Skip to content
This repository has been archived by the owner on Jul 11, 2022. It is now read-only.

Commit

Permalink
Bug 908795 - [RFE] The JMX plugin should be able to use JBoss Remotin…
Browse files Browse the repository at this point in the history
…g 3 to connect to EAP6 using JSR-160 remoting

Added new connection metadata (ConnectionTypeDescriptor classes) for:
* AS7 and EAP6.0
* EAP6.1 and above
* Wildfly 8

Added new connection templates for JMX server manual process

Refactored JMX plugin itests

Added itests for AS7 and Wildfly 8 in standalone mode
-> Added the Maven plugins for AS7 and Wildfly 8 in order to start standalone servers
-> add-user script is through an ANT tasks to support both UNIX-like systems and Windows systems
  • Loading branch information
tsegismont committed Jul 31, 2014
1 parent 672fa50 commit 73e9bb5
Show file tree
Hide file tree
Showing 12 changed files with 972 additions and 335 deletions.
41 changes: 41 additions & 0 deletions modules/plugins/jmx/add-user.xml
@@ -0,0 +1,41 @@
<?xml version="1.0" encoding="UTF-8" ?>

<project name="add-user" default="main">

<target name="main">

<exec osfamily="unix" executable="bash" dir="${rhq.jmxplugin.as7.standalone.home}/bin">
<arg value="add-user.sh"/>
<arg value="--silent=true"/>
<arg value="rhqadmin"/>
<arg value="rhqadmin_1"/>
</exec>

<exec osfamily="unix" executable="bash" dir="${rhq.jmxplugin.wildfly8.standalone.home}/bin">
<arg value="add-user.sh"/>
<arg value="--silent=true"/>
<arg value="rhqadmin"/>
<arg value="rhqadmin_1"/>
</exec>

<exec osfamily="windows" executable="cmd" dir="${rhq.jmxplugin.as7.standalone.home}\bin">
<arg value="/C"/>
<arg value="start"/>
<arg value="add-user.bat"/>
<arg value="--silent=true"/>
<arg value="rhqadmin"/>
<arg value="rhqadmin_1"/>
</exec>

<exec osfamily="windows" executable="cmd" dir="${rhq.jmxplugin.wildfly8.standalone.home}\bin">
<arg value="/C"/>
<arg value="start"/>
<arg value="add-user.bat"/>
<arg value="--silent=true"/>
<arg value="rhqadmin"/>
<arg value="rhqadmin_1"/>
</exec>

</target>

</project>
121 changes: 118 additions & 3 deletions modules/plugins/jmx/pom.xml
Expand Up @@ -17,8 +17,18 @@

<properties>
<rhq.internal>false</rhq.internal>
<rhq.jmxplugin.as7.artifact>org.jboss.as:jboss-as-dist:7.1.1.Final</rhq.jmxplugin.as7.artifact>
<rhq.jmxplugin.as7.standalone.portOffset>37897</rhq.jmxplugin.as7.standalone.portOffset>
<!-- IMPORTANT: The management port must be the port offset + 9999. -->
<rhq.jmxplugin.as7.standalone.management.port>47896</rhq.jmxplugin.as7.standalone.management.port>
<rhq.jmxplugin.as7.standalone.home>${project.build.directory}/jboss-as-run/jboss-as-7.1.1.Final</rhq.jmxplugin.as7.standalone.home>
<rhq.jmxplugin.wildfly8.artifact>org.wildfly:wildfly-dist:8.1.0.Final</rhq.jmxplugin.wildfly8.artifact>
<rhq.jmxplugin.wildfly8.standalone.portOffset>47897</rhq.jmxplugin.wildfly8.standalone.portOffset>
<!-- IMPORTANT: The management port must be the port offset + 9990. -->
<rhq.jmxplugin.wildfly8.standalone.management.port>57887</rhq.jmxplugin.wildfly8.standalone.management.port>
<rhq.jmxplugin.wildfly8.standalone.home>${project.build.directory}/wildfly-run/wildfly-8.1.0.Final</rhq.jmxplugin.wildfly8.standalone.home>
</properties>

<dependencies>

<dependency>
Expand All @@ -37,6 +47,14 @@
<systemPath>${jdkToolsJar}</systemPath>
</dependency>

<!-- Test dependencies -->

<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
<scope>test</scope>
</dependency>

</dependencies>

<build>
Expand Down Expand Up @@ -76,7 +94,7 @@
<exists>${java.home}/../lib/tools.jar</exists>
</file>
</activation>
<properties>
<properties>
<jdkToolsJar>${java.home}/../lib/tools.jar</jdkToolsJar>
</properties>
</profile>
Expand All @@ -88,7 +106,7 @@
<exists>${java.home}/../Classes/classes.jar</exists>
</file>
</activation>
<properties>
<properties>
<jdkToolsJar>${java.home}/../Classes/classes.jar</jdkToolsJar>
</properties>
</profile>
Expand All @@ -110,6 +128,12 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skip>true</skip>
<properties>
<property>
<name>listener</name>
<value>org.rhq.test.testng.StdoutReporter</value>
</property>
</properties>
</configuration>
<executions>
<execution>
Expand All @@ -133,12 +157,91 @@
<name>project.version</name>
<value>${project.version}</value>
</property>
<property>
<name>rhq.jmxplugin.as7.standalone.management.port</name>
<value>${rhq.jmxplugin.as7.standalone.management.port}</value>
</property>
<property>
<name>rhq.jmxplugin.as7.standalone.home</name>
<value>${rhq.jmxplugin.as7.standalone.home}</value>
</property>
<property>
<name>rhq.jmxplugin.wildfly8.standalone.management.port</name>
<value>${rhq.jmxplugin.wildfly8.standalone.management.port}</value>
</property>
<property>
<name>rhq.jmxplugin.wildfly8.standalone.home</name>
<value>${rhq.jmxplugin.wildfly8.standalone.home}</value>
</property>
</systemProperties>
</configuration>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
<version>7.5.Final</version>
<configuration>
<artifact>${rhq.jmxplugin.as7.artifact}</artifact>
<jvmArgs>
-Xms64m -Xmx128m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true
-Dorg.jboss.resolver.warning=true -Dsun.rmi.dgc.client.gcInterval=3600000
-Dsun.rmi.dgc.server.gcInterval=3600000
-Djboss.socket.binding.port-offset=${rhq.jmxplugin.as7.standalone.portOffset}
</jvmArgs>
<port>${rhq.jmxplugin.as7.standalone.management.port}</port>
</configuration>
<executions>
<execution>
<id>start-as7-pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>shutdown-as7-post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<groupId>org.wildfly.plugins</groupId>
<artifactId>wildfly-maven-plugin</artifactId>
<version>1.0.2.Final</version>
<configuration>
<artifact>${rhq.jmxplugin.wildfly8.artifact}</artifact>
<jvmArgs>
-Xms64m -Xmx128m -XX:MaxPermSize=256m -Djava.net.preferIPv4Stack=true
-Dsun.rmi.dgc.client.gcInterval=3600000 -Dsun.rmi.dgc.server.gcInterval=3600000
-Djboss.socket.binding.port-offset=${rhq.jmxplugin.wildfly8.standalone.portOffset}
</jvmArgs>
<port>${rhq.jmxplugin.wildfly8.standalone.management.port}</port>
</configuration>
<executions>
<execution>
<id>start-wfly8-pre-integration-test</id>
<phase>pre-integration-test</phase>
<goals>
<goal>start</goal>
</goals>
</execution>
<execution>
<id>shutdown-wfly8-post-integration-test</id>
<phase>post-integration-test</phase>
<goals>
<goal>shutdown</goal>
</goals>
</execution>
</executions>
</plugin>

<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
Expand Down Expand Up @@ -182,6 +285,18 @@
<goal>run</goal>
</goals>
</execution>
<execution>
<id>install-as7-mgmt-user-pre-integration-test</id>
<phase>pre-integration-test</phase>
<configuration>
<tasks>
<ant antfile="add-user.xml"/>
</tasks>
</configuration>
<goals>
<goal>run</goal>
</goals>
</execution>
</executions>
</plugin>

Expand Down
@@ -0,0 +1,62 @@
/*
* RHQ Management Platform
* Copyright (C) 2005-2014 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/

package org.rhq.plugins.jmx.connection.metadata;

import java.util.Properties;

import org.mc4j.ems.connection.ConnectionFactory;
import org.mc4j.ems.connection.support.metadata.JSR160ConnectionTypeDescriptor;

/**
* @author Thomas Segismont
*/
public class AS7ConnectionTypeDescriptor extends JSR160ConnectionTypeDescriptor {
@Override
public String getConnectionType() {
return "AS7";
}

@Override
public String getDisplayName() {
return "JBoss AS7 and Red Hat JBoss EAP6 connection type";
}

@Override
public String getDefaultServerUrl() {
return "service:jmx:remoting-jmx://localhost:9999";
}

@Override
public String[] getConnectionClasspathEntries() {
return new String[] { "bin/client/jboss-client.jar" };
}

@Override
public boolean isUseChildFirstClassLoader() {
return true;
}

@Override
public Properties getDefaultAdvancedProperties() {
Properties properties = super.getDefaultAdvancedProperties();
properties.put(ConnectionFactory.USE_CONTEXT_CLASSLOADER, Boolean.FALSE.toString());
return properties;
}
}
@@ -0,0 +1,62 @@
/*
* RHQ Management Platform
* Copyright (C) 2005-2014 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation version 2 of the License.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/

package org.rhq.plugins.jmx.connection.metadata;

import java.util.Properties;

import org.mc4j.ems.connection.ConnectionFactory;
import org.mc4j.ems.connection.support.metadata.JSR160ConnectionTypeDescriptor;

/**
* @author Thomas Segismont
*/
public class EAP61ConnectionTypeDescriptor extends JSR160ConnectionTypeDescriptor {
@Override
public String getConnectionType() {
return "EAP6.1+";
}

@Override
public String getDisplayName() {
return "Red Hat JBoss EAP6.1 and above connection type";
}

@Override
public String getDefaultServerUrl() {
return "service:jmx:remoting-jmx://localhost:9999";
}

@Override
public String[] getConnectionClasspathEntries() {
return new String[] { "bin/client/jboss-cli-client.jar" };
}

@Override
public boolean isUseChildFirstClassLoader() {
return true;
}

@Override
public Properties getDefaultAdvancedProperties() {
Properties properties = super.getDefaultAdvancedProperties();
properties.put(ConnectionFactory.USE_CONTEXT_CLASSLOADER, Boolean.FALSE.toString());
return properties;
}
}

0 comments on commit 73e9bb5

Please sign in to comment.