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


Java LoggingInterceptor.setLogResponseBody方法代码示例

本文整理汇总了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());
	}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:20,代码来源:OperationServerDstu3Test.java

示例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());
	}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:20,代码来源:OperationServerDstu2_1Test.java

示例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());
	}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:20,代码来源:OperationServerR4Test.java

示例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());
}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:21,代码来源:OperationServerDstu2Test.java

示例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]]"));
	}

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:28,代码来源:SearchDstu3Test.java

示例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]]"));
	}

}
 
开发者ID:jamesagnew,项目名称:hapi-fhir,代码行数:28,代码来源:SearchR4Test.java


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