Search in sources :

Example 6 with CimConnectionInfo

use of com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo in project coprhd-controller by CoprHD.

the class EcomIndicationProcessorTest method createConnectionInfo.

/**
 * Creates the connection info for the connection.
 *
 * @return The connection info for the connection
 */
private CimConnectionInfo createConnectionInfo() {
    CimConnectionInfo connectionInfo = new CimConnectionInfo();
    connectionInfo.setType(CimConstants.ECOM_CONNECTION_TYPE);
    connectionInfo.setHost(PROVIDER_IP);
    connectionInfo.setPort(Integer.parseInt(PROVIDER_PORT));
    connectionInfo.setUser(PROVIDER_USER);
    connectionInfo.setPassword(PROVIDER_PW);
    connectionInfo.setInteropNS(PROVIDER_INTEROP_NS);
    connectionInfo.setImplNS(PROVIDER_IMPL_NS);
    connectionInfo.setUseSSL(isProviderSslEnabled);
    return connectionInfo;
}
Also used : CimConnectionInfo(com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo)

Example 7 with CimConnectionInfo

use of com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo in project coprhd-controller by CoprHD.

the class ConnectionManagerTest method testIsConnectedConnected.

/**
 * Tests the isConnected method when passed host is not connected.
 */
@Test
public void testIsConnectedConnected() {
    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);
    // Remove the connection.
    try {
        _connectionManager.removeConnection(PROVIDER_IP);
    } catch (ConnectionManagerException e) {
        wasException = true;
    }
    Assert.assertFalse(wasException);
}
Also used : CimConnectionInfo(com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo) Test(org.junit.Test)

Example 8 with CimConnectionInfo

use of com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo in project coprhd-controller by CoprHD.

the class ConnectionManagerTest method testRemoveConnectionConnected.

/**
 * Tests the removeConnection method when passed host is connected.
 */
@Test
public void testRemoveConnectionConnected() {
    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);
    // Remove 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);
}
Also used : CimConnectionInfo(com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo) Test(org.junit.Test)

Example 9 with CimConnectionInfo

use of com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo in project coprhd-controller by CoprHD.

the class ConnectionManagerTest method testAddConnectionInvalidConnectionType.

/**
 * Tests the addConnection method when the connection type is not valid.
 */
@Test
public void testAddConnectionInvalidConnectionType() {
    Assert.assertNotNull(_connectionManager);
    // Create the connection info.
    CimConnectionInfo connectionInfo = new CimConnectionInfo();
    connectionInfo.setType(INVALID_CONN_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.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);
}
Also used : CimConnectionInfo(com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo) Test(org.junit.Test)

Example 10 with CimConnectionInfo

use of com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo in project coprhd-controller by CoprHD.

the class ConnectionManagerTest method testAddConnectionCIM.

/**
 * Tests the addConnection method for a generic CIM connection type.
 */
@Test
public void testAddConnectionCIM() {
    Assert.assertNotNull(_connectionManager);
    // Create the connection info.
    CimConnectionInfo connectionInfo = new CimConnectionInfo();
    connectionInfo.setType(CimConstants.CIM_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);
}
Also used : CimConnectionInfo(com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo) Test(org.junit.Test)

Aggregations

CimConnectionInfo (com.emc.storageos.cimadapter.connections.cim.CimConnectionInfo)16 Test (org.junit.Test)9 ConnectionManagerException (com.emc.storageos.cimadapter.connections.ConnectionManagerException)3 CimConnection (com.emc.storageos.cimadapter.connections.cim.CimConnection)2 StorageProvider (com.emc.storageos.db.client.model.StorageProvider)1 DatabaseException (com.emc.storageos.db.exceptions.DatabaseException)1 StorageMonitorException (com.emc.storageos.volumecontroller.StorageMonitorException)1 IOException (java.io.IOException)1 Timer (java.util.Timer)1 PostConstruct (javax.annotation.PostConstruct)1 WBEMException (javax.wbem.WBEMException)1 DependsOn (org.springframework.context.annotation.DependsOn)1 ClassPathXmlApplicationContext (org.springframework.context.support.ClassPathXmlApplicationContext)1