Search in sources :

Example 16 with DbClientContext

use of com.emc.storageos.db.client.impl.DbClientContext in project coprhd-controller by CoprHD.

the class ExportUtilsTests method setupTest.

@Before
public void setupTest() {
    DbClientImplUnitTester dbClient = new DbClientImplUnitTester();
    dbClient.setCoordinatorClient(_coordinator);
    dbClient.setDbVersionInfo(sourceVersion);
    dbClient.setBypassMigrationLock(true);
    _encryptionProvider.setCoordinator(_coordinator);
    dbClient.setEncryptionProvider(_encryptionProvider);
    DbClientContext localCtx = new DbClientContext();
    localCtx.setClusterName("Test");
    localCtx.setKeyspaceName("Test");
    dbClient.setLocalContext(localCtx);
    VdcUtil.setDbClient(dbClient);
    dbClient.setBypassMigrationLock(false);
    dbClient.start();
    _dbClient = dbClient;
}
Also used : DbClientContext(com.emc.storageos.db.client.impl.DbClientContext) DbClientImplUnitTester(com.emc.storageos.db.server.DbClientTest.DbClientImplUnitTester) Before(org.junit.Before)

Example 17 with DbClientContext

use of com.emc.storageos.db.client.impl.DbClientContext in project coprhd-controller by CoprHD.

the class InternalDbClient method getKeyspace.

@Override
public <T extends DataObject> Keyspace getKeyspace(Class<T> clazz) {
    DbClientContext ctx = null;
    if (localContext == null || geoContext == null) {
        throw new IllegalStateException();
    }
    ctx = KeyspaceUtil.isGlobal(clazz) ? geoContext : localContext;
    if (!ctx.isInitDone()) {
        String serviceName = ctx.equals(geoContext) ? Constants.GEODBSVC_NAME : Constants.DBSVC_NAME;
        log.info("Initialize db context {}", serviceName);
        setupContext(ctx, serviceName);
    }
    return ctx.getKeyspace();
}
Also used : DbClientContext(com.emc.storageos.db.client.impl.DbClientContext)

Aggregations

DbClientContext (com.emc.storageos.db.client.impl.DbClientContext)17 DrUtil (com.emc.storageos.coordinator.client.service.DrUtil)4 Before (org.junit.Before)4 DbVersionInfo (com.emc.storageos.coordinator.client.model.DbVersionInfo)3 DbClientImpl (com.emc.storageos.db.client.impl.DbClientImpl)3 DbClientImplUnitTester (com.emc.storageos.db.server.DbClientTest.DbClientImplUnitTester)3 CoordinatorClientInetAddressMap (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)2 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)2 IOException (java.io.IOException)2 NoSuchAlgorithmException (java.security.NoSuchAlgorithmException)2 SiteInfo (com.emc.storageos.coordinator.client.model.SiteInfo)1 CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)1 CoordinatorClientImpl (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientImpl)1 DualInetAddress (com.emc.storageos.coordinator.client.service.impl.DualInetAddress)1 Configuration (com.emc.storageos.coordinator.common.Configuration)1 ConfigurationImpl (com.emc.storageos.coordinator.common.impl.ConfigurationImpl)1 ServiceImpl (com.emc.storageos.coordinator.common.impl.ServiceImpl)1 ZkConnection (com.emc.storageos.coordinator.common.impl.ZkConnection)1 CoordinatorException (com.emc.storageos.coordinator.exceptions.CoordinatorException)1 FatalCoordinatorException (com.emc.storageos.coordinator.exceptions.FatalCoordinatorException)1