Search in sources :

Example 6 with InternalDbClient

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

the class DbServiceTestBase method getDbClientBase.

protected DbClientImpl getDbClientBase() {
    InternalDbClient dbClient = new InternalDbClient();
    dbClient.setCoordinatorClient(coordinator);
    dbClient.setDbVersionInfo(dbVersionInfo);
    dbClient.setBypassMigrationLock(true);
    dbClient.setLocalContext(createLocalContext());
    VdcUtil.setDbClient(dbClient);
    return dbClient;
}
Also used : InternalDbClient(com.emc.storageos.db.client.upgrade.InternalDbClient)

Example 7 with InternalDbClient

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

the class DbClientTest method testRemoveIndex.

@Test
public void testRemoveIndex() {
    StoragePool pool = createStoragePools(1, "storagepool").iterator().next();
    List<Volume> vols = createVolumes(3, "volume", null, pool);
    Constraint constraint = ContainmentConstraint.Factory.getVirtualPoolVolumeConstraint(pool.getId());
    URIQueryResultList results = new URIQueryResultList();
    _dbClient.queryByConstraint(constraint, results);
    Assert.assertEquals(size(results), 3);
    // delete the index records
    if (InternalDbClient.class.isAssignableFrom(_dbClient.getClass())) {
        ((InternalDbClient) _dbClient).removeFieldIndex(Volume.class, "pool", "RelationIndex");
        URIQueryResultList results2 = new URIQueryResultList();
        _dbClient.queryByConstraint(constraint, results2);
        Assert.assertFalse(results2.iterator().hasNext());
    } else {
        Assert.fail("testRemoveIndex requires InternalDbClient");
    }
}
Also used : StoragePool(com.emc.storageos.db.client.model.StoragePool) Volume(com.emc.storageos.db.client.model.Volume) PrefixConstraint(com.emc.storageos.db.client.constraint.PrefixConstraint) AlternateIdConstraint(com.emc.storageos.db.client.constraint.AlternateIdConstraint) ContainmentPrefixConstraint(com.emc.storageos.db.client.constraint.ContainmentPrefixConstraint) AggregatedConstraint(com.emc.storageos.db.client.constraint.AggregatedConstraint) ContainmentPermissionsConstraint(com.emc.storageos.db.client.constraint.ContainmentPermissionsConstraint) Constraint(com.emc.storageos.db.client.constraint.Constraint) ContainmentConstraint(com.emc.storageos.db.client.constraint.ContainmentConstraint) InternalDbClient(com.emc.storageos.db.client.upgrade.InternalDbClient) URIQueryResultList(com.emc.storageos.db.client.constraint.URIQueryResultList) Test(org.junit.Test)

Aggregations

InternalDbClient (com.emc.storageos.db.client.upgrade.InternalDbClient)7 AggregatedConstraint (com.emc.storageos.db.client.constraint.AggregatedConstraint)1 AlternateIdConstraint (com.emc.storageos.db.client.constraint.AlternateIdConstraint)1 Constraint (com.emc.storageos.db.client.constraint.Constraint)1 ContainmentConstraint (com.emc.storageos.db.client.constraint.ContainmentConstraint)1 ContainmentPermissionsConstraint (com.emc.storageos.db.client.constraint.ContainmentPermissionsConstraint)1 ContainmentPrefixConstraint (com.emc.storageos.db.client.constraint.ContainmentPrefixConstraint)1 PrefixConstraint (com.emc.storageos.db.client.constraint.PrefixConstraint)1 URIQueryResultList (com.emc.storageos.db.client.constraint.URIQueryResultList)1 CompositeColumnName (com.emc.storageos.db.client.impl.CompositeColumnName)1 DataObjectType (com.emc.storageos.db.client.impl.DataObjectType)1 StoragePool (com.emc.storageos.db.client.model.StoragePool)1 Volume (com.emc.storageos.db.client.model.Volume)1 MigrationCallbackException (com.emc.storageos.svcs.errorhandling.resources.MigrationCallbackException)1 Keyspace (com.netflix.astyanax.Keyspace)1 Row (com.netflix.astyanax.model.Row)1 Rows (com.netflix.astyanax.model.Rows)1 InvocationTargetException (java.lang.reflect.InvocationTargetException)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1