Search in sources :

Example 1 with OpenEhrClientConfig

use of org.ehrbase.client.openehrclient.OpenEhrClientConfig in project fhir-bridge by ehrbase.

the class AbstractSetupIT method setup.

@BeforeAll
static void setup() throws URISyntaxException {
    CredentialsProvider credentialsProvider = new BasicCredentialsProvider();
    credentialsProvider.setCredentials(AuthScope.ANY, new UsernamePasswordCredentials("myuser", "myPassword432"));
    CloseableHttpClient httpClient = HttpClientBuilder.create().setDefaultCredentialsProvider(credentialsProvider).build();
    DefaultRestClient client = new DefaultRestClient(new OpenEhrClientConfig(new URI("http://localhost:8080/ehrbase/")), new ResourceTemplateProvider("classpath:/opt/*.opt"), httpClient);
    PATIENT_ID = UUID.randomUUID().toString();
    EhrStatus ehrStatus = new EhrStatus();
    ehrStatus.setSubject(new PartySelf(new PartyRef(new HierObjectId(PATIENT_ID), "demographic", "PERSON")));
    ehrStatus.setArchetypeNodeId("openEHR-EHR-EHR_STATUS.generic.v1");
    ehrStatus.setName(new DvText("Integration tests status"));
    client.ehrEndpoint().createEhr(ehrStatus);
}
Also used : CloseableHttpClient(org.apache.http.impl.client.CloseableHttpClient) BasicCredentialsProvider(org.apache.http.impl.client.BasicCredentialsProvider) EhrStatus(com.nedap.archie.rm.ehr.EhrStatus) BasicCredentialsProvider(org.apache.http.impl.client.BasicCredentialsProvider) CredentialsProvider(org.apache.http.client.CredentialsProvider) DefaultRestClient(org.ehrbase.client.openehrclient.defaultrestclient.DefaultRestClient) URI(java.net.URI) UsernamePasswordCredentials(org.apache.http.auth.UsernamePasswordCredentials) PartySelf(com.nedap.archie.rm.generic.PartySelf) DvText(com.nedap.archie.rm.datavalues.DvText) PartyRef(com.nedap.archie.rm.support.identification.PartyRef) OpenEhrClientConfig(org.ehrbase.client.openehrclient.OpenEhrClientConfig) ResourceTemplateProvider(org.ehrbase.fhirbridge.ehr.ResourceTemplateProvider) HierObjectId(com.nedap.archie.rm.support.identification.HierObjectId) BeforeAll(org.junit.jupiter.api.BeforeAll)

Example 2 with OpenEhrClientConfig

use of org.ehrbase.client.openehrclient.OpenEhrClientConfig in project openEHR_SDK by ehrbase.

the class DefaultRestClientTestHelper method setupDefaultRestClientWithDefaultProvider.

public static DefaultRestClient setupDefaultRestClientWithDefaultProvider(DefaultValuesProvider defaultValuesProvider) throws URISyntaxException {
    TestDataTemplateProvider templateProvider = new TestDataTemplateProvider();
    OpenEhrClientConfig config = new OpenEhrClientConfig(new URI(OPEN_EHR_URL));
    config.setDefaultValuesProvider(defaultValuesProvider);
    DefaultRestClient client = new DefaultRestClient(config, templateProvider);
    templateProvider.listTemplateIds().stream().forEach(t -> client.templateEndpoint().ensureExistence(t));
    return client;
}
Also used : OpenEhrClientConfig(org.ehrbase.client.openehrclient.OpenEhrClientConfig) URI(java.net.URI) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider)

Example 3 with OpenEhrClientConfig

use of org.ehrbase.client.openehrclient.OpenEhrClientConfig in project openEHR_SDK by ehrbase.

the class DefaultRestClientTestHelper method setupDefaultRestClient.

public static DefaultRestClient setupDefaultRestClient() throws URISyntaxException {
    TestDataTemplateProvider templateProvider = new TestDataTemplateProvider();
    DefaultRestClient client = new DefaultRestClient(new OpenEhrClientConfig(new URI(OPEN_EHR_URL)), templateProvider);
    templateProvider.listTemplateIds().stream().forEach(t -> client.templateEndpoint().ensureExistence(t));
    return client;
}
Also used : OpenEhrClientConfig(org.ehrbase.client.openehrclient.OpenEhrClientConfig) URI(java.net.URI) TestDataTemplateProvider(org.ehrbase.client.templateprovider.TestDataTemplateProvider)

Aggregations

URI (java.net.URI)3 OpenEhrClientConfig (org.ehrbase.client.openehrclient.OpenEhrClientConfig)3 TestDataTemplateProvider (org.ehrbase.client.templateprovider.TestDataTemplateProvider)2 DvText (com.nedap.archie.rm.datavalues.DvText)1 EhrStatus (com.nedap.archie.rm.ehr.EhrStatus)1 PartySelf (com.nedap.archie.rm.generic.PartySelf)1 HierObjectId (com.nedap.archie.rm.support.identification.HierObjectId)1 PartyRef (com.nedap.archie.rm.support.identification.PartyRef)1 UsernamePasswordCredentials (org.apache.http.auth.UsernamePasswordCredentials)1 CredentialsProvider (org.apache.http.client.CredentialsProvider)1 BasicCredentialsProvider (org.apache.http.impl.client.BasicCredentialsProvider)1 CloseableHttpClient (org.apache.http.impl.client.CloseableHttpClient)1 DefaultRestClient (org.ehrbase.client.openehrclient.defaultrestclient.DefaultRestClient)1 ResourceTemplateProvider (org.ehrbase.fhirbridge.ehr.ResourceTemplateProvider)1 BeforeAll (org.junit.jupiter.api.BeforeAll)1