Search in sources :

Example 41 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class AddStorageServerConnectionCommandTest method addNewConnectionWithVds.

@Test
public void addNewConnectionWithVds() {
    StorageServerConnections newPosixConnection = createPosixConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data1", StorageType.POSIXFS, "nfs", "timeo=30");
    newPosixConnection.setId("");
    parameters.setStorageServerConnection(newPosixConnection);
    doReturn(false).when(command).isConnWithSameDetailsExists(newPosixConnection, null);
    Pair<Boolean, Integer> connectResult = new Pair(true, 0);
    doReturn(connectResult).when(command).connectHostToStorage();
    doReturn(null).when(command).getConnectionFromDbById(newPosixConnection.getId());
    doNothing().when(command).saveConnection(newPosixConnection);
    command.executeCommand();
    CommandAssertUtils.checkSucceeded(command, true);
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Pair(org.ovirt.engine.core.common.utils.Pair) Test(org.junit.Test)

Example 42 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class AddStorageServerConnectionCommandTest method isConnWithSameDetailsExist.

@Test
public void isConnWithSameDetailsExist() {
    StorageServerConnections newISCSIConnection = createISCSIConnection("1.2.3.4", StorageType.ISCSI, "iqn.2013-04.myhat.com:aaa-target1", "3650", "user1", "mypassword123");
    StorageServerConnections existingConn = createISCSIConnection("1.2.3.4", StorageType.ISCSI, "iqn.2013-04.myhat.com:aaa-target1", "3650", "user1", "mypassword123");
    existingConn.setId(Guid.newGuid().toString());
    when(iscsiStorageHelper.findConnectionWithSameDetails(newISCSIConnection)).thenReturn(existingConn);
    boolean isExists = command.isConnWithSameDetailsExists(newISCSIConnection, null);
    assertTrue(isExists);
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Test(org.junit.Test)

Example 43 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class AddStorageServerConnectionCommandTest method addExistingConnection.

@Test
public void addExistingConnection() {
    StorageServerConnections newPosixConnection = createPosixConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data1", StorageType.POSIXFS, "nfs", "timeo=30");
    parameters.setStorageServerConnection(newPosixConnection);
    parameters.setVdsId(Guid.Empty);
    doReturn(true).when(command).isConnWithSameDetailsExists(newPosixConnection, null);
    ValidateTestUtils.runAndAssertValidateFailure(command, EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTION_ALREADY_EXISTS);
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Test(org.junit.Test)

Example 44 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class AddStorageServerConnectionCommandTest method isLocalDomainConnWithSamePathAndPoolExist.

@Test
public void isLocalDomainConnWithSamePathAndPoolExist() {
    StorageServerConnections newLocalConnection = populateBasicConnectionDetails(null, "/localSD", StorageType.LOCALFS);
    StorageServerConnections existingConn = populateBasicConnectionDetails(null, "/localSD", StorageType.LOCALFS);
    existingConn.setId(Guid.newGuid().toString());
    Guid storagePoolId = Guid.newGuid();
    List<StorageServerConnections> connections = Collections.singletonList(existingConn);
    when(storageConnDao.getAllConnectableStorageSeverConnection(storagePoolId)).thenReturn(connections);
    when(storageConnDao.getAllForStorage(newLocalConnection.getConnection())).thenReturn(connections);
    boolean isExists = command.isConnWithSameDetailsExists(newLocalConnection, storagePoolId);
    assertTrue(isExists);
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Guid(org.ovirt.engine.core.compat.Guid) Test(org.junit.Test)

Example 45 with StorageServerConnections

use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.

the class AddStorageServerConnectionCommandTest method addNewConnectionEmptyVdsId.

@Test
public void addNewConnectionEmptyVdsId() {
    StorageServerConnections newPosixConnection = createPosixConnection("multipass.my.domain.tlv.company.com:/export/allstorage/data1", StorageType.POSIXFS, "nfs", "timeo=30");
    newPosixConnection.setId("");
    parameters.setStorageServerConnection(newPosixConnection);
    parameters.setVdsId(Guid.Empty);
    doReturn(false).when(command).isConnWithSameDetailsExists(newPosixConnection, null);
    doReturn(null).when(command).getConnectionFromDbById(newPosixConnection.getId());
    doNothing().when(command).saveConnection(newPosixConnection);
    command.executeCommand();
    CommandAssertUtils.checkSucceeded(command, true);
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Test(org.junit.Test)

Aggregations

StorageServerConnections (org.ovirt.engine.core.common.businessentities.StorageServerConnections)181 Test (org.junit.Test)83 ArrayList (java.util.ArrayList)43 Guid (org.ovirt.engine.core.compat.Guid)39 LUNs (org.ovirt.engine.core.common.businessentities.storage.LUNs)33 StorageDomain (org.ovirt.engine.core.common.businessentities.StorageDomain)32 StorageDomainStatic (org.ovirt.engine.core.common.businessentities.StorageDomainStatic)19 List (java.util.List)18 StorageType (org.ovirt.engine.core.common.businessentities.storage.StorageType)17 VDS (org.ovirt.engine.core.common.businessentities.VDS)16 StorageServerConnectionParametersBase (org.ovirt.engine.core.common.action.StorageServerConnectionParametersBase)15 QueryReturnValue (org.ovirt.engine.core.common.queries.QueryReturnValue)15 StoragePool (org.ovirt.engine.core.common.businessentities.StoragePool)14 HashSet (java.util.HashSet)13 ActionReturnValue (org.ovirt.engine.core.common.action.ActionReturnValue)11 ActionType (org.ovirt.engine.core.common.action.ActionType)11 Set (java.util.Set)10 StorageConnection (org.ovirt.engine.api.model.StorageConnection)10 StorageDomainType (org.ovirt.engine.core.common.businessentities.StorageDomainType)10 QueryType (org.ovirt.engine.core.common.queries.QueryType)10