Search in sources :

Example 61 with Endpoint

use of org.hl7.fhir.r4.model.Endpoint in project cqf-ruler by DBCG.

the class CacheValueSetsProviderIT method testCacheValueSetsValueSetNull.

@Test
public void testCacheValueSetsValueSetNull() throws Exception {
    Endpoint endpoint = uploadLocalServerEndpoint();
    StringAndListParam stringAndListParam = new StringAndListParam();
    stringAndListParam.setValuesAsQueryTokens(getFhirContext(), "valueset", Arrays.asList(QualifiedParamList.singleton(new ValueSet().getId())));
    RequestDetails details = Mockito.mock(RequestDetails.class);
    Resource outcomeResource = cacheValueSetsProvider.cacheValuesets(details, endpoint.getIdElement(), stringAndListParam, null, null);
    validateOutcome(outcomeResource, "HTTP 404 : Resource ValueSet/" + new ValueSet().getIdElement().getIdPart() + " is not known");
}
Also used : Endpoint(org.hl7.fhir.dstu3.model.Endpoint) StringAndListParam(ca.uhn.fhir.rest.param.StringAndListParam) Resource(org.hl7.fhir.dstu3.model.Resource) ValueSet(org.hl7.fhir.dstu3.model.ValueSet) RequestDetails(ca.uhn.fhir.rest.api.server.RequestDetails) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 62 with Endpoint

use of org.hl7.fhir.r4.model.Endpoint in project cqf-ruler by DBCG.

the class CacheValueSetsProviderIT method testCacheValueSetsAuthenticationErrorPassword.

@Test
public void testCacheValueSetsAuthenticationErrorPassword() throws Exception {
    Endpoint endpoint = uploadLocalServerEndpoint();
    StringAndListParam stringAndListParam = getStringAndListParamFromValueSet("valueset/AcuteInpatient.json");
    RequestDetails details = Mockito.mock(RequestDetails.class);
    Resource outcomeResource = cacheValueSetsProvider.cacheValuesets(details, endpoint.getIdElement(), stringAndListParam, null, "password");
    String detailMessage = "Password was provided, but not a user name.";
    validateOutcome(outcomeResource, detailMessage);
}
Also used : Endpoint(org.hl7.fhir.dstu3.model.Endpoint) StringAndListParam(ca.uhn.fhir.rest.param.StringAndListParam) Resource(org.hl7.fhir.dstu3.model.Resource) RequestDetails(ca.uhn.fhir.rest.api.server.RequestDetails) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 63 with Endpoint

use of org.hl7.fhir.r4.model.Endpoint in project cqf-ruler by DBCG.

the class CacheValueSetsProviderIT method uploadLocalServerEndpoint.

private Endpoint uploadLocalServerEndpoint() throws IOException {
    BufferedReader reader = new BufferedReader(new InputStreamReader(CacheValueSetsProvider.class.getResourceAsStream("endpoint/LocalServerEndpoint.json")));
    String resourceString = reader.lines().collect(Collectors.joining(System.lineSeparator()));
    reader.close();
    // Don't want to update during loading because need to setAddress first
    Endpoint endpoint = (Endpoint) loadResource("json", resourceString);
    endpoint.setAddress("http://localhost:" + getPort() + "/fhir/");
    create(endpoint);
    return endpoint;
}
Also used : InputStreamReader(java.io.InputStreamReader) Endpoint(org.hl7.fhir.dstu3.model.Endpoint) BufferedReader(java.io.BufferedReader)

Example 64 with Endpoint

use of org.hl7.fhir.r4.model.Endpoint in project cqf-ruler by DBCG.

the class CacheValueSetsProviderIT method testCacheValueSetsEndpointDNE.

@Test
public void testCacheValueSetsEndpointDNE() throws Exception {
    Endpoint endpoint = new Endpoint();
    endpoint.setId(new IdType("localhost"));
    StringAndListParam stringAndListParam = getStringAndListParamFromValueSet("valueset/AcuteInpatient.json");
    RequestDetails details = Mockito.mock(RequestDetails.class);
    Resource outcomeResource = cacheValueSetsProvider.cacheValuesets(details, endpoint.getIdElement(), stringAndListParam, null, null);
    String detailMessage = "Could not find Endpoint/" + endpoint.getIdElement().getIdPart();
    validateOutcome(outcomeResource, detailMessage);
}
Also used : Endpoint(org.hl7.fhir.dstu3.model.Endpoint) StringAndListParam(ca.uhn.fhir.rest.param.StringAndListParam) Resource(org.hl7.fhir.dstu3.model.Resource) RequestDetails(ca.uhn.fhir.rest.api.server.RequestDetails) IdType(org.hl7.fhir.dstu3.model.IdType) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Example 65 with Endpoint

use of org.hl7.fhir.r4.model.Endpoint in project cqf-ruler by DBCG.

the class CacheValueSetsProviderIT method testCacheValueSetsValueSetNull.

@Test
public void testCacheValueSetsValueSetNull() throws Exception {
    Endpoint endpoint = uploadLocalServerEndpoint();
    StringAndListParam stringAndListParam = new StringAndListParam();
    stringAndListParam.setValuesAsQueryTokens(getFhirContext(), "valueset", Arrays.asList(QualifiedParamList.singleton(new ValueSet().getId())));
    RequestDetails details = Mockito.mock(RequestDetails.class);
    Resource outcomeResource = cacheValueSetsProvider.cacheValuesets(details, endpoint.getIdElement(), stringAndListParam, null, null);
    validateOutcome(outcomeResource, "HTTP 404 : Resource ValueSet/" + new ValueSet().getIdElement().getIdPart() + " is not known");
}
Also used : Endpoint(org.hl7.fhir.r4.model.Endpoint) StringAndListParam(ca.uhn.fhir.rest.param.StringAndListParam) Resource(org.hl7.fhir.r4.model.Resource) ValueSet(org.hl7.fhir.r4.model.ValueSet) RequestDetails(ca.uhn.fhir.rest.api.server.RequestDetails) Test(org.junit.jupiter.api.Test) SpringBootTest(org.springframework.boot.test.context.SpringBootTest) RestIntegrationTest(org.opencds.cqf.ruler.test.RestIntegrationTest)

Aggregations

Test (org.junit.jupiter.api.Test)36 Endpoint (org.hl7.fhir.dstu3.model.Endpoint)21 RequestDetails (ca.uhn.fhir.rest.api.server.RequestDetails)18 StringAndListParam (ca.uhn.fhir.rest.param.StringAndListParam)16 RestIntegrationTest (org.opencds.cqf.ruler.test.RestIntegrationTest)16 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)16 IGenericClient (ca.uhn.fhir.rest.client.api.IGenericClient)15 Endpoint (org.hl7.fhir.r4.model.Endpoint)15 Complex (org.hl7.fhir.dstu3.utils.formats.Turtle.Complex)14 Complex (org.hl7.fhir.r4.utils.formats.Turtle.Complex)14 Bundle (org.hl7.fhir.r4.model.Bundle)12 Organization (org.hl7.fhir.dstu3.model.Organization)11 Resource (org.hl7.fhir.r4.model.Resource)10 Resource (org.hl7.fhir.dstu3.model.Resource)9 Operation (ca.uhn.fhir.rest.annotation.Operation)7 List (java.util.List)7 Bundle (org.hl7.fhir.dstu3.model.Bundle)7 Description (ca.uhn.fhir.model.api.annotation.Description)6 MethodOutcome (ca.uhn.fhir.rest.api.MethodOutcome)6 ArrayList (java.util.ArrayList)6