[rhq] Branch 'release/jon3.1.x' - 2 commits - modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
New commits:
commit 9a5f62016b0a57b48d781fc7c9a51e53069e05f8
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Fri Jun 22 09:51:49 2012 -0700
[BZ 825230] Some measure names are not readable in JON EPP plugin. This is actually a global layout issue in the resource measurements portlet.
(cherry picked from commit 5f8827fef9f40546edae97fc2747bd6f1cbf75df)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
index 9855b1f..c27e626 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
@@ -100,6 +100,7 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
//display container
final VLayout column = new VLayout();
column.setHeight(10);//pack
+ column.setWidth100();
//initialize to defaults
end = System.currentTimeMillis();
@@ -266,6 +267,7 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
destination);
link.setTitleVAlign(VerticalAlignment.TOP);
link.setAlign(Alignment.LEFT);
+ link.setClipValue(false);
link.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
@@ -290,6 +292,7 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
value.setVAlign(VerticalAlignment.TOP);
row.setItems(graphContainer, link, value);
+ row.setWidth100();
//if graph content returned
if ((md.getName().trim().indexOf("Trait.") == -1)
commit ddb3c9f0dc27f9adbefac02dd668e217e2e2222d
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Fri Jun 22 11:31:55 2012 -0700
[BZ 825230] Eliminate some of the space in the layout between the resource measurement sparkline graphs and the resource name link.
(cherry picked from commit aa154aa89f09185ae6a8cf417cbb9e3271b231be)
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
index a625edf..9855b1f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/resource/ResourceMetricsPortlet.java
@@ -239,16 +239,15 @@ public class ResourceMetricsPortlet extends GroupMetricsPortlet {
LocatableDynamicForm row = new LocatableDynamicForm(
recentMeasurementsContent.extendLocatorId(md.getName()));
row.setNumCols(3);
+ row.setColWidths(65,"*","*");
row.setWidth100();
HTMLFlow graph = new HTMLFlow();
- // String contents = "<span id='sparkline_" + index + "' class='dynamicsparkline' width='0'>"
- // + commaDelimitedList + "</span>";
String contents = "<span id='sparkline_" + index
+ "' class='dynamicsparkline' width='0' " + "values='"
+ commaDelimitedList + "'>...</span>";
graph.setContents(contents);
graph.setContentsType(ContentsType.PAGE);
- //diable scrollbars on span
+ //disable scrollbars on span
graph.setScrollbarSize(0);
CanvasItem graphContainer = new CanvasItem();
11 years, 4 months
[rhq] Branch 'mazz/test-rhq-on-as7' - modules/enterprise
by mazz
modules/enterprise/server/appserver/pom.xml | 331 +++++
modules/enterprise/server/appserver/src/main/bin-resources/jbossas/standalone/configuration/rhq.truststore |binary
modules/enterprise/server/appserver/src/main/scripts/rhq-container.assembly.xml | 39
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 578 ++++++++++
4 files changed, 948 insertions(+)
New commits:
commit f53dcc8396881a119d303dd6165affad7fe8bb87
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Jul 31 18:15:27 2012 -0400
the start of the new container build ant script.
still have a ways to go before this produces a functional rhq server on as7
diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml
new file mode 100644
index 0000000..ee378b8
--- /dev/null
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -0,0 +1,331 @@
+<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>
+
+ <parent>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-parent</artifactId>
+ <version>4.5.0-SNAPSHOT</version>
+ <relativePath>../../../../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-server-appserver</artifactId>
+ <packaging>pom</packaging>
+
+ <name>RHQ Enterprise Server Application Server Container</name>
+ <description>The full RHQ appserver container build, including the JBossAS server and all config/deploy files</description>
+
+ <properties>
+ <jboss.version>7.1.1.Final</jboss.version>
+
+ <!-- TODO do we still need this? -->
+ <rhq.webappsReloadable>false</rhq.webappsReloadable>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>safe-invoker</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-container-lib</artifactId>
+ <version>${project.version}</version>
+ </dependency>
+
+ <!-- 3rd Party Deps -->
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-api</artifactId>
+ <!-- NOTE: version defined in root pom dependencyManagement section -->
+ </dependency>
+
+ <dependency>
+ <groupId>javax.faces</groupId>
+ <artifactId>jsf-impl</artifactId>
+ <!-- NOTE: version defined in root pom dependencyManagement section -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-dist</artifactId>
+ <version>7.1.1.Final</version>
+ <type>zip</type>
+ </dependency>
+
+ <dependency>
+ <groupId>jgroups</groupId>
+ <artifactId>jgroups-all</artifactId>
+ <version>2.2.9.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opensymphony.quartz</groupId>
+ <artifactId>quartz</artifactId>
+ <!-- NOTE: version defined in root pom dependencyManagement section -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.opensymphony.quartz</groupId>
+ <artifactId>quartz-oracle</artifactId>
+ <!-- NOTE: version defined in root pom dependencyManagement section -->
+ </dependency>
+
+ <dependency>
+ <groupId>postgresql</groupId>
+ <artifactId>postgresql</artifactId>
+ <!-- NOTE: version defined in root pom dependencyManagement section -->
+ </dependency>
+
+ <dependency>
+ <groupId>org.codehaus.groovy</groupId>
+ <artifactId>groovy-all</artifactId>
+ <version>1.7.3</version>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <finalName>rhq-server-${project.version}</finalName>
+ <outputDirectory>target/${project.build.finalName}</outputDirectory>
+
+ <resources>
+
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+
+ <resource>
+ <directory>src/main/bin-resources</directory>
+ <filtering>false</filtering>
+ </resource>
+
+ </resources>
+
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-resources-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>move-src</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>resources</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>prepare-container</id>
+ <phase>generate-resources</phase>
+ <configuration>
+ <target>
+ <echo>settings.localRepository=${settings.localRepository}</echo>
+ <echo>project.build.outputDirectory=${project.build.outputDirectory}</echo>
+ <ant antfile="src/main/scripts/rhq-container.build.xml"
+ target="prepare-container">
+ <property name="settings.localRepository" value="${settings.localRepository}" />
+ <property name="project.build.outputDirectory" value="${project.build.outputDirectory}" />
+ <property name="project.version" value="${project.version}" />
+ <property name="dev.profile.active" value="${dev.profile.active}" />
+ <property name="developer" value="${developer}" />
+ <property name="rhq.earName" value="${rhq.earName}" />
+
+ <!-- dependency versions -->
+ <property name="rhq.version" value="${project.version}" />
+ <property name="jboss.version" value="${jboss.version}" />
+ <property name="jboss.zip" location="${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip" />
+ <property name="ojdbc6.version" value="${ojdbc6.version}" />
+ <property name="postgresql.version" value="${postgresql.version}" />
+ <property name="jboss-javassist.version" value="${jboss-javassist.version}" />
+ <property name="jsf-api.version" value="${jsf-api.version}" />
+ <property name="jsf-impl.version" value="${jsf-impl.version}" />
+ <property name="hibernate3.version" value="${hibernate3.version}" />
+ <property name="quartz.version" value="${quartz.version}" />
+ <property name="xercesImpl.version" value="${xercesImpl.version}" />
+
+ <!-- dev DB settings (used to init rhq-server.properties if dev profile is active or developer prop is set) -->
+ <property name="rhq.dev.ds.connection-url" value="${rhq.dev.ds.connection-url}" />
+ <property name="rhq.dev.ds.driver-class" value="${rhq.dev.ds.driver-class}" />
+ <property name="rhq.dev.ds.xa-datasource-class" value="${rhq.dev.ds.xa-datasource-class}" />
+ <property name="rhq.dev.ds.user-name" value="${rhq.dev.ds.user-name}" />
+ <property name="rhq.dev.ds.password.encrypted" value="${rhq.dev.ds.password.encrypted}" />
+ <property name="rhq.dev.ds.type-mapping" value="${rhq.dev.ds.type-mapping}" />
+ <property name="rhq.dev.ds.server-name" value="${rhq.dev.ds.server-name}" />
+ <property name="rhq.dev.ds.port" value="${rhq.dev.ds.port}" />
+ <property name="rhq.dev.ds.db-name" value="${rhq.dev.ds.db-name}" />
+ <property name="rhq.dev.ds.hibernate-dialect" value="${rhq.dev.ds.hibernate-dialect}" />
+ <property name="rhq.dev.quartz.driverDelegateClass" value="${rhq.dev.quartz.driverDelegateClass}" />
+ <property name="rhq.dev.quartz.selectWithLockSQL" value="${rhq.dev.quartz.selectWithLockSQL}" />
+ <property name="rhq.dev.quartz.lockHandlerClass" value="${rhq.dev.quartz.lockHandlerClass}" />
+
+ <!-- default server settings used by installer -->
+ <property name="rhq.server.http.port" value="${rhq.server.http.port}" />
+ <property name="rhq.server.https.port" value="${rhq.server.https.port}" />
+ <property name="rhq.sync.endpoint-address" value="${rhq.sync.endpoint-address}" />
+ </ant>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>prepare-release</id>
+ <phase>prepare-package</phase>
+ <configuration>
+ <target>
+ <echo>Preparing the release at ${project.build.outputDirectory}...</echo>
+ <ant antfile="src/main/scripts/rhq-container.build.xml"
+ target="prepare-release">
+
+ <property name="project.build.outputDirectory" value="${project.build.outputDirectory}" />
+
+ <!-- the 'dev.profile.active' prop is set to true by the root POM if the dev profile is active;
+ if 'dev.profile.active' != "true", the container will be made packageable
+ (i.e. running the installer first will be required);
+ if 'dev.profile.active' == "true", the ear, datasource and JMS backend will be predeployed;
+ developers will normally want to do this to avoid having to run the installer
+ [mazz] added the ability to say -Ddeveloper to also predeploy, even if not in dev profile -->
+ <property name="dev.profile.active" value="${dev.profile.active}" />
+ <property name="developer" value="${developer}" />
+ <property name="rhq.earName" value="${rhq.earName}" />
+
+ <!-- dev/test DB type (needed to init rhq-ds.xml) -->
+ <property name="rhq.test.ds.type-mapping" value="${rhq.test.ds.type-mapping}" />
+ <property name="rhq.dev.ds.type-mapping" value="${rhq.dev.ds.type-mapping}" />
+ </ant>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-assembly-plugin</artifactId>
+ <configuration>
+ <archiverConfig>
+ <!-- permissions for archiver configuration are in decimal (not octal) -->
+ <!-- 493 (decimal) = 755 (octal) -->
+ <defaultDirectoryMode>493</defaultDirectoryMode>
+ </archiverConfig>
+ <descriptors>
+ <descriptor>src/main/scripts/rhq-container.assembly.xml</descriptor>
+ </descriptors>
+ <finalName>${project.build.finalName}</finalName>
+ </configuration>
+ <executions>
+ <execution>
+ <id>assemble-server-container-zip</id>
+ <phase>package</phase>
+ <goals>
+ <goal>attached</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <!-- We skip the API checking in this module, because there is
+ no new code to check. This module merely composes classes from other modules
+ which have already been checked. Also, enabling the API checks in this module
+ causes some weird problems for the animal sniffer, because it most probably
+ cannot figure out the full set of dependencies for classes of the web apps
+ contained in the EAR were creating here. -->
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>animal-sniffer-maven-plugin</artifactId>
+ <configuration>
+ <skip>true</skip>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <profile>
+ <id>dev</id>
+
+ <properties>
+ <rhq.rootDir>../../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <!-- TODO do we still need this? -->
+ <rhq.webappsReloadable>true</rhq.webappsReloadable>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>deploy</id>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <property name="deployment.dir" location="${rhq.containerDir}" />
+ <echo>*** Copying updated files
+ from
+ target${file.separator}${project.build.finalName}${file.separator}
+ to
+ ${deployment.dir}${file.separator}...</echo>
+ <copy todir="${deployment.dir}" verbose="${rhq.verbose}">
+ <fileset dir="${basedir}/target/${project.build.finalName}" />
+ </copy>
+ <!-- Make sure shell scripts are readable and executable. -->
+ <chmod perm="ug+x" verbose="true">
+ <fileset dir="${deployment.dir}/bin" includes="*.sh" />
+ <fileset dir="${deployment.dir}/jbossas/bin" includes="*.sh" />
+ </chmod>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <target>
+ <property name="deployment.dir" location="${rhq.containerDir}" />
+ <echo>*** Deleting ${deployment.dir}${file.separator}...</echo>
+ <delete dir="${deployment.dir}" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+ </profile>
+
+ </profiles>
+
+</project>
+
diff --git a/modules/enterprise/server/appserver/src/main/bin-resources/jbossas/standalone/configuration/rhq.truststore b/modules/enterprise/server/appserver/src/main/bin-resources/jbossas/standalone/configuration/rhq.truststore
new file mode 100644
index 0000000..fdaf825
Binary files /dev/null and b/modules/enterprise/server/appserver/src/main/bin-resources/jbossas/standalone/configuration/rhq.truststore differ
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.assembly.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.assembly.xml
new file mode 100644
index 0000000..ef6c459
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.assembly.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0"?>
+
+<assembly>
+ <id>rhq-container</id>
+ <formats>
+ <format>zip</format>
+ </formats>
+ <includeBaseDirectory>true</includeBaseDirectory>
+ <baseDirectory>${project.build.finalName}</baseDirectory>
+ <fileSets>
+ <fileSet>
+ <directory>${project.build.outputDirectory}</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**/*</include>
+ </includes>
+ <excludes>
+ <exclude>**/*.sh</exclude>
+ <exclude>**/*.so</exclude>
+ <exclude>**/*.sl</exclude>
+ <exclude>**/*.dylib</exclude>
+ </excludes>
+ <fileMode>0644</fileMode>
+ <directoryMode>0755</directoryMode>
+ </fileSet>
+ <fileSet>
+ <directory>${project.build.outputDirectory}</directory>
+ <outputDirectory>/</outputDirectory>
+ <includes>
+ <include>**/*.sh</include>
+ <include>**/*.so</include>
+ <include>**/*.sl</include>
+ <include>**/*.dylib</include>
+ </includes>
+ <fileMode>0755</fileMode>
+ <directoryMode>0755</directoryMode>
+ </fileSet>
+ </fileSets>
+</assembly>
\ No newline at end of file
diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
new file mode 100644
index 0000000..e4888b4
--- /dev/null
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
@@ -0,0 +1,578 @@
+<?xml version="1.0"?>
+
+<project name="rhq-appserver-container" basedir=".">
+
+ <property name="default.rhq.server.database.hibernate-dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
+ <property name="default.rhq.server.database.connection-url" value="jdbc:postgresql://127.0.0.1:5432/rhq" />
+ <property name="default.rhq.server.database.user-name" value="rhqadmin" />
+ <property name="default.rhq.server.database.password" value="rhqadmin" />
+ <property name="default.rhq.server.database.password.encrypted" value="1eeb2f255e832171df8592078de921bc" />
+ <property name="default.rhq.server.database.type-mapping" value="PostgreSQL" />
+
+ <!-- these are needed for the PostgreSQL XADataSource setup -->
+ <property name="default.rhq.server.database.server-name" value="127.0.0.1" />
+ <property name="default.rhq.server.database.port" value="5432" />
+ <property name="default.rhq.server.database.db-name" value="rhq" />
+ <property name="default.rhq.server.quartz.driverDelegateClass" value="org.quartz.impl.jdbcjobstore.PostgreSQLDelegate" />
+ <property name="default.rhq.server.quartz.selectWithLockSQL" value="SELECT * FROM {0}LOCKS WHERE LOCK_NAME = ? FOR UPDATE" />
+ <property name="default.rhq.server.quartz.lockHandlerClass" value="org.quartz.impl.jdbcjobstore.StdRowLockSemaphore" />
+
+ <property name="rhq.sync.endpoint-address" value="false"/>
+
+ <property name="default.rhq.server.drift.binary.content" value="false"/>
+
+ <target name="set-predeploy-prop">
+ <condition property="predeploy" value="true">
+ <or>
+ <equals arg1="${dev.profile.active}" arg2="true" />
+ <equals arg1="${developer}" arg2="true" />
+ </or>
+ </condition>
+ </target>
+
+ <target name="set-dev-server-props" if="predeploy">
+ <echo>*** Using dev database settings in rhq-server.properties...</echo>
+ <property name="rhq.server.database.hibernate-dialect" value="${rhq.dev.ds.hibernate-dialect}" />
+ <property name="rhq.server.database.connection-url" value="${rhq.dev.ds.connection-url}" />
+ <property name="rhq.server.database.user-name" value="${rhq.dev.ds.user-name}" />
+ <property name="rhq.server.database.password" value="${rhq.dev.ds.password.encrypted}" />
+ <property name="rhq.server.database.type-mapping" value="${rhq.dev.ds.type-mapping}" />
+ <property name="rhq.server.database.server-name" value="${rhq.dev.ds.server-name}" />
+ <property name="rhq.server.database.port" value="${rhq.dev.ds.port}" />
+ <property name="rhq.server.database.db-name" value="${rhq.dev.ds.db-name}" />
+ <property name="rhq.server.quartz.driverDelegateClass" value="${rhq.dev.quartz.driverDelegateClass}" />
+ <property name="rhq.server.quartz.selectWithLockSQL" value="${rhq.dev.quartz.selectWithLockSQL}" />
+ <property name="rhq.server.quartz.lockHandlerClass" value="${rhq.dev.quartz.lockHandlerClass}" />
+ <property name="rhq.server.drift.store-binary-content" value="${default.rhq.server.drift.binary.content}"/>
+ </target>
+
+ <target name="set-default-server-props" unless="predeploy">
+ <echo>*** Using default database settings in rhq-server.properties...</echo>
+ <property name="rhq.server.database.hibernate-dialect" value="${default.rhq.server.database.hibernate-dialect}" />
+ <property name="rhq.server.database.connection-url" value="${default.rhq.server.database.connection-url}" />
+ <property name="rhq.server.database.user-name" value="${default.rhq.server.database.user-name}" />
+ <property name="rhq.server.database.password" value="${default.rhq.server.database.password.encrypted}" />
+ <property name="rhq.server.database.type-mapping" value="${default.rhq.server.database.type-mapping}" />
+ <property name="rhq.server.database.server-name" value="${default.rhq.server.database.server-name}" />
+ <property name="rhq.server.database.port" value="${default.rhq.server.database.port}" />
+ <property name="rhq.server.database.db-name" value="${default.rhq.server.database.db-name}" />
+ <property name="rhq.server.quartz.driverDelegateClass" value="${default.rhq.server.quartz.driverDelegateClass}" />
+ <property name="rhq.server.quartz.selectWithLockSQL" value="${default.rhq.server.quartz.selectWithLockSQL}" />
+ <property name="rhq.server.quartz.lockHandlerClass" value="${default.rhq.server.quartz.lockHandlerClass}" />
+ <property name="rhq.server.drift.store-binary-content" value="${default.rhq.server.drift.binary.content}"/>
+ </target>
+
+ <target name="initialize" depends="set-predeploy-prop, set-dev-server-props, set-default-server-props">
+ <echo>*** Database type is ${rhq.server.database.type-mapping}</echo>
+ <property name="jboss.home" location="${project.build.outputDirectory}/jbossas" />
+
+ <!-- TODO: if JBossAS has a marker file that we can check to see if server is running, we can use it here -->
+ <!--
+ <property name="marker.file" location="${jboss.home}/server/default/data/hypersonic/localDB.lck" />
+ <fail message="The RHQ container appears to be currently running (${marker.file} exists). Please stop the container before rebuilding it in place.">
+ <condition>
+ <available file="${marker.file}" />
+ </condition>
+ </fail>
+ -->
+
+ <property name="jboss.deploy.dir" location="${jboss.home}/standalone/deployments" />
+
+ <condition property="use-postgres" value="true">
+ <contains string="${rhq.server.database.type-mapping}" substring="postgres" casesensitive="false" />
+ </condition>
+ <condition property="use-oracle" value="true">
+ <contains string="${rhq.server.database.type-mapping}" substring="oracle" casesensitive="false" />
+ </condition>
+
+ <condition property="copy.dev.resources" value="true">
+ <or>
+ <equals arg1="${dev.profile.active}" arg2="true" />
+ <equals arg1="${developer}" arg2="true" />
+ </or>
+ </condition>
+
+ <condition property="predeploy-postgres" value="true">
+ <and>
+ <equals arg1="${predeploy}" arg2="true" />
+ <equals arg1="${use-postgres}" arg2="true" />
+ </and>
+ </condition>
+
+ <condition property="predeploy-oracle" value="true">
+ <and>
+ <equals arg1="${predeploy}" arg2="true" />
+ <equals arg1="${use-oracle}" arg2="true" />
+ </and>
+ </condition>
+
+ <!-- developers might want to deploy agent/server plugins frequently, so we'll scan every 30 seconds -->
+ <!-- in production, plugins change very infrequently, so only scan every 5 minutes -->
+ <condition property="rhq.server.plugin-scan-period-ms" value="30000">
+ <or>
+ <equals arg1="${dev.profile.active}" arg2="true" />
+ <equals arg1="${developer}" arg2="true" />
+ </or>
+ </condition>
+ <condition property="rhq.server.plugin-scan-period-ms" value="300000">
+ <not>
+ <or>
+ <equals arg1="${dev.profile.active}" arg2="true" />
+ <equals arg1="${developer}" arg2="true" />
+ </or>
+ </not>
+ </condition>
+
+ </target>
+
+ <target name="prepare-container"
+ depends="prepare-jbossas-dir,
+ prepare-bin-dir" />
+
+ <target name="prepare-jbossas-dir"
+ depends="initialize"
+ description="prepare JBossAS for hosting the RHQ Server">
+
+ <echo>*** Preparing jbossas dir ***</echo>
+
+ <echo>Unzipping vanilla JBoss dist zipfile found at ${jboss.zip}</echo>
+ <condition property="jboss.uptodate">
+ <and>
+ <uptodate srcfile="${jboss.zip}" targetfile="${jboss.home}" />
+ <available file="${jboss.home}/jboss-modules.jar" type="file" />
+ </and>
+ </condition>
+
+ <antcall target="unzip-jboss" />
+
+ <echo>Checking that we have a valid JBossAS distribution...</echo>
+ <available file="${jboss.home}/jboss-modules.jar" type="file" property="jboss.home.is.valid" />
+ <fail unless="jboss.home.is.valid" message="${jboss.home} does not contain a valid JBossAS installation - aborting!" />
+
+ <!-- TODO: THESE WERE NEEDED IN THE OLD 4.2.3 CONTAINER - WE SHOULD BE ABLE TO DELETE THESE
+ <echo>Installing patched hibernate jar ...</echo>
+ <copy file="${settings.localRepository}/hibernate/hibernate3/${hibernate3.version}/hibernate3-${hibernate3.version}.jar"
+ tofile="${jboss.home}/server/default/lib/hibernate3.jar" verbose="true"/>
+
+ <echo>Installing custom container library...</echo>
+ <copy file="${settings.localRepository}/org/rhq/rhq-container-lib/${rhq.version}/rhq-container-lib-${rhq.version}.jar"
+ tofile="${jboss.home}/server/default/lib/rhq-container-lib-${rhq.version}.jar" verbose="true"/>
+ -->
+
+ <property name="jboss.modules.dir" location="${jboss.home}/modules" />
+ <echo>Adding JDBC modules to ${jboss.modules.dir} ...</echo>
+ <copy file="${settings.localRepository}/com/oracle/ojdbc6/${ojdbc6.version}/ojdbc6-${ojdbc6.version}.jar"
+ toDir="${jboss.modules.dir}/org/rhq/oracle/main" failonerror="false" verbose="true" />
+ <echo file="${jboss.modules.dir}/org/rhq/oracle/main/module.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:jboss:module:1.1" name="org.rhq.oracle">
+ <resources>
+ <resource-root path="ojdbc6-${ojdbc6.version}.jar"/>
+ </resources>
+ <dependencies>
+ <module name="javax.api"/>
+ <module name="javax.transaction.api"/>
+ </dependencies>
+</module>
+]]></echo>
+ <copy file="${settings.localRepository}/postgresql/postgresql/${postgresql.version}/postgresql-${postgresql.version}.jar"
+ toDir="${jboss.modules.dir}/org/rhq/postgres/main" verbose="true" />
+ <echo file="${jboss.modules.dir}/org/rhq/postgres/main/module.xml"><![CDATA[<?xml version="1.0" encoding="UTF-8"?>
+<module xmlns="urn:jboss:module:1.1" name="org.rhq.postgres">
+ <resources>
+ <resource-root path="postgresql-${postgresql.version}.jar"/>
+ </resources>
+ <dependencies>
+ <module name="javax.api"/>
+ <module name="javax.transaction.api"/>
+ </dependencies>
+</module>
+]]></echo>
+
+ <echo>Generate SSL key for RHQ server - 128-bit key that expires in 20 years</echo>
+ <property name="jboss.conf.dir" location="${jboss.home}/standalone/configuration" />
+ <available file="${jboss.conf.dir}/rhq.keystore" type="file" property="rhq.keystore.exists" />
+ <antcall target="generate-rhq-ssl-key" />
+
+ <echo>Delete the various working directories if they happen to exist</echo>
+ <delete dir="${jboss.home}/standalone/data" />
+ <delete dir="${jboss.home}/standalone/log" />
+ <delete dir="${jboss.home}/standalone/tmp" />
+ <delete dir="${jboss.home}/standalone/work" /> <!-- TODO: does AS7 still have this? -->
+
+ <!-- TODO: we need to put Quartz in the ear and deploy a scheduler sar -->
+ <!--
+ <echo>Upgrading Quartz to v${quartz.version} ...</echo>
+ <copy file="${settings.localRepository}/org/opensymphony/quartz/quartz/${quartz.version}/quartz-${quartz.version}.jar"
+ tofile="${jboss.home}/server/default/lib/quartz.jar" overwrite="true" verbose="true" />
+ <copy file="${settings.localRepository}/org/opensymphony/quartz/quartz-oracle/${quartz.version}/quartz-oracle-${quartz.version}.jar"
+ tofile="${jboss.home}/server/default/lib/quartz-oracle.jar" overwrite="true" verbose="true" />
+ -->
+
+ <echo>Deploying ${rhq.earName} ...</echo>
+ <mkdir dir="${jboss.deploy.dir}/${rhq.earName}" />
+ <unjar src="${settings.localRepository}/org/rhq/rhq-enterprise-server-ear/${rhq.version}/rhq-enterprise-server-ear-${rhq.version}.ear"
+ dest="${jboss.deploy.dir}/${rhq.earName}" />
+
+ <echo>Deploying installer webapp ...</echo>
+ <mkdir dir="${jboss.deploy.dir}/rhq-installer.war" />
+ <unwar src="${settings.localRepository}/org/rhq/rhq-installer/${rhq.version}/rhq-installer-${rhq.version}.war"
+ dest="${jboss.deploy.dir}/rhq-installer.war" />
+
+ <!-- TODO: deploy embedded agent sar -->
+ <!--
+ <echo>Deploying embedded agent sar ...</echo>
+ <mkdir dir="${jboss.deploy.dir}/rhq-agent.sar" />
+ <unjar src="${settings.localRepository}/org/rhq/rhq-enterprise-server-agent-sar/${rhq.version}/rhq-enterprise-server-agent-sar-${rhq.version}.sar"
+ dest="${jboss.deploy.dir}/rhq-agent.sar" />
+ -->
+
+ <echo>Delete docs, README, et. al. files</echo>
+ <delete dir="${jboss.home}/docs/examples" />
+ <delete>
+ <fileset dir="${jboss.home}" includes="*.txt" />
+ </delete>
+
+ <echo>Delete domain files - we only start in standalone mode</echo>
+ <delete dir="${jboss.home}/domain" />
+
+ <!-- TODO: setup our own welcome-content that points to our app -->
+ <!--
+ <echo>Setup welcome content</echo>
+ <delete dir="${jboss.home}/welcome-content" />
+ -->
+
+ <echo>Make sure the top level downloads directory exists</echo>
+ <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads" />
+
+ <echo>Deploying static downloadable content</echo>
+ <copy todir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads"
+ verbose="true"
+ failonerror="false">
+ <fileset dir="${basedir}/src/main/downloadable-resources" />
+ </copy>
+
+ <echo>Make sure our downloads directories exist</echo>
+ <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-agent" />
+ <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-client" />
+ <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-plugins" />
+ <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/connectors" />
+ <mkdir dir="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/bundle-deployer" />
+
+ <echo>Deploying the latest agent update binary and renaming it rhq-enterprise-agent-${rhq.version}.jar</echo>
+ <copy file="${settings.localRepository}/org/rhq/rhq-enterprise-agentupdate/${rhq.version}/rhq-enterprise-agentupdate-${rhq.version}.jar"
+ tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-agent/rhq-enterprise-agent-${rhq.version}.jar"
+ verbose="true"
+ failonerror="true"/>
+
+ <echo>Deploying the latest remote client binary</echo>
+ <copy file="${settings.localRepository}/org/rhq/rhq-remoting-cli/${rhq.version}/rhq-remoting-cli-${rhq.version}.zip"
+ tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/rhq-client/rhq-remoting-cli-${rhq.version}.zip"
+ verbose="true"
+ failonerror="false"/>
+
+ <echo>Deploying the latest command-line bundle deployer to the downloads location</echo>
+ <copy file="${settings.localRepository}/org/rhq/rhq-ant-bundle-common/${rhq.version}/rhq-ant-bundle-common-${rhq.version}.zip"
+ tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/bundle-deployer/rhq-bundle-deployer-${rhq.version}.zip"
+ verbose="true"
+ failonerror="false"/>
+
+ <antcall target="package-connectors" />
+ <echo>Deploying RT filter jar ...</echo>
+ <unzip src="${settings.localRepository}/org/rhq/helpers/rhq-rtfilter/${project.version}/rhq-rtfilter-${project.version}.zip"
+ dest="${jboss.home}/modules" />
+
+ <unzip src="${settings.localRepository}/org/rhq/helpers/rhq-rtfilter-subsystem/${project.version}/rhq-rtfilter-subsystem-${project.version}.zip"
+ dest="${jboss.home}/modules" />
+ <!-- TODO: it is up to either the installer or our EAR's WAR to use this so JON itself can have its RT data collected -->
+
+ </target>
+
+ <target name="package-connectors">
+ <echo>Deploying the response-time (RT) servlet filter connectors ...</echo>
+ <delete file="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/connectors/connector-rtfilter.zip" />
+ <zip destfile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/connectors/connector-rtfilter.zip">
+ <zipfileset dir="${settings.localRepository}/org/rhq/helpers/rhq-rtfilter/${project.version}">
+ <include name="rhq-rtfilter-${project.version}.jar" />
+ </zipfileset>
+ <zipfileset dir="${settings.localRepository}/commons-logging/commons-logging/1.1.1">
+ <include name="commons-logging-1.1.1.jar" />
+ </zipfileset>
+ </zip>
+
+ <!-- rtfilter AS7 modules -->
+ <copy file="${settings.localRepository}/org/rhq/helpers/rhq-rtfilter/${project.version}/rhq-rtfilter-${project.version}.zip"
+ tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/connectors/rhq-rtfilter-module.zip" />
+
+ <copy file="${settings.localRepository}/org/rhq/helpers/rhq-rtfilter-subsystem/${project.version}/rhq-rtfilter-subsystem-${project.version}.zip"
+ tofile="${jboss.deploy.dir}/${rhq.earName}/rhq-downloads/connectors/rhq-rtfilter-subsystem-module.zip" />
+ </target>
+
+ <target name="prepare-bin-dir">
+ <echo>*** Preparing bin dir ***</echo>
+ <echo>Connection URL is ${rhq.server.database.connection-url}</echo>
+
+ <property name="rhq.bin.dir" location="${project.build.outputDirectory}/bin" />
+ <mkdir dir="${rhq.bin.dir}" />
+ <echo file="${rhq.bin.dir}/rhq-server.properties">### RHQ Server Configuration Properties
+
+# Database
+rhq.server.database.connection-url=${rhq.server.database.connection-url}
+rhq.server.database.user-name=${rhq.server.database.user-name}
+rhq.server.database.password=${rhq.server.database.password}
+rhq.server.database.type-mapping=${rhq.server.database.type-mapping}
+rhq.server.database.server-name=${rhq.server.database.server-name}
+rhq.server.database.port=${rhq.server.database.port}
+rhq.server.database.db-name=${rhq.server.database.db-name}
+hibernate.dialect=${rhq.server.database.hibernate-dialect}
+
+# Quartz
+rhq.server.quartz.driverDelegateClass=${rhq.server.quartz.driverDelegateClass}
+rhq.server.quartz.selectWithLockSQL=${rhq.server.quartz.selectWithLockSQL}
+rhq.server.quartz.lockHandlerClass=${rhq.server.quartz.lockHandlerClass}
+
+# Container configuration
+# ********************************** NOTE ************************************
+# If the jboss.bind.address property is set to anything besides 0.0.0.0,
+# uncomment the java.rmi.server.hostname property below and set it to the same
+# value - setting it to ${jboss.bind.address} will *not* work.
+jboss.bind.address=0.0.0.0
+#java.rmi.server.hostname=0.0.0.0
+
+# High Availability (HA)
+rhq.server.high-availability.name=
+rhq.server.maintenance-mode-at-startup=false
+
+# General Properties
+rhq.server.startup.web.http.port=${rhq.server.http.port}
+rhq.server.startup.web.https.port=${rhq.server.https.port}
+rhq.server.startup.webservice.port=9093
+rhq.server.startup.namingservice.port=2099
+rhq.server.startup.namingservice.rmiport=2098
+rhq.server.startup.jrmpinvoker.rmiport=7444
+rhq.server.startup.pooledinvoker.rmiport=7445
+rhq.server.startup.ajp.port=9009
+rhq.server.startup.unifiedinvoker.port=5446
+rhq.server.startup.aspectdeployer.bind-port=4873
+
+# The number of concurrent threads used to deploy plugins.
+# Currently, it is not recommended to increase this value.
+rhq.server.plugin-deployer-threads=1
+
+# RHQ Server's remote endpoint for agents to talk to
+# bind-address and bind-port are derived from the HA server definition,
+# if you set the address/port here, they will override the HA server definition found in the database
+rhq.communications.connector.transport=servlet
+rhq.communications.connector.bind-address=
+rhq.communications.connector.bind-port=
+rhq.communications.connector.transport-params=/jboss-remoting-servlet-invoker/ServerInvokerServlet
+
+# Multicast detector configuration for auto-discovery
+rhq.communications.multicast-detector.enabled=false
+rhq.communications.multicast-detector.bind-address=${jboss.bind.address}
+rhq.communications.multicast-detector.multicast-address=224.16.16.16
+rhq.communications.multicast-detector.port=16162
+
+# Server-side SSL Security Configuration for HTTPS thru Tomcat
+# These are used for browser https: access and for incoming messages from agents over sslservlet transport
+# [you cannot use ${x} variables - see https://jira.jboss.org/jira/browse/JBWEB-74]
+rhq.server.tomcat.security.client-auth-mode=want
+rhq.server.tomcat.security.secure-socket-protocol=TLS
+rhq.server.tomcat.security.algorithm=SunX509
+rhq.server.tomcat.security.keystore.alias=RHQ
+rhq.server.tomcat.security.keystore.file=conf/rhq.keystore
+rhq.server.tomcat.security.keystore.password=RHQManagement
+rhq.server.tomcat.security.keystore.type=JKS
+rhq.server.tomcat.security.truststore.file=conf/rhq.truststore
+rhq.server.tomcat.security.truststore.password=RHQManagement
+rhq.server.tomcat.security.truststore.type=JKS
+
+# Server-side SSL Security Configuration (for incoming messages from agents)
+# These are used when secure transports other than sslservlet are used
+rhq.communications.connector.security.secure-socket-protocol=TLS
+rhq.communications.connector.security.keystore.file=${jboss.server.home.dir}/conf/rhq.keystore
+rhq.communications.connector.security.keystore.algorithm=SunX509
+rhq.communications.connector.security.keystore.type=JKS
+rhq.communications.connector.security.keystore.password=RHQManagement
+rhq.communications.connector.security.keystore.key-password=RHQManagement
+rhq.communications.connector.security.keystore.alias=RHQ
+rhq.communications.connector.security.truststore.file=${jboss.server.home.dir}/conf/rhq.truststore
+rhq.communications.connector.security.truststore.algorithm=SunX509
+rhq.communications.connector.security.truststore.type=JKS
+rhq.communications.connector.security.truststore.password=RHQManagement
+rhq.communications.connector.security.client-auth-mode=none
+
+# Client-side SSL Security Configuration (for outgoing messages to agents)
+rhq.server.client.security.secure-socket-protocol=TLS
+rhq.server.client.security.keystore.file=${jboss.server.home.dir}/conf/rhq.keystore
+rhq.server.client.security.keystore.algorithm=SunX509
+rhq.server.client.security.keystore.type=JKS
+rhq.server.client.security.keystore.password=RHQManagement
+rhq.server.client.security.keystore.key-password=RHQManagement
+rhq.server.client.security.keystore.alias=RHQ
+rhq.server.client.security.truststore.file=${jboss.server.home.dir}/conf/rhq.truststore
+rhq.server.client.security.truststore.algorithm=SunX509
+rhq.server.client.security.truststore.type=JKS
+rhq.server.client.security.truststore.password=RHQManagement
+rhq.server.client.security.server-auth-mode-enabled=false
+
+# Embedded RHQ Agent
+rhq.server.embedded-agent.enabled=false
+rhq.server.embedded-agent.name=
+rhq.server.embedded-agent.reset-configuration=true
+rhq.server.embedded-agent.disable-native-system=false
+
+# Email
+rhq.server.email.smtp-host=localhost
+rhq.server.email.smtp-port=25
+rhq.server.email.from-address=rhqadmin@localhost
+
+# Operations/controls timeout
+# Defines the default timeout for all operations (specified in seconds)
+rhq.server.operation-timeout=600
+
+# Concurrency limits for incoming UI and agent messages
+rhq.server.startup.web.max-connections=200
+rhq.server.agent-downloads-limit=45
+rhq.server.client-downloads-limit=5
+rhq.communications.global-concurrency-limit=30
+rhq.server.concurrency-limit.inventory-report=5
+rhq.server.concurrency-limit.availability-report=25
+rhq.server.concurrency-limit.inventory-sync=10
+rhq.server.concurrency-limit.content-report=5
+rhq.server.concurrency-limit.content-download=5
+rhq.server.concurrency-limit.measurement-report=10
+rhq.server.concurrency-limit.measurement-schedule-request=10
+
+# Content Local Filesystem Repository
+rhq.server.content.filesystem=${jboss.server.data.dir}/packagebits
+
+# The frequency (in millis) the server checks for updated plugins
+rhq.server.plugin-scan-period-ms=${rhq.server.plugin-scan-period-ms}
+
+# When this is enabled, the server at start up will compare its endpoint
+# address to the host name/address found on the host machine. If they differ,
+# the server endpoint address will be updated to the value found on the host
+# machine. This is targeted for use in cloud deployments where IP addresses
+# change frequently, but it can be of use in other deployment settings where
+# you have to deal with IP address changes.
+rhq.sync.endpoint-address=false
+
+# When this is enabled, the server will request that agents send content for
+# for binary files that are being monitored for drift. The content for those
+# files will then be persisted on the server. By default, the server does not
+# persist content for well known binary file types like .ear, .war, .zip, .so,
+# etc. The server does however persist content for text files or any other
+# files that are not known binary types.
+# rhq.server.drift.store-binary-content=${rhq.server.drift.store-binary-content}
+
+# Auto-Install Pre-Configuration Settings
+# If you wish to circumvent the installer webapp and auto-install the server
+# immediately upon first startup, make sure all of the settings above are
+# correctly set for your server's deployment environment. Then make sure the
+# following rhq.autoinstall properties are defined appropriately:
+# rhq.autoinstall.enabled: must be true to trigger the automatic install
+# rhq.autoinstall.database: allowed values: auto, overwrite, skip
+# "auto" will create a new schema if one does not
+# yet exist or, if a schema does exist, will simply
+# upgrade it as needed (which keeps existing data).
+# "overwrite" if you want to create an empty schema,
+# even if one already exists (loses existing data).
+# "skip" if you don't want to do any database
+# upgrade or creation. WARNING! You must ensure your
+# database schema already exists and is up to date.
+# rhq.autoinstall.public-endpoint-address: public IP/hostname that all agents
+# will use to talk to this server.
+# If not set, a value to use is
+# determined at auto-install time.
+rhq.autoinstall.enabled=false
+rhq.autoinstall.database=auto
+rhq.autoinstall.public-endpoint-address=
+
+</echo>
+
+ </target>
+
+ <target name="unzip-jboss" unless="jboss.uptodate">
+ <echo>Unzipping JBossAS ${jboss.version} found at ${jboss.zip}</echo>
+ <unzip src="${jboss.zip}" dest="${basedir}/target" />
+ <delete dir="${jboss.home}" />
+ <move file="${basedir}/target/jboss-as-${jboss.version}" tofile="${jboss.home}" />
+ </target>
+
+ <target name="generate-rhq-ssl-key" unless="rhq.keystore.exists">
+ <echo>Generating self-signed certificate in ${jboss.conf.dir} ...</echo>
+ <genkey alias="RHQ"
+ keystore="${jboss.conf.dir}/rhq.keystore"
+ keyalg="rsa"
+ storepass="RHQManagement"
+ validity="7300"
+ dname="CN=RHQ, OU=RHQ, O=rhq-project.org, C=US" />
+ <!-- the rhq.truststore is pre-built and checked into git. It is empty with the same store pass as above -->
+ </target>
+
+ <target name="copy-dev-resources" if="copy.dev.resources">
+ <echo>Copying dev-only resources ...</echo>
+ <copy todir="${project.build.outputDirectory}" verbose="true">
+ <fileset dir="src/main/dev-resources" />
+ </copy>
+ <echo>Putting a developer setting in rhq-server.properties to turn on/off strict agent update version checking</echo>
+ <echo file="${project.build.outputDirectory}/bin/rhq-server.properties" append="true">rhq.server.agent-update.nonstrict-version-check=true</echo>
+ </target>
+
+ <!-- The prepare-release target must be run AFTER the resources:resources goal has executed. -->
+ <!-- (i.e. after rhq-server.sh, etc. have been copied over by the resources plugin) -->
+
+ <target name="prepare-release"
+ description="If this is a release build, make sure it is properly prepared."
+ depends="initialize,
+ fix-perms,
+ prepare-postinstaller-war,
+ developer-release-message,
+ copy-dev-resources,
+ deploy-postgres-ds,
+ deploy-oracle-ds,
+ undeploy-ear">
+
+ <echo>Adding license files...</echo>
+ <copy todir="${project.build.outputDirectory}">
+ <fileset dir="${basedir}/../../../.." includes="LICENSE*" />
+ </copy>
+ </target>
+
+ <target name="fix-perms">
+ <!-- Make sure shell scripts are readable and executable. -->
+ <chmod dir="${project.build.outputDirectory}/bin" includes="*.sh" perm="ug+x" verbose="true" />
+ <chmod dir="${jboss.home}/bin" includes="*.sh" perm="ug+x" verbose="true" />
+ </target>
+
+ <target name="prepare-postinstaller-war">
+ <!-- nothing to do here - leaving in case we need to perform things in the future -->
+ </target>
+
+ <target name="developer-release-message" if="predeploy">
+ <echo>!!THIS IS A DEVELOPER CONTAINER BUILD - PRE-DEPLOYING RHQ SERVER!!</echo>
+ </target>
+
+ <!-- TODO: when we ship with an embedded agent -->
+ <!--
+ <target name="undeploy-embedded-agent" unless="predeploy">
+ <echo>Preparing for release - undeploying Embedded Agent...</echo>
+ <move file="${jboss.deploy.dir}/rhq-agent.sar" tofile="${jboss.deploy.dir}/rhq-agent.sar.skipdeploy" />
+ </target>
+ -->
+
+ <target name="undeploy-ear" unless="predeploy">
+ <echo>Preparing for release - telling AS to skip ear deployment</echo>
+ <touch file="${jboss.deploy.dir}/${rhq.earName}.skipdeploy" />
+ </target>
+
+ <target name="deploy-postgres-ds" if="predeploy-postgres">
+ <echo>Postgres will be your datasource backend!</echo>
+ </target>
+
+ <target name="deploy-oracle-ds" if="predeploy-oracle">
+ <echo>Oracle will be your datasource backend!</echo>
+ </target>
+
+</project>
+
11 years, 4 months
[rhq] Changes to 'stefan/as7https'
by snegrea
New branch 'stefan/as7https' available with the following commits:
commit 182a9c0aed0f2359fcf2eb2e6467ed36721ab069
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jul 31 16:44:28 2012 -0500
[BZ 840403] Enable secure connection detection and use for AS7 communication.
11 years, 4 months
[rhq] Branch 'feature/hadoop-plugin' - modules/plugins
by Jiri Kremser
modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml | 24 +++++++---
1 file changed, 18 insertions(+), 6 deletions(-)
New commits:
commit e444f96a6f8fa3d9c60dd6837d45dc4f46254664
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Jul 31 19:55:36 2012 +0200
Added metric definitions for TaskTracker node; typos
diff --git a/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml
index af5b865..91f829a 100644
--- a/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml
@@ -7,8 +7,9 @@
<!-- NameNode (http://wiki.apache.org/hadoop/NameNode) -->
<server name="NameNode" discovery="HadoopServiceDiscovery" class="HadoopServiceComponent">
<plugin-configuration>
- <c:simple-property name="hadoop.home.dir" displayName="Home Directory" />
- <c:simple-property name="_mainClass" displayName="Main Class" readOnly="true" default="org.apache.hadoop.hdfs.server.namenode.NameNode" />
+ <c:simple-property name="hadoop.home.dir" displayName="Home Directory"/>
+ <c:simple-property name="_mainClass" displayName="Main Class" readOnly="true"
+ default="org.apache.hadoop.hdfs.server.namenode.NameNode"/>
</plugin-configuration>
<process-scan name="NameNode" query="process|basename|match=^java.*,arg|-Dproc_namenode|match=.*"/>
@@ -40,8 +41,6 @@
<metric property="Hadoop:service=NameNode,name=FSNamesystemState:FilesTotal" displayName="FilesTotal" units="none"/>
<metric property="Hadoop:service=NameNode,name=FSNamesystemState:PendingReplicationBlocks" displayName="Pending Replication Blocks"
units="none"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeActivity:FilesCreated" displayName="Files Created"
- units="none" measurementType="trendsup"/>
<resource-configuration>
<c:simple-property name="conf/core-site.xml:fs.default.name" displayName="Namenode URI"/>
@@ -88,7 +87,7 @@
default="org.apache.hadoop.mapred.JobTracker"/>
</plugin-configuration>
- <process-scan name="JobTracker" query="process|basename|match=^java.*,arg|-Dproc_jobtracker|match=*"/>
+ <process-scan name="JobTracker" query="process|basename|match=^java.*,arg|-Dproc_jobtracker|match=.*"/>
<metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:jobs_completed" displayName="Jobs Completed"
displayType="summary"/>
@@ -130,6 +129,19 @@
default="org.apache.hadoop.mapred.TaskTracker"/>
</plugin-configuration>
- <process-scan name="TaskTracker" query="process|basename|match=^java.*,arg|-Dproc_tasktracker|match=*"/>
+ <process-scan name="TaskTracker" query="process|basename|match=^java.*,arg|-Dproc_tasktracker|match=.*"/>
+
+ <metric property="Hadoop:service=TaskTracker,name=TaskTrackerMetrics:mapTaskSlots" displayName="Map Task Slots"/>
+ <metric property="Hadoop:service=TaskTracker,name=TaskTrackerMetrics:reduceTaskSlots" displayName="Reduce Task Slots"/>
+ <metric property="Hadoop:service=TaskTracker,name=TaskTrackerMetrics:maps_running" displayName="Running Map Tasks"/>
+ <metric property="Hadoop:service=TaskTracker,name=TaskTrackerMetrics:reduces_running" displayName="Running Reduce Tasks"/>
+ <metric property="Hadoop:service=TaskTracker,name=TaskTrackerMetrics:tasks_completed" displayName="Tasks Completed"
+ displayType="summary"/>
+ <metric property="Hadoop:service=TaskTracker,name=RpcDetailedActivityForPort*:done_avg_time" displayName="Task Done Avg. Time"
+ displayType="summary"/>
+
+ <metric property="Hadoop:service=TaskTracker,name=TaskTrackerInfo:JobTrackerUrl" displayName="Tasks Completed"
+ dataType="trait"/>
+
</server>
</plugin>
\ No newline at end of file
11 years, 4 months
[rhq] Branch 'release/jon3.1.x' - modules/core
by snegrea
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java | 14 +++++-----
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java | 10 +++++--
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/getnativeprocess/NativeProcessRetrievalTest.java | 7 ++---
3 files changed, 18 insertions(+), 13 deletions(-)
New commits:
commit 93392282ae4c708429d81ab031fd4a72f9c27736
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jul 31 12:36:23 2012 -0500
ensure tests run in a predictable order
(cherry picked from commit 4990d3896d4197e56274541d49902346abe97e22)
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
index 9322b2d..005e900 100644
--- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
+++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
@@ -148,7 +148,7 @@ public class AvailTest extends Arquillian {
}
}
- @Test(groups = "pc.itest.avail")
+ @Test(groups = "pc.itest.avail", priority = 20)
public void testDiscovery() throws Exception {
Assert.assertNotNull(pluginContainer);
Assert.assertTrue(pluginContainer.isStarted());
@@ -170,7 +170,7 @@ public class AvailTest extends Arquillian {
Assert.assertEquals(grandchildComponents2.size(), 8, "missing grandchild2");
}
- @Test(groups = "pc.itest.avail", dependsOnMethods = "testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
public void testAvailReport() throws Exception {
AvailabilityExecutor executor = new ForceAvailabilityExecutor(this.pluginContainer.getInventoryManager());
dumpContainers("testAvailReport() Start");
@@ -213,7 +213,7 @@ public class AvailTest extends Arquillian {
assertScan(scan, true, false, 29, 7, 23, 28, 0, 6);
}
- @Test(groups = "pc.itest.avail", dependsOnMethods = "testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
public void testScheduling() throws Exception {
AvailabilityExecutor executor = new ForceAvailabilityExecutor(this.pluginContainer.getInventoryManager());
AvailabilityReport report = executor.call();
@@ -266,7 +266,7 @@ public class AvailTest extends Arquillian {
Assert.assertTrue(numBuckets >= 3, "Random distribution seems wrong, buckets hit= " + numBuckets);
}
- @Test(groups = "pc.itest.avail", dependsOnMethods = "testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
// If a parent changes to UP, its children must all be checked as they could legitimately be something
// other than UP.
public void testForceChildrenOfParentUp() throws Exception {
@@ -330,7 +330,7 @@ public class AvailTest extends Arquillian {
assertScan(scan, false, false, 29, 14, 15, 12, 2, 0);
}
- @Test(groups = "pc.itest.avail", dependsOnMethods = "testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
// If a parent changes to DOWN, its children should all defer to being DOWN as well.
public void testDeferToParentDown() throws Exception {
// don't use a ForceAvailabilityExecutor for this test, we want to manipulate what gets checked
@@ -401,7 +401,7 @@ public class AvailTest extends Arquillian {
assertScan(scan, false, false, 29, 14, 3, 0, 2, 12);
}
- @Test(groups = "pc.itest.avail", dependsOnMethods = "testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
public void testCheckOnlyEligible() throws Exception {
// Force all the avails to UP to start so we can avoid the scenario in testForceChildrenOfParentUp()
AvailabilityExecutor executor = new ForceAvailabilityExecutor(this.pluginContainer.getInventoryManager());
@@ -466,7 +466,7 @@ public class AvailTest extends Arquillian {
assertScan(scan, false, false, 29, 0, 1, 0, 0, 0);
}
- @Test(groups = "pc.itest.avail", dependsOnMethods = "testDiscovery")
+ @Test(groups = "pc.itest.avail", priority = 21)
public void testDeferToParent() throws Exception {
AvailabilityExecutor executor = new ForceAvailabilityExecutor(this.pluginContainer.getInventoryManager());
AvailabilityReport report = executor.call();
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
index b7227ff..84b6ca6 100644
--- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
+++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
@@ -55,6 +55,7 @@ import static org.mockito.Mockito.when;
*
* @author Ian Springer
*/
+@RunDiscovery
public class InventoryManagerTest extends Arquillian {
@Deployment(name = "test")
@@ -102,8 +103,7 @@ public class InventoryManagerTest extends Arquillian {
*
* @throws Exception if an error occurs
*/
- @Test(groups = "pc.itest.inventorymanager")
- @RunDiscovery
+ @Test(groups = "pc.itest.inventorymanager", priority = 1)
public void testSyncUnknownResources() throws Exception {
validatePluginContainerInventory();
@@ -133,7 +133,7 @@ public class InventoryManagerTest extends Arquillian {
*
* @throws Exception if an error occurs
*/
- @Test(groups = "pc.itest.inventorymanager", dependsOnMethods = "testSyncUnknownResources")
+ @Test(groups = "pc.itest.inventorymanager", priority = 1)
public void testUninventoryResources() throws Exception {
validatePluginContainerInventory();
@@ -186,10 +186,14 @@ public class InventoryManagerTest extends Arquillian {
Assert.assertNotNull(platform);
Assert.assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
+ Assert.assertEquals(platform.getChildResources().size(), 1,
+ "platform child Resources: " + platform.getChildResources());
Resource server = platform.getChildResources().iterator().next();
Assert.assertNotNull(server);
Assert.assertEquals(server.getInventoryStatus(), InventoryStatus.COMMITTED);
+ Assert.assertEquals(server.getChildResources().size(), 1,
+ "server child Resources: " + server.getChildResources());
Resource service = server.getChildResources().iterator().next();
Assert.assertNotNull(service);
Assert.assertEquals(service.getInventoryStatus(), InventoryStatus.COMMITTED);
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/getnativeprocess/NativeProcessRetrievalTest.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/getnativeprocess/NativeProcessRetrievalTest.java
index 7df75d0..4170115 100644
--- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/getnativeprocess/NativeProcessRetrievalTest.java
+++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/getnativeprocess/NativeProcessRetrievalTest.java
@@ -84,7 +84,7 @@ public class NativeProcessRetrievalTest extends Arquillian {
}
}
- @Test(groups = "pc.itest.native")
+ @Test(groups = "pc.itest.native", priority = 30)
public void testProcessInfoAccurateAfterProcessRestart() throws Exception {
Assert.assertEquals(components.size(), 1, "There should be exactly 1 resource discovered");
@@ -107,7 +107,7 @@ public class NativeProcessRetrievalTest extends Arquillian {
Assert.assertNotEquals(beforePid, afterPid, "The process info should have refreshed");
}
- @Test(groups = "pc.itest.native")
+ @Test(groups = "pc.itest.native", priority = 30)
public void testProcessInfoAccurateWhenProcessStopped() throws Exception {
Assert.assertEquals(components.size(), 1, "There should be exactly 1 resource discovered");
@@ -131,7 +131,7 @@ public class NativeProcessRetrievalTest extends Arquillian {
startTestProcess();
}
- @Test(groups = "pc.itest.native")
+ @Test(groups = "pc.itest.native", priority = 30)
public void testProcessInfoAccurateAfterProcessStarted() throws Exception {
Assert.assertEquals(components.size(), 1, "There should be exactly 1 resource discovered");
@@ -161,4 +161,5 @@ public class NativeProcessRetrievalTest extends Arquillian {
Assert.assertEquals(afterDiscoveryCallCount, beforeDiscoveryCallCount + 1, "Exactly 1 discovery call should have been made to refresh the process info after the process started again.");
Assert.assertNotEquals(afterPid, 0, "The process info should have refreshed");
}
+
}
11 years, 4 months
[rhq] Branch 'feature/hadoop-plugin' - 2 commits - modules/plugins
by Jiri Kremser
modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceComponent.java | 137 +++++-----
modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml | 107 +++++--
2 files changed, 150 insertions(+), 94 deletions(-)
New commits:
commit 8c5819f9c4cade6c78998159fafda5f892ed8b5a
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Jul 31 18:52:38 2012 +0200
Metric definitions for server of type JobTracker
diff --git a/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml
index cd22c2d..af5b865 100644
--- a/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml
@@ -11,68 +11,72 @@
<c:simple-property name="_mainClass" displayName="Main Class" readOnly="true" default="org.apache.hadoop.hdfs.server.namenode.NameNode" />
</plugin-configuration>
- <process-scan name="NameNode"
- query="process|basename|match=^java.*,arg|-Dproc_namenode|match=.*"/>
+ <process-scan name="NameNode" query="process|basename|match=^java.*,arg|-Dproc_namenode|match=.*"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|NameDirStatuses" displayName="NameNode Storage"
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:NameDirStatuses" displayName="NameNode Storage"
dataType="trait" displayType="summary"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|Version" displayName="Version" dataType="trait"
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:Version" displayName="Version" dataType="trait"
displayType="summary"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|DeadNodes" displayName="Dead Nodes" dataType="trait"
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:DeadNodes" displayName="Dead Nodes" dataType="trait"
displayType="summary"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|DecomNodes" displayName="Decommissioning Nodes"
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:DecomNodes" displayName="Decommissioning Nodes"
dataType="trait" displayType="summary"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|LiveNodes" displayName="Live Nodes" dataType="trait"
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:LiveNodes" displayName="Live Nodes" dataType="trait"
displayType="summary"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|Total" displayName="Capacity Total" units="bytes"
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:Total" displayName="Capacity Total" units="bytes"
description="DFS Configured capacitiy"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|Used" displayName="DFS Used" units="bytes"
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:Used" displayName="DFS Used" units="bytes"
description="DFS used" displayType="summary"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|PercentUsed" displayName="DFS Used %" units="percentage"
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:PercentUsed" displayName="DFS Used %"
description="DFS Used %" displayType="summary"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|NonDfsUsedSpace" displayName="Non DFS Used"
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:NonDfsUsedSpace" displayName="Non DFS Used"
units="bytes" description="Non DFS used"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|Free" displayName="DFS Capacity Remaining" units="bytes"
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:Free" displayName="DFS Capacity Remaining" units="bytes"
description="DFS remaining"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|PercentRemaining" displayName="DFS Capacity Remaining %"
- units="percentage" description="DFS remaining"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeInfo|TotalBlocks" displayName="Blocks Total" units="none"/>
- <metric property="Hadoop:service=NameNode,name=FSNamesystemState|FilesTotal" displayName="FilesTotal" units="none"/>
- <metric property="Hadoop:service=NameNode,name=FSNamesystemState|PendingReplicationBlocks" displayName="Pending Replication Blocks"
+ <!-- jmx returns number from interval (0,100) not from (0,1) units="percentage" -->
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:PercentRemaining" displayName="DFS Capacity Remaining %"
+ description="DFS remaining"/>
+ <metric property="Hadoop:service=NameNode,name=NameNodeInfo:TotalBlocks" displayName="Blocks Total" units="none"/>
+ <metric property="Hadoop:service=NameNode,name=FSNamesystemState:FilesTotal" displayName="FilesTotal" units="none"/>
+ <metric property="Hadoop:service=NameNode,name=FSNamesystemState:PendingReplicationBlocks" displayName="Pending Replication Blocks"
units="none"/>
- <metric property="Hadoop:service=NameNode,name=NameNodeActivity|FilesCreated" displayName="Files Created"
+ <metric property="Hadoop:service=NameNode,name=NameNodeActivity:FilesCreated" displayName="Files Created"
units="none" measurementType="trendsup"/>
<resource-configuration>
- <c:simple-property name="conf/core-site.xml:fs.default.name" displayName="Namenode URI" />
- <c:simple-property name="conf/hdfs-site.xml:dfs.name.dir" displayName="Local Namespace and Logs Storage Directory" description="Path on the local filesystem where the NameNode stores the namespace and transactions logs persistently."/>
+ <c:simple-property name="conf/core-site.xml:fs.default.name" displayName="Namenode URI"/>
+ <c:simple-property name="conf/hdfs-site.xml:dfs.name.dir" displayName="Local Namespace and Logs Storage Directory"
+ description="Path on the local filesystem where the NameNode stores the namespace and transactions logs persistently."/>
</resource-configuration>
</server>
<server name="SecondaryNameNode" discovery="HadoopServiceDiscovery" class="HadoopServiceComponent">
<plugin-configuration>
- <c:simple-property name="_mainClass" displayName="Main Class" readOnly="true" default="org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode" />
+ <c:simple-property name="_mainClass" displayName="Main Class" readOnly="true"
+ default="org.apache.hadoop.hdfs.server.namenode.SecondaryNameNode"/>
</plugin-configuration>
- <process-scan name="SecondaryNameNode" query="process|basename|match=^java.*,arg|*|match=.*proc_secondarynamenode.*"/>
+ <process-scan name="SecondaryNameNode" query="process|basename|match=^java.*,arg|-Dproc_secondarynamenode|match=.*"/>
</server>
<!-- DataNode (http://wiki.apache.org/hadoop/DataNode) -->
<server name="DataNode" discovery="HadoopServiceDiscovery" class="HadoopServiceComponent">
<plugin-configuration>
- <c:simple-property name="_mainClass" displayName="Main Class" readOnly="true" default="org.apache.hadoop.hdfs.server.datanode.DataNode" />
+ <c:simple-property name="_mainClass" displayName="Main Class" readOnly="true"
+ default="org.apache.hadoop.hdfs.server.datanode.DataNode"/>
</plugin-configuration>
<process-scan name="DataNode" query="process|basename|match=^java.*,arg|*|match=.*proc_datanode.*"/>
- <metric property="Hadoop:service=DataNode,name=DataNode*|bytes_written" displayName="Bytes Writter"
+ <metric property="Hadoop:service=DataNode,name=DataNode*:bytes_written" displayName="Bytes Writter"
measurementType="trendsup"/>
- <metric property="Hadoop:service=DataNode,name=FSDatasetState*|Remaining" displayName="Remaining" units="bytes"/>
- <metric property="Hadoop:service=DataNode,name=FSDatasetState*|Capacity" displayName="Capacity" units="bytes"/>
- <metric property="Hadoop:service=DataNode,name=FSDatasetState*|StorageInfo" dataType="trait" displayType="summary"/>
- <metric property="Hadoop:service=DataNode,name=RpcActivitForPort*|NumOpenConnections" displayName="Number of Open Connections"/>
-
+ <metric property="Hadoop:service=DataNode,name=FSDatasetState*:Remaining" displayName="Remaining" units="bytes"/>
+ <metric property="Hadoop:service=DataNode,name=FSDatasetState*:Capacity" displayName="Capacity" units="bytes"/>
+ <metric property="Hadoop:service=DataNode,name=FSDatasetState*:StorageInfo" dataType="trait" displayType="summary"/>
+ <metric property="Hadoop:service=DataNode,name=RpcActivitForPort*:NumOpenConnections" displayName="Number of Open Connections"/>
+
<resource-configuration>
- <c:simple-property name="conf/hdfs-site.xml:dfs.data.dir" displayName="Storage Directory" description="Comma separated list of paths on the local filesystem of a DataNode where it should store its blocks."/>
+ <c:simple-property name="conf/hdfs-site.xml:dfs.data.dir" displayName="Storage Directory"
+ description="Comma separated list of paths on the local filesystem of a DataNode where it should store its blocks."/>
</resource-configuration>
</server>
@@ -80,17 +84,52 @@
<server name="JobTracker" discovery="HadoopServiceDiscovery" class="HadoopServiceComponent">
<plugin-configuration>
<c:simple-property name="baseObjectName" defaultValue="hadoop:service=JobTracker"/>
- <c:simple-property name="_mainClass" displayName="Main Class" readOnly="true" default="org.apache.hadoop.mapred.JobTracker" />
+ <c:simple-property name="_mainClass" displayName="Main Class" readOnly="true"
+ default="org.apache.hadoop.mapred.JobTracker"/>
</plugin-configuration>
- <process-scan name="JobTracker" query="process|basename|match=^java.*,arg|*|match=.*proc_jobtracker.*"/>
+
+ <process-scan name="JobTracker" query="process|basename|match=^java.*,arg|-Dproc_jobtracker|match=*"/>
+
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:jobs_completed" displayName="Jobs Completed"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:jobs_running" displayName="Jobs Running"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:jobs_preparing" displayName="Jobs Preparing"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:jobs_killed" displayName="Jobs Killed"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:jobs_failed" displayName="Jobs Failed"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:running_maps" displayName="Running Map Tasks"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:running_reduces" displayName="Running Reduce Tasks"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:jobs_submitted" displayName="Total Submissions"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:trackers" displayName="Nodes" displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:occupied_map_slots" displayName="Occupied Map Slots"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:occupied_reduce_slots" displayName="Occupied Reduce Slots"
+ description="DFS Configured capacitiy"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:reserved_map_slots" displayName="Reserved Map Slots"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:reserved_reduce_slots" displayName="Reserved Reduce Slots"
+ displayType="summary"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:map_slots" displayName="Map Task Capacity"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:reduce_slots" displayName="Reduce Task Capacity"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:trackers_blacklisted" displayName="Blacklisted Nodes"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:trackers_graylisted" displayName="Graylisted Nodes"/>
+ <metric property="Hadoop:service=JobTracker,name=JobTrackerMetrics:trackers_decommissioned" displayName="Excluded Nodes"/>
+
</server>
<!-- TaskTracker (http://wiki.apache.org/hadoop/TaskTracker) -->
<server name="TaskTracker" discovery="HadoopServiceDiscovery" class="HadoopServiceComponent">
<plugin-configuration>
- <c:simple-property name="_mainClass" displayName="Main Class" readOnly="true" default="org.apache.hadoop.mapred.TaskTracker" />
+ <c:simple-property name="_mainClass" displayName="Main Class" readOnly="true"
+ default="org.apache.hadoop.mapred.TaskTracker"/>
</plugin-configuration>
- <process-scan name="TaskTracker" query="process|basename|match=^java.*,arg|*|match=.*proc_tasktracker.*"/>
+ <process-scan name="TaskTracker" query="process|basename|match=^java.*,arg|-Dproc_tasktracker|match=*"/>
</server>
</plugin>
\ No newline at end of file
commit 0e51f3179a68b70cbaa73d25063d823ea01e1cbd
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Jul 31 18:37:05 2012 +0200
Metrics subsystem is now collecting the data via JMX
diff --git a/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceComponent.java b/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceComponent.java
index e204355..02f7a22 100644
--- a/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceComponent.java
+++ b/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceComponent.java
@@ -44,6 +44,7 @@ import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
@@ -57,22 +58,22 @@ import org.rhq.plugins.jmx.JMXServerComponent;
public class HadoopServiceComponent extends JMXServerComponent<ResourceComponent<?>> implements
JMXComponent<ResourceComponent<?>>, MeasurementFacet, OperationFacet, ConfigurationFacet {
-
+
private static final Log LOG = LogFactory.getLog(HadoopServiceComponent.class);
private static final XMLInputFactory XML_INPUT_FACTORY = XMLInputFactory.newInstance();
-
+
private static final String PROPERTY_TAG_NAME = "property";
private static final String NAME_TAG_NAME = "name";
private static final String VALUE_TAG_NAME = "value";
-
+
/**
* Return availability of this resource
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
*/
@Override
public AvailabilityType getAvailability() {
- return getResourceContext().getNativeProcess().isRunning() ? AvailabilityType.UP: AvailabilityType.DOWN;
+ return getResourceContext().getNativeProcess().isRunning() ? AvailabilityType.UP : AvailabilityType.DOWN;
}
@Override
@@ -90,55 +91,68 @@ public class HadoopServiceComponent extends JMXServerComponent<ResourceComponent
* @see org.rhq.core.pluginapi.measurement.MeasurementFacet#getValues(org.rhq.core.domain.measurement.MeasurementReport, java.util.Set)
*/
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
-
- for (MeasurementScheduleRequest req : metrics) {
- String property = req.getName();
- String props[] = property.split("\\|");
-
- EmsConnection conn = getEmsConnection();
- EmsBean bean = conn.getBean(props[0]);
- if (bean != null) {
- bean.refreshAttributes();
- EmsAttribute att = bean.getAttribute(props[1]);
- if (att != null) {
- Long val = (Long) att.getValue(); // TODO check for real type
-
- MeasurementDataNumeric res = new MeasurementDataNumeric(req, Double.valueOf(val));
- report.addData(res);
- } else
- LOG.warn("Attribute " + props[1] + " not found");
- } else
- LOG.warn("MBean " + props[0] + " not found");
+ for (MeasurementScheduleRequest request : metrics) {
+ String name = request.getName();
+ int delimIndex = name.lastIndexOf(':');
+ String beanName = name.substring(0, delimIndex);
+ String attributeName = name.substring(delimIndex + 1);
+ try {
+ EmsConnection emsConnection = getEmsConnection();
+ EmsBean bean = emsConnection.getBean(beanName);
+ if (bean != null) {
+ bean.refreshAttributes();
+ EmsAttribute attribute = bean.getAttribute(attributeName);
+ if (attribute != null) {
+ Object valueObject = attribute.refresh();
+ if (valueObject instanceof Number) {
+ Number value = (Number) valueObject;
+ report.addData(new MeasurementDataNumeric(request, value.doubleValue()));
+ } else {
+ report.addData(new MeasurementDataTrait(request, valueObject.toString()));
+ }
+ } else {
+ LOG.warn("Attribute " + attributeName + " not found");
+ }
+ } else {
+ LOG.warn("MBean " + beanName + " not found");
+ }
+ } catch (Exception e) {
+ LOG.error("Failed to obtain measurement [" + name + "]", e);
+ }
}
}
public Configuration loadResourceConfiguration() throws Exception {
- ConfigurationDefinition definition = getResourceContext().getResourceType().getResourceConfigurationDefinition();
+ ConfigurationDefinition definition = getResourceContext().getResourceType()
+ .getResourceConfigurationDefinition();
Configuration config = new Configuration();
-
- File homeDir = new File(getResourceContext().getPluginConfiguration().getSimpleValue(HadoopServiceDiscovery.HOME_DIR_PROPERTY));
-
+
+ File homeDir = new File(getResourceContext().getPluginConfiguration().getSimpleValue(
+ HadoopServiceDiscovery.HOME_DIR_PROPERTY));
+
if (!homeDir.exists()) {
- throw new IllegalArgumentException("The configured home directory of this Hadoop instance (" + homeDir.getAbsolutePath() + ") no longer exists.");
+ throw new IllegalArgumentException("The configured home directory of this Hadoop instance ("
+ + homeDir.getAbsolutePath() + ") no longer exists.");
}
-
+
if (!homeDir.isDirectory()) {
- throw new IllegalArgumentException("The configured home directory of this Hadoop instance (" + homeDir.getAbsolutePath() + ") is not a directory.");
+ throw new IllegalArgumentException("The configured home directory of this Hadoop instance ("
+ + homeDir.getAbsolutePath() + ") is not a directory.");
}
-
+
if (!homeDir.canRead()) {
- throw new IllegalArgumentException("The configured home directory of this Hadoop instance (" + homeDir.getAbsolutePath() + ") is not readable.");
+ throw new IllegalArgumentException("The configured home directory of this Hadoop instance ("
+ + homeDir.getAbsolutePath() + ") is not readable.");
}
-
+
fillResourceConfiguration(homeDir, config, definition);
-
+
return config;
}
-
public void updateResourceConfiguration(ConfigurationUpdateReport report) {
// TODO Auto-generated method stub
-
+
}
/**
@@ -157,59 +171,62 @@ public class HadoopServiceComponent extends JMXServerComponent<ResourceComponent
}
return res;
}
-
- public static void fillResourceConfiguration(File homeDir, Configuration config, ConfigurationDefinition definition) throws XMLStreamException, IOException {
+
+ public static void fillResourceConfiguration(File homeDir, Configuration config, ConfigurationDefinition definition)
+ throws XMLStreamException, IOException {
//the config is just a bunch of simples, so this is rather easy.. no cumbersome traversal of property maps and lists
-
+
Map<String, PropertySimple> propertiesToFind = new HashMap<String, PropertySimple>();
Set<File> configFilesToParse = new HashSet<File>();
-
- for(PropertyDefinition pd : definition.getPropertyDefinitions().values()) {
+
+ for (PropertyDefinition pd : definition.getPropertyDefinitions().values()) {
if (!(pd instanceof PropertyDefinitionSimple)) {
//hmm... well, someone thought it's enough to change the config and the code would be clever.
//it's not ;)
continue;
}
-
+
String propertyName = pd.getName();
String[] parts = propertyName.split(":");
String fileName = parts[0];
String configName = parts[1];
-
+
File configFile = new File(homeDir, fileName);
-
+
if (!configFile.exists()) {
- throw new IllegalArgumentException("The expected configuration file (" + configFile.getAbsolutePath() + ") doesn't exist.");
+ throw new IllegalArgumentException("The expected configuration file (" + configFile.getAbsolutePath()
+ + ") doesn't exist.");
}
-
+
configFilesToParse.add(configFile);
-
+
PropertySimple prop = new PropertySimple();
prop.setName(propertyName);
config.put(prop);
-
+
propertiesToFind.put(configName, prop);
}
-
- for(File configFile : configFilesToParse) {
+
+ for (File configFile : configFilesToParse) {
parseAndAssignProps(configFile, propertiesToFind);
}
}
-
- private static void parseAndAssignProps(File configFile, Map<String, PropertySimple> props) throws XMLStreamException, IOException {
+
+ private static void parseAndAssignProps(File configFile, Map<String, PropertySimple> props)
+ throws XMLStreamException, IOException {
FileInputStream in = new FileInputStream(configFile);
XMLStreamReader rdr = XML_INPUT_FACTORY.createXMLStreamReader(in);
try {
boolean inProperty = false;
String propertyName = null;
String propertyValue = null;
-
- while(rdr.hasNext()) {
+
+ while (rdr.hasNext()) {
int event = rdr.next();
-
+
String tag = null;
-
- switch(event) {
+
+ switch (event) {
case XMLStreamReader.START_ELEMENT:
tag = rdr.getName().getLocalPart();
if (PROPERTY_TAG_NAME.equals(tag)) {
@@ -224,12 +241,12 @@ public class HadoopServiceComponent extends JMXServerComponent<ResourceComponent
tag = rdr.getName().getLocalPart();
if (PROPERTY_TAG_NAME.equals(tag)) {
inProperty = false;
-
+
PropertySimple prop = props.get(propertyName);
if (prop != null) {
prop.setValue(propertyValue);
}
-
+
propertyName = null;
propertyValue = null;
}
@@ -241,5 +258,5 @@ public class HadoopServiceComponent extends JMXServerComponent<ResourceComponent
in.close();
}
}
-
+
}
11 years, 4 months
[rhq] modules/enterprise
by mike thompson
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit a9a655c1b1ff04330ef75e7a7c9456b88bd0ad56
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Tue Jul 31 09:07:55 2012 -0700
[BZ 733487 New SearchBar] Handle null search condition better.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java
index 5409248..f56c81e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/searchbar/BasicSearchStrategy.java
@@ -163,7 +163,7 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
.getValueAsString().length());
} else {
Log.debug("Empty Search expression");
- getTabAwareSearchSuggestions(SearchSubsystem.RESOURCE, "", 0);
+ getTabAwareSearchSuggestions(SearchSubsystem.RESOURCE, null, 0);
}
}
@@ -175,7 +175,7 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
private void getTabAwareSearchSuggestions(final SearchSubsystem searchSubsystem, final String expression,
int caretPosition) {
- if (expression.equals(lastExpression)) {
+ if (null != expression && expression.equals(lastExpression)) {
// short-circuit if we dont really need to do a search
Log.debug("search tab aware Suggestions: ignoring duplicate search for: " + expression);
return;
@@ -193,7 +193,7 @@ public class BasicSearchStrategy extends AbstractSearchStrategy {
ComboBoxItem comboBox = searchBar.getSearchComboboxItem();
// If the value has already changed assume a subsequent search is what they want
- if (!expression.equals(comboBox.getValueAsString())) {
+ if (null != expression && !expression.equals(comboBox.getValueAsString())) {
Log.debug("search tab aware Suggestions: ignoring obsolete results for: " + expression);
return;
}
11 years, 4 months
[rhq] Branch 'release/jon3.1.x' - modules/core
by snegrea
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java | 29 ++++++++--
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/TestResourceDiscoveryComponent.java | 16 +++++
2 files changed, 42 insertions(+), 3 deletions(-)
New commits:
commit 2c5e267ff8f77108f606877e3f8cc79380077900
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jul 31 10:52:46 2012 -0500
add a test that checks if discovery is run more than once per child type
(cherry picked from commit de82e5b9603bf9cd2ec8261b8cb996edbd5a838b)
Conflicts:
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
index ea11189..b7227ff 100644
--- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
+++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/InventoryManagerTest.java
@@ -19,6 +19,11 @@
package org.rhq.core.pc.inventory;
import java.io.File;
+import java.util.HashMap;
+import java.util.Map;
+
+import org.testng.Assert;
+import org.testng.annotations.Test;
import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.container.test.api.TargetsContainer;
@@ -29,6 +34,7 @@ import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.rhq.core.clientapi.server.discovery.InventoryReport;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.PluginContainer;
import org.rhq.core.pc.PluginContainerConfiguration;
import org.rhq.core.pc.inventory.testplugin.TestResourceComponent;
@@ -40,8 +46,6 @@ import org.rhq.test.arquillian.FakeServerInventory;
import org.rhq.test.arquillian.MockingServerServices;
import org.rhq.test.arquillian.RunDiscovery;
import org.rhq.test.shrinkwrap.RhqAgentPluginArchive;
-import org.testng.Assert;
-import org.testng.annotations.Test;
import static org.mockito.Matchers.any;
import static org.mockito.Mockito.when;
@@ -93,7 +97,7 @@ public class InventoryManagerTest extends Arquillian {
}
/**
- * Tests that Resources are properly synchronized after the plugin container is restarted with a clean data
+ * Tests that Resources are properly synchronized after the inventory manager is restarted with a clean data
* directory.
*
* @throws Exception if an error occurs
@@ -156,6 +160,25 @@ public class InventoryManagerTest extends Arquillian {
validatePluginContainerInventory();
}
+ /**
+ * Tests that discovery was only run once per ResourceType.
+ *
+ * @throws Exception if an error occurs
+ */
+ @Test(groups = "pc.itest.inventorymanager", dependsOnMethods = "testSyncUnknownResources")
+ public void testDiscoveryRunsOnlyOncePerType() throws Exception {
+ Map<ResourceType,Integer> executionCountsByResourceType = TestResourceDiscoveryComponent.getExecutionCountsByResourceType();
+ Map<ResourceType,Integer> flaggedExecutionCountsByResourceType = new HashMap<ResourceType, Integer>();
+ for (ResourceType resourceType : executionCountsByResourceType.keySet()) {
+ Integer count = executionCountsByResourceType.get(resourceType);
+ if (count > 1) {
+ flaggedExecutionCountsByResourceType.put(resourceType, count);
+ }
+ }
+ Assert.assertTrue(flaggedExecutionCountsByResourceType.isEmpty(),
+ "Discovery was executed more than once for the following types: " + flaggedExecutionCountsByResourceType);
+ }
+
private void validatePluginContainerInventory() {
System.out.println("Validating PC inventory...");
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/TestResourceDiscoveryComponent.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/TestResourceDiscoveryComponent.java
index 43ccfd4..8091054 100644
--- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/TestResourceDiscoveryComponent.java
+++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/TestResourceDiscoveryComponent.java
@@ -19,6 +19,8 @@
package org.rhq.core.pc.inventory.testplugin;
import java.util.Collections;
+import java.util.HashMap;
+import java.util.Map;
import java.util.Set;
import org.rhq.core.domain.resource.ResourceType;
@@ -33,11 +35,21 @@ import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
*/
public class TestResourceDiscoveryComponent implements ResourceDiscoveryComponent<ResourceComponent<?>> {
+ private static Map<ResourceType, Integer> executionCountsByResourceType = new HashMap();
+
@Override
public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ResourceComponent<?>> discoveryContext)
throws InvalidPluginConfigurationException, Exception {
ResourceType resourceType = discoveryContext.getResourceType();
+
+ Integer count = executionCountsByResourceType.get(resourceType);
+ if (count == null) {
+ executionCountsByResourceType.put(resourceType, 1);
+ } else {
+ executionCountsByResourceType.put(resourceType, count + 1);
+ }
+
DiscoveredResourceDetails resourceDetails = new DiscoveredResourceDetails(resourceType,
"SINGLETON", resourceType.getName(), "1.0", resourceType.getDescription(),
discoveryContext.getDefaultPluginConfiguration(), null);
@@ -45,4 +57,8 @@ public class TestResourceDiscoveryComponent implements ResourceDiscoveryComponen
return Collections.singleton(resourceDetails);
}
+ public static Map<ResourceType, Integer> getExecutionCountsByResourceType() {
+ return executionCountsByResourceType;
+ }
+
}
11 years, 4 months
[rhq] Branch 'release/jon3.1.x' - 2 commits - modules/core
by snegrea
modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/FakeServerInventory.java | 19
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/DiscoveryTest.java | 221 ++++++++++
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/ManualAddDiscoveryComponent.java | 34 +
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/TestResourceComponent.java | 103 ++++
modules/core/plugin-container-itest/src/test/resources/test-great-grandchild-discovery-plugin.xml | 60 ++
modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityContextImpl.java | 7
modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java | 7
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 23 -
8 files changed, 461 insertions(+), 13 deletions(-)
New commits:
commit bf517b9d9a0f31ae370e7c8b952c45083d054866
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jul 31 10:19:23 2012 -0500
[BZ 832090] - adding an integration test for checking that all the PC
subsystems obtain the synced resource after manual add.
(cherry picked from commit ac7fe40163f22ed7b634d1ec8138fb0182e1617d)
Conflicts:
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/DiscoveryTest.java
modules/core/plugin-container-itest/src/test/resources/test-great-grandchild-discovery-plugin.xml
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 0b7b043..37e4ff2 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
@@ -41,6 +41,7 @@ import org.mockito.stubbing.Answer;
import org.rhq.core.clientapi.agent.upgrade.ResourceUpgradeRequest;
import org.rhq.core.clientapi.agent.upgrade.ResourceUpgradeResponse;
import org.rhq.core.clientapi.server.discovery.InventoryReport;
+import org.rhq.core.domain.discovery.MergeResourceResponse;
import org.rhq.core.domain.discovery.ResourceSyncInfo;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
@@ -186,6 +187,24 @@ public class FakeServerInventory {
return discoveryChecker;
}
+ public synchronized Answer<MergeResourceResponse> addResource() {
+ return new Answer<MergeResourceResponse>() {
+ @Override
+ public MergeResourceResponse answer(InvocationOnMock invocation) throws Throwable {
+ Resource r = (Resource) invocation.getArguments()[0];
+ int subjectId = (Integer) invocation.getArguments()[1];
+
+ LOG.debug("A request to add a resource [" + r + "] made by subject with id " + subjectId);
+
+ boolean exists = getResourceStore().containsKey(r.getUuid());
+
+ r = fakePersist(r, InventoryStatus.COMMITTED, new HashSet<String>());
+
+ return new MergeResourceResponse(r.getId(), exists);
+ }
+ };
+ }
+
public synchronized Answer<ResourceSyncInfo> mergeInventoryReport(final InventoryStatus requiredInventoryStatus) {
return new Answer<ResourceSyncInfo>() {
@Override
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/DiscoveryTest.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/DiscoveryTest.java
new file mode 100644
index 0000000..8880b92
--- /dev/null
+++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/DiscoveryTest.java
@@ -0,0 +1,221 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2012 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.core.pc.inventory;
+
+import static org.mockito.Matchers.any;
+import static org.mockito.Matchers.anyInt;
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertNotEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import org.mockito.Mockito;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import org.jboss.arquillian.container.test.api.Deployment;
+import org.jboss.arquillian.container.test.api.TargetsContainer;
+import org.jboss.arquillian.test.api.ArquillianResource;
+import org.jboss.arquillian.testng.Arquillian;
+import org.jboss.shrinkwrap.api.ShrinkWrap;
+
+import org.rhq.core.clientapi.server.discovery.InventoryReport;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.discovery.MergeResourceResponse;
+import org.rhq.core.domain.resource.InventoryStatus;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pc.PluginContainer;
+import org.rhq.core.pc.PluginContainerConfiguration;
+import org.rhq.core.pc.availability.AvailabilityContextImpl;
+import org.rhq.core.pc.content.ContentContextImpl;
+import org.rhq.core.pc.event.EventContextImpl;
+import org.rhq.core.pc.inventory.testplugin.ManualAddDiscoveryComponent;
+import org.rhq.core.pc.inventory.testplugin.TestResourceComponent;
+import org.rhq.core.pc.inventory.testplugin.TestResourceDiscoveryComponent;
+import org.rhq.core.pc.operation.OperationContextImpl;
+import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.test.arquillian.AfterDiscovery;
+import org.rhq.test.arquillian.BeforeDiscovery;
+import org.rhq.test.arquillian.FakeServerInventory;
+import org.rhq.test.arquillian.MockingServerServices;
+import org.rhq.test.arquillian.RunDiscovery;
+import org.rhq.test.shrinkwrap.RhqAgentPluginArchive;
+
+/**
+ * A unit test for testing discovery.
+ */
+public class DiscoveryTest extends Arquillian {
+
+ @Deployment(name = "test")
+ @TargetsContainer("pc")
+ public static RhqAgentPluginArchive getTestPlugin() {
+ RhqAgentPluginArchive pluginJar = ShrinkWrap.create(RhqAgentPluginArchive.class, "test-plugin.jar");
+ return pluginJar.setPluginDescriptor("test-great-grandchild-discovery-plugin.xml").addClasses(
+ TestResourceDiscoveryComponent.class, TestResourceComponent.class, ManualAddDiscoveryComponent.class);
+ }
+
+ @ArquillianResource
+ private MockingServerServices serverServices;
+
+ @ArquillianResource
+ private PluginContainerConfiguration pluginContainerConfiguration;
+
+ @ArquillianResource
+ private PluginContainer pluginContainer;
+
+ private FakeServerInventory fakeServerInventory;
+
+ private FakeServerInventory.CompleteDiscoveryChecker discoveryCompleteChecker;
+
+ @BeforeDiscovery
+ public void resetServerServices() throws Exception {
+ // Set up our fake server discovery ServerService, which will auto-import all Resources in reports it receives.
+ serverServices.resetMocks();
+ fakeServerInventory = new FakeServerInventory();
+ discoveryCompleteChecker = fakeServerInventory.createAsyncDiscoveryCompletionChecker(4);
+ when(serverServices.getDiscoveryServerService().mergeInventoryReport(any(InventoryReport.class))).then(
+ fakeServerInventory.mergeInventoryReport(InventoryStatus.COMMITTED));
+ }
+
+ @AfterDiscovery
+ public void waitForAsyncDiscoveries() throws Exception {
+ if (discoveryCompleteChecker != null) {
+ discoveryCompleteChecker.waitForDiscoveryComplete(10000);
+ }
+ }
+
+ /**
+ * Tests that discovery was only run once per ResourceType. This tests a deep, 4-level hierarchy.
+ *
+ * @throws Exception if an error occurs
+ */
+ @RunDiscovery
+ @Test(groups = "pc.itest.discovery", priority = 10)
+ public void testDiscoveryRunsOnlyOncePerType() throws Exception {
+ // make sure our inventory is as we expect it to be
+ validatePluginContainerInventory();
+
+ // reset our discovery component's internal storage
+ TestResourceDiscoveryComponent.getExecutionCountsByResourceType().clear();
+
+ // run our own discovery scan
+ this.pluginContainer.getInventoryManager().executeServiceScanImmediately();
+
+ Map<ResourceType, Integer> executionCountsByResourceType = TestResourceDiscoveryComponent
+ .getExecutionCountsByResourceType();
+ Map<ResourceType, Integer> flaggedExecutionCountsByResourceType = new HashMap<ResourceType, Integer>();
+ for (ResourceType resourceType : executionCountsByResourceType.keySet()) {
+ Integer count = executionCountsByResourceType.get(resourceType);
+ if (count != 1) {
+ flaggedExecutionCountsByResourceType.put(resourceType, count);
+ }
+ }
+ Assert.assertTrue(flaggedExecutionCountsByResourceType.isEmpty(),
+ "Discovery was not executed once (and only once) for the following types: "
+ + flaggedExecutionCountsByResourceType);
+ }
+
+ @Test(groups = "pc.itest.discovery", priority = 10)
+ public void testResourceSyncedWithServerAfterManualAdd() throws Exception {
+ Mockito.when(serverServices.getDiscoveryServerService().addResource(any(Resource.class), anyInt())).then(
+ fakeServerInventory.addResource());
+
+ InventoryManager inventoryManager = pluginContainer.getInventoryManager();
+
+ Resource platform = inventoryManager.getPlatform();
+
+ Configuration myPluginConfig = new Configuration();
+ myPluginConfig.put(new PropertySimple("test", "value"));
+
+ ResourceType resourceType = pluginContainer.getPluginManager().getMetadataManager()
+ .getType("Manual Add Server", "test");
+
+ MergeResourceResponse response = inventoryManager.manuallyAddResource(resourceType, platform.getId(),
+ myPluginConfig, -1);
+
+ assertFalse(response.resourceAlreadyExisted(), "The manual add resource shouldn't have existed");
+ assertNotEquals(response.getResourceId(), 0, "The manual add resource should have had its resource id set");
+
+ ResourceContainer resourceContainer = inventoryManager.getResourceContainer(response.getResourceId());
+ ResourceContext<?> resourceContext = resourceContainer.getResourceContext();
+
+ assertEquals(resourceContext.getPluginConfiguration(), myPluginConfig,
+ "The manual add resource doesn't have the expected plugin config.");
+
+ assertTrue(resourceContext.getAvailabilityContext() instanceof AvailabilityContextImpl,
+ "Unexpected implementation clas of the AvailabilityContext, please fix this test.");
+ assertEquals(((AvailabilityContextImpl) resourceContext.getAvailabilityContext()).getResource().getId(),
+ response.getResourceId(),
+ "Availability subsystem isn't aware of the correct resource id for manual add resource");
+
+ assertTrue(resourceContext.getContentContext() instanceof ContentContextImpl,
+ "Unexpected implementation class of ContentContext, please fix this test");
+ assertEquals(((ContentContextImpl) resourceContext.getContentContext()).getResourceId(),
+ response.getResourceId(),
+ "Content subsystem isn't aware of the correct resource id for manual add resource");
+
+ assertTrue(resourceContext.getEventContext() instanceof EventContextImpl,
+ "Unexpected implementation clas of the EventContext, please fix this test.");
+ assertEquals(((EventContextImpl) resourceContext.getEventContext()).getResource().getId(),
+ response.getResourceId(), "Event subsystem isn't aware of the correct resource id for manual add resource");
+
+ assertTrue(resourceContext.getOperationContext() instanceof OperationContextImpl,
+ "Unexpected implementation clas of the OperationContext, please fix this test.");
+ assertEquals(((OperationContextImpl) resourceContext.getOperationContext()).getResourceId(),
+ response.getResourceId(),
+ "Operation subsystem isn't aware of the correct resource id for manual add resource");
+ }
+
+ private void validatePluginContainerInventory() throws Exception {
+ System.out.println("Validating PC inventory...");
+
+ Resource platform = pluginContainer.getInventoryManager().getPlatform();
+ Assert.assertNotNull(platform);
+ Assert.assertEquals(platform.getInventoryStatus(), InventoryStatus.COMMITTED);
+
+ Resource server = platform.getChildResources().iterator().next();
+ Assert.assertNotNull(server);
+ Assert.assertEquals(server.getInventoryStatus(), InventoryStatus.COMMITTED);
+ assert server.getResourceType().getName().equals("Test Server");
+
+ Resource child = server.getChildResources().iterator().next();
+ Assert.assertNotNull(child);
+ Assert.assertEquals(child.getInventoryStatus(), InventoryStatus.COMMITTED);
+ assert child.getResourceType().getName().equals("Test Service Child");
+
+ Resource grandchild = child.getChildResources().iterator().next();
+ Assert.assertNotNull(grandchild);
+ Assert.assertEquals(grandchild.getInventoryStatus(), InventoryStatus.COMMITTED);
+ assert grandchild.getResourceType().getName().equals("Test Service GrandChild");
+
+ Resource greatgrandchild = grandchild.getChildResources().iterator().next();
+ Assert.assertNotNull(greatgrandchild);
+ Assert.assertEquals(greatgrandchild.getInventoryStatus(), InventoryStatus.COMMITTED);
+ assert greatgrandchild.getResourceType().getName().equals("Test Service GreatGrandChild");
+
+ System.out.println("PC inventory validated successfully!");
+ }
+
+}
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/ManualAddDiscoveryComponent.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/ManualAddDiscoveryComponent.java
new file mode 100644
index 0000000..95701b2
--- /dev/null
+++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/ManualAddDiscoveryComponent.java
@@ -0,0 +1,34 @@
+package org.rhq.core.pc.inventory.testplugin;
+
+import java.util.Collections;
+import java.util.Set;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails;
+import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import org.rhq.core.pluginapi.inventory.ManualAddFacet;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+public class ManualAddDiscoveryComponent implements ResourceDiscoveryComponent<ResourceComponent<?>>,
+ ManualAddFacet<ResourceComponent<?>> {
+
+ @Override
+ public DiscoveredResourceDetails discoverResource(Configuration pluginConfiguration,
+ ResourceDiscoveryContext<ResourceComponent<?>> context) throws InvalidPluginConfigurationException {
+
+ ResourceType resourceType = context.getResourceType();
+
+ return new DiscoveredResourceDetails(resourceType, "SINGLETON", resourceType.getName(), "1.0",
+ resourceType.getDescription(), pluginConfiguration, null);
+ }
+
+ @Override
+ public Set<DiscoveredResourceDetails> discoverResources(ResourceDiscoveryContext<ResourceComponent<?>> context)
+ throws InvalidPluginConfigurationException, Exception {
+ return Collections.emptySet();
+ }
+
+}
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/TestResourceComponent.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/TestResourceComponent.java
index d56d598..20ccf76 100644
--- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/TestResourceComponent.java
+++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/inventory/testplugin/TestResourceComponent.java
@@ -18,15 +18,49 @@
*/
package org.rhq.core.pc.inventory.testplugin;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Set;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.content.PackageType;
+import org.rhq.core.domain.content.transfer.DeployPackageStep;
+import org.rhq.core.domain.content.transfer.DeployPackagesResponse;
+import org.rhq.core.domain.content.transfer.RemovePackagesResponse;
+import org.rhq.core.domain.content.transfer.ResourcePackageDetails;
import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.bundle.BundleDeployRequest;
+import org.rhq.core.pluginapi.bundle.BundleDeployResult;
+import org.rhq.core.pluginapi.bundle.BundleFacet;
+import org.rhq.core.pluginapi.bundle.BundlePurgeRequest;
+import org.rhq.core.pluginapi.bundle.BundlePurgeResult;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
+import org.rhq.core.pluginapi.content.ContentFacet;
+import org.rhq.core.pluginapi.content.ContentServices;
+import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
+import org.rhq.core.pluginapi.inventory.CreateResourceReport;
+import org.rhq.core.pluginapi.inventory.DeleteResourceFacet;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
+import org.rhq.core.pluginapi.measurement.MeasurementFacet;
+import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.core.pluginapi.operation.OperationResult;
+import org.rhq.core.pluginapi.support.SnapshotReportRequest;
+import org.rhq.core.pluginapi.support.SnapshotReportResults;
+import org.rhq.core.pluginapi.support.SupportFacet;
/**
+ * This resource component implements most (all?) of the facets so that all the plugin container subsystems can work
+ * with it.
+ *
* @author Ian Springer
*/
-public class TestResourceComponent implements ResourceComponent<ResourceComponent<?>> {
+public class TestResourceComponent implements ResourceComponent<ResourceComponent<?>>, OperationFacet, ContentFacet,
+ ConfigurationFacet, MeasurementFacet, DeleteResourceFacet, CreateChildResourceFacet, BundleFacet, SupportFacet {
private ResourceContext<ResourceComponent<?>> resourceContext;
@@ -46,4 +80,71 @@ public class TestResourceComponent implements ResourceComponent<ResourceComponen
return;
}
+ @Override
+ public SnapshotReportResults getSnapshotReport(SnapshotReportRequest request) throws Exception {
+ return null;
+ }
+
+ @Override
+ public BundleDeployResult deployBundle(BundleDeployRequest request) {
+ return null;
+ }
+
+ @Override
+ public BundlePurgeResult purgeBundle(BundlePurgeRequest request) {
+ return null;
+ }
+
+ @Override
+ public CreateResourceReport createResource(CreateResourceReport report) {
+ return null;
+ }
+
+ @Override
+ public void deleteResource() throws Exception {
+ }
+
+ @Override
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
+ }
+
+ @Override
+ public Configuration loadResourceConfiguration() throws Exception {
+ return null;
+ }
+
+ @Override
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ }
+
+ @Override
+ public List<DeployPackageStep> generateInstallationSteps(ResourcePackageDetails packageDetails) {
+ return null;
+ }
+
+ @Override
+ public DeployPackagesResponse deployPackages(Set<ResourcePackageDetails> packages, ContentServices contentServices) {
+ return null;
+ }
+
+ @Override
+ public RemovePackagesResponse removePackages(Set<ResourcePackageDetails> packages) {
+ return null;
+ }
+
+ @Override
+ public Set<ResourcePackageDetails> discoverDeployedPackages(PackageType type) {
+ return null;
+ }
+
+ @Override
+ public InputStream retrievePackageBits(ResourcePackageDetails packageDetails) {
+ return null;
+ }
+
+ @Override
+ public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException,
+ Exception {
+ return null;
+ }
}
diff --git a/modules/core/plugin-container-itest/src/test/resources/test-great-grandchild-discovery-plugin.xml b/modules/core/plugin-container-itest/src/test/resources/test-great-grandchild-discovery-plugin.xml
new file mode 100644
index 0000000..a1e222a
--- /dev/null
+++ b/modules/core/plugin-container-itest/src/test/resources/test-great-grandchild-discovery-plugin.xml
@@ -0,0 +1,60 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<plugin name="test"
+ displayName="Test"
+ description="a test plugin"
+ package="org.rhq.core.pc.inventory.testplugin"
+ version="1.0"
+ xmlns="urn:xmlns:rhq-plugin"
+ xmlns:c="urn:xmlns:rhq-configuration">
+
+ <server name="Test Server"
+ discovery="TestResourceDiscoveryComponent"
+ class="TestResourceComponent">
+
+ <service name="Test Service Child"
+ discovery="TestResourceDiscoveryComponent"
+ class="TestResourceComponent">
+
+ <service name="Test Service GrandChild"
+ discovery="TestResourceDiscoveryComponent"
+ class="TestResourceComponent">
+
+ <service name="Test Service GreatGrandChild"
+ discovery="TestResourceDiscoveryComponent"
+ class="TestResourceComponent">
+ </service>
+ </service>
+ </service>
+ </server>
+
+ <server name="Manual Add Server"
+ discovery="ManualAddDiscoveryComponent"
+ class="TestResourceComponent">
+ <plugin-configuration>
+ <c:simple-property name="test" />
+ </plugin-configuration>
+ <operation name="test" />
+ <metric property="test" />
+ <event name="test" />
+ <content name="test" category="executableScript" />
+ <resource-configuration>
+ <c:simple-property name="test" />
+ </resource-configuration>
+
+ <drift-definition name="test">
+ <basedir>
+ <value-context>fileSystem</value-context>
+ <value-name>test</value-name>
+ </basedir>
+ </drift-definition>
+
+ <bundle-target>
+ <destination-base-dir name="test">
+ <value-context>fileSystem</value-context>
+ <value-name>test</value-name>
+ </destination-base-dir>
+ </bundle-target>
+
+ </server>
+</plugin>
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityContextImpl.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityContextImpl.java
index f34d673..32fb361 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityContextImpl.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/availability/AvailabilityContextImpl.java
@@ -79,4 +79,11 @@ public class AvailabilityContextImpl implements AvailabilityContext {
public void enable() {
PluginContainer.getInstance().getInventoryManager().setResourceEnablement(resource.getId(), true);
}
+
+ /**
+ * Only used in tests
+ */
+ public Resource getResource() {
+ return resource;
+ }
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
index a50a658..fd360cf 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/event/EventContextImpl.java
@@ -108,6 +108,13 @@ public class EventContextImpl implements EventContext {
return getEventManager().getSigar();
}
+ /**
+ * Only used for testing purposes.
+ */
+ public Resource getResource() {
+ return resource;
+ }
+
private void registerEventPollerInternal(final EventPoller poller, int pollingInterval, final String sourceLocation) {
EventDefinition eventDefinition = EventUtility.getEventDefinition(poller.getEventType(),
this.resource.getResourceType());
commit 5a4b2ec79c9f05a13f24d253aea91227df7fd40f
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Jul 31 10:16:39 2012 -0500
[BZ 832090] - Make sure to activate the resource only after it has been
synced with the server during manual add so that the subsystems dependent
on the resource id get the correct one.
(cherry picked from commit 662d3ef2ad7ac1b49257565b08c7c7f61187d3a2)
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 7288038..31974c4 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
@@ -694,7 +694,6 @@ public class InventoryManager extends AgentService implements ContainerService,
MergeResourceResponse mergeResourceResponse;
Resource resource = null;
boolean resourceAlreadyExisted = false;
- Throwable startError = null;
try {
ResourceContainer parentResourceContainer = getResourceContainer(parentResourceId);
@@ -805,14 +804,6 @@ public class InventoryManager extends AgentService implements ContainerService,
if (log.isDebugEnabled()) {
log.debug("Activating resource [" + resource + "]...");
}
- // if it fails to start keep going, we already have the resource in inventory and
- // need to coordinate with the server. The new resource will be unavailable but at least
- // it will be accessible and editable by the user. Report the start exception at the end.
- try {
- activateResource(resource, resourceContainer, newPluginConfig);
- } catch (Throwable t) {
- startError = t;
- }
// NOTE: We don't mess with inventory status - that's the server's responsibility.
@@ -829,11 +820,19 @@ public class InventoryManager extends AgentService implements ContainerService,
postProcessNewlyCommittedResources(newResources);
performServiceScan(resource.getId());
- if (null != startError) {
- handleInvalidPluginConfigurationResourceError(resource, startError);
+ // Note that it is important to activate the resource *AFTER* it has been synced with the
+ // server so that the resource has a valid id (which is needed by at least the content
+ // subsystem).
+ try {
+ activateResource(resource, resourceContainer, newPluginConfig);
+ } catch (Throwable t) {
+ // if it fails to start keep going, we already have the resource in inventory and
+ // we are in sync with the server. The new resource will be unavailable but at least
+ // it will be accessible and editable by the user. Report the start exception at the end.
+ handleInvalidPluginConfigurationResourceError(resource, t);
throw new PluginContainerException("The resource [" + resource
+ "] has been added but could not be started. Verify the supplied configuration values: ",
- startError);
+ t);
}
}
11 years, 4 months
[rhq] Branch 'feature/hadoop-plugin' - 2 commits - modules/plugins
by lkrejci
modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceComponent.java | 141 +++++++++-
modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceDiscovery.java | 29 +-
modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml | 2
3 files changed, 166 insertions(+), 6 deletions(-)
New commits:
commit d81f463b877b57a7e561159bbef7f0854b53dd81
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Jul 31 17:18:24 2012 +0200
Reading of hadoop config files should work now.
diff --git a/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceComponent.java b/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceComponent.java
index 5cb3806..e204355 100644
--- a/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceComponent.java
+++ b/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceComponent.java
@@ -19,8 +19,18 @@
package org.rhq.plugins.hadoop;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
import java.util.Set;
+import javax.xml.stream.XMLInputFactory;
+import javax.xml.stream.XMLStreamException;
+import javax.xml.stream.XMLStreamReader;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.mc4j.ems.connection.EmsConnection;
@@ -28,10 +38,16 @@ import org.mc4j.ems.connection.bean.EmsBean;
import org.mc4j.ems.connection.bean.attribute.EmsAttribute;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementDataNumeric;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.configuration.ConfigurationFacet;
+import org.rhq.core.pluginapi.configuration.ConfigurationUpdateReport;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
import org.rhq.core.pluginapi.operation.OperationFacet;
@@ -40,10 +56,16 @@ import org.rhq.plugins.jmx.JMXComponent;
import org.rhq.plugins.jmx.JMXServerComponent;
public class HadoopServiceComponent extends JMXServerComponent<ResourceComponent<?>> implements
- JMXComponent<ResourceComponent<?>>, MeasurementFacet, OperationFacet {
+ JMXComponent<ResourceComponent<?>>, MeasurementFacet, OperationFacet, ConfigurationFacet {
private static final Log LOG = LogFactory.getLog(HadoopServiceComponent.class);
+ private static final XMLInputFactory XML_INPUT_FACTORY = XMLInputFactory.newInstance();
+
+ private static final String PROPERTY_TAG_NAME = "property";
+ private static final String NAME_TAG_NAME = "name";
+ private static final String VALUE_TAG_NAME = "value";
+
/**
* Return availability of this resource
* @see org.rhq.core.pluginapi.inventory.ResourceComponent#getAvailability()
@@ -55,7 +77,7 @@ public class HadoopServiceComponent extends JMXServerComponent<ResourceComponent
@Override
public EmsConnection getEmsConnection() {
- EmsConnection conn = super.getEmsConnection(); // TODO: Customise this generated block
+ EmsConnection conn = super.getEmsConnection();
if (LOG.isTraceEnabled()) {
LOG.trace("EmsConnection is " + conn.toString());
}
@@ -90,6 +112,35 @@ public class HadoopServiceComponent extends JMXServerComponent<ResourceComponent
}
}
+ public Configuration loadResourceConfiguration() throws Exception {
+ ConfigurationDefinition definition = getResourceContext().getResourceType().getResourceConfigurationDefinition();
+ Configuration config = new Configuration();
+
+ File homeDir = new File(getResourceContext().getPluginConfiguration().getSimpleValue(HadoopServiceDiscovery.HOME_DIR_PROPERTY));
+
+ if (!homeDir.exists()) {
+ throw new IllegalArgumentException("The configured home directory of this Hadoop instance (" + homeDir.getAbsolutePath() + ") no longer exists.");
+ }
+
+ if (!homeDir.isDirectory()) {
+ throw new IllegalArgumentException("The configured home directory of this Hadoop instance (" + homeDir.getAbsolutePath() + ") is not a directory.");
+ }
+
+ if (!homeDir.canRead()) {
+ throw new IllegalArgumentException("The configured home directory of this Hadoop instance (" + homeDir.getAbsolutePath() + ") is not readable.");
+ }
+
+ fillResourceConfiguration(homeDir, config, definition);
+
+ return config;
+ }
+
+
+ public void updateResourceConfiguration(ConfigurationUpdateReport report) {
+ // TODO Auto-generated method stub
+
+ }
+
/**
* Invokes the passed operation on the managed resource
* @param name Name of the operation
@@ -106,5 +157,89 @@ public class HadoopServiceComponent extends JMXServerComponent<ResourceComponent
}
return res;
}
-
+
+ public static void fillResourceConfiguration(File homeDir, Configuration config, ConfigurationDefinition definition) throws XMLStreamException, IOException {
+ //the config is just a bunch of simples, so this is rather easy.. no cumbersome traversal of property maps and lists
+
+ Map<String, PropertySimple> propertiesToFind = new HashMap<String, PropertySimple>();
+ Set<File> configFilesToParse = new HashSet<File>();
+
+ for(PropertyDefinition pd : definition.getPropertyDefinitions().values()) {
+ if (!(pd instanceof PropertyDefinitionSimple)) {
+ //hmm... well, someone thought it's enough to change the config and the code would be clever.
+ //it's not ;)
+ continue;
+ }
+
+ String propertyName = pd.getName();
+ String[] parts = propertyName.split(":");
+ String fileName = parts[0];
+ String configName = parts[1];
+
+ File configFile = new File(homeDir, fileName);
+
+ if (!configFile.exists()) {
+ throw new IllegalArgumentException("The expected configuration file (" + configFile.getAbsolutePath() + ") doesn't exist.");
+ }
+
+ configFilesToParse.add(configFile);
+
+ PropertySimple prop = new PropertySimple();
+ prop.setName(propertyName);
+ config.put(prop);
+
+ propertiesToFind.put(configName, prop);
+ }
+
+ for(File configFile : configFilesToParse) {
+ parseAndAssignProps(configFile, propertiesToFind);
+ }
+ }
+
+ private static void parseAndAssignProps(File configFile, Map<String, PropertySimple> props) throws XMLStreamException, IOException {
+ FileInputStream in = new FileInputStream(configFile);
+ XMLStreamReader rdr = XML_INPUT_FACTORY.createXMLStreamReader(in);
+ try {
+ boolean inProperty = false;
+ String propertyName = null;
+ String propertyValue = null;
+
+ while(rdr.hasNext()) {
+ int event = rdr.next();
+
+ String tag = null;
+
+ switch(event) {
+ case XMLStreamReader.START_ELEMENT:
+ tag = rdr.getName().getLocalPart();
+ if (PROPERTY_TAG_NAME.equals(tag)) {
+ inProperty = true;
+ } else if (inProperty && NAME_TAG_NAME.equals(tag)) {
+ propertyName = rdr.getElementText();
+ } else if (inProperty && VALUE_TAG_NAME.equals(tag)) {
+ propertyValue = rdr.getElementText();
+ }
+ break;
+ case XMLStreamReader.END_ELEMENT:
+ tag = rdr.getName().getLocalPart();
+ if (PROPERTY_TAG_NAME.equals(tag)) {
+ inProperty = false;
+
+ PropertySimple prop = props.get(propertyName);
+ if (prop != null) {
+ prop.setValue(propertyValue);
+ }
+
+ propertyName = null;
+ propertyValue = null;
+ }
+ break;
+ }
+ }
+ } finally {
+ rdr.close();
+ in.close();
+ }
+ }
+
}
diff --git a/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceDiscovery.java b/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceDiscovery.java
index 7b75931..e292168 100644
--- a/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceDiscovery.java
+++ b/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceDiscovery.java
@@ -52,7 +52,7 @@ public class HadoopServiceDiscovery implements ResourceDiscoveryComponent<Resour
private static final String HADOOP_VERSION_MATCH = "hadoop-core-([0-9\\.]+)\\.jar";
private static final Pattern HADOOP_VERSION_PATTERN = Pattern.compile(HADOOP_VERSION_MATCH);
private static final String MAIN_CLASS_PROPERTY = "_mainClass";
- private static final String HOME_DIR_PROPERTY = "hadoop.home.dir";
+ public static final String HOME_DIR_PROPERTY = "hadoop.home.dir";
private static final String HOME_DIR_OPTION = "-Dhadoop.home.dir";
public Set<DiscoveredResourceDetails> discoverResources(
diff --git a/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml
index 334fcf5..cd22c2d 100644
--- a/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/hadoop/src/main/resources/META-INF/rhq-plugin.xml
@@ -7,7 +7,7 @@
<!-- NameNode (http://wiki.apache.org/hadoop/NameNode) -->
<server name="NameNode" discovery="HadoopServiceDiscovery" class="HadoopServiceComponent">
<plugin-configuration>
- <c:simple-property name="hadoop.home.dir" displayName="Home Directory" readOnly="true" />
+ <c:simple-property name="hadoop.home.dir" displayName="Home Directory" />
<c:simple-property name="_mainClass" displayName="Main Class" readOnly="true" default="org.apache.hadoop.hdfs.server.namenode.NameNode" />
</plugin-configuration>
commit a0060b11bf90aa65423060daf1bdeb34098dc1ca
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Tue Jul 31 16:20:43 2012 +0200
try to read the hadoop home dir from the commandline if it is there,
otherwise fall back to the CWD of its process.
diff --git a/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceDiscovery.java b/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceDiscovery.java
index f010976..7b75931 100644
--- a/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceDiscovery.java
+++ b/modules/plugins/hadoop/src/main/java/org/rhq/plugins/hadoop/HadoopServiceDiscovery.java
@@ -52,7 +52,9 @@ public class HadoopServiceDiscovery implements ResourceDiscoveryComponent<Resour
private static final String HADOOP_VERSION_MATCH = "hadoop-core-([0-9\\.]+)\\.jar";
private static final Pattern HADOOP_VERSION_PATTERN = Pattern.compile(HADOOP_VERSION_MATCH);
private static final String MAIN_CLASS_PROPERTY = "_mainClass";
-
+ private static final String HOME_DIR_PROPERTY = "hadoop.home.dir";
+ private static final String HOME_DIR_OPTION = "-Dhadoop.home.dir";
+
public Set<DiscoveredResourceDetails> discoverResources(
ResourceDiscoveryContext<ResourceComponent<?>> resourceDiscoveryContext)
throws InvalidPluginConfigurationException, Exception {
@@ -72,6 +74,9 @@ public class HadoopServiceDiscovery implements ResourceDiscoveryComponent<Resour
String version = getVersion(cwd);
Configuration pluginConfiguration = resourceDiscoveryContext.getDefaultPluginConfiguration();
+
+ //TODO is it ok to base the resource key on the current working directory as opposed to
+ //the configured hadoop.home.dir? How do they differ?
DiscoveredResourceDetails detail = new DiscoveredResourceDetails(resourceType, // ResourceType
rtName + ":" + cwd, // ResourceKey
rtName, // resource name
@@ -89,7 +94,14 @@ public class HadoopServiceDiscovery implements ResourceDiscoveryComponent<Resour
pluginConfiguration.getSimpleValue(MAIN_CLASS_PROPERTY, null)));
pluginConfiguration.put(new PropertySimple(JMXDiscoveryComponent.CONNECTION_TYPE,
LocalVMTypeDescriptor.class.getName()));
-
+
+ String homeDir = getHadoopHomeDirIfAvailable(psr.getProcessInfo().getCommandLine());
+ if (homeDir == null) {
+ homeDir = cwd;
+ }
+
+ pluginConfiguration.put(new PropertySimple(HOME_DIR_PROPERTY, homeDir));
+
log.debug("Discovered " + detail);
details.add(detail);
@@ -130,4 +142,17 @@ public class HadoopServiceDiscovery implements ResourceDiscoveryComponent<Resour
}
}
+ private String getHadoopHomeDirIfAvailable(String[] cmdline) {
+ for(int i = 0; i < cmdline.length; ++i) {
+ String cmd = cmdline[i];
+ if (cmd.startsWith(HOME_DIR_OPTION)) {
+ int eqPos = cmd.indexOf('=');
+ if (eqPos > 0) {
+ return cmd.substring(eqPos + 1);
+ }
+ }
+ }
+
+ return null;
+ }
}
11 years, 4 months