当前位置: 首页>>代码示例>>Java>>正文


Java MultivaluedMapImpl类代码示例

本文整理汇总了Java中org.jboss.resteasy.specimpl.MultivaluedMapImpl的典型用法代码示例。如果您正苦于以下问题:Java MultivaluedMapImpl类的具体用法?Java MultivaluedMapImpl怎么用?Java MultivaluedMapImpl使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


MultivaluedMapImpl类属于org.jboss.resteasy.specimpl包,在下文中一共展示了MultivaluedMapImpl类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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


注:本文中的org.jboss.resteasy.specimpl.MultivaluedMapImpl类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。