@Test public void testAddObectSpecificData() throws Exception { HttpServletRequest request = mock(HttpServletRequest.class); context.turnOffAuthorisationSystem(); Community community = CommunityBuilder.createCommunity(context).build(); Collection collection = CollectionBuilder.createCollection(context, community).build(); Item item = ItemBuilder.createItem(context, collection).build(); File f = new File(testProps.get("test.bitstream").toString()); Bitstream bitstream = BitstreamBuilder.createBitstream(context, item, new FileInputStream(f)).build(); context.restoreAuthSystemState(); BitstreamEventProcessor bitstreamEventProcessor = new BitstreamEventProcessor(context, request, bitstream); String result = bitstreamEventProcessor.addObjectSpecificData("existing-string", bitstream); assertThat(result, is("existing-string&svc_dat=" + encodedUrl + "%2Fapi%2Fcore%2Fbitstreams%2F" + bitstream.getID() + "%2Fcontent&rft_dat=Request")); }
protected String addObjectSpecificData(final String string, Bitstream bitstream) throws UnsupportedEncodingException { StringBuilder data = new StringBuilder(string); String bitstreamInfo = getBitstreamInfo(bitstream); data.append("&").append(URLEncoder.encode("svc_dat", UTF_8)).append("=") .append(URLEncoder.encode(bitstreamInfo, UTF_8)); data.append("&").append(URLEncoder.encode("rft_dat", UTF_8)).append("=") .append(URLEncoder.encode(BITSTREAM_DOWNLOAD, UTF_8)); return data.toString(); }
BitstreamEventProcessor extends ExportEventProcessor { protected String addObjectSpecificData(final String string, Bitstream bitstream) throws UnsupportedEncodingException { StringBuilder data = new StringBuilder(string); String bitstreamInfo = getBitstreamInfo(bitstream); data.append("&").append(URLEncoder.encode("svc_dat", UTF_8)).append("=") .append(URLEncoder.encode(bitstreamInfo, UTF_8)); data.append("&").append(URLEncoder.encode("rft_dat", UTF_8)).append("=") .append(URLEncoder.encode(BITSTREAM_DOWNLOAD, UTF_8)); return data.toString(); } }
BitstreamEventProcessor extends ExportEventProcessor { protected String addObjectSpecificData(final String string, Bitstream bitstream) throws UnsupportedEncodingException { StringBuilder data = new StringBuilder(string); String bitstreamInfo = getBitstreamInfo(bitstream); data.append("&").append(URLEncoder.encode("svc_dat", UTF_8)).append("=") .append(URLEncoder.encode(bitstreamInfo, UTF_8)); data.append("&").append(URLEncoder.encode("rft_dat", UTF_8)).append("=") .append(URLEncoder.encode(BITSTREAM_DOWNLOAD, UTF_8)); return data.toString(); } BitstreamEventProcessor(Context context, HttpServletRequest request, Bitstream bitstream); }
BitstreamEventProcessor extends ExportEventProcessor { protected String addObjectSpecificData(final String string, Bitstream bitstream) throws UnsupportedEncodingException { StringBuilder data = new StringBuilder(string); String bitstreamInfo = getBitstreamInfo(bitstream); data.append("&").append(URLEncoder.encode("svc_dat", UTF_8)).append("=") .append(URLEncoder.encode(bitstreamInfo, UTF_8)); data.append("&").append(URLEncoder.encode("rft_dat", UTF_8)).append("=") .append(URLEncoder.encode(BITSTREAM_DOWNLOAD, UTF_8)); return data.toString(); } BitstreamEventProcessor(Context context, HttpServletRequest request, Bitstream bitstream); void processEvent(); }
BitstreamEventProcessor extends ExportEventProcessor { protected String addObjectSpecificData(final String string, Bitstream bitstream) throws UnsupportedEncodingException { StringBuilder data = new StringBuilder(string); String bitstreamInfo = getBitstreamInfo(bitstream); data.append("&").append(URLEncoder.encode("svc_dat", UTF_8)).append("=") .append(URLEncoder.encode(bitstreamInfo, UTF_8)); data.append("&").append(URLEncoder.encode("rft_dat", UTF_8)).append("=") .append(URLEncoder.encode(BITSTREAM_DOWNLOAD, UTF_8)); return data.toString(); } BitstreamEventProcessor(Context context, HttpServletRequest request, Bitstream bitstream); void processEvent();  }