use of org.alfresco.util.schemacomp.model.DbObject in project alfresco-repository by Alfresco.
the class DefaultComparisonUtilsTest method collectionPropertyIsNotComparedWhenValidatorTakesResponsibility.
@Test
public void collectionPropertyIsNotComparedWhenValidatorTakesResponsibility() {
Collection<Object> refCollection = new ArrayList<Object>();
refCollection.add(123);
refCollection.add("both");
DbObject refDbObj = new DbObjectWithCollection("left", refCollection);
DbProperty refCollProp = new DbProperty(refDbObj, "collection");
Collection<Object> targetCollection = new ArrayList<Object>();
targetCollection.add(234);
targetCollection.add("both");
DbObject targetDbObj = new DbObjectWithCollection("right", targetCollection);
DbProperty targetCollProp = new DbProperty(targetDbObj, "collection");
DbValidator validator = mock(DbValidator.class);
when(validator.validates("collection")).thenReturn(true);
refDbObj.getValidators().add(validator);
comparisonUtils.compareSimpleCollections(refCollProp, targetCollProp, ctx);
// No information should be reported...
verify(differences, never()).add(Where.IN_BOTH_NO_DIFFERENCE, dbPropForValue(refDbObj, "collection[1]", "both"), dbPropForValue(targetDbObj, "collection[1]", "both"));
verify(differences, never()).add(Where.ONLY_IN_REFERENCE, dbPropForValue(refDbObj, "collection[0]", 123), dbPropForValue(targetDbObj, "collection", targetCollection));
verify(differences, never()).add(Where.ONLY_IN_TARGET, dbPropForValue(refDbObj, "collection", refCollection), dbPropForValue(targetDbObj, "collection[0]", 234));
}
use of org.alfresco.util.schemacomp.model.DbObject in project alfresco-repository by Alfresco.
the class RedundantDbObjectTest method describe.
@Test
public void describe() {
DbObject reference = new MyDbObject("reference");
List<DbObject> matches = makeMatches(3);
RedundantDbObject redundantDBO = new RedundantDbObject(reference, matches);
assertEquals("Redundancy: 3 items matching MyDbObject[name=reference], " + "matches: MyDbObject[name=match1], MyDbObject[name=match2], MyDbObject[name=match3]", redundantDBO.describe());
}
use of org.alfresco.util.schemacomp.model.DbObject in project alfresco-repository by Alfresco.
the class RedundantDbObjectTest method describeTooManyMatches.
@Test
public void describeTooManyMatches() {
DbObject reference = new MyDbObject("reference");
List<DbObject> matches = makeMatches(4);
RedundantDbObject redundantDBO = new RedundantDbObject(reference, matches);
assertEquals("4 redundant items? reference: MyDbObject[name=reference], " + "matches: MyDbObject[name=match1], MyDbObject[name=match2], MyDbObject[name=match3] and 1 more...", redundantDBO.describe());
}
use of org.alfresco.util.schemacomp.model.DbObject in project alfresco-repository by Alfresco.
the class MySQLDialectExportTester method doExportTest.
@Override
protected void doExportTest() throws Exception {
Schema schema = getSchema();
Table exampleTable = null;
Table otherTable = null;
for (DbObject dbo : schema) {
if (dbo.getName().equals("export_test_example")) {
exampleTable = (Table) dbo;
}
if (dbo.getName().equals("export_test_other")) {
otherTable = (Table) dbo;
}
}
checkExampleTable(schema, exampleTable);
checkOtherTable(schema, otherTable);
}
use of org.alfresco.util.schemacomp.model.DbObject in project alfresco-repository by Alfresco.
the class DbObjectXMLTransformer method transformSchema.
private void transformSchema(Schema schema) throws SAXException {
simpleStartTag(XML.EL_OBJECTS);
for (DbObject dbo : schema) {
output(dbo);
}
simpleEndTag(XML.EL_OBJECTS);
}
Aggregations