use of com.jayway.restassured.response.Headers in project quality-measure-and-cohort-service by Alvearie.
the class DefaultVT method testCohortEvaluationWithLogging.
@Test
public void testCohortEvaluationWithLogging() {
final String RESOURCE = getUrlBase() + "/{version}/cohort-evaluation";
Assume.assumeTrue(isServiceDarkFeatureEnabled(CohortEngineRestConstants.DARK_LAUNCHED_VALUE_SET_UPLOAD));
// Create the metadata part of the request
CohortEvaluation requestData = new CohortEvaluation();
requestData.setDataServerConfig(dataServerConfig);
requestData.setTerminologyServerConfig(dataServerConfig);
requestData.setDefineToRun("Male");
requestData.setEntrypoint("cql/basic/Test-1.0.0.cql");
requestData.setPatientIds(VALID_PATIENT_ID);
requestData.setLoggingLevel(CqlDebug.TRACE);
RequestSpecification request = buildBaseRequest(new Headers()).queryParam(CohortEngineRestHandler.VERSION, ServiceBuildConstants.DATE).multiPart(CohortEngineRestHandler.REQUEST_DATA_PART, requestData, "application/json").multiPart(CohortEngineRestHandler.CQL_DEFINITION, new File("src/test/resources/cql/zip/Test-1.0.0.zip"));
ValidatableResponse response = request.post(RESOURCE, getServiceVersion()).then();
ValidatableResponse vr = runSuccessValidation(response, ContentType.JSON, HttpStatus.SC_OK);
String actual = vr.extract().response().getBody().prettyPrint();
String expected = "{\n \"result\": [\n \n ]\n}";
assertEquals(expected, actual);
}
use of com.jayway.restassured.response.Headers in project quality-measure-and-cohort-service by Alvearie.
the class DefaultVT method testValueSetOverride.
@Test
public void testValueSetOverride() {
testValueSetUpload();
final String RESOURCE = getUrlBase() + "/{version}/valueset";
// Create the metadata part of the request
ObjectMapper om = new ObjectMapper();
String fhirConfigjson = "";
try {
fhirConfigjson = om.writeValueAsString(dataServerConfig);
} catch (JsonProcessingException e) {
e.printStackTrace();
fail();
}
RequestSpecification request = buildBaseRequest(new Headers()).param(CohortEngineRestHandler.VERSION, ServiceBuildConstants.DATE).queryParam(CohortEngineRestHandler.UPDATE_IF_EXISTS_PARM, true).multiPart(CohortEngineRestHandler.FHIR_DATA_SERVER_CONFIG_PART, fhirConfigjson, "application/json").multiPart(CohortEngineRestHandler.VALUE_SET_PART, new File("src/test/resources/2.16.840.1.113762.1.4.1114.7.xlsx"));
ValidatableResponse response = request.post(RESOURCE, getServiceVersion()).then();
runSuccessValidation(response, ContentType.JSON, HttpStatus.SC_CREATED);
}
use of com.jayway.restassured.response.Headers in project quality-measure-and-cohort-service by Alvearie.
the class DefaultVT method testMeasureEvaluationByMeasureIdentifier.
// to tag a specific test to be part of DVT (deployment verification test)
@Category(DVT.class)
@Test
public /**
* Test a successful measure evaluation using identifier and version as the lookup key
*/
void testMeasureEvaluationByMeasureIdentifier() throws Exception {
// You want -Denabled.dark.features=all in your Liberty jvm.options
Assume.assumeTrue(isServiceDarkFeatureEnabled(CohortEngineRestConstants.DARK_LAUNCHED_MEASURE_EVALUATION));
final String RESOURCE = getUrlBase() + CohortServiceAPISpec.CREATE_DELETE_EVALUATION_PATH;
FhirContext fhirContext = FhirContext.forR4();
IParser parser = fhirContext.newJsonParser().setPrettyPrint(true);
Library library = TestHelper.getTemplateLibrary();
Identifier identifier = new Identifier().setValue("measure-identifier").setSystem("http://ibm.com/health/test");
Measure measure = TestHelper.getTemplateMeasure(library);
measure.setIdentifier(Arrays.asList(identifier));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
TestHelper.createMeasureArtifact(baos, parser, measure, library);
// Files.write( baos.toByteArray(), new File("target/test_measure_v1_0_0.zip"));
Map<String, Parameter> parameterOverrides = new HashMap<>();
parameterOverrides.put("Measurement Period", new IntervalParameter(new DateParameter("2019-07-04"), true, new DateParameter("2020-07-04"), true));
MeasureEvaluation requestData = new MeasureEvaluation();
requestData.setDataServerConfig(dataServerConfig);
requestData.setTerminologyServerConfig(termServerConfig);
// This is a patient ID that is assumed to exist in the target FHIR server
requestData.setPatientId(VALID_PATIENT_ID);
requestData.setMeasureContext(new MeasureContext(null, parameterOverrides, new com.ibm.cohort.engine.measure.Identifier(identifier.getSystem(), identifier.getValue()), measure.getVersion()));
requestData.setEvidenceOptions(new MeasureEvidenceOptions(false, MeasureEvidenceOptions.DefineReturnOptions.NONE));
ObjectMapper om = new ObjectMapper();
System.out.println(om.writeValueAsString(requestData));
RequestSpecification request = buildBaseRequest(new Headers()).queryParam(CohortEngineRestHandler.VERSION, ServiceBuildConstants.DATE).multiPart(CohortEngineRestHandler.REQUEST_DATA_PART, requestData, "application/json").multiPart(CohortEngineRestHandler.MEASURE_PART, "test_measure_v1_0_0.zip", new ByteArrayInputStream(baos.toByteArray()));
ValidatableResponse response = request.post(RESOURCE, getServiceVersion()).then();
ValidatableResponse vr = runSuccessValidation(response, ContentType.JSON, HttpStatus.SC_OK);
String expected = getJsonFromFile(ServiceAPIGlobalSpec.EXP_FOLDER_TYPE, "measure_evaluation_exp.json");
String actual = vr.extract().asString();
assertMeasureReportEquals(parser, expected, actual, false);
}
use of com.jayway.restassured.response.Headers in project quality-measure-and-cohort-service by Alvearie.
the class DefaultVT method testValueSetAlreadyExists.
@Test
public void testValueSetAlreadyExists() {
testValueSetUpload();
final String RESOURCE = getUrlBase() + "/{version}/valueset";
// Create the metadata part of the request
ObjectMapper om = new ObjectMapper();
String fhirConfigjson = "";
try {
fhirConfigjson = om.writeValueAsString(dataServerConfig);
} catch (JsonProcessingException e) {
e.printStackTrace();
fail();
}
RequestSpecification request = buildBaseRequest(new Headers()).param(CohortEngineRestHandler.VERSION, ServiceBuildConstants.DATE).queryParam(CohortEngineRestHandler.UPDATE_IF_EXISTS_PARM, false).multiPart(CohortEngineRestHandler.FHIR_DATA_SERVER_CONFIG_PART, fhirConfigjson, "application/json").multiPart(CohortEngineRestHandler.VALUE_SET_PART, new File("src/test/resources/2.16.840.1.113762.1.4.1114.7.xlsx"));
ValidatableResponse response = request.post(RESOURCE, getServiceVersion()).then();
runSuccessValidation(response, ContentType.JSON, HttpStatus.SC_CONFLICT);
}
use of com.jayway.restassured.response.Headers in project newrelic-java-agent by newrelic.
the class SprayHttpRoutesTest method testSimpleRouteFutureCAT.
@Test
public void testSimpleRouteFutureCAT() throws UnsupportedEncodingException {
String idHeader = Obfuscator.obfuscateNameUsingKey("1xyz234#1xyz3333", "cafebabedeadbeef8675309babecafe1beefdead");
ValidatableResponse response = given().header(HeadersUtil.NEWRELIC_ID_HEADER, idHeader).baseUri("http://localhost:" + server.getPort()).when().get("/simple/route/future?query=value").then().body(containsString("Simple Route Future"));
Headers responseHeaders = response.extract().headers();
Assert.assertTrue(responseHeaders.hasHeaderWithName(HeadersUtil.NEWRELIC_APP_DATA_HEADER));
Introspector introspector = InstrumentationTestRunner.getIntrospector();
Assert.assertEquals(1, introspector.getFinishedTransactionCount(DEFAULT_TIMEOUT_MILLIS));
Assert.assertTrue(introspector.getTransactionNames().toString(), introspector.getTransactionNames().contains(getTransactionPrefix() + "/simple/route/future"));
}
Aggregations