use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method successfullyAddedStorageConnections.
@Test
public void successfullyAddedStorageConnections() {
IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
List<StorageServerConnections> conns = new ArrayList<>();
conns.add(createStorageConnection());
conns.add(createStorageConnection());
doReturn(conns).when(storageServerConnectionDao).getConnectableStorageConnectionsByStorageType(iscsiBond.getStoragePoolId(), StorageType.ISCSI);
iscsiBond.getStorageConnectionIds().add(conns.get(0).getId());
iscsiBond.getStorageConnectionIds().add(conns.get(1).getId());
assertEquals(ValidationResult.VALID, validator.validateAddedStorageConnections(iscsiBond));
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method createStorageConnection.
private StorageServerConnections createStorageConnection() {
StorageServerConnections conn = new StorageServerConnections();
conn.setId(Guid.newGuid().toString());
return conn;
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class IscsiBondValidatorTest method someAddedStorageConnectionsAreNotAnIscsi.
@Test
public void someAddedStorageConnectionsAreNotAnIscsi() {
IscsiBond iscsiBond = createIscsiBond("First", Guid.newGuid());
List<StorageServerConnections> conns = new ArrayList<>();
conns.add(createStorageConnection());
doReturn(conns).when(storageServerConnectionDao).getConnectableStorageConnectionsByStorageType(iscsiBond.getStoragePoolId(), StorageType.ISCSI);
iscsiBond.getStorageConnectionIds().add(conns.get(0).getId());
iscsiBond.getStorageConnectionIds().add(Guid.newGuid().toString());
ValidationResult res = validator.validateAddedStorageConnections(iscsiBond);
assertThat(res, failsWith(EngineMessage.ACTION_TYPE_FAILED_STORAGE_CONNECTIONS_CANNOT_BE_ADDED_TO_ISCSI_BOND));
assertEquals(1, res.getVariableReplacements().size());
assertEquals("$connectionIds " + iscsiBond.getStorageConnectionIds().get(1).toString(), res.getVariableReplacements().get(0));
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class StorageConnectionValidatorTest method isConnectionForISCSIDomainAttached.
@Test
public void isConnectionForISCSIDomainAttached() {
StorageServerConnections connection = new StorageServerConnections();
connection.setId(CONNECTION_ID_FOR_VALIDATION);
List<StorageServerConnections> connections = getConnections();
connections.add(connection);
doReturn(connections).when(validator).getAllConnectionsForDomain(domain.getId());
assertTrue(validator.isConnectionForISCSIDomainAttached(domain));
}
use of org.ovirt.engine.core.common.businessentities.StorageServerConnections in project ovirt-engine by oVirt.
the class StorageConnectionValidatorTest method setUp.
@Before
public void setUp() {
connection = new StorageServerConnections();
connection.setId(CONNECTION_ID_FOR_VALIDATION);
connection.setStorageType(StorageType.ISCSI);
validator = spy(new StorageConnectionValidator(connection));
domain = new StorageDomain();
domain.setStorageType(StorageType.ISCSI);
domain.setId(Guid.newGuid());
domain.setStatus(StorageDomainStatus.Maintenance);
domain.setStorageDomainSharedStatus(StorageDomainSharedStatus.Inactive);
}
Aggregations