本文整理汇总了Java中org.jboss.resteasy.specimpl.MultivaluedMapImpl类的典型用法代码示例。如果您正苦于以下问题:Java MultivaluedMapImpl类的具体用法?Java MultivaluedMapImpl怎么用?Java MultivaluedMapImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MultivaluedMapImpl类属于org.jboss.resteasy.specimpl包,在下文中一共展示了MultivaluedMapImpl类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testSecurityAnalysisCsv
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void testSecurityAnalysisCsv() {
MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class);
Map<String, List<InputPart>> formValues = new HashMap<>();
formValues.put("format", Collections.singletonList(new InputPartImpl("CSV", MediaType.TEXT_PLAIN_TYPE)));
formValues.put("limit-types", Collections.singletonList(new InputPartImpl("CURRENT", MediaType.TEXT_PLAIN_TYPE)));
MultivaluedMap<String, String> headers = new MultivaluedMapImpl<>();
headers.putSingle("Content-Disposition", "filename=" + "case-file.xiidm");
formValues.put("case-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("Network".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers)));
MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>();
headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv");
formValues.put("contingencies-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("contingencies".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2)));
when(dataInput.getFormDataMap()).thenReturn(formValues);
Response res = service.analyze(dataInput);
Assert.assertEquals(200, res.getStatus());
}
开发者ID:itesla,项目名称:ipst,代码行数:26,代码来源:SecurityWsTest.java
示例2: testWrongFormat
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void testWrongFormat() {
MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class);
Map<String, List<InputPart>> formValues = new HashMap<>();
formValues.put("format", Collections.singletonList(new InputPartImpl("ERR", MediaType.TEXT_PLAIN_TYPE)));
formValues.put("limit-types", Collections.singletonList(new InputPartImpl("CURRENT", MediaType.TEXT_PLAIN_TYPE)));
MultivaluedMap<String, String> headers = new MultivaluedMapImpl<>();
headers.putSingle("Content-Disposition", "filename=" + "case-file.xiidm.gz");
formValues.put("case-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("Network".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers)));
MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>();
headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv");
formValues.put("contingencies-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("contingencies".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2)));
when(dataInput.getFormDataMap()).thenReturn(formValues);
Response res = service.analyze(dataInput);
Assert.assertEquals(400, res.getStatus());
}
开发者ID:itesla,项目名称:ipst,代码行数:27,代码来源:SecurityWsTest.java
示例3: testMissingFormat
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void testMissingFormat() {
MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class);
Map<String, List<InputPart>> formValues = new HashMap<>();
formValues.put("limit-types", Collections.singletonList(new InputPartImpl("HIGH_VOLTAGE,CURRENT", MediaType.TEXT_PLAIN_TYPE)));
MultivaluedMap<String, String> headers = new MultivaluedMapImpl<>();
headers.putSingle("Content-Disposition", "filename=" + "case-file.xiidm.gz");
formValues.put("case-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("Network".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers)));
MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>();
headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv");
formValues.put("contingencies-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("contingencies".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2)));
when(dataInput.getFormDataMap()).thenReturn(formValues);
Response res = service.analyze(dataInput);
Assert.assertEquals(400, res.getStatus());
}
开发者ID:itesla,项目名称:ipst,代码行数:26,代码来源:SecurityWsTest.java
示例4: testMissingCaseFile
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void testMissingCaseFile() {
MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class);
Map<String, List<InputPart>> formValues = new HashMap<>();
formValues.put("format", Collections.singletonList(new InputPartImpl("JSON", MediaType.TEXT_PLAIN_TYPE)));
formValues.put("limit-types", Collections.singletonList(new InputPartImpl("CURRENT", MediaType.TEXT_PLAIN_TYPE)));
MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>();
headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv");
formValues.put("contingencies-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("contingencies".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2)));
when(dataInput.getFormDataMap()).thenReturn(formValues);
Response res = service.analyze(dataInput);
Assert.assertEquals(400, res.getStatus());
}
开发者ID:itesla,项目名称:ipst,代码行数:20,代码来源:SecurityWsTest.java
示例5: response
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void response() throws IOException {
final String key = UUID.randomUUID().toString();
final String key2 = UUID.randomUUID().toString();
final String value = UUID.randomUUID().toString();
final MultivaluedMap<String, String> map = new MultivaluedMapImpl<>();
map.add(key, value);
map.addAll(key2, Collections.emptyList());
final ClientRequestContext ctx = Mockito.mock(ClientRequestContext.class);
final ClientResponseContext ctx2 = Mockito.mock(ClientResponseContext.class);
Mockito.when(ctx2.getHeaders()).thenReturn(map);
Mockito.when(ctx2.getStatusInfo()).thenReturn(Mockito.mock(Response.StatusType.class));
final RoboZonkyFilter filter = new RoboZonkyFilter();
filter.filter(ctx, ctx2);
SoftAssertions.assertSoftly(softly -> {
softly.assertThat(filter.getLastResponseHeader(key)).contains(value);
softly.assertThat(filter.getLastResponseHeader(key2)).isEmpty();
});
}
开发者ID:RoboZonky,项目名称:robozonky,代码行数:20,代码来源:RoboZonkyFilterTest.java
示例6: getResourceOrCollection
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
private void getResourceOrCollection(String path, List <String> accepts, String typeResponse, int statusResponse)
throws URISyntaxException {
MultivaluedMap <String, String> acceptHeader = new MultivaluedMapImpl<>();
acceptHeader.put("Accept", accepts);
HttpHeaders headers = new ResteasyHttpHeaders(acceptHeader);
UriInfo uriInfo = new ResteasyUriInfo(new URI("http://localhost:8080/FiwareRepository/v2/collec/"+path),
new URI("http://localhost:8080/FiwareRepository/v2/"));
Response response = toTest.getResource(uriInfo, headers, path);
if (typeResponse != null) {
assertEquals(typeResponse, response.getMediaType().toString());
}
assertEquals(statusResponse, response.getStatus());
}
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:17,代码来源:CollectionServiceTest.java
示例7: getResourceMeta
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
private void getResourceMeta(String path, List <String> accepts, String typeResponse, int statusResponse)
throws URISyntaxException {
MultivaluedMap <String, String> acceptHeader = new MultivaluedMapImpl<>();
acceptHeader.put("Accept", accepts);
HttpHeaders headers = new ResteasyHttpHeaders(acceptHeader);
UriInfo uriInfo = new ResteasyUriInfo(new URI("http://localhost:8080/FiwareRepository/v2/collec/"+path+".meta"),
new URI("http://localhost:8080/FiwareRepository/v2/"));
Response response = toTest.getResourceMeta(uriInfo, headers, path);
if (typeResponse != null) {
assertEquals(typeResponse, response.getMediaType().toString());
}
assertEquals(statusResponse, response.getStatus());
}
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:17,代码来源:CollectionServiceTest.java
示例8: obtainResourceOKTest
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void obtainResourceOKTest() {
Response returned;
String path = "path";
String type = "application/rdf+xml";
Resource resource = new Resource();
resource.setContent("resourceContent".getBytes());
List <String> accepts = new LinkedList();
accepts.add(type);
MultivaluedMap <String, String> acceptHeader = new MultivaluedMapImpl<>();
acceptHeader.put("Accept", accepts);
HttpHeaders headers = new ResteasyHttpHeaders(acceptHeader);
try {
when(virtuosoResourceDAO.getResource(path, RestHelper.typeMap.get(type))).thenReturn(resource);
} catch (DatasourceException ex) {
fail(ex.getLocalizedMessage());
}
returned = toTest.obtainResource(headers, path);
assertEquals(200, returned.getStatus());
assertEquals(resource.getContent(), returned.getEntity());
}
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:27,代码来源:QueryServiceTest.java
示例9: obtainResourceAnyMediaTypeTest
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void obtainResourceAnyMediaTypeTest() {
Response returned;
String path = "path";
String type = "*/*";
Resource resource = new Resource();
resource.setContent("resourceContent".getBytes());
List <String> accepts = new LinkedList();
accepts.add(type);
MultivaluedMap <String, String> acceptHeader = new MultivaluedMapImpl<>();
acceptHeader.put("Accept", accepts);
HttpHeaders headers = new ResteasyHttpHeaders(acceptHeader);
try {
when(virtuosoResourceDAO.getResource(path, RestHelper.typeMap.get(RestHelper.RdfDefaultType))).thenReturn(resource);
} catch (DatasourceException ex) {
fail(ex.getLocalizedMessage());
}
returned = toTest.obtainResource(headers, path);
assertEquals(200, returned.getStatus());
assertEquals(resource.getContent(), returned.getEntity());
}
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:27,代码来源:QueryServiceTest.java
示例10: obtainResourceNotFoundTest
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void obtainResourceNotFoundTest() {
Response returned;
String path = "path";
String type = "application/rdf+xml";
List <String> accepts = new LinkedList();
accepts.add(type);
MultivaluedMap <String, String> acceptHeader = new MultivaluedMapImpl<>();
acceptHeader.put("Accept", accepts);
HttpHeaders headers = new ResteasyHttpHeaders(acceptHeader);
try {
when(virtuosoResourceDAO.getResource(path, RestHelper.typeMap.get(type))).thenReturn(null);
} catch (DatasourceException ex) {
fail(ex.getLocalizedMessage());
}
returned = toTest.obtainResource(headers, path);
assertEquals(404, returned.getStatus());
}
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:24,代码来源:QueryServiceTest.java
示例11: obtainResourceNotAcceptableTest
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void obtainResourceNotAcceptableTest() {
Response returned;
String path = "path";
String type = "test/fail";
List <String> accepts = new LinkedList();
accepts.add(type);
MultivaluedMap <String, String> acceptHeader = new MultivaluedMapImpl<>();
acceptHeader.put("Accept", accepts);
HttpHeaders headers = new ResteasyHttpHeaders(acceptHeader);
try {
when(virtuosoResourceDAO.getResource(path, RestHelper.typeMap.get(type))).thenReturn(null);
} catch (DatasourceException ex) {
fail(ex.getLocalizedMessage());
}
returned = toTest.obtainResource(headers, path);
assertEquals(NOT_ACCEPTABLE, returned.getStatus());
}
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:24,代码来源:QueryServiceTest.java
示例12: obtainResourceErrorTest
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void obtainResourceErrorTest() {
Response returned;
String path = "path";
String type = "application/rdf+xml";
List <String> accepts = new LinkedList();
accepts.add(type);
MultivaluedMap <String, String> acceptHeader = new MultivaluedMapImpl<>();
acceptHeader.put("Accept", accepts);
HttpHeaders headers = new ResteasyHttpHeaders(acceptHeader);
try {
when(virtuosoResourceDAO.getResource(path, RestHelper.typeMap.get(type))).thenThrow(DatasourceException.class);
} catch (DatasourceException ex) {
fail(ex.getLocalizedMessage());
}
returned = toTest.obtainResource(headers, path);
assertEquals(500, returned.getStatus());
}
开发者ID:conwetlab,项目名称:Repository-RI,代码行数:24,代码来源:QueryServiceTest.java
示例13: feed_errorhandling_3
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void feed_errorhandling_3() throws IOException, URISyntaxException {
FeedRestService tested = getTested();
// case - error handling for index not found exception
{
Mockito.reset(tested.querySettingsParser, tested.searchService);
UriInfo uriInfo = Mockito.mock(UriInfo.class);
MultivaluedMap<String, String> qp = new MultivaluedMapImpl<String, String>();
Mockito.when(uriInfo.getQueryParameters()).thenReturn(qp);
QuerySettings qs = new QuerySettings();
Mockito.when(tested.querySettingsParser.parseUriParams(qp)).thenReturn(qs);
Mockito.when(
tested.searchService.performSearch(Mockito.eq(qs), Mockito.notNull(String.class),
Mockito.eq(StatsRecordType.FEED))).thenThrow(new IndexMissingException(null));
Object response = tested.feed(uriInfo);
TestUtils.assertResponseStatus(response, Status.NOT_FOUND);
}
}
开发者ID:searchisko,项目名称:searchisko,代码行数:20,代码来源:FeedRestServiceTest.java
示例14: feed_errorhandling_4
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test(expected = RuntimeException.class)
public void feed_errorhandling_4() throws IOException, URISyntaxException {
FeedRestService tested = getTested();
// case - error handling for other exceptions
{
Mockito.reset(tested.querySettingsParser, tested.searchService);
UriInfo uriInfo = Mockito.mock(UriInfo.class);
MultivaluedMap<String, String> qp = new MultivaluedMapImpl<String, String>();
Mockito.when(uriInfo.getQueryParameters()).thenReturn(qp);
QuerySettings qs = new QuerySettings();
Mockito.when(tested.querySettingsParser.parseUriParams(qp)).thenReturn(qs);
Mockito.when(
tested.searchService.performSearch(Mockito.eq(qs), Mockito.notNull(String.class),
Mockito.eq(StatsRecordType.FEED))).thenThrow(new RuntimeException());
tested.feed(uriInfo);
}
}
开发者ID:searchisko,项目名称:searchisko,代码行数:19,代码来源:FeedRestServiceTest.java
示例15: testSecurityAnalysisJson
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void testSecurityAnalysisJson() {
MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class);
Map<String, List<InputPart>> formValues = new HashMap<>();
formValues.put("format", Collections.singletonList(new InputPartImpl("JSON", MediaType.TEXT_PLAIN_TYPE)));
formValues.put("limit-types", Collections.singletonList(new InputPartImpl("CURRENT", MediaType.TEXT_PLAIN_TYPE)));
MultivaluedMap<String, String> headers = new MultivaluedMapImpl<>();
headers.putSingle("Content-Disposition", "filename=" + "case-file.xiidm");
formValues.put("case-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("Network".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers)));
MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>();
headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv");
formValues.put("contingencies-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("contingencies".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2)));
when(dataInput.getFormDataMap()).thenReturn(formValues);
Response res = service.analyze(dataInput);
Assert.assertEquals(200, res.getStatus());
}
开发者ID:itesla,项目名称:ipst,代码行数:28,代码来源:SecurityWsTest.java
示例16: testWrongLimits
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void testWrongLimits() {
MultipartFormDataInput dataInput = mock(MultipartFormDataInput.class);
Map<String, List<InputPart>> formValues = new HashMap<>();
formValues.put("format", Collections.singletonList(new InputPartImpl("JSON", MediaType.TEXT_PLAIN_TYPE)));
formValues.put("limit-types", Collections.singletonList(new InputPartImpl("ERRR", MediaType.TEXT_PLAIN_TYPE)));
MultivaluedMap<String, String> headers = new MultivaluedMapImpl<>();
headers.putSingle("Content-Disposition", "filename=" + "case-file.xiidm.gz");
formValues.put("case-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("Network".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers)));
MultivaluedMap<String, String> headers2 = new MultivaluedMapImpl<>();
headers2.putSingle("Content-Disposition", "filename=" + "contingencies-file.csv");
formValues.put("contingencies-file",
Collections.singletonList(new InputPartImpl(
new ByteArrayInputStream("contingencies".getBytes()),
MediaType.APPLICATION_OCTET_STREAM_TYPE, headers2)));
when(dataInput.getFormDataMap()).thenReturn(formValues);
Response res = service.analyze(dataInput);
Assert.assertEquals(400, res.getStatus());
}
开发者ID:itesla,项目名称:ipst,代码行数:28,代码来源:SecurityWsTest.java
示例17: changes400to401
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void changes400to401() throws IOException {
final int expectedCode = 400;
final ClientRequestContext ctx = Mockito.mock(ClientRequestContext.class);
final ClientResponseContext ctx2 = Mockito.mock(ClientResponseContext.class);
final ZonkyApiToken token = new ZonkyApiToken("", "", 299);
Mockito.when(ctx2.hasEntity()).thenReturn(true);
Mockito.when(ctx2.getHeaders()).thenReturn(new MultivaluedMapImpl<>());
Mockito.when(ctx2.getEntityStream()).thenReturn(c(token));
Mockito.when(ctx2.getStatusInfo()).thenReturn(Response.Status.fromStatusCode(expectedCode));
Mockito.when(ctx2.getStatus()).thenReturn(expectedCode);
final RoboZonkyFilter filter = new AuthenticatedFilter(token);
filter.filter(ctx, ctx2);
Mockito.verify(ctx2, Mockito.times(1)).setStatus(401);
}
开发者ID:RoboZonky,项目名称:robozonky,代码行数:16,代码来源:AuthenticatedFilterTest.java
示例18: userAgent
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void userAgent() throws IOException {
final MultivaluedMap<String, Object> map = new MultivaluedMapImpl<>();
final ClientRequestContext ctx = Mockito.mock(ClientRequestContext.class);
Mockito.when(ctx.getHeaders()).thenReturn(map);
new RoboZonkyFilter().filter(ctx);
Assertions.assertThat(map.get("User-Agent").get(0)).isEqualTo(Defaults.ROBOZONKY_USER_AGENT);
}
开发者ID:RoboZonky,项目名称:robozonky,代码行数:9,代码来源:RoboZonkyFilterTest.java
示例19: before
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Before
public void before() {
converter = new QuerySearchConverter() {
@Override
protected Search.Builder getBuilder() {
return new Search.Builder() {
@Override
protected List<String> getSupportedSortAttributes() {
return ImmutableList.of("test:test", "test:test1_abc");
}
@Override
protected Multimap<String, Operator> getSupportedConditions() {
return ImmutableMultimap.of("test:test", Operator.EQ, "test:test1_abc", Operator.EQ);
}
};
}
@Override
protected ImmutableBiMap<String, String> getQueryAttributeMap() {
return ImmutableBiMap.of("test", "test:test", "test1_abc", "test:test1_abc");
}
@Override
protected boolean isDateAttribute(String attribute) {
return false;
}
};
multivaluedMap = new MultivaluedMapImpl<>();
}
开发者ID:projectomakase,项目名称:omakase,代码行数:31,代码来源:QuerySearchConverterTest.java
示例20: shouldConvertQueryToSearchNoErrorCondition
import org.jboss.resteasy.specimpl.MultivaluedMapImpl; //导入依赖的package包/类
@Test
public void shouldConvertQueryToSearchNoErrorCondition() throws Exception {
MultivaluedMap<String, String> multivaluedMap = new MultivaluedMapImpl<>();
multivaluedMap.add("timestamp[eq]", "2015-05-01");
Search actualSearch = converter.from(multivaluedMap);
assertThat(actualSearch.getSearchConditions()).usingFieldByFieldElementComparator().containsExactly(new SearchCondition("jcr:created", Operator.EQ, "2015-05-01", true));
MessageSearchBuilder messageSearchBuilder = new MessageSearchBuilder();
assertThat(actualSearch).isEqualToIgnoringGivenFields(messageSearchBuilder.build(), "searchConditions");
}
开发者ID:projectomakase,项目名称:omakase,代码行数:11,代码来源:MessageQuerySearchConverterTest.java
注:本文中的org.jboss.resteasy.specimpl.MultivaluedMapImpl类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论