Allon Mureinik has posted comments on this change.
Change subject: restapi: add connections subresource for domain
......................................................................
Patch Set 4: (15 inline comments)
....................................................
File
backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/GetStorageServerConnectionsOfDomainQuery.java
Line 1: package org.ovirt.engine.core.bll;
Line 2:
Line 3: import org.ovirt.engine.core.common.queries.IdQueryParameters;
Line 4:
Line 5: public class GetStorageServerConnectionsOfDomainQuery<P extends
IdQueryParameters> extends QueriesCommandBase<P> {
I'd replace Of with For
Line 6:
Line 7: public GetStorageServerConnectionsOfDomainQuery(P parameters) {
Line 8: super(parameters);
Line 9: }
....................................................
File
backend/manager/modules/dal/src/main/java/org/ovirt/engine/core/dao/StorageServerConnectionDAODbFacadeImpl.java
Line 84: }
Line 85:
Line 86: @Override
Line 87: public List<StorageServerConnections> getAllForDomain(Guid
domainId) {
Line 88: return
getCallsHandler().executeReadList("GetStorageServerConnectionsOfDomain",mapper,
I'd replace Of with For
Line 89:
getCustomMapSqlParameterSource().addValue("storage_domain_id", domainId));
Line 90: }
Line 91:
Line 92: @Override
....................................................
File
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/LunDAOTest.java
Line 11: import org.junit.Test;
Line 12: import org.ovirt.engine.core.common.businessentities.LUNs;
Line 13:
Line 14: public class LunDAOTest extends BaseDAOTestCase {
Line 15: private static final String STORAGE_SERVER_CONNECTION_ID =
"0cc146e8-e5ed-482c-8814-270bc48c297e";
Is this intended?
Line 16: private LunDAO dao;
Line 17: private LUNs existingLUN;
Line 18: private LUNs newLUN;
Line 19:
....................................................
File
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageDomainDAOTest.java
Line 45: * Ensures that retrieving the id works.
Line 46: */
Line 47: @Test
Line 48: public void testGetMasterStorageDomainIdForPool() {
Line 49: Guid result =
dao.getMasterStorageDomainIdForPool(Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d"));
use new Guid(String) - this literal can't be null
Line 50:
Line 51: assertNotNull(result);
Line 52: assertEquals(EXISTING_DOMAIN_ID, result);
Line 53: }
Line 53: }
Line 54:
Line 55: @Test
Line 56: public void testGetstorage_domain_by_type_for_storagePoolId() {
Line 57: StorageDomain result =
dao.getStorageDomainByTypeAndPool(Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d"),
StorageDomainType.Master);
use new Guid(String) - this literal can't be null
Line 58:
Line 59: assertNotNull(result);
Line 60: assertGetResult(result);
Line 61: }
Line 166: * Ensures the call works as expected.
Line 167: */
Line 168: @Test
Line 169: public void testGetForStoragePool() {
Line 170: StorageDomain result =
dao.getForStoragePool(existingDomain.getId(),
Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d"));
use new Guid(String) - this literal can't be null
Line 171:
Line 172: assertGetResult(result);
Line 173: }
Line 174:
Line 302: */
Line 303: @Test
Line 304: public void testGetAllByStoragePoolAndConnection() {
Line 305: List<StorageDomain> result =
Line 306:
dao.getAllByStoragePoolAndConnection(EXISTING_STORAGE_POOL_ID,
"10.35.64.25:/export/share");
Isn't this just EXISTING_CONNECTION ?
Line 307:
Line 308: assertGetAllForStoragePoolResult(result,
EXISTING_STORAGE_POOL_ID);
Line 309: }
Line 310:
Line 333: * Ensures that the right collection is returned for a given
storage pool with filtering for a privileged user.
Line 334: */
Line 335: @Test
Line 336: public void
testGetAllForStoragePoolWithPermissionsPrivilegedUser() {
Line 337: Guid storagePoolId =
Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d");
use new Guid(String) - this literal can't be null
Line 338: List<StorageDomain> result =
dao.getAllForStoragePool(storagePoolId, PRIVILEGED_USER_ID, true);
Line 339:
Line 340: assertGetAllForStoragePoolResult(result, storagePoolId);
Line 341: }
Line 377: public void testGetPermittedStorageDomains() {
Line 378: List<StorageDomain> result =
Line 379:
dao.getPermittedStorageDomainsByStoragePool(EXISTING_USER_ID,
Line 380: ActionGroup.CONFIGURE_VM_STORAGE,
Line 381:
Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d"));
use new Guid(String) - this literal can't be null
Line 382: assertNotNull(result);
Line 383: assertFalse(result.isEmpty());
Line 384: assertEquals(result.get(0).getId(), existingDomain.getId());
Line 385: }
Line 388: public void testGetNonePermittedStorageDomains() {
Line 389: List<StorageDomain> result =
Line 390:
dao.getPermittedStorageDomainsByStoragePool(EXISTING_USER_ID,
Line 391: ActionGroup.CONSUME_QUOTA,
Line 392:
Guid.createGuidFromString("6d849ebf-755f-4552-ad09-9a090cda105d"));
use new Guid(String) - this literal can't be null
Line 393: assertNotNull(result);
Line 394: assertTrue(result.isEmpty());
Line 395: }
Line 396:
Line 422: }
Line 423:
Line 424: @Test
Line 425: public void testAllByConnectionId() {
Line 426: List<StorageDomain> domains =
dao.getAllByConnectionId(Guid.createGuidFromString("0cc146e8-e5ed-482c-8814-270bc48c297f"));
use new Guid(String) - this literal can't be null
Line 427: assertEquals("Unexpected number of storage domains by
connection id", domains.size(), 1);
Line 428: assertEquals("Wrong storage domain id for search by
connection id",
Line 429: domains.get(0).getId(),
Line 430:
Guid.createGuidFromString("c2211b56-8869-41cd-84e1-78d7cb96f31d"));
Line 426: List<StorageDomain> domains =
dao.getAllByConnectionId(Guid.createGuidFromString("0cc146e8-e5ed-482c-8814-270bc48c297f"));
Line 427: assertEquals("Unexpected number of storage domains by
connection id", domains.size(), 1);
Line 428: assertEquals("Wrong storage domain id for search by
connection id",
Line 429: domains.get(0).getId(),
Line 430:
Guid.createGuidFromString("c2211b56-8869-41cd-84e1-78d7cb96f31d"));
use new Guid(String) - this literal can't be null
Line 431: }
Line 432: /**
Line 433: * Asserts the result from {@link StorageDomainDAO#getAll()} is
correct without filtering
Line 434: *
....................................................
File
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/StorageServerConnectionDAOTest.java
Line 16: import org.ovirt.engine.core.compat.Guid;
Line 17:
Line 18: public class StorageServerConnectionDAOTest extends BaseDAOTestCase {
Line 19: private static final int
SERVER_CONNECTION_COUNT_FOR_SPECIFIC_STORAGE = 7;
Line 20: // private static final String EXISTING_DOMAIN_STORAGE_NAME =
"fDMzhE-wx3s-zo3q-Qcxd-T0li-yoYU-QvVePk";
Please remove this
Line 21: private static final String EXISTING_DOMAIN_STORAGE_NAME =
"G95OWd-Wvck-vftu-pMq9-9SAC-NF3E-ulDPsQ";
Line 22: private static final Guid EXISTING_STORAGE_POOL_ID = new
Guid("6d849ebf-755f-4552-ad09-9a090cda105d");
Line 23:
Line 24: private StorageServerConnectionDAO dao;
Line 231: public void testGetAllConnectionsOfIscsiDomain() {
Line 232: List<StorageServerConnections> connections =
dao.getAllForDomain(Guid.createGuidFromString("72e3a666-89e1-4005-a7ca-f7548004a9ab"));
Line 233: assertEquals(connections.size(),2);
Line 234:
assertTrue((connections.get(0).getid().equals("fDMzhE-wx3s-zo3q-Qcxd-T0li-yoYU-QvVePk"))
||
(connections.get(0).getid().equals("0cc146e8-e5ed-482c-8814-270bc48c297e")));
Line 235: }
Please use the constants you defined.
....................................................
File
backend/manager/modules/restapi/jaxrs/src/main/java/org/ovirt/engine/api/restapi/resource/BackendStorageDomainServerConnectionResource.java
Line 22: }
Line 23:
Line 24: @Override
Line 25: public Storage update(Storage connection) {
Line 26: throw new UnsupportedOperationException();
Please fix the indentation
Line 27: }
Line 28:
Line 29:
Line 30: @Override
--
To view, visit http://gerrit.ovirt.org/17245
To unsubscribe, visit http://gerrit.ovirt.org/settings
Gerrit-MessageType: comment
Gerrit-Change-Id: I0f63f8384c245eb28c18a3fde87ba57a8c1cd678
Gerrit-PatchSet: 4
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Alissa Bonas <[email protected]>
Gerrit-Reviewer: Alissa Bonas <[email protected]>
Gerrit-Reviewer: Allon Mureinik <[email protected]>
Gerrit-Reviewer: oVirt Jenkins CI Server
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches