本文整理汇总了Java中ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor.setLogResponseBody方法的典型用法代码示例。如果您正苦于以下问题:Java LoggingInterceptor.setLogResponseBody方法的具体用法?Java LoggingInterceptor.setLogResponseBody怎么用?Java LoggingInterceptor.setLogResponseBody使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor
的用法示例。
在下文中一共展示了LoggingInterceptor.setLogResponseBody方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testConformance
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
@Test
public void testConformance() throws Exception {
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setLogResponseBody(true);
myFhirClient.registerInterceptor(loggingInterceptor);
CapabilityStatement p = myFhirClient.fetchConformance().ofType(CapabilityStatement.class).prettyPrint().execute();
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(p));
List<CapabilityStatementRestOperationComponent> ops = p.getRest().get(0).getOperation();
assertThat(ops.size(), greaterThan(1));
List<String> opNames = toOpNames(ops);
assertThat(opNames, containsInRelativeOrder("OP_TYPE"));
// OperationDefinition def = (OperationDefinition) ops.get(opNames.indexOf("OP_TYPE")).getDefinition().getResource();
OperationDefinition def = myFhirClient.read().resource(OperationDefinition.class).withId(ops.get(opNames.indexOf("OP_TYPE")).getDefinition().getReferenceElement()).execute();
assertEquals("OP_TYPE", def.getCode());
}
示例2: testConformance
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
@Test
public void testConformance() throws Exception {
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setLogResponseBody(true);
myFhirClient.registerInterceptor(loggingInterceptor);
Conformance p = myFhirClient.fetchConformance().ofType(Conformance.class).prettyPrint().execute();
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(p));
List<ConformanceRestOperationComponent> ops = p.getRest().get(0).getOperation();
assertThat(ops.size(), greaterThan(1));
List<String> opNames = toOpNames(ops);
assertThat(opNames, containsInRelativeOrder("OP_TYPE"));
// OperationDefinition def = (OperationDefinition) ops.get(opNames.indexOf("OP_TYPE")).getDefinition().getResource();
OperationDefinition def = myFhirClient.read().resource(OperationDefinition.class).withId(ops.get(opNames.indexOf("OP_TYPE")).getDefinition().getReferenceElement()).execute();
assertEquals("OP_TYPE", def.getCode());
}
示例3: testConformance
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
@Test
public void testConformance() throws Exception {
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setLogResponseBody(true);
myFhirClient.registerInterceptor(loggingInterceptor);
CapabilityStatement p = myFhirClient.fetchConformance().ofType(CapabilityStatement.class).prettyPrint().execute();
ourLog.info(ourCtx.newXmlParser().setPrettyPrint(true).encodeResourceToString(p));
List<CapabilityStatement.CapabilityStatementRestResourceOperationComponent> ops = p.getRest().get(0).getOperation();
assertThat(ops.size(), greaterThan(1));
List<String> opNames = toOpNames(ops);
assertThat(opNames, containsInRelativeOrder("OP_TYPE"));
// OperationDefinition def = (OperationDefinition) ops.get(opNames.indexOf("OP_TYPE")).getDefinition().getResource();
OperationDefinition def = myFhirClient.read().resource(OperationDefinition.class).withId(ops.get(opNames.indexOf("OP_TYPE")).getDefinition().getReferenceElement()).execute();
assertEquals("OP_TYPE", def.getCode());
}
示例4: testConformance
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
@Test
public void testConformance() throws Exception {
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setLogResponseBody(true);
myFhirClient.registerInterceptor(loggingInterceptor);
Conformance p = myFhirClient.fetchConformance().ofType(Conformance.class).prettyPrint().execute();
List<RestOperation> ops = p.getRest().get(0).getOperation();
assertThat(ops.size(), greaterThan(1));
assertNull(ops.get(0).getDefinition().getReference().getBaseUrl());
assertThat(ops.get(0).getDefinition().getReference().getValue(), startsWith("OperationDefinition/"));
OperationDefinition def = myFhirClient.read().resource(OperationDefinition.class).withId(ops.get(0).getDefinition().getReference()).execute();
assertThat(def.getCode(), not(blankOrNullString()));
List<String> opNames = toOpNames(ops);
assertThat(opNames, containsInRelativeOrder("OP_TYPE"));
assertEquals("OperationDefinition/Patient--OP_TYPE", ops.get(opNames.indexOf("OP_TYPE")).getDefinition().getReference().getValue());
}
示例5: testSearchWithPostAndInvalidParameters
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
@Test
public void testSearchWithPostAndInvalidParameters() throws Exception {
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort);
LoggingInterceptor interceptor = new LoggingInterceptor();
interceptor.setLogRequestSummary(true);
interceptor.setLogRequestBody(true);
interceptor.setLogRequestHeaders(false);
interceptor.setLogResponseBody(false);
interceptor.setLogResponseHeaders(false);
interceptor.setLogResponseSummary(false);
client.registerInterceptor(interceptor);
try {
client
.search()
.forResource(Patient.class)
.where(new StringClientParam("foo").matches().value("bar"))
.prettyPrint()
.usingStyle(SearchStyleEnum.POST)
.returnBundle(org.hl7.fhir.dstu3.model.Bundle.class)
.encodedJson()
.execute();
fail();
} catch (InvalidRequestException e) {
assertThat(e.getMessage(), containsString("Invalid request: The FHIR endpoint on this server does not know how to handle POST operation[Patient/_search] with parameters [[_pretty, foo]]"));
}
}
示例6: testSearchWithPostAndInvalidParameters
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
@Test
public void testSearchWithPostAndInvalidParameters() throws Exception {
IGenericClient client = ourCtx.newRestfulGenericClient("http://localhost:" + ourPort);
LoggingInterceptor interceptor = new LoggingInterceptor();
interceptor.setLogRequestSummary(true);
interceptor.setLogRequestBody(true);
interceptor.setLogRequestHeaders(false);
interceptor.setLogResponseBody(false);
interceptor.setLogResponseHeaders(false);
interceptor.setLogResponseSummary(false);
client.registerInterceptor(interceptor);
try {
client
.search()
.forResource(Patient.class)
.where(new StringClientParam("foo").matches().value("bar"))
.prettyPrint()
.usingStyle(SearchStyleEnum.POST)
.returnBundle(org.hl7.fhir.r4.model.Bundle.class)
.encodedJson()
.execute();
fail();
} catch (InvalidRequestException e) {
assertThat(e.getMessage(), containsString("Invalid request: The FHIR endpoint on this server does not know how to handle POST operation[Patient/_search] with parameters [[_pretty, foo]]"));
}
}