Search in sources :

Example 6 with StorageServerConnections

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));
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ArrayList(java.util.ArrayList) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) Test(org.junit.Test)

Example 7 with StorageServerConnections

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;
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections)

Example 8 with StorageServerConnections

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));
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) ArrayList(java.util.ArrayList) IscsiBond(org.ovirt.engine.core.common.businessentities.IscsiBond) ValidationResult(org.ovirt.engine.core.bll.ValidationResult) Test(org.junit.Test)

Example 9 with StorageServerConnections

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));
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Test(org.junit.Test)

Example 10 with StorageServerConnections

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);
}
Also used : StorageDomain(org.ovirt.engine.core.common.businessentities.StorageDomain) StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Before(org.junit.Before)

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