Search in sources :

Example 91 with StorageServerConnections

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

the class StorageServerConnectionDaoTest method getAllForForConnectionWithNullValues.

@Test
public void getAllForForConnectionWithNullValues() {
    StorageServerConnections noNullValConnection = createConnection("id1", "connection", null, "username", "password", "portal", "port");
    StorageServerConnections noNullValConnection2 = createConnection("id11", "connection", null, "username", "password", "portal", "port");
    assertGetAllForConnectionResult(Arrays.asList(noNullValConnection, noNullValConnection2), noNullValConnection);
    noNullValConnection = createConnection("id2", "connection", "iqn", null, "password", "portal", "port");
    noNullValConnection2 = createConnection("id12", "connection", "iqn", null, "password", "portal", "port");
    assertGetAllForConnectionResult(Arrays.asList(noNullValConnection, noNullValConnection2), noNullValConnection);
    // testing with different passwords to see that it's not being considered as part of the stored procedure.
    noNullValConnection = createConnection("id3", "connection", "iqn", "username", "pass1", "portal", "port");
    noNullValConnection2 = createConnection("id13", "connection", "iqn", "username", "pass2", "portal", "port");
    assertGetAllForConnectionResult(Arrays.asList(noNullValConnection, noNullValConnection2), noNullValConnection);
    noNullValConnection = createConnection("id4", "connection", "iqn", "username", "password", null, "port");
    noNullValConnection2 = createConnection("id14", "connection", "iqn", "username", "password", null, "port");
    assertGetAllForConnectionResult(Arrays.asList(noNullValConnection, noNullValConnection2), noNullValConnection);
    noNullValConnection = createConnection("id5", "connection", "iqn", "username", "password", "portal", null);
    noNullValConnection2 = createConnection("id15", "connection", "iqn", "username", "password", "portal", null);
    assertGetAllForConnectionResult(Arrays.asList(noNullValConnection, noNullValConnection2), noNullValConnection);
    noNullValConnection = createConnection("id6", "b", null, null, null, null, null);
    noNullValConnection2 = createConnection("id16", "b", null, null, null, null, null);
    assertGetAllForConnectionResult(Arrays.asList(noNullValConnection, noNullValConnection2), noNullValConnection);
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Test(org.junit.Test)

Example 92 with StorageServerConnections

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

the class StorageServerConnectionDaoTest method getStorageConnectionsByStorageTypeWithRecords.

public void getStorageConnectionsByStorageTypeWithRecords(EnumSet<StorageDomainStatus> statuses, Collection<Guid> expectedDomains) {
    List<StoragePoolIsoMap> poolIsoMap = dbFacade.getStoragePoolIsoMapDao().getAllForStoragePool(FixturesTool.STORAGE_POOL_MIXED_TYPES);
    List<Guid> storageDomainIds = poolIsoMap.stream().filter(isoMap -> statuses.contains(isoMap.getStatus())).map(StoragePoolIsoMap::getStorageId).collect(Collectors.toList());
    assertTrue("the list of the pool domains expected to be in the given statuses doesn't match the queried data", CollectionUtils.isEqualCollection(expectedDomains, storageDomainIds));
    List<StorageServerConnections> result = dao.getStorageConnectionsByStorageTypeAndStatus(FixturesTool.STORAGE_POOL_MIXED_TYPES, StorageType.NFS, statuses);
    assertFalse("there should be connections for the tested domains to verify the correctness", result.isEmpty());
    for (StorageServerConnections storageServerConnection : result) {
        assertEquals("connections were loaded with incorrect storage type", StorageType.NFS, storageServerConnection.getStorageType());
    }
    List<StorageServerConnections> domainConnections = new LinkedList<>();
    for (Guid domainId : storageDomainIds) {
        domainConnections.addAll(dao.getAllForDomain(domainId));
    }
    assertTrue("the connections loaded by the given dao function should match the connections loaded separately", CollectionUtils.isEqualCollection(domainConnections, result));
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) StoragePoolIsoMap(org.ovirt.engine.core.common.businessentities.StoragePoolIsoMap) Guid(org.ovirt.engine.core.compat.Guid) LinkedList(java.util.LinkedList)

Example 93 with StorageServerConnections

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

the class StorageDomainMapperTest method checkPosixStorageConnectionsMappings.

@Test
public void checkPosixStorageConnectionsMappings() {
    StorageServerConnections connection = new StorageServerConnections();
    Guid connId = Guid.newGuid();
    connection.setId(connId.toString());
    connection.setStorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType.POSIXFS);
    connection.setConnection("1.2.135.255:/myshare/data");
    connection.setVfsType("nfs");
    connection.setMountOptions("timeo=30");
    HostStorage RESTConnection = new HostStorage();
    RESTConnection.setId(connId.toString());
    RESTConnection.setType(StorageType.POSIXFS);
    RESTConnection.setAddress("1.2.135.255");
    RESTConnection.setPath("/myshare/data");
    RESTConnection.setVfsType("nfs");
    RESTConnection.setMountOptions("timeo=30");
    StorageConnection mappedResult = StorageDomainMapper.map(connection, null);
    assertEquals(RESTConnection.getId(), mappedResult.getId());
    assertEquals(RESTConnection.getType(), mappedResult.getType());
    assertEquals(RESTConnection.getAddress(), mappedResult.getAddress());
    assertEquals(RESTConnection.getVfsType(), mappedResult.getVfsType());
    assertEquals(RESTConnection.getPath(), mappedResult.getPath());
    assertEquals(RESTConnection.getMountOptions(), mappedResult.getMountOptions());
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) HostStorage(org.ovirt.engine.api.model.HostStorage) Guid(org.ovirt.engine.core.compat.Guid) StorageConnection(org.ovirt.engine.api.model.StorageConnection) Test(org.junit.Test)

