Search in sources :

Example 16 with Diff

use of org.javers.core.diff.Diff in project fhir-bridge by ehrbase.

the class ClinicalTrialParticipationIT method testMapping.

@Override
public void testMapping(String resourcePath, String paragonPath) throws IOException {
    Observation observation = (Observation) super.testFileLoader.loadResource(resourcePath);
    ClinicalTrialParticipationCompositionConverter clinicalTrialParticipationCompositionConverter = new ClinicalTrialParticipationCompositionConverter();
    GECCOStudienteilnahmeComposition mapped = clinicalTrialParticipationCompositionConverter.convert(observation);
    Diff diff = compareCompositions(getJavers(), paragonPath, mapped);
    assertEquals(0, diff.getChanges().size());
}
Also used : GECCOStudienteilnahmeComposition(org.ehrbase.fhirbridge.ehr.opt.geccostudienteilnahmecomposition.GECCOStudienteilnahmeComposition) Diff(org.javers.core.diff.Diff) Observation(org.hl7.fhir.r4.model.Observation) ClinicalTrialParticipationCompositionConverter(org.ehrbase.fhirbridge.ehr.converter.specific.clinicaltrialparticipation.ClinicalTrialParticipationCompositionConverter)

Example 17 with Diff

use of org.javers.core.diff.Diff in project fhir-bridge by ehrbase.

the class QuestionnaireResponseIT method testMapping.

@Override
public void testMapping(String resourcePath, String paragonPath) throws IOException {
    QuestionnaireResponse resource = (QuestionnaireResponse) super.testFileLoader.loadResource(resourcePath);
    D4lQuestionnaireCompositionConverter d4lQuestionnaireCompositionConverter = new D4lQuestionnaireCompositionConverter();
    D4LQuestionnaireComposition mappedD4LQuestionnaireComposition = d4lQuestionnaireCompositionConverter.convert(resource);
    Diff diff = compareCompositions(getJavers(), paragonPath, mappedD4LQuestionnaireComposition);
    assertEquals(0, diff.getChanges().size());
}
Also used : D4lQuestionnaireCompositionConverter(org.ehrbase.fhirbridge.ehr.converter.specific.d4lquestionnaire.D4lQuestionnaireCompositionConverter) Diff(org.javers.core.diff.Diff) QuestionnaireResponse(org.hl7.fhir.r4.model.QuestionnaireResponse) D4LQuestionnaireComposition(org.ehrbase.fhirbridge.ehr.opt.d4lquestionnairecomposition.D4LQuestionnaireComposition)

Example 18 with Diff

use of org.javers.core.diff.Diff in project fhir-bridge by ehrbase.

the class GenericTherapyIT method testMapping.

public void testMapping(String resourcePath, String paragonPath) throws IOException {
    Procedure procedure = (Procedure) super.testFileLoader.loadResource(resourcePath);
    TherapyCompositionConverter therapyCompositionConverter = new TherapyCompositionConverter();
    GECCOProzedurComposition mappedProzedurComposition = therapyCompositionConverter.convert(procedure);
    Diff diff = compareCompositions(getJavers(), paragonPath, mappedProzedurComposition);
    assertEquals(diff.getChanges().size(), 0);
}
Also used : GECCOProzedurComposition(org.ehrbase.fhirbridge.ehr.opt.geccoprozedurcomposition.GECCOProzedurComposition) TherapyCompositionConverter(org.ehrbase.fhirbridge.ehr.converter.specific.therapy.TherapyCompositionConverter) Diff(org.javers.core.diff.Diff) Procedure(org.hl7.fhir.r4.model.Procedure)

Example 19 with Diff

use of org.javers.core.diff.Diff in project fhir-bridge by ehrbase.

the class SmokingstatusIT method testMapping.

@Override
public void testMapping(String resourcePath, String paragonPath) throws IOException {
    Observation observation = (Observation) super.testFileLoader.loadResource(resourcePath);
    RaucherstatusCompositionConverter raucherstatusCompositionConverter = new RaucherstatusCompositionConverter();
    RaucherstatusComposition mapped = raucherstatusCompositionConverter.convert(observation);
    Diff diff = compareCompositions(getJavers(), paragonPath, mapped);
    assertEquals(0, diff.getChanges().size());
}
Also used : RaucherstatusComposition(org.ehrbase.fhirbridge.ehr.opt.raucherstatuscomposition.RaucherstatusComposition) Diff(org.javers.core.diff.Diff) Observation(org.hl7.fhir.r4.model.Observation) RaucherstatusCompositionConverter(org.ehrbase.fhirbridge.ehr.converter.specific.smokingstatus.RaucherstatusCompositionConverter)

Example 20 with Diff

use of org.javers.core.diff.Diff in project jag-pcss-civil by bcgov.

the class TestService method compare.

public <T, G> boolean compare(T response, G request) {
    Jaxb2Marshaller jaxb2Marshaller = new Jaxb2Marshaller();
    DualProtocolSaajSoapMessageFactory saajSoapMessageFactory = new DualProtocolSaajSoapMessageFactory();
    saajSoapMessageFactory.setSoapVersion(SoapVersion.SOAP_12);
    saajSoapMessageFactory.afterPropertiesSet();
    HttpComponentsMessageSender httpComponentsMessageSender = new HttpComponentsMessageSender();
    httpComponentsMessageSender.setCredentials(new UsernamePasswordCredentials(username, password));
    webServiceTemplate.setMessageSender(webServiceSenderWithAuth);
    webServiceTemplate.setMessageFactory(saajSoapMessageFactory);
    jaxb2Marshaller.setContextPaths("ca.bc.gov.open.pcss.one", "ca.bc.gov.open.pcss.three");
    webServiceTemplate.setMarshaller(jaxb2Marshaller);
    webServiceTemplate.setUnmarshaller(jaxb2Marshaller);
    webServiceTemplate.afterPropertiesSet();
    T resultObjectWM = null;
    T resultObjectAPI = null;
    try {
        resultObjectWM = (T) webServiceTemplate.marshalSendAndReceive(wmHost, request);
        resultObjectAPI = (T) webServiceTemplate.marshalSendAndReceive(apiHost, request);
        Thread.sleep(5000);
    } catch (Exception e) {
        System.out.println("ERROR: Failed to send request... " + e);
        fileOutput.println("ERROR: Failed to send request... " + e);
    }
    Diff diff = javers.compare(resultObjectAPI, resultObjectWM);
    String responseClassName = response.getClass().getName();
    if (diff.hasChanges()) {
        printDiff(diff);
        return false;
    } else {
        if (resultObjectAPI == null && resultObjectWM == null)
            System.out.println("WARN: " + responseClassName.substring(responseClassName.lastIndexOf('.') + 1) + ": NULL responses");
        else
            System.out.println("INFO: " + responseClassName.substring(responseClassName.lastIndexOf('.') + 1) + ": No Diff Detected");
        return true;
    }
}
Also used : DualProtocolSaajSoapMessageFactory(ca.bc.gov.open.pcss.civil.comparison.config.DualProtocolSaajSoapMessageFactory) Diff(org.javers.core.diff.Diff) HttpComponentsMessageSender(org.springframework.ws.transport.http.HttpComponentsMessageSender) Jaxb2Marshaller(org.springframework.oxm.jaxb.Jaxb2Marshaller) UsernamePasswordCredentials(org.apache.http.auth.UsernamePasswordCredentials)

Aggregations

Diff (org.javers.core.diff.Diff)57 Observation (org.hl7.fhir.r4.model.Observation)23 Javers (org.javers.core.Javers)10 Test (org.junit.Test)5 Bundle (org.hl7.fhir.r4.model.Bundle)4 DualProtocolSaajSoapMessageFactory (ca.bc.gov.open.pcss.civil.comparison.config.DualProtocolSaajSoapMessageFactory)2 List (java.util.List)2 UsernamePasswordCredentials (org.apache.http.auth.UsernamePasswordCredentials)2 VirologischerBefundCompositionConverter (org.ehrbase.fhirbridge.ehr.converter.specific.virologischerbefund.VirologischerBefundCompositionConverter)2 GECCOPersonendatenComposition (org.ehrbase.fhirbridge.ehr.opt.geccopersonendatencomposition.GECCOPersonendatenComposition)2 VirologischerBefundComposition (org.ehrbase.fhirbridge.ehr.opt.virologischerbefundcomposition.VirologischerBefundComposition)2 BefundObservation (org.ehrbase.fhirbridge.ehr.opt.virologischerbefundcomposition.definition.BefundObservation)2 VirologischerBefundConverter (org.ehrbase.fhirbridge.fhir.bundle.converter.VirologischerBefundConverter)2 Condition (org.hl7.fhir.r4.model.Condition)2 DiagnosticReport (org.hl7.fhir.r4.model.DiagnosticReport)2 ValueChange (org.javers.core.diff.changetype.ValueChange)2 WebServiceSenderWithAuth (ca.bc.gov.open.pcss.civil.comparison.config.WebServiceSenderWithAuth)1 ca.bc.gov.open.pcss.three (ca.bc.gov.open.pcss.three)1 YesNoType (ca.bc.gov.open.pcss.two.YesNoType)1 VisibleForTesting (com.google.common.annotations.VisibleForTesting)1