本文整理汇总了Java中org.jboss.resteasy.mock.MockHttpResponse类的典型用法代码示例。如果您正苦于以下问题:Java MockHttpResponse类的具体用法?Java MockHttpResponse怎么用?Java MockHttpResponse使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
MockHttpResponse类属于org.jboss.resteasy.mock包,在下文中一共展示了MockHttpResponse类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testGetOdmOpenEpic
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
@Test
public void testGetOdmOpenEpic() {
MockHttpRequest request = null;
try {
request = MockHttpRequest.get(
"/fhir/patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB/odm?project_id=29&instrument=usciit_prep_flu_study&group_id=2&encounter_start=2016-04-18&encounter_end=2016-04-20");
} catch (URISyntaxException e) {
fail(e.getMessage());
}
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
assertTrue(response.getContentAsString().contains("Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB"));
}
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:17,代码来源:FhirServiceIT.java
示例2: testGetPatientHapi
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
@Test
public void testGetPatientHapi() {
MockHttpRequest request = null;
try {
request = MockHttpRequest.get("/fhir/patient/fhirTest?group_id=4");
//http://fhirtest.uhn.ca/baseDstu2/Patient?_id=fhirTest
} catch (URISyntaxException e) {
fail(e.getMessage());
}
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
assertTrue(response.getContentAsString().contains("fhirTest"));
}
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:17,代码来源:FhirServiceIT.java
示例3: testGetPatientOpenEpic
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
@Test
public void testGetPatientOpenEpic() {
MockHttpRequest request = null;
try {
request = MockHttpRequest.get("/fhir/patient/Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB?group_id=2");
//https://open-ic.epic.com/FHIR/api/FHIR/DSTU2/Patient?_id=Tbt3KuCY0B5PSrJvCu2j-PlK.aiHsu2xUjUM8bWpetXoB
} catch (URISyntaxException e) {
fail(e.getMessage());
}
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
assertTrue(response.getContentAsString().contains("Argonaut, Jason"));
}
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:17,代码来源:FhirServiceIT.java
示例4: testGetOdmHapi
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
@Test
public void testGetOdmHapi() {
MockHttpRequest request = null;
try {
request = MockHttpRequest.get(
"/fhir/patient/fhirTest/odm?project_id=29&instrument=usciit_prep_flu_study&group_id=4&encounter_start=2016-05-29T09:00:00&encounter_end=2016-06-20");
} catch (URISyntaxException e) {
fail(e.getMessage());
}
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
assertEquals(HttpServletResponse.SC_OK, response.getStatus());
assertTrue(response.getContentAsString().contains("fhirTest"));
}
开发者ID:Discovery-Research-Network-SCCM,项目名称:FHIR-CQL-ODM-service,代码行数:17,代码来源:FhirServiceIT.java
示例5: testSendingHttpRequest
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
@Test
public void testSendingHttpRequest() throws Exception {
MockHttpRequest request = MockHttpRequest.post("/rest").contentType(MediaType.APPLICATION_XML_TYPE);
MockHttpResponse response = new MockHttpResponse();
Person person = new Person();
person.setAge(25);
StringWriter writer = new StringWriter();
context.createMarshaller().marshal(person, writer);
request.content(writer.toString().getBytes());
dispatcher.invoke(request, response);
assertThat(response.getStatus(), is(Response.Status.OK.getStatusCode()));
assertThat(response.getContentAsString(), is("true"));
}
开发者ID:gtudan,项目名称:camel-cdi-drools-test,代码行数:19,代码来源:RestEndpointTest.java
示例6: get
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
private ContentTypeHelper get(String uri, String acceptHeader) throws Exception {
MockHttpRequest req = MockHttpRequest.get(uri);
MockHttpResponse res = new MockHttpResponse();
RequestImpl restReq = new RequestImpl(req, res);
if (acceptHeader != null) {
req = req.header(HttpHeaders.ACCEPT, acceptHeader);
}
return new ContentTypeHelper(req, restReq, req.getUri());
}
开发者ID:Doccrazy,项目名称:keycloak-protocol-cas,代码行数:12,代码来源:ContentTypeHelperTest.java
示例7: invoke
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
@Override
public ClientResponse invoke(ClientInvocation request) {
MockHttpRequest mockRequest = createRequest(request);
MockHttpResponse mockResponse = new MockHttpResponse();
dispatcher.invoke(mockRequest, mockResponse);
return createResponse(request, mockResponse);
}
开发者ID:tbroyer,项目名称:jaxrs-utils,代码行数:10,代码来源:InProcessClientHttpEngine.java
示例8: createResponse
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
private ClientResponse createResponse(
final ClientInvocation request, final MockHttpResponse mockResponse) {
ClientResponse response =
new ClientResponse(request.getClientConfiguration()) {
private InputStream inputStream;
@Override
protected InputStream getInputStream() {
if (inputStream == null) {
inputStream = new ByteArrayInputStream(mockResponse.getOutput());
}
return inputStream;
}
@Override
protected void setInputStream(InputStream is) {
inputStream = is;
}
@Override
public void releaseConnection() throws IOException {
// no-op
}
};
response.setStatus(mockResponse.getStatus());
response.setHeaders(
transformHeaders(mockResponse.getOutputHeaders(), mockResponse.getNewCookies()));
return response;
}
开发者ID:tbroyer,项目名称:jaxrs-utils,代码行数:32,代码来源:InProcessClientHttpEngine.java
示例9: invoke
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
public HttpResponse invoke(HttpRequest request) {
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
return response;
}
开发者ID:redsaz,项目名称:deciservice,代码行数:6,代码来源:BaseResourceTest.java
示例10: executeRequest
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
private JaxrsResponse executeRequest(MockHttpRequest request) {
MockHttpResponse response = new MockHttpResponse();
dispatcher.invoke(request, response);
return new RestEasyResponse(response);
}
开发者ID:binout,项目名称:jaxrs-unit,代码行数:6,代码来源:RestEasyResource.java
示例11: RestEasyResponse
import org.jboss.resteasy.mock.MockHttpResponse; //导入依赖的package包/类
RestEasyResponse(MockHttpResponse mockResponse) {
this.mockResponse = mockResponse;
}
开发者ID:binout,项目名称:jaxrs-unit,代码行数:4,代码来源:RestEasyResponse.java
注:本文中的org.jboss.resteasy.mock.MockHttpResponse类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论