modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/util/PluginContainerClassEnhancer.java
| 2
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/AbstractIgnoreTypesInventoryManagerBaseTest.java
| 257 ++++++++++
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/CommitThenIgnoreTypesInventoryManagerTest.java
| 67 ++
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/IgnoreTypesInventoryManagerTest.java
| 217 --------
modules/helpers/rest-docs-generator/pom.xml
| 65 +-
5 files changed, 372 insertions(+), 236 deletions(-)
New commits:
commit caaf437cf41cb921d1552f1b446139f946a60937
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 26 13:20:46 2013 -0400
BZ 535289 - more tests.
NOTE - plugin-container-itests test suite fails. there is a problem in
the arquillian/PC test framework where tests step on each other.
this needs to be fixed in order for these two new tests to not clobber
other tests. FWIW, these two new tests pass individually.
diff --git
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/AbstractIgnoreTypesInventoryManagerBaseTest.java
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/AbstractIgnoreTypesInventoryManagerBaseTest.java
new file mode 100644
index 0000000..452a4ff
--- /dev/null
+++
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/AbstractIgnoreTypesInventoryManagerBaseTest.java
@@ -0,0 +1,257 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.core.pc.inventory;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Mockito.when;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.testng.Assert;
+
+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;
+
+import org.rhq.core.clientapi.server.discovery.InventoryReport;
+import org.rhq.core.domain.discovery.MergeInventoryReportResults;
+import org.rhq.core.domain.discovery.ResourceSyncInfo;
+import org.rhq.core.domain.resource.InventoryStatus;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pc.PluginContainer;
+import org.rhq.core.pc.PluginContainerConfiguration;
+import org.rhq.core.pc.inventory.testplugin.ManualAddDiscoveryComponent;
+import org.rhq.core.pc.inventory.testplugin.TestResourceComponent;
+import org.rhq.core.pc.inventory.testplugin.TestResourceDiscoveryComponent;
+import org.rhq.test.arquillian.AfterDiscovery;
+import org.rhq.test.arquillian.BeforeDiscovery;
+import org.rhq.test.arquillian.MockingServerServices;
+import org.rhq.test.shrinkwrap.RhqAgentPluginArchive;
+
+/**
+ * Base test class for testing ignoring resource types and notifying the {@link
InventoryManager} about it.
+ *
+ * @author John Mazzitelli
+ */
+public abstract class AbstractIgnoreTypesInventoryManagerBaseTest extends Arquillian {
+
+ @Deployment(name = "testIgnoreTypes", order = 1)
+ @TargetsContainer("pc")
+ public static RhqAgentPluginArchive getTestPlugin() {
+ RhqAgentPluginArchive pluginJar = ShrinkWrap.create(RhqAgentPluginArchive.class,
"test-plugin.jar");
+ return
pluginJar.setPluginDescriptor("test-great-grandchild-discovery-plugin.xml").addClasses(
+ TestResourceDiscoveryComponent.class, TestResourceComponent.class,
ManualAddDiscoveryComponent.class);
+ }
+
+ @ArquillianResource
+ private MockingServerServices serverServices;
+
+ @ArquillianResource
+ protected PluginContainerConfiguration pluginContainerConfiguration;
+
+ // for subclasses to use this, this must be exposed as a protected field - can't
use a getPluginContainer() method
+ @ArquillianResource
+ protected PluginContainer pluginContainer;
+
+ protected Resource platform;
+
+ protected HashMap<String, Resource> simulatedInventory; // key == UUID
+
+ protected HashSet<ResourceType> ignoredTypes;
+
+ private CountDownLatch gotIgnoredTypeFromAgent;
+
+ protected abstract void initializeIgnoredTypes();
+
+ @BeforeDiscovery
+ public void resetServerServices() throws Exception {
+ platform = null;
+ simulatedInventory = new HashMap<String, Resource>();
+ gotIgnoredTypeFromAgent = new CountDownLatch(1); // will be open once we know
agent discovered types we want ignored
+
+ initializeIgnoredTypes();
+
+ serverServices.resetMocks();
+
+
when(serverServices.getDiscoveryServerService().mergeInventoryReport(any(InventoryReport.class))).then(
+ mergeInventoryReport());
+ }
+
+ @AfterDiscovery
+ public void afterDiscovery() throws Exception {
+ // wait for agent discovery to start getting ignored types
+ // actually, I don't think this latch will ever count down - if I did this
right,
+ // the first inventory report will tell the agent about the ignored types -
before the agent
+ // even attempted to discover resources of that type. Therefore, the agent will
probably never
+ // send up resources of the ignored types. But we have to wait anyway for the few
inventory reports
+ // that have to be received (which includes the resources of the unignored
types).
+ gotIgnoredTypeFromAgent.await(20L, TimeUnit.SECONDS);
+ }
+
+ protected void resetSimulatedServerSideInventory() {
+ if (simulatedInventory != null) {
+ simulatedInventory.clear();
+ }
+
+ if (platform != null) {
+ platform.getChildResources().clear();
+ if (simulatedInventory != null) {
+ simulatedInventory.put(platform.getUuid(), platform);
+ }
+ }
+ }
+
+ protected void waitForInventory(int depth) throws Exception {
+ long start = System.currentTimeMillis();
+ while (getInventoryDepth(platform) < depth) {
+ Thread.sleep(1000);
+ if (System.currentTimeMillis() - start > 30000L) {
+ break; // this should never take longer than 30s
+ }
+ }
+ return;
+ }
+
+ protected int getInventoryDepth(Resource root) {
+ if (root == null) {
+ return 0;
+ }
+ int maxDepth = 0;
+ for (Resource c : root.getChildResources()) {
+ int childDepth = getInventoryDepth(c);
+ if (maxDepth < childDepth) {
+ maxDepth = childDepth;
+ }
+ }
+ return maxDepth + 1;
+ }
+
+ protected Answer<MergeInventoryReportResults> mergeInventoryReport() {
+ return new Answer<MergeInventoryReportResults>() {
+ @Override
+ public MergeInventoryReportResults answer(InvocationOnMock invocation) throws
Throwable {
+ InventoryReport inventoryReport = (InventoryReport)
invocation.getArguments()[0];
+ return simulateInventoryReportServerProcessing(inventoryReport);
+ }
+ };
+ }
+
+ protected MergeInventoryReportResults
simulateInventoryReportServerProcessing(InventoryReport inventoryReport) {
+ ResourceSyncInfo syncInfo = null;
+ if (inventoryReport.getAddedRoots() != null &&
!inventoryReport.getAddedRoots().isEmpty()) {
+ for (Resource res : inventoryReport.getAddedRoots()) {
+ persistInSimulatedInventory(res);
+ }
+ syncInfo = ResourceSyncInfo.buildResourceSyncInfo(platform);
+ }
+ return new MergeInventoryReportResults(syncInfo, ignoredTypes);
+ }
+
+ protected void persistInSimulatedInventory(Resource res) {
+ if (!ignoredTypes.contains(res.getResourceType())) {
+ if (!simulatedInventory.containsKey(res.getUuid())) {
+ Resource persisted = new Resource(res.getResourceKey(), res.getName(),
res.getResourceType());
+ persisted.setUuid(res.getUuid());
+ persisted.setInventoryStatus(InventoryStatus.COMMITTED);
+ simulatedInventory.put(persisted.getUuid(), persisted);
+ if (res.getParentResource() == Resource.ROOT) {
+ platform = persisted;
+ } else {
+ Resource parent =
simulatedInventory.get(res.getParentResource().getUuid());
+ if (parent != null) {
+ parent.addChildResource(persisted);
+ }
+ }
+ }
+ for (Resource child : res.getChildResources()) {
+ persistInSimulatedInventory(child);
+ }
+ } else {
+ gotIgnoredTypeFromAgent.countDown();
+ }
+ return;
+ }
+
+ protected void validateFullInventory() {
+ System.out.println("Validating full inventory...");
+
+ // get platform
+ Resource platform = pluginContainer.getInventoryManager().getPlatform();
+ Assert.assertNotNull(platform);
+ Assert.assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ // get top server
+ Assert.assertEquals(platform.getChildResources().size(), 1, "plat children:
" + platform.getChildResources());
+ Resource server = platform.getChildResources().iterator().next();
+ Assert.assertNotNull(server);
+ Assert.assertEquals(server.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ // get top server's immediate child service
+ Assert.assertEquals(server.getChildResources().size(), 1, "srv children:
" + server.getChildResources());
+ Resource service = server.getChildResources().iterator().next();
+ Assert.assertNotNull(service);
+ Assert.assertEquals(service.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ // get top server's grandchild service
+ Assert.assertEquals(service.getChildResources().size(), 1, "svc children:
" + service.getChildResources());
+ Resource grandchild = service.getChildResources().iterator().next();
+ Assert.assertNotNull(grandchild);
+ Assert.assertEquals(grandchild.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ // get top server's great-grandchild service
+ Assert.assertEquals(grandchild.getChildResources().size(), 1, "svc grandch:
" + grandchild.getChildResources());
+ Resource greatgrandchild = grandchild.getChildResources().iterator().next();
+ Assert.assertNotNull(greatgrandchild);
+ Assert.assertEquals(greatgrandchild.getInventoryStatus(),
InventoryStatus.COMMITTED);
+
+ assert greatgrandchild.getChildResources().isEmpty() : "great grandchild
should have no children";
+ }
+
+ protected void validatePartiallyIgnoredInventory() {
+ System.out.println("Validating partially ignored inventory...");
+
+ // get platform
+ Resource platform = pluginContainer.getInventoryManager().getPlatform();
+ Assert.assertNotNull(platform);
+ Assert.assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ // get top server
+ Assert.assertEquals(platform.getChildResources().size(), 1, "plat children:
" + platform.getChildResources());
+ Resource server = platform.getChildResources().iterator().next();
+ Assert.assertNotNull(server);
+ Assert.assertEquals(server.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ // get top server's immediate child service
+ Assert.assertEquals(server.getChildResources().size(), 1, "srv children:
" + server.getChildResources());
+ Resource service = server.getChildResources().iterator().next();
+ Assert.assertNotNull(service);
+ Assert.assertEquals(service.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ // the grandchild service type is ignored, we should have no children from here
on down
+ assert service.getChildResources().isEmpty() : "grandchild should have been
ignored";
+ }
+}
diff --git
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/CommitThenIgnoreTypesInventoryManagerTest.java
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/CommitThenIgnoreTypesInventoryManagerTest.java
new file mode 100644
index 0000000..65c9ab7
--- /dev/null
+++
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/CommitThenIgnoreTypesInventoryManagerTest.java
@@ -0,0 +1,67 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.core.pc.inventory;
+
+import java.util.HashSet;
+
+import org.testng.annotations.Test;
+
+import org.rhq.core.clientapi.server.discovery.InventoryReport;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.test.arquillian.RunDiscovery;
+
+/**
+ * Tests committing a full inventory then having resource types ignored server-side and
+ * watching that the agent is told about that and that the ignored resources are removed
+ * from agent inventory.
+ *
+ * @author John Mazzitelli
+ */
+@Test(groups = { "ignoreTypesTests" }, singleThreaded = true)
+public class CommitThenIgnoreTypesInventoryManagerTest extends
AbstractIgnoreTypesInventoryManagerBaseTest {
+
+ protected void initializeIgnoredTypes() {
+ this.ignoredTypes = new HashSet<ResourceType>();
+ return;
+ }
+
+ @RunDiscovery
+ public void testIgnoreTypesAfterFullCommit() throws Exception {
+ // make sure the agent inventory has a full inventory
+ validateFullInventory();
+
+ // simulate the ignoring of types
+ resetSimulatedServerSideInventory();
+ ignoredTypes.add(new ResourceType("Test Service GrandChild",
"test", null, null));
+ ignoredTypes.add(new ResourceType("Manual Add Server",
"test", null, null));
+
+ // the agent side will have the committed resources removed when they are ignored
by the server
+ InventoryManager inventoryManager = this.pluginContainer.getInventoryManager();
+ inventoryManager.getPlatform().getChildResources().clear(); // just clear
everything, sync'ing should give us back unignored ones
+
+ // Now execute a full discovery again, this time, we should see the ignored
resources go away
+ System.out.println("Executing full discovery...");
+ InventoryReport report = inventoryManager.executeServerScanImmediately();
+ inventoryManager.handleReport(report);
+ report = inventoryManager.executeServiceScanImmediately();
+ inventoryManager.handleReport(report);
+ waitForInventory(3);
+ validatePartiallyIgnoredInventory();
+ }
+}
diff --git
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/IgnoreTypesInventoryManagerTest.java
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/IgnoreTypesInventoryManagerTest.java
index 682b63a..fc9b610 100644
---
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/IgnoreTypesInventoryManagerTest.java
+++
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/IgnoreTypesInventoryManagerTest.java
@@ -18,103 +18,30 @@
*/
package org.rhq.core.pc.inventory;
-import static org.mockito.Matchers.any;
-import static org.mockito.Mockito.when;
-
-import java.util.Collection;
-import java.util.HashMap;
import java.util.HashSet;
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-import org.mockito.invocation.InvocationOnMock;
-import org.mockito.stubbing.Answer;
-import org.testng.Assert;
import org.testng.annotations.Test;
-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;
-
import org.rhq.core.clientapi.server.discovery.InventoryReport;
-import org.rhq.core.domain.discovery.MergeInventoryReportResults;
-import org.rhq.core.domain.discovery.ResourceSyncInfo;
-import org.rhq.core.domain.resource.InventoryStatus;
-import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.pc.PluginContainer;
-import org.rhq.core.pc.PluginContainerConfiguration;
-import org.rhq.core.pc.inventory.testplugin.ManualAddDiscoveryComponent;
-import org.rhq.core.pc.inventory.testplugin.TestResourceComponent;
-import org.rhq.core.pc.inventory.testplugin.TestResourceDiscoveryComponent;
-import org.rhq.test.arquillian.AfterDiscovery;
-import org.rhq.test.arquillian.BeforeDiscovery;
-import org.rhq.test.arquillian.MockingServerServices;
import org.rhq.test.arquillian.RunDiscovery;
-import org.rhq.test.shrinkwrap.RhqAgentPluginArchive;
/**
* Test the server ignoring resource types and notifying the {@link InventoryManager}
about it.
*
* @author John Mazzitelli
*/
-@RunDiscovery
-public class IgnoreTypesInventoryManagerTest extends Arquillian {
-
- @Deployment(name = "test")
- @TargetsContainer("pc")
- public static RhqAgentPluginArchive getTestPlugin() {
- RhqAgentPluginArchive pluginJar = ShrinkWrap.create(RhqAgentPluginArchive.class,
"test-plugin.jar");
- return
pluginJar.setPluginDescriptor("test-great-grandchild-discovery-plugin.xml").addClasses(
- TestResourceDiscoveryComponent.class, TestResourceComponent.class,
ManualAddDiscoveryComponent.class);
- }
-
- @ArquillianResource
- private MockingServerServices serverServices;
-
- @ArquillianResource
- private PluginContainerConfiguration pluginContainerConfiguration;
-
- @ArquillianResource
- private PluginContainer pluginContainer;
-
- private Resource platform;
- private HashMap<String, Resource> simulatedInventory; // key == UUID
-
- private Collection<ResourceType> ignoredTypes;
-
- private CountDownLatch gotIgnoredTypeFromAgent;
-
- @BeforeDiscovery
- public void resetServerServices() throws Exception {
- platform = null;
- simulatedInventory = new HashMap<String, Resource>();
- gotIgnoredTypeFromAgent = new CountDownLatch(1); // will be open once we know
agent discovered types we want ignored
+@Test(groups = { "ignoreTypesTests" }, singleThreaded = true)
+public class IgnoreTypesInventoryManagerTest extends
AbstractIgnoreTypesInventoryManagerBaseTest {
- ignoredTypes = new HashSet<ResourceType>();
+ protected void initializeIgnoredTypes() {
+ this.ignoredTypes = new HashSet<ResourceType>();
ignoredTypes.add(new ResourceType("Test Service GrandChild",
"test", null, null));
ignoredTypes.add(new ResourceType("Manual Add Server",
"test", null, null));
-
- serverServices.resetMocks();
-
-
when(serverServices.getDiscoveryServerService().mergeInventoryReport(any(InventoryReport.class))).then(
- mergeInventoryReport());
- }
-
- @AfterDiscovery
- public void afterDiscovery() throws Exception {
- // wait for agent discovery to start getting ignored types
- // actually, I don't think this latch will ever count down - if I did this
right,
- // the first inventory report will tell the agent about the ignored types -
before the agent
- // even attempted to discover resources of that type. Therefore, the agent will
probably never
- // send up resources of the ignored types. But we have to wait anyway for the few
inventory reports
- // that have to be received (which includes the resources of the unignored
types).
- gotIgnoredTypeFromAgent.await(20L, TimeUnit.SECONDS);
+ return;
}
- @Test
+ @RunDiscovery
public void testIgnoreTypes() throws Exception {
// make sure the agent inventory does not have any resources of the ignored
types
validatePartiallyIgnoredInventory();
@@ -124,140 +51,12 @@ public class IgnoreTypesInventoryManagerTest extends Arquillian {
// Now execute a full discovery again, this time, we should see the full
inventory come in
System.out.println("Executing full discovery...");
- InventoryManager inventoryManager = pluginContainer.getInventoryManager();
+ InventoryManager inventoryManager = this.pluginContainer.getInventoryManager();
InventoryReport report = inventoryManager.executeServerScanImmediately();
inventoryManager.handleReport(report);
report = inventoryManager.executeServiceScanImmediately();
inventoryManager.handleReport(report);
- waitForFullInventory();
+ waitForInventory(5);
validateFullInventory();
}
-
- private void waitForFullInventory() throws Exception {
- long start = System.currentTimeMillis();
- while (getInventoryDepth(platform) < 5) {
- Thread.sleep(1000);
- if (System.currentTimeMillis() - start > 30000L) {
- break; // this should never take longer than 30s
- }
- }
- return;
- }
-
- private int getInventoryDepth(Resource root) {
- if (root == null) {
- return 0;
- }
- int maxDepth = 0;
- for (Resource c : root.getChildResources()) {
- int childDepth = getInventoryDepth(c);
- if (maxDepth < childDepth) {
- maxDepth = childDepth;
- }
- }
- return maxDepth + 1;
- }
-
- private Answer<MergeInventoryReportResults> mergeInventoryReport() {
- return new Answer<MergeInventoryReportResults>() {
- @Override
- public MergeInventoryReportResults answer(InvocationOnMock invocation) throws
Throwable {
- InventoryReport inventoryReport = (InventoryReport)
invocation.getArguments()[0];
- return simulateInventoryReportServerProcessing(inventoryReport);
- }
- };
- }
-
- private MergeInventoryReportResults
simulateInventoryReportServerProcessing(InventoryReport inventoryReport) {
- ResourceSyncInfo syncInfo = null;
- if (inventoryReport.getAddedRoots() != null &&
!inventoryReport.getAddedRoots().isEmpty()) {
- for (Resource res : inventoryReport.getAddedRoots()) {
- persistInSimulatedInventory(res);
- }
- syncInfo = ResourceSyncInfo.buildResourceSyncInfo(platform);
- }
- return new MergeInventoryReportResults(syncInfo, ignoredTypes);
- }
-
- private void persistInSimulatedInventory(Resource res) {
- if (!ignoredTypes.contains(res.getResourceType())) {
- if (!simulatedInventory.containsKey(res.getUuid())) {
- Resource persisted = new Resource(res.getResourceKey(), res.getName(),
res.getResourceType());
- persisted.setUuid(res.getUuid());
- persisted.setInventoryStatus(InventoryStatus.COMMITTED);
- simulatedInventory.put(persisted.getUuid(), persisted);
- if (res.getParentResource() == Resource.ROOT) {
- platform = persisted;
- } else {
- Resource parent =
simulatedInventory.get(res.getParentResource().getUuid());
- parent.addChildResource(persisted);
- }
- }
- for (Resource child : res.getChildResources()) {
- persistInSimulatedInventory(child);
- }
- } else {
- gotIgnoredTypeFromAgent.countDown();
- }
- return;
- }
-
- private void validateFullInventory() {
- System.out.println("Validating full inventory...");
-
- // get platform
- Resource platform = pluginContainer.getInventoryManager().getPlatform();
- Assert.assertNotNull(platform);
- Assert.assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
-
- // get top server
- Assert.assertEquals(platform.getChildResources().size(), 1, "plat children:
" + platform.getChildResources());
- Resource server = platform.getChildResources().iterator().next();
- Assert.assertNotNull(server);
- Assert.assertEquals(server.getInventoryStatus(), InventoryStatus.COMMITTED);
-
- // get top server's immediate child service
- Assert.assertEquals(server.getChildResources().size(), 1, "srv children:
" + server.getChildResources());
- Resource service = server.getChildResources().iterator().next();
- Assert.assertNotNull(service);
- Assert.assertEquals(service.getInventoryStatus(), InventoryStatus.COMMITTED);
-
- // get top server's grandchild service
- Assert.assertEquals(service.getChildResources().size(), 1, "svc children:
" + service.getChildResources());
- Resource grandchild = service.getChildResources().iterator().next();
- Assert.assertNotNull(grandchild);
- Assert.assertEquals(grandchild.getInventoryStatus(), InventoryStatus.COMMITTED);
-
- // get top server's great-grandchild service
- Assert.assertEquals(grandchild.getChildResources().size(), 1, "svc grandch:
" + grandchild.getChildResources());
- Resource greatgrandchild = grandchild.getChildResources().iterator().next();
- Assert.assertNotNull(greatgrandchild);
- Assert.assertEquals(greatgrandchild.getInventoryStatus(),
InventoryStatus.COMMITTED);
-
- assert greatgrandchild.getChildResources().isEmpty() : "great grandchild
should have no children";
- }
-
- private void validatePartiallyIgnoredInventory() {
- System.out.println("Validating partially ignored inventory...");
-
- // get platform
- Resource platform = pluginContainer.getInventoryManager().getPlatform();
- Assert.assertNotNull(platform);
- Assert.assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
-
- // get top server
- Assert.assertEquals(platform.getChildResources().size(), 1, "plat children:
" + platform.getChildResources());
- Resource server = platform.getChildResources().iterator().next();
- Assert.assertNotNull(server);
- Assert.assertEquals(server.getInventoryStatus(), InventoryStatus.COMMITTED);
-
- // get top server's immediate child service
- Assert.assertEquals(server.getChildResources().size(), 1, "srv children:
" + server.getChildResources());
- Resource service = server.getChildResources().iterator().next();
- Assert.assertNotNull(service);
- Assert.assertEquals(service.getInventoryStatus(), InventoryStatus.COMMITTED);
-
- // the grandchild service type is ignored, we should have no children from here
on down
- assert service.getChildResources().isEmpty() : "grandchild should have been
ignored";
- }
}
commit 62efaabe0874ddf660d5e14e96fe888d50de9556
Merge: 086ce6d 08d1940
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 25 12:02:56 2013 -0400
Merge remote-tracking branch 'origin/master' into bug/rhq-1
commit 08d1940f310b9bf4089c59b4582039a2c4ade939
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 25 12:01:29 2013 -0400
provide cause when this error happens
diff --git
a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/util/PluginContainerClassEnhancer.java
b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/util/PluginContainerClassEnhancer.java
index 82e64bb..aefad84 100644
---
a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/util/PluginContainerClassEnhancer.java
+++
b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/util/PluginContainerClassEnhancer.java
@@ -66,7 +66,7 @@ public class PluginContainerClassEnhancer {
pcClass.toClass(cl, null);
} catch (Exception e) {
- throw new IllegalStateException("Could not enhance the
PluginContaier class");
+ throw new IllegalStateException("Could not enhance the
PluginContainer class", e);
} finally {
initialized = true;
}
commit 93fe7c6c3d209598480d4bb06d1b537c1309d575
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Mar 25 11:24:15 2013 +0100
Use the maven compiler plugin instead of the (outdated) bsc annotation processor
diff --git a/modules/helpers/rest-docs-generator/pom.xml
b/modules/helpers/rest-docs-generator/pom.xml
index 208d40b..1dff5bd 100644
--- a/modules/helpers/rest-docs-generator/pom.xml
+++ b/modules/helpers/rest-docs-generator/pom.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ RHQ Management Platform
- ~ Copyright (C) 2005-2012 Red Hat, Inc.
+ ~ Copyright (C) 2005-2013 Red Hat, Inc.
~ All rights reserved.
~
~ This program is free software; you can redistribute it and/or modify
@@ -14,8 +14,8 @@
~ GNU General Public License for more details.
~
~ You should have received a copy of the GNU General Public License
- ~ along with this program; if not, write to the Free Software
- ~ Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ ~ along with this program; if not, write to the Free Software Foundation, Inc.,
+ ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
-->
<project
xmlns="http://maven.apache.org/POM/4.0.0"
@@ -49,43 +49,56 @@
<plugins>
<plugin>
- <groupId>org.bsc.maven</groupId>
- <artifactId>maven-processor-plugin</artifactId>
- <version>2.0.6-redhat</version>
- <configuration>
- <processors>
-
<processor>org.rhq.helpers.rest_docs_generator.ClassLevelProcessor</processor>
- </processors>
-
<compilerArguments>-AtargetDirectory=${project.build.directory}/docs/xml</compilerArguments>
- <!-- comment in next line to get the xml on stdout for debugging -->
-
<!--<compilerArguments>-Averbose=true</compilerArguments>-->
- </configuration>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.0</version>
<executions>
<execution>
- <id>create-rest-api-report</id>
- <phase>process-classes</phase>
+ <!-- Compile the sources i.e. the processor plugin-->
+ <id>compile-processor</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <proc>none</proc>
+ <verbose>false</verbose>
+ </configuration>
+ </execution>
+ <execution>
+ <!-- Execute the compiled plugin on the test sources -->
+ <id>create-rest-api-reports</id>
+ <phase>process-test-classes</phase>
<goals>
<!-- We want to process the classes in test/ -->
- <goal>process-test</goal>
+ <goal>testCompile</goal>
</goals>
+ <configuration>
+ <annotationProcessors>
+
<processor>org.rhq.helpers.rest_docs_generator.ClassLevelProcessor</processor>
+ </annotationProcessors>
+ <proc>only</proc>
+ <compilerArguments>
+
<AtargetDirectory>${project.build.directory}/docs/xml</AtargetDirectory>
+
<AmodelPkg>org.rhq.helpers.rest_docs_generator.test</AmodelPkg>
+ <!-- enable the next line to have the output of the processor shown on
console -->
+ <!--<Averbose>true</Averbose>-->
+ </compilerArguments>
+ <!-- set the next to true to enable verbose output of the compiler
plugin; default from the evn is true, but this is too noisy -->
+ <verbose>false</verbose>
+ </configuration>
+
</execution>
</executions>
</plugin>
- <!-- Disable annotation processors during normal compilation -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <compilerArgument>-proc:none</compilerArgument>
- </configuration>
- </plugin>
+
<!-- now xml translate the output from above to html -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
- <phase>process-classes</phase>
+ <phase>process-test-classes</phase>
<goals>
<goal>transform</goal>
</goals>