Liron Aravot has posted comments on this change. Change subject: core: create ReconstructMasterDomain validators ......................................................................
Patch Set 8: (5 comments) http://gerrit.ovirt.org/#/c/28624/8/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StoragePoolValidator.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/storage/StoragePoolValidator.java: Line 93: Line 94: for (StoragePoolIsoMap domainIsoMap : poolIsoMaps) { Line 95: if (domainIsoMap.getStatus() != null && domainIsoMap.getStatus().isStorageDomainInProcess()) { Line 96: return new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2, Line 97: String.format("$status %1$s", StorageDomainStatus.Locked)); please put the correct status. Line 98: } Line 99: } Line 100: Line 101: return ValidationResult.VALID; http://gerrit.ovirt.org/#/c/28624/8/backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java File backend/manager/modules/bll/src/main/java/org/ovirt/engine/core/bll/validator/StorageDomainValidator.java: Line 243: StoragePoolIsoMap domainIsoMap = storageDomain.getStoragePoolIsoMapData(); Line 244: Line 245: if (domainIsoMap.getStatus() != null && domainIsoMap.getStatus().isStorageDomainInProcess()) { Line 246: new ValidationResult(VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2, Line 247: String.format("$status %1$s", StorageDomainStatus.Locked)); the status in the message is now wrong (as you check more statuses), let's put the domain status. Line 248: } Line 249: Line 250: return ValidationResult.VALID; Line 251: } http://gerrit.ovirt.org/#/c/28624/8/backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/ReconstructMasterDomainCommandTest.java File backend/manager/modules/bll/src/test/java/org/ovirt/engine/core/bll/storage/ReconstructMasterDomainCommandTest.java: Line 52: Line 53: StorageDomain storageDomain = new StorageDomain(); Line 54: storageDomain.setStoragePoolIsoMapData(storagePoolIsoMap); Line 55: Line 56: StoragePoolIsoMapDAO storagePoolIsoMapDao = mock(StoragePoolIsoMapDAO.class); let's mock it in the way we usually do that.. @Mock private StoragePoolIsoMapDAO storagePoolIsoMapDao; Line 57: doReturn(Collections.singletonList(storagePoolIsoMap)).when(storagePoolIsoMapDao).getAllForStoragePool(storagePoolId); Line 58: Line 59: StoragePool storagePool = new StoragePool(); Line 60: storagePool.setId(storagePoolId); Line 65: doReturn(storageDomain).when(cmd).getStorageDomain(); Line 66: doReturn(storagePool).when(cmd).getStoragePool(); Line 67: doReturn(storagePoolValidator).when(cmd).createStoragePoolValidator(); Line 68: Line 69: } perhaps you can add a test also to the first check in the command CDA (the storage domain status) Line 70: Line 71: public void assertCanDoActionDomainInProcess(StorageDomainStatus status) { Line 72: storagePoolIsoMap.setStatus(status); Line 73: Line 76: Line 77: List<String> messages = cmd.getReturnValue().getCanDoActionMessages(); Line 78: Line 79: assertEquals(messages.get(0), VdcBllMessages.ACTION_TYPE_FAILED_STORAGE_DOMAIN_STATUS_ILLEGAL2.toString()); Line 80: assertEquals(messages.get(1), String.format("$status %1$s", status)); based on the comments in the previous file, i'm not sure how this test doesn't fail (as we currently put always the Locked status in the meessage).. Line 81: } Line 82: Line 83: @Test Line 84: public void testCanDoActionDomainLocked() { -- To view, visit http://gerrit.ovirt.org/28624 To unsubscribe, visit http://gerrit.ovirt.org/settings Gerrit-MessageType: comment Gerrit-Change-Id: I1b8c4727336c5df28f06566f7cb05c1871fcb000 Gerrit-PatchSet: 8 Gerrit-Project: ovirt-engine Gerrit-Branch: master Gerrit-Owner: Federico Simoncelli <fsimo...@redhat.com> Gerrit-Reviewer: Allon Mureinik <amure...@redhat.com> Gerrit-Reviewer: Liron Aravot <lara...@redhat.com> Gerrit-Reviewer: Maor Lipchuk <mlipc...@redhat.com> Gerrit-Reviewer: automat...@ovirt.org Gerrit-Reviewer: oVirt Jenkins CI Server Gerrit-HasComments: Yes _______________________________________________ Engine-patches mailing list Engine-patches@ovirt.org http://lists.ovirt.org/mailman/listinfo/engine-patches