Search in sources :

Example 1 with BaseCustomMigrationCallback

use of com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback in project coprhd-controller by CoprHD.

the class MockMigrationHandler method run.

@Override
public boolean run() throws DatabaseException {
    for (Entry<String, List<BaseCustomMigrationCallback>> entry : this.getCustomMigrationCallbacks().entrySet()) {
        log.info("execute migration callback under {}", entry.getKey());
        for (BaseCustomMigrationCallback callback : entry.getValue()) {
            callback.setName(callback.getClass().getName());
            callback.setDbClient(this.getDbClient());
            callback.setCoordinatorClient(this.getCoordinator());
            log.info("Invoking migration callback: " + callback.getName());
            try {
                callback.process();
            } catch (MigrationCallbackException e) {
                log.error("invoke migration callback {} failed:{}", callback.getName(), e);
                return false;
            }
        }
    }
    return true;
}
Also used : BaseCustomMigrationCallback(com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback) MigrationCallbackException(com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException) List(java.util.List)

Example 2 with BaseCustomMigrationCallback

use of com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback in project coprhd-controller by CoprHD.

the class BlockSnapshotSessionMigrationTest method setup.

/**
 * Setup method executed before test is executed.
 *
 * @throws IOException
 */
@BeforeClass
public static void setup() throws IOException {
    customMigrationCallbacks.put("2.4", new ArrayList<BaseCustomMigrationCallback>() {

        private static final long serialVersionUID = 1L;

        {
            // Add your implementation of migration callback below.
            add(new BlockSnapshotSessionMigration());
        }
    });
    // Adding this, which is typically executed in the base class
    // call, as it is needed to clear the DB file between runs.
    _dataDir = new File(dataDir);
    if (_dataDir.exists() && _dataDir.isDirectory()) {
        cleanDirectory(_dataDir);
    }
    _dataDir.mkdir();
// Commenting this out as it prevents the migration callback
// from being executed when the test is executed.
// DbsvcTestBase.setup();
}
Also used : BaseCustomMigrationCallback(com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback) BlockSnapshotSessionMigration(com.emc.storageos.db.client.upgrade.callbacks.BlockSnapshotSessionMigration) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Example 3 with BaseCustomMigrationCallback

use of com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback in project coprhd-controller by CoprHD.

the class XtremioBlockSnapshotDeviceLabelMigrationTest method setup.

@BeforeClass
public static void setup() throws IOException {
    customMigrationCallbacks.put("2.3", new ArrayList<BaseCustomMigrationCallback>() {

        {
            add(new XtremioBlockSnapshotDeviceLabelMigration());
        }
    });
    // Adding this, which is typically executed in the base class
    // call, as it is needed to clear the DB file between runs.
    _dataDir = new File(dataDir);
    if (_dataDir.exists() && _dataDir.isDirectory()) {
        cleanDirectory(_dataDir);
    }
    _dataDir.mkdir();
    // Commenting this out as it prevents the migration callback
    // from being executed when the test is executed.
    // DbsvcTestBase.setup();
    log.info("completed setup");
}
Also used : BaseCustomMigrationCallback(com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback) XtremioBlockSnapshotDeviceLabelMigration(com.emc.storageos.db.client.upgrade.callbacks.XtremioBlockSnapshotDeviceLabelMigration) File(java.io.File) BeforeClass(org.junit.BeforeClass)

Aggregations

BaseCustomMigrationCallback (com.emc.storageos.db.client.upgrade.BaseCustomMigrationCallback)3 File (java.io.File)2 BeforeClass (org.junit.BeforeClass)2 BlockSnapshotSessionMigration (com.emc.storageos.db.client.upgrade.callbacks.BlockSnapshotSessionMigration)1 XtremioBlockSnapshotDeviceLabelMigration (com.emc.storageos.db.client.upgrade.callbacks.XtremioBlockSnapshotDeviceLabelMigration)1 MigrationCallbackException (com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException)1 List (java.util.List)1