本文整理汇总了Java中ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor.setLogRequestSummary方法的典型用法代码示例。如果您正苦于以下问题:Java LoggingInterceptor.setLogRequestSummary方法的具体用法?Java LoggingInterceptor.setLogRequestSummary怎么用?Java LoggingInterceptor.setLogRequestSummary使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor
的用法示例。
在下文中一共展示了LoggingInterceptor.setLogRequestSummary方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testFindConsent
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
/**
* Test method for
* {@link org.iexhub.services.JaxRsConsentRestProvider\#find(@IdParam final
* IdDt id)}.
*/
@Test
public void testFindConsent() {
try {
Logger logger = LoggerFactory.getLogger(ConsentDstu3Test.class);
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setLogRequestSummary(true);
loggingInterceptor.setLogRequestBody(true);
loggingInterceptor.setLogger(logger);
IGenericClient client = ctxt.newRestfulGenericClient(serverBaseUrl);
client.registerInterceptor(loggingInterceptor); // Required only for
// logging
Consent retVal = client.read(Consent.class,
/*iExHubDomainOid + "." + consentId*/ /*"2.25.1469220780502"*/ "2.25.1471531116858");
assertTrue("Error - unexpected return value for testFindConsent", retVal != null);
} catch (Exception e) {
fail(e.getMessage());
}
}
示例2: testSearchConsent
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
/**
* Test method for
* {@link org.iexhub.services.JaxRsConsentRestProvider#search\(@IdParam
* final IdDt id)}.
*/
@Test
public void testSearchConsent() {
try {
Logger logger = LoggerFactory.getLogger(ConsentDstu3Test.class);
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setLogRequestSummary(true);
loggingInterceptor.setLogRequestBody(true);
loggingInterceptor.setLogger(logger);
IGenericClient client = ctxt.newRestfulGenericClient(serverBaseUrl);
client.registerInterceptor(loggingInterceptor);
Identifier searchParam = new Identifier();
searchParam.setSystem(iExHubDomainOid).setValue(defaultPatientId);
Bundle response = client
.search()
.forResource(Consent.class)
.where(Patient.IDENTIFIER.exactly().identifier(searchParam.getId()))
.returnBundle(Bundle.class).execute();
assertTrue("Error - unexpected return value for testSearchConsent", response != null);
} catch (Exception e) {
fail(e.getMessage());
}
}
示例3: testCreateBasicConsent
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
/**
* Test method for Basic Consent Content
* {@link org.iexhub.services.JaxRsConsentRestProvider\#create(Patient patient, String theConditional)}
*
* @author Ioana Singureanu
*/
@Test
public void testCreateBasicConsent() {
// Create a Privacy Consent as a Consent to be submitted as document
// using ITI-41
String currentTest = "BasicConsent";
try {
Logger logger = LoggerFactory.getLogger(ConsentDstu3Test.class);
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setLogRequestSummary(true);
loggingInterceptor.setLogRequestBody(true);
loggingInterceptor.setLogger(logger);
Consent consent = createBasicTestConsent();
// Use the narrative generator
// @TODO: add generator Thymeleaf templates
// ctxt.setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
String xmlEncodedGranularConsent = ctxt.newXmlParser().setPrettyPrint(true)
.encodeResourceToString(consent);
FileUtils.writeStringToFile(new File(testResourcesPath+"/XML/"+currentTest+".xml"), xmlEncodedGranularConsent);
String jsonEncodedGranularConsent = ctxt.newJsonParser().setPrettyPrint(true)
.encodeResourceToString(consent);
FileUtils.writeStringToFile(new File(testResourcesPath+"/JSON/"+currentTest+".json"), jsonEncodedGranularConsent);
// create FHIR client
IGenericClient client = ctxt.newRestfulGenericClient(serverBaseUrl);
client.registerInterceptor(loggingInterceptor);
// invoke Consent service
client.create().resource(consent).execute();
} catch (Exception e) {
fail( e.getMessage());
}
}
示例4: testUpdateBasicConsent
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
/**
* Test method for Basic Consent Content update
* {@link org.iexhub.services.JaxRsConsentRestProvider\#create(Patient patient, String theConditional)}
*
* @author A. Sute
*/
@Test
public void testUpdateBasicConsent() {
// Create a Privacy Consent as a Consent to be submitted as document
// using ITI-41
String currentTest = "BasicConsentUpdate";
try {
Logger logger = LoggerFactory.getLogger(ConsentDstu3Test.class);
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setLogRequestSummary(true);
loggingInterceptor.setLogRequestBody(true);
loggingInterceptor.setLogger(logger);
Consent consent = createBasicTestConsent(UUID.fromString("819efe60-d1bb-47b7-b5d6-ab5fa073eef0"));
// Use the narrative generator
// @TODO: add generator Thymeleaf templates
// ctxt.setNarrativeGenerator(new DefaultThymeleafNarrativeGenerator());
String xmlEncodedGranularConsent = ctxt.newXmlParser().setPrettyPrint(true)
.encodeResourceToString(consent);
FileUtils.writeStringToFile(new File(testResourcesPath+"/XML/"+currentTest+".xml"), xmlEncodedGranularConsent);
String jsonEncodedGranularConsent = ctxt.newJsonParser().setPrettyPrint(true)
.encodeResourceToString(consent);
FileUtils.writeStringToFile(new File(testResourcesPath+"/JSON/"+currentTest+".json"), jsonEncodedGranularConsent);
// create FHIR client
IGenericClient client = ctxt.newRestfulGenericClient(serverBaseUrl);
client.registerInterceptor(loggingInterceptor);
// invoke Consent service
client.update().resource(consent).execute();
} catch (Exception e) {
fail( e.getMessage());
}
}
示例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]]"));
}
}
示例7: getGenericClient
import ca.uhn.fhir.rest.client.interceptor.LoggingInterceptor; //导入方法依赖的package包/类
public static IGenericClient getGenericClient(String theServerBase) {
// Create a logging interceptor
LoggingInterceptor loggingInterceptor = new LoggingInterceptor();
loggingInterceptor.setLogRequestSummary(true);
loggingInterceptor.setLogRequestBody(true);
IGenericClient client = context.newRestfulGenericClient(theServerBase);
client.registerInterceptor(loggingInterceptor);
return client;
}