public T setReturn(T name, String[] value) throws IllegalArgumentException, IllegalStateException { set(name, value); return name; }
public T setReturn(T name, String value) throws IllegalArgumentException, IllegalStateException { set(name, value); return name; }
public T setReturn(T name, String[] value) throws IllegalArgumentException, IllegalStateException { set(name, value); return name; }
public T setReturn(T name, String value) throws IllegalArgumentException, IllegalStateException { set(name, value); return name; }
/** * This method covers the totally bogus Exception that is thrown by * MultiValueMap.set(), and wraps it in an IllegalArgumentException, which * is more appropriate. * @param <T> */ private <T> void storeInMap(MultiValueMap<T> map, T key, String[] values) { try { map.set(key, values); } catch (Exception e) { throw new IllegalArgumentException(e); } }
/** * This method covers the totally bogus Exception that is thrown by * MultiValueMap.set(), and wraps it in an IllegalArgumentException, which * is more appropriate. * @param <T> */ private <T> void storeInMap(MultiValueMap<T> map, T key, String[] values) { try { map.set(key, values); } catch (Exception e) { throw new IllegalArgumentException(e); } }
/** * This method is just to guard against the totally bogus Exception * declaration in MultiValueMap.set() */ private void storeInMultiMap(MultiValueMap<String> map, String key, String[] values) throws JournalException { try { map.set(key, values); } catch (Exception e) { // totally bogus Exception here. throw new JournalException(e); } }
/** * This method is just to guard against the totally bogus Exception * declaration in MultiValueMap.set() */ private void storeInMultiMap(MultiValueMap<String> map, String key, String[] values) throws JournalException { try { map.set(key, values); } catch (Exception e) { // totally bogus Exception here. throw new JournalException(e); } }
private static final MultiValueMap<URI> beginEnvironmentMap(String messageProtocol) throws Exception { MultiValueMap<URI> environmentMap = new MultiValueMap<URI>(); environmentMap.set(Constants.HTTP_REQUEST.MESSAGE_PROTOCOL.attributeId, messageProtocol); Date now = new Date(); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE_TIME.attributeId, DateUtility.convertDateToString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE.attributeId, DateUtility .convertDateToDateString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_TIME.attributeId, DateUtility .convertDateToTimeString(now)); return environmentMap; }
private static final MultiValueMap<URI> beginEnvironmentMap(String messageProtocol) throws Exception { MultiValueMap<URI> environmentMap = new MultiValueMap<URI>(); environmentMap.set(Constants.HTTP_REQUEST.MESSAGE_PROTOCOL.attributeId, messageProtocol); Date now = new Date(); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE_TIME.attributeId, DateUtility.convertDateToString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE.attributeId, DateUtility .convertDateToDateString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_TIME.attributeId, DateUtility .convertDateToTimeString(now)); return environmentMap; }
private static final MultiValueMap<URI> beginEnvironmentMap(String messageProtocol) { MultiValueMap<URI> environmentMap = new MultiValueMap<URI>(); try { environmentMap.set(Constants.HTTP_REQUEST.MESSAGE_PROTOCOL.attributeId, messageProtocol); Date now = new Date(); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE_TIME.attributeId, DateUtility.convertDateToString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_DATE.attributeId, DateUtility .convertDateToDateString(now)); environmentMap.set(Constants.ENVIRONMENT.CURRENT_TIME.attributeId, DateUtility .convertDateToTimeString(now)); } catch (Exception e) { logger.warn("Datastream could not set envAttributes for checksum context"); } return environmentMap; }
private MultiValueMap<URI> convertStringMap(MultiValueMap<String> input) { MultiValueMap<URI> result = new MultiValueMap<URI>(); for (Iterator<String> names = input.names(); names.hasNext();) { String name = names.next(); result.set(URI.create(name), input.getStringArray(name)); } return result; }
private MultiValueMap<URI> convertStringMap(MultiValueMap<String> input) { MultiValueMap<URI> result = new MultiValueMap<URI>(); for (Iterator<String> names = input.names(); names.hasNext();) { String name = names.next(); result.set(URI.create(name), input.getStringArray(name)); } return result; }
private static MultiValueMap<String> buildMultiMap(String[][] pairs) { MultiValueMap<String> map = new MultiValueMap<String>(); for (String[] pair : pairs) { map.set(pair[0], pair[1]); } return map; }
private static MultiValueMap<URI> buildUriMultiMap(String[][] pairs) { MultiValueMap<URI> map = new MultiValueMap<URI>(); for (String[] pair : pairs) { map.set(URI.create(pair[0]), pair[1]); } return map; }
private <T> MultiValueMap<T> createMap(T key, String[] value) { MultiValueMap<T> map = new MultiValueMap<T>(); map.set(key, value); return map; }
private MultiValueMap<String> createMap(String[][] key_value) { MultiValueMap<String> map = new MultiValueMap<String>(); for (String[] pair: key_value){ map.set(pair[0], pair[1]); } return map; }
/** * The {@link #expectedContext} should be like the {@link #leadingContext}, * with the addition of anything we expect the management method to add. */ private void loadExpectedContext() { expectedContext = new JournalEntryContext(leadingContext); for (Map.Entry<RDFName, String[]> entry : contextAdditions.entrySet()) { expectedContext.getRecoveryAttributes().set(entry.getKey().attributeId, entry.getValue()); } }
@Test public void testCachedDatastreamDissemination() throws Exception { DatastreamManagedContent ds = mockDatastream(); when(mockReader.GetDatastream(any(String.class), any(Date.class))).thenReturn(ds); Context context = getContext(); // header names are stored and compared lower-cased in ReadOnlyContext context.getHeaders().set(HttpHeaders.IF_NONE_MATCH.toLowerCase(), TEST_ETAG_CHECKSUM); MIMETypedStream output = test.getDatastreamDissemination(context, TEST_PID, TEST_DSID, null); assertEquals(HttpStatus.SC_NOT_MODIFIED, output.getStatusCode()); }
@Test public void testPartialDatastreamDissemination() throws Exception { DatastreamManagedContent ds = mockDatastream("0123456789abcdef"); when(mockReader.GetDatastream(any(String.class), any(Date.class))).thenReturn(ds); Context context = getContext(); // header names are stored and compared lower-cased in ReadOnlyContext context.getHeaders().set(HttpHeaders.RANGE.toLowerCase(), "bytes=0-12"); MIMETypedStream output = test.getDatastreamDissemination(context, TEST_PID, TEST_DSID, null); assertEquals(13l,output.getSize()); assertEquals("0123456789abc", IOUtils.toString(output.getStream())); assertEquals(HttpStatus.SC_PARTIAL_CONTENT, output.getStatusCode()); }