Search in sources :

Example 6 with DbSchemasDiff

use of com.emc.storageos.db.common.diff.DbSchemasDiff in project coprhd-controller by CoprHD.

the class DbSchemaCheckerTest method testNewClassAnnotationValue.

@Test
public void testNewClassAnnotationValue() {
    tgtSchema = new DataObjectSchema(NewClassAnnotationValue.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 7 with DbSchemasDiff

use of com.emc.storageos.db.common.diff.DbSchemasDiff in project coprhd-controller by CoprHD.

the class DbSchemaCheckerTest method testRemovedClassAnnotation.

@Test
public void testRemovedClassAnnotation() {
    tgtSchema = new DataObjectSchema(RemovedClassAnnotation.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 8 with DbSchemasDiff

use of com.emc.storageos.db.common.diff.DbSchemasDiff in project coprhd-controller by CoprHD.

the class DbSchemaCheckerTest method testNewClassAnnotation.

@Test
public void testNewClassAnnotation() {
    tgtSchema = new DataObjectSchema(NewClassAnnotation.class);
    // a little bit of hack
    tgtSchema.setType(srcSchema.getType());
    tgtSchemas.addSchema(tgtSchema);
    DbSchemasDiff diff = new DbSchemasDiff(srcSchemas, tgtSchemas);
    // No new class annotation is allowed
    Assert.assertFalse(diff.isUpgradable());
    Assert.assertTrue(diff.isChanged());
    Assert.assertTrue(diff.getNewClasses().isEmpty());
    Assert.assertTrue(diff.getNewFields().isEmpty());
    Assert.assertFalse(diff.getNewClassAnnotations().isEmpty());
    Assert.assertEquals(diff.getNewClassAnnotations().size(), 1);
    Assert.assertTrue(diff.getNewFieldAnnotations().isEmpty());
    Assert.assertTrue(diff.getNewAnnotationValues().isEmpty());
}
Also used : DataObjectSchema(com.emc.storageos.db.common.schema.DataObjectSchema) DbSchemasDiff(com.emc.storageos.db.common.diff.DbSchemasDiff) Test(org.junit.Test)

Example 9 with DbSchemasDiff

use of com.emc.storageos.db.common.diff.DbSchemasDiff in project coprhd-controller by CoprHD.

the class DbSchemaCheckerTest method testNewField.

@Test
public void testNewField() {
    tgtSchema = new DataObjectSchema(NewField.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.assertFalse(diff.getNewFields().isEmpty());
    Assert.assertEquals(diff.getNewFields().size(), 1);
    Assert.assertTrue(diff.getNewClassAnnotations().isEmpty());
    Assert.assertTrue(diff.getNewFieldAnnotations().isEmpty());
    Assert.assertTrue(diff.getNewAnnotationValues().isEmpty());
}
Also used : DataObjectSchema(com.emc.storageos.db.common.schema.DataObjectSchema) DbSchemasDiff(com.emc.storageos.db.common.diff.DbSchemasDiff) Test(org.junit.Test)

Example 10 with DbSchemasDiff

use of com.emc.storageos.db.common.diff.DbSchemasDiff in project coprhd-controller by CoprHD.

the class DbSchemaCheckerTest method testNewFieldType.

@Test
public void testNewFieldType() {
    tgtSchema = new DataObjectSchema(NewFieldType.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)

Aggregations

DbSchemasDiff (com.emc.storageos.db.common.diff.DbSchemasDiff)24 DataObjectSchema (com.emc.storageos.db.common.schema.DataObjectSchema)21 Test (org.junit.Test)21 DbSchema (com.emc.storageos.db.common.schema.DbSchema)6 DbSchemas (com.emc.storageos.db.common.schema.DbSchemas)3 ArrayList (java.util.ArrayList)2 MigrationStatus (com.emc.storageos.coordinator.client.model.MigrationStatus)1 FatalCoordinatorException (com.emc.storageos.coordinator.exceptions.FatalCoordinatorException)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 FatalDatabaseException (com.emc.storageos.db.exceptions.FatalDatabaseException)1 MigrationCallbackException (com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException)1 BufferedReader (java.io.BufferedReader)1 FileReader (java.io.FileReader)1 List (java.util.List)1 InterProcessLock (org.apache.curator.framework.recipes.locks.InterProcessLock)1