Search in sources :

Example 1 with DataObjectSchema

use of com.emc.storageos.db.common.schema.DataObjectSchema in project coprhd-controller by CoprHD.

the class BaseDbSchemaCheckerTest method testMoveFieldToBaseClass.

@Test
public void testMoveFieldToBaseClass() {
    srcSchemas.setSchemas(new ArrayList<DbSchema>());
    tgtSchemas.setSchemas(new ArrayList<DbSchema>());
    srcSchema = new DataObjectSchema(ChildClassUTBefore.class);
    srcSchema.setType(srcSchema.getType());
    srcSchemas.addSchema(srcSchema);
    tgtSchema = new DataObjectSchema(ChildClassUTAfter1.class);
    tgtSchema.setType(tgtSchema.getType());
    tgtSchemas.addSchema(tgtSchema);
    tgtSchema = new DataObjectSchema(ChildClassUTAfter2.class);
    tgtSchema.setType(tgtSchema.getType());
    tgtSchemas.addSchema(tgtSchema);
    diff = new DbSchemasDiff(srcSchemas, tgtSchemas);
    Assert.assertTrue(diff.isUpgradable());
    Assert.assertTrue(diff.isChanged());
}
Also used : DataObjectSchema(com.emc.storageos.db.common.schema.DataObjectSchema) DbSchema(com.emc.storageos.db.common.schema.DbSchema) DbSchemasDiff(com.emc.storageos.db.common.diff.DbSchemasDiff) Test(org.junit.Test)

Example 2 with DataObjectSchema

use of com.emc.storageos.db.common.schema.DataObjectSchema in project coprhd-controller by CoprHD.

the class BaseDbSchemaCheckerTest method testCustomMigrationPreUpgrade.

@Test
public void testCustomMigrationPreUpgrade() {
    srcSchemas.setSchemas(new ArrayList<DbSchema>());
    tgtSchemas.setSchemas(new ArrayList<DbSchema>());
    srcSchema = new DataObjectSchema(CustomMigrationExistingField.class);
    srcSchema.setType(srcSchema.getType());
    srcSchemas.addSchema(srcSchema);
    tgtSchema = new DataObjectSchema(CustomMigrationExistingAndNewField.class);
    tgtSchema.setType(tgtSchema.getType());
    tgtSchemas.addSchema(tgtSchema);
    diff = new DbSchemasDiff(srcSchemas, tgtSchemas);
    Assert.assertTrue(diff.isUpgradable());
    Assert.assertTrue(diff.isChanged());
}
Also used : DataObjectSchema(com.emc.storageos.db.common.schema.DataObjectSchema) DbSchema(com.emc.storageos.db.common.schema.DbSchema) DbSchemasDiff(com.emc.storageos.db.common.diff.DbSchemasDiff) Test(org.junit.Test)

Example 3 with DataObjectSchema

use of com.emc.storageos.db.common.schema.DataObjectSchema in project coprhd-controller by CoprHD.

the class DbSchemaCheckerTest method testNewFieldAnnotationValue.

@Test
public void testNewFieldAnnotationValue() {
    tgtSchema = new DataObjectSchema(WithChangedAnnotationValue.class);
    tgtSchema.setType(srcSchema.getType());
    tgtSchemas.addSchema(tgtSchema);
    DbSchemasDiff diff = new DbSchemasDiff(srcSchemas, tgtSchemas);
    Assert.assertFalse(diff.isUpgradable());
    Assert.assertTrue(diff.isChanged());
}
Also used : DataObjectSchema(com.emc.storageos.db.common.schema.DataObjectSchema) DbSchemasDiff(com.emc.storageos.db.common.diff.DbSchemasDiff) Test(org.junit.Test)

Example 4 with DataObjectSchema

use of com.emc.storageos.db.common.schema.DataObjectSchema in project coprhd-controller by CoprHD.

the class DbSchemaCheckerTest method testMultipleIllegalUpgradeChanges.

@Test
public void testMultipleIllegalUpgradeChanges() {
    srcSchema = new DataObjectSchema(WithIndexAnnotation.class);
    srcSchema.setType(srcSchema.getType());
    srcSchemas.addSchema(srcSchema);
    srcSchema = new DataObjectSchema(ClassUT7.class);
    srcSchema.setType(srcSchema.getType());
    srcSchemas.addSchema(srcSchema);
    srcSchema = new DataObjectSchema(ClassUT4.class);
    srcSchema.setType(srcSchema.getType());
    srcSchemas.addSchema(srcSchema);
    srcSchema = new DataObjectSchema(ClassUT5.class);
    srcSchema.setType(srcSchema.getType());
    srcSchemas.addSchema(srcSchema);
    tgtSchema = new DataObjectSchema(WithRemovedIndexAnnotation.class);
    tgtSchema.setType(srcSchema.getType());
    tgtSchemas.addSchema(tgtSchema);
    tgtSchema = new DataObjectSchema(ClassUT3.class);
    tgtSchema.setType(srcSchema.getType());
    tgtSchemas.addSchema(tgtSchema);
    tgtSchema = new DataObjectSchema(ClassUT6.class);
    tgtSchema.setType(srcSchema.getType());
    tgtSchemas.addSchema(tgtSchema);
    DbSchemasDiff diff = new DbSchemasDiff(srcSchemas, tgtSchemas);
    Assert.assertFalse(diff.isUpgradable());
    Assert.assertTrue(diff.isChanged());
}
Also used : DataObjectSchema(com.emc.storageos.db.common.schema.DataObjectSchema) DbSchemasDiff(com.emc.storageos.db.common.diff.DbSchemasDiff) Test(org.junit.Test)

Example 5 with DataObjectSchema

use of com.emc.storageos.db.common.schema.DataObjectSchema in project coprhd-controller by CoprHD.

the class DbSchemaCheckerTest method testGeoNewAnnotationOnNewCF.

@Test
public void testGeoNewAnnotationOnNewCF() {
    DbSchema srcGeoSchema = new DataObjectSchema(GeoClassUT.class);
    srcSchemas.addSchema(srcGeoSchema);
    tgtSchemas.addSchema(srcGeoSchema);
    tgtSchema = new DataObjectSchema(GeoNewCF.class);
    tgtSchema.setType(srcSchema.getType());
    tgtSchemas.addSchema(tgtSchema);
    tgtSchemas.addSchema(srcSchema);
    DbSchemasDiff diff = new DbSchemasDiff(srcSchemas, tgtSchemas);
    // Adding index of new Geo object is allowed
    Assert.assertTrue(diff.isUpgradable());
    Assert.assertTrue(diff.isChanged());
}
Also used : DataObjectSchema(com.emc.storageos.db.common.schema.DataObjectSchema) DbSchema(com.emc.storageos.db.common.schema.DbSchema) DbSchemasDiff(com.emc.storageos.db.common.diff.DbSchemasDiff) Test(org.junit.Test)

Aggregations

DataObjectSchema (com.emc.storageos.db.common.schema.DataObjectSchema)23 DbSchemasDiff (com.emc.storageos.db.common.diff.DbSchemasDiff)21 Test (org.junit.Test)21 DbSchema (com.emc.storageos.db.common.schema.DbSchema)6 DbKeyspace (com.emc.storageos.db.client.model.DbKeyspace)1 TimeSeries (com.emc.storageos.db.client.model.TimeSeries)1 TimeSeriesSerializer (com.emc.storageos.db.client.model.TimeSeriesSerializer)1 DataPointSchema (com.emc.storageos.db.common.schema.DataPointSchema)1 DbSchemas (com.emc.storageos.db.common.schema.DbSchemas)1 TimeSeriesSchema (com.emc.storageos.db.common.schema.TimeSeriesSchema)1 Before (org.junit.Before)1