Tal Nisan has uploaded a new change for review.

Change subject: core: DAO test for testGetVmsCountByClusterId in VdsGroupDao
......................................................................

core: DAO test for testGetVmsCountByClusterId in VdsGroupDao

Change-Id: I604f25e13b7f13cdd2e1f1b32e478c83b7e923cc
Signed-off-by: Tal Nisan <[email protected]>
Related-To: https://bugzilla.redhat.com/913234
---
M 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java
M 
backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java
2 files changed, 21 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.ovirt.org:29418/ovirt-engine refs/changes/30/25930/1

diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java
index 0ec19a6..e823309 100644
--- 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/FixturesTool.java
@@ -565,4 +565,11 @@
      * </ul>
      */
     public static final String STORAGE_CONNECTION_ID = 
"0cc146e8-e5ed-482c-8814-270bc48c297e";
+
+
+    /**
+     * Number of VMs on clusters
+     */
+    public static final int NUMBER_OF_VMS_IN_VDS_GROUP_RHEL6_NFS_CLUSTER = 0;
+    public static final int NUMBER_OF_VMS_IN_VDS_GROUP_RHEL6_ISCSI = 7;
 }
diff --git 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java
 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java
index fab5f1b..69d29ce 100644
--- 
a/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java
+++ 
b/backend/manager/modules/dal/src/test/java/org/ovirt/engine/core/dao/VdsGroupDAOTest.java
@@ -447,4 +447,18 @@
         assertFalse(result.isEmpty());
         assertEquals(NUMBER_OF_GROUPS, result.size());
     }
+
+    @Test
+    public void testGetVmsCountByClusterId() {
+        // Cluster with no VMs
+        assertEquals("Incorrect number of VMs in cluster", 
dao.getVmsCountByClusterId(FixturesTool.VDS_GROUP_RHEL6_NFS),
+                FixturesTool.NUMBER_OF_VMS_IN_VDS_GROUP_RHEL6_NFS_CLUSTER);
+
+        // Cluster with VMs
+        assertEquals("Incorrect number of VMs in cluster", 
dao.getVmsCountByClusterId(FixturesTool.VDS_GROUP_RHEL6_ISCSI),
+                FixturesTool.NUMBER_OF_VMS_IN_VDS_GROUP_RHEL6_ISCSI);
+
+        // Non existing cluster, should return 0
+        assertEquals("Incorrect number of VMs in cluster", 
dao.getVmsCountByClusterId(Guid.newGuid()), 0);
+    }
 }


-- 
To view, visit http://gerrit.ovirt.org/25930
To unsubscribe, visit http://gerrit.ovirt.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I604f25e13b7f13cdd2e1f1b32e478c83b7e923cc
Gerrit-PatchSet: 1
Gerrit-Project: ovirt-engine
Gerrit-Branch: master
Gerrit-Owner: Tal Nisan <[email protected]>
_______________________________________________
Engine-patches mailing list
[email protected]
http://lists.ovirt.org/mailman/listinfo/engine-patches

Reply via email to