use of com.emc.storageos.volumecontroller.impl.ControllerServiceImpl.Lock in project coprhd-controller by CoprHD.
the class DataCollectionTest method setup.
@Before
public void setup() {
try {
for (Lock lock : Lock.values()) {
Method method = lock.getClass().getDeclaredMethod("setLock", InterProcessLock.class);
method.setAccessible(true);
Object[] parameters = new Object[1];
parameters[0] = _coordinator.getLock(lock.name());
method.invoke(lock, parameters);
}
_dbClient.start();
if (_provider != null) {
String providerKey = _provider.getIPAddress() + "-" + _provider.getPortNumber();
List<StorageProvider> providers = CustomQueryUtility.getActiveStorageProvidersByProviderId(_dbClient, providerKey);
if (providers != null && !providers.isEmpty()) {
_providerURI = providers.get(0).getId();
_logger.warn("Provider has already been in db.");
} else if (isTestNewProvider) {
_providerURI = URIUtil.createId(StorageProvider.class);
_provider.setId(_providerURI);
_dbClient.createObject(_provider);
}
}
CIMConnectionFactory cimConnectionFactory = new CIMConnectionFactory();
cimConnectionFactory.setDbClient(_dbClient);
cimConnectionFactory.setConnectionManager(_connectionManager);
DataCollectionJobScheduler scheduler = new DataCollectionJobScheduler();
scheduler.setConfigInfo(_configInfo);
scheduler.setConnectionFactory(cimConnectionFactory);
scheduler.setCoordinator(_coordinator);
scheduler.setDbClient(_dbClient);
_jobUtil = new DataCollectionJobUtil();
_jobUtil.setDbClient(_dbClient);
_jobUtil.setConfigInfo(_configInfo);
_jobConsumer = new TestDataCollectionJobConsumer();
_jobConsumer.setConfigInfo(_configInfo);
_jobConsumer.setConnectionFactory(cimConnectionFactory);
_jobConsumer.setCoordinator(_coordinator);
_jobConsumer.setDbClient(_dbClient);
_jobConsumer.setUtil(_jobUtil);
_jobConsumer.setJobScheduler(scheduler);
VersionChecker versionChecker = new VersionChecker();
versionChecker.setCoordinator(_coordinator);
} catch (Exception e) {
_logger.error("Failed to run setup. Exception - " + e.getMessage());
_logger.error(e.getMessage(), e);
}
}
Aggregations