use of com.emc.storageos.db.common.diff.DbSchemasDiff in project coprhd-controller by CoprHD.
the class DbSchemaCheckerTest method testRemovedFieldAnnotation.
@Test
public void testRemovedFieldAnnotation() {
tgtSchema = new DataObjectSchema(RemovedFieldAnnotation.class);
tgtSchema.setType(srcSchema.getType());
tgtSchemas.addSchema(tgtSchema);
DbSchemasDiff diff = new DbSchemasDiff(srcSchemas, tgtSchemas);
Assert.assertFalse(diff.isUpgradable());
Assert.assertTrue(diff.isChanged());
}
use of com.emc.storageos.db.common.diff.DbSchemasDiff in project coprhd-controller by CoprHD.
the class DbSchemaCheckerTest method testRemovedFieldIndexAnnotation.
@Test
public void testRemovedFieldIndexAnnotation() {
srcSchema = new DataObjectSchema(WithIndexAnnotation.class);
srcSchema.setType(srcSchema.getType());
srcSchemas.addSchema(srcSchema);
tgtSchema = new DataObjectSchema(WithRemovedIndexAnnotation.class);
tgtSchema.setType(srcSchema.getType());
tgtSchemas.addSchema(tgtSchema);
DbSchemasDiff diff = new DbSchemasDiff(srcSchemas, tgtSchemas);
Assert.assertFalse(diff.isUpgradable());
Assert.assertTrue(diff.isChanged());
}
use of com.emc.storageos.db.common.diff.DbSchemasDiff in project coprhd-controller by CoprHD.
the class DbSchemaCheckerTest method testNewPermittedFieldAnnotation.
@Test
public void testNewPermittedFieldAnnotation() {
tgtSchema = new DataObjectSchema(NewPermittedFieldAnnotation.class);
tgtSchema.setType(srcSchema.getType());
tgtSchemas.addSchema(tgtSchema);
DbSchemasDiff diff = new DbSchemasDiff(srcSchemas, tgtSchemas);
Assert.assertTrue(diff.isUpgradable());
Assert.assertTrue(diff.isChanged());
Assert.assertTrue(diff.getNewClasses().isEmpty());
Assert.assertTrue(diff.getNewFields().isEmpty());
Assert.assertTrue(diff.getNewClassAnnotations().isEmpty());
Assert.assertFalse(diff.getNewFieldAnnotations().isEmpty());
Assert.assertEquals(diff.getNewFieldAnnotations().size(), 1);
Assert.assertTrue(diff.getNewAnnotationValues().isEmpty());
}
use of com.emc.storageos.db.common.diff.DbSchemasDiff in project coprhd-controller by CoprHD.
the class DbSchemaChecker method genGeoDiffs.
/**
* Filter out all the non-geo db schemas from the spec and generate a diff
* Note that some CFs might have been migrated from local db to geo db
* So we need to grab a latest list of geo schemas from the current schema first.
*
* @param spec the db schema spec generated from the baseline file
* @param geoSchemas the latest list of geo schemas from the current DbSchemas object
* @return
*/
private static DbSchemasDiff genGeoDiffs(DbSchemas spec, List<DbSchema> geoSchemas) {
// prepare a list of geo schema names
List<String> geoSchemaNames = new ArrayList<>();
for (DbSchema geoSchema : geoSchemas) {
geoSchemaNames.add(geoSchema.getName());
}
List<DbSchema> specSchemaList = new ArrayList<>();
for (DbSchema schema : spec.getSchemas()) {
if (geoSchemaNames.contains(schema.getName())) {
specSchemaList.add(schema);
}
}
return new DbSchemasDiff(new DbSchemas(specSchemaList), new DbSchemas(geoSchemas));
}
Aggregations