use of com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo in project coprhd-controller by CoprHD.
the class ShutdownTask method main.
public static void main(String[] args) {
try {
// Set the shutdown delay is one is passed.
if (args.length > 0) {
_shutdownDelay = Long.parseLong(args[0]);
}
// Create and start the connection manager.
ClassPathXmlApplicationContext springContext = new ClassPathXmlApplicationContext(SPRING_CONFIG_FILE);
_connectionManager = (ConnectionManager) springContext.getBean(CONNECTION_MANAGER_BEAN);
// Create a CIM connection info and add the connection.
CimConnectionInfo connectionInfo = new CimConnectionInfo();
connectionInfo.setType(CimConstants.ECOM_CONNECTION_TYPE);
connectionInfo.setHost(providerIP);
connectionInfo.setPort(providerPort);
connectionInfo.setUser(providerUser);
connectionInfo.setPassword(providerPassword);
connectionInfo.setInteropNS(providerInterOpNamespace);
connectionInfo.setImplNS(providerNamespace);
connectionInfo.setUseSSL(isProviderSslEnabled);
_connectionManager.addConnection(connectionInfo);
// Create the shut down task and schedule it.
ShutdownTask shutDownTask = new ShutdownTask();
Timer timer = new Timer();
timer.schedule(shutDownTask, _shutdownDelay);
} catch (Exception e) {
s_logger.error("Exception adding connection.", e);
}
}
use of com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo in project coprhd-controller by CoprHD.
the class ConnectionManagerTest method testAddConnectionECOM.
/**
* Tests the addConnection method for an ECOM connection type.
*/
@Test
public void testAddConnectionECOM() {
Assert.assertNotNull(_connectionManager);
// Create the connection info.
CimConnectionInfo connectionInfo = new CimConnectionInfo();
connectionInfo.setType(CimConstants.ECOM_CONNECTION_TYPE);
connectionInfo.setHost(PROVIDER_IP);
connectionInfo.setPort(PROVIDER_PORT);
connectionInfo.setUser(PROVIDER_USER);
connectionInfo.setPassword(PROVIDER_PWD);
connectionInfo.setInteropNS(PROVIDER_INTEROP_NS);
connectionInfo.setImplNS(BLOCK_PROVIDER_IMPL_NS);
connectionInfo.setUseSSL(Boolean.parseBoolean(providerUseSsl));
// Add the connection.
boolean wasException = false;
try {
_connectionManager.addConnection(connectionInfo);
} catch (ConnectionManagerException e) {
wasException = true;
}
Assert.assertFalse(wasException);
// Assert the provider is connected.
try {
Assert.assertTrue(_connectionManager.isConnected(PROVIDER_IP));
} catch (ConnectionManagerException e) {
wasException = true;
}
Assert.assertFalse(wasException);
// Clean up by removing the connection.
try {
_connectionManager.removeConnection(PROVIDER_IP);
} catch (ConnectionManagerException e) {
wasException = true;
}
Assert.assertFalse(wasException);
// Assert the provider is no longer connected.
try {
Assert.assertFalse(_connectionManager.isConnected(PROVIDER_IP));
} catch (ConnectionManagerException e) {
wasException = true;
}
Assert.assertFalse(wasException);
}
use of com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo in project coprhd-controller by CoprHD.
the class ConnectionManagerTest method testAddConnectionException.
/**
* Tests the addConnection method when an exception occurs trying to create
* the CIM client connection.
*/
@Test
public void testAddConnectionException() {
Assert.assertNotNull(_connectionManager);
// Create the connection info with an invalid provider host, which will
// cause an exception to occur when creating the CIM client connection.
CimConnectionInfo connectionInfo = new CimConnectionInfo();
connectionInfo.setType(CimConstants.ECOM_CONNECTION_TYPE);
connectionInfo.setHost(null);
connectionInfo.setPort(PROVIDER_PORT);
connectionInfo.setUser(PROVIDER_USER);
connectionInfo.setPassword(PROVIDER_PWD);
connectionInfo.setInteropNS(PROVIDER_INTEROP_NS);
connectionInfo.setImplNS(BLOCK_PROVIDER_IMPL_NS);
connectionInfo.setUseSSL(Boolean.parseBoolean(providerUseSsl));
// Add the connection.
boolean wasException = false;
try {
_connectionManager.addConnection(connectionInfo);
} catch (ConnectionManagerException e) {
wasException = true;
}
Assert.assertTrue(wasException);
// Assert the provider is not connected.
wasException = false;
try {
Assert.assertFalse(_connectionManager.isConnected(PROVIDER_IP));
} catch (ConnectionManagerException e) {
wasException = true;
}
Assert.assertFalse(wasException);
}
use of com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo in project coprhd-controller by CoprHD.
the class CelerraConnectionTest method createConnectionInfo.
/**
* Creates the connection info for the connection.
*
* @return The connection info for the connection
*/
private static CimConnectionInfo createConnectionInfo() {
CimConnectionInfo connectionInfo = new CimConnectionInfo();
connectionInfo.setType(CimConstants.ECOM_FILE_CONNECTION_TYPE);
connectionInfo.setHost(PROVIDER_IP);
connectionInfo.setPort(PROVIDER_PORT);
connectionInfo.setUser(PROVIDER_USER);
connectionInfo.setPassword(PROVIDER_PW);
connectionInfo.setInteropNS(PROVIDER_INTEROP_NS);
connectionInfo.setImplNS(PROVIDER_IMPL_NS);
connectionInfo.setUseSSL(true);
return connectionInfo;
}
use of com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo in project coprhd-controller by CoprHD.
the class EcomConnectionTest method createConnectionInfo.
/**
* Creates the connection info for the connection.
*
* @return The connection info for the connection
*/
private static CimConnectionInfo createConnectionInfo() {
CimConnectionInfo connectionInfo = new CimConnectionInfo();
connectionInfo.setType(CimConstants.ECOM_CONNECTION_TYPE);
connectionInfo.setHost(providerIP);
connectionInfo.setPort(providerPort);
connectionInfo.setUser(providerUser);
connectionInfo.setPassword(providerPassword);
connectionInfo.setInteropNS(providerInterOpNamespace);
connectionInfo.setImplNS(providerNamespace);
connectionInfo.setUseSSL(isProviderSslEnabled);
return connectionInfo;
}
Aggregations