modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
| 7
modules/enterprise/scripting/javascript/pom.xml
| 6
modules/enterprise/scripting/python/pom.xml
| 6
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java
| 9
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
| 137 +++++++---
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/PortScout.java
| 69 +++++
modules/integration-tests/apache-plugin-test/src/test/resources/log4j.xml
| 2
modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/includes/inventory-without-snmp.xml
| 2
modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/mess/inventory-without-snmp.xml
| 2
modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/nested/inventory-without-snmp.xml
| 2
modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/simple/inventory-without-snmp.xml
| 2
modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/includes/inventory-without-snmp.xml
| 2
modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/mess/inventory-without-snmp.xml
| 2
modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/nested/inventory-without-snmp.xml
| 2
modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/simple/inventory-without-snmp.xml
| 2
modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
| 22 +
16 files changed, 217 insertions(+), 57 deletions(-)
New commits:
commit 844f016ee8b2608496d063c94f38461e997bcabe
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Nov 23 17:18:35 2012 +0100
[BZ 879655] - Properly deactivate the resource instead of just calling the
component's stop() method when forcing reactivation of a started component.
This will ensure the PC can't enter an inconsistent state in the case the
stop() method fails.
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 b3f7fa9..473b0d0 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
@@ -1614,7 +1614,10 @@ public class InventoryManager extends AgentService implements
ContainerService,
if (forceReinitialization) {
switch (state) {
case STARTED:
- component.stop();
+ if (log.isDebugEnabled()) {
+ log.debug("Forcing re-initialization of an already started
resource: " + resource);
+ }
+ deactivateResource(resource);
break;
case STARTING:
log.warn("Could not force initialization of component for
resource [" + resource.getId()
@@ -2037,7 +2040,7 @@ public class InventoryManager extends AgentService implements
ContainerService,
log.debug("Successfully deactivated resource with id ["
+ resource.getId() + "].");
}
} catch (Throwable t) {
- log.warn("Plugin Error: Failed to stop component for [" +
resource + "].");
+ log.warn("Plugin Error: Failed to stop component for [" +
resource + "].", t);
}
container.setResourceComponentState(ResourceComponentState.STOPPED);
commit 16f04c50bd9cffaed77c73338d5f31ffb0f9c451
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Nov 23 17:12:43 2012 +0100
Improvements in Apache integration tests:
* improved logging
* randomization of used ports
* *WithoutSNMP tests don't use SNMP even after upgrade (makes the behavior more
understandable)
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java
index 8f8cdb6..aebea53 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java
+++
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java
@@ -102,9 +102,6 @@ public class UpgradeTestBase extends PluginContainerTest {
boolean testFailed = false;
try {
- LOG.debug("----------------------------------------------------------
Starting the upgrade test for: "
- + testId);
-
String[] configFiles =
Arrays.copyOf(testConfiguration.apacheConfigurationFiles,
testConfiguration.apacheConfigurationFiles.length + 1);
configFiles[testConfiguration.apacheConfigurationFiles.length] =
"/snmpd.conf";
@@ -114,7 +111,11 @@ public class UpgradeTestBase extends PluginContainerTest {
.withServerRoot(testConfiguration.serverRoot).withExePath(testConfiguration.binPath);
testConfiguration.beforeTestSetup(setup);
-
+
+ LOG.debug("----------------------------------------------------------
Starting the upgrade test for: "
+ + testId);
+ LOG.debug("Deployment configuration: " +
setup.getDeploymentConfig());
+
setup.setup();
testConfiguration.beforePluginContainerStart(setup);
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
index bc80898..02be42c 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
+++
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
@@ -19,7 +19,6 @@
package org.rhq.plugins.apache.util;
-import java.io.BufferedReader;
import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
@@ -33,7 +32,6 @@ import java.net.UnknownHostException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
-import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
import java.util.Map;
@@ -198,10 +196,40 @@ public class ApacheDeploymentUtil {
tokenReplacements.put(LISTEN4, address4 == null ? "" :
address4.toString(false, false));
}
}
+
+ @Override
+ public String toString() {
+ StringBuilder bld = new StringBuilder("VHost[");
+ if (address1 != null) {
+ bld.append(address1.toString()).append(", ");
+ }
+ if (address2 != null) {
+ bld.append(address2.toString()).append(", ");
+ }
+ if (address3 != null) {
+ bld.append(address3.toString()).append(", ");
+ }
+ if (address4 != null) {
+ bld.append(address4.toString()).append(", ");
+ }
+
+ String serverName = getServerName();
+ if (serverName != null) {
+ bld.append("serverName=").append(serverName).append(",
");
+ }
+
+ if (additionalDirectives != null) {
+ bld.append("with additional directives, ");
+ }
+
+ bld.replace(bld.length() - 2, bld.length(), "]");
+
+ return bld.toString();
+ }
}
public String serverRoot = null;
- public String documentRoot = "hdocs";
+ public String documentRoot = "htdocs";
public String snmpHost = "localhost";
public int snmpPort = 1610;
public final VHost mainServer = new VHost();
@@ -242,48 +270,69 @@ public class ApacheDeploymentUtil {
default: throw new IllegalArgumentException();
}
}
+
+ @Override
+ public String toString() {
+ return new
StringBuilder("DeploymentConfig[").append("mainServer=").append(mainServer).append(",
vhost1=")
+ .append(vhost1).append(",
vhost2=").append(vhost2).append(", vhost3=").append(vhost3)
+ .append(", vhost4=").append(vhost4).append(",
serverRoot=").append(serverRoot)
+ .append(", documentRoot=").append(documentRoot).append(",
snmpHost=").append(snmpHost)
+ .append(",
snmpPort=").append(snmpPort).append("]").toString();
+ }
}
public static void addDefaultVariables(Map<String, String> variables, String
prefix) {
InetAddress localhost = determineLocalhost();
- checkOrAddDefault(variables, "localhost", localhost.getHostName());
- checkOrAddDefault(variables, "localhost.ip",
localhost.getHostAddress());
- checkOrAddDefault(variables, "unresolvable.host",
"unreachable.host.com");
- checkOrAddDefault(variables, "port1", "11675");
- checkOrAddDefault(variables, "port2", "11676");
- checkOrAddDefault(variables, "port3", "11677");
- checkOrAddDefault(variables, "port4", "11678");
-
- if (prefix != null && !prefix.trim().isEmpty()) {
- prefix += ".";
- } else {
- prefix = "";
+ PortScout portScout = new PortScout();
+ try {
+ checkOrAddDefault(variables, "localhost",
localhost.getHostName());
+ checkOrAddDefault(variables, "localhost.ip",
localhost.getHostAddress());
+ checkOrAddDefault(variables, "unresolvable.host",
"unreachable.host.com");
+
+ checkOrAddDefault(variables, "port1",
getRandomFreePort(portScout));
+ checkOrAddDefault(variables, "port2",
getRandomFreePort(portScout));
+ checkOrAddDefault(variables, "port3",
getRandomFreePort(portScout));
+ checkOrAddDefault(variables, "port4",
getRandomFreePort(portScout));
+
+ if (prefix != null && !prefix.trim().isEmpty()) {
+ prefix += ".";
+ } else {
+ prefix = "";
+ }
+
+ checkOrAddDefault(variables, prefix + "snmp.port",
getRandomFreePort(portScout));
+
+ checkOrAddDefault(variables, prefix + "listen1",
"${port1}");
+ checkOrAddDefault(variables, prefix + "listen2",
"${port2}");
+ checkOrAddDefault(variables, prefix + "listen3",
"${port3}");
+ checkOrAddDefault(variables, prefix + "listen4",
"${port4}");
+
+ checkOrAddDefault(variables, prefix + "vhost1.servername",
"${localhost}:${port1}");
+ checkOrAddDefault(variables, prefix + "vhost1.urls", "${"
+ prefix + "vhost1.servername}");
+ checkOrAddDefault(variables, prefix +
"vhost1.servername.directive", "ServerName ${" + prefix
+ + "vhost1.servername}");
+
+ checkOrAddDefault(variables, prefix + "vhost2.servername",
"${localhost}:${port2}");
+ checkOrAddDefault(variables, prefix + "vhost2.urls", "${"
+ prefix + "vhost2.servername}");
+ checkOrAddDefault(variables, prefix +
"vhost2.servername.directive", "ServerName ${" + prefix
+ + "vhost2.servername}");
+
+ checkOrAddDefault(variables, prefix + "vhost3.servername",
"${localhost}:${port3}");
+ checkOrAddDefault(variables, prefix + "vhost3.urls", "${"
+ prefix + "vhost3.servername}");
+ checkOrAddDefault(variables, prefix +
"vhost3.servername.directive", "ServerName ${" + prefix
+ + "vhost3.servername}");
+
+ checkOrAddDefault(variables, prefix + "vhost4.servername",
"${localhost}:${port4}");
+ checkOrAddDefault(variables, prefix + "vhost4.urls", "${"
+ prefix + "vhost4.servername}");
+ checkOrAddDefault(variables, prefix +
"vhost4.servername.directive", "ServerName ${" + prefix
+ + "vhost4.servername}");
+ } finally {
+ try {
+ portScout.close();
+ } catch (IOException e) {
+ throw new IllegalStateException(e);
+ }
}
-
- checkOrAddDefault(variables, prefix + "listen1",
"${port1}");
- checkOrAddDefault(variables, prefix + "listen2",
"${port2}");
- checkOrAddDefault(variables, prefix + "listen3",
"${port3}");
- checkOrAddDefault(variables, prefix + "listen4",
"${port4}");
-
- checkOrAddDefault(variables, prefix + "vhost1.servername",
"${localhost}:${port1}");
- checkOrAddDefault(variables, prefix + "vhost1.urls", "${" +
prefix + "vhost1.servername}");
- checkOrAddDefault(variables, prefix + "vhost1.servername.directive",
"ServerName ${" + prefix
- + "vhost1.servername}");
-
- checkOrAddDefault(variables, prefix + "vhost2.servername",
"${localhost}:${port2}");
- checkOrAddDefault(variables, prefix + "vhost2.urls", "${" +
prefix + "vhost2.servername}");
- checkOrAddDefault(variables, prefix + "vhost2.servername.directive",
"ServerName ${" + prefix
- + "vhost2.servername}");
-
- checkOrAddDefault(variables, prefix + "vhost3.servername",
"${localhost}:${port3}");
- checkOrAddDefault(variables, prefix + "vhost3.urls", "${" +
prefix + "vhost3.servername}");
- checkOrAddDefault(variables, prefix + "vhost3.servername.directive",
"ServerName ${" + prefix
- + "vhost3.servername}");
-
- checkOrAddDefault(variables, prefix + "vhost4.servername",
"${localhost}:${port4}");
- checkOrAddDefault(variables, prefix + "vhost4.urls", "${" +
prefix + "vhost4.servername}");
- checkOrAddDefault(variables, prefix + "vhost4.servername.directive",
"ServerName ${" + prefix
- + "vhost4.servername}");
}
private static void checkOrAddDefault(Map<String, String> map, String key,
String value) {
@@ -433,4 +482,12 @@ public class ApacheDeploymentUtil {
}
}
};
+
+ private static String getRandomFreePort(PortScout scout) throws IllegalStateException
{
+ try {
+ return Integer.toString(scout.getNextFreePort());
+ } catch (IOException e) {
+ throw new IllegalStateException("Failed to find a free port.", e);
+ }
+ }
}
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/PortScout.java
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/PortScout.java
new file mode 100644
index 0000000..3a33f09
--- /dev/null
+++
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/PortScout.java
@@ -0,0 +1,69 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2012, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.plugins.apache.util;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.net.ServerSocket;
+import java.net.SocketAddress;
+import java.util.HashSet;
+import java.util.Set;
+
+/**
+ * Tries to find a series of free ports.
+ *
+ * The ports remain open until the {@link #close()} method is called.
+ *
+ * @author Lukas Krejci
+ */
+public class PortScout implements Closeable {
+
+ private Set<ServerSocket> activeSockets = new HashSet<ServerSocket>();
+
+ public int getNextFreePort() throws IOException {
+ ServerSocket s = new ServerSocket(0);
+ activeSockets.add(s);
+ return s.getLocalPort();
+ }
+
+ @Override
+ public void close() throws IOException {
+ String message = null;
+ for(ServerSocket s : activeSockets) {
+ SocketAddress addr = s.getLocalSocketAddress();
+ try {
+ s.close();
+ } catch (IOException e) {
+ if (message == null) {
+ message = "The following test sockets failed to close while
looking for free ports:\n";
+ }
+
+ message += addr.toString() + ": " + e.getMessage() +
",\n";
+ }
+ }
+
+ if (message != null) {
+ message = message.substring(0, message.length() - 2);
+
+ throw new IOException(message);
+ }
+ }
+}
diff --git a/modules/integration-tests/apache-plugin-test/src/test/resources/log4j.xml
b/modules/integration-tests/apache-plugin-test/src/test/resources/log4j.xml
index 008588f..70151b7 100644
--- a/modules/integration-tests/apache-plugin-test/src/test/resources/log4j.xml
+++ b/modules/integration-tests/apache-plugin-test/src/test/resources/log4j.xml
@@ -19,7 +19,7 @@
<param name="MaxBackupIndex" value="1000" />
<param name="MaxFileSize" value="50MB" />
<layout class="org.apache.log4j.PatternLayout">
- <param name="ConversionPattern" value="%-5p %d{dd-MM
HH:mm:ss,SSS} (%F:%M:%L) -%m%n"/>
+ <param name="ConversionPattern" value="%-5p %d{dd-MM
HH:mm:ss,SSS} [%t] (%F:%M:%L) -%m%n"/>
</layout>
</appender>
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/includes/inventory-without-snmp.xml
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/includes/inventory-without-snmp.xml
index 32f6477..10530b5 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/includes/inventory-without-snmp.xml
+++
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/includes/inventory-without-snmp.xml
@@ -512,7 +512,7 @@
<propertySimple>
<id>10876</id>
<name>snmpAgentPort</name>
- <stringValue>1610</stringValue>
+ <stringValue>${port1}</stringValue> <!-- intentionally wrong
-->
</propertySimple>
<propertySimple>
<id>10877</id>
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/mess/inventory-without-snmp.xml
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/mess/inventory-without-snmp.xml
index d0dd8ac..cbb9d66 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/mess/inventory-without-snmp.xml
+++
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/mess/inventory-without-snmp.xml
@@ -284,7 +284,7 @@
<propertySimple>
<id>10876</id>
<name>snmpAgentPort</name>
- <stringValue>1610</stringValue>
+ <stringValue>${port1}</stringValue><!-- intentionally wrong
-->
</propertySimple>
<propertySimple>
<id>10877</id>
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/nested/inventory-without-snmp.xml
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/nested/inventory-without-snmp.xml
index d0dd8ac..1f97d99 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/nested/inventory-without-snmp.xml
+++
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/nested/inventory-without-snmp.xml
@@ -284,7 +284,7 @@
<propertySimple>
<id>10876</id>
<name>snmpAgentPort</name>
- <stringValue>1610</stringValue>
+ <stringValue>${port1}</stringValue> <!-- intentionally wrong
-->
</propertySimple>
<propertySimple>
<id>10877</id>
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/simple/inventory-without-snmp.xml
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/simple/inventory-without-snmp.xml
index 32f6477..10530b5 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/simple/inventory-without-snmp.xml
+++
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.0/simple/inventory-without-snmp.xml
@@ -512,7 +512,7 @@
<propertySimple>
<id>10876</id>
<name>snmpAgentPort</name>
- <stringValue>1610</stringValue>
+ <stringValue>${port1}</stringValue> <!-- intentionally wrong
-->
</propertySimple>
<propertySimple>
<id>10877</id>
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/includes/inventory-without-snmp.xml
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/includes/inventory-without-snmp.xml
index c3906be..987a9a0 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/includes/inventory-without-snmp.xml
+++
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/includes/inventory-without-snmp.xml
@@ -512,7 +512,7 @@
<propertySimple>
<id>10876</id>
<name>snmpAgentPort</name>
- <stringValue>1610</stringValue>
+ <stringValue>${port1}</stringValue> <!-- intentionally wrong
-->
</propertySimple>
<propertySimple>
<id>10877</id>
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/mess/inventory-without-snmp.xml
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/mess/inventory-without-snmp.xml
index 716773a..8557de3 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/mess/inventory-without-snmp.xml
+++
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/mess/inventory-without-snmp.xml
@@ -284,7 +284,7 @@
<propertySimple>
<id>10876</id>
<name>snmpAgentPort</name>
- <stringValue>1610</stringValue>
+ <stringValue>${port1}</stringValue> <!-- intentionally wrong
-->
</propertySimple>
<propertySimple>
<id>10877</id>
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/nested/inventory-without-snmp.xml
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/nested/inventory-without-snmp.xml
index 716773a..8557de3 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/nested/inventory-without-snmp.xml
+++
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/nested/inventory-without-snmp.xml
@@ -284,7 +284,7 @@
<propertySimple>
<id>10876</id>
<name>snmpAgentPort</name>
- <stringValue>1610</stringValue>
+ <stringValue>${port1}</stringValue> <!-- intentionally wrong
-->
</propertySimple>
<propertySimple>
<id>10877</id>
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/simple/inventory-without-snmp.xml
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/simple/inventory-without-snmp.xml
index c3906be..987a9a0 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/simple/inventory-without-snmp.xml
+++
b/modules/integration-tests/apache-plugin-test/src/test/resources/mocked-inventories/rhq-3.0.1/simple/inventory-without-snmp.xml
@@ -512,7 +512,7 @@
<propertySimple>
<id>10876</id>
<name>snmpAgentPort</name>
- <stringValue>1610</stringValue>
+ <stringValue>${port1}</stringValue> <!-- intentionally wrong
-->
</propertySimple>
<propertySimple>
<id>10877</id>
diff --git
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
index a07438d..2a2b839 100644
---
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
+++
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
@@ -292,7 +292,8 @@ public class ApacheServerComponent implements AugeasRHQComponent,
ResourceCompon
availPingTime = System.currentTimeMillis() - t1;
} else {
if (log.isDebugEnabled()) {
- log.debug("Trying to ping the server for availability through
SNMP.");
+ log.debug("Trying to ping the server for availability through
SNMP "
+ +
getSNMPAddressString(resourceContext.getPluginConfiguration()));
}
available = getSNMPSession().ping();
availPingTime = -1;
@@ -633,6 +634,14 @@ public class ApacheServerComponent implements AugeasRHQComponent,
ResourceCompon
return snmpSession;
}
+ private static String getSNMPAddressString(Configuration pluginConfig) {
+ String host =
pluginConfig.getSimple(PLUGIN_CONFIG_PROP_SNMP_AGENT_HOST).getStringValue();
+ String portString =
pluginConfig.getSimple(PLUGIN_CONFIG_PROP_SNMP_AGENT_PORT).getStringValue();
+ String community =
pluginConfig.getSimple(PLUGIN_CONFIG_PROP_SNMP_AGENT_COMMUNITY).getStringValue();
+
+ return host + ":" + portString + "/" + community;
+ }
+
/**
* Return the absolute path of this Apache server's server root (e.g.
"C:\Program Files\Apache Group\Apache2").
*
commit 8b0919aceedac820bcbd2beb9408b1795cc32c8d
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Nov 21 17:00:07 2012 +0100
stuff to help debug the apache integration test failures.
diff --git a/modules/enterprise/scripting/javascript/pom.xml
b/modules/enterprise/scripting/javascript/pom.xml
index ab35acb..ee5e4ba 100644
--- a/modules/enterprise/scripting/javascript/pom.xml
+++ b/modules/enterprise/scripting/javascript/pom.xml
@@ -27,6 +27,10 @@
</dependency>
</dependencies>
+ <properties>
+ <failIfNoTests>true</failIfNoTests>
+ </properties>
+
<build>
<plugins>
<plugin>
@@ -61,7 +65,7 @@
-Djava.security.policy==${project.build.testOutputDirectory}/allow-all.policy</argLine>
<!-- This is important, because some of the tests try to exit
the JVM. -->
- <failIfNoTests>true</failIfNoTests>
+ <failIfNoTests>${failIfNoTests}</failIfNoTests>
</configuration>
</plugin>
</plugins>
diff --git a/modules/enterprise/scripting/python/pom.xml
b/modules/enterprise/scripting/python/pom.xml
index e4b3cfb..fc64086 100644
--- a/modules/enterprise/scripting/python/pom.xml
+++ b/modules/enterprise/scripting/python/pom.xml
@@ -10,6 +10,10 @@
<name>RHQ Python support</name>
<description>Provides RHQ scripting in Python using Jython</description>
+ <properties>
+ <failIfNoTests>true</failIfNoTests>
+ </properties>
+
<dependencies>
<dependency>
<groupId>${project.groupId}</groupId>
@@ -60,7 +64,7 @@
-Djava.security.policy==${project.build.testOutputDirectory}/allow-all.policy</argLine>
<!-- This is important, because some of the tests try to exit
the JVM. -->
- <failIfNoTests>true</failIfNoTests>
+ <failIfNoTests>${failIfNoTests}</failIfNoTests>
</configuration>
</plugin>
</plugins>
diff --git
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
index 8ccef7f..a07438d 100644
---
a/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
+++
b/modules/plugins/apache/src/main/java/org/rhq/plugins/apache/ApacheServerComponent.java
@@ -283,18 +283,31 @@ public class ApacheServerComponent implements AugeasRHQComponent,
ResourceCompon
boolean available;
try {
if (this.url != null) {
+ if (log.isDebugEnabled()) {
+ log.debug("Trying to ping the server for availability: " +
this.url);
+ }
long t1 = System.currentTimeMillis();
int timeout = PluginUtility.getAvailabilityFacetTimeout();
available = WWWUtils.isAvailable(this.url, timeout);
availPingTime = System.currentTimeMillis() - t1;
} else {
+ if (log.isDebugEnabled()) {
+ log.debug("Trying to ping the server for availability through
SNMP.");
+ }
available = getSNMPSession().ping();
availPingTime = -1;
}
} catch (Exception e) {
+ if (log.isDebugEnabled()) {
+ log.debug("Exception while checking availability.", e);
+ }
available = false;
}
+ if (log.isDebugEnabled()) {
+ log.debug("Availability determined: " + (available ?
AvailabilityType.UP : AvailabilityType.DOWN));
+ }
+
return (available) ? AvailabilityType.UP : AvailabilityType.DOWN;
}