use of com.emc.storageos.db.common.schema.DataObjectSchema 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.schema.DataObjectSchema 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.schema.DataObjectSchema in project coprhd-controller by CoprHD.
the class DbSchemaScanner method processClass.
@Override
protected void processClass(Class clazz) {
DbSchema schema = null;
if (DataObject.class.isAssignableFrom(clazz)) {
if (_scannerInterceptor != null && _scannerInterceptor.isClassIgnored(clazz.getSimpleName())) {
log.info("{} is ignored in schema due to interceptor", clazz.getSimpleName());
return;
}
schema = new DataObjectSchema(clazz, _scannerInterceptor);
if (clazz.isAnnotationPresent(DbKeyspace.class)) {
DbKeyspace anno = (DbKeyspace) clazz.getAnnotation(DbKeyspace.class);
if (DbKeyspace.Keyspaces.GLOBAL.equals(anno.value())) {
geoSchemas.add(schema);
}
}
} else if (TimeSeries.class.isAssignableFrom(clazz)) {
schema = new TimeSeriesSchema(clazz);
} else if (TimeSeriesSerializer.DataPoint.class.isAssignableFrom(clazz)) {
schema = new DataPointSchema(clazz);
} else {
return;
}
schemas.addSchema(schema);
}
Aggregations