modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java | 17 +++++++--- modules/core/plugin-container-itest/src/test/resources/arquillian.xml | 1 2 files changed, 13 insertions(+), 5 deletions(-)
New commits: commit e2e88d3045ec9a26f04b8326e67467b20931442e Author: Ian Springer ian.springer@redhat.com Date: Thu May 17 16:26:10 2012 -0400
fix some test failures (cherry picked from commit c1f2e51dda4421551748deafb4b533371166dd57)
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 c367687..ea11189 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 @@ -20,8 +20,8 @@ package org.rhq.core.pc.inventory;
import java.io.File;
-import org.jboss.arquillian.container.test.api.Deployer; import org.jboss.arquillian.container.test.api.Deployment; +import org.jboss.arquillian.container.test.api.TargetsContainer; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.arquillian.testng.Arquillian; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -34,6 +34,7 @@ import org.rhq.core.pc.PluginContainerConfiguration; import org.rhq.core.pc.inventory.testplugin.TestResourceComponent; import org.rhq.core.pc.inventory.testplugin.TestResourceDiscoveryComponent; import org.rhq.core.util.file.FileUtil; +import org.rhq.test.arquillian.AfterDiscovery; import org.rhq.test.arquillian.BeforeDiscovery; import org.rhq.test.arquillian.FakeServerInventory; import org.rhq.test.arquillian.MockingServerServices; @@ -53,6 +54,7 @@ import static org.mockito.Mockito.when; public class InventoryManagerTest extends Arquillian {
@Deployment(name = "test") + @TargetsContainer("pc") public static RhqAgentPluginArchive getTestPlugin() { RhqAgentPluginArchive pluginJar = ShrinkWrap.create(RhqAgentPluginArchive.class, "test-plugin.jar"); return pluginJar @@ -69,20 +71,27 @@ public class InventoryManagerTest extends Arquillian { @ArquillianResource private PluginContainer pluginContainer;
- @ArquillianResource - private Deployer pluginDeployer; - private FakeServerInventory fakeServerInventory;
+ private FakeServerInventory.CompleteDiscoveryChecker discoveryCompleteChecker; + @BeforeDiscovery public void resetServerServices() throws Exception { // Set up our fake server discovery ServerService, which will auto-import all Resources in reports it receives. serverServices.resetMocks(); fakeServerInventory = new FakeServerInventory(); + discoveryCompleteChecker = fakeServerInventory.createAsyncDiscoveryCompletionChecker(2); when(serverServices.getDiscoveryServerService().mergeInventoryReport(any(InventoryReport.class))).then( fakeServerInventory.mergeInventoryReport(InventoryStatus.COMMITTED)); }
+ @AfterDiscovery + public void waitForAsyncDiscoveries() throws Exception { + if (discoveryCompleteChecker != null) { + discoveryCompleteChecker.waitForDiscoveryComplete(10000); + } + } + /** * Tests that Resources are properly synchronized after the plugin container is restarted with a clean data * directory. diff --git a/modules/core/plugin-container-itest/src/test/resources/arquillian.xml b/modules/core/plugin-container-itest/src/test/resources/arquillian.xml index 2eb50c8..b8b9271 100644 --- a/modules/core/plugin-container-itest/src/test/resources/arquillian.xml +++ b/modules/core/plugin-container-itest/src/test/resources/arquillian.xml @@ -14,7 +14,6 @@
<container qualifier="pc"> <configuration> - <property name="mode">manual</property> <property name="serverServicesImplementationClassName">org.rhq.test.arquillian.MockingServerServices</property> <property name="insideAgent">true</property> <property name="startManagementBean">false</property>
rhq-commits@lists.fedorahosted.org