summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Negrea <snegrea@redhat.com>2012-08-14 16:29:41 (GMT)
committerStefan Negrea <snegrea@redhat.com>2012-08-14 16:31:02 (GMT)
commit7615ad2081f7b593ac50c34c648a6c6215c7a652 (patch)
treee4d6a0a8127bd86c49792cf11c40ccfbe153f1f4
parent7dd49dfa00e4c10ffca6c10f1771b2b2bf542d63 (diff)
downloadrhq-7615ad2081f7b593ac50c34c648a6c6215c7a652.zip
rhq-7615ad2081f7b593ac50c34c648a6c6215c7a652.tar.gz
rhq-7615ad2081f7b593ac50c34c648a6c6215c7a652.tar.xz
[BZ 828329] Adding inventory context to a resource context.
Squashed commit of the following: commit 14b7dd184880140d74d4658ffa0e62a575f27c4f Author: Stefan Negrea <snegrea@redhat.com> Date: Tue Aug 7 16:03:33 2012 -0500 [BZ 828329] Minor documentation updates and rewording. commit 7f5aa39c22688ee935b23d2dad767ff03c41dc96 Author: Stefan Negrea <snegrea@redhat.com> Date: Tue Aug 7 14:45:31 2012 -0500 [BZ 828329] Removed plugin container specific classes. The regular will just block until the discovery processes completes, no data is returned to caller. commit 2b17808e9bff072776c7ecada992d33c34203155 Author: Stefan Negrea <snegrea@redhat.com> Date: Mon Aug 6 21:07:00 2012 -0500 [BZ 828329] The inventory context has now a deferred and a blocking method for requesting discovery. Also included are various other updates based on community feedback. commit 816622e43c88c3b2bf751c1e2d9682d64556fdbb Author: Stefan Negrea <snegrea@redhat.com> Date: Mon Aug 6 10:38:34 2012 -0500 [BZ 828329] Added the possibility to start discovery scans from a resource context. The code executes a deffered service scan for children of the resource managed by the resource context. (cherry picked from commit ef1a7865118a3a76f7ee0ea1e119ba03f28c34ca) Conflicts: modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java modules/plugins/database/src/test/java/org/rhq/plugins/database/ComponentTest.java modules/plugins/mysql/src/test/java/org/rhq/plugins/mysql/ComponentTest.java
-rw-r--r--modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/InventoryContext.java65
-rw-r--r--modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java14
-rw-r--r--modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java6
-rw-r--r--modules/core/plugin-api/src/test/java/org/rhq/core/pluginapi/inventory/ResourceContextTest.java12
-rw-r--r--modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryContextImpl.java57
-rw-r--r--modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java43
-rw-r--r--modules/core/plugin-container/src/test/java/org/rhq/core/pc/bundle/BundleManagerTest.java2
-rw-r--r--modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java3
-rw-r--r--modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java1
-rw-r--r--modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/nonpc/UploadAndDeployTest.java6
-rw-r--r--modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java12
-rw-r--r--modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java5
12 files changed, 205 insertions, 21 deletions
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/InventoryContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/InventoryContext.java
new file mode 100644
index 0000000..ec1fab4
--- /dev/null
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/InventoryContext.java
@@ -0,0 +1,65 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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.pluginapi.inventory;
+
+
+/**
+ * @author Stefan Negrea
+ *
+ */
+public interface InventoryContext {
+
+ /**
+ * This method requests a deferred service discovery process for children of the resource. It requests the discovery
+ * process and returns immediately without waiting for results. The discovery process imports into inventory all discovered
+ * resources, so no further action is required from the caller.
+ *
+ * This method should be used by resources following an action (outside of create/delete children) that results
+ * in having additional children discoverable. A good example is an operation execution that enables extra functionality
+ * on the managed resource which in turn translates into having additional children available for management.
+ *
+ * Note: All services are discovered by the regular discovery process that runs every 24 hours. This method allows
+ * a resource to request an immediate run of the discovery process for child resources, rather than wait for the scheduled
+ * service discovery.
+ */
+ public void requestDeferredChildResourcesDiscovery();
+
+
+ /**
+ * This method requests a service discovery process for children of the resource. It schedules the discovery
+ * process and blocks until the discovery finishes. The discovery process imports into inventory all discovered
+ * resources, so no further action is required from the caller.
+ *
+ * This method should be used by resources following an action (outside of create/delete children) that results
+ * in having additional children discoverable. A good example is an operation execution that enables extra functionality
+ * on the managed resource which in turn translates into having additional children available for management. This method blocks
+ * until the discovery processes finishes, this includes committing resources to inventory. For additional processing,
+ * the calling resource can then request the list of child resources (it will include newly discovered resources too).
+ *
+ * Note: All services are discovered by the regular discovery process that runs every 24 hours. This method allows
+ * a resource to request an immediate run of the discovery process for child resources, rather than wait for the scheduled
+ * service discovery.
+ *
+ * @return discovered child resources
+ */
+ public void requestChildResourcesDiscovery();
+
+}
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
index 4b21719..76ccf39 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
@@ -83,6 +83,7 @@ public class ResourceContext<T extends ResourceComponent<?>> {
private final OperationContext operationContext;
private final ContentContext contentContext;
private final AvailabilityContext availabilityContext;
+ private final InventoryContext inventoryContext;
private final PluginContainerDeployment pluginContainerDeployment;
private final ResourceTypeProcesses trackedProcesses;
@@ -152,7 +153,7 @@ public class ResourceContext<T extends ResourceComponent<?>> {
public ResourceContext(Resource resource, T parentResourceComponent, ResourceContext<?> parentResourceContext,
ResourceDiscoveryComponent<T> resourceDiscoveryComponent, SystemInfo systemInfo, File temporaryDirectory,
File dataDirectory, String pluginContainerName, EventContext eventContext, OperationContext operationContext,
- ContentContext contentContext, AvailabilityContext availabilityContext,
+ ContentContext contentContext, AvailabilityContext availabilityContext, InventoryContext inventoryContext,
PluginContainerDeployment pluginContainerDeployment) {
this.resourceKey = resource.getResourceKey();
@@ -177,6 +178,7 @@ public class ResourceContext<T extends ResourceComponent<?>> {
this.operationContext = operationContext;
this.contentContext = contentContext;
this.availabilityContext = availabilityContext;
+ this.inventoryContext = inventoryContext;
String parentResourceUuid = "";
if (resource.getParentResource() != null) {
@@ -505,6 +507,16 @@ public class ResourceContext<T extends ResourceComponent<?>> {
}
/**
+ * Returns an {@link InventoryContext} that allows the plugin to access inventory related functionality provided by the
+ * plugin container.
+ *
+ * @return the inventory context
+ */
+ public InventoryContext getInventoryContext() {
+ return inventoryContext;
+ }
+
+ /**
* @deprecated Use {@link AvailabilityContext#createAvailabilityCollectorRunnable(AvailabilityFacet, long)}
*/
public AvailabilityCollectorRunnable createAvailabilityCollectorRunnable(AvailabilityFacet availChecker,
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
index 3c5b6a2..471978c 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
@@ -23,13 +23,13 @@
package org.rhq.core.pluginapi.upgrade;
import java.io.File;
-import java.util.concurrent.Executor;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.pluginapi.availability.AvailabilityContext;
import org.rhq.core.pluginapi.content.ContentContext;
import org.rhq.core.pluginapi.event.EventContext;
+import org.rhq.core.pluginapi.inventory.InventoryContext;
import org.rhq.core.pluginapi.inventory.PluginContainerDeployment;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
@@ -60,11 +60,11 @@ public class ResourceUpgradeContext<T extends ResourceComponent<?>> extends Reso
T parentResourceComponent, ResourceDiscoveryComponent<T> resourceDiscoveryComponent, SystemInfo systemInfo,
File temporaryDirectory, File dataDirectory, String pluginContainerName, EventContext eventContext,
OperationContext operationContext, ContentContext contentContext, AvailabilityContext availabilityContext,
- PluginContainerDeployment pluginContainerDeployment) {
+ InventoryContext inventoryContext, PluginContainerDeployment pluginContainerDeployment) {
super(resource, parentResourceComponent, parentResourceContext, resourceDiscoveryComponent, systemInfo,
temporaryDirectory, dataDirectory, pluginContainerName, eventContext, operationContext, contentContext,
- availabilityContext, pluginContainerDeployment);
+ availabilityContext, inventoryContext, pluginContainerDeployment);
this.resourceConfiguration = resource.getResourceConfiguration();
this.name = resource.getName();
diff --git a/modules/core/plugin-api/src/test/java/org/rhq/core/pluginapi/inventory/ResourceContextTest.java b/modules/core/plugin-api/src/test/java/org/rhq/core/pluginapi/inventory/ResourceContextTest.java
index fe194c9..118d514 100644
--- a/modules/core/plugin-api/src/test/java/org/rhq/core/pluginapi/inventory/ResourceContextTest.java
+++ b/modules/core/plugin-api/src/test/java/org/rhq/core/pluginapi/inventory/ResourceContextTest.java
@@ -86,7 +86,7 @@ public class ResourceContextTest {
//create object to test and inject required dependencies
ResourceContext<?> objectUnderTest = new ResourceContext(mockResource, null, parentResourceContext, null, null,
- mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null);
+ mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null, null);
//run code under test
File result = objectUnderTest.getResourceDataDirectory();
@@ -152,7 +152,7 @@ public class ResourceContextTest {
//create object to test and inject required dependencies
ResourceContext<?> objectUnderTest = new ResourceContext(mockResource, null, parent1ResourceContext, null,
- null, mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null);
+ null, mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null, null);
//run code under test
File result = objectUnderTest.getResourceDataDirectory();
@@ -206,7 +206,7 @@ public class ResourceContextTest {
//create object to test and inject required dependencies
ResourceContext<?> objectUnderTest = new ResourceContext(mockResource, null, parentResourceContext, null, null,
- mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null);
+ mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null, null);
//run code under test
File result = objectUnderTest.getResourceDataDirectory();
@@ -260,7 +260,7 @@ public class ResourceContextTest {
//create object to test and inject required dependencies
ResourceContext<?> objectUnderTest = new ResourceContext(mockResource, null, parentResourceContext, null, null,
- mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null);
+ mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null, null);
//run code under test
File result = objectUnderTest.getResourceDataDirectory();
@@ -314,7 +314,7 @@ public class ResourceContextTest {
//create object to test and inject required dependencies
ResourceContext<?> objectUnderTest = new ResourceContext(mockResource, null, parentResourceContext, null, null,
- mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null);
+ mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null, null);
//run code under test
File result = objectUnderTest.getResourceDataDirectory();
@@ -377,7 +377,7 @@ public class ResourceContextTest {
//create object to test and inject required dependencies
ResourceContext<?> objectUnderTest = new ResourceContext(mockResource, null, parent1ResourceContext, null,
- null, mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null);
+ null, mockTemporaryDirectory, mockDataDirectory, null, null, null, null, null, null, null);
//run code under test
File result = objectUnderTest.getFutureChildResourceDataDirectory(inputChildResourceKey);
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryContextImpl.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryContextImpl.java
new file mode 100644
index 0000000..460a827
--- /dev/null
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryContextImpl.java
@@ -0,0 +1,57 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * 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 org.rhq.core.domain.resource.Resource;
+import org.rhq.core.pc.PluginContainer;
+import org.rhq.core.pluginapi.inventory.InventoryContext;
+
+/**
+ * @author Stefan Negrea
+ *
+ */
+public class InventoryContextImpl implements InventoryContext {
+
+ private final Resource resource;
+
+ /**
+ * @param resource resource
+ */
+ public InventoryContextImpl(Resource resource) {
+ this.resource = resource;
+ }
+
+ /* (non-Javadoc)
+ * @see org.rhq.core.pluginapi.inventory.InventoryContext#discoverChildResources()
+ */
+ @Override
+ public void requestDeferredChildResourcesDiscovery() {
+ PluginContainer.getInstance().getInventoryManager().executeServiceScanDeferred(resource);
+ }
+
+ /* (non-Javadoc)
+ * @see org.rhq.core.pluginapi.inventory.InventoryContext#requestChildResourcesDiscovery()
+ */
+ @Override
+ public void requestChildResourcesDiscovery() {
+ PluginContainer.getInstance().getInventoryManager().executeServiceScanImmediately(resource);
+ }
+}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index 31974c4..3fcd148 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -108,6 +108,7 @@ import org.rhq.core.pluginapi.event.EventContext;
import org.rhq.core.pluginapi.inventory.ClassLoaderFacet;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.InventoryContext;
import org.rhq.core.pluginapi.inventory.ManualAddFacet;
import org.rhq.core.pluginapi.inventory.ProcessScanResult;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
@@ -575,10 +576,29 @@ public class InventoryManager extends AgentService implements ContainerService,
}
}
+ @NotNull
+ public InventoryReport executeServiceScanImmediately(Resource resource) {
+ try {
+ RuntimeDiscoveryExecutor discoveryExecutor = new RuntimeDiscoveryExecutor(this, this.configuration,
+ resource);
+ return inventoryThreadPoolExecutor.submit((Callable<InventoryReport>) discoveryExecutor).get();
+ } catch (InterruptedException e) {
+ throw new RuntimeException("Service scan execution was interrupted", e);
+ } catch (ExecutionException e) {
+ // Should never happen, reports are always generated, even if they're just to report the error
+ throw new RuntimeException("Unexpected exception", e);
+ }
+ }
+
public void executeServiceScanDeferred() {
inventoryThreadPoolExecutor.submit((Callable<InventoryReport>) this.serviceScanExecutor);
}
+ public void executeServiceScanDeferred(Resource resource) {
+ RuntimeDiscoveryExecutor discoveryExecutor = new RuntimeDiscoveryExecutor(this, this.configuration, resource);
+ inventoryThreadPoolExecutor.submit((Callable<InventoryReport>) discoveryExecutor);
+ }
+
/** this will NOT send a availability report up to the server! */
public AvailabilityReport executeAvailabilityScanImmediately(boolean changedOnlyReport) {
return executeAvailabilityScanImmediately(changedOnlyReport, false);
@@ -1293,7 +1313,7 @@ public class InventoryManager extends AgentService implements ContainerService,
/**
* Get the parent resource's children, ensuring we use the resource container version of the resource, because
* the container's resource is guaranteed to be up to date.
- *
+ *
* @param parentResource
* @return the children, may be empty, not null.
*/
@@ -1760,6 +1780,7 @@ public class InventoryManager extends AgentService implements ContainerService,
getOperationContext(resource), // for operation manager access
getContentContext(resource), // for content manager access
getAvailabilityContext(resource, this.availabilityCollectors), // for components that want to perform async avail checking
+ getInventoryContext(resource),
this.configuration.getPluginContainerDeployment()); // helps components make determinations of what to do
}
@@ -1779,6 +1800,7 @@ public class InventoryManager extends AgentService implements ContainerService,
getOperationContext(resource), // for operation manager access
getContentContext(resource), // for content manager access
getAvailabilityContext(resource, this.availabilityCollectors), // for components that want avail manager access
+ getInventoryContext(resource),
this.configuration.getPluginContainerDeployment()); // helps components make determinations of what to do
}
@@ -1829,7 +1851,7 @@ public class InventoryManager extends AgentService implements ContainerService,
return this.platform;
}
} else {
- // don't use container children here, the caller is providing the desired resources
+ // don't use container children here, the caller is providing the desired resources
for (Resource child : parent.getChildResources()) {
if (child != null && matches(resource, child)) {
return child;
@@ -2352,7 +2374,7 @@ public class InventoryManager extends AgentService implements ContainerService,
/**
* The resource upgrade should only occur during the {@link #initialize()} method and should be
* switched off at all other times.
- *
+ *
* @return true if resource upgrade is currently active, false otherwise
*/
public boolean isResourceUpgradeActive() {
@@ -2620,6 +2642,21 @@ public class InventoryManager extends AgentService implements ContainerService,
return availabilityContext;
}
+ /**
+ * Create inventory context for a resource.
+ *
+ * @param resource the resource
+ * @return the inventory context
+ */
+ private InventoryContext getInventoryContext(Resource resource) {
+ if (null == resource.getUuid() || resource.getUuid().isEmpty()) {
+ log.error("RESOURCE UUID IS NOT SET! Inventory features may not work!");
+ }
+
+ InventoryContext inventoryContext = new InventoryContextImpl(resource);
+ return inventoryContext;
+ }
+
private void updateResourceVersion(Resource resource, String version) {
String existingVersion = resource.getVersion();
boolean versionChanged = (existingVersion != null) ? !existingVersion.equals(version) : version != null;
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/bundle/BundleManagerTest.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/bundle/BundleManagerTest.java
index b6b39e0..4b37c89 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/bundle/BundleManagerTest.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/bundle/BundleManagerTest.java
@@ -478,7 +478,7 @@ public class BundleManagerTest {
@SuppressWarnings("unchecked")
private static class MockResourceContext extends ResourceContext {
public MockResourceContext(Resource resource) {
- super(resource, null, null, null, null, null, null, null, null, null, null, null, null);
+ super(resource, null, null, null, null, null, null, null, null, null, null, null, null, null);
}
}
} \ No newline at end of file
diff --git a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
index 05ebc2f..daf5463 100644
--- a/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
+++ b/modules/plugins/ant-bundle/src/test/java/org/rhq/plugins/ant/AntBundlePluginComponentTest.java
@@ -101,7 +101,8 @@ public class AntBundlePluginComponentTest {
resource.setUuid(UUID.randomUUID().toString());
@SuppressWarnings({ "rawtypes", "unchecked" })
ResourceContext<?> context = new ResourceContext(resource, null, null, null,
- SystemInfoFactory.createJavaSystemInfo(), tmpDir, null, "antBundleTestPC", null, null, null, null, null);
+ SystemInfoFactory.createJavaSystemInfo(), tmpDir, null, "antBundleTestPC", null, null, null, null, null,
+ null);
this.plugin.start(context);
}
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
index 75bc091..ff55c8d 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
@@ -547,6 +547,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
+ " server with key [" + context.getResourceKey() + "].");
context.getAvailabilityContext().requestAvailabilityCheck();
+ context.getInventoryContext().requestDeferredChildResourcesDiscovery();
return result;
}
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/nonpc/UploadAndDeployTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/nonpc/UploadAndDeployTest.java
index 8ddb308..28a8688 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/nonpc/UploadAndDeployTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/nonpc/UploadAndDeployTest.java
@@ -345,7 +345,8 @@ public class UploadAndDeployTest extends AbstractIntegrationTest {
resource.setUuid(UUID.randomUUID().toString());
StandaloneASComponent parentComponent = new StandaloneASComponent();
parentComponent.setConnection(getASConnection());
- ResourceContext context = new ResourceContext(resource,parentComponent,null,null,null,null,null,null,null,null,null,null,null);
+ ResourceContext context = new ResourceContext(resource, parentComponent, null, null, null, null, null, null,
+ null, null, null, null, null, null);
bc.start(context);
String bytes_value = uploadToAs(TEST_WAR_PATH);
@@ -379,7 +380,8 @@ public class UploadAndDeployTest extends AbstractIntegrationTest {
resource.setUuid(UUID.randomUUID().toString());
StandaloneASComponent parentComponent = new StandaloneASComponent();
parentComponent.setConnection(getASConnection());
- ResourceContext context = new ResourceContext(resource,parentComponent,null,null,null,null,null,null,null,null,null,null,null);
+ ResourceContext context = new ResourceContext(resource, parentComponent, null, null, null, null, null, null,
+ null, null, null, null, null, null);
bc.start(context);
String bytes_value = uploadToAs(TEST_WAR_PATH);
diff --git a/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java b/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java
index dfee1b6..569bd09 100644
--- a/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java
+++ b/modules/plugins/oracle/src/test/java/org/rhq/plugins/oracle/ComponentTest.java
@@ -36,12 +36,14 @@ import org.rhq.core.pc.availability.AvailabilityContextImpl;
import org.rhq.core.pc.content.ContentContextImpl;
import org.rhq.core.pc.event.EventContextImpl;
import org.rhq.core.pc.event.EventManager;
+import org.rhq.core.pc.inventory.InventoryContextImpl;
import org.rhq.core.pc.operation.OperationContextImpl;
import org.rhq.core.pc.upgrade.plugins.multi.base.NothingDiscoveringDiscoveryComponent;
import org.rhq.core.pluginapi.availability.AvailabilityContext;
import org.rhq.core.pluginapi.content.ContentContext;
import org.rhq.core.pluginapi.event.EventContext;
import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InventoryContext;
import org.rhq.core.pluginapi.inventory.PluginContainerDeployment;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
@@ -133,9 +135,11 @@ public abstract class ComponentTest {
ResourceDiscoveryComponent resourceDiscoveryComponent = new NothingDiscoveringDiscoveryComponent();
EventContext eventContext = new EventContextImpl(resource);
AvailabilityContext availContext = new AvailabilityContextImpl(resource, Executors.newCachedThreadPool());
+ InventoryContext inventoryContext = new InventoryContextImpl(resource);
ResourceContext context = new ResourceContext(resource, parentResourceComponent, parentResourceContext,
resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory, pluginContainerName,
- eventContext, operationContext, contentContext, availContext, pluginContainerDeployment);
+ eventContext, operationContext, contentContext, availContext, inventoryContext,
+ pluginContainerDeployment);
component.start(context);
resourceDiscoveryContext = new ResourceDiscoveryContext(resourceType, parentResourceComponent, context,
@@ -169,9 +173,10 @@ public abstract class ComponentTest {
EventContext eventContext = new EventContextImpl(resource);
AvailabilityContext availContext = new AvailabilityContextImpl(resource, Executors.newCachedThreadPool());
+ InventoryContext inventoryContext = new InventoryContextImpl(resource);
ResourceContext context = new ResourceContext(resource, component, parentContext, resourceDiscoveryComponent,
systemInfo, temporaryDirectory, dataDirectory, pluginContainerName, eventContext, operationContext,
- contentContext, availContext, pluginContainerDeployment);
+ contentContext, availContext, inventoryContext, pluginContainerDeployment);
ResourceDiscoveryContext resourceDiscoveryContext = new ResourceDiscoveryContext(resourceType, component,
context, systemInfo, Collections.emptyList(), Collections.emptyList(), pluginContainerName,
pluginContainerDeployment);
@@ -200,9 +205,10 @@ public abstract class ComponentTest {
EventContext eventContext = new EventContextImpl(resource);
AvailabilityContext availContext = new AvailabilityContextImpl(resource, Executors.newCachedThreadPool());
+ InventoryContext inventoryContext = new InventoryContextImpl(resource);
ResourceContext context = new ResourceContext(cresource, parentComponent, parentContext,
resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory, pluginContainerName,
- eventContext, operationContext, contentContext, availContext, pluginContainerDeployment);
+ eventContext, operationContext, contentContext, availContext, inventoryContext, pluginContainerDeployment);
component.start(context);
components.put(component, cresource);
diff --git a/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java b/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java
index b023609..cd90737 100644
--- a/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java
+++ b/modules/plugins/snmptrapd/src/test/java/org/rhq/plugins/snmptrapd/ComponentTest.java
@@ -24,11 +24,13 @@ import org.rhq.core.pc.availability.AvailabilityContextImpl;
import org.rhq.core.pc.content.ContentContextImpl;
import org.rhq.core.pc.event.EventContextImpl;
import org.rhq.core.pc.event.EventManager;
+import org.rhq.core.pc.inventory.InventoryContextImpl;
import org.rhq.core.pc.operation.OperationContextImpl;
import org.rhq.core.pc.upgrade.plugins.multi.base.NothingDiscoveringDiscoveryComponent;
import org.rhq.core.pluginapi.availability.AvailabilityContext;
import org.rhq.core.pluginapi.content.ContentContext;
import org.rhq.core.pluginapi.event.EventContext;
+import org.rhq.core.pluginapi.inventory.InventoryContext;
import org.rhq.core.pluginapi.inventory.PluginContainerDeployment;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
@@ -97,9 +99,10 @@ public abstract class ComponentTest {
ContentContext contentContext = new ContentContextImpl(0);
PluginContainerDeployment pluginContainerDeployment = null;
AvailabilityContext availContext = new AvailabilityContextImpl(resource, Executors.newCachedThreadPool());
+ InventoryContext inventoryContext = new InventoryContextImpl(resource);
ResourceContext context = new ResourceContext(resource, parentResourceComponent, parentResourceContext,
resourceDiscoveryComponent, systemInfo, temporaryDirectory, dataDirectory, pluginContainerName,
- eventContext, operationContext, contentContext, availContext, pluginContainerDeployment);
+ eventContext, operationContext, contentContext, availContext, inventoryContext, pluginContainerDeployment);
Assert.assertNotNull(context.getEventContext());
component.start(context);
}