diff --git a/source/java/org/alfresco/util/schemacomp/DefaultComparisonUtils.java b/source/java/org/alfresco/util/schemacomp/DefaultComparisonUtils.java index dec3effc47..7822f34269 100644 --- a/source/java/org/alfresco/util/schemacomp/DefaultComparisonUtils.java +++ b/source/java/org/alfresco/util/schemacomp/DefaultComparisonUtils.java @@ -102,7 +102,7 @@ public class DefaultComparisonUtils implements ComparisonUtils { // No equivalent object in the right hand collection. // Using rightIndexedProperty would result in index out of bounds error. - differences.add(Where.ONLY_IN_LEFT, leftIndexedProp, rightProp, strength); + differences.add(Where.ONLY_IN_REFERENCE, leftIndexedProp, rightProp, strength); } } @@ -114,7 +114,7 @@ public class DefaultComparisonUtils implements ComparisonUtils { DbProperty rightIndexedProp = new DbProperty(rightProp.getDbObject(), rightProp.getPropertyName(), rightIndex); // No equivalent object in the left hand collection. - differences.add(Where.ONLY_IN_RIGHT, leftProp, rightIndexedProp, strength); + differences.add(Where.ONLY_IN_TARGET, leftProp, rightIndexedProp, strength); } } } @@ -158,7 +158,7 @@ public class DefaultComparisonUtils implements ComparisonUtils else { // No equivalent object in the right hand collection. - differences.add(Where.ONLY_IN_LEFT, new DbProperty(leftObj, null), null, strength); + differences.add(Where.ONLY_IN_REFERENCE, new DbProperty(leftObj, null), null, strength); } } @@ -170,7 +170,7 @@ public class DefaultComparisonUtils implements ComparisonUtils if (leftObj == null) { // No equivalent object in the left hand collection. - differences.add(Where.ONLY_IN_RIGHT, null, new DbProperty(rightObj, null), strength); + differences.add(Where.ONLY_IN_TARGET, null, new DbProperty(rightObj, null), strength); } } } @@ -214,12 +214,12 @@ public class DefaultComparisonUtils implements ComparisonUtils else if (left == null) { // right can't be null, or left == right would have been true - where = Where.ONLY_IN_RIGHT; + where = Where.ONLY_IN_TARGET; } else if (right == null) { // left can't be null, or left == right would have been true - where = Where.ONLY_IN_LEFT; + where = Where.ONLY_IN_REFERENCE; } else { diff --git a/source/java/org/alfresco/util/schemacomp/DefaultComparisonUtilsTest.java b/source/java/org/alfresco/util/schemacomp/DefaultComparisonUtilsTest.java index d4c03ad930..a84065e856 100644 --- a/source/java/org/alfresco/util/schemacomp/DefaultComparisonUtilsTest.java +++ b/source/java/org/alfresco/util/schemacomp/DefaultComparisonUtilsTest.java @@ -74,10 +74,10 @@ public class DefaultComparisonUtilsTest verify(differences).add(Where.IN_BOTH_BUT_DIFFERENCE, prop("left"), prop("right"), Strength.ERROR); comparisonUtils.compareSimple(prop("left"), prop(null), ctx, Strength.ERROR); - verify(differences).add(Where.ONLY_IN_LEFT, prop("left"), prop(null), Strength.ERROR); + verify(differences).add(Where.ONLY_IN_REFERENCE, prop("left"), prop(null), Strength.ERROR); comparisonUtils.compareSimple(prop(null), prop("right"), ctx, Strength.ERROR); - verify(differences).add(Where.ONLY_IN_RIGHT, prop(null), prop("right"), Strength.ERROR); + verify(differences).add(Where.ONLY_IN_TARGET, prop(null), prop("right"), Strength.ERROR); } public DbProperty prop(String propValue) @@ -111,8 +111,8 @@ public class DefaultComparisonUtilsTest verify(db4).diff(db4, ctx, Strength.ERROR); // Objects in only one collections are marked as such - verify(differences).add(Where.ONLY_IN_LEFT, new DbProperty(db2), null, Strength.ERROR); - verify(differences).add(Where.ONLY_IN_RIGHT, null, new DbProperty(db3), Strength.ERROR); + verify(differences).add(Where.ONLY_IN_REFERENCE, new DbProperty(db2), null, Strength.ERROR); + verify(differences).add(Where.ONLY_IN_TARGET, null, new DbProperty(db3), Strength.ERROR); } @@ -163,28 +163,28 @@ public class DefaultComparisonUtilsTest dbPropForValue(rightDbObj, "collection[2]", subCollectionRight), Strength.WARN); verify(differences).add( - Where.ONLY_IN_LEFT, + Where.ONLY_IN_REFERENCE, dbPropForValue(leftDbObj, "collection[3]", 456), dbPropForValue(rightDbObj, "collection", rightCollection), Strength.WARN); verify(differences).add( - Where.ONLY_IN_LEFT, + Where.ONLY_IN_REFERENCE, dbPropForValue(leftDbObj, "collection[4]", "left only"), dbPropForValue(rightDbObj, "collection", rightCollection), Strength.WARN); verify(differences).add( - Where.ONLY_IN_RIGHT, + Where.ONLY_IN_TARGET, dbPropForValue(leftDbObj, "collection", leftCollection), dbPropForValue(rightDbObj, "collection[1]", 789), Strength.WARN); verify(differences).add( - Where.ONLY_IN_RIGHT, + Where.ONLY_IN_TARGET, dbPropForValue(leftDbObj, "collection", leftCollection), dbPropForValue(rightDbObj, "collection[3]", "right only"), Strength.WARN); verify(differences).add( - Where.ONLY_IN_RIGHT, + Where.ONLY_IN_TARGET, dbPropForValue(leftDbObj, "collection", leftCollection), dbPropForValue(rightDbObj, "collection[5]", "one more right only"), Strength.WARN); diff --git a/source/java/org/alfresco/util/schemacomp/Difference.java b/source/java/org/alfresco/util/schemacomp/Difference.java index 9db40caae5..1db962798e 100644 --- a/source/java/org/alfresco/util/schemacomp/Difference.java +++ b/source/java/org/alfresco/util/schemacomp/Difference.java @@ -28,7 +28,7 @@ package org.alfresco.util.schemacomp; public final class Difference extends Result { /** Specifies the type of differences */ - public enum Where { ONLY_IN_LEFT, ONLY_IN_RIGHT, IN_BOTH_NO_DIFFERENCE, IN_BOTH_BUT_DIFFERENCE }; + public enum Where { ONLY_IN_REFERENCE, ONLY_IN_TARGET, IN_BOTH_NO_DIFFERENCE, IN_BOTH_BUT_DIFFERENCE }; private final Where where; private final DbProperty left; private final DbProperty right; diff --git a/source/java/org/alfresco/util/schemacomp/DifferenceTest.java b/source/java/org/alfresco/util/schemacomp/DifferenceTest.java index 9d3ea3e351..4d86fa2f9d 100644 --- a/source/java/org/alfresco/util/schemacomp/DifferenceTest.java +++ b/source/java/org/alfresco/util/schemacomp/DifferenceTest.java @@ -43,9 +43,9 @@ public class DifferenceTest DbProperty targetDbProp = mock(DbProperty.class); when(targetDbProp.getPath()).thenReturn("alfresco.some_table.some_column.name"); when(targetDbProp.getPropertyValue()).thenReturn("nood_ref"); - Difference diff = new Difference(Where.ONLY_IN_LEFT, refDbProp, targetDbProp); + Difference diff = new Difference(Where.ONLY_IN_REFERENCE, refDbProp, targetDbProp); - assertEquals("Difference: ONLY_IN_LEFT reference path:alfresco.some_table.some_column.name (value: node_ref) " + + assertEquals("Difference: ONLY_IN_REFERENCE reference path:alfresco.some_table.some_column.name (value: node_ref) " + "target path:alfresco.some_table.some_column.name (value: nood_ref)", diff.describe()); } } diff --git a/source/java/org/alfresco/util/schemacomp/SchemaComparatorTest.java b/source/java/org/alfresco/util/schemacomp/SchemaComparatorTest.java index bee4269269..5f9e6c8f79 100644 --- a/source/java/org/alfresco/util/schemacomp/SchemaComparatorTest.java +++ b/source/java/org/alfresco/util/schemacomp/SchemaComparatorTest.java @@ -96,7 +96,7 @@ public class SchemaComparatorTest // Table table_in_reference only appears in the reference schema Difference diff = (Difference) it.next(); - assertEquals(Where.ONLY_IN_LEFT, diff.getWhere()); + assertEquals(Where.ONLY_IN_REFERENCE, diff.getWhere()); assertEquals("schema.table_in_reference", diff.getLeft().getPath()); assertEquals(null, diff.getRight()); assertEquals(null, diff.getLeft().getPropertyName()); @@ -104,7 +104,7 @@ public class SchemaComparatorTest // Table tbl_has_diff_pk has PK of "id" in reference and "nodeRef" in target diff = (Difference) it.next(); - assertEquals(Where.ONLY_IN_LEFT, diff.getWhere()); + assertEquals(Where.ONLY_IN_REFERENCE, diff.getWhere()); assertEquals("schema.tbl_has_diff_pk.pk_is_diff.columnNames[0]", diff.getLeft().getPath()); assertEquals("schema.tbl_has_diff_pk.pk_is_diff.columnNames", diff.getRight().getPath()); assertEquals("columnNames[0]", diff.getLeft().getPropertyName()); @@ -114,7 +114,7 @@ public class SchemaComparatorTest // Table tbl_has_diff_pk has PK of "id" in reference and "nodeRef" in target diff = (Difference) it.next(); - assertEquals(Where.ONLY_IN_RIGHT, diff.getWhere()); + assertEquals(Where.ONLY_IN_TARGET, diff.getWhere()); assertEquals("schema.tbl_has_diff_pk.pk_is_diff.columnNames", diff.getLeft().getPath()); assertEquals("schema.tbl_has_diff_pk.pk_is_diff.columnNames[0]", diff.getRight().getPath()); assertEquals("columnNames", diff.getLeft().getPropertyName()); @@ -133,7 +133,7 @@ public class SchemaComparatorTest // Table table_in_target does not exist in the reference schema diff = (Difference) it.next(); - assertEquals(Where.ONLY_IN_RIGHT, diff.getWhere()); + assertEquals(Where.ONLY_IN_TARGET, diff.getWhere()); assertEquals("schema.table_in_target", diff.getRight().getPath()); assertEquals(null, diff.getLeft()); assertEquals(null, diff.getRight().getPropertyName());