modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
| 14 +++++-----
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
| 10 +++++--
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/getnativeprocess/NativeProcessRetrievalTest.java
| 7 ++---
3 files changed, 18 insertions(+), 13 deletions(-)
New commits:
commit 93392282ae4c708429d81ab031fd4a72f9c27736
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jul 31 12:36:23 2012 -0500
ensure tests run in a predictable order
(cherry picked from commit 4990d3896d4197e56274541d49902346abe97e22)
diff --git
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
index 9322b2d..005e900 100644
---
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
+++
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
@@ -148,7 +148,7 @@ public class AvailTest extends Arquillian {
}
}
- @Test(groups = "pc.itest.avail")
+ @Test(groups = "pc.itest.avail", priority = 20)
public void testDiscovery() throws Exception {
Assert.assertNotNull(pluginContainer);
Assert.assertTrue(pluginContainer.isStarted());
@@ -170,7 +170,7 @@ public class AvailTest extends Arquillian {
Assert.assertEquals(grandchildComponents2.size(), 8, "missing
grandchild2");
}
- @Test(groups = "pc.itest.avail", dependsOnMethods =
"testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
public void testAvailReport() throws Exception {
AvailabilityExecutor executor = new
ForceAvailabilityExecutor(this.pluginContainer.getInventoryManager());
dumpContainers("testAvailReport() Start");
@@ -213,7 +213,7 @@ public class AvailTest extends Arquillian {
assertScan(scan, true, false, 29, 7, 23, 28, 0, 6);
}
- @Test(groups = "pc.itest.avail", dependsOnMethods =
"testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
public void testScheduling() throws Exception {
AvailabilityExecutor executor = new
ForceAvailabilityExecutor(this.pluginContainer.getInventoryManager());
AvailabilityReport report = executor.call();
@@ -266,7 +266,7 @@ public class AvailTest extends Arquillian {
Assert.assertTrue(numBuckets >= 3, "Random distribution seems wrong,
buckets hit= " + numBuckets);
}
- @Test(groups = "pc.itest.avail", dependsOnMethods =
"testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
// If a parent changes to UP, its children must all be checked as they could
legitimately be something
// other than UP.
public void testForceChildrenOfParentUp() throws Exception {
@@ -330,7 +330,7 @@ public class AvailTest extends Arquillian {
assertScan(scan, false, false, 29, 14, 15, 12, 2, 0);
}
- @Test(groups = "pc.itest.avail", dependsOnMethods =
"testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
// If a parent changes to DOWN, its children should all defer to being DOWN as well.
public void testDeferToParentDown() throws Exception {
// don't use a ForceAvailabilityExecutor for this test, we want to manipulate
what gets checked
@@ -401,7 +401,7 @@ public class AvailTest extends Arquillian {
assertScan(scan, false, false, 29, 14, 3, 0, 2, 12);
}
- @Test(groups = "pc.itest.avail", dependsOnMethods =
"testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
public void testCheckOnlyEligible() throws Exception {
// Force all the avails to UP to start so we can avoid the scenario in
testForceChildrenOfParentUp()
AvailabilityExecutor executor = new
ForceAvailabilityExecutor(this.pluginContainer.getInventoryManager());
@@ -466,7 +466,7 @@ public class AvailTest extends Arquillian {
assertScan(scan, false, false, 29, 0, 1, 0, 0, 0);
}
- @Test(groups = "pc.itest.avail", dependsOnMethods =
"testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
public void testDeferToParent() throws Exception {
AvailabilityExecutor executor = new
ForceAvailabilityExecutor(this.pluginContainer.getInventoryManager());
AvailabilityReport report = executor.call();
diff --git
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
index b7227ff..84b6ca6 100644
---
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
+++
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
@@ -55,6 +55,7 @@ import static org.mockito.Mockito.when;
*
* @author Ian Springer
*/
+@RunDiscovery
public class InventoryManagerTest extends Arquillian {
@Deployment(name = "test")
@@ -102,8 +103,7 @@ public class InventoryManagerTest extends Arquillian {
*
* @throws Exception if an error occurs
*/
- @Test(groups = "pc.itest.inventorymanager")
- @RunDiscovery
+ @Test(groups = "pc.itest.inventorymanager", priority = 1)
public void testSyncUnknownResources() throws Exception {
validatePluginContainerInventory();
@@ -133,7 +133,7 @@ public class InventoryManagerTest extends Arquillian {
*
* @throws Exception if an error occurs
*/
- @Test(groups = "pc.itest.inventorymanager", dependsOnMethods =
"testSyncUnknownResources")
+ @Test(groups = "pc.itest.inventorymanager", priority = 1)
public void testUninventoryResources() throws Exception {
validatePluginContainerInventory();
@@ -186,10 +186,14 @@ public class InventoryManagerTest extends Arquillian {
Assert.assertNotNull(platform);
Assert.assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
+ Assert.assertEquals(platform.getChildResources().size(), 1,
+ "platform child Resources: " + platform.getChildResources());
Resource server = platform.getChildResources().iterator().next();
Assert.assertNotNull(server);
Assert.assertEquals(server.getInventoryStatus(), InventoryStatus.COMMITTED);
+ Assert.assertEquals(server.getChildResources().size(), 1,
+ "server child Resources: " + server.getChildResources());
Resource service = server.getChildResources().iterator().next();
Assert.assertNotNull(service);
Assert.assertEquals(service.getInventoryStatus(), InventoryStatus.COMMITTED);
diff --git
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/getnativeprocess/NativeProcessRetrievalTest.java
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/getnativeprocess/NativeProcessRetrievalTest.java
index 7df75d0..4170115 100644
---
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/getnativeprocess/NativeProcessRetrievalTest.java
+++
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/getnativeprocess/NativeProcessRetrievalTest.java
@@ -84,7 +84,7 @@ public class NativeProcessRetrievalTest extends Arquillian {
}
}
- @Test(groups = "pc.itest.native")
+ @Test(groups = "pc.itest.native", priority = 30)
public void testProcessInfoAccurateAfterProcessRestart() throws Exception {
Assert.assertEquals(components.size(), 1, "There should be exactly 1
resource discovered");
@@ -107,7 +107,7 @@ public class NativeProcessRetrievalTest extends Arquillian {
Assert.assertNotEquals(beforePid, afterPid, "The process info should have
refreshed");
}
- @Test(groups = "pc.itest.native")
+ @Test(groups = "pc.itest.native", priority = 30)
public void testProcessInfoAccurateWhenProcessStopped() throws Exception {
Assert.assertEquals(components.size(), 1, "There should be exactly 1
resource discovered");
@@ -131,7 +131,7 @@ public class NativeProcessRetrievalTest extends Arquillian {
startTestProcess();
}
- @Test(groups = "pc.itest.native")
+ @Test(groups = "pc.itest.native", priority = 30)
public void testProcessInfoAccurateAfterProcessStarted() throws Exception {
Assert.assertEquals(components.size(), 1, "There should be exactly 1
resource discovered");
@@ -161,4 +161,5 @@ public class NativeProcessRetrievalTest extends Arquillian {
Assert.assertEquals(afterDiscoveryCallCount, beforeDiscoveryCallCount + 1,
"Exactly 1 discovery call should have been made to refresh the process info after the
process started again.");
Assert.assertNotEquals(afterPid, 0, "The process info should have
refreshed");
}
+
}