Search in sources :

Example 1 with InternalDbService

use of com.emc.storageos.db.server.upgrade.util.InternalDbService in project coprhd-controller by CoprHD.

the class DbServiceTestBase method startDb.

/**
 * Start embedded DB
 */
protected void startDb(String schemaVersion, String extraModelsPkg) throws Exception {
    List<String> packages = new ArrayList<String>();
    packages.add("com.emc.storageos.db.client.model");
    if (extraModelsPkg != null) {
        packages.add(extraModelsPkg);
    }
    String[] pkgsArray = packages.toArray(new String[packages.size()]);
    ServiceImpl service = new ServiceImpl();
    service.setName("dbsvc");
    service.setVersion(schemaVersion);
    service.setEndpoint(URI.create("thrift://localhost:9160"));
    service.setId("db-standalone");
    DataObjectScanner scanner = new DataObjectScanner();
    scanner.setPackages(pkgsArray);
    scanner.init();
    dbVersionInfo = new DbVersionInfo();
    dbVersionInfo.setSchemaVersion(schemaVersion);
    coordinator.setDbVersionInfo(dbVersionInfo);
    DbServiceStatusChecker statusChecker = new DbServiceStatusChecker();
    statusChecker.setCoordinator(coordinator);
    statusChecker.setClusterNodeCount(1);
    statusChecker.setDbVersionInfo(dbVersionInfo);
    statusChecker.setServiceName(service.getName());
    CoordinatorClientInetAddressMap coordinatorMap = new CoordinatorClientInetAddressMap();
    coordinatorMap.setNodeId("localhost");
    coordinatorMap.setDualInetAddress(DualInetAddress.fromAddress("127.0.0.1"));
    Map<String, DualInetAddress> addressLookupMap = new HashMap<String, DualInetAddress>();
    addressLookupMap.put(coordinatorMap.getNodeId(), coordinatorMap.getDualInetAddress());
    coordinatorMap.setControllerNodeIPLookupMap(addressLookupMap);
    coordinatorMap.setCoordinatorClient(coordinator);
    coordinator.setInetAddessLookupMap(coordinatorMap);
    SchemaUtil util = new SchemaUtil();
    util.setKeyspaceName("Test");
    util.setClusterName("Test");
    util.setDataObjectScanner(scanner);
    util.setService(service);
    util.setStatusChecker(statusChecker);
    util.setCoordinator(coordinator);
    util.setVdcShortId("vdc1");
    util.setClientContext(createLocalContext());
    List<String> vdcHosts = new ArrayList();
    vdcHosts.add("127.0.0.1");
    util.setVdcNodeList(vdcHosts);
    util.setDbCommonInfo(new java.util.Properties());
    dbsvc = new InternalDbService();
    dbsvc.setConfig("db-test.yaml");
    dbsvc.setSchemaUtil(util);
    dbsvc.setCoordinator(coordinator);
    dbsvc.setStatusChecker(statusChecker);
    dbsvc.setService(service);
    dbsvc.setDbDir(".");
    JmxServerWrapper jmx = new JmxServerWrapper();
    jmx.setEnabled(false);
    dbsvc.setJmxServerWrapper(jmx);
    dbClient = getDbClientBase();
    dbsvc.setDbClient(dbClient);
    PasswordUtils passwordUtils = new PasswordUtils();
    passwordUtils.setCoordinator(coordinator);
    EncryptionProviderImpl provider = new EncryptionProviderImpl();
    provider.setCoordinator(coordinator);
    provider.start();
    passwordUtils.setEncryptionProvider(provider);
    passwordUtils.setDbClient(dbClient);
    util.setPasswordUtils(passwordUtils);
    StubBeaconImpl beacon = new StubBeaconImpl(service);
    dbsvc.setBeacon(beacon);
    MigrationHandlerImpl handler = new MigrationHandlerImpl();
    handler.setPackages(pkgsArray);
    handler.setService(service);
    handler.setStatusChecker(statusChecker);
    handler.setCoordinator(coordinator);
    handler.setDbClient(dbClient);
    handler.setSchemaUtil(util);
    dbsvc.setMigrationHandler(handler);
    dbsvc.setDisableScheduledDbRepair(true);
    dbsvc.start();
}
Also used : DataObjectScanner(com.emc.storageos.db.common.DataObjectScanner) InternalDbService(com.emc.storageos.db.server.upgrade.util.InternalDbService) HashMap(java.util.HashMap) ServiceImpl(com.emc.storageos.coordinator.common.impl.ServiceImpl) MigrationHandlerImpl(com.emc.storageos.db.server.impl.MigrationHandlerImpl) ArrayList(java.util.ArrayList) DbServiceStatusChecker(com.emc.storageos.db.common.DbServiceStatusChecker) PasswordUtils(com.emc.storageos.security.password.PasswordUtils) EncryptionProviderImpl(com.emc.storageos.db.client.impl.EncryptionProviderImpl) DbVersionInfo(com.emc.storageos.coordinator.client.model.DbVersionInfo) SchemaUtil(com.emc.storageos.db.server.impl.SchemaUtil) CoordinatorClientInetAddressMap(com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap) StubBeaconImpl(com.emc.storageos.db.server.util.StubBeaconImpl) JmxServerWrapper(com.emc.storageos.services.util.JmxServerWrapper) DualInetAddress(com.emc.storageos.coordinator.client.service.impl.DualInetAddress)

Aggregations

DbVersionInfo (com.emc.storageos.coordinator.client.model.DbVersionInfo)1 CoordinatorClientInetAddressMap (com.emc.storageos.coordinator.client.service.impl.CoordinatorClientInetAddressMap)1 DualInetAddress (com.emc.storageos.coordinator.client.service.impl.DualInetAddress)1 ServiceImpl (com.emc.storageos.coordinator.common.impl.ServiceImpl)1 EncryptionProviderImpl (com.emc.storageos.db.client.impl.EncryptionProviderImpl)1 DataObjectScanner (com.emc.storageos.db.common.DataObjectScanner)1 DbServiceStatusChecker (com.emc.storageos.db.common.DbServiceStatusChecker)1 MigrationHandlerImpl (com.emc.storageos.db.server.impl.MigrationHandlerImpl)1 SchemaUtil (com.emc.storageos.db.server.impl.SchemaUtil)1 InternalDbService (com.emc.storageos.db.server.upgrade.util.InternalDbService)1 StubBeaconImpl (com.emc.storageos.db.server.util.StubBeaconImpl)1 PasswordUtils (com.emc.storageos.security.password.PasswordUtils)1 JmxServerWrapper (com.emc.storageos.services.util.JmxServerWrapper)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1