Example 94 with StorageServerConnections

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

the class StorageDomainMapperTest method checkNFSStorageConnectionsMappingsToBll.

@Test
public void checkNFSStorageConnectionsMappingsToBll() {
    StorageServerConnections connection = new StorageServerConnections();
    Guid connId = Guid.newGuid();
    connection.setId(connId.toString());
    connection.setStorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType.NFS);
    connection.setConnection("1.2.135.255:/myshare/data");
    connection.setNfsRetrans((short) 200);
    connection.setNfsTimeo((short) 400);
    connection.setNfsVersion(org.ovirt.engine.core.common.businessentities.NfsVersion.V3);
    connection.setMountOptions("tcp");
    StorageConnection RESTConnection = new StorageConnection();
    RESTConnection.setId(connId.toString());
    RESTConnection.setType(StorageType.NFS);
    RESTConnection.setAddress("1.2.135.255");
    RESTConnection.setPath("/myshare/data");
    RESTConnection.setNfsRetrans(200);
    RESTConnection.setNfsTimeo(400);
    RESTConnection.setNfsVersion(NfsVersion.V3);
    RESTConnection.setMountOptions("tcp");
    StorageServerConnections mappedResult = StorageDomainMapper.map(RESTConnection, null);
    assertEquals(connection.getId(), mappedResult.getId());
    assertEquals(connection.getStorageType(), mappedResult.getStorageType());
    assertEquals(connection.getConnection(), mappedResult.getConnection());
    assertEquals(connection.getNfsRetrans(), mappedResult.getNfsRetrans());
    assertEquals(connection.getNfsTimeo(), mappedResult.getNfsTimeo());
    assertEquals(connection.getNfsVersion(), mappedResult.getNfsVersion());
    assertEquals(connection.getMountOptions(), mappedResult.getMountOptions());
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Guid(org.ovirt.engine.core.compat.Guid) StorageConnection(org.ovirt.engine.api.model.StorageConnection) Test(org.junit.Test)

Example 95 with StorageServerConnections

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

the class StorageDomainMapperTest method checkISCSISStorageConnectionsMappingsToBll.

@Test
public void checkISCSISStorageConnectionsMappingsToBll() {
    StorageServerConnections connection = new StorageServerConnections();
    Guid connId = Guid.newGuid();
    connection.setId(connId.toString());
    connection.setIqn("iqn.my.target1");
    connection.setPort("3260");
    connection.setStorageType(org.ovirt.engine.core.common.businessentities.storage.StorageType.ISCSI);
    connection.setConnection("1.2.135.255");
    connection.setUserName("myuser1");
    connection.setPassword("123");
    StorageConnection RESTConnection = new StorageConnection();
    RESTConnection.setId(connId.toString());
    RESTConnection.setType(StorageType.ISCSI);
    RESTConnection.setPort(3260);
    RESTConnection.setTarget("iqn.my.target1");
    RESTConnection.setAddress("1.2.135.255");
    RESTConnection.setUsername("myuser1");
    RESTConnection.setPassword("123");
    StorageServerConnections mappedResult = StorageDomainMapper.map(RESTConnection, null);
    assertEquals(mappedResult.getId(), mappedResult.getId());
    assertEquals(mappedResult.getStorageType(), mappedResult.getStorageType());
    assertEquals(mappedResult.getConnection(), mappedResult.getConnection());
    assertEquals(mappedResult.getIqn(), mappedResult.getIqn());
    assertEquals(mappedResult.getUserName(), mappedResult.getUserName());
    assertEquals(mappedResult.getPassword(), mappedResult.getPassword());
    assertEquals(mappedResult.getPort(), mappedResult.getPort());
}
Also used : StorageServerConnections(org.ovirt.engine.core.common.businessentities.StorageServerConnections) Guid(org.ovirt.engine.core.compat.Guid) StorageConnection(org.ovirt.engine.api.model.StorageConnection) 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