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);
}
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);
}
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);
}
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);
}
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);
}
Aggregations