[rhq] modules/core
by Jay Shaughnessy
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java | 41 ++++++----
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 8 +
modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java | 23 ++---
3 files changed, 46 insertions(+), 26 deletions(-)
New commits:
commit 5ef9c47ee8edab0fd0558a208911cc31dfb5d1dc
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 27 09:15:20 2013 -0500
Try to stop generating as many ERRORs in the agent.log when the PC is shut
down, typically for normal reasons.
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
index 0470d9b..7c0a21b 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
@@ -259,6 +259,21 @@ public class PluginContainer {
}
/**
+ * If the plugin container has been initialized, the plugins have started work, and the container is
+ * not actively shutting down, this returns <code>true</code>.
+ *
+ * @return <code>true</code> if the plugin container was initialized, started and is not shutting down; <code>false</code> otherwise
+ */
+ public boolean isRunning() {
+ Lock lock = obtainReadLock();
+ try {
+ return started && !shuttingDown;
+ } finally {
+ releaseLock(lock);
+ }
+ }
+
+ /**
* Initializes the plugin container which initializes all internal managers. Once initialized, all plugins will be
* activated, metrics will begin getting collected and automatic discovery will start.
*
@@ -360,8 +375,8 @@ public class PluginContainer {
if (configuration.isWaitForShutdownServiceTermination()) {
log.info("Plugin container shutdown will wait up to "
- + configuration.getShutdownServiceTerminationTimeout()
- + " seconds for shut down background threads to terminate.");
+ + configuration.getShutdownServiceTerminationTimeout()
+ + " seconds for shut down background threads to terminate.");
}
driftManager.shutdown();
@@ -389,12 +404,12 @@ public class PluginContainer {
if (configuration.isWaitForShutdownServiceTermination()) {
if (shutdownGracefully) {
long elapsedMillis = System.currentTimeMillis() - this.shutdownStartTime;
- String elapsedTimeString = (elapsedMillis >= 1000) ?
- (elapsedMillis / 1000) + " seconds" : "less than 1 second";
+ String elapsedTimeString = (elapsedMillis >= 1000) ? (elapsedMillis / 1000) + " seconds"
+ : "less than 1 second";
log.info("All shut down background threads have terminated (" + elapsedTimeString + " elapsed).");
} else {
log.warn("Timed out after " + configuration.getShutdownServiceTerminationTimeout()
- + " seconds while waiting for shut down background threads to terminate.");
+ + " seconds while waiting for shut down background threads to terminate.");
}
}
@@ -770,14 +785,14 @@ public class PluginContainer {
try {
logWaitingForExecutorServiceTerminationDebugMessage(executorService, remainingShutdownTimeoutMillis);
boolean executorTerminated = executorService.awaitTermination(remainingShutdownTimeoutMillis,
- TimeUnit.MILLISECONDS);
+ TimeUnit.MILLISECONDS);
if (!executorTerminated) {
String poolName = getPoolName(executorService);
if (poolName != null) {
int activeThreadsInPool = getActiveThreadCount(poolName);
log.warn("Timed out after [" + (remainingShutdownTimeoutMillis / 1000)
- + "] seconds while waiting for all threads in pool [" + poolName + "] to terminate - ["
- + activeThreadsInPool + "] threads in the pool are still active.");
+ + "] seconds while waiting for all threads in pool [" + poolName + "] to terminate - ["
+ + activeThreadsInPool + "] threads in the pool are still active.");
}
}
} catch (InterruptedException e) {
@@ -795,13 +810,13 @@ public class PluginContainer {
}
private void logWaitingForExecutorServiceTerminationDebugMessage(ExecutorService executorService,
- long remainingShutdownTimeoutMillis) {
+ long remainingShutdownTimeoutMillis) {
if (log.isDebugEnabled()) {
String poolName = getPoolName(executorService);
if (poolName != null) {
int activeThreadsInPool = getActiveThreadCount(poolName);
log.debug("Waiting up to [" + (remainingShutdownTimeoutMillis / 1000) + "] seconds for ["
- + activeThreadsInPool + "] threads in pool [" + poolName + "] to terminate...");
+ + activeThreadsInPool + "] threads in pool [" + poolName + "] to terminate...");
}
}
}
@@ -812,8 +827,8 @@ public class PluginContainer {
int activeThreadsInPool = getActiveThreadCount(poolName);
if (activeThreadsInPool > 0) {
log.debug("Not waiting for all threads in pool [" + poolName
- + "] to terminate, since the configured plugin container shutdown timeout has already elapsed - ["
- + activeThreadsInPool + "] threads in the pool are still active.");
+ + "] to terminate, since the configured plugin container shutdown timeout has already elapsed - ["
+ + activeThreadsInPool + "] threads in the pool are still active.");
}
}
}
@@ -822,7 +837,7 @@ public class PluginContainer {
if (executorService instanceof ThreadPoolExecutor) {
ThreadFactory threadFactory = ((ThreadPoolExecutor) executorService).getThreadFactory();
if (threadFactory instanceof LoggingThreadFactory) {
- return ((LoggingThreadFactory)threadFactory).getPoolName();
+ return ((LoggingThreadFactory) threadFactory).getPoolName();
}
}
return null;
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 7231360..caa9260 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
@@ -2614,8 +2614,12 @@ public class InventoryManager extends AgentService implements ContainerService,
} catch (Throwable e) {
// TODO GH: Add server/parent - up/down semantics so this won't happen just because a server is not up
long elapsedTime = System.currentTimeMillis() - startTime;
- log.warn("Failure during discovery for [" + resourceType.getName() + "] Resources - failed after "
- + elapsedTime + " ms.", e);
+ if (!PluginContainer.getInstance().isRunning()) {
+ log.warn("Could not complete discovery, plugin container was shut down.");
+ } else {
+ log.warn("Failure during discovery for [" + resourceType.getName() + "] Resources - failed after "
+ + elapsedTime + " ms.", e);
+ }
return Collections.EMPTY_SET;
}
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
index 61733b9..c160b78 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
@@ -74,8 +74,8 @@ public class DiscoveryComponentProxyFactory {
*/
@SuppressWarnings("unchecked")
public <T> T getDiscoveryComponentProxy(ResourceType type, ResourceDiscoveryComponent component, long timeout,
- Class<T> componentInterface, ResourceContainer parentResourceContainer)
- throws PluginContainerException, BlacklistedException {
+ Class<T> componentInterface, ResourceContainer parentResourceContainer) throws PluginContainerException,
+ BlacklistedException {
if (isResourceTypeBlacklisted(type)) {
throw new BlacklistedException("Discovery component for resource type [" + type + "] has been blacklisted");
@@ -84,8 +84,8 @@ public class DiscoveryComponentProxyFactory {
try {
PluginComponentFactory pluginComponentFactory = PluginContainer.getInstance().getPluginComponentFactory();
- ClassLoader pluginClassLoader =
- pluginComponentFactory.getDiscoveryComponentClassLoader(parentResourceContainer, type.getPlugin());
+ ClassLoader pluginClassLoader = pluginComponentFactory.getDiscoveryComponentClassLoader(
+ parentResourceContainer, type.getPlugin());
// This is the handler that will actually invoke the method calls.
ResourceDiscoveryComponentInvocationHandler handler = new ResourceDiscoveryComponentInvocationHandler(type,
@@ -120,11 +120,10 @@ public class DiscoveryComponentProxyFactory {
*/
@SuppressWarnings("unchecked")
public ResourceDiscoveryComponent getDiscoveryComponentProxy(ResourceType type,
- ResourceDiscoveryComponent component, long timeout,
- ResourceContainer parentResourceContainer)
- throws PluginContainerException, BlacklistedException {
+ ResourceDiscoveryComponent component, long timeout, ResourceContainer parentResourceContainer)
+ throws PluginContainerException, BlacklistedException {
return getDiscoveryComponentProxy(type, component, timeout, ResourceDiscoveryComponent.class,
- parentResourceContainer);
+ parentResourceContainer);
}
public void initialize() {
@@ -181,7 +180,7 @@ public class DiscoveryComponentProxyFactory {
private final ResourceType resourceType;
private final ClassLoader pluginClassLoader;
private Class<?> componentInterface;
-
+
public ResourceDiscoveryComponentInvocationHandler(ResourceType type, ResourceDiscoveryComponent component,
long timeout, ClassLoader pluginClassLoader, Class<?> componentInterface) {
if (timeout <= 0) {
@@ -220,7 +219,9 @@ public class DiscoveryComponentProxyFactory {
try {
return future.get(this.timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
- log.error("Thread [" + Thread.currentThread().getName() + "] was interrupted.");
+ if (log.isDebugEnabled()) {
+ log.debug("Thread [" + Thread.currentThread().getName() + "] was interrupted.");
+ }
future.cancel(true); // this is a daemon thread, let's try to cancel it
throw new RuntimeException(invokedMethodString(method, args, "was interrupted."), e);
} catch (ExecutionException e) {
@@ -236,7 +237,7 @@ public class DiscoveryComponentProxyFactory {
if (thread != null) {
StackTraceElement[] stackTrace = thread.getStackTrace();
cause = new Exception(thread + " with id [" + thread.getId()
- + "] is hung. This exception contains its stack trace.");
+ + "] is hung. This exception contains its stack trace.");
cause.setStackTrace(stackTrace);
} else {
cause = null;
11 years, 2 months
[rhq] .classpath
by Thomas Segismont
.classpath | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 160d916ef9a258f5ef47d5bb0213541cbd2045d4
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Wed Feb 27 14:46:57 2013 +0100
Modified Eclipse classpath file for javassist sources
diff --git a/.classpath b/.classpath
index 632aa9a..f6ced85 100644
--- a/.classpath
+++ b/.classpath
@@ -75,8 +75,8 @@
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-email/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-operations/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-cli/src/main/java"/>
- <classpathentry kind="src" path="modules/enterprise/server/plugins/alert-snmp/src/main/java"/>
- <classpathentry kind="src" path="modules/enterprise/server/plugins/alert-snmp/src/main/resources"/>
+ <classpathentry kind="src" path="modules/enterprise/server/plugins/alert-snmp/src/main/java"/>
+ <classpathentry kind="src" path="modules/enterprise/server/plugins/alert-snmp/src/main/resources"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-irc/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-microblog/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-mobicents/src/main/java"/>
@@ -260,7 +260,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/net/java/dev/jna/jna/3.2.5/jna-3.2.5.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/freemarker/freemarker/2.3.11/freemarker-2.3.11.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/jline/jline/0.9.94/jline-0.9.94.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar" sourcepath="/M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/net/sf/opencsv/opencsv/1.8/opencsv-1.8.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar"/>
11 years, 2 months
[rhq] modules/enterprise
by lkrejci
modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java | 15 ++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
New commits:
commit 5f74ac330228be62050d1b387ea2cf9a47639c36
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 27 14:40:52 2013 +0100
[BZ 726673] - be more robust against different types of bean properties.
Rhino doesn't handle indexed properties automagically as it does normal
basic javabean properties, so we should offer no code completion on such
advanced property types.
diff --git a/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java b/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
index f33e029..0d5e25d 100644
--- a/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
+++ b/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
@@ -191,9 +191,20 @@ public class JavascriptCompletor implements CodeCompletion {
Object rootObject = nextList.get(0);
if (rootObject instanceof PropertyDescriptor && !(baseObject instanceof Class)) {
try {
- rootObject = invoke(baseObject, ((PropertyDescriptor) rootObject).getReadMethod());
+ Method readMethod = ((PropertyDescriptor) rootObject).getReadMethod();
+ //the read method might be null for for example indexed bean properties.
+ //Rhino doesn't interpret any more complex bean properties.
+ if (readMethod != null) {
+ rootObject = invoke(baseObject, readMethod);
+ } else {
+ return -1;
+ }
} catch (Exception e) {
- e.printStackTrace();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exception while reading a java bean property.", e);
+ }
+
+ return -1;
}
} else if (rootObject instanceof Method) {
rootObject = ((Method) rootObject).getReturnType();
11 years, 2 months
[rhq] modules/plugins
by Thomas Segismont
modules/plugins/netservices/pom.xml | 15 +++---
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java | 25 +++++++++-
2 files changed, 32 insertions(+), 8 deletions(-)
New commits:
commit 244a9489ab126f59fc7559f6547a7949b3c0b2dd
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Wed Feb 27 13:58:43 2013 +0100
Netservices plugin: make itest http port configurable (useful for Jenkins multijob context)
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 184f1db..4a661a0 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -16,6 +16,10 @@
<name>RHQ Network Services Plugin</name>
<description>A plugin for monitoring network services.</description>
+ <properties>
+ <netservices.itest.http.server.port>31158</netservices.itest.http.server.port>
+ </properties>
+
<dependencies>
<dependency>
@@ -111,6 +115,9 @@
</properties>
<useSystemClassLoader>false</useSystemClassLoader>
<argLine>${jacoco.integration-test.args}</argLine>
+ <systemPropertyVariables>
+ <netservices.itest.http.server.port>${netservices.itest.http.server.port}</netservices.itest.http.server.port>
+ </systemPropertyVariables>
</configuration>
<executions>
<execution>
@@ -167,11 +174,9 @@
<build>
<plugins>
-
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
-
<execution>
<id>deploy</id>
<phase>compile</phase>
@@ -187,7 +192,6 @@
<goal>run</goal>
</goals>
</execution>
-
<execution>
<id>deploy-jar-meta-inf</id>
<phase>package</phase>
@@ -209,7 +213,6 @@
<goal>run</goal>
</goals>
</execution>
-
<execution>
<id>undeploy</id>
<phase>clean</phase>
@@ -224,13 +227,13 @@
<goal>run</goal>
</goals>
</execution>
-
</executions>
</plugin>
-
</plugins>
</build>
+
</profile>
+
</profiles>
</project>
diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
index 24b6644..fc02516 100644
--- a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
+++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
@@ -53,6 +53,7 @@ import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.util.StringUtil;
import org.rhq.plugins.netservices.HTTPNetServiceComponent;
import org.rhq.plugins.netservices.HTTPNetServiceComponent.ConfigKeys;
import org.rhq.plugins.netservices.HTTPNetServiceComponent.HttpMethod;
@@ -70,8 +71,12 @@ public class HTTPNetServiceComponentTest extends NetServiceComponentTest {
private static final int HTTP_PORT = 31158;
+ private static final String HTTP_PORT_VARIABLE = "netservices.itest.http.server.port";
+
private static final int SERVLET_SLEEP = 1000;
+ private int httpPort;
+
private Server jettyServer;
private HTTPNetServiceComponent httpNetServiceComponent;
@@ -79,7 +84,8 @@ public class HTTPNetServiceComponentTest extends NetServiceComponentTest {
@BeforeClass
public void startJetty() throws Exception {
LOG.info("Setting up Jetty test server");
- jettyServer = new Server(new InetSocketAddress(HTTP_HOST, HTTP_PORT));
+ httpPort = getJettyPort();
+ jettyServer = new Server(new InetSocketAddress(HTTP_HOST, httpPort));
ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
jettyServer.setHandler(context);
@@ -101,6 +107,21 @@ public class HTTPNetServiceComponentTest extends NetServiceComponentTest {
jettyServer.start();
}
+ private static int getJettyPort() {
+ String httpPortVariable = System.getProperty(HTTP_PORT_VARIABLE);
+ if (StringUtil.isNotBlank(httpPortVariable)) {
+ try {
+ int port = Integer.parseInt(httpPortVariable);
+ LOG.info("Using port " + httpPortVariable + " for http server");
+ return port;
+ } catch (NumberFormatException e) {
+ LOG.warn("Invalid port variable: " + httpPortVariable);
+ }
+ }
+ LOG.info("Using default port " + String.valueOf(HTTP_PORT) + " for http server");
+ return HTTP_PORT;
+ }
+
@AfterClass
public void stopJetty() {
LOG.info("Shutting down Jetty test server");
@@ -115,7 +136,7 @@ public class HTTPNetServiceComponentTest extends NetServiceComponentTest {
@Test(dependsOnMethods = "testPluginLoad")
public void testManualAdd() throws Exception {
Configuration configuration = new Configuration();
- configuration.setSimpleValue(ConfigKeys.URL, "http://" + HTTP_HOST + ":" + HTTP_PORT + "/pipo/molo");
+ configuration.setSimpleValue(ConfigKeys.URL, "http://" + HTTP_HOST + ":" + httpPort + "/pipo/molo");
configuration.setSimpleValue(ConfigKeys.METHOD, HttpMethod.GET.name());
configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_CODE, "true");
configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_PATTERN, "success");
11 years, 2 months
[rhq] .classpath
by Thomas Segismont
.classpath | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
New commits:
commit 160c2ddbb281694e07e83ce556b97e0e611e1c5f
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Wed Feb 27 10:39:00 2013 +0100
Eclipse classpath file settings for SNMP alerts
diff --git a/.classpath b/.classpath
index dd5d354..632aa9a 100644
--- a/.classpath
+++ b/.classpath
@@ -75,7 +75,8 @@
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-email/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-operations/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-cli/src/main/java"/>
- <classpathentry kind="src" path="modules/enterprise/server/plugins/alert-snmp/src/main/java"/>
+ <classpathentry kind="src" path="modules/enterprise/server/plugins/alert-snmp/src/main/java"/>
+ <classpathentry kind="src" path="modules/enterprise/server/plugins/alert-snmp/src/main/resources"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-irc/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-microblog/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/plugins/alert-mobicents/src/main/java"/>
@@ -213,7 +214,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-validator/commons-validator/1.1.4/commons-validator-1.1.4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/testng/testng/6.5.2/testng-6.5.2.jar" sourcepath="/M2_REPO/org/testng/testng/6.5.2/testng-6.5.2-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/snmp4j/snmp4j/1.8.2/snmp4j-1.8.2.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/snmp4j/snmp4j/1.8.2/snmp4j-1.8.2.jar" sourcepath="M2_REPO/org/snmp4j/snmp4j/1.8.2/snmp4j-1.8.2-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/tomcat/tomcat-jk/4.1.31/tomcat-jk-4.1.31.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/jdom/jdom/1.0/jdom-1.0.jar"/>
11 years, 2 months
[rhq] Branch 'feature/cassandra-backend' - modules/common modules/enterprise pom.xml
by John Sanda
dev/null |binary
modules/common/cassandra-ccm/cassandra-ccm-core/pom.xml | 23 ++++++++--
modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties | 2
modules/common/cassandra-schema/pom.xml | 16 ------
modules/enterprise/server/installer/pom.xml | 3 -
modules/enterprise/server/installer/src/main/resources/module/main/module.xml | 2
modules/enterprise/server/server-metrics/pom.xml | 16 ------
pom.xml | 1
8 files changed, 23 insertions(+), 40 deletions(-)
New commits:
commit 79ae5d20ebe5abe556856e7a7b058d815b2da17d
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Feb 26 16:03:48 2013 -0500
several updates to support using forked version of snappy-java
The datastax driver uses snappy-java for compression. The snappy-java native
library would not load in JBoss AS due to snappy-java using the root class
loader. I have since forked snappy-java so that it loads its native library
using the same class loader that other snappy classes.
Also making some JNA upgrades necessary for C* 1.2.1. The JNA libraries are no
longer stored in git. When creating the C* bundle, the ant script (that creates
the bundle) copies the JNA artifacts from the local maven repo.
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/pom.xml b/modules/common/cassandra-ccm/cassandra-ccm-core/pom.xml
index e738ef2..82530a7 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/pom.xml
+++ b/modules/common/cassandra-ccm/cassandra-ccm-core/pom.xml
@@ -14,6 +14,7 @@
<properties>
<local.repo>${settings.localRepository}</local.repo>
+ <cassandra.jna.version>3.5.1</cassandra.jna.version>
</properties>
<dependencies>
@@ -50,11 +51,24 @@
<dependency>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
- <version>3.2.7</version>
+ <version>${cassandra.jna.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>net.java.dev.jna</groupId>
+ <artifactId>platform</artifactId>
+ <version>${cassandra.jna.version}</version>
</dependency>
</dependencies>
<build>
+ <resources>
+ <resource>
+ <directory>src/main/resources</directory>
+ <filtering>true</filtering>
+ </resource>
+ </resources>
+
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
@@ -131,10 +145,11 @@
value="${project.build.outputDirectory}/${cassandra.distro.filename}"/>
<copy file="${settings.localRepository}/org/rhq/rhq-cassandra-auth/${project.version}/rhq-cassandra-auth-${project.version}.jar"
todir="${cassandra.dir}/lib"/>
+ <copy file="${settings.localRepository}/net/java/dev/jna/platform/${cassandra.jna.version}/platform-${cassandra.jna.version}.jar"
+ todir="${cassandra.dir}/lib"/>
+ <copy file="${settings.localRepository}/net/java/dev/jna/jna/${cassandra.jna.version}/jna-${cassandra.jna.version}.jar"
+ todir="${cassandra.dir}/lib"/>
<move file="${project.build.outputDirectory}/cassandra/conf" todir="${cassandra.dir}"/>
- <move file="${project.build.outputDirectory}/cassandra/lib" todir="${cassandra.dir}"/>
- <!--<move file="${project.build.outputDirectory}/passwd.properties" todir="${cassandra.dir}/conf"/>-->
- <!--<move file="${project.build.outputDirectory}/access.properties" todir="${cassandra.dir}/conf"/>-->
<zip basedir="${cassandra.dir}" destfile="${cassandra.distro.zip}"/>
<delete dir="${cassandra.dir}"/>
<zip basedir="${project.build.outputDirectory}"
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
index 84687cb..67e33bb 100644
--- a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
+++ b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra.properties
@@ -8,7 +8,7 @@ rhq.cassandra.bundle.version=1.0
# The directory in which Cassandra is installed. This property must be
# specified.
-rhq.cassandra.basedir=
+rhq.cassandra.basedir=${rhq.rootDir}
# The username with which to authenticate requests to Cassandra.
rhq.cassandra.username=rhqadmin
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra/lib/jna-3.4.1.jar b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra/lib/jna-3.4.1.jar
deleted file mode 100644
index 4e05a4a..0000000
Binary files a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra/lib/jna-3.4.1.jar and /dev/null differ
diff --git a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra/lib/platform-3.4.1.jar b/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra/lib/platform-3.4.1.jar
deleted file mode 100644
index 8357d2e..0000000
Binary files a/modules/common/cassandra-ccm/cassandra-ccm-core/src/main/resources/cassandra/lib/platform-3.4.1.jar and /dev/null differ
diff --git a/modules/common/cassandra-schema/pom.xml b/modules/common/cassandra-schema/pom.xml
index 5ea1ce3..9433b46 100644
--- a/modules/common/cassandra-schema/pom.xml
+++ b/modules/common/cassandra-schema/pom.xml
@@ -28,22 +28,6 @@
<profiles>
<profile>
- <id>snappy-mac-workaround</id>
- <activation>
- <os>
- <family>Mac</family>
- </os>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.xerial.snappy</groupId>
- <artifactId>snappy-java</artifactId>
- <version>1.0.5-M3</version>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
<id>dev</id>
<properties>
<rhq.rootDir>../../..</rhq.rootDir>
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index d5f09e2..7f30db5 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -229,8 +229,7 @@
<artifactItem>
<groupId>org.xerial.snappy</groupId>
<artifactId>snappy-java</artifactId>
- <version>1.0.4.1</version>
- <!--<version>1.0.5-M3</version>-->
+ <version>${cassandra.driver.snappy.version}</version>
</artifactItem>
<artifactItem>
<groupId>com.ning</groupId>
diff --git a/modules/enterprise/server/installer/src/main/resources/module/main/module.xml b/modules/enterprise/server/installer/src/main/resources/module/main/module.xml
index a1448ce..8449d46 100644
--- a/modules/enterprise/server/installer/src/main/resources/module/main/module.xml
+++ b/modules/enterprise/server/installer/src/main/resources/module/main/module.xml
@@ -33,7 +33,7 @@
<resource-root path="libthrift-${cassandra.thrift.version}.jar"/>
<resource-root path="jackson-mapper-asl-1.4.0.jar"/>
<resource-root path="jackson-core-asl-1.4.0.jar"/>
- <resource-root path="snappy-java-1.0.4.1.jar"/>
+ <resource-root path="snappy-java-${cassandra.driver.snappy.version}.jar"/>
<!-- end rhq-cassandra-schema dependencies -->
<resource-root path="commons-codec-1.2.jar"/>
</resources>
diff --git a/modules/enterprise/server/server-metrics/pom.xml b/modules/enterprise/server/server-metrics/pom.xml
index e5417e3..0db7f68 100644
--- a/modules/enterprise/server/server-metrics/pom.xml
+++ b/modules/enterprise/server/server-metrics/pom.xml
@@ -158,22 +158,6 @@
<profiles>
<profile>
- <id>snappy-mac-workaround</id>
- <activation>
- <os>
- <family>Mac</family>
- </os>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.xerial.snappy</groupId>
- <artifactId>snappy-java</artifactId>
- <version>1.0.5-M3</version>
- </dependency>
- </dependencies>
- </profile>
-
- <profile>
<id>dev</id>
<properties>
<rhq.rootDir>../../..</rhq.rootDir>
diff --git a/pom.xml b/pom.xml
index 222e8e9..6e9e489 100644
--- a/pom.xml
+++ b/pom.xml
@@ -155,6 +155,7 @@
<cassandra.version>1.2.1</cassandra.version>
<cassandra.thrift.version>0.7.0</cassandra.thrift.version>
<cassandra.driver.version>1.0.0-beta1</cassandra.driver.version>
+ <cassandra.driver.snappy.version>1.0.5-M3-p1</cassandra.driver.snappy.version>
<rhq.db.admin.username>rhqadmin</rhq.db.admin.username>
<rhq.db.admin.password>rhqadmin</rhq.db.admin.password>
11 years, 2 months
[rhq] modules/core
by Simeon Pinder
modules/core/domain/intentional-api-changes-since-4.6.0.xml | 21 ++++++++++++
1 file changed, 21 insertions(+)
New commits:
commit 3c46c9036d8bff55df035bade9a81365d582d09e
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 26 13:47:33 2013 -0500
Adding in justification for api changes. This should fix api check once 4.6.0 is published.
diff --git a/modules/core/domain/intentional-api-changes-since-4.6.0.xml b/modules/core/domain/intentional-api-changes-since-4.6.0.xml
new file mode 100644
index 0000000..7554092
--- /dev/null
+++ b/modules/core/domain/intentional-api-changes-since-4.6.0.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<differences>
+ <difference>
+ <className>org/rhq/core/domain/criteria/BaseCriteria</className>
+ <differenceType>7012</differenceType><!-- method added -->
+ <method>void addSortId(org.rhq.core.domain.util.PageOrdering)</method>
+ <justification>
+ We are adding a default addSortId operation to all criteria to support paging through
+ large result sets.
+ </justification>
+ </difference>
+ <difference>
+ <className>org/rhq/core/domain/criteria/BaseCriteria</className>
+ <differenceType>7012</differenceType><!-- method added -->
+ <method>java.util.List getOrderingFieldNames()</method>
+ <justification>
+ We are adding an operation to return FieldOrdering to support paging through
+ large result sets.
+ </justification>
+ </difference>
+</differences>
11 years, 2 months
[rhq] 61 commits - modules/core modules/enterprise
by Simeon Pinder
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BaseCriteria.java | 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java | 9
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java | 30 -
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftCriteria.java | 29 -
modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java | 5
modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java | 42 +
modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java | 21
modules/enterprise/gui/content_http-war/src/main/java/org/rhq/gui/content/ContentHTTPServlet.java | 1
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/ScriptableAbstractEJB3Test.java | 37 +
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java | 22
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java | 81 ++
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java | 279 +++++++++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java | 55 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java | 24
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 78 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java | 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java | 26
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java | 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DeletedResourceTypeFilter.java | 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java | 12
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java | 16
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java | 18
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java | 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java | 48 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java | 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java | 15
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java | 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java | 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java | 19
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java | 20
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java | 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java | 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java | 13
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java | 34 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java | 25
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java | 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java | 92 +++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java | 69 ++
modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java | 1
modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServer.java | 17
46 files changed, 1073 insertions(+), 171 deletions(-)
New commits:
commit 9957e3f699a021b08093e3fd6a96421577be9725
Merge: a9352d7 c367f45
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 26 10:04:15 2013 -0500
Merge branch 'track_master' into spinder/criteriaUsage
commit a9352d74a8eff4e9517af200d5f81b2f6f7b9f2b
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 21 16:36:29 2013 -0500
refactor to expose the ScriptEngine for these and other tests.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/ScriptableAbstractEJB3Test.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/ScriptableAbstractEJB3Test.java
new file mode 100644
index 0000000..1cc66c5
--- /dev/null
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/ScriptableAbstractEJB3Test.java
@@ -0,0 +1,37 @@
+package org.rhq.enterprise.client;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.security.PermissionCollection;
+import java.util.Collections;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+
+import org.testng.annotations.Test;
+
+import org.rhq.bindings.ScriptEngineFactory;
+import org.rhq.bindings.StandardBindings;
+import org.rhq.bindings.StandardScriptPermissions;
+import org.rhq.bindings.util.PackageFinder;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.server.test.AbstractEJB3Test;
+
+/**
+ *
+ * @author Simeon Pinder
+ *
+ */
+@Test
+public class ScriptableAbstractEJB3Test extends AbstractEJB3Test {
+
+ protected ScriptEngine getEngine(Subject subject) throws ScriptException, IOException {
+ StandardBindings bindings = new StandardBindings(new PrintWriter(System.out), new LocalClient(subject));
+
+ PermissionCollection perms = new StandardScriptPermissions();
+
+ return ScriptEngineFactory.getSecuredScriptEngine("javascript",
+ new PackageFinder(Collections.<File> emptyList()), bindings, perms);
+ }
+}
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
index 8489f1d..349a8ce 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
@@ -18,11 +18,7 @@
*/
package org.rhq.enterprise.client.security.test;
-import java.io.File;
import java.io.IOException;
-import java.io.PrintWriter;
-import java.security.PermissionCollection;
-import java.util.Collections;
import javax.naming.Context;
import javax.script.ScriptEngine;
@@ -31,15 +27,10 @@ import javax.script.ScriptException;
import org.testng.Assert;
import org.testng.annotations.Test;
-import org.rhq.bindings.ScriptEngineFactory;
-import org.rhq.bindings.StandardBindings;
-import org.rhq.bindings.StandardScriptPermissions;
-import org.rhq.bindings.util.PackageFinder;
import org.rhq.core.domain.auth.Subject;
-import org.rhq.enterprise.client.LocalClient;
+import org.rhq.enterprise.client.ScriptableAbstractEJB3Test;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.system.SystemManagerBean;
-import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -48,7 +39,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
* @author Lukas Krejci
*/
@Test
-public class JndiAccessTest extends AbstractEJB3Test {
+public class JndiAccessTest extends ScriptableAbstractEJB3Test {
public void testScriptCantOverrideSystemProperties() throws Exception {
Subject overlord = LookupUtil.getSubjectManager().getOverlord();
@@ -272,15 +263,6 @@ public class JndiAccessTest extends AbstractEJB3Test {
// }
// }
- protected ScriptEngine getEngine(Subject subject) throws ScriptException, IOException {
- StandardBindings bindings = new StandardBindings(new PrintWriter(System.out), new LocalClient(subject));
-
- PermissionCollection perms = new StandardScriptPermissions();
-
- return ScriptEngineFactory.getSecuredScriptEngine("javascript",
- new PackageFinder(Collections.<File> emptyList()), bindings, perms);
- }
-
private static void checkIsDesiredSecurityException(ScriptException e) {
String message = e.getMessage();
String permissionTrace = "org.rhq.allow.server.internals.access";
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
index 98ad38c..6768021 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
@@ -17,7 +17,7 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.client.security.test.JndiAccessTest;
+import org.rhq.enterprise.client.ScriptableAbstractEJB3Test;
import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.enterprise.server.util.SessionTestHelper;
@@ -26,7 +26,7 @@ import org.rhq.enterprise.server.util.SessionTestHelper;
* @author Simeon Pinder
*/
@Test
-public class ScriptTest extends JndiAccessTest {
+public class ScriptTest extends ScriptableAbstractEJB3Test {
/** Exercise the ScriptUtil.findResoruces
*
commit 0d130abb277d988190ac2577879d6eb40ea0814a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 21 16:29:01 2013 -0500
Deprecate ScriptUtil.findResources() usage as does not properly support paging
and can produce result sets difficult to parse for large result sets.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
index 6b86b61..7d64eab 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
@@ -70,6 +70,25 @@ public class ScriptUtil {
this.scriptEngine = scriptEngine;
}
+ /** This convenience method has been deprecated as it was not designed to support paging
+ * which is a requirement to efficiently handle large results sets. This methods returns
+ * all inexact matches to the String parameter passed in. Clients may have difficulty
+ * retrieving all results.
+ *
+ * Instead to page through large/small result sets you should create
+ * i)ResourceCriteria instances to be passed into
+ * ii)ResourceManager.findResourcesByCriteria(ResourceCriteria criteria)
+ *
+ * NOTE: ResourceCriteria by default has a page size of 200 and starts on page 0. Ex. criteria.setPaging(0,200);
+ *
+ * To iterate over a larger result set you can
+ * i)get access to the total number of resources, as the PageList<Resource> return includes a getTotalSize() method
+ * ii)iterate through the pages of results by using Ex. criteria.setPaging(1,200), criteria.setPaging(2,200), [N,PageSize]
+ *
+ * @param string
+ * @return PageList<Resource> Resources with inexact name matches to the string passed in.
+ */
+ @Deprecated
public PageList<Resource> findResources(String string) {
if (remoteClient == null) {
throw new IllegalStateException("The findResources() method requires a connection to the RHQ server.");
commit bf664e0f63aabbd22b242450d0f673c4064c4215
Merge: 76458a3 b452250
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 21 14:49:53 2013 -0500
Merge branch 'track_master' into spinder/criteriaUsage
commit 76458a3ca5762cec0512e8ed6b607cdafeddf71a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 21 14:16:16 2013 -0500
Add integration test to exercise some CLI functionality specifically findResources.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
index fabe6ae..8489f1d 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
@@ -272,7 +272,7 @@ public class JndiAccessTest extends AbstractEJB3Test {
// }
// }
- private ScriptEngine getEngine(Subject subject) throws ScriptException, IOException {
+ protected ScriptEngine getEngine(Subject subject) throws ScriptException, IOException {
StandardBindings bindings = new StandardBindings(new PrintWriter(System.out), new LocalClient(subject));
PermissionCollection perms = new StandardScriptPermissions();
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
new file mode 100644
index 0000000..98ad38c
--- /dev/null
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
@@ -0,0 +1,81 @@
+package org.rhq.enterprise.client.util;
+
+import java.io.IOException;
+import java.util.Random;
+
+import javax.persistence.EntityManager;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.client.security.test.JndiAccessTest;
+import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.util.SessionTestHelper;
+
+/**Exercise some of the methods available via cli an integration tests/using a running server.
+
+ * @author Simeon Pinder
+ */
+@Test
+public class ScriptTest extends JndiAccessTest {
+
+ /** Exercise the ScriptUtil.findResoruces
+ *
+ * @throws ScriptException
+ * @throws IOException
+ * @throws NotSupportedException
+ * @throws SystemException
+ * @throws SecurityException
+ * @throws IllegalStateException
+ * @throws RollbackException
+ * @throws HeuristicMixedException
+ * @throws HeuristicRollbackException
+ */
+ @Test
+ public void testScriptUtilFindResources() throws ScriptException, IOException, NotSupportedException,
+ SystemException,
+ SecurityException, IllegalStateException, RollbackException, HeuristicMixedException,
+ HeuristicRollbackException {
+
+ //Instantiate ScriptEngine.
+ Subject overlord = LookupUtil.getSubjectManager().getOverlord();
+ ScriptEngine engine = getEngine(overlord);
+
+ //create resources to query.
+ getTransactionManager().begin();
+ EntityManager entityMgr = getEntityManager();
+ String tuid = "" + new Random().nextInt();
+ String prefix = "CLI-TEST-" + tuid + "-";
+ int resourceCount = 201; //assuming 200 per page at least 2 pages of results.
+ int[] resourceIds = new int[resourceCount];
+ try {
+ System.out.println("-------- Creating " + resourceCount + " resource(s). This may take a while ....");
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < resourceCount; i++) {
+ String name = prefix + i;
+ Resource r = SessionTestHelper.createNewResource(entityMgr, name);
+ resourceIds[i] = r.getId();
+ }
+ entityMgr.flush();
+
+ System.out.println("----------- Created " + resourceCount + " resource(s) in "
+ + (System.currentTimeMillis() - start) + " ms.");
+
+ //now get the Resources back by CLI
+ PageList<Resource> result = (PageList<Resource>) engine.eval("findResources('" + prefix + "');");
+ assert result.size() == resourceCount : "Expected to get '" + resourceCount
+ + "' result(s) from across two pages but instead got '" + result.size() + "'.";
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+}
commit 6a2b2c0c8c19cc52cbf39ddee7c49ea9ad0a3de1
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 21 10:13:48 2013 -0500
Apply fixes for CriteriaQueryTest incorrectly using paging.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
index faa14ad..2e1c897 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
@@ -73,7 +73,9 @@ public class CriteriaQueryTest {
}
public void addPage(List<FakeEntity> entities) {
- pages.add(new PageList<FakeEntity>(entities, totalSize, pc));
+ int pageNumber = pages.size();
+ pages
+ .add(new PageList<FakeEntity>(entities, totalSize, new PageControl(pageNumber, this.pc.getPageSize())));
}
@Override
@@ -113,7 +115,8 @@ public class CriteriaQueryTest {
queryExecutor.addPage(expected.subList(2, 4));
FakeEntityCriteria criteria = new FakeEntityCriteria();
- criteria.setPageControl(pc);
+ //spinder 2-20-13: DO NOT use criteria.setPageControl(pc) here as it causes ignore of pageNumber/pageSize
+ criteria.setPaging(pc.getPageNumber(), pc.getPageSize());
CriteriaQuery<FakeEntity, FakeEntityCriteria> query = new CriteriaQuery<FakeEntity, FakeEntityCriteria>(
criteria, queryExecutor);
@@ -164,7 +167,7 @@ public class CriteriaQueryTest {
//build criteria and attach pageControl
FakeEntityCriteria criteria = new FakeEntityCriteria();
- //DO NOT use criteria.setPageControl(pc) here as it causes ignore of pageNumber/pageSize
+ //spinder 2-20-13:DO NOT use criteria.setPageControl(pc) here as it causes ignore of pageNumber/pageSize
criteria.setPaging(pc.getPageNumber(), pc.getPageSize());
//?? So which pageControl has the right details? Criteria.pageControl? OR PageControl passed into the QueryExecutor.
commit 650d2c0b7c326c1528acf309ddb22e2792b6d65c
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Wed Feb 20 14:03:52 2013 -0500
Clarify dirty read javadoc for test.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
index f48d360..40b0623 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
@@ -221,9 +221,12 @@ public class ResourceStorageTest extends AbstractEJB3Test {
}
/** Test creates a large number of resources and pages through them using CriteriaQuery.
+ *
* NOTE: CriteriaQuery uses PageList instances underneath and are susceptible to dirty
- * read issues if the total number of resources being parsed is i)very large or ii)processing
- * each instance takes a significant amount of time. Ex. Begin parsing all resource types,
+ * read issues if the underlying dataset changes because the total number of resources being
+ * parsed is i)very large or ii)processing each instance takes a significant amount of
+ * time such that another action/process/object may have changed the original resources
+ * before resultset processing could be completed. Ex. Begin parsing all resource types,
* while plugin update is removing some of those same types.
*
* @throws Exception
commit 962b33d40299d5076e57e5e5949c4d664d62ab15
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 20 13:53:51 2013 -0500
CriteriaQuery should always have a sort applied in the Criteria supplied to
it. Otherwise the implicit chunking will be unreliable, as queries will
have no guaranteed ordering, the DB is free to order results in any way it
likes.
To do this I've done two things:
1) I added the ability to sort by ID on all subclasses of Criteria
2) If no sort is specified in the CriteriaQuery Criteria, an ID sort is added
This default ASC sort on ID provides consistent chunking and the fastest
ordering given that it's an indexed (PK) field.
AND, DONE DURING MERGE:
Fix merge issue.
Also:
- fix issue when using CriteriaQuery with pageControlOverrides
- update tests to cover a few more scenarios
- remove the unnecessary pagecontrol overrides forwarding in CriteriaQuery.next
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BaseCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BaseCriteria.java
index c4993c1..5b931aa 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BaseCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BaseCriteria.java
@@ -18,7 +18,10 @@
*/
package org.rhq.core.domain.criteria;
+import java.util.List;
+
import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageOrdering;
/**
* All criteria, regardless of the backend storage that will be queried with this criteria, needs
@@ -28,6 +31,10 @@ import org.rhq.core.domain.util.PageControl;
*/
public interface BaseCriteria {
+ void addSortId(PageOrdering sortId);
+
+ List<String> getOrderingFieldNames();
+
PageControl getPageControlOverrides();
void setPageControl(PageControl pageControl);
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index afcff6f..2ae6859 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@ -35,6 +35,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
/**
* @author Joseph Marques
@@ -96,6 +97,9 @@ public abstract class Criteria implements Serializable, BaseCriteria {
private String searchExpression;
+ // All Criteria support sorting on ID
+ private PageOrdering sortId;
+
/**
* This default constructor will set default paging to avoid unintended fetch of huge results. The default is:
* <pre>setPaging(0, 200);</pre>
@@ -139,6 +143,11 @@ public abstract class Criteria implements Serializable, BaseCriteria {
return pageControlOverrides;
}
+ public void addSortId(PageOrdering sortId) {
+ addSortField("id");
+ this.sortId = sortId;
+ }
+
protected void addSortField(String fieldName) {
orderingFieldNames.add("sort" + Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1));
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
index 0cb6bfa..c640bf0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
@@ -18,15 +18,16 @@
*/
package org.rhq.core.domain.criteria;
-import org.rhq.core.domain.drift.DriftCategory;
-import org.rhq.core.domain.drift.DriftChangeSetCategory;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageOrdering;
+import static org.rhq.core.domain.util.CriteriaUtils.getListIgnoringNulls;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.List;
-import static org.rhq.core.domain.util.CriteriaUtils.getListIgnoringNulls;
+import org.rhq.core.domain.drift.DriftCategory;
+import org.rhq.core.domain.drift.DriftChangeSetCategory;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageOrdering;
/**
* The generic implementation of DriftChangeSetCriteria makes no assumptions about the actual drift server
@@ -68,6 +69,8 @@ public class GenericDriftChangeSetCriteria implements Serializable, DriftChangeS
private boolean fetchDrifts;
+ private PageOrdering sortId;
+
private PageOrdering sortVersion;
private PageControl pageControl;
@@ -209,6 +212,11 @@ public class GenericDriftChangeSetCriteria implements Serializable, DriftChangeS
}
@Override
+ public void addSortId(PageOrdering sortId) {
+ this.sortId = sortId;
+ }
+
+ @Override
public void addSortVersion(PageOrdering sortVersion) {
this.sortVersion = sortVersion;
}
@@ -244,4 +252,16 @@ public class GenericDriftChangeSetCriteria implements Serializable, DriftChangeS
pageControl.setPageSize(pageSize);
}
+ @Override
+ public List<String> getOrderingFieldNames() {
+ List<String> result = new ArrayList<String>(2);
+ if (null != sortId) {
+ result.add("id");
+ }
+ if (null != sortVersion) {
+ result.add("version");
+ }
+ return result;
+ }
+
}
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftCriteria.java
index 3146b16..1c53353 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftCriteria.java
@@ -18,16 +18,16 @@
*/
package org.rhq.core.domain.criteria;
-import org.rhq.core.domain.drift.DriftCategory;
-import org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageOrdering;
+import static org.rhq.core.domain.util.CriteriaUtils.getListIgnoringNulls;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import static org.rhq.core.domain.util.CriteriaUtils.getListIgnoringNulls;
+import org.rhq.core.domain.drift.DriftCategory;
+import org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageOrdering;
/**
* The generic implementation of DriftCriteria makes no assumptions about the actual drift server
@@ -71,6 +71,8 @@ public class GenericDriftCriteria implements Serializable, DriftCriteria {
private PageControl pageControl;
+ private PageOrdering sortId;
+
private PageOrdering sortCtime;
private boolean strict;
@@ -206,6 +208,11 @@ public class GenericDriftCriteria implements Serializable, DriftCriteria {
}
@Override
+ public void addSortId(PageOrdering sortId) {
+ this.sortId = sortId;
+ }
+
+ @Override
public void addSortCtime(PageOrdering sortCtime) {
this.sortCtime = sortCtime;
}
@@ -241,4 +248,16 @@ public class GenericDriftCriteria implements Serializable, DriftCriteria {
pageControl.setPageSize(pageSize);
}
+ @Override
+ public List<String> getOrderingFieldNames() {
+ List<String> result = new ArrayList<String>(2);
+ if (null != sortId) {
+ result.add("id");
+ }
+ if (null != sortCtime) {
+ result.add("ctime");
+ }
+ return result;
+ }
+
}
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
index e746deb..f48d360 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
@@ -132,8 +132,8 @@ public class ResourceStorageTest extends AbstractEJB3Test {
ResourceGroupManagerLocal groupManager = LookupUtil.getResourceGroupManager();
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
PageControl pc = new PageControl(0, 5, new OrderingField("rg.name", PageOrdering.ASC));
- PageList<ResourceGroupComposite> groups = groupManager.findResourceGroupComposites(subjectManager
- .getOverlord(), GroupCategory.COMPATIBLE, null, null, null, null, null, null, pc);
+ PageList<ResourceGroupComposite> groups = groupManager.findResourceGroupComposites(
+ subjectManager.getOverlord(), GroupCategory.COMPATIBLE, null, null, null, null, null, null, pc);
System.out.println("Found compatible groups: " + groups.getTotalSize());
for (ResourceGroupComposite group : groups) {
System.out.println("\t" + group);
@@ -195,8 +195,8 @@ public class ResourceStorageTest extends AbstractEJB3Test {
Subject rhqadmin = subjectManager.loginUnauthenticated("rhqadmin");
rhqadmin = createSession(rhqadmin);
- Map<Resource, List<Resource>> queue = discoveryBoss.getQueuedPlatformsAndServers(rhqadmin, PageControl
- .getUnlimitedInstance());
+ Map<Resource, List<Resource>> queue = discoveryBoss.getQueuedPlatformsAndServers(rhqadmin,
+ PageControl.getUnlimitedInstance());
for (Resource root : queue.keySet()) {
System.out.println("Queue root resource: " + root);
}
@@ -228,7 +228,6 @@ public class ResourceStorageTest extends AbstractEJB3Test {
*
* @throws Exception
*/
- @SuppressWarnings("unused")
@Test(groups = "integration.ejb3")
public void testParsingCriteriaQueryResults() throws Exception {
getTransactionManager().begin();
@@ -251,8 +250,7 @@ public class ResourceStorageTest extends AbstractEJB3Test {
String tuid = "" + new Random().nextInt();
//create large number of resources
String prefix = "largeResultSet-" + tuid + "-";
- System.out.println("-------- Creating " + resourceCount
- + " resource(s). This may take a while ....");
+ System.out.println("-------- Creating " + resourceCount + " resource(s). This may take a while ....");
long start = System.currentTimeMillis();
for (int i = 0; i < resourceCount; i++) {
@@ -264,15 +262,14 @@ public class ResourceStorageTest extends AbstractEJB3Test {
entityMgr.flush();
System.out.println("----------- Created " + resourceCount + " resource(s) in "
- + (System.currentTimeMillis() - start)
- + " ms.");
+ + (System.currentTimeMillis() - start) + " ms.");
assert resourceNames.size() == resourceCount;//assert all resources loaded/created
//query the results and delete the resources
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterName(prefix);
- criteria.addSortName(PageOrdering.ASC);
+ criteria.addSortName(PageOrdering.DESC); // use DESC just to make sure sorting on name is different than insert order
criteria.setPaging(0, 47);
//iterate over the results with CriteriaQuery
@@ -288,10 +285,95 @@ public class ResourceStorageTest extends AbstractEJB3Test {
criteria, queryExecutor);
start = System.currentTimeMillis();
+ String prevName = null;
+ //iterate over the entire result set efficiently
+ ArrayList<String> alreadySeen = new ArrayList<String>();
+ int actualCount = 0;
+ for (Resource r : resources) {
+ assert null == prevName || r.getName().compareTo(prevName) < 0 : "Results should be sorted by name DESC, something is out of order";
+ prevName = r.getName();
+ actualCount++;
+ // System.out.println(actualCount + " @@@ " + r.getId() + ":"
+ // + ((resourceNames.containsKey(String.valueOf(r.getId()))) ? "NEW" : "DIRTY") + ":" + r.getName());
+ resourceNames.remove(String.valueOf(r.getId()));
+ }
+
+ System.out.println("----------- Parsed " + actualCount + " resource(s) in "
+ + (System.currentTimeMillis() - start) + " ms.");
+
+ //test that entire list parsed spanning multiple pages
+ assert resourceNames.size() == 0 : "Expected resourceNames to be empty. Still " + resourceNames.size()
+ + " name(s).";
+
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
+ @Test(groups = "integration.ejb3")
+ public void testParsingCriteriaQueryResults_2() throws Exception {
+ // Same test as above but makes sure default id search works. use different numbers just for variety
+ getTransactionManager().begin();
+ EntityManager entityMgr = getEntityManager();
+ final ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
+
+ //verify that all resource objects are actually parsed.
+ Map<String, Object> resourceNames = new HashMap<String, Object>();
+ int resourceCount = 344;
+
+ try {
+ final Subject subject = SessionTestHelper.createNewSubject(entityMgr, "testSubject");
+
+ Role roleWithSubject = SessionTestHelper.createNewRoleForSubject(entityMgr, subject, "role with subject");
+ roleWithSubject.addPermission(Permission.VIEW_RESOURCE);
+
+ ResourceGroup group = SessionTestHelper.createNewCompatibleGroupForRole(entityMgr, roleWithSubject,
+ "accessible group");
+
+ String tuid = "" + new Random().nextInt();
+ //create large number of resources
+ String prefix = "largeResultSet-" + tuid + "-";
+ System.out.println("-------- Creating " + resourceCount + " resource(s). This may take a while ....");
+
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < resourceCount; i++) {
+ String name = prefix + i;
+ Resource r = SessionTestHelper.createNewResourceForGroup(entityMgr, group, name);
+ //store away each resource name/key
+ resourceNames.put(String.valueOf(r.getId()), name);
+ }
+ entityMgr.flush();
+
+ System.out.println("----------- Created " + resourceCount + " resource(s) in "
+ + (System.currentTimeMillis() - start) + " ms.");
+
+ assert resourceNames.size() == resourceCount;//assert all resources loaded/created
+
+ //query the results and delete the resources, use default ID search
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterName(prefix);
+ criteria.setPaging(0, 25);
+
+ //iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceManager.findResourcesByCriteria(subject, criteria);
+ }
+ };
+
+ //initiate first/(total depending on page size) request.
+ CriteriaQuery<Resource, ResourceCriteria> resources = new CriteriaQuery<Resource, ResourceCriteria>(
+ criteria, queryExecutor);
+
+ start = System.currentTimeMillis();
+ int prevId = 0;
//iterate over the entire result set efficiently
ArrayList<String> alreadySeen = new ArrayList<String>();
int actualCount = 0;
for (Resource r : resources) {
+ assert r.getId() > prevId : "Results should be sorted by ID ASC, something is out of order";
+ prevId = r.getId();
actualCount++;
// System.out.println(actualCount + " @@@ " + r.getId() + ":"
// + ((resourceNames.containsKey(String.valueOf(r.getId()))) ? "NEW" : "DIRTY") + ":" + r.getName());
@@ -299,8 +381,7 @@ public class ResourceStorageTest extends AbstractEJB3Test {
}
System.out.println("----------- Parsed " + actualCount + " resource(s) in "
- + (System.currentTimeMillis() - start)
- + " ms.");
+ + (System.currentTimeMillis() - start) + " ms.");
//test that entire list parsed spanning multiple pages
assert resourceNames.size() == 0 : "Expected resourceNames to be empty. Still " + resourceNames.size()
@@ -310,4 +391,89 @@ public class ResourceStorageTest extends AbstractEJB3Test {
getTransactionManager().rollback();
}
}
+
+ @Test(groups = "integration.ejb3")
+ public void testParsingCriteriaQueryResults_3() throws Exception {
+ // Same test as above but makes sure pageoverrides default id search works. use different numbers just for variety
+ getTransactionManager().begin();
+ EntityManager entityMgr = getEntityManager();
+ final ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
+
+ //verify that all resource objects are actually parsed.
+ Map<String, Object> resourceNames = new HashMap<String, Object>();
+ int resourceCount = 423;
+
+ try {
+ final Subject subject = SessionTestHelper.createNewSubject(entityMgr, "testSubject");
+
+ Role roleWithSubject = SessionTestHelper.createNewRoleForSubject(entityMgr, subject, "role with subject");
+ roleWithSubject.addPermission(Permission.VIEW_RESOURCE);
+
+ ResourceGroup group = SessionTestHelper.createNewCompatibleGroupForRole(entityMgr, roleWithSubject,
+ "accessible group");
+
+ String tuid = "" + new Random().nextInt();
+ //create large number of resources
+ String prefix = "largeResultSet-" + tuid + "-";
+ System.out.println("-------- Creating " + resourceCount + " resource(s). This may take a while ....");
+
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < resourceCount; i++) {
+ String name = prefix + i;
+ Resource r = SessionTestHelper.createNewResourceForGroup(entityMgr, group, name);
+ //store away each resource name/key
+ resourceNames.put(String.valueOf(r.getId()), name);
+ }
+ entityMgr.flush();
+
+ System.out.println("----------- Created " + resourceCount + " resource(s) in "
+ + (System.currentTimeMillis() - start) + " ms.");
+
+ assert resourceNames.size() == resourceCount;//assert all resources loaded/created
+
+ //query the results and delete the resources, use default ID search
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterName(prefix);
+ PageControl pc = new PageControl(0, 73);
+ criteria.setPageControl(pc);
+ assert pc.getOrderingFields().isEmpty() : "Should not have had any sorting defined";
+
+ //iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceManager.findResourcesByCriteria(subject, criteria);
+ }
+ };
+
+ //initiate first/(total depending on page size) request.
+ CriteriaQuery<Resource, ResourceCriteria> resources = new CriteriaQuery<Resource, ResourceCriteria>(
+ criteria, queryExecutor);
+
+ start = System.currentTimeMillis();
+ int prevId = 0;
+ //iterate over the entire result set efficiently
+ ArrayList<String> alreadySeen = new ArrayList<String>();
+ int actualCount = 0;
+ for (Resource r : resources) {
+ System.out.println(actualCount + " @@@ " + r.getId() + ":"
+ + ((resourceNames.containsKey(String.valueOf(r.getId()))) ? "NEW" : "DIRTY") + ":" + r.getName());
+ assert r.getId() > prevId : "Results should be sorted by ID ASC, something is out of order";
+ prevId = r.getId();
+ actualCount++;
+ resourceNames.remove(String.valueOf(r.getId()));
+ }
+
+ System.out.println("----------- Parsed " + actualCount + " resource(s) in "
+ + (System.currentTimeMillis() - start) + " ms.");
+
+ //test that entire list parsed spanning multiple pages
+ assert resourceNames.size() == 0 : "Expected resourceNames to be empty. Still " + resourceNames.size()
+ + " name(s).";
+
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
}
\ No newline at end of file
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
index 5e30b87..ab6a915 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
@@ -27,6 +27,7 @@ import java.util.NoSuchElementException;
import org.rhq.core.domain.criteria.BaseCriteria;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
/** This class provides a way to make PageList results easily iterable with 'for each','while',etc. loops
* and importantly automatically handles iteration through all PageControl results. This
@@ -50,9 +51,28 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
//Executor
private CriteriaQueryExecutor<T, C> queryExecutor;
+ /**
+ * It is important that the <code>criteria</code> includes sorting. If not then paging is nonsensical as the DB
+ * provides no guarantee of ordering. If no sort is specified, an implicit sort on ID is added.
+ *
+ * @param criteria The criteria applied to each execution of the fetch. If no sort is specified, an implicit sort on
+ * ID is added.
+ * @param queryExecutor
+ */
public CriteriaQuery(C criteria, CriteriaQueryExecutor<T, C> queryExecutor) {
this.criteria = criteria;
this.queryExecutor = queryExecutor;
+
+ // make sure we have at least a default sort, otherwise chunking doesn't work
+ PageControl pageControlOverrides = this.criteria.getPageControlOverrides();
+ if (null != pageControlOverrides) {
+ if (pageControlOverrides.getOrderingFields().isEmpty()) {
+ pageControlOverrides.addDefaultOrderingField("id");
+ }
+
+ } else if (this.criteria.getOrderingFieldNames().isEmpty()) {
+ this.criteria.addSortId(PageOrdering.ASC);
+ }
}
/** Returns iterator for a single page of results as defined by
@@ -104,21 +124,31 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
if (count == currentPage.getTotalSize()) {
throw new NoSuchElementException();
}
- deletable = null;//reset deletable.
+
+ deletable = null; // reset deletable.
+
//remove all flagged instances of T
if (!forDeletion.isEmpty()) {
currentPage.removeAll(forDeletion);
forDeletion.clear();
}
- PageControl pc = currentPage.getPageControl();
- criteria.setPaging(pc.getPageNumber() + 1, pc.getPageSize());
+ // advance the page. Although strange to be using a page control override in conjunction with
+ // CriteriaQuery, nonetheless make sure we advance it if it exists, because the normal setPaging is
+ // ignored when their is an overrides.
+ PageControl pcCurrent = currentPage.getPageControl();
+ PageControl pcOverrides = criteria.getPageControlOverrides();
+
+ if (null != pcOverrides) {
+ pcOverrides.setPageNumber(pcOverrides.getPageNumber() + 1);
+ } else {
+ criteria.setPaging(pcCurrent.getPageNumber() + 1, pcCurrent.getPageSize());
+ }
+
//help out the GC.
currentPage.clear();
- //move the current pagelist forward one
currentPage = queryExecutor.execute(criteria);
- currentPage.setPageControl(new PageControl(pc.getPageNumber() + 1, pc.getPageSize()));
iterator = currentPage.iterator();
}
commit ee7aabd4672dde076ed804fcb65c4b84f9d4c5b3
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Wed Feb 20 10:40:34 2013 -0500
small change to help out GC for large parses.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
index 82c4b21..5e30b87 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
@@ -113,6 +113,9 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
PageControl pc = currentPage.getPageControl();
criteria.setPaging(pc.getPageNumber() + 1, pc.getPageSize());
+ //help out the GC.
+ currentPage.clear();
+
//move the current pagelist forward one
currentPage = queryExecutor.execute(criteria);
currentPage.setPageControl(new PageControl(pc.getPageNumber() + 1, pc.getPageSize()));
commit ed395405ae926481cf23b1f0d402a69463726ed7
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Wed Feb 20 10:26:02 2013 -0500
Fix issue with CriteriaQuery where no sorting was being applied resulting in dirty reads for large parses.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
index 6b93f7a..e746deb 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
@@ -237,9 +237,6 @@ public class ResourceStorageTest extends AbstractEJB3Test {
//verify that all resource objects are actually parsed.
Map<String, Object> resourceNames = new HashMap<String, Object>();
-
- ArrayList<Resource> allResources = new ArrayList<Resource>();
-
int resourceCount = 700; //assuming 200 per page at least 4 pages of results.
try {
@@ -275,8 +272,8 @@ public class ResourceStorageTest extends AbstractEJB3Test {
//query the results and delete the resources
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterName(prefix);
+ criteria.addSortName(PageOrdering.ASC);
criteria.setPaging(0, 47);
- // PageList<Resource> resources = resourceManager.findResourcesByCriteria(subject, criteria);
//iterate over the results with CriteriaQuery
CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
@@ -292,12 +289,16 @@ public class ResourceStorageTest extends AbstractEJB3Test {
start = System.currentTimeMillis();
//iterate over the entire result set efficiently
+ ArrayList<String> alreadySeen = new ArrayList<String>();
+ int actualCount = 0;
for (Resource r : resources) {
- allResources.add(r);
+ actualCount++;
+ // System.out.println(actualCount + " @@@ " + r.getId() + ":"
+ // + ((resourceNames.containsKey(String.valueOf(r.getId()))) ? "NEW" : "DIRTY") + ":" + r.getName());
resourceNames.remove(String.valueOf(r.getId()));
}
- System.out.println("----------- Parsed " + resourceCount + " resource(s) in "
+ System.out.println("----------- Parsed " + actualCount + " resource(s) in "
+ (System.currentTimeMillis() - start)
+ " ms.");
commit e705b8b0d4f1013079d8370e172034e5985f22db
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Wed Feb 20 09:17:20 2013 -0500
Add delete support to CriteriaQuery during iteration process.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
index eb65599..82c4b21 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
@@ -20,6 +20,7 @@
*/
package org.rhq.enterprise.server.util;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -27,13 +28,13 @@ import org.rhq.core.domain.criteria.BaseCriteria;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-/** This class provides a way to make PageList results easily iterable for 'for each' loops
+/** This class provides a way to make PageList results easily iterable with 'for each','while',etc. loops
* and importantly automatically handles iteration through all PageControl results. This
* means that with a CriteriaQuery instance once can do:
*
* for (Resource entity : query) {
*
- * and automatically page through the results in PageControl.getPageSize(def. 200) chunks.
+ * and automatically page through all of the results in PageControl.getPageSize(def. 200) chunks.
*
* @author John Sanda
* @author Simeon Pinder
@@ -71,14 +72,18 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
// i)creates page sized chunks results
// ii)at the end of each pageList, moves the iterator to next page and continues iteration
//
- //NOTE: Assumes criteria page iteration starts with page 0. If that is not the case
- private class QueryResultsIterator implements Iterator<T> {
+ //NOTE: Assumes criteria page iteration starts with page 0. Will continue to iterate over N members.
+ protected class QueryResultsIterator implements Iterator<T> {
private int count;
private PageList<T> currentPage;
private Iterator<T> iterator;
+ private T deletable = null;
+
+ private ArrayList<T> forDeletion = new ArrayList<T>();
+
/**The first pageList returned by the criteria instance is where iteration begins.
* @param firstPage
*/
@@ -99,6 +104,12 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
if (count == currentPage.getTotalSize()) {
throw new NoSuchElementException();
}
+ deletable = null;//reset deletable.
+ //remove all flagged instances of T
+ if (!forDeletion.isEmpty()) {
+ currentPage.removeAll(forDeletion);
+ forDeletion.clear();
+ }
PageControl pc = currentPage.getPageControl();
criteria.setPaging(pc.getPageNumber() + 1, pc.getPageSize());
@@ -109,22 +120,20 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
}
T next = iterator.next();
+ deletable = next;
count++;
return next;
}
@Override
public void remove() {
- throw new UnsupportedOperationException("This iterator does not support removal.");
- }
- }
-
- public PageList<T> loadAsList() {
- Iterator<T> iterator = iterator();
- PageList<T> list = new PageList<T>();
- while (iterator.hasNext()) {
- list.add(iterator.next());
+ if (deletable != null) {
+ forDeletion.add(deletable);
+ deletable = null;
+ } else {
+ throw new IllegalStateException(
+ "Not allowed to call remove() without calling next() just before this call.");
+ }
}
- return list;
}
}
commit d6081f71933379e8d1455f7003eac5fcbaae5d1b
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 10:35:20 2013 -0500
Fix issue with conversion to CriteriaQuery usage.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
index 9fd49a7..368f5d8 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
@@ -125,7 +125,8 @@ public class RepoScriptSourceProvider extends BaseRhqSchemeScriptSourceProvider
CriteriaQuery<PackageAndLatestVersionComposite, PackageCriteria> pvs = new CriteriaQuery<PackageAndLatestVersionComposite, PackageCriteria>(
pCrit, pQueryExecutor);
- if (!pvs.iterator().hasNext()) {
+ // if (!pvs.iterator().hasNext()) {
+ if (pvs.iterator().hasNext()) {
PackageAndLatestVersionComposite pv = pvs.iterator().next();
byte[] bytes = repoManager.getPackageVersionBytes(rhqFacade.getSubject(), repo.getId(), pv
commit b22eeffcdaf0f5f37033705bd697faa0327d5076
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 06:05:15 2013 -0500
Removing earlier paging/CriteriaQuery changes as REST will be handling this differently.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
index 6b4c4ba..032bf97 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
@@ -83,8 +83,6 @@ import org.rhq.enterprise.server.rest.domain.GroupRest;
import org.rhq.enterprise.server.rest.domain.Link;
import org.rhq.enterprise.server.rest.domain.MetricSchedule;
import org.rhq.enterprise.server.rest.domain.ResourceWithType;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Deal with group related things.
@@ -124,16 +122,7 @@ public class GroupHandlerBean extends AbstractRestBean {
criteria.addFilterName(q);
}
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<ResourceGroup, ResourceGroupCriteria> queryExecutor = new CriteriaQueryExecutor<ResourceGroup, ResourceGroupCriteria>() {
- @Override
- public PageList<ResourceGroup> execute(ResourceGroupCriteria criteria) {
- return resourceGroupManager.findResourceGroupsByCriteria(caller, criteria);
- }
- };
-
- CriteriaQuery<ResourceGroup, ResourceGroupCriteria> groups = new CriteriaQuery<ResourceGroup, ResourceGroupCriteria>(
- criteria, queryExecutor);
+ PageList<ResourceGroup> groups = resourceGroupManager.findResourceGroupsByCriteria(caller, criteria);
List<GroupRest> list = new ArrayList<GroupRest>();
for (ResourceGroup group : groups) {
@@ -415,16 +404,7 @@ public class GroupHandlerBean extends AbstractRestBean {
criteria.addFilterName(q);
}
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<GroupDefinition, ResourceGroupDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<GroupDefinition, ResourceGroupDefinitionCriteria>() {
- @Override
- public PageList<GroupDefinition> execute(ResourceGroupDefinitionCriteria criteria) {
- return definitionManager.findGroupDefinitionsByCriteria(caller, criteria);
- }
- };
-
- CriteriaQuery<GroupDefinition, ResourceGroupDefinitionCriteria> gdlist = new CriteriaQuery<GroupDefinition, ResourceGroupDefinitionCriteria>(
- criteria, queryExecutor);
+ PageList<GroupDefinition> gdlist = definitionManager.findGroupDefinitionsByCriteria(caller, criteria);
List<GroupDefinitionRest> list = new ArrayList<GroupDefinitionRest>();
for (GroupDefinition def: gdlist) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
index 2e8f99c..a94b81c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
@@ -76,8 +76,6 @@ import org.rhq.enterprise.server.rest.domain.OperationDefinitionRest;
import org.rhq.enterprise.server.rest.domain.OperationHistoryRest;
import org.rhq.enterprise.server.rest.domain.OperationRest;
import org.rhq.enterprise.server.rest.domain.SimplePropDef;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Deal with operations
@@ -390,16 +388,7 @@ public class OperationsHandlerBean extends AbstractRestBean {
criteria.addSortEndTime(PageOrdering.DESC);
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<ResourceOperationHistory, ResourceOperationHistoryCriteria> queryExecutor = new CriteriaQueryExecutor<ResourceOperationHistory, ResourceOperationHistoryCriteria>() {
- @Override
- public PageList<ResourceOperationHistory> execute(ResourceOperationHistoryCriteria criteria) {
- return opsManager.findResourceOperationHistoriesByCriteria(caller, criteria);
- }
- };
-
- CriteriaQuery<ResourceOperationHistory, ResourceOperationHistoryCriteria> list = new CriteriaQuery<ResourceOperationHistory, ResourceOperationHistoryCriteria>(
- criteria, queryExecutor);
+ PageList<ResourceOperationHistory> list = opsManager.findResourceOperationHistoriesByCriteria(caller, criteria);
List<OperationHistoryRest> result = new ArrayList<OperationHistoryRest>();
for (ResourceOperationHistory roh : list) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
index b748833..f518952 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
@@ -329,7 +329,6 @@ public class ResourceHandlerBean extends AbstractRestBean {
criteria.addFilterInterval(start,end);
criteria.addFilterResourceId(resourceId);
criteria.addSortStartTime(PageOrdering.DESC);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
List<Availability> points = availMgr.findAvailabilityByCriteria(caller,criteria);
List<AvailabilityRest> ret = new ArrayList<AvailabilityRest>(points.size());
@@ -524,7 +523,6 @@ public class ResourceHandlerBean extends AbstractRestBean {
public List<Link> getAlertsForResource(@ApiParam("Id of the resource to query") @PathParam("id") int resourceId) {
AlertCriteria criteria = new AlertCriteria();
criteria.addFilterResourceIds(resourceId);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
List<Alert> alerts = alertManager.findAlertsByCriteria(caller, criteria);
List<Link> links = new ArrayList<Link>(alerts.size());
commit 9ba9f80aaa95d4f5ee3e209d26315d1cb70e12b8
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:43:55 2013 -0500
Remove any paging changes as REST will handle paging differently.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
index e550bd2..becb680 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
@@ -61,14 +61,11 @@ import org.rhq.core.domain.event.EventSource;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.event.EventManagerLocal;
import org.rhq.enterprise.server.rest.domain.EventDefinitionRest;
import org.rhq.enterprise.server.rest.domain.EventRest;
import org.rhq.enterprise.server.rest.domain.EventSourceRest;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Handle event related things
@@ -308,16 +305,8 @@ public class EventHandlerBean extends AbstractRestBean {
private Response.ResponseBuilder getEventsAsBuilderForCriteria(HttpHeaders headers, EventCriteria criteria) {
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<Event, EventCriteria> queryExecutor = new CriteriaQueryExecutor<Event, EventCriteria>() {
- @Override
- public PageList<Event> execute(EventCriteria criteria) {
- return eventManager.findEventsByCriteria(caller, criteria);
- }
- };
-
- CriteriaQuery<Event, EventCriteria> eventList = new CriteriaQuery<Event, EventCriteria>(criteria, queryExecutor);
- List<EventRest> restEvents = new ArrayList<EventRest>();
+ List<Event> eventList = eventManager.findEventsByCriteria(caller, criteria);
+ List<EventRest> restEvents = new ArrayList<EventRest>(eventList.size());
for (Event event : eventList) {
restEvents.add(convertEvent(event));
}
commit 2cb4c49448eeb7730ba064a2692929ddc45aa9c1
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:37:31 2013 -0500
Commenting out unused code. No need to execute the query if we don't process the results.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 6521730..a1ff092 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -83,7 +83,6 @@ import org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceError;
@@ -2625,12 +2624,12 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
}
} else if (tt == PropertyOptionsSource.TargetType.GROUP) {
- // for groups we need to talk to the group manager
- ResourceGroupCriteria criteria = new ResourceGroupCriteria();
- criteria.setSearchExpression(expression);
-
- //?? spinder 2-12-13: We don't do anything with the composite results here?
- resourceGroupManager.findResourceGroupCompositesByCriteria(subject, criteria);
+ // spinder 2-15-13: commenting out this code below as we don't appear to be using any of it. Half done.
+ // // for groups we need to talk to the group manager
+ // ResourceGroupCriteria criteria = new ResourceGroupCriteria();
+ // criteria.setSearchExpression(expression);
+ //
+ // resourceGroupManager.findResourceGroupCompositesByCriteria(subject, criteria);
}
// TODO plugin and resourceType
}
commit bacb200a03eb9ac474a61bf10c9121fd56e4e13e
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:32:12 2013 -0500
Removing criteriaQuery usage here as paging needs to be handled by caller instead.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
index 239cf35..5d149a1 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
@@ -82,8 +82,6 @@ import org.rhq.enterprise.server.agentclient.AgentClient;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.plugin.pc.drift.DriftChangeSetSummary;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -180,24 +178,13 @@ public class JPADriftServerBean implements JPADriftServerLocal {
}
@Override
- public PageList<DriftComposite> findDriftCompositesByCriteria(final Subject subject, DriftCriteria criteria) {
+ public PageList<DriftComposite> findDriftCompositesByCriteria(Subject subject, DriftCriteria criteria) {
JPADriftCriteria jpaCriteria = (criteria instanceof JPADriftCriteria) ? (JPADriftCriteria) criteria
: new JPADriftCriteria(criteria);
jpaCriteria.fetchChangeSet(true);
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<JPADrift, JPADriftCriteria> queryExecutor = new CriteriaQueryExecutor<JPADrift, JPADriftCriteria>() {
- @Override
- public PageList<JPADrift> execute(JPADriftCriteria jpaCriteria) {
- return findDriftsByCriteria(subject, jpaCriteria);
- }
- };
-
- CriteriaQuery<JPADrift, JPADriftCriteria> drifts = new CriteriaQuery<JPADrift, JPADriftCriteria>(jpaCriteria,
- queryExecutor);
-
+ PageList<JPADrift> drifts = findDriftsByCriteria(subject, jpaCriteria);
PageList<DriftComposite> result = new PageList<DriftComposite>();
for (JPADrift drift : drifts) {
JPADriftChangeSet changeSet = drift.getChangeSet();
commit 835f4a546bfdd626c9519e3a4c2b9245e2cfee1a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:25:30 2013 -0500
Remove this occurrence of CriteriaQuery usage.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index 68af1e7..f749c9c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -111,8 +111,6 @@ import org.rhq.enterprise.server.plugin.pc.content.PackageTypeBehavior;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -1595,26 +1593,17 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
return runner.execute();
}
- public PageList<PackageAndLatestVersionComposite> findPackagesWithLatestVersion(final Subject subject,
+ public PageList<PackageAndLatestVersionComposite> findPackagesWithLatestVersion(Subject subject,
PackageCriteria criteria) {
if (criteria.getFilterRepoId() == null) {
throw new IllegalArgumentException("The criteria query has to have a filter for a specific repo.");
}
criteria.fetchVersions(true);
+ PageList<Package> packages = findPackagesByCriteria(subject, criteria);
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<Package, PackageCriteria> queryExecutor = new CriteriaQueryExecutor<Package, PackageCriteria>() {
- @Override
- public PageList<Package> execute(PackageCriteria criteria) {
- return findPackagesByCriteria(subject, criteria);
- }
- };
-
- CriteriaQuery<Package, PackageCriteria> packages = new CriteriaQuery<Package, PackageCriteria>(criteria,
- queryExecutor);
-
- PageList<PackageAndLatestVersionComposite> ret = new PageList<PackageAndLatestVersionComposite>();
+ PageList<PackageAndLatestVersionComposite> ret = new PageList<PackageAndLatestVersionComposite>(
+ packages.getTotalSize(), packages.getPageControl());
for(Package p : packages) {
PackageVersion latest = repoManager.getLatestPackageVersion(subject, p.getId(), criteria.getFilterRepoId());
commit f7146a6313337bfe23b9e0a52edb817b5df4e222
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:17:00 2013 -0500
Revert to just use clearPaging as CriteriaQuery usage not needed.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
index 711a653..a52c4c2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
@@ -1,6 +1,6 @@
package org.rhq.enterprise.server.resource.metadata;
-import java.util.ArrayList;
+import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -12,11 +12,8 @@ import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertTemplateManagerLocal;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class AlertMetadataManagerBean implements AlertMetadataManagerLocal {
@@ -30,32 +27,21 @@ public class AlertMetadataManagerBean implements AlertMetadataManagerLocal {
private AlertTemplateManagerLocal alertTemplateMgr;
@Override
- public void deleteAlertTemplates(final Subject subject, ResourceType resourceType) {
+ public void deleteAlertTemplates(Subject subject, ResourceType resourceType) {
log.debug("Deleting alert templates for " + resourceType);
AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
criteria.addFilterAlertTemplateResourceTypeId(resourceType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<AlertDefinition, AlertDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<AlertDefinition, AlertDefinitionCriteria>() {
- @Override
- public PageList<AlertDefinition> execute(AlertDefinitionCriteria criteria) {
- return alertDefinitionMgr.findAlertDefinitionsByCriteria(subject, criteria);
- }
- };
+ List<AlertDefinition> templates = alertDefinitionMgr.findAlertDefinitionsByCriteria(subject, criteria);
- CriteriaQuery<AlertDefinition, AlertDefinitionCriteria> templates = new CriteriaQuery<AlertDefinition, AlertDefinitionCriteria>(
- criteria, queryExecutor);
-
- ArrayList<Integer> templateIdList = new ArrayList<Integer>();
+ Integer[] templateIds = new Integer[templates.size()];
int i = 0;
for (AlertDefinition template : templates) {
- templateIdList.add(template.getId());
+ templateIds[i++] = template.getId();
}
- Integer[] templateIds = new Integer[templateIdList.size()];
- templateIds = templateIdList.toArray(templateIds);
-
// Alert definitions associated with individual resources and with groups
// are deleted as part of resource deletion. This commit adds support for
// templates which are alert definitions associated with the resource
commit 3f33214af914fb3411f0d297020347f275cfc95b
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:10:37 2013 -0500
Revert to only clearpaging updates here as CriteriaQuery usage is unnecessary.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index 773176b..9b20aef 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -74,8 +74,6 @@ import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerRemote;
import org.rhq.enterprise.server.operation.OperationManagerRemote;
import org.rhq.enterprise.server.resource.ResourceManagerRemote;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Implements a local object that exposes resource related data as
@@ -237,18 +235,9 @@ public class ResourceClientProxy {
private void initChildren() {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterParentResourceId(resourceId);
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
- @Override
- public PageList<Resource> execute(ResourceCriteria criteria) {
- return remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
- remoteClient.getSubject(), criteria);
- }
- };
-
- CriteriaQuery<Resource, ResourceCriteria> childResources = new CriteriaQuery<Resource, ResourceCriteria>(
- criteria, queryExecutor);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+ PageList<Resource> childResources = remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
+ remoteClient.getSubject(), criteria);
for (Resource child : childResources) {
this.children.add(proxyFactory.getResource(child.getId()));
@@ -258,26 +247,14 @@ public class ResourceClientProxy {
private void initMeasurements() {
MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
criteria.addFilterResourceTypeId(resource.getResourceType().getId());
- // criteria.addFilterResourceTypeName(resource.getResourceType().getName());
- // criteria.setStrict(true);
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria>() {
- @Override
- public PageList<MeasurementDefinition> execute(MeasurementDefinitionCriteria criteria) {
- return remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
- .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
- }
- };
-
- CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria> measurementDefIterator = new CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria>(
- criteria, queryExecutor);
+ // criteria.addFilterResourceTypeName(resource.getResourceType().getName());
+ // criteria.setStrict(true);
- this.measurementDefinitions = new PageList<MeasurementDefinition>();
+ this.measurementDefinitions = remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
+ .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
this.measurementMap = new HashMap<String, Measurement>();
- for (MeasurementDefinition def : measurementDefIterator) {
- this.measurementDefinitions.add(def);
+ for (MeasurementDefinition def : measurementDefinitions) {
Measurement m = new Measurement(def);
String name = def.getDisplayName().replaceAll("\\W", "");
commit 8d55baaac5f93f222dd14383884fe8538d752cc5
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 04:52:36 2013 -0500
Remove CriteriaQuery usage as unnecessary here.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index e005121..13baa3c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -126,8 +126,6 @@ import org.rhq.enterprise.server.resource.disambiguation.DisambiguationUpdateStr
import org.rhq.enterprise.server.resource.disambiguation.Disambiguator;
import org.rhq.enterprise.server.resource.group.ResourceGroupDeleteException;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.QueryUtility;
@@ -882,7 +880,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return resourceLineage;
}
- public Map<Integer, String> getResourcesAncestry(final Subject subject, Integer[] resourceIds,
+ public Map<Integer, String> getResourcesAncestry(Subject subject, Integer[] resourceIds,
ResourceAncestryFormat format) {
Map<Integer, String> result = new HashMap<Integer, String>(resourceIds.length);
@@ -890,20 +888,10 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return result;
}
- final ResourceCriteria resourceCriteria = new ResourceCriteria();
+ ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterIds(resourceIds);
resourceCriteria.fetchResourceType(true);
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
- @Override
- public PageList<Resource> execute(ResourceCriteria criteria) {
- return findResourcesByCriteria(subject, resourceCriteria);
- }
- };
-
- CriteriaQuery<Resource, ResourceCriteria> resources = new CriteriaQuery<Resource, ResourceCriteria>(
- resourceCriteria, queryExecutor);
+ List<Resource> resources = findResourcesByCriteria(subject, resourceCriteria);
if (ResourceAncestryFormat.RAW == format) {
for (Resource resource : resources) {
@@ -925,36 +913,17 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// In addition to the types of the result resources, get the types of their ancestry
typesSet.addAll(getAncestryTypeIds(ancestries));
- final ResourceTypeCriteria resourceTypeCriteria = new ResourceTypeCriteria();
+ ResourceTypeCriteria resourceTypeCriteria = new ResourceTypeCriteria();
resourceTypeCriteria.addFilterIds(typesSet.toArray(new Integer[typesSet.size()]));
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria> rtQueryExecutor =
- new CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria>() {
- @Override
- public PageList<ResourceType> execute(ResourceTypeCriteria criteria) {
- return typeManager.findResourceTypesByCriteria(subject, resourceTypeCriteria);
- }
- };
-
- CriteriaQuery<ResourceType, ResourceTypeCriteria> types =
- new CriteriaQuery<ResourceType, ResourceTypeCriteria>(resourceTypeCriteria, rtQueryExecutor);
+ List<ResourceType> types = typeManager.findResourceTypesByCriteria(subject, resourceTypeCriteria);
for (Resource resource : resources) {
- String decodedAncestry = getDecodedAncestry(resource, loadAsList(types.iterator()), format);
+ String decodedAncestry = getDecodedAncestry(resource, types, format);
result.put(resource.getId(), decodedAncestry);
}
return result;
}
- private List<ResourceType> loadAsList(Iterator<ResourceType> iterator) {
- PageList<ResourceType> list = new PageList<ResourceType>();
- while(iterator.hasNext()){
- list.add(iterator.next());
- }
- return list;
- }
-
/**
* Get the complete set of resource type Ids in the ancestries provided. This is useful for
* being able to load all the types in advance of generating decoded values.
commit 1d2618a3e388ad46f390732bc5101fef67c94e8c
Merge: db38ce2 f7409c5
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Sun Feb 17 22:19:02 2013 -0500
Merge branch 'track_master' into spinder/criteriaUsage
Conflicts:
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
commit db38ce2e7137d4507194ee296fbc51358b6719ed
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Sun Feb 17 22:10:41 2013 -0500
Add test to exercise CriteriaQuery iteration for large result sets.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
index d748109..6b93f7a 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
@@ -18,9 +18,13 @@
*/
package org.rhq.enterprise.server.resource.test;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Random;
+import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.apache.commons.logging.Log;
@@ -28,11 +32,15 @@ import org.apache.commons.logging.LogFactory;
import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.OrderingField;
import org.rhq.core.domain.util.PageControl;
@@ -44,7 +52,10 @@ import org.rhq.enterprise.server.discovery.DiscoveryBossLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.util.SessionTestHelper;
public class ResourceStorageTest extends AbstractEJB3Test {
private Log log = LogFactory.getLog(ResourceStorageTest.class);
@@ -208,4 +219,94 @@ public class ResourceStorageTest extends AbstractEJB3Test {
Subject rhqadmin = subjectManager.loginUnauthenticated("rhqadmin");
System.out.println(rhqadmin);
}
+
+ /** Test creates a large number of resources and pages through them using CriteriaQuery.
+ * NOTE: CriteriaQuery uses PageList instances underneath and are susceptible to dirty
+ * read issues if the total number of resources being parsed is i)very large or ii)processing
+ * each instance takes a significant amount of time. Ex. Begin parsing all resource types,
+ * while plugin update is removing some of those same types.
+ *
+ * @throws Exception
+ */
+ @SuppressWarnings("unused")
+ @Test(groups = "integration.ejb3")
+ public void testParsingCriteriaQueryResults() throws Exception {
+ getTransactionManager().begin();
+ EntityManager entityMgr = getEntityManager();
+ final ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
+
+ //verify that all resource objects are actually parsed.
+ Map<String, Object> resourceNames = new HashMap<String, Object>();
+
+ ArrayList<Resource> allResources = new ArrayList<Resource>();
+
+ int resourceCount = 700; //assuming 200 per page at least 4 pages of results.
+
+ try {
+ final Subject subject = SessionTestHelper.createNewSubject(entityMgr, "testSubject");
+
+ Role roleWithSubject = SessionTestHelper.createNewRoleForSubject(entityMgr, subject, "role with subject");
+ roleWithSubject.addPermission(Permission.VIEW_RESOURCE);
+
+ ResourceGroup group = SessionTestHelper.createNewCompatibleGroupForRole(entityMgr, roleWithSubject,
+ "accessible group");
+
+ String tuid = "" + new Random().nextInt();
+ //create large number of resources
+ String prefix = "largeResultSet-" + tuid + "-";
+ System.out.println("-------- Creating " + resourceCount
+ + " resource(s). This may take a while ....");
+
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < resourceCount; i++) {
+ String name = prefix + i;
+ Resource r = SessionTestHelper.createNewResourceForGroup(entityMgr, group, name);
+ //store away each resource name/key
+ resourceNames.put(String.valueOf(r.getId()), name);
+ }
+ entityMgr.flush();
+
+ System.out.println("----------- Created " + resourceCount + " resource(s) in "
+ + (System.currentTimeMillis() - start)
+ + " ms.");
+
+ assert resourceNames.size() == resourceCount;//assert all resources loaded/created
+
+ //query the results and delete the resources
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterName(prefix);
+ criteria.setPaging(0, 47);
+ // PageList<Resource> resources = resourceManager.findResourcesByCriteria(subject, criteria);
+
+ //iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceManager.findResourcesByCriteria(subject, criteria);
+ }
+ };
+
+ //initiate first/(total depending on page size) request.
+ CriteriaQuery<Resource, ResourceCriteria> resources = new CriteriaQuery<Resource, ResourceCriteria>(
+ criteria, queryExecutor);
+
+ start = System.currentTimeMillis();
+ //iterate over the entire result set efficiently
+ for (Resource r : resources) {
+ allResources.add(r);
+ resourceNames.remove(String.valueOf(r.getId()));
+ }
+
+ System.out.println("----------- Parsed " + resourceCount + " resource(s) in "
+ + (System.currentTimeMillis() - start)
+ + " ms.");
+
+ //test that entire list parsed spanning multiple pages
+ assert resourceNames.size() == 0 : "Expected resourceNames to be empty. Still " + resourceNames.size()
+ + " name(s).";
+
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
}
\ No newline at end of file
commit 42593fc93ee5fffe4c270b60fedcce0101a25e66
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Feb 14 18:23:36 2013 +0100
Fix JMX plugin test failure
diff --git a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
index b841a38..9757c7a 100644
--- a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
+++ b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
@@ -72,8 +72,6 @@ import org.rhq.plugins.jmx.util.JvmResourceKey;
* @author Greg Hinkle
* @author Ian Springer
*/
-// Disabled until we find a fix for Sigar getProcCredName issue
-@Test(enabled = false)
public class JMXPluginTest {
private static final int JMX_REMOTING_PORT1 = 9921;
@@ -95,8 +93,9 @@ public class JMXPluginTest {
this.testServerJvms.add(startTestServerJvm("-Dcom.sun.management.jmxremote.port=" + JMX_REMOTING_PORT1,
"-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.authenticate=false"));
- this.testServerJvms.add(startTestServerJvm("-D" + JMXDiscoveryComponent.SYSPROP_RHQ_RESOURCE_KEY + "="
- + EXPLICIT_RESOURCE_KEY1));
+ // FIXME: Disabled until we find a fix for Sigar getProcCredName issue
+ // this.testServerJvms.add(startTestServerJvm("-D" + JMXDiscoveryComponent.SYSPROP_RHQ_RESOURCE_KEY + "="
+ // + EXPLICIT_RESOURCE_KEY1));
this.testServerJvms.add(startTestServerJvm("-Dcom.sun.management.jmxremote.port=" + JMX_REMOTING_PORT2,
"-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.authenticate=false",
@@ -206,7 +205,8 @@ public class JMXPluginTest {
}
}
assert foundJmxRemotingServer : "JMX Remoting server not found.";
- assert foundExplicitKey1Server : "Explicit key server not found.";
+ // FIXME: Disabled until we find a fix for Sigar getProcCredName issue
+ //assert foundExplicitKey1Server : "Explicit key server not found.";
assert foundExplicitKey2Server : "JMX Remoting + explicit key server not found.";
}
commit e7311690dd0c28a9d75b6b7a481291bcd13634db
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 13 20:09:02 2013 +0100
Fix the expectations of the JMock-based apache plugin integration tests
after the fixes in the inventory report processing that changed the workflow
slightly.
This should make the apache integration tests pass again.
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
index a7f6697..37d8433 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
@@ -117,7 +117,7 @@ public class FakeServerInventory {
InventoryReport inventoryReport = (InventoryReport) invocation.getParameter(0);
for (Resource res : inventoryReport.getAddedRoots()) {
- Resource persisted = fakePersist(res, judge, new HashSet<String>());
+ Resource persisted = fakePersist(res, requiredInventoryStatus, new HashSet<String>());
if (res.getParentResource() == Resource.ROOT) {
platform = persisted;
@@ -333,7 +333,7 @@ public class FakeServerInventory {
}
}
- private Resource fakePersist(Resource agentSideResource, InventoryStatusJudge statusJudge,
+ private Resource fakePersist(Resource agentSideResource, InventoryStatus requiredInventoryStatus,
Set<String> inProgressUUIds) {
Resource persisted = resourceStore.get(agentSideResource.getUuid());
if (!inProgressUUIds.add(agentSideResource.getUuid())) {
commit 5c5706794ad060158ca832fcbd876dedb811d716
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Feb 14 15:28:02 2013 +0100
[BZ 909157 - Operation parameters are not shown in schedule operation details.] If the method refreshOperationParametersItem() is called when scheduling a new operation, the existent parameters are not forget.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
index 0f54af0..8436c2ab 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
@@ -355,7 +355,6 @@ public abstract class AbstractOperationScheduleDetailsView extends
this.operationParameters = (Configuration) record
.getAttributeAsObject(AbstractOperationScheduleDataSource.Field.PARAMETERS);
-
super.editExistingRecord(record);
}
@@ -426,11 +425,14 @@ public abstract class AbstractOperationScheduleDetailsView extends
private void refreshOperationParametersItem() {
String operationName = getSelectedOperationName();
String value;
- operationParameters = null; // reset params between dropdown selects
- // make sure we wipe out anything left by the previous op def
- for (Canvas child : this.operationParametersConfigurationHolder.getChildren()) {
- child.destroy();
+ if (isNewRecord()) { // BZ 909157: do it only for new schedule
+ operationParameters = null; // reset params between dropdown selects
+ // make sure we wipe out anything left by the previous op def
+ for (Canvas child : this.operationParametersConfigurationHolder.getChildren()) {
+ child.destroy();
+ }
}
+
if (operationName == null) {
value = "<i>" + MSG.view_operationScheduleDetails_fieldDefault_parameters() + "</i>";
this.operationParametersConfigurationHolder.hide();
@@ -453,8 +455,6 @@ public abstract class AbstractOperationScheduleDetailsView extends
ConfigurationTemplate defaultTemplate = parametersDefinition.getDefaultTemplate();
this.operationParameters = (defaultTemplate != null) ? defaultTemplate.createConfiguration()
: new Configuration();
- } else {
- this.operationParameters = new Configuration();
}
ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
commit 56f8cf4ff1a4ef2c3aa7959d25487e57897778bb
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 14 09:22:47 2013 -0500
installer now provides a "--force" option - this lets you re-run the installer even if you didn't set autoinstall.enabled=true
and it also lets you attempt another installation if a previous one failed in the middle of its prior attempt.
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
index 48defbc..b8a83fc 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
@@ -157,6 +157,7 @@ public class Installer {
usage.append("\t--host=<hostname>, -h: hostname where the app server is running").append("\n");
usage.append("\t--port=<port>, -p: talk to the app server over this management port").append("\n");
usage.append("\t--test, -t: test the validity of the server properties (install not performed)").append("\n");
+ usage.append("\t--force, -f: force the installer to try to install everything").append("\n");
usage.append("\t--listservers, -l: show list of known installed servers (install not performed)").append("\n");
usage.append("\t--setupdb, -b: only perform database schema creation or update").append("\n");
usage.append("\t--reconfig, -r: resets some configuration settings in an installed server").append("\n");
@@ -166,7 +167,7 @@ public class Installer {
}
private WhatToDo[] processArguments(String[] args) throws Exception {
- String sopts = "-:HD:h:p:d:blrt";
+ String sopts = "-:HD:h:p:d:bflrt";
LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'H'),
new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'h'),
new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
@@ -174,6 +175,7 @@ public class Installer {
new LongOpt("setupdb", LongOpt.NO_ARGUMENT, null, 'b'),
new LongOpt("listservers", LongOpt.NO_ARGUMENT, null, 'l'),
new LongOpt("reconfig", LongOpt.NO_ARGUMENT, null, 'r'),
+ new LongOpt("force", LongOpt.NO_ARGUMENT, null, 'f'),
new LongOpt("test", LongOpt.NO_ARGUMENT, null, 't') };
boolean test = false;
@@ -255,6 +257,11 @@ public class Installer {
break; // don't return, in case we need to allow more args
}
+ case 'f': {
+ this.installerConfig.setForceInstall(true);
+ break; // don't return, in case we need to allow more args
+ }
+
case 'l': {
listservers = true;
break; // don't return, we need to allow more args to be processed, like -p or -h
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java
index 0852b78..3adecbe 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java
@@ -28,6 +28,7 @@ package org.rhq.enterprise.server.installer;
public class InstallerConfiguration {
private String managementHost = "127.0.0.1";
private int managementPort = 9999; // this is the default AS port
+ private boolean forceInstall = false;
public InstallerConfiguration() {
}
@@ -59,4 +60,12 @@ public class InstallerConfiguration {
}
this.managementPort = port;
}
+
+ public boolean isForceInstall() {
+ return this.forceInstall;
+ }
+
+ public void setForceInstall(boolean flag) {
+ this.forceInstall = flag;
+ }
}
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
index 3ece569..e72f133 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
@@ -86,7 +86,7 @@ public class InstallerServiceImpl implements InstallerService {
return;
}
if (allServerDetails.size() == 0) {
- log.info("There are no known servers currently registered");
+ log("There are no known servers currently registered");
return;
}
@@ -108,7 +108,7 @@ public class InstallerServiceImpl implements InstallerService {
info.append(serverDetails.getEndpointSecurePortString());
info.append("\n");
}
- log.info(info.toString());
+ log(info.toString());
return;
}
@@ -136,15 +136,21 @@ public class InstallerServiceImpl implements InstallerService {
ServerDetails detailsFromProps = getServerDetailsFromPropertiesOnly(serverProperties);
ServerDetails detailsFromDb = getServerDetails(dbUrl, dbUsername, clearTextDbPassword,
detailsFromProps.getName());
+ ExistingSchemaOption existingSchemaOption = getAutoinstallExistingSchemaOption(serverProperties);
+
if (detailsFromDb == null) {
- log.info("This will be considered a new server: " + detailsFromProps);
+ log("This will be considered a new server: " + detailsFromProps);
} else {
- log.info("This [" + detailsFromProps + "] will be considered a reinstallation of an existing server ["
- + detailsFromDb + "]");
+ if (existingSchemaOption == ExistingSchemaOption.OVERWRITE) {
+ log("This [" + detailsFromProps + "] will OVERWRITE the existing server [" + detailsFromDb
+ + "] that already exists in the database.");
+ } else {
+ log("This [" + detailsFromProps + "] will be considered a reinstallation of an existing server ["
+ + detailsFromDb + "]");
+ }
}
// just warns if the schema will be overwritten
- ExistingSchemaOption existingSchemaOption = getAutoinstallExistingSchemaOption(serverProperties);
if (existingSchemaOption == ExistingSchemaOption.OVERWRITE) {
log.warn("The installer has been configured to OVERWRITE any existing data in the database. "
+ "If you do install with this configuration, realize that all existing data in the database "
@@ -153,10 +159,10 @@ public class InstallerServiceImpl implements InstallerService {
// just logs the location of the AS instance where RHQ will be installed
String appServerHomeDir = getAppServerHomeDir();
- log.info("The app server where the installation will go is found at: " + appServerHomeDir);
+ log("The app server where the installation will go is found at: " + appServerHomeDir);
// give some message to indicate everything looks OK and the user can start the real install
- log.info("It looks like everything is OK and you can start the installation.");
+ log("It looks like everything is OK and you can start the installation.");
}
@Override
@@ -177,8 +183,12 @@ public class InstallerServiceImpl implements InstallerService {
if (autoInstallMode) {
log("The server is preconfigured and ready for auto-install.");
} else {
- throw new AutoInstallDisabledException(
- "Auto-installation is disabled. Please fully configure rhq-server.properties");
+ if (this.installerConfiguration.isForceInstall()) {
+ log("Auto-installation would have been disabled, but installer was asked to force the install... continuing.");
+ } else {
+ throw new AutoInstallDisabledException(
+ "Auto-installation is disabled. Please fully configure rhq-server.properties");
+ }
}
// make an attempt to connect to the app server - we must make sure its running and we can connect to it
@@ -189,11 +199,21 @@ public class InstallerServiceImpl implements InstallerService {
final String installationResults = getInstallationResults();
if (installationResults != null) {
if (installationResults.length() == 0) {
- throw new AlreadyInstalledException(
- "The installer has already been told to perform its work. The server should be ready soon.");
+ if (this.installerConfiguration.isForceInstall()) {
+ log("The installer appears to have already been told to perform its work, but the installer was asked for force the install... continuing.");
+ } else {
+ throw new AlreadyInstalledException(
+ "The installer has already been told to perform its work. The server should be ready soon.");
+ }
} else {
- throw new Exception("The installer has already attempted to install the server but errors occurred:\n"
- + installationResults);
+ if (this.installerConfiguration.isForceInstall()) {
+ log("The installer is going to force another installation attempt, even though a previous attempt encountered errors:\n"
+ + installationResults);
+ } else {
+ throw new Exception(
+ "The installer has already attempted to install the server but errors occurred:\n"
+ + installationResults);
+ }
}
}
@@ -225,8 +245,12 @@ public class InstallerServiceImpl implements InstallerService {
String existingSchemaOption) throws AutoInstallDisabledException, AlreadyInstalledException, Exception {
if (isEarDeployed()) {
- throw new AlreadyInstalledException(
- "It looks like the installation has already been completed - there is nothing for the installer to do.");
+ if (this.installerConfiguration.isForceInstall()) {
+ log("It looks like the installation has already been completed, but the installer was asked for force the install... continuing.");
+ } else {
+ throw new AlreadyInstalledException(
+ "It looks like the installation has already been completed - there is nothing for the installer to do.");
+ }
}
prepareDatabase(serverProperties, serverDetails, existingSchemaOption);
@@ -930,7 +954,8 @@ public class InstallerServiceImpl implements InstallerService {
// Not only do we want to make sure we can connect, but we also want to wait for the subsystems to initialize.
// Let's wait for one of the subsystems to exist; once we know this is up, the rest are probably ready too.
if (!(new WebJBossASClient(getModelControllerClient()).isWebSubsystem())) {
- throw new IllegalStateException("The server does not appear to be fully started yet");
+ throw new IllegalStateException(
+ "The server does not appear to be fully started yet (the web subsystem did not start)");
}
return retVal;
@@ -1096,8 +1121,13 @@ public class InstallerServiceImpl implements InstallerService {
try {
mcc = getModelControllerClient();
CoreJBossASClient client = new CoreJBossASClient(mcc);
- log("Installing RHQ EAR startup subsystem extension");
- client.addExtension(RHQ_EXTENSION_NAME);
+ boolean isDeployed = client.isExtension(RHQ_EXTENSION_NAME);
+ if (!isDeployed) {
+ log("Installing RHQ EAR startup subsystem extension");
+ client.addExtension(RHQ_EXTENSION_NAME);
+ } else {
+ log("RHQ EAR startup subsystem extension is already deployed");
+ }
} finally {
safeClose(mcc);
}
@@ -1108,8 +1138,13 @@ public class InstallerServiceImpl implements InstallerService {
try {
mcc = getModelControllerClient();
CoreJBossASClient client = new CoreJBossASClient(mcc);
- log("Installing RHQ EAR subsystem");
- client.addSubsystem(RHQ_SUBSYSTEM_NAME);
+ boolean isDeployed = client.isSubsystem(RHQ_SUBSYSTEM_NAME);
+ if (!isDeployed) {
+ log("Installing RHQ EAR subsystem");
+ client.addSubsystem(RHQ_SUBSYSTEM_NAME);
+ } else {
+ log("RHQ EAR subsystem is already deployed");
+ }
} finally {
safeClose(mcc);
}
commit 36316a5917684ae2bfe811c682a553e7b7149772
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Feb 14 15:04:35 2013 +0100
The apache integration tests are now resilient against apache servers running on the target machine out of the test control. These will no longer affect the test results.
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
index 8bc25ca..a7f6697 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
@@ -59,6 +59,10 @@ import org.rhq.core.domain.resource.ResourceType;
*/
public class FakeServerInventory {
+ public interface InventoryStatusJudge {
+ InventoryStatus judge(Resource resource);
+ }
+
private Resource platform;
private Map<String, Resource> resourceStore = new HashMap<String, Resource>();
private int counter;
@@ -77,6 +81,13 @@ public class FakeServerInventory {
}
};
+ private static final Comparator<Resource> RESOURCE_TYPE_AND_STATUS_COMPARATOR = new Comparator<Resource>() {
+ public int compare(Resource o1, Resource o2) {
+ return o1.getResourceType().equals(o2.getResourceType())
+ && o1.getInventoryStatus() == o2.getInventoryStatus() ? 0 : o1.getId() - o2.getId();
+ }
+ };
+
public FakeServerInventory() {
this(false);
}
@@ -86,14 +97,18 @@ public class FakeServerInventory {
}
public synchronized void prepopulateInventory(Resource platform, Collection<Resource> topLevelServers) {
- this.platform = fakePersist(platform, InventoryStatus.COMMITTED, new HashSet<String>());
+ this.platform = fakePersist(platform, getSimpleJudge(InventoryStatus.COMMITTED), new HashSet<String>());
for (Resource res : topLevelServers) {
res.setParentResource(this.platform);
- fakePersist(res, InventoryStatus.COMMITTED, new HashSet<String>());
+ fakePersist(res, getSimpleJudge(InventoryStatus.COMMITTED), new HashSet<String>());
}
}
public synchronized CustomAction mergeInventoryReport(final InventoryStatus requiredInventoryStatus) {
+ return mergeInventoryReport(getSimpleJudge(requiredInventoryStatus));
+ }
+
+ public synchronized CustomAction mergeInventoryReport(final InventoryStatusJudge judge) {
return new CustomAction("updateServerSideInventory") {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
@@ -102,7 +117,7 @@ public class FakeServerInventory {
InventoryReport inventoryReport = (InventoryReport) invocation.getParameter(0);
for (Resource res : inventoryReport.getAddedRoots()) {
- Resource persisted = fakePersist(res, requiredInventoryStatus, new HashSet<String>());
+ Resource persisted = fakePersist(res, judge, new HashSet<String>());
if (res.getParentResource() == Resource.ROOT) {
platform = persisted;
@@ -265,6 +280,23 @@ public class FakeServerInventory {
}
@SuppressWarnings("serial")
+ public synchronized Set<Resource> findResourcesByTypeAndStatus(final ResourceType type, final InventoryStatus status) {
+ Set<Resource> result = new HashSet<Resource>();
+ if (platform != null) {
+ findResources(platform, new Resource() {
+ public ResourceType getResourceType() {
+ return type;
+ }
+
+ public InventoryStatus getInventoryStatus() {
+ return status;
+ }
+ }, result, RESOURCE_TYPE_AND_STATUS_COMPARATOR);
+ }
+ return result;
+ }
+
+ @SuppressWarnings("serial")
private Set<Resource> getResources(Set<Integer> resourceIds, boolean includeDescendants) {
//it is important to keep the hierarchical order of the resource in the returned set
//so that plugin container can merge the resources from top to bottom.
@@ -301,7 +333,7 @@ public class FakeServerInventory {
}
}
- private Resource fakePersist(Resource agentSideResource, InventoryStatus requiredInventoryStatus,
+ private Resource fakePersist(Resource agentSideResource, InventoryStatusJudge statusJudge,
Set<String> inProgressUUIds) {
Resource persisted = resourceStore.get(agentSideResource.getUuid());
if (!inProgressUUIds.add(agentSideResource.getUuid())) {
@@ -316,6 +348,7 @@ public class FakeServerInventory {
persisted.setUuid(agentSideResource.getUuid());
resourceStore.put(persisted.getUuid(), persisted);
}
+
persisted.setAgent(agentSideResource.getAgent());
persisted.setCurrentAvailability(agentSideResource.getCurrentAvailability());
persisted.setDescription(agentSideResource.getDescription());
@@ -323,13 +356,15 @@ public class FakeServerInventory {
persisted.setPluginConfiguration(agentSideResource.getPluginConfiguration().clone());
persisted.setResourceConfiguration(agentSideResource.getResourceConfiguration().clone());
persisted.setVersion(agentSideResource.getVersion());
- persisted.setInventoryStatus(requiredInventoryStatus);
persisted.setResourceKey(agentSideResource.getResourceKey());
persisted.setResourceType(agentSideResource.getResourceType());
+ InventoryStatus status = statusJudge.judge(persisted);
+ persisted.setInventoryStatus(status);
+
Resource parent = agentSideResource.getParentResource();
if (parent != null && parent != Resource.ROOT) {
- parent = fakePersist(agentSideResource.getParentResource(), requiredInventoryStatus,
+ parent = fakePersist(agentSideResource.getParentResource(), statusJudge,
inProgressUUIds);
persisted.setParentResource(parent);
parent.getChildResources().add(persisted);
@@ -340,7 +375,7 @@ public class FakeServerInventory {
//persist the children
Set<Resource> childResources = new LinkedHashSet<Resource>();
for (Resource child : agentSideResource.getChildResources()) {
- childResources.add(fakePersist(child, requiredInventoryStatus, inProgressUUIds));
+ childResources.add(fakePersist(child, statusJudge, inProgressUUIds));
}
//now update the list with whatever the persisted resource contained in the past
//i.e. we prefer the current results from the agent but keep the children we used to
@@ -398,6 +433,7 @@ public class FakeServerInventory {
children.add(syncChild);
}
+
getPrivateField(clazz, "childSyncInfos").set(ret, children);
return ret;
@@ -444,4 +480,14 @@ public class FakeServerInventory {
}
}
}
+
+ private InventoryStatusJudge getSimpleJudge(final InventoryStatus requiredStatus) {
+ return new InventoryStatusJudge() {
+
+ @Override
+ public InventoryStatus judge(Resource resource) {
+ return requiredStatus;
+ }
+ };
+ }
}
diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java
index b1c8a24..85d5f52 100644
--- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java
+++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java
@@ -49,6 +49,7 @@ import org.rhq.core.pc.configuration.ConfigurationManager;
import org.rhq.core.pc.inventory.InventoryManager;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pc.upgrade.FakeServerInventory;
+import org.rhq.plugins.apache.ApacheServerComponent;
import org.rhq.plugins.apache.PluginLocation;
import org.rhq.plugins.apache.setup.ApacheTestConfiguration;
import org.rhq.plugins.apache.setup.ApacheTestSetup;
@@ -58,7 +59,7 @@ import org.rhq.test.pc.PluginContainerSetup;
import org.rhq.test.pc.PluginContainerTest;
/**
- *
+ *
*
* @author Lukas Krejci
*/
@@ -126,13 +127,13 @@ public class AugeasReferenceLeakingTest extends BMNGRunner {
configureApacheServerToUseAugeas();
PluginContainer pc = PluginContainer.getInstance();
- Resource platform = pc.getInventoryManager().getPlatform();
+ Resource apacheServer = findApacheServerResource().getResource();
for (int i = 0; i < configurationReadingInvocationCount; ++i) {
- checkConfigurationRecursively(platform, pc.getConfigurationManager());
+ checkApacheServerConfigurationRecursively(apacheServer, pc.getConfigurationManager());
Thread.sleep(10000);
}
-
+
//wait a couple of seconds for the loadConfig calls to finish
Thread.sleep(60000);
} finally {
@@ -192,14 +193,14 @@ public class AugeasReferenceLeakingTest extends BMNGRunner {
}
}
- private void checkConfigurationRecursively(Resource resource, ConfigurationManager cm)
+ private void checkApacheServerConfigurationRecursively(Resource resource, ConfigurationManager cm)
throws PluginContainerException {
if (resource.getResourceType().getResourceConfigurationDefinition() != null) {
cm.loadResourceConfiguration(resource.getId());
}
for (Resource child : resource.getChildResources()) {
- checkConfigurationRecursively(child, cm);
+ checkApacheServerConfigurationRecursively(child, cm);
}
}
@@ -208,32 +209,36 @@ public class AugeasReferenceLeakingTest extends BMNGRunner {
InventoryManager im = PluginContainer.getInstance().getInventoryManager();
- ResourceContainer apacheServer = findResource(resourceTypes.findByName("Apache HTTP Server"));
+ ResourceContainer apacheServer = findApacheServerResource();
Configuration config = apacheServer.getResourceContext().getPluginConfiguration();
config.getSimple("augeasEnabled").setValue("yes");
im.updatePluginConfiguration(apacheServer.getResource().getId(), config);
-
+
//and run discovery so that the new resources can go into inventory
-
+
im.executeServiceScanImmediately();
}
- private ResourceContainer findResource(ResourceType resourceType) {
+ private ResourceContainer findApacheServerResource() throws Exception {
InventoryManager im = PluginContainer.getInstance().getInventoryManager();
+ ResourceTypes resourceTypes = new ResourceTypes(PluginLocation.APACHE_PLUGIN);
+ ResourceType apacheServerResourceType = resourceTypes.findByName("Apache HTTP Server");
- return findResource(im, resourceType, im.getPlatform());
+ return findApacheServerResource(im, apacheServerResourceType, im.getPlatform());
}
- private ResourceContainer findResource(InventoryManager im, ResourceType rt, Resource root) {
- if (root.getResourceType().equals(rt)) {
+ private ResourceContainer findApacheServerResource(InventoryManager im, ResourceType rt, Resource root) {
+ if (root.getResourceType().equals(rt)
+ && root.getPluginConfiguration().getSimpleValue(ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT)
+ .equals(setup.getDeploymentConfig().serverRoot)) {
return im.getResourceContainer(root);
}
for (Resource child : root.getChildResources()) {
- ResourceContainer rc = findResource(im, rt, child);
+ ResourceContainer rc = findApacheServerResource(im, rt, child);
if (rc != null) {
return rc;
}
diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
index 37e74d9..e0363af 100644
--- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
+++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
@@ -41,6 +41,7 @@ import org.rhq.core.domain.discovery.AvailabilityReport;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceError;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.ServerServices;
import org.rhq.core.pc.upgrade.FakeServerInventory;
import org.rhq.core.system.SystemInfoFactory;
@@ -257,9 +258,23 @@ public class ApacheTestSetup {
public void addDefaultExceptations(Expectations expectations) throws Exception {
ServerServices ss = PluginContainerTest.getCurrentPluginContainerConfiguration().getServerServices();
+ //only import the apache servers we actually care about - we can't assume another apache won't be present
+ //on the machine running the test...
+ final ResourceType serverResourceType = apacheResourceTypes.findByName("Apache HTTP Server");
expectations.allowing(ss.getDiscoveryServerService()).mergeInventoryReport(
expectations.with(Expectations.any(InventoryReport.class)));
- expectations.will(fakeInventory.mergeInventoryReport(InventoryStatus.COMMITTED));
+ expectations.will(fakeInventory.mergeInventoryReport(new FakeServerInventory.InventoryStatusJudge() {
+ @Override
+ public InventoryStatus judge(Resource resource) {
+ if (serverResourceType.equals(resource.getResourceType())) {
+ return deploymentConfig.serverRoot.equals(resource.getPluginConfiguration().getSimpleValue(
+ ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT)) ? InventoryStatus.COMMITTED
+ : InventoryStatus.IGNORED;
+ } else {
+ return InventoryStatus.COMMITTED;
+ }
+ }
+ }));
expectations.allowing(ss.getDiscoveryServerService()).upgradeResources(
expectations.with(Expectations.any(Set.class)));
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 aebea53..719a3dd 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
@@ -42,6 +42,7 @@ import org.testng.annotations.BeforeClass;
import org.rhq.core.clientapi.agent.metadata.PluginMetadataParser;
import org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil;
import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor;
+import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceError;
@@ -77,15 +78,15 @@ import org.rhq.test.pc.PluginContainerTest;
public class UpgradeTestBase extends PluginContainerTest {
private static final Log LOG = LogFactory.getLog(UpgradeTestBase.class);
-
+
public enum ResourceKeyFormat {
SNMP, RHQ3, RHQ4
};
-
+
protected static final String DEPLOYMENT_SIMPLE_WITH_RESOLVABLE_SERVERNAMES = "simpleWithResolvableServerNames";
protected static final String DEPLOYMENT_SIMPLE_WITH_UNRESOLVABLE_SERVER_NAMES = "simpleWithUnresolvableServerNames";
protected static final String DEPLOYMENT_SIMPLE_WITH_WILDCARD_LISTENS = "simpleWithWildcardListens";
-
+
private ResourceTypes apacheResourceTypes;
protected Resource platform;
@@ -101,15 +102,15 @@ public class UpgradeTestBase extends PluginContainerTest {
apacheResourceTypes);
boolean testFailed = false;
try {
-
+
String[] configFiles = Arrays.copyOf(testConfiguration.apacheConfigurationFiles, testConfiguration.apacheConfigurationFiles.length + 1);
configFiles[testConfiguration.apacheConfigurationFiles.length] = "/snmpd.conf";
-
+
setup.withInventoryFrom(testConfiguration.inventoryFile)
.withPlatformResource(platform).withDefaultExpectations().withDefaultOverrides(testConfiguration.defaultOverrides)
.withApacheSetup().withConfigurationFiles(configFiles)
.withServerRoot(testConfiguration.serverRoot).withExePath(testConfiguration.binPath);
-
+
testConfiguration.beforeTestSetup(setup);
LOG.debug("---------------------------------------------------------- Starting the upgrade test for: "
@@ -117,46 +118,46 @@ public class UpgradeTestBase extends PluginContainerTest {
LOG.debug("Deployment configuration: " + setup.getDeploymentConfig());
setup.setup();
-
+
testConfiguration.beforePluginContainerStart(setup);
-
+
startConfiguredPluginContainer();
-
+
testConfiguration.beforeTests(setup);
-
+
//ok, now we should see the resources upgraded in the fake server inventory.
ResourceType serverResourceType = apacheResourceTypes.findByName("Apache HTTP Server");
ResourceType vhostResourceType = apacheResourceTypes.findByName("Apache Virtual Host");
-
- Set<Resource> servers = setup.getFakeInventory().findResourcesByType(serverResourceType);
+
+ Set<Resource> servers = setup.getFakeInventory().findResourcesByTypeAndStatus(serverResourceType, InventoryStatus.COMMITTED);
assertEquals(servers.size(), 1, "There should be exactly one apache server discovered.");
-
+
Resource server = servers.iterator().next();
-
+
String expectedResourceKey = ApacheServerDiscoveryComponent.formatResourceKey(testConfiguration.serverRoot, testConfiguration.serverRoot
+ "/conf/httpd.conf");
-
+
assertEquals(server.getResourceKey(), expectedResourceKey,
"The server resource key doesn't seem to be upgraded.");
-
- Set<Resource> vhosts = setup.getFakeInventory().findResourcesByType(vhostResourceType);
-
+
+ Set<Resource> vhosts = setup.getFakeInventory().findResourcesByTypeAndStatus(vhostResourceType, InventoryStatus.COMMITTED);
+
String[] expectedRKs = testConfiguration.getExpectedResourceKeysAfterUpgrade(setup);
-
+
assertEquals(vhosts.size(), expectedRKs.length, "Unexpected number of vhosts discovered found");
-
+
List<String> expectedResourceKeys = Arrays.asList(expectedRKs);
-
+
for (Resource vhost : vhosts) {
assertTrue(expectedResourceKeys.contains(vhost.getResourceKey()),
"Unexpected virtual host resource key: '" + vhost.getResourceKey() + "'. Only expecting " + expectedResourceKeys);
}
-
+
String[] expectedFailureRKs = testConfiguration.getExpectedResourceKeysWithFailures(setup);
if (expectedFailureRKs != null && expectedFailureRKs.length > 0) {
Set<Resource> failingResources = new HashSet<Resource>();
-
+
for(String rk : expectedFailureRKs) {
for(Resource r : vhosts) {
if (rk.equals(r.getResourceKey())) {
@@ -165,21 +166,21 @@ public class UpgradeTestBase extends PluginContainerTest {
}
}
}
-
+
assertEquals(failingResources.size(), expectedFailureRKs.length, "Couldn't find all the resources that should have failed.");
-
+
for(Resource failingResource : failingResources) {
List<ResourceError> errors = failingResource.getResourceErrors(ResourceErrorType.UPGRADE);
assertNotNull(errors, "The main vhost doesn't have any upgrade errors.");
assertEquals(errors.size(), 1, "There should be exactly one upgrade error on the main vhost.");
}
-
+
//check that all other vhosts were not upgraded but have no errors
for(Resource r : vhosts) {
if (failingResources.contains(r)) {
continue;
}
-
+
assertEquals(r.getResourceErrors(ResourceErrorType.UPGRADE).size(), 0, "Unexpected number of resource upgrade errors on vhost " + r);
}
} else {
@@ -213,31 +214,31 @@ public class UpgradeTestBase extends PluginContainerTest {
setup.withApacheSetup().init();
ApacheServerComponent component = setup.withApacheSetup().getServerComponent();
ApacheDirectiveTree config = component.parseRuntimeConfiguration(false);
-
+
DeploymentConfig deployConfig = setup.getDeploymentConfig();
-
+
VirtualHostLegacyResourceKeyUtil keyUtil = new VirtualHostLegacyResourceKeyUtil(component, config);
-
+
Map<String, String> replacements = deployConfig.getTokenReplacements();
-
+
testConfig.defaultOverrides.put("main.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyMainServerResourceKey());
-
- if (deployConfig.vhost1 != null) {
+
+ if (deployConfig.vhost1 != null) {
testConfig.defaultOverrides.put("vhost1.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost1.getVHostSpec(replacements)));
}
-
+
if (deployConfig.vhost2 != null) {
testConfig.defaultOverrides.put("vhost2.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost2.getVHostSpec(replacements)));
}
-
+
if (deployConfig.vhost3 != null) {
testConfig.defaultOverrides.put("vhost3.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost3.getVHostSpec(replacements)));
}
-
+
if (deployConfig.vhost4 != null) {
testConfig.defaultOverrides.put("vhost4.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost4.getVHostSpec(replacements)));
}
-
+
setup.withDefaultOverrides(testConfig.defaultOverrides);
}
@@ -248,13 +249,13 @@ public class UpgradeTestBase extends PluginContainerTest {
protected static String[] getVHostRKs(ApacheTestSetup setup, int[] successfulUpgrades, int[] failedUpgrades, ResourceKeyFormat rkFormat) {
int sucLen = successfulUpgrades == null ? 0 : successfulUpgrades.length;
int failLen = failedUpgrades == null ? 0 : failedUpgrades.length;
-
+
String[] ret = new String[sucLen + failLen];
-
+
int retIdx = 0;
-
+
Map<String, String> replacements = setup.getInventoryFileReplacements();
-
+
for(int i = 0; i < sucLen; ++i, ++retIdx) {
int vhostNum = successfulUpgrades[i];
if (vhostNum == 0) {
@@ -264,7 +265,7 @@ public class UpgradeTestBase extends PluginContainerTest {
ret[retIdx] = ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(vhost.serverName, vhost.hosts);
}
}
-
+
for(int i = 0; i < failLen; ++i, ++retIdx) {
String variableName = null;
if (failedUpgrades[i] == 0) {
@@ -280,7 +281,7 @@ public class UpgradeTestBase extends PluginContainerTest {
variableName = "vhost" + failedUpgrades[i] + ".rhq";
}
}
-
+
switch (rkFormat) {
case RHQ3:
variableName += "3.resource.key";
@@ -292,10 +293,10 @@ public class UpgradeTestBase extends PluginContainerTest {
variableName += "snmp.identifier";
break;
}
-
+
ret[retIdx] = replacements.get(variableName);
}
-
+
return ret;
}
@@ -305,7 +306,7 @@ public class UpgradeTestBase extends PluginContainerTest {
.toURL());
PluginMetadataParser parser = new PluginMetadataParser(descriptor,
Collections.<String, PluginMetadataParser> emptyMap());
-
+
List<ResourceType> platformTypes = parser.getAllTypes();
//this is the default container name in case of no plugin explicit plugin configuration, which we don't have.
@@ -317,20 +318,20 @@ public class UpgradeTestBase extends PluginContainerTest {
}
Class discoveryClass = Class.forName(parser.getDiscoveryComponentClass(rt));
-
+
ResourceDiscoveryComponent discoveryComponent = (ResourceDiscoveryComponent) discoveryClass.newInstance();
-
+
ResourceDiscoveryContext context = new ResourceDiscoveryContext(rt, null, null,
SystemInfoFactory.createSystemInfo(), Collections.emptyList(), Collections.emptyList(), containerName,
PluginContainerDeployment.AGENT);
-
+
Set<DiscoveredResourceDetails> results = discoveryComponent.discoverResources(context);
-
+
if (!results.isEmpty()) {
DiscoveredResourceDetails details = results.iterator().next();
-
+
Resource platform = new Resource();
-
+
platform.setDescription(details.getResourceDescription());
platform.setResourceKey(details.getResourceKey());
platform.setName(details.getResourceName());
@@ -339,11 +340,11 @@ public class UpgradeTestBase extends PluginContainerTest {
platform.setResourceType(rt);
platform.setUuid(UUID.randomUUID().toString());
platform.setId(1);
-
+
return platform;
}
}
-
+
return null;
}
@@ -352,12 +353,12 @@ public class UpgradeTestBase extends PluginContainerTest {
if (prefix != null && !prefix.isEmpty()) {
bld.append(prefix).append(".");
}
-
+
bld.append(name);
-
+
return bld.toString();
}
-
+
protected static InetAddress determineLocalhost() {
try {
return InetAddress.getLocalHost();
commit 9b30d84de016542bad1f9490a9b24e93dce9c162
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 13 16:11:34 2013 -0500
append to the installer log so we don't lose any installer log messages when rhq-installer.sh is run multiple times
diff --git a/modules/enterprise/server/installer/src/main/resources/logging.properties b/modules/enterprise/server/installer/src/main/resources/logging.properties
index 6a48b2b..0affd97 100644
--- a/modules/enterprise/server/installer/src/main/resources/logging.properties
+++ b/modules/enterprise/server/installer/src/main/resources/logging.properties
@@ -16,8 +16,9 @@ handler.CONSOLE.formatter=PATTERN
# File handler configuration
handler.FILE=org.jboss.logmanager.handlers.FileHandler
handler.FILE.level=${rhq.server.installer.loglevel:DEBUG}
-handler.FILE.properties=autoFlush,fileName
+handler.FILE.properties=autoFlush,append,fileName
handler.FILE.autoFlush=true
+handler.FILE.append=true
handler.FILE.fileName=${rhq.server.installer.logdir:.}/rhq-installer.log
handler.FILE.formatter=PATTERN
commit d3465f9300f95680fda57fab996401870a39ffa6
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 13 20:09:02 2013 +0100
Fix the expectations of the JMock-based apache plugin integration tests
after the fixes in the inventory report processing that changed the workflow
slightly.
This should make the apache integration tests pass again.
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
index 17beb1e..8bc25ca 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
@@ -26,6 +26,8 @@ package org.rhq.core.pc.upgrade;
import static org.testng.Assert.fail;
import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -52,7 +54,7 @@ import org.rhq.core.domain.resource.ResourceType;
/**
* This class represents a server side database store of the inventory for the purposes
* of the ResourceUpgradeTest unit test.
- *
+ *
* @author Lukas Krejci
*/
public class FakeServerInventory {
@@ -62,7 +64,7 @@ public class FakeServerInventory {
private int counter;
private boolean failing;
private boolean failUpgrade;
-
+
private static final Comparator<Resource> ID_COMPARATOR = new Comparator<Resource>() {
public int compare(Resource o1, Resource o2) {
return o1.getId() - o2.getId();
@@ -90,18 +92,18 @@ public class FakeServerInventory {
fakePersist(res, InventoryStatus.COMMITTED, new HashSet<String>());
}
}
-
+
public synchronized CustomAction mergeInventoryReport(final InventoryStatus requiredInventoryStatus) {
return new CustomAction("updateServerSideInventory") {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
throwIfFailing();
-
+
InventoryReport inventoryReport = (InventoryReport) invocation.getParameter(0);
-
+
for (Resource res : inventoryReport.getAddedRoots()) {
Resource persisted = fakePersist(res, requiredInventoryStatus, new HashSet<String>());
-
+
if (res.getParentResource() == Resource.ROOT) {
platform = persisted;
}
@@ -117,9 +119,9 @@ public class FakeServerInventory {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
throwIfFailing();
-
+
platform = null;
-
+
return getSyncInfo();
}
}
@@ -131,36 +133,36 @@ public class FakeServerInventory {
public Object invoke(Invocation invocation) throws Throwable {
synchronized(FakeServerInventory.this) {
throwIfFailing();
-
+
ResourceError error = (ResourceError) invocation.getParameter(0);
-
+
Resource serverSideResource = resourceStore.get(error.getResource().getUuid());
-
+
if (serverSideResource != null) {
List<ResourceError> currentErrors = serverSideResource.getResourceErrors();
currentErrors.add(error);
}
-
+
return null;
}
}
};
}
-
+
public synchronized CustomAction upgradeResources() {
return new CustomAction("upgradeServerSideInventory") {
@SuppressWarnings({ "serial", "unchecked" })
public Object invoke(Invocation invocation) throws Throwable {
synchronized(FakeServerInventory.this) {
throwIfFailing();
-
+
if (failUpgrade) {
- throw new RuntimeException("Failing the upgrade purposefully.");
+ throw new RuntimeException("Failing the upgrade purposefully.");
}
-
+
Set<ResourceUpgradeRequest> requests = (Set<ResourceUpgradeRequest>) invocation.getParameter(0);
Set<ResourceUpgradeResponse> responses = new HashSet<ResourceUpgradeResponse>();
-
+
for (final ResourceUpgradeRequest request : requests) {
Resource resource = findResource(platform, new Resource() {
public int getId() {
@@ -174,18 +176,18 @@ public class FakeServerInventory {
if (request.getNewName() != null) {
resource.setName(request.getNewName());
}
-
+
if (request.getNewResourceKey() != null) {
resource.setResourceKey(request.getNewResourceKey());
}
-
+
if (request.getUpgradeErrorMessage() != null) {
ResourceError error = new ResourceError(resource, ResourceErrorType.UPGRADE,
request.getUpgradeErrorMessage(), request.getUpgradeErrorStackTrace(),
request.getTimestamp());
resource.getResourceErrors().add(error);
}
-
+
ResourceUpgradeResponse resp = new ResourceUpgradeResponse();
resp.setResourceId(resource.getId());
resp.setUpgradedResourceName(resource.getName());
@@ -206,16 +208,33 @@ public class FakeServerInventory {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
throwIfFailing();
-
+
Set<Integer> resourceIds = (Set<Integer>) invocation.getParameter(0);
boolean includeDescendants = (Boolean) invocation.getParameter(1);
-
+
return getResources(resourceIds, includeDescendants);
}
}
};
}
+ public synchronized CustomAction getResourcesAsList() {
+ return new CustomAction("getResourcesAsList") {
+ @Override
+ public Object invoke(Invocation invocation) throws Throwable {
+ synchronized(FakeServerInventory.this) {
+ throwIfFailing();
+
+ Integer[] resourceIds = (Integer[]) invocation.getParameter(0);
+
+ Set<Resource> resources = getResources(new LinkedHashSet<Integer>(Arrays.asList(resourceIds)), false);
+
+ return new ArrayList<Resource>(resources);
+ }
+ }
+ };
+ }
+
public synchronized boolean isFailing() {
return failing;
}
@@ -227,11 +246,11 @@ public class FakeServerInventory {
public synchronized boolean isFailUpgrade() {
return failUpgrade;
}
-
+
public synchronized void setFailUpgrade(boolean failUpgrade) {
this.failUpgrade = failUpgrade;
}
-
+
@SuppressWarnings("serial")
public synchronized Set<Resource> findResourcesByType(final ResourceType type) {
Set<Resource> result = new HashSet<Resource>();
@@ -281,7 +300,7 @@ public class FakeServerInventory {
removeResource(child);
}
}
-
+
private Resource fakePersist(Resource agentSideResource, InventoryStatus requiredInventoryStatus,
Set<String> inProgressUUIds) {
Resource persisted = resourceStore.get(agentSideResource.getUuid());
@@ -327,9 +346,9 @@ public class FakeServerInventory {
//i.e. we prefer the current results from the agent but keep the children we used to
//have in the past. This is the same behavior as the actual RHQ server has.
childResources.addAll(persisted.getChildResources());
-
+
persisted.setChildResources(childResources);
-
+
inProgressUUIds.remove(agentSideResource.getUuid());
return persisted;
diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
index 9f12166..37e74d9 100644
--- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
+++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
@@ -74,14 +74,14 @@ public class ApacheTestSetup {
private Mockery context;
private ResourceTypes apacheResourceTypes;
private String testId;
-
+
public class ApacheSetup {
private String serverRoot;
private String exePath;
private Collection<String> configurationFiles;
private ApacheExecutionUtil execution;
private boolean deploy = true;
-
+
private ApacheSetup() {
}
@@ -162,16 +162,16 @@ public class ApacheTestSetup {
+ serverRootDir + "'.");
File logsDir = new File(serverRootDir, "logs");
-
+
assertTrue(logsDir.exists(), "The configured server root denotes a directory that doesn't have a 'logs' subdirectory. This is unexpected.");
-
+
File confDir = new File(serverRootDir, "conf");
assertTrue(confDir.exists(),
"The configured server root denotes a directory that doesn't have a 'conf' subdirectory. This is unexpected.");
-
+
String confFilePath = confDir.getAbsolutePath() + File.separatorChar + "httpd.conf";
-
+
String snmpHost = null;
int snmpPort = 0;
String pingUrl = null;
@@ -185,11 +185,11 @@ public class ApacheTestSetup {
new File(binDir, "envvars-std"));
ApacheDeploymentUtil.deployConfiguration(confDir, configurationFiles, additionalFilesToProcess, deploymentConfig);
}
-
+
//ok, now try to find the ping URL. The best thing is to actually invoke
- //the same code the apache server discovery does.
+ //the same code the apache server discovery does.
ApacheDirectiveTree tree = ApacheServerDiscoveryComponent.parseRuntimeConfiguration(confFilePath, null, ApacheBinaryInfo.getInfo(exePath, SystemInfoFactory.createSystemInfo()));
-
+
//XXX this hardcodes apache2 as the only option we have...
HttpdAddressUtility.Address addrToUse = HttpdAddressUtility.APACHE_2_x.getMainServerSampleAddress(tree, null, -1);
pingUrl = addrToUse.toString();
@@ -205,7 +205,7 @@ public class ApacheTestSetup {
}
private void doSetup() throws Exception {
- init();
+ init();
startApache();
}
@@ -228,12 +228,12 @@ public class ApacheTestSetup {
return this;
}
- public ApacheTestSetup withDefaultOverrides(Map<String, String> defaultOverrides) {
+ public ApacheTestSetup withDefaultOverrides(Map<String, String> defaultOverrides) {
this.defaultOverrides = defaultOverrides == null ? new HashMap<String, String>() : defaultOverrides;
deploymentConfig = ApacheDeploymentUtil.getDeploymentConfigurationFromSystemProperties(configurationName, this.defaultOverrides);
return this;
}
-
+
public ApacheTestSetup withPlatformResource(Resource platform) {
this.platform = platform;
return this;
@@ -271,7 +271,7 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDiscoveryServerService()).setResourceError(expectations.with(Expectations.any(ResourceError.class)));
expectations.will(fakeInventory.setResourceError());
-
+
expectations.allowing(ss.getDiscoveryServerService()).mergeAvailabilityReport(
expectations.with(Expectations.any(AvailabilityReport.class)));
@@ -280,7 +280,7 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDiscoveryServerService()).clearResourceConfigError(
expectations.with(Expectations.any(int.class)));
-
+
expectations.allowing(ss.getDiscoveryServerService()).setResourceEnablement(
expectations.with(Expectations.any(int.class)), expectations.with(Expectations.any(boolean.class)));
@@ -289,7 +289,10 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDriftServerService()).getDriftDefinitions(expectations.with(Expectations.any(Set.class)));
expectations.will(Expectations.returnValue(Collections.emptyMap()));
-
+
+ expectations.allowing(ss.getDiscoveryServerService()).getResourcesAsList(expectations.with(Expectations.any(Integer[].class)));
+ expectations.will(fakeInventory.getResourcesAsList());
+
expectations.ignoring(ss.getBundleServerService());
expectations.ignoring(ss.getConfigurationServerService());
expectations.ignoring(ss.getContentServerService());
@@ -307,14 +310,14 @@ public class ApacheTestSetup {
public DeploymentConfig getDeploymentConfig() {
return deploymentConfig;
}
-
+
public ApacheTestSetup setup() throws Exception {
apacheSetup.doSetup();
- Map<String, String> replacements = deploymentConfig.getTokenReplacements();
+ Map<String, String> replacements = deploymentConfig.getTokenReplacements();
replacements.put("server.root", apacheSetup.serverRoot);
replacements.put("exe.path", apacheSetup.exePath);
-
+
ApacheDeploymentUtil.addDefaultVariables(replacements, null);
HttpdAddressUtility addressUtility = apacheSetup.getServerComponent()
@@ -325,18 +328,18 @@ public class ApacheTestSetup {
addressUtility.getHttpdInternalMainServerAddressRepresentation(runtimeConfig).toString(false, false));
replacements.put("main.rhq4.resource.key", ApacheVirtualHostServiceComponent.MAIN_SERVER_RESOURCE_KEY);
-
+
VHostSpec vhost1 = deploymentConfig.vhost1 == null ? null : deploymentConfig.vhost1.getVHostSpec(replacements);
VHostSpec vhost2 = deploymentConfig.vhost2 == null ? null : deploymentConfig.vhost2.getVHostSpec(replacements);
VHostSpec vhost3 = deploymentConfig.vhost3 == null ? null : deploymentConfig.vhost3.getVHostSpec(replacements);
VHostSpec vhost4 = deploymentConfig.vhost4 == null ? null : deploymentConfig.vhost4.getVHostSpec(replacements);
-
+
if (vhost1 != null) {
replacements.put(
"vhost1.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost1.hosts.get(0),
vhost1.serverName).toString(false, false));
-
+
replacements.put(
"vhost1.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -348,7 +351,7 @@ public class ApacheTestSetup {
"vhost2.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost2.hosts.get(0),
vhost2.serverName).toString(false, false));
-
+
replacements.put(
"vhost2.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -360,7 +363,7 @@ public class ApacheTestSetup {
"vhost3.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost3.hosts.get(0),
vhost3.serverName).toString(false, false));
-
+
replacements.put(
"vhost3.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -372,7 +375,7 @@ public class ApacheTestSetup {
"vhost4.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost4.hosts.get(0),
vhost4.serverName).toString(false, false));
-
+
replacements.put(
"vhost4.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -381,35 +384,35 @@ public class ApacheTestSetup {
//let the user override everything we just did
replacements.putAll(defaultOverrides);
-
+
inventoryFileReplacements = replacements;
-
+
if (inventoryFile != null) {
InputStream dataStream = getClass().getResourceAsStream(inventoryFile);
-
+
Reader rdr = new TokenReplacingReader(new InputStreamReader(dataStream), replacements);
-
+
@SuppressWarnings("unchecked")
List<Resource> inventory = (List<Resource>) new ObjectCollectionSerializer().deserialize(rdr);
-
- //fix up the parent relationships, because they might not be reconstructed correctly by
+
+ //fix up the parent relationships, because they might not be reconstructed correctly by
//JAXB - we're missing XmlID and XmlIDRef annotations in our model
fixupParent(null, inventory);
-
+
fakeInventory.prepopulateInventory(platform, inventory);
}
return this;
}
/**
- * After the setup, this returns all the variables used to update the tokens in the inventory file.
- *
+ * After the setup, this returns all the variables used to update the tokens in the inventory file.
+ *
* @return
*/
public Map<String, String> getInventoryFileReplacements() {
return inventoryFileReplacements;
}
-
+
private void fixupParent(Resource parent, Collection<Resource> children) {
for (Resource child : children) {
child.setParentResource(parent);
commit a23490d9053904f0e78cb5b0ce7c43a92b7c4f36
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 13 11:51:45 2013 -0500
Fix issues in mergeAvailabilityReport "repair code". This is code that
attempts to fix problems in the Availability records, if they somehow get
corrupted. In general, it doesn't execute. But if and when it did, it
wasn't repairing things as well as it could. This makes improvements.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
index 2946d40..0181d7a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
@@ -591,52 +591,13 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
// availability reports only tell us the current state at the start time; end time is ignored/must be null
reported.setEndTime(null);
- try {
- q.setParameter("resourceId", reported.getResource().getId());
- Availability latest = (Availability) q.getSingleResult();
- AvailabilityType latestType = latest.getAvailabilityType();
- AvailabilityType reportedType = reported.getAvailabilityType();
-
- // If the current avail is DISABLED, and this report is not trying to re-enable the resource,
- // Then ignore the reported avail.
- if (AvailabilityType.DISABLED == latestType) {
- if (!(mergeInfo.isEnablementReport() && (AvailabilityType.UNKNOWN == reportedType))) {
- disabledAvailabilities.add(reported);
- continue;
- }
- }
-
- if (reported.getStartTime() >= latest.getStartTime()) {
- //log.info( "new avail (latest/reported)-->" + latest + "/" + reported );
-
- // the new availability data is for a time after our last known state change
- // we are run-length encoded, so only persist data if the availability changed
- if (latest.getAvailabilityType() != reported.getAvailabilityType()) {
- entityManager.persist(reported);
- mergeInfo.incrementNumInserted();
-
- latest.setEndTime(reported.getStartTime());
- latest = entityManager.merge(latest);
-
- updateResourceAvailability(reported);
- }
-
- // our last known state was unknown, ask for a full report to ensure we are in sync with agent
- if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) {
- mergeInfo.setAskForFullReport(true);
- }
- } else {
- //log.info( "past avail (latest/reported)==>" + latest + "/" + reported );
+ // get the latest avail for the reported resource
+ q.setParameter("resourceId", reported.getResource().getId());
+ Availability latest = null;
- // The new data is for a time in the past, probably an agent sending a report after
- // a network outage has been corrected but after we have already backfilled.
- // We need to insert it into our past timeline.
- insertAvailability(reported);
- mergeInfo.incrementNumInserted();
+ try {
+ latest = (Availability) q.getSingleResult();
- // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent
- mergeInfo.setAskForFullReport(true);
- }
} catch (NoResultException nre) {
// This should not happen unless the Resource in the report is stale, which can happen in certain
// sync scenarios. A Resource is given its initial Availability/ResourceAvailability when it is
@@ -644,37 +605,47 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
// it must not exist in my utopian view of the world. Let's just make sure...
Resource attachedResource = (Resource) entityManager.find(Resource.class, reported.getResource()
.getId());
- if (null == attachedResource) {
+
+ if ((null == attachedResource) || (InventoryStatus.COMMITTED != attachedResource.getInventoryStatus())) {
// expected case
log.info("Skipping mergeAvailabilityReport() for stale resource [" + reported.getResource()
+ "]. These messages should go away after the next agent synchronization with the server.");
- } else if (InventoryStatus.COMMITTED == attachedResource.getInventoryStatus()) {
- // this should not happen, it means the resource exists but has no latest Availability
- // record (i.e. sendTime == null). Try to correct the situation.
+ continue;
+
+ } else {
+ // this should not really happen but is possible in rare failure situations, it means the resource
+ // exists but has no latest Availability record (i.e. sendTime == null). Correct the situation and
+ // then process the reported avail.
log.warn("Resource [" + reported.getResource()
+ "] has no latest availability record (i.e. no endtime) - will attempt to repair.\n"
+ mergeInfo.toString(false));
+
try {
List<Availability> attachedAvails = attachedResource.getAvailability();
+ Availability attachedLastAvail = null;
+
if (attachedAvails.isEmpty()) {
- attachedResource.initCurrentAvailability();
- entityManager.merge(attachedResource);
+ latest = new Availability(attachedResource, 0L, AvailabilityType.UNKNOWN);
+ entityManager.persist(latest);
} else {
- Availability attachedLastAvail = attachedAvails.get(attachedAvails.size() - 1);
- attachedLastAvail.setEndTime(null);
- entityManager.merge(attachedLastAvail);
+ latest = attachedAvails.get(attachedAvails.size() - 1);
+ latest.setEndTime(null);
+ latest = entityManager.merge(latest);
}
+ updateResourceAvailability(latest);
+
// ask the agent for a full report so as to ensure we are in sync with agent
mergeInfo.setAskForFullReport(true);
} catch (Throwable t) {
- log.warn("Unable to repair latest availablity for Resource [" + reported.getResource() + "]", t);
+ log.warn("Unable to repair NoResult latest availablity for Resource [" + reported.getResource()
+ + "]", t);
+ continue;
}
}
-
} catch (NonUniqueResultException nure) {
// This condition should never happen. In my world of la-la land, I've done everything
// correctly so this never happens. But, due to the asynchronous nature of things,
@@ -686,15 +657,69 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
log.warn("Resource [" + reported.getResource() + "] has multiple availabilities without an endtime ["
+ nure.getMessage() + "] - will attempt to remove the extra ones\n" + mergeInfo.toString(false));
- q.setParameter("resourceId", reported.getResource().getId());
- List<Availability> latest = q.getResultList();
+ try {
+
+ List<Availability> latestList = q.getResultList();
+
+ // delete all but the last one (our query sorts in ASC start time order)
+ int latestCount = latestList.size();
+ for (int i = 0; i < (latestCount - 1); i++) {
+ entityManager.remove(latestList.get(i));
+ }
+
+ latest = latestList.get(latestCount - 1);
+ updateResourceAvailability(latest);
+
+ // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent
+ mergeInfo.setAskForFullReport(true);
+
+ } catch (Throwable t) {
+ log.warn(
+ "Unable to repair NonUnique Result latest availablity for Resource [" + reported.getResource()
+ + "]", t);
+ continue;
+ }
+ }
+
+ AvailabilityType latestType = latest.getAvailabilityType();
+ AvailabilityType reportedType = reported.getAvailabilityType();
- // delete all but the last one (our query sorts in ASC start time order)
- int latestCount = latest.size();
- for (int i = 0; i < (latestCount - 1); i++) {
- entityManager.remove(latest.get(i));
+ // If the current avail is DISABLED, and this report is not trying to re-enable the resource,
+ // Then ignore the reported avail.
+ if (AvailabilityType.DISABLED == latestType) {
+ if (!(mergeInfo.isEnablementReport() && (AvailabilityType.UNKNOWN == reportedType))) {
+ disabledAvailabilities.add(reported);
+ continue;
}
- updateResourceAvailability(latest.get(latestCount - 1));
+ }
+
+ if (reported.getStartTime() >= latest.getStartTime()) {
+ //log.info( "new avail (latest/reported)-->" + latest + "/" + reported );
+
+ // the new availability data is for a time after our last known state change
+ // we are run-length encoded, so only persist data if the availability changed
+ if (latest.getAvailabilityType() != reported.getAvailabilityType()) {
+ entityManager.persist(reported);
+ mergeInfo.incrementNumInserted();
+
+ latest.setEndTime(reported.getStartTime());
+ latest = entityManager.merge(latest);
+
+ updateResourceAvailability(reported);
+ }
+
+ // our last known state was unknown, ask for a full report to ensure we are in sync with agent
+ if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) {
+ mergeInfo.setAskForFullReport(true);
+ }
+ } else {
+ //log.info( "past avail (latest/reported)==>" + latest + "/" + reported );
+
+ // The new data is for a time in the past, probably an agent sending a report after
+ // a network outage has been corrected but after we have already backfilled.
+ // We need to insert it into our past timeline.
+ insertAvailability(reported);
+ mergeInfo.incrementNumInserted();
// this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent
mergeInfo.setAskForFullReport(true);
commit 9c6886bf1be548b195ac14e81c76805b988c149a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 13 09:22:40 2013 -0500
Fix test given slight change in avail behavior. In commit c516ad09fcebcedfd1a505d6bfd434997ac6642d
we stopped kicking off an immediate avail scan when new resources were discovered,
simplifying the code, and approach, to just wait for the next scheduled scan,
which likely occurs nearly as fast. From the test's perspective this meant one
resource, the platform, had its avail change at a slightly different time.
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 005e900..956fb97 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
@@ -24,13 +24,13 @@ import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.pc.PluginContainer;
-import org.rhq.plugins.test.avail.AvailDiscoveryComponent;
-import org.rhq.plugins.test.avail.AvailResourceComponent;
import org.rhq.core.pc.inventory.AvailabilityExecutor;
import org.rhq.core.pc.inventory.AvailabilityExecutor.Scan;
import org.rhq.core.pc.inventory.ForceAvailabilityExecutor;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.plugins.test.avail.AvailDiscoveryComponent;
+import org.rhq.plugins.test.avail.AvailResourceComponent;
import org.rhq.test.arquillian.AfterDiscovery;
import org.rhq.test.arquillian.BeforeDiscovery;
import org.rhq.test.arquillian.FakeServerInventory;
@@ -184,7 +184,7 @@ public class AvailTest extends Arquillian {
Assert.assertEquals(datum.getAvailabilityType(), AvailabilityType.UP, "should be UP at the start");
}
AvailabilityExecutor.Scan scan = executor.getMostRecentScanHistory();
- assertScan(scan, true, true, 29, 28, 29, 28, 0, 0);
+ assertScan(scan, true, true, 29, 29, 29, 28, 0, 0);
// do a forced avail check again - nothing changed, so we should have an empty report
report = executor.call();
@@ -514,7 +514,7 @@ public class AvailTest extends Arquillian {
Assert.assertEquals(scan.getNumResources(), numResources,
"Unexpected numResources, remember to include the implied platform?");
Assert.assertEquals(scan.getNumAvailabilityChanges(), numChanges,
- "Unexpected numChanges, remember to omit the implied platform");
+ "Unexpected numChanges, remember to include the implied platform");
Assert.assertEquals(scan.getNumGetAvailabilityCalls(), numCalls,
"Unexpected numGetAvailCalls, remember to include the implied platform");
Assert.assertEquals(scan.getNumScheduledRandomly(), numSched,
commit 1b1e78f7a8c6a364d563a9bae4ea73116e5381c1
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Feb 12 17:20:00 2013 -0500
To maintain the test dep ordering, which is sometimes important, and definitel
is important here, move all of the test deps to the new test.dependencies profile.
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml
index d5daa17..5961627 100644
--- a/modules/enterprise/server/itests-2/pom.xml
+++ b/modules/enterprise/server/itests-2/pom.xml
@@ -35,144 +35,7 @@
</properties>
<dependencies>
- <!--================ Test Deps ================ -->
-
- <!-- Note, the test dep ordering can be important. Maven orders the [test] classpath in the order listed in the pom. -->
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-dist</artifactId>
- <type>zip</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.spec</groupId>
- <artifactId>jboss-javaee-6.0</artifactId>
- <version>${jboss.javaee6.spec.version}</version>
- <scope>provided</scope>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.testng</groupId>
- <artifactId>arquillian-testng-container</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.shrinkwrap.resolver</groupId>
- <artifactId>shrinkwrap-resolver-depchain</artifactId>
- <type>pom</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-arquillian-suite-extension</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-enterprise-server</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-script-bindings</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-server-client-api</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-serverplugin-drift</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>test-utils</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- </exclusion>
- </exclusions>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq.helpers</groupId>
- <artifactId>perftest-support</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-testng</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.opensymphony.quartz</groupId>
- <artifactId>quartz</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.liquibase</groupId>
- <artifactId>liquibase-core</artifactId>
- <version>${liquibase.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>2.1</version>
- <scope>test</scope>
- </dependency>
+ <!-- see the test.dependencies profile below -->
</dependencies>
<build>
@@ -669,46 +532,183 @@
<profiles>
- <profile>
- <!--
- This profile has been created to avoid unnecessary resolution of test dependencies during a build that
- does not run, compile or need tests.
- More test dependencies are to be moved here if the set of sub-dependencies is complex, references project
- test jars, or conflicts with changing the container version.
- -->
- <id>test.dependencies</id>
- <activation>
- <property>
- <name>maven.test.skip</name>
- <value>!true</value>
- </property>
- </activation>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-core-client-api</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-arquillian-container-managed</artifactId>
- <version>${jboss.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
+ <profile>
+ <!-- This profile has been created to avoid unnecessary resolution of test dependencies during a build that does not
+ run, compile or need tests. There are product build dependencies on this profile, don't remove. -->
+
+ <id>test.dependencies</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+
+ <dependencies>
+ <!-- Note, the test dep ordering can be important. Maven orders the [test] classpath in the order listed in the pom. -->
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-dist</artifactId>
+ <type>zip</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <version>${jboss.javaee6.spec.version}</version>
+ <scope>provided</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <version>${jboss.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.testng</groupId>
+ <artifactId>arquillian-testng-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-arquillian-suite-extension</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-server</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-script-bindings</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-server-client-api</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-serverplugin-drift</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-client-api</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>test-utils</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq.helpers</groupId>
+ <artifactId>perftest-support</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-testng</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opensymphony.quartz</groupId>
+ <artifactId>quartz</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.liquibase</groupId>
+ <artifactId>liquibase-core</artifactId>
+ <version>${liquibase.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>2.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ </profile>
<!-- If testing against oracle, override the default property settings -->
<profile>
commit 1c247adee91e2d82a2dd28905345067efa546a85
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Feb 12 15:48:32 2013 -0500
Fix a transactioning issue with agent backfill. It was possible for the Agent to
be marked backfilled in one transaction yet have the actual avail changes fail
in a second transaction, leaving the dead agent and its children with UP avail
and no longer eligible for backfill due to the flag being set.
Additionally, avoid large transactions if many agents need to be backfilled
sumultaneously.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
index 29c3ad3..d01dbd0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
@@ -192,7 +192,7 @@ public class AgentManagerBean implements AgentManagerLocal {
server_bootstrap.removeDownedAgent(downedAgent.getRemoteEndpoint());
log.info("Agent with name [" + agentName + "] just went down");
- agentManager.backfillAgent(subjectManager.getOverlord(), agentName, downedAgent.getId());
+ agentManager.backfillAgentInNewTransaction(subjectManager.getOverlord(), agentName, downedAgent.getId());
return;
}
@@ -272,7 +272,8 @@ public class AgentManagerBean implements AgentManagerLocal {
log.info("Have not heard from agent [" + record.getAgentName() + "] since ["
+ new Date(record.getLastAvailabilityPing()) + "]. Will be backfilled since we suspect it is down");
- agentManager.backfillAgent(subjectManager.getOverlord(), record.getAgentName(), record.getAgentId());
+ agentManager.backfillAgentInNewTransaction(subjectManager.getOverlord(), record.getAgentName(),
+ record.getAgentId());
}
}
@@ -281,7 +282,8 @@ public class AgentManagerBean implements AgentManagerLocal {
return;
}
- public void backfillAgent(Subject subject, String agentName, int agentId) {
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public void backfillAgentInNewTransaction(Subject subject, String agentName, int agentId) {
// make sure we lock out all processing of any availability reports that might come our way to avoid concurrency
// problems
AvailabilityReportSerializer.getSingleton().lock(agentName);
@@ -299,7 +301,6 @@ public class AgentManagerBean implements AgentManagerLocal {
}
}
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void setAgentBackfilled(int agentId, boolean backfilled) {
Query query = entityManager.createNamedQuery(Agent.QUERY_SET_AGENT_BACKFILLED);
query.setParameter("agentId", agentId);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
index 6cb50f2..842d5d8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
@@ -45,15 +45,16 @@ import org.rhq.enterprise.server.agentclient.AgentClient;
public interface AgentManagerLocal {
/**
- * Call this method to set the agent down and mark it 'backfilled'. Also, sets all of its monitored resources
- * to an UNKNOWN avail state since the agent is no longer reporting availability.
+ * Call this method to set the agent DOWN and mark it 'backfilled'. Also, sets all of its monitored resources
+ * to an UNKNOWN avail state since the agent is no longer reporting availability. Done in its own transaction to
+ * avoid large transactions if many agents are simultaneously backfilled.
*
* @param subject
* @param agentName
* @param agentId
*/
// This method should not be remoted.
- void backfillAgent(Subject subject, String agentName, int agentId);
+ void backfillAgentInNewTransaction(Subject subject, String agentName, int agentId);
/**
* Persists a new agent.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
index d92cbc4..2946d40 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
@@ -749,7 +749,6 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
}
@SuppressWarnings("unchecked")
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void updateAgentResourceAvailabilities(int agentId, AvailabilityType platformAvailType,
AvailabilityType childAvailType) {
commit 6bcb845e3a3fd76fed93444c64eb0d2d98dd93d1
Merge: 08de25a c516ad0
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 15:14:41 2013 -0500
Merge branch 'track_master' into testMerge
Conflicts:
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index c239cb1,b2492cf..00c12c3
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@@ -450,10 -448,9 +450,11 @@@ public class BundleManagerBean implemen
// first see if the bundle exists or not; if not, create one
BundleCriteria criteria = new BundleCriteria();
+ criteria.setStrict(true);
criteria.addFilterBundleTypeId(Integer.valueOf(bundleTypeId));
criteria.addFilterName(bundleName);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<Bundle> bundles = findBundlesByCriteria(subject, criteria);
Bundle bundle;
if (bundles.getTotalSize() == 0) {
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index d6c6f50,319319f..68af1e7
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@@ -107,10 -108,9 +108,11 @@@ import org.rhq.enterprise.server.authz.
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.plugin.pc.content.PackageDetailsValidationException;
import org.rhq.enterprise.server.plugin.pc.content.PackageTypeBehavior;
+ import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index 63cb44d,e7f5b68..f604468
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@@ -1077,30 -1078,18 +1078,17 @@@ public class DiscoveryBossBean implemen
if (null == resourceType) {
try {
- ResourceTypeCriteria criteria = new ResourceTypeCriteria();
- criteria.addFilterPluginName(plugin);
- criteria.addFilterName(name);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
-
- List<ResourceType> result = resourceTypeManager.findResourceTypesByCriteria(
- subjectManager.getOverlord(), criteria);
-
- if (!result.isEmpty()) {
- resourceType = result.get(0);
- loadedTypeMap.put(key.toString(), resourceType);
- }
+ resourceType = this.resourceTypeManager.getResourceTypeByNameAndPlugin(name, plugin);
-
} catch (RuntimeException e) {
- log.error("Failed to lookup Resource type [" + resource.getResourceType() + "] for reported Resource ["
- + resource + "] - this should not have happened.");
- return false;
+ resourceType = null;
}
- }
- if (null == resourceType) {
- log.error("Reported resource [" + resource + "] has an unknown type [" + resource.getResourceType()
- + "]. The Agent most likely has a plugin named '" + resource.getResourceType().getPlugin()
- + "' installed that is not installed on the Server. Resource will be ignored...");
- return false;
+ if (null == resourceType) {
+ log.error("Reported resource [" + resource + "] has an unknown type [" + resource.getResourceType()
+ + "]. The Agent most likely has a plugin named '" + plugin
+ + "' installed that is not installed on the Server. Resource will be ignored...");
+ return false;
+ }
}
resource.setResourceType(resourceType);
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index 53241d9,1495710..3b4f2ec
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@@ -504,10 -501,9 +505,11 @@@ public class DriftManagerBean implement
}
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
+ criteria.setStrict(true);
criteria.addFilterName(summary.getDriftDefinitionName());
criteria.addFilterResourceIds(resourceId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<DriftDefinition> definitions = findDriftDefinitionsByCriteria(subject, criteria);
if (definitions.isEmpty()) {
diff --cc modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
index 95b5f9d,a6002a97..43d5240
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
@@@ -64,8 -64,8 +65,10 @@@ import org.rhq.enterprise.server.resour
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupDeleteException;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
+ import org.rhq.enterprise.server.scheduler.jobs.AsyncResourceDeleteJob;
+ import org.rhq.enterprise.server.scheduler.jobs.PurgeResourceTypesJob;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* This class manages the metadata for resources. Plugins are registered against this bean so that their metadata can be
diff --cc modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
index 5d64970,ddf29b6..faa14ad
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
@@@ -126,60 -122,48 +126,104 @@@ public class CriteriaQueryTest
assertEquals(actual, expected);
}
+ /** This is like executeQueryThatReturnsMultiplePagesOfResults(), creates more
+ * that two pages of ordered entries and iterates over them. This is to test
+ * a nasty bug in CriteriaQuery where results beyond the first two pages were
+ * not being parsed.
+ */
+ @Test
+ public void executeQueryThatReturnsTotalPagesOfResults() {
+ //create page control to browse entries 100 at a time and start at page 0
+ int pageSize = 100;
+ PageControl pc = new PageControl(0, pageSize);
+
+ //Total size of result set is 500.
+ int totalSize = 500;
+
+ //Create list and populate with all entries.
+ List<FakeEntity> total = new ArrayList<FakeEntity>();
+ for (int i = 0; i < totalSize; i++) {
+ total.add(new FakeEntity(i));
+ }
+
+ //build executor to parse a given list with using PageControl passed in
+ FakeCriteriaQueryExecutor queryExecutor = new FakeCriteriaQueryExecutor(totalSize, pc);
+
+ //add pages of results to simulate PageList results as returned by db queries
+ //todo: spinder, modify to support fractional results below and add last page.
+ int bucketCount = totalSize / pageSize;//number of full pages to list
+ int start = 0;
+ int end = pageSize;
+ //add bucketCount pages of data to read from.
+ for (int i = 0; i < bucketCount; i++) {
+ //Ex. first two pages (0, 100), (100,200), etc.
+ queryExecutor.addPage(total.subList(start, end));
+ start += pageSize;
+ end += pageSize;
+ }
+
+ //build criteria and attach pageControl
+ FakeEntityCriteria criteria = new FakeEntityCriteria();
+ //DO NOT use criteria.setPageControl(pc) here as it causes ignore of pageNumber/pageSize
+ criteria.setPaging(pc.getPageNumber(), pc.getPageSize());
+
+ //?? So which pageControl has the right details? Criteria.pageControl? OR PageControl passed into the QueryExecutor.
+
+ //Start off the initial query to page through the items in chunks defined by the pageControl instance
+ CriteriaQuery<FakeEntity, FakeEntityCriteria> query = new CriteriaQuery<FakeEntity, FakeEntityCriteria>(
+ criteria, queryExecutor);
+
+ //Now iterate over the list and make sure that iteration happens in order as expected
+ //monotonically increasing.
+ int last = -1;
+ for (FakeEntity entity : query) {
+ //this fails with earlier bug in CriteriaQuery
+ assertEquals(true, (last < entity.getId()));
+ last = entity.getId();
+ }
+ }
++
+ @Test
+ public void singleResultTest() {
+ // This test doesn't really fit here but I;m adding it for convenience
+ List<FakeEntity> result = null;
+
+ try {
+ FakeEntityCriteria.getSingleResult(result);
+ assert false : "Should have thrown Runtime Exception";
+
+ } catch (RuntimeException e) {
+ assert e.getMessage().contains("NoResultException");
+ }
+
+ result = new ArrayList<FakeEntity>(2);
+
+ try {
+ FakeEntityCriteria.getSingleResult(result);
+ assert false : "Should have thrown Runtime Exception";
+
+ } catch (RuntimeException e) {
+ assert e.getMessage().contains("NoResultException");
+ }
+
+ result.add(new FakeEntity(1));
+
+ try {
+ FakeEntity r = FakeEntityCriteria.getSingleResult(result);
+ assert r.getId() == 1 : "Should have retuned expected entity but returned: " + r;
+
+ } catch (Throwable t) {
+ assert false : "Should have returned single result";
+ }
+
+ result.add(new FakeEntity(2));
+
+ try {
+ FakeEntityCriteria.getSingleResult(result);
+ assert false : "Should have thrown Runtime Exception";
+
+ } catch (RuntimeException e) {
+ assert e.getMessage().contains("NonUniqueResultException");
+ }
+ }
-
}
commit 08de25a9c5d952594e4226f47e4cdd52e75b0137
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 15:00:02 2013 -0500
i)update DriftManagerBean to eliminate unnecessary page clearing
ii)Update ConfigurationManagerBean to use CriteriaQuery where possible instead of unbounded criteria queries.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 141b910..6521730 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -120,6 +120,8 @@ import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupNotFoundException;
import org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.QuartzUtil;
@@ -2560,7 +2562,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
* @param subject Subject of the caller - may limit search results
* @param pds the PropertyDefinitionSimple to work on
*/
- private void handlePDS(Subject subject, int resourceId, PropertyDefinitionSimple pds) {
+ private void handlePDS(final Subject subject, int resourceId, PropertyDefinitionSimple pds) {
if (pds.getOptionsSource() != null) {
// evaluate the source parameters
@@ -2574,8 +2576,16 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (tt == PropertyOptionsSource.TargetType.RESOURCE || tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
List<Resource> resources = null;
+ CriteriaQuery<Resource, ResourceCriteria> resourcesPaged = null;
ResourceCriteria criteria = new ResourceCriteria();
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceManager.findResourcesByCriteria(subject, criteria);
+ }
+ };
if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
// split out expression part for target=configuration
@@ -2586,7 +2596,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (!"self".equals(expr)) {
criteria.setSearchExpression(expr);
- resources = resourceManager.findResourcesByCriteria(subject, criteria);
+ resourcesPaged = new CriteriaQuery<Resource, ResourceCriteria>(criteria, queryExecutor);
} else if (resourceId >= 0) {
resources = new ArrayList<Resource>();
resources.add(resourceManager.getResourceById(subject, resourceId));
@@ -2602,37 +2612,24 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
} else {
criteria.setSearchExpression(expression);
- resources = resourceManager.findResourcesByCriteria(subject, criteria);
+ resourcesPaged = new CriteriaQuery<Resource, ResourceCriteria>(criteria, queryExecutor);
}
+ if (resources != null) {//process resources
for (Resource resource : resources) {
- if (tt == PropertyOptionsSource.TargetType.RESOURCE) {
- String name = resource.getName();
-
- // filter if the user provided a filter
- if (filterPattern != null) {
- Matcher m = filterPattern.matcher(name);
- if (m.matches()) {
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, "" + name);
- pds.getEnumeratedValues().add(pde);
- }
- } else { // Filter is null -> none provided -> do not filter
- PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, "" + name);
- pds.getEnumeratedValues().add(pde);
- }
- } else if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
- // for configuration we need to drill down into the resource configuration
- if (!handleConfigurationTarget(pds, expression, resource))
- return;
-
+ processPropertyOptionsSource(pds, tt, expression, filterPattern, resource);
+ }
+ } else {// process resourcesPaged(CriteriaQuery parsing)
+ for (Resource resource : resourcesPaged) {
+ processPropertyOptionsSource(pds, tt, expression, filterPattern, resource);
}
}
} else if (tt == PropertyOptionsSource.TargetType.GROUP) {
// for groups we need to talk to the group manager
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.setSearchExpression(expression);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+ //?? spinder 2-12-13: We don't do anything with the composite results here?
resourceGroupManager.findResourceGroupCompositesByCriteria(subject, criteria);
}
// TODO plugin and resourceType
@@ -2640,6 +2637,30 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
}
+ private void processPropertyOptionsSource(PropertyDefinitionSimple pds, PropertyOptionsSource.TargetType tt,
+ String expression, Pattern filterPattern, Resource resource) {
+ if (tt == PropertyOptionsSource.TargetType.RESOURCE) {
+ String name = resource.getName();
+
+ // filter if the user provided a filter
+ if (filterPattern != null) {
+ Matcher m = filterPattern.matcher(name);
+ if (m.matches()) {
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, "" + name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ } else { // Filter is null -> none provided -> do not filter
+ PropertyDefinitionEnumeration pde = new PropertyDefinitionEnumeration(name, "" + name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ } else if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // for configuration we need to drill down into the resource configuration
+ if (!handleConfigurationTarget(pds, expression, resource))
+ return;
+
+ }
+ }
+
/**
* Drill down in the case the user set up a target of "configuration". We need to check
* that the target property actually exists and that it has a format we understand
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index dcc08d8..53241d9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -208,7 +208,6 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
DriftDefinitionCriteria driftDefCriteria = new DriftDefinitionCriteria();
driftDefCriteria.addFilterResourceIds(resourceId);
driftDefCriteria.addFilterName(driftDefName);
- driftDefCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<DriftDefinition> defs = findDriftDefinitionsByCriteria(overlord, driftDefCriteria);
if (defs.isEmpty()) {
@@ -223,7 +222,6 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
criteria.addFilterDriftDefinitionId(driftDef.getId());
criteria.addFilterVersion(Integer.toString(version));
criteria.fetchDrifts(true);
- criteria.setPageControl(PageControl.getUnlimitedInstance());//disable paging as the code assumes all the results will be returned.
PageList<? extends DriftChangeSet<?>> changeSets = driftServerPlugin.findDriftChangeSetsByCriteria(overlord,
criteria);
commit 074bb5d7cdb8512e3a3d7738ca45f08018696ed3
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 13:27:03 2013 -0500
Update unbounded criteria usage to CriteriaQuery usage to scale for larger deployments.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 4fabe9a..c239cb1 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -84,7 +84,6 @@ import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.StringUtils;
import org.rhq.core.util.NumberUtil;
@@ -105,6 +104,8 @@ import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility;
import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility.SerializationType;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -376,7 +377,6 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
criteria.addFilterDestinationId(bundleDestination.getId());
criteria.addFilterIsLive(true);
criteria.fetchBundleVersion(true);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
List<BundleDeployment> liveDeployments = bundleManager.findBundleDeploymentsByCriteria(subject, criteria);
BundleDeployment liveDeployment = (liveDeployments.isEmpty()) ? null : liveDeployments.get(0);
@@ -634,7 +634,6 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
criteria.setStrict(true);
criteria.addFilterBundleTypeId(bundleType.getId());
criteria.addFilterName(bundleName);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<Bundle> bundles = bundleManager.findBundlesByCriteria(subject, criteria);
Bundle bundle;
@@ -702,15 +701,25 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
bundleVersion = bundleVersions.get(0);
List<BundleFile> bundleFiles = bundleVersion.getBundleFiles();
if (bundleFiles != null && bundleFiles.size() > 0) {
- BundleFileCriteria bfCriteria = new BundleFileCriteria();
+ final BundleFileCriteria bfCriteria = new BundleFileCriteria();
bfCriteria.addFilterBundleVersionId(bundleVersion.getId());
bfCriteria.fetchPackageVersion(true);
- bfCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- PageList<BundleFile> bfs = bundleManager.findBundleFilesByCriteria(subjectManager.getOverlord(),
- bfCriteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<BundleFile, BundleFileCriteria> queryExecutor = new CriteriaQueryExecutor<BundleFile, BundleFileCriteria>() {
+ @Override
+ public PageList<BundleFile> execute(BundleFileCriteria criteria) {
+ return bundleManager.findBundleFilesByCriteria(subjectManager.getOverlord(), bfCriteria);
+ }
+ };
+
+ CriteriaQuery<BundleFile, BundleFileCriteria> bfs = new CriteriaQuery<BundleFile, BundleFileCriteria>(
+ bfCriteria, queryExecutor);
+
bundleFiles.clear();
- bundleFiles.addAll(bfs);
+ for (BundleFile bf : bfs) {
+ bundleFiles.add(bf);
+ }
}
bundleVersion.setBundleDeployments(new ArrayList<BundleDeployment>());
} else {
@@ -854,7 +863,7 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
@Override
@RequiredPermission(Permission.MANAGE_BUNDLE)
@TransactionAttribute(TransactionAttributeType.NEVER)
- public void purgeBundleDestination(Subject subject, int bundleDestinationId) throws Exception {
+ public void purgeBundleDestination(final Subject subject, int bundleDestinationId) throws Exception {
// find the live bundle deployment for this destination, and get all the resource deployments for that live deployment
BundleDeploymentCriteria bdc = new BundleDeploymentCriteria();
bdc.addFilterDestinationId(bundleDestinationId);
@@ -890,16 +899,28 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
for (BundleResourceDeployment resourceDeploy : resourceDeploys) {
resourceDeployIds.add(resourceDeploy.getId());
}
- BundleResourceDeploymentCriteria brdc = new BundleResourceDeploymentCriteria();
+ final BundleResourceDeploymentCriteria brdc = new BundleResourceDeploymentCriteria();
brdc.addFilterIds(resourceDeployIds.toArray(new Integer[resourceDeployIds.size()]));
brdc.fetchResource(true);
- brdc.setPageControl(PageControl.getUnlimitedInstance());
- PageList<BundleResourceDeployment> brdResults = bundleManager.findBundleResourceDeploymentsByCriteria(subject,
- brdc);
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<BundleResourceDeployment, BundleResourceDeploymentCriteria> queryExecutor = new CriteriaQueryExecutor<BundleResourceDeployment, BundleResourceDeploymentCriteria>() {
+ @Override
+ public PageList<BundleResourceDeployment> execute(BundleResourceDeploymentCriteria criteria) {
+ return bundleManager.findBundleResourceDeploymentsByCriteria(subject, brdc);
+ }
+ };
+
+ CriteriaQuery<BundleResourceDeployment, BundleResourceDeploymentCriteria> brdResults = new CriteriaQuery<BundleResourceDeployment, BundleResourceDeploymentCriteria>(
+ brdc, queryExecutor);
+
+ // PageList<BundleResourceDeployment> brdResults = bundleManager.findBundleResourceDeploymentsByCriteria(subject,
+ // brdc);
resourceDeploys.clear();
- resourceDeploys.addAll(brdResults);
+ // resourceDeploys.addAll(brdResults);
// need to wire the live bundle deployment back in - no need for another query or fetch it above because we have it already
for (BundleResourceDeployment brd : brdResults) {
+ resourceDeploys.add(brd);
brd.setBundleDeployment(liveDeployment);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
index 0ca5b82..a78d7e9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
@@ -33,11 +33,14 @@ import org.rhq.core.domain.bundle.BundleResourceDeploymentHistory;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.criteria.BundleFileCriteria;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
+import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.exception.WrappedRemotingException;
import org.rhq.enterprise.server.content.ContentManagerLocal;
import org.rhq.enterprise.server.content.ContentSourceManagerLocal;
import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility;
import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility.SerializationType;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -63,18 +66,27 @@ public class BundleServerServiceImpl implements BundleServerService {
public List<PackageVersion> getAllBundleVersionPackageVersions(int bundleVersionId) {
try {
- BundleManagerLocal bm = LookupUtil.getBundleManager();
+ final BundleManagerLocal bm = LookupUtil.getBundleManager();
ContentManagerLocal cm = LookupUtil.getContentManager();
- Subject subject = LookupUtil.getSubjectManager().getOverlord();
- BundleFileCriteria bfc = new BundleFileCriteria();
+ final Subject subject = LookupUtil.getSubjectManager().getOverlord();
+ final BundleFileCriteria bfc = new BundleFileCriteria();
PackageVersionCriteria pvc = new PackageVersionCriteria();
bfc.addFilterBundleVersionId(bundleVersionId);
bfc.fetchPackageVersion(true);
- bfc.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<BundleFile> bundleFiles = bm.findBundleFilesByCriteria(subject, bfc);
- List<PackageVersion> packageVersions = new ArrayList<PackageVersion>(bundleFiles.size());
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<BundleFile, BundleFileCriteria> queryExecutor = new CriteriaQueryExecutor<BundleFile, BundleFileCriteria>() {
+ @Override
+ public PageList<BundleFile> execute(BundleFileCriteria criteria) {
+ return bm.findBundleFilesByCriteria(subject, bfc);
+ }
+ };
+
+ CriteriaQuery<BundleFile, BundleFileCriteria> bundleFiles = new CriteriaQuery<BundleFile, BundleFileCriteria>(
+ bfc, queryExecutor);
+
+ List<PackageVersion> packageVersions = new ArrayList<PackageVersion>();
PackageVersion packageVersion = null;
for (BundleFile bundleFile : bundleFiles) {
pvc.addFilterId(bundleFile.getPackageVersion().getId());
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DeletedResourceTypeFilter.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DeletedResourceTypeFilter.java
index c2371bd..347bc03 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DeletedResourceTypeFilter.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DeletedResourceTypeFilter.java
@@ -9,11 +9,12 @@ import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.plugin.Plugin;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.metadata.PluginManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
public class DeletedResourceTypeFilter {
@@ -41,9 +42,17 @@ public class DeletedResourceTypeFilter {
private void loadDeletedTypes() {
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterDeleted(true);
- criteria.setPageControl(PageControl.getUnlimitedInstance());
- PageList<ResourceType> results = resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
- criteria);
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria> queryExecutor = new CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria>() {
+ @Override
+ public PageList<ResourceType> execute(ResourceTypeCriteria criteria) {
+ return resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), criteria);
+ }
+ };
+
+ CriteriaQuery<ResourceType, ResourceTypeCriteria> results = new CriteriaQuery<ResourceType, ResourceTypeCriteria>(
+ criteria, queryExecutor);
for (ResourceType type : results) {
deletedTypes.add(type.getName() + "::" + type.getPlugin());
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
index 1629926..ca9bfab 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
@@ -33,10 +33,13 @@ import org.rhq.core.domain.search.SavedSearch;
import org.rhq.core.domain.search.SearchSubsystem;
import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.search.SearchSuggestion.Kind;
+import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.server.search.SavedSearchManagerLocal;
import org.rhq.enterprise.server.search.assist.SearchAssistant;
import org.rhq.enterprise.server.search.assist.SearchAssistantFactory;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -606,9 +609,17 @@ public class SearchAssistManager {
criteria.setCaseSensitive(false);
criteria.addSortName(PageOrdering.ASC);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<SavedSearch> savedSearchResults = savedSearchManager.findSavedSearchesByCriteria(subject, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<SavedSearch, SavedSearchCriteria> queryExecutor = new CriteriaQueryExecutor<SavedSearch, SavedSearchCriteria>() {
+ @Override
+ public PageList<SavedSearch> execute(SavedSearchCriteria criteria) {
+ return savedSearchManager.findSavedSearchesByCriteria(subject, criteria);
+ }
+ };
+
+ CriteriaQuery<SavedSearch, SavedSearchCriteria> savedSearchResults = new CriteriaQuery<SavedSearch, SavedSearchCriteria>(
+ criteria, queryExecutor);
List<SearchSuggestion> results = new ArrayList<SearchSuggestion>();
for (SavedSearch next : savedSearchResults) {
@@ -637,9 +648,17 @@ public class SearchAssistManager {
criteria.setCaseSensitive(false);
criteria.addSortName(PageOrdering.ASC);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<SavedSearch> savedSearchResults = savedSearchManager.findSavedSearchesByCriteria(subject, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<SavedSearch, SavedSearchCriteria> queryExecutor = new CriteriaQueryExecutor<SavedSearch, SavedSearchCriteria>() {
+ @Override
+ public PageList<SavedSearch> execute(SavedSearchCriteria criteria) {
+ return savedSearchManager.findSavedSearchesByCriteria(subject, criteria);
+ }
+ };
+
+ CriteriaQuery<SavedSearch, SavedSearchCriteria> savedSearchResults = new CriteriaQuery<SavedSearch, SavedSearchCriteria>(
+ criteria, queryExecutor);
List<SearchSuggestion> results = new ArrayList<SearchSuggestion>();
for (SavedSearch next : savedSearchResults) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
index 944f799..27b2bf7 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
@@ -84,7 +84,6 @@ public class TagManagerBean implements TagManagerLocal, TagManagerRemote {
criteria.addFilterSemantic(tag.getSemantic());
criteria.addFilterName(tag.getName());
criteria.setStrict(true);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
List<Tag> found = findTagsByCriteria(subject, criteria);
if (!found.isEmpty()) {
commit 03bd442a7270443572a8e17c77551a2d72bf4951
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 12:04:30 2013 -0500
i)update ContentSourceMangerBean and several rest instances using unbounded criteria to use CriteriaQuery specifically.
ii)modified CriteriaQuery to be able to return list of types
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
index e6bdf1b..b1dc1bc 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
@@ -122,6 +122,8 @@ import org.rhq.enterprise.server.plugin.pc.content.InitializationException;
import org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport;
import org.rhq.enterprise.server.plugin.pc.content.RepoDetails;
import org.rhq.enterprise.server.resource.ProductVersionManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -746,16 +748,25 @@ public class ContentSourceManagerBean implements ContentSourceManagerLocal {
// Following same sort of workaround done in ContentProviderManager for synchronizeContentProvider
// Assume this will need to be updated when we place syncing in repo layer
//
- RepoCriteria reposForContentSource = new RepoCriteria();
+ final RepoCriteria reposForContentSource = new RepoCriteria();
reposForContentSource.addFilterContentSourceIds(contentSourceId);
reposForContentSource.addFilterCandidate(false); // Don't sync distributions for candidates
- reposForContentSource.clearPaging();//disable paging as the code assumes all the results will be returned.
- Subject overlord = LookupUtil.getSubjectManager().getOverlord();
- List<Repo> repos = repoManager.findReposByCriteria(overlord, reposForContentSource);
- log.debug("downloadDistributionBits found " + repos.size() + " repos associated with this contentSourceId "
- + contentSourceId);
+ final Subject overlord = LookupUtil.getSubjectManager().getOverlord();
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Repo, RepoCriteria> queryExecutor = new CriteriaQueryExecutor<Repo, RepoCriteria>() {
+ @Override
+ public PageList<Repo> execute(RepoCriteria criteria) {
+ return repoManager.findReposByCriteria(overlord, reposForContentSource);
+ }
+ };
+
+ CriteriaQuery<Repo, RepoCriteria> repos = new CriteriaQuery<Repo, RepoCriteria>(reposForContentSource,
+ queryExecutor);
+
+ int repoCount = 0;
for (Repo repo : repos) {
+ repoCount++;
log.debug("downloadDistributionBits operating on repo: " + repo.getName() + " id = " + repo.getId());
// Look up Distributions associated with this ContentSource.
PageControl pageControl = PageControl.getUnlimitedInstance();
@@ -798,6 +809,9 @@ public class ContentSourceManagerBean implements ContentSourceManagerLocal {
}
}
}
+ log.debug("downloadDistributionBits found and processed " + repoCount
+ + " repos associated with this contentSourceId "
+ + contentSourceId);
} catch (Throwable t) {
log.error(t);
throw new RuntimeException(t);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
index 3d7abe0..786a8b1 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
@@ -59,11 +59,14 @@ import org.rhq.core.domain.event.EventSource;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.event.EventManagerLocal;
import org.rhq.enterprise.server.rest.domain.EventDefinitionRest;
import org.rhq.enterprise.server.rest.domain.EventRest;
import org.rhq.enterprise.server.rest.domain.EventSourceRest;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Handle event related things
@@ -297,8 +300,16 @@ public class EventHandlerBean extends AbstractRestBean {
private Response.ResponseBuilder getEventsAsBuilderForCriteria(HttpHeaders headers, EventCriteria criteria) {
- List<Event> eventList = eventManager.findEventsByCriteria(caller,criteria);
- List<EventRest> restEvents = new ArrayList<EventRest>(eventList.size());
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Event, EventCriteria> queryExecutor = new CriteriaQueryExecutor<Event, EventCriteria>() {
+ @Override
+ public PageList<Event> execute(EventCriteria criteria) {
+ return eventManager.findEventsByCriteria(caller, criteria);
+ }
+ };
+
+ CriteriaQuery<Event, EventCriteria> eventList = new CriteriaQuery<Event, EventCriteria>(criteria, queryExecutor);
+ List<EventRest> restEvents = new ArrayList<EventRest>();
for (Event event : eventList) {
restEvents.add(convertEvent(event));
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
index ebaf451..8f9b360 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
@@ -80,6 +80,8 @@ import org.rhq.enterprise.server.rest.domain.GroupRest;
import org.rhq.enterprise.server.rest.domain.Link;
import org.rhq.enterprise.server.rest.domain.MetricSchedule;
import org.rhq.enterprise.server.rest.domain.ResourceWithType;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Deal with group related things.
@@ -114,11 +116,19 @@ public class GroupHandlerBean extends AbstractRestBean {
if (q!=null) {
criteria.addFilterName(q);
}
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<ResourceGroup> groups = resourceGroupManager.findResourceGroupsByCriteria(caller, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<ResourceGroup, ResourceGroupCriteria> queryExecutor = new CriteriaQueryExecutor<ResourceGroup, ResourceGroupCriteria>() {
+ @Override
+ public PageList<ResourceGroup> execute(ResourceGroupCriteria criteria) {
+ return resourceGroupManager.findResourceGroupsByCriteria(caller, criteria);
+ }
+ };
+
+ CriteriaQuery<ResourceGroup, ResourceGroupCriteria> groups = new CriteriaQuery<ResourceGroup, ResourceGroupCriteria>(
+ criteria, queryExecutor);
- List<GroupRest> list = new ArrayList<GroupRest>(groups.size());
+ List<GroupRest> list = new ArrayList<GroupRest>();
for (ResourceGroup group : groups) {
list.add(fillGroup(group, uriInfo));
}
@@ -373,10 +383,19 @@ public class GroupHandlerBean extends AbstractRestBean {
if (q!=null) {
criteria.addFilterName(q);
}
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- PageList<GroupDefinition> gdlist = definitionManager.findGroupDefinitionsByCriteria(caller, criteria);
- List<GroupDefinitionRest> list = new ArrayList<GroupDefinitionRest>(gdlist.getTotalSize());
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<GroupDefinition, ResourceGroupDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<GroupDefinition, ResourceGroupDefinitionCriteria>() {
+ @Override
+ public PageList<GroupDefinition> execute(ResourceGroupDefinitionCriteria criteria) {
+ return definitionManager.findGroupDefinitionsByCriteria(caller, criteria);
+ }
+ };
+
+ CriteriaQuery<GroupDefinition, ResourceGroupDefinitionCriteria> gdlist = new CriteriaQuery<GroupDefinition, ResourceGroupDefinitionCriteria>(
+ criteria, queryExecutor);
+
+ List<GroupDefinitionRest> list = new ArrayList<GroupDefinitionRest>();
for (GroupDefinition def: gdlist) {
GroupDefinitionRest definitionRest = buildGDRestFromDefinition(def);
createLinksForGDRest(uriInfo,definitionRest);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
index fbf81fb..2e8f99c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
@@ -67,6 +67,7 @@ import org.rhq.core.domain.operation.ResourceOperationHistory;
import org.rhq.core.domain.operation.bean.ResourceOperationSchedule;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
@@ -75,6 +76,8 @@ import org.rhq.enterprise.server.rest.domain.OperationDefinitionRest;
import org.rhq.enterprise.server.rest.domain.OperationHistoryRest;
import org.rhq.enterprise.server.rest.domain.OperationRest;
import org.rhq.enterprise.server.rest.domain.SimplePropDef;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Deal with operations
@@ -343,7 +346,6 @@ public class OperationsHandlerBean extends AbstractRestBean {
ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
JobId jobId = new JobId(jobName);
criteria.addFilterJobId(jobId);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
ResourceOperationHistory history ;//= opsManager.getOperationHistoryByJobId(caller,jobName);
List<ResourceOperationHistory> list = opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
@@ -387,11 +389,19 @@ public class OperationsHandlerBean extends AbstractRestBean {
criteria.addFilterResourceIds(resourceId);
criteria.addSortEndTime(PageOrdering.DESC);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<ResourceOperationHistory> list = opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<ResourceOperationHistory, ResourceOperationHistoryCriteria> queryExecutor = new CriteriaQueryExecutor<ResourceOperationHistory, ResourceOperationHistoryCriteria>() {
+ @Override
+ public PageList<ResourceOperationHistory> execute(ResourceOperationHistoryCriteria criteria) {
+ return opsManager.findResourceOperationHistoriesByCriteria(caller, criteria);
+ }
+ };
+
+ CriteriaQuery<ResourceOperationHistory, ResourceOperationHistoryCriteria> list = new CriteriaQuery<ResourceOperationHistory, ResourceOperationHistoryCriteria>(
+ criteria, queryExecutor);
- List<OperationHistoryRest> result = new ArrayList<OperationHistoryRest>(list.size());
+ List<OperationHistoryRest> result = new ArrayList<OperationHistoryRest>();
for (ResourceOperationHistory roh : list) {
OperationHistoryRest historyRest = historyToHistoryRest(roh,uriInfo);
result.add(historyRest);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
index 0a4509d..eb65599 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
@@ -118,4 +118,13 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
throw new UnsupportedOperationException("This iterator does not support removal.");
}
}
+
+ public PageList<T> loadAsList() {
+ Iterator<T> iterator = iterator();
+ PageList<T> list = new PageList<T>();
+ while (iterator.hasNext()) {
+ list.add(iterator.next());
+ }
+ return list;
+ }
}
commit 60692c34e375615b5b772f32bd92d4da0cf904b7
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 09:12:50 2013 -0500
Update ContentMangerBean to use CriteriaQuery.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index a957d00..d6c6f50 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -109,6 +109,8 @@ import org.rhq.enterprise.server.plugin.pc.content.PackageDetailsValidationExcep
import org.rhq.enterprise.server.plugin.pc.content.PackageTypeBehavior;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -1588,17 +1590,26 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
return runner.execute();
}
- public PageList<PackageAndLatestVersionComposite> findPackagesWithLatestVersion(Subject subject, PackageCriteria criteria) {
+ public PageList<PackageAndLatestVersionComposite> findPackagesWithLatestVersion(final Subject subject,
+ PackageCriteria criteria) {
if (criteria.getFilterRepoId() == null) {
throw new IllegalArgumentException("The criteria query has to have a filter for a specific repo.");
}
criteria.fetchVersions(true);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- PageList<Package> packages = findPackagesByCriteria(subject, criteria);
-
- PageList<PackageAndLatestVersionComposite> ret = new PageList<PackageAndLatestVersionComposite>(packages.getTotalSize(), packages.getPageControl());
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Package, PackageCriteria> queryExecutor = new CriteriaQueryExecutor<Package, PackageCriteria>() {
+ @Override
+ public PageList<Package> execute(PackageCriteria criteria) {
+ return findPackagesByCriteria(subject, criteria);
+ }
+ };
+
+ CriteriaQuery<Package, PackageCriteria> packages = new CriteriaQuery<Package, PackageCriteria>(criteria,
+ queryExecutor);
+
+ PageList<PackageAndLatestVersionComposite> ret = new PageList<PackageAndLatestVersionComposite>();
for(Package p : packages) {
PackageVersion latest = repoManager.getLatestPackageVersion(subject, p.getId(), criteria.getFilterRepoId());
commit 3806efcdd4e34a1089d08137f53137d80c9e1879
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 09:00:29 2013 -0500
more unbounded criteria usages converted to CriteriaQuery.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
index 0ab7dee..cf813ca 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
@@ -26,10 +26,13 @@ import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.measurement.NumericType;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class MeasurementMetadataManagerBean implements MeasurementMetadataManagerLocal {
@@ -216,10 +219,18 @@ public class MeasurementMetadataManagerBean implements MeasurementMetadataManage
MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<MeasurementDefinition> definitions = measurementDefinitionMgr.findMeasurementDefinitionsByCriteria(
- subjectMgr.getOverlord(), criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria>() {
+ @Override
+ public PageList<MeasurementDefinition> execute(MeasurementDefinitionCriteria criteria) {
+ return measurementDefinitionMgr
+ .findMeasurementDefinitionsByCriteria(subjectMgr.getOverlord(), criteria);
+ }
+ };
+
+ CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria> definitions = new CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria>(
+ criteria, queryExecutor);
// Remove the type's metric definitions. We do this separately, rather than just relying on cascade
// upon deletion of the ResourceType, because the removeMeasurementDefinition() will also take care
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
index f833bc5..0c2fdcb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
@@ -1,7 +1,5 @@
package org.rhq.enterprise.server.resource.metadata;
-import java.util.List;
-
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
@@ -21,11 +19,14 @@ import org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.configuration.metadata.ConfigurationDefinitionUpdateReport;
import org.rhq.enterprise.server.configuration.metadata.ConfigurationMetadataManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class PluginConfigurationMetadataManagerBean implements PluginConfigurationMetadataManagerLocal {
@@ -73,12 +74,20 @@ public class PluginConfigurationMetadataManagerBean implements PluginConfigurati
if (updateReport.getNewPropertyDefinitions().size() > 0
|| updateReport.getUpdatedPropertyDefinitions().size() > 0) {
- Subject overlord = subjectMgr.getOverlord();
+ final Subject overlord = subjectMgr.getOverlord();
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<Resource> resources = resourceMgr.findResourcesByCriteria(overlord, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceMgr.findResourcesByCriteria(overlord, criteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> resources = new CriteriaQuery<Resource, ResourceCriteria>(
+ criteria, queryExecutor);
for (Resource resource : resources) {
updateResourcePluginConfiguration(resource, updateReport);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
index 08a4775..2845fcf 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.server.scheduler.jobs;
+import java.util.ArrayList;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
@@ -35,6 +37,8 @@ import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.content.ContentSourceManagerLocal;
import org.rhq.enterprise.server.content.RepoManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -113,19 +117,31 @@ public class ContentProviderSyncJob implements StatefulJob {
private void syncImportedRepos(ContentSource contentSource) throws InterruptedException {
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
- Subject overlord = subjectManager.getOverlord();
- RepoCriteria repoCriteria = new RepoCriteria();
+ final Subject overlord = subjectManager.getOverlord();
+ final RepoCriteria repoCriteria = new RepoCriteria();
repoCriteria.addFilterContentSourceIds(contentSource.getId());
repoCriteria.addFilterCandidate(false);
- repoCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
-
- RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
- PageList<Repo> repos = repoManager.findReposByCriteria(overlord, repoCriteria);
- Integer[] repoIds = new Integer[repos.size()];
- for (int i = 0; i < repos.size(); i++) {
- Repo repo = repos.get(i);
- repoIds[i] = repo.getId();
+
+ final RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Repo, RepoCriteria> queryExecutor = new CriteriaQueryExecutor<Repo, RepoCriteria>() {
+ @Override
+ public PageList<Repo> execute(RepoCriteria criteria) {
+ return repoManager.findReposByCriteria(overlord, repoCriteria);
+ }
+ };
+
+ CriteriaQuery<Repo, RepoCriteria> repos = new CriteriaQuery<Repo, RepoCriteria>(repoCriteria, queryExecutor);
+
+
+ ArrayList<Integer> repoIdList = new ArrayList<Integer>();
+ for (Repo repo : repos) {
+ repoIdList.add(repo.getId());
}
+ Integer[] repoIds = new Integer[repoIdList.size()];
+ repoIds = repoIdList.toArray(repoIds);
+
repoManager.internalSynchronizeRepos(overlord, repoIds);
}
commit 4b2d458e0dcab67e5123ca9b28f280076ddaffba
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 08:38:53 2013 -0500
Update criteria usage to use CriteriaQuery where possible instead of unbounded queries.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
index a52c4c2..711a653 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
@@ -1,6 +1,6 @@
package org.rhq.enterprise.server.resource.metadata;
-import java.util.List;
+import java.util.ArrayList;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -12,8 +12,11 @@ import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertTemplateManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class AlertMetadataManagerBean implements AlertMetadataManagerLocal {
@@ -27,21 +30,32 @@ public class AlertMetadataManagerBean implements AlertMetadataManagerLocal {
private AlertTemplateManagerLocal alertTemplateMgr;
@Override
- public void deleteAlertTemplates(Subject subject, ResourceType resourceType) {
+ public void deleteAlertTemplates(final Subject subject, ResourceType resourceType) {
log.debug("Deleting alert templates for " + resourceType);
AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
criteria.addFilterAlertTemplateResourceTypeId(resourceType.getId());
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<AlertDefinition> templates = alertDefinitionMgr.findAlertDefinitionsByCriteria(subject, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<AlertDefinition, AlertDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<AlertDefinition, AlertDefinitionCriteria>() {
+ @Override
+ public PageList<AlertDefinition> execute(AlertDefinitionCriteria criteria) {
+ return alertDefinitionMgr.findAlertDefinitionsByCriteria(subject, criteria);
+ }
+ };
- Integer[] templateIds = new Integer[templates.size()];
+ CriteriaQuery<AlertDefinition, AlertDefinitionCriteria> templates = new CriteriaQuery<AlertDefinition, AlertDefinitionCriteria>(
+ criteria, queryExecutor);
+
+ ArrayList<Integer> templateIdList = new ArrayList<Integer>();
int i = 0;
for (AlertDefinition template : templates) {
- templateIds[i++] = template.getId();
+ templateIdList.add(template.getId());
}
+ Integer[] templateIds = new Integer[templateIdList.size()];
+ templateIds = templateIdList.toArray(templateIds);
+
// Alert definitions associated with individual resources and with groups
// are deleted as part of resource deletion. This commit adds support for
// templates which are alert definitions associated with the resource
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
index cd54bf0..6ebdc20 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
@@ -24,9 +24,12 @@ import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.bundle.BundleManagerLocal;
import org.rhq.enterprise.server.configuration.metadata.ConfigurationMetadataManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class ContentMetadataManagerBean implements ContentMetadataManagerLocal {
@@ -230,7 +233,7 @@ public class ContentMetadataManagerBean implements ContentMetadataManagerLocal {
}
}
- private void deleteBundles(Subject subject, ResourceType resourceType) throws Exception {
+ private void deleteBundles(final Subject subject, ResourceType resourceType) throws Exception {
BundleType bundleType = resourceType.getBundleType();
if (bundleType == null) {
@@ -239,9 +242,18 @@ public class ContentMetadataManagerBean implements ContentMetadataManagerLocal {
BundleCriteria criteria = new BundleCriteria();
criteria.addFilterBundleTypeId(bundleType.getId());
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<Bundle> bundles = bundleMgr.findBundlesByCriteria(subject, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Bundle, BundleCriteria> queryExecutor = new CriteriaQueryExecutor<Bundle, BundleCriteria>() {
+ @Override
+ public PageList<Bundle> execute(BundleCriteria criteria) {
+ return bundleMgr.findBundlesByCriteria(subject, criteria);
+ }
+ };
+
+ CriteriaQuery<Bundle, BundleCriteria> bundles = new CriteriaQuery<Bundle, BundleCriteria>(criteria,
+ queryExecutor);
+
for (Bundle bundle : bundles) {
bundleMgr.deleteBundle(subject, bundle.getId());
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
index 6f0c9df..95b5f9d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
@@ -56,6 +56,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceSubCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.RequiredPermission;
@@ -63,6 +64,8 @@ import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupDeleteException;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* This class manages the metadata for resources. Plugins are registered against this bean so that their metadata can be
@@ -270,7 +273,7 @@ public class ResourceMetadataManagerBean implements ResourceMetadataManagerLocal
c.addFilterInventoryStatus(null);
List<Resource> resources = resourceManager.findResourcesByCriteria(subject, c);
//Chunk through the results in 200(default) page element batches to avoid excessive
- //memory usage for large deployments
+ //memory usage for large deployments. No need to use CriteriaQuery here as this loop is more efficient at catching stragglers
while ((resources != null) && (!resources.isEmpty())) {
Iterator<Resource> resIter = resources.iterator();
while (resIter.hasNext()) {
@@ -678,13 +681,22 @@ public class ResourceMetadataManagerBean implements ResourceMetadataManagerLocal
private void moveResourcesToNewParent(ResourceType existingType, ResourceType obsoleteParentType,
Set<ResourceType> newParentTypes) {
- Subject overlord = subjectManager.getOverlord();
+ final Subject overlord = subjectManager.getOverlord();
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
criteria.addFilterParentResourceTypeId(obsoleteParentType.getId());
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<Resource> resources = resourceManager.findResourcesByCriteria(overlord, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceManager.findResourcesByCriteria(overlord, criteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> resources = new CriteriaQuery<Resource, ResourceCriteria>(criteria,
+ queryExecutor);
+
for (Resource resource : resources) {
Resource newParent = null;
newParentTypes: for (ResourceType newParentType : newParentTypes) {
commit 74602ae63e196bbbf3e4c6d156d6a385bd208c6f
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 08:20:28 2013 -0500
Update ResourceManagerBean criteria usage to CriteriaQuery where possible. Still required to clearPaging in some cases.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 205252d..e8758ec 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -126,6 +126,8 @@ import org.rhq.enterprise.server.resource.disambiguation.DisambiguationUpdateStr
import org.rhq.enterprise.server.resource.disambiguation.Disambiguator;
import org.rhq.enterprise.server.resource.group.ResourceGroupDeleteException;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.QueryUtility;
@@ -853,7 +855,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return resourceLineage;
}
- public Map<Integer, String> getResourcesAncestry(Subject subject, Integer[] resourceIds,
+ public Map<Integer, String> getResourcesAncestry(final Subject subject, Integer[] resourceIds,
ResourceAncestryFormat format) {
Map<Integer, String> result = new HashMap<Integer, String>(resourceIds.length);
@@ -861,12 +863,20 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
return result;
}
- ResourceCriteria resourceCriteria = new ResourceCriteria();
+ final ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterIds(resourceIds);
resourceCriteria.fetchResourceType(true);
- resourceCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<Resource> resources = findResourcesByCriteria(subject, resourceCriteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return findResourcesByCriteria(subject, resourceCriteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> resources = new CriteriaQuery<Resource, ResourceCriteria>(
+ resourceCriteria, queryExecutor);
if (ResourceAncestryFormat.RAW == format) {
for (Resource resource : resources) {
@@ -888,19 +898,36 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// In addition to the types of the result resources, get the types of their ancestry
typesSet.addAll(getAncestryTypeIds(ancestries));
- ResourceTypeCriteria resourceTypeCriteria = new ResourceTypeCriteria();
+ final ResourceTypeCriteria resourceTypeCriteria = new ResourceTypeCriteria();
resourceTypeCriteria.addFilterIds(typesSet.toArray(new Integer[typesSet.size()]));
- resourceCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria> rtQueryExecutor =
+ new CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria>() {
+ @Override
+ public PageList<ResourceType> execute(ResourceTypeCriteria criteria) {
+ return typeManager.findResourceTypesByCriteria(subject, resourceTypeCriteria);
+ }
+ };
- List<ResourceType> types = typeManager.findResourceTypesByCriteria(subject, resourceTypeCriteria);
+ CriteriaQuery<ResourceType, ResourceTypeCriteria> types =
+ new CriteriaQuery<ResourceType, ResourceTypeCriteria>(resourceTypeCriteria, rtQueryExecutor);
for (Resource resource : resources) {
- String decodedAncestry = getDecodedAncestry(resource, types, format);
+ String decodedAncestry = getDecodedAncestry(resource, loadAsList(types.iterator()), format);
result.put(resource.getId(), decodedAncestry);
}
return result;
}
+ private List<ResourceType> loadAsList(Iterator<ResourceType> iterator) {
+ PageList<ResourceType> list = new PageList<ResourceType>();
+ while(iterator.hasNext()){
+ list.add(iterator.next());
+ }
+ return list;
+ }
+
/**
* Get the complete set of resource type Ids in the ancestries provided. This is useful for
* being able to load all the types in advance of generating decoded values.
commit 6f2a62643acafde67e9726219b2d358adcb0a60b
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 08:16:49 2013 -0500
Update more criteriaQuery usages with CriteriaQuery instead of unbounded.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
index 3eb83e0..4638e25 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
@@ -41,6 +41,8 @@ import org.rhq.core.domain.drift.DriftSnapshot;
import org.rhq.core.domain.drift.DriftSnapshotRequest;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
public class DriftServerServiceImpl implements DriftServerService {
@@ -80,10 +82,19 @@ public class DriftServerServiceImpl implements DriftServerService {
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
criteria.addFilterResourceIds(resourceIds.toArray(new Integer[resourceIds.size()]));
criteria.fetchConfiguration(true);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- Subject overlord = getSubjectManager().getOverlord();
- PageList<DriftDefinition> definitions = getDriftManager().findDriftDefinitionsByCriteria(overlord, criteria);
+ final Subject overlord = getSubjectManager().getOverlord();
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<DriftDefinition, DriftDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<DriftDefinition, DriftDefinitionCriteria>() {
+ @Override
+ public PageList<DriftDefinition> execute(DriftDefinitionCriteria criteria) {
+ return getDriftManager().findDriftDefinitionsByCriteria(overlord, criteria);
+ }
+ };
+
+ CriteriaQuery<DriftDefinition, DriftDefinitionCriteria> definitions = new CriteriaQuery<DriftDefinition, DriftDefinitionCriteria>(
+ criteria, queryExecutor);
Map<Integer, List<DriftDefinition>> result = new HashMap<Integer, List<DriftDefinition>>();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
index 39bda2c..5457e49 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
@@ -47,6 +47,8 @@ import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.authz.RequiredPermission;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -120,7 +122,7 @@ public class DriftTemplateManagerBean implements DriftTemplateManagerLocal, Drif
@RequiredPermission(Permission.MANAGE_SETTINGS)
@Override
@TransactionAttribute(NEVER)
- public void pinTemplate(Subject subject, int templateId, int driftDefId, int snapshotVersion) {
+ public void pinTemplate(final Subject subject, int templateId, int driftDefId, int snapshotVersion) {
templateMgr.createTemplateChangeSet(subject, templateId, driftDefId, snapshotVersion);
DriftDefinitionTemplateCriteria templateCriteria = new DriftDefinitionTemplateCriteria();
@@ -135,9 +137,18 @@ public class DriftTemplateManagerBean implements DriftTemplateManagerLocal, Drif
criteria.addFilterTemplateId(templateId);
criteria.fetchConfiguration(true);
criteria.fetchResource(true);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- PageList<DriftDefinition> definitions = driftMgr.findDriftDefinitionsByCriteria(subject, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<DriftDefinition, DriftDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<DriftDefinition, DriftDefinitionCriteria>() {
+ @Override
+ public PageList<DriftDefinition> execute(DriftDefinitionCriteria criteria) {
+ return driftMgr.findDriftDefinitionsByCriteria(subject, criteria);
+ }
+ };
+
+ CriteriaQuery<DriftDefinition, DriftDefinitionCriteria> definitions = new CriteriaQuery<DriftDefinition, DriftDefinitionCriteria>(
+ criteria, queryExecutor);
+
for (DriftDefinition def : definitions) {
if (def.isAttached()) {
int resourceId = def.getResource().getId();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
index 72eb3e4..239cf35 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
@@ -82,6 +82,8 @@ import org.rhq.enterprise.server.agentclient.AgentClient;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.plugin.pc.drift.DriftChangeSetSummary;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -178,15 +180,24 @@ public class JPADriftServerBean implements JPADriftServerLocal {
}
@Override
- public PageList<DriftComposite> findDriftCompositesByCriteria(Subject subject, DriftCriteria criteria) {
+ public PageList<DriftComposite> findDriftCompositesByCriteria(final Subject subject, DriftCriteria criteria) {
JPADriftCriteria jpaCriteria = (criteria instanceof JPADriftCriteria) ? (JPADriftCriteria) criteria
: new JPADriftCriteria(criteria);
jpaCriteria.fetchChangeSet(true);
- jpaCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- PageList<JPADrift> drifts = findDriftsByCriteria(subject, jpaCriteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<JPADrift, JPADriftCriteria> queryExecutor = new CriteriaQueryExecutor<JPADrift, JPADriftCriteria>() {
+ @Override
+ public PageList<JPADrift> execute(JPADriftCriteria jpaCriteria) {
+ return findDriftsByCriteria(subject, jpaCriteria);
+ }
+ };
+
+ CriteriaQuery<JPADrift, JPADriftCriteria> drifts = new CriteriaQuery<JPADrift, JPADriftCriteria>(jpaCriteria,
+ queryExecutor);
+
PageList<DriftComposite> result = new PageList<DriftComposite>();
for (JPADrift drift : drifts) {
JPADriftChangeSet changeSet = drift.getChangeSet();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
index a7bd5c3..e114171 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
@@ -50,6 +50,8 @@ import org.rhq.core.domain.resource.composite.PlatformMetricsSummary.SwapMetric;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.collection.ArrayUtils;
import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* @author jsanda
@@ -70,24 +72,42 @@ public class PlatformUtilizationManagerBean implements PlatformUtilizationManage
private PlatformUtilizationManagerLocal platformUtilizationMgr;
@Override
- public PageList<PlatformMetricsSummary> loadPlatformMetrics(Subject subject) {
- ResourceTypeCriteria typeCriteria = new ResourceTypeCriteria();
+ public PageList<PlatformMetricsSummary> loadPlatformMetrics(final Subject subject) {
+ final ResourceTypeCriteria typeCriteria = new ResourceTypeCriteria();
typeCriteria.addFilterCategory(PLATFORM);
typeCriteria.fetchMetricDefinitions(true);
- typeCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- PageList<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subject, typeCriteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria> queryExecutor = new CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria>() {
+ @Override
+ public PageList<ResourceType> execute(ResourceTypeCriteria criteria) {
+ return resourceTypeMgr.findResourceTypesByCriteria(subject, typeCriteria);
+ }
+ };
+
+ CriteriaQuery<ResourceType, ResourceTypeCriteria> resourceTypes = new CriteriaQuery<ResourceType, ResourceTypeCriteria>(
+ typeCriteria, queryExecutor);
+
Map<Integer, Set<Integer>> platformMetricDefs = new HashMap<Integer, Set<Integer>>();
for (ResourceType resourceType : resourceTypes) {
platformMetricDefs.put(resourceType.getId(), getPlatformMetricDefIds(resourceType));
}
- ResourceCriteria resourceCriteria = new ResourceCriteria();
+ final ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterResourceCategories(PLATFORM);
resourceCriteria.addFilterInventoryStatus(COMMITTED);
- resourceCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- PageList<Resource> platforms = resourceMgr.findResourcesByCriteria(subject, resourceCriteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> resourceQueryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceMgr.findResourcesByCriteria(subject, resourceCriteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> platforms = new CriteriaQuery<Resource, ResourceCriteria>(
+ resourceCriteria, resourceQueryExecutor);
+
PageList<PlatformMetricsSummary> summaries = new PageList<PlatformMetricsSummary>();
for (Resource platform : platforms) {
commit 05224b4bd31adfec2a24a4892a90f104a5bce779
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 03:19:51 2013 -0500
i)remove incorrect page clearing on CliComponent
ii)update more usages of criteria to also use CriteriaQuery.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
index b9ca613..9fd49a7 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
@@ -25,7 +25,6 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URI;
import java.nio.charset.Charset;
-import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -36,8 +35,11 @@ import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
import org.rhq.core.domain.criteria.PackageCriteria;
import org.rhq.core.domain.criteria.RepoCriteria;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.content.ContentManagerRemote;
import org.rhq.enterprise.server.content.RepoManagerRemote;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* The implementation of script source provider that is able to locate the script files
@@ -86,30 +88,45 @@ public class RepoScriptSourceProvider extends BaseRhqSchemeScriptSourceProvider
String scriptName = path.substring(slashIdx + 1);
try {
- RepoManagerRemote repoManager = rhqFacade.getProxy(RepoManagerRemote.class);
+ final RepoManagerRemote repoManager = rhqFacade.getProxy(RepoManagerRemote.class);
- RepoCriteria repoCrit = new RepoCriteria();
+ final RepoCriteria repoCrit = new RepoCriteria();
repoCrit.addFilterName(repoName);
- repoCrit.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<Repo> repos = repoManager.findReposByCriteria(rhqFacade.getSubject(), repoCrit);
- if (repos.isEmpty()) {
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Repo, RepoCriteria> queryExecutor = new CriteriaQueryExecutor<Repo, RepoCriteria>() {
+ @Override
+ public PageList<Repo> execute(RepoCriteria criteria) {
+ return repoManager.findReposByCriteria(rhqFacade.getSubject(), repoCrit);
+ }
+ };
+
+ CriteriaQuery<Repo, RepoCriteria> repos = new CriteriaQuery<Repo, RepoCriteria>(repoCrit, queryExecutor);
+
+ if (!repos.iterator().hasNext()) {
return null;
}
- ContentManagerRemote contentManager = rhqFacade.getProxy(ContentManagerRemote.class);
+ final ContentManagerRemote contentManager = rhqFacade.getProxy(ContentManagerRemote.class);
for (Repo repo : repos) {
- PackageCriteria pCrit = new PackageCriteria();
+ final PackageCriteria pCrit = new PackageCriteria();
pCrit.addFilterName(scriptName);
pCrit.addFilterRepoId(repo.getId());
- pCrit.clearPaging();//disable paging as the code assumes all the results will be returned.
- List<PackageAndLatestVersionComposite> pvs = contentManager.findPackagesWithLatestVersion(
- rhqFacade.getSubject(), pCrit);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<PackageAndLatestVersionComposite, PackageCriteria> pQueryExecutor = new CriteriaQueryExecutor<PackageAndLatestVersionComposite, PackageCriteria>() {
+ @Override
+ public PageList<PackageAndLatestVersionComposite> execute(PackageCriteria criteria) {
+ return contentManager.findPackagesWithLatestVersion(rhqFacade.getSubject(), pCrit);
+ }
+ };
+
+ CriteriaQuery<PackageAndLatestVersionComposite, PackageCriteria> pvs = new CriteriaQuery<PackageAndLatestVersionComposite, PackageCriteria>(
+ pCrit, pQueryExecutor);
- if (!pvs.isEmpty()) {
- PackageAndLatestVersionComposite pv = pvs.get(0);
+ if (!pvs.iterator().hasNext()) {
+ PackageAndLatestVersionComposite pv = pvs.iterator().next();
byte[] bytes = repoManager.getPackageVersionBytes(rhqFacade.getSubject(), repo.getId(), pv
.getLatestPackageVersion().getId());
diff --git a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
index 2c1f874..d73b42e 100644
--- a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
+++ b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
@@ -304,7 +304,6 @@ public class CliComponent implements ServerPluginComponent, ControlFacet {
String packageId = cliNotification.getConfiguration().getSimpleValue(CliSender.PROP_PACKAGE_ID, null);
if (packageId != null) {
crit.addFilterPackageId(Integer.valueOf(packageId));
- crit.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<PackageVersion> res = contentManager.findPackageVersionsByCriteria(overlord, crit);
count = res.getTotalSize();
diff --git a/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServer.java b/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServer.java
index 9d25a30..f80b111 100644
--- a/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServer.java
+++ b/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServer.java
@@ -84,6 +84,8 @@ import org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSet
import org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry;
import org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBFile;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
public class MongoDBDriftServer implements DriftServerPluginFacet, ServerPluginComponent {
@@ -397,12 +399,21 @@ public class MongoDBDriftServer implements DriftServerPluginFacet, ServerPluginC
return new String(StreamUtil.slurp(file.getInputStream()));
}
- Map<Integer, Resource> loadResourceMap(Subject subject, Integer[] resourceIds) {
+ Map<Integer, Resource> loadResourceMap(final Subject subject, Integer[] resourceIds) {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterIds(resourceIds);
- ResourceManagerLocal resourceMgr = getResourceManager();
- PageList<Resource> resources = resourceMgr.findResourcesByCriteria(subject, criteria);
+ final ResourceManagerLocal resourceMgr = getResourceManager();
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceMgr.findResourcesByCriteria(subject, criteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> resources = new CriteriaQuery<Resource, ResourceCriteria>(criteria,
+ queryExecutor);
Map<Integer, Resource> map = new HashMap<Integer, Resource>();
for (Resource r : resources) {
commit 2100a34c6176ea5f11eab5fc09e68b87bb6e8a1d
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 02:29:32 2013 -0500
Update unbounded criteria usage to instead use CriteriaQuery to iterate through result sets.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index e2738ee..773176b 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -74,6 +74,8 @@ import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerRemote;
import org.rhq.enterprise.server.operation.OperationManagerRemote;
import org.rhq.enterprise.server.resource.ResourceManagerRemote;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Implements a local object that exposes resource related data as
@@ -235,9 +237,18 @@ public class ResourceClientProxy {
private void initChildren() {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterParentResourceId(resourceId);
- criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
- PageList<Resource> childResources = remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
- remoteClient.getSubject(), criteria);
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
+ remoteClient.getSubject(), criteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> childResources = new CriteriaQuery<Resource, ResourceCriteria>(
+ criteria, queryExecutor);
for (Resource child : childResources) {
this.children.add(proxyFactory.getResource(child.getId()));
@@ -247,14 +258,26 @@ public class ResourceClientProxy {
private void initMeasurements() {
MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
criteria.addFilterResourceTypeId(resource.getResourceType().getId());
-// criteria.addFilterResourceTypeName(resource.getResourceType().getName());
-// criteria.setStrict(true);
+ // criteria.addFilterResourceTypeName(resource.getResourceType().getName());
+ // criteria.setStrict(true);
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria> queryExecutor = new CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria>() {
+ @Override
+ public PageList<MeasurementDefinition> execute(MeasurementDefinitionCriteria criteria) {
+ return remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
+ .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
+ }
+ };
+
+ CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria> measurementDefIterator = new CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria>(
+ criteria, queryExecutor);
- this.measurementDefinitions = remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
- .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
+ this.measurementDefinitions = new PageList<MeasurementDefinition>();
this.measurementMap = new HashMap<String, Measurement>();
- for (MeasurementDefinition def : measurementDefinitions) {
+ for (MeasurementDefinition def : measurementDefIterator) {
+ this.measurementDefinitions.add(def);
Measurement m = new Measurement(def);
String name = def.getDisplayName().replaceAll("\\W", "");
commit 53f0e721c12eac53044893bb0cd6778791a80b29
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 01:06:44 2013 -0500
i)Fixes nasty bug with CriteriaQuery that cause iteration to fail after two pages
ii)Added new unit test for regression testing of the fix.
iii)Added basic javadoc for CriteriaQuery.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
index be5b5a3..0a4509d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
@@ -27,10 +27,26 @@ import org.rhq.core.domain.criteria.BaseCriteria;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+/** This class provides a way to make PageList results easily iterable for 'for each' loops
+ * and importantly automatically handles iteration through all PageControl results. This
+ * means that with a CriteriaQuery instance once can do:
+ *
+ * for (Resource entity : query) {
+ *
+ * and automatically page through the results in PageControl.getPageSize(def. 200) chunks.
+ *
+ * @author John Sanda
+ * @author Simeon Pinder
+ *
+ * @param <T> The return type included by the PageList.
+ * @param <C> The Criteria subclass used to generate/execute the query.
+ */
public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
+ //Criteria instance used by Executor to page through results
private C criteria;
+ //Executor
private CriteriaQueryExecutor<T, C> queryExecutor;
public CriteriaQuery(C criteria, CriteriaQueryExecutor<T, C> queryExecutor) {
@@ -38,6 +54,10 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
this.queryExecutor = queryExecutor;
}
+ /** Returns iterator for a single page of results as defined by
+ * i)the Criteria instance
+ * ii)the paging details applied to the Criteria instance
+ */
@Override
public Iterator<T> iterator() {
return new QueryResultsIterator(executeQuery());
@@ -47,6 +67,11 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
return queryExecutor.execute(criteria);
}
+ //Defines the iterator that:
+ // i)creates page sized chunks results
+ // ii)at the end of each pageList, moves the iterator to next page and continues iteration
+ //
+ //NOTE: Assumes criteria page iteration starts with page 0. If that is not the case
private class QueryResultsIterator implements Iterator<T> {
private int count;
@@ -54,6 +79,9 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
private Iterator<T> iterator;
+ /**The first pageList returned by the criteria instance is where iteration begins.
+ * @param firstPage
+ */
public QueryResultsIterator(PageList<T> firstPage) {
currentPage = firstPage;
iterator = currentPage.iterator();
@@ -66,6 +94,7 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
@Override
public T next() {
+ //define logic for the end of a pagelist to move the iterator onto next page
if (!iterator.hasNext()) {
if (count == currentPage.getTotalSize()) {
throw new NoSuchElementException();
@@ -73,7 +102,9 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
PageControl pc = currentPage.getPageControl();
criteria.setPaging(pc.getPageNumber() + 1, pc.getPageSize());
+ //move the current pagelist forward one
currentPage = queryExecutor.execute(criteria);
+ currentPage.setPageControl(new PageControl(pc.getPageNumber() + 1, pc.getPageSize()));
iterator = currentPage.iterator();
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
index cdccd6c..5d64970 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
@@ -57,12 +57,16 @@ public class CriteriaQueryTest {
private static class FakeCriteriaQueryExecutor implements CriteriaQueryExecutor<FakeEntity, FakeEntityCriteria> {
+ //list of pagelists
private List<PageList<FakeEntity>> pages = new ArrayList<PageList<FakeEntity>>();
+ //total size
private int totalSize;
+ // the pageControl instance to use
private PageControl pc;
+ //
public FakeCriteriaQueryExecutor(int totalSize, PageControl pc) {
this.totalSize = totalSize;
this.pc = pc;
@@ -122,4 +126,60 @@ public class CriteriaQueryTest {
assertEquals(actual, expected);
}
+ /** This is like executeQueryThatReturnsMultiplePagesOfResults(), creates more
+ * that two pages of ordered entries and iterates over them. This is to test
+ * a nasty bug in CriteriaQuery where results beyond the first two pages were
+ * not being parsed.
+ */
+ @Test
+ public void executeQueryThatReturnsTotalPagesOfResults() {
+ //create page control to browse entries 100 at a time and start at page 0
+ int pageSize = 100;
+ PageControl pc = new PageControl(0, pageSize);
+
+ //Total size of result set is 500.
+ int totalSize = 500;
+
+ //Create list and populate with all entries.
+ List<FakeEntity> total = new ArrayList<FakeEntity>();
+ for (int i = 0; i < totalSize; i++) {
+ total.add(new FakeEntity(i));
+ }
+
+ //build executor to parse a given list with using PageControl passed in
+ FakeCriteriaQueryExecutor queryExecutor = new FakeCriteriaQueryExecutor(totalSize, pc);
+
+ //add pages of results to simulate PageList results as returned by db queries
+ //todo: spinder, modify to support fractional results below and add last page.
+ int bucketCount = totalSize / pageSize;//number of full pages to list
+ int start = 0;
+ int end = pageSize;
+ //add bucketCount pages of data to read from.
+ for (int i = 0; i < bucketCount; i++) {
+ //Ex. first two pages (0, 100), (100,200), etc.
+ queryExecutor.addPage(total.subList(start, end));
+ start += pageSize;
+ end += pageSize;
+ }
+
+ //build criteria and attach pageControl
+ FakeEntityCriteria criteria = new FakeEntityCriteria();
+ //DO NOT use criteria.setPageControl(pc) here as it causes ignore of pageNumber/pageSize
+ criteria.setPaging(pc.getPageNumber(), pc.getPageSize());
+
+ //?? So which pageControl has the right details? Criteria.pageControl? OR PageControl passed into the QueryExecutor.
+
+ //Start off the initial query to page through the items in chunks defined by the pageControl instance
+ CriteriaQuery<FakeEntity, FakeEntityCriteria> query = new CriteriaQuery<FakeEntity, FakeEntityCriteria>(
+ criteria, queryExecutor);
+
+ //Now iterate over the list and make sure that iteration happens in order as expected
+ //monotonically increasing.
+ int last = -1;
+ for (FakeEntity entity : query) {
+ //this fails with earlier bug in CriteriaQuery
+ assertEquals(true, (last < entity.getId()));
+ last = entity.getId();
+ }
+ }
}
commit a782494672c097804bedbee316bd42a75f033975
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 16:43:11 2013 -0500
Update default criteria usages for i)ScriptUtil and
ii)for ContentManagerBean.findPackagesWithLatestVersion usages as is a criteria search but does not
include 'Criteria' in the method name as all the other criteria methods.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
index 607263a..b9ca613 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
@@ -103,6 +103,7 @@ public class RepoScriptSourceProvider extends BaseRhqSchemeScriptSourceProvider
PackageCriteria pCrit = new PackageCriteria();
pCrit.addFilterName(scriptName);
pCrit.addFilterRepoId(repo.getId());
+ pCrit.clearPaging();//disable paging as the code assumes all the results will be returned.
List<PackageAndLatestVersionComposite> pvs = contentManager.findPackagesWithLatestVersion(
rhqFacade.getSubject(), pCrit);
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
index bd121e7..6b86b61 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
@@ -79,6 +79,8 @@ public class ScriptUtil {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterName(string);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
return resourceManager.findResourcesByCriteria(getSubjectFromEngine(), criteria);
}
commit b5983f41c53750286601a16e2fca0eb17d31366e
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 16:34:28 2013 -0500
Update default criteria usages for ConfigurationMangerBean.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 50e5fd4..141b910 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -89,7 +89,6 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceError;
import org.rhq.core.domain.resource.ResourceErrorType;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
@@ -2576,6 +2575,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
if (tt == PropertyOptionsSource.TargetType.RESOURCE || tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
List<Resource> resources = null;
ResourceCriteria criteria = new ResourceCriteria();
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
// split out expression part for target=configuration
@@ -2631,6 +2631,7 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
// for groups we need to talk to the group manager
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.setSearchExpression(expression);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
resourceGroupManager.findResourceGroupCompositesByCriteria(subject, criteria);
}
commit 4655782edfffe9706abe97948002d35b71d5d624
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 16:29:06 2013 -0500
Update more default criteria usages by SubjectManager bean and for Bundles as that logic already assumes as much.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
index c9002ba..efe86fb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
@@ -216,6 +216,8 @@ public class SubjectManagerBean implements SubjectManagerLocal, SubjectManagerRe
if (newLdapRoles != null) {
RoleCriteria subjectLdapRolesCriteria = new RoleCriteria();
subjectLdapRolesCriteria.addFilterLdapSubjectId(subjectToModify.getId());
+ subjectLdapRolesCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<Role> currentLdapRoles = roleManager.findRolesByCriteria(whoami, subjectLdapRolesCriteria);
ldapRolesModified = !(currentLdapRoles.containsAll(newLdapRoles) && newLdapRoles
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index a6302de..4fabe9a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -376,6 +376,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
criteria.addFilterDestinationId(bundleDestination.getId());
criteria.addFilterIsLive(true);
criteria.fetchBundleVersion(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<BundleDeployment> liveDeployments = bundleManager.findBundleDeploymentsByCriteria(subject, criteria);
BundleDeployment liveDeployment = (liveDeployments.isEmpty()) ? null : liveDeployments.get(0);
@@ -450,6 +452,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
BundleCriteria criteria = new BundleCriteria();
criteria.addFilterBundleTypeId(Integer.valueOf(bundleTypeId));
criteria.addFilterName(bundleName);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<Bundle> bundles = findBundlesByCriteria(subject, criteria);
Bundle bundle;
if (bundles.getTotalSize() == 0) {
@@ -630,6 +634,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
criteria.setStrict(true);
criteria.addFilterBundleTypeId(bundleType.getId());
criteria.addFilterName(bundleName);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<Bundle> bundles = bundleManager.findBundlesByCriteria(subject, criteria);
Bundle bundle;
if (bundles.getTotalSize() == 0) {
@@ -699,6 +705,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
BundleFileCriteria bfCriteria = new BundleFileCriteria();
bfCriteria.addFilterBundleVersionId(bundleVersion.getId());
bfCriteria.fetchPackageVersion(true);
+ bfCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<BundleFile> bfs = bundleManager.findBundleFilesByCriteria(subjectManager.getOverlord(),
bfCriteria);
bundleFiles.clear();
@@ -1477,6 +1485,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
Bundle bundle = version.getBundle();
BundleDestinationCriteria destinationCriteria = new BundleDestinationCriteria();
destinationCriteria.addFilterBundleId(bundle.getId());
+ destinationCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<BundleDestination> destinations = findBundleDestinationsByCriteria(subject,destinationCriteria);
List<BundleDeployment> resultingDeployments = new ArrayList<BundleDeployment>(version.getBundleDeployments().size());
// We now have visible destinations - go over the resultingDeployments and only include the ones with vis. destinations
@@ -1534,6 +1544,8 @@ public class BundleManagerBean implements BundleManagerLocal, BundleManagerRemot
for (Bundle bundle : bundles.getValues()) { // TODO clone the bundle and return the modified clones
BundleDestinationCriteria destinationCriteria = new BundleDestinationCriteria();
destinationCriteria.addFilterBundleId(bundle.getId());
+ destinationCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<BundleDestination> destinations = findBundleDestinationsByCriteria(subject,destinationCriteria);
bundle.setDestinations(destinations);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
index 65a1209..0ca5b82 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
@@ -71,6 +71,8 @@ public class BundleServerServiceImpl implements BundleServerService {
bfc.addFilterBundleVersionId(bundleVersionId);
bfc.fetchPackageVersion(true);
+ bfc.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<BundleFile> bundleFiles = bm.findBundleFilesByCriteria(subject, bfc);
List<PackageVersion> packageVersions = new ArrayList<PackageVersion>(bundleFiles.size());
PackageVersion packageVersion = null;
commit 12dca890e6f2d53405a3f440f214d4020a315982
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 12:46:40 2013 -0500
i)Update several more instances of default criteria where logic assumed all results returned.
ii)small cosmetic fix in rest description.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index c75246f..a957d00 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -1593,7 +1593,9 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
throw new IllegalArgumentException("The criteria query has to have a filter for a specific repo.");
}
- criteria.fetchVersions(true);
+ criteria.fetchVersions(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<Package> packages = findPackagesByCriteria(subject, criteria);
PageList<PackageAndLatestVersionComposite> ret = new PageList<PackageAndLatestVersionComposite>(packages.getTotalSize(), packages.getPageControl());
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
index 775a1e8..e6bdf1b 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
@@ -749,6 +749,8 @@ public class ContentSourceManagerBean implements ContentSourceManagerLocal {
RepoCriteria reposForContentSource = new RepoCriteria();
reposForContentSource.addFilterContentSourceIds(contentSourceId);
reposForContentSource.addFilterCandidate(false); // Don't sync distributions for candidates
+ reposForContentSource.clearPaging();//disable paging as the code assumes all the results will be returned.
+
Subject overlord = LookupUtil.getSubjectManager().getOverlord();
List<Repo> repos = repoManager.findReposByCriteria(overlord, reposForContentSource);
log.debug("downloadDistributionBits found " + repos.size() + " repos associated with this contentSourceId "
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
index c8234bb..64dde49 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
@@ -582,6 +582,7 @@ public class RepoManagerBean implements RepoManagerLocal, RepoManagerRemote {
RepoCriteria candidateReposCriteria = new RepoCriteria();
candidateReposCriteria.addFilterContentSourceIds(contentSourceId);
candidateReposCriteria.addFilterCandidate(true);
+ candidateReposCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<Repo> candidatesForThisProvider = findReposByCriteria(subject, candidateReposCriteria);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
index f9143ce..ebaf451 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
@@ -54,7 +54,6 @@ import com.wordnik.swagger.annotations.ApiParam;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.resteasy.annotations.Form;
import org.jboss.resteasy.annotations.GZIP;
import org.jboss.resteasy.annotations.cache.Cache;
@@ -115,6 +114,8 @@ public class GroupHandlerBean extends AbstractRestBean {
if (q!=null) {
criteria.addFilterName(q);
}
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<ResourceGroup> groups = resourceGroupManager.findResourceGroupsByCriteria(caller, criteria);
List<GroupRest> list = new ArrayList<GroupRest>(groups.size());
@@ -372,6 +373,8 @@ public class GroupHandlerBean extends AbstractRestBean {
if (q!=null) {
criteria.addFilterName(q);
}
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<GroupDefinition> gdlist = definitionManager.findGroupDefinitionsByCriteria(caller, criteria);
List<GroupDefinitionRest> list = new ArrayList<GroupDefinitionRest>(gdlist.getTotalSize());
for (GroupDefinition def: gdlist) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
index 92287d5..fbf81fb 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
@@ -343,6 +343,7 @@ public class OperationsHandlerBean extends AbstractRestBean {
ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
JobId jobId = new JobId(jobName);
criteria.addFilterJobId(jobId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
ResourceOperationHistory history ;//= opsManager.getOperationHistoryByJobId(caller,jobName);
List<ResourceOperationHistory> list = opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
@@ -386,6 +387,7 @@ public class OperationsHandlerBean extends AbstractRestBean {
criteria.addFilterResourceIds(resourceId);
criteria.addSortEndTime(PageOrdering.DESC);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
List<ResourceOperationHistory> list = opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
@@ -413,6 +415,8 @@ public class OperationsHandlerBean extends AbstractRestBean {
ResourceOperationHistoryCriteria criteria = new ResourceOperationHistoryCriteria();
criteria.addFilterJobId(new JobId(jobName));
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<ResourceOperationHistory> list = opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
if ((list != null && !list.isEmpty())) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
index 8142f17..b748833 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
@@ -88,7 +88,12 @@ import org.rhq.enterprise.server.measurement.AvailabilityManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
import org.rhq.enterprise.server.resource.ResourceAlreadyExistsException;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
-import org.rhq.enterprise.server.rest.domain.*;
+import org.rhq.enterprise.server.rest.domain.AvailabilityRest;
+import org.rhq.enterprise.server.rest.domain.Link;
+import org.rhq.enterprise.server.rest.domain.MetricSchedule;
+import org.rhq.enterprise.server.rest.domain.ResourceWithChildren;
+import org.rhq.enterprise.server.rest.domain.ResourceWithType;
+import org.rhq.enterprise.server.rest.domain.StringValue;
/**
* Class that deals with getting data about resources
@@ -324,6 +329,8 @@ public class ResourceHandlerBean extends AbstractRestBean {
criteria.addFilterInterval(start,end);
criteria.addFilterResourceId(resourceId);
criteria.addSortStartTime(PageOrdering.DESC);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<Availability> points = availMgr.findAvailabilityByCriteria(caller,criteria);
List<AvailabilityRest> ret = new ArrayList<AvailabilityRest>(points.size());
for (Availability avail : points) {
@@ -517,6 +524,8 @@ public class ResourceHandlerBean extends AbstractRestBean {
public List<Link> getAlertsForResource(@ApiParam("Id of the resource to query") @PathParam("id") int resourceId) {
AlertCriteria criteria = new AlertCriteria();
criteria.addFilterResourceIds(resourceId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<Alert> alerts = alertManager.findAlertsByCriteria(caller, criteria);
List<Link> links = new ArrayList<Link>(alerts.size());
for (Alert al : alerts) {
@@ -638,9 +647,9 @@ public class ResourceHandlerBean extends AbstractRestBean {
@POST
@Path("/")
- @ApiOperation("Create a new resource as a child of an existing resource¡")
+ @ApiOperation("Create a new resource as a child of an existing resource<A1>")
public Response createResource(
- @ApiParam("THe info about the resource. You need to supply resource name, resource type name, plugin name, id of the parent") ResourceWithType resource,
+ @ApiParam("The info about the resource. You need to supply resource name, resource type name, plugin name, id of the parent") ResourceWithType resource,
@Context UriInfo uriInfo)
{
return createResourceInternal(resource.getResourceName(),resource.getPluginName(),resource.getParentId(),resource.getTypeName(),uriInfo);
commit 5b4db0d3246d9e43da722d4dd6a679481e17023a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 10:29:58 2013 -0500
Update some more default criteria usages to disable paging where logic already assumes it.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
index b59ca8b..134dedf 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
@@ -140,6 +140,8 @@ public class RoleManagerBean implements RoleManagerLocal, RoleManagerRemote {
// Make sure there's not an existing role with the same name.
RoleCriteria criteria = new RoleCriteria();
criteria.addFilterName(newRole.getName());
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<Role> roles = findRolesByCriteria(whoami, criteria);
if (!roles.isEmpty()) {
throw new EntityExistsException("A user role [" + newRole.getName() + "] already exists.");
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index d5d7128..63cb44d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@ -1080,6 +1080,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterPluginName(plugin);
criteria.addFilterName(name);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<ResourceType> result = resourceTypeManager.findResourceTypesByCriteria(
subjectManager.getOverlord(), criteria);
@@ -1266,6 +1268,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterParentResourceId(parentResource.getId());
resourceCriteria.addFilterResourceTypeId(resourceType.getId());
+ resourceCriteria.clearPaging();//Doc: disable paging as the code assumes all the results will be returned.
+
PageList<Resource> childResourcesOfType = resourceManager.findResourcesByCriteria(
subjectManager.getOverlord(), resourceCriteria);
if (childResourcesOfType.size() >= 1) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java
index c159275..9f7fc00 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java
@@ -1,10 +1,6 @@
package org.rhq.enterprise.server.inventory;
-import java.util.HashSet;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -14,9 +10,7 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
-import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
-import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
@@ -78,6 +72,7 @@ public class InventoryManagerBean implements InventoryManagerLocal {
public List<ResourceType> getDeletedTypes() {
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterDeleted(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
return resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), criteria);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
index bfc2164..1629926 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
@@ -606,6 +606,7 @@ public class SearchAssistManager {
criteria.setCaseSensitive(false);
criteria.addSortName(PageOrdering.ASC);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
List<SavedSearch> savedSearchResults = savedSearchManager.findSavedSearchesByCriteria(subject, criteria);
@@ -636,6 +637,7 @@ public class SearchAssistManager {
criteria.setCaseSensitive(false);
criteria.addSortName(PageOrdering.ASC);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
List<SavedSearch> savedSearchResults = savedSearchManager.findSavedSearchesByCriteria(subject, criteria);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
index a7e05a2..944f799 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
@@ -84,6 +84,8 @@ public class TagManagerBean implements TagManagerLocal, TagManagerRemote {
criteria.addFilterSemantic(tag.getSemantic());
criteria.addFilterName(tag.getName());
criteria.setStrict(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<Tag> found = findTagsByCriteria(subject, criteria);
if (!found.isEmpty()) {
assert found.size() == 1; // should never be more than one
commit 9b0f4a401362baed1e1a0b0d171195403b31a554
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 09:36:09 2013 -0500
Update criteria usage by job to explicitly return all the results and not the default.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
index 574dea2..08a4775 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
@@ -117,6 +117,8 @@ public class ContentProviderSyncJob implements StatefulJob {
RepoCriteria repoCriteria = new RepoCriteria();
repoCriteria.addFilterContentSourceIds(contentSource.getId());
repoCriteria.addFilterCandidate(false);
+ repoCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
PageList<Repo> repos = repoManager.findReposByCriteria(overlord, repoCriteria);
Integer[] repoIds = new Integer[repos.size()];
commit 122db27657ac9b66573c2695cd38de76b42045c6
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 09:19:56 2013 -0500
Update Resource type and metadata default usages of criteria to return all results as assumed by logic.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
index 0e4c2c9..a7bd5c3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
@@ -21,6 +21,11 @@
package org.rhq.enterprise.server.resource;
+import static java.util.Arrays.asList;
+import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
+import static org.rhq.core.domain.resource.InventoryStatus.COMMITTED;
+import static org.rhq.core.domain.resource.ResourceCategory.PLATFORM;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -39,18 +44,13 @@ import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.PlatformMetricsSummary;
+import org.rhq.core.domain.resource.composite.PlatformMetricsSummary.CPUMetric;
+import org.rhq.core.domain.resource.composite.PlatformMetricsSummary.MemoryMetric;
+import org.rhq.core.domain.resource.composite.PlatformMetricsSummary.SwapMetric;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.collection.ArrayUtils;
import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
-import static java.util.Arrays.asList;
-import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
-import static org.rhq.core.domain.resource.InventoryStatus.COMMITTED;
-import static org.rhq.core.domain.resource.ResourceCategory.PLATFORM;
-import static org.rhq.core.domain.resource.composite.PlatformMetricsSummary.CPUMetric;
-import static org.rhq.core.domain.resource.composite.PlatformMetricsSummary.MemoryMetric;
-import static org.rhq.core.domain.resource.composite.PlatformMetricsSummary.SwapMetric;
-
/**
* @author jsanda
*/
@@ -74,6 +74,7 @@ public class PlatformUtilizationManagerBean implements PlatformUtilizationManage
ResourceTypeCriteria typeCriteria = new ResourceTypeCriteria();
typeCriteria.addFilterCategory(PLATFORM);
typeCriteria.fetchMetricDefinitions(true);
+ typeCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<ResourceType> resourceTypes = resourceTypeMgr.findResourceTypesByCriteria(subject, typeCriteria);
Map<Integer, Set<Integer>> platformMetricDefs = new HashMap<Integer, Set<Integer>>();
@@ -84,6 +85,7 @@ public class PlatformUtilizationManagerBean implements PlatformUtilizationManage
ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterResourceCategories(PLATFORM);
resourceCriteria.addFilterInventoryStatus(COMMITTED);
+ resourceCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<Resource> platforms = resourceMgr.findResourcesByCriteria(subject, resourceCriteria);
PageList<PlatformMetricsSummary> summaries = new PageList<PlatformMetricsSummary>();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
index ad81fb1..a7f7433 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
@@ -717,6 +717,8 @@ public class ResourceFactoryManagerBean implements ResourceFactoryManagerLocal,
ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterParentResourceId(parentResource.getId());
resourceCriteria.addFilterResourceTypeId(resourceType.getId());
+ resourceCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<Resource> childResourcesOfType = resourceManager.findResourcesByCriteria(
subjectManager.getOverlord(), resourceCriteria);
if (childResourcesOfType.size() >= 1) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 0b06d92..205252d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -814,6 +814,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterParentResourceId(ancestor.getResource().getId());
criteria.addSortName(PageOrdering.ASC);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<Resource> children = findResourcesByCriteriaBounded(subject, criteria, 0, 0);
// Remove any that are in the lineage to avoid repeated handling.
children.removeAll(rawResourceLineage);
@@ -862,6 +864,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterIds(resourceIds);
resourceCriteria.fetchResourceType(true);
+ resourceCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<Resource> resources = findResourcesByCriteria(subject, resourceCriteria);
if (ResourceAncestryFormat.RAW == format) {
@@ -886,6 +890,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
ResourceTypeCriteria resourceTypeCriteria = new ResourceTypeCriteria();
resourceTypeCriteria.addFilterIds(typesSet.toArray(new Integer[typesSet.size()]));
+ resourceCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<ResourceType> types = typeManager.findResourceTypesByCriteria(subject, resourceTypeCriteria);
for (Resource resource : resources) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
index f93a935..d4f9bb9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
@@ -525,6 +525,8 @@ public class ResourceTypeManagerBean implements ResourceTypeManagerLocal, Resour
if (sawTopLevelServer) {
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterCategory(ResourceCategory.PLATFORM);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<ResourceType> platforms = findResourceTypesByCriteria(subject, criteria);
results.addAll(platforms);
}
@@ -539,6 +541,8 @@ public class ResourceTypeManagerBean implements ResourceTypeManagerLocal, Resour
if (first.getCategory() == ResourceCategory.PLATFORM) {
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<ResourceType> allResourceTypes = findResourceTypesByCriteria(subject, criteria);
List<ResourceType> results = new ArrayList<ResourceType>();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
index 25ea666..a52c4c2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
@@ -1,21 +1,20 @@
package org.rhq.enterprise.server.resource.metadata;
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertTemplateManagerLocal;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import java.util.List;
-
@Stateless
public class AlertMetadataManagerBean implements AlertMetadataManagerLocal {
@@ -33,6 +32,8 @@ public class AlertMetadataManagerBean implements AlertMetadataManagerLocal {
AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
criteria.addFilterAlertTemplateResourceTypeId(resourceType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<AlertDefinition> templates = alertDefinitionMgr.findAlertDefinitionsByCriteria(subject, criteria);
Integer[] templateIds = new Integer[templates.size()];
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
index 6fc58d6..cd54bf0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
@@ -239,6 +239,7 @@ public class ContentMetadataManagerBean implements ContentMetadataManagerLocal {
BundleCriteria criteria = new BundleCriteria();
criteria.addFilterBundleTypeId(bundleType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
List<Bundle> bundles = bundleMgr.findBundlesByCriteria(subject, criteria);
for (Bundle bundle : bundles) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
index 7b03d73..0ab7dee 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
@@ -216,6 +216,8 @@ public class MeasurementMetadataManagerBean implements MeasurementMetadataManage
MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<MeasurementDefinition> definitions = measurementDefinitionMgr.findMeasurementDefinitionsByCriteria(
subjectMgr.getOverlord(), criteria);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
index 841fe03..f833bc5 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
@@ -76,6 +76,8 @@ public class PluginConfigurationMetadataManagerBean implements PluginConfigurati
Subject overlord = subjectMgr.getOverlord();
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<Resource> resources = resourceMgr.findResourcesByCriteria(overlord, criteria);
for (Resource resource : resources) {
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
index f3c7158..6f0c9df 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
@@ -682,6 +682,8 @@ public class ResourceMetadataManagerBean implements ResourceMetadataManagerLocal
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
criteria.addFilterParentResourceTypeId(obsoleteParentType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
List<Resource> resources = resourceManager.findResourcesByCriteria(overlord, criteria);
for (Resource resource : resources) {
Resource newParent = null;
commit 91cd383c9b82499340009922e8ed6ba5db919760
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 08:51:30 2013 -0500
i)Update drift component criteria usage to use explicitly request resources as already assumed by the logic.
ii)Updated one or two spots to explicitly request single result pagesets where already assumed by logic.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index 35339cc..dcc08d8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -208,6 +208,7 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
DriftDefinitionCriteria driftDefCriteria = new DriftDefinitionCriteria();
driftDefCriteria.addFilterResourceIds(resourceId);
driftDefCriteria.addFilterName(driftDefName);
+ driftDefCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<DriftDefinition> defs = findDriftDefinitionsByCriteria(overlord, driftDefCriteria);
if (defs.isEmpty()) {
@@ -286,6 +287,7 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
criteria.setStrict(true);
criteria.fetchDrifts(true);
criteria.addSortVersion(PageOrdering.ASC);
+ criteria.setPageControl(PageControl.getUnlimitedInstance());//disable paging as the code assumes all the results will be returned.
PageList<? extends DriftChangeSet<?>> changeSets = findDriftChangeSetsByCriteria(subject, criteria);
for (DriftChangeSet<? extends Drift<?, ?>> changeSet : changeSets) {
@@ -303,6 +305,7 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
criteria.addFilterDriftDefinitionId(request.getDriftDefinitionId());
criteria.addFilterId(request.getTemplateChangeSetId());
criteria.fetchDrifts(true);
+ criteria.setPageControl(PageControl.getUnlimitedInstance());//disable paging as the code assumes all the results will be returned.
PageList<? extends DriftChangeSet<?>> changeSets = findDriftChangeSetsByCriteria(subject, criteria);
if (changeSets.isEmpty()) {
@@ -353,6 +356,8 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
criteria.addFilterName(driftDefName);
criteria.addFilterResourceIds(resourceId);
criteria.setStrict(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<DriftDefinition> results = driftManager.findDriftDefinitionsByCriteria(subject, criteria);
DriftDefinition doomedDriftDef = null;
if (results != null && results.size() == 1) {
@@ -503,6 +508,8 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
criteria.addFilterName(summary.getDriftDefinitionName());
criteria.addFilterResourceIds(resourceId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<DriftDefinition> definitions = findDriftDefinitionsByCriteria(subject, criteria);
if (definitions.isEmpty()) {
@@ -692,6 +699,8 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
GenericDriftCriteria criteria = new GenericDriftCriteria();
criteria.addFilterId(driftId1);
+ criteria.setPageControl(PageControl.getSingleRowInstance());
+
List<? extends Drift<?, ?>> result = driftServerPlugin.findDriftsByCriteria(subject, criteria);
if (result.size() != 1) {
throw new IllegalArgumentException("Drift record not found: " + driftId1);
@@ -699,6 +708,8 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
Drift drift1 = result.get(0);
criteria.addFilterId(driftId2);
+ criteria.setPageControl(PageControl.getSingleRowInstance());
+
result = driftServerPlugin.findDriftsByCriteria(subject, criteria);
if (result.size() != 1) {
throw new IllegalArgumentException("Drift record not found: " + driftId2);
@@ -889,6 +900,7 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
GenericDriftCriteria criteria = new GenericDriftCriteria();
criteria.addFilterId(driftId);
criteria.fetchChangeSet(true);
+ criteria.setPageControl(PageControl.getSingleRowInstance());
DriftDetails driftDetails = new DriftDetails();
DriftServerPluginFacet driftServerPlugin = getServerPlugin();
@@ -946,6 +958,7 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
criteria.addFilterResourceId(drift.getChangeSet().getResourceId());
criteria.addFilterDriftDefinitionId(drift.getChangeSet().getDriftDefinitionId());
criteria.addFilterVersion(Integer.toString(drift.getChangeSet().getVersion() - 1));
+ criteria.setPageControl(PageControl.getSingleRowInstance());
PageList<? extends DriftChangeSet<?>> results = findDriftChangeSetsByCriteria(subject, criteria);
// TODO handle empty results
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
index b206b54..3eb83e0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
@@ -80,6 +80,7 @@ public class DriftServerServiceImpl implements DriftServerService {
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
criteria.addFilterResourceIds(resourceIds.toArray(new Integer[resourceIds.size()]));
criteria.fetchConfiguration(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
Subject overlord = getSubjectManager().getOverlord();
PageList<DriftDefinition> definitions = getDriftManager().findDriftDefinitionsByCriteria(overlord, criteria);
@@ -119,6 +120,7 @@ public class DriftServerServiceImpl implements DriftServerService {
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
criteria.addFilterResourceIds(resourceId);
criteria.addFilterName(drfitDefName);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
DriftManagerLocal driftMgr = getDriftManager();
SubjectManagerLocal subjectMgr = getSubjectManager();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
index 5d149a1..72eb3e4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
@@ -184,6 +184,8 @@ public class JPADriftServerBean implements JPADriftServerLocal {
: new JPADriftCriteria(criteria);
jpaCriteria.fetchChangeSet(true);
+ jpaCriteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<JPADrift> drifts = findDriftsByCriteria(subject, jpaCriteria);
PageList<DriftComposite> result = new PageList<DriftComposite>();
for (JPADrift drift : drifts) {
commit 7fd0b56fcaa9a506ad409d52636a8dbf8b405e7b
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 17:21:14 2013 -0500
Update criteria usage to explicitly support all or one search resource where applicable as already expected by the code.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
index 528fd7a..39bda2c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
@@ -41,6 +41,7 @@ import org.rhq.core.domain.drift.DriftSnapshot;
import org.rhq.core.domain.drift.DriftSnapshotRequest;
import org.rhq.core.domain.drift.dto.DriftChangeSetDTO;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.authz.RequiredPermission;
@@ -125,6 +126,7 @@ public class DriftTemplateManagerBean implements DriftTemplateManagerLocal, Drif
DriftDefinitionTemplateCriteria templateCriteria = new DriftDefinitionTemplateCriteria();
templateCriteria.addFilterId(templateId);
templateCriteria.fetchDriftDefinitions(true);
+ templateCriteria.setPageControl(PageControl.getSingleRowInstance());
PageList<DriftDefinitionTemplate> templates = templateMgr.findTemplatesByCriteria(subject, templateCriteria);
DriftDefinitionTemplate template = templates.get(0);
@@ -133,6 +135,7 @@ public class DriftTemplateManagerBean implements DriftTemplateManagerLocal, Drif
criteria.addFilterTemplateId(templateId);
criteria.fetchConfiguration(true);
criteria.fetchResource(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<DriftDefinition> definitions = driftMgr.findDriftDefinitionsByCriteria(subject, criteria);
for (DriftDefinition def : definitions) {
commit f7e7b33e564c123750c5d40a7fbb4df2ab6e5a64
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 17:12:33 2013 -0500
Update measurementSchedule default criteria usage to support larger then default result sets.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerBean.java
index 934dcd1..9ca60bc 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerBean.java
@@ -461,6 +461,8 @@ public class MeasurementChartsManagerBean implements MeasurementChartsManagerLoc
criteria.addFilterAutoGroupResourceTypeId(context.resourceTypeId);
}
criteria.addFilterDefinitionIds(definitionId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
+
PageList<MeasurementSchedule> theSchedules = scheduleManager.findSchedulesByCriteria(subject, criteria);
int totalScheduleCount = theSchedules.getTotalSize();
commit b7c248012959381e365b1afca4a01a373ed12755
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 16:54:58 2013 -0500
update default criteria instances in the server side plugins as code already assumes as much.
diff --git a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
index d73b42e..2c1f874 100644
--- a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
+++ b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
@@ -304,6 +304,7 @@ public class CliComponent implements ServerPluginComponent, ControlFacet {
String packageId = cliNotification.getConfiguration().getSimpleValue(CliSender.PROP_PACKAGE_ID, null);
if (packageId != null) {
crit.addFilterPackageId(Integer.valueOf(packageId));
+ crit.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<PackageVersion> res = contentManager.findPackageVersionsByCriteria(overlord, crit);
count = res.getTotalSize();
diff --git a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
index 5eb9360..2d2cd63 100644
--- a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
+++ b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
@@ -397,6 +397,7 @@ public class CliSender extends AlertSender<CliComponent> {
RepoCriteria criteria = new RepoCriteria();
criteria.addFilterId(config.repoId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
List<Repo> repos = rm.findReposByCriteria(overlord, criteria);
commit b42ab9daa335de32779daf8d0563f5720afe9dca
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 16:36:42 2013 -0500
update some more usages of Criteria to return all results as code already assumes this.
diff --git a/modules/enterprise/gui/content_http-war/src/main/java/org/rhq/gui/content/ContentHTTPServlet.java b/modules/enterprise/gui/content_http-war/src/main/java/org/rhq/gui/content/ContentHTTPServlet.java
index cfcf1ec..9990bda 100644
--- a/modules/enterprise/gui/content_http-war/src/main/java/org/rhq/gui/content/ContentHTTPServlet.java
+++ b/modules/enterprise/gui/content_http-war/src/main/java/org/rhq/gui/content/ContentHTTPServlet.java
@@ -563,6 +563,7 @@ public class ContentHTTPServlet extends DefaultServlet {
criteria.addFilterFileName(fileName);
criteria.addFilterRepoId(repo.getId());
criteria.setStrict(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
log.debug("Created criteria for repoId = " + repo.getId() + ", fileName = " + fileName);
List<PackageVersion> pkgVers = contentMgr.findPackageVersionsByCriteria(LookupUtil.getSubjectManager()
.getOverlord(), criteria);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index 7abdd49..35339cc 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -222,6 +222,7 @@ public class DriftManagerBean implements DriftManagerLocal, DriftManagerRemote {
criteria.addFilterDriftDefinitionId(driftDef.getId());
criteria.addFilterVersion(Integer.toString(version));
criteria.fetchDrifts(true);
+ criteria.setPageControl(PageControl.getUnlimitedInstance());//disable paging as the code assumes all the results will be returned.
PageList<? extends DriftChangeSet<?>> changeSets = driftServerPlugin.findDriftChangeSetsByCriteria(overlord,
criteria);
commit 6f83ea4895cf4fe44e569d0fd837a4c78353c2b5
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 16:09:35 2013 -0500
Modify criteria to return all instances as logic assumes as much.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
index 2a1f944..607263a 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
@@ -90,6 +90,7 @@ public class RepoScriptSourceProvider extends BaseRhqSchemeScriptSourceProvider
RepoCriteria repoCrit = new RepoCriteria();
repoCrit.addFilterName(repoName);
+ repoCrit.clearPaging();//disable paging as the code assumes all the results will be returned.
List<Repo> repos = repoManager.findReposByCriteria(rhqFacade.getSubject(), repoCrit);
if (repos.isEmpty()) {
commit 0ffe7828cbd10a63142e1fa3b69b8bac05d61565
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 15:54:23 2013 -0500
modify ResourceClientProxy to now process all child resources.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index 7361fe8..e2738ee 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -235,6 +235,7 @@ public class ResourceClientProxy {
private void initChildren() {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterParentResourceId(resourceId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will be returned.
PageList<Resource> childResources = remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
remoteClient.getSubject(), criteria);
commit 9fcf54993de428e43db31366345ab6fd25dddb5a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 15:37:01 2013 -0500
Reverting " update ResourceClientProxy to handle larger metric definition results." as this approach is particularly problematic to implement when i)the same processed elements could be available in subsequent chunk queries and with ii)large deployments when parsing full list or resources can take long enough to span other transactions.
This reverts commit 42d955fc9e59c1ae0a1e69aead9c0d25fca60ba6.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index a9c272a..7361fe8 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -253,23 +253,14 @@ public class ResourceClientProxy {
.findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
this.measurementMap = new HashMap<String, Measurement>();
- //Chunk through the results in 200(default) page element batches to avoid excessive
- //memory usage for large deployments
- while (!measurementDefinitions.isEmpty()) {
- for (MeasurementDefinition def : measurementDefinitions) {
- Measurement m = new Measurement(def);
+ for (MeasurementDefinition def : measurementDefinitions) {
+ Measurement m = new Measurement(def);
- String name = def.getDisplayName().replaceAll("\\W", "");
- name = decapitalize(name);
+ String name = def.getDisplayName().replaceAll("\\W", "");
+ name = decapitalize(name);
- this.measurementMap.put(name, m);
- this.allProperties.put(name, m);
- }
- //process next batch if available with new criteria instance
- criteria = new MeasurementDefinitionCriteria();
- criteria.addFilterResourceTypeId(resource.getResourceType().getId());
- this.measurementDefinitions = remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
- .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
+ this.measurementMap.put(name, m);
+ this.allProperties.put(name, m);
}
}
commit 42d955fc9e59c1ae0a1e69aead9c0d25fca60ba6
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Fri Feb 1 09:25:14 2013 -0500
update ResourceClientProxy to handle larger metric definition results.
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index 7361fe8..a9c272a 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -253,14 +253,23 @@ public class ResourceClientProxy {
.findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
this.measurementMap = new HashMap<String, Measurement>();
- for (MeasurementDefinition def : measurementDefinitions) {
- Measurement m = new Measurement(def);
+ //Chunk through the results in 200(default) page element batches to avoid excessive
+ //memory usage for large deployments
+ while (!measurementDefinitions.isEmpty()) {
+ for (MeasurementDefinition def : measurementDefinitions) {
+ Measurement m = new Measurement(def);
- String name = def.getDisplayName().replaceAll("\\W", "");
- name = decapitalize(name);
+ String name = def.getDisplayName().replaceAll("\\W", "");
+ name = decapitalize(name);
- this.measurementMap.put(name, m);
- this.allProperties.put(name, m);
+ this.measurementMap.put(name, m);
+ this.allProperties.put(name, m);
+ }
+ //process next batch if available with new criteria instance
+ criteria = new MeasurementDefinitionCriteria();
+ criteria.addFilterResourceTypeId(resource.getResourceType().getId());
+ this.measurementDefinitions = remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
+ .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
}
}
11 years, 2 months
[rhq] Branch 'spinder/criteriaUsage' - 11 commits - code-coverage/pom.xml modules/cli-tests modules/common modules/core modules/enterprise modules/helpers modules/integration-tests modules/plugins modules/pom.xml modules/test-utils pom.xml
by Simeon Pinder
code-coverage/pom.xml | 2
dev/null |binary
modules/cli-tests/pom.xml | 2
modules/common/ant-bundle/pom.xml | 2
modules/common/drift/pom.xml | 2
modules/common/filetemplate-bundle/pom.xml | 2
modules/common/jboss-as-dmr-client/pom.xml | 2
modules/common/jboss-as/pom.xml | 2
modules/common/pom.xml | 2
modules/core/arquillian-integration/archive/pom.xml | 2
modules/core/arquillian-integration/container/pom.xml | 2
modules/core/arquillian-integration/pom.xml | 2
modules/core/arquillian-integration/suite-extension/pom.xml | 2
modules/core/client-api/pom.xml | 2
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java | 23 ++
modules/core/comm-api/pom.xml | 2
modules/core/dbutils/pom.xml | 4
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 23 ++
modules/core/domain/pom.xml | 2
modules/core/gui/pom.xml | 2
modules/core/native-system/pom.xml | 2
modules/core/plugin-api/pom.xml | 2
modules/core/plugin-container-itest/pom.xml | 2
modules/core/plugin-container/pom.xml | 2
modules/core/plugin-test-api/pom.xml | 2
modules/core/plugin-test-util/pom.xml | 2
modules/core/plugin-validator/pom.xml | 2
modules/core/plugindoc/pom.xml | 2
modules/core/pom.xml | 2
modules/core/util/pom.xml | 2
modules/enterprise/agent/pom.xml | 2
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java | 12 +
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java | 3
modules/enterprise/agentupdate/pom.xml | 2
modules/enterprise/binding/pom.xml | 22 ++
modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java | 10 -
modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java | 11 +
modules/enterprise/comm/pom.xml | 2
modules/enterprise/gui/content_http-war/pom.xml | 2
modules/enterprise/gui/coregui/pom.xml | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java | 78 ----------
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java | 3
modules/enterprise/gui/pom.xml | 2
modules/enterprise/gui/portal-war/pom.xml | 2
modules/enterprise/gui/rest-examples-war/pom.xml | 2
modules/enterprise/gui/rest-war/pom.xml | 2
modules/enterprise/pom.xml | 2
modules/enterprise/remoting/cli/pom.xml | 2
modules/enterprise/remoting/client-api/pom.xml | 2
modules/enterprise/remoting/client-deps/pom.xml | 2
modules/enterprise/remoting/pom.xml | 2
modules/enterprise/scripting/api/pom.xml | 4
modules/enterprise/scripting/javascript/pom.xml | 4
modules/enterprise/scripting/pom.xml | 4
modules/enterprise/scripting/python/pom.xml | 4
modules/enterprise/server/appserver/pom.xml | 2
modules/enterprise/server/client-api/pom.xml | 4
modules/enterprise/server/ear/pom.xml | 2
modules/enterprise/server/installer/pom.xml | 2
modules/enterprise/server/itests-2/pom.xml | 2
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java | 33 ----
modules/enterprise/server/jar/pom.xml | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java | 3
modules/enterprise/server/plugins/alert-cli/pom.xml | 4
modules/enterprise/server/plugins/alert-email/pom.xml | 4
modules/enterprise/server/plugins/alert-irc/pom.xml | 4
modules/enterprise/server/plugins/alert-log4j/pom.xml | 4
modules/enterprise/server/plugins/alert-microblog/pom.xml | 4
modules/enterprise/server/plugins/alert-mobicents/pom.xml | 4
modules/enterprise/server/plugins/alert-operations/pom.xml | 4
modules/enterprise/server/plugins/alert-roles/pom.xml | 4
modules/enterprise/server/plugins/alert-snmp/pom.xml | 4
modules/enterprise/server/plugins/alert-subject/pom.xml | 4
modules/enterprise/server/plugins/ant-bundle/pom.xml | 2
modules/enterprise/server/plugins/cobbler/pom.xml | 4
modules/enterprise/server/plugins/disk/pom.xml | 2
modules/enterprise/server/plugins/drift-rhq/pom.xml | 2
modules/enterprise/server/plugins/filetemplate-bundle/pom.xml | 2
modules/enterprise/server/plugins/jboss-software/pom.xml | 2
modules/enterprise/server/plugins/packagetype-cli/pom.xml | 4
modules/enterprise/server/plugins/pom.xml | 2
modules/enterprise/server/plugins/url/pom.xml | 2
modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml | 2
modules/enterprise/server/plugins/yum/pom.xml | 2
modules/enterprise/server/pom.xml | 2
modules/enterprise/server/safe-invoker/pom.xml | 2
modules/enterprise/server/sars/pom.xml | 2
modules/enterprise/server/sars/services-sar/pom.xml | 2
modules/enterprise/server/startup-subsystem/pom.xml | 2
modules/enterprise/server/xml-schemas/pom.xml | 2
modules/helpers/bundleGen/pom.xml | 4
modules/helpers/jeeGen/pom.xml | 2
modules/helpers/perftest-support/pom.xml | 4
modules/helpers/pom.xml | 2
modules/helpers/rest-docs-generator/pom.xml | 2
modules/helpers/rtfilter-subsystem/pom.xml | 2
modules/helpers/rtfilter/pom.xml | 2
modules/integration-tests/apache-plugin-test/pom.xml | 2
modules/integration-tests/jndi-access/jndi-access-test/pom.xml | 2
modules/integration-tests/jndi-access/pom.xml | 2
modules/integration-tests/jndi-access/remote-server/pom.xml | 2
modules/integration-tests/pom.xml | 2
modules/integration-tests/rest-api/pom.xml | 2
modules/plugins/aliases/pom.xml | 2
modules/plugins/ant-bundle/pom.xml | 2
modules/plugins/apache/pom.xml | 2
modules/plugins/augeas/pom.xml | 2
modules/plugins/byteman/pom.xml | 2
modules/plugins/cassandra/pom.xml | 2
modules/plugins/cobbler/pom.xml | 2
modules/plugins/cron/pom.xml | 2
modules/plugins/database/pom.xml | 2
modules/plugins/filetemplate-bundle/pom.xml | 2
modules/plugins/grub/pom.xml | 2
modules/plugins/hadoop/pom.xml | 2
modules/plugins/hibernate/pom.xml | 2
modules/plugins/hosts/pom.xml | 2
modules/plugins/hudson/pom.xml | 4
modules/plugins/iis/pom.xml | 2
modules/plugins/irc/pom.xml | 2
modules/plugins/jboss-as-5/pom.xml | 2
modules/plugins/jboss-as-7/pom.xml | 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java | 20 +-
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 5
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java | 20 +-
modules/plugins/jboss-as/pom.xml | 2
modules/plugins/jboss-cache-v3/pom.xml | 2
modules/plugins/jboss-cache/pom.xml | 2
modules/plugins/jmx/pom.xml | 2
modules/plugins/kickstart/pom.xml | 2
modules/plugins/mod-cluster/pom.xml | 2
modules/plugins/mysql/pom.xml | 2
modules/plugins/netservices/pom.xml | 2
modules/plugins/noop/pom.xml | 2
modules/plugins/oracle/pom.xml | 2
modules/plugins/pattern-generator/pom.xml | 2
modules/plugins/perftest/pom.xml | 2
modules/plugins/platform/pom.xml | 2
modules/plugins/pom.xml | 2
modules/plugins/postfix/pom.xml | 2
modules/plugins/postgres/pom.xml | 2
modules/plugins/rhq-agent/pom.xml | 2
modules/plugins/rhq-server/pom.xml | 2
modules/plugins/samba/pom.xml | 2
modules/plugins/script/pom.xml | 2
modules/plugins/script2/pom.xml | 2
modules/plugins/snmptrapd/pom.xml | 2
modules/plugins/sshd/pom.xml | 2
modules/plugins/sudoers/pom.xml | 2
modules/plugins/tomcat/pom.xml | 2
modules/plugins/twitter/pom.xml | 2
modules/plugins/validate-all-plugins/pom.xml | 2
modules/plugins/virt/pom.xml | 2
modules/pom.xml | 2
modules/test-utils/pom.xml | 2
pom.xml | 2
161 files changed, 290 insertions(+), 310 deletions(-)
New commits:
commit 9957e3f699a021b08093e3fd6a96421577be9725
Merge: a9352d7 c367f45
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 26 10:04:15 2013 -0500
Merge branch 'track_master' into spinder/criteriaUsage
commit c367f45a05cd488d4822d51f4c6368f5924c8223
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Feb 21 11:34:05 2013 +0100
BZ911327 - [EAP 6.1] Restarting servers in server-group fails
While the bug was detected because of the underlying EAP operation failing, it appears that the RHQ timeout for this operation is pretty low. The operation timeout is now configurable and should be adjusted by users for their particular environment. It defaults to 2 minutes.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
index 71967e5..eb97042 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
@@ -55,29 +55,30 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* Component dealing with server group specific things
* @author Heiko W. Rupp
*/
-@SuppressWarnings("unused")
public class ServerGroupComponent extends BaseComponent implements ContentFacet, CreateChildResourceFacet,
OperationFacet {
- private static final String SUCCESS = "success";
private static final String OUTCOME = "outcome";
+ private static final String RESTART_SERVERS = "restart-servers";
@Override
public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException,
Exception {
-
Operation op = new Operation(name, getAddress());
- Result res = getASConnection().execute(op);
-
+ Result res = null;
+ if (RESTART_SERVERS.equals(name)) {
+ // This operation as a timeout parameter as it can run for quite a long time
+ res = getASConnection().execute(op, parameters.getSimple("responseTimeout").getIntegerValue());
+ } else {
+ res = getASConnection().execute(op);
+ }
OperationResult result = new OperationResult();
-
if (res.isSuccess()) {
- result.setSimpleResult(SUCCESS);
+ result.setSimpleResult(Result.SUCCESS);
} else {
result.setErrorMessage(res.getFailureDescription());
}
return result;
-
}
@Override
@@ -119,7 +120,7 @@ public class ServerGroupComponent extends BaseComponent implements ContentFacet,
if (uploadResult.has(OUTCOME)) {
String outcome = uploadResult.get(OUTCOME).getTextValue();
- if (outcome.equals(SUCCESS)) { // Upload was successful, so now add the file to the server group
+ if (outcome.equals(Result.SUCCESS)) { // Upload was successful, so now add the file to the server group
JsonNode resultNode = uploadResult.get("result");
String hash = resultNode.get("BYTES_VALUE").getTextValue();
ASConnection connection = getASConnection();
@@ -202,6 +203,7 @@ public class ServerGroupComponent extends BaseComponent implements ContentFacet,
return null; // TODO: Customise this generated block
}
+ @SuppressWarnings("unused")
private String serverGroupFromKey() {
String key1 = context.getResourceKey();
return key1.substring(key1.lastIndexOf("/") + 1);
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 2509073..cf01d5f 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1016,7 +1016,10 @@
<c:simple-property name="operationResult"/>
</results>
</operation>
- <operation name="restart-servers" description="Restarts all servers belonging to the server group currently running in the domain.">
+ <operation name="restart-servers" description="Restarts all servers belonging to the server group currently running in the domain." timeout="180">
+ <parameters>
+ <c:simple-property name="responseTimeout" default="120" type="long" description="Amount of time the agent will be waiting for domain host response. Defaults to 120 seconds." />
+ </parameters>
<results>
<c:simple-property name="operationResult"/>
</results>
commit 068f664483a2013fa84123cb6b6ba85b54ee7c5c
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Feb 25 16:36:41 2013 -0500
[Bug 881848 - Resource availability type remains in state unknown after application of workaround from bug 865166]
Ensure after upgrade that all resources, including those in the ADQ, have
at least an intial UNKNOWN Availability.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index d4bc14c..109eb3a 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -17,7 +17,7 @@
<description>Database schema setup, upgrade and other utilities</description>
<properties>
- <db.schema.version>2.128</db.schema.version>
+ <db.schema.version>2.129</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.server-name>${rhq.test.ds.server-name}</rhq.ds.server-name>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 19ac9dd..936c7bf 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -1944,6 +1944,7 @@
</schemaSpec>
<schemaSpec version="2.125">
+ <!-- Note, JON 3.1.2 includes this already but it is safe to re-execute -->
<!-- We were using a buggy version of password obfuscation from JBoss AS. This task sets the affected
passwords to NULL. Fortunately, this currently affects only CSP content sources, so the damage
is not huge from the user perspective. -->
@@ -1952,6 +1953,7 @@
<!-- BZ 865167 -->
<schemaSpec version="2.126">
+ <!-- Note, JON 3.1.2 includes this already but it is safe to re-execute -->
<schema-directSQL>
<statement targetDBVendor="postgresql">
INSERT INTO RHQ_RESOURCE_AVAIL ( ID, RESOURCE_ID, AVAILABILITY_TYPE )
@@ -1988,6 +1990,27 @@
</schema-directSQL>
</schemaSpec>
+<!-- RHQ 4.6.0 uses DB Schema 2.128 -->
+
+ <!-- BZ 881848 -->
+ <schemaSpec version="2.129">
+ <schema-directSQL>
+ <statement targetDBVendor="postgresql">
+ INSERT INTO RHQ_AVAILABILITY ( ID, RESOURCE_ID, START_TIME, END_TIME, AVAILABILITY_TYPE )
+ SELECT nextval('RHQ_AVAILABILITY_ID_SEQ'::text), res.ID, 0, NULL, 2
+ FROM RHQ_RESOURCE res
+ WHERE NOT EXISTS ( SELECT * FROM RHQ_AVAILABILITY WHERE RESOURCE_ID = res.ID )
+ </statement>
+ <statement targetDBVendor="oracle">
+ INSERT INTO RHQ_AVAILABILITY ( ID, RESOURCE_ID, START_TIME, END_TIME, AVAILABILITY_TYPE )
+ SELECT RHQ_AVAILABILITY_ID_SEQ.nextval, res.ID, 0, NULL, 2
+ FROM RHQ_RESOURCE res
+ WHERE NOT EXISTS ( SELECT * FROM RHQ_AVAILABILITY WHERE RESOURCE_ID = res.ID )
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
+
</dbupgrade>
</target>
</project>
commit c6ddc8538eb130703a276752b05e85b9da5faabc
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Feb 25 17:31:02 2013 -0600
Update development version to 4.7.0-SNAPSHOT.
diff --git a/code-coverage/pom.xml b/code-coverage/pom.xml
index 7bce055..cacf523 100644
--- a/code-coverage/pom.xml
+++ b/code-coverage/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>rhq-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-code-coverage</artifactId>
diff --git a/modules/cli-tests/pom.xml b/modules/cli-tests/pom.xml
index ecd5c00..394dc13 100644
--- a/modules/cli-tests/pom.xml
+++ b/modules/cli-tests/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/common/ant-bundle/pom.xml b/modules/common/ant-bundle/pom.xml
index f69c49e..111b6f0 100644
--- a/modules/common/ant-bundle/pom.xml
+++ b/modules/common/ant-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/common/drift/pom.xml b/modules/common/drift/pom.xml
index 2b0a46a..190bc89 100644
--- a/modules/common/drift/pom.xml
+++ b/modules/common/drift/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-common-drift</artifactId>
diff --git a/modules/common/filetemplate-bundle/pom.xml b/modules/common/filetemplate-bundle/pom.xml
index 7dc4571..32692b5 100644
--- a/modules/common/filetemplate-bundle/pom.xml
+++ b/modules/common/filetemplate-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-filetemplate-bundle-common</artifactId>
diff --git a/modules/common/jboss-as-dmr-client/pom.xml b/modules/common/jboss-as-dmr-client/pom.xml
index 260bd92..4f43692 100644
--- a/modules/common/jboss-as-dmr-client/pom.xml
+++ b/modules/common/jboss-as-dmr-client/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-jboss-as-dmr-client</artifactId>
diff --git a/modules/common/jboss-as/pom.xml b/modules/common/jboss-as/pom.xml
index c8f844c..17e5433 100644
--- a/modules/common/jboss-as/pom.xml
+++ b/modules/common/jboss-as/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-jboss-as-common</artifactId>
diff --git a/modules/common/pom.xml b/modules/common/pom.xml
index 960909d..4ed6d92 100644
--- a/modules/common/pom.xml
+++ b/modules/common/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/core/arquillian-integration/archive/pom.xml b/modules/core/arquillian-integration/archive/pom.xml
index 2e9dc48..7c7e949 100644
--- a/modules/core/arquillian-integration/archive/pom.xml
+++ b/modules/core/arquillian-integration/archive/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-arquillian-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<!-- Model Version -->
diff --git a/modules/core/arquillian-integration/container/pom.xml b/modules/core/arquillian-integration/container/pom.xml
index 65043aa..50e0fed 100644
--- a/modules/core/arquillian-integration/container/pom.xml
+++ b/modules/core/arquillian-integration/container/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-arquillian-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<!-- Model Version -->
diff --git a/modules/core/arquillian-integration/pom.xml b/modules/core/arquillian-integration/pom.xml
index cbdc2a9..fb6f3ee 100644
--- a/modules/core/arquillian-integration/pom.xml
+++ b/modules/core/arquillian-integration/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/arquillian-integration/suite-extension/pom.xml b/modules/core/arquillian-integration/suite-extension/pom.xml
index 3ccb886..5d80c3f 100644
--- a/modules/core/arquillian-integration/suite-extension/pom.xml
+++ b/modules/core/arquillian-integration/suite-extension/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-arquillian-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<!-- Model Version -->
diff --git a/modules/core/client-api/pom.xml b/modules/core/client-api/pom.xml
index ee8f1dc..a4f4b9e 100644
--- a/modules/core/client-api/pom.xml
+++ b/modules/core/client-api/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/comm-api/pom.xml b/modules/core/comm-api/pom.xml
index bf4b745..9fd9f98 100644
--- a/modules/core/comm-api/pom.xml
+++ b/modules/core/comm-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index aa9a2ce..d4bc14c 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index 21af6e4..9775aa6 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-domain</artifactId>
diff --git a/modules/core/gui/pom.xml b/modules/core/gui/pom.xml
index d17353c..9f1b724 100644
--- a/modules/core/gui/pom.xml
+++ b/modules/core/gui/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/native-system/pom.xml b/modules/core/native-system/pom.xml
index 08e5675..21f1c48 100644
--- a/modules/core/native-system/pom.xml
+++ b/modules/core/native-system/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/core/plugin-api/pom.xml b/modules/core/plugin-api/pom.xml
index fd717f7..4b828f7 100644
--- a/modules/core/plugin-api/pom.xml
+++ b/modules/core/plugin-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/plugin-container-itest/pom.xml b/modules/core/plugin-container-itest/pom.xml
index f439dab..900eb72 100644
--- a/modules/core/plugin-container-itest/pom.xml
+++ b/modules/core/plugin-container-itest/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-plugin-container-itest</artifactId>
diff --git a/modules/core/plugin-container/pom.xml b/modules/core/plugin-container/pom.xml
index f7451c5..8bff199 100644
--- a/modules/core/plugin-container/pom.xml
+++ b/modules/core/plugin-container/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-plugin-container</artifactId>
diff --git a/modules/core/plugin-test-api/pom.xml b/modules/core/plugin-test-api/pom.xml
index 5d80afc..f7abec9 100644
--- a/modules/core/plugin-test-api/pom.xml
+++ b/modules/core/plugin-test-api/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-plugin-test-api</artifactId>
diff --git a/modules/core/plugin-test-util/pom.xml b/modules/core/plugin-test-util/pom.xml
index 40d29ec..dbb97fe 100644
--- a/modules/core/plugin-test-util/pom.xml
+++ b/modules/core/plugin-test-util/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/plugin-validator/pom.xml b/modules/core/plugin-validator/pom.xml
index aff829f..fc8ff80 100644
--- a/modules/core/plugin-validator/pom.xml
+++ b/modules/core/plugin-validator/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/plugindoc/pom.xml b/modules/core/plugindoc/pom.xml
index e8a53b5..4528810 100644
--- a/modules/core/plugindoc/pom.xml
+++ b/modules/core/plugindoc/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index d0eff4c..c51fb51 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/core/util/pom.xml b/modules/core/util/pom.xml
index ef4b285..ff2a247 100644
--- a/modules/core/util/pom.xml
+++ b/modules/core/util/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-util</artifactId>
diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml
index f8c7720..99f9b40 100644
--- a/modules/enterprise/agent/pom.xml
+++ b/modules/enterprise/agent/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/agentupdate/pom.xml b/modules/enterprise/agentupdate/pom.xml
index b26d8e3..ba0d852 100644
--- a/modules/enterprise/agentupdate/pom.xml
+++ b/modules/enterprise/agentupdate/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml
index 709a213..1ddf893 100644
--- a/modules/enterprise/binding/pom.xml
+++ b/modules/enterprise/binding/pom.xml
@@ -3,10 +3,10 @@
<parent>
<artifactId>rhq-enterprise-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-script-bindings</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Script Bindings</name>
<description>Abstraction of different facilities and default configurations for script bindings</description>
diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml
index 48fad0c..cf5b95f 100644
--- a/modules/enterprise/comm/pom.xml
+++ b/modules/enterprise/comm/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/content_http-war/pom.xml b/modules/enterprise/gui/content_http-war/pom.xml
index 104b50d..61abd3a 100644
--- a/modules/enterprise/gui/content_http-war/pom.xml
+++ b/modules/enterprise/gui/content_http-war/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-gui-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index 0f58d9b..f60ae8b 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/pom.xml b/modules/enterprise/gui/pom.xml
index f864813..b71b130 100644
--- a/modules/enterprise/gui/pom.xml
+++ b/modules/enterprise/gui/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/portal-war/pom.xml b/modules/enterprise/gui/portal-war/pom.xml
index d032b6d..9795f49 100644
--- a/modules/enterprise/gui/portal-war/pom.xml
+++ b/modules/enterprise/gui/portal-war/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/rest-examples-war/pom.xml b/modules/enterprise/gui/rest-examples-war/pom.xml
index 1eb1ad2..87354d1 100644
--- a/modules/enterprise/gui/rest-examples-war/pom.xml
+++ b/modules/enterprise/gui/rest-examples-war/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/rest-war/pom.xml b/modules/enterprise/gui/rest-war/pom.xml
index 9e1ac5a..1b5349c 100644
--- a/modules/enterprise/gui/rest-war/pom.xml
+++ b/modules/enterprise/gui/rest-war/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/pom.xml b/modules/enterprise/pom.xml
index 7fe3331..489d603 100644
--- a/modules/enterprise/pom.xml
+++ b/modules/enterprise/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml
index e6daa0f..ee672e2 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/client-api/pom.xml b/modules/enterprise/remoting/client-api/pom.xml
index c2addd5..8f0978c 100644
--- a/modules/enterprise/remoting/client-api/pom.xml
+++ b/modules/enterprise/remoting/client-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/client-deps/pom.xml b/modules/enterprise/remoting/client-deps/pom.xml
index 0c81641..006a9a6 100644
--- a/modules/enterprise/remoting/client-deps/pom.xml
+++ b/modules/enterprise/remoting/client-deps/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/pom.xml b/modules/enterprise/remoting/pom.xml
index 3e76a1c..3ab9e66 100644
--- a/modules/enterprise/remoting/pom.xml
+++ b/modules/enterprise/remoting/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/scripting/api/pom.xml b/modules/enterprise/scripting/api/pom.xml
index 2a705b3..5fdffe3 100644
--- a/modules/enterprise/scripting/api/pom.xml
+++ b/modules/enterprise/scripting/api/pom.xml
@@ -3,10 +3,10 @@
<parent>
<artifactId>rhq-scripting-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-api</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Scripting API</name>
<description>Provides API for adding scripting support to RHQ using different javax.scripting - based interpreters</description>
diff --git a/modules/enterprise/scripting/javascript/pom.xml b/modules/enterprise/scripting/javascript/pom.xml
index c2363a5..208076a 100644
--- a/modules/enterprise/scripting/javascript/pom.xml
+++ b/modules/enterprise/scripting/javascript/pom.xml
@@ -4,10 +4,10 @@
<parent>
<artifactId>rhq-scripting-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-javascript</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Javascript support</name>
<description>Provides RHQ scripting in Javascript using Rhino</description>
diff --git a/modules/enterprise/scripting/pom.xml b/modules/enterprise/scripting/pom.xml
index d6faff8..5c82958 100644
--- a/modules/enterprise/scripting/pom.xml
+++ b/modules/enterprise/scripting/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>rhq-enterprise-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-parent</artifactId>
<packaging>pom</packaging>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Scripting Parent Module</name>
<modules>
diff --git a/modules/enterprise/scripting/python/pom.xml b/modules/enterprise/scripting/python/pom.xml
index 34e5231..ab12edf 100644
--- a/modules/enterprise/scripting/python/pom.xml
+++ b/modules/enterprise/scripting/python/pom.xml
@@ -3,10 +3,10 @@
<parent>
<artifactId>rhq-scripting-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-python</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Python support</name>
<description>Provides RHQ scripting in Python using Jython</description>
diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml
index d8c7d6f..2ffdc7c 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/client-api/pom.xml b/modules/enterprise/server/client-api/pom.xml
index 87a99b7..ac92aec 100644
--- a/modules/enterprise/server/client-api/pom.xml
+++ b/modules/enterprise/server/client-api/pom.xml
@@ -5,13 +5,13 @@
<parent>
<artifactId>rhq-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-server-client-api</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Client API</name>
<description>The implementation of the client API when accessing the server locally</description>
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index 09b0def..d6a38d8 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index a1b2dab..83b8977 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml
index 49d79f5..cf6aa8d 100644
--- a/modules/enterprise/server/itests-2/pom.xml
+++ b/modules/enterprise/server/itests-2/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index 2eb3668..d59460f 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/plugins/alert-cli/pom.xml b/modules/enterprise/server/plugins/alert-cli/pom.xml
index 6a9c1fd..68ea87a 100644
--- a/modules/enterprise/server/plugins/alert-cli/pom.xml
+++ b/modules/enterprise/server/plugins/alert-cli/pom.xml
@@ -3,11 +3,11 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
<artifactId>alert-cli</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server CLI Script Alert Plugin</name>
<description>An alert sender able to execute an arbitrary CLI script as a response to an alert</description>
diff --git a/modules/enterprise/server/plugins/alert-email/pom.xml b/modules/enterprise/server/plugins/alert-email/pom.xml
index cfd0d9b..ec91baf 100644
--- a/modules/enterprise/server/plugins/alert-email/pom.xml
+++ b/modules/enterprise/server/plugins/alert-email/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq.server</groupId>
<artifactId>alert-email</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Email Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-irc/pom.xml b/modules/enterprise/server/plugins/alert-irc/pom.xml
index 67fa7a2..ea7bd90 100644
--- a/modules/enterprise/server/plugins/alert-irc/pom.xml
+++ b/modules/enterprise/server/plugins/alert-irc/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-irc</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server IRC Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-log4j/pom.xml b/modules/enterprise/server/plugins/alert-log4j/pom.xml
index 358861c..c50b5cb 100644
--- a/modules/enterprise/server/plugins/alert-log4j/pom.xml
+++ b/modules/enterprise/server/plugins/alert-log4j/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-log4j</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Log4J Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-microblog/pom.xml b/modules/enterprise/server/plugins/alert-microblog/pom.xml
index eecd72a..c576b41 100644
--- a/modules/enterprise/server/plugins/alert-microblog/pom.xml
+++ b/modules/enterprise/server/plugins/alert-microblog/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-microblog</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Microblog Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-mobicents/pom.xml b/modules/enterprise/server/plugins/alert-mobicents/pom.xml
index 975858f..5d9fb43 100644
--- a/modules/enterprise/server/plugins/alert-mobicents/pom.xml
+++ b/modules/enterprise/server/plugins/alert-mobicents/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-mobicents</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Mobicents Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-operations/pom.xml b/modules/enterprise/server/plugins/alert-operations/pom.xml
index 90df568..3b08f01 100644
--- a/modules/enterprise/server/plugins/alert-operations/pom.xml
+++ b/modules/enterprise/server/plugins/alert-operations/pom.xml
@@ -2,14 +2,14 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-operations</artifactId>
<packaging>jar</packaging>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Opertions Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-roles/pom.xml b/modules/enterprise/server/plugins/alert-roles/pom.xml
index 7ba6e6f..4f8c6a5 100644
--- a/modules/enterprise/server/plugins/alert-roles/pom.xml
+++ b/modules/enterprise/server/plugins/alert-roles/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-roles</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Roles Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-snmp/pom.xml b/modules/enterprise/server/plugins/alert-snmp/pom.xml
index dfb59aa..909053a 100644
--- a/modules/enterprise/server/plugins/alert-snmp/pom.xml
+++ b/modules/enterprise/server/plugins/alert-snmp/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-snmp</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server SNMP Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-subject/pom.xml b/modules/enterprise/server/plugins/alert-subject/pom.xml
index de85cf5..cd0263b 100644
--- a/modules/enterprise/server/plugins/alert-subject/pom.xml
+++ b/modules/enterprise/server/plugins/alert-subject/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-subject</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Subject Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml b/modules/enterprise/server/plugins/ant-bundle/pom.xml
index 6a1b367..6f636d5 100644
--- a/modules/enterprise/server/plugins/ant-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/cobbler/pom.xml b/modules/enterprise/server/plugins/cobbler/pom.xml
index 5b41896..2c81751 100644
--- a/modules/enterprise/server/plugins/cobbler/pom.xml
+++ b/modules/enterprise/server/plugins/cobbler/pom.xml
@@ -4,14 +4,14 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>rhq-serverplugin-cobbler</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Cobbler Plugin</name>
diff --git a/modules/enterprise/server/plugins/disk/pom.xml b/modules/enterprise/server/plugins/disk/pom.xml
index 570caa3..5ecb7a9 100644
--- a/modules/enterprise/server/plugins/disk/pom.xml
+++ b/modules/enterprise/server/plugins/disk/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/drift-rhq/pom.xml b/modules/enterprise/server/plugins/drift-rhq/pom.xml
index 0afed7e..52b3a7c 100644
--- a/modules/enterprise/server/plugins/drift-rhq/pom.xml
+++ b/modules/enterprise/server/plugins/drift-rhq/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
index 7d0ba17..b43da47 100644
--- a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/jboss-software/pom.xml b/modules/enterprise/server/plugins/jboss-software/pom.xml
index 55b2aea..3d31342 100644
--- a/modules/enterprise/server/plugins/jboss-software/pom.xml
+++ b/modules/enterprise/server/plugins/jboss-software/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/packagetype-cli/pom.xml b/modules/enterprise/server/plugins/packagetype-cli/pom.xml
index 38bb3f4..80799ab 100644
--- a/modules/enterprise/server/plugins/packagetype-cli/pom.xml
+++ b/modules/enterprise/server/plugins/packagetype-cli/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>packagetype-cli</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server CLI Package Type Plugin</name>
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml
index 77f4d79..827bc41 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/plugins/url/pom.xml b/modules/enterprise/server/plugins/url/pom.xml
index e4f17ed..f677d6a 100644
--- a/modules/enterprise/server/plugins/url/pom.xml
+++ b/modules/enterprise/server/plugins/url/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
index bd8c3b1..0d80df3 100644
--- a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
+++ b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/yum/pom.xml b/modules/enterprise/server/plugins/yum/pom.xml
index 75c478c..75b3cdc 100644
--- a/modules/enterprise/server/plugins/yum/pom.xml
+++ b/modules/enterprise/server/plugins/yum/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/pom.xml b/modules/enterprise/server/pom.xml
index d64e981..494e98e 100644
--- a/modules/enterprise/server/pom.xml
+++ b/modules/enterprise/server/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/safe-invoker/pom.xml b/modules/enterprise/server/safe-invoker/pom.xml
index d216e87..8c509f4 100644
--- a/modules/enterprise/server/safe-invoker/pom.xml
+++ b/modules/enterprise/server/safe-invoker/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/sars/pom.xml b/modules/enterprise/server/sars/pom.xml
index 2fad1d7..2b00e67 100644
--- a/modules/enterprise/server/sars/pom.xml
+++ b/modules/enterprise/server/sars/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/sars/services-sar/pom.xml b/modules/enterprise/server/sars/services-sar/pom.xml
index 40044b2..413c681 100644
--- a/modules/enterprise/server/sars/services-sar/pom.xml
+++ b/modules/enterprise/server/sars/services-sar/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-sars-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/startup-subsystem/pom.xml b/modules/enterprise/server/startup-subsystem/pom.xml
index a7ed12f..3359f33 100644
--- a/modules/enterprise/server/startup-subsystem/pom.xml
+++ b/modules/enterprise/server/startup-subsystem/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/xml-schemas/pom.xml b/modules/enterprise/server/xml-schemas/pom.xml
index a060587..9c1bfdd 100644
--- a/modules/enterprise/server/xml-schemas/pom.xml
+++ b/modules/enterprise/server/xml-schemas/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/helpers/bundleGen/pom.xml b/modules/helpers/bundleGen/pom.xml
index c83a433..1c570fc 100644
--- a/modules/helpers/bundleGen/pom.xml
+++ b/modules/helpers/bundleGen/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq.helpers</groupId>
<artifactId>bundleGen</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<build>
<plugins>
diff --git a/modules/helpers/jeeGen/pom.xml b/modules/helpers/jeeGen/pom.xml
index 14530ff..348b780 100644
--- a/modules/helpers/jeeGen/pom.xml
+++ b/modules/helpers/jeeGen/pom.xml
@@ -9,7 +9,7 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
diff --git a/modules/helpers/perftest-support/pom.xml b/modules/helpers/perftest-support/pom.xml
index 3350726..ceb5377 100644
--- a/modules/helpers/perftest-support/pom.xml
+++ b/modules/helpers/perftest-support/pom.xml
@@ -3,11 +3,11 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
<artifactId>perftest-support</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>Performance Testing Support</name>
<description>To support performance testing, this is a basic tool to support extracting and later reimporting of
data from/to a database.
diff --git a/modules/helpers/pom.xml b/modules/helpers/pom.xml
index 20f1f76..bd47d23 100644
--- a/modules/helpers/pom.xml
+++ b/modules/helpers/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/helpers/rest-docs-generator/pom.xml b/modules/helpers/rest-docs-generator/pom.xml
index f97d2de..0996c3b 100644
--- a/modules/helpers/rest-docs-generator/pom.xml
+++ b/modules/helpers/rest-docs-generator/pom.xml
@@ -24,7 +24,7 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/modules/helpers/rtfilter-subsystem/pom.xml b/modules/helpers/rtfilter-subsystem/pom.xml
index d08c7c6..f3cbb2e 100644
--- a/modules/helpers/rtfilter-subsystem/pom.xml
+++ b/modules/helpers/rtfilter-subsystem/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq.helpers</groupId>
<artifactId>rhq-helpers</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
diff --git a/modules/helpers/rtfilter/pom.xml b/modules/helpers/rtfilter/pom.xml
index dcb0402..98b8667 100644
--- a/modules/helpers/rtfilter/pom.xml
+++ b/modules/helpers/rtfilter/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq.helpers</groupId>
<artifactId>rhq-helpers</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
diff --git a/modules/integration-tests/apache-plugin-test/pom.xml b/modules/integration-tests/apache-plugin-test/pom.xml
index e161160..ce66fd5 100644
--- a/modules/integration-tests/apache-plugin-test/pom.xml
+++ b/modules/integration-tests/apache-plugin-test/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>rhq-integration-tests</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
index b20dfa0..e574631 100644
--- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
+++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>jndi-access-test-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>jndi-access-test</artifactId>
diff --git a/modules/integration-tests/jndi-access/pom.xml b/modules/integration-tests/jndi-access/pom.xml
index 8dfe58e..caef075 100644
--- a/modules/integration-tests/jndi-access/pom.xml
+++ b/modules/integration-tests/jndi-access/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>rhq-integration-tests</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/integration-tests/jndi-access/remote-server/pom.xml b/modules/integration-tests/jndi-access/remote-server/pom.xml
index 2bc2fdd..fd7e312 100644
--- a/modules/integration-tests/jndi-access/remote-server/pom.xml
+++ b/modules/integration-tests/jndi-access/remote-server/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>jndi-access-test-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>jndi-access-remote-server</artifactId>
diff --git a/modules/integration-tests/pom.xml b/modules/integration-tests/pom.xml
index 4c31380..f110387 100644
--- a/modules/integration-tests/pom.xml
+++ b/modules/integration-tests/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/modules/integration-tests/rest-api/pom.xml b/modules/integration-tests/rest-api/pom.xml
index 3ba07c4..cea2a5c 100644
--- a/modules/integration-tests/rest-api/pom.xml
+++ b/modules/integration-tests/rest-api/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-integration-tests</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/modules/plugins/aliases/pom.xml b/modules/plugins/aliases/pom.xml
index 2244a12..a7a4469 100644
--- a/modules/plugins/aliases/pom.xml
+++ b/modules/plugins/aliases/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml
index 172cce8..5390fcc 100644
--- a/modules/plugins/ant-bundle/pom.xml
+++ b/modules/plugins/ant-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/apache/pom.xml b/modules/plugins/apache/pom.xml
index e887a4e..2ca9086 100644
--- a/modules/plugins/apache/pom.xml
+++ b/modules/plugins/apache/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/augeas/pom.xml b/modules/plugins/augeas/pom.xml
index 3617648..9a8acb4 100644
--- a/modules/plugins/augeas/pom.xml
+++ b/modules/plugins/augeas/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/byteman/pom.xml b/modules/plugins/byteman/pom.xml
index 8366602..6a85842 100644
--- a/modules/plugins/byteman/pom.xml
+++ b/modules/plugins/byteman/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml
index d8cfd68..ac3d8ff 100644
--- a/modules/plugins/cassandra/pom.xml
+++ b/modules/plugins/cassandra/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/cobbler/pom.xml b/modules/plugins/cobbler/pom.xml
index b333ad2..8321f4e 100644
--- a/modules/plugins/cobbler/pom.xml
+++ b/modules/plugins/cobbler/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/cron/pom.xml b/modules/plugins/cron/pom.xml
index b0e4004..6ed701b 100644
--- a/modules/plugins/cron/pom.xml
+++ b/modules/plugins/cron/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/database/pom.xml b/modules/plugins/database/pom.xml
index eaf49b8..7959a32 100644
--- a/modules/plugins/database/pom.xml
+++ b/modules/plugins/database/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/filetemplate-bundle/pom.xml b/modules/plugins/filetemplate-bundle/pom.xml
index 70f6d22..c67fc10 100644
--- a/modules/plugins/filetemplate-bundle/pom.xml
+++ b/modules/plugins/filetemplate-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/grub/pom.xml b/modules/plugins/grub/pom.xml
index 0b00df8..d77acf5 100644
--- a/modules/plugins/grub/pom.xml
+++ b/modules/plugins/grub/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/hadoop/pom.xml b/modules/plugins/hadoop/pom.xml
index 9d488f5..1a6c591 100644
--- a/modules/plugins/hadoop/pom.xml
+++ b/modules/plugins/hadoop/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/hibernate/pom.xml b/modules/plugins/hibernate/pom.xml
index a0eac76..0303046 100644
--- a/modules/plugins/hibernate/pom.xml
+++ b/modules/plugins/hibernate/pom.xml
@@ -6,7 +6,7 @@
<groupId>org.rhq</groupId>
<!-- Bypass the jopr-plugins-parent which can not have children. It must build after the plugins in order to execute integration tests on them. -->
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/hosts/pom.xml b/modules/plugins/hosts/pom.xml
index 06315b2..467397e 100644
--- a/modules/plugins/hosts/pom.xml
+++ b/modules/plugins/hosts/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/hudson/pom.xml b/modules/plugins/hudson/pom.xml
index 9c7f6d2..1a8d193 100644
--- a/modules/plugins/hudson/pom.xml
+++ b/modules/plugins/hudson/pom.xml
@@ -6,12 +6,12 @@
<parent>
<artifactId>rhq-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-hudson-plugin</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>RHQ Hudson Plugin</name>
diff --git a/modules/plugins/iis/pom.xml b/modules/plugins/iis/pom.xml
index b8f1f5a..69f1dbb 100644
--- a/modules/plugins/iis/pom.xml
+++ b/modules/plugins/iis/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/irc/pom.xml b/modules/plugins/irc/pom.xml
index 9787a1d..fc69a41 100644
--- a/modules/plugins/irc/pom.xml
+++ b/modules/plugins/irc/pom.xml
@@ -5,7 +5,7 @@
<parent>
<artifactId>rhq-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml
index 9c71f33..f2a81a1 100644
--- a/modules/plugins/jboss-as-5/pom.xml
+++ b/modules/plugins/jboss-as-5/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 75d5b51..1f63c91 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml
index 53e8149..d1f4c74 100644
--- a/modules/plugins/jboss-as/pom.xml
+++ b/modules/plugins/jboss-as/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jboss-cache-v3/pom.xml b/modules/plugins/jboss-cache-v3/pom.xml
index aa4f232..34bdffe 100644
--- a/modules/plugins/jboss-cache-v3/pom.xml
+++ b/modules/plugins/jboss-cache-v3/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jboss-cache/pom.xml b/modules/plugins/jboss-cache/pom.xml
index 35d919b..421f24d 100644
--- a/modules/plugins/jboss-cache/pom.xml
+++ b/modules/plugins/jboss-cache/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jmx/pom.xml b/modules/plugins/jmx/pom.xml
index 16d4245..48e3f93 100644
--- a/modules/plugins/jmx/pom.xml
+++ b/modules/plugins/jmx/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/kickstart/pom.xml b/modules/plugins/kickstart/pom.xml
index 5d85bc4..9255d09 100644
--- a/modules/plugins/kickstart/pom.xml
+++ b/modules/plugins/kickstart/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/mod-cluster/pom.xml b/modules/plugins/mod-cluster/pom.xml
index 64620e1..804b04a 100644
--- a/modules/plugins/mod-cluster/pom.xml
+++ b/modules/plugins/mod-cluster/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/mysql/pom.xml b/modules/plugins/mysql/pom.xml
index 9e5a24e..14e39a3 100644
--- a/modules/plugins/mysql/pom.xml
+++ b/modules/plugins/mysql/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 4afa8a5..184f1db 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/noop/pom.xml b/modules/plugins/noop/pom.xml
index 1ab336f..1f43ea4 100644
--- a/modules/plugins/noop/pom.xml
+++ b/modules/plugins/noop/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/oracle/pom.xml b/modules/plugins/oracle/pom.xml
index 5ce8144..dc4f4aa 100644
--- a/modules/plugins/oracle/pom.xml
+++ b/modules/plugins/oracle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/pattern-generator/pom.xml b/modules/plugins/pattern-generator/pom.xml
index b8fdab2..7fe46e5 100644
--- a/modules/plugins/pattern-generator/pom.xml
+++ b/modules/plugins/pattern-generator/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/perftest/pom.xml b/modules/plugins/perftest/pom.xml
index e8b68fe..7ccffa7 100644
--- a/modules/plugins/perftest/pom.xml
+++ b/modules/plugins/perftest/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/platform/pom.xml b/modules/plugins/platform/pom.xml
index 143872e..ef210b6 100644
--- a/modules/plugins/platform/pom.xml
+++ b/modules/plugins/platform/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index 73947ae..9af3938 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/plugins/postfix/pom.xml b/modules/plugins/postfix/pom.xml
index 29ea010..69a3b7d 100644
--- a/modules/plugins/postfix/pom.xml
+++ b/modules/plugins/postfix/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/postgres/pom.xml b/modules/plugins/postgres/pom.xml
index c565c89..1e323fb 100644
--- a/modules/plugins/postgres/pom.xml
+++ b/modules/plugins/postgres/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/rhq-agent/pom.xml b/modules/plugins/rhq-agent/pom.xml
index 1dcf822..e187c17 100644
--- a/modules/plugins/rhq-agent/pom.xml
+++ b/modules/plugins/rhq-agent/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/rhq-server/pom.xml b/modules/plugins/rhq-server/pom.xml
index 9d1557b..5327977 100644
--- a/modules/plugins/rhq-server/pom.xml
+++ b/modules/plugins/rhq-server/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/samba/pom.xml b/modules/plugins/samba/pom.xml
index dd8150c..a392c58 100644
--- a/modules/plugins/samba/pom.xml
+++ b/modules/plugins/samba/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/script/pom.xml b/modules/plugins/script/pom.xml
index 77d117e..3772829 100644
--- a/modules/plugins/script/pom.xml
+++ b/modules/plugins/script/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/script2/pom.xml b/modules/plugins/script2/pom.xml
index 672ac51..3bec031 100644
--- a/modules/plugins/script2/pom.xml
+++ b/modules/plugins/script2/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/snmptrapd/pom.xml b/modules/plugins/snmptrapd/pom.xml
index 35121e0..4805c8f 100644
--- a/modules/plugins/snmptrapd/pom.xml
+++ b/modules/plugins/snmptrapd/pom.xml
@@ -2,7 +2,7 @@
<parent>
<artifactId>rhq-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/modules/plugins/sshd/pom.xml b/modules/plugins/sshd/pom.xml
index 6d880e3..92e76ef 100644
--- a/modules/plugins/sshd/pom.xml
+++ b/modules/plugins/sshd/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/sudoers/pom.xml b/modules/plugins/sudoers/pom.xml
index 91bfbee..053fac0 100644
--- a/modules/plugins/sudoers/pom.xml
+++ b/modules/plugins/sudoers/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/tomcat/pom.xml b/modules/plugins/tomcat/pom.xml
index 52c9b13..9ded2f5 100644
--- a/modules/plugins/tomcat/pom.xml
+++ b/modules/plugins/tomcat/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/twitter/pom.xml b/modules/plugins/twitter/pom.xml
index 6b0ad95..6f00f3f 100644
--- a/modules/plugins/twitter/pom.xml
+++ b/modules/plugins/twitter/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/validate-all-plugins/pom.xml b/modules/plugins/validate-all-plugins/pom.xml
index fbc5f94..1e8c6fc 100644
--- a/modules/plugins/validate-all-plugins/pom.xml
+++ b/modules/plugins/validate-all-plugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/virt/pom.xml b/modules/plugins/virt/pom.xml
index a2a48da..1c2bbca 100644
--- a/modules/plugins/virt/pom.xml
+++ b/modules/plugins/virt/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/pom.xml b/modules/pom.xml
index d1745b2..82d911d 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/test-utils/pom.xml b/modules/test-utils/pom.xml
index a04cf92..ee5bbfd 100644
--- a/modules/test-utils/pom.xml
+++ b/modules/test-utils/pom.xml
@@ -7,7 +7,7 @@
<parent>
<artifactId>rhq-modules-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>test-utils</artifactId>
diff --git a/pom.xml b/pom.xml
index 711cad0..afd1a61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>RHQ</name>
commit 503f985d13d376f388b3cf1842f3e2904f5ed549
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 22 15:28:28 2013 -0500
Don't access the resource to delete transactionally and hold it while trying
to then uninventory it via slsb calls. This could cause a deadlock.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
index 1fcda30..213d75d 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
@@ -105,26 +105,21 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
@Override
protected void afterMethod() throws Exception {
try {
+ prepareForTestAgents();
+
if (theResource != null) {
// perform in-band and out-of-band work in quick succession
// this also deletes our attached agent
- prepareForTestAgents();
resourceManager.uninventoryResource(overlord, theResource.getId());
resourceManager.uninventoryResourceAsyncWork(overlord, theResource.getId());
- unprepareForTestAgents();
theResource = null;
}
if (additionalResources != null) {
- getTransactionManager().begin();
-
for (Resource res : additionalResources) {
- Resource res2 = em.find(Resource.class, res.getId());
- resourceManager.uninventoryResource(overlord, res2.getId());
- resourceManager.uninventoryResourceAsyncWork(overlord, res2.getId());
-
+ resourceManager.uninventoryResource(overlord, res.getId());
+ resourceManager.uninventoryResourceAsyncWork(overlord, res.getId());
}
- getTransactionManager().commit();
}
if (theResourceType != null) {
@@ -141,6 +136,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
}
finally {
+ unprepareForTestAgents();
unprepareScheduler();
unprepareServerPluginService();
testServerPluginService.stopMasterPluginContainer();
@@ -280,7 +276,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
// platform: UNKNOWN(0) -->
commitAndClose();
-
AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
availPoints = availabilityManager.findAvailabilitiesForResource(overlord, theResource.getId(), 1,
@@ -431,7 +426,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
// setAllAgentResourceAvails will only operate on those that have at least 1 avail row
Availability avail = new Availability(theResource, UNKNOWN);
persistAvailability(avail);
@@ -461,7 +455,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
// have never heard from the new agent yet - we do not backfill anything in this case
LookupUtil.getAgentManager().checkForSuspectAgents();
assert availabilityManager.getCurrentAvailabilityTypeForResource(overlord, theResource.getId()) == UNKNOWN;
@@ -491,7 +484,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
// add a report that says the resource was up 20 minutes ago
Availability avail = new Availability(theResource, (System.currentTimeMillis() - 12000000), UP);
AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
@@ -507,7 +499,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
agent.setLastAvailabilityPing(System.currentTimeMillis() - (1000 * 60 * 18)); // 18 mins
commitAndClose();
-
// the agent should be suspect and will be considered down, the platform resource should be down
// (although children should be UNKNOWN)
LookupUtil.getAgentManager().checkForSuspectAgents(); // checks for 5 mins !!
@@ -523,7 +514,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
assert allAvails.size() == 3;
commitAndClose();
-
Availability a1 = allAvails.get(0);
Availability a2 = allAvails.get(1);
Availability a3 = allAvails.get(2);
@@ -571,7 +561,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
commitAndClose();
-
for (Resource res : allResources) {
int resId = res.getId();
Availability currentAvailability = availabilityManager.getCurrentAvailabilityForResource(overlord,
@@ -600,7 +589,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
agent.setLastAvailabilityPing(System.currentTimeMillis() - (1000 * 60 * 18)); // 18 mins
commitAndClose();
-
// the agent should be suspect and will be considered down. the resources have their initial
// UNKNOWN avails. The platform should get a new DOWN Availability row. The rest should remain
// as is since they are already UNKNOWN.
@@ -641,7 +629,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
agent.setLastAvailabilityPing(System.currentTimeMillis() - (1000 * 60 * 18));
commitAndClose();
-
// the agent should be suspect and will be considered down
// all of the resources have availabilities now, so another row will be added to them if they are not disabled
start = System.currentTimeMillis();
@@ -670,7 +657,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
assert allAvails.size() == ((expected == DOWN) ? 4 : ((expected == DISABLED) ? 2 : 3)) : allAvails;
commitAndClose();
-
Availability a0 = allAvails.get(0);
Availability a1 = allAvails.get(1);
Availability a2 = null;
@@ -716,7 +702,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
System.out.println("testAgentBackfillPerformance: checking validity of data took "
+ (System.currentTimeMillis() - start) + "ms");
-
} catch (Exception e) {
e.printStackTrace();
throw e;
@@ -737,7 +722,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource(); // inserts initial UNKNOWN Availability at epoch
commitAndClose();
-
Availability avail;
long now = System.currentTimeMillis();
@@ -824,7 +808,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
long now = System.currentTimeMillis();
// add a report that says the resource is down - reports can't have the same resource in it twice,
@@ -885,7 +868,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 2000);
cal.set(Calendar.MONTH, 0);
@@ -973,7 +955,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
long allAvailCount = setUpAvailabilities();
// we now have 1:00 UP, 1:20 DOWN, 1:40 UP
@@ -1170,7 +1151,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
avail = avails.get(0); // 0..1:00
assertTrue(avail.toString(), Math.abs(avail.getStartTime() - 0L) < 1000L);
assertEquals(avail.toString(), AvailabilityType.UNKNOWN, avail.getAvailabilityType());
- assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(1).getStartTime()) < 1000L);
+ assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(1).getStartTime()) < 1000L);
avail = avails.get(1); // 1:00..1:20
assertTrue(avail.toString(), Math.abs(currentStartTime - (avail.getStartTime() + (40 * 60 * 1000))) < 1000L);
assertEquals(avail.toString(), AvailabilityType.UP, avail.getAvailabilityType());
@@ -1297,7 +1278,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
commitAndClose();
-
// add a report that says the resources are now up - the report will add one avail for each resource
// at this point, the resources do not yet have a row in availability - after the merge they will have 1
AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
@@ -1371,7 +1351,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
System.out.println("testMergeReportPerformance: checking validity of data 3 took "
+ (System.currentTimeMillis() - start) + "ms");
-
} catch (Exception e) {
e.printStackTrace();
throw e;
commit 17aa29bfb17f8e4ab25f7f26c852a386985c6781
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 22 10:42:48 2013 -0500
Fix tests so they run on windows as well.
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java
index bb8adcd..534e9f4 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java
@@ -48,6 +48,8 @@ import org.rhq.core.util.stream.StreamUtil;
public class AS7CommandLineTest {
private static final File FAKE_JBOSS_HOME = new File(".");
+ private static final String FILE_URL_PREFIX = (File.separatorChar == '/') ? "file://" : "file:///";
+
private interface CommandLineProducer {
AS7CommandLine get();
}
@@ -73,8 +75,8 @@ public class AS7CommandLineTest {
File propsFile1 = File.createTempFile("jboss1-", ".properties");
File propsFile2 = File.createTempFile("jboss2-", ".properties");
- String propsFile1Path = "file://" + propsFile1;
- String propsFile2Path = "file://" + propsFile2;
+ String propsFile1Path = FILE_URL_PREFIX + propsFile1;
+ String propsFile2Path = FILE_URL_PREFIX + propsFile2;
try {
testSysProps(propsFile1, propsFile2, FAKE_JBOSS_HOME,
@@ -197,8 +199,8 @@ public class AS7CommandLineTest {
File propsFile1 = File.createTempFile("jboss1-", ".properties");
File propsFile2 = File.createTempFile("jboss2-", ".properties");
- String propsFile1Path = "file://" + propsFile1;
- String propsFile2Path = "file://" + propsFile2;
+ String propsFile1Path = FILE_URL_PREFIX + propsFile1;
+ String propsFile2Path = FILE_URL_PREFIX + propsFile2;
FakeServerProcess fakeServer = startFakeServer(FAKE_JBOSS_HOME, FAKE_JBOSS_HOME, propsFile1Path, propsFile2Path);
@@ -218,8 +220,8 @@ public class AS7CommandLineTest {
File propsFile1 = File.createTempFile("jboss1-", ".properties");
File propsFile2 = File.createTempFile("jboss2-", ".properties");
- String propsFile1Path = "file://" + propsFile1;
- String propsFile2Path = "file://" + propsFile2;
+ String propsFile1Path = FILE_URL_PREFIX + propsFile1;
+ String propsFile2Path = FILE_URL_PREFIX + propsFile2;
FakeServerProcess fakeServer = startFakeServer(new File(".."), FAKE_JBOSS_HOME, propsFile1Path, propsFile2Path);
@@ -385,11 +387,7 @@ public class AS7CommandLineTest {
Assert
.fail("The fake jboss as server process has finished even though it should keep running. The exit value was "
- + exitValue
- + ". Stdout was:\n"
- + stdout
- + "\n\nStderr was:\n"
- + stderr);
+ + exitValue + ". Stdout was:\n" + stdout + "\n\nStderr was:\n" + stderr);
} catch (IllegalThreadStateException e) {
//expected
}
commit ad131fe3d7a38287857fcf5d34e6b3d3983acc96
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Feb 22 11:40:25 2013 +0100
Unifying the width of buttons in the toolstrip (removing autoFit by default, autoFit property is set if the title length is greater than 15 characters) and removing unused class SimpleCollapsiblePanel.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java
index b9b16ed..d7b8c81 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java
@@ -223,7 +223,6 @@ public class AgentPluginTableView extends TableSection<AgentPluginDataSource> {
IButton scanForUpdatesButton = new LocatableIButton(extendLocatorId("scanButton"),
MSG.view_admin_plugins_scan());
- scanForUpdatesButton.setAutoFit(true);
scanForUpdatesButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
GWTServiceLookup.getPluginService().scanAndRegister(new AsyncCallback<Void>() {
@@ -246,7 +245,6 @@ public class AgentPluginTableView extends TableSection<AgentPluginDataSource> {
final IButton showDeletedButton = new LocatableIButton(extendLocatorId("showDeletedButton"),
MSG.view_admin_plugins_showDeleted());
- showDeletedButton.setAutoFit(true);
showDeletedButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
showDeleted = !showDeleted;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java
index c83d93f..f3f72f4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java
@@ -223,7 +223,6 @@ public class ServerPluginTableView extends TableSection<ServerPluginDataSource>
IButton scanForUpdatesButton = new LocatableIButton(extendLocatorId("scanButton"),
MSG.view_admin_plugins_scan());
- scanForUpdatesButton.setAutoFit(true);
scanForUpdatesButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
GWTServiceLookup.getPluginService().scanAndRegister(new AsyncCallback<Void>() {
@@ -246,7 +245,6 @@ public class ServerPluginTableView extends TableSection<ServerPluginDataSource>
IButton restartMasterPCButton = new LocatableIButton(extendLocatorId("restartMasterPCButton"),
MSG.view_admin_plugins_restartMasterPC());
- restartMasterPCButton.setAutoFit(true);
restartMasterPCButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Message msg = new Message(MSG.view_admin_plugins_restartMasterPCStarted(), Severity.Info);
@@ -272,7 +270,6 @@ public class ServerPluginTableView extends TableSection<ServerPluginDataSource>
final IButton showUndeployedButton = new LocatableIButton(extendLocatorId("showUndeployedButton"),
MSG.view_admin_plugins_showUndeployed());
- showUndeployedButton.setAutoFit(true);
showUndeployedButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
showUndeployed = !showUndeployed;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java
deleted file mode 100644
index ed9163d..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.components;
-
-import com.smartgwt.client.types.SelectionType;
-import com.smartgwt.client.widgets.Button;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-/**
- * TODO: Not Quite Working. For some reason the icon is not clickable.
- *
- * @author Greg Hinkle
- */
-public class SimpleCollapsiblePanel extends VLayout {
-
- private Canvas content;
- private String title;
-
- private boolean expanded = true;
-
- public SimpleCollapsiblePanel(String title, Canvas content) {
- this.content = content;
- this.title = title;
- setWidth100();
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
- final Button button = new Button(title);
- button.setShowRollOver(false);
- button.setActionType(SelectionType.RADIO);
- //button.setBorder(null);
- button.setAutoFit(true);
-
- button.setIcon("[skin]/images/SectionHeader/opener_opened.png");
- //button.setBaseStyle("SimpleButton");
-
- button.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- expanded = !expanded;
- if (expanded) {
- button.setIcon("[skin]/images/SectionHeader/opener_opened.png");
- content.show();
- } else {
- button.setIcon("[skin]/images/SectionHeader/opener_closed.png");
- content.hide();
- setHeight(30);
- }
- getParentElement().markForRedraw();
- markForRedraw();
- }
- });
-
- addMember(button);
- addMember(content);
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java
index d82d2ee..cd1a396 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java
@@ -362,7 +362,6 @@ public abstract class Carousel extends LocatableHLayout implements RefreshableVi
.getTitle());
menuButton.setMenu(menu);
menuButton.setDisabled(true);
- menuButton.setAutoFit(true); // this makes it pretty tight, but maybe better than the default, which is pretty wide
menuButton.setOverflow(Overflow.VISIBLE);
menuButton.setShowMenuBelow(false);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
index 991098e..8cdb741 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -153,7 +153,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
.common_title_edit_mode());
- editButton.setAutoFit(true);
editButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
editMode = !editMode;
@@ -163,7 +162,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
});
resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
- resetButton.setAutoFit(true);
resetButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
String message = MSG.view_summaryDashboard_resetConfirm();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 77a729d..ceca886 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -122,7 +122,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
.common_title_edit_mode());
- editButton.setAutoFit(true);
editButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
editMode = !editMode;
@@ -132,7 +131,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
});
resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
- resetButton.setAutoFit(true);
resetButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
String message = MSG.view_summaryDashboard_resetConfirm();
commit 29b87752782a07869894b5c3eccb8d47dd11f46a
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Feb 21 23:56:16 2013 +0100
Adding the API checks to the script bindings.
Also corrected a minor incompatible change that was introduced since 4.5.1.
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml
index 08cfdd4..709a213 100644
--- a/modules/enterprise/binding/pom.xml
+++ b/modules/enterprise/binding/pom.xml
@@ -12,6 +12,7 @@
<properties>
<filtered.location>src/main/java</filtered.location>
+ <rhq.internal>false</rhq.internal>
</properties>
<dependencies>
@@ -240,6 +241,23 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>clirr-maven-plugin</artifactId>
+ <configuration>
+ <includes>
+ <!-- Hand picked stuff that corresponds to what is the script context initialized to
+ in the org/rhq/bindings/StandardBindings. -->
+ <include>org/rhq/bindings/client/*</include>
+ <include>org/rhq/bindings/export/*</include>
+ <include>org/rhq/bindings/output/*</include>
+ <include>org/rhq/bindings/util/ScriptAssert</include>
+ <include>org/rhq/bindings/util/ScriptAssertException</include>
+ <include>org/rhq/bindings/util/ScriptUtil</include>
+ </includes>
+ </configuration>
+ </plugin>
+
</plugins>
</build>
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java
index 3e1e137..e0e794c 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java
@@ -46,6 +46,10 @@ import org.rhq.core.domain.util.PageControl;
* is available for all the users of this class. The user is however able to later modify these defaults to provide
* use-case specific overrides (for example the CLI might want to supply impls that hook into the console to provide
* interactivity with user in some workflows, which, generically, is not possible in a common case).
+ * <p>
+ * *NOTE*: any change in what is exposed to the scripting clients needs to be reflected in the API check configuration
+ * in the pom.xml of the corresponding modules, because any class that gets exposed in the script context essentially
+ * becomes a public API.
*
* @author Lukas Krejci
*/
@@ -118,10 +122,10 @@ public class StandardBindings extends HashMap<String, Object> {
/**
* If you want to preserve non-client-dependent bindings when the facade changes, call this as opposed to
- * constructing new StandardBindings.
+ * constructing new StandardBindings.
*/
public void setFacade(PrintWriter output, RhqFacade rhqFacade) {
- // remove any existing managers
+ // remove any existing managers
if (null != managers) {
for (RhqManager manager : managers.keySet()) {
remove(manager.name());
@@ -204,7 +208,7 @@ public class StandardBindings extends HashMap<String, Object> {
}
public Map<RhqManager, Object> getManagers() {
- //XXX ideally this should be a projection into our map
+ //XXX ideally this should be a projection into our map
return (null == managers) ? managers = Collections.emptyMap() : managers;
}
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java
index 32832b2..2c781a1 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java
@@ -101,7 +101,7 @@ public enum RhqManager {
this.beanName = this.name() + "Bean";
localInterfaceClassName = getLocalInterfaceClassName(remote);
- //defaults and evaluates to TRUE unless the string contains "false". Done to defend against
+ //defaults and evaluates to TRUE unless the string contains "false". Done to defend against
//possible errors in string replacement during rhq build.
this.enabled = true;
if ((enable != null) && (enable.trim().length() > 0)) {
@@ -123,6 +123,15 @@ public enum RhqManager {
return this.remote;
}
+ /**
+ * @deprecated since 4.6.0, use the {@link #remote()} method instead
+ * @return the class name of the remote interface
+ */
+ @Deprecated
+ public String remoteName() {
+ return this.remote.getName();
+ }
+
public String localInterfaceClassName() {
return localInterfaceClassName;
}
commit 6f71c2d100c564e2f52894eca3238a6f5c7b73d7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 21 21:22:24 2013 -0500
[BZ 913778] fix NPE
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
index 6fdaf95..0aecd4d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
@@ -37,7 +37,8 @@ public class LocatableIButton extends IButton implements Locatable {
private void init(String locatorId) {
this.locatorId = locatorId;
SeleniumUtility.setID(this, locatorId);
- if (getTitle().length() > 15) {
+ String title = getTitle();
+ if (title != null && title.length() > 15) {
setAutoFit(true);
}
}
commit 277c8b1fc4379e6a652931b7db1bbdd4ce3ce5ac
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 21 16:25:40 2013 -0500
[BZ 913606] agent will send a full avail report if the server tells it at connect time that it has been backfilled.
the server will also update the last ping time of the agent when the connect comes in.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java
index 47be78b..3bcf47b 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java
@@ -32,10 +32,12 @@ import java.io.Serializable;
public class ConnectAgentResults implements Serializable {
private static final long serialVersionUID = 1L;
- private long serverTime;
+ private final long serverTime;
+ private final boolean isDown;
- public ConnectAgentResults(long serverTime) {
+ public ConnectAgentResults(long serverTime, boolean isDown) {
this.serverTime = serverTime;
+ this.isDown = isDown;
}
/**
@@ -49,10 +51,23 @@ public class ConnectAgentResults implements Serializable {
}
/**
- * @see java.lang.Object#toString()
+ * If true, this indicates if the server thinks the agent is down. This happens if the agent
+ * hasn't connected in a long time and the server had "backfilled" the agent's resources
+ * as DOWN/UNKNOWN.
+ *
+ * When an agent connects to a server, and the server thinks that agent was down, the agent needs
+ * to prepare to notify the server of its state - for example, the agent should soon send up
+ * a full availability report so the server can get the up-to-date availability statuses of all
+ * resources.
+ *
+ * @return true if the server had this agent's resources marked as DOWN/UNKNOWN.
*/
+ public boolean isDown() {
+ return isDown;
+ }
+
@Override
public String toString() {
- return "ConnectAgentResults: [server-time=" + this.serverTime + "]";
+ return "ConnectAgentResults: [server-time=" + this.serverTime + ", is-down=" + this.isDown + "]";
}
}
\ No newline at end of file
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
index 6c01d67..0c95199 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
@@ -2146,6 +2146,18 @@ public class AgentMain {
ConnectAgentResults results = (ConnectAgentResults) connectResponse.getResults();
long serverTime = results.getServerTime();
serverClockNotification(serverTime);
+
+ // If the server thinks we are down, we need to do some things to get this agent in sync with the server.
+ // Anything we do in here should be very fast.
+ boolean serverThinksWeAreDown = results.isDown();
+ if (serverThinksWeAreDown) {
+ LOG.warn(AgentI18NResourceKeys.SERVER_THINKS_AGENT_IS_DOWN);
+ PluginContainer plugin_container = PluginContainer.getInstance();
+ if (plugin_container.isStarted()) {
+ // tell the plugin container to send a full avail report up so the server knows we are UP
+ plugin_container.getInventoryManager().requestFullAvailabilityReport();
+ }
+ }
} catch (Throwable t) {
// should never happen, should always cast to non-null ConnectAgentResults
LOG.error(AgentI18NResourceKeys.TIME_UNKNOWN, ThrowableUtil.getAllMessages(t));
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
index 57f427c..10761ff 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
@@ -170,6 +170,9 @@ public interface AgentI18NResourceKeys {
@I18NMessage("Failed to determine the server time. Cause: {0}")
String TIME_UNKNOWN = "AgentMain.time-unknown";
+ @I18NMessage("The server thinks this agent is down. Will notify the server of up-to-date information when possible.")
+ String SERVER_THINKS_AGENT_IS_DOWN = "AgentMain.server-thinks-agent-is-down";
+
@I18NMessage("Timed out waiting for the connectAgent R/W lock to avoid a possible deadlock")
String TIMEOUT_WAITING_FOR_CONNECT_LOCK = "AgentMain.connect-lock-timeout";
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java
index 23bcbcf..9818ac3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java
@@ -320,6 +320,7 @@ public class CoreServerServiceImpl implements CoreServerService {
Server server = getServerManager().getServer();
agent.setServer(server);
+ agent.setLastAvailabilityPing(Long.valueOf(System.currentTimeMillis()));
getAgentManager().updateAgent(agent);
getAlertConditionCacheManager().reloadCachesForAgent(agent.getId());
@@ -328,7 +329,7 @@ public class CoreServerServiceImpl implements CoreServerService {
PartitionEventType.AGENT_CONNECT, agentName + " - " + server.getName());
log.info("Agent [" + agentName + "] has connected to this server at " + new Date());
- return new ConnectAgentResults(System.currentTimeMillis());
+ return new ConnectAgentResults(System.currentTimeMillis(), agent.isBackFilled());
}
/**
commit 369633cd9ab6a42d24c98a8c599f8a134fb5cc95
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 21 15:12:05 2013 -0500
this should not be here
diff --git a/modules/enterprise/server/jar/lib/log4jdbc4-1.2beta2.jar b/modules/enterprise/server/jar/lib/log4jdbc4-1.2beta2.jar
deleted file mode 100644
index 3d6f466..0000000
Binary files a/modules/enterprise/server/jar/lib/log4jdbc4-1.2beta2.jar and /dev/null differ
11 years, 2 months
[rhq] Branch 'bug/783603' - 56 commits - .classpath code-coverage/pom.xml etc/agentspawn modules/cli-tests modules/common modules/core modules/enterprise modules/helpers modules/integration-tests modules/plugins modules/pom.xml modules/test-utils pom.xml
by mazz
.classpath | 36
code-coverage/pom.xml | 2
dev/null |binary
etc/agentspawn/src/scripts/agentcopy.properties | 4
modules/cli-tests/pom.xml | 2
modules/common/ant-bundle/pom.xml | 2
modules/common/drift/pom.xml | 2
modules/common/filetemplate-bundle/pom.xml | 2
modules/common/jboss-as-dmr-client/pom.xml | 2
modules/common/jboss-as/pom.xml | 2
modules/common/pom.xml | 2
modules/core/arquillian-integration/archive/pom.xml | 2
modules/core/arquillian-integration/container/pom.xml | 2
modules/core/arquillian-integration/pom.xml | 2
modules/core/arquillian-integration/suite-extension/pom.xml | 2
modules/core/client-api/pom.xml | 2
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/configuration/ConfigurationServerService.java | 4
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java | 23
modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java | 1
modules/core/comm-api/pom.xml | 2
modules/core/dbutils/pom.xml | 4
modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseType.java | 13
modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java | 15
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 23
modules/core/domain/pom.xml | 36
modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java | 17
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java | 24
modules/core/domain/src/test/resources/arquillian.xml | 4
modules/core/gui/pom.xml | 2
modules/core/native-system/pom.xml | 2
modules/core/plugin-api/pom.xml | 2
modules/core/plugin-container-itest/pom.xml | 2
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java | 8
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/LateMeasurementRescheduleTest.java | 4
modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/ReadOnlyScheduleSetTest.java | 4
modules/core/plugin-container/pom.xml | 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 64 -
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java | 133 ++
modules/core/plugin-test-api/pom.xml | 2
modules/core/plugin-test-util/pom.xml | 2
modules/core/plugin-validator/pom.xml | 2
modules/core/plugindoc/pom.xml | 2
modules/core/pom.xml | 2
modules/core/util/pom.xml | 2
modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java | 20
modules/enterprise/agent/pom.xml | 2
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java | 12
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentManagement.java | 4
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java | 8
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java | 38
modules/enterprise/agentupdate/pom.xml | 2
modules/enterprise/binding/pom.xml | 64 +
modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java | 10
modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java | 11
modules/enterprise/comm/pom.xml | 2
modules/enterprise/gui/content_http-war/pom.xml | 2
modules/enterprise/gui/coregui/pom.xml | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java | 3
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java | 78 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java | 14
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 24
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java | 4
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2
modules/enterprise/gui/pom.xml | 2
modules/enterprise/gui/portal-war/pom.xml | 2
modules/enterprise/gui/rest-examples-war/pom.xml | 2
modules/enterprise/gui/rest-war/pom.xml | 2
modules/enterprise/pom.xml | 2
modules/enterprise/remoting/cli/pom.xml | 36
modules/enterprise/remoting/client-api/pom.xml | 2
modules/enterprise/remoting/client-deps/pom.xml | 2
modules/enterprise/remoting/pom.xml | 2
modules/enterprise/scripting/api/pom.xml | 4
modules/enterprise/scripting/javascript/pom.xml | 4
modules/enterprise/scripting/pom.xml | 4
modules/enterprise/scripting/python/pom.xml | 4
modules/enterprise/server/appserver/pom.xml | 2
modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 1
modules/enterprise/server/client-api/pom.xml | 4
modules/enterprise/server/ear/pom.xml | 2
modules/enterprise/server/installer/pom.xml | 2
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java | 9
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java | 9
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java | 77 +
modules/enterprise/server/installer/src/main/resources/logging.properties | 3
modules/enterprise/server/itests-2/pom.xml | 361 ++++---
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java | 96 +-
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java | 53 -
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerCommunicationsService.java | 7
modules/enterprise/server/itests-2/src/test/resources/arquillian.xml | 4
modules/enterprise/server/jar/pom.xml | 39
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 124 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java | 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java | 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java | 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java | 9
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java | 21
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsService.java | 12
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsServiceMBean.java | 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java | 353 ++++---
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java | 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 133 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java | 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java | 58 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java | 35
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/BadArgumentException.java | 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java | 20
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java | 81 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java | 8
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java | 10
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java | 52 +
modules/enterprise/server/plugins/alert-cli/pom.xml | 4
modules/enterprise/server/plugins/alert-email/pom.xml | 4
modules/enterprise/server/plugins/alert-irc/pom.xml | 4
modules/enterprise/server/plugins/alert-log4j/pom.xml | 4
modules/enterprise/server/plugins/alert-microblog/pom.xml | 4
modules/enterprise/server/plugins/alert-mobicents/pom.xml | 4
modules/enterprise/server/plugins/alert-operations/pom.xml | 4
modules/enterprise/server/plugins/alert-roles/pom.xml | 4
modules/enterprise/server/plugins/alert-snmp/pom.xml | 4
modules/enterprise/server/plugins/alert-subject/pom.xml | 4
modules/enterprise/server/plugins/ant-bundle/pom.xml | 2
modules/enterprise/server/plugins/cobbler/pom.xml | 4
modules/enterprise/server/plugins/disk/pom.xml | 2
modules/enterprise/server/plugins/drift-rhq/pom.xml | 2
modules/enterprise/server/plugins/filetemplate-bundle/pom.xml | 2
modules/enterprise/server/plugins/jboss-software/pom.xml | 2
modules/enterprise/server/plugins/packagetype-cli/pom.xml | 4
modules/enterprise/server/plugins/pom.xml | 2
modules/enterprise/server/plugins/url/pom.xml | 2
modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml | 2
modules/enterprise/server/plugins/yum/pom.xml | 2
modules/enterprise/server/pom.xml | 4
modules/enterprise/server/safe-invoker/pom.xml | 2
modules/enterprise/server/sars/pom.xml | 2
modules/enterprise/server/sars/services-sar/pom.xml | 2
modules/enterprise/server/startup-subsystem/pom.xml | 2
modules/enterprise/server/xml-schemas/pom.xml | 2
modules/helpers/bundleGen/pom.xml | 4
modules/helpers/jeeGen/pom.xml | 2
modules/helpers/perftest-support/pom.xml | 4
modules/helpers/pom.xml | 2
modules/helpers/rest-docs-generator/pom.xml | 2
modules/helpers/rtfilter-subsystem/pom.xml | 2
modules/helpers/rtfilter/pom.xml | 2
modules/integration-tests/apache-plugin-test/pom.xml | 40
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java | 33
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java | 88 +
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java | 115 +-
modules/integration-tests/jndi-access/jndi-access-test/pom.xml | 59 -
modules/integration-tests/jndi-access/pom.xml | 2
modules/integration-tests/jndi-access/remote-server/pom.xml | 2
modules/integration-tests/pom.xml | 2
modules/integration-tests/rest-api/pom.xml | 2
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java | 383 +++++++-
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java | 54 +
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java | 232 ++++
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java | 25
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java | 55 +
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Availability.java | 64 +
modules/plugins/aliases/pom.xml | 2
modules/plugins/ant-bundle/pom.xml | 2
modules/plugins/apache/pom.xml | 2
modules/plugins/augeas/pom.xml | 2
modules/plugins/byteman/pom.xml | 2
modules/plugins/cassandra/pom.xml | 2
modules/plugins/cobbler/pom.xml | 2
modules/plugins/cron/pom.xml | 2
modules/plugins/database/pom.xml | 2
modules/plugins/filetemplate-bundle/pom.xml | 2
modules/plugins/grub/pom.xml | 2
modules/plugins/hadoop/pom.xml | 2
modules/plugins/hibernate/pom.xml | 2
modules/plugins/hosts/pom.xml | 2
modules/plugins/hudson/pom.xml | 4
modules/plugins/iis/pom.xml | 2
modules/plugins/irc/pom.xml | 2
modules/plugins/jboss-as-5/pom.xml | 2
modules/plugins/jboss-as-7/pom.xml | 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java | 171 ++-
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java | 20
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 12
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java | 20
modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java | 1
modules/plugins/jboss-as/pom.xml | 2
modules/plugins/jboss-cache-v3/pom.xml | 2
modules/plugins/jboss-cache/pom.xml | 2
modules/plugins/jmx/pom.xml | 2
modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java | 20
modules/plugins/kickstart/pom.xml | 2
modules/plugins/mod-cluster/pom.xml | 2
modules/plugins/mysql/pom.xml | 2
modules/plugins/netservices/pom.xml | 468 ++++------
modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponent.java | 214 +++-
modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponentConfiguration.java | 57 +
modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponent.java | 51 -
modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceComponent.java | 77 -
modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponent.java | 41
modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml | 37
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponentTest.java | 178 +++
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponentTest.java | 105 ++
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java | 162 +++
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java | 154 +++
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PingNetServiceComponentTest.java | 98 ++
modules/plugins/netservices/src/test/resources/log4j.xml | 32
modules/plugins/noop/pom.xml | 2
modules/plugins/oracle/pom.xml | 2
modules/plugins/pattern-generator/pom.xml | 2
modules/plugins/perftest/pom.xml | 2
modules/plugins/platform/pom.xml | 2
modules/plugins/pom.xml | 36
modules/plugins/postfix/pom.xml | 2
modules/plugins/postgres/pom.xml | 2
modules/plugins/rhq-agent/pom.xml | 2
modules/plugins/rhq-server/pom.xml | 2
modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml | 7
modules/plugins/samba/pom.xml | 2
modules/plugins/script/pom.xml | 2
modules/plugins/script2/pom.xml | 2
modules/plugins/snmptrapd/pom.xml | 2
modules/plugins/sshd/pom.xml | 2
modules/plugins/sudoers/pom.xml | 2
modules/plugins/tomcat/pom.xml | 2
modules/plugins/twitter/pom.xml | 2
modules/plugins/validate-all-plugins/pom.xml | 2
modules/plugins/virt/pom.xml | 2
modules/pom.xml | 2
modules/test-utils/pom.xml | 2
pom.xml | 2
234 files changed, 4118 insertions(+), 1687 deletions(-)
New commits:
commit 95ea451aaf0d230c76f0e446e4965fb929250aa2
Merge: 0d09f03 c367f45
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Feb 26 09:35:51 2013 -0500
Merge branch 'master' into bug/783603
commit c367f45a05cd488d4822d51f4c6368f5924c8223
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Feb 21 11:34:05 2013 +0100
BZ911327 - [EAP 6.1] Restarting servers in server-group fails
While the bug was detected because of the underlying EAP operation failing, it appears that the RHQ timeout for this operation is pretty low. The operation timeout is now configurable and should be adjusted by users for their particular environment. It defaults to 2 minutes.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
index 71967e5..eb97042 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
@@ -55,29 +55,30 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* Component dealing with server group specific things
* @author Heiko W. Rupp
*/
-@SuppressWarnings("unused")
public class ServerGroupComponent extends BaseComponent implements ContentFacet, CreateChildResourceFacet,
OperationFacet {
- private static final String SUCCESS = "success";
private static final String OUTCOME = "outcome";
+ private static final String RESTART_SERVERS = "restart-servers";
@Override
public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException,
Exception {
-
Operation op = new Operation(name, getAddress());
- Result res = getASConnection().execute(op);
-
+ Result res = null;
+ if (RESTART_SERVERS.equals(name)) {
+ // This operation as a timeout parameter as it can run for quite a long time
+ res = getASConnection().execute(op, parameters.getSimple("responseTimeout").getIntegerValue());
+ } else {
+ res = getASConnection().execute(op);
+ }
OperationResult result = new OperationResult();
-
if (res.isSuccess()) {
- result.setSimpleResult(SUCCESS);
+ result.setSimpleResult(Result.SUCCESS);
} else {
result.setErrorMessage(res.getFailureDescription());
}
return result;
-
}
@Override
@@ -119,7 +120,7 @@ public class ServerGroupComponent extends BaseComponent implements ContentFacet,
if (uploadResult.has(OUTCOME)) {
String outcome = uploadResult.get(OUTCOME).getTextValue();
- if (outcome.equals(SUCCESS)) { // Upload was successful, so now add the file to the server group
+ if (outcome.equals(Result.SUCCESS)) { // Upload was successful, so now add the file to the server group
JsonNode resultNode = uploadResult.get("result");
String hash = resultNode.get("BYTES_VALUE").getTextValue();
ASConnection connection = getASConnection();
@@ -202,6 +203,7 @@ public class ServerGroupComponent extends BaseComponent implements ContentFacet,
return null; // TODO: Customise this generated block
}
+ @SuppressWarnings("unused")
private String serverGroupFromKey() {
String key1 = context.getResourceKey();
return key1.substring(key1.lastIndexOf("/") + 1);
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 2509073..cf01d5f 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1016,7 +1016,10 @@
<c:simple-property name="operationResult"/>
</results>
</operation>
- <operation name="restart-servers" description="Restarts all servers belonging to the server group currently running in the domain.">
+ <operation name="restart-servers" description="Restarts all servers belonging to the server group currently running in the domain." timeout="180">
+ <parameters>
+ <c:simple-property name="responseTimeout" default="120" type="long" description="Amount of time the agent will be waiting for domain host response. Defaults to 120 seconds." />
+ </parameters>
<results>
<c:simple-property name="operationResult"/>
</results>
commit 068f664483a2013fa84123cb6b6ba85b54ee7c5c
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Feb 25 16:36:41 2013 -0500
[Bug 881848 - Resource availability type remains in state unknown after application of workaround from bug 865166]
Ensure after upgrade that all resources, including those in the ADQ, have
at least an intial UNKNOWN Availability.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index d4bc14c..109eb3a 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -17,7 +17,7 @@
<description>Database schema setup, upgrade and other utilities</description>
<properties>
- <db.schema.version>2.128</db.schema.version>
+ <db.schema.version>2.129</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.server-name>${rhq.test.ds.server-name}</rhq.ds.server-name>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 19ac9dd..936c7bf 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -1944,6 +1944,7 @@
</schemaSpec>
<schemaSpec version="2.125">
+ <!-- Note, JON 3.1.2 includes this already but it is safe to re-execute -->
<!-- We were using a buggy version of password obfuscation from JBoss AS. This task sets the affected
passwords to NULL. Fortunately, this currently affects only CSP content sources, so the damage
is not huge from the user perspective. -->
@@ -1952,6 +1953,7 @@
<!-- BZ 865167 -->
<schemaSpec version="2.126">
+ <!-- Note, JON 3.1.2 includes this already but it is safe to re-execute -->
<schema-directSQL>
<statement targetDBVendor="postgresql">
INSERT INTO RHQ_RESOURCE_AVAIL ( ID, RESOURCE_ID, AVAILABILITY_TYPE )
@@ -1988,6 +1990,27 @@
</schema-directSQL>
</schemaSpec>
+<!-- RHQ 4.6.0 uses DB Schema 2.128 -->
+
+ <!-- BZ 881848 -->
+ <schemaSpec version="2.129">
+ <schema-directSQL>
+ <statement targetDBVendor="postgresql">
+ INSERT INTO RHQ_AVAILABILITY ( ID, RESOURCE_ID, START_TIME, END_TIME, AVAILABILITY_TYPE )
+ SELECT nextval('RHQ_AVAILABILITY_ID_SEQ'::text), res.ID, 0, NULL, 2
+ FROM RHQ_RESOURCE res
+ WHERE NOT EXISTS ( SELECT * FROM RHQ_AVAILABILITY WHERE RESOURCE_ID = res.ID )
+ </statement>
+ <statement targetDBVendor="oracle">
+ INSERT INTO RHQ_AVAILABILITY ( ID, RESOURCE_ID, START_TIME, END_TIME, AVAILABILITY_TYPE )
+ SELECT RHQ_AVAILABILITY_ID_SEQ.nextval, res.ID, 0, NULL, 2
+ FROM RHQ_RESOURCE res
+ WHERE NOT EXISTS ( SELECT * FROM RHQ_AVAILABILITY WHERE RESOURCE_ID = res.ID )
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
+
</dbupgrade>
</target>
</project>
commit c6ddc8538eb130703a276752b05e85b9da5faabc
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Feb 25 17:31:02 2013 -0600
Update development version to 4.7.0-SNAPSHOT.
diff --git a/code-coverage/pom.xml b/code-coverage/pom.xml
index 7bce055..cacf523 100644
--- a/code-coverage/pom.xml
+++ b/code-coverage/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>rhq-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-code-coverage</artifactId>
diff --git a/modules/cli-tests/pom.xml b/modules/cli-tests/pom.xml
index ecd5c00..394dc13 100644
--- a/modules/cli-tests/pom.xml
+++ b/modules/cli-tests/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/common/ant-bundle/pom.xml b/modules/common/ant-bundle/pom.xml
index f69c49e..111b6f0 100644
--- a/modules/common/ant-bundle/pom.xml
+++ b/modules/common/ant-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/common/drift/pom.xml b/modules/common/drift/pom.xml
index 2b0a46a..190bc89 100644
--- a/modules/common/drift/pom.xml
+++ b/modules/common/drift/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-common-drift</artifactId>
diff --git a/modules/common/filetemplate-bundle/pom.xml b/modules/common/filetemplate-bundle/pom.xml
index 7dc4571..32692b5 100644
--- a/modules/common/filetemplate-bundle/pom.xml
+++ b/modules/common/filetemplate-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-filetemplate-bundle-common</artifactId>
diff --git a/modules/common/jboss-as-dmr-client/pom.xml b/modules/common/jboss-as-dmr-client/pom.xml
index 260bd92..4f43692 100644
--- a/modules/common/jboss-as-dmr-client/pom.xml
+++ b/modules/common/jboss-as-dmr-client/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-jboss-as-dmr-client</artifactId>
diff --git a/modules/common/jboss-as/pom.xml b/modules/common/jboss-as/pom.xml
index c8f844c..17e5433 100644
--- a/modules/common/jboss-as/pom.xml
+++ b/modules/common/jboss-as/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-jboss-as-common</artifactId>
diff --git a/modules/common/pom.xml b/modules/common/pom.xml
index 960909d..4ed6d92 100644
--- a/modules/common/pom.xml
+++ b/modules/common/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/core/arquillian-integration/archive/pom.xml b/modules/core/arquillian-integration/archive/pom.xml
index 2e9dc48..7c7e949 100644
--- a/modules/core/arquillian-integration/archive/pom.xml
+++ b/modules/core/arquillian-integration/archive/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-arquillian-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<!-- Model Version -->
diff --git a/modules/core/arquillian-integration/container/pom.xml b/modules/core/arquillian-integration/container/pom.xml
index 65043aa..50e0fed 100644
--- a/modules/core/arquillian-integration/container/pom.xml
+++ b/modules/core/arquillian-integration/container/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-arquillian-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<!-- Model Version -->
diff --git a/modules/core/arquillian-integration/pom.xml b/modules/core/arquillian-integration/pom.xml
index cbdc2a9..fb6f3ee 100644
--- a/modules/core/arquillian-integration/pom.xml
+++ b/modules/core/arquillian-integration/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/arquillian-integration/suite-extension/pom.xml b/modules/core/arquillian-integration/suite-extension/pom.xml
index 3ccb886..5d80c3f 100644
--- a/modules/core/arquillian-integration/suite-extension/pom.xml
+++ b/modules/core/arquillian-integration/suite-extension/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-arquillian-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<!-- Model Version -->
diff --git a/modules/core/client-api/pom.xml b/modules/core/client-api/pom.xml
index ee8f1dc..a4f4b9e 100644
--- a/modules/core/client-api/pom.xml
+++ b/modules/core/client-api/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/comm-api/pom.xml b/modules/core/comm-api/pom.xml
index bf4b745..9fd9f98 100644
--- a/modules/core/comm-api/pom.xml
+++ b/modules/core/comm-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index aa9a2ce..d4bc14c 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index 21af6e4..9775aa6 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-domain</artifactId>
diff --git a/modules/core/gui/pom.xml b/modules/core/gui/pom.xml
index d17353c..9f1b724 100644
--- a/modules/core/gui/pom.xml
+++ b/modules/core/gui/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/native-system/pom.xml b/modules/core/native-system/pom.xml
index 08e5675..21f1c48 100644
--- a/modules/core/native-system/pom.xml
+++ b/modules/core/native-system/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/core/plugin-api/pom.xml b/modules/core/plugin-api/pom.xml
index fd717f7..4b828f7 100644
--- a/modules/core/plugin-api/pom.xml
+++ b/modules/core/plugin-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/plugin-container-itest/pom.xml b/modules/core/plugin-container-itest/pom.xml
index f439dab..900eb72 100644
--- a/modules/core/plugin-container-itest/pom.xml
+++ b/modules/core/plugin-container-itest/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-plugin-container-itest</artifactId>
diff --git a/modules/core/plugin-container/pom.xml b/modules/core/plugin-container/pom.xml
index f7451c5..8bff199 100644
--- a/modules/core/plugin-container/pom.xml
+++ b/modules/core/plugin-container/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-plugin-container</artifactId>
diff --git a/modules/core/plugin-test-api/pom.xml b/modules/core/plugin-test-api/pom.xml
index 5d80afc..f7abec9 100644
--- a/modules/core/plugin-test-api/pom.xml
+++ b/modules/core/plugin-test-api/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-plugin-test-api</artifactId>
diff --git a/modules/core/plugin-test-util/pom.xml b/modules/core/plugin-test-util/pom.xml
index 40d29ec..dbb97fe 100644
--- a/modules/core/plugin-test-util/pom.xml
+++ b/modules/core/plugin-test-util/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/plugin-validator/pom.xml b/modules/core/plugin-validator/pom.xml
index aff829f..fc8ff80 100644
--- a/modules/core/plugin-validator/pom.xml
+++ b/modules/core/plugin-validator/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/plugindoc/pom.xml b/modules/core/plugindoc/pom.xml
index e8a53b5..4528810 100644
--- a/modules/core/plugindoc/pom.xml
+++ b/modules/core/plugindoc/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index d0eff4c..c51fb51 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/core/util/pom.xml b/modules/core/util/pom.xml
index ef4b285..ff2a247 100644
--- a/modules/core/util/pom.xml
+++ b/modules/core/util/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-util</artifactId>
diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml
index f8c7720..99f9b40 100644
--- a/modules/enterprise/agent/pom.xml
+++ b/modules/enterprise/agent/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/agentupdate/pom.xml b/modules/enterprise/agentupdate/pom.xml
index b26d8e3..ba0d852 100644
--- a/modules/enterprise/agentupdate/pom.xml
+++ b/modules/enterprise/agentupdate/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml
index 709a213..1ddf893 100644
--- a/modules/enterprise/binding/pom.xml
+++ b/modules/enterprise/binding/pom.xml
@@ -3,10 +3,10 @@
<parent>
<artifactId>rhq-enterprise-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-script-bindings</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Script Bindings</name>
<description>Abstraction of different facilities and default configurations for script bindings</description>
diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml
index 48fad0c..cf5b95f 100644
--- a/modules/enterprise/comm/pom.xml
+++ b/modules/enterprise/comm/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/content_http-war/pom.xml b/modules/enterprise/gui/content_http-war/pom.xml
index 104b50d..61abd3a 100644
--- a/modules/enterprise/gui/content_http-war/pom.xml
+++ b/modules/enterprise/gui/content_http-war/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-gui-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index 0f58d9b..f60ae8b 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/pom.xml b/modules/enterprise/gui/pom.xml
index f864813..b71b130 100644
--- a/modules/enterprise/gui/pom.xml
+++ b/modules/enterprise/gui/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/portal-war/pom.xml b/modules/enterprise/gui/portal-war/pom.xml
index d032b6d..9795f49 100644
--- a/modules/enterprise/gui/portal-war/pom.xml
+++ b/modules/enterprise/gui/portal-war/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/rest-examples-war/pom.xml b/modules/enterprise/gui/rest-examples-war/pom.xml
index 1eb1ad2..87354d1 100644
--- a/modules/enterprise/gui/rest-examples-war/pom.xml
+++ b/modules/enterprise/gui/rest-examples-war/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/rest-war/pom.xml b/modules/enterprise/gui/rest-war/pom.xml
index 9e1ac5a..1b5349c 100644
--- a/modules/enterprise/gui/rest-war/pom.xml
+++ b/modules/enterprise/gui/rest-war/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/pom.xml b/modules/enterprise/pom.xml
index 7fe3331..489d603 100644
--- a/modules/enterprise/pom.xml
+++ b/modules/enterprise/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml
index e6daa0f..ee672e2 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/client-api/pom.xml b/modules/enterprise/remoting/client-api/pom.xml
index c2addd5..8f0978c 100644
--- a/modules/enterprise/remoting/client-api/pom.xml
+++ b/modules/enterprise/remoting/client-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/client-deps/pom.xml b/modules/enterprise/remoting/client-deps/pom.xml
index 0c81641..006a9a6 100644
--- a/modules/enterprise/remoting/client-deps/pom.xml
+++ b/modules/enterprise/remoting/client-deps/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/pom.xml b/modules/enterprise/remoting/pom.xml
index 3e76a1c..3ab9e66 100644
--- a/modules/enterprise/remoting/pom.xml
+++ b/modules/enterprise/remoting/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/scripting/api/pom.xml b/modules/enterprise/scripting/api/pom.xml
index 2a705b3..5fdffe3 100644
--- a/modules/enterprise/scripting/api/pom.xml
+++ b/modules/enterprise/scripting/api/pom.xml
@@ -3,10 +3,10 @@
<parent>
<artifactId>rhq-scripting-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-api</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Scripting API</name>
<description>Provides API for adding scripting support to RHQ using different javax.scripting - based interpreters</description>
diff --git a/modules/enterprise/scripting/javascript/pom.xml b/modules/enterprise/scripting/javascript/pom.xml
index c2363a5..208076a 100644
--- a/modules/enterprise/scripting/javascript/pom.xml
+++ b/modules/enterprise/scripting/javascript/pom.xml
@@ -4,10 +4,10 @@
<parent>
<artifactId>rhq-scripting-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-javascript</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Javascript support</name>
<description>Provides RHQ scripting in Javascript using Rhino</description>
diff --git a/modules/enterprise/scripting/pom.xml b/modules/enterprise/scripting/pom.xml
index d6faff8..5c82958 100644
--- a/modules/enterprise/scripting/pom.xml
+++ b/modules/enterprise/scripting/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>rhq-enterprise-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-parent</artifactId>
<packaging>pom</packaging>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Scripting Parent Module</name>
<modules>
diff --git a/modules/enterprise/scripting/python/pom.xml b/modules/enterprise/scripting/python/pom.xml
index 34e5231..ab12edf 100644
--- a/modules/enterprise/scripting/python/pom.xml
+++ b/modules/enterprise/scripting/python/pom.xml
@@ -3,10 +3,10 @@
<parent>
<artifactId>rhq-scripting-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-python</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Python support</name>
<description>Provides RHQ scripting in Python using Jython</description>
diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml
index d8c7d6f..2ffdc7c 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/client-api/pom.xml b/modules/enterprise/server/client-api/pom.xml
index 87a99b7..ac92aec 100644
--- a/modules/enterprise/server/client-api/pom.xml
+++ b/modules/enterprise/server/client-api/pom.xml
@@ -5,13 +5,13 @@
<parent>
<artifactId>rhq-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-server-client-api</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Client API</name>
<description>The implementation of the client API when accessing the server locally</description>
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index 09b0def..d6a38d8 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index a1b2dab..83b8977 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml
index 49d79f5..cf6aa8d 100644
--- a/modules/enterprise/server/itests-2/pom.xml
+++ b/modules/enterprise/server/itests-2/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index 2eb3668..d59460f 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/plugins/alert-cli/pom.xml b/modules/enterprise/server/plugins/alert-cli/pom.xml
index 6a9c1fd..68ea87a 100644
--- a/modules/enterprise/server/plugins/alert-cli/pom.xml
+++ b/modules/enterprise/server/plugins/alert-cli/pom.xml
@@ -3,11 +3,11 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
<artifactId>alert-cli</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server CLI Script Alert Plugin</name>
<description>An alert sender able to execute an arbitrary CLI script as a response to an alert</description>
diff --git a/modules/enterprise/server/plugins/alert-email/pom.xml b/modules/enterprise/server/plugins/alert-email/pom.xml
index cfd0d9b..ec91baf 100644
--- a/modules/enterprise/server/plugins/alert-email/pom.xml
+++ b/modules/enterprise/server/plugins/alert-email/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq.server</groupId>
<artifactId>alert-email</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Email Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-irc/pom.xml b/modules/enterprise/server/plugins/alert-irc/pom.xml
index 67fa7a2..ea7bd90 100644
--- a/modules/enterprise/server/plugins/alert-irc/pom.xml
+++ b/modules/enterprise/server/plugins/alert-irc/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-irc</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server IRC Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-log4j/pom.xml b/modules/enterprise/server/plugins/alert-log4j/pom.xml
index 358861c..c50b5cb 100644
--- a/modules/enterprise/server/plugins/alert-log4j/pom.xml
+++ b/modules/enterprise/server/plugins/alert-log4j/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-log4j</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Log4J Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-microblog/pom.xml b/modules/enterprise/server/plugins/alert-microblog/pom.xml
index eecd72a..c576b41 100644
--- a/modules/enterprise/server/plugins/alert-microblog/pom.xml
+++ b/modules/enterprise/server/plugins/alert-microblog/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-microblog</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Microblog Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-mobicents/pom.xml b/modules/enterprise/server/plugins/alert-mobicents/pom.xml
index 975858f..5d9fb43 100644
--- a/modules/enterprise/server/plugins/alert-mobicents/pom.xml
+++ b/modules/enterprise/server/plugins/alert-mobicents/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-mobicents</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Mobicents Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-operations/pom.xml b/modules/enterprise/server/plugins/alert-operations/pom.xml
index 90df568..3b08f01 100644
--- a/modules/enterprise/server/plugins/alert-operations/pom.xml
+++ b/modules/enterprise/server/plugins/alert-operations/pom.xml
@@ -2,14 +2,14 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-operations</artifactId>
<packaging>jar</packaging>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Opertions Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-roles/pom.xml b/modules/enterprise/server/plugins/alert-roles/pom.xml
index 7ba6e6f..4f8c6a5 100644
--- a/modules/enterprise/server/plugins/alert-roles/pom.xml
+++ b/modules/enterprise/server/plugins/alert-roles/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-roles</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Roles Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-snmp/pom.xml b/modules/enterprise/server/plugins/alert-snmp/pom.xml
index dfb59aa..909053a 100644
--- a/modules/enterprise/server/plugins/alert-snmp/pom.xml
+++ b/modules/enterprise/server/plugins/alert-snmp/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-snmp</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server SNMP Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-subject/pom.xml b/modules/enterprise/server/plugins/alert-subject/pom.xml
index de85cf5..cd0263b 100644
--- a/modules/enterprise/server/plugins/alert-subject/pom.xml
+++ b/modules/enterprise/server/plugins/alert-subject/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-subject</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Subject Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml b/modules/enterprise/server/plugins/ant-bundle/pom.xml
index 6a1b367..6f636d5 100644
--- a/modules/enterprise/server/plugins/ant-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/cobbler/pom.xml b/modules/enterprise/server/plugins/cobbler/pom.xml
index 5b41896..2c81751 100644
--- a/modules/enterprise/server/plugins/cobbler/pom.xml
+++ b/modules/enterprise/server/plugins/cobbler/pom.xml
@@ -4,14 +4,14 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>rhq-serverplugin-cobbler</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Cobbler Plugin</name>
diff --git a/modules/enterprise/server/plugins/disk/pom.xml b/modules/enterprise/server/plugins/disk/pom.xml
index 570caa3..5ecb7a9 100644
--- a/modules/enterprise/server/plugins/disk/pom.xml
+++ b/modules/enterprise/server/plugins/disk/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/drift-rhq/pom.xml b/modules/enterprise/server/plugins/drift-rhq/pom.xml
index 0afed7e..52b3a7c 100644
--- a/modules/enterprise/server/plugins/drift-rhq/pom.xml
+++ b/modules/enterprise/server/plugins/drift-rhq/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
index 7d0ba17..b43da47 100644
--- a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/jboss-software/pom.xml b/modules/enterprise/server/plugins/jboss-software/pom.xml
index 55b2aea..3d31342 100644
--- a/modules/enterprise/server/plugins/jboss-software/pom.xml
+++ b/modules/enterprise/server/plugins/jboss-software/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/packagetype-cli/pom.xml b/modules/enterprise/server/plugins/packagetype-cli/pom.xml
index 38bb3f4..80799ab 100644
--- a/modules/enterprise/server/plugins/packagetype-cli/pom.xml
+++ b/modules/enterprise/server/plugins/packagetype-cli/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>packagetype-cli</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server CLI Package Type Plugin</name>
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml
index 77f4d79..827bc41 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/plugins/url/pom.xml b/modules/enterprise/server/plugins/url/pom.xml
index e4f17ed..f677d6a 100644
--- a/modules/enterprise/server/plugins/url/pom.xml
+++ b/modules/enterprise/server/plugins/url/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
index bd8c3b1..0d80df3 100644
--- a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
+++ b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/yum/pom.xml b/modules/enterprise/server/plugins/yum/pom.xml
index 75c478c..75b3cdc 100644
--- a/modules/enterprise/server/plugins/yum/pom.xml
+++ b/modules/enterprise/server/plugins/yum/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/pom.xml b/modules/enterprise/server/pom.xml
index d64e981..494e98e 100644
--- a/modules/enterprise/server/pom.xml
+++ b/modules/enterprise/server/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/safe-invoker/pom.xml b/modules/enterprise/server/safe-invoker/pom.xml
index d216e87..8c509f4 100644
--- a/modules/enterprise/server/safe-invoker/pom.xml
+++ b/modules/enterprise/server/safe-invoker/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/sars/pom.xml b/modules/enterprise/server/sars/pom.xml
index 2fad1d7..2b00e67 100644
--- a/modules/enterprise/server/sars/pom.xml
+++ b/modules/enterprise/server/sars/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/sars/services-sar/pom.xml b/modules/enterprise/server/sars/services-sar/pom.xml
index 40044b2..413c681 100644
--- a/modules/enterprise/server/sars/services-sar/pom.xml
+++ b/modules/enterprise/server/sars/services-sar/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-sars-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/startup-subsystem/pom.xml b/modules/enterprise/server/startup-subsystem/pom.xml
index a7ed12f..3359f33 100644
--- a/modules/enterprise/server/startup-subsystem/pom.xml
+++ b/modules/enterprise/server/startup-subsystem/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/xml-schemas/pom.xml b/modules/enterprise/server/xml-schemas/pom.xml
index a060587..9c1bfdd 100644
--- a/modules/enterprise/server/xml-schemas/pom.xml
+++ b/modules/enterprise/server/xml-schemas/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/helpers/bundleGen/pom.xml b/modules/helpers/bundleGen/pom.xml
index c83a433..1c570fc 100644
--- a/modules/helpers/bundleGen/pom.xml
+++ b/modules/helpers/bundleGen/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq.helpers</groupId>
<artifactId>bundleGen</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<build>
<plugins>
diff --git a/modules/helpers/jeeGen/pom.xml b/modules/helpers/jeeGen/pom.xml
index 14530ff..348b780 100644
--- a/modules/helpers/jeeGen/pom.xml
+++ b/modules/helpers/jeeGen/pom.xml
@@ -9,7 +9,7 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
diff --git a/modules/helpers/perftest-support/pom.xml b/modules/helpers/perftest-support/pom.xml
index 3350726..ceb5377 100644
--- a/modules/helpers/perftest-support/pom.xml
+++ b/modules/helpers/perftest-support/pom.xml
@@ -3,11 +3,11 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
<artifactId>perftest-support</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>Performance Testing Support</name>
<description>To support performance testing, this is a basic tool to support extracting and later reimporting of
data from/to a database.
diff --git a/modules/helpers/pom.xml b/modules/helpers/pom.xml
index 20f1f76..bd47d23 100644
--- a/modules/helpers/pom.xml
+++ b/modules/helpers/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/helpers/rest-docs-generator/pom.xml b/modules/helpers/rest-docs-generator/pom.xml
index f97d2de..0996c3b 100644
--- a/modules/helpers/rest-docs-generator/pom.xml
+++ b/modules/helpers/rest-docs-generator/pom.xml
@@ -24,7 +24,7 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/modules/helpers/rtfilter-subsystem/pom.xml b/modules/helpers/rtfilter-subsystem/pom.xml
index d08c7c6..f3cbb2e 100644
--- a/modules/helpers/rtfilter-subsystem/pom.xml
+++ b/modules/helpers/rtfilter-subsystem/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq.helpers</groupId>
<artifactId>rhq-helpers</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
diff --git a/modules/helpers/rtfilter/pom.xml b/modules/helpers/rtfilter/pom.xml
index dcb0402..98b8667 100644
--- a/modules/helpers/rtfilter/pom.xml
+++ b/modules/helpers/rtfilter/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq.helpers</groupId>
<artifactId>rhq-helpers</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
diff --git a/modules/integration-tests/apache-plugin-test/pom.xml b/modules/integration-tests/apache-plugin-test/pom.xml
index e161160..ce66fd5 100644
--- a/modules/integration-tests/apache-plugin-test/pom.xml
+++ b/modules/integration-tests/apache-plugin-test/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>rhq-integration-tests</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
index b20dfa0..e574631 100644
--- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
+++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>jndi-access-test-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>jndi-access-test</artifactId>
diff --git a/modules/integration-tests/jndi-access/pom.xml b/modules/integration-tests/jndi-access/pom.xml
index 8dfe58e..caef075 100644
--- a/modules/integration-tests/jndi-access/pom.xml
+++ b/modules/integration-tests/jndi-access/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>rhq-integration-tests</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/integration-tests/jndi-access/remote-server/pom.xml b/modules/integration-tests/jndi-access/remote-server/pom.xml
index 2bc2fdd..fd7e312 100644
--- a/modules/integration-tests/jndi-access/remote-server/pom.xml
+++ b/modules/integration-tests/jndi-access/remote-server/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>jndi-access-test-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>jndi-access-remote-server</artifactId>
diff --git a/modules/integration-tests/pom.xml b/modules/integration-tests/pom.xml
index 4c31380..f110387 100644
--- a/modules/integration-tests/pom.xml
+++ b/modules/integration-tests/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/modules/integration-tests/rest-api/pom.xml b/modules/integration-tests/rest-api/pom.xml
index 3ba07c4..cea2a5c 100644
--- a/modules/integration-tests/rest-api/pom.xml
+++ b/modules/integration-tests/rest-api/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-integration-tests</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/modules/plugins/aliases/pom.xml b/modules/plugins/aliases/pom.xml
index 2244a12..a7a4469 100644
--- a/modules/plugins/aliases/pom.xml
+++ b/modules/plugins/aliases/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml
index 172cce8..5390fcc 100644
--- a/modules/plugins/ant-bundle/pom.xml
+++ b/modules/plugins/ant-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/apache/pom.xml b/modules/plugins/apache/pom.xml
index e887a4e..2ca9086 100644
--- a/modules/plugins/apache/pom.xml
+++ b/modules/plugins/apache/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/augeas/pom.xml b/modules/plugins/augeas/pom.xml
index 3617648..9a8acb4 100644
--- a/modules/plugins/augeas/pom.xml
+++ b/modules/plugins/augeas/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/byteman/pom.xml b/modules/plugins/byteman/pom.xml
index 8366602..6a85842 100644
--- a/modules/plugins/byteman/pom.xml
+++ b/modules/plugins/byteman/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml
index d8cfd68..ac3d8ff 100644
--- a/modules/plugins/cassandra/pom.xml
+++ b/modules/plugins/cassandra/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/cobbler/pom.xml b/modules/plugins/cobbler/pom.xml
index b333ad2..8321f4e 100644
--- a/modules/plugins/cobbler/pom.xml
+++ b/modules/plugins/cobbler/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/cron/pom.xml b/modules/plugins/cron/pom.xml
index b0e4004..6ed701b 100644
--- a/modules/plugins/cron/pom.xml
+++ b/modules/plugins/cron/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/database/pom.xml b/modules/plugins/database/pom.xml
index eaf49b8..7959a32 100644
--- a/modules/plugins/database/pom.xml
+++ b/modules/plugins/database/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/filetemplate-bundle/pom.xml b/modules/plugins/filetemplate-bundle/pom.xml
index 70f6d22..c67fc10 100644
--- a/modules/plugins/filetemplate-bundle/pom.xml
+++ b/modules/plugins/filetemplate-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/grub/pom.xml b/modules/plugins/grub/pom.xml
index 0b00df8..d77acf5 100644
--- a/modules/plugins/grub/pom.xml
+++ b/modules/plugins/grub/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/hadoop/pom.xml b/modules/plugins/hadoop/pom.xml
index 9d488f5..1a6c591 100644
--- a/modules/plugins/hadoop/pom.xml
+++ b/modules/plugins/hadoop/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/hibernate/pom.xml b/modules/plugins/hibernate/pom.xml
index a0eac76..0303046 100644
--- a/modules/plugins/hibernate/pom.xml
+++ b/modules/plugins/hibernate/pom.xml
@@ -6,7 +6,7 @@
<groupId>org.rhq</groupId>
<!-- Bypass the jopr-plugins-parent which can not have children. It must build after the plugins in order to execute integration tests on them. -->
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/hosts/pom.xml b/modules/plugins/hosts/pom.xml
index 06315b2..467397e 100644
--- a/modules/plugins/hosts/pom.xml
+++ b/modules/plugins/hosts/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/hudson/pom.xml b/modules/plugins/hudson/pom.xml
index 9c7f6d2..1a8d193 100644
--- a/modules/plugins/hudson/pom.xml
+++ b/modules/plugins/hudson/pom.xml
@@ -6,12 +6,12 @@
<parent>
<artifactId>rhq-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-hudson-plugin</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>RHQ Hudson Plugin</name>
diff --git a/modules/plugins/iis/pom.xml b/modules/plugins/iis/pom.xml
index b8f1f5a..69f1dbb 100644
--- a/modules/plugins/iis/pom.xml
+++ b/modules/plugins/iis/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/irc/pom.xml b/modules/plugins/irc/pom.xml
index 9787a1d..fc69a41 100644
--- a/modules/plugins/irc/pom.xml
+++ b/modules/plugins/irc/pom.xml
@@ -5,7 +5,7 @@
<parent>
<artifactId>rhq-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml
index 9c71f33..f2a81a1 100644
--- a/modules/plugins/jboss-as-5/pom.xml
+++ b/modules/plugins/jboss-as-5/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 75d5b51..1f63c91 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml
index 53e8149..d1f4c74 100644
--- a/modules/plugins/jboss-as/pom.xml
+++ b/modules/plugins/jboss-as/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jboss-cache-v3/pom.xml b/modules/plugins/jboss-cache-v3/pom.xml
index aa4f232..34bdffe 100644
--- a/modules/plugins/jboss-cache-v3/pom.xml
+++ b/modules/plugins/jboss-cache-v3/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jboss-cache/pom.xml b/modules/plugins/jboss-cache/pom.xml
index 35d919b..421f24d 100644
--- a/modules/plugins/jboss-cache/pom.xml
+++ b/modules/plugins/jboss-cache/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jmx/pom.xml b/modules/plugins/jmx/pom.xml
index 16d4245..48e3f93 100644
--- a/modules/plugins/jmx/pom.xml
+++ b/modules/plugins/jmx/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/kickstart/pom.xml b/modules/plugins/kickstart/pom.xml
index 5d85bc4..9255d09 100644
--- a/modules/plugins/kickstart/pom.xml
+++ b/modules/plugins/kickstart/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/mod-cluster/pom.xml b/modules/plugins/mod-cluster/pom.xml
index 64620e1..804b04a 100644
--- a/modules/plugins/mod-cluster/pom.xml
+++ b/modules/plugins/mod-cluster/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/mysql/pom.xml b/modules/plugins/mysql/pom.xml
index 9e5a24e..14e39a3 100644
--- a/modules/plugins/mysql/pom.xml
+++ b/modules/plugins/mysql/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 4afa8a5..184f1db 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/noop/pom.xml b/modules/plugins/noop/pom.xml
index 1ab336f..1f43ea4 100644
--- a/modules/plugins/noop/pom.xml
+++ b/modules/plugins/noop/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/oracle/pom.xml b/modules/plugins/oracle/pom.xml
index 5ce8144..dc4f4aa 100644
--- a/modules/plugins/oracle/pom.xml
+++ b/modules/plugins/oracle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/pattern-generator/pom.xml b/modules/plugins/pattern-generator/pom.xml
index b8fdab2..7fe46e5 100644
--- a/modules/plugins/pattern-generator/pom.xml
+++ b/modules/plugins/pattern-generator/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/perftest/pom.xml b/modules/plugins/perftest/pom.xml
index e8b68fe..7ccffa7 100644
--- a/modules/plugins/perftest/pom.xml
+++ b/modules/plugins/perftest/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/platform/pom.xml b/modules/plugins/platform/pom.xml
index 143872e..ef210b6 100644
--- a/modules/plugins/platform/pom.xml
+++ b/modules/plugins/platform/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index 73947ae..9af3938 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/plugins/postfix/pom.xml b/modules/plugins/postfix/pom.xml
index 29ea010..69a3b7d 100644
--- a/modules/plugins/postfix/pom.xml
+++ b/modules/plugins/postfix/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/postgres/pom.xml b/modules/plugins/postgres/pom.xml
index c565c89..1e323fb 100644
--- a/modules/plugins/postgres/pom.xml
+++ b/modules/plugins/postgres/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/rhq-agent/pom.xml b/modules/plugins/rhq-agent/pom.xml
index 1dcf822..e187c17 100644
--- a/modules/plugins/rhq-agent/pom.xml
+++ b/modules/plugins/rhq-agent/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/rhq-server/pom.xml b/modules/plugins/rhq-server/pom.xml
index 9d1557b..5327977 100644
--- a/modules/plugins/rhq-server/pom.xml
+++ b/modules/plugins/rhq-server/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/samba/pom.xml b/modules/plugins/samba/pom.xml
index dd8150c..a392c58 100644
--- a/modules/plugins/samba/pom.xml
+++ b/modules/plugins/samba/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/script/pom.xml b/modules/plugins/script/pom.xml
index 77d117e..3772829 100644
--- a/modules/plugins/script/pom.xml
+++ b/modules/plugins/script/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/script2/pom.xml b/modules/plugins/script2/pom.xml
index 672ac51..3bec031 100644
--- a/modules/plugins/script2/pom.xml
+++ b/modules/plugins/script2/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/snmptrapd/pom.xml b/modules/plugins/snmptrapd/pom.xml
index 35121e0..4805c8f 100644
--- a/modules/plugins/snmptrapd/pom.xml
+++ b/modules/plugins/snmptrapd/pom.xml
@@ -2,7 +2,7 @@
<parent>
<artifactId>rhq-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/modules/plugins/sshd/pom.xml b/modules/plugins/sshd/pom.xml
index 6d880e3..92e76ef 100644
--- a/modules/plugins/sshd/pom.xml
+++ b/modules/plugins/sshd/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/sudoers/pom.xml b/modules/plugins/sudoers/pom.xml
index 91bfbee..053fac0 100644
--- a/modules/plugins/sudoers/pom.xml
+++ b/modules/plugins/sudoers/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/tomcat/pom.xml b/modules/plugins/tomcat/pom.xml
index 52c9b13..9ded2f5 100644
--- a/modules/plugins/tomcat/pom.xml
+++ b/modules/plugins/tomcat/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/twitter/pom.xml b/modules/plugins/twitter/pom.xml
index 6b0ad95..6f00f3f 100644
--- a/modules/plugins/twitter/pom.xml
+++ b/modules/plugins/twitter/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/validate-all-plugins/pom.xml b/modules/plugins/validate-all-plugins/pom.xml
index fbc5f94..1e8c6fc 100644
--- a/modules/plugins/validate-all-plugins/pom.xml
+++ b/modules/plugins/validate-all-plugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/virt/pom.xml b/modules/plugins/virt/pom.xml
index a2a48da..1c2bbca 100644
--- a/modules/plugins/virt/pom.xml
+++ b/modules/plugins/virt/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/pom.xml b/modules/pom.xml
index d1745b2..82d911d 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/test-utils/pom.xml b/modules/test-utils/pom.xml
index a04cf92..ee5bbfd 100644
--- a/modules/test-utils/pom.xml
+++ b/modules/test-utils/pom.xml
@@ -7,7 +7,7 @@
<parent>
<artifactId>rhq-modules-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>test-utils</artifactId>
diff --git a/pom.xml b/pom.xml
index 711cad0..afd1a61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>RHQ</name>
commit 503f985d13d376f388b3cf1842f3e2904f5ed549
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 22 15:28:28 2013 -0500
Don't access the resource to delete transactionally and hold it while trying
to then uninventory it via slsb calls. This could cause a deadlock.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
index 1fcda30..213d75d 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
@@ -105,26 +105,21 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
@Override
protected void afterMethod() throws Exception {
try {
+ prepareForTestAgents();
+
if (theResource != null) {
// perform in-band and out-of-band work in quick succession
// this also deletes our attached agent
- prepareForTestAgents();
resourceManager.uninventoryResource(overlord, theResource.getId());
resourceManager.uninventoryResourceAsyncWork(overlord, theResource.getId());
- unprepareForTestAgents();
theResource = null;
}
if (additionalResources != null) {
- getTransactionManager().begin();
-
for (Resource res : additionalResources) {
- Resource res2 = em.find(Resource.class, res.getId());
- resourceManager.uninventoryResource(overlord, res2.getId());
- resourceManager.uninventoryResourceAsyncWork(overlord, res2.getId());
-
+ resourceManager.uninventoryResource(overlord, res.getId());
+ resourceManager.uninventoryResourceAsyncWork(overlord, res.getId());
}
- getTransactionManager().commit();
}
if (theResourceType != null) {
@@ -141,6 +136,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
}
finally {
+ unprepareForTestAgents();
unprepareScheduler();
unprepareServerPluginService();
testServerPluginService.stopMasterPluginContainer();
@@ -280,7 +276,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
// platform: UNKNOWN(0) -->
commitAndClose();
-
AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
availPoints = availabilityManager.findAvailabilitiesForResource(overlord, theResource.getId(), 1,
@@ -431,7 +426,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
// setAllAgentResourceAvails will only operate on those that have at least 1 avail row
Availability avail = new Availability(theResource, UNKNOWN);
persistAvailability(avail);
@@ -461,7 +455,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
// have never heard from the new agent yet - we do not backfill anything in this case
LookupUtil.getAgentManager().checkForSuspectAgents();
assert availabilityManager.getCurrentAvailabilityTypeForResource(overlord, theResource.getId()) == UNKNOWN;
@@ -491,7 +484,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
// add a report that says the resource was up 20 minutes ago
Availability avail = new Availability(theResource, (System.currentTimeMillis() - 12000000), UP);
AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
@@ -507,7 +499,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
agent.setLastAvailabilityPing(System.currentTimeMillis() - (1000 * 60 * 18)); // 18 mins
commitAndClose();
-
// the agent should be suspect and will be considered down, the platform resource should be down
// (although children should be UNKNOWN)
LookupUtil.getAgentManager().checkForSuspectAgents(); // checks for 5 mins !!
@@ -523,7 +514,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
assert allAvails.size() == 3;
commitAndClose();
-
Availability a1 = allAvails.get(0);
Availability a2 = allAvails.get(1);
Availability a3 = allAvails.get(2);
@@ -571,7 +561,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
commitAndClose();
-
for (Resource res : allResources) {
int resId = res.getId();
Availability currentAvailability = availabilityManager.getCurrentAvailabilityForResource(overlord,
@@ -600,7 +589,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
agent.setLastAvailabilityPing(System.currentTimeMillis() - (1000 * 60 * 18)); // 18 mins
commitAndClose();
-
// the agent should be suspect and will be considered down. the resources have their initial
// UNKNOWN avails. The platform should get a new DOWN Availability row. The rest should remain
// as is since they are already UNKNOWN.
@@ -641,7 +629,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
agent.setLastAvailabilityPing(System.currentTimeMillis() - (1000 * 60 * 18));
commitAndClose();
-
// the agent should be suspect and will be considered down
// all of the resources have availabilities now, so another row will be added to them if they are not disabled
start = System.currentTimeMillis();
@@ -670,7 +657,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
assert allAvails.size() == ((expected == DOWN) ? 4 : ((expected == DISABLED) ? 2 : 3)) : allAvails;
commitAndClose();
-
Availability a0 = allAvails.get(0);
Availability a1 = allAvails.get(1);
Availability a2 = null;
@@ -716,7 +702,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
System.out.println("testAgentBackfillPerformance: checking validity of data took "
+ (System.currentTimeMillis() - start) + "ms");
-
} catch (Exception e) {
e.printStackTrace();
throw e;
@@ -737,7 +722,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource(); // inserts initial UNKNOWN Availability at epoch
commitAndClose();
-
Availability avail;
long now = System.currentTimeMillis();
@@ -824,7 +808,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
long now = System.currentTimeMillis();
// add a report that says the resource is down - reports can't have the same resource in it twice,
@@ -885,7 +868,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
Calendar cal = Calendar.getInstance();
cal.set(Calendar.YEAR, 2000);
cal.set(Calendar.MONTH, 0);
@@ -973,7 +955,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
setupResource();
commitAndClose();
-
long allAvailCount = setUpAvailabilities();
// we now have 1:00 UP, 1:20 DOWN, 1:40 UP
@@ -1170,7 +1151,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
avail = avails.get(0); // 0..1:00
assertTrue(avail.toString(), Math.abs(avail.getStartTime() - 0L) < 1000L);
assertEquals(avail.toString(), AvailabilityType.UNKNOWN, avail.getAvailabilityType());
- assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(1).getStartTime()) < 1000L);
+ assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(1).getStartTime()) < 1000L);
avail = avails.get(1); // 1:00..1:20
assertTrue(avail.toString(), Math.abs(currentStartTime - (avail.getStartTime() + (40 * 60 * 1000))) < 1000L);
assertEquals(avail.toString(), AvailabilityType.UP, avail.getAvailabilityType());
@@ -1297,7 +1278,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
commitAndClose();
-
// add a report that says the resources are now up - the report will add one avail for each resource
// at this point, the resources do not yet have a row in availability - after the merge they will have 1
AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
@@ -1371,7 +1351,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
System.out.println("testMergeReportPerformance: checking validity of data 3 took "
+ (System.currentTimeMillis() - start) + "ms");
-
} catch (Exception e) {
e.printStackTrace();
throw e;
commit 17aa29bfb17f8e4ab25f7f26c852a386985c6781
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 22 10:42:48 2013 -0500
Fix tests so they run on windows as well.
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java
index bb8adcd..534e9f4 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java
@@ -48,6 +48,8 @@ import org.rhq.core.util.stream.StreamUtil;
public class AS7CommandLineTest {
private static final File FAKE_JBOSS_HOME = new File(".");
+ private static final String FILE_URL_PREFIX = (File.separatorChar == '/') ? "file://" : "file:///";
+
private interface CommandLineProducer {
AS7CommandLine get();
}
@@ -73,8 +75,8 @@ public class AS7CommandLineTest {
File propsFile1 = File.createTempFile("jboss1-", ".properties");
File propsFile2 = File.createTempFile("jboss2-", ".properties");
- String propsFile1Path = "file://" + propsFile1;
- String propsFile2Path = "file://" + propsFile2;
+ String propsFile1Path = FILE_URL_PREFIX + propsFile1;
+ String propsFile2Path = FILE_URL_PREFIX + propsFile2;
try {
testSysProps(propsFile1, propsFile2, FAKE_JBOSS_HOME,
@@ -197,8 +199,8 @@ public class AS7CommandLineTest {
File propsFile1 = File.createTempFile("jboss1-", ".properties");
File propsFile2 = File.createTempFile("jboss2-", ".properties");
- String propsFile1Path = "file://" + propsFile1;
- String propsFile2Path = "file://" + propsFile2;
+ String propsFile1Path = FILE_URL_PREFIX + propsFile1;
+ String propsFile2Path = FILE_URL_PREFIX + propsFile2;
FakeServerProcess fakeServer = startFakeServer(FAKE_JBOSS_HOME, FAKE_JBOSS_HOME, propsFile1Path, propsFile2Path);
@@ -218,8 +220,8 @@ public class AS7CommandLineTest {
File propsFile1 = File.createTempFile("jboss1-", ".properties");
File propsFile2 = File.createTempFile("jboss2-", ".properties");
- String propsFile1Path = "file://" + propsFile1;
- String propsFile2Path = "file://" + propsFile2;
+ String propsFile1Path = FILE_URL_PREFIX + propsFile1;
+ String propsFile2Path = FILE_URL_PREFIX + propsFile2;
FakeServerProcess fakeServer = startFakeServer(new File(".."), FAKE_JBOSS_HOME, propsFile1Path, propsFile2Path);
@@ -385,11 +387,7 @@ public class AS7CommandLineTest {
Assert
.fail("The fake jboss as server process has finished even though it should keep running. The exit value was "
- + exitValue
- + ". Stdout was:\n"
- + stdout
- + "\n\nStderr was:\n"
- + stderr);
+ + exitValue + ". Stdout was:\n" + stdout + "\n\nStderr was:\n" + stderr);
} catch (IllegalThreadStateException e) {
//expected
}
commit ad131fe3d7a38287857fcf5d34e6b3d3983acc96
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Feb 22 11:40:25 2013 +0100
Unifying the width of buttons in the toolstrip (removing autoFit by default, autoFit property is set if the title length is greater than 15 characters) and removing unused class SimpleCollapsiblePanel.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java
index b9b16ed..d7b8c81 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java
@@ -223,7 +223,6 @@ public class AgentPluginTableView extends TableSection<AgentPluginDataSource> {
IButton scanForUpdatesButton = new LocatableIButton(extendLocatorId("scanButton"),
MSG.view_admin_plugins_scan());
- scanForUpdatesButton.setAutoFit(true);
scanForUpdatesButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
GWTServiceLookup.getPluginService().scanAndRegister(new AsyncCallback<Void>() {
@@ -246,7 +245,6 @@ public class AgentPluginTableView extends TableSection<AgentPluginDataSource> {
final IButton showDeletedButton = new LocatableIButton(extendLocatorId("showDeletedButton"),
MSG.view_admin_plugins_showDeleted());
- showDeletedButton.setAutoFit(true);
showDeletedButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
showDeleted = !showDeleted;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java
index c83d93f..f3f72f4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java
@@ -223,7 +223,6 @@ public class ServerPluginTableView extends TableSection<ServerPluginDataSource>
IButton scanForUpdatesButton = new LocatableIButton(extendLocatorId("scanButton"),
MSG.view_admin_plugins_scan());
- scanForUpdatesButton.setAutoFit(true);
scanForUpdatesButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
GWTServiceLookup.getPluginService().scanAndRegister(new AsyncCallback<Void>() {
@@ -246,7 +245,6 @@ public class ServerPluginTableView extends TableSection<ServerPluginDataSource>
IButton restartMasterPCButton = new LocatableIButton(extendLocatorId("restartMasterPCButton"),
MSG.view_admin_plugins_restartMasterPC());
- restartMasterPCButton.setAutoFit(true);
restartMasterPCButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
Message msg = new Message(MSG.view_admin_plugins_restartMasterPCStarted(), Severity.Info);
@@ -272,7 +270,6 @@ public class ServerPluginTableView extends TableSection<ServerPluginDataSource>
final IButton showUndeployedButton = new LocatableIButton(extendLocatorId("showUndeployedButton"),
MSG.view_admin_plugins_showUndeployed());
- showUndeployedButton.setAutoFit(true);
showUndeployedButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent event) {
showUndeployed = !showUndeployed;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java
deleted file mode 100644
index ed9163d..0000000
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2010 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.enterprise.gui.coregui.client.components;
-
-import com.smartgwt.client.types.SelectionType;
-import com.smartgwt.client.widgets.Button;
-import com.smartgwt.client.widgets.Canvas;
-import com.smartgwt.client.widgets.events.ClickEvent;
-import com.smartgwt.client.widgets.events.ClickHandler;
-import com.smartgwt.client.widgets.layout.VLayout;
-
-/**
- * TODO: Not Quite Working. For some reason the icon is not clickable.
- *
- * @author Greg Hinkle
- */
-public class SimpleCollapsiblePanel extends VLayout {
-
- private Canvas content;
- private String title;
-
- private boolean expanded = true;
-
- public SimpleCollapsiblePanel(String title, Canvas content) {
- this.content = content;
- this.title = title;
- setWidth100();
- }
-
- @Override
- protected void onInit() {
- super.onInit();
-
- final Button button = new Button(title);
- button.setShowRollOver(false);
- button.setActionType(SelectionType.RADIO);
- //button.setBorder(null);
- button.setAutoFit(true);
-
- button.setIcon("[skin]/images/SectionHeader/opener_opened.png");
- //button.setBaseStyle("SimpleButton");
-
- button.addClickHandler(new ClickHandler() {
- public void onClick(ClickEvent clickEvent) {
- expanded = !expanded;
- if (expanded) {
- button.setIcon("[skin]/images/SectionHeader/opener_opened.png");
- content.show();
- } else {
- button.setIcon("[skin]/images/SectionHeader/opener_closed.png");
- content.hide();
- setHeight(30);
- }
- getParentElement().markForRedraw();
- markForRedraw();
- }
- });
-
- addMember(button);
- addMember(content);
- }
-}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java
index d82d2ee..cd1a396 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java
@@ -362,7 +362,6 @@ public abstract class Carousel extends LocatableHLayout implements RefreshableVi
.getTitle());
menuButton.setMenu(menu);
menuButton.setDisabled(true);
- menuButton.setAutoFit(true); // this makes it pretty tight, but maybe better than the default, which is pretty wide
menuButton.setOverflow(Overflow.VISIBLE);
menuButton.setShowMenuBelow(false);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
index 991098e..8cdb741 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java
@@ -153,7 +153,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
.common_title_edit_mode());
- editButton.setAutoFit(true);
editButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
editMode = !editMode;
@@ -163,7 +162,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
});
resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
- resetButton.setAutoFit(true);
resetButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
String message = MSG.view_summaryDashboard_resetConfirm();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
index 77a729d..ceca886 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java
@@ -122,7 +122,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG
.common_title_edit_mode());
- editButton.setAutoFit(true);
editButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
editMode = !editMode;
@@ -132,7 +131,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
});
resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset());
- resetButton.setAutoFit(true);
resetButton.addClickHandler(new ClickHandler() {
public void onClick(ClickEvent clickEvent) {
String message = MSG.view_summaryDashboard_resetConfirm();
commit 29b87752782a07869894b5c3eccb8d47dd11f46a
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Feb 21 23:56:16 2013 +0100
Adding the API checks to the script bindings.
Also corrected a minor incompatible change that was introduced since 4.5.1.
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml
index 08cfdd4..709a213 100644
--- a/modules/enterprise/binding/pom.xml
+++ b/modules/enterprise/binding/pom.xml
@@ -12,6 +12,7 @@
<properties>
<filtered.location>src/main/java</filtered.location>
+ <rhq.internal>false</rhq.internal>
</properties>
<dependencies>
@@ -240,6 +241,23 @@
</configuration>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>clirr-maven-plugin</artifactId>
+ <configuration>
+ <includes>
+ <!-- Hand picked stuff that corresponds to what is the script context initialized to
+ in the org/rhq/bindings/StandardBindings. -->
+ <include>org/rhq/bindings/client/*</include>
+ <include>org/rhq/bindings/export/*</include>
+ <include>org/rhq/bindings/output/*</include>
+ <include>org/rhq/bindings/util/ScriptAssert</include>
+ <include>org/rhq/bindings/util/ScriptAssertException</include>
+ <include>org/rhq/bindings/util/ScriptUtil</include>
+ </includes>
+ </configuration>
+ </plugin>
+
</plugins>
</build>
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java
index 3e1e137..e0e794c 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java
@@ -46,6 +46,10 @@ import org.rhq.core.domain.util.PageControl;
* is available for all the users of this class. The user is however able to later modify these defaults to provide
* use-case specific overrides (for example the CLI might want to supply impls that hook into the console to provide
* interactivity with user in some workflows, which, generically, is not possible in a common case).
+ * <p>
+ * *NOTE*: any change in what is exposed to the scripting clients needs to be reflected in the API check configuration
+ * in the pom.xml of the corresponding modules, because any class that gets exposed in the script context essentially
+ * becomes a public API.
*
* @author Lukas Krejci
*/
@@ -118,10 +122,10 @@ public class StandardBindings extends HashMap<String, Object> {
/**
* If you want to preserve non-client-dependent bindings when the facade changes, call this as opposed to
- * constructing new StandardBindings.
+ * constructing new StandardBindings.
*/
public void setFacade(PrintWriter output, RhqFacade rhqFacade) {
- // remove any existing managers
+ // remove any existing managers
if (null != managers) {
for (RhqManager manager : managers.keySet()) {
remove(manager.name());
@@ -204,7 +208,7 @@ public class StandardBindings extends HashMap<String, Object> {
}
public Map<RhqManager, Object> getManagers() {
- //XXX ideally this should be a projection into our map
+ //XXX ideally this should be a projection into our map
return (null == managers) ? managers = Collections.emptyMap() : managers;
}
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java
index 32832b2..2c781a1 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java
@@ -101,7 +101,7 @@ public enum RhqManager {
this.beanName = this.name() + "Bean";
localInterfaceClassName = getLocalInterfaceClassName(remote);
- //defaults and evaluates to TRUE unless the string contains "false". Done to defend against
+ //defaults and evaluates to TRUE unless the string contains "false". Done to defend against
//possible errors in string replacement during rhq build.
this.enabled = true;
if ((enable != null) && (enable.trim().length() > 0)) {
@@ -123,6 +123,15 @@ public enum RhqManager {
return this.remote;
}
+ /**
+ * @deprecated since 4.6.0, use the {@link #remote()} method instead
+ * @return the class name of the remote interface
+ */
+ @Deprecated
+ public String remoteName() {
+ return this.remote.getName();
+ }
+
public String localInterfaceClassName() {
return localInterfaceClassName;
}
commit 6f71c2d100c564e2f52894eca3238a6f5c7b73d7
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 21 21:22:24 2013 -0500
[BZ 913778] fix NPE
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
index 6fdaf95..0aecd4d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
@@ -37,7 +37,8 @@ public class LocatableIButton extends IButton implements Locatable {
private void init(String locatorId) {
this.locatorId = locatorId;
SeleniumUtility.setID(this, locatorId);
- if (getTitle().length() > 15) {
+ String title = getTitle();
+ if (title != null && title.length() > 15) {
setAutoFit(true);
}
}
commit 277c8b1fc4379e6a652931b7db1bbdd4ce3ce5ac
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 21 16:25:40 2013 -0500
[BZ 913606] agent will send a full avail report if the server tells it at connect time that it has been backfilled.
the server will also update the last ping time of the agent when the connect comes in.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java
index 47be78b..3bcf47b 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java
@@ -32,10 +32,12 @@ import java.io.Serializable;
public class ConnectAgentResults implements Serializable {
private static final long serialVersionUID = 1L;
- private long serverTime;
+ private final long serverTime;
+ private final boolean isDown;
- public ConnectAgentResults(long serverTime) {
+ public ConnectAgentResults(long serverTime, boolean isDown) {
this.serverTime = serverTime;
+ this.isDown = isDown;
}
/**
@@ -49,10 +51,23 @@ public class ConnectAgentResults implements Serializable {
}
/**
- * @see java.lang.Object#toString()
+ * If true, this indicates if the server thinks the agent is down. This happens if the agent
+ * hasn't connected in a long time and the server had "backfilled" the agent's resources
+ * as DOWN/UNKNOWN.
+ *
+ * When an agent connects to a server, and the server thinks that agent was down, the agent needs
+ * to prepare to notify the server of its state - for example, the agent should soon send up
+ * a full availability report so the server can get the up-to-date availability statuses of all
+ * resources.
+ *
+ * @return true if the server had this agent's resources marked as DOWN/UNKNOWN.
*/
+ public boolean isDown() {
+ return isDown;
+ }
+
@Override
public String toString() {
- return "ConnectAgentResults: [server-time=" + this.serverTime + "]";
+ return "ConnectAgentResults: [server-time=" + this.serverTime + ", is-down=" + this.isDown + "]";
}
}
\ No newline at end of file
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
index 6c01d67..0c95199 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
@@ -2146,6 +2146,18 @@ public class AgentMain {
ConnectAgentResults results = (ConnectAgentResults) connectResponse.getResults();
long serverTime = results.getServerTime();
serverClockNotification(serverTime);
+
+ // If the server thinks we are down, we need to do some things to get this agent in sync with the server.
+ // Anything we do in here should be very fast.
+ boolean serverThinksWeAreDown = results.isDown();
+ if (serverThinksWeAreDown) {
+ LOG.warn(AgentI18NResourceKeys.SERVER_THINKS_AGENT_IS_DOWN);
+ PluginContainer plugin_container = PluginContainer.getInstance();
+ if (plugin_container.isStarted()) {
+ // tell the plugin container to send a full avail report up so the server knows we are UP
+ plugin_container.getInventoryManager().requestFullAvailabilityReport();
+ }
+ }
} catch (Throwable t) {
// should never happen, should always cast to non-null ConnectAgentResults
LOG.error(AgentI18NResourceKeys.TIME_UNKNOWN, ThrowableUtil.getAllMessages(t));
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
index 57f427c..10761ff 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
@@ -170,6 +170,9 @@ public interface AgentI18NResourceKeys {
@I18NMessage("Failed to determine the server time. Cause: {0}")
String TIME_UNKNOWN = "AgentMain.time-unknown";
+ @I18NMessage("The server thinks this agent is down. Will notify the server of up-to-date information when possible.")
+ String SERVER_THINKS_AGENT_IS_DOWN = "AgentMain.server-thinks-agent-is-down";
+
@I18NMessage("Timed out waiting for the connectAgent R/W lock to avoid a possible deadlock")
String TIMEOUT_WAITING_FOR_CONNECT_LOCK = "AgentMain.connect-lock-timeout";
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java
index 23bcbcf..9818ac3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java
@@ -320,6 +320,7 @@ public class CoreServerServiceImpl implements CoreServerService {
Server server = getServerManager().getServer();
agent.setServer(server);
+ agent.setLastAvailabilityPing(Long.valueOf(System.currentTimeMillis()));
getAgentManager().updateAgent(agent);
getAlertConditionCacheManager().reloadCachesForAgent(agent.getId());
@@ -328,7 +329,7 @@ public class CoreServerServiceImpl implements CoreServerService {
PartitionEventType.AGENT_CONNECT, agentName + " - " + server.getName());
log.info("Agent [" + agentName + "] has connected to this server at " + new Date());
- return new ConnectAgentResults(System.currentTimeMillis());
+ return new ConnectAgentResults(System.currentTimeMillis(), agent.isBackFilled());
}
/**
commit 369633cd9ab6a42d24c98a8c599f8a134fb5cc95
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 21 15:12:05 2013 -0500
this should not be here
diff --git a/modules/enterprise/server/jar/lib/log4jdbc4-1.2beta2.jar b/modules/enterprise/server/jar/lib/log4jdbc4-1.2beta2.jar
deleted file mode 100644
index 3d6f466..0000000
Binary files a/modules/enterprise/server/jar/lib/log4jdbc4-1.2beta2.jar and /dev/null differ
commit b4522507d1a18a20cabff9cd2097c730c5d5f42e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Feb 21 11:21:27 2013 -0500
This should allow us to run Arquillian's spawned AS7 instances (for
domain and server jar itests) on non-default ports. This can be helpful
in environments where you want to run multiple AS7 instances at the same
time.
Arquillian will now inspect, through the AS7 management port (assumed to be on
the local machine for now), to find out what ports it needs to deal with.
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index 3eec8ad..21af6e4 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -235,6 +235,16 @@
<echo>Will now add test configuration to JBossAS config file: ${jboss.conf}</echo>
<replace file="${jboss.conf}">
<replacefilter>
+ <replacetoken></extensions></replacetoken>
+ <replacevalue><![CDATA[
+ </extensions>
+
+ <!-- FOR RHQ TESTING -->
+ <system-properties>
+ <property name="jboss.socket.binding.port-offset" value="${jboss.socket.binding.port-offset}" />
+ </system-properties>]]></replacevalue>
+ </replacefilter>
+ <replacefilter>
<replacetoken></drivers></replacetoken>
<replacevalue><![CDATA[
<!-- FOR RHQ TESTING -->
@@ -681,6 +691,22 @@
<jboss.vm.args.debug>-Xrunjdwp:transport=dt_socket,address=8798,server=y,suspend=y</jboss.vm.args.debug>
</properties>
</profile>
+
+ <!-- These two properties allow Arquillian to inspect AS7 through the mgmt port, to determine the ports it needs to interact
+ with when spawning the AS7 instance. This allows the AS7 to run on non-default ports. If these properties are not set (for
+ example, in settings.xml) then we must set the defaults here. The offset is then provided via the standalone.xml properties -->
+ <profile>
+ <id>arquillian-ports</id>
+ <activation>
+ <property>
+ <name>!jboss.socket.binding.port-offset</name>
+ </property>
+ </activation>
+ <properties>
+ <jboss.socket.binding.port-offset>0</jboss.socket.binding.port-offset>
+ <jboss.management.native.port>9999</jboss.management.native.port>
+ </properties>
+ </profile>
</profiles>
diff --git a/modules/core/domain/src/test/resources/arquillian.xml b/modules/core/domain/src/test/resources/arquillian.xml
index 368ce23..d0744f3 100644
--- a/modules/core/domain/src/test/resources/arquillian.xml
+++ b/modules/core/domain/src/test/resources/arquillian.xml
@@ -21,6 +21,10 @@
<configuration>
<property name="jbossHome">${jboss.unzip.location}</property>
+ <!-- These two properties allow Arquillian to inspect AS7 through the mgmt port, to determine the ports it needs
+ to interact with when spawning the AS7 instance. This allows the AS7 to run on non-default ports. -->
+ <property name="managementAddress">127.0.0.1</property>
+ <property name="managementPort">${jboss.management.native.port}</property>
</configuration>
</container>
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml
index 5961627..49d79f5 100644
--- a/modules/enterprise/server/itests-2/pom.xml
+++ b/modules/enterprise/server/itests-2/pom.xml
@@ -91,6 +91,7 @@
<system-properties>
<property name="project.version" value="${project.version}"/>
<property name="rhq.server.content.filesystem" value="${jboss.unzip.location}/standalone/data/packagebits" />
+ <property name="jboss.socket.binding.port-offset" value="${jboss.socket.binding.port-offset}" />
</system-properties>]]></replacevalue>
</replacefilter>
@@ -741,5 +742,22 @@
<jboss.vm.args.debug>-Xrunjdwp:transport=dt_socket,address=8798,server=y,suspend=y</jboss.vm.args.debug>
</properties>
</profile>
+
+ <!-- These two properties allow Arquillian to inspect AS7 through the mgmt port, to determine the ports it needs to interact
+ with when spawning the AS7 instance. This allows the AS7 to run on non-default ports. If these properties are not set (for
+ example, in settings.xml) then we must set the defaults here. The offset is then provided via the standalone.xml properties -->
+ <profile>
+ <id>arquillian-ports</id>
+ <activation>
+ <property>
+ <name>!jboss.socket.binding.port-offset</name>
+ </property>
+ </activation>
+ <properties>
+ <jboss.socket.binding.port-offset>0</jboss.socket.binding.port-offset>
+ <jboss.management.native.port>9999</jboss.management.native.port>
+ </properties>
+ </profile>
+
</profiles>
</project>
diff --git a/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml b/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml
index 72f8bdc..ffaa79e 100644
--- a/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml
+++ b/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml
@@ -33,6 +33,10 @@
<configuration>
<property name="jbossHome">${jboss.unzip.location}</property>
<property name="javaVmArguments">${jboss.vm.args} ${jboss.vm.args.debug}</property>
+ <!-- These two properties allow Arquillian to inspect AS7 through the mgmt port, to determine the ports it needs
+ to interact with when spawning the AS7 instance. This allows the AS7 to run on non-default ports. -->
+ <property name="managementAddress">127.0.0.1</property>
+ <property name="managementPort">${jboss.management.native.port}</property>
</configuration>
</container>
</arquillian>
commit 93fb46966bfce20ec918191ec78408d20ce6b010
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 21 10:35:59 2013 -0500
don't deprecate these methods - criteria is nice, but these specific methods are very efficient and can be used when we need to eek out as much performance as possible. no need to go through the criteria API just to get a single agent using very targeted WHERE conditions.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
index 842d5d8..7e2c3b9 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
@@ -134,47 +134,51 @@ public interface AgentManagerLocal {
/**
* Given an agent name, this will look up and return the {@link Agent} with that name. If no agent with the given
* name exists, <code>null</code> is returned.
- *
+ * This method is very efficient if you want to find a single agent by its name.
+ * If you need to get more than one agent, you could use <code>findAgentsByCriteria</code>.
+ *
* @param agentName
*
* @return the agent whose name matches the given name; <code>null</code> if there is no agent with the given name
- * @deprecated Use <code>findAgentsByCriteria()</code> instead
*/
Agent getAgentByName(String agentName);
/**
* Given an agent id, this will look up and return the {@link Agent} with that id. If no agent with the given
* name exists, <code>null</code> is returned.
+ * This method is very efficient if you want to find a single agent by its ID.
+ * If you need to get more than one agent, you could use <code>findAgentsByCriteria</code>.
*
* @param agentId
*
* @return the agent whose id matches the given id; <code>null</code> if there is no agent with the given id
- * @deprecated Use <code>findAgentsByCriteria()</code> instead
*/
Agent getAgentByID(int agentId);
/**
* Given an agent token string, this will look up and return the {@link Agent} associated with that token. If the
* given token is invalid, <code>null</code> is returned.
+ * This method is very efficient if you want to find a single agent by its token.
+ * If you need to get more than one agent, you could use <code>findAgentsByCriteria</code>.
*
* @param token the agent token
*
* @return the agent whose agent token matches the given token; <code>null</code> if there is no agent with the
* given token
- * @deprecated Use <code>findAgentsByCriteria()</code> instead
*/
Agent getAgentByAgentToken(String token);
/**
* Given an agent's address and port, this will look up and return the {@link Agent} associated with that address
* and port. If no agent is found, <code>null</code> is returned.
+ * This method is very efficient if you want to find a single agent by its endpoint.
+ * If you need to get more than one agent, you could use <code>findAgentsByCriteria</code>.
*
* @param address the address that the agent is bound to
* @param port the port at the given address that the agent is listening on
*
* @return the agent to be known at the given address and port; <code>null</code> if there is no agent with the
* given token
- * @deprecated Use <code>findAgentsByCriteria()</code> instead
*/
Agent getAgentByAddressAndPort(String address, int port);
commit e0ea2fd840197301df934d34088b419e97279d83
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Feb 12 10:23:51 2013 +0100
netservices plugin strengthening
Added Unit tests for HTTPNetServiceDiscoveryComponent
Added HTTPNetServiceComponent itest and verified code coverage
Added Unit tests for PingNetServiceDiscoveryComponent
Added PingNetServiceComponent itest and verified code coverage
Implemented missing parts and cleaned up code
diff --git a/.classpath b/.classpath
index 9af3a50..dd5d354 100644
--- a/.classpath
+++ b/.classpath
@@ -24,9 +24,9 @@
<classpathentry kind="src" path="modules/core/util/src/test/java"/>
<classpathentry kind="src" path="modules/core/dbutils/src/main/java"/>
<classpathentry kind="src" path="modules/core/dbutils/src/test/java"/>
- <classpathentry kind="src" path="modules/core/native-system/src/main/java"/>
- <classpathentry kind="src" path="modules/core/native-system/src/test/java"/>
- <classpathentry kind="src" path="modules/core/native-system/src/test/resources"/>
+ <classpathentry kind="src" path="modules/core/native-system/src/main/java"/>
+ <classpathentry kind="src" path="modules/core/native-system/src/test/java"/>
+ <classpathentry kind="src" path="modules/core/native-system/src/test/resources"/>
<classpathentry kind="src" path="modules/core/domain/src/main/java"/>
<classpathentry kind="src" path="modules/core/domain/src/test/java"/>
<classpathentry kind="src" path="modules/core/plugin-api/src/main/java"/>
@@ -124,6 +124,9 @@
<classpathentry kind="src" path="modules/plugins/apache/src/test/resources"/>
<classpathentry kind="src" path="modules/plugins/script/src/main/java"/>
<classpathentry kind="src" path="modules/plugins/netservices/src/main/java"/>
+ <classpathentry kind="src" path="modules/plugins/netservices/src/main/resources"/>
+ <classpathentry kind="src" path="modules/plugins/netservices/src/test/java"/>
+ <classpathentry kind="src" path="modules/plugins/netservices/src/test/resources"/>
<classpathentry kind="src" path="modules/plugins/ant-bundle/src/main/java"/>
<classpathentry kind="src" path="modules/plugins/ant-bundle/src/test/java"/>
<classpathentry kind="src" path="modules/plugins/ant-bundle/src/test/resources"/>
@@ -178,11 +181,11 @@
<classpathentry kind="src" path="modules/core/arquillian-integration/container/src/test/java"/>
<classpathentry kind="src" path="modules/core/arquillian-integration/container/src/test/resources"/>
<classpathentry kind="src" path="modules/test-utils/src/main/java"/>
- <classpathentry kind="src" path="modules/integration-tests/apache-plugin-test/src/test/java"/>
- <classpathentry kind="src" path="modules/integration-tests/apache-plugin-test/src/test/resources"/>
- <classpathentry kind="src" path="modules/integration-tests/jndi-access/jndi-access-test/src/test/java"/>
- <classpathentry kind="src" path="modules/integration-tests/jndi-access/jndi-access-test/src/test/resources"/>
- <classpathentry kind="src" path="modules/integration-tests/mod_cluster-plugin-test/src/test/java"/>
+ <classpathentry kind="src" path="modules/integration-tests/apache-plugin-test/src/test/java"/>
+ <classpathentry kind="src" path="modules/integration-tests/apache-plugin-test/src/test/resources"/>
+ <classpathentry kind="src" path="modules/integration-tests/jndi-access/jndi-access-test/src/test/java"/>
+ <classpathentry kind="src" path="modules/integration-tests/jndi-access/jndi-access-test/src/test/resources"/>
+ <classpathentry kind="src" path="modules/integration-tests/mod_cluster-plugin-test/src/test/java"/>
<classpathentry kind="src" path="etc/samples/skeleton-plugin/src/main/java"/>
<classpathentry kind="src" path="etc/samples/custom-serverplugin/src/main/java"/>
<classpathentry kind="src" path="etc/samples/simplereport-serverplugin/src/main/java"/>
@@ -336,9 +339,9 @@
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/jms/jboss-jms-api_1.1_spec/1.0.0.Final/jboss-jms-api_1.1_spec-1.0.0.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/interceptor/jboss-interceptors-api_1.1_spec/1.0.0.Final/jboss-interceptors-api_1.1_spec-1.0.0.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/transaction/jboss-transaction-api_1.1_spec/1.0.0.Final/jboss-transaction-api_1.1_spec-1.0.0.Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/remotingjmx/remoting-jmx/1.0.2.Final/remoting-jmx-1.0.2.Final.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/javax/enterprise/cdi-api/1.0-SP4/cdi-api-1.0-SP4.jar" sourcepath="M2_REPO/javax/enterprise/cdi-api/1.0-SP4/cdi-api-1.0-SP4-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar" sourcepath="M2_REPO/javax/inject/javax.inject/1/javax.inject-1-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/remotingjmx/remoting-jmx/1.0.2.Final/remoting-jmx-1.0.2.Final.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/javax/enterprise/cdi-api/1.0-SP4/cdi-api-1.0-SP4.jar" sourcepath="M2_REPO/javax/enterprise/cdi-api/1.0-SP4/cdi-api-1.0-SP4-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar" sourcepath="M2_REPO/javax/inject/javax.inject/1/javax.inject-1-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/mozilla/rhino/1.7R4/rhino-1.7R4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/picketbox/picketbox/4.0.7.Final/picketbox-4.0.7.Final.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/python/jython-standalone/2.5.2/jython-standalone-2.5.2.jar"/>
@@ -346,9 +349,10 @@
<classpathentry exported="true" kind="var" path="M2_REPO/joda-time/joda-time/2.1/joda-time-2.1.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/apache/cassandra/cassandra-thrift/1.1.5/cassandra-thrift-1.1.5.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/hectorclient/hector-core/1.1-1/hector-core-1.1-1.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-install/1.5.2/byteman-install-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-install/1.5.2/byteman-install-1.5.2-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-submit/1.5.2/byteman-submit-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-submit/1.5.2/byteman-submit-1.5.2-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-bmunit/1.5.2/byteman-bmunit-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-bmunit/1.5.2/byteman-bmunit-1.5.2-sources.jar"/>
- <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/>
- <classpathentry kind="output" path="eclipse-classes"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-install/1.5.2/byteman-install-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-install/1.5.2/byteman-install-1.5.2-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-submit/1.5.2/byteman-submit-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-submit/1.5.2/byteman-submit-1.5.2-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-bmunit/1.5.2/byteman-bmunit-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-bmunit/1.5.2/byteman-bmunit-1.5.2-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/eclipse/jetty/aggregate/jetty-all/8.1.8.v20121106/jetty-all-8.1.8.v20121106.jar" sourcepath="M2_REPO/org/eclipse/jetty/aggregate/jetty-all/8.1.8.v20121106/jetty-all-8.1.8.v20121106-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/>
+ <classpathentry kind="output" path="eclipse-classes"/>
</classpath>
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java b/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java
index 59a09f2..21e81c4 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java
@@ -39,6 +39,8 @@ public class StringUtil {
private static final Log log = LogFactory.getLog(StringUtil.class);
+ public static final String EMPTY_STRING = "";
+
/**
* @param source The source string to perform replacements on.
* @param find The substring to find in source.
@@ -119,7 +121,7 @@ public class StringUtil {
*
* @return The Iterator's elements in a user-friendly string format.
*/
- public static String iteratorToString(Iterator i, String delim) {
+ public static String iteratorToString(Iterator<?> i, String delim) {
return iteratorToString(i, delim, "");
}
@@ -132,7 +134,7 @@ public class StringUtil {
*
* @return The Iterator's elements in a user-friendly string format.
*/
- public static String iteratorToString(Iterator i, String delim, String quoteChar) {
+ public static String iteratorToString(Iterator<?> i, String delim, String quoteChar) {
Object elt = null;
StringBuilder rstr = new StringBuilder();
String s;
@@ -166,21 +168,21 @@ public class StringUtil {
*
* @return The List in a user-friendly string format.
*/
- public static String listToString(List list, String delim) {
+ public static String listToString(List<?> list, String delim) {
if (list == null) {
return "NULL";
}
- Iterator i = list.iterator();
+ Iterator<?> i = list.iterator();
return iteratorToString(i, delim, null);
}
- public static String collectionToString(Collection collection, String delim) {
+ public static String collectionToString(Collection<?> collection, String delim) {
if (collection == null) {
return "NULL";
}
- Iterator i = collection.iterator();
+ Iterator<?> i = collection.iterator();
return iteratorToString(i, delim, null);
}
@@ -191,11 +193,11 @@ public class StringUtil {
*
* @return The List in a user-friendly string format.
*/
- public static String listToString(List list) {
+ public static String listToString(List<?> list) {
return listToString(list, ",");
}
- public static String collectionToString(Collection collection) {
+ public static String collectionToString(Collection<?> collection) {
return collectionToString(collection, ",");
}
@@ -278,7 +280,7 @@ public class StringUtil {
*
* @return A string with objects in the list seperated by delim
*/
- public static String implode(List objs, String delim) {
+ public static String implode(List<?> objs, String delim) {
StringBuilder buf = new StringBuilder();
int size = objs.size();
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 7805daa..4afa8a5 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -1,240 +1,236 @@
-<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-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
- </parent>
-
- <groupId>org.rhq</groupId>
- <artifactId>rhq-netservices-plugin</artifactId>
- <packaging>jar</packaging>
-
- <name>RHQ Network Services Plugin</name>
- <description>
- A plugin for monitoring network services.
- </description>
-
- <dependencies>
-
- <dependency>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>${commons-httpclient.version}</version>
- </dependency>
- <dependency>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>${commons-codec.version}</version>
- </dependency>
-
- </dependencies>
-
- <build>
-
- <plugins>
-
- <plugin>
- <artifactId>maven-dependency-plugin</artifactId>
- <executions>
- <execution>
- <id>copy-dependency-jars</id>
- <phase>process-resources</phase>
- <goals>
- <goal>copy</goal>
- </goals>
- <configuration>
- <artifactItems>
- <artifactItem>
- <groupId>commons-httpclient</groupId>
- <artifactId>commons-httpclient</artifactId>
- <version>${commons-httpclient.version}</version>
- </artifactItem>
- <artifactItem>
- <groupId>commons-codec</groupId>
- <artifactId>commons-codec</artifactId>
- <version>1.2</version>
- </artifactItem>
- </artifactItems>
- <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
-
- </build>
-
-
- <profiles>
- <profile>
- <id>integration-tests</id>
- <activation>
+<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-plugins-parent</artifactId>
+ <version>4.6.0-SNAPSHOT</version>
+ </parent>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-netservices-plugin</artifactId>
+ <packaging>jar</packaging>
+
+ <name>RHQ Network Services Plugin</name>
+ <description>A plugin for monitoring network services.</description>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>${commons-httpclient.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons-codec.version}</version>
+ </dependency>
+
+ <!-- Test dependencies -->
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>1.9.5</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.eclipse.jetty.aggregate</groupId>
+ <artifactId>jetty-all</artifactId>
+ <version>8.1.8.v20121106</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-surefire-plugin</artifactId>
+ <configuration>
+ <excludes>
+ <exclude>org/rhq/plugins/netservices/itest/**</exclude>
+ </excludes>
+ <properties>
<property>
- <name>maven.test.skip</name>
- <value>!true</value>
+ <name>listener</name>
+ <value>org.rhq.test.testng.StdoutReporter</value>
</property>
- </activation>
-
- <build>
- <plugins>
-
- <!-- Integration testing voodoo to load and test this plugin with its plugin dependencies -->
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
- <execution>
- <phase>pre-integration-test</phase>
- <configuration>
- <target>
- <echo>Setting up plugin dependencies for ${project.artifactId}-${project.version}.jar...</echo>
- <property name="settings.localRepository" location="${user.home}/.m2/repository" />
- <mkdir dir="target/itest" />
- <mkdir dir="target/itest/plugins" />
- <mkdir dir="target/itest/lib" />
- <copy toDir="target/itest/plugins" flatten="true">
- <fileset dir="${project.build.directory}">
- <include name="${project.artifactId}-${project.version}.jar" />
- </fileset>
- </copy>
- <unzip dest="target/itest/lib">
- <fileset dir="${settings.localRepository}/org/hyperic/sigar-dist/${sigar.version}" includes="*.zip" />
- <patternset>
- <include name="**/lib/sigar.jar" />
- <include name="**/lib/bcel*.jar" />
- <include name="**/lib/*.so" />
- <include name="**/lib/*.sl" />
- <include name="**/lib/*.dll" />
- <include name="**/lib/*.dylib" />
- </patternset>
- </unzip>
- <move todir="target/itest/lib" flatten="true">
- <fileset dir="target/itest/lib">
- <include name="**/lib/*" />
- </fileset>
- </move>
- <delete dir="target/itest/lib/hyperic-sigar-${sigar.version}" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
-
- <plugin>
- <artifactId>maven-surefire-plugin</artifactId>
- <configuration>
- <skip>true</skip>
- </configuration>
- <executions>
- <execution>
- <id>surefire-it</id>
- <phase>integration-test</phase>
- <goals>
- <goal>test</goal>
- </goals>
- <configuration>
- <skip>${maven.test.skip}</skip>
- <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
- <useSystemClassLoader>false</useSystemClassLoader>
- <argLine>${jacoco.integration-test.args} -Dorg.hyperic.sigar.path=${basedir}/target/itest/lib</argLine>
- <!--<argLine>${jacoco.integration-test.args} -Dorg.hyperic.sigar.path=${basedir}/target/itest/lib -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>-->
- <systemProperties>
- <property>
- <name>project.artifactId</name>
- <value>${project.artifactId}</value>
- </property>
- <property>
- <name>project.version</name>
- <value>${project.version}</value>
- </property>
- </systemProperties>
- </configuration>
- </execution>
- </executions>
- </plugin>
-
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>dev</id>
-
- <properties>
- <rhq.rootDir>../../..</rhq.rootDir>
- <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
- <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir>
- </properties>
-
- <build>
- <plugins>
-
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <executions>
-
- <execution>
- <id>deploy</id>
- <phase>compile</phase>
- <configuration>
- <target>
- <mkdir dir="${rhq.deploymentDir}" />
- <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
- <echo>*** Updating ${deployment.file}...</echo>
- <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- <execution>
- <id>deploy-jar-meta-inf</id>
- <phase>package</phase>
- <configuration>
- <target>
- <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
- <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
- <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
- <patternset><include name="META-INF/**" /></patternset>
- </unjar>
- <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF" update="true">
- </jar>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- <execution>
- <id>undeploy</id>
- <phase>clean</phase>
- <configuration>
- <target>
- <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
- <echo>*** Deleting ${deployment.file}...</echo>
- <delete file="${deployment.file}" />
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
-
- </executions>
- </plugin>
-
- </plugins>
- </build>
- </profile>
- </profiles>
+ </properties>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ <argLine>${jacoco.unit-test.args}</argLine>
+ </configuration>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <phase>pre-integration-test</phase>
+ <configuration>
+ <target>
+ <echo>Setting up itest plugin container...</echo>
+ <property name="settings.localRepository" location="${user.home}/.m2/repository" />
+ <mkdir dir="target/itest/plugins" />
+ <copy toDir="target/itest/plugins" flatten="true" verbose="true">
+ <fileset dir="${settings.localRepository}/">
+ <include name="org/rhq/rhq-platform-plugin/${project.version}/rhq-platform-plugin-${project.version}.jar" />
+ </fileset>
+ <fileset dir="${project.build.directory}">
+ <include name="${project.artifactId}-${project.version}.jar" />
+ </fileset>
+ </copy>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-failsafe-plugin</artifactId>
+ <configuration>
+ <skipTests>false</skipTests>
+ <skipITs>false</skipITs>
+ <includes>
+ <!-- only include integration tests; normal unit tests are handled above by surefire plugin -->
+ <include>org/rhq/plugins/netservices/itest/**/*Test.java</include>
+ </includes>
+ <properties>
+ <property>
+ <name>listener</name>
+ <value>org.rhq.test.testng.StdoutReporter</value>
+ </property>
+ </properties>
+ <useSystemClassLoader>false</useSystemClassLoader>
+ <argLine>${jacoco.integration-test.args}</argLine>
+ </configuration>
+ <executions>
+ <execution>
+ <goals>
+ <goal>integration-test</goal>
+ <goal>verify</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-dependency-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>copy-dependency-jars</id>
+ <phase>process-resources</phase>
+ <goals>
+ <goal>copy</goal>
+ </goals>
+ <configuration>
+ <artifactItems>
+ <artifactItem>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>${commons-httpclient.version}</version>
+ </artifactItem>
+ <artifactItem>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>1.2</version>
+ </artifactItem>
+ </artifactItems>
+ <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+
+ <profiles>
+
+ <profile>
+
+ <id>dev</id>
+
+ <properties>
+ <rhq.rootDir>../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+
+ <execution>
+ <id>deploy</id>
+ <phase>compile</phase>
+ <configuration>
+ <target>
+ <mkdir dir="${rhq.deploymentDir}" />
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating ${deployment.file}...</echo>
+ <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>deploy-jar-meta-inf</id>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Updating META-INF dir in ${deployment.file}...</echo>
+ <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}">
+ <patternset>
+ <include name="META-INF/**" />
+ </patternset>
+ </unjar>
+ <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF"
+ update="true">
+ </jar>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <target>
+ <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" />
+ <echo>*** Deleting ${deployment.file}...</echo>
+ <delete file="${deployment.file}" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ </executions>
+ </plugin>
+
+ </plugins>
+ </build>
+ </profile>
+ </profiles>
</project>
diff --git a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponent.java b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponent.java
index 54d9256..42cbcee 100644
--- a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponent.java
+++ b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponent.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -19,14 +19,22 @@
package org.rhq.plugins.netservices;
-import java.text.SimpleDateFormat;
+import java.net.MalformedURLException;
+import java.net.URL;
import java.util.Date;
-import java.util.Locale;
import java.util.Set;
+import java.util.regex.Pattern;
+import java.util.regex.PatternSyntaxException;
import org.apache.commons.httpclient.Header;
import org.apache.commons.httpclient.HttpClient;
+import org.apache.commons.httpclient.HttpMethodBase;
+import org.apache.commons.httpclient.SimpleHttpConnectionManager;
+import org.apache.commons.httpclient.UsernamePasswordCredentials;
+import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.GetMethod;
+import org.apache.commons.httpclient.methods.HeadMethod;
+import org.apache.commons.httpclient.util.DateUtil;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -39,43 +47,114 @@ 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.util.StringUtil;
/**
* Monitoring of HTTP Servers
*
* @author Greg Hinkle
*/
-public class HTTPNetServiceComponent implements ResourceComponent, MeasurementFacet, OperationFacet {
- private final Log log = LogFactory.getLog(this.getClass());
+public class HTTPNetServiceComponent implements ResourceComponent, MeasurementFacet {
- public static final String CONFIG_URL = "url";
- public static final String CONFIG_USER = "user";
- public static final String CONFIG_PASSWORD = "password";
- public static final String CONFIG_REALM = "realm";
+ public static final class ConfigKeys {
- // One of { none, SSL, TLS }
- public static final String CONFIG_SSL_PROTOCOL = "sslProtocol";
+ private ConfigKeys() {
+ // Defensive
+ }
+
+ public static final String URL = "url";
+ public static final String USER = "user";
+ public static final String PASSWORD = "password";
+ public static final String REALM = "realm";
+ public static final String METHOD = "method";
+ public static final String FOLOW_REDIRECTS = "followRedirects";
+ public static final String VALIDATE_RESPONSE_CODE = "validateResponseCode";
+ public static final String VALIDATE_RESPONSE_PATTERN = "validateResponsePattern";
- // One of { HEAD, GET }
- public static final String CONFIG_METHOD = "method";
- public static final String CONFIG_FOLOW_REDIRECTS = "followRedirects";
- public static final String CONFIG_RESPONSE_PATTERN = "responsePattern";
+ }
+
+ public static enum HttpMethod {
+ GET, HEAD
+ }
+
+ private static final Log LOG = LogFactory.getLog(HTTPNetServiceComponent.class);
private ResourceContext resourceContext;
+ private Configuration pluginConfig;
+
+ private HTTPNetServiceComponentConfiguration componentConfig;
+
+ @Override
public void start(ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception {
this.resourceContext = resourceContext;
- String url = resourceContext.getPluginConfiguration().getSimple(CONFIG_URL).getStringValue();
- if (!url.startsWith("http:") && !url.startsWith("https")) {
- throw new InvalidPluginConfigurationException("Url not valid. Must start with 'http:' or 'https:'");
+ pluginConfig = resourceContext.getPluginConfiguration();
+ componentConfig = createComponentConfiguration(pluginConfig);
+ }
+
+ /**
+ * Create a foram {@link HTTPNetServiceComponentConfiguration} instance with the supplied {@link Configuration}.
+ * May throw {@link InvalidPluginConfigurationException} if:
+ * <ul>
+ * <li>Url is empty, invalid, or pointing an non http/https resource</li>
+ * <li>Http method is not HEAD or GET</li>
+ * <li>If both content validation and HEAD method are configured</li>
+ * <li>If the content validation pattern is invalid</li>
+ * <ul>
+ *
+ * @param pluginConfig
+ * @return
+ * @throws InvalidPluginConfigurationException
+ */
+ static HTTPNetServiceComponentConfiguration createComponentConfiguration(Configuration pluginConfig) {
+
+ URL endPointUrl = null;
+ String configUrl = pluginConfig.getSimpleValue(ConfigKeys.URL, StringUtil.EMPTY_STRING);
+ if (StringUtil.isBlank(configUrl)) {
+ throw new InvalidPluginConfigurationException("Endpoint URL is not defined");
+ }
+ try {
+ endPointUrl = new URL(configUrl);
+ } catch (MalformedURLException e) {
+ throw new InvalidPluginConfigurationException(configUrl + " is not a valid URL");
}
+ String protocol = endPointUrl.getProtocol();
+ if (!protocol.equals("http") && !protocol.equals("https")) {
+ throw new InvalidPluginConfigurationException(configUrl + "does not point to an http(s) resource");
+ }
+
+ HttpMethod httpMethod = null;
+ String configMethod = pluginConfig.getSimpleValue(ConfigKeys.METHOD, StringUtil.EMPTY_STRING);
+ try {
+ httpMethod = HttpMethod.valueOf(configMethod);
+ } catch (IllegalArgumentException e) {
+ throw new InvalidPluginConfigurationException("Invalid http method: " + configMethod);
+ }
+
+ Pattern responseValidationPattern = null;
+ String configValidateResponsePattern = pluginConfig.getSimpleValue(ConfigKeys.VALIDATE_RESPONSE_PATTERN);
+ if (configValidateResponsePattern != null) {
+ if (httpMethod.equals(HttpMethod.HEAD)) {
+ throw new InvalidPluginConfigurationException("Cannot validate response content with HEAD request");
+ }
+ try {
+ responseValidationPattern = Pattern.compile(configValidateResponsePattern);
+ } catch (PatternSyntaxException e) {
+ throw new InvalidPluginConfigurationException("Invalid pattern: " + configValidateResponsePattern);
+ }
+ }
+
+ return new HTTPNetServiceComponentConfiguration(endPointUrl, httpMethod, responseValidationPattern);
}
+ @Override
public void stop() {
+ resourceContext = null;
+ pluginConfig = null;
+ componentConfig = null;
}
+ @Override
public AvailabilityType getAvailability() {
try {
return getValuesOrAvailability(null, null) ? AvailabilityType.UP : AvailabilityType.DOWN;
@@ -84,53 +163,60 @@ public class HTTPNetServiceComponent implements ResourceComponent, MeasurementFa
}
}
+ @Override
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
getValuesOrAvailability(report, metrics);
}
- public boolean getValuesOrAvailability(MeasurementReport report, Set<MeasurementScheduleRequest> metrics)
+ private boolean getValuesOrAvailability(MeasurementReport report, Set<MeasurementScheduleRequest> metrics)
throws Exception {
- try {
-
- Configuration config = resourceContext.getPluginConfiguration();
-
- HttpClient httpClient = new HttpClient();
+ SimpleHttpConnectionManager httpConnectionManager = new SimpleHttpConnectionManager();
+ HttpClient client = new HttpClient(httpConnectionManager);
+
+ String userName = pluginConfig.getSimpleValue(ConfigKeys.USER, StringUtil.EMPTY_STRING);
+ // Set credentials only if a user name is configured
+ if (StringUtil.isNotBlank(userName)) {
+ String password = pluginConfig.getSimpleValue(ConfigKeys.PASSWORD, StringUtil.EMPTY_STRING);
+ String realm = pluginConfig.getSimpleValue(ConfigKeys.REALM, AuthScope.ANY_REALM);
+ client.getState().setCredentials(
+ new AuthScope(componentConfig.getEndPointUrl().getHost(), componentConfig.getEndPointUrl().getPort(),
+ realm), new UsernamePasswordCredentials(userName, password));
+ }
- GetMethod method = new GetMethod(config.getSimple(CONFIG_URL).getStringValue());
+ HttpMethodBase method = null;
+ switch (componentConfig.getHttpMethod()) {
+ case GET:
+ method = new GetMethod(componentConfig.getEndPointUrl().toExternalForm());
+ break;
+ case HEAD:
+ method = new HeadMethod(componentConfig.getEndPointUrl().toExternalForm());
+ break;
+ default:
+ throw new RuntimeException("Unsupported http method: '" + componentConfig.getHttpMethod() + "'");
+ }
+ Boolean followRedirects = pluginConfig.getSimple(ConfigKeys.FOLOW_REDIRECTS).getBooleanValue();
+ method.setFollowRedirects(followRedirects == null ? false : followRedirects.booleanValue());
- method.setFollowRedirects(config.getSimple(CONFIG_FOLOW_REDIRECTS).getBooleanValue());
+ try {
long start = System.currentTimeMillis();
- int responseCode = httpClient.executeMethod(method);
+ int responseCode = client.executeMethod(method);
long connectTime = System.currentTimeMillis() - start;
- boolean success = !config.getSimple("validateResponseCode").getBooleanValue()
+ // Availability may depend on reponse code value
+ boolean success = !pluginConfig.getSimple(ConfigKeys.VALIDATE_RESPONSE_CODE).getBooleanValue()
|| (responseCode >= 200 && responseCode <= 299);
-
- String response = method.getResponseBodyAsString();
+ // Availability may depend on reponse content matching a pattern
+ success = success
+ && (componentConfig.getResponseValidationPattern() == null || componentConfig
+ .getResponseValidationPattern().matcher(method.getResponseBodyAsString()).find());
long readTime = (System.currentTimeMillis() - start);
- // TODO: may need to allow plugin to configure the locale, but for this fixed string, make sure we
- // ignore default locale, this works for english.
- SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz", Locale.ENGLISH);
Header dateHeader = method.getResponseHeader("Date");
- Date contentDate = dateHeader == null ? new Date(System.currentTimeMillis()) : sdf.parse(dateHeader.getValue());
-
- // System.out.println("Success: " + success);
- // System.out.println("Response: " + responseCode);
- // System.out.println("Connect Time: " + connectTime);
- // System.out.println("Read Time: " + readTime);
- // System.out.println("Content Length: " + response.length());
- // System.out.println("Content Date: " + contentDate);
- // System.out.println("Content Charset: " + method.getResponseCharSet());
- // System.out.println("Content Age: " + (System.currentTimeMillis() - contentDate.getTime()));
-
- // System.out.println("-----------------------");
- // for (Header header : method.getResponseHeaders()) {
- // System.out.println(header.getName() + " = " + header.getValue());
- // }
+ Date contentDate = dateHeader == null ? new Date(System.currentTimeMillis()) : DateUtil
+ .parseDate(dateHeader.getValue());
if (metrics != null) {
for (MeasurementScheduleRequest request : metrics) {
@@ -139,7 +225,7 @@ public class HTTPNetServiceComponent implements ResourceComponent, MeasurementFa
} else if (request.getName().equals("readTime")) {
report.addData(new MeasurementDataNumeric(request, (double) readTime));
} else if (request.getName().equals("contentLength")) {
- report.addData(new MeasurementDataNumeric(request, (double) response.length()));
+ report.addData(new MeasurementDataNumeric(request, (double) method.getResponseContentLength()));
} else if (request.getName().equals("contentAge")) {
report.addData(new MeasurementDataNumeric(request,
(double) (System.currentTimeMillis() - contentDate.getTime())));
@@ -150,28 +236,14 @@ public class HTTPNetServiceComponent implements ResourceComponent, MeasurementFa
return success;
} catch (Exception e) {
- // e.printStackTrace();
- log.error(e);
+ LOG.error(e);
+ } finally {
+ // First release connection
+ method.releaseConnection();
+ // Then force close
+ httpConnectionManager.closeIdleConnections(0);
}
return false;
}
- // TODO GH: This really only makes sense to offer to go get the content if we can support long config content for responses bigger than 4k
- public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException,
- Exception {
- Configuration config = resourceContext.getPluginConfiguration();
-
- HttpClient httpClient = new HttpClient();
-
- GetMethod method = new GetMethod(config.getSimple(CONFIG_URL).getStringValue());
-
- method.setFollowRedirects(config.getSimple(CONFIG_FOLOW_REDIRECTS).getBooleanValue());
-
- int responseCode = httpClient.executeMethod(method);
-
- String response = method.getResponseBodyAsString();
-
- OperationResult result = new OperationResult(response);
- return result;
- }
}
diff --git a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponentConfiguration.java b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponentConfiguration.java
new file mode 100644
index 0000000..b28d03f
--- /dev/null
+++ b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponentConfiguration.java
@@ -0,0 +1,57 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2013 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.plugins.netservices;
+
+import java.net.URL;
+import java.util.regex.Pattern;
+
+import org.rhq.plugins.netservices.HTTPNetServiceComponent.HttpMethod;
+
+/**
+ * @author Thomas Segismont
+ */
+class HTTPNetServiceComponentConfiguration {
+
+ private URL endPointUrl;
+
+ private HttpMethod httpMethod;
+
+ private Pattern responseValidationPattern;
+
+ public HTTPNetServiceComponentConfiguration(URL endPointUrl, HttpMethod httpMethod,
+ Pattern responseValidationPattern) {
+ this.endPointUrl = endPointUrl;
+ this.httpMethod = httpMethod;
+ this.responseValidationPattern = responseValidationPattern;
+ }
+
+ public URL getEndPointUrl() {
+ return endPointUrl;
+ }
+
+ public HttpMethod getHttpMethod() {
+ return httpMethod;
+ }
+
+ public Pattern getResponseValidationPattern() {
+ return responseValidationPattern;
+ }
+
+}
\ No newline at end of file
diff --git a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponent.java b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponent.java
index f0d693b..6b259b3 100644
--- a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponent.java
+++ b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponent.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -19,48 +19,37 @@
package org.rhq.plugins.netservices;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import java.util.Collections;
+import java.util.Set;
+
+import org.rhq.core.domain.configuration.Configuration;
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.domain.configuration.Configuration;
-
-import java.util.Set;
-import java.util.Collections;
-import java.net.URL;
-import java.net.MalformedURLException;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
/**
* @author Greg Hinkle
*/
public class HTTPNetServiceDiscoveryComponent implements ResourceDiscoveryComponent, ManualAddFacet {
- public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException, Exception {
+
+ @Override
+ public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext)
+ throws InvalidPluginConfigurationException, Exception {
// We don't support auto-discovery.
return Collections.emptySet();
}
+ @Override
public DiscoveredResourceDetails discoverResource(Configuration config,
- ResourceDiscoveryContext resourceDiscoveryContext)
- throws InvalidPluginConfigurationException {
- String configURL = config.getSimple(HTTPNetServiceComponent.CONFIG_URL).getStringValue();
- URL url;
- try {
- url = new URL(configURL);
- }
- catch (MalformedURLException e) {
- throw new InvalidPluginConfigurationException("Property '" + HTTPNetServiceComponent.CONFIG_URL
- + "' is not a valid URL.");
- }
- DiscoveredResourceDetails details =
- new DiscoveredResourceDetails(
- resourceDiscoveryContext.getResourceType(),
- url.toExternalForm(),
- url.toExternalForm(),
- null,
- null,
- config,
- null);
+ ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException {
+ // Get the component configuration. This call will also make configuration checks
+ HTTPNetServiceComponentConfiguration componentConfiguration = HTTPNetServiceComponent
+ .createComponentConfiguration(config);
+ String endPointUrl = componentConfiguration.getEndPointUrl().toExternalForm();
+ DiscoveredResourceDetails details = new DiscoveredResourceDetails(resourceDiscoveryContext.getResourceType(),
+ endPointUrl, endPointUrl, null, null, config, null);
return details;
}
}
diff --git a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceComponent.java b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceComponent.java
index f219e05..f416140 100644
--- a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceComponent.java
+++ b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceComponent.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -19,78 +19,93 @@
package org.rhq.plugins.netservices;
-import org.apache.commons.httpclient.Header;
-import org.apache.commons.httpclient.HttpClient;
-import org.apache.commons.httpclient.methods.GetMethod;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.configuration.Configuration;
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.domain.measurement.MeasurementDataTrait;
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 java.text.SimpleDateFormat;
-import java.util.Date;
-import java.util.Set;
-import java.net.InetAddress;
-import java.net.Inet4Address;
-import java.net.UnknownHostException;
-
+import org.rhq.core.util.StringUtil;
/**
- * Monitoring of HTTP Servers
+ * Monitoring of IP addresses
*
* @author Greg Hinkle
*/
public class PingNetServiceComponent implements ResourceComponent, MeasurementFacet {
- public static final String CONFIG_ADDRESS = "address";
+ public static final class ConfigKeys {
+ private ConfigKeys() {
+ // Defensive
+ }
+
+ public static final String ADDRESS = "address";
+ }
- private ResourceContext resourceContext;
+ private static final Log LOG = LogFactory.getLog(PingNetServiceComponent.class);
- public void start(ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception {
- this.resourceContext = resourceContext;
- String addressString = resourceContext.getPluginConfiguration().getSimple(CONFIG_ADDRESS).getStringValue();
+ private static final int PING_TIMEOUT = 5000;
+
+ private InetAddress address;
+
+ @Override
+ public void start(@SuppressWarnings("rawtypes")
+ ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception {
+ address = createComponentConfiguration(resourceContext.getPluginConfiguration());
+ }
+
+ static InetAddress createComponentConfiguration(Configuration pluginConfig)
+ throws InvalidPluginConfigurationException {
+ String addressString = pluginConfig.getSimpleValue(ConfigKeys.ADDRESS, StringUtil.EMPTY_STRING);
+ if (StringUtil.isBlank(addressString)) {
+ throw new InvalidPluginConfigurationException("Address is not defined");
+ }
try {
- InetAddress address = InetAddress.getByName(addressString);
+ return InetAddress.getByName(addressString);
} catch (UnknownHostException uhe) {
throw new InvalidPluginConfigurationException(uhe);
}
}
+ @Override
public void stop() {
+ address = null;
}
+ @Override
public AvailabilityType getAvailability() {
try {
- String addressString = resourceContext.getPluginConfiguration().getSimple(CONFIG_ADDRESS).getStringValue();
- InetAddress address = InetAddress.getByName(addressString);
- return address.isReachable(5000) ? AvailabilityType.UP : AvailabilityType.DOWN;
+ return address.isReachable(PING_TIMEOUT) ? AvailabilityType.UP : AvailabilityType.DOWN;
} catch (Exception e) {
+ if (LOG.isWarnEnabled()) {
+ LOG.warn(address.getHostAddress() + " not reachable", e);
+ }
return AvailabilityType.DOWN;
}
}
-
+ @Override
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
- String addressString = resourceContext.getPluginConfiguration().getSimple(CONFIG_ADDRESS).getStringValue();
- InetAddress address = InetAddress.getByName(addressString);
-
- for (MeasurementScheduleRequest request :metrics) {
+ for (MeasurementScheduleRequest request : metrics) {
if (request.getName().equals("ipAddress")) {
report.addData(new MeasurementDataTrait(request, address.getHostAddress()));
} else if (request.getName().equals("hostName")) {
report.addData(new MeasurementDataTrait(request, address.getCanonicalHostName()));
} else if (request.getName().equals("responseTime")) {
long start = System.currentTimeMillis();
- address.isReachable(5000);
+ address.isReachable(PING_TIMEOUT);
report.addData(new MeasurementDataNumeric(request, (double) (System.currentTimeMillis() - start)));
}
}
diff --git a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponent.java b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponent.java
index 3f41a7e..da87c1b 100644
--- a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponent.java
+++ b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponent.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2008 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -19,40 +19,37 @@
package org.rhq.plugins.netservices;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
-import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
+import java.net.InetAddress;
+import java.util.Collections;
+import java.util.Set;
+
+import org.rhq.core.domain.configuration.Configuration;
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.domain.configuration.Configuration;
-
-import java.util.Set;
-import java.util.Collections;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
/**
* @author Greg Hinkle
*/
public class PingNetServiceDiscoveryComponent implements ResourceDiscoveryComponent, ManualAddFacet {
+
+ private static final String RESOURCE_NAME_PREFIX = "Ping ";
+
+ @Override
public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext)
- throws InvalidPluginConfigurationException, Exception {
+ throws InvalidPluginConfigurationException, Exception {
// We don't support auto-discovery.
return Collections.emptySet();
}
+ @Override
public DiscoveredResourceDetails discoverResource(Configuration config,
- ResourceDiscoveryContext resourceDiscoveryContext)
- throws InvalidPluginConfigurationException {
- String address = config.getSimple(PingNetServiceComponent.CONFIG_ADDRESS).getStringValue();
- // TODO: Validate the address is a valid host name or IP address.
- DiscoveredResourceDetails details =
- new DiscoveredResourceDetails(
- resourceDiscoveryContext.getResourceType(),
- address,
- "Ping " + address,
- null,
- null,
- config,
- null);
+ ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException {
+ InetAddress address = PingNetServiceComponent.createComponentConfiguration(config);
+ DiscoveredResourceDetails details = new DiscoveredResourceDetails(resourceDiscoveryContext.getResourceType(),
+ address.getHostAddress(), RESOURCE_NAME_PREFIX + address.getHostAddress(), null, null, config, null);
return details;
}
}
\ No newline at end of file
diff --git a/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml
index b6b0cd3..16a48d5 100644
--- a/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml
@@ -11,30 +11,29 @@
<service name="HTTPService"
discovery="HTTPNetServiceDiscoveryComponent"
class="HTTPNetServiceComponent"
- supportsManualAdd="true">
+ supportsManualAdd="true"
+ description="HTTP Endpoint monitoring service">
<plugin-configuration>
- <c:simple-property name="url"/>
- <c:simple-property name="user" required="false"/>
- <c:simple-property name="password" required="false"/>
- <c:simple-property name="realm" required="false"/>
- <c:simple-property name="validateResponseCode" type="boolean" default="false"
- description="Codes in the 200-299 range are considered success"/>
- <c:simple-property name="sslProtocol" default="none">
- <c:property-options>
- <c:option value="none"/>
- <c:option value="SSL"/>
- <c:option value="TLS"/>
- </c:property-options>
- </c:simple-property>
+ <c:simple-property name="url" description="Http URL of the endpoint" />
+ <c:simple-property name="user" required="false"
+ description="User name if http endpoint requires authentication." />
+ <c:simple-property name="password" required="false"
+ description="Password if http endpoint requires authentication." />
+ <c:simple-property name="realm" required="false"
+ description="Authentication Realm. By default user name and password will be used with any realm." />
<c:simple-property name="method" default="GET">
<c:property-options>
<c:option value="HEAD"/>
<c:option value="GET"/>
</c:property-options>
</c:simple-property>
- <c:simple-property name="followRedirects" type="boolean" default="false"/>
- <c:simple-property name="responsePattern" required="false"/>
+ <c:simple-property name="followRedirects" type="boolean" default="false"
+ description="Follow http redirects when contacting endpoints?" />
+ <c:simple-property name="validateResponseCode" type="boolean" default="false"
+ description="Set this to true if response code should determine availability. Codes in the 200-299 range are considered success." />
+ <c:simple-property name="validateResponsePattern" required="false"
+ description="If not empty, availability will depend on http response having content matching this (Java style) regular expression."/>
</plugin-configuration>
<metric property="connectTime" units="milliseconds" displayType="summary"
@@ -46,17 +45,17 @@
<metric property="contentAge" units="milliseconds"
description="The declared age of the requested page"/>
-
</service>
<service name="PingService"
discovery="PingNetServiceDiscoveryComponent"
class="PingNetServiceComponent"
- supportsManualAdd="true">
+ supportsManualAdd="true"
+ description="IP address ping service">
<plugin-configuration>
- <c:simple-property name="address"/>
+ <c:simple-property name="address" description="IP address"/>
</plugin-configuration>
<metric property="ipAddress" displayType="summary" dataType="trait" description="The ip address of the host"/>
diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponentTest.java
new file mode 100644
index 0000000..0745a34
--- /dev/null
+++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponentTest.java
@@ -0,0 +1,178 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2013, 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.netservices;
+
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+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.ResourceDiscoveryContext;
+import org.rhq.plugins.netservices.HTTPNetServiceComponent.ConfigKeys;
+import org.rhq.plugins.netservices.HTTPNetServiceComponent.HttpMethod;
+
+/**
+ * @author Thomas Segismont
+ */
+public class HTTPNetServiceDiscoveryComponentTest {
+
+ private HTTPNetServiceDiscoveryComponent httpNetServiceDiscoveryComponent;
+
+ private Configuration configuration;
+
+ @Mock
+ private ResourceDiscoveryContext<?> resourceDiscoveryContext;
+
+ @Mock
+ private ResourceType resourceType;
+
+ @BeforeMethod(alwaysRun = true)
+ protected void setUp() throws Exception {
+ httpNetServiceDiscoveryComponent = new HTTPNetServiceDiscoveryComponent();
+ configuration = new Configuration();
+ configuration.setSimpleValue(ConfigKeys.URL, "http://www.myhost.com/pipo/molo");
+ configuration.setSimpleValue(ConfigKeys.METHOD, HttpMethod.GET.name());
+ configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_PATTERN, "(ok|success)");
+ MockitoAnnotations.initMocks(this);
+ when(resourceDiscoveryContext.getResourceType()).thenReturn(resourceType);
+ }
+
+ @Test
+ public void testDiscoverResources() throws Exception {
+ // Manual add only, should always return empty set
+ assertEquals(0, httpNetServiceDiscoveryComponent.discoverResources(null).size());
+ }
+
+ @Test
+ public void testValidComponentConfiguration() {
+ try {
+ DiscoveredResourceDetails resourceDetails = httpNetServiceDiscoveryComponent.discoverResource(
+ configuration, resourceDiscoveryContext);
+ assertEquals(resourceDetails.getResourceType(), resourceType);
+ } catch (InvalidPluginConfigurationException e) {
+ fail("Component configuration should be valid", e);
+ }
+ }
+
+ @Test
+ public void testMissingUrl() {
+ try {
+ configuration.remove(ConfigKeys.URL);
+ httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getMessage(), "Endpoint URL is not defined");
+ }
+ }
+
+ @Test
+ public void testMalformedUrl() {
+ String configUrl = "pipomolo";
+ try {
+ configuration.setSimpleValue(ConfigKeys.URL, configUrl);
+ httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getMessage(), configUrl + " is not a valid URL");
+ }
+ }
+
+ @Test
+ public void testNotHttpOrHttpsUrl() {
+ String configUrl = "ftp://pipo.com/molo.zipo";
+ try {
+ configuration.setSimpleValue(ConfigKeys.URL, configUrl);
+ httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getMessage(), configUrl + "does not point to an http(s) resource");
+ }
+ }
+
+ @Test
+ public void testHttpsUrl() {
+ try {
+ configuration.setSimpleValue(ConfigKeys.URL, "https://www.myhost.com/pipo/molo");
+ DiscoveredResourceDetails resourceDetails = httpNetServiceDiscoveryComponent.discoverResource(
+ configuration, resourceDiscoveryContext);
+ assertEquals(resourceDetails.getResourceType(), resourceType);
+ } catch (InvalidPluginConfigurationException e) {
+ fail("Component configuration should be valid", e);
+ }
+ }
+
+ @Test
+ public void testInvalidHttpMethod() {
+ String configMethod = "DELETE";
+ try {
+ configuration.setSimpleValue(ConfigKeys.METHOD, configMethod);
+ httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getMessage(), "Invalid http method: " + configMethod);
+ }
+ }
+
+ @Test
+ public void testHeadMethod() {
+ try {
+ configuration.setSimpleValue(ConfigKeys.METHOD, HttpMethod.HEAD.name());
+ configuration.remove(ConfigKeys.VALIDATE_RESPONSE_PATTERN);
+ DiscoveredResourceDetails resourceDetails = httpNetServiceDiscoveryComponent.discoverResource(
+ configuration, resourceDiscoveryContext);
+ assertEquals(resourceDetails.getResourceType(), resourceType);
+ } catch (InvalidPluginConfigurationException e) {
+ fail("Component configuration should be valid", e);
+ }
+ }
+
+ @Test
+ public void testUnableToValidateContentWithHeadRequest() {
+ try {
+ configuration.setSimpleValue(ConfigKeys.METHOD, HttpMethod.HEAD.name());
+ httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getMessage(), "Cannot validate response content with HEAD request");
+ }
+ }
+
+ @Test
+ public void testInvalidPatternSyntax() {
+ String configValidateResponsePattern = "(pipo";
+ try {
+ configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_PATTERN, configValidateResponsePattern);
+ httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getMessage(), "Invalid pattern: " + configValidateResponsePattern);
+ }
+ }
+
+}
diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponentTest.java
new file mode 100644
index 0000000..961a81c
--- /dev/null
+++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponentTest.java
@@ -0,0 +1,105 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2013, 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.netservices;
+
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
+import java.net.UnknownHostException;
+
+import org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+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.ResourceDiscoveryContext;
+import org.rhq.plugins.netservices.PingNetServiceComponent.ConfigKeys;
+
+/**
+ * @author Thomas Segismont
+ */
+public class PingNetServiceDiscoveryComponentTest {
+
+ private PingNetServiceDiscoveryComponent pingNetServiceDiscoveryComponent;
+
+ private Configuration configuration;
+
+ @Mock
+ private ResourceDiscoveryContext<?> resourceDiscoveryContext;
+
+ @Mock
+ private ResourceType resourceType;
+
+ @BeforeMethod(alwaysRun = true)
+ protected void setUp() throws Exception {
+ pingNetServiceDiscoveryComponent = new PingNetServiceDiscoveryComponent();
+ configuration = new Configuration();
+ configuration.setSimpleValue(ConfigKeys.ADDRESS, "127.0.0.1");
+ MockitoAnnotations.initMocks(this);
+ when(resourceDiscoveryContext.getResourceType()).thenReturn(resourceType);
+ }
+
+ @Test
+ public void testDiscoverResources() throws Exception {
+ // Manual add only, should always return empty set
+ assertEquals(0, pingNetServiceDiscoveryComponent.discoverResources(null).size());
+ }
+
+ @Test
+ public void testValidComponentConfiguration() {
+ try {
+ DiscoveredResourceDetails resourceDetails = pingNetServiceDiscoveryComponent.discoverResource(
+ configuration, resourceDiscoveryContext);
+ assertEquals(resourceDetails.getResourceType(), resourceType);
+ } catch (InvalidPluginConfigurationException e) {
+ fail("Component configuration should be valid", e);
+ }
+ }
+
+ @Test
+ public void testMissingAddress() {
+ try {
+ configuration.remove(ConfigKeys.ADDRESS);
+ pingNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getMessage(), "Address is not defined");
+ }
+ }
+
+ @Test
+ public void testMalformedAddress() {
+ String configAddress = "pipomolo";
+ try {
+ configuration.setSimpleValue(ConfigKeys.ADDRESS, configAddress);
+ pingNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getCause().getClass(), UnknownHostException.class);
+ }
+ }
+
+}
diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
new file mode 100644
index 0000000..24b6644
--- /dev/null
+++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
@@ -0,0 +1,162 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2013, 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.netservices.itest;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import javax.servlet.ServletException;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.servlet.ServletContextHandler;
+import org.eclipse.jetty.servlet.ServletHolder;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.discovery.MergeResourceResponse;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.DataType;
+import org.rhq.core.domain.measurement.MeasurementData;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.plugins.netservices.HTTPNetServiceComponent;
+import org.rhq.plugins.netservices.HTTPNetServiceComponent.ConfigKeys;
+import org.rhq.plugins.netservices.HTTPNetServiceComponent.HttpMethod;
+
+/**
+ * @author Thomas Segismont
+ */
+public class HTTPNetServiceComponentTest extends NetServiceComponentTest {
+
+ private static final Log LOG = LogFactory.getLog(NetServiceComponentTest.class);
+
+ private static final String SERVICE_NAME = "HTTPService";
+
+ private static final String HTTP_HOST = "localhost";
+
+ private static final int HTTP_PORT = 31158;
+
+ private static final int SERVLET_SLEEP = 1000;
+
+ private Server jettyServer;
+
+ private HTTPNetServiceComponent httpNetServiceComponent;
+
+ @BeforeClass
+ public void startJetty() throws Exception {
+ LOG.info("Setting up Jetty test server");
+ jettyServer = new Server(new InetSocketAddress(HTTP_HOST, HTTP_PORT));
+ ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS);
+ context.setContextPath("/");
+ jettyServer.setHandler(context);
+ @SuppressWarnings("serial")
+ HttpServlet testServlet = new HttpServlet() {
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
+ resp.getWriter().println("Test servlet request: success view");
+ long start = System.currentTimeMillis();
+ do {
+ try {
+ Thread.sleep(SERVLET_SLEEP);
+ } catch (InterruptedException e) {
+ }
+ } while (System.currentTimeMillis() - start < SERVLET_SLEEP);
+ }
+ };
+ context.addServlet(new ServletHolder(testServlet), "/*");
+ jettyServer.start();
+ }
+
+ @AfterClass
+ public void stopJetty() {
+ LOG.info("Shutting down Jetty test server");
+ try {
+ if (jettyServer != null) {
+ jettyServer.stop();
+ }
+ } catch (Exception ignore) {
+ }
+ }
+
+ @Test(dependsOnMethods = "testPluginLoad")
+ public void testManualAdd() throws Exception {
+ Configuration configuration = new Configuration();
+ configuration.setSimpleValue(ConfigKeys.URL, "http://" + HTTP_HOST + ":" + HTTP_PORT + "/pipo/molo");
+ configuration.setSimpleValue(ConfigKeys.METHOD, HttpMethod.GET.name());
+ configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_CODE, "true");
+ configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_PATTERN, "success");
+ MergeResourceResponse response = getInventoryManager().manuallyAddResource(
+ getPluginManager().getMetadataManager().getType(SERVICE_NAME, PLUGIN_NAME), getPlatform().getId(),
+ configuration, -1);
+ assertNotNull(response, "Manual add response is null");
+ @SuppressWarnings("rawtypes")
+ ResourceComponent resourceComponent = getInventoryManager().getResourceContainer(response.getResourceId())
+ .getResourceComponent();
+ assertEquals(resourceComponent.getClass(), HTTPNetServiceComponent.class);
+ httpNetServiceComponent = (HTTPNetServiceComponent) resourceComponent;
+ }
+
+ @Test(dependsOnMethods = "testManualAdd")
+ public void testAvailability() throws Exception {
+ assertEquals(httpNetServiceComponent.getAvailability(), AvailabilityType.UP);
+ }
+
+ @Test(dependsOnMethods = "testAvailability")
+ public void testMeasurement() throws Exception {
+ MeasurementReport report = new MeasurementReport();
+ Set<MeasurementScheduleRequest> metrics = new HashSet<MeasurementScheduleRequest>();
+ int scheduleId = 1;
+ metrics.add(new MeasurementScheduleRequest(scheduleId++, "connectTime", 1000, true, DataType.MEASUREMENT));
+ metrics.add(new MeasurementScheduleRequest(scheduleId++, "readTime", 1000, true, DataType.MEASUREMENT));
+ metrics.add(new MeasurementScheduleRequest(scheduleId++, "contentLength", 1000, true, DataType.MEASUREMENT));
+ metrics.add(new MeasurementScheduleRequest(scheduleId++, "contentAge", 1000, true, DataType.MEASUREMENT));
+ httpNetServiceComponent.getValues(report, metrics);
+ Map<String, Object> datas = new HashMap<String, Object>();
+ for (MeasurementData data : report.getNumericData()) {
+ datas.put(data.getName(), data.getValue());
+ }
+ Double value = getMetric(datas, "connectTime");
+ assertTrue(value > SERVLET_SLEEP);
+ value = getMetric(datas, "readTime");
+ assertTrue(value > SERVLET_SLEEP);
+ value = getMetric(datas, "contentLength");
+ assertTrue(value > 0);
+ value = getMetric(datas, "contentAge");
+ assertTrue(value > 0);
+ }
+
+}
diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java
new file mode 100644
index 0000000..503e359
--- /dev/null
+++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java
@@ -0,0 +1,154 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2013, 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.netservices.itest;
+
+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.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.io.File;
+import java.util.Map;
+import java.util.concurrent.atomic.AtomicInteger;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.mockito.Mockito;
+import org.mockito.invocation.InvocationOnMock;
+import org.mockito.stubbing.Answer;
+import org.testng.annotations.AfterSuite;
+import org.testng.annotations.BeforeSuite;
+import org.testng.annotations.Test;
+
+import org.rhq.core.clientapi.server.discovery.DiscoveryServerService;
+import org.rhq.core.domain.discovery.MergeResourceResponse;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.pc.PluginContainer;
+import org.rhq.core.pc.PluginContainerConfiguration;
+import org.rhq.core.pc.ServerServices;
+import org.rhq.core.pc.inventory.InventoryManager;
+import org.rhq.core.pc.plugin.FileSystemPluginFinder;
+import org.rhq.core.pc.plugin.PluginEnvironment;
+import org.rhq.core.pc.plugin.PluginManager;
+
+/**
+ * @author Thomas Segismont
+ */
+public abstract class NetServiceComponentTest {
+
+ public static final String PLUGIN_NAME = "NetworkServices";
+
+ private static final Log LOG = LogFactory.getLog(NetServiceComponentTest.class);
+
+ private static final AtomicInteger resourceIdGenerator = new AtomicInteger(Integer.MIN_VALUE / 2);
+
+ private static PluginContainer pluginContainer;
+
+ private static InventoryManager inventoryManager;
+
+ private static Resource platform;
+
+ private static PluginManager pluginManager;
+
+ private static PluginEnvironment pluginEnvironment;
+
+ protected PluginContainer getPluginContainer() {
+ return pluginContainer;
+ }
+
+ protected InventoryManager getInventoryManager() {
+ return inventoryManager;
+ }
+
+ protected Resource getPlatform() {
+ return platform;
+ }
+
+ protected PluginManager getPluginManager() {
+ return pluginManager;
+ }
+
+ protected PluginEnvironment getPluginEnvironment() {
+ return pluginEnvironment;
+ }
+
+ @BeforeSuite
+ public static void startPluginContainer() throws Exception {
+ LOG.info("Setting up plugin container");
+ File pluginDir = new File("target/itest/plugins");
+ PluginContainerConfiguration containerConfig = new PluginContainerConfiguration();
+ containerConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir));
+ containerConfig.setPluginDirectory(pluginDir);
+ containerConfig.setInsideAgent(false);
+ // netservices plugin has resources which can only be manually added so we have to mock server integration.
+ DiscoveryServerService discoveryServerService = Mockito.mock(DiscoveryServerService.class);
+ when(discoveryServerService.addResource(any(Resource.class), anyInt())).thenAnswer(
+ new Answer<MergeResourceResponse>() {
+
+ @Override
+ public MergeResourceResponse answer(InvocationOnMock invocation) throws Throwable {
+ return new MergeResourceResponse(resourceIdGenerator.decrementAndGet(), false);
+ }
+ });
+ ServerServices serverServices = new ServerServices();
+ serverServices.setDiscoveryServerService(discoveryServerService);
+ containerConfig.setServerServices(serverServices);
+ pluginContainer = PluginContainer.getInstance();
+ pluginContainer.setConfiguration(containerConfig);
+ pluginContainer.initialize();
+ inventoryManager = pluginContainer.getInventoryManager();
+ platform = inventoryManager.getPlatform();
+ pluginManager = pluginContainer.getPluginManager();
+ pluginEnvironment = pluginManager.getPlugin(PLUGIN_NAME);
+ }
+
+ @AfterSuite
+ public static void stopPluginContainer() {
+ LOG.info("Shutting down plugin container");
+ try {
+ if (pluginContainer != null) {
+ pluginContainer.shutdown();
+ }
+ } catch (Exception ignore) {
+ }
+ }
+
+ @Test
+ public static void testPluginLoad() {
+ assertNotNull(pluginEnvironment, "Plugin not loaded");
+ assertEquals(pluginEnvironment.getPluginName(), PLUGIN_NAME);
+ }
+
+ public static Double getMetric(Map<String, Object> datas, String metricName) {
+ assertTrue(datas.containsKey(metricName), metricName + " metric not found");
+ assertTrue(datas.get(metricName).getClass().equals(Double.class), metricName + " metric value is not a Double");
+ return (Double) datas.get(metricName);
+ }
+
+ public static String getTrait(Map<String, Object> datas, String traitName) {
+ assertTrue(datas.containsKey(traitName), traitName + " trait not found");
+ assertTrue(datas.get(traitName).getClass().equals(String.class), traitName + " traitName value is not a String");
+ return (String) datas.get(traitName);
+ }
+
+}
diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PingNetServiceComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PingNetServiceComponentTest.java
new file mode 100644
index 0000000..ea1a374
--- /dev/null
+++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PingNetServiceComponentTest.java
@@ -0,0 +1,98 @@
+/*
+ * RHQ Management Platform
+ * Copyright 2013, 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.netservices.itest;
+
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertTrue;
+
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.discovery.MergeResourceResponse;
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.DataType;
+import org.rhq.core.domain.measurement.MeasurementData;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
+import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.util.StringUtil;
+import org.rhq.plugins.netservices.PingNetServiceComponent;
+import org.rhq.plugins.netservices.PingNetServiceComponent.ConfigKeys;
+
+/**
+ * @author Thomas Segismont
+ */
+public class PingNetServiceComponentTest extends NetServiceComponentTest {
+
+ private static final String SERVICE_NAME = "PingService";
+
+ private static final String LOOPBACK = "127.0.0.1";
+
+ private PingNetServiceComponent pingNetServiceComponent;
+
+ @Test(dependsOnMethods = "testPluginLoad")
+ public void testManualAdd() throws Exception {
+ Configuration configuration = new Configuration();
+ configuration.setSimpleValue(ConfigKeys.ADDRESS, LOOPBACK);
+ MergeResourceResponse response = getInventoryManager().manuallyAddResource(
+ getPluginManager().getMetadataManager().getType(SERVICE_NAME, PLUGIN_NAME), getPlatform().getId(),
+ configuration, -1);
+ assertNotNull(response, "Manual add response is null");
+ @SuppressWarnings("rawtypes")
+ ResourceComponent resourceComponent = getInventoryManager().getResourceContainer(response.getResourceId())
+ .getResourceComponent();
+ assertEquals(resourceComponent.getClass(), PingNetServiceComponent.class);
+ pingNetServiceComponent = (PingNetServiceComponent) resourceComponent;
+ }
+
+ @Test(dependsOnMethods = "testManualAdd")
+ public void testAvailability() throws Exception {
+ assertEquals(pingNetServiceComponent.getAvailability(), AvailabilityType.UP);
+ }
+
+ @Test(dependsOnMethods = "testAvailability")
+ public void testMeasurement() throws Exception {
+ MeasurementReport report = new MeasurementReport();
+ Set<MeasurementScheduleRequest> metrics = new HashSet<MeasurementScheduleRequest>();
+ int scheduleId = 1;
+ metrics.add(new MeasurementScheduleRequest(scheduleId++, "ipAddress", 1000, true, DataType.TRAIT));
+ metrics.add(new MeasurementScheduleRequest(scheduleId++, "hostName", 1000, true, DataType.TRAIT));
+ metrics.add(new MeasurementScheduleRequest(scheduleId++, "responseTime", 1000, true, DataType.MEASUREMENT));
+ pingNetServiceComponent.getValues(report, metrics);
+ Map<String, Object> datas = new HashMap<String, Object>();
+ for (MeasurementData data : report.getNumericData()) {
+ datas.put(data.getName(), data.getValue());
+ }
+ for (MeasurementData data : report.getTraitData()) {
+ datas.put(data.getName(), data.getValue());
+ }
+ assertEquals(getTrait(datas, "ipAddress"), LOOPBACK);
+ assertTrue(StringUtil.isNotBlank(getTrait(datas, "hostName")));
+ assertTrue(getMetric(datas, "responseTime") >= 0);
+ }
+
+}
diff --git a/modules/plugins/netservices/src/test/resources/log4j.xml b/modules/plugins/netservices/src/test/resources/log4j.xml
new file mode 100644
index 0000000..4815936
--- /dev/null
+++ b/modules/plugins/netservices/src/test/resources/log4j.xml
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+
+<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
+
+<!-- | For more configuration information and examples, see the Jakarta Log4j | website: http://jakarta.apache.org/log4j -->
+
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+
+ <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender">
+ <param name="Target" value="System.out" />
+ <param name="Threshold" value="INFO" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) - %m%n" />
+ </layout>
+ </appender>
+
+ <appender name="FILE" class="org.apache.log4j.RollingFileAppender">
+ <param name="File" value="target/test.log" />
+ <param name="Append" value="false" />
+ <param name="Threshold" value="DEBUG" />
+ <layout class="org.apache.log4j.PatternLayout">
+ <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) - %m%n" />
+ </layout>
+ </appender>
+
+ <root>
+ <level value="DEBUG" />
+ <appender-ref ref="CONSOLE" />
+ <appender-ref ref="FILE" />
+ </root>
+
+</log4j:configuration>
commit b3b316f4b6761183fa75738008a94acc3bad918a
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Feb 21 15:16:37 2013 +0100
Add getAlerts4Definition, extend testing
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java
index ce208a3..ce1ad76 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java
@@ -45,6 +45,8 @@ import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiError;
+import com.wordnik.swagger.annotations.ApiErrors;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
@@ -86,18 +88,40 @@ public class AlertHandlerBean extends AbstractRestBean {
@GZIP
@GET
@Path("/")
- @ApiOperation(value = "List all alerts", multiValueResponse = true, responseClass = "List<AlertRest>")
+ @ApiOperation(value = "List all alerts, possibly limiting by resource or alert definition, priority and start time", multiValueResponse = true, responseClass = "List<AlertRest>")
+ @ApiErrors({
+ @ApiError(code = 406, reason = "There are 'resourceId' and 'definitionId' passed as query parameters"),
+ @ApiError(code = 406, reason = "Page size was 0"),
+ @ApiError(code = 406, reason = "Page number was < 1")
+ })
public Response listAlerts(
- @ApiParam(value = "Page number", defaultValue = "1") @QueryParam("page") int page,
+ @ApiParam(value = "Page number") @QueryParam("page") @DefaultValue("1") int page,
+ @ApiParam(value = "Page size; use -1 for 'unlimited'") @QueryParam("size") @DefaultValue("100")int size,
@ApiParam(value = "Limit to priority", allowableValues = "High, Medium, Low, All") @DefaultValue("All") @QueryParam("prio") String prio,
@ApiParam(value = "Should full resources and definitions be sent") @QueryParam("slim") @DefaultValue("false") boolean slim,
- @ApiParam( value = "If non-null only send alerts that have fired after this time, time is millisecond since epoch") @QueryParam("since") Long since,
+ @ApiParam(value = "If non-null only send alerts that have fired after this time, time is millisecond since epoch") @QueryParam("since") Long since,
@ApiParam(value = "Id of a resource to limit search for") @QueryParam("resourceId") Integer resourceId,
+ @ApiParam(value = "If of an alert definition to search for") @QueryParam("definitionId") Integer definitionId,
@Context UriInfo uriInfo, @Context HttpHeaders headers) {
+ if (resourceId!=null && definitionId!=null) {
+ throw new BadArgumentException("At most one of 'resourceId' and 'definitionId' may be given");
+ }
+ if (size==0)
+ throw new BadArgumentException("size","Must not be 0");
+ if (page<1)
+ throw new BadArgumentException("page","Must be >=1");
AlertCriteria criteria = new AlertCriteria();
- criteria.setPaging(page,20); // TODO implement linking to next page
+
+ if (size==-1) {
+ PageControl pageControl = PageControl.getUnlimitedInstance();
+ pageControl.setPageNumber(page);
+ criteria.setPageControl(pageControl);
+ }
+ else
+ criteria.setPaging(page-1, size); // TODO implement linking to next page
+
if (since!=null) {
criteria.addFilterStartTime(since);
}
@@ -105,6 +129,9 @@ public class AlertHandlerBean extends AbstractRestBean {
if (resourceId!=null) {
criteria.addFilterResourceIds(resourceId);
}
+ if (definitionId!=null) {
+ criteria.addFilterAlertDefinitionIds(definitionId);
+ }
if (!prio.equals("All")) {
AlertPriority alertPriority = AlertPriority.valueOf(prio.toUpperCase());
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/BadArgumentException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/BadArgumentException.java
index c07b4ce..cea84c2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/BadArgumentException.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/BadArgumentException.java
@@ -32,7 +32,7 @@ public class BadArgumentException extends RuntimeException {
private static final long serialVersionUID = 1L;
public BadArgumentException(String message) {
- super("Bad parameter given: " + message);
+ super("Bad parameter(s) given: " + message);
}
/**
@@ -43,4 +43,5 @@ public class BadArgumentException extends RuntimeException {
public BadArgumentException(String parameterName, String cause) {
super("Parameter " + parameterName + " is bad: " + cause);
}
+
}
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
index 7e9fa70..aa56a46 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
@@ -27,11 +27,13 @@ import org.junit.Test;
import org.rhq.modules.integrationTests.restApi.d.AlertCondition;
import org.rhq.modules.integrationTests.restApi.d.AlertDefinition;
import org.rhq.modules.integrationTests.restApi.d.AlertNotification;
+import org.rhq.modules.integrationTests.restApi.d.Availability;
import org.rhq.modules.integrationTests.restApi.d.Group;
import static com.jayway.restassured.RestAssured.delete;
import static com.jayway.restassured.RestAssured.expect;
import static com.jayway.restassured.RestAssured.given;
+import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.iterableWithSize;
@@ -115,7 +117,43 @@ public class AlertTest extends AbstractBase {
.get("/alert/count")
.xmlPath();
- int count = xmlPath.getInt("value.@value");
+ xmlPath.getInt("value.@value");
+ }
+
+ @Test
+ public void testGetAlertByBadId() throws Exception {
+ given()
+ .header(acceptJson)
+ .pathParam("id",123)
+ .expect()
+ .statusCode(404)
+ .log().ifError()
+ .when()
+ .get("/alert/{id}");
+ }
+
+ @Test
+ public void testGetAlertConditionLogsByBadId() throws Exception {
+ given()
+ .header(acceptJson)
+ .pathParam("id",123)
+ .expect()
+ .statusCode(404)
+ .log().ifError()
+ .when()
+ .get("/alert/{id}/conditions");
+ }
+
+ @Test
+ public void testGetAlertNotificationLogsByBadId() throws Exception {
+ given()
+ .header(acceptJson)
+ .pathParam("id",123)
+ .expect()
+ .statusCode(404)
+ .log().everything()
+ .when()
+ .get("/alert/{id}/notifications");
}
@Test
@@ -200,7 +238,7 @@ public class AlertTest extends AbstractBase {
@Test
public void testCreateDeleteBasicAlertDefinition() throws Exception {
- int definitionId = createEmptyAlertDefinition();
+ int definitionId = createEmptyAlertDefinition(false);
cleanupDefinition(definitionId);
}
@@ -333,7 +371,7 @@ public class AlertTest extends AbstractBase {
@Test
public void testCreateDeleteAlertDefinitionWith1Condition() throws Exception {
- int definitionId = createEmptyAlertDefinition();
+ int definitionId = createEmptyAlertDefinition(false);
// Now add a condition
try {
@@ -376,7 +414,7 @@ public class AlertTest extends AbstractBase {
@Test
public void testCreateDeleteAlertDefinitionWith2Conditions() throws Exception {
- int definitionId = createEmptyAlertDefinition();
+ int definitionId = createEmptyAlertDefinition(false);
try {
@@ -446,7 +484,7 @@ public class AlertTest extends AbstractBase {
@Test
public void testCreateDeleteAlertDefinitionWith1Notification() throws Exception {
- int definitionId = createEmptyAlertDefinition();
+ int definitionId = createEmptyAlertDefinition(false);
// Now add a condition
try {
@@ -491,7 +529,7 @@ public class AlertTest extends AbstractBase {
@Test
public void testCRUDNotification() throws Exception {
- int definitionId = createEmptyAlertDefinition();
+ int definitionId = createEmptyAlertDefinition(false);
// Now add a condition
try {
@@ -563,7 +601,7 @@ public class AlertTest extends AbstractBase {
@Test
public void testCRUDCondition() throws Exception {
- int definitionId = createEmptyAlertDefinition();
+ int definitionId = createEmptyAlertDefinition(false);
// Now add a condition
try {
@@ -723,7 +761,7 @@ public class AlertTest extends AbstractBase {
@Test
public void testCreateDeleteAlertDefinitionWithUnknwonSender() throws Exception {
- int definitionId = createEmptyAlertDefinition();
+ int definitionId = createEmptyAlertDefinition(false);
// Now add a condition
try {
@@ -802,7 +840,7 @@ public class AlertTest extends AbstractBase {
@Test
public void testCreateDeleteAlertDefinitionWith2Notifications() throws Exception {
- int definitionId = createEmptyAlertDefinition();
+ int definitionId = createEmptyAlertDefinition(false);
// Now add a condition
try {
@@ -1049,7 +1087,7 @@ public class AlertTest extends AbstractBase {
@Test
public void testUpdateDefinition() throws Exception {
- int definitionId = createEmptyAlertDefinition();
+ int definitionId = createEmptyAlertDefinition(false);
try {
AlertDefinition definition =
given()
@@ -1177,6 +1215,245 @@ public class AlertTest extends AbstractBase {
cleanupDefinition(result.getId());
}
+ @Test
+ public void testCreateDeleteAlertDefinitionWith1ConditionAndFire() throws Exception {
+
+ int definitionId = createEmptyAlertDefinition(true);
+
+ // Now add a condition
+ try {
+
+ AlertCondition alertCondition = new AlertCondition("AVAIL_GOES_UP","AVAILABILITY");
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(alertCondition)
+ .pathParam("defId",definitionId)
+ .expect()
+ .statusCode(201)
+ .log().ifError()
+ .when()
+ .post("/alert/definition/{defId}/conditions");
+
+ System.out.println("Definition created, waiting 60s for it to become active");
+
+ // Wait a while - see https://bugzilla.redhat.com/show_bug.cgi?id=830299
+ Thread.sleep(60*1000);
+
+ // Send a avail down/up sequence -> alert definition should fire
+ long now = System.currentTimeMillis();
+ Availability a = new Availability(10001,now-2000,"DOWN");
+ given()
+ .contentType(ContentType.JSON)
+ .pathParam("id", 10001)
+ .body(a)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .put("/resource/{id}/availability");
+
+ a = new Availability(10001,now-1000,"UP");
+ given()
+ .contentType(ContentType.JSON)
+ .pathParam("id", 10001)
+ .body(a)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .put("/resource/{id}/availability");
+
+ // wait a little
+ Thread.sleep(5000);
+
+ int alertId =
+ given()
+ .header(acceptJson)
+ .queryParam("definitionId",definitionId)
+ .queryParam("since", now - 3000)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("alertDefinition.name",contains("-x-test-definition"))
+ .body("",iterableWithSize(1))
+ .when()
+ .get("/alert")
+ .body().jsonPath().getInt("id[0]");
+
+ System.out.println(alertId);
+
+ // Find this alert by id and then its condition logs and notification logs
+ given()
+ .header(acceptJson)
+ .pathParam("id",alertId)
+ .log().everything()
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("id",is(alertId))
+ .when()
+ .get("/alert/{id}");
+
+
+ given()
+ .header(acceptJson)
+ .pathParam("id", alertId)
+ .log().everything()
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("",iterableWithSize(1))
+ .when()
+ .get("/alert/{id}/conditions");
+
+ given()
+ .header(acceptJson)
+ .pathParam("id", alertId)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("",iterableWithSize(0))
+ .when()
+ .get("/alert/{id}/notifications");
+
+
+ }
+
+ finally {
+ // delete the definition again
+ cleanupDefinition(definitionId);
+ }
+ }
+
+
+ @Test
+ public void testCreateDeleteAlertDefinitionWith1ConditionAndNotificationAndFire() throws Exception {
+
+ int definitionId = createEmptyAlertDefinition(true);
+
+ // Now add a condition
+ try {
+
+ AlertCondition alertCondition = new AlertCondition("AVAIL_GOES_UP","AVAILABILITY");
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(alertCondition)
+ .pathParam("defId",definitionId)
+ .expect()
+ .statusCode(201)
+ .log().ifError()
+ .when()
+ .post("/alert/definition/{defId}/conditions");
+
+ AlertNotification notification = new AlertNotification("Direct Emails"); // short-name from server plugin descriptor
+ notification.getConfig().put("emailAddress", "root(a)eruditorium.org");
+
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(notification)
+ .pathParam("defId", definitionId)
+ .log().everything()
+ .expect()
+ .statusCode(201)
+ .log().ifError()
+ .when()
+ .post("/alert/definition/{defId}/notifications");
+
+
+ System.out.println("Definition created, waiting 60s for it to become active");
+
+ // Wait a while - see https://bugzilla.redhat.com/show_bug.cgi?id=830299
+ Thread.sleep(60*1000);
+
+ // Send a avail down/up sequence -> alert definition should fire
+ long now = System.currentTimeMillis();
+ Availability a = new Availability(10001,now-2000,"DOWN");
+ given()
+ .contentType(ContentType.JSON)
+ .pathParam("id", 10001)
+ .body(a)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .put("/resource/{id}/availability");
+
+ a = new Availability(10001,now-1000,"UP");
+ given()
+ .contentType(ContentType.JSON)
+ .pathParam("id", 10001)
+ .body(a)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .put("/resource/{id}/availability");
+
+ // wait a little
+ Thread.sleep(5000);
+
+ int alertId =
+ given()
+ .header(acceptJson)
+ .queryParam("definitionId",definitionId)
+ .queryParam("since", now - 3000)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("alertDefinition.name",contains("-x-test-definition"))
+ .body("",iterableWithSize(1))
+ .when()
+ .get("/alert")
+ .body().jsonPath().getInt("id[0]");
+
+ System.out.println(alertId);
+
+ // Find this alert by id and then its condition logs and notification logs
+ given()
+ .header(acceptJson)
+ .pathParam("id",alertId)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("id",is(alertId))
+ .when()
+ .get("/alert/{id}");
+
+
+ given()
+ .header(acceptJson)
+ .pathParam("id", alertId)
+ .log().everything()
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("",iterableWithSize(1))
+ .when()
+ .get("/alert/{id}/conditions");
+
+ given()
+ .header(acceptJson)
+ .pathParam("id", alertId)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("",iterableWithSize(1))
+ .when()
+ .get("/alert/{id}/notifications");
+
+
+ }
+
+ finally {
+ // delete the definition again
+ cleanupDefinition(definitionId);
+ }
+ }
+
+
private void cleanupDefinition(int definitionId) {
if (definitionId==0)
@@ -1190,10 +1467,10 @@ public class AlertTest extends AbstractBase {
.delete("/alert/definition/{id}");
}
- private int createEmptyAlertDefinition() {
+ private int createEmptyAlertDefinition(boolean enabled) {
AlertDefinition alertDefinition = new AlertDefinition();
alertDefinition.setName("-x-test-definition");
- alertDefinition.setEnabled(false);
+ alertDefinition.setEnabled(enabled);
alertDefinition.setPriority("LOW");
alertDefinition.setDampeningCategory("NONE");
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Availability.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Availability.java
new file mode 100644
index 0000000..fdacbb8
--- /dev/null
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Availability.java
@@ -0,0 +1,64 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2013 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
+ */
+
+package org.rhq.modules.integrationTests.restApi.d;
+
+/**
+ * Availability for testing
+ * @author Heiko W. Rupp
+ */
+public class Availability {
+
+ long since;
+ String type;
+ int resourceId;
+
+ public Availability() {
+ }
+
+ public Availability(int resourceId, long since, String type) {
+ this.resourceId = resourceId;
+ this.since = since;
+ this.type = type;
+ }
+
+ public int getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(int resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public long getSince() {
+ return since;
+ }
+
+ public void setSince(long since) {
+ this.since = since;
+ }
+
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+}
commit ac5b2e13dbd2e3648169ddbbefb85a37eb2fdc35
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Feb 20 20:55:25 2013 +0100
Add a get group by id case with valid id
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java
index ce338bb..f6ffbe7 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java
@@ -35,6 +35,7 @@ import org.rhq.modules.integrationTests.restApi.d.GroupDef;
import static com.jayway.restassured.RestAssured.expect;
import static com.jayway.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.hasItem;
+import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.iterableWithSize;
/**
@@ -118,6 +119,20 @@ public class GroupTest extends AbstractBase {
int groupId = jsonPath.get("[0].id");
assert groupId == createdId;
+ // Fetch id by id
+ given()
+ .pathParam("id",groupId)
+ .header(acceptJson)
+ .expect()
+ .statusCode(200)
+ .body("name",is(X_TEST_GROUP))
+ .body("id",is(groupId))
+ .body("explicitCount",is(0))
+ .log().ifError()
+ .when()
+ .get("/group/{id}");
+
+
// delete the group again
given()
.pathParam("id",groupId)
@@ -429,7 +444,6 @@ public class GroupTest extends AbstractBase {
int id = Integer.parseInt(location.substring(location.lastIndexOf("/")+1));
try {
- response =
given()
.header(acceptJson)
.pathParam("id",id)
@@ -472,7 +486,6 @@ public class GroupTest extends AbstractBase {
list.add("resource.name");
gd.setExpression(list);
- Response response =
given()
.contentType(ContentType.JSON)
.header("Accept","application/json")
@@ -507,19 +520,18 @@ public class GroupTest extends AbstractBase {
String location = response.getHeader("Location");
- int defintionId = Integer.parseInt(location.substring(location.lastIndexOf("/")+1));
+ int definitionId = Integer.parseInt(location.substring(location.lastIndexOf("/")+1));
try {
// retrieve by id
given()
- .pathParam("id", defintionId)
+ .pathParam("id", definitionId)
.expect()
.statusCode(200)
.when()
.get("/group/definition/{id}");
// retrieve by query
- Response resp =
given()
.queryParam("q", "-x-test-def")
.expect()
@@ -534,7 +546,7 @@ public class GroupTest extends AbstractBase {
expect()
.statusCode(204)
.when()
- .delete("/group/definition/" + defintionId);
+ .delete("/group/definition/" + definitionId);
}
}
commit 2b908fa04815c7758e0486eb5e5055c6e13f1d15
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Feb 20 14:00:02 2013 -0600
[BZ 912478] Add managed server deployment as parent for the web subsystem resource type.
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 03dd318..2509073 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -8834,6 +8834,7 @@
<runs-inside>
<parent-resource-type name="Deployment" plugin="&pluginName;"/>
<parent-resource-type name="Subdeployment" plugin="&pluginName;"/>
+ <parent-resource-type name="ManagedServerDeployment" plugin="&pluginName;"/>
</runs-inside>
<plugin-configuration>
commit 68d2e82cc37e7109d5d989a58387b9e368b5f03a
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Feb 20 19:16:56 2013 +0100
[BZ 913121 - Manual import from resource tree's context menu opens the create child child wizard instead] Both import and create option led to the openint the same wizzard. Also some typos in javadoc has been fixed.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
index c38e77a..b4be93c 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java
@@ -573,7 +573,7 @@ public class ResourceTreeView extends LocatableVLayout {
Integer[] singletonChildTypes = getSingletonChildTypes(resourceType);
// To properly filter Create Child and Import menus we need existing singleton child resources. If the
- // user has creat permission and the parent type has singleton child types and creatable or importable child
+ // user has created permission and the parent type has singleton child types and creatable or importable child
// types, perform an async call to fetch the singleton children.
if (canCreate && singletonChildTypes.length > 0 && (hasCreatableTypes || hasImportableTypes)) {
@@ -587,12 +587,14 @@ public class ResourceTreeView extends LocatableVLayout {
public void onSuccess(PageList<Resource> singletonChildren) {
if (hasCreatableTypes) {
Map<String, ResourceType> displayNameMap = getDisplayNames(creatableChildTypes);
- addMenu(MSG.common_button_create_child(), true, singletonChildren, resource, displayNameMap);
+ addMenu(MSG.common_button_create_child(), true, singletonChildren, resource,
+ displayNameMap, true);
}
if (hasImportableTypes) {
Map<String, ResourceType> displayNameMap = getDisplayNames(importableChildTypes);
- addMenu(MSG.common_button_import(), true, singletonChildren, resource, displayNameMap);
+ addMenu(MSG.common_button_import(), true, singletonChildren, resource, displayNameMap,
+ false);
}
resourceContextMenu.showContextMenu();
@@ -607,22 +609,22 @@ public class ResourceTreeView extends LocatableVLayout {
} else if (canCreate && singletonChildTypes.length == 0 && (hasCreatableTypes || hasImportableTypes)) {
if (hasCreatableTypes) {
Map<String, ResourceType> displayNameMap = getDisplayNames(creatableChildTypes);
- addMenu(MSG.common_button_create_child(), true, null, resource, displayNameMap);
+ addMenu(MSG.common_button_create_child(), true, null, resource, displayNameMap, true);
}
if (hasImportableTypes) {
Map<String, ResourceType> displayNameMap = getDisplayNames(importableChildTypes);
- addMenu(MSG.common_button_import(), true, null, resource, displayNameMap);
+ addMenu(MSG.common_button_import(), true, null, resource, displayNameMap, false);
}
resourceContextMenu.showContextMenu();
} else {
if (!canCreate && hasCreatableTypes) {
- addMenu(MSG.common_button_create_child(), false, null, null, null);
+ addMenu(MSG.common_button_create_child(), false, null, null, null, true);
}
if (!canCreate && hasImportableTypes) {
- addMenu(MSG.common_button_import(), false, null, null, null);
+ addMenu(MSG.common_button_import(), false, null, null, null, false);
}
resourceContextMenu.showContextMenu();
@@ -630,12 +632,12 @@ public class ResourceTreeView extends LocatableVLayout {
}
private void addMenu(String name, boolean enabled, List<Resource> singletonChildren, Resource resource,
- Map<String, ResourceType> displayNameMap) {
+ Map<String, ResourceType> displayNameMap, boolean isCreate) {
MenuItem menu = new MenuItem(name);
if (enabled) {
Menu subMenu = new Menu();
- singletonChildren = (null == singletonChildren) ? new ArrayList() : singletonChildren;
- Menu filteredSubMenu = checkForSingletons(singletonChildren, resource, displayNameMap, subMenu, true);
+ singletonChildren = (null == singletonChildren) ? new ArrayList<Resource>() : singletonChildren;
+ Menu filteredSubMenu = checkForSingletons(singletonChildren, resource, displayNameMap, subMenu, isCreate);
menu.setSubmenu(filteredSubMenu);
} else {
menu.setEnabled(false);
@@ -676,7 +678,7 @@ public class ResourceTreeView extends LocatableVLayout {
// omit the type's menu item if the singleton already exists, otherwise add the necessary click handler.
// note: we omit as opposed to disable the menu item to match the behavior of the buttons in the Inventory
- // -> Child Resources view, which has no facility to do the anologous disabling.
+ // -> Child Resources view, which has no facility to do the analogous disabling.
if (!exists) {
itemToAdd.addClickHandler(new ClickHandler() {
public void onClick(MenuItemClickEvent event) {
commit b3d6756033305f1d6a02ebded33864c4303d3a10
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 20 09:37:52 2013 -0500
Add another test for the work done in Bug 912871.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
index 0900ce6..7d0343b 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
@@ -78,11 +78,8 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
private Agent agent;
private Subject overlord;
- /**
- * Prepares things for the entire test class.
- */
- //@BeforeClass don't use BeforeClass as Arquillian 1.0.2 invokes it on every test method
- protected void beforeClass() {
+ @Override
+ protected void beforeMethod() throws Exception {
// Make sure page control sorts so the latest config update is last (the default is for the latest to be first).
configUpdatesPageControl = PageControl.getUnlimitedInstance();
// (ips, 04/01/10): Use createdTime, rather than id, to order by, since the id's are not guaranteed to be
@@ -92,12 +89,6 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
configurationManager = LookupUtil.getConfigurationManager();
resourceManager = LookupUtil.getResourceManager();
- overlord = LookupUtil.getSubjectManager().getOverlord();
- }
-
- @Override
- protected void beforeMethod() throws Exception {
- beforeClass();
prepareScheduler();
@@ -106,6 +97,8 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
agentServiceContainer.configurationService = testServices;
agentServiceContainer.discoveryService = testServices;
+ overlord = LookupUtil.getSubjectManager().getOverlord();
+
getTransactionManager().begin();
try {
@@ -257,6 +250,87 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
}
@Test(enabled = ENABLE_TESTS)
+ public void testInProgressConfiguration() throws Exception {
+ int resourceId = newResource1.getId();
+
+ Subject overlord = LookupUtil.getSubjectManager().getOverlord();
+
+ // create 3 configs: config1 will be stored as current. config2 will be in progress, config3 should get
+ // blocked from updating by the inprogress update
+ Configuration configuration1 = new Configuration();
+ configuration1.put(new PropertySimple("myboolean", "true"));
+
+ Configuration configuration2 = new Configuration();
+ configuration2.put(new PropertySimple("myboolean", "false"));
+ configuration2.put(new PropertySimple("mysleep", "7000"));
+
+ Configuration configuration3 = new Configuration();
+ configuration3.put(new PropertySimple("mysleep", "10000"));
+
+ // make config1 the current
+ configurationManager.updateResourceConfiguration(overlord, resourceId, configuration1);
+ Thread.sleep(2000); // wait for the test agent to complete the request
+
+ ResourceConfigurationUpdate history1;
+ history1 = configurationManager.getLatestResourceConfigurationUpdate(overlord, resourceId);
+ assert history1 != null;
+ PropertySimple myprop = history1.getConfiguration().getSimple("myboolean");
+ assert myprop != null;
+ assert "true".equals(myprop.getStringValue());
+
+ // now update to config2 - the "agent" will sleep for a bit before it completes
+ // so we will have an INPROGRESS configuration for a few seconds before it goes to SUCCESS
+ configurationManager.updateResourceConfiguration(overlord, resourceId, configuration2);
+
+ // now update to config3 - this should fail as you can't update while there is one in progress
+ try {
+ configurationManager.updateResourceConfiguration(overlord, resourceId, configuration3);
+ assert false : "Should have thrown an in progress exception";
+
+ } catch (ConfigurationUpdateStillInProgressException e) {
+ System.out.println("======> " + e);
+
+ // make sure everything works as expected (like the above test)
+
+ boolean inProgress = false;
+ boolean inProgressTested = false;
+
+ do {
+ ResourceConfigurationUpdate history2 = configurationManager.getLatestResourceConfigurationUpdate(
+ overlord, resourceId);
+ inProgress = configurationManager.isResourceConfigurationUpdateInProgress(overlord, resourceId);
+
+ if (inProgress) {
+ // history2 should be history1 since the update is not complete
+ assert history2 != null;
+ assert history2.getId() == history1.getId();
+ myprop = history2.getConfiguration().getSimple("myboolean");
+ assert myprop != null;
+ assert "true".equals(myprop.getStringValue());
+ myprop = history2.getConfiguration().getSimple("mysleep"); // this wasn't in the first config
+ assert myprop == null;
+ // record that this test case ran, we expect it will if the agent delay is there
+ inProgressTested = true;
+ } else {
+ // update is complete, history 2 should be different
+ history2 = configurationManager.getLatestResourceConfigurationUpdate(overlord, resourceId);
+ assert history2 != null;
+ assert history2.getId() != history1.getId();
+ myprop = history2.getConfiguration().getSimple("myboolean");
+ assert myprop != null;
+ assert "false".equals(myprop.getStringValue());
+ myprop = history2.getConfiguration().getSimple("mysleep");
+ assert myprop.getLongValue() != null;
+ assert myprop.getLongValue().longValue() == 7000L;
+ }
+ } while (inProgress);
+
+ } catch (Throwable t) {
+ assert false : "Should have thrown an in progress exception, not: " + t;
+ }
+ }
+
+ @Test(enabled = ENABLE_TESTS)
public void testDeleteType() throws Exception {
// the purpose of this little test is to test an error condition I'm getting when attempting to delete
// a resource type - just forces a run with before/afterMethod
commit 4385fbb69a2dfd9aced1f8802e9477dfb44860ae
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Feb 19 16:40:32 2013 -0500
[Bug 912871 - Perf: resource configuration update taking a lot of backend resources]
Scalability work for resource config update. We already added concurrency limits
that should throttle how many config updates the server gets hit with at one
time but we also want to see if we can relieve the intense banging on the db
and speed up the update time for each resource.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
index c2d4767..69ebb9d 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java
@@ -38,7 +38,7 @@ import org.rhq.core.domain.resource.Resource;
@DiscriminatorValue("resource")
@Entity
-@NamedQueries( {
+@NamedQueries({
@NamedQuery(name = ResourceConfigurationUpdate.QUERY_FIND_ALL_IN_STATUS, query = "" //
+ "SELECT cu " //
+ " FROM ResourceConfigurationUpdate cu " //
@@ -58,7 +58,8 @@ import org.rhq.core.domain.resource.Resource;
+ " WHERE icu.resource.id = res.id) " //
+ " ) " //
+ " )"),
- @NamedQuery(name = ResourceConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG, query = "" //
+ // Note: Changes to this query should also be applied to QUERY_FIND_CURRENT_AND_IN_PROGRESS_CONFIGS, below.
+ @NamedQuery(name = ResourceConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG, query = "" //
+ "SELECT cu " //
+ " FROM ResourceConfigurationUpdate cu " //
+ " WHERE cu.resource.id = :resourceId " //
@@ -67,6 +68,17 @@ import org.rhq.core.domain.resource.Resource;
+ " FROM ResourceConfigurationUpdate cu2 " //
+ " WHERE cu2.resource.id = :resourceId " //
+ " AND cu2.status = 'SUCCESS' ) "),
+ @NamedQuery(name = ResourceConfigurationUpdate.QUERY_FIND_CURRENT_AND_IN_PROGRESS_CONFIGS, query = "" //
+ + "SELECT cu " //
+ + " FROM ResourceConfigurationUpdate cu " //
+ + " WHERE cu.resource.id = :resourceId " //
+ + " AND ( ( cu.status = 'INPROGRESS' ) " //
+ + " OR ( cu.status = 'SUCCESS' " //
+ + " AND cu.modifiedTime = ( SELECT MAX(cu2.modifiedTime) " //
+ + " FROM ResourceConfigurationUpdate cu2 " //
+ + " WHERE cu2.resource.id = :resourceId " //
+ + " AND cu2.status = 'SUCCESS' ) " //
+ + " ) ) "),
@NamedQuery(name = ResourceConfigurationUpdate.QUERY_FIND_LATEST_BY_RESOURCE_ID, query = "" //
+ "SELECT cu " //
+ " FROM ResourceConfigurationUpdate cu " //
@@ -178,6 +190,7 @@ public class ResourceConfigurationUpdate extends AbstractResourceConfigurationUp
public static final String QUERY_FIND_ALL_IN_STATUS = "ResourceConfigurationUpdate.findAllInStatus";
public static final String QUERY_FIND_ALL_BY_RESOURCE_ID = "ResourceConfigurationUpdate.findAllByResourceId";
public static final String QUERY_FIND_CURRENTLY_ACTIVE_CONFIG = "ResourceConfigurationUpdate.findCurrentlyActiveConfig";
+ public static final String QUERY_FIND_CURRENT_AND_IN_PROGRESS_CONFIGS = "ResourceConfigurationUpdate.findCurrentAndInProgressConfigs";
public static final String QUERY_FIND_LATEST_BY_RESOURCE_ID = "ResourceConfigurationUpdate.findByLatestByResourceId";
public static final String QUERY_FIND_BY_GROUP_ID_AND_STATUS = "ResourceConfigurationUpdate.findByGroupIdAndStatus";
public static final String QUERY_FIND_BY_PARENT_UPDATE_ID_AND_STATUS = "ResourceConfigurationUpdate.findByParentUpdateIdAndStatus";
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 50e5fd4..04c15b7 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -89,7 +89,6 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceError;
import org.rhq.core.domain.resource.ResourceErrorType;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
@@ -487,9 +486,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
* is triggering save based on the semantics that we want to provide for configuration updates.
* For the same reason, we pass null as the subject.
*/
- ResourceConfigurationUpdate update = this.configurationManager.persistNewResourceConfigurationUpdateHistory(
- this.subjectManager.getOverlord(), resource.getId(), liveConfig, ConfigurationUpdateStatus.SUCCESS, null,
- false);
+ ResourceConfigurationUpdate update = this.configurationManager
+ .persistResourceConfigurationUpdateInNewTransaction(this.subjectManager.getOverlord(), resource.getId(),
+ liveConfig, ConfigurationUpdateStatus.SUCCESS, null, false);
// resource.setResourceConfiguration(liveConfig.deepCopy(false));
resource.setResourceConfiguration(liveConfig.deepCopyWithoutProxies());
@@ -1248,8 +1247,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
return resourceConfigurationUpdate;
}
- ResourceConfigurationUpdate newUpdate = configurationManager.persistNewResourceConfigurationUpdateHistory(
- subject, resourceId, configToUpdate, ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
+ ResourceConfigurationUpdate newUpdate = configurationManager
+ .persistResourceConfigurationUpdateInNewTransaction(subject, resourceId, configToUpdate,
+ ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
executeResourceConfigurationUpdate(newUpdate);
return newUpdate;
}
@@ -1307,9 +1307,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
// configuration.
// TODO: Consider synchronizing to avoid the condition where someone calls this method twice quickly in two
// different tx's, which would put two updates in INPROGRESS and cause havoc.
- ResourceConfigurationUpdate newUpdate = configurationManager.persistNewResourceConfigurationUpdateHistory(
- subject, resourceId, newResourceConfiguration, ConfigurationUpdateStatus.INPROGRESS, subject.getName(),
- false);
+ ResourceConfigurationUpdate newUpdate = configurationManager
+ .persistResourceConfigurationUpdateInNewTransaction(subject, resourceId, newResourceConfiguration,
+ ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
executeResourceConfigurationUpdate(newUpdate);
@@ -1382,91 +1382,83 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@Override
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
- public ResourceConfigurationUpdate persistNewResourceConfigurationUpdateHistory(Subject subject, int resourceId,
- Configuration newConfiguration, ConfigurationUpdateStatus newStatus, String newSubject,
+ public ResourceConfigurationUpdate persistResourceConfigurationUpdateInNewTransaction(Subject subject,
+ int resourceId, Configuration newConfiguration, ConfigurationUpdateStatus newStatus, String newSubject,
boolean isPartofGroupUpdate) throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException {
- // get the resource that we will be updating
- Resource resource = resourceManager.getResourceById(subject, resourceId);
- // make sure the user has the proper permissions to do this
- if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_WRITE, resource.getId())) {
- throw new PermissionException("User [" + subject.getName()
- + "] does not have permission to modify configuration for resource [" + resource + "]");
- }
+ ResourceConfigurationUpdate current = null;
+ String errorMessage = null;
- // see if there was a previous update request and make sure it isn't still in progress
- List<ResourceConfigurationUpdate> previousRequests = resource.getResourceConfigurationUpdates();
+ // for efficiency, in one query fetch IN_PROGRESS and/or the current update
+ Query query = entityManager
+ .createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_CURRENT_AND_IN_PROGRESS_CONFIGS);
+ query.setParameter("resourceId", resourceId);
+ List<?> updates = query.getResultList();
+ for (Object result : updates) {
+ current = (ResourceConfigurationUpdate) result;
+
+ if (ConfigurationUpdateStatus.INPROGRESS == current.getStatus()) {
+ // A previous update is still in progress for this Resource. If this update is part of a group
+ // update, persist it with FAILURE status, so it is still listed as part of the group history.
+ // Otherwise, throw an exception that can bubble up to the GUI.
+ if (isPartofGroupUpdate) {
+ newStatus = ConfigurationUpdateStatus.FAILURE;
+ errorMessage = "Resource configuration Update was aborted because an update request for the Resource was already in progress.";
- String errorMessage = null;
- if (previousRequests != null) {
- for (ResourceConfigurationUpdate previousRequest : previousRequests) {
- if (previousRequest.getStatus() == ConfigurationUpdateStatus.INPROGRESS) {
- // A previous update is still in progresss for this Resource. If this update is part of a group
- // update, persist it with FAILURE status, so it is still listed as part of the group history.
- // Otherwise, throw an exception that can bubble up to the GUI.
- if (isPartofGroupUpdate) {
- newStatus = ConfigurationUpdateStatus.FAILURE;
- errorMessage = "Resource configuration Update was aborted because an update request for the Resource was already in progress.";
- } else {
- // NOTE: If you change this to another exception, make sure you change getLatestResourceConfigurationUpdate().
- throw new ConfigurationUpdateStillInProgressException(
- "Resource ["
- + resource
- + "] has a resource configuration update request already in progress - please wait for it to finish: "
- + previousRequest);
- }
+ } else {
+ // NOTE: If you change this to another exception, make sure you change getLatestResourceConfigurationUpdate().
+ throw new ConfigurationUpdateStillInProgressException(
+ "Resource ["
+ + resourceId
+ + "] has a resource configuration update request already in progress - please wait for it to finish: "
+ + current);
}
}
}
- ResourceConfigurationUpdate current;
+ Resource resource = null;
+
+ if (null != current) {
+ // Always persist a group update because each member must have an update. Otherwise, only persist a
+ // single resource update if it has changed.
+ if (!isPartofGroupUpdate) {
+ Configuration currentConfiguration = current.getConfiguration();
+ Hibernate.initialize(currentConfiguration.getMap());
+ if (currentConfiguration.equals(newConfiguration)) {
+ return null;
+ }
+ }
- // Get the latest configuration as known to the server (i.e. persisted in the DB).
- try {
- Query query = entityManager
- .createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG);
- query.setParameter("resourceId", resourceId);
- current = (ResourceConfigurationUpdate) query.getSingleResult();
resource = current.getResource();
- } catch (NoResultException nre) {
- current = null; // The resource hasn't been successfully configured yet.
- }
- // If this update is not part of an group update, don't bother persisting a new entry if the Configuration
- // hasn't changed. If it's part of an group update, persist a new entry no matter what, so the group
- // update isn't missing any member updates.
- if (!isPartofGroupUpdate && current != null) {
- Configuration currentConfiguration = current.getConfiguration();
- Hibernate.initialize(currentConfiguration.getMap());
- if (currentConfiguration.equals(newConfiguration)) {
- return null;
- }
+ } else {
+ // make sure the resource exists
+ resource = resourceManager.getResourceById(subject, resourceId);
}
- //Configuration zeroedConfiguration = newConfiguration.deepCopy(false);
Configuration zeroedConfiguration = newConfiguration.deepCopyWithoutProxies();
- // create our new update request and assign it to our resource - its status will initially be "in progress"
+ // create our new update request and assign it to our resource - its status will initially be INPROGRESS
ResourceConfigurationUpdate newUpdateRequest = new ResourceConfigurationUpdate(resource, zeroedConfiguration,
newSubject);
-
newUpdateRequest.setStatus(newStatus);
- if (newStatus == ConfigurationUpdateStatus.FAILURE) {
+
+ if (ConfigurationUpdateStatus.FAILURE == newStatus) {
newUpdateRequest.setErrorMessage(errorMessage);
}
entityManager.persist(newUpdateRequest);
- if (current != null) {
- if (newStatus == ConfigurationUpdateStatus.SUCCESS) {
- // If this is the first configuration update since the resource was imported, don't alert
+
+ // No need to alert on the first configuration update, only on subsequent change
+ if (null != current) {
+ if (ConfigurationUpdateStatus.SUCCESS == newStatus) {
notifyAlertConditionCacheManager("persistNewResourceConfigurationUpdateHistory", newUpdateRequest);
}
}
resource.addResourceConfigurationUpdates(newUpdateRequest);
- // agent and childResources fields are LAZY - force them to load, because the caller will need them.
- Hibernate.initialize(resource.getChildResources());
+ // provide the agent while we have the entity, it's typically needed by the caller
Hibernate.initialize(resource.getAgent());
return newUpdateRequest;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
index f5b28ee..85c1247 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java
@@ -188,7 +188,7 @@ public interface ConfigurationManagerLocal extends ConfigurationManagerRemote {
* {@link #getLatestResourceConfigurationUpdate(Subject, int)} and
* {@link #scheduleGroupResourceConfigurationUpdate}.
*
- * @param subject
+ * @param subject ASSUMES CONFIGURE_WRITE perm for resource in question, no authz checks in this method.
* @param resourceId
* @param newConfiguration
* @param newStatus
@@ -196,10 +196,11 @@ public interface ConfigurationManagerLocal extends ConfigurationManagerRemote {
*
* @param isPartofGroupUpdate
* @return the persisted Resource Configuration update, or null if the specified Configuration is identical to the
- * currently persisted Configuration
+ * currently persisted Configuration. Note, on success the normally lazy-loaded
+ * ResourceConfigurationUpdate.resource.agent will be provided.
*/
@Nullable
- ResourceConfigurationUpdate persistNewResourceConfigurationUpdateHistory(Subject subject, int resourceId,
+ ResourceConfigurationUpdate persistResourceConfigurationUpdateInNewTransaction(Subject subject, int resourceId,
Configuration newConfiguration, ConfigurationUpdateStatus newStatus, String newSubject,
boolean isPartofGroupUpdate) throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
index a36f35d..be32c53 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java
@@ -43,8 +43,8 @@ public class ConfigurationServerServiceImpl implements ConfigurationServerServic
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
int configUpdateId = response.getConfigurationUpdateId();
- ResourceConfigurationUpdate configUpdate = configurationManager.getResourceConfigurationUpdate(subjectManager
- .getOverlord(), configUpdateId);
+ ResourceConfigurationUpdate configUpdate = configurationManager.getResourceConfigurationUpdate(
+ subjectManager.getOverlord(), configUpdateId);
if (configUpdate != null) {
Resource resource = configUpdate.getResource();
@@ -67,7 +67,7 @@ public class ConfigurationServerServiceImpl implements ConfigurationServerServic
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
Subject overlord = subjectManager.getOverlord();
- ResourceConfigurationUpdate update = configurationManager.persistNewResourceConfigurationUpdateHistory(
+ ResourceConfigurationUpdate update = configurationManager.persistResourceConfigurationUpdateInNewTransaction(
overlord, resourceId, resourceConfiguration, ConfigurationUpdateStatus.SUCCESS, null, false);
if (update == null) {
@@ -76,7 +76,7 @@ public class ConfigurationServerServiceImpl implements ConfigurationServerServic
return;
}
- Configuration configuration = update.getConfiguration().deepCopy(false); // clone the config, zeroing out ids
+ Configuration configuration = update.getConfiguration().deepCopy(false); // clone the config, zeroing out ids
configurationManager.setResourceConfiguration(resourceId, configuration); // now set it as the current config on the Resource
}
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
index d51798d..d29ad16 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java
@@ -149,7 +149,7 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest {
allowing(entityMgr).find(Resource.class, fixture.resourceId); will(returnValue(fixture.resource));
- oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject,
+ oneOf(configurationMgrLocal).persistResourceConfigurationUpdateInNewTransaction(fixture.subject,
fixture.resourceId, fixture.configuration, INPROGRESS, fixture.subject.getName(),
fixture.isPartOfGroupUpdate);
will(returnValue(expectedUpdate));
@@ -191,7 +191,7 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest {
oneOf(authorizationMgr).hasResourcePermission(fixture.subject, CONFIGURE_WRITE, fixture.resourceId);
will(returnValue(true));
- oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject,
+ oneOf(configurationMgrLocal).persistResourceConfigurationUpdateInNewTransaction(fixture.subject,
fixture.resourceId, fixture.configuration, INPROGRESS, fixture.subject.getName(),
fixture.isPartOfGroupUpdate);
will(returnValue(expectedUpdate));
@@ -252,7 +252,7 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest {
oneOf(configAgentService).validate(fixture.configuration, fixture.resourceId, FROM_STRUCTURED);
inSequence(configUdpate);
- oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject,
+ oneOf(configurationMgrLocal).persistResourceConfigurationUpdateInNewTransaction(fixture.subject,
fixture.resourceId, fixture.configuration, INPROGRESS, fixture.subject.getName(),
fixture.isPartOfGroupUpdate);
will(returnValue(expectedUpdate));
@@ -302,7 +302,7 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest {
oneOf(configAgentService).merge(fixture.configuration, fixture.resourceId, FROM_RAW);
will(returnValue(translatedConfig)); inSequence(configUdpate);
- oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject,
+ oneOf(configurationMgrLocal).persistResourceConfigurationUpdateInNewTransaction(fixture.subject,
fixture.resourceId, translatedConfig, INPROGRESS, fixture.subject.getName(),
fixture.isPartOfGroupUpdate);
will(returnValue(expectedUpdate));
@@ -350,7 +350,7 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest {
oneOf(authorizationMgr).hasResourcePermission(fixture.subject, CONFIGURE_WRITE, fixture.resourceId);
will(returnValue(true));
- oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject, fixture.resourceId,
+ oneOf(configurationMgrLocal).persistResourceConfigurationUpdateInNewTransaction(fixture.subject, fixture.resourceId,
fixture.configuration, INPROGRESS, fixture.subject.getName(), fixture.isPartOfGroupUpdate);
will(returnValue(expectedUpdate));
commit 3005a262a20961e6c8583e02953d9af1501d8c68
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Feb 19 13:56:03 2013 -0500
[BZ 912525] add new concurrency limit for configuration updates
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/configuration/ConfigurationServerService.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/configuration/ConfigurationServerService.java
index caa1a91..e9e5b36 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/configuration/ConfigurationServerService.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/configuration/ConfigurationServerService.java
@@ -23,6 +23,7 @@
package org.rhq.core.clientapi.server.configuration;
import org.rhq.core.communications.command.annotation.Asynchronous;
+import org.rhq.core.communications.command.annotation.LimitedConcurrency;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.Property;
@@ -31,6 +32,8 @@ import org.rhq.core.domain.configuration.Property;
* Interface that allows an agent to provide information about a resource's configuration.
*/
public interface ConfigurationServerService {
+ String CONCURRENCY_LIMIT_CONFIG_UPDATE = "rhq.server.concurrency-limit.configuration-update";
+
/**
* The agent will notify the server when a configuration update request has been completed by calling this method.
*
@@ -65,6 +68,7 @@ public interface ConfigurationServerService {
* @param resourceConfiguration the newly detected configuration
*/
@Asynchronous(guaranteedDelivery = true)
+ @LimitedConcurrency(CONCURRENCY_LIMIT_CONFIG_UPDATE)
void persistUpdatedResourceConfiguration(int resourceId, Configuration resourceConfiguration);
}
\ 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
index f7f781e..544dfbf 100644
--- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
+++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml
@@ -557,6 +557,7 @@ 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
+rhq.server.concurrency-limit.configuration-update=10
# Content Local Filesystem Repository
rhq.server.content.filesystem=${jboss.server.data.dir}/packagebits
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerCommunicationsService.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerCommunicationsService.java
index 0a1c625..7ed7ffd 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerCommunicationsService.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerCommunicationsService.java
@@ -142,6 +142,13 @@ public class TestServerCommunicationsService implements TestServerCommunications
public void setMeasurementScheduleRequestConcurrencyLimit(Integer maxConcurrency) {
}
+ public Integer getConfigurationUpdateConcurrencyLimit() {
+ return 1;
+ }
+
+ public void setConfigurationUpdateConcurrencyLimit(Integer maxConcurrency) {
+ }
+
public Boolean getMaintenanceModeAtStartup() {
return Boolean.FALSE;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsService.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsService.java
index 9c7909e..0d88020 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsService.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsService.java
@@ -45,6 +45,7 @@ import mazz.i18n.Logger;
import org.jboss.remoting.InvokerLocator;
import org.jboss.util.StringPropertyReplacer;
+import org.rhq.core.clientapi.server.configuration.ConfigurationServerService;
import org.rhq.core.clientapi.server.content.ContentServerService;
import org.rhq.core.clientapi.server.discovery.DiscoveryServerService;
import org.rhq.core.clientapi.server.measurement.MeasurementServerService;
@@ -645,6 +646,17 @@ public class ServerCommunicationsService implements ServerCommunicationsServiceM
}
@Override
+ public Integer getConfigurationUpdateConcurrencyLimit() {
+ return getServiceContainer().getConcurrencyManager().getConfiguredNumberOfPermitsAllowed(
+ ConfigurationServerService.CONCURRENCY_LIMIT_CONFIG_UPDATE);
+ }
+
+ @Override
+ public void setConfigurationUpdateConcurrencyLimit(Integer maxConcurrency) {
+ setConcurrencyLimit(ConfigurationServerService.CONCURRENCY_LIMIT_CONFIG_UPDATE, maxConcurrency, true);
+ }
+
+ @Override
public Boolean getMaintenanceModeAtStartup() {
InputStream inputStream = null;
Boolean flag;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsServiceMBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsServiceMBean.java
index 9c8c993..5d4c319 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsServiceMBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsServiceMBean.java
@@ -340,6 +340,23 @@ public interface ServerCommunicationsServiceMBean extends ServiceContainerMetric
void setMeasurementScheduleRequestConcurrencyLimit(Integer maxConcurrency);
/**
+ * Gets the concurrency limit for configuration updates. This is the amount of new configuration updates that the server
+ * will allow to be processed concurrently. A configuration update is something the agent originates when it needs to
+ * let the server know when a resource's configuration has changed.
+ *
+ * @return number of concurrent calls allowed
+ */
+ Integer getConfigurationUpdateConcurrencyLimit();
+
+ /**
+ * Sets the new concurrency limit for configuration updates. This new number is the amount of configuration updates
+ * that the server will allow to be processed concurrently.
+ *
+ * @param maxConcurrency
+ */
+ void setConfigurationUpdateConcurrencyLimit(Integer maxConcurrency);
+
+ /**
* Returns <code>true</code> if the server should always start up in maintenance mode.
* If <code>false</code>, the server will startup in the same state it was in when it
* was shutdown.
diff --git a/modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml
index 84289ad..ee3fbd1 100644
--- a/modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml
@@ -616,6 +616,13 @@
required="true"
activationPolicy="immediate"
description="Number of measurement schedule requests that can be processed concurrently; if zero or less, there is no limit" />
+ <c:simple-property
+ name="ConfigurationUpdateConcurrencyLimit"
+ displayName="Configuration Update Concurrency Limit"
+ type="integer"
+ required="true"
+ activationPolicy="immediate"
+ description="Number of configuration updates originating from agents that can be processed concurrently; if zero or less, there is no limit" />
</c:group>
<c:group
name="ha"
commit 532c73f05d278ef150056370ad84e4f12eb0de36
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Feb 19 17:02:19 2013 +0100
Follow the recent changes in availability handling and add another test.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
index 8142f17..ec42c3c 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
@@ -31,6 +31,8 @@ import java.util.UUID;
import javax.ejb.EJB;
import javax.ejb.Stateless;
+import javax.ejb.TransactionAttribute;
+import javax.ejb.TransactionAttributeType;
import javax.interceptor.Interceptors;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
@@ -356,6 +358,7 @@ public class ResourceHandlerBean extends AbstractRestBean {
@PUT
@Path("/{id}/availability")
@ApiOperation("Set the current availability of the passed resource")
+ @TransactionAttribute(TransactionAttributeType.NEVER)
public void reportAvailability(@ApiParam("Id of the resource to update") @PathParam("id") int resourceId,
@ApiParam(value= "New Availability setting", required = true) AvailabilityRest avail) {
if (avail.getResourceId() != resourceId)
@@ -368,11 +371,12 @@ public class ResourceHandlerBean extends AbstractRestBean {
// According to jshaughn, plaforms must not be set to DISABLED, so catch this case here.
if (resource.getResourceType().getCategory()==ResourceCategory.PLATFORM && at==AvailabilityType.DISABLED) {
- throw new BadArgumentException("Availabilty","Platforms must not be set to DISABLED");
+ throw new BadArgumentException("Availability","Platforms must not be set to DISABLED");
}
+ Agent agent = agentMgr.getAgentByResourceId(caller,resourceId);
- AvailabilityReport report = new AvailabilityReport(true, resource.getAgent().getName());
+ AvailabilityReport report = new AvailabilityReport(true, agent.getName());
Availability availability = new Availability(resource, avail.getSince(), at);
report.addAvailability(availability);
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java
index 6899995..27bf5a2 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java
@@ -220,6 +220,61 @@ public class ResourcesTest extends AbstractBase {
}
@Test
+ public void testCreatePlatformUpdateAvailabilityAndRemove() throws Exception {
+
+ Resource resource = new Resource();
+ resource.setResourceName("dummy-test");
+ resource.setTypeName("Linux");
+
+ Response response =
+ given()
+ .header(acceptXml)
+ .contentType(ContentType.JSON)
+ .body(resource)
+ .expect()
+ .statusCode(201)
+ .log().ifError()
+ .when()
+ .post("/resource/platforms");
+
+ XmlPath xmlPath = response.xmlPath();
+ Node resource1 = xmlPath.get("resource");
+ Node platformIdNode = resource1.get("resourceId");
+ String platformId = platformIdNode.value();
+
+ try {
+ long now = System.currentTimeMillis()-100;
+ given().body("{\"since\":" + now + ",\"type\":\"DOWN\",\"resourceId\":" + platformId + "}")
+ .header("Content-Type","application/json")
+ .header("Accept","application/json")
+ .pathParam("id",platformId)
+ .expect()
+ .statusCode(HttpStatus.SC_NO_CONTENT)
+ .log().ifError()
+ .when().put("/resource/{id}/availability");
+
+ now += 50;
+ given().body("{\"since\":" + now + ",\"type\":\"UP\",\"resourceId\":" + platformId + "}")
+ .header("Content-Type","application/json")
+ .header("Accept","application/json")
+ .pathParam("id",platformId)
+ .expect()
+ .statusCode(HttpStatus.SC_NO_CONTENT)
+ .log().ifError()
+ .when().put("/resource/{id}/availability");
+
+
+ }
+
+ finally {
+ given().pathParam("id", platformId)
+ .expect().statusCode(HttpStatus.SC_NO_CONTENT)
+ .when().delete("/resource/{id}");
+ }
+
+ }
+
+ @Test
public void testCreatePlatformOLDAndRemove() throws Exception {
Response response =
commit 7189891da688fc90f5b3b5dc78a6706f1cd57060
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Mon Feb 18 19:39:10 2013 +0100
BZ911172 - Creating mail server fails with EAP 6.1.0.DR4 if outbound-socket-binding-ref is not filled
Mail server outbound-socket-binding-ref now mandatory in UI
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index ba4fe29..03dd318 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -11670,7 +11670,7 @@
</plugin-configuration>
<resource-configuration>
- <c:simple-property name="outbound-socket-binding-ref" required="false" type="string" readOnly="false" description="Outbound Socket binding to SMTP server">
+ <c:simple-property name="outbound-socket-binding-ref" required="true" type="string" readOnly="false" description="Outbound Socket binding to SMTP server">
<c:option-source target="configuration" expression="*1/remote-destination-outbound-socket-binding=name:type=SocketBindingGroup"/>
</c:simple-property>
<c:simple-property name="password" required="false" type="string" readOnly="false" description="Password to authenticate on server"/>
@@ -11694,7 +11694,7 @@
</plugin-configuration>
<resource-configuration>
- <c:simple-property name="outbound-socket-binding-ref" required="false" type="string" readOnly="false" description="Outbound Socket binding to IMAP server">
+ <c:simple-property name="outbound-socket-binding-ref" required="true" type="string" readOnly="false" description="Outbound Socket binding to IMAP server">
<c:option-source target="configuration" expression="*1/remote-destination-outbound-socket-binding=name:type=SocketBindingGroup"/>
</c:simple-property>
<c:simple-property name="password" required="false" type="string" readOnly="false" description="Password to authenticate on server"/>
@@ -11718,7 +11718,7 @@
</plugin-configuration>
<resource-configuration>
- <c:simple-property name="outbound-socket-binding-ref" required="false" type="string" readOnly="false" description="Outbound Socket binding to POP3 server">
+ <c:simple-property name="outbound-socket-binding-ref" required="true" type="string" readOnly="false" description="Outbound Socket binding to POP3 server">
<c:option-source target="configuration" expression="*1/remote-destination-outbound-socket-binding=name:type=SocketBindingGroup"/>
</c:simple-property>
<c:simple-property name="password" required="false" type="string" readOnly="false" description="Password to authenticate on server"/>
commit 3dfeb0200b33373de0e9899f659b76c8d27a8648
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Feb 19 11:07:16 2013 +0100
Fix AS7 plugin itest failures due to misuse of context.getNativeProcess
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
index dcf21d3..42c19ba 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
@@ -51,6 +51,7 @@ import org.rhq.core.pluginapi.util.ProcessExecutionUtility;
import org.rhq.core.pluginapi.util.StartScriptConfiguration;
import org.rhq.core.system.ProcessExecution;
import org.rhq.core.system.ProcessExecutionResults;
+import org.rhq.core.system.ProcessInfo;
import org.rhq.core.system.SystemInfo;
import org.rhq.core.util.PropertiesFileUpdate;
import org.rhq.modules.plugins.jbossas7.helper.HostConfiguration;
@@ -69,8 +70,8 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* @author Heiko W. Rupp
* @author Ian Springer
*/
-public abstract class BaseServerComponent<T extends ResourceComponent<?>> extends BaseComponent<T>
- implements MeasurementFacet {
+public abstract class BaseServerComponent<T extends ResourceComponent<?>> extends BaseComponent<T> implements
+ MeasurementFacet {
private static final String SEPARATOR = "\n-----------------------\n";
@@ -88,9 +89,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
serverPluginConfig = new ServerPluginConfiguration(pluginConfiguration);
connection = new ASConnection(serverPluginConfig.getHostname(), serverPluginConfig.getPort(),
- serverPluginConfig.getUser(), serverPluginConfig.getPassword());
- @SuppressWarnings("UnusedDeclaration")
- AvailabilityType avail = getAvailability();
+ serverPluginConfig.getUser(), serverPluginConfig.getPassword());
+ getAvailability();
logFileEventDelegate = new LogFileEventResourceComponentHelper(context);
logFileEventDelegate.startLogFileEventPollers();
startScriptConfig = new StartScriptConfiguration(pluginConfiguration);
@@ -127,7 +127,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
private void validateServerAttributes() throws InvalidPluginConfigurationException {
// Validate the base dir (e.g. /opt/jboss-as-7.1.1.Final/standalone).
File runtimeBaseDir;
- File baseDir=null;
+ File baseDir = null;
try {
String runtimeBaseDirString = readAttribute(getEnvironmentAddress(), getBaseDirAttributeName());
// Canonicalize both paths before comparing them!
@@ -142,12 +142,12 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
log.error("Failed to validate base dir for " + getResourceDescription() + ".", e);
}
if ((runtimeBaseDir != null) && (baseDir != null)) {
- if(!runtimeBaseDir.equals(baseDir)) {
+ if (!runtimeBaseDir.equals(baseDir)) {
throw new InvalidPluginConfigurationException("The server listening on "
- + serverPluginConfig.getHostname() + ":" + serverPluginConfig.getPort()
- + " has base dir [" + runtimeBaseDir + "], but the base dir we expected was [" + baseDir
- + "]. Perhaps the management hostname or port has been changed for the server with base dir ["
- + baseDir + "].");
+ + serverPluginConfig.getHostname() + ":" + serverPluginConfig.getPort() + " has base dir ["
+ + runtimeBaseDir + "], but the base dir we expected was [" + baseDir
+ + "]. Perhaps the management hostname or port has been changed for the server with base dir ["
+ + baseDir + "].");
}
}
@@ -161,9 +161,9 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
}
if (runtimeMode != null) {
String mode = getMode().name();
- if(!runtimeMode.equals(mode)) {
- throw new InvalidPluginConfigurationException("The original mode discovered for this AS7 server was " +
- getMode() + ", but the server is now reporting its mode is [" + runtimeMode + "].");
+ if (!runtimeMode.equals(mode)) {
+ throw new InvalidPluginConfigurationException("The original mode discovered for this AS7 server was "
+ + getMode() + ", but the server is now reporting its mode is [" + runtimeMode + "].");
}
}
@@ -171,8 +171,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
JBossProductType runtimeType;
try {
String runtimeTypeString = readAttribute("product-name");
- runtimeType = (runtimeTypeString != null && !runtimeTypeString.isEmpty()) ?
- JBossProductType.getValueByProductName(runtimeTypeString) : JBossProductType.AS;
+ runtimeType = (runtimeTypeString != null && !runtimeTypeString.isEmpty()) ? JBossProductType
+ .getValueByProductName(runtimeTypeString) : JBossProductType.AS;
} catch (Exception e) {
runtimeType = null;
log.error("Failed to validate product type for " + getResourceDescription() + ".", e);
@@ -180,8 +180,9 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
if (runtimeType != null) {
JBossProductType type = serverPluginConfig.getProductType();
if (runtimeType != type) {
- throw new InvalidPluginConfigurationException("The original product type discovered for this AS7 server was "
- + type + ", but the server is now reporting its product type is [" + runtimeType + "].");
+ throw new InvalidPluginConfigurationException(
+ "The original product type discovered for this AS7 server was " + type
+ + ", but the server is now reporting its product type is [" + runtimeType + "].");
}
}
}
@@ -225,7 +226,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
List<String> errors = validateStartScriptPluginConfigProps();
if (!errors.isEmpty()) {
- OperationResult result = new OperationResult();
+ OperationResult result = new OperationResult();
setErrorMessage(result, errors);
return result;
}
@@ -279,9 +280,17 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
if (hostPort.isLocal) {
// lets be paranoid here
- while (context.getNativeProcess() != null && context.getNativeProcess().priorSnaphot() != null
- && context.getNativeProcess().priorSnaphot().isRunning()
- && count++ <= 20) {
+ for (; count <= 20; count++) {
+ ProcessInfo processInfo = context.getNativeProcess();
+ if (processInfo == null) {
+ // Process not found, so it died, that's fine
+ break;
+ }
+ if (!processInfo.priorSnaphot().isRunning()) {
+ // Process info says process is no longer running, that's fine
+ break;
+ }
+ // Process is still running, wait a second and check again
try {
Thread.sleep(1000); // Wait 1s
} catch (InterruptedException e) {
@@ -314,7 +323,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
String startScriptPrefix = startScriptConfig.getStartScriptPrefix();
File startScriptFile = getStartScriptFile();
ProcessExecution processExecution = ProcessExecutionUtility.createProcessExecution(startScriptPrefix,
- startScriptFile);
+ startScriptFile);
List<String> arguments = processExecution.getArguments();
if (arguments == null) {
@@ -352,7 +361,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
if (results.getError() != null) {
operationResult.setErrorMessage(results.getError().getMessage());
} else if (results.getExitCode() != null) {
- operationResult.setErrorMessage("Start failed with error code " + results.getExitCode() + ":\n" + results.getCapturedOutput());
+ operationResult.setErrorMessage("Start failed with error code " + results.getExitCode() + ":\n"
+ + results.getCapturedOutput());
} else {
// Try to connect to the server - ping once per second, timing out after 20s.
boolean up = waitForServerToStart();
@@ -368,7 +378,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
}
private boolean isManuallyAddedServer(OperationResult operationResult, String operation) {
- if (pluginConfiguration.get("manuallyAdded")!=null) {
+ if (pluginConfiguration.get("manuallyAdded") != null) {
operationResult.setErrorMessage(operation + " is not enabled for manually added servers");
return true;
}
@@ -410,8 +420,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
Map<String, String> startScriptEnv = startScriptConfig.getStartScriptEnv();
if (startScriptEnv.isEmpty()) {
errors.add("No start script environment variables are set. At a minimum, PATH should be set "
- + "(on UNIX, it should contain at least /bin and /usr/bin). It is recommended that "
- + "JAVA_HOME also be set, otherwise the PATH will be used to find java.");
+ + "(on UNIX, it should contain at least /bin and /usr/bin). It is recommended that "
+ + "JAVA_HOME also be set, otherwise the PATH will be used to find java.");
}
return errors;
@@ -438,7 +448,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
int count = 0;
while (!up) {
Operation op = new ReadAttribute(new Address(), "release-version");
- try{
+ try {
Result res = getASConnection().execute(op);
if (res.isSuccess()) { // If op succeeds, server is not down
up = true;
@@ -478,7 +488,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
*/
protected OperationResult postProcessResult(String name, Result res) {
OperationResult operationResult = new OperationResult();
- if (res==null) {
+ if (res == null) {
operationResult.setErrorMessage("No result received from server");
return operationResult;
}
@@ -490,29 +500,29 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
* reading, this is a good sign.
*/
if (!res.isSuccess()) {
- if (res.getRhqThrowable()!=null && (res.getRhqThrowable() instanceof ConnectException || res.getRhqThrowable().getMessage().equals("Connection refused"))) {
+ if (res.getRhqThrowable() != null
+ && (res.getRhqThrowable() instanceof ConnectException || res.getRhqThrowable().getMessage()
+ .equals("Connection refused"))) {
operationResult.setSimpleResult("Success");
- log.debug("Got a ConnectionRefused for operation " + name + " this is considered ok, as the remote server sometimes closes the communications channel before sending a reply");
+ log.debug("Got a ConnectionRefused for operation "
+ + name
+ + " this is considered ok, as the remote server sometimes closes the communications channel before sending a reply");
}
if (res.getFailureDescription().contains("Socket closed")) { // See https://issues.jboss.org/browse/AS7-4192
operationResult.setSimpleResult("Success");
- log.debug("Got a 'Socket closed' result from AS for operation " + name );
- }
- else
+ log.debug("Got a 'Socket closed' result from AS for operation " + name);
+ } else
operationResult.setErrorMessage(res.getFailureDescription());
- }
- else {
+ } else {
operationResult.setSimpleResult("Success");
}
- }
- else {
+ } else {
if (res.isSuccess()) {
- if (res.getResult()!=null)
+ if (res.getResult() != null)
operationResult.setSimpleResult(res.getResult().toString());
else
operationResult.setSimpleResult("-None provided by server-");
- }
- else
+ } else
operationResult.setErrorMessage(res.getFailureDescription());
}
return operationResult;
@@ -525,8 +535,9 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
OperationResult result = new OperationResult();
PropertySimple remoteProp = pluginConfig.getSimple("manuallyAdded");
- if (remoteProp!=null && remoteProp.getBooleanValue()!= null && remoteProp.getBooleanValue()) {
- result.setErrorMessage("This is a manually added server. This operation can not be used to install a management user. Use the server's 'bin/add-user.sh'");
+ if (remoteProp != null && remoteProp.getBooleanValue() != null && remoteProp.getBooleanValue()) {
+ result
+ .setErrorMessage("This is a manually added server. This operation can not be used to install a management user. Use the server's 'bin/add-user.sh'");
return result;
}
@@ -537,7 +548,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
File baseDir = serverPluginConfig.getBaseDir();
if (baseDir == null) {
- result.setErrorMessage("'" + ServerPluginConfiguration.Property.BASE_DIR + "' plugin config prop is not set.");
+ result.setErrorMessage("'" + ServerPluginConfiguration.Property.BASE_DIR
+ + "' plugin config prop is not set.");
return result;
}
@@ -562,14 +574,13 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
PropertiesFileUpdate propsFileUpdate = new PropertiesFileUpdate(propertiesFile.getPath());
userAlreadyExisted = propsFileUpdate.update(user, encryptedPassword);
} catch (Exception e) {
- throw new RuntimeException("Failed to update management users properties file [" + propertiesFile + "].",
- e);
+ throw new RuntimeException("Failed to update management users properties file [" + propertiesFile + "].", e);
}
String verb = (userAlreadyExisted) ? "updated" : "added";
result.setSimpleResult("Management user [" + user + "] " + verb + ".");
log.info("Management user [" + user + "] " + verb + " for " + context.getResourceType().getName()
- + " server with key [" + context.getResourceKey() + "].");
+ + " server with key [" + context.getResourceKey() + "].");
context.getAvailabilityContext().requestAvailabilityCheck();
context.getInventoryContext().requestDeferredChildResourcesDiscovery();
@@ -588,7 +599,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception {
Set<MeasurementScheduleRequest> skmRequests = new HashSet<MeasurementScheduleRequest>(requests.size());
Set<MeasurementScheduleRequest> leftovers = new HashSet<MeasurementScheduleRequest>(requests.size());
- for (MeasurementScheduleRequest request: requests) {
+ for (MeasurementScheduleRequest request : requests) {
String requestName = request.getName();
if (requestName.equals("startTime")) {
collectStartTimeTrait(report, request);
@@ -681,14 +692,14 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
op.includeRuntime(true);
ComplexResult res = getASConnection().executeComplex(op);
if (res.isSuccess()) {
- Map<String,Object> props = res.getResult();
+ Map<String, Object> props = res.getResult();
- for (MeasurementScheduleRequest request: skmRequests) {
+ for (MeasurementScheduleRequest request : skmRequests) {
String requestName = request.getName();
String realName = requestName.substring(requestName.indexOf(':') + 1);
- String val=null;
+ String val = null;
if (props.containsKey(realName)) {
- val = getStringValue( props.get(realName) );
+ val = getStringValue(props.get(realName));
}
if ("null".equals(val)) {
@@ -699,7 +710,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
else
log.debug("Value for " + realName + " was 'null' and no replacement found");
}
- MeasurementDataTrait data = new MeasurementDataTrait(request,val);
+ MeasurementDataTrait data = new MeasurementDataTrait(request, val);
report.addData(data);
}
} else {
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
index f6f1502..7aa92b6 100644
--- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
+++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java
@@ -62,6 +62,7 @@ public abstract class AbstractServerComponentTest extends AbstractJBossAS7Plugin
private static final Map<String, String> EAP6_VERSION_TO_AS7_VERSION_MAP = new HashMap<String, String>();
static {
EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0", "7.1.2.Final-redhat-1");
+ EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.1", "7.1.3.Final-redhat-4");
}
private static final String RELEASE_VERSION_TRAIT_NAME = "_skm:release-version";
commit 43a268f07024873ad666fb3fda5713199f163dde
Author: Jay Shaughnessy <jshaughn(a)jshaughn.csb>
Date: Mon Feb 18 14:09:31 2013 -0500
Fix resource bulk delete when the resource is a member of
groups, on oracle. The issue is that a native Query is used that
returns resource group ids and since Oracle represents integers
as Number, it actually returns a BigDecimal, not an Integer, for
the Ids. Deal with it in the generic way we deal with DB
type differences.
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseType.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseType.java
index fb62e4c..9e141a8 100644
--- a/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseType.java
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseType.java
@@ -274,6 +274,19 @@ public abstract class DatabaseType {
}
/**
+ * Get the Integer representation of the number type supplied by the db vendor for an integer field value.
+ * The default implementation simply applies a cast to the passed in number and is appropriate for DB types
+ * that support a native integer field type (like Postgres). Other db types should override this method
+ * (like Oracle).
+ *
+ * @param number
+ * @return
+ */
+ public Integer getInteger(Object number) {
+ return (Integer) number;
+ }
+
+ /**
* Fill out a <code>PreparedStatement</code> correctly with a boolean.
*
* @param bool the boolean you want
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
index 9dcbb89..15ee0af 100644
--- a/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java
@@ -18,6 +18,7 @@
*/
package org.rhq.core.db;
+import java.math.BigDecimal;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
@@ -46,6 +47,7 @@ public abstract class OracleDatabaseType extends DatabaseType {
*
* @see DatabaseType#getVendor()
*/
+ @Override
public String getVendor() {
return VENDOR;
}
@@ -55,10 +57,23 @@ public abstract class OracleDatabaseType extends DatabaseType {
*
* @see DatabaseType#getBooleanValue(boolean)
*/
+ @Override
public String getBooleanValue(boolean bool) {
return bool ? "1" : "0";
}
+ /* (non-Javadoc)
+ * @see org.rhq.core.db.DatabaseType#getInteger(java.lang.Object)
+ *
+ * Oracle stores integer fields as Numbers and returns a BigDecimal. It is assumed <code>number</code> is actually
+ * an integer value, otherwise precision will be lost in this conversion.
+ */
+ @Override
+ public Integer getInteger(Object number) {
+ BigDecimal intField = (BigDecimal) number;
+ return intField.intValue();
+ }
+
/**
* For Oracle databases, the boolean parameter will actually be of type "int" with a value of 0 or 1.
*
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 384a432..d3fd1ee 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -45,6 +45,7 @@ import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
+import org.rhq.core.db.DatabaseType;
import org.rhq.core.db.DatabaseTypeFactory;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertCondition;
@@ -499,7 +500,10 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// In other words, the implicit resources of a group have no impact on the group type (compatible/mixed).
Query nativeQuery = entityManager.createNativeQuery(ResourceGroup.QUERY_GET_GROUP_IDS_BY_RESOURCE_IDS);
nativeQuery.setParameter("resourceIds", resourceIds);
- List<Integer> groupIds = nativeQuery.getResultList();
+ // Note that different DB vendors return different types for IDs because the representation
+ // is different at the storage layer. This is an em native query so we need to handle the differences.
+ // Postgres will return an Integer, but Oracle returns a BigDecimal, etc.
+ List<?> rs = nativeQuery.getResultList();
String[] nativeQueriesToExecute = new String[] { //
ResourceGroup.QUERY_DELETE_EXPLICIT_BY_RESOURCE_IDS, // unmap from explicit groups
@@ -514,9 +518,13 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
// update the resource type of affected groups by calling setResouceType()
- for (int groupId : groupIds) {
+ DatabaseType dbType = DatabaseTypeFactory.getDefaultDatabaseType();
+ Integer groupId = null;
+ for (int i = 0, size = rs.size(); i < size; ++i) {
try {
+ groupId = dbType.getInteger(rs.get(i));
resourceGroupManager.setResourceType(groupId);
+
} catch (ResourceGroupDeleteException rgde) {
log.warn("Unable to change resource type for group with id [" + groupId + "]", rgde);
}
commit f7409c5649029ba91d1d25ced972196b677ab14d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 15 21:29:54 2013 -0500
Inventory sync no longer schedules avail check runs in response to
unknown/modified resources, instead just waiting for the next scheduled
run, which is soon given only 30s intervals.
These test classes, perhaps unwittingly, depended on that behavior, so now
run the avail checker as a post-discovery task, to fully initialize the
resource containers.
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/LateMeasurementRescheduleTest.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/LateMeasurementRescheduleTest.java
index c79988b..301d613 100644
--- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/LateMeasurementRescheduleTest.java
+++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/LateMeasurementRescheduleTest.java
@@ -18,6 +18,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.pc.PluginContainer;
+import org.rhq.core.pc.inventory.ForceAvailabilityExecutor;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.plugins.test.SingleResourceDiscoveryComponent;
import org.rhq.plugins.test.measurement.BZ834019ResourceComponent;
@@ -85,6 +86,9 @@ public class LateMeasurementRescheduleTest extends Arquillian {
public void waitForAsyncDiscoveries() throws Exception {
if (discoveryCompleteChecker != null) {
discoveryCompleteChecker.waitForDiscoveryComplete(10000);
+
+ // Since the avail job is not running, make sure our discovered resources get their initial UP avail
+ new ForceAvailabilityExecutor(pluginContainer.getInventoryManager()).call();
}
}
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/ReadOnlyScheduleSetTest.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/ReadOnlyScheduleSetTest.java
index dedf968..4747851 100644
--- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/ReadOnlyScheduleSetTest.java
+++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/ReadOnlyScheduleSetTest.java
@@ -19,6 +19,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.pc.PluginContainer;
+import org.rhq.core.pc.inventory.ForceAvailabilityExecutor;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.plugins.test.SingleResourceDiscoveryComponent;
import org.rhq.plugins.test.measurement.BZ821058ResourceComponent;
@@ -84,6 +85,9 @@ public class ReadOnlyScheduleSetTest extends Arquillian {
public void waitForAsyncDiscoveries() throws Exception {
if (discoveryCompleteChecker != null) {
discoveryCompleteChecker.waitForDiscoveryComplete(10000);
+
+ // Since the avail job is not running, make sure our discovered resources get their initial UP avail
+ new ForceAvailabilityExecutor(pluginContainer.getInventoryManager()).call();
}
}
commit f7da6afeb80a4a3a18906d7ae3f8318e2d3640a9
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 15 15:43:50 2013 -0500
the name of the perftest sysprops are different now
diff --git a/etc/agentspawn/src/scripts/agentcopy.properties b/etc/agentspawn/src/scripts/agentcopy.properties
index 52f3cba..8e15c26 100644
--- a/etc/agentspawn/src/scripts/agentcopy.properties
+++ b/etc/agentspawn/src/scripts/agentcopy.properties
@@ -32,8 +32,8 @@ agentcopy.agent.javaopts-default=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=tru
# you do not specify -D options for a specific agent index, the
# sysprops-default will be used for that agent.
agentcopy.agent.sysprops-default=
-#agentcopy.agent.sysprops-default=-Don.perftest.scenario=configurable-alphaomega -Don.perftest.server-omega-count=10 -Don.perftest.service-alpha-count=25 -Don.perftest.service-beta-count=50
-#agentcopy.agent.sysprops.#####=-Don.perftest.scenario=configurable-3 -Don.perftest.server-b-count=10 -Don.perftest.service-b-count=50
+#agentcopy.agent.sysprops-default=-Drhq.perftest.scenario=configurable-alphaomega -Drhq.perftest.server-omega-count=10 -Drhq.perftest.service-alpha-count=25 -Drhq.perftest.service-beta-count=50
+#agentcopy.agent.sysprops.#####=-Drhq.perftest.scenario=configurable-3 -Drhq.perftest.server-b-count=10 -Drhq.perftest.service-b-count=50
# These are additional agent command line options that you can pass to an
# agent. These are added to the normal command line options that are always
commit 93a79d386873d8ecf9261fa7dee1d11772c9d591
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 15 14:33:14 2013 -0500
Fix test to reflect the improved behavior when mergeAvailabilityReport
performs Availability "repair".
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
index d6ac8b2..1fcda30 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java
@@ -1242,26 +1242,32 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
Thread.sleep(1000);
availabilityManager.mergeAvailabilityReport(report);
+ // the end time of avail 4 should have been reset to the start time of avail 5. Avail 5 should have been
+ // added and should be DOWN
avails = getResourceAvailabilities(theResource);
- assertEquals(avails.toString(), 4, avails.size());
+ assertEquals(avails.toString(), 5, avails.size());
- // avail start times should now be 0, 1:00 (UP), 1:10(DOWN), 1:40(UP)
+ // avail start times should now be 0, 1:00 (UP), 1:20(DOWN), 1:40(UP), 1:45(DOWN)
avail = avails.get(0); // 0..1:00
assertTrue(avail.toString(), Math.abs(avail.getStartTime() - 0L) < 1000L);
assertEquals(avail.toString(), AvailabilityType.UNKNOWN, avail.getAvailabilityType());
assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(1).getStartTime()) < 1000L);
avail = avails.get(1); // 1:00..1:20
- assertTrue(avail.toString(), Math.abs(currentStartTime - (avail.getStartTime() + (40 * 60 * 1000))) < 1000L);
+ assertTrue(avail.toString(), Math.abs(newStartTime - (avail.getStartTime() + (45 * 60 * 1000))) < 1000L);
assertEquals(avail.toString(), AvailabilityType.UP, avail.getAvailabilityType());
assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(2).getStartTime()) < 1000L);
avail = avails.get(2); // 1:20..1:40
- assertTrue(avail.toString(), Math.abs(currentStartTime - (avail.getStartTime() + (20 * 60 * 1000))) < 1000L);
+ assertTrue(avail.toString(), Math.abs(newStartTime - (avail.getStartTime() + (25 * 60 * 1000))) < 1000L);
assertEquals(avail.toString(), AvailabilityType.DOWN, avail.getAvailabilityType());
assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(3).getStartTime()) < 1000L);
- avail = avails.get(3); // 1:40
- assertTrue(avail.toString(), Math.abs(currentStartTime - avail.getStartTime()) < 1000L);
+ avail = avails.get(3); // 1:40..1:45
+ assertTrue(avail.toString(), Math.abs(newStartTime - (avail.getStartTime() + (5 * 60 * 1000))) < 1000L);
assertEquals(avail.toString(), AvailabilityType.UP, avail.getAvailabilityType());
- assertEquals(avail.toString(), null, avail.getEndTime()); // THIS IS THE CHANGE
+ assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(4).getStartTime()) < 1000L); // THE FIX
+ avail = avails.get(4); // 1:45..null
+ assertTrue(avail.toString(), Math.abs(newStartTime - avail.getStartTime()) < 1000L);
+ assertEquals(avail.toString(), AvailabilityType.DOWN, avail.getAvailabilityType());
+ assertEquals(avail.toString(), null, avail.getEndTime());
} catch (Exception e) {
e.printStackTrace();
commit 0ec2c91347728df8462b2587f7ecc01e9245b73d
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Fri Feb 15 16:14:38 2013 +0100
Fix the JNDI access integration test. Default activation of profiles in Maven
just doesn't work the way I expected it to ;)
diff --git a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
index 74e563c..b20dfa0 100644
--- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
+++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
@@ -155,14 +155,15 @@
<profile>
<id>managed-test-server</id>
<activation>
- <activeByDefault>true</activeByDefault>
+ <property>
+ <name>!remote-test-server</name>
+ </property>
</activation>
<dependencies>
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
- <version>${jboss.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -170,6 +171,11 @@
<profile>
<id>remote-test-server</id>
+ <activation>
+ <property>
+ <name>remote-test-server</name>
+ </property>
+ </activation>
<dependencies>
<dependency>
commit d124641fbb254087544f8f6dda17ae0dc8b3d967
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Feb 14 18:23:36 2013 +0100
Fix JMX plugin test failure
diff --git a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
index b841a38..9757c7a 100644
--- a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
+++ b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
@@ -72,8 +72,6 @@ import org.rhq.plugins.jmx.util.JvmResourceKey;
* @author Greg Hinkle
* @author Ian Springer
*/
-// Disabled until we find a fix for Sigar getProcCredName issue
-@Test(enabled = false)
public class JMXPluginTest {
private static final int JMX_REMOTING_PORT1 = 9921;
@@ -95,8 +93,9 @@ public class JMXPluginTest {
this.testServerJvms.add(startTestServerJvm("-Dcom.sun.management.jmxremote.port=" + JMX_REMOTING_PORT1,
"-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.authenticate=false"));
- this.testServerJvms.add(startTestServerJvm("-D" + JMXDiscoveryComponent.SYSPROP_RHQ_RESOURCE_KEY + "="
- + EXPLICIT_RESOURCE_KEY1));
+ // FIXME: Disabled until we find a fix for Sigar getProcCredName issue
+ // this.testServerJvms.add(startTestServerJvm("-D" + JMXDiscoveryComponent.SYSPROP_RHQ_RESOURCE_KEY + "="
+ // + EXPLICIT_RESOURCE_KEY1));
this.testServerJvms.add(startTestServerJvm("-Dcom.sun.management.jmxremote.port=" + JMX_REMOTING_PORT2,
"-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.authenticate=false",
@@ -206,7 +205,8 @@ public class JMXPluginTest {
}
}
assert foundJmxRemotingServer : "JMX Remoting server not found.";
- assert foundExplicitKey1Server : "Explicit key server not found.";
+ // FIXME: Disabled until we find a fix for Sigar getProcCredName issue
+ //assert foundExplicitKey1Server : "Explicit key server not found.";
assert foundExplicitKey2Server : "JMX Remoting + explicit key server not found.";
}
commit f5104b4e3523c481a768a6411e87122371c002ec
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Feb 14 15:28:02 2013 +0100
[BZ 909157 - Operation parameters are not shown in schedule operation details.] If the method refreshOperationParametersItem() is called when scheduling a new operation, the existent parameters are not forget.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
index 0f54af0..8436c2ab 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
@@ -355,7 +355,6 @@ public abstract class AbstractOperationScheduleDetailsView extends
this.operationParameters = (Configuration) record
.getAttributeAsObject(AbstractOperationScheduleDataSource.Field.PARAMETERS);
-
super.editExistingRecord(record);
}
@@ -426,11 +425,14 @@ public abstract class AbstractOperationScheduleDetailsView extends
private void refreshOperationParametersItem() {
String operationName = getSelectedOperationName();
String value;
- operationParameters = null; // reset params between dropdown selects
- // make sure we wipe out anything left by the previous op def
- for (Canvas child : this.operationParametersConfigurationHolder.getChildren()) {
- child.destroy();
+ if (isNewRecord()) { // BZ 909157: do it only for new schedule
+ operationParameters = null; // reset params between dropdown selects
+ // make sure we wipe out anything left by the previous op def
+ for (Canvas child : this.operationParametersConfigurationHolder.getChildren()) {
+ child.destroy();
+ }
}
+
if (operationName == null) {
value = "<i>" + MSG.view_operationScheduleDetails_fieldDefault_parameters() + "</i>";
this.operationParametersConfigurationHolder.hide();
@@ -453,8 +455,6 @@ public abstract class AbstractOperationScheduleDetailsView extends
ConfigurationTemplate defaultTemplate = parametersDefinition.getDefaultTemplate();
this.operationParameters = (defaultTemplate != null) ? defaultTemplate.createConfiguration()
: new Configuration();
- } else {
- this.operationParameters = new Configuration();
}
ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
commit 75938dac1e630e1f71a6a31e59f7b6124084a2c3
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 14 09:22:47 2013 -0500
installer now provides a "--force" option - this lets you re-run the installer even if you didn't set autoinstall.enabled=true
and it also lets you attempt another installation if a previous one failed in the middle of its prior attempt.
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
index 48defbc..b8a83fc 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
@@ -157,6 +157,7 @@ public class Installer {
usage.append("\t--host=<hostname>, -h: hostname where the app server is running").append("\n");
usage.append("\t--port=<port>, -p: talk to the app server over this management port").append("\n");
usage.append("\t--test, -t: test the validity of the server properties (install not performed)").append("\n");
+ usage.append("\t--force, -f: force the installer to try to install everything").append("\n");
usage.append("\t--listservers, -l: show list of known installed servers (install not performed)").append("\n");
usage.append("\t--setupdb, -b: only perform database schema creation or update").append("\n");
usage.append("\t--reconfig, -r: resets some configuration settings in an installed server").append("\n");
@@ -166,7 +167,7 @@ public class Installer {
}
private WhatToDo[] processArguments(String[] args) throws Exception {
- String sopts = "-:HD:h:p:d:blrt";
+ String sopts = "-:HD:h:p:d:bflrt";
LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'H'),
new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'h'),
new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
@@ -174,6 +175,7 @@ public class Installer {
new LongOpt("setupdb", LongOpt.NO_ARGUMENT, null, 'b'),
new LongOpt("listservers", LongOpt.NO_ARGUMENT, null, 'l'),
new LongOpt("reconfig", LongOpt.NO_ARGUMENT, null, 'r'),
+ new LongOpt("force", LongOpt.NO_ARGUMENT, null, 'f'),
new LongOpt("test", LongOpt.NO_ARGUMENT, null, 't') };
boolean test = false;
@@ -255,6 +257,11 @@ public class Installer {
break; // don't return, in case we need to allow more args
}
+ case 'f': {
+ this.installerConfig.setForceInstall(true);
+ break; // don't return, in case we need to allow more args
+ }
+
case 'l': {
listservers = true;
break; // don't return, we need to allow more args to be processed, like -p or -h
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java
index 0852b78..3adecbe 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java
@@ -28,6 +28,7 @@ package org.rhq.enterprise.server.installer;
public class InstallerConfiguration {
private String managementHost = "127.0.0.1";
private int managementPort = 9999; // this is the default AS port
+ private boolean forceInstall = false;
public InstallerConfiguration() {
}
@@ -59,4 +60,12 @@ public class InstallerConfiguration {
}
this.managementPort = port;
}
+
+ public boolean isForceInstall() {
+ return this.forceInstall;
+ }
+
+ public void setForceInstall(boolean flag) {
+ this.forceInstall = flag;
+ }
}
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
index 3ece569..e72f133 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
@@ -86,7 +86,7 @@ public class InstallerServiceImpl implements InstallerService {
return;
}
if (allServerDetails.size() == 0) {
- log.info("There are no known servers currently registered");
+ log("There are no known servers currently registered");
return;
}
@@ -108,7 +108,7 @@ public class InstallerServiceImpl implements InstallerService {
info.append(serverDetails.getEndpointSecurePortString());
info.append("\n");
}
- log.info(info.toString());
+ log(info.toString());
return;
}
@@ -136,15 +136,21 @@ public class InstallerServiceImpl implements InstallerService {
ServerDetails detailsFromProps = getServerDetailsFromPropertiesOnly(serverProperties);
ServerDetails detailsFromDb = getServerDetails(dbUrl, dbUsername, clearTextDbPassword,
detailsFromProps.getName());
+ ExistingSchemaOption existingSchemaOption = getAutoinstallExistingSchemaOption(serverProperties);
+
if (detailsFromDb == null) {
- log.info("This will be considered a new server: " + detailsFromProps);
+ log("This will be considered a new server: " + detailsFromProps);
} else {
- log.info("This [" + detailsFromProps + "] will be considered a reinstallation of an existing server ["
- + detailsFromDb + "]");
+ if (existingSchemaOption == ExistingSchemaOption.OVERWRITE) {
+ log("This [" + detailsFromProps + "] will OVERWRITE the existing server [" + detailsFromDb
+ + "] that already exists in the database.");
+ } else {
+ log("This [" + detailsFromProps + "] will be considered a reinstallation of an existing server ["
+ + detailsFromDb + "]");
+ }
}
// just warns if the schema will be overwritten
- ExistingSchemaOption existingSchemaOption = getAutoinstallExistingSchemaOption(serverProperties);
if (existingSchemaOption == ExistingSchemaOption.OVERWRITE) {
log.warn("The installer has been configured to OVERWRITE any existing data in the database. "
+ "If you do install with this configuration, realize that all existing data in the database "
@@ -153,10 +159,10 @@ public class InstallerServiceImpl implements InstallerService {
// just logs the location of the AS instance where RHQ will be installed
String appServerHomeDir = getAppServerHomeDir();
- log.info("The app server where the installation will go is found at: " + appServerHomeDir);
+ log("The app server where the installation will go is found at: " + appServerHomeDir);
// give some message to indicate everything looks OK and the user can start the real install
- log.info("It looks like everything is OK and you can start the installation.");
+ log("It looks like everything is OK and you can start the installation.");
}
@Override
@@ -177,8 +183,12 @@ public class InstallerServiceImpl implements InstallerService {
if (autoInstallMode) {
log("The server is preconfigured and ready for auto-install.");
} else {
- throw new AutoInstallDisabledException(
- "Auto-installation is disabled. Please fully configure rhq-server.properties");
+ if (this.installerConfiguration.isForceInstall()) {
+ log("Auto-installation would have been disabled, but installer was asked to force the install... continuing.");
+ } else {
+ throw new AutoInstallDisabledException(
+ "Auto-installation is disabled. Please fully configure rhq-server.properties");
+ }
}
// make an attempt to connect to the app server - we must make sure its running and we can connect to it
@@ -189,11 +199,21 @@ public class InstallerServiceImpl implements InstallerService {
final String installationResults = getInstallationResults();
if (installationResults != null) {
if (installationResults.length() == 0) {
- throw new AlreadyInstalledException(
- "The installer has already been told to perform its work. The server should be ready soon.");
+ if (this.installerConfiguration.isForceInstall()) {
+ log("The installer appears to have already been told to perform its work, but the installer was asked for force the install... continuing.");
+ } else {
+ throw new AlreadyInstalledException(
+ "The installer has already been told to perform its work. The server should be ready soon.");
+ }
} else {
- throw new Exception("The installer has already attempted to install the server but errors occurred:\n"
- + installationResults);
+ if (this.installerConfiguration.isForceInstall()) {
+ log("The installer is going to force another installation attempt, even though a previous attempt encountered errors:\n"
+ + installationResults);
+ } else {
+ throw new Exception(
+ "The installer has already attempted to install the server but errors occurred:\n"
+ + installationResults);
+ }
}
}
@@ -225,8 +245,12 @@ public class InstallerServiceImpl implements InstallerService {
String existingSchemaOption) throws AutoInstallDisabledException, AlreadyInstalledException, Exception {
if (isEarDeployed()) {
- throw new AlreadyInstalledException(
- "It looks like the installation has already been completed - there is nothing for the installer to do.");
+ if (this.installerConfiguration.isForceInstall()) {
+ log("It looks like the installation has already been completed, but the installer was asked for force the install... continuing.");
+ } else {
+ throw new AlreadyInstalledException(
+ "It looks like the installation has already been completed - there is nothing for the installer to do.");
+ }
}
prepareDatabase(serverProperties, serverDetails, existingSchemaOption);
@@ -930,7 +954,8 @@ public class InstallerServiceImpl implements InstallerService {
// Not only do we want to make sure we can connect, but we also want to wait for the subsystems to initialize.
// Let's wait for one of the subsystems to exist; once we know this is up, the rest are probably ready too.
if (!(new WebJBossASClient(getModelControllerClient()).isWebSubsystem())) {
- throw new IllegalStateException("The server does not appear to be fully started yet");
+ throw new IllegalStateException(
+ "The server does not appear to be fully started yet (the web subsystem did not start)");
}
return retVal;
@@ -1096,8 +1121,13 @@ public class InstallerServiceImpl implements InstallerService {
try {
mcc = getModelControllerClient();
CoreJBossASClient client = new CoreJBossASClient(mcc);
- log("Installing RHQ EAR startup subsystem extension");
- client.addExtension(RHQ_EXTENSION_NAME);
+ boolean isDeployed = client.isExtension(RHQ_EXTENSION_NAME);
+ if (!isDeployed) {
+ log("Installing RHQ EAR startup subsystem extension");
+ client.addExtension(RHQ_EXTENSION_NAME);
+ } else {
+ log("RHQ EAR startup subsystem extension is already deployed");
+ }
} finally {
safeClose(mcc);
}
@@ -1108,8 +1138,13 @@ public class InstallerServiceImpl implements InstallerService {
try {
mcc = getModelControllerClient();
CoreJBossASClient client = new CoreJBossASClient(mcc);
- log("Installing RHQ EAR subsystem");
- client.addSubsystem(RHQ_SUBSYSTEM_NAME);
+ boolean isDeployed = client.isSubsystem(RHQ_SUBSYSTEM_NAME);
+ if (!isDeployed) {
+ log("Installing RHQ EAR subsystem");
+ client.addSubsystem(RHQ_SUBSYSTEM_NAME);
+ } else {
+ log("RHQ EAR subsystem is already deployed");
+ }
} finally {
safeClose(mcc);
}
commit a7172ed168f77a6de4c6eb020666fa142aaa5569
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Feb 14 15:04:35 2013 +0100
The apache integration tests are now resilient against apache servers running on the target machine out of the test control. These will no longer affect the test results.
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
index 8bc25ca..a7f6697 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
@@ -59,6 +59,10 @@ import org.rhq.core.domain.resource.ResourceType;
*/
public class FakeServerInventory {
+ public interface InventoryStatusJudge {
+ InventoryStatus judge(Resource resource);
+ }
+
private Resource platform;
private Map<String, Resource> resourceStore = new HashMap<String, Resource>();
private int counter;
@@ -77,6 +81,13 @@ public class FakeServerInventory {
}
};
+ private static final Comparator<Resource> RESOURCE_TYPE_AND_STATUS_COMPARATOR = new Comparator<Resource>() {
+ public int compare(Resource o1, Resource o2) {
+ return o1.getResourceType().equals(o2.getResourceType())
+ && o1.getInventoryStatus() == o2.getInventoryStatus() ? 0 : o1.getId() - o2.getId();
+ }
+ };
+
public FakeServerInventory() {
this(false);
}
@@ -86,14 +97,18 @@ public class FakeServerInventory {
}
public synchronized void prepopulateInventory(Resource platform, Collection<Resource> topLevelServers) {
- this.platform = fakePersist(platform, InventoryStatus.COMMITTED, new HashSet<String>());
+ this.platform = fakePersist(platform, getSimpleJudge(InventoryStatus.COMMITTED), new HashSet<String>());
for (Resource res : topLevelServers) {
res.setParentResource(this.platform);
- fakePersist(res, InventoryStatus.COMMITTED, new HashSet<String>());
+ fakePersist(res, getSimpleJudge(InventoryStatus.COMMITTED), new HashSet<String>());
}
}
public synchronized CustomAction mergeInventoryReport(final InventoryStatus requiredInventoryStatus) {
+ return mergeInventoryReport(getSimpleJudge(requiredInventoryStatus));
+ }
+
+ public synchronized CustomAction mergeInventoryReport(final InventoryStatusJudge judge) {
return new CustomAction("updateServerSideInventory") {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
@@ -102,7 +117,7 @@ public class FakeServerInventory {
InventoryReport inventoryReport = (InventoryReport) invocation.getParameter(0);
for (Resource res : inventoryReport.getAddedRoots()) {
- Resource persisted = fakePersist(res, requiredInventoryStatus, new HashSet<String>());
+ Resource persisted = fakePersist(res, judge, new HashSet<String>());
if (res.getParentResource() == Resource.ROOT) {
platform = persisted;
@@ -265,6 +280,23 @@ public class FakeServerInventory {
}
@SuppressWarnings("serial")
+ public synchronized Set<Resource> findResourcesByTypeAndStatus(final ResourceType type, final InventoryStatus status) {
+ Set<Resource> result = new HashSet<Resource>();
+ if (platform != null) {
+ findResources(platform, new Resource() {
+ public ResourceType getResourceType() {
+ return type;
+ }
+
+ public InventoryStatus getInventoryStatus() {
+ return status;
+ }
+ }, result, RESOURCE_TYPE_AND_STATUS_COMPARATOR);
+ }
+ return result;
+ }
+
+ @SuppressWarnings("serial")
private Set<Resource> getResources(Set<Integer> resourceIds, boolean includeDescendants) {
//it is important to keep the hierarchical order of the resource in the returned set
//so that plugin container can merge the resources from top to bottom.
@@ -301,7 +333,7 @@ public class FakeServerInventory {
}
}
- private Resource fakePersist(Resource agentSideResource, InventoryStatus requiredInventoryStatus,
+ private Resource fakePersist(Resource agentSideResource, InventoryStatusJudge statusJudge,
Set<String> inProgressUUIds) {
Resource persisted = resourceStore.get(agentSideResource.getUuid());
if (!inProgressUUIds.add(agentSideResource.getUuid())) {
@@ -316,6 +348,7 @@ public class FakeServerInventory {
persisted.setUuid(agentSideResource.getUuid());
resourceStore.put(persisted.getUuid(), persisted);
}
+
persisted.setAgent(agentSideResource.getAgent());
persisted.setCurrentAvailability(agentSideResource.getCurrentAvailability());
persisted.setDescription(agentSideResource.getDescription());
@@ -323,13 +356,15 @@ public class FakeServerInventory {
persisted.setPluginConfiguration(agentSideResource.getPluginConfiguration().clone());
persisted.setResourceConfiguration(agentSideResource.getResourceConfiguration().clone());
persisted.setVersion(agentSideResource.getVersion());
- persisted.setInventoryStatus(requiredInventoryStatus);
persisted.setResourceKey(agentSideResource.getResourceKey());
persisted.setResourceType(agentSideResource.getResourceType());
+ InventoryStatus status = statusJudge.judge(persisted);
+ persisted.setInventoryStatus(status);
+
Resource parent = agentSideResource.getParentResource();
if (parent != null && parent != Resource.ROOT) {
- parent = fakePersist(agentSideResource.getParentResource(), requiredInventoryStatus,
+ parent = fakePersist(agentSideResource.getParentResource(), statusJudge,
inProgressUUIds);
persisted.setParentResource(parent);
parent.getChildResources().add(persisted);
@@ -340,7 +375,7 @@ public class FakeServerInventory {
//persist the children
Set<Resource> childResources = new LinkedHashSet<Resource>();
for (Resource child : agentSideResource.getChildResources()) {
- childResources.add(fakePersist(child, requiredInventoryStatus, inProgressUUIds));
+ childResources.add(fakePersist(child, statusJudge, inProgressUUIds));
}
//now update the list with whatever the persisted resource contained in the past
//i.e. we prefer the current results from the agent but keep the children we used to
@@ -398,6 +433,7 @@ public class FakeServerInventory {
children.add(syncChild);
}
+
getPrivateField(clazz, "childSyncInfos").set(ret, children);
return ret;
@@ -444,4 +480,14 @@ public class FakeServerInventory {
}
}
}
+
+ private InventoryStatusJudge getSimpleJudge(final InventoryStatus requiredStatus) {
+ return new InventoryStatusJudge() {
+
+ @Override
+ public InventoryStatus judge(Resource resource) {
+ return requiredStatus;
+ }
+ };
+ }
}
diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java
index b1c8a24..85d5f52 100644
--- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java
+++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java
@@ -49,6 +49,7 @@ import org.rhq.core.pc.configuration.ConfigurationManager;
import org.rhq.core.pc.inventory.InventoryManager;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pc.upgrade.FakeServerInventory;
+import org.rhq.plugins.apache.ApacheServerComponent;
import org.rhq.plugins.apache.PluginLocation;
import org.rhq.plugins.apache.setup.ApacheTestConfiguration;
import org.rhq.plugins.apache.setup.ApacheTestSetup;
@@ -58,7 +59,7 @@ import org.rhq.test.pc.PluginContainerSetup;
import org.rhq.test.pc.PluginContainerTest;
/**
- *
+ *
*
* @author Lukas Krejci
*/
@@ -126,13 +127,13 @@ public class AugeasReferenceLeakingTest extends BMNGRunner {
configureApacheServerToUseAugeas();
PluginContainer pc = PluginContainer.getInstance();
- Resource platform = pc.getInventoryManager().getPlatform();
+ Resource apacheServer = findApacheServerResource().getResource();
for (int i = 0; i < configurationReadingInvocationCount; ++i) {
- checkConfigurationRecursively(platform, pc.getConfigurationManager());
+ checkApacheServerConfigurationRecursively(apacheServer, pc.getConfigurationManager());
Thread.sleep(10000);
}
-
+
//wait a couple of seconds for the loadConfig calls to finish
Thread.sleep(60000);
} finally {
@@ -192,14 +193,14 @@ public class AugeasReferenceLeakingTest extends BMNGRunner {
}
}
- private void checkConfigurationRecursively(Resource resource, ConfigurationManager cm)
+ private void checkApacheServerConfigurationRecursively(Resource resource, ConfigurationManager cm)
throws PluginContainerException {
if (resource.getResourceType().getResourceConfigurationDefinition() != null) {
cm.loadResourceConfiguration(resource.getId());
}
for (Resource child : resource.getChildResources()) {
- checkConfigurationRecursively(child, cm);
+ checkApacheServerConfigurationRecursively(child, cm);
}
}
@@ -208,32 +209,36 @@ public class AugeasReferenceLeakingTest extends BMNGRunner {
InventoryManager im = PluginContainer.getInstance().getInventoryManager();
- ResourceContainer apacheServer = findResource(resourceTypes.findByName("Apache HTTP Server"));
+ ResourceContainer apacheServer = findApacheServerResource();
Configuration config = apacheServer.getResourceContext().getPluginConfiguration();
config.getSimple("augeasEnabled").setValue("yes");
im.updatePluginConfiguration(apacheServer.getResource().getId(), config);
-
+
//and run discovery so that the new resources can go into inventory
-
+
im.executeServiceScanImmediately();
}
- private ResourceContainer findResource(ResourceType resourceType) {
+ private ResourceContainer findApacheServerResource() throws Exception {
InventoryManager im = PluginContainer.getInstance().getInventoryManager();
+ ResourceTypes resourceTypes = new ResourceTypes(PluginLocation.APACHE_PLUGIN);
+ ResourceType apacheServerResourceType = resourceTypes.findByName("Apache HTTP Server");
- return findResource(im, resourceType, im.getPlatform());
+ return findApacheServerResource(im, apacheServerResourceType, im.getPlatform());
}
- private ResourceContainer findResource(InventoryManager im, ResourceType rt, Resource root) {
- if (root.getResourceType().equals(rt)) {
+ private ResourceContainer findApacheServerResource(InventoryManager im, ResourceType rt, Resource root) {
+ if (root.getResourceType().equals(rt)
+ && root.getPluginConfiguration().getSimpleValue(ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT)
+ .equals(setup.getDeploymentConfig().serverRoot)) {
return im.getResourceContainer(root);
}
for (Resource child : root.getChildResources()) {
- ResourceContainer rc = findResource(im, rt, child);
+ ResourceContainer rc = findApacheServerResource(im, rt, child);
if (rc != null) {
return rc;
}
diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
index 37e74d9..e0363af 100644
--- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
+++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
@@ -41,6 +41,7 @@ import org.rhq.core.domain.discovery.AvailabilityReport;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceError;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.ServerServices;
import org.rhq.core.pc.upgrade.FakeServerInventory;
import org.rhq.core.system.SystemInfoFactory;
@@ -257,9 +258,23 @@ public class ApacheTestSetup {
public void addDefaultExceptations(Expectations expectations) throws Exception {
ServerServices ss = PluginContainerTest.getCurrentPluginContainerConfiguration().getServerServices();
+ //only import the apache servers we actually care about - we can't assume another apache won't be present
+ //on the machine running the test...
+ final ResourceType serverResourceType = apacheResourceTypes.findByName("Apache HTTP Server");
expectations.allowing(ss.getDiscoveryServerService()).mergeInventoryReport(
expectations.with(Expectations.any(InventoryReport.class)));
- expectations.will(fakeInventory.mergeInventoryReport(InventoryStatus.COMMITTED));
+ expectations.will(fakeInventory.mergeInventoryReport(new FakeServerInventory.InventoryStatusJudge() {
+ @Override
+ public InventoryStatus judge(Resource resource) {
+ if (serverResourceType.equals(resource.getResourceType())) {
+ return deploymentConfig.serverRoot.equals(resource.getPluginConfiguration().getSimpleValue(
+ ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT)) ? InventoryStatus.COMMITTED
+ : InventoryStatus.IGNORED;
+ } else {
+ return InventoryStatus.COMMITTED;
+ }
+ }
+ }));
expectations.allowing(ss.getDiscoveryServerService()).upgradeResources(
expectations.with(Expectations.any(Set.class)));
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 aebea53..719a3dd 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
@@ -42,6 +42,7 @@ import org.testng.annotations.BeforeClass;
import org.rhq.core.clientapi.agent.metadata.PluginMetadataParser;
import org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil;
import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor;
+import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceError;
@@ -77,15 +78,15 @@ import org.rhq.test.pc.PluginContainerTest;
public class UpgradeTestBase extends PluginContainerTest {
private static final Log LOG = LogFactory.getLog(UpgradeTestBase.class);
-
+
public enum ResourceKeyFormat {
SNMP, RHQ3, RHQ4
};
-
+
protected static final String DEPLOYMENT_SIMPLE_WITH_RESOLVABLE_SERVERNAMES = "simpleWithResolvableServerNames";
protected static final String DEPLOYMENT_SIMPLE_WITH_UNRESOLVABLE_SERVER_NAMES = "simpleWithUnresolvableServerNames";
protected static final String DEPLOYMENT_SIMPLE_WITH_WILDCARD_LISTENS = "simpleWithWildcardListens";
-
+
private ResourceTypes apacheResourceTypes;
protected Resource platform;
@@ -101,15 +102,15 @@ public class UpgradeTestBase extends PluginContainerTest {
apacheResourceTypes);
boolean testFailed = false;
try {
-
+
String[] configFiles = Arrays.copyOf(testConfiguration.apacheConfigurationFiles, testConfiguration.apacheConfigurationFiles.length + 1);
configFiles[testConfiguration.apacheConfigurationFiles.length] = "/snmpd.conf";
-
+
setup.withInventoryFrom(testConfiguration.inventoryFile)
.withPlatformResource(platform).withDefaultExpectations().withDefaultOverrides(testConfiguration.defaultOverrides)
.withApacheSetup().withConfigurationFiles(configFiles)
.withServerRoot(testConfiguration.serverRoot).withExePath(testConfiguration.binPath);
-
+
testConfiguration.beforeTestSetup(setup);
LOG.debug("---------------------------------------------------------- Starting the upgrade test for: "
@@ -117,46 +118,46 @@ public class UpgradeTestBase extends PluginContainerTest {
LOG.debug("Deployment configuration: " + setup.getDeploymentConfig());
setup.setup();
-
+
testConfiguration.beforePluginContainerStart(setup);
-
+
startConfiguredPluginContainer();
-
+
testConfiguration.beforeTests(setup);
-
+
//ok, now we should see the resources upgraded in the fake server inventory.
ResourceType serverResourceType = apacheResourceTypes.findByName("Apache HTTP Server");
ResourceType vhostResourceType = apacheResourceTypes.findByName("Apache Virtual Host");
-
- Set<Resource> servers = setup.getFakeInventory().findResourcesByType(serverResourceType);
+
+ Set<Resource> servers = setup.getFakeInventory().findResourcesByTypeAndStatus(serverResourceType, InventoryStatus.COMMITTED);
assertEquals(servers.size(), 1, "There should be exactly one apache server discovered.");
-
+
Resource server = servers.iterator().next();
-
+
String expectedResourceKey = ApacheServerDiscoveryComponent.formatResourceKey(testConfiguration.serverRoot, testConfiguration.serverRoot
+ "/conf/httpd.conf");
-
+
assertEquals(server.getResourceKey(), expectedResourceKey,
"The server resource key doesn't seem to be upgraded.");
-
- Set<Resource> vhosts = setup.getFakeInventory().findResourcesByType(vhostResourceType);
-
+
+ Set<Resource> vhosts = setup.getFakeInventory().findResourcesByTypeAndStatus(vhostResourceType, InventoryStatus.COMMITTED);
+
String[] expectedRKs = testConfiguration.getExpectedResourceKeysAfterUpgrade(setup);
-
+
assertEquals(vhosts.size(), expectedRKs.length, "Unexpected number of vhosts discovered found");
-
+
List<String> expectedResourceKeys = Arrays.asList(expectedRKs);
-
+
for (Resource vhost : vhosts) {
assertTrue(expectedResourceKeys.contains(vhost.getResourceKey()),
"Unexpected virtual host resource key: '" + vhost.getResourceKey() + "'. Only expecting " + expectedResourceKeys);
}
-
+
String[] expectedFailureRKs = testConfiguration.getExpectedResourceKeysWithFailures(setup);
if (expectedFailureRKs != null && expectedFailureRKs.length > 0) {
Set<Resource> failingResources = new HashSet<Resource>();
-
+
for(String rk : expectedFailureRKs) {
for(Resource r : vhosts) {
if (rk.equals(r.getResourceKey())) {
@@ -165,21 +166,21 @@ public class UpgradeTestBase extends PluginContainerTest {
}
}
}
-
+
assertEquals(failingResources.size(), expectedFailureRKs.length, "Couldn't find all the resources that should have failed.");
-
+
for(Resource failingResource : failingResources) {
List<ResourceError> errors = failingResource.getResourceErrors(ResourceErrorType.UPGRADE);
assertNotNull(errors, "The main vhost doesn't have any upgrade errors.");
assertEquals(errors.size(), 1, "There should be exactly one upgrade error on the main vhost.");
}
-
+
//check that all other vhosts were not upgraded but have no errors
for(Resource r : vhosts) {
if (failingResources.contains(r)) {
continue;
}
-
+
assertEquals(r.getResourceErrors(ResourceErrorType.UPGRADE).size(), 0, "Unexpected number of resource upgrade errors on vhost " + r);
}
} else {
@@ -213,31 +214,31 @@ public class UpgradeTestBase extends PluginContainerTest {
setup.withApacheSetup().init();
ApacheServerComponent component = setup.withApacheSetup().getServerComponent();
ApacheDirectiveTree config = component.parseRuntimeConfiguration(false);
-
+
DeploymentConfig deployConfig = setup.getDeploymentConfig();
-
+
VirtualHostLegacyResourceKeyUtil keyUtil = new VirtualHostLegacyResourceKeyUtil(component, config);
-
+
Map<String, String> replacements = deployConfig.getTokenReplacements();
-
+
testConfig.defaultOverrides.put("main.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyMainServerResourceKey());
-
- if (deployConfig.vhost1 != null) {
+
+ if (deployConfig.vhost1 != null) {
testConfig.defaultOverrides.put("vhost1.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost1.getVHostSpec(replacements)));
}
-
+
if (deployConfig.vhost2 != null) {
testConfig.defaultOverrides.put("vhost2.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost2.getVHostSpec(replacements)));
}
-
+
if (deployConfig.vhost3 != null) {
testConfig.defaultOverrides.put("vhost3.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost3.getVHostSpec(replacements)));
}
-
+
if (deployConfig.vhost4 != null) {
testConfig.defaultOverrides.put("vhost4.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost4.getVHostSpec(replacements)));
}
-
+
setup.withDefaultOverrides(testConfig.defaultOverrides);
}
@@ -248,13 +249,13 @@ public class UpgradeTestBase extends PluginContainerTest {
protected static String[] getVHostRKs(ApacheTestSetup setup, int[] successfulUpgrades, int[] failedUpgrades, ResourceKeyFormat rkFormat) {
int sucLen = successfulUpgrades == null ? 0 : successfulUpgrades.length;
int failLen = failedUpgrades == null ? 0 : failedUpgrades.length;
-
+
String[] ret = new String[sucLen + failLen];
-
+
int retIdx = 0;
-
+
Map<String, String> replacements = setup.getInventoryFileReplacements();
-
+
for(int i = 0; i < sucLen; ++i, ++retIdx) {
int vhostNum = successfulUpgrades[i];
if (vhostNum == 0) {
@@ -264,7 +265,7 @@ public class UpgradeTestBase extends PluginContainerTest {
ret[retIdx] = ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(vhost.serverName, vhost.hosts);
}
}
-
+
for(int i = 0; i < failLen; ++i, ++retIdx) {
String variableName = null;
if (failedUpgrades[i] == 0) {
@@ -280,7 +281,7 @@ public class UpgradeTestBase extends PluginContainerTest {
variableName = "vhost" + failedUpgrades[i] + ".rhq";
}
}
-
+
switch (rkFormat) {
case RHQ3:
variableName += "3.resource.key";
@@ -292,10 +293,10 @@ public class UpgradeTestBase extends PluginContainerTest {
variableName += "snmp.identifier";
break;
}
-
+
ret[retIdx] = replacements.get(variableName);
}
-
+
return ret;
}
@@ -305,7 +306,7 @@ public class UpgradeTestBase extends PluginContainerTest {
.toURL());
PluginMetadataParser parser = new PluginMetadataParser(descriptor,
Collections.<String, PluginMetadataParser> emptyMap());
-
+
List<ResourceType> platformTypes = parser.getAllTypes();
//this is the default container name in case of no plugin explicit plugin configuration, which we don't have.
@@ -317,20 +318,20 @@ public class UpgradeTestBase extends PluginContainerTest {
}
Class discoveryClass = Class.forName(parser.getDiscoveryComponentClass(rt));
-
+
ResourceDiscoveryComponent discoveryComponent = (ResourceDiscoveryComponent) discoveryClass.newInstance();
-
+
ResourceDiscoveryContext context = new ResourceDiscoveryContext(rt, null, null,
SystemInfoFactory.createSystemInfo(), Collections.emptyList(), Collections.emptyList(), containerName,
PluginContainerDeployment.AGENT);
-
+
Set<DiscoveredResourceDetails> results = discoveryComponent.discoverResources(context);
-
+
if (!results.isEmpty()) {
DiscoveredResourceDetails details = results.iterator().next();
-
+
Resource platform = new Resource();
-
+
platform.setDescription(details.getResourceDescription());
platform.setResourceKey(details.getResourceKey());
platform.setName(details.getResourceName());
@@ -339,11 +340,11 @@ public class UpgradeTestBase extends PluginContainerTest {
platform.setResourceType(rt);
platform.setUuid(UUID.randomUUID().toString());
platform.setId(1);
-
+
return platform;
}
}
-
+
return null;
}
@@ -352,12 +353,12 @@ public class UpgradeTestBase extends PluginContainerTest {
if (prefix != null && !prefix.isEmpty()) {
bld.append(prefix).append(".");
}
-
+
bld.append(name);
-
+
return bld.toString();
}
-
+
protected static InetAddress determineLocalhost() {
try {
return InetAddress.getLocalHost();
commit 21a5d14f5577f71245d62456ffabab7e4c647698
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 13 16:11:34 2013 -0500
append to the installer log so we don't lose any installer log messages when rhq-installer.sh is run multiple times
diff --git a/modules/enterprise/server/installer/src/main/resources/logging.properties b/modules/enterprise/server/installer/src/main/resources/logging.properties
index 6a48b2b..0affd97 100644
--- a/modules/enterprise/server/installer/src/main/resources/logging.properties
+++ b/modules/enterprise/server/installer/src/main/resources/logging.properties
@@ -16,8 +16,9 @@ handler.CONSOLE.formatter=PATTERN
# File handler configuration
handler.FILE=org.jboss.logmanager.handlers.FileHandler
handler.FILE.level=${rhq.server.installer.loglevel:DEBUG}
-handler.FILE.properties=autoFlush,fileName
+handler.FILE.properties=autoFlush,append,fileName
handler.FILE.autoFlush=true
+handler.FILE.append=true
handler.FILE.fileName=${rhq.server.installer.logdir:.}/rhq-installer.log
handler.FILE.formatter=PATTERN
commit 842814143212160f2a88f3a83b5ae71eb3a6d506
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 13 20:09:02 2013 +0100
Fix the expectations of the JMock-based apache plugin integration tests
after the fixes in the inventory report processing that changed the workflow
slightly.
This should make the apache integration tests pass again.
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
index 17beb1e..8bc25ca 100644
--- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
+++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
@@ -26,6 +26,8 @@ package org.rhq.core.pc.upgrade;
import static org.testng.Assert.fail;
import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -52,7 +54,7 @@ import org.rhq.core.domain.resource.ResourceType;
/**
* This class represents a server side database store of the inventory for the purposes
* of the ResourceUpgradeTest unit test.
- *
+ *
* @author Lukas Krejci
*/
public class FakeServerInventory {
@@ -62,7 +64,7 @@ public class FakeServerInventory {
private int counter;
private boolean failing;
private boolean failUpgrade;
-
+
private static final Comparator<Resource> ID_COMPARATOR = new Comparator<Resource>() {
public int compare(Resource o1, Resource o2) {
return o1.getId() - o2.getId();
@@ -90,18 +92,18 @@ public class FakeServerInventory {
fakePersist(res, InventoryStatus.COMMITTED, new HashSet<String>());
}
}
-
+
public synchronized CustomAction mergeInventoryReport(final InventoryStatus requiredInventoryStatus) {
return new CustomAction("updateServerSideInventory") {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
throwIfFailing();
-
+
InventoryReport inventoryReport = (InventoryReport) invocation.getParameter(0);
-
+
for (Resource res : inventoryReport.getAddedRoots()) {
Resource persisted = fakePersist(res, requiredInventoryStatus, new HashSet<String>());
-
+
if (res.getParentResource() == Resource.ROOT) {
platform = persisted;
}
@@ -117,9 +119,9 @@ public class FakeServerInventory {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
throwIfFailing();
-
+
platform = null;
-
+
return getSyncInfo();
}
}
@@ -131,36 +133,36 @@ public class FakeServerInventory {
public Object invoke(Invocation invocation) throws Throwable {
synchronized(FakeServerInventory.this) {
throwIfFailing();
-
+
ResourceError error = (ResourceError) invocation.getParameter(0);
-
+
Resource serverSideResource = resourceStore.get(error.getResource().getUuid());
-
+
if (serverSideResource != null) {
List<ResourceError> currentErrors = serverSideResource.getResourceErrors();
currentErrors.add(error);
}
-
+
return null;
}
}
};
}
-
+
public synchronized CustomAction upgradeResources() {
return new CustomAction("upgradeServerSideInventory") {
@SuppressWarnings({ "serial", "unchecked" })
public Object invoke(Invocation invocation) throws Throwable {
synchronized(FakeServerInventory.this) {
throwIfFailing();
-
+
if (failUpgrade) {
- throw new RuntimeException("Failing the upgrade purposefully.");
+ throw new RuntimeException("Failing the upgrade purposefully.");
}
-
+
Set<ResourceUpgradeRequest> requests = (Set<ResourceUpgradeRequest>) invocation.getParameter(0);
Set<ResourceUpgradeResponse> responses = new HashSet<ResourceUpgradeResponse>();
-
+
for (final ResourceUpgradeRequest request : requests) {
Resource resource = findResource(platform, new Resource() {
public int getId() {
@@ -174,18 +176,18 @@ public class FakeServerInventory {
if (request.getNewName() != null) {
resource.setName(request.getNewName());
}
-
+
if (request.getNewResourceKey() != null) {
resource.setResourceKey(request.getNewResourceKey());
}
-
+
if (request.getUpgradeErrorMessage() != null) {
ResourceError error = new ResourceError(resource, ResourceErrorType.UPGRADE,
request.getUpgradeErrorMessage(), request.getUpgradeErrorStackTrace(),
request.getTimestamp());
resource.getResourceErrors().add(error);
}
-
+
ResourceUpgradeResponse resp = new ResourceUpgradeResponse();
resp.setResourceId(resource.getId());
resp.setUpgradedResourceName(resource.getName());
@@ -206,16 +208,33 @@ public class FakeServerInventory {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
throwIfFailing();
-
+
Set<Integer> resourceIds = (Set<Integer>) invocation.getParameter(0);
boolean includeDescendants = (Boolean) invocation.getParameter(1);
-
+
return getResources(resourceIds, includeDescendants);
}
}
};
}
+ public synchronized CustomAction getResourcesAsList() {
+ return new CustomAction("getResourcesAsList") {
+ @Override
+ public Object invoke(Invocation invocation) throws Throwable {
+ synchronized(FakeServerInventory.this) {
+ throwIfFailing();
+
+ Integer[] resourceIds = (Integer[]) invocation.getParameter(0);
+
+ Set<Resource> resources = getResources(new LinkedHashSet<Integer>(Arrays.asList(resourceIds)), false);
+
+ return new ArrayList<Resource>(resources);
+ }
+ }
+ };
+ }
+
public synchronized boolean isFailing() {
return failing;
}
@@ -227,11 +246,11 @@ public class FakeServerInventory {
public synchronized boolean isFailUpgrade() {
return failUpgrade;
}
-
+
public synchronized void setFailUpgrade(boolean failUpgrade) {
this.failUpgrade = failUpgrade;
}
-
+
@SuppressWarnings("serial")
public synchronized Set<Resource> findResourcesByType(final ResourceType type) {
Set<Resource> result = new HashSet<Resource>();
@@ -281,7 +300,7 @@ public class FakeServerInventory {
removeResource(child);
}
}
-
+
private Resource fakePersist(Resource agentSideResource, InventoryStatus requiredInventoryStatus,
Set<String> inProgressUUIds) {
Resource persisted = resourceStore.get(agentSideResource.getUuid());
@@ -327,9 +346,9 @@ public class FakeServerInventory {
//i.e. we prefer the current results from the agent but keep the children we used to
//have in the past. This is the same behavior as the actual RHQ server has.
childResources.addAll(persisted.getChildResources());
-
+
persisted.setChildResources(childResources);
-
+
inProgressUUIds.remove(agentSideResource.getUuid());
return persisted;
diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
index 9f12166..37e74d9 100644
--- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
+++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
@@ -74,14 +74,14 @@ public class ApacheTestSetup {
private Mockery context;
private ResourceTypes apacheResourceTypes;
private String testId;
-
+
public class ApacheSetup {
private String serverRoot;
private String exePath;
private Collection<String> configurationFiles;
private ApacheExecutionUtil execution;
private boolean deploy = true;
-
+
private ApacheSetup() {
}
@@ -162,16 +162,16 @@ public class ApacheTestSetup {
+ serverRootDir + "'.");
File logsDir = new File(serverRootDir, "logs");
-
+
assertTrue(logsDir.exists(), "The configured server root denotes a directory that doesn't have a 'logs' subdirectory. This is unexpected.");
-
+
File confDir = new File(serverRootDir, "conf");
assertTrue(confDir.exists(),
"The configured server root denotes a directory that doesn't have a 'conf' subdirectory. This is unexpected.");
-
+
String confFilePath = confDir.getAbsolutePath() + File.separatorChar + "httpd.conf";
-
+
String snmpHost = null;
int snmpPort = 0;
String pingUrl = null;
@@ -185,11 +185,11 @@ public class ApacheTestSetup {
new File(binDir, "envvars-std"));
ApacheDeploymentUtil.deployConfiguration(confDir, configurationFiles, additionalFilesToProcess, deploymentConfig);
}
-
+
//ok, now try to find the ping URL. The best thing is to actually invoke
- //the same code the apache server discovery does.
+ //the same code the apache server discovery does.
ApacheDirectiveTree tree = ApacheServerDiscoveryComponent.parseRuntimeConfiguration(confFilePath, null, ApacheBinaryInfo.getInfo(exePath, SystemInfoFactory.createSystemInfo()));
-
+
//XXX this hardcodes apache2 as the only option we have...
HttpdAddressUtility.Address addrToUse = HttpdAddressUtility.APACHE_2_x.getMainServerSampleAddress(tree, null, -1);
pingUrl = addrToUse.toString();
@@ -205,7 +205,7 @@ public class ApacheTestSetup {
}
private void doSetup() throws Exception {
- init();
+ init();
startApache();
}
@@ -228,12 +228,12 @@ public class ApacheTestSetup {
return this;
}
- public ApacheTestSetup withDefaultOverrides(Map<String, String> defaultOverrides) {
+ public ApacheTestSetup withDefaultOverrides(Map<String, String> defaultOverrides) {
this.defaultOverrides = defaultOverrides == null ? new HashMap<String, String>() : defaultOverrides;
deploymentConfig = ApacheDeploymentUtil.getDeploymentConfigurationFromSystemProperties(configurationName, this.defaultOverrides);
return this;
}
-
+
public ApacheTestSetup withPlatformResource(Resource platform) {
this.platform = platform;
return this;
@@ -271,7 +271,7 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDiscoveryServerService()).setResourceError(expectations.with(Expectations.any(ResourceError.class)));
expectations.will(fakeInventory.setResourceError());
-
+
expectations.allowing(ss.getDiscoveryServerService()).mergeAvailabilityReport(
expectations.with(Expectations.any(AvailabilityReport.class)));
@@ -280,7 +280,7 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDiscoveryServerService()).clearResourceConfigError(
expectations.with(Expectations.any(int.class)));
-
+
expectations.allowing(ss.getDiscoveryServerService()).setResourceEnablement(
expectations.with(Expectations.any(int.class)), expectations.with(Expectations.any(boolean.class)));
@@ -289,7 +289,10 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDriftServerService()).getDriftDefinitions(expectations.with(Expectations.any(Set.class)));
expectations.will(Expectations.returnValue(Collections.emptyMap()));
-
+
+ expectations.allowing(ss.getDiscoveryServerService()).getResourcesAsList(expectations.with(Expectations.any(Integer[].class)));
+ expectations.will(fakeInventory.getResourcesAsList());
+
expectations.ignoring(ss.getBundleServerService());
expectations.ignoring(ss.getConfigurationServerService());
expectations.ignoring(ss.getContentServerService());
@@ -307,14 +310,14 @@ public class ApacheTestSetup {
public DeploymentConfig getDeploymentConfig() {
return deploymentConfig;
}
-
+
public ApacheTestSetup setup() throws Exception {
apacheSetup.doSetup();
- Map<String, String> replacements = deploymentConfig.getTokenReplacements();
+ Map<String, String> replacements = deploymentConfig.getTokenReplacements();
replacements.put("server.root", apacheSetup.serverRoot);
replacements.put("exe.path", apacheSetup.exePath);
-
+
ApacheDeploymentUtil.addDefaultVariables(replacements, null);
HttpdAddressUtility addressUtility = apacheSetup.getServerComponent()
@@ -325,18 +328,18 @@ public class ApacheTestSetup {
addressUtility.getHttpdInternalMainServerAddressRepresentation(runtimeConfig).toString(false, false));
replacements.put("main.rhq4.resource.key", ApacheVirtualHostServiceComponent.MAIN_SERVER_RESOURCE_KEY);
-
+
VHostSpec vhost1 = deploymentConfig.vhost1 == null ? null : deploymentConfig.vhost1.getVHostSpec(replacements);
VHostSpec vhost2 = deploymentConfig.vhost2 == null ? null : deploymentConfig.vhost2.getVHostSpec(replacements);
VHostSpec vhost3 = deploymentConfig.vhost3 == null ? null : deploymentConfig.vhost3.getVHostSpec(replacements);
VHostSpec vhost4 = deploymentConfig.vhost4 == null ? null : deploymentConfig.vhost4.getVHostSpec(replacements);
-
+
if (vhost1 != null) {
replacements.put(
"vhost1.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost1.hosts.get(0),
vhost1.serverName).toString(false, false));
-
+
replacements.put(
"vhost1.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -348,7 +351,7 @@ public class ApacheTestSetup {
"vhost2.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost2.hosts.get(0),
vhost2.serverName).toString(false, false));
-
+
replacements.put(
"vhost2.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -360,7 +363,7 @@ public class ApacheTestSetup {
"vhost3.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost3.hosts.get(0),
vhost3.serverName).toString(false, false));
-
+
replacements.put(
"vhost3.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -372,7 +375,7 @@ public class ApacheTestSetup {
"vhost4.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost4.hosts.get(0),
vhost4.serverName).toString(false, false));
-
+
replacements.put(
"vhost4.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -381,35 +384,35 @@ public class ApacheTestSetup {
//let the user override everything we just did
replacements.putAll(defaultOverrides);
-
+
inventoryFileReplacements = replacements;
-
+
if (inventoryFile != null) {
InputStream dataStream = getClass().getResourceAsStream(inventoryFile);
-
+
Reader rdr = new TokenReplacingReader(new InputStreamReader(dataStream), replacements);
-
+
@SuppressWarnings("unchecked")
List<Resource> inventory = (List<Resource>) new ObjectCollectionSerializer().deserialize(rdr);
-
- //fix up the parent relationships, because they might not be reconstructed correctly by
+
+ //fix up the parent relationships, because they might not be reconstructed correctly by
//JAXB - we're missing XmlID and XmlIDRef annotations in our model
fixupParent(null, inventory);
-
+
fakeInventory.prepopulateInventory(platform, inventory);
}
return this;
}
/**
- * After the setup, this returns all the variables used to update the tokens in the inventory file.
- *
+ * After the setup, this returns all the variables used to update the tokens in the inventory file.
+ *
* @return
*/
public Map<String, String> getInventoryFileReplacements() {
return inventoryFileReplacements;
}
-
+
private void fixupParent(Resource parent, Collection<Resource> children) {
for (Resource child : children) {
child.setParentResource(parent);
commit 955ef8974d5c8782c048704550ad8da395365e93
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 13 11:51:45 2013 -0500
Fix issues in mergeAvailabilityReport "repair code". This is code that
attempts to fix problems in the Availability records, if they somehow get
corrupted. In general, it doesn't execute. But if and when it did, it
wasn't repairing things as well as it could. This makes improvements.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
index 2946d40..0181d7a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
@@ -591,52 +591,13 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
// availability reports only tell us the current state at the start time; end time is ignored/must be null
reported.setEndTime(null);
- try {
- q.setParameter("resourceId", reported.getResource().getId());
- Availability latest = (Availability) q.getSingleResult();
- AvailabilityType latestType = latest.getAvailabilityType();
- AvailabilityType reportedType = reported.getAvailabilityType();
-
- // If the current avail is DISABLED, and this report is not trying to re-enable the resource,
- // Then ignore the reported avail.
- if (AvailabilityType.DISABLED == latestType) {
- if (!(mergeInfo.isEnablementReport() && (AvailabilityType.UNKNOWN == reportedType))) {
- disabledAvailabilities.add(reported);
- continue;
- }
- }
-
- if (reported.getStartTime() >= latest.getStartTime()) {
- //log.info( "new avail (latest/reported)-->" + latest + "/" + reported );
-
- // the new availability data is for a time after our last known state change
- // we are run-length encoded, so only persist data if the availability changed
- if (latest.getAvailabilityType() != reported.getAvailabilityType()) {
- entityManager.persist(reported);
- mergeInfo.incrementNumInserted();
-
- latest.setEndTime(reported.getStartTime());
- latest = entityManager.merge(latest);
-
- updateResourceAvailability(reported);
- }
-
- // our last known state was unknown, ask for a full report to ensure we are in sync with agent
- if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) {
- mergeInfo.setAskForFullReport(true);
- }
- } else {
- //log.info( "past avail (latest/reported)==>" + latest + "/" + reported );
+ // get the latest avail for the reported resource
+ q.setParameter("resourceId", reported.getResource().getId());
+ Availability latest = null;
- // The new data is for a time in the past, probably an agent sending a report after
- // a network outage has been corrected but after we have already backfilled.
- // We need to insert it into our past timeline.
- insertAvailability(reported);
- mergeInfo.incrementNumInserted();
+ try {
+ latest = (Availability) q.getSingleResult();
- // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent
- mergeInfo.setAskForFullReport(true);
- }
} catch (NoResultException nre) {
// This should not happen unless the Resource in the report is stale, which can happen in certain
// sync scenarios. A Resource is given its initial Availability/ResourceAvailability when it is
@@ -644,37 +605,47 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
// it must not exist in my utopian view of the world. Let's just make sure...
Resource attachedResource = (Resource) entityManager.find(Resource.class, reported.getResource()
.getId());
- if (null == attachedResource) {
+
+ if ((null == attachedResource) || (InventoryStatus.COMMITTED != attachedResource.getInventoryStatus())) {
// expected case
log.info("Skipping mergeAvailabilityReport() for stale resource [" + reported.getResource()
+ "]. These messages should go away after the next agent synchronization with the server.");
- } else if (InventoryStatus.COMMITTED == attachedResource.getInventoryStatus()) {
- // this should not happen, it means the resource exists but has no latest Availability
- // record (i.e. sendTime == null). Try to correct the situation.
+ continue;
+
+ } else {
+ // this should not really happen but is possible in rare failure situations, it means the resource
+ // exists but has no latest Availability record (i.e. sendTime == null). Correct the situation and
+ // then process the reported avail.
log.warn("Resource [" + reported.getResource()
+ "] has no latest availability record (i.e. no endtime) - will attempt to repair.\n"
+ mergeInfo.toString(false));
+
try {
List<Availability> attachedAvails = attachedResource.getAvailability();
+ Availability attachedLastAvail = null;
+
if (attachedAvails.isEmpty()) {
- attachedResource.initCurrentAvailability();
- entityManager.merge(attachedResource);
+ latest = new Availability(attachedResource, 0L, AvailabilityType.UNKNOWN);
+ entityManager.persist(latest);
} else {
- Availability attachedLastAvail = attachedAvails.get(attachedAvails.size() - 1);
- attachedLastAvail.setEndTime(null);
- entityManager.merge(attachedLastAvail);
+ latest = attachedAvails.get(attachedAvails.size() - 1);
+ latest.setEndTime(null);
+ latest = entityManager.merge(latest);
}
+ updateResourceAvailability(latest);
+
// ask the agent for a full report so as to ensure we are in sync with agent
mergeInfo.setAskForFullReport(true);
} catch (Throwable t) {
- log.warn("Unable to repair latest availablity for Resource [" + reported.getResource() + "]", t);
+ log.warn("Unable to repair NoResult latest availablity for Resource [" + reported.getResource()
+ + "]", t);
+ continue;
}
}
-
} catch (NonUniqueResultException nure) {
// This condition should never happen. In my world of la-la land, I've done everything
// correctly so this never happens. But, due to the asynchronous nature of things,
@@ -686,15 +657,69 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
log.warn("Resource [" + reported.getResource() + "] has multiple availabilities without an endtime ["
+ nure.getMessage() + "] - will attempt to remove the extra ones\n" + mergeInfo.toString(false));
- q.setParameter("resourceId", reported.getResource().getId());
- List<Availability> latest = q.getResultList();
+ try {
+
+ List<Availability> latestList = q.getResultList();
+
+ // delete all but the last one (our query sorts in ASC start time order)
+ int latestCount = latestList.size();
+ for (int i = 0; i < (latestCount - 1); i++) {
+ entityManager.remove(latestList.get(i));
+ }
+
+ latest = latestList.get(latestCount - 1);
+ updateResourceAvailability(latest);
+
+ // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent
+ mergeInfo.setAskForFullReport(true);
+
+ } catch (Throwable t) {
+ log.warn(
+ "Unable to repair NonUnique Result latest availablity for Resource [" + reported.getResource()
+ + "]", t);
+ continue;
+ }
+ }
+
+ AvailabilityType latestType = latest.getAvailabilityType();
+ AvailabilityType reportedType = reported.getAvailabilityType();
- // delete all but the last one (our query sorts in ASC start time order)
- int latestCount = latest.size();
- for (int i = 0; i < (latestCount - 1); i++) {
- entityManager.remove(latest.get(i));
+ // If the current avail is DISABLED, and this report is not trying to re-enable the resource,
+ // Then ignore the reported avail.
+ if (AvailabilityType.DISABLED == latestType) {
+ if (!(mergeInfo.isEnablementReport() && (AvailabilityType.UNKNOWN == reportedType))) {
+ disabledAvailabilities.add(reported);
+ continue;
}
- updateResourceAvailability(latest.get(latestCount - 1));
+ }
+
+ if (reported.getStartTime() >= latest.getStartTime()) {
+ //log.info( "new avail (latest/reported)-->" + latest + "/" + reported );
+
+ // the new availability data is for a time after our last known state change
+ // we are run-length encoded, so only persist data if the availability changed
+ if (latest.getAvailabilityType() != reported.getAvailabilityType()) {
+ entityManager.persist(reported);
+ mergeInfo.incrementNumInserted();
+
+ latest.setEndTime(reported.getStartTime());
+ latest = entityManager.merge(latest);
+
+ updateResourceAvailability(reported);
+ }
+
+ // our last known state was unknown, ask for a full report to ensure we are in sync with agent
+ if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) {
+ mergeInfo.setAskForFullReport(true);
+ }
+ } else {
+ //log.info( "past avail (latest/reported)==>" + latest + "/" + reported );
+
+ // The new data is for a time in the past, probably an agent sending a report after
+ // a network outage has been corrected but after we have already backfilled.
+ // We need to insert it into our past timeline.
+ insertAvailability(reported);
+ mergeInfo.incrementNumInserted();
// this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent
mergeInfo.setAskForFullReport(true);
commit ae56056671aba575d8b3c2c9064497bacfe00661
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 13 09:22:40 2013 -0500
Fix test given slight change in avail behavior. In commit c516ad09fcebcedfd1a505d6bfd434997ac6642d
we stopped kicking off an immediate avail scan when new resources were discovered,
simplifying the code, and approach, to just wait for the next scheduled scan,
which likely occurs nearly as fast. From the test's perspective this meant one
resource, the platform, had its avail change at a slightly different time.
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 005e900..956fb97 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
@@ -24,13 +24,13 @@ import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.pc.PluginContainer;
-import org.rhq.plugins.test.avail.AvailDiscoveryComponent;
-import org.rhq.plugins.test.avail.AvailResourceComponent;
import org.rhq.core.pc.inventory.AvailabilityExecutor;
import org.rhq.core.pc.inventory.AvailabilityExecutor.Scan;
import org.rhq.core.pc.inventory.ForceAvailabilityExecutor;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.plugins.test.avail.AvailDiscoveryComponent;
+import org.rhq.plugins.test.avail.AvailResourceComponent;
import org.rhq.test.arquillian.AfterDiscovery;
import org.rhq.test.arquillian.BeforeDiscovery;
import org.rhq.test.arquillian.FakeServerInventory;
@@ -184,7 +184,7 @@ public class AvailTest extends Arquillian {
Assert.assertEquals(datum.getAvailabilityType(), AvailabilityType.UP, "should be UP at the start");
}
AvailabilityExecutor.Scan scan = executor.getMostRecentScanHistory();
- assertScan(scan, true, true, 29, 28, 29, 28, 0, 0);
+ assertScan(scan, true, true, 29, 29, 29, 28, 0, 0);
// do a forced avail check again - nothing changed, so we should have an empty report
report = executor.call();
@@ -514,7 +514,7 @@ public class AvailTest extends Arquillian {
Assert.assertEquals(scan.getNumResources(), numResources,
"Unexpected numResources, remember to include the implied platform?");
Assert.assertEquals(scan.getNumAvailabilityChanges(), numChanges,
- "Unexpected numChanges, remember to omit the implied platform");
+ "Unexpected numChanges, remember to include the implied platform");
Assert.assertEquals(scan.getNumGetAvailabilityCalls(), numCalls,
"Unexpected numGetAvailCalls, remember to include the implied platform");
Assert.assertEquals(scan.getNumScheduledRandomly(), numSched,
commit d5acca52875c8aabcf784bf512fc63f1ebab373a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Feb 12 17:20:00 2013 -0500
To maintain the test dep ordering, which is sometimes important, and definitel
is important here, move all of the test deps to the new test.dependencies profile.
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml
index d5daa17..5961627 100644
--- a/modules/enterprise/server/itests-2/pom.xml
+++ b/modules/enterprise/server/itests-2/pom.xml
@@ -35,144 +35,7 @@
</properties>
<dependencies>
- <!--================ Test Deps ================ -->
-
- <!-- Note, the test dep ordering can be important. Maven orders the [test] classpath in the order listed in the pom. -->
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-dist</artifactId>
- <type>zip</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.spec</groupId>
- <artifactId>jboss-javaee-6.0</artifactId>
- <version>${jboss.javaee6.spec.version}</version>
- <scope>provided</scope>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.testng</groupId>
- <artifactId>arquillian-testng-container</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.shrinkwrap.resolver</groupId>
- <artifactId>shrinkwrap-resolver-depchain</artifactId>
- <type>pom</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-arquillian-suite-extension</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-enterprise-server</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-script-bindings</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-server-client-api</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-serverplugin-drift</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>test-utils</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- </exclusion>
- </exclusions>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq.helpers</groupId>
- <artifactId>perftest-support</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-testng</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.opensymphony.quartz</groupId>
- <artifactId>quartz</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.liquibase</groupId>
- <artifactId>liquibase-core</artifactId>
- <version>${liquibase.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>2.1</version>
- <scope>test</scope>
- </dependency>
+ <!-- see the test.dependencies profile below -->
</dependencies>
<build>
@@ -669,46 +532,183 @@
<profiles>
- <profile>
- <!--
- This profile has been created to avoid unnecessary resolution of test dependencies during a build that
- does not run, compile or need tests.
- More test dependencies are to be moved here if the set of sub-dependencies is complex, references project
- test jars, or conflicts with changing the container version.
- -->
- <id>test.dependencies</id>
- <activation>
- <property>
- <name>maven.test.skip</name>
- <value>!true</value>
- </property>
- </activation>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-core-client-api</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-arquillian-container-managed</artifactId>
- <version>${jboss.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
+ <profile>
+ <!-- This profile has been created to avoid unnecessary resolution of test dependencies during a build that does not
+ run, compile or need tests. There are product build dependencies on this profile, don't remove. -->
+
+ <id>test.dependencies</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+
+ <dependencies>
+ <!-- Note, the test dep ordering can be important. Maven orders the [test] classpath in the order listed in the pom. -->
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-dist</artifactId>
+ <type>zip</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <version>${jboss.javaee6.spec.version}</version>
+ <scope>provided</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <version>${jboss.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.testng</groupId>
+ <artifactId>arquillian-testng-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-arquillian-suite-extension</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-server</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-script-bindings</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-server-client-api</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-serverplugin-drift</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-client-api</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>test-utils</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq.helpers</groupId>
+ <artifactId>perftest-support</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-testng</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opensymphony.quartz</groupId>
+ <artifactId>quartz</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.liquibase</groupId>
+ <artifactId>liquibase-core</artifactId>
+ <version>${liquibase.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>2.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ </profile>
<!-- If testing against oracle, override the default property settings -->
<profile>
commit 0057e40c03683899f3cc454a9958aba188984d03
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Feb 12 15:48:32 2013 -0500
Fix a transactioning issue with agent backfill. It was possible for the Agent to
be marked backfilled in one transaction yet have the actual avail changes fail
in a second transaction, leaving the dead agent and its children with UP avail
and no longer eligible for backfill due to the flag being set.
Additionally, avoid large transactions if many agents need to be backfilled
sumultaneously.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
index 29c3ad3..d01dbd0 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
@@ -192,7 +192,7 @@ public class AgentManagerBean implements AgentManagerLocal {
server_bootstrap.removeDownedAgent(downedAgent.getRemoteEndpoint());
log.info("Agent with name [" + agentName + "] just went down");
- agentManager.backfillAgent(subjectManager.getOverlord(), agentName, downedAgent.getId());
+ agentManager.backfillAgentInNewTransaction(subjectManager.getOverlord(), agentName, downedAgent.getId());
return;
}
@@ -272,7 +272,8 @@ public class AgentManagerBean implements AgentManagerLocal {
log.info("Have not heard from agent [" + record.getAgentName() + "] since ["
+ new Date(record.getLastAvailabilityPing()) + "]. Will be backfilled since we suspect it is down");
- agentManager.backfillAgent(subjectManager.getOverlord(), record.getAgentName(), record.getAgentId());
+ agentManager.backfillAgentInNewTransaction(subjectManager.getOverlord(), record.getAgentName(),
+ record.getAgentId());
}
}
@@ -281,7 +282,8 @@ public class AgentManagerBean implements AgentManagerLocal {
return;
}
- public void backfillAgent(Subject subject, String agentName, int agentId) {
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public void backfillAgentInNewTransaction(Subject subject, String agentName, int agentId) {
// make sure we lock out all processing of any availability reports that might come our way to avoid concurrency
// problems
AvailabilityReportSerializer.getSingleton().lock(agentName);
@@ -299,7 +301,6 @@ public class AgentManagerBean implements AgentManagerLocal {
}
}
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void setAgentBackfilled(int agentId, boolean backfilled) {
Query query = entityManager.createNamedQuery(Agent.QUERY_SET_AGENT_BACKFILLED);
query.setParameter("agentId", agentId);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
index 6cb50f2..842d5d8 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
@@ -45,15 +45,16 @@ import org.rhq.enterprise.server.agentclient.AgentClient;
public interface AgentManagerLocal {
/**
- * Call this method to set the agent down and mark it 'backfilled'. Also, sets all of its monitored resources
- * to an UNKNOWN avail state since the agent is no longer reporting availability.
+ * Call this method to set the agent DOWN and mark it 'backfilled'. Also, sets all of its monitored resources
+ * to an UNKNOWN avail state since the agent is no longer reporting availability. Done in its own transaction to
+ * avoid large transactions if many agents are simultaneously backfilled.
*
* @param subject
* @param agentName
* @param agentId
*/
// This method should not be remoted.
- void backfillAgent(Subject subject, String agentName, int agentId);
+ void backfillAgentInNewTransaction(Subject subject, String agentName, int agentId);
/**
* Persists a new agent.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
index d92cbc4..2946d40 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
@@ -749,7 +749,6 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
}
@SuppressWarnings("unchecked")
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void updateAgentResourceAvailabilities(int agentId, AvailabilityType platformAvailType,
AvailabilityType childAvailType) {
commit c516ad09fcebcedfd1a505d6bfd434997ac6642d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Feb 12 12:20:13 2013 -0500
Simplify availability logic by removing the legacy assumption that an availability
check may not report avail changes to the server. Previously the caller of the avail
check could optionally send the report. Now avail checks will always forward the
resulting report to the server (although empty reports will not actually be sent).
The legacy behavior was likely due to the old always-perform-a-full-scan approach.
The new behavior gives us a scalability enhancement. We no longer have to
follow up on-demand avail checks (like the 'avail' prompt command or agent operation)
with full reports, which can be costly for agents with large inventory.
- fix up relevant jdoc and inline comments
- remove the special case code handling the legacy assumption
- always pass off the resulting report to InventoryManager.handleReport()
- remove the unnecessary performAvailabilityChecks() method, with the short
avail check intervals it can just be replaced with a request for a full report
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java
index 1e2ee9f..6747645 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java
@@ -80,7 +80,6 @@ public interface DiscoveryServerService {
* in sync. <code>true</code> should always be returned if the given availability report is already a full
* report.
*/
- // GH: Disabled temporarily (JBNADM-2385) @Asynchronous( guaranteedDelivery = true )
@LimitedConcurrency(CONCURRENCY_LIMIT_AVAILABILITY_REPORT)
boolean mergeAvailabilityReport(AvailabilityReport availabilityReport);
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 684db76..7231360 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
@@ -613,12 +613,25 @@ public class InventoryManager extends AgentService implements ContainerService,
inventoryThreadPoolExecutor.submit((Callable<InventoryReport>) discoveryExecutor);
}
- /** this will NOT send a availability report up to the server! */
+ /**
+ * This method implicitly calls {@link #handleReport(AvailabilityReport)} so any report generating entries
+ * *will be sent to the server*. Callers should subsequently *NOT* send the report.
+ *
+ * @param changedOnlyReport
+ * @return The report, for inspection
+ */
public AvailabilityReport executeAvailabilityScanImmediately(boolean changedOnlyReport) {
return executeAvailabilityScanImmediately(changedOnlyReport, false);
}
- /** this will NOT send a availability report up to the server! */
+ /**
+ * This method implicitly calls {@link #handleReport(AvailabilityReport)} so any report generating entries
+ * *will be sent to the server*. Callers should subsequently *NOT* send the report.
+ *
+ * @param changedOnlyReport
+ * @param forceChecks
+ * @return The report, for inspection
+ */
public AvailabilityReport executeAvailabilityScanImmediately(boolean changedOnlyReport, boolean forceChecks) {
try {
AvailabilityExecutor availExec = (forceChecks) ? new ForceAvailabilityExecutor(this)
@@ -633,19 +646,11 @@ public class InventoryManager extends AgentService implements ContainerService,
AvailabilityReport availabilityReport = availabilityThreadPoolExecutor.submit(
(Callable<AvailabilityReport>) availExec).get();
- // because the above uses the Callable interface (on purpose), the avail executor will not
- // hand the report off to the Inventory Manager for sending to the server. Because this report
- // will not be sent to the server, we need to be careful because our ResourceContainers will
- // still have their availabilities updated. This may mean a change in availability detected
- // in the above scan will not make its way to the server. To avoid the possibility of losing
- // availability status changes, we need to tell the real availability executor to send a
- // full report next time it runs its periodic scan. (RHQ-1997) So, if the report contains
- // any entries, request the full report.
- if (!(null == availabilityReport || availabilityReport.getResourceAvailability().isEmpty())) {
- this.availabilityExecutor.sendFullReportNextTime();
- }
+ // make sure the server is notified of any changes in availability
+ handleReport(availabilityReport);
return availabilityReport;
+
} catch (InterruptedException e) {
throw new RuntimeException("Availability scan execution was interrupted", e);
} catch (ExecutionException e) {
@@ -1160,10 +1165,13 @@ public class InventoryManager extends AgentService implements ContainerService,
(System.currentTimeMillis() - startTime)));
}
- // If we synced any Resources, one or more Resource components were probably started,
- // so run an avail check to report on their availabilities immediately. Also kick off
- // a service scan to scan those Resources for new child Resources. Kick both tasks off
+ // If we synced any Resources, one or more Resource components were probably started, request a
+ // full avail report to make sure their availabilities are determined on the next avail run (typically
+ // < 30s away). A full avail report will ensure an initial avail check is performed for a resource.
+ //
+ // Also kick off a service scan to scan those Resources for new child Resources. Kick both tasks off
// asynchronously.
+ //
// Do this only if we are finished with resource upgrade because no availability checks
// or discoveries can happen during upgrade. This is to ensure maximum consistency of the
// inventory with the server side as well as to disallow any other server-agent traffic during
@@ -1171,7 +1179,11 @@ public class InventoryManager extends AgentService implements ContainerService,
// time the upgrade kicks in..
if (!isResourceUpgradeActive()
&& (!syncedResources.isEmpty() || !unknownResourceSyncInfos.isEmpty() || !modifiedResourceIds.isEmpty())) {
- performAvailabilityChecks(true);
+
+ // TODO: If someday this is undesirable for scalability reasons, we could probably instead call
+ // requestAvailabilityCheck on each unknown or modified resource.
+ requestFullAvailabilityReport();
+
this.inventoryThreadPoolExecutor.schedule((Callable<? extends Object>) this.serviceScanExecutor,
configuration.getChildResourceDiscoveryDelay(), TimeUnit.SECONDS);
}
@@ -2382,24 +2394,6 @@ public class InventoryManager extends AgentService implements ContainerService,
return mgr;
}
- /**
- * Calling this method will immediately perform an availability check on all inventories resources. The availability
- * checks will be made asynchronously; this method will not block.
- *
- * @param sendFullReport if <code>true</code>, the availability report that is sent will contain availability
- * records for all resources; if <code>false</code> the report will only contain records for
- * those resources whose availability changed from their last known state.
- */
- private void performAvailabilityChecks(boolean sendFullReport) {
- if (sendFullReport) {
- availabilityExecutor.sendFullReportNextTime();
- }
-
- if (!availabilityThreadPoolExecutor.isShutdown()) {
- availabilityThreadPoolExecutor.schedule((Runnable) availabilityExecutor, 0, TimeUnit.MILLISECONDS);
- }
- }
-
public void requestFullAvailabilityReport() {
if (null != availabilityExecutor) {
availabilityExecutor.sendFullReportNextTime();
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentManagement.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentManagement.java
index 1a51f43..0bce074 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentManagement.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentManagement.java
@@ -249,14 +249,10 @@ public class AgentManagement implements AgentManagementMBean, MBeanRegistration
AvailabilityReport report;
InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
- // ask for the report and tell the inventory manager to handle it. We must hand it off to IM
- // because we need to send the report to the server - otherwise, the "real" availability executor
- // will not send changed resources thinking someone else did.
ClassLoader originalCL = Thread.currentThread().getContextClassLoader();
try {
Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader());
report = inventoryManager.executeAvailabilityScanImmediately(changes);
- inventoryManager.handleReport(report);
} finally {
Thread.currentThread().setContextClassLoader(originalCL);
}
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java
index c9b7fc7..0247389 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java
@@ -181,10 +181,7 @@ public class AvailabilityPromptCommand implements AgentPromptCommand {
}
}
- // we need to send the report to the server - otherwise, the "real" availability executor
- // will not send changed resources thinking someone else did
- out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_SENDING));
- inventoryManager.handleReport(report);
+ // out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_SENDING));
out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_SENT));
return;
commit c7199465b2ab8bf9cd253fdffcc278577d557a7a
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Feb 12 17:06:56 2013 +0100
[BZ 902823 - Nonsense data returned as backing content of non-content-backed resources] Instead of throwing the exception, the null is returned. Now it's in compliance w/ the the method's jdoc.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index e329d46..319319f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -1614,11 +1614,11 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe
public InstalledPackage getBackingPackageForResource(Subject subject, int resourceId) {
InstalledPackage result = null;
- // check if the resource is content backed
+ // check if the resource is content backed if not, return null
Resource res = resourceManager.getResourceById(subject, resourceId);
ResourceType type = res.getResourceType();
if (!ResourceCreationDataType.CONTENT.equals(type.getCreationDataType())) {
- throw new UnsupportedOperationException("Resource [" + resourceId + "] is not content backed.");
+ return null;
}
InstalledPackageCriteria criteria = new InstalledPackageCriteria();
commit da8012a65541b86ba02ed2405b983f9b6cd0cb3f
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Feb 12 16:58:31 2013 +0100
[BZ 893802 [as7] Restart operation fails to start AS when shutdown hasn't completed when start script is invoked] I have added NPE check, because I got NPE in certain circumstances.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
index 5e3373b..dcf21d3 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
@@ -279,7 +279,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
if (hostPort.isLocal) {
// lets be paranoid here
- while (context.getNativeProcess() != null && context.getNativeProcess().priorSnaphot().isRunning()
+ while (context.getNativeProcess() != null && context.getNativeProcess().priorSnaphot() != null
+ && context.getNativeProcess().priorSnaphot().isRunning()
&& count++ <= 20) {
try {
Thread.sleep(1000); // Wait 1s
commit bc2c090dd5f6d6a114b7d8450580d039504e7ca0
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Feb 12 10:29:18 2013 +0100
Disable JMXPluginTest (Sigar getProcCredName issue)
diff --git a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
index ee172ba..b841a38 100644
--- a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
+++ b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
@@ -39,22 +39,20 @@ import java.util.HashSet;
import java.util.List;
import java.util.Set;
-import org.rhq.core.domain.configuration.Configuration;
-import org.rhq.core.domain.resource.ResourceCategory;
-import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.plugins.jmx.JMXDiscoveryComponent;
-import org.rhq.plugins.jmx.util.JvmResourceKey;
import org.testng.annotations.AfterSuite;
import org.testng.annotations.BeforeSuite;
import org.testng.annotations.Test;
import org.rhq.core.clientapi.server.discovery.InventoryReport;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.resource.ResourceCategory;
+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.InventoryManager;
@@ -65,6 +63,8 @@ import org.rhq.core.pc.util.InventoryPrinter;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
import org.rhq.core.pluginapi.operation.OperationFacet;
+import org.rhq.plugins.jmx.JMXDiscoveryComponent;
+import org.rhq.plugins.jmx.util.JvmResourceKey;
/**
* Integration test for the JMX plugin.
@@ -72,6 +72,8 @@ import org.rhq.core.pluginapi.operation.OperationFacet;
* @author Greg Hinkle
* @author Ian Springer
*/
+// Disabled until we find a fix for Sigar getProcCredName issue
+@Test(enabled = false)
public class JMXPluginTest {
private static final int JMX_REMOTING_PORT1 = 9921;
@@ -85,7 +87,7 @@ public class JMXPluginTest {
private List<Process> testServerJvms = new ArrayList<Process>();
private InventoryManager inventoryManager;
-
+
@BeforeSuite
public void start() {
try {
commit 8fd2a8c339f4ee9428a8af49015c447edf0ccaac
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Feb 11 16:23:03 2013 -0600
Move few more test-jar dependencies to the test specific profile.
diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml
index 3c50a21..e6daa0f 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -33,14 +33,6 @@
<version>${project.version}</version>
<scope>runtime</scope>
</dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -185,6 +177,32 @@
<profiles>
+ <profile>
+ <!--
+ This profile has been created to avoid unnecessary resolution of test dependencies during a build that
+ does not run, compile or need tests.
+ More test dependencies are to be moved here if the set of sub-dependencies is complex, references project
+ test jars, or conflicts with changing the container version.
+ -->
+ <id>test.dependencies</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
<!-- NOTE: this profile HAS TO have the same activation policy as the profile with the same name in the root pom.xml of RHQ -->
<profile>
<id>bundle-additional-script-languages</id>
diff --git a/modules/integration-tests/apache-plugin-test/pom.xml b/modules/integration-tests/apache-plugin-test/pom.xml
index 4411185..e161160 100644
--- a/modules/integration-tests/apache-plugin-test/pom.xml
+++ b/modules/integration-tests/apache-plugin-test/pom.xml
@@ -52,15 +52,6 @@
<version>${project.version}</version>
<scope>test</scope>
</dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-plugin-container</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
<!-- The expected layout of the httpd zip is:
httpd-${httpd.version}-${system.type}-${system.architecture}.zip
@@ -120,6 +111,35 @@
</dependency>
</dependencies>
+
+ <profiles>
+ <profile>
+ <!--
+ This profile has been created to avoid unnecessary resolution of test dependencies during a build that
+ does not run, compile or need tests.
+ More test dependencies are to be moved here if the set of sub-dependencies is complex, references project
+ test jars, or conflicts with changing the container version.
+ -->
+ <id>test.dependencies</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-plugin-container</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+ </profiles>
+
<build>
<plugins>
<!-- Integration testing voodoo to load and test this plugin
diff --git a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
index b619cb2..74e563c 100644
--- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
+++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
@@ -79,20 +79,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-server-itests-2</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-arquillian-suite-extension</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
-
<!-- Arquillian -->
<dependency>
<groupId>org.jboss.arquillian.testng</groupId>
@@ -133,6 +119,39 @@
</dependencies>
<profiles>
+
+ <profile>
+ <!--
+ This profile has been created to avoid unnecessary resolution of test dependencies during a build that
+ does not run, compile or need tests.
+ More test dependencies are to be moved here if the set of sub-dependencies is complex, references project
+ test jars, or conflicts with changing the container version.
+ -->
+ <id>test.dependencies</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-server-itests-2</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-arquillian-suite-extension</artifactId>
+ </exclusion>
+ </exclusions>
+ </dependency>
+ </dependencies>
+ </profile>
+
<profile>
<id>managed-test-server</id>
<activation>
commit 025f3d793338ef9dde0de59b4338a281d419f0ca
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Feb 11 15:41:19 2013 -0600
Move more dependencies to special test profile to avoid resolution if tests are disabled.
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml
index e0e88af..08cfdd4 100644
--- a/modules/enterprise/binding/pom.xml
+++ b/modules/enterprise/binding/pom.xml
@@ -59,14 +59,6 @@
<dependency>
<groupId>${project.groupId}</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
<artifactId>rhq-enterprise-server</artifactId>
<version>${project.version}</version>
<type>ejb-client</type>
@@ -253,6 +245,32 @@
<profiles>
+ <profile>
+ <!--
+ This profile has been created to avoid unnecessary resolution of test dependencies during a build that
+ does not run, compile or need tests.
+ More test dependencies are to be moved here if the set of sub-dependencies is complex, references project
+ test jars, or conflicts with changing the container version.
+ -->
+ <id>test.dependencies</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
<profile>
<id>dev</id>
@@ -357,10 +375,10 @@
</build>
</profile>
-
- <!-- Profile activated explicitly by command line call, or brew property. -->
- <profile>
- <id>disable-tags</id>
+
+ <!-- Profile activated explicitly by command line call, or brew property. -->
+ <profile>
+ <id>disable-tags</id>
<activation>
<property>
<name>brew</name>
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml
index 5c0da0d..d5daa17 100644
--- a/modules/enterprise/server/itests-2/pom.xml
+++ b/modules/enterprise/server/itests-2/pom.xml
@@ -54,13 +54,6 @@
</dependency>
<dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-arquillian-container-managed</artifactId>
- <version>${jboss.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>org.jboss.arquillian.testng</groupId>
<artifactId>arquillian-testng-container</artifactId>
<scope>test</scope>
@@ -95,14 +88,6 @@
<dependency>
<groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server</artifactId>
<version>${project.version}</version>
<scope>test</scope>
@@ -130,14 +115,6 @@
</dependency>
<dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-core-client-api</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>org.rhq</groupId>
<artifactId>test-utils</artifactId>
<version>${project.version}</version>
@@ -691,6 +668,48 @@
</build>
<profiles>
+
+ <profile>
+ <!--
+ This profile has been created to avoid unnecessary resolution of test dependencies during a build that
+ does not run, compile or need tests.
+ More test dependencies are to be moved here if the set of sub-dependencies is complex, references project
+ test jars, or conflicts with changing the container version.
+ -->
+ <id>test.dependencies</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-client-api</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <version>${jboss.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
<!-- If testing against oracle, override the default property settings -->
<profile>
<id>itest.oracle</id>
commit 65536a1e114e28b768f142f5ef3a80ecb1a64609
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Feb 11 12:24:33 2013 -0500
Add Criteria.getSingleResult() convenience method.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index 40a2092..afcff6f 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@ -274,4 +274,28 @@ public abstract class Criteria implements Serializable, BaseCriteria {
}
return this.alias;
}
+
+ /**
+ * Somewhat analogous to JPA's Query.getSingleResult. Wrap a CriteriaQuery result with this method when
+ * expecting a single result from the fetch. If the result set has only one entry it is returned. Otherwise
+ * a RuntimeException is thrown, indicating whether no results, or multiple results were found.
+ *
+ * @param result
+ * @return
+ * @throws RuntimeException In not exactly one result is found. The message will include either the String
+ * "NoResultException" or "NonUniqueResultException", appropriately. The JPA exceptions are not used so that there
+ * is no dependency on a JPA implementation jar for the caller.
+ */
+ public static <T> T getSingleResult(List<T> result) throws RuntimeException {
+ if (null == result || result.isEmpty()) {
+ throw new RuntimeException("NoResultException: Expected exactly one result but no result was found.");
+ }
+
+ if (1 != result.size()) {
+ throw new RuntimeException(
+ "NonUniqueResultException: Expected exactly one result but found multiple results: " + result);
+ }
+
+ return result.get(0);
+ }
}
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
index cdccd6c..ddf29b6 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
@@ -87,8 +87,8 @@ public class CriteriaQueryTest {
FakeEntityCriteria criteria = new FakeEntityCriteria();
- CriteriaQuery<FakeEntity, FakeEntityCriteria> query =
- new CriteriaQuery<FakeEntity, FakeEntityCriteria>(criteria, queryExecutor);
+ CriteriaQuery<FakeEntity, FakeEntityCriteria> query = new CriteriaQuery<FakeEntity, FakeEntityCriteria>(
+ criteria, queryExecutor);
List<FakeEntity> actual = new ArrayList<FakeEntity>();
for (FakeEntity entity : query) {
@@ -111,8 +111,8 @@ public class CriteriaQueryTest {
FakeEntityCriteria criteria = new FakeEntityCriteria();
criteria.setPageControl(pc);
- CriteriaQuery<FakeEntity, FakeEntityCriteria> query =
- new CriteriaQuery<FakeEntity, FakeEntityCriteria>(criteria, queryExecutor);
+ CriteriaQuery<FakeEntity, FakeEntityCriteria> query = new CriteriaQuery<FakeEntity, FakeEntityCriteria>(
+ criteria, queryExecutor);
List<FakeEntity> actual = new ArrayList<FakeEntity>();
for (FakeEntity entity : query) {
@@ -122,4 +122,48 @@ public class CriteriaQueryTest {
assertEquals(actual, expected);
}
+ @Test
+ public void singleResultTest() {
+ // This test doesn't really fit here but I;m adding it for convenience
+ List<FakeEntity> result = null;
+
+ try {
+ FakeEntityCriteria.getSingleResult(result);
+ assert false : "Should have thrown Runtime Exception";
+
+ } catch (RuntimeException e) {
+ assert e.getMessage().contains("NoResultException");
+ }
+
+ result = new ArrayList<FakeEntity>(2);
+
+ try {
+ FakeEntityCriteria.getSingleResult(result);
+ assert false : "Should have thrown Runtime Exception";
+
+ } catch (RuntimeException e) {
+ assert e.getMessage().contains("NoResultException");
+ }
+
+ result.add(new FakeEntity(1));
+
+ try {
+ FakeEntity r = FakeEntityCriteria.getSingleResult(result);
+ assert r.getId() == 1 : "Should have retuned expected entity but returned: " + r;
+
+ } catch (Throwable t) {
+ assert false : "Should have returned single result";
+ }
+
+ result.add(new FakeEntity(2));
+
+ try {
+ FakeEntityCriteria.getSingleResult(result);
+ assert false : "Should have thrown Runtime Exception";
+
+ } catch (RuntimeException e) {
+ assert e.getMessage().contains("NonUniqueResultException");
+ }
+ }
+
}
commit f59ff0205726f31fcf08911d3f4acf1661e2638a
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Feb 11 08:29:18 2013 -0600
Move test jar dependency to test specific profile.
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index 88a6e82..2eb3668 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -138,16 +138,7 @@
</exclusions>
</dependency>
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
-
- <!-- 3rd Party Deps -->
+ <!-- 3rd Party Deps -->
<!-- do we really need this version, for now use the version provided by AS7, declare just below -->
<dependency>
@@ -647,6 +638,32 @@
<profiles>
<profile>
+ <!--
+ This profile has been created to avoid unnecessary resolution of test dependencies during a build that
+ does not run, compile or need tests.
+ More test dependencies are to be moved here if the set of sub-dependencies is complex, references project
+ test jars, or conflicts with changing the container version.
+ -->
+ <id>test.dependencies</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
<!-- only if we are not running an individual set of tests via -Dtest do we do this -->
<id>no-individual-test</id>
<activation>
commit 69c6ff1dea4473aef4d281137cc888ae0704c2b0
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 8 21:52:50 2013 -0500
Scalability work to chunk processing of availability reports. Start outside
of a transaction and execute one transaction per chunk.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
index 31f1040..d92cbc4 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
@@ -28,7 +28,6 @@ import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.persistence.EntityManager;
-import javax.persistence.FlushModeType;
import javax.persistence.NoResultException;
import javax.persistence.NonUniqueResultException;
import javax.persistence.PersistenceContext;
@@ -78,6 +77,19 @@ import org.rhq.enterprise.server.util.CriteriaQueryRunner;
public class AvailabilityManagerBean implements AvailabilityManagerLocal, AvailabilityManagerRemote {
private final Log log = LogFactory.getLog(AvailabilityManagerBean.class);
+ static private final int MERGE_BATCH_SIZE;
+
+ static {
+
+ int mergeBatchSize = 200;
+ try {
+ mergeBatchSize = Integer.parseInt(System.getProperty("rhq.server.availability.merge.batch.size", "200"));
+ } catch (Throwable t) {
+ //
+ }
+ MERGE_BATCH_SIZE = mergeBatchSize;
+ }
+
@PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
private EntityManager entityManager;
@@ -449,6 +461,7 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
}
@SuppressWarnings("unchecked")
+ @TransactionAttribute(TransactionAttributeType.NEVER)
public boolean mergeAvailabilityReport(AvailabilityReport report) {
int reportSize = report.getResourceAvailability().size();
String agentName = report.getAgentName();
@@ -472,158 +485,220 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
.getAvailabilityType()));
}
- // We will alert only on the avails for enabled resources. Keep track of any that are disabled.
- List<Availability> disabledAvailabilities = new ArrayList<Availability>();
-
- boolean askForFullReport = false;
Integer agentToUpdate = agentManager.getAgentIdByName(agentName);
- // if this report is from an agent update the lastAvailreport time
+ // if this report is from an agent update the lastAvailReport time
if (!report.isEnablementReport() && agentToUpdate != null) {
- // do this now, before we might clear() the entity manager
- availabilityManager.updateLastAvailabilityReport(agentToUpdate.intValue());
+ availabilityManager.updateLastAvailabilityReportInNewTransaction(agentToUpdate.intValue());
}
- int numInserted = 0;
+ MergeInfo mergeInfo = new MergeInfo(report);
// if this report is from an agent, and is a changes-only report, and the agent appears backfilled,
- // then we need to skip this report so as not to waste our time> Then, immediately request and process
+ // then we need to skip this report so as not to waste our time. Then, immediately request and process
// a full report because, obviously, the agent is no longer down but the server thinks
// it still is down - we need to know the availabilities for all the resources on that agent
if (!report.isEnablementReport() && report.isChangesOnlyReport()
&& agentManager.isAgentBackfilled(agentToUpdate.intValue())) {
- askForFullReport = true;
+
+ mergeInfo.setAskForFullReport(true);
} else {
- Query q = entityManager.createNamedQuery(Availability.FIND_CURRENT_BY_RESOURCE);
- q.setFlushMode(FlushModeType.COMMIT);
+ // process the report in batches to avoid an overly long transaction and to potentially increase the
+ // speed in which an avail change becomes visible.
+
+ while (!availabilities.isEmpty()) {
+ int size = availabilities.size();
+ int end = (MERGE_BATCH_SIZE < size) ? MERGE_BATCH_SIZE : size;
- int count = 0;
- for (Availability reported : availabilities) {
- if ((++count % 100) == 0) {
- entityManager.flush();
- entityManager.clear();
+ List<Availability> availBatch = availabilities.subList(0, end);
+ availabilityManager.mergeAvailabilitiesInNewTransaction(availBatch, mergeInfo);
+
+ // Advance our progress and possibly help GC. This will remove the processed avails from the backing list
+ availBatch.clear();
+ }
+
+ MeasurementMonitor.getMBean().incrementAvailabilityReports(report.isChangesOnlyReport());
+ MeasurementMonitor.getMBean().incrementAvailabilitiesInserted(mergeInfo.getNumInserted());
+ MeasurementMonitor.getMBean().incrementAvailabilityInsertTime(watch.getElapsed());
+ watch.reset();
+ }
+
+ if (!report.isEnablementReport()) {
+ if (agentToUpdate != null) {
+ // don't bother asking for a full report if the one we are currently processing is already full
+ if (mergeInfo.isAskForFullReport() && report.isChangesOnlyReport()) {
+ log.debug("The server is unsure that it has up-to-date availabilities for agent [" + agentName
+ + "]; asking for a full report to be sent");
+ return false;
}
+ } else {
+ log.error("Could not figure out which agent sent availability report. "
+ + "This error is harmless and should stop appearing after a short while if the platform of the agent ["
+ + agentName + "] was recently removed. In any other case this is a bug." + report);
+ }
+ }
- // availability reports only tell us the current state at the start time; end time is ignored/must be null
- reported.setEndTime(null);
-
- try {
- q.setParameter("resourceId", reported.getResource().getId());
- Availability latest = (Availability) q.getSingleResult();
- AvailabilityType latestType = latest.getAvailabilityType();
- AvailabilityType reportedType = reported.getAvailabilityType();
-
- // If the current avail is DISABLED, and this report is not trying to re-enable the resource,
- // Then ignore the reported avail.
- if (AvailabilityType.DISABLED == latestType) {
- if (!(report.isEnablementReport() && (AvailabilityType.UNKNOWN == reportedType))) {
- disabledAvailabilities.add(reported);
- continue;
- }
- }
+ return true; // everything is OK and things look to be in sync
+ }
- if (reported.getStartTime() >= latest.getStartTime()) {
- //log.info( "new avail (latest/reported)-->" + latest + "/" + reported );
+ static class MergeInfo {
+ private AvailabilityReport report;
+ private int numInserted = 0;
+ private boolean askForFullReport = false;
- // the new availability data is for a time after our last known state change
- // we are runlength encoded, so only persist data if the availability changed
- if (latest.getAvailabilityType() != reported.getAvailabilityType()) {
- entityManager.persist(reported);
- numInserted++;
+ public MergeInfo(AvailabilityReport report) {
+ super();
+ this.report = report;
+ }
- latest.setEndTime(reported.getStartTime());
- latest = entityManager.merge(latest);
+ public int getNumInserted() {
+ return numInserted;
+ }
- updateResourceAvailability(reported);
- }
+ public void incrementNumInserted() {
+ ++this.numInserted;
+ }
- // our last known state was unknown, ask for a full report to ensure we are in sync with agent
- if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) {
- askForFullReport = true;
- }
- } else {
- //log.info( "past avail (latest/reported)==>" + latest + "/" + reported );
+ public boolean isAskForFullReport() {
+ return askForFullReport;
+ }
- // The new data is for a time in the past, probably an agent sending a report after
- // a network outage has been corrected but after we have already backfilled.
- // We need to insert it into our past timeline.
- insertAvailability(reported);
- numInserted++;
+ public void setAskForFullReport(boolean askForFullReport) {
+ this.askForFullReport = askForFullReport;
+ }
- // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent
- askForFullReport = true;
+ public boolean isEnablementReport() {
+ return report.isEnablementReport();
+ }
+
+ public String toString(boolean includeAll) {
+ return report.toString(includeAll);
+ }
+ }
+
+ @Override
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public void mergeAvailabilitiesInNewTransaction(List<Availability> availabilities, MergeInfo mergeInfo) {
+
+ // We will alert only on the avails for enabled resources. Keep track of any that are disabled.
+ List<Availability> disabledAvailabilities = new ArrayList<Availability>();
+ Query q = entityManager.createNamedQuery(Availability.FIND_CURRENT_BY_RESOURCE);
+ int count = 0;
+
+ for (Availability reported : availabilities) {
+
+ // availability reports only tell us the current state at the start time; end time is ignored/must be null
+ reported.setEndTime(null);
+
+ try {
+ q.setParameter("resourceId", reported.getResource().getId());
+ Availability latest = (Availability) q.getSingleResult();
+ AvailabilityType latestType = latest.getAvailabilityType();
+ AvailabilityType reportedType = reported.getAvailabilityType();
+
+ // If the current avail is DISABLED, and this report is not trying to re-enable the resource,
+ // Then ignore the reported avail.
+ if (AvailabilityType.DISABLED == latestType) {
+ if (!(mergeInfo.isEnablementReport() && (AvailabilityType.UNKNOWN == reportedType))) {
+ disabledAvailabilities.add(reported);
+ continue;
}
- } catch (NoResultException nre) {
- // This should not happen unless the Resource in the report is stale, which can happen in certain
- // sync scenarios. A Resource is given its initial Availability/ResourceAvailability when it is
- // persisted so it is guaranteed to have Availability, so, the Resource must not exist. At least
- // it must not exist in my utopian view of the world. Let's just make sure...
- Resource attachedResource = (Resource) entityManager.find(Resource.class, reported.getResource()
- .getId());
- if (null == attachedResource) {
- // expected case
- log.info("Skipping mergeAvailabilityReport() for stale resource [" + reported.getResource()
- + "]. These messages should go away after the next agent synchronization with the server.");
-
- } else if (InventoryStatus.COMMITTED == attachedResource.getInventoryStatus()) {
- // this should not happen, it means the resource exists but has no latest Availability
- // record (i.e. sendTime == null). Try to correct the situation.
- log.warn("Resource [" + reported.getResource()
- + "] has no latest availability record (i.e. no endtime) - will attempt to repair.\n"
- + report.toString(false));
- try {
- List<Availability> attachedAvails = attachedResource.getAvailability();
- if (attachedAvails.isEmpty()) {
- attachedResource.initCurrentAvailability();
- entityManager.merge(attachedResource);
-
- } else {
- Availability attachedLastAvail = attachedAvails.get(attachedAvails.size() - 1);
- attachedLastAvail.setEndTime(null);
- entityManager.merge(attachedLastAvail);
- }
-
- // ask the agent for a full report so as to ensure we are in sync with agent
- askForFullReport = true;
-
- } catch (Throwable t) {
- log.warn("Unable to repair latest availablity for Resource [" + reported.getResource()
- + "]", t);
- }
+ }
+
+ if (reported.getStartTime() >= latest.getStartTime()) {
+ //log.info( "new avail (latest/reported)-->" + latest + "/" + reported );
+
+ // the new availability data is for a time after our last known state change
+ // we are run-length encoded, so only persist data if the availability changed
+ if (latest.getAvailabilityType() != reported.getAvailabilityType()) {
+ entityManager.persist(reported);
+ mergeInfo.incrementNumInserted();
+
+ latest.setEndTime(reported.getStartTime());
+ latest = entityManager.merge(latest);
+
+ updateResourceAvailability(reported);
}
- } catch (NonUniqueResultException nure) {
- // This condition should never happen. In my world of la-la land, I've done everything
- // correctly so this never happens. But, due to the asynchronous nature of things,
- // I have to believe that this still might happen (albeit rarely). If it does happen,
- // and we do nothing about it - bad things arise. So, if we find that a resource
- // has 2 or more availabilities with endTime of null, we need to delete all but the
- // latest one (the one whose start time is the latest). This should correct the
- // problem and allow us to continue processing availability reports for that resource
+ // our last known state was unknown, ask for a full report to ensure we are in sync with agent
+ if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) {
+ mergeInfo.setAskForFullReport(true);
+ }
+ } else {
+ //log.info( "past avail (latest/reported)==>" + latest + "/" + reported );
+
+ // The new data is for a time in the past, probably an agent sending a report after
+ // a network outage has been corrected but after we have already backfilled.
+ // We need to insert it into our past timeline.
+ insertAvailability(reported);
+ mergeInfo.incrementNumInserted();
+
+ // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent
+ mergeInfo.setAskForFullReport(true);
+ }
+ } catch (NoResultException nre) {
+ // This should not happen unless the Resource in the report is stale, which can happen in certain
+ // sync scenarios. A Resource is given its initial Availability/ResourceAvailability when it is
+ // persisted so it is guaranteed to have Availability, so, the Resource must not exist. At least
+ // it must not exist in my utopian view of the world. Let's just make sure...
+ Resource attachedResource = (Resource) entityManager.find(Resource.class, reported.getResource()
+ .getId());
+ if (null == attachedResource) {
+ // expected case
+ log.info("Skipping mergeAvailabilityReport() for stale resource [" + reported.getResource()
+ + "]. These messages should go away after the next agent synchronization with the server.");
+
+ } else if (InventoryStatus.COMMITTED == attachedResource.getInventoryStatus()) {
+ // this should not happen, it means the resource exists but has no latest Availability
+ // record (i.e. sendTime == null). Try to correct the situation.
log.warn("Resource [" + reported.getResource()
- + "] has multiple availabilities without an endtime [" + nure.getMessage()
- + "] - will attempt to remove the extra ones\n" + report.toString(false));
+ + "] has no latest availability record (i.e. no endtime) - will attempt to repair.\n"
+ + mergeInfo.toString(false));
+ try {
+ List<Availability> attachedAvails = attachedResource.getAvailability();
+ if (attachedAvails.isEmpty()) {
+ attachedResource.initCurrentAvailability();
+ entityManager.merge(attachedResource);
+
+ } else {
+ Availability attachedLastAvail = attachedAvails.get(attachedAvails.size() - 1);
+ attachedLastAvail.setEndTime(null);
+ entityManager.merge(attachedLastAvail);
+ }
- q.setParameter("resourceId", reported.getResource().getId());
- List<Availability> latest = q.getResultList();
+ // ask the agent for a full report so as to ensure we are in sync with agent
+ mergeInfo.setAskForFullReport(true);
- // delete all but the last one (our query sorts in ASC start time order)
- int latestCount = latest.size();
- for (int i = 0; i < (latestCount - 1); i++) {
- entityManager.remove(latest.get(i));
+ } catch (Throwable t) {
+ log.warn("Unable to repair latest availablity for Resource [" + reported.getResource() + "]", t);
}
- updateResourceAvailability(latest.get(latestCount - 1));
+ }
- // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent
- askForFullReport = true;
+ } catch (NonUniqueResultException nure) {
+ // This condition should never happen. In my world of la-la land, I've done everything
+ // correctly so this never happens. But, due to the asynchronous nature of things,
+ // I have to believe that this still might happen (albeit rarely). If it does happen,
+ // and we do nothing about it - bad things arise. So, if we find that a resource
+ // has 2 or more availabilities with endTime of null, we need to delete all but the
+ // latest one (the one whose start time is the latest). This should correct the
+ // problem and allow us to continue processing availability reports for that resource
+ log.warn("Resource [" + reported.getResource() + "] has multiple availabilities without an endtime ["
+ + nure.getMessage() + "] - will attempt to remove the extra ones\n" + mergeInfo.toString(false));
+
+ q.setParameter("resourceId", reported.getResource().getId());
+ List<Availability> latest = q.getResultList();
+
+ // delete all but the last one (our query sorts in ASC start time order)
+ int latestCount = latest.size();
+ for (int i = 0; i < (latestCount - 1); i++) {
+ entityManager.remove(latest.get(i));
}
- }
+ updateResourceAvailability(latest.get(latestCount - 1));
- MeasurementMonitor.getMBean().incrementAvailabilityReports(report.isChangesOnlyReport());
- MeasurementMonitor.getMBean().incrementAvailabilitiesInserted(numInserted);
- MeasurementMonitor.getMBean().incrementAvailabilityInsertTime(watch.getElapsed());
- watch.reset();
+ // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent
+ mergeInfo.setAskForFullReport(true);
+ }
}
// notify alert condition cache manager for all reported avails for for enabled resources
@@ -631,23 +706,7 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
notifyAlertConditionCacheManager("mergeAvailabilityReport",
availabilities.toArray(new Availability[availabilities.size()]));
- if (!report.isEnablementReport()) {
- // a single report comes from a single agent - update the agent's last availability report timestamp
- if (agentToUpdate != null) {
- // don't bother asking for a full report if the one we are currently processing is already full
- if (askForFullReport && report.isChangesOnlyReport()) {
- log.debug("The server is unsure that it has up-to-date availabilities for agent [" + agentName
- + "]; asking for a full report to be sent");
- return false;
- }
- } else {
- log.error("Could not figure out which agent sent availability report. "
- + "This error is harmless and should stop appearing after a short while if the platform of the agent ["
- + agentName + "] was recently removed. In any other case this is a bug." + report);
- }
- }
-
- return true; // everything is OK and things look to be in sync
+ return;
}
private void updateResourceAvailability(Availability reported) {
@@ -670,7 +729,7 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
}
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
- public void updateLastAvailabilityReport(int agentId) {
+ public void updateLastAvailabilityReportInNewTransaction(int agentId) {
// should we catch exceptions here, or allow them to bubble up and be caught?
/*
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java
index 5d9a5fd..ed15c17 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java
@@ -27,6 +27,7 @@ import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.discovery.AvailabilityReport;
import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.enterprise.server.measurement.AvailabilityManagerBean.MergeInfo;
/**
* Manager that is used to determine a resource's availability over a span of time.
@@ -125,12 +126,19 @@ public interface AvailabilityManagerLocal extends AvailabilityManagerRemote {
boolean mergeAvailabilityReport(AvailabilityReport report);
/**
+ * Internal use only. Used only for transactional processing purposes.
+ * @param availabilities
+ * @param mergeInfo
+ */
+ void mergeAvailabilitiesInNewTransaction(List<Availability> availabilities, MergeInfo mergeInfo);
+
+ /**
* Executing this method will update the given agent's lastAvailabilityReport time
* in a new transaction
*
* @param agentId the id of the agent
*/
- void updateLastAvailabilityReport(int agentId);
+ void updateLastAvailabilityReportInNewTransaction(int agentId);
/**
* Update availabilities for all resources managed by the given agent to the given availability type (which may be
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 0a87342..384a432 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -2664,12 +2664,39 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
@Override
+ @TransactionAttribute(TransactionAttributeType.NEVER)
public List<Integer> disableResources(Subject subject, int[] resourceIds) {
+
List<Integer> disableResourceIds = new ArrayList<Integer>();
+
+ // one report for each agent, keyed by agent name
+ Map<Agent, AvailabilityReport> reports = resourceManager.getDisableResourcesReportInNewTransaction(subject,
+ resourceIds, disableResourceIds);
+
+ // Set the resources disabled via the standard mergeInventoryReport mechanism, from the server service
+ // level. We do this for a few reasons:
+ // - The server service uses locking to ensure we don't conflict with an actual report from the agent
+ // - It ensure all necessary db modifications take place, like avail history and current avail
+ // - It ensures that all ancillary avail change logic, like alerting, still happens.
+ DiscoveryServerServiceImpl service = new DiscoveryServerServiceImpl();
+ for (AvailabilityReport report : reports.values()) {
+ service.mergeAvailabilityReport(report);
+ }
+
+ return disableResourceIds;
+ }
+
+ @Override
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public Map<Agent, AvailabilityReport> getDisableResourcesReportInNewTransaction(Subject subject, int[] resourceIds,
+ List<Integer> disableResourceIds) {
+
// one report for each agent
Map<Agent, AvailabilityReport> reports = new HashMap<Agent, AvailabilityReport>();
long now = System.currentTimeMillis();
+ boolean isInventoryManager = authorizationManager.isInventoryManager(subject);
+
for (Integer resourceId : resourceIds) {
if (disableResourceIds.contains(resourceId)) {
continue;
@@ -2678,7 +2705,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// make sure the user is authorized to disable this resource (which implies you can disable all its children)
// TODO: this may require its own permission, but until someone needs it we'll piggyback on DELETE, at least
// that gives a resource-level permission option.
- if (!authorizationManager.hasResourcePermission(subject, Permission.DELETE_RESOURCE, resourceId)) {
+ if (!isInventoryManager
+ && !authorizationManager.hasResourcePermission(subject, Permission.DELETE_RESOURCE, resourceId)) {
throw new PermissionException("You do not have permission to disable resource [" + resourceId + "]");
}
@@ -2717,17 +2745,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
}
- // Set the resources disabled via the standard mergeInventoryReport mechanism, from the server service
- // level. We do this for a few reasons:
- // - The server service uses locking to ensure we don't conflict with an actual report from the agent
- // - It ensure all necessary db modifications take place, like avail history and current avail
- // - It ensures that all ancillary avail change logic, like alerting, still happens.
- DiscoveryServerServiceImpl service = new DiscoveryServerServiceImpl();
- for (AvailabilityReport report : reports.values()) {
- service.mergeAvailabilityReport(report);
- }
-
- return disableResourceIds;
+ return reports;
}
private List<Integer> getFamily(Resource resource) {
@@ -2742,12 +2760,56 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
@Override
+ @TransactionAttribute(TransactionAttributeType.NEVER)
public List<Integer> enableResources(Subject subject, int[] resourceIds) {
+
List<Integer> enableResourceIds = new ArrayList<Integer>();
+
+ // one report for each agent, keyed by agent name
+ Map<Agent, AvailabilityReport> reports = resourceManager.getEnableResourcesReportInNewTransaction(subject,
+ resourceIds, enableResourceIds);
+
+ // Set the resources disabled via the standard mergeInventoryReport mechanism, from the server service
+ // level. We do this for a few reasons:
+ // - The server service uses locking to ensure we don't conflict with an actual report from the agent
+ // - It ensure all necessary db modifications take place, like avail history and current avail
+ // - It ensures that all ancillary avail change logic, like alerting, still happens.
+ DiscoveryServerServiceImpl service = new DiscoveryServerServiceImpl();
+ for (AvailabilityReport report : reports.values()) {
+ service.mergeAvailabilityReport(report);
+ }
+
+ // On a best effort basic, ask the relevant agents that their next avail report be full, so that we get
+ // the current avail type for the newly enabled resources. If we can't contact the agent don't worry about
+ // it; if it's down we'll get a full report when it comes up.
+ // TODO: This may need to be made out of band if perf becomes an issue.
+ for (Agent agent : reports.keySet()) {
+ try {
+ AgentClient agentClient = agentManager.getAgentClient(agent);
+ agentClient.getDiscoveryAgentService().requestFullAvailabilityReport();
+ } catch (Throwable t) {
+ if (log.isDebugEnabled()) {
+ log.debug("Failed to notify Agent ["
+ + agent
+ + "] of enabled resources. The agent is likely down. This is ok, the avails will be updated when the agent is restarted or prompt command 'avail --force is executed'.");
+ }
+ }
+ }
+
+ return enableResourceIds;
+ }
+
+ @Override
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public Map<Agent, AvailabilityReport> getEnableResourcesReportInNewTransaction(Subject subject, int[] resourceIds,
+ List<Integer> enableResourceIds) {
+
// one report for each agent, keyed by agent name
Map<Agent, AvailabilityReport> reports = new HashMap<Agent, AvailabilityReport>();
long now = System.currentTimeMillis();
+ boolean isInventoryManager = authorizationManager.isInventoryManager(subject);
+
for (Integer resourceId : resourceIds) {
if (enableResourceIds.contains(resourceId)) {
continue;
@@ -2756,7 +2818,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// make sure the user is authorized to enable this resource (which implies you can enable all its children)
// TODO: this may require its own permission, but until someone needs it we'll piggyback on DELETE, at least
// that gives a resource-level permission option.
- if (!authorizationManager.hasResourcePermission(subject, Permission.DELETE_RESOURCE, resourceId)) {
+ if (!isInventoryManager
+ && !authorizationManager.hasResourcePermission(subject, Permission.DELETE_RESOURCE, resourceId)) {
throw new PermissionException("You do not have permission to enable resource [" + resourceId + "]");
}
@@ -2794,33 +2857,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
}
- // Set the resources disabled via the standard mergeInventoryReport mechanism, from the server service
- // level. We do this for a few reasons:
- // - The server service uses locking to ensure we don't conflict with an actual report from the agent
- // - It ensure all necessary db modifications take place, like avail history and current avail
- // - It ensures that all ancillary avail change logic, like alerting, still happens.
- DiscoveryServerServiceImpl service = new DiscoveryServerServiceImpl();
- for (AvailabilityReport report : reports.values()) {
- service.mergeAvailabilityReport(report);
- }
-
- // On a best effort basic, ask the relevant agents that their next avail report be full, so that we get
- // the current avail type for the newly enabled resources. If we can't contact the agent don't worry about
- // it; if it's down we'll get a full report when it comes up.
- // TODO: This may need to be made out of band if perf becomes an issue.
- for (Agent agent : reports.keySet()) {
- try {
- AgentClient agentClient = agentManager.getAgentClient(agent);
- agentClient.getDiscoveryAgentService().requestFullAvailabilityReport();
- } catch (Throwable t) {
- if (log.isDebugEnabled()) {
- log.debug("Failed to notify Agent ["
- + agent
- + "] of enabled resources. The agent is likely down. This is ok, the avails will be updated when the agent is restarted or prompt command 'avail --force is executed'.");
- }
- }
- }
-
- return enableResourceIds;
+ return reports;
}
+
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
index 80bfee7..b4c90f2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java
@@ -28,6 +28,7 @@ import org.jetbrains.annotations.Nullable;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.ResourceCriteria;
+import org.rhq.core.domain.discovery.AvailabilityReport;
import org.rhq.core.domain.measurement.ResourceAvailability;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.InventoryStatus;
@@ -206,8 +207,8 @@ public interface ResourceManagerLocal {
* @return the resource, or null if no such resource exists
*/
@Nullable
- Resource getResourceByParentAndKey(Subject user, @Nullable Resource parent, String key, String plugin,
- String typeName);
+ Resource getResourceByParentAndKey(Subject user, @Nullable
+ Resource parent, String key, String plugin, String typeName);
PageList<Resource> findResourceByParentAndInventoryStatus(Subject user, Resource parent, InventoryStatus status,
PageControl pageControl);
@@ -478,6 +479,12 @@ public interface ResourceManagerLocal {
List<Resource> findResourcesByCriteriaBounded(Subject subject, ResourceCriteria criteria, int maxResources,
int maxResourcesByType);
+ Map<Agent, AvailabilityReport> getDisableResourcesReportInNewTransaction(Subject subject, int[] resourceIds,
+ List<Integer> disableResourceIds);
+
+ Map<Agent, AvailabilityReport> getEnableResourcesReportInNewTransaction(Subject subject, int[] resourceIds,
+ List<Integer> enableResourceIds);
+
// !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
//
// The following are shared with the Remote Interface
commit e7990be973b7c3ca524a0bd41eb83e69c831344e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 8 15:13:05 2013 -0500
provide a --quiet option to avail prompt command
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
index f25f62b..57f427c 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java
@@ -2076,7 +2076,7 @@ public interface AgentI18NResourceKeys {
@I18NMessage("avail")
String AVAILABILITY = "PromptCommand.availability";
- @I18NMessage("avail [--changed] [--force] [--verbose]")
+ @I18NMessage("avail [--changed] [--force] [--verbose|--quiet]")
String AVAILABILITY_SYNTAX = "PromptCommand.availability.syntax";
@I18NMessage("Get availability of inventoried resources")
@@ -2092,7 +2092,8 @@ public interface AgentI18NResourceKeys {
+ "\\ for only those resources whose status changed.\\n\\\n"
+ "\\ -f, --force : if specified, the report will force availability\\n\\\n"
+ "\\ checks for all resources.\\n\\\n"
- + "\\ -v, --verbose : if true, additional information is displayed.")
+ + "\\ -v, --verbose : if specified, additional resource information is displayed.\\n\\\n"
+ + "\\ -q, --quiet : if specified, don't show individual resource information.")
String AVAILABILITY_DETAILED_HELP = "PromptCommand.availability.detailed-help";
@I18NMessage("The agent/plugin container must be started to get availability data.\\n\\\n"
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java
index 6dcc49d..c9b7fc7 100644
--- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java
+++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java
@@ -88,11 +88,13 @@ public class AvailabilityPromptCommand implements AgentPromptCommand {
PrintWriter out = agent.getOut();
boolean changedOnly = false;
boolean verbose = false;
+ boolean quiet = false;
boolean force = false;
- String sopts = "-cvf";
+ String sopts = "-cvqf";
LongOpt[] lopts = { new LongOpt("changed", LongOpt.NO_ARGUMENT, null, 'c'),
new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 'v'),
+ new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'),
new LongOpt("force", LongOpt.NO_ARGUMENT, null, 'f') };
Getopt getopt = new Getopt(getPromptCommandString(), args, sopts, lopts);
@@ -117,6 +119,11 @@ public class AvailabilityPromptCommand implements AgentPromptCommand {
break;
}
+ case 'q': {
+ quiet = true;
+ break;
+ }
+
case 'f': {
force = true;
break;
@@ -158,17 +165,19 @@ public class AvailabilityPromptCommand implements AgentPromptCommand {
return;
}
- for (AvailabilityReport.Datum datum : availabilities) {
- // lookup the heavy-weight resource object
- int resourceId = datum.getResourceId();
- Resource resource = inventoryManager.getResourceContainer(resourceId).getResource();
-
- if (verbose) {
- out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_RESOURCE_VERBOSE,
- datum.getAvailabilityType(), resource.getName(), resource.getId(), resource.getResourceKey()));
- } else {
- out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_RESOURCE, datum.getAvailabilityType(),
- resource.getName()));
+ if (!quiet) {
+ for (AvailabilityReport.Datum datum : availabilities) {
+ // lookup the heavy-weight resource object
+ int resourceId = datum.getResourceId();
+ Resource resource = inventoryManager.getResourceContainer(resourceId).getResource();
+
+ if (verbose) {
+ out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_RESOURCE_VERBOSE,
+ datum.getAvailabilityType(), resource.getName(), resource.getId(), resource.getResourceKey()));
+ } else {
+ out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_RESOURCE,
+ datum.getAvailabilityType(), resource.getName()));
+ }
}
}
commit 43893d0b4e4fd58e074fa8819fe69f4404aeca5d
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Feb 8 10:00:41 2013 -0600
Move test-jar dependencies to the special test profile.
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index 7d795f7..3eec8ad 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -525,10 +525,10 @@
<profiles>
<profile>
<!--
- This profile has been created to avoid unnecessary resolution of test dependencies during a build that
- does not run, compile or need tests.
- More test dependencies are to be moved here if the set of sub-dependencies is complex or conflicts
- with changing the container version.
+ This profile has been created to avoid unnecessary resolution of test dependencies during a build that
+ does not run, compile or need tests.
+ More test dependencies are to be moved here if the set of sub-dependencies is complex, references project
+ test jars, or conflicts with changing the container version.
-->
<id>test.dependencies</id>
<activation>
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index e6fbe33..73947ae 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -48,14 +48,6 @@
<dependency>
<groupId>${rhq.groupId}</groupId>
- <artifactId>rhq-core-plugin-container</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${rhq.groupId}</groupId>
<artifactId>test-utils</artifactId>
<version>${project.version}</version>
<scope>test</scope>
@@ -100,6 +92,32 @@
<profiles>
<profile>
+ <!--
+ This profile has been created to avoid unnecessary resolution of test dependencies during a build that
+ does not run, compile or need tests.
+ More test dependencies are to be moved here if the set of sub-dependencies is complex, references project
+ test jars, or conflicts with changing the container version.
+ -->
+ <id>test.dependencies</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+ <dependencies>
+ <dependency>
+ <groupId>${rhq.groupId}</groupId>
+ <artifactId>rhq-core-plugin-container</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+ </dependencies>
+ </profile>
+
+ <profile>
<id>jboss-plugins</id>
<activation>
<property>
commit 3125d4e96856d39de9b81bc52e54ef26fd25ede2
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Feb 8 16:43:20 2013 +0100
Setting auto fit for button's width when title consits from more than 15 chars
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
index ea6a2f1..6fdaf95 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java
@@ -37,6 +37,9 @@ public class LocatableIButton extends IButton implements Locatable {
private void init(String locatorId) {
this.locatorId = locatorId;
SeleniumUtility.setID(this, locatorId);
+ if (getTitle().length() > 15) {
+ setAutoFit(true);
+ }
}
public String getLocatorId() {
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
index 4c29ae3..ebb423a 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties
@@ -22,7 +22,7 @@ common_button_create_child = Create Child
common_button_delete = Delete
common_button_delete_all = Delete All
common_button_disable = Disable
-common_button_dump_sysInfo_to_log = Dump system info
+common_button_dump_sysInfo_to_log = Dump System Info
common_button_edit = Edit
common_button_enable = Enable
common_button_execute = Execute
commit 12921ea02422df0ef34b0d241828b35ec4d26a62
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Feb 8 16:12:41 2013 +0100
Improvements in the Events and Group area of the REST-api
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
index 3d7abe0..5c50907 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
@@ -46,6 +46,8 @@ import javax.ws.rs.core.Request;
import javax.ws.rs.core.Response;
import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiError;
+import com.wordnik.swagger.annotations.ApiErrors;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
@@ -86,7 +88,6 @@ public class EventHandlerBean extends AbstractRestBean {
@Path("/{id}/sources")
@ApiOperation(value = "List the defined event sources for the resource", responseClass = "EventSourceRest", multiValueResponse = true)
public Response listEventSourcesForResource(@ApiParam("id of the resource") @PathParam("id") int resourceId,
- @Context Request request,
@Context HttpHeaders headers) {
Resource res = fetchResource(resourceId);
@@ -115,8 +116,7 @@ public class EventHandlerBean extends AbstractRestBean {
@Path("/{id}/definitions")
@ApiOperation(value = "List the defined event source definitions for the resource", responseClass = "EventDefintionRest", multiValueResponse = true)
public Response listEventDefinitionsForResource(@ApiParam("id of the resource") @PathParam("id") int resourceId,
- @Context Request request,
- @Context HttpHeaders headers) {
+ @Context HttpHeaders headers) {
Resource res = fetchResource(resourceId);
ResourceType resourceType = res.getResourceType();
@@ -148,6 +148,7 @@ public class EventHandlerBean extends AbstractRestBean {
@GET
@Path("/source/{id}")
@ApiOperation(value = "Retrieve the event source with the passed id", responseClass = "EventSourceRest")
+ @ApiError(code = 404, reason = "There is no event source with the passed id")
public EventSourceRest getEventSource(@ApiParam("Id of the source to retrieve") @PathParam("id") int sourceId) {
EventSource source = findEventSourceById(sourceId);
@@ -162,6 +163,11 @@ public class EventHandlerBean extends AbstractRestBean {
"The source.name must match an existing definition fo this resource. " +
"If an event source for the definition name and resource with the same location already exists, no new source is created. " +
"NOTE: An Event source added this way will not show up in the connection properties.")
+ @ApiErrors({
+ @ApiError(code = 404, reason = "Resource with the passed id does not exist"),
+ @ApiError(code = 404, reason = "Event definition with the passed name not found"),
+ @ApiError(code = 406, reason = "Tried to create an event source on the same definition with the same location")
+ })
public EventSourceRest addEventSource(@ApiParam("id of the resource") @PathParam("id") int resourceId,
EventSourceRest esr) {
@@ -204,10 +210,12 @@ public class EventHandlerBean extends AbstractRestBean {
@ApiOperation(value = "Delete the event source with the passed id")
public Response deleteEventSource(@ApiParam("Id of the source to delete") @PathParam("id") int sourceId) {
- EventSource source = findEventSourceById(sourceId);
- em.remove(source); // We have a cascade delete on the events TODO make operation async ?
+ EventSource source = em.find(EventSource.class,sourceId);
+ if (source!=null) {
+ em.remove(source); // We have a cascade delete on the events TODO make operation async ?
+ }
- return Response.ok().build();
+ return Response.noContent().build();
}
@GET @GZIP
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
index f9143ce..7a3f8e2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
@@ -1,6 +1,6 @@
/*
* RHQ Management Platform
- * Copyright (C) 2005-2012 Red Hat, Inc.
+ * Copyright (C) 2005-2013 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -13,8 +13,8 @@
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ * along with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
package org.rhq.enterprise.server.rest;
@@ -27,6 +27,8 @@ import java.util.Set;
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
+import javax.persistence.EntityManager;
+import javax.persistence.PersistenceContext;
import javax.ws.rs.Consumes;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
@@ -54,7 +56,6 @@ import com.wordnik.swagger.annotations.ApiParam;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.resteasy.annotations.Form;
import org.jboss.resteasy.annotations.GZIP;
import org.jboss.resteasy.annotations.cache.Cache;
@@ -67,6 +68,7 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.GroupDefinition;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
@@ -90,7 +92,7 @@ import org.rhq.enterprise.server.rest.domain.ResourceWithType;
@Interceptors(SetCallerInterceptor.class)
@Path("/group")
@Api(value="Deal with groups and DynaGroups", description = "Api that deals with resource groups and group definitions")
-(a)Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML, "application/yaml"})
+(a)Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML})
public class GroupHandlerBean extends AbstractRestBean {
private final Log log = LogFactory.getLog(GroupHandlerBean.class);
@@ -104,10 +106,14 @@ public class GroupHandlerBean extends AbstractRestBean {
@EJB
GroupDefinitionManagerLocal definitionManager;
+ @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
+ EntityManager em;
+
+
@GZIP
@GET
@Path("/")
- @ApiOperation(value = "List all groups", multiValueResponse = true)
+ @ApiOperation(value = "List all groups", multiValueResponse = true, responseClass = "GroupRest")
public Response getGroups(@ApiParam("String to search in the group name") @QueryParam("q") String q,
@Context HttpHeaders headers, @Context UriInfo uriInfo) {
@@ -123,14 +129,15 @@ public class GroupHandlerBean extends AbstractRestBean {
}
MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
- Response.ResponseBuilder builder;
+ Response.ResponseBuilder builder = Response.ok();
+ builder.type(mediaType);
if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) {
- builder = Response.ok(renderTemplate("listGroup", list), mediaType);
+ builder.entity(renderTemplate("listGroup", list));
}
else {
GenericEntity<List<GroupRest>> ret = new GenericEntity<List<GroupRest>>(list) {};
- builder = Response.ok(ret);
+ builder.entity(ret);
}
return builder.build();
@@ -141,6 +148,7 @@ public class GroupHandlerBean extends AbstractRestBean {
@GET
@Path("{id}")
@ApiOperation(value = "Get the group with the passed id")
+ @ApiError(code = 404, reason = "Group with passed id not found")
public Response getGroup(@ApiParam(value = "Id of the group") @PathParam("id") int id,
@Context HttpHeaders headers,
@Context UriInfo uriInfo) {
@@ -151,13 +159,14 @@ public class GroupHandlerBean extends AbstractRestBean {
MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
- Response.ResponseBuilder builder;
+ Response.ResponseBuilder builder = Response.ok();
+ builder.type(mediaType);
if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) {
- builder = Response.ok(renderTemplate("group", groupRest), mediaType);
+ builder.entity(renderTemplate("group", groupRest));
}
else {
- builder = Response.ok(groupRest,mediaType);
+ builder.entity(groupRest);
}
return builder.build();
@@ -166,6 +175,11 @@ public class GroupHandlerBean extends AbstractRestBean {
@POST
@Path("/")
@ApiOperation(value = "Create a new group")
+ @ApiErrors({
+ @ApiError(code = 404, reason = "Resource type for provided type id does not exist"),
+ @ApiError(code = 406, reason = "No group provided"),
+ @ApiError(code = 406, reason = "Provided group has no name")
+ })
public Response createGroup(
@ApiParam(value = "A GroupRest object containing at least a name for the group") GroupRest group,
@Context HttpHeaders headers, @Context UriInfo uriInfo) {
@@ -209,6 +223,10 @@ public class GroupHandlerBean extends AbstractRestBean {
@PUT
@Path("{id}")
@ApiOperation(value = "Update the passed group. Currently only name change is supported")
+ @ApiErrors({
+ @ApiError(code = 404, reason = "Group with the passed id does not exist"),
+ @ApiError(code = 406, reason = "Updating the name failed")
+ })
public Response updateGroup(@ApiParam(value = "Id of the group to update") @PathParam("id") int id,
@ApiParam(value = "New version of the group") GroupRest in,
@Context HttpHeaders headers,
@@ -237,18 +255,19 @@ public class GroupHandlerBean extends AbstractRestBean {
try {
resourceGroupManager.deleteResourceGroup(caller,id);
removeFromCache(id,ResourceGroup.class);
- return Response.ok().build();
} catch (ResourceGroupDeleteException e) {
e.printStackTrace(); // TODO: Customise this generated block
return Response.serverError().build(); // TODO what exactly ?
}
+ return Response.noContent().build();
}
@GZIP
@GET
@Path("{id}/resources")
@Cache(isPrivate = true,maxAge = 60)
- @ApiOperation(value="Get the resources of the group", multiValueResponse = true)
+ @ApiOperation(value="Get the resources of the group", multiValueResponse = true, responseClass = "ResourceWithType")
+ @ApiError(code = 404, reason = "Group with passed id does not exist")
public Response getResources(@ApiParam("Id of the group to retrieve the resources for") @PathParam("id") int id,
@Context HttpHeaders headers,
@Context UriInfo uriInfo) {
@@ -298,15 +317,25 @@ public class GroupHandlerBean extends AbstractRestBean {
}
// TODO if comp group and no resourceTypeId set, shall we allow to have it change to a mixed group?
- resourceGroup.addExplicitResource(res);
+ resourceGroupManager.addResourcesToGroup(caller,id,new int[]{resourceId});
- return Response.ok().build(); // TODO right code?
+ resourceGroup = fetchGroup(id, false);
+ GroupRest gr = fillGroup(resourceGroup,uriInfo);
+
+ Response.ResponseBuilder builder = Response.ok(); // TODO right code?
+ builder.entity(gr);
+ builder.type(headers.getAcceptableMediaTypes().get(0));
+ return builder.build();
}
@DELETE
@Path("{id}/resource/{resourceId}")
@ApiOperation("Remove the resource with the passed id from the group")
+ @ApiErrors({
+ @ApiError(code = 404, reason = "Group with the passed id does not exist"),
+ @ApiError(code = 404, reason = "Resource with the passed id does not exist")
+ })
public Response removeResource(@ApiParam("Id of the existing group") @PathParam("id") int id,
@ApiParam("Id of the resource to remove") @PathParam("resourceId") int resourceId,
@Context HttpHeaders headers, @Context UriInfo uriInfo) {
@@ -326,6 +355,7 @@ public class GroupHandlerBean extends AbstractRestBean {
@GZIP
@Path("{id}/metricDefinitions")
@ApiOperation(value = "Get the metric definitions for the compatible group with the passed id")
+ @ApiError(code = 404, reason = "Group with the passed id does not exist")
public Response getMetricDefinitionsForGroup(@ApiParam(value = "Id of the group") @PathParam("id") int id,
@Context HttpHeaders headers,
@Context UriInfo uriInfo) {
@@ -362,7 +392,7 @@ public class GroupHandlerBean extends AbstractRestBean {
@GZIP
@GET
@Path("/definitions")
- @ApiOperation(value="List all existing GroupDefinitions",multiValueResponse = true)
+ @ApiOperation(value="List all existing GroupDefinitions",multiValueResponse = true, responseClass = "GroupDefinitionRest")
public Response getGroupDefinitions(
@ApiParam("String to search in the group definition name") @QueryParam("q") String q,
@Context HttpHeaders headers,
@@ -399,7 +429,8 @@ public class GroupHandlerBean extends AbstractRestBean {
@GET
@Path("/definition/{id}")
@Cache(isPrivate = true,maxAge = 60)
- @ApiOperation(value = "Retrieve a single GroupDefinition by id")
+ @ApiOperation(value = "Retrieve a single GroupDefinition by id", responseClass = "GroupDefinitionRest")
+ @ApiError(code = 404, reason = "Group definition with the passed id does not exist.")
public Response getGroupDefinition(
@ApiParam("The id of the definition to retrieve") @PathParam("id") int definitionId,
@Context HttpHeaders headers, @Context UriInfo uriInfo) {
@@ -465,6 +496,11 @@ public class GroupHandlerBean extends AbstractRestBean {
@Path("/definitions")
@Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
@ApiOperation("Create a new GroupDefinition. The name of the group is required in the passed definition.")
+ @ApiErrors({
+ @ApiError(code = 406, reason = "Passed group definition has no name"),
+ @ApiError(code = 409, reason = "There already exists a definition by this name"),
+ @ApiError(code = 406, reason = "Group creation failed")
+ })
public Response createGroupDefinition(GroupDefinitionRest definition,
@Context HttpHeaders headers,
@Context UriInfo uriInfo) {
@@ -519,6 +555,10 @@ public class GroupHandlerBean extends AbstractRestBean {
@Path("/definition/{id}")
@Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
@ApiOperation("Update an existing GroupDefinition or recalculate it if the query param 'recalculate' is set to true")
+ @ApiErrors({
+ @ApiError(code = 404, reason = "Group with the passed id does not exist"),
+ @ApiError(code = 406, reason = "Group membership calculation failed")
+ })
public Response updateGroupDefinition(@ApiParam("Id fo the definition to update") @PathParam("id") int definitionId,
@ApiParam("If true, trigger a re-calculation") @QueryParam( "recalculate")
@DefaultValue("false") boolean recalculate,
@@ -579,9 +619,12 @@ public class GroupHandlerBean extends AbstractRestBean {
builder = Response.ok(gdr);
} catch (GroupDefinitionNotFoundException e) {
- throw new StuffNotFoundException("Group Definition with id " + gd.getId());
+ builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR);
+ builder.entity("Group Definition with id " + gd.getId());
}
+ MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
+ builder.type(mediaType);
return builder.build();
}
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java
index 697d6f0..20caca4 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java
@@ -67,6 +67,44 @@ public class EventTest extends AbstractBase {
}
@Test
+ public void testAddEventSourceForUnknownResource() throws Exception {
+
+ EventSource es = new EventSource();
+ es.setResourceId(15);
+ es.setName("Event Log"); // Name of the event definition
+ es.setLocation("-x-test-location");
+
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .pathParam("id",15)
+ .body(es)
+ .expect()
+ .statusCode(404)
+ .when()
+ .post("/event/{id}/sources");
+ }
+
+ @Test
+ public void testAddEventSourceForUnknownDefinition() throws Exception {
+
+ EventSource es = new EventSource();
+ es.setResourceId(10001);
+ es.setName("Frobnitz"); // Name of the event definition
+ es.setLocation("-x-test-location");
+
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .pathParam("id", 10001)
+ .body(es)
+ .expect()
+ .statusCode(404)
+ .when()
+ .post("/event/{id}/sources");
+ }
+
+ @Test
public void testAddGetDeleteEventSource() throws Exception {
EventSource es = new EventSource();
@@ -130,11 +168,12 @@ public class EventTest extends AbstractBase {
given()
.pathParam("id", result.getId())
.expect()
- .statusCode(200)
+ .statusCode(204)
.when()
.delete("/event/source/{id}");
}
}
+
@Test
public void testAddGetEventOnSource() throws Exception {
@@ -215,9 +254,20 @@ public class EventTest extends AbstractBase {
given()
.pathParam("id", eventSource.getId())
.expect()
- .statusCode(200)
+ .statusCode(204)
.when()
.delete("/event/source/{id}");
}
}
+
+ @Test
+ public void testDeleteUnknownSource() throws Exception {
+ given()
+ .pathParam("id", 123)
+ .expect()
+ .statusCode(204)
+ .when()
+ .delete("/event/source/{id}");
+
+ }
}
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java
index 3023732..ce338bb 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java
@@ -26,6 +26,7 @@ import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.response.Response;
import org.apache.http.HttpStatus;
+import org.junit.Before;
import org.junit.Test;
import org.rhq.modules.integrationTests.restApi.d.Group;
@@ -34,7 +35,7 @@ import org.rhq.modules.integrationTests.restApi.d.GroupDef;
import static com.jayway.restassured.RestAssured.expect;
import static com.jayway.restassured.RestAssured.given;
import static org.hamcrest.CoreMatchers.hasItem;
-import static org.hamcrest.CoreMatchers.is;
+import static org.hamcrest.Matchers.iterableWithSize;
/**
* Test group related stuff
@@ -42,6 +43,30 @@ import static org.hamcrest.CoreMatchers.is;
*/
public class GroupTest extends AbstractBase {
+ private static final String X_TEST_GROUP = "-x-test-group";
+
+ @Override
+ @Before
+ public void setUp() throws Exception {
+ super.setUp();
+
+ // Remove group that was left over (just in case)
+ Response response =
+ given()
+ .header(acceptJson)
+ .queryParam("q", X_TEST_GROUP)
+ .when()
+ .get("/group");
+
+ JsonPath jsonPath = response.jsonPath();
+ if (jsonPath.get("id[0]")!=null) {
+ int groupId = jsonPath.getInt("id[0]");
+ given()
+ .pathParam("id", groupId)
+ .delete("/group/{id}");
+ }
+ }
+
@Test
public void testGetGroups() throws Exception {
expect().statusCode(200)
@@ -59,7 +84,7 @@ public class GroupTest extends AbstractBase {
@Test
public void testCreateGroupAndRemove() throws Exception {
- Group group = new Group("-x-test-group");
+ Group group = new Group(X_TEST_GROUP);
// create the group
Response created =
@@ -81,14 +106,15 @@ public class GroupTest extends AbstractBase {
// Search for it
Response response =
given()
- .queryParam("q", "-x-test-group")
+ .header(acceptJson)
+ .queryParam("q", X_TEST_GROUP)
.expect()
- .statusCode(200)
+ .statusCode(200)
.when()
- .get("/group");
+ .get("/group");
JsonPath jsonPath = response.jsonPath();
- assert jsonPath.get("[0].name").equals("-x-test-group"); // [0] as the query returns a list
+ assert jsonPath.get("[0].name").equals(X_TEST_GROUP); // [0] as the query returns a list
int groupId = jsonPath.get("[0].id");
assert groupId == createdId;
@@ -96,7 +122,7 @@ public class GroupTest extends AbstractBase {
given()
.pathParam("id",groupId)
.expect()
- .statusCode(200)
+ .statusCode(204)
.log().ifError()
.when()
.delete("/group/{id}");
@@ -104,8 +130,32 @@ public class GroupTest extends AbstractBase {
}
@Test
+ public void testGetGroupWithInvalidId() throws Exception {
+ given()
+ .pathParam("gid", 42)
+ .expect()
+ .statusCode(404)
+ .when()
+ .get("/group/{gid}");
+ }
+
+ @Test
+ public void testUpdateGroupWithInvalidId() throws Exception {
+ Group group = new Group(X_TEST_GROUP);
+ given()
+ .pathParam("gid",42)
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(group)
+ .expect()
+ .statusCode(404)
+ .when()
+ .put("/group/{gid}");
+ }
+
+ @Test
public void testUpdateGroup() throws Exception {
- Group group = new Group("-x-test-group");
+ Group group = new Group(X_TEST_GROUP);
// Generate the group
Response response =
@@ -140,7 +190,7 @@ public class GroupTest extends AbstractBase {
given()
.pathParam("id", id)
.expect()
- .statusCode(200)
+ .statusCode(204)
.log().ifError()
.when()
.delete("/group/{id}");
@@ -149,7 +199,7 @@ public class GroupTest extends AbstractBase {
@Test
public void testAddResourceToGroup() throws Exception {
- Group group = new Group("-x-test-group");
+ Group group = new Group(X_TEST_GROUP);
// Generate the group
Response response =
@@ -171,7 +221,7 @@ public class GroupTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(group)
- .pathParam("id",id)
+ .pathParam("id", id)
.pathParam("resourceId",10001)
.expect()
.statusCode(HttpStatus.SC_OK)
@@ -184,7 +234,7 @@ public class GroupTest extends AbstractBase {
given()
.pathParam("id",id)
.expect()
- .statusCode(200)
+ .statusCode(204)
.log().ifError()
.when()
.delete("/group/{id}");
@@ -192,8 +242,72 @@ public class GroupTest extends AbstractBase {
}
@Test
+ public void testAddResourceToGroupAndGetResources() throws Exception {
+ Group group = new Group(X_TEST_GROUP);
+
+ // Generate the group
+ Response response =
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(group)
+ .expect()
+ .statusCode(HttpStatus.SC_CREATED)
+ .log().ifError()
+ .when()
+ .post("/group");
+
+ String location = response.header("Location");
+ int groupId = Integer.parseInt(location.substring(location.lastIndexOf("/")+1));
+
+ try {
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(group)
+ .pathParam("gid", groupId)
+ .pathParam("resourceId",10001)
+ .expect()
+ .statusCode(HttpStatus.SC_OK)
+ .log().ifError()
+ .when()
+ .put("/group/{gid}/resource/{resourceId}");
+
+ given()
+ .pathParam("groupId",groupId)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("", iterableWithSize(1)) // Expect one
+ .when()
+ .get("/group/{groupId}/resources");
+
+ }
+ finally {
+ // delete the group
+ given()
+ .pathParam("id",groupId)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .delete("/group/{id}");
+ }
+ }
+
+ @Test
+ public void testGetResourcesForGroupWithInvalidId() throws Exception {
+ given()
+ .pathParam("groupId", 14)
+ .expect()
+ .statusCode(404)
+ .when()
+ .get("/group/{groupId}/resources");
+ }
+
+ @Test
public void testAddNonExistingResourceToGroup() throws Exception {
- Group group = new Group("-x-test-group");
+ Group group = new Group(X_TEST_GROUP);
// Generate the group
Response response =
@@ -228,7 +342,7 @@ public class GroupTest extends AbstractBase {
given()
.pathParam("id",id)
.expect()
- .statusCode(200)
+ .statusCode(204)
.log().ifError()
.when()
.delete("/group/{id}");
@@ -237,7 +351,7 @@ public class GroupTest extends AbstractBase {
@Test
public void testRemoveResourceFromGroup() throws Exception {
- Group group = new Group("-x-test-group");
+ Group group = new Group(X_TEST_GROUP);
// Generate the group
Response response =
@@ -285,7 +399,7 @@ public class GroupTest extends AbstractBase {
given()
.pathParam("id",id)
.expect()
- .statusCode(200)
+ .statusCode(204)
.log().ifError()
.when()
.delete("/group/{id}");
@@ -294,7 +408,7 @@ public class GroupTest extends AbstractBase {
@Test
public void testGetMetricDefinitionsForGroup() throws Exception {
- Group group = new Group("-x-test-group");
+ Group group = new Group(X_TEST_GROUP);
group.setCategory("COMPATIBLE");
group.setResourceTypeId(10001);
@@ -331,7 +445,7 @@ public class GroupTest extends AbstractBase {
given()
.pathParam("id",id)
.expect()
- .statusCode(200)
+ .statusCode(204)
.log().ifError()
.when()
.delete("/group/{id}");
@@ -349,6 +463,28 @@ public class GroupTest extends AbstractBase {
}
@Test
+ public void testCreateDefinitionWithoutName() throws Exception {
+
+ GroupDef gd = new GroupDef();
+ gd.setDescription("Just testing");
+ List<String> list = new ArrayList<String>();
+ list.add("groupby resource");
+ list.add("resource.name");
+ gd.setExpression(list);
+
+ Response response =
+ given()
+ .contentType(ContentType.JSON)
+ .header("Accept","application/json")
+ .body(gd)
+ .expect()
+ .statusCode(406)
+ .log().ifError()
+ .when()
+ .post("/group/definitions");
+ }
+
+ @Test
public void testCreateRetrieveDeleteDefinition() throws Exception {
GroupDef gd = new GroupDef("-x-test-def");
@@ -404,6 +540,44 @@ public class GroupTest extends AbstractBase {
}
@Test
+ public void testGetUnknownGroupDefinition() throws Exception {
+
+ given()
+ .pathParam("id", 44)
+ .expect()
+ .statusCode(404)
+ .when()
+ .get("/group/definition/{id}");
+ }
+
+ @Test
+ public void testUpdateUnknownGroupDefinition() throws Exception {
+
+ GroupDef gd = new GroupDef("-x-test-def");
+ gd.setDescription("Just testing");
+
+ given()
+ .contentType(ContentType.JSON)
+ .header("Accept","application/json")
+ .body(gd)
+ .pathParam("id", 44)
+ .expect()
+ .statusCode(404)
+ .when()
+ .put("/group/definition/{id}");
+ }
+
+ @Test
+ public void testDeleteUnknownGroupDefinition() throws Exception {
+ given()
+ .pathParam("id", 44)
+ .expect()
+ .statusCode(204)
+ .when()
+ .delete("/group/definition/{id}");
+ }
+
+ @Test
public void testCreateUpdateRecalcDeleteDefinition() throws Exception {
GroupDef gd = new GroupDef("-x-test-def2");
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java
index 9472059..18b0297 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java
@@ -22,6 +22,7 @@ import java.util.List;
import java.util.Map;
import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.path.json.JsonPath;
import com.jayway.restassured.response.Response;
import org.junit.Before;
@@ -183,12 +184,12 @@ public class OperationsTest extends AbstractBase {
.body(draft)
.expect()
.statusCode(200)
- .log().ifError()
+ .log().everything()
.when()
.put("/operation/{id}")
.as(Operation.class);
- System.out.println(scheduled);
+ System.out.println(scheduled.getId());
String history = null;
List<Map<String,Object>> links = scheduled.getLinks();
for (Map<String,Object> link : links) {
@@ -199,7 +200,7 @@ public class OperationsTest extends AbstractBase {
String historyId = history.substring(history.lastIndexOf("/")+1);
try {
- Thread.sleep(5000); // we need to wait a little as the execution may take time
+ Thread.sleep(15000); // we need to wait a little as the execution may take time
given()
.pathParam("hid",historyId)
@@ -236,21 +237,23 @@ public class OperationsTest extends AbstractBase {
boolean done = false;
int count = 0;
while (!done) {
- String status =
+ Response response =
given()
- .pathParam("hid",historyId)
- .expect()
- .statusCode(200)
- .log().everything()
+ .header(acceptJson)
+ .pathParam("hid", historyId)
.when()
- .get("/operation/history/{hid}")
- .jsonPath().getString("status");
+ .get("/operation/history/{hid}");
+
+ JsonPath jsonPath = response.jsonPath();
+ String status= jsonPath.getString("status");
+ int code = response.statusCode();
- if (status.equals("Success") || status.equals("Failed")) {
+ if (code==200 && (status.equals("Success") || status.equals("Failed"))) {
done = true;
} else {
Thread.sleep(2000);
}
+ count ++;
assert count < 10 :"Waited for 20sec -- something is wrong";
}
commit 58d2f793f5b07d62aeb9cb550b5a4fd071b0022f
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Feb 8 15:25:25 2013 +0100
Itests are now itests-2
diff --git a/modules/enterprise/server/pom.xml b/modules/enterprise/server/pom.xml
index 556efa3..d64e981 100644
--- a/modules/enterprise/server/pom.xml
+++ b/modules/enterprise/server/pom.xml
@@ -33,7 +33,7 @@
<module>installer</module>
<module>safe-invoker</module>
<module>client-api</module>
- <module>itests</module>
+ <module>itests-2</module>
</modules>
</profile>
commit 62b3f19350fcdbb5f1b64f6d516a6c7a84e9225f
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Thu Feb 7 13:09:11 2013 +0100
Improve documentation and harden the alert definition part of the REST api
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
index d2fa410e..5897644 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java
@@ -31,6 +31,7 @@ import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.interceptor.Interceptors;
import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
import javax.ws.rs.DELETE;
@@ -52,6 +53,8 @@ import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiError;
+import com.wordnik.swagger.annotations.ApiErrors;
import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
@@ -159,6 +162,7 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@GET
@Path("/definition/{id}")
@ApiOperation(value = "Get one AlertDefinition by id", responseClass = "AlertDefinitionRest")
+ @ApiError(code = 404, reason = "No definition found with the passed id.")
public Response getAlertDefinition(@ApiParam("Id of the alert definition to retrieve") @PathParam("id") int definitionId,
@ApiParam("Should conditions be returned too?") @QueryParam("full") @DefaultValue("false") boolean full,
@Context Request request) {
@@ -181,6 +185,10 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@POST
@Path("/definitions")
@ApiOperation("Create an AlertDefinition for the resource/group/resource type passed as query param. One and only one of the three params must be given at any time.")
+ @ApiErrors({
+ @ApiError(code = 406, reason = "There was not exactly one of 'resourceId','groupId' or 'resourceTypeId' given"),
+ @ApiError(code = 404, reason = "A non existing alert notification sender was requested.")
+ })
public Response createAlertDefinition(@ApiParam("The id of the resource to attach the definition to") @QueryParam("resourceId") Integer resourceId,
@ApiParam("The id of the group to attach the definition to") @QueryParam("groupId") Integer groupId,
@ApiParam("The id of the resource type to attach the definition to") @QueryParam("resourceTypeId") Integer resourceTypeId,
@@ -266,6 +274,7 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@PUT
@Path("/definition/{id}")
@ApiOperation(value = "Update the alert definition (priority, enablement, dampening, recovery)", notes = "Priority must be HIGH,LOW,MEDIUM. If not provided, LOW is assumed.")
+ @ApiError(code = 404, reason = "No AlertDefinition with the passed id exists")
public Response updateDefinition(
@ApiParam("Id of the alert definition to update") @PathParam("id") int definitionId,
@ApiParam("Data for the update") AlertDefinitionRest definitionRest) {
@@ -385,6 +394,7 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@POST
@Path("definition/{id}/conditions")
@ApiOperation("Add a new alert condition to an existing alert definition")
+ @ApiError(code = 404, reason = "No AlertDefinition with the passed id exists")
public Response addConditionToDefinition(
@ApiParam("The id of the alert definition") @PathParam("id") int definitionId,
@ApiParam("The condition to add") AlertConditionRest conditionRest, @Context UriInfo uriInfo) {
@@ -409,9 +419,17 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@ApiOperation("Remove an alert condition")
public Response deleteCondition(
@ApiParam("The id of the condition to remove")@PathParam("cid") int conditionId) {
- Integer definitionId = findDefinitionIdForConditionId(conditionId);
- AlertDefinition definition2 = entityManager.find(AlertDefinition.class,definitionId);
+ Integer definitionId;
+ try {
+ definitionId = findDefinitionIdForConditionId(conditionId);
+ }
+ catch (NoResultException nre) {
+ return Response.noContent().build();
+ }
+
+ AlertDefinition definition2;
+ definition2 = entityManager.find(AlertDefinition.class,definitionId);
AlertCondition condition=null;
for (AlertCondition c: definition2.getConditions()) {
if (c.getId() == conditionId)
@@ -444,11 +462,18 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@PUT
@Path("condition/{cid}")
@ApiOperation("Update an existing condition of an alert definition.Note that the update will change the id of the condition")
+ @ApiError(code = 404, reason = "Condition with passed id does not exist")
public Response updateCondition(
@ApiParam("The id of the condition to update") @PathParam("cid") int conditionId,
@ApiParam("The updated condition") AlertConditionRest conditionRest, @Context UriInfo uriInfo) {
- Integer definitionId = findDefinitionIdForConditionId(conditionId);
+ Integer definitionId;
+ try {
+ definitionId = findDefinitionIdForConditionId(conditionId);
+ }
+ catch (NoResultException nre) {
+ throw new StuffNotFoundException("Condition with id " + conditionId);
+ }
AlertDefinition definition = entityManager.find(AlertDefinition.class,definitionId);
AlertCondition condition=null;
@@ -485,10 +510,13 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@GET
@Path("condition/{cid}")
@ApiOperation("Retrieve a condition of an alert definition by its condition id")
+ @ApiError(code = 404, reason = "No condition with the passed id exists")
public Response getCondition(
@ApiParam("The id of the condition to retrieve") @PathParam("cid") int conditionId) {
AlertCondition condition = conditionMgr.getAlertConditionById(conditionId);
+ if (condition==null)
+ throw new StuffNotFoundException("No condition with id " + conditionId);
AlertConditionRest acr = conditionToConditionRest(condition);
return Response.ok(acr).build();
@@ -543,10 +571,13 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@GET
@Path("notification/{nid}")
@ApiOperation("Return a notification definition by its id")
+ @ApiError(code = 404, reason = "No notification with the passed id found")
public Response getNotification(
@ApiParam("The id of the notification definition to retrieve") @PathParam("nid") int notificationId) {
AlertNotification notification = notificationMgr.getAlertNotification(caller,notificationId);
+ if (notification==null)
+ throw new StuffNotFoundException("No notification with id " + notificationId);
AlertNotificationRest anr = notificationToNotificationRest(notification);
return Response.ok(anr).build();
@@ -559,26 +590,30 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@ApiParam("The id of the notification definition to remove") @PathParam("nid") int notificationId) {
AlertNotification notification = notificationMgr.getAlertNotification(caller,notificationId);
- AlertDefinition definition = alertDefinitionManager.getAlertDefinition(caller,notification.getAlertDefinition().getId());
-
- definition.getAlertNotifications().remove(notification);
+ if (notification!=null) {
+ AlertDefinition definition = alertDefinitionManager.getAlertDefinition(caller,notification.getAlertDefinition().getId());
- alertDefinitionManager.updateAlertDefinitionInternal(caller,definition.getId(),definition,true,true,true);
-// alertDefinitionManager.updateAlertDefinition(caller, definition.getId(), copiedDef, true);
+ definition.getAlertNotifications().remove(notification);
- entityManager.flush();
+ alertDefinitionManager.updateAlertDefinitionInternal(caller,definition.getId(),definition,true,true,true);
+ entityManager.flush();
+ }
return Response.noContent().build();
}
@PUT
@Path("notification/{nid}")
@ApiOperation("Update a notification definition")
+ @ApiError(code = 404, reason = "There is no notification with the passed id")
public Response updateNotification(
@ApiParam("The id of the notification definition to update") @PathParam("nid") int notificationId,
@ApiParam("The updated notification definition to use") AlertNotificationRest notificationRest) {
AlertNotification notification = notificationMgr.getAlertNotification(caller,notificationId);
+ if (notification==null)
+ throw new StuffNotFoundException("No notification with id " + notificationId);
+
AlertDefinition definition = alertDefinitionManager.getAlertDefinition(caller,notification.getAlertDefinition().getId());
AlertNotification newNotif = notificationRestToNotification(definition,notificationRest);
@@ -607,6 +642,10 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@POST
@Path("definition/{id}/notifications")
@ApiOperation("Add a new notification definition to an alert definition")
+ @ApiErrors({
+ @ApiError(code = 404, reason = "Requested alert notification sender does not exist"),
+ @ApiError(code = 404, reason = "There is no alert definition with the passed id")
+ })
public Response addNotificationToDefinition(
@ApiParam("Id of the alert definition that should get the notification definition") @PathParam("id") int definitionId,
@ApiParam("The notification definition to add") AlertNotificationRest notificationRest, @Context UriInfo uriInfo) {
@@ -701,6 +740,7 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean {
@ApiOperation("Return an alert notification sender by name. This includes information about the configuration it expects")
@GET @GZIP
@Path("sender/{name}")
+ @ApiError(code = 404, reason = "There is no sender with the passed name")
public Response getAlertSenderByName(
@ApiParam("Name of the sender to retrieve") @PathParam("name")String senderName, @Context UriInfo uriInfo) {
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
index 283e152..7e9fa70 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
@@ -639,6 +639,88 @@ public class AlertTest extends AbstractBase {
}
@Test
+ public void testGetNonExistingCondition() throws Exception {
+
+ given()
+ .header(acceptJson)
+ .pathParam("cid",14)
+ .expect()
+ .statusCode(404)
+ .log().ifError()
+ .when()
+ .get("/alert/condition/{cid}");
+
+ }
+
+ @Test
+ public void testGetNonExistingNotification() throws Exception {
+
+ given()
+ .header(acceptXml)
+ .pathParam("cid",14)
+ .expect()
+ .statusCode(404)
+ .log().ifError()
+ .when()
+ .get("/alert/notification/{cid}");
+
+ }
+
+ @Test
+ public void testUpdateNonExistingCondition() throws Exception {
+
+ given()
+ .header(acceptJson)
+ .pathParam("cid",14)
+ .expect()
+ .statusCode(404)
+ .log().ifError()
+ .when()
+ .put("/alert/condition/{cid}");
+
+ }
+
+ @Test
+ public void testUpdateNonExistingNotification() throws Exception {
+
+ given()
+ .header(acceptXml)
+ .pathParam("cid",14)
+ .expect()
+ .statusCode(404)
+ .log().ifError()
+ .when()
+ .put("/alert/notification/{cid}");
+
+ }
+
+ @Test
+ public void testDeleteNonExistingNotification() throws Exception {
+
+ given()
+ .header(acceptJson)
+ .pathParam("cid",14)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .delete("/alert/notification/{cid}");
+ }
+
+ @Test
+ public void testDeleteNonExistingCondition() throws Exception {
+
+ given()
+ .header(acceptJson)
+ .pathParam("cid",14)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .delete("/alert/condition/{cid}");
+ }
+
+ @Test
public void testCreateDeleteAlertDefinitionWithUnknwonSender() throws Exception {
int definitionId = createEmptyAlertDefinition();
commit 572fca628aa0c492347f1661ef723c3834b2cde5
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Feb 8 10:17:15 2013 -0500
Fix issue with SLSB invocation.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index ea4b5aa..0a87342 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -279,7 +279,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
throw new PermissionException("You do not have permission to uninventory resource [" + resourceId + "]");
}
- return uninventoryResourceInNewTransaction(resourceId);
+ return resourceManager.uninventoryResourceInNewTransaction(resourceId);
}
@Override
commit c17aa632dca792707a4c84ba16245efb9c4ed99a
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Feb 8 15:18:40 2013 +0100
[BZ Bug 893802 - [as7] Restart operation fails to start AS when shutdown hasn't completed when start script is invoked] If the AS is deployed on the same node as the agent, the check whether the process is runing or not is done in a loop once a second. This new check was added after the original (using the DMR api polling) check. In total, the AS has up to 20 second to finish its work and completely shut down.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
index 98a46d2..5e3373b 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java
@@ -54,6 +54,7 @@ import org.rhq.core.system.ProcessExecutionResults;
import org.rhq.core.system.SystemInfo;
import org.rhq.core.util.PropertiesFileUpdate;
import org.rhq.modules.plugins.jbossas7.helper.HostConfiguration;
+import org.rhq.modules.plugins.jbossas7.helper.HostPort;
import org.rhq.modules.plugins.jbossas7.helper.ServerPluginConfiguration;
import org.rhq.modules.plugins.jbossas7.json.Address;
import org.rhq.modules.plugins.jbossas7.json.ComplexResult;
@@ -242,24 +243,24 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
}
protected boolean waitUntilDown() throws InterruptedException {
- boolean down=false;
- int count=0;
+ boolean notAnswering = false;
+ int count = 0;
- while (!down) {
- Operation op = new ReadAttribute(new Address(),"release-version");
+ while (!notAnswering) {
+ Operation op = new ReadAttribute(new Address(), "release-version");
- try{
+ try {
Result res = getASConnection().execute(op);
if (!res.isSuccess()) { // If op succeeds, server is not down
- down = true;
+ notAnswering = true;
} else if (count > 20) {
break;
}
} catch (Exception e) {
- down = true;
+ notAnswering = true;
}
- if (!down) {
+ if (!notAnswering) {
try {
Thread.sleep(1000); // Wait 1s
} catch (InterruptedException e) {
@@ -269,8 +270,27 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
count++;
}
- log.debug("waitUntilDown: Used " + count + " delay round(s) to shut down. Server down=" + down);
- return down;
+ // BZ 893802: wait until server (the process) is really down
+ HostConfiguration hostConfig = getHostConfig();
+ // commandLine instance is not important for determining whether the HostPort is local or not
+ AS7CommandLine commandLine = new AS7CommandLine(new String[] { "java", "foo.Main",
+ "org.jboss.as.host-controller" });
+ HostPort hostPort = hostConfig.getDomainControllerHostPort(commandLine);
+
+ if (hostPort.isLocal) {
+ // lets be paranoid here
+ while (context.getNativeProcess() != null && context.getNativeProcess().priorSnaphot().isRunning()
+ && count++ <= 20) {
+ try {
+ Thread.sleep(1000); // Wait 1s
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ }
+ }
+
+ log.debug("waitUntilDown: Used " + count + " delay round(s) to shut down. Server down=" + notAnswering);
+ return notAnswering;
}
/**
@@ -520,14 +540,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
return result;
}
- File configFile = getHostConfigFile();
- HostConfiguration hostConfig;
- try {
- hostConfig = new HostConfiguration(configFile);
- } catch (Exception e) {
- throw new RuntimeException("Failed to parse configuration file [" + configFile + "].", e);
- }
-
+ HostConfiguration hostConfig = getHostConfig();
String realm = pluginConfig.getSimpleValue("realm", "ManagementRealm");
File propertiesFile = hostConfig.getSecurityPropertyFile(baseDir, getMode(), realm);
if (!propertiesFile.canWrite()) {
@@ -635,8 +648,9 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
}
}
- private File getHostConfigFile() {
+ private HostConfiguration getHostConfig() {
File configFile;
+ HostConfiguration hostConfig;
try {
String config = readAttribute(getEnvironmentAddress(), getMode().getHostConfigAttributeName());
configFile = new File(config);
@@ -652,7 +666,12 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
throw new RuntimeException("Failed to determine config file path.", e);
}
}
- return configFile;
+ try {
+ hostConfig = new HostConfiguration(configFile);
+ } catch (Exception e) {
+ throw new RuntimeException("Failed to parse configuration file [" + configFile + "].", e);
+ }
+ return hostConfig;
}
private void collectServerKindTraits(MeasurementReport report, Set<MeasurementScheduleRequest> skmRequests) {
11 years, 2 months