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;
}
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");
}
}
Aggregations