Search in sources :

Example 56 with Diff

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

the class AbstractMappingTestSetupIT method compareCompositions.

public Diff compareCompositions(Javers javers, String paragonFilePath, CompositionEntity mappedComposition) throws IOException {
    RMObject composition = new CanonicalJson().unmarshal(testFileLoader.loadResourceToString(paragonFilePath), com.nedap.archie.rm.composition.Composition.class);
    ResourceTemplateProvider resourceTemplateProvider = new ResourceTemplateProvider("classpath:/opt/");
    resourceTemplateProvider.afterPropertiesSet();
    Flattener cut = new Flattener(resourceTemplateProvider);
    CompositionEntity paragonComposition = cut.flatten(composition, mappedComposition.getClass());
    Diff diff = javers.compare(paragonComposition, mappedComposition);
    diff.getChanges().forEach(System.out::println);
    return diff;
}
Also used : CanonicalJson(org.ehrbase.serialisation.jsonencoding.CanonicalJson) ResourceTemplateProvider(org.ehrbase.fhirbridge.ehr.ResourceTemplateProvider) CompositionEntity(org.ehrbase.client.classgenerator.interfaces.CompositionEntity) Diff(org.javers.core.diff.Diff) Flattener(org.ehrbase.client.flattener.Flattener) RMObject(com.nedap.archie.rm.RMObject)

Example 57 with Diff

use of org.javers.core.diff.Diff in project molgenis-emx2 by molgenis.

the class CompareTools method assertEquals.

public static void assertEquals(SchemaMetadata schema1, SchemaMetadata schema2) {
    Collection<String> tableNames1 = schema1.getTableNames();
    Collection<String> tableNames2 = schema2.getTableNames();
    for (Object tableName : tableNames1) if (!tableNames2.contains(tableName))
        fail("Schema's have different tables: schema2 doesn't contain '" + tableName + "'");
    for (Object tableName : tableNames2) if (!tableNames1.contains(tableName))
        fail("Schema's have different tables: schema1 doesn't contain '" + tableName + "'");
    for (String tableName : tableNames1) {
        Diff diff = getJavers().compare(schema1.getTableMetadata(tableName), schema2.getTableMetadata(tableName));
        if (diff.hasChanges()) {
            fail("Roundtrip test failed: changes for table " + tableName + ": " + diff.toString());
        }
    }
}
Also used : Diff(org.javers.core.diff.Diff)

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