modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
| 13 +++++----
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
| 8 +++--
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
| 14 +++++++++-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
| 8 +++++
4 files changed, 32 insertions(+), 11 deletions(-)
New commits:
commit f335fb5f32f81f10cbbf984669e87ecdfe7f9067
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Nov 4 14:25:26 2011 +0100
BZ 751065 better detect the version and mark EAP servers as such.
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
index bbf3304..2b1e9aa 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/AbstractBaseDiscovery.java
@@ -47,7 +47,7 @@ public abstract class AbstractBaseDiscovery<T extends
ResourceComponent<?>> impl
private static final String JBOSS_AS_PREFIX = "jboss-as-";
protected Document hostXml;
protected final Log log = LogFactory.getLog(this.getClass());
-
+ private static final String JBOSS_EAP_PREFIX = "jboss-eap-";
/**
* Read the host.xml or standalone.xml file depending on isDomainMode. If
isDomainMode is true,
@@ -68,7 +68,7 @@ public abstract class AbstractBaseDiscovery<T extends
ResourceComponent<?>> impl
is.close();
}
} catch (Exception e) {
- e.printStackTrace(); // TODO: Customise this generated block
+ log.error(e.getMessage());
}
}
@@ -314,8 +314,10 @@ public abstract class AbstractBaseDiscovery<T extends
ResourceComponent<?>> impl
protected String determineServerVersionFromHomeDir(String homeDir) {
String version;
String tmp = homeDir.substring(homeDir.lastIndexOf("/")+1);
- if (tmp.startsWith("jboss-as-")) {
+ if (tmp.startsWith(JBOSS_AS_PREFIX)) {
version = tmp.substring(JBOSS_AS_PREFIX.length());
+ } else if (tmp.startsWith(JBOSS_EAP_PREFIX)) {
+ version = tmp.substring(JBOSS_EAP_PREFIX.length());
} else {
version = homeDir.substring(homeDir.lastIndexOf("-") + 1);
}
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
index 037c40e..2a2013f 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseProcessDiscovery.java
@@ -74,12 +74,18 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery
implements Resou
String psName = psr.getProcessScan().getName();
String description = discoveryContext.getResourceType().getDescription();
String homeDir = getHomeDirFromCommandLine(commandLine);
- String version = null;
+ String version = determineServerVersionFromHomeDir(homeDir);
+ boolean isEAP = false;
//retrieve specific boot log file. Override for Standalone as server.log is
more appropriate
String bootLogFile = getLogFileFromCommandLine(commandLine);
String logFile = bootLogFile;
+ if (homeDir.contains("eap")) {
+ isEAP=true;
+ version="EAP " + version;
+ }
+
if (psName.equals("HostController")) {
readStandaloneOrHostXml(psr.getProcessInfo(), true);
@@ -109,6 +115,8 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery
implements Resou
} else { // Standalone server
serverNameFull = homeDir;
+
+
readStandaloneOrHostXml(psr.getProcessInfo(), false);
if ( serverNameFull.isEmpty()) {
// Try to obtain the server name
@@ -141,6 +149,10 @@ public class BaseProcessDiscovery extends AbstractBaseDiscovery
implements Resou
logFile = bootLogFile.substring(0,
bootLogFile.lastIndexOf("/")) + File.separator + "server.log";
}
+ if (isEAP) {
+ description=description.replace("AS7","EAP6");
+ }
+
initLogEventSourcesConfigProp(logFile, config);
HostPort managmentPort = getManagementPortFromHostXml(commandLine);
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
index c8cdba8..6421035 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ManagedASDiscovery.java
@@ -105,12 +105,18 @@ public class ManagedASDiscovery extends AbstractBaseDiscovery
initLogFile(scans, serverInfo.name, config, homeDir);
String version = determineServerVersionFromHomeDir(homeDir);
+ String resourceDescription = "Managed AS7 instance";
+
+ if (homeDir.contains("eap")) {
+ version = "EAP " + version;
+ resourceDescription =
resourceDescription.replace("AS7","EAP6");
+ }
DiscoveredResourceDetails detail = new
DiscoveredResourceDetails(discoveryContext.getResourceType(), // ResourceType
hostName + "/" + serverInfo.name, // key
serverInfo.name, // Name
version, // TODO get from Domain as soon as it is provided
- "Managed AS 7 instance", // Description
+ resourceDescription, // Description
config, null);
// Add to return values
commit d1e85ac2ef91f4578861f139bbc248603fea782e
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Nov 4 12:08:35 2011 +0100
BZ 751027 Skip tests if not on a RH flavor of Linux
diff --git
a/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
b/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
index 1df24d6..0240f72 100644
--- a/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
+++ b/modules/common/ant-bundle/src/test/java/org/rhq/bundle/ant/AntLauncherTest.java
@@ -59,6 +59,7 @@ import org.rhq.core.util.updater.FileHashcodeMap;
public class AntLauncherTest {
private static final File DEPLOY_DIR = new
File("target/test-ant-bundle").getAbsoluteFile();
private static final String ANT_BASEDIR = "target/test-classes";
+ private static final File REDHAT_RELEASE_FILE = new
File("/etc/redhat-release");
private int deploymentId;
@@ -107,7 +108,7 @@ public class AntLauncherTest {
public void testInstall() throws Exception {
- if (skipNonLinux("testInstall")) return;
+ if (skipNonRHLinux("testInstall")) return;
// We want to test a fresh install, so make sure the deploy dir doesn't
pre-exist.
FileUtil.purge(DEPLOY_DIR, true);
@@ -163,9 +164,9 @@ public class AntLauncherTest {
"templatized.variable").equals("10000");
}
- private boolean skipNonLinux(String meth) {
- if (!System.getProperty("os.name").equals("Linux")) {
- System.out.println("Skipping " + meth + "() as this only works
on Linux");
+ private boolean skipNonRHLinux(String meth) {
+ if (!System.getProperty("os.name").equals("Linux") ||
!REDHAT_RELEASE_FILE.exists()) {
+ System.out.println("Skipping " + meth + "() as this only works
on Red Hat Linux flavors");
return true;
}
return false;
@@ -174,7 +175,7 @@ public class AntLauncherTest {
@Test(dependsOnMethods = "testInstall")
public void testUpgrade() throws Exception {
- if (skipNonLinux("testUpgrade")) return;
+ if (skipNonRHLinux("testUpgrade")) return;
// We want to test an upgrade, so do *not* wipe out the deploy dir - our test
method @dependsOnMethods testInstall
// but we do want to add an unrelated file to see that it gets deleted as part of
the upgrade
@@ -230,7 +231,7 @@ public class AntLauncherTest {
public void testUpgradeNoManageRootDir() throws Exception {
- if (skipNonLinux("testInstall")) return;
+ if (skipNonRHLinux("testInstall")) return;
// We want to test an upgrade, so do *not* wipe out the deploy dir - let's
re-invoke testInstall
// to get us to an initial state of the v1 bundle installed