etc/eclipse-tools/templates/formatter-profile.xml
| 6
etc/test-apps/javaee6-test-app/pom.xml
| 97 +++
etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleEntity.java
| 53 ++
etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleQueueMDB.java
| 38 +
etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleSingleton.java
| 44 +
etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleStateful.java
| 29 +
etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleStateless.java
| 29 +
etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleTopicMDB.java
| 38 +
etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleWebService.java
| 34 +
etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleWebServiceImpl.java
| 33 +
etc/test-apps/javaee6-test-app/src/main/resources/META-INF/persistence.xml
| 34 +
etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/beans.xml
| 25
etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/javaee6-test-app-ds.xml
| 34 +
etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/javaee6-test-app-jms.xml
| 34 +
modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/FakeServerInventory.java
| 3
modules/plugins/jboss-as-7/pom.xml
| 1
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
| 46 +
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
| 25
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
| 10
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java
| 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
| 17
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
| 2
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
| 17
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentRuntimeResourcesTest.java
| 264 ++++++++++
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java
| 151 +----
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/TestDeployments.java
| 45 +
modules/plugins/jboss-as-7/src/test/resources/itest/javaee6-test-app.war
|binary
modules/plugins/jboss-as-7/src/test/resources/log4j.xml
| 12
28 files changed, 960 insertions(+), 163 deletions(-)
New commits:
commit b1abc08b03fb1589dda73202961877b6fc3a86c2
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Fri Oct 25 18:08:01 2013 +0200
Bug 1015665 - Remove bogus product name check
Cherry-picked from master 1d7b80e
Introduced new pluginConfig property "expectedRuntimeProductName"
Will check this property while validating attributes
If a dependant plugin changes its product-name, it will be able to set this property
in a discovery callback
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
index 876b1ac..85f409d 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
@@ -18,6 +18,8 @@
*/
package org.rhq.modules.plugins.jbossas7;
+import static java.lang.Boolean.FALSE;
+import static java.lang.Boolean.TRUE;
import static org.rhq.core.util.StringUtil.arrayToString;
import static org.rhq.core.util.StringUtil.isNotBlank;
@@ -205,6 +207,7 @@ public abstract class BaseProcessDiscovery implements
ResourceDiscoveryComponent
String apiVersion = hostConfig.getDomainApiVersion();
JBossProductType productType =
JBossProductType.determineJBossProductType(homeDir, apiVersion);
serverPluginConfig.setProductType(productType);
+ pluginConfig.setSimpleValue("expectedRuntimeProductName",
productType.PRODUCT_NAME);
pluginConfig.setSimpleValue("hostXmlFileName",
getHostXmlFileName(commandLine));
ProcessInfo agentProcess =
discoveryContext.getSystemInformation().getThisProcess();
@@ -458,6 +461,7 @@ public abstract class BaseProcessDiscovery implements
ResourceDiscoveryComponent
pluginConfig.put(new PropertySimple("manuallyAdded", true));
pluginConfig.put(new
PropertySimple("productType",productType.name()));
+ pluginConfig.setSimpleValue("expectedRuntimeProductName",
productType.PRODUCT_NAME);
DiscoveredResourceDetails detail = new
DiscoveredResourceDetails(context.getResourceType(), key, name,
version, description, pluginConfig, null);
@@ -471,26 +475,36 @@ public abstract class BaseProcessDiscovery implements
ResourceDiscoveryComponent
Configuration pluginConfiguration =
inventoriedResource.getPluginConfiguration();
ServerPluginConfiguration serverPluginConfiguration = new
ServerPluginConfiguration(pluginConfiguration);
- if (currentResourceKey.startsWith(LOCAL_RESOURCE_KEY_PREFIX)
- || currentResourceKey.startsWith(REMOTE_RESOURCE_KEY_PREFIX)) {
- // Resource key already in right format
- return null;
- }
-
ResourceUpgradeReport report = new ResourceUpgradeReport();
+ Boolean upgraded = FALSE;
+
+ if (!currentResourceKey.startsWith(LOCAL_RESOURCE_KEY_PREFIX)
+ && !currentResourceKey.startsWith(REMOTE_RESOURCE_KEY_PREFIX)) {
+ // Resource key in wrong format
+ upgraded = TRUE;
+ if (new File(currentResourceKey).isDirectory()) {
+ // Old key format for a local resource (key is base dir)
+
report.setNewResourceKey(createKeyForLocalResource(serverPluginConfiguration));
+ } else if (currentResourceKey.contains(":")) {
+ // Old key format for a remote (manually added) resource (key is base
dir)
+
report.setNewResourceKey(createKeyForRemoteResource(currentResourceKey));
+ } else {
+ upgraded = FALSE;
+ log.warn("Unknown format, cannot upgrade resource key [" +
currentResourceKey + "]");
+ }
+ }
- if (new File(currentResourceKey).isDirectory()) {
- // Old key format for a local resource (key is base dir)
-
report.setNewResourceKey(createKeyForLocalResource(serverPluginConfiguration));
- } else if (currentResourceKey.contains(":")) {
- // Old key format for a remote (manually added) resource (key is base dir)
- report.setNewResourceKey(createKeyForRemoteResource(currentResourceKey));
- } else {
- log.warn("Unknown format, cannot upgrade resource key [" +
currentResourceKey + "]");
- return null;
+ if (pluginConfiguration.getSimpleValue("expectedRuntimeProductName") ==
null) {
+ upgraded = TRUE;
+ pluginConfiguration.setSimpleValue("expectedRuntimeProductName",
+ serverPluginConfiguration.getProductType().PRODUCT_NAME);
+ report.setNewPluginConfiguration(pluginConfiguration);
}
- return report;
+ if (upgraded == TRUE) {
+ return report;
+ }
+ return null;
}
private String createKeyForRemoteResource(String hostPort) {
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 9c2a799..b226af0 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
@@ -45,7 +45,6 @@ import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.pluginapi.availability.AvailabilityCollectorRunnable;
import org.rhq.core.pluginapi.availability.AvailabilityFacet;
-import org.rhq.core.pluginapi.component.ComponentInvocationContext;
import org.rhq.core.pluginapi.event.log.LogFileEventResourceComponentHelper;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
@@ -205,22 +204,20 @@ public abstract class BaseServerComponent<T extends
ResourceComponent<?>> extend
}
// Validate the product type (e.g. AS or EAP).
- JBossProductType runtimeType;
+ String expectedRuntimeProductName =
pluginConfiguration.getSimpleValue("expectedRuntimeProductName");
try {
- String runtimeTypeString = readAttribute(getHostAddress(),
"product-name");
- runtimeType = (runtimeTypeString != null &&
!runtimeTypeString.isEmpty()) ? JBossProductType
- .getValueByProductName(runtimeTypeString) : JBossProductType.AS;
- } catch (Exception e) {
- runtimeType = null;
- log.error("Failed to validate product type for " +
getResourceDescription() + ".", e);
- }
- if (runtimeType != null) {
- JBossProductType type = serverPluginConfig.getProductType();
- if (runtimeType != type) {
+ String runtimeProductName = readAttribute(getHostAddress(),
"product-name");
+ if (runtimeProductName == null || runtimeProductName.trim().isEmpty()) {
+ runtimeProductName = JBossProductType.AS.PRODUCT_NAME;
+ }
+ if (!runtimeProductName.equals(expectedRuntimeProductName)) {
throw new InvalidPluginConfigurationException(
- "The original product type discovered for this AS7 server was
" + type
- + ", but the server is now reporting its product type is
[" + runtimeType + "].");
+ "The original product type discovered for this server was "
+ expectedRuntimeProductName
+ + ", but the server is now reporting its product type is
[" + runtimeProductName + "]");
}
+ } catch (Exception e) {
+ throw new InvalidPluginConfigurationException("Failed to validate
product type for "
+ + getResourceDescription(), e);
}
}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
index f4cbb40..92c9e31 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/HostControllerDiscovery.java
@@ -1,6 +1,6 @@
/*
* 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
@@ -13,8 +13,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
*/
package org.rhq.modules.plugins.jbossas7;
@@ -33,10 +33,6 @@ public class HostControllerDiscovery extends BaseProcessDiscovery {
private static final String DOMAIN_CONFIG_DIR_SYSPROP =
"jboss.domain.config.dir";
private static final String DOMAIN_LOG_DIR_SYSPROP =
"jboss.domain.log.dir";
- private static final String DEFAULT_HOST_CONFIG_FILE_NAME = "host.xml";
-
- private CommandLineOption HOST_CONFIG_OPTION = new CommandLineOption(null,
"host-config");
-
@Override
protected AS7Mode getMode() {
return AS7Mode.DOMAIN;
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java
index 05b72e3..fa73974 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/JBossProductType.java
@@ -32,7 +32,7 @@ public enum JBossProductType {
AS("AS", "JBoss AS 7", "JBoss Application Server 7",
"AS"),
EAP("EAP", "JBoss EAP 6", "JBoss Enterprise Application
Platform 6", "EAP"),
- ISPN("ISPN", "Infinispan Server", "Infinispan Server",
"ISPN"),
+ ISPN("ISPN", "Infinispan Server", "Infinispan Server",
"Infinispan Server"),
JDG("JDG", "JBoss JDG 6", "JBoss Data Grid 6",
"Data Grid"),
JPP("JPP", "JBoss JPP 6", "JBoss Portal Platform 6",
"Portal Platform"),
SOA("SOA-P", "JBoss SOA-P 6", "Red Hat JBoss Fuse Service
Works", "Red Hat JBoss Fuse Service Works"),
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
index 2978343..31ad026 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/StandaloneASDiscovery.java
@@ -1,6 +1,6 @@
/*
* 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
@@ -13,13 +13,11 @@
* 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
*/
package org.rhq.modules.plugins.jbossas7;
-import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
import org.rhq.core.system.ProcessInfo;
import org.rhq.modules.plugins.jbossas7.helper.HostPort;
@@ -76,15 +74,6 @@ public class StandaloneASDiscovery extends BaseProcessDiscovery {
}
@Override
- protected DiscoveredResourceDetails buildResourceDetails(ResourceDiscoveryContext
discoveryContext,
- ProcessInfo process, AS7CommandLine commandLine) throws Exception {
-
- DiscoveredResourceDetails resourceDetails =
super.buildResourceDetails(discoveryContext, process, commandLine);
-
- return resourceDetails;
- }
-
- @Override
protected ProcessInfo getPotentialStartScriptProcess(ProcessInfo process) {
// If the server was started via standalone.sh/bat, its parent process will be
standalone.sh/bat.
return process.getParentProcess();
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
index f34a554..6ff3d06 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
@@ -63,6 +63,7 @@ public abstract class AbstractServerComponentTest extends
AbstractJBossAS7Plugin
static {
EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0",
"7.1.2.Final-redhat-1");
EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.1",
"7.1.3.Final-redhat-4");
+ EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.1.0",
"7.2.0.Final-redhat-8");
}
private static final String RELEASE_VERSION_TRAIT_NAME =
"_skm:release-version";
@@ -124,9 +125,13 @@ public abstract class AbstractServerComponentTest extends
AbstractJBossAS7Plugin
Assert.assertNotNull(ipce, "InvalidPluginConfigurationException was not
thrown by server component's "
+ "start() method due to invalid baseDir.");
- // Change the productType prop.
- JBossProductType originalProductType = serverPluginConfig.getProductType();
- serverPluginConfig.setProductType(originalProductType == JBossProductType.AS ?
JBossProductType.EAP : JBossProductType.AS);
+ // Change the expectedRuntimeProductName property
+ String originalExpectedRuntimeProductName =
pluginConfig.getSimpleValue("expectedRuntimeProductName");
+ if (originalExpectedRuntimeProductName.equals(JBossProductType.AS.PRODUCT_NAME))
{
+ pluginConfig.setSimpleValue("expectedRuntimeProductName",
JBossProductType.EAP.PRODUCT_NAME);
+ } else {
+ pluginConfig.setSimpleValue("expectedRuntimeProductName",
JBossProductType.AS.PRODUCT_NAME);
+ }
// Restart the server ResourceComponent so it picks up the changes we just made
to the plugin config.
inventoryManager.deactivateResource(getServerResource());
@@ -137,9 +142,9 @@ public abstract class AbstractServerComponentTest extends
AbstractJBossAS7Plugin
ipce = e;
}
- // Set the productType back to the original value and restart the component
before making any assertions, to ensure
- // things aren't left in a corrupt state for remaining test methods.
- serverPluginConfig.setProductType(originalProductType);
+ // Set the expectedRuntimeProductName property back to the original value and
restart the component before
+ // making any assertions, to ensure things aren't left in a corrupt state for
remaining test methods.
+ pluginConfig.setSimpleValue("expectedRuntimeProductName",
originalExpectedRuntimeProductName);
inventoryManager.activateResource(getServerResource(), serverContainer, true);
Assert.assertNotNull(ipce, "InvalidPluginConfigurationException was not
thrown by server component's "
commit ed1ad368ce9f37e088dba67660d936fdf293cc12
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Oct 24 11:09:36 2013 +0200
Bug 1023057 - AS7 plugin: "Hibernate Persistence Unit" service does not show
up
Cherry-picked from master ec97c8c7e65ba71b7f8b47fce8c799f2586aa513
Bug 1022409 - AS7 plugin: "Hibernate Persistence Unit" service does not show
up
Bug due to a typo in the plugin descriptor ('persistance' instead of
'persistence')
Added Sample JavaEE6 application
Added integration test for deployment "*Runtime" child resources
diff --git a/etc/eclipse-tools/templates/formatter-profile.xml
b/etc/eclipse-tools/templates/formatter-profile.xml
index 8f6df20..cfe6538 100644
--- a/etc/eclipse-tools/templates/formatter-profile.xml
+++ b/etc/eclipse-tools/templates/formatter-profile.xml
@@ -155,7 +155,7 @@
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_parenthesized_expression_in_throw"
value="insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_while"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_closing_brace_in_block"
value="insert"/>
-<setting id="org.eclipse.jdt.core.compiler.source"
value="1.5"/>
+<setting id="org.eclipse.jdt.core.compiler.source"
value="1.6"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_comma_in_for_increments"
value="insert"/>
<setting
id="org.eclipse.jdt.core.formatter.indent_body_declarations_compare_to_enum_declaration_header"
value="true"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_between_empty_parens_in_constructor_declaration"
value="do not insert"/>
@@ -163,7 +163,7 @@
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_prefix_operator"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.brace_position_for_type_declaration"
value="end_of_line"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_assignment_operator"
value="insert"/>
-<setting id="org.eclipse.jdt.core.compiler.compliance"
value="1.5"/>
+<setting id="org.eclipse.jdt.core.compiler.compliance"
value="1.6"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_opening_paren_in_method_invocation"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_angle_bracket_in_type_arguments"
value="do not insert"/>
<setting id="org.eclipse.jdt.core.formatter.compact_else_if"
value="true"/>
@@ -197,7 +197,7 @@
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_catch"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_after_opening_paren_in_synchronized"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.keep_empty_array_initializer_on_one_line"
value="false"/>
-<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform"
value="1.5"/>
+<setting id="org.eclipse.jdt.core.compiler.codegen.targetPlatform"
value="1.6"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_bracket_in_array_reference"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_paren_in_switch"
value="do not insert"/>
<setting
id="org.eclipse.jdt.core.formatter.insert_space_before_closing_brace_in_array_initializer"
value="insert"/>
diff --git a/etc/test-apps/javaee6-test-app/pom.xml
b/etc/test-apps/javaee6-test-app/pom.xml
new file mode 100644
index 0000000..1831f71
--- /dev/null
+++ b/etc/test-apps/javaee6-test-app/pom.xml
@@ -0,0 +1,97 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ RHQ Management Platform
+ ~ Copyright (C) 2005-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.,
+ ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ -->
+
+<project
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+
+ <groupId>javaee6-test-app</groupId>
+ <artifactId>javaee6-test-app</artifactId>
+ <version>1.0-SNAPSHOT</version>
+
+ <packaging>war</packaging>
+ <name>javaee6-test-app</name>
+
+ <properties>
+ <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+ <version.jboss.maven.plugin>7.4.Final</version.jboss.maven.plugin>
+ <version.jboss.bom>1.0.7.Final</version.jboss.bom>
+ </properties>
+
+ <dependencyManagement>
+ <dependencies>
+ <dependency>
+ <groupId>org.jboss.bom</groupId>
+ <artifactId>jboss-javaee-6.0-with-hibernate</artifactId>
+ <version>${version.jboss.bom}</version>
+ <type>pom</type>
+ <scope>import</scope>
+ </dependency>
+ </dependencies>
+ </dependencyManagement>
+
+ <dependencies>
+ <dependency>
+ <groupId>javax.enterprise</groupId>
+ <artifactId>cdi-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.hibernate.javax.persistence</groupId>
+ <artifactId>hibernate-jpa-2.0-api</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.ejb</groupId>
+ <artifactId>jboss-ejb-api_3.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ <dependency>
+ <groupId>org.jboss.spec.javax.jms</groupId>
+ <artifactId>jboss-jms-api_1.1_spec</artifactId>
+ <scope>provided</scope>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>javaee6-test-app</finalName>
+ <plugins>
+ <plugin>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.4</version>
+ <configuration>
+ <failOnMissingWebXml>false</failOnMissingWebXml>
+ </configuration>
+ </plugin>
+ <plugin>
+ <groupId>org.jboss.as.plugins</groupId>
+ <artifactId>jboss-as-maven-plugin</artifactId>
+ <version>7.4.Final</version>
+ <configuration>
+ <hostname>127.0.0.18</hostname>
+ <port>9999</port>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+</project>
diff --git
a/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleEntity.java
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleEntity.java
new file mode 100644
index 0000000..41c8660
--- /dev/null
+++
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleEntity.java
@@ -0,0 +1,53 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.test.apps.javaee6;
+
+import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.Id;
+
+/**
+ * @author Thomas Segismont
+ */
+@Entity
+public class SimpleEntity {
+
+ private Long id;
+
+ private String name;
+
+ @Id
+ @GeneratedValue
+ public Long getId() {
+ return id;
+ }
+
+ public void setId(Long id) {
+ this.id = id;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+}
diff --git
a/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleQueueMDB.java
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleQueueMDB.java
new file mode 100644
index 0000000..17756c1
--- /dev/null
+++
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleQueueMDB.java
@@ -0,0 +1,38 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.test.apps.javaee6;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+@MessageDriven(name = "SimpleQueueMDB", activationConfig = {
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue =
"javax.jms.Queue"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue =
"queue/SimpleQueue"),
+ @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue =
"Auto-acknowledge") })
+/**
+ * @author Thomas Segismont
+ */
+public class SimpleQueueMDB implements MessageListener {
+
+ public void onMessage(Message message) {
+ }
+}
diff --git
a/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleSingleton.java
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleSingleton.java
new file mode 100644
index 0000000..d057dd4
--- /dev/null
+++
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleSingleton.java
@@ -0,0 +1,44 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.test.apps.javaee6;
+
+import javax.annotation.PostConstruct;
+import javax.ejb.Singleton;
+import javax.ejb.Startup;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
+
+/**
+ * @author Thomas Segismont
+ */
+@Singleton
+@Startup
+public class SimpleSingleton {
+
+ @PersistenceContext
+ EntityManager em;
+
+ @PostConstruct
+ public void init() {
+ em.createQuery("from SimpleEntity").getResultList();
+ }
+
+
+}
diff --git
a/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleStateful.java
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleStateful.java
new file mode 100644
index 0000000..4267704
--- /dev/null
+++
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleStateful.java
@@ -0,0 +1,29 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.test.apps.javaee6;
+
+import javax.ejb.Stateful;
+
+/**
+ * @author Thomas Segismont
+ */
+@Stateful
+public class SimpleStateful {
+}
diff --git
a/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleStateless.java
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleStateless.java
new file mode 100644
index 0000000..70dbec6
--- /dev/null
+++
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleStateless.java
@@ -0,0 +1,29 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.test.apps.javaee6;
+
+import javax.ejb.Stateless;
+
+/**
+ * @author Thomas Segismont
+ */
+@Stateless
+public class SimpleStateless {
+}
diff --git
a/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleTopicMDB.java
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleTopicMDB.java
new file mode 100644
index 0000000..e26728a
--- /dev/null
+++
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleTopicMDB.java
@@ -0,0 +1,38 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.test.apps.javaee6;
+
+import javax.ejb.ActivationConfigProperty;
+import javax.ejb.MessageDriven;
+import javax.jms.Message;
+import javax.jms.MessageListener;
+
+@MessageDriven(name = "SimpleTopicMDB", activationConfig = {
+ @ActivationConfigProperty(propertyName = "destinationType", propertyValue =
"javax.jms.Topic"),
+ @ActivationConfigProperty(propertyName = "destination", propertyValue =
"topic/SimpleTopic"),
+ @ActivationConfigProperty(propertyName = "acknowledgeMode", propertyValue =
"Auto-acknowledge") })
+/**
+ * @author Thomas Segismont
+ */
+public class SimpleTopicMDB implements MessageListener {
+
+ public void onMessage(Message rcvMessage) {
+ }
+}
diff --git
a/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleWebService.java
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleWebService.java
new file mode 100644
index 0000000..cdba606
--- /dev/null
+++
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleWebService.java
@@ -0,0 +1,34 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+package org.rhq.test.apps.javaee6;
+
+import java.util.List;
+
+import javax.jws.WebMethod;
+import javax.jws.WebService;
+
+/**
+ * @author Thomas Segismont
+ */
+@WebService(targetNamespace =
"http://www.jboss.org/rhq/test-apps/javaee6-test-app/SimpleWebService")
+public interface SimpleWebService {
+
+ @WebMethod
+ public String simpleAction();
+}
\ No newline at end of file
diff --git
a/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleWebServiceImpl.java
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleWebServiceImpl.java
new file mode 100644
index 0000000..1298255
--- /dev/null
+++
b/etc/test-apps/javaee6-test-app/src/main/java/org/rhq/test/apps/javaee6/SimpleWebServiceImpl.java
@@ -0,0 +1,33 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.test.apps.javaee6;
+
+import javax.jws.WebService;
+
+/**
+ * @author Thomas Segismont
+ */
+@WebService(serviceName = "SimpleWebService", portName =
"SimpleWebService", name = "SimpleWebService", endpointInterface =
"org.rhq.test.apps.javaee6.SimpleWebService", targetNamespace =
"http://www.jboss.org/rhq/test-apps/javaee6-test-app/SimpleWebService")
+public class SimpleWebServiceImpl implements SimpleWebService {
+ @Override
+ public String simpleAction() {
+ return "ok";
+ }
+}
diff --git a/etc/test-apps/javaee6-test-app/src/main/resources/META-INF/persistence.xml
b/etc/test-apps/javaee6-test-app/src/main/resources/META-INF/persistence.xml
new file mode 100644
index 0000000..55edc7b
--- /dev/null
+++ b/etc/test-apps/javaee6-test-app/src/main/resources/META-INF/persistence.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ RHQ Management Platform
+ ~ Copyright (C) 2005-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.,
+ ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ -->
+
+<persistence version="2.0"
+
xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+
http://java.sun.com/xml/ns/persistence
+
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd">
+ <persistence-unit name="primary">
+
<jta-data-source>java:jboss/datasources/javaee6-test-appDS</jta-data-source>
+ <properties>
+ <property name="hibernate.hbm2ddl.auto"
value="create-drop"/>
+ <property name="hibernate.show_sql" value="true"/>
+ <property name="hibernate.generate_statistics"
value="true"/>
+ </properties>
+ </persistence-unit>
+</persistence>
diff --git a/etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/beans.xml
b/etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/beans.xml
new file mode 100644
index 0000000..cfc146e
--- /dev/null
+++ b/etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/beans.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ RHQ Management Platform
+ ~ Copyright (C) 2005-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.,
+ ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ -->
+
+<beans
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="
+
http://java.sun.com/xml/ns/javaee
+
http://java.sun.com/xml/ns/javaee/beans_1_0.xsd">
+</beans>
diff --git
a/etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/javaee6-test-app-ds.xml
b/etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/javaee6-test-app-ds.xml
new file mode 100644
index 0000000..081a8e8
--- /dev/null
+++ b/etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/javaee6-test-app-ds.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ RHQ Management Platform
+ ~ Copyright (C) 2005-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.,
+ ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ -->
+
+<datasources
xmlns="http://www.jboss.org/ironjacamar/schema"
+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+
xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema
http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
+ <datasource jndi-name="java:jboss/datasources/javaee6-test-appDS"
+ pool-name="javaee6-test-app" enabled="true"
+ use-java-context="true">
+
<connection-url>jdbc:h2:mem:javaee6-test-app;DB_CLOSE_ON_EXIT=FALSE;DB_CLOSE_DELAY=-1</connection-url>
+ <driver>h2</driver>
+ <security>
+ <user-name>sa</user-name>
+ <password>sa</password>
+ </security>
+ </datasource>
+</datasources>
diff --git
a/etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/javaee6-test-app-jms.xml
b/etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/javaee6-test-app-jms.xml
new file mode 100644
index 0000000..2821b43
--- /dev/null
+++ b/etc/test-apps/javaee6-test-app/src/main/webapp/WEB-INF/javaee6-test-app-jms.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ RHQ Management Platform
+ ~ Copyright (C) 2005-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.,
+ ~ 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ -->
+
+<messaging-deployment xmlns="urn:jboss:messaging-deployment:1.0">
+ <hornetq-server>
+ <jms-destinations>
+ <jms-queue name="SimpleQueue">
+ <entry name="/queue/SimpleQueue"/>
+ <durable>true</durable>
+ <selector string="red"/>
+ </jms-queue>
+ <jms-topic name="SimpleTopic">
+ <entry name="/topic/SimpleTopic"/>
+ </jms-topic>
+ </jms-destinations>
+ </hornetq-server>
+</messaging-deployment>
\ No newline at end of file
diff --git
a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/FakeServerInventory.java
b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/FakeServerInventory.java
index 1f56095..94654ee 100644
---
a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/FakeServerInventory.java
+++
b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/FakeServerInventory.java
@@ -16,6 +16,7 @@
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
+
package org.rhq.test.arquillian;
import java.lang.reflect.Field;
@@ -113,7 +114,7 @@ public class FakeServerInventory {
private void setDepth(int resourceTreeDepth) {
synchronized (sync) {
if (LOG.isDebugEnabled()) {
- LOG.debug("Current tree depth is " + resourceTreeDepth +
", while this checker is waiting for "
+ LOG.debug("Current tree depth is " + resourceTreeDepth +
", this checker is waiting for "
+ expectedDepth + " on " + this);
}
if (!depthReached && resourceTreeDepth >= expectedDepth) {
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index b9b0914..566e0ef 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -615,6 +615,7 @@
<!--<include>org/rhq/modules/plugins/jbossas7/itest/standalone/StandaloneServerComponentTest.java</include>-->
<!--<include>org/rhq/modules/plugins/jbossas7/itest/standalone/InterruptibleOperationsTest.java</include>-->
<!--<include>org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java</include>-->
+
<!--<include>org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentRuntimeResourcesTest.java</include>-->
<!--<include>org/rhq/modules/plugins/jbossas7/itest/standalone/WebConnectorComponentTest.java</include>-->
<!--<include>org/rhq/modules/plugins/jbossas7/itest/domain/DomainServerComponentTest.java</include>-->
<!--<include>org/rhq/modules/plugins/jbossas7/itest/domain/ManagedServerTest.java</include>-->
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index af8474b..aabf8de 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -10063,7 +10063,7 @@
singleton="true">
<plugin-configuration>
- <c:simple-property name="path"
default="hibernate-persistance-unit" readOnly="true"/>
+ <c:simple-property name="path"
default="hibernate-persistence-unit" readOnly="true"/>
</plugin-configuration>
<operation name="subsystem:clear" description="Clear
statistics.">
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentRuntimeResourcesTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentRuntimeResourcesTest.java
new file mode 100644
index 0000000..05237ef
--- /dev/null
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentRuntimeResourcesTest.java
@@ -0,0 +1,264 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-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.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.modules.plugins.jbossas7.itest.standalone;
+
+import static java.lang.System.currentTimeMillis;
+import static java.util.concurrent.TimeUnit.MINUTES;
+import static java.util.concurrent.TimeUnit.SECONDS;
+import static
org.rhq.modules.plugins.jbossas7.itest.standalone.DeploymentTest.copyStreamAndReturnCount;
+import static
org.rhq.modules.plugins.jbossas7.itest.standalone.DeploymentTest.getMeasurementScheduleRequests;
+import static
org.rhq.modules.plugins.jbossas7.itest.standalone.DeploymentTest.getMissingMeasurements;
+import static
org.rhq.modules.plugins.jbossas7.itest.standalone.DeploymentTest.getTestDeploymentPackageDetails;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
+
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.util.HashSet;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.testng.annotations.Test;
+
+import org.rhq.core.clientapi.agent.PluginContainerException;
+import org.rhq.core.clientapi.agent.inventory.CreateResourceRequest;
+import org.rhq.core.clientapi.agent.inventory.CreateResourceResponse;
+import org.rhq.core.clientapi.agent.inventory.DeleteResourceRequest;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.content.PackageDetailsKey;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.domain.resource.CreateResourceStatus;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.pc.inventory.ResourceContainer;
+import org.rhq.core.pc.util.FacetLockType;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.modules.plugins.jbossas7.itest.AbstractJBossAS7PluginTest;
+import org.rhq.test.arquillian.DiscoveredResources;
+import org.rhq.test.arquillian.RunDiscovery;
+import org.rhq.test.arquillian.ServerServicesSetup;
+
+/**
+ * This test ensures that "* Runtime" (JPA, Messaging, EJB3) child resources of
a deployment get discovered.
+ *
+ * @author Thomas Segismont
+ */
+@Test(groups = { "integration", "pc", "standalone" },
singleThreaded = true)
+public class DeploymentRuntimeResourcesTest extends AbstractJBossAS7PluginTest {
+ private static final Log LOG =
LogFactory.getLog(DeploymentRuntimeResourcesTest.class);
+
+ private enum RuntimeServiceType {
+ DATASOURCES_RUNTIME("Datasources Runtime"), //
+ DATASOURCE_RUNTIME("Datasource Runtime"), //
+ MESSAGING_RUNTIME("Messaging Runtime"), //
+ HORNETQ_SERVER_RUNTIME("HornetQ Server Runtime"), //
+ JMS_QUEUE_RUNTIME("JMS Queue Runtime"), //
+ JMS_TOPIC_RUNTIME("JMS Topic Runtime"), //
+ EJB3_RUNTIME("EJB3 Runtime"), //
+ MESSAGE_DRIVEN_BEAN_RUNTIME("Message Driven Bean Runtime"), //
+ SINGLETON_BEAN_RUNTIME("Singleton Bean Runtime"), //
+ STATELESS_SESSION_BEAN_RUNTIME("Stateless Session Bean Runtime"), //
+ STATEFUL_SESSION_BEAN_RUNTIME("Stateful Session Bean Runtime"), //
+ WEBSERVICES_RUNTIME("Webservices Runtime"), //
+ ENDPOINT_RUNTIME("Endpoint Runtime"), //
+ JPA_RUNTIME("JPA Runtime"), //
+ HIBERNATE_PERSISTENCE_UNIT("Hibernate Persistence Unit"), //
+ ENTITY("Entity");
+
+ private String serviceTypeName;
+
+ RuntimeServiceType(String serviceTypeName) {
+ this.serviceTypeName = serviceTypeName;
+ }
+
+ public String getServiceTypeName() {
+ return serviceTypeName;
+ }
+ }
+
+ @DiscoveredResources(plugin = PLUGIN_NAME, resourceType = "JBossAS7 Standalone
Server")
+ private Set<Resource> standaloneResources;
+
+ @DiscoveredResources(plugin = PLUGIN_NAME, resourceType = "Deployment")
+ private Set<Resource> deploymentResources;
+
+ @ServerServicesSetup
+ @Test(enabled = false)
+ public void setupContentServices() {
+ Mockito.when(
+
serverServices.getContentServerService().downloadPackageBitsForChildResource(Mockito.anyInt(),
+ Mockito.anyString(), Mockito.any(PackageDetailsKey.class),
Mockito.any(OutputStream.class))).then(
+ new Answer<Long>() {
+ @Override
+ public Long answer(InvocationOnMock invocation) throws Throwable {
+ InputStream str = getClass().getClassLoader().getResourceAsStream(
+ TestDeployments.JAVAEE6_TEST_APP.getResourcePath());
+ OutputStream out = (OutputStream)
invocation.getArguments()[invocation.getArguments().length - 1];
+ return copyStreamAndReturnCount(str, out);
+ }
+ });
+
+ Mockito.when(
+
serverServices.getContentServerService().downloadPackageBitsGivenResource(Mockito.anyInt(),
+ Mockito.any(PackageDetailsKey.class),
Mockito.any(OutputStream.class))).then(new Answer<Long>() {
+ @Override
+ public Long answer(InvocationOnMock invocation) throws Throwable {
+ InputStream str = getClass().getClassLoader().getResourceAsStream(
+ TestDeployments.JAVAEE6_TEST_APP.getResourcePath());
+ OutputStream out = (OutputStream)
invocation.getArguments()[invocation.getArguments().length - 1];
+ return copyStreamAndReturnCount(str, out);
+ }
+ });
+ }
+
+ @Test(priority = 10)
+ @RunDiscovery
+ public void testDeploy() throws Exception {
+ assertFalse(standaloneResources == null || standaloneResources.size() != 1,
+ "Exactly 1 AS7 standalone server resource should be present.");
+
+ int serverResourceId = standaloneResources.iterator().next().getId();
+
+ ResourcePackageDetails packageDetails =
getTestDeploymentPackageDetails(TestDeployments.JAVAEE6_TEST_APP);
+
+ Configuration deploymentConfig = new Configuration();
+ deploymentConfig.put(new PropertySimple("runtimeName",
packageDetails.getName()));
+
+ CreateResourceRequest request = new CreateResourceRequest();
+ request.setPackageDetails(packageDetails);
+ request.setParentResourceId(serverResourceId);
+ request.setPluginConfiguration(null);
+ request.setPluginName(PLUGIN_NAME);
+ request.setResourceConfiguration(deploymentConfig);
+ request.setResourceName(packageDetails.getName());
+ request.setResourceTypeName("Deployment");
+
+ CreateResourceResponse response =
pluginContainer.getResourceFactoryManager().executeCreateResourceImmediately(
+ request);
+
+ assertEquals(response.getStatus(), CreateResourceStatus.SUCCESS,
+ "The deployment failed with an error mesasge: " +
response.getErrorMessage());
+ }
+
+ @Test(priority = 12)
+ @RunDiscovery
+ public void testRuntimeResources() throws Exception {
+ ensureAllRuntimeServicesAreFound();
+ for (RuntimeServiceType runtimeServiceType : RuntimeServiceType.values()) {
+ testRuntimeResourceMeasurements(runtimeServiceType);
+ }
+ }
+
+ private void ensureAllRuntimeServicesAreFound() throws InterruptedException {
+ long start = currentTimeMillis();
+ boolean foundAllRuntimeServices = false;
+ do {
+ boolean runtimeServiceMissing = false;
+ for (RuntimeServiceType runtimeServiceType : RuntimeServiceType.values()) {
+ Set<Resource> childResources =
getChildResourcesOfType(getDeploymentResource(),
+ runtimeServiceType.getServiceTypeName());
+ runtimeServiceMissing = childResources.isEmpty() &&
canGetMeasurementFacet(childResources);
+ if (runtimeServiceMissing) {
+ break;
+ }
+ }
+ foundAllRuntimeServices = !runtimeServiceMissing;
+ Thread.sleep(SECONDS.toMillis(5));
+ } while (!foundAllRuntimeServices && (currentTimeMillis() - start) <
MINUTES.toMillis(10));
+ assertTrue(foundAllRuntimeServices, "Could not find all runtime
services");
+ Thread.sleep(MINUTES.toMillis(5));
+ }
+
+ private boolean canGetMeasurementFacet(Set<Resource> resources) {
+ for (Resource resource : resources) {
+ if (getMeasurementFacet(resource) == null) {
+ return false;
+ }
+ }
+ return true;
+ }
+
+ private void testRuntimeResourceMeasurements(RuntimeServiceType runtimeServiceType)
throws Exception {
+ Set<Resource> resources = getChildResourcesOfType(getDeploymentResource(),
+ runtimeServiceType.getServiceTypeName());
+ for (Resource resource : resources) {
+ MeasurementFacet measurementFacet = getMeasurementFacet(resource);
+ MeasurementReport report = new MeasurementReport();
+ Set<MeasurementScheduleRequest> measurementScheduleRequests =
getMeasurementScheduleRequests(resource);
+ measurementFacet.getValues(report, measurementScheduleRequests);
+ assertEquals(report.getCallTimeData().size(), 0,
runtimeServiceType.getServiceTypeName()
+ + ": no calltime data was requested");
+ assertEquals(
+ report.getNumericData().size() + report.getTraitData().size(),
+ measurementScheduleRequests.size(),
+ runtimeServiceType.getServiceTypeName()
+ + ": some requested measurements are missing: "
+ + getMissingMeasurements(measurementScheduleRequests,
report.getNumericData(),
+ report.getTraitData()));
+ }
+ }
+
+ private MeasurementFacet getMeasurementFacet(Resource resource) {
+ ResourceContainer resourceContainer =
pluginContainer.getInventoryManager().getResourceContainer(resource);
+ try {
+ return resourceContainer.createResourceComponentProxy(MeasurementFacet.class,
FacetLockType.READ,
+ SECONDS.toMillis(5), false, false, false);
+ } catch (PluginContainerException e) {
+ return null;
+ }
+ }
+
+ private Set<Resource> getChildResourcesOfType(final Resource parentResource,
final String runtimeServiceType) {
+ Set<Resource> foundResources = new HashSet<Resource>();
+ Set<Resource> childResources = parentResource.getChildResources();
+ if (childResources != null && !childResources.isEmpty()) {
+ for (Resource childResource : childResources) {
+ if (runtimeServiceType.equals(childResource.getResourceType().getName()))
{
+ foundResources.add(childResource);
+ }
+ foundResources.addAll(getChildResourcesOfType(childResource,
runtimeServiceType));
+ }
+ }
+ return foundResources;
+ }
+
+ @Test(priority = 99)
+ public void testUndeploy() throws Exception {
+ Resource deploymentResource = getDeploymentResource();
+ DeleteResourceRequest request = new DeleteResourceRequest(0,
deploymentResource.getId());
+ getServerInventory().removeResource(deploymentResource);
+ pluginContainer.getResourceFactoryManager().deleteResource(request);
+ }
+
+ private Resource getDeploymentResource() {
+ assertFalse(deploymentResources == null || deploymentResources.size() != 1,
+ "Exactly 1 deployment resource should be present.");
+ return pluginContainer.getInventoryManager()
+
.getResourceContainer(deploymentResources.iterator().next().getId()).getResource();
+ }
+
+}
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java
index b872ad6..24add24 100644
---
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/DeploymentTest.java
@@ -24,12 +24,9 @@ import static
org.rhq.core.domain.util.ResourceTypeUtility.getMeasurementDefinit
import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue;
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.security.MessageDigest;
-import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
@@ -66,6 +63,7 @@ import org.rhq.core.domain.util.MeasurementDefinitionFilter;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pc.util.FacetLockType;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.util.MessageDigestGenerator;
import org.rhq.modules.plugins.jbossas7.StandaloneASComponent;
import org.rhq.modules.plugins.jbossas7.itest.AbstractJBossAS7PluginTest;
import org.rhq.test.arquillian.DiscoveredResources;
@@ -81,32 +79,6 @@ import org.rhq.test.arquillian.ServerServicesSetup;
@Test(groups = { "integration", "pc", "standalone" },
singleThreaded = true)
public class DeploymentTest extends AbstractJBossAS7PluginTest {
- private enum TestDeployments {
- DEPLOYMENT_1("test-simple.war"),
DEPLOYMENT_2("test-simple-2.war");
-
- private String deploymentName;
- private String resourcePath;
- private byte[] hash;
-
- private TestDeployments(String warName) {
- this.deploymentName = warName;
- this.resourcePath = "itest/" + warName;
- hash =
computeHash(DeploymentTest.class.getClassLoader().getResourceAsStream(resourcePath));
- }
-
- public String getDeploymentName() {
- return deploymentName;
- }
-
- public String getResourcePath() {
- return resourcePath;
- }
-
- public byte[] getHash() {
- return hash;
- }
- }
-
@ResourceComponentInstances(plugin = PLUGIN_NAME, resourceType = "JBossAS7
Standalone Server")
private Set<StandaloneASComponent> standalones;
@@ -123,19 +95,6 @@ public class DeploymentTest extends AbstractJBossAS7PluginTest {
private static TestDeployments DEPLOYMENT_TO_SERVE = TestDeployments.DEPLOYMENT_1;
- private static long copyStreamAndReturnCount(InputStream in, OutputStream out) throws
IOException {
- int data;
- long cnt = 0;
- while ((data = in.read()) != -1) {
- if (out != null) {
- out.write(data);
- }
- cnt++;
- }
-
- return cnt;
- }
-
//this is no test method
@ServerServicesSetup
@Test(enabled = false)
@@ -278,41 +237,9 @@ public class DeploymentTest extends AbstractJBossAS7PluginTest {
measurementFacet.getValues(report, measurementScheduleRequests);
assertEquals(report.getCallTimeData().size(), 0, "No calltime data was
requested");
assertTrue(
- report.getNumericData().size() + report.getTraitData().size() ==
measurementScheduleRequests.size(),
- "Some requested measurements are missing: "
- + getMissingMeasurements(measurementScheduleRequests,
report.getNumericData(), report.getTraitData()));
- }
-
- private Set<String>
getMissingMeasurements(Set<MeasurementScheduleRequest> measurementScheduleRequests,
- Set<MeasurementDataNumeric> numericData, Set<MeasurementDataTrait>
traitData) {
- Set<String> missingMeasurements = new HashSet<String>();
- for (MeasurementScheduleRequest measurementScheduleRequest :
measurementScheduleRequests) {
- missingMeasurements.add(measurementScheduleRequest.getName());
- }
- for (MeasurementDataNumeric measurementDataNumeric : numericData) {
- missingMeasurements.remove(measurementDataNumeric.getName());
- }
- for (MeasurementDataTrait measurementDataTrait : traitData) {
- missingMeasurements.remove(measurementDataTrait.getName());
- }
- return missingMeasurements;
- }
-
- private Set<MeasurementScheduleRequest> getMeasurementScheduleRequests(Resource
webRuntimeResource) {
- Set<MeasurementDefinition> measurementDefinitions =
getMeasurementDefinitions(
- webRuntimeResource.getResourceType(), new MeasurementDefinitionFilter() {
- private final Set<DataType> acceptableDataTypes =
EnumSet.of(DataType.MEASUREMENT, DataType.TRAIT);
-
- public boolean accept(MeasurementDefinition measurementDefinition) {
- return
acceptableDataTypes.contains(measurementDefinition.getDataType());
- }
- });
- Set<MeasurementScheduleRequest> measurementScheduleRequests = new
HashSet<MeasurementScheduleRequest>();
- for (MeasurementDefinition measurementDefinition : measurementDefinitions) {
- measurementScheduleRequests.add(new MeasurementScheduleRequest(-1,
measurementDefinition.getName(), -1,
- true, measurementDefinition.getDataType(),
measurementDefinition.getRawNumericType()));
- }
- return measurementScheduleRequests;
+ report.getNumericData().size() + report.getTraitData().size() ==
measurementScheduleRequests.size(),
+ "Some requested measurements are missing: "
+ + getMissingMeasurements(measurementScheduleRequests,
report.getNumericData(), report.getTraitData()));
}
@Test(priority = 16)
@@ -344,6 +271,14 @@ public class DeploymentTest extends AbstractJBossAS7PluginTest {
return null;
}
+
+ private byte[] computeHash(InputStream data) {
+ try {
+ return MessageDigestGenerator.getDigest(data);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ }
+ }
})
.when(serverServices.getContentServerService())
.completeRetrievePackageBitsRequest(Mockito.any(ContentServiceResponse.class),
@@ -365,39 +300,55 @@ public class DeploymentTest extends AbstractJBossAS7PluginTest {
}
}
- private ResourcePackageDetails getTestDeploymentPackageDetails(TestDeployments
deployment) {
+ static long copyStreamAndReturnCount(InputStream in, OutputStream out) throws
IOException {
+ int data;
+ long cnt = 0;
+ while ((data = in.read()) != -1) {
+ if (out != null) {
+ out.write(data);
+ }
+ cnt++;
+ }
+ return cnt;
+ }
+
+ static ResourcePackageDetails getTestDeploymentPackageDetails(TestDeployments
deployment) {
ResourcePackageDetails details = new ResourcePackageDetails(new
PackageDetailsKey(
deployment.getDeploymentName(), "1.0", "file",
"noarch"));
details.setFileName(deployment.getDeploymentName());
details.setDeploymentTimeConfiguration(new Configuration());
-
return details;
+ }
+ static Set<String> getMissingMeasurements(Set<MeasurementScheduleRequest>
measurementScheduleRequests,
+ Set<MeasurementDataNumeric>
numericData, Set<MeasurementDataTrait> traitData) {
+ Set<String> missingMeasurements = new HashSet<String>();
+ for (MeasurementScheduleRequest measurementScheduleRequest :
measurementScheduleRequests) {
+ missingMeasurements.add(measurementScheduleRequest.getName());
+ }
+ for (MeasurementDataNumeric measurementDataNumeric : numericData) {
+ missingMeasurements.remove(measurementDataNumeric.getName());
+ }
+ for (MeasurementDataTrait measurementDataTrait : traitData) {
+ missingMeasurements.remove(measurementDataTrait.getName());
+ }
+ return missingMeasurements;
}
- private static byte[] computeHash(InputStream str) {
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try {
- int data;
- while ((data = str.read()) != -1) {
- out.write(data);
- }
+ static Set<MeasurementScheduleRequest> getMeasurementScheduleRequests(Resource
webRuntimeResource) {
+ Set<MeasurementDefinition> measurementDefinitions =
getMeasurementDefinitions(
+ webRuntimeResource.getResourceType(), new MeasurementDefinitionFilter()
{
+ private final Set<DataType> acceptableDataTypes =
EnumSet.of(DataType.MEASUREMENT, DataType.TRAIT);
- return MessageDigest.getInstance("md5").digest(out.toByteArray());
- } catch (IOException e) {
- throw new IllegalStateException("Could not determine the MD5 of the test
deployment.", e);
- } catch (NoSuchAlgorithmException e) {
- throw new IllegalStateException(
- "Could not instantiate MD5 message digest algorithm, this should not
happen.", e);
- } finally {
- try {
- out.close();
- } catch (IOException e) {
- }
- try {
- str.close();
- } catch (IOException e) {
+ public boolean accept(MeasurementDefinition measurementDefinition) {
+ return
acceptableDataTypes.contains(measurementDefinition.getDataType());
}
+ });
+ Set<MeasurementScheduleRequest> measurementScheduleRequests = new
HashSet<MeasurementScheduleRequest>();
+ for (MeasurementDefinition measurementDefinition : measurementDefinitions) {
+ measurementScheduleRequests.add(new MeasurementScheduleRequest(-1,
measurementDefinition.getName(), -1,
+ true, measurementDefinition.getDataType(),
measurementDefinition.getRawNumericType()));
}
+ return measurementScheduleRequests;
}
}
diff --git
a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/TestDeployments.java
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/TestDeployments.java
new file mode 100644
index 0000000..ef265c8
--- /dev/null
+++
b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/standalone/TestDeployments.java
@@ -0,0 +1,45 @@
+package org.rhq.modules.plugins.jbossas7.itest.standalone;
+
+import java.io.IOException;
+import java.io.InputStream;
+
+import org.rhq.core.util.MessageDigestGenerator;
+import org.rhq.core.util.stream.StreamUtil;
+
+/**
+* @author Thomas Segismont
+*/
+enum TestDeployments {
+ DEPLOYMENT_1("test-simple.war"), //
+ DEPLOYMENT_2("test-simple-2.war"), //
+ JAVAEE6_TEST_APP("javaee6-test-app.war");
+
+ private String deploymentName;
+ private String resourcePath;
+ private byte[] hash;
+
+ TestDeployments(String warName) {
+ this.deploymentName = warName;
+ this.resourcePath = "itest/" + warName;
+ InputStream resourceAsStream =
DeploymentTest.class.getClassLoader().getResourceAsStream(resourcePath);
+ try {
+ hash = MessageDigestGenerator.getDigest(resourceAsStream);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ StreamUtil.safeClose(resourceAsStream);
+ }
+ }
+
+ public String getDeploymentName() {
+ return deploymentName;
+ }
+
+ public String getResourcePath() {
+ return resourcePath;
+ }
+
+ public byte[] getHash() {
+ return hash;
+ }
+}
diff --git a/modules/plugins/jboss-as-7/src/test/resources/itest/javaee6-test-app.war
b/modules/plugins/jboss-as-7/src/test/resources/itest/javaee6-test-app.war
new file mode 100644
index 0000000..f88eab4
Binary files /dev/null and
b/modules/plugins/jboss-as-7/src/test/resources/itest/javaee6-test-app.war differ
diff --git a/modules/plugins/jboss-as-7/src/test/resources/log4j.xml
b/modules/plugins/jboss-as-7/src/test/resources/log4j.xml
index 16165cb..30a97b1 100644
--- a/modules/plugins/jboss-as-7/src/test/resources/log4j.xml
+++ b/modules/plugins/jboss-as-7/src/test/resources/log4j.xml
@@ -35,6 +35,18 @@
</layout>
</appender>
+ <category name="org.apache.http">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="org.apache.http.wire">
+ <priority value="ERROR"/>
+ </category>
+
+ <category name="org.apache.http.headers">
+ <priority value="ERROR"/>
+ </category>
+
<category name="org.rhq.modules.plugins">
<priority value="DEBUG"/>
</category>