[rhq] Branch 'feature/cassandra-backend' - 56 commits - .classpath code-coverage/pom.xml etc/augeas-utils etc/classloaders-test etc/eclipse-tools modules/cli-tests modules/common modules/core modules/enterprise modules/helpers modules/integration-tests modules/plugins modules/test-utils pom.xml
by John Sanda
.classpath | 6
code-coverage/pom.xml | 7
etc/augeas-utils/pom.xml | 5
etc/classloaders-test/plugin1/pom.xml | 18
etc/classloaders-test/plugin2/pom.xml | 18
etc/eclipse-tools/RHQ | 59 -
modules/cli-tests/pom.xml | 3
modules/common/ant-bundle/pom.xml | 3
modules/common/drift/pom.xml | 1
modules/common/jboss-as/pom.xml | 3
modules/core/arquillian-integration/container/pom.xml | 3
modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/util/PluginContainerClassEnhancer.java | 2
modules/core/client-api/pom.xml | 2
modules/core/dbutils/pom.xml | 7
modules/core/domain/pom.xml | 19
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AvailabilityCriteria.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/measurement/Availability.java | 4
modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupAvailability.java | 100 +
modules/core/gui/pom.xml | 7
modules/core/native-system/pom.xml | 1
modules/core/plugin-api/pom.xml | 2
modules/core/plugin-container/pom.xml | 1
modules/core/plugin-test-api/pom.xml | 2
modules/core/plugin-test-util/pom.xml | 1
modules/core/plugin-validator/pom.xml | 1
modules/core/plugindoc/pom.xml | 2
modules/core/util/pom.xml | 1
modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingProperties.java | 300 +++++
modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingReader.java | 201 +++
modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferences.java | 220 ++++
modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferencesFactory.java | 71 +
modules/enterprise/agent/ant-run.xml | 4
modules/enterprise/agent/pom.xml | 9
modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.conf | 2
modules/enterprise/agent/src/etc/rhq-agent-env.bat | 2
modules/enterprise/agent/src/etc/rhq-agent-env.sh | 2
modules/enterprise/agent/src/etc/rhq-agent.bat | 9
modules/enterprise/agent/src/etc/rhq-agent.sh | 9
modules/enterprise/agentupdate/pom.xml | 4
modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/MigrateAgentPreferences.java | 139 ++
modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build-tasks.properties | 5
modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml | 8
modules/enterprise/binding/pom.xml | 10
modules/enterprise/comm/pom.xml | 10
modules/enterprise/gui/content_http-war/pom.xml | 20
modules/enterprise/gui/coregui/pom.xml | 1
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/selection/SingleCompatibleResourceGroupSelector.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/UserPreferencesMeasurementRangeEditor.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/SingleResourceGroupSelectorItem.java | 85 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java | 13
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java | 4
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AvailabilityGWTService.java | 9
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java | 52
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java | 383 +++---
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java | 172 +--
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionExpressionBuilder.java | 213 ++-
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java | 57 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java | 27
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java | 57 -
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/AvailabilityD3Graph.java | 11
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourceGroupSelector.java | 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AvailabilityGWTServiceImpl.java | 28
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 4
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties | 4
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 7
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 8
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties | 8
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 4
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 10
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 6
modules/enterprise/gui/coregui/src/main/webapp/css/charts.css | 20
modules/enterprise/gui/pom.xml | 1
modules/enterprise/gui/portal-war/pom.xml | 14
modules/enterprise/gui/remoting-war/pom.xml | 145 ++
modules/enterprise/gui/remoting-war/src/main/java/org/rhq/enterprise/communications/servlet/ServerInvokerServlet.java | 92 +
modules/enterprise/gui/remoting-war/src/main/webapp/WEB-INF/web.xml | 34
modules/enterprise/gui/rest-examples-war/pom.xml | 1
modules/enterprise/gui/rest-war/pom.xml | 3
modules/enterprise/remoting/ant-run.xml | 9
modules/enterprise/remoting/cli/pom.xml | 5
modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/Controller.java | 6
modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml | 2
modules/enterprise/remoting/client-api/pom.xml | 4
modules/enterprise/remoting/client-deps/pom.xml | 57 -
modules/enterprise/scripting/api/pom.xml | 1
modules/enterprise/scripting/javascript/pom.xml | 2
modules/enterprise/scripting/python/pom.xml | 2
modules/enterprise/server/appserver/pom.xml | 1
modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc | 9
modules/enterprise/server/client-api/pom.xml | 3
modules/enterprise/server/ear/pom.xml | 23
modules/enterprise/server/installer/pom.xml | 5
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java | 3
modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java | 27
modules/enterprise/server/itests-2/pom.xml | 4
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBeanTest.java | 273 ++++
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java | 549 ++++++++++
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java | 329 ++++-
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java | 361 ++++++
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java | 453 ++------
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/scheduler/jobs/SavedSearchResultCountRecalculationJobTest.java | 256 ++++
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/search/SavedSearchManagerBeanTest.java | 192 +++
modules/enterprise/server/jar/intentional-api-changes-since-4.6.0.xml | 16
modules/enterprise/server/jar/pom.xml | 34
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java | 204 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java | 30
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityPoint.java | 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java | 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerLocal.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerRemote.java | 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 20
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java | 88 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java | 36
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ContentHandlerBean.java | 169 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java | 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java | 212 +++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceTypeHandlerBean.java | 97 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/AvailabilitySummary.java | 221 ++++
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBRresourceRequest.java | 56 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/ResourceTypeRest.java | 98 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/helper/LinkSerializer.java | 5
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java | 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java | 1
modules/enterprise/server/plugins/alert-operations/pom.xml | 1
modules/enterprise/server/plugins/alert-roles/pom.xml | 1
modules/enterprise/server/plugins/ant-bundle/pom.xml | 1
modules/enterprise/server/plugins/cobbler/pom.xml | 1
modules/enterprise/server/plugins/disk/pom.xml | 2
modules/enterprise/server/plugins/drift-mongodb/pom.xml | 1
modules/enterprise/server/plugins/groovy-script/pom.xml | 14
modules/enterprise/server/plugins/jboss-software/pom.xml | 2
modules/enterprise/server/plugins/url/pom.xml | 1
modules/enterprise/server/sars/agent-sar/pom.xml | 5
modules/enterprise/server/sars/services-sar/pom.xml | 19
modules/enterprise/server/xml-schemas/pom.xml | 1
modules/helpers/bundleGen/pom.xml | 2
modules/helpers/inventory-serializer/pom.xml | 1
modules/helpers/perftest-support/pom.xml | 3
modules/helpers/pluginGen/pom.xml | 2
modules/helpers/rest-docs-generator/pom.xml | 65 -
modules/helpers/rtfilter/pom.xml | 1
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java | 2
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java | 2
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java | 4
modules/integration-tests/jndi-access/jndi-access-test/pom.xml | 2
modules/integration-tests/jndi-access/remote-server/pom.xml | 1
modules/integration-tests/mod_cluster-plugin-test/pom.xml | 4
modules/integration-tests/rest-api/pom.xml | 1
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java | 4
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java | 13
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ContentTest.java | 333 ++++++
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java | 218 +++
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/CreateCBRRequest.java | 49
modules/integration-tests/rest-api/src/test/resources/test-simple.war |binary
modules/plugins/aliases/pom.xml | 1
modules/plugins/ant-bundle/pom.xml | 1
modules/plugins/apache/pom.xml | 2
modules/plugins/augeas/pom.xml | 3
modules/plugins/cassandra/pom.xml | 1
modules/plugins/cobbler/pom.xml | 3
modules/plugins/cron/pom.xml | 1
modules/plugins/grub/pom.xml | 1
modules/plugins/hadoop/pom.xml | 1
modules/plugins/hosts/pom.xml | 1
modules/plugins/hudson/src/main/java/org/rhq/plugins/hudson/HudsonProjectComponent.java | 60 -
modules/plugins/hudson/src/main/resources/META-INF/rhq-plugin.xml | 8
modules/plugins/irc/pom.xml | 1
modules/plugins/jboss-as-5/pom.xml | 10
modules/plugins/jboss-as-5/testsuite/pom.xml | 1
modules/plugins/jboss-as-7/pom.xml | 2
modules/plugins/jboss-as/pom.xml | 10
modules/plugins/jboss-cache-v3/pom.xml | 3
modules/plugins/mod-cluster/pom.xml | 1
modules/plugins/netservices/pom.xml | 3
modules/plugins/pattern-generator/pom.xml | 1
modules/plugins/perftest/pom.xml | 1
modules/plugins/pom.xml | 1
modules/plugins/postfix/pom.xml | 1
modules/plugins/raw-config-test/pom.xml | 9
modules/plugins/samba/pom.xml | 1
modules/plugins/snmptrapd/pom.xml | 1
modules/plugins/sshd/pom.xml | 1
modules/plugins/sudoers/pom.xml | 1
modules/plugins/tomcat/pom.xml | 2
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java | 1
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatRoleComponent.java | 1
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java | 1
modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java | 14
modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml | 38
modules/plugins/twitter/pom.xml | 1
modules/test-utils/pom.xml | 5
modules/test-utils/src/main/java/org/rhq/test/TokenReplacingProperties.java | 300 -----
modules/test-utils/src/main/java/org/rhq/test/TokenReplacingReader.java | 201 ---
pom.xml | 330 +++++-
194 files changed, 6471 insertions(+), 1993 deletions(-)
New commits:
commit 799cfe5ce1a1910cfb5de5c8b96884e470916558
Merge: 5447273 bb955e4
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 27 21:45:27 2013 -0400
Merge branch 'master' into feature/cassandra-backend
Conflicts:
pom.xml
diff --cc pom.xml
index 6723b51,0a804a7..139d4ba
--- a/pom.xml
+++ b/pom.xml
@@@ -150,13 -150,21 +150,27 @@@
<xercesImpl.version>2.9.1-jbossas-2</xercesImpl.version> <!-- see BZ-820629 and CVE-2009-2625 -->
<opencsv.version>1.8</opencsv.version>
<commons-httpclient.version>3.0.1</commons-httpclient.version>
+ <commons-io.version>1.4</commons-io.version>
+ <commons-lang.version>2.4</commons-lang.version>
+ <commons-codec.version>1.4</commons-codec.version>
+ <commons-validator.version>1.1.4</commons-validator.version>
+ <commons-collections.version>3.2.1</commons-collections.version>
+ <commons-configuration.version>1.6</commons-configuration.version>
+
+ <junit.version>4.8.2</junit.version>
+ <liquibase-core.version>1.9.5</liquibase-core.version>
+ <jbpm.version>3.1.1</jbpm.version>
+ <servlet-api.version>2.4</servlet-api.version>
+
+ <mockito-core.version>1.9.0</mockito-core.version>
+ <el.version>1.0</el.version>
+ <!-- cassandra dependency versions -->
+ <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>
commit bb955e4a5ccf2f15803dddaf741fe496d1cf044b
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 27 21:36:13 2013 -0400
moving TokenReplacingProperties and TokenReplacingReader for use in production code
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingProperties.java b/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingProperties.java
new file mode 100644
index 0000000..12b36e1
--- /dev/null
+++ b/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingProperties.java
@@ -0,0 +1,300 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.util;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+
+/**
+ * This map is basically an extension of the {@link Properties} class that can resolve the references
+ * to values of other keys inside the values.
+ * <p>
+ * I.e., if the map is initialized with the following mappings:
+ * <p>
+ * <code>
+ * name => world <br />
+ * hello => Hello ${name}!
+ * </code>
+ * <p>
+ * then the call to:
+ * <p>
+ * <code>
+ * get("hello")
+ * </code>
+ * <p>
+ * will return:
+ * <code>
+ * "Hello world!"
+ * </code>
+ * <p>
+ * To access and modify the underlying unprocessed values, one can use the "raw" counterparts of the standard
+ * map methods (e.g. instead of {@link #get(Object)}, use {@link #getRaw(Object)}, etc.).
+ *
+ * @author Lukas Krejci
+ */
+public class TokenReplacingProperties extends HashMap<String, String> {
+ private static final long serialVersionUID = 1L;
+
+ private Map<String, String> wrapped;
+ private Map<Object, String> resolved = new HashMap<Object, String>();
+
+ private class Entry implements Map.Entry<String, String> {
+ private Map.Entry<String, String> wrapped;
+ private boolean process;
+
+ public Entry(Map.Entry<String, String> wrapped, boolean process) {
+ this.wrapped = wrapped;
+ this.process = process;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+
+ if (!(obj instanceof Entry)) {
+ return false;
+ }
+
+ Entry other = (Entry) obj;
+
+ String key = wrapped.getKey();
+ String otherKey = other.getKey();
+ String value = getValue();
+ String otherValue = other.getValue();
+
+ return (key == null ? otherKey == null : key.equals(otherKey)) &&
+ (value == null ? otherValue == null : value.equals(otherValue));
+ }
+
+ public String getKey() {
+ return wrapped.getKey();
+ }
+
+ public String getValue() {
+ if (process) {
+ return get(wrapped.getKey());
+ } else {
+ return wrapped.getValue();
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ String key = wrapped.getKey();
+ String value = getValue();
+ return (key == null ? 0 : key.hashCode()) ^
+ (value == null ? 0 : value.hashCode());
+ }
+
+ public String setValue(String value) {
+ resolved.remove(wrapped.getKey());
+ return wrapped.setValue(value);
+ }
+
+ @Override
+ public String toString() {
+ return wrapped.toString();
+ }
+ }
+
+ public TokenReplacingProperties(Map<String, String> wrapped) {
+ this.wrapped = wrapped;
+ }
+
+ @SuppressWarnings("unchecked")
+ public TokenReplacingProperties(Properties properties) {
+ @SuppressWarnings("rawtypes")
+ Map map = properties;
+ this.wrapped = (Map<String, String>) map;
+ }
+
+ @Override
+ public String get(Object key) {
+ if (resolved.containsKey(key)) {
+ return resolved.get(key);
+ }
+
+ String rawValue = getRaw(key);
+
+ if (rawValue == null) {
+ return null;
+ }
+
+ String ret = readAll(new TokenReplacingReader(new StringReader(rawValue.toString()), this));
+
+ resolved.put(key, ret);
+
+ return ret;
+ }
+
+ public String getRaw(Object key) {
+ return wrapped.get(key);
+ }
+
+ @Override
+ public String put(String key, String value) {
+ resolved.remove(key);
+ return wrapped.put(key, value);
+ }
+
+ @Override
+ public void putAll(Map<? extends String, ? extends String> m) {
+ for(String key : m.keySet()) {
+ resolved.remove(key);
+ }
+ wrapped.putAll(m);
+ }
+
+ public void putAll(Properties properties) {
+ for(String propName : properties.stringPropertyNames()) {
+ put(propName, properties.getProperty(propName));
+ }
+ }
+
+ @Override
+ public void clear() {
+ wrapped.clear();
+ resolved.clear();
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ return wrapped.containsKey(key);
+ }
+
+ @Override
+ public Set<String> keySet() {
+ return wrapped.keySet();
+ }
+
+ @Override
+ public boolean containsValue(Object value) {
+ for(String key : keySet()) {
+ String thisVal = get(key);
+ if (thisVal == null) {
+ if (value == null) {
+ return true;
+ }
+ } else {
+ if (thisVal.equals(value)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks whether this map contains the unprocessed value.
+ *
+ * @param value
+ * @return
+ */
+ public boolean containsRawValue(Object value) {
+ return wrapped.containsValue(value);
+ }
+
+ /**
+ * The returned set <b>IS NOT</b> backed by this map
+ * (unlike in the default map implementations).
+ * <p>
+ * The {@link java.util.Map.Entry#setValue(Object)} method
+ * does modify this map though.
+ */
+ @Override
+ public Set<Map.Entry<String, String>> entrySet() {
+ Set<Map.Entry<String, String>> ret = new HashSet<Map.Entry<String, String>>();
+ for(Map.Entry<String, String> entry : wrapped.entrySet()) {
+ ret.add(new Entry(entry, true));
+ }
+
+ return ret;
+ }
+
+ public Set<Map.Entry<String, String>> getRawEntrySet() {
+ Set<Map.Entry<String, String>> ret = new HashSet<Map.Entry<String, String>>();
+ for(Map.Entry<String, String> entry : wrapped.entrySet()) {
+ ret.add(new Entry(entry, false));
+ }
+
+ return ret;
+ }
+
+ @Override
+ public String remove(Object key) {
+ resolved.remove(key);
+ return wrapped.remove(key).toString();
+ }
+
+ @Override
+ public int size() {
+ return wrapped.size();
+ }
+
+ /**
+ * Unlike in the default implementation the collection returned
+ * from this method <b>IS NOT</b> backed by this map.
+ */
+ @Override
+ public Collection<String> values() {
+ List<String> ret = new ArrayList<String>();
+ for(String key : keySet()) {
+ ret.add(get(key));
+ }
+
+ return ret;
+ }
+
+ public Collection<String> getRawValues() {
+ List<String> ret = new ArrayList<String>();
+ for(String key : keySet()) {
+ ret.add(wrapped.get(key));
+ }
+
+ return ret;
+ }
+
+ private String readAll(Reader rdr) {
+ int in = -1;
+ StringBuilder bld = new StringBuilder();
+ try {
+ while ((in = rdr.read()) != -1) {
+ bld.append((char) in);
+ }
+ } catch (IOException e) {
+ throw new IllegalStateException("Exception while reading a string.", e);
+ }
+
+ return bld.toString();
+ }
+}
\ No newline at end of file
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingReader.java b/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingReader.java
new file mode 100644
index 0000000..3303b76
--- /dev/null
+++ b/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingReader.java
@@ -0,0 +1,201 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.util;
+
+import java.io.IOException;
+import java.io.PushbackReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.nio.CharBuffer;
+import java.util.ArrayDeque;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Copied from http://tutorials.jenkov.com/java-howto/replace-strings-in-streams-arrays-...
+ * with fixes to {@link #read(char[], int, int)} and added support for escaping.
+ *
+ * @author Lukas Krejci
+ */
+public class TokenReplacingReader extends Reader {
+
+ private PushbackReader pushbackReader = null;
+ private Map<String, String> tokens = null;
+ private StringBuilder tokenNameBuffer = new StringBuilder();
+ private String tokenValue = null;
+ private int tokenValueIndex = 0;
+ private boolean escaping = false;
+ private Deque<String> activeTokens;
+ private Map<String, String> resolvedTokens;
+
+ public TokenReplacingReader(Reader source, Map<String, String> tokens) {
+ this.pushbackReader = new PushbackReader(source, 2);
+ this.tokens = tokens;
+ this.activeTokens = new ArrayDeque<String>();
+ this.resolvedTokens = new HashMap<String, String>();
+ }
+
+ protected TokenReplacingReader(String source, Map<String, String> tokens, Deque<String> activeTokens, Map<String, String> resolvedTokens) {
+ pushbackReader = new PushbackReader(new StringReader(source));
+ this.tokens = tokens;
+ this.activeTokens = activeTokens;
+ this.resolvedTokens = resolvedTokens;
+ }
+
+ public int read(CharBuffer target) throws IOException {
+ throw new RuntimeException("Operation Not Supported");
+ }
+
+ public int read() throws IOException {
+ if (this.tokenValue != null) {
+ if (this.tokenValueIndex < this.tokenValue.length()) {
+ return this.tokenValue.charAt(this.tokenValueIndex++);
+ }
+ if (this.tokenValueIndex == this.tokenValue.length()) {
+ this.tokenValue = null;
+ this.tokenValueIndex = 0;
+ }
+ }
+
+ int data = this.pushbackReader.read();
+
+ if (escaping) {
+ escaping = false;
+ return data;
+ }
+
+ if (data == '\\') {
+ escaping = true;
+ return data;
+ }
+
+ if (data != '$')
+ return data;
+
+ data = this.pushbackReader.read();
+ if (data != '{') {
+ this.pushbackReader.unread(data);
+ return '$';
+ }
+ this.tokenNameBuffer.delete(0, this.tokenNameBuffer.length());
+
+ data = this.pushbackReader.read();
+ while (data != '}') {
+ this.tokenNameBuffer.append((char) data);
+ data = this.pushbackReader.read();
+ }
+
+ String tokenName = tokenNameBuffer.toString();
+
+ if (resolvedTokens.containsKey(tokenName)) {
+ tokenValue = resolvedTokens.get(tokenName);
+ } else {
+ tokenValue = resolveToken(tokenName);
+ }
+
+ tokenValueIndex = 0;
+
+ if (!this.tokenValue.isEmpty()) {
+ return this.tokenValue.charAt(this.tokenValueIndex++);
+ } else {
+ return read();
+ }
+ }
+
+ public int read(char cbuf[]) throws IOException {
+ return read(cbuf, 0, cbuf.length);
+ }
+
+ public int read(char cbuf[], int off, int len) throws IOException {
+ int i = 0;
+ for (; i < len; i++) {
+ int nextChar = read();
+ if (nextChar == -1) {
+ if (i == 0) {
+ i = -1;
+ }
+ break;
+ }
+ cbuf[off + i] = (char) nextChar;
+ }
+ return i;
+ }
+
+ public void close() throws IOException {
+ this.pushbackReader.close();
+ }
+
+ public long skip(long n) throws IOException {
+ throw new UnsupportedOperationException("skip() not supported on TokenReplacingReader.");
+ }
+
+ public boolean ready() throws IOException {
+ return this.pushbackReader.ready();
+ }
+
+ public boolean markSupported() {
+ return false;
+ }
+
+ public void mark(int readAheadLimit) throws IOException {
+ throw new IOException("mark() not supported on TokenReplacingReader.");
+ }
+
+ public void reset() throws IOException {
+ throw new IOException("reset() not supported on TokenReplacingReader.");
+ }
+
+ private String readAll(Reader r) throws IOException {
+ int c;
+ StringBuilder bld = new StringBuilder();
+ while((c = r.read()) >= 0) {
+ bld.append((char)c);
+ }
+
+ return bld.toString();
+ }
+
+ private String resolveToken(String tokenName) throws IOException {
+ if (activeTokens.contains(tokenName)) {
+ throw new IllegalArgumentException("Token '" + tokenName + "' (indirectly) contains reference to itself in its value.");
+ }
+
+ activeTokens.push(tokenName);
+
+ String tokenValue = tokens.get(tokenName);
+
+ if (tokenValue != null) {
+ if (tokenValue.contains("${")) {
+ TokenReplacingReader childReader = new TokenReplacingReader(tokenValue, tokens, activeTokens, resolvedTokens);
+
+ tokenValue = readAll(childReader);
+ }
+ } else {
+ tokenValue = "${" + tokenName + "}";
+ }
+
+ resolvedTokens.put(tokenName, tokenValue);
+
+ activeTokens.pop();
+
+ return tokenValue;
+ }
+}
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 e0363af..908f7d7 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
@@ -60,7 +60,7 @@ import org.rhq.plugins.apache.util.HttpdAddressUtility;
import org.rhq.plugins.apache.util.ResourceTypes;
import org.rhq.plugins.apache.util.VHostSpec;
import org.rhq.test.ObjectCollectionSerializer;
-import org.rhq.test.TokenReplacingReader;
+import org.rhq.core.util.TokenReplacingReader;
import org.rhq.test.pc.PluginContainerTest;
public class ApacheTestSetup {
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 719a3dd..7c4eb1e 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
@@ -66,7 +66,7 @@ import org.rhq.plugins.apache.util.ApacheDeploymentUtil.DeploymentConfig;
import org.rhq.plugins.apache.util.ResourceTypes;
import org.rhq.plugins.apache.util.VHostSpec;
import org.rhq.plugins.apache.util.VirtualHostLegacyResourceKeyUtil;
-import org.rhq.test.TokenReplacingReader;
+import org.rhq.core.util.TokenReplacingReader;
import org.rhq.test.pc.PluginContainerTest;
diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
index d5a7e45..c7f176c 100644
--- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
+++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
@@ -44,8 +44,8 @@ import org.rhq.core.util.file.FileUtil;
import org.rhq.core.util.stream.StreamUtil;
import org.rhq.plugins.apache.util.HttpdAddressUtility.Address;
import org.rhq.test.PortScout;
-import org.rhq.test.TokenReplacingProperties;
-import org.rhq.test.TokenReplacingReader;
+import org.rhq.core.util.TokenReplacingProperties;
+import org.rhq.core.util.TokenReplacingReader;
/**
*
diff --git a/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingProperties.java b/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingProperties.java
deleted file mode 100644
index 5708ee3..0000000
--- a/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingProperties.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 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.test;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-
-/**
- * This map is basically an extension of the {@link Properties} class that can resolve the references
- * to values of other keys inside the values.
- * <p>
- * I.e., if the map is initialized with the following mappings:
- * <p>
- * <code>
- * name => world <br />
- * hello => Hello ${name}!
- * </code>
- * <p>
- * then the call to:
- * <p>
- * <code>
- * get("hello")
- * </code>
- * <p>
- * will return:
- * <code>
- * "Hello world!"
- * </code>
- * <p>
- * To access and modify the underlying unprocessed values, one can use the "raw" counterparts of the standard
- * map methods (e.g. instead of {@link #get(Object)}, use {@link #getRaw(Object)}, etc.).
- *
- * @author Lukas Krejci
- */
-public class TokenReplacingProperties extends HashMap<String, String> {
- private static final long serialVersionUID = 1L;
-
- private Map<String, String> wrapped;
- private Map<Object, String> resolved = new HashMap<Object, String>();
-
- private class Entry implements Map.Entry<String, String> {
- private Map.Entry<String, String> wrapped;
- private boolean process;
-
- public Entry(Map.Entry<String, String> wrapped, boolean process) {
- this.wrapped = wrapped;
- this.process = process;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
-
- if (!(obj instanceof Entry)) {
- return false;
- }
-
- Entry other = (Entry) obj;
-
- String key = wrapped.getKey();
- String otherKey = other.getKey();
- String value = getValue();
- String otherValue = other.getValue();
-
- return (key == null ? otherKey == null : key.equals(otherKey)) &&
- (value == null ? otherValue == null : value.equals(otherValue));
- }
-
- public String getKey() {
- return wrapped.getKey();
- }
-
- public String getValue() {
- if (process) {
- return get(wrapped.getKey());
- } else {
- return wrapped.getValue();
- }
- }
-
- @Override
- public int hashCode() {
- String key = wrapped.getKey();
- String value = getValue();
- return (key == null ? 0 : key.hashCode()) ^
- (value == null ? 0 : value.hashCode());
- }
-
- public String setValue(String value) {
- resolved.remove(wrapped.getKey());
- return wrapped.setValue(value);
- }
-
- @Override
- public String toString() {
- return wrapped.toString();
- }
- }
-
- public TokenReplacingProperties(Map<String, String> wrapped) {
- this.wrapped = wrapped;
- }
-
- @SuppressWarnings("unchecked")
- public TokenReplacingProperties(Properties properties) {
- @SuppressWarnings("rawtypes")
- Map map = properties;
- this.wrapped = (Map<String, String>) map;
- }
-
- @Override
- public String get(Object key) {
- if (resolved.containsKey(key)) {
- return resolved.get(key);
- }
-
- String rawValue = getRaw(key);
-
- if (rawValue == null) {
- return null;
- }
-
- String ret = readAll(new TokenReplacingReader(new StringReader(rawValue.toString()), this));
-
- resolved.put(key, ret);
-
- return ret;
- }
-
- public String getRaw(Object key) {
- return wrapped.get(key);
- }
-
- @Override
- public String put(String key, String value) {
- resolved.remove(key);
- return wrapped.put(key, value);
- }
-
- @Override
- public void putAll(Map<? extends String, ? extends String> m) {
- for(String key : m.keySet()) {
- resolved.remove(key);
- }
- wrapped.putAll(m);
- }
-
- public void putAll(Properties properties) {
- for(String propName : properties.stringPropertyNames()) {
- put(propName, properties.getProperty(propName));
- }
- }
-
- @Override
- public void clear() {
- wrapped.clear();
- resolved.clear();
- }
-
- @Override
- public boolean containsKey(Object key) {
- return wrapped.containsKey(key);
- }
-
- @Override
- public Set<String> keySet() {
- return wrapped.keySet();
- }
-
- @Override
- public boolean containsValue(Object value) {
- for(String key : keySet()) {
- String thisVal = get(key);
- if (thisVal == null) {
- if (value == null) {
- return true;
- }
- } else {
- if (thisVal.equals(value)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Checks whether this map contains the unprocessed value.
- *
- * @param value
- * @return
- */
- public boolean containsRawValue(Object value) {
- return wrapped.containsValue(value);
- }
-
- /**
- * The returned set <b>IS NOT</b> backed by this map
- * (unlike in the default map implementations).
- * <p>
- * The {@link java.util.Map.Entry#setValue(Object)} method
- * does modify this map though.
- */
- @Override
- public Set<Map.Entry<String, String>> entrySet() {
- Set<Map.Entry<String, String>> ret = new HashSet<Map.Entry<String, String>>();
- for(Map.Entry<String, String> entry : wrapped.entrySet()) {
- ret.add(new Entry(entry, true));
- }
-
- return ret;
- }
-
- public Set<Map.Entry<String, String>> getRawEntrySet() {
- Set<Map.Entry<String, String>> ret = new HashSet<Map.Entry<String, String>>();
- for(Map.Entry<String, String> entry : wrapped.entrySet()) {
- ret.add(new Entry(entry, false));
- }
-
- return ret;
- }
-
- @Override
- public String remove(Object key) {
- resolved.remove(key);
- return wrapped.remove(key).toString();
- }
-
- @Override
- public int size() {
- return wrapped.size();
- }
-
- /**
- * Unlike in the default implementation the collection returned
- * from this method <b>IS NOT</b> backed by this map.
- */
- @Override
- public Collection<String> values() {
- List<String> ret = new ArrayList<String>();
- for(String key : keySet()) {
- ret.add(get(key));
- }
-
- return ret;
- }
-
- public Collection<String> getRawValues() {
- List<String> ret = new ArrayList<String>();
- for(String key : keySet()) {
- ret.add(wrapped.get(key));
- }
-
- return ret;
- }
-
- private String readAll(Reader rdr) {
- int in = -1;
- StringBuilder bld = new StringBuilder();
- try {
- while ((in = rdr.read()) != -1) {
- bld.append((char) in);
- }
- } catch (IOException e) {
- throw new IllegalStateException("Exception while reading a string.", e);
- }
-
- return bld.toString();
- }
-}
\ No newline at end of file
diff --git a/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingReader.java b/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingReader.java
deleted file mode 100644
index bc5aef6..0000000
--- a/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingReader.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 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.test;
-
-import java.io.IOException;
-import java.io.PushbackReader;
-import java.io.Reader;
-import java.io.StringReader;
-import java.nio.CharBuffer;
-import java.util.ArrayDeque;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Copied from http://tutorials.jenkov.com/java-howto/replace-strings-in-streams-arrays-...
- * with fixes to {@link #read(char[], int, int)} and added support for escaping.
- *
- * @author Lukas Krejci
- */
-public class TokenReplacingReader extends Reader {
-
- private PushbackReader pushbackReader = null;
- private Map<String, String> tokens = null;
- private StringBuilder tokenNameBuffer = new StringBuilder();
- private String tokenValue = null;
- private int tokenValueIndex = 0;
- private boolean escaping = false;
- private Deque<String> activeTokens;
- private Map<String, String> resolvedTokens;
-
- public TokenReplacingReader(Reader source, Map<String, String> tokens) {
- this.pushbackReader = new PushbackReader(source, 2);
- this.tokens = tokens;
- this.activeTokens = new ArrayDeque<String>();
- this.resolvedTokens = new HashMap<String, String>();
- }
-
- protected TokenReplacingReader(String source, Map<String, String> tokens, Deque<String> activeTokens, Map<String, String> resolvedTokens) {
- pushbackReader = new PushbackReader(new StringReader(source));
- this.tokens = tokens;
- this.activeTokens = activeTokens;
- this.resolvedTokens = resolvedTokens;
- }
-
- public int read(CharBuffer target) throws IOException {
- throw new RuntimeException("Operation Not Supported");
- }
-
- public int read() throws IOException {
- if (this.tokenValue != null) {
- if (this.tokenValueIndex < this.tokenValue.length()) {
- return this.tokenValue.charAt(this.tokenValueIndex++);
- }
- if (this.tokenValueIndex == this.tokenValue.length()) {
- this.tokenValue = null;
- this.tokenValueIndex = 0;
- }
- }
-
- int data = this.pushbackReader.read();
-
- if (escaping) {
- escaping = false;
- return data;
- }
-
- if (data == '\\') {
- escaping = true;
- return data;
- }
-
- if (data != '$')
- return data;
-
- data = this.pushbackReader.read();
- if (data != '{') {
- this.pushbackReader.unread(data);
- return '$';
- }
- this.tokenNameBuffer.delete(0, this.tokenNameBuffer.length());
-
- data = this.pushbackReader.read();
- while (data != '}') {
- this.tokenNameBuffer.append((char) data);
- data = this.pushbackReader.read();
- }
-
- String tokenName = tokenNameBuffer.toString();
-
- if (resolvedTokens.containsKey(tokenName)) {
- tokenValue = resolvedTokens.get(tokenName);
- } else {
- tokenValue = resolveToken(tokenName);
- }
-
- tokenValueIndex = 0;
-
- if (!this.tokenValue.isEmpty()) {
- return this.tokenValue.charAt(this.tokenValueIndex++);
- } else {
- return read();
- }
- }
-
- public int read(char cbuf[]) throws IOException {
- return read(cbuf, 0, cbuf.length);
- }
-
- public int read(char cbuf[], int off, int len) throws IOException {
- int i = 0;
- for (; i < len; i++) {
- int nextChar = read();
- if (nextChar == -1) {
- if (i == 0) {
- i = -1;
- }
- break;
- }
- cbuf[off + i] = (char) nextChar;
- }
- return i;
- }
-
- public void close() throws IOException {
- this.pushbackReader.close();
- }
-
- public long skip(long n) throws IOException {
- throw new UnsupportedOperationException("skip() not supported on TokenReplacingReader.");
- }
-
- public boolean ready() throws IOException {
- return this.pushbackReader.ready();
- }
-
- public boolean markSupported() {
- return false;
- }
-
- public void mark(int readAheadLimit) throws IOException {
- throw new IOException("mark() not supported on TokenReplacingReader.");
- }
-
- public void reset() throws IOException {
- throw new IOException("reset() not supported on TokenReplacingReader.");
- }
-
- private String readAll(Reader r) throws IOException {
- int c;
- StringBuilder bld = new StringBuilder();
- while((c = r.read()) >= 0) {
- bld.append((char)c);
- }
-
- return bld.toString();
- }
-
- private String resolveToken(String tokenName) throws IOException {
- if (activeTokens.contains(tokenName)) {
- throw new IllegalArgumentException("Token '" + tokenName + "' (indirectly) contains reference to itself in its value.");
- }
-
- activeTokens.push(tokenName);
-
- String tokenValue = tokens.get(tokenName);
-
- if (tokenValue != null) {
- if (tokenValue.contains("${")) {
- TokenReplacingReader childReader = new TokenReplacingReader(tokenValue, tokens, activeTokens, resolvedTokens);
-
- tokenValue = readAll(childReader);
- }
- } else {
- tokenValue = "${" + tokenName + "}";
- }
-
- resolvedTokens.put(tokenName, tokenValue);
-
- activeTokens.pop();
-
- return tokenValue;
- }
-}
commit 2227cbc40dcfa6e922fbe8569e041b930bc2e627
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 27 09:02:48 2013 -0500
[BZ 923458] Roll back ant version to the latest version declared in child poms and not the root pom.
diff --git a/pom.xml b/pom.xml
index f3823c3..0a804a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -823,19 +823,19 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.4</version>
+ <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.8.4</version>
+ <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
- <version>1.8.1</version>
+ <version>1.8.0</version>
</dependency>
<dependency>
commit d15e5ceedb318119bc807d203f794ba56c0eabd3
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 27 08:56:49 2013 -0500
[BZ 923458] Revert ant version changes since they are used in bundles.
diff --git a/modules/common/ant-bundle/pom.xml b/modules/common/ant-bundle/pom.xml
index 26e7795..4cf6703 100644
--- a/modules/common/ant-bundle/pom.xml
+++ b/modules/common/ant-bundle/pom.xml
@@ -53,17 +53,20 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.8.0</version>
</dependency>
<!-- include some optional Ant tasks for users to be able to use -->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
+ <version>1.8.0</version>
</dependency>
<dependency>
diff --git a/modules/common/jboss-as/pom.xml b/modules/common/jboss-as/pom.xml
index a53545f..b9ee5be 100644
--- a/modules/common/jboss-as/pom.xml
+++ b/modules/common/jboss-as/pom.xml
@@ -16,8 +16,9 @@
<dependencies>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index f6d5f5a..085ba4c 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -37,8 +37,9 @@
<!-- 3rd Party Deps -->
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -46,9 +47,10 @@
<version>1.1.1</version>
</dependency>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
<scope>test</scope>
+ <version>1.6.5</version>
</dependency>
<dependency>
<groupId>i18nlog</groupId>
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index 4936d3f..0460892 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -63,13 +63,15 @@
<!-- we need to package this (and ant) in our module -->
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
@@ -134,11 +136,11 @@
<artifactId>rhq-jboss-as-dmr-client</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
</artifactItem>
<artifactItem>
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml b/modules/enterprise/server/plugins/ant-bundle/pom.xml
index 5227e8c..489b37b 100644
--- a/modules/enterprise/server/plugins/ant-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml
@@ -75,22 +75,26 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<!-- include some optional Ant tasks for users to be able to use -->
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
</artifactItem>
<artifactItem>
diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml
index ce163b8..ea20099 100644
--- a/modules/enterprise/server/plugins/groovy-script/pom.xml
+++ b/modules/enterprise/server/plugins/groovy-script/pom.xml
@@ -23,6 +23,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.opensymphony.quartz</groupId>
diff --git a/modules/helpers/perftest-support/pom.xml b/modules/helpers/perftest-support/pom.xml
index 43458a5..ed71426 100644
--- a/modules/helpers/perftest-support/pom.xml
+++ b/modules/helpers/perftest-support/pom.xml
@@ -14,12 +14,14 @@
</description>
<dependencies>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml
index cc1a8a5..9c3e48d 100644
--- a/modules/plugins/ant-bundle/pom.xml
+++ b/modules/plugins/ant-bundle/pom.xml
@@ -47,22 +47,26 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<!-- include some optional Ant tasks for users to be able to use -->
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
</artifactItem>
<artifactItem>
diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml
index abc21d5..d9838cf 100644
--- a/modules/plugins/jboss-as-5/pom.xml
+++ b/modules/plugins/jboss-as-5/pom.xml
@@ -187,8 +187,9 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>dom4j</groupId>
diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml
index 1fee627..bd58a06 100644
--- a/modules/plugins/jboss-as/pom.xml
+++ b/modules/plugins/jboss-as/pom.xml
@@ -124,8 +124,9 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>org.rhq</groupId>
@@ -150,8 +151,9 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>dom4j</groupId>
diff --git a/modules/plugins/raw-config-test/pom.xml b/modules/plugins/raw-config-test/pom.xml
index 19a48fe..c615a39 100644
--- a/modules/plugins/raw-config-test/pom.xml
+++ b/modules/plugins/raw-config-test/pom.xml
@@ -69,10 +69,12 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.7.1</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.7.1</version>
</artifactItem>
<artifactItem>
<groupId>commons-configuration</groupId>
commit 841631a84639d50e8a111b3574af1537d6fa6cb1
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 27 08:41:56 2013 -0500
Revert "fix installer ant references"
This reverts commit 9d24ff5f20e37996594ebc6fa2f9d9bcc7c955ca.
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index 185cafe..4936d3f 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -20,6 +20,7 @@
<properties>
<moduleName>org.rhq.${project.artifactId}</moduleName>
<moduleDir>org/rhq/${project.artifactId}</moduleDir>
+ <ant.version>1.6.5</ant.version> <!-- the version used by dbutils that we need to depend on -->
</properties>
<dependencies>
diff --git a/pom.xml b/pom.xml
index 665f7b8..f3823c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -156,7 +156,6 @@
<commons-validator.version>1.1.4</commons-validator.version>
<commons-collections.version>3.2.1</commons-collections.version>
<commons-configuration.version>1.6</commons-configuration.version>
- <ant.version>1.8.4</ant.version>
<junit.version>4.8.2</junit.version>
<liquibase-core.version>1.9.5</liquibase-core.version>
@@ -824,13 +823,13 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>${ant.version}</version>
+ <version>1.8.4</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>${ant.version}</version>
+ <version>1.8.4</version>
</dependency>
<dependency>
@@ -921,7 +920,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>${ant.version}</version>
+ <version>1.8.4</version>
</dependency>
<!-- This includes the <if> task, and a bunch of other handy tasks. -->
commit 354f2d4ced38e4eb7f75a56d6b33dfa6b37bc278
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 27 09:37:46 2013 -0400
put back commons-collection dep, it is needed by quartz
diff --git a/.classpath b/.classpath
index d35bf95..b060cc7 100644
--- a/.classpath
+++ b/.classpath
@@ -219,7 +219,7 @@
<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"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar" sourcepath="/M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar" sourcepath="/M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-jmx/4.2.3.GA/jboss-jmx-4.2.3.GA.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/tomcat/catalina/5.5.20/catalina-5.5.20.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar"/>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index 1a70da8..acb8931 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -285,6 +285,11 @@
<scope>provided</scope> <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
</dependency>
+ <!-- this is needed by quartz -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
<dependency>
<groupId>org.snmp4j</groupId>
commit 592dfd81a99ec6d2b1486f2a99aa1ff95e771e5b
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Mar 27 14:10:12 2013 +0100
Enabling two tests that test the edge cases for criteria queries. Tesing possible regression of BZ 923458. Also added 8 more combinations of page size, start page and count of filtered elements.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
index 3cadf38..cd2523e 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.TreeSet;
import org.testng.annotations.Test;
@@ -319,29 +320,87 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
}
});
}
-
-
+
@Test(groups = "integration.ejb3")
public void testParsingAllCriteriaQueryResults1() throws Exception {
- testParsingHelperStartingPageEqualTo(0);
+ int startPage = 0;
+ int pageSize = 3;
+ int serverCount = 605;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
}
-
- /**
- * This test should pass if enabled, but doesn't :(
- */
- @Test(groups = "integration.ejb3", enabled = false)
+
+ @Test(groups = "integration.ejb3", enabled = true)
public void testParsingAllCriteriaQueryResults2() throws Exception {
- testParsingHelperStartingPageEqualTo(1);
+ int startPage = 1;
+ int pageSize = 3;
+ int serverCount = 605;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
}
-
- /**
- * This test should pass if enabled, but doesn't :(
- */
- @Test(groups = "integration.ejb3", enabled = false)
+
+ @Test(groups = "integration.ejb3", enabled = true)
public void testParsingAllCriteriaQueryResults3() throws Exception {
- testParsingHelperStartingPageEqualTo(5);
+ int startPage = 2;
+ int pageSize = 3;
+ int serverCount = 609;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
}
-
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults4() throws Exception {
+ int startPage = 3;
+ int pageSize = 7;
+ int serverCount = 800;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults5() throws Exception {
+ int startPage = 4;
+ int pageSize = 2;
+ int serverCount = 444;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults6() throws Exception {
+ int startPage = 5;
+ int pageSize = 3;
+ int serverCount = 605;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults7() throws Exception {
+ int startPage = 1;
+ int pageSize = 5;
+ int serverCount = 934;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults8() throws Exception {
+ int startPage = 4;
+ int pageSize = 7;
+ int serverCount = 1234;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults9() throws Exception {
+ int startPage = 2;
+ int pageSize = 1;
+ int serverCount = 109;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults10() throws Exception {
+ int startPage = 0;
+ int pageSize = 11;
+ int serverCount = 999;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
@Test(groups = "integration.ejb3")
public void testFindNonExistentServer() throws Exception {
@@ -390,19 +449,17 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
}
- private void testParsingHelperStartingPageEqualTo(final int startPage) throws Exception {
+ private void testParsingHelperStartingPageEqualTo(final int startPage, final int pageSize, final int serverCount) throws Exception {
- final int serverCount = 605;
- final int pageSize = 3;
executeInTransaction(new TransactionCallback() {
public void execute() throws Exception {
// verify that all server objects are actually parsed.
- final Set<String> serverNames = new HashSet<String>(serverCount);
+ final Set<String> serverNames = new TreeSet<String>();
final String namePrefix = "server";
final String addressPrefix = "address";
int shouldBeFoundCount = 0;
int shouldBeSkipped = pageSize * startPage;
-
+
for (int i = 0; i < serverCount; i++) {
String name = namePrefix + String.format(" %03d", i + 1);
Server server = new Server();
@@ -413,7 +470,7 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
break;
case 1:
server.setOperationMode(OperationMode.MAINTENANCE);
- if (i % 20 == 9 && shouldBeSkipped-- <= 0) {
+ if (i % 20 == 9) {
shouldBeFoundCount++;
serverNames.add(name);
}
@@ -427,6 +484,15 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
em.flush();
}
em.flush();
+
+ if (shouldBeSkipped > 0) {
+ // delete the members to be skipped because of the start page
+ String[] serverNamesArray = serverNames.toArray(new String[serverNames.size()]);
+ for (int i = 0; i < shouldBeSkipped; i++) {
+ serverNames.remove(serverNamesArray[serverNamesArray.length - i - 1]);
+ }
+ shouldBeFoundCount -= shouldBeSkipped;
+ }
// query the results and delete the servers
ServerCriteria criteria = new ServerCriteria();
@@ -466,7 +532,7 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
serverNames.remove(s.getName());
}
- final int finderCallCounter = (int) Math.ceil((double) shouldBeFoundCount / pageSize) - startPage;
+ final int finderCallCounter = (int) Math.ceil((double) shouldBeFoundCount / pageSize);
assertTrue("While iterating the servers, the findServersByCriteria() should be called "
+ finderCallCounter + " times. It was called " + pagesFlipped.get(0) + " times.",
pagesFlipped.get(0) == finderCallCounter);
commit 902ce81c0fa6e6f0b66091c77977c68a05c3248d
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Mar 27 14:06:42 2013 +0100
[BZ 923458] - CriteriaQuery based finder fails if the start page is not zero and the totalSize is dividable by pageSize - Changing the initial value of variable count. It takes into consideration the possible offset made by using the non-zero start page set in the criteria.
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 ab6a915..2d40388 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
@@ -110,6 +110,7 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
public QueryResultsIterator(PageList<T> firstPage) {
currentPage = firstPage;
iterator = currentPage.iterator();
+ count = firstPage == null || firstPage.getPageControl() == null ? 0 : firstPage.getPageControl().getStartRow();
}
@Override
commit 9d24ff5f20e37996594ebc6fa2f9d9bcc7c955ca
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 26 16:46:43 2013 -0400
fix installer ant references
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index 4936d3f..185cafe 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -20,7 +20,6 @@
<properties>
<moduleName>org.rhq.${project.artifactId}</moduleName>
<moduleDir>org/rhq/${project.artifactId}</moduleDir>
- <ant.version>1.6.5</ant.version> <!-- the version used by dbutils that we need to depend on -->
</properties>
<dependencies>
diff --git a/pom.xml b/pom.xml
index f3823c3..665f7b8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -156,6 +156,7 @@
<commons-validator.version>1.1.4</commons-validator.version>
<commons-collections.version>3.2.1</commons-collections.version>
<commons-configuration.version>1.6</commons-configuration.version>
+ <ant.version>1.8.4</ant.version>
<junit.version>4.8.2</junit.version>
<liquibase-core.version>1.9.5</liquibase-core.version>
@@ -823,13 +824,13 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.4</version>
+ <version>${ant.version}</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.8.4</version>
+ <version>${ant.version}</version>
</dependency>
<dependency>
@@ -920,7 +921,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.4</version>
+ <version>${ant.version}</version>
</dependency>
<!-- This includes the <if> task, and a bunch of other handy tasks. -->
commit 018955418ebd767b1996caac1729bfda58ece561
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Mar 26 18:29:38 2013 +0100
Changing the return type in for the findOperationDefinitionsByCriteria() signature from List to PageList. Now there is no need to overcast the result.
diff --git a/modules/enterprise/server/jar/intentional-api-changes-since-4.6.0.xml b/modules/enterprise/server/jar/intentional-api-changes-since-4.6.0.xml
index e675d9a..21dc048 100644
--- a/modules/enterprise/server/jar/intentional-api-changes-since-4.6.0.xml
+++ b/modules/enterprise/server/jar/intentional-api-changes-since-4.6.0.xml
@@ -6,4 +6,11 @@
<method>void uninventoryAllResourcesByAgent(org.rhq.core.domain.auth.Subject, org.rhq.core.domain.resource.Agent)</method>
<justification>Adding a method to a remote API interface is safe. This class is never to be implemented by users.</justification>
</difference>
+ <difference>
+ <className>org/rhq/enterprise/server/operation/OperationManagerRemote</className>
+ <differenceType>7006</differenceType> <!-- method added to an interface -->
+ <method>java.util.List findOperationDefinitionsByCriteria(org.rhq.core.domain.auth.Subject, org.rhq.core.domain.criteria.OperationDefinitionCriteria)</method>
+ <to>org.rhq.core.domain.util.PageList</to>
+ <justification>Method Return Type changed. Returning the PageList instead of List. PageList is assignable to a List variable, therefore this change is safe.</justification>
+ </difference>
</differences>
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java
index e7151fb..088f13e 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerBean.java
@@ -1994,17 +1994,15 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan
}
}
- @SuppressWarnings("unchecked")
- public List<OperationDefinition> findOperationDefinitionsByCriteria(Subject subject,
+ public PageList<OperationDefinition> findOperationDefinitionsByCriteria(Subject subject,
OperationDefinitionCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
- CriteriaQueryRunner<OperationDefinition> queryRunner = new CriteriaQueryRunner(criteria, generator,
+ CriteriaQueryRunner<OperationDefinition> queryRunner = new CriteriaQueryRunner<OperationDefinition>(criteria, generator,
entityManager);
return queryRunner.execute();
}
- @SuppressWarnings("unchecked")
public PageList<ResourceOperationHistory> findResourceOperationHistoriesByCriteria(Subject subject,
ResourceOperationHistoryCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
@@ -2013,12 +2011,11 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan
subject.getId());
}
- CriteriaQueryRunner<ResourceOperationHistory> queryRunner = new CriteriaQueryRunner(criteria, generator,
+ CriteriaQueryRunner<ResourceOperationHistory> queryRunner = new CriteriaQueryRunner<ResourceOperationHistory>(criteria, generator,
entityManager);
return queryRunner.execute();
}
- @SuppressWarnings("unchecked")
public PageList<GroupOperationHistory> findGroupOperationHistoriesByCriteria(Subject subject,
GroupOperationHistoryCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
@@ -2027,7 +2024,7 @@ public class OperationManagerBean implements OperationManagerLocal, OperationMan
subject.getId());
}
- CriteriaQueryRunner<GroupOperationHistory> queryRunner = new CriteriaQueryRunner(criteria, generator,
+ CriteriaQueryRunner<GroupOperationHistory> queryRunner = new CriteriaQueryRunner<GroupOperationHistory>(criteria, generator,
entityManager);
return queryRunner.execute();
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerLocal.java
index bce2a18..2d1ea239 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerLocal.java
@@ -740,7 +740,7 @@ public interface OperationManagerLocal {
*/
void unscheduleGroupOperation(Subject subject, String jobId, int resourceGroupId) throws UnscheduleException;
- List<OperationDefinition> findOperationDefinitionsByCriteria(Subject subject, OperationDefinitionCriteria criteria);
+ PageList<OperationDefinition> findOperationDefinitionsByCriteria(Subject subject, OperationDefinitionCriteria criteria);
PageList<ResourceOperationHistory> findResourceOperationHistoriesByCriteria(Subject subject,
ResourceOperationHistoryCriteria criteria);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerRemote.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerRemote.java
index 8a4bf1d..3c6e81d 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerRemote.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationManagerRemote.java
@@ -267,7 +267,7 @@ public interface OperationManagerRemote {
List<GroupOperationSchedule> findScheduledGroupOperations(Subject subject, int groupId) throws Exception;
- List<OperationDefinition> findOperationDefinitionsByCriteria(Subject subject, OperationDefinitionCriteria criteria);
+ PageList<OperationDefinition> findOperationDefinitionsByCriteria(Subject subject, OperationDefinitionCriteria criteria);
PageList<ResourceOperationHistory> findResourceOperationHistoriesByCriteria(Subject subject,
ResourceOperationHistoryCriteria criteria);
commit 3b9efe8bbf6e88ab90c0e25b289e3598d90d0d7f
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 26 15:21:21 2013 -0400
BZ 824010 - don't do this yet - it will blow away native prefs and we don't want to support this file based prefs yet
diff --git a/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml b/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml
index 6601de3..a24f374 100644
--- a/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml
+++ b/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml
@@ -133,7 +133,9 @@
</copy>
<!-- if necessary, migrate native prefs into our file prefs (since RHQ 4.7) -->
+ <!--
<migrate-agent-preferences todir="${_update.tmp.dir}/rhq-agent/conf" />
+ -->
<!-- if there are any Windows wrapper environment or include files, copy them -->
<echo>Copy existing Java Service Wrapper configuration files from the old agent to the new agent</echo>
@@ -342,4 +344,4 @@ Jar File: ${rhq.agent.update.jar-file}
<target name="process-exit-code-unix" if="_launcher.unix.successful">
<echo>Launched Unix agent successfully</echo>
</target>
-</project>
\ No newline at end of file
+</project>
commit 3354fcc2e4f806194b523942ccb63ca6adf00415
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Tue Mar 26 12:21:50 2013 -0500
[BZ 923458] More maven dependency and plugin version updates.
diff --git a/code-coverage/pom.xml b/code-coverage/pom.xml
index cacf523..efa72b1 100644
--- a/code-coverage/pom.xml
+++ b/code-coverage/pom.xml
@@ -18,7 +18,7 @@
<property>
<name>code-coverage</name>
</property>
- </activation>
+ </activation>
<build>
<plugins>
<plugin>
@@ -60,7 +60,6 @@
<artifactItem>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
- <version>${jacoco.version}</version>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
@@ -179,7 +178,7 @@
<include name="**/target/generated-sources/*" />
</dirset>
</sourcefiles>
- </group>
+ </group>
</structure>
<html destdir="${project.reporting.outputDirectory}/coverage-report/overall" />
<xml destfile="${project.reporting.outputDirectory}/coverage-report/overall/coverage-report.xml" />
@@ -193,7 +192,6 @@
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
- <version>${jacoco.version}</version>
</dependency>
</dependencies>
</plugin>
@@ -202,4 +200,3 @@
</profile>
</profiles>
</project>
-
\ No newline at end of file
diff --git a/etc/classloaders-test/plugin1/pom.xml b/etc/classloaders-test/plugin1/pom.xml
index 3521a91..cc0dd51 100644
--- a/etc/classloaders-test/plugin1/pom.xml
+++ b/etc/classloaders-test/plugin1/pom.xml
@@ -74,24 +74,6 @@
<scope>provided</scope>
</dependency>
- <!--
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency>
- -->
-
- <!--
- <dependency>
- <groupId>i18nlog</groupId>
- <artifactId>i18nlog</artifactId>
- <version>1.0.9</version>
- <scope>provided</scope>
- </dependency>
- -->
-
<!-- Define any third-party dependencies your plugin has here. -->
<dependency>
<groupId>dummy</groupId>
diff --git a/etc/classloaders-test/plugin2/pom.xml b/etc/classloaders-test/plugin2/pom.xml
index 7c2add2..e4549d3 100644
--- a/etc/classloaders-test/plugin2/pom.xml
+++ b/etc/classloaders-test/plugin2/pom.xml
@@ -74,24 +74,6 @@
<scope>provided</scope>
</dependency>
- <!--
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- <scope>provided</scope>
- </dependency>
- -->
-
- <!--
- <dependency>
- <groupId>i18nlog</groupId>
- <artifactId>i18nlog</artifactId>
- <version>1.0.9</version>
- <scope>provided</scope>
- </dependency>
- -->
-
<!-- Define any third-party dependencies your plugin has here. -->
<dependency>
<groupId>dummy</groupId>
diff --git a/modules/common/ant-bundle/pom.xml b/modules/common/ant-bundle/pom.xml
index 4cf6703..26e7795 100644
--- a/modules/common/ant-bundle/pom.xml
+++ b/modules/common/ant-bundle/pom.xml
@@ -53,20 +53,17 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.8.0</version>
</dependency>
<!-- include some optional Ant tasks for users to be able to use -->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
- <version>1.8.0</version>
</dependency>
<dependency>
diff --git a/modules/common/jboss-as/pom.xml b/modules/common/jboss-as/pom.xml
index d3bf151..a53545f 100644
--- a/modules/common/jboss-as/pom.xml
+++ b/modules/common/jboss-as/pom.xml
@@ -16,10 +16,10 @@
<dependencies>
<dependency>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.6.5</version>
</dependency>
+
<dependency>
<groupId>jboss</groupId>
<artifactId>jbpm</artifactId>
diff --git a/modules/core/client-api/pom.xml b/modules/core/client-api/pom.xml
index c03f268..acd19c9 100644
--- a/modules/core/client-api/pom.xml
+++ b/modules/core/client-api/pom.xml
@@ -49,7 +49,6 @@
<dependency>
<groupId>commons-jxpath</groupId>
<artifactId>commons-jxpath</artifactId>
- <version>1.3</version>
<scope>test</scope>
</dependency>
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 41351ed..f6d5f5a 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -34,12 +34,11 @@
<artifactId>rhq-core-util</artifactId>
<version>${project.version}</version>
</dependency>
-
+
<!-- 3rd Party Deps -->
<dependency>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.6.5</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -47,9 +46,8 @@
<version>1.1.1</version>
</dependency>
<dependency>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.6.5</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/modules/core/gui/pom.xml b/modules/core/gui/pom.xml
index 365535a..b3b7706 100644
--- a/modules/core/gui/pom.xml
+++ b/modules/core/gui/pom.xml
@@ -16,10 +16,6 @@
<description>JSF utility classes, validators, converters, etc. that are used by both enterprise and embedded
</description>
- <properties>
- <!-- dependency versions -->
- <el.version>1.0</el.version>
- </properties>
<dependencies>
@@ -65,9 +61,7 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
- <version>2.0</version>
<scope>provided</scope>
- <!-- by JBossAS -->
</dependency>
<dependency>
diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml
index d1200f6..cb1fad0 100644
--- a/modules/enterprise/agent/pom.xml
+++ b/modules/enterprise/agent/pom.xml
@@ -63,7 +63,6 @@
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
- <version>${jline.version}</version>
</dependency>
<!-- 3rd Party Deps -->
@@ -87,7 +86,6 @@
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
- <version>${jboss-logging.version}</version> <!-- just using the one that is also used by AS7 -->
</dependency>
</dependencies>
diff --git a/modules/enterprise/agentupdate/pom.xml b/modules/enterprise/agentupdate/pom.xml
index 3b66b92..ddec938 100644
--- a/modules/enterprise/agentupdate/pom.xml
+++ b/modules/enterprise/agentupdate/pom.xml
@@ -37,14 +37,12 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>${ant.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>${ant.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml
index 822d405..c312dc1 100644
--- a/modules/enterprise/comm/pom.xml
+++ b/modules/enterprise/comm/pom.xml
@@ -43,7 +43,6 @@
<dependency>
<groupId>dom4j</groupId>
<artifactId>dom4j</artifactId>
- <version>1.6</version>
<exclusions>
<exclusion>
<groupId>xml-apis</groupId>
@@ -87,7 +86,6 @@
<dependency>
<groupId>oswego-concurrent</groupId>
<artifactId>concurrent</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
</dependency>
</dependencies>
diff --git a/modules/enterprise/gui/content_http-war/pom.xml b/modules/enterprise/gui/content_http-war/pom.xml
index 19208e8..333aa5d 100644
--- a/modules/enterprise/gui/content_http-war/pom.xml
+++ b/modules/enterprise/gui/content_http-war/pom.xml
@@ -62,7 +62,7 @@
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
- <!-- adding so we can extend DefaultServlet
+ <!-- adding so we can extend DefaultServlet
Chose version 2.0.1 so it's compatible with info here for JBoss 4.2.3
http://community.jboss.org/wiki/VersionOfTomcatInJBossAS-->
<dependency>
@@ -76,11 +76,10 @@
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
</dependency>
-
+
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
- <version>1.2</version>
</dependency>
<dependency>
@@ -104,7 +103,6 @@
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
- <version>1.1.4</version>
</dependency>
<dependency>
@@ -120,7 +118,6 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1-alpha-1</version>
<configuration>
<archive>
<manifest>
diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml
index d890830..a3dfde1 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -151,7 +151,6 @@
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
- <version>1.2</version>
</dependency>
<dependency>
diff --git a/modules/enterprise/gui/portal-war/pom.xml b/modules/enterprise/gui/portal-war/pom.xml
index 6c12259..4ee28ed 100644
--- a/modules/enterprise/gui/portal-war/pom.xml
+++ b/modules/enterprise/gui/portal-war/pom.xml
@@ -17,7 +17,6 @@
<properties>
<!-- dependency versions -->
- <el.version>1.0</el.version>
<jsf-facelets.version>1.1.15.B1</jsf-facelets.version>
<!-- plugin versions -->
@@ -75,19 +74,16 @@
<dependency>
<groupId>commons-dbcp</groupId>
<artifactId>commons-dbcp</artifactId>
- <version>1.2.1</version>
</dependency>
<dependency>
<groupId>commons-el</groupId>
<artifactId>commons-el</artifactId>
- <version>1.0</version>
</dependency>
<dependency>
<groupId>commons-fileupload</groupId>
<artifactId>commons-fileupload</artifactId>
- <version>1.2</version>
</dependency>
<dependency>
@@ -129,7 +125,6 @@
<dependency>
<groupId>javax.el</groupId>
<artifactId>el-api</artifactId>
- <version>${el.version}</version>
<scope>provided</scope> <!-- by JBossAS Tomcat -->
</dependency>
@@ -143,7 +138,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jsp-api</artifactId>
- <version>2.0</version>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
@@ -289,7 +283,6 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.6.4</version>
</dependency>
</dependencies>
diff --git a/modules/enterprise/gui/remoting-war/pom.xml b/modules/enterprise/gui/remoting-war/pom.xml
index 9570336..70ece03 100644
--- a/modules/enterprise/gui/remoting-war/pom.xml
+++ b/modules/enterprise/gui/remoting-war/pom.xml
@@ -29,7 +29,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
- <version>3.0.1</version>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
</dependencies>
diff --git a/modules/enterprise/gui/rest-war/pom.xml b/modules/enterprise/gui/rest-war/pom.xml
index 0797145..5d3dbfc 100644
--- a/modules/enterprise/gui/rest-war/pom.xml
+++ b/modules/enterprise/gui/rest-war/pom.xml
@@ -35,7 +35,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
- <version>3.0.1</version>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
@@ -48,7 +47,6 @@
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.1_spec</artifactId>
- <version>1.0.2.Final</version>
</dependency>
</dependencies>
diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml
index fc164c9..e371826 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -57,20 +57,16 @@
<dependency>
<groupId>jline</groupId>
<artifactId>jline</artifactId>
- <version>${jline.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>${testng.version}</version>
- <!-- Yes, this is actually meant to be compile, and not test, scoped. -->
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>${log4j.version}</version>
<scope>runtime</scope>
</dependency>
diff --git a/modules/enterprise/remoting/client-deps/pom.xml b/modules/enterprise/remoting/client-deps/pom.xml
index 61b7c19..b411a87 100644
--- a/modules/enterprise/remoting/client-deps/pom.xml
+++ b/modules/enterprise/remoting/client-deps/pom.xml
@@ -45,11 +45,11 @@
</exclusion>
</exclusions>
</dependency>
- <dependency>
- <groupId>oswego-concurrent</groupId>
- <artifactId>concurrent</artifactId>
- <version>1.3.4-jboss-update1</version>
- </dependency>
+
+ <dependency>
+ <groupId>oswego-concurrent</groupId>
+ <artifactId>concurrent</artifactId>
+ </dependency>
<dependency>
<groupId>i18nlog</groupId>
diff --git a/modules/enterprise/scripting/javascript/pom.xml b/modules/enterprise/scripting/javascript/pom.xml
index b1d6553..32eb12d 100644
--- a/modules/enterprise/scripting/javascript/pom.xml
+++ b/modules/enterprise/scripting/javascript/pom.xml
@@ -36,7 +36,6 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>jarjar-maven-plugin</artifactId>
- <version>1.5</version>
<executions>
<execution>
<phase>package</phase>
diff --git a/modules/enterprise/scripting/python/pom.xml b/modules/enterprise/scripting/python/pom.xml
index 8e7ff39..f6a1149c 100644
--- a/modules/enterprise/scripting/python/pom.xml
+++ b/modules/enterprise/scripting/python/pom.xml
@@ -35,7 +35,6 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>jarjar-maven-plugin</artifactId>
- <version>1.5</version>
<executions>
<execution>
<phase>package</phase>
diff --git a/modules/enterprise/server/client-api/pom.xml b/modules/enterprise/server/client-api/pom.xml
index c645073..6bb6ea2 100644
--- a/modules/enterprise/server/client-api/pom.xml
+++ b/modules/enterprise/server/client-api/pom.xml
@@ -31,7 +31,6 @@
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
- <version>1.0</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index 5e5cdd1..4936d3f 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -63,15 +63,13 @@
<!-- we need to package this (and ant) in our module -->
<dependency>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>${ant.version}</version>
</dependency>
<dependency>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>${ant.version}</version>
</dependency>
<dependency>
@@ -136,11 +134,11 @@
<artifactId>rhq-jboss-as-dmr-client</artifactId>
</artifactItem>
<artifactItem>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
</artifactItem>
<artifactItem>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</artifactItem>
<artifactItem>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index b86af52..1a70da8 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -175,15 +175,10 @@
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
- <version>1.6.1</version>
</dependency>
<!-- Required by a couple APL classes - TODO: Remove this once APL has been removed. -->
<!-- also required by EJB3 Embedded (test scope) -->
- <dependency>
- <groupId>commons-collections</groupId>
- <artifactId>commons-collections</artifactId>
- </dependency>
<dependency>
<groupId>commons-httpclient</groupId>
@@ -290,13 +285,6 @@
<scope>provided</scope> <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
</dependency>
- <dependency>
- <groupId>org.easymock</groupId>
- <artifactId>easymockclassextension</artifactId>
- <version>2.2</version>
- <scope>test</scope>
- <!-- somehow this is needed otherwise the hibernate stuff doesn't initialize in our tests -->
- </dependency>
<dependency>
<groupId>org.snmp4j</groupId>
@@ -308,7 +296,6 @@
<dependency>
<groupId>oswego-concurrent</groupId>
<artifactId>concurrent</artifactId>
- <version>1.3.4</version>
</dependency>
<dependency>
@@ -868,7 +855,6 @@
<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
- <version>${jboss-logging.version}</version>
</dependency>
</dependencies>
@@ -996,7 +982,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
- <version>${clirr.version}</version>
<configuration>
<includes>
<include>**/*Remote</include>
diff --git a/modules/enterprise/server/plugins/alert-roles/pom.xml b/modules/enterprise/server/plugins/alert-roles/pom.xml
index 4f8c6a5..31acb49 100644
--- a/modules/enterprise/server/plugins/alert-roles/pom.xml
+++ b/modules/enterprise/server/plugins/alert-roles/pom.xml
@@ -18,7 +18,6 @@
<dependency>
<groupId>jboss.jboss-embeddable-ejb3</groupId>
<artifactId>jboss-ejb3-all</artifactId>
- <version>1.0.0.Alpha9</version>
<scope>compile</scope>
</dependency>
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml b/modules/enterprise/server/plugins/ant-bundle/pom.xml
index 4226e21..5227e8c 100644
--- a/modules/enterprise/server/plugins/ant-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml
@@ -75,20 +75,17 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.8.0</version>
</artifactItem>
<!-- include some optional Ant tasks for users to be able to use -->
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
- <version>1.8.0</version>
</artifactItem>
<artifactItem>
diff --git a/modules/enterprise/server/plugins/cobbler/pom.xml b/modules/enterprise/server/plugins/cobbler/pom.xml
index 2c81751..94cbe7d 100644
--- a/modules/enterprise/server/plugins/cobbler/pom.xml
+++ b/modules/enterprise/server/plugins/cobbler/pom.xml
@@ -30,7 +30,6 @@
<dependency>
<groupId>jboss.jboss-embeddable-ejb3</groupId>
<artifactId>jboss-ejb3-all</artifactId>
- <version>1.0.0.Alpha9</version>
<scope>compile</scope>
</dependency>
</dependencies>
diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml
index ea20099..ce163b8 100644
--- a/modules/enterprise/server/plugins/groovy-script/pom.xml
+++ b/modules/enterprise/server/plugins/groovy-script/pom.xml
@@ -23,7 +23,6 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.opensymphony.quartz</groupId>
diff --git a/modules/enterprise/server/sars/agent-sar/pom.xml b/modules/enterprise/server/sars/agent-sar/pom.xml
index 6f2cc2e..e5639f9 100644
--- a/modules/enterprise/server/sars/agent-sar/pom.xml
+++ b/modules/enterprise/server/sars/agent-sar/pom.xml
@@ -36,7 +36,6 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <!-- make sure you match that which is used by standalone agent! -->
</dependency>
<dependency>
diff --git a/modules/helpers/perftest-support/pom.xml b/modules/helpers/perftest-support/pom.xml
index 4136b47..43458a5 100644
--- a/modules/helpers/perftest-support/pom.xml
+++ b/modules/helpers/perftest-support/pom.xml
@@ -14,14 +14,12 @@
</description>
<dependencies>
<dependency>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.6.5</version>
</dependency>
<dependency>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.6.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
@@ -68,7 +66,6 @@
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
- <version>1.0</version>
</dependency>
<dependency>
<groupId>org.rhq</groupId>
diff --git a/modules/helpers/rest-docs-generator/pom.xml b/modules/helpers/rest-docs-generator/pom.xml
index 1dff5bd..e72aab4 100644
--- a/modules/helpers/rest-docs-generator/pom.xml
+++ b/modules/helpers/rest-docs-generator/pom.xml
@@ -51,7 +51,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>3.0</version>
<executions>
<execution>
<!-- Compile the sources i.e. the processor 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 9469947..03dfcc9 100644
--- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
+++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
@@ -24,7 +24,6 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>1.2.14</version>
<scope>runtime</scope>
</dependency>
diff --git a/modules/integration-tests/mod_cluster-plugin-test/pom.xml b/modules/integration-tests/mod_cluster-plugin-test/pom.xml
index b3370a3..e09207a 100644
--- a/modules/integration-tests/mod_cluster-plugin-test/pom.xml
+++ b/modules/integration-tests/mod_cluster-plugin-test/pom.xml
@@ -57,7 +57,7 @@
<version>${project.version}</version>
<scope>provided</scope>
</dependency>
-
+
<dependency>
<groupId>org.jboss.on</groupId>
<artifactId>jopr-tomcat-plugin</artifactId>
@@ -113,7 +113,6 @@
<dependency>
<groupId>oswego-concurrent</groupId>
<artifactId>concurrent</artifactId>
- <version>1.3.4-jboss</version>
<scope>test</scope>
</dependency>
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml
index 0c750b6..cc1a8a5 100644
--- a/modules/plugins/ant-bundle/pom.xml
+++ b/modules/plugins/ant-bundle/pom.xml
@@ -47,20 +47,17 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.8.0</version>
</artifactItem>
<!-- include some optional Ant tasks for users to be able to use -->
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
- <version>1.8.0</version>
</artifactItem>
<artifactItem>
diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml
index 3eb65a7..abc21d5 100644
--- a/modules/plugins/jboss-as-5/pom.xml
+++ b/modules/plugins/jboss-as-5/pom.xml
@@ -187,9 +187,8 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>dom4j</groupId>
@@ -443,14 +442,14 @@
</properties>
<dependencies>
-
+
<dependency>
<groupId>org.jboss.shrinkwrap.resolver</groupId>
<artifactId>shrinkwrap-resolver-depchain</artifactId>
<type>pom</type>
<scope>test</scope>
</dependency>
-
+
</dependencies>
<build>
@@ -665,7 +664,7 @@
</plugins>
</build>
- </profile>
+ </profile>
</profiles>
diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml
index 8a5b6c9..1fee627 100644
--- a/modules/plugins/jboss-as/pom.xml
+++ b/modules/plugins/jboss-as/pom.xml
@@ -18,7 +18,7 @@
<properties>
<rhq.internal>false</rhq.internal>
</properties>
-
+
<dependencies>
<!-- internal -->
<!-- TODO: Move this up to the parent pom. -->
@@ -99,7 +99,7 @@
</goals>
<configuration>
<artifactItems>
- <!--
+ <!--
<artifactItem>
<groupId>jboss</groupId>
<artifactId>jboss-common</artifactId>
@@ -124,9 +124,8 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>org.rhq</groupId>
@@ -151,9 +150,8 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>dom4j</groupId>
@@ -197,7 +195,7 @@
<executions>
<execution>
<phase>pre-integration-test</phase>
-
+
<configuration>
<target>
<echo>Setting up plugin dependencies...</echo>
diff --git a/modules/plugins/jboss-cache-v3/pom.xml b/modules/plugins/jboss-cache-v3/pom.xml
index 34bdffe..c83611c 100644
--- a/modules/plugins/jboss-cache-v3/pom.xml
+++ b/modules/plugins/jboss-cache-v3/pom.xml
@@ -114,7 +114,6 @@
<dependency>
<groupId>oswego-concurrent</groupId>
<artifactId>concurrent</artifactId>
- <version>1.3.4-jboss</version>
<scope>test</scope>
</dependency>
@@ -494,7 +493,7 @@
</build>
</profile>
</profiles>
-
+
<reporting>
<plugins>
<plugin>
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index 9af3938..9d6a147 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -60,7 +60,6 @@
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
- <version>1.0</version>
<scope>provided</scope> <!-- by RHQ container -->
</dependency>
diff --git a/modules/plugins/raw-config-test/pom.xml b/modules/plugins/raw-config-test/pom.xml
index c615a39..19a48fe 100644
--- a/modules/plugins/raw-config-test/pom.xml
+++ b/modules/plugins/raw-config-test/pom.xml
@@ -69,12 +69,10 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.7.1</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.7.1</version>
</artifactItem>
<artifactItem>
<groupId>commons-configuration</groupId>
diff --git a/modules/test-utils/pom.xml b/modules/test-utils/pom.xml
index 07e3aa1..f536119 100644
--- a/modules/test-utils/pom.xml
+++ b/modules/test-utils/pom.xml
@@ -17,7 +17,6 @@
<dependency>
<groupId>javax.persistence</groupId>
<artifactId>persistence-api</artifactId>
- <version>1.0</version>
</dependency>
<dependency>
<groupId>javax.transaction</groupId>
@@ -37,7 +36,6 @@
<dependency>
<groupId>commons-beanutils</groupId>
<artifactId>commons-beanutils</artifactId>
- <version>1.8.2</version>
</dependency>
<dependency>
<groupId>org.unitils</groupId>
diff --git a/pom.xml b/pom.xml
index 0d6a847..f3823c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -163,6 +163,7 @@
<servlet-api.version>2.4</servlet-api.version>
<mockito-core.version>1.9.0</mockito-core.version>
+ <el.version>1.0</el.version>
<rhq.db.admin.username>rhqadmin</rhq.db.admin.username>
<rhq.db.admin.password>rhqadmin</rhq.db.admin.password>
@@ -447,6 +448,12 @@
<version>${commons-httpclient.version}</version>
</dependency>
+ <dependency>
+ <groupId>commons-beanutils</groupId>
+ <artifactId>commons-beanutils</artifactId>
+ <version>1.8.2</version>
+ </dependency>
+
<!-- GNU GetOpt (any modules that need to do command-line argument parsing should use this) -->
<dependency>
<groupId>gnu-getopt</groupId>
@@ -764,6 +771,102 @@
<artifactId>log4j</artifactId>
<version>${log4j.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.jacoco</groupId>
+ <artifactId>org.jacoco.ant</artifactId>
+ <version>${jacoco.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-jxpath</groupId>
+ <artifactId>commons-jxpath</artifactId>
+ <version>1.3</version>
+ </dependency>
+ <dependency>
+ <groupId>javax.persistence</groupId>
+ <artifactId>persistence-api</artifactId>
+ <version>1.0</version>
+ <scope>provided</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>jsp-api</artifactId>
+ <version>2.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-fileupload</groupId>
+ <artifactId>commons-fileupload</artifactId>
+ <version>1.2</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jline</groupId>
+ <artifactId>jline</artifactId>
+ <version>${jline.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>jboss.jboss-embeddable-ejb3</groupId>
+ <artifactId>jboss-ejb3-all</artifactId>
+ <version>1.0.0.Alpha9</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.logging</groupId>
+ <artifactId>jboss-logging</artifactId>
+ <version>${jboss-logging.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant</artifactId>
+ <version>1.8.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-launcher</artifactId>
+ <version>1.8.4</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.apache.ant</groupId>
+ <artifactId>ant-nodeps</artifactId>
+ <version>1.8.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>dom4j</groupId>
+ <artifactId>dom4j</artifactId>
+ <version>1.6</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-dbcp</groupId>
+ <artifactId>commons-dbcp</artifactId>
+ <version>1.2.1</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-el</groupId>
+ <artifactId>commons-el</artifactId>
+ <version>1.0</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.el</groupId>
+ <artifactId>el-api</artifactId>
+ <version>${el.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.0.1</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -827,7 +930,7 @@
<version>${ant.contrib.version}</version>
<exclusions>
<exclusion>
- <groupId>ant</groupId>
+ <groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
</exclusion>
</exclusions>
@@ -861,7 +964,7 @@
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.3.2</version>
+ <version>3.0</version>
</plugin>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
@@ -938,6 +1041,11 @@
</configuration>
</plugin>
<plugin>
+ <groupId>org.sonatype.plugins</groupId>
+ <artifactId>jarjar-maven-plugin</artifactId>
+ <version>1.5</version>
+ </plugin>
+ <plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
</plugin>
@@ -1599,7 +1707,6 @@
<artifactItem>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
- <version>${jacoco.version}</version>
</artifactItem>
</artifactItems>
<stripVersion>true</stripVersion>
@@ -1659,7 +1766,6 @@
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.ant</artifactId>
- <version>${jacoco.version}</version>
</dependency>
</dependencies>
</plugin>
@@ -1935,6 +2041,12 @@
<version>2.6</version>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>clirr-maven-plugin</artifactId>
+ <version>${clirr.version}</version>
+ </plugin>
+
<!--
<plugin>
<artifactId>maven-javadoc-plugin</artifactId>
commit dc604ae17d538a129371f1bf9fbe8e324d1f4e5e
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Tue Mar 26 12:12:35 2013 -0400
Revert "do not pass not-yet-fully-initialized "this" reference to GroupOperationHistory.addResourceOperationHistory() in ResourceOperationHistory's constructor, as the GWT compiler fails when it sees this (at least in my OS X 10.7.5, Oracle JDK 1.7.0_17 environment)"
This reverts commit df18b71df2d5114d9edc8a26ad42e0d7a9036eb2.
Charles asked that I revert this.
Reverting for a couple reasons:
* This broke a jenkins build - an API change has been introduced and it therefore fails the API check job. (I think its due to a change in a public domain object's constructor).
* Also, There is no BZ for this - we don't know what this addressed.
Ian - feel free to commit this back in a branch (not master) and create a BZ for
this. We'll cherry pick in master at the appropriate time.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
index 08611ac..08c29be 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
@@ -126,11 +126,12 @@ public class ResourceOperationHistory extends OperationHistory {
protected ResourceOperationHistory() {
}
- public ResourceOperationHistory(
- String jobName, String jobGroup, String subjectName,
- OperationDefinition operationDefinition, Configuration parameters, Resource resource) {
+ public ResourceOperationHistory(String jobName, String jobGroup, String subjectName,
+ OperationDefinition operationDefinition, Configuration parameters, Resource resource,
+ GroupOperationHistory groupHistory) {
super(jobName, jobGroup, subjectName, operationDefinition, parameters);
this.resource = resource;
+ setGroupOperationHistory(groupHistory);
}
public Resource getResource() {
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java
index 6ec38e5..34837a1 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java
@@ -285,8 +285,7 @@ public class OperationHistoryTest extends AbstractEJB3Test {
private ResourceOperationHistory createGroupIndividualResourceHistory(GroupOperationHistory g1) {
ResourceOperationHistory r2 = new ResourceOperationHistory("job3" + System.currentTimeMillis(), "group3",
- "user", newOperation, null, newResource);
- r2.setGroupOperationHistory(g1);
+ "user", newOperation, null, newResource, g1);
r2.setStartedTime();
em.persist(r2);
return r2;
@@ -301,7 +300,7 @@ public class OperationHistoryTest extends AbstractEJB3Test {
private ResourceOperationHistory createIndividualResourceHistory() {
ResourceOperationHistory r1 = new ResourceOperationHistory("job1" + System.currentTimeMillis(), "group1",
- "user", newOperation, null, newResource);
+ "user", newOperation, null, newResource, null);
r1.setStartedTime();
em.persist(r1);
return r1;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java
index 5b3b374..4bc457e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java
@@ -149,7 +149,7 @@ public class ResourceOperationHistoryDataSource extends
@Override
protected ResourceOperationHistory createOperationHistory() {
- return new ResourceOperationHistory(null, null, null, null, null, null);
+ return new ResourceOperationHistory(null, null, null, null, null, null, null);
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryDataSource.java
index dc5e887..df1e09e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryDataSource.java
@@ -431,7 +431,7 @@ public class OperationHistoryDataSource extends
ResourceOperationHistory resourceOperationHistory = new ResourceOperationHistory(null, null,
from.getAttribute(Field.SUBJECT),
(OperationDefinition) from.getAttributeAsObject(Field.OPERATION_DEFINITION),
- (Configuration) from.getAttributeAsObject(Field.PARAMETERS), resource);
+ (Configuration) from.getAttributeAsObject(Field.PARAMETERS), resource, null);
resourceOperationHistory.setId(from.getAttributeAsInt(Field.ID));
return resourceOperationHistory;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationJob.java
index 6982d58..955de7a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationJob.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationJob.java
@@ -97,8 +97,7 @@ public abstract class OperationJob implements Job {
ResourceOperationHistory history;
history = new ResourceOperationHistory(jobName, jobGroup, schedule.getSubject().getName(), op, parameters,
- schedule.getResource());
- history.setGroupOperationHistory(groupHistory);
+ schedule.getResource(), groupHistory);
// persist the results of the initial create
ResourceOperationHistory persisted;
commit 87a06a50d2c0d3fe92568c6d17272f2510e7ee20
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Mar 26 15:38:43 2013 +0100
Adding integration tests for OperationManagerBean covering the scheduling using cron and other methods.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java
index fe61829..a75388b 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/operation/OperationManagerBeanTest.java
@@ -18,7 +18,10 @@
*/
package org.rhq.enterprise.server.operation;
+import java.util.Arrays;
+import java.util.Calendar;
import java.util.Date;
+import java.util.GregorianCalendar;
import java.util.List;
import java.util.Random;
@@ -34,6 +37,7 @@ import org.rhq.core.clientapi.agent.operation.CancelResults.InterruptedState;
import org.rhq.core.clientapi.agent.operation.OperationAgentService;
import org.rhq.core.clientapi.server.operation.OperationServerService;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.common.JobTrigger;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.operation.GroupOperationHistory;
@@ -502,7 +506,7 @@ public class OperationManagerBeanTest extends AbstractEJB3Test {
}
@Test(enabled = ENABLE_TESTS)
- public void testScheduleGroupOperation() throws Exception {
+ public void testScheduleGroupOperation1() throws Exception {
// make it a success
simulatedOperation_Error = null;
simulatedOperation_Timeout = false;
@@ -571,6 +575,160 @@ public class OperationManagerBeanTest extends AbstractEJB3Test {
list = operationManager.findRecentlyCompletedGroupOperations(overlord, PageControl.getUnlimitedInstance());
assert list.size() == 0;
}
+
+ @Test(enabled = ENABLE_TESTS)
+ public void testScheduleGroupOperation2() throws Exception {
+ // make it a success
+ simulatedOperation_Error = null;
+ simulatedOperation_Timeout = false;
+ simulatedOperation_Sleep = 0L;
+
+ GroupOperationSchedule schedule = operationManager.scheduleGroupOperation(overlord, newGroup.getId(),
+ new int[] { newResource.getId() }, true, "testOp", null, 0, 0, 0, 20, "desc");
+ assert schedule != null;
+ assert schedule.getDescription().equals("desc");
+ assert schedule.getOperationName().equals("testOp");
+ assert schedule.getParameters() != null;
+ assert schedule.getGroup().getId() == newGroup.getId();
+
+ Thread.sleep(4000L); // wait for it to finish, should be fast
+
+ PageList<GroupOperationHistory> results;
+ results = operationManager.findCompletedGroupOperationHistories(overlord, newGroup.getId(),
+ PageControl.getUnlimitedInstance());
+ assert results != null;
+ assert results.size() == 1;
+ GroupOperationHistory history = results.get(0);
+ assert history.getId() > 0 : history;
+ assert history.getJobId() != null : history;
+ assert history.getJobName() != null : history;
+ assert history.getJobGroup() != null : history;
+ assert history.getErrorMessage() == null : history;
+ assert history.getStatus() == OperationRequestStatus.SUCCESS : history;
+ assert history.getSubjectName().equals(overlord.getName()) : history;
+
+ PageList<GroupOperationLastCompletedComposite> list;
+ list = operationManager.findRecentlyCompletedGroupOperations(overlord, PageControl.getUnlimitedInstance());
+ assert list.size() == 1;
+ assert list.get(0).getOperationHistoryId() == history.getId();
+ assert list.get(0).getGroupId() == newGroup.getId();
+ assert list.get(0).getGroupName().equals(newGroup.getName());
+ assert list.get(0).getOperationName().equals("Test Operation");
+
+ // get the one resource history from the group
+ PageList<ResourceOperationHistory> results2;
+ results2 = operationManager.findCompletedResourceOperationHistories(overlord, newResource.getId(), null, null,
+ PageControl.getUnlimitedInstance());
+ assert results2.size() == 1 : "Should have had 1 result: " + results2;
+
+ ResourceOperationHistory rHistory = results2.get(0);
+ assert rHistory.getId() > 0 : rHistory;
+ assert rHistory.getJobId() != null : rHistory;
+ assert rHistory.getJobName() != null : rHistory;
+ assert rHistory.getJobGroup() != null : rHistory;
+ assert rHistory.getErrorMessage() == null : rHistory;
+ assert rHistory.getStatus() == OperationRequestStatus.SUCCESS : rHistory;
+ assert rHistory.getSubjectName().equals(overlord.getName()) : rHistory;
+
+ operationManager.deleteOperationHistory(overlord, history.getId(), false);
+ results = operationManager.findCompletedGroupOperationHistories(overlord, newGroup.getId(),
+ PageControl.getUnlimitedInstance());
+ assert results != null;
+ assert results.size() == 0; // none left, we purged the only group history there was
+
+ // purging group history purges all resource histories that belong to it
+ results2 = operationManager.findCompletedResourceOperationHistories(overlord, newResource.getId(), null, null,
+ PageControl.getUnlimitedInstance());
+ assert results2 != null;
+ assert results2.size() == 0;
+
+ list = operationManager.findRecentlyCompletedGroupOperations(overlord, PageControl.getUnlimitedInstance());
+ assert list.size() == 0;
+ }
+
+ @Test(enabled = ENABLE_TESTS)
+ public void testScheduleGroupOperation3() throws Exception {
+ // make it a success
+ simulatedOperation_Error = null;
+ simulatedOperation_Timeout = false;
+ simulatedOperation_Sleep = 0L;
+
+ GroupOperationSchedule newSchedule = new GroupOperationSchedule();
+ newSchedule.setGroup(newGroup);
+ newSchedule.setExecutionOrder(Arrays.asList(newResource));
+ newSchedule.setHaltOnFailure(true);
+ newSchedule.setOperationName("testOp");
+ newSchedule.setParameters(null);
+ newSchedule.setJobTrigger(JobTrigger.createNowTrigger());
+ newSchedule.setDescription("desc");
+
+ int scheduleId = operationManager.scheduleGroupOperation(overlord, newSchedule);
+ List<GroupOperationSchedule> schedules = operationManager.findScheduledGroupOperations(overlord, newGroup.getId());
+
+ assert schedules != null;
+ assert !schedules.isEmpty();
+ GroupOperationSchedule schedule = schedules.get(0);
+ assert schedule != null;
+ assert schedule.getId() == scheduleId;
+ assert schedule.getDescription().equals("desc");
+ assert schedule.getOperationName().equals("testOp");
+ assert schedule.getParameters() == null;
+ assert schedule.getGroup().getId() == newGroup.getId();
+
+ Thread.sleep(4000L); // wait for it to finish, should be fast
+
+ PageList<GroupOperationHistory> results;
+ results = operationManager.findCompletedGroupOperationHistories(overlord, newGroup.getId(),
+ PageControl.getUnlimitedInstance());
+ assert results != null;
+ assert results.size() == 1;
+ GroupOperationHistory history = results.get(0);
+ assert history.getId() > 0 : history;
+ assert history.getJobId() != null : history;
+ assert history.getJobName() != null : history;
+ assert history.getJobGroup() != null : history;
+ assert history.getErrorMessage() == null : history;
+ assert history.getStatus() == OperationRequestStatus.SUCCESS : history;
+ assert history.getSubjectName().equals(overlord.getName()) : history;
+
+ PageList<GroupOperationLastCompletedComposite> list;
+ list = operationManager.findRecentlyCompletedGroupOperations(overlord, PageControl.getUnlimitedInstance());
+ assert list.size() == 1;
+ assert list.get(0).getOperationHistoryId() == history.getId();
+ assert list.get(0).getGroupId() == newGroup.getId();
+ assert list.get(0).getGroupName().equals(newGroup.getName());
+ assert list.get(0).getOperationName().equals("Test Operation");
+
+ // get the one resource history from the group
+ PageList<ResourceOperationHistory> results2;
+ results2 = operationManager.findCompletedResourceOperationHistories(overlord, newResource.getId(), null, null,
+ PageControl.getUnlimitedInstance());
+ assert results2.size() == 1 : "Should have had 1 result: " + results2;
+
+ ResourceOperationHistory rHistory = results2.get(0);
+ assert rHistory.getId() > 0 : rHistory;
+ assert rHistory.getJobId() != null : rHistory;
+ assert rHistory.getJobName() != null : rHistory;
+ assert rHistory.getJobGroup() != null : rHistory;
+ assert rHistory.getErrorMessage() == null : rHistory;
+ assert rHistory.getStatus() == OperationRequestStatus.SUCCESS : rHistory;
+ assert rHistory.getSubjectName().equals(overlord.getName()) : rHistory;
+
+ operationManager.deleteOperationHistory(overlord, history.getId(), false);
+ results = operationManager.findCompletedGroupOperationHistories(overlord, newGroup.getId(),
+ PageControl.getUnlimitedInstance());
+ assert results != null;
+ assert results.size() == 0; // none left, we purged the only group history there was
+
+ // purging group history purges all resource histories that belong to it
+ results2 = operationManager.findCompletedResourceOperationHistories(overlord, newResource.getId(), null, null,
+ PageControl.getUnlimitedInstance());
+ assert results2 != null;
+ assert results2.size() == 0;
+
+ list = operationManager.findRecentlyCompletedGroupOperations(overlord, PageControl.getUnlimitedInstance());
+ assert list.size() == 0;
+ }
@Test(enabled = ENABLE_TESTS)
public void testScheduleGroupOperationRecurring() throws Exception {
@@ -1258,7 +1416,7 @@ public class OperationManagerBeanTest extends AbstractEJB3Test {
}
@Test(enabled = ENABLE_TESTS)
- public void testScheduleResourceOperation() throws Exception {
+ public void testScheduleResourceOperation1() throws Exception {
Resource resource = newResource;
// make it a success after 500ms
@@ -1310,6 +1468,73 @@ public class OperationManagerBeanTest extends AbstractEJB3Test {
PageControl.getUnlimitedInstance());
assert list.size() == 0;
}
+
+ @Test(enabled = ENABLE_TESTS)
+ public void testScheduleResourceOperation2() throws Exception {
+ Resource resource = newResource;
+
+ // make it a success after 500ms
+ simulatedOperation_Error = null;
+ simulatedOperation_Timeout = false;
+ simulatedOperation_Sleep = 0L;
+
+ ResourceOperationSchedule newSchedule = new ResourceOperationSchedule();
+
+ newSchedule.setJobTrigger(JobTrigger.createNowTrigger());
+ newSchedule.setResource(resource);
+ newSchedule.setOperationName("testOp");
+ newSchedule.setDescription("desc");
+ newSchedule.setParameters(null);
+ newSchedule.setParameters(null);
+
+ int scheduleId = operationManager.scheduleResourceOperation(overlord, newSchedule);
+ List<ResourceOperationSchedule> schedules = operationManager.findScheduledResourceOperations(overlord, resource.getId());
+
+ assert schedules != null;
+ assert !schedules.isEmpty();
+ ResourceOperationSchedule schedule = schedules.get(0);
+ assert schedule != null;
+ assert schedule.getId() == scheduleId;
+ assert schedule.getDescription().equals("desc");
+ assert schedule.getOperationName().equals("testOp");
+ assert schedule.getParameters() == null;
+ assert schedule.getResource().getId() == newResource.getId();
+
+ Thread.sleep(4000L); // wait for it to finish, should be very quick
+
+ PageList<ResourceOperationHistory> results;
+ results = operationManager.findCompletedResourceOperationHistories(overlord, resource.getId(), null, null,
+ PageControl.getUnlimitedInstance());
+ assert results != null;
+ assert results.size() == 1;
+ ResourceOperationHistory history = results.get(0);
+ assert history.getId() > 0 : history;
+ assert history.getJobId() != null : history;
+ assert history.getJobName() != null : history;
+ assert history.getJobGroup() != null : history;
+ assert history.getErrorMessage() == null : history;
+ assert history.getStatus() == OperationRequestStatus.SUCCESS : history;
+ assert history.getSubjectName().equals(overlord.getName()) : history;
+
+ PageList<ResourceOperationLastCompletedComposite> list;
+ list = operationManager.findRecentlyCompletedResourceOperations(overlord, null,
+ PageControl.getUnlimitedInstance());
+ assert list.size() == 1;
+ assert list.get(0).getOperationHistoryId() == history.getId();
+ assert list.get(0).getResourceId() == resource.getId();
+ assert list.get(0).getResourceName().equals(resource.getName());
+ assert list.get(0).getOperationName().equals("Test Operation");
+
+ operationManager.deleteOperationHistory(overlord, history.getId(), false);
+ results = operationManager.findCompletedResourceOperationHistories(overlord, resource.getId(), null, null,
+ PageControl.getUnlimitedInstance());
+ assert results != null;
+ assert results.size() == 0;
+
+ list = operationManager.findRecentlyCompletedResourceOperations(overlord, null,
+ PageControl.getUnlimitedInstance());
+ assert list.size() == 0;
+ }
@Test(enabled = ENABLE_TESTS)
public void testScheduleResourceOperationRecurring() throws Exception {
@@ -1531,6 +1756,138 @@ public class OperationManagerBeanTest extends AbstractEJB3Test {
new int[] { noPermSubject.getId() });
}
}
+
+ @Test(enabled = ENABLE_TESTS)
+ public void testCronResourceScheduling() throws Exception {
+ Resource resource = newResource;
+ Calendar calendar = new GregorianCalendar();
+ calendar.add(Calendar.SECOND, 2);
+ ResourceOperationSchedule schedule = operationManager.scheduleResourceOperationUsingCron(overlord,
+ resource.getId(), "testOp", calendar.get(Calendar.SECOND) + " " + calendar.get(Calendar.MINUTE)
+ + " * * * ?", 20, null, "desc");
+
+ assert schedule != null;
+ assert schedule.getDescription().equals("desc");
+ assert schedule.getOperationName().equals("testOp");
+ assert schedule.getParameters() != null;
+ assert schedule.getResource().getId() == resource.getId();
+
+ List<ResourceOperationSchedule> results;
+ results = operationManager.findScheduledResourceOperations(overlord, resource.getId());
+ assert results != null;
+ assert results.size() == 1;
+ ResourceOperationSchedule returnedSchedule = results.get(0);
+ assert returnedSchedule.getId() > 0 : returnedSchedule;
+ assert returnedSchedule.getJobId() != null : returnedSchedule;
+ assert returnedSchedule.getJobName() != null : returnedSchedule;
+ assert returnedSchedule.getJobGroup() != null : returnedSchedule;
+ assert returnedSchedule.getDescription().equals("desc");
+ assert returnedSchedule.getOperationName().equals("testOp");
+ assert returnedSchedule.getParameters() != null;
+ assert returnedSchedule.getResource().getId() == resource.getId();
+
+ System.out.println("WAITING FOR 4s FOR THE SCHEDULED OPERATION TO FINISH");
+ Thread.sleep(4000L);
+
+ PageList<ResourceOperationHistory> resultsHist;
+ resultsHist = operationManager.findCompletedResourceOperationHistories(overlord, resource.getId(), null, null,
+ PageControl.getUnlimitedInstance());
+ assert resultsHist != null;
+ assert resultsHist.size() == 1;
+ ResourceOperationHistory history = resultsHist.get(0);
+ assert history.getId() > 0 : history;
+ assert history.getJobId() != null : history;
+ assert history.getJobName() != null : history;
+ assert history.getJobGroup() != null : history;
+ assert history.getErrorMessage() == null : history;
+ assert history.getStatus() == OperationRequestStatus.SUCCESS : history;
+ assert history.getSubjectName().equals(overlord.getName()) : history;
+
+ PageList<ResourceOperationLastCompletedComposite> list;
+ list = operationManager.findRecentlyCompletedResourceOperations(overlord, null,
+ PageControl.getUnlimitedInstance());
+ assert list.size() == 1;
+ assert list.get(0).getOperationHistoryId() == history.getId();
+ assert list.get(0).getResourceId() == resource.getId();
+ assert list.get(0).getResourceName().equals(resource.getName());
+ assert list.get(0).getOperationName().equals("Test Operation");
+
+ operationManager.deleteOperationHistory(overlord, history.getId(), false);
+ resultsHist = operationManager.findCompletedResourceOperationHistories(overlord, resource.getId(), null, null,
+ PageControl.getUnlimitedInstance());
+ assert resultsHist != null;
+ assert resultsHist.size() == 0;
+
+ list = operationManager.findRecentlyCompletedResourceOperations(overlord, null,
+ PageControl.getUnlimitedInstance());
+ assert list.size() == 0;
+ }
+
+ @Test(enabled = ENABLE_TESTS)
+ public void testCronGroupScheduling() throws Exception {
+ Resource resource = newResource;
+ ResourceGroup group = newGroup;
+ Calendar calendar = new GregorianCalendar();
+ calendar.add(Calendar.SECOND, 2);
+ GroupOperationSchedule schedule = operationManager.scheduleGroupOperationUsingCron(overlord, newGroup.getId(), new int[] { resource.getId() }, true, "testOp", null, calendar.get(Calendar.SECOND) + " " + calendar.get(Calendar.MINUTE)
+ + " * * * ?", 20, "desc");
+
+ assert schedule != null;
+ assert schedule.getDescription().equals("desc");
+ assert schedule.getOperationName().equals("testOp");
+ assert schedule.getParameters() != null;
+ assert schedule.getGroup().getId() == group.getId();
+
+ List<GroupOperationSchedule> results;
+ results = operationManager.findScheduledGroupOperations(overlord, group.getId());
+ assert results != null;
+ assert results.size() == 1;
+ GroupOperationSchedule returnedSchedule = results.get(0);
+ assert returnedSchedule.getId() > 0 : returnedSchedule;
+ assert returnedSchedule.getJobId() != null : returnedSchedule;
+ assert returnedSchedule.getJobName() != null : returnedSchedule;
+ assert returnedSchedule.getJobGroup() != null : returnedSchedule;
+ assert returnedSchedule.getDescription().equals("desc");
+ assert returnedSchedule.getOperationName().equals("testOp");
+ assert returnedSchedule.getParameters() != null;
+ assert returnedSchedule.getGroup().getId() == group.getId();
+
+ System.out.println("WAITING FOR 4s FOR THE SCHEDULED OPERATION TO FINISH");
+ Thread.sleep(4000L);
+
+ PageList<ResourceOperationHistory> resultsHist;
+ resultsHist = operationManager.findCompletedResourceOperationHistories(overlord, resource.getId(), null, null,
+ PageControl.getUnlimitedInstance());
+ assert resultsHist != null;
+ assert resultsHist.size() == 1;
+ ResourceOperationHistory history = resultsHist.get(0);
+ assert history.getId() > 0 : history;
+ assert history.getJobId() != null : history;
+ assert history.getJobName() != null : history;
+ assert history.getJobGroup() != null : history;
+ assert history.getErrorMessage() == null : history;
+ assert history.getStatus() == OperationRequestStatus.SUCCESS : history;
+ assert history.getSubjectName().equals(overlord.getName()) : history;
+
+ PageList<ResourceOperationLastCompletedComposite> list;
+ list = operationManager.findRecentlyCompletedResourceOperations(overlord, null,
+ PageControl.getUnlimitedInstance());
+ assert list.size() == 1;
+ assert list.get(0).getOperationHistoryId() == history.getId();
+ assert list.get(0).getResourceId() == resource.getId();
+ assert list.get(0).getResourceName().equals(resource.getName());
+ assert list.get(0).getOperationName().equals("Test Operation");
+
+ operationManager.deleteOperationHistory(overlord, history.getId(), false);
+ resultsHist = operationManager.findCompletedResourceOperationHistories(overlord, resource.getId(), null, null,
+ PageControl.getUnlimitedInstance());
+ assert resultsHist != null;
+ assert resultsHist.size() == 0;
+
+ list = operationManager.findRecentlyCompletedResourceOperations(overlord, null,
+ PageControl.getUnlimitedInstance());
+ assert list.size() == 0;
+ }
private Resource createNewResource() throws Exception {
getTransactionManager().begin();
commit d3ee49b474616fdbd0b3829379520c6da1406ec0
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 26 09:56:10 2013 -0400
Bug 824010
Until it's clear we can wipe them, make sure the autoupdater migration
task does not wipe the native prefs.
diff --git a/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/MigrateAgentPreferences.java b/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/MigrateAgentPreferences.java
index 333d9aa..aec7a16 100644
--- a/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/MigrateAgentPreferences.java
+++ b/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/MigrateAgentPreferences.java
@@ -42,16 +42,14 @@ public class MigrateAgentPreferences extends Task {
static private final String NODE_PREFIX = NODE_PARENT + NODE_DELIM;
static private final String DEFAULT_PREFS_FILE = "agent-prefs.properties";
static private final String MAINTAIN_NATIVE_PREFS_SYSPROP = "rhq.preferences.migrate.keep-native-prefs";
+ // Currently keeping native prefs until we're sure we don't need them.
+ // static private final String MAINTAIN_NATIVE_PREFS_DEFAULT = "false";
+ static private final String MAINTAIN_NATIVE_PREFS_DEFAULT = "true";
static private final Boolean MAINTAIN_NATIVE_PREFS;
static {
- Boolean sysProp = Boolean.FALSE;
- try {
- sysProp = Boolean.valueOf(System.getProperty(MAINTAIN_NATIVE_PREFS_SYSPROP, "false"));
- } catch (Throwable t) {
- sysProp = Boolean.FALSE;
- }
- MAINTAIN_NATIVE_PREFS = sysProp;
+ MAINTAIN_NATIVE_PREFS = Boolean.valueOf(System.getProperty(MAINTAIN_NATIVE_PREFS_SYSPROP,
+ MAINTAIN_NATIVE_PREFS_DEFAULT));
}
private File toDir;
commit df18b71df2d5114d9edc8a26ad42e0d7a9036eb2
Author: Ian Springer <ispringer(a)apptegic.com>
Date: Tue Mar 26 09:48:20 2013 -0400
do not pass not-yet-fully-initialized "this" reference to GroupOperationHistory.addResourceOperationHistory() in ResourceOperationHistory's constructor, as the GWT compiler fails when it sees this (at least in my OS X 10.7.5, Oracle JDK 1.7.0_17 environment)
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
index 08c29be..08611ac 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/operation/ResourceOperationHistory.java
@@ -126,12 +126,11 @@ public class ResourceOperationHistory extends OperationHistory {
protected ResourceOperationHistory() {
}
- public ResourceOperationHistory(String jobName, String jobGroup, String subjectName,
- OperationDefinition operationDefinition, Configuration parameters, Resource resource,
- GroupOperationHistory groupHistory) {
+ public ResourceOperationHistory(
+ String jobName, String jobGroup, String subjectName,
+ OperationDefinition operationDefinition, Configuration parameters, Resource resource) {
super(jobName, jobGroup, subjectName, operationDefinition, parameters);
this.resource = resource;
- setGroupOperationHistory(groupHistory);
}
public Resource getResource() {
diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java
index 34837a1..6ec38e5 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/operation/OperationHistoryTest.java
@@ -285,7 +285,8 @@ public class OperationHistoryTest extends AbstractEJB3Test {
private ResourceOperationHistory createGroupIndividualResourceHistory(GroupOperationHistory g1) {
ResourceOperationHistory r2 = new ResourceOperationHistory("job3" + System.currentTimeMillis(), "group3",
- "user", newOperation, null, newResource, g1);
+ "user", newOperation, null, newResource);
+ r2.setGroupOperationHistory(g1);
r2.setStartedTime();
em.persist(r2);
return r2;
@@ -300,7 +301,7 @@ public class OperationHistoryTest extends AbstractEJB3Test {
private ResourceOperationHistory createIndividualResourceHistory() {
ResourceOperationHistory r1 = new ResourceOperationHistory("job1" + System.currentTimeMillis(), "group1",
- "user", newOperation, null, newResource, null);
+ "user", newOperation, null, newResource);
r1.setStartedTime();
em.persist(r1);
return r1;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java
index 4bc457e..5b3b374 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/operation/history/ResourceOperationHistoryDataSource.java
@@ -149,7 +149,7 @@ public class ResourceOperationHistoryDataSource extends
@Override
protected ResourceOperationHistory createOperationHistory() {
- return new ResourceOperationHistory(null, null, null, null, null, null, null);
+ return new ResourceOperationHistory(null, null, null, null, null, null);
}
@Override
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryDataSource.java
index df1e09e..dc5e887 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/operation/OperationHistoryDataSource.java
@@ -431,7 +431,7 @@ public class OperationHistoryDataSource extends
ResourceOperationHistory resourceOperationHistory = new ResourceOperationHistory(null, null,
from.getAttribute(Field.SUBJECT),
(OperationDefinition) from.getAttributeAsObject(Field.OPERATION_DEFINITION),
- (Configuration) from.getAttributeAsObject(Field.PARAMETERS), resource, null);
+ (Configuration) from.getAttributeAsObject(Field.PARAMETERS), resource);
resourceOperationHistory.setId(from.getAttributeAsInt(Field.ID));
return resourceOperationHistory;
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationJob.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationJob.java
index 955de7a..6982d58 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationJob.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/operation/OperationJob.java
@@ -97,7 +97,8 @@ public abstract class OperationJob implements Job {
ResourceOperationHistory history;
history = new ResourceOperationHistory(jobName, jobGroup, schedule.getSubject().getName(), op, parameters,
- schedule.getResource(), groupHistory);
+ schedule.getResource());
+ history.setGroupOperationHistory(groupHistory);
// persist the results of the initial create
ResourceOperationHistory persisted;
commit 417fbb59817edf64a93d3cca00f2c51926379ab2
Author: Rémy Maucherat <rmaucher(a)redhat.com>
Date: Tue Mar 26 14:51:55 2013 +0100
Fix some roles operations.
Fix some attributes (not valid across all versions).
diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
index 1d667a7..ba68ce9 100644
--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatGroupComponent.java
@@ -185,6 +185,7 @@ public class TomcatGroupComponent extends MBeanResourceComponent<TomcatUserDatab
nameProperty = new PropertySimple(CONFIG_GROUP_NAME, name.substring(1, name.length() - 1));
opConfig.put(nameProperty);
resourceContext.getParentResourceComponent().invokeOperation("removeGroup", opConfig);
+ resourceContext.getParentResourceComponent().save();
}
}
diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatRoleComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatRoleComponent.java
index 92e2610..051965c 100644
--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatRoleComponent.java
+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatRoleComponent.java
@@ -50,6 +50,7 @@ public class TomcatRoleComponent extends MBeanResourceComponent<TomcatUserDataba
nameProperty = new PropertySimple(CONFIG_ROLE_NAME, name);
opConfig.put(nameProperty);
resourceContext.getParentResourceComponent().invokeOperation("removeRole", opConfig);
+ resourceContext.getParentResourceComponent().save();
}
@Override
diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
index 24936cd..7eb8aa5 100644
--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserComponent.java
@@ -206,6 +206,7 @@ public class TomcatUserComponent extends MBeanResourceComponent<TomcatUserDataba
nameProperty = new PropertySimple(CONFIG_USERNAME, name.substring(1, name.length() - 1));
opConfig.put(nameProperty);
resourceContext.getParentResourceComponent().invokeOperation("removeUser", opConfig);
+ resourceContext.getParentResourceComponent().save();
}
}
diff --git a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
index 23a20e1..ead4956 100644
--- a/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
+++ b/modules/plugins/tomcat/src/main/java/org/jboss/on/plugins/tomcat/TomcatUserDatabaseComponent.java
@@ -26,6 +26,7 @@ package org.jboss.on.plugins.tomcat;
import org.jboss.on.plugins.tomcat.helper.CreateResourceHelper;
import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.resource.CreateResourceStatus;
import org.rhq.core.pluginapi.inventory.CreateChildResourceFacet;
import org.rhq.core.pluginapi.inventory.CreateResourceReport;
@@ -45,8 +46,11 @@ public class TomcatUserDatabaseComponent extends MBeanResourceComponent<TomcatSe
String objectName = null;
String operation = null;
try {
+ PropertySimple newGroups = null;
+ PropertySimple newRoles = null;
if (TomcatGroupComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName)) {
name = report.getResourceConfiguration().getSimple("groupname").getStringValue();
+ newRoles = report.getResourceConfiguration().getSimple(TomcatGroupComponent.CONFIG_ROLES);
report.getResourceConfiguration().remove(TomcatGroupComponent.CONFIG_ROLES);
objectName = String.format("Users:type=Group,groupname=\"%s\",database=UserDatabase", name);
operation = "createGroup";
@@ -56,6 +60,8 @@ public class TomcatUserDatabaseComponent extends MBeanResourceComponent<TomcatSe
operation = "createRole";
} else if (TomcatUserComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName)) {
name = report.getResourceConfiguration().getSimple("username").getStringValue();
+ newRoles = report.getResourceConfiguration().getSimple(TomcatUserComponent.CONFIG_ROLES);
+ newGroups = report.getResourceConfiguration().getSimple(TomcatUserComponent.CONFIG_GROUPS);
report.getResourceConfiguration().remove(TomcatUserComponent.CONFIG_ROLES);
report.getResourceConfiguration().remove(TomcatUserComponent.CONFIG_GROUPS);
objectName = String.format("Users:type=User,username=\"%s\",database=UserDatabase", name);
@@ -70,6 +76,14 @@ public class TomcatUserDatabaseComponent extends MBeanResourceComponent<TomcatSe
CreateResourceHelper.setResourceName(report, name);
this.invokeOperation(operation, report.getResourceConfiguration());
+ if (TomcatGroupComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName)) {
+ report.getResourceConfiguration().put(newRoles);
+ // FIXME: Add newRoles to the group
+ } else if (TomcatUserComponent.RESOURCE_TYPE_NAME.equals(resourceTypeName)) {
+ report.getResourceConfiguration().put(newGroups);
+ report.getResourceConfiguration().put(newRoles);
+ // FIXME: Add newRoles and newGroups to the user
+ }
// If all went well, persist the changes to the Tomcat user Database
save();
diff --git a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
index 37bc478..97f410a 100644
--- a/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/tomcat/src/main/resources/META-INF/rhq-plugin.xml
@@ -233,7 +233,9 @@
name="Tomcat Virtual Host"
discovery="TomcatVHostDiscoveryComponent"
class="TomcatVHostComponent"
- description="A virtual host in the web container">
+ description="A virtual host in the web container"
+ createDeletePolicy="both"
+ creationDataType="configuration">
<plugin-configuration>
<c:group
@@ -508,10 +510,6 @@
type="integer"
description="Maximum size of the static resource cache in kilobytes. If not specified, the default value is 10240 (10 megabytes)." />
<c:simple-property
- name="caseSensitive"
- type="boolean"
- description="If the value of this flag is true, all case sensitivity checks will be disabled. If not specified, the default value of the flag is true. NOTE: This flag MUST NOT be set to false on the Windows platform (or any other OS which does not have a case sensitive filesystem), as it will disable case sensitivity checks, allowing JSP source code disclosure, among other security problems." />
- <c:simple-property
name="cookies"
type="boolean"
description="Set to true if you want cookies to be used for session identifier communication if supported by the client (this is the default). Set to false if you want to disable the use of cookies for session identifier communication, and rely only on URL rewriting by the application." />
@@ -523,7 +521,8 @@
<c:simple-property
name="configFile"
type="string"
- description="The location of the context.xml resource or file" />
+ description="The location of the context.xml resource or file Note: Does not exist in Tomcat 7 (return type changed to URL)"
+ required="false" />
<c:simple-property
name="crossContext"
type="boolean"
@@ -533,13 +532,7 @@
readOnly="true"
required="true"
description="The docBase set for this application" />
- <!-- Although it claims to be writable, update failed in my V5 and V6 test, so read only for now. -->
- <c:simple-property
- name="eventProvider"
- type="boolean"
- description="Event provider support for this managed object?"
- readOnly="true" />
- <c:simple-property
+ <c:simple-property
name="privileged"
type="boolean"
description="Set to true to allow this context to use container servlets, like the manager servlet. Use of the privileged attribute will change the context's parent class loader to be the Server class loader rather than the Shared class loader. Note that in a default installation, the Common class loader is used for both the Server and the Shared class loaders." />
@@ -551,18 +544,6 @@
name="saveConfig"
type="boolean"
description="Write the configuration as needed on startup?" />
- <!-- Although it claims to be writable, update failed in my V5 and V6 test, so read only for now. -->
- <c:simple-property
- name="stateManageable"
- type="boolean"
- description="State management support for this managed object?"
- readOnly="true" />
- <!-- Although it claims to be writable, update failed in my V5 and V6 test, so read only for now. -->
- <c:simple-property
- name="statisticsProvider"
- type="boolean"
- description="Performance statistics support for this managed object?"
- readOnly="true" />
<c:simple-property
name="swallowOutput"
type="boolean"
@@ -864,10 +845,6 @@
type="boolean"
description="A boolean value which can be used to enable or disable the TRACE HTTP method. If not specified, this attribute is set to false." />
<c:simple-property
- name="bufferSize"
- type="integer"
- description="HTTP: The size (in bytes) of the buffer to be provided for input streams created by this connector. By default, buffers of 2048 bytes will be provided. AJP: The size of the output buffer to use. If less than or equal to zero, then output buffering is disabled. The default value is -1 (i.e. buffering disabled)" />
- <c:simple-property
name="connectionTimeout"
type="integer"
description="HTTP: The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. The default value is 60000 (i.e. 60 seconds). AJP: The number of milliseconds this Connector will wait, after accepting a connection, for the request URI line to be presented. The default value is infinite (i.e. no timeout)."
@@ -875,7 +852,8 @@
<c:simple-property
name="emptySessionPath"
type="boolean"
- description="If set to true, all paths for session cookies will be set to /. This can be useful for portlet specification implementations, but will greatly affect performance if many applications are accessed on a given server by the client. If not specified, this attribute is set to false." />
+ description="If set to true, all paths for session cookies will be set to /. This can be useful for portlet specification implementations, but will greatly affect performance if many applications are accessed on a given server by the client. If not specified, this attribute is set to false. Note: Does not exist in Tomcat 7"
+ required="false" />
<c:simple-property
name="enableLookups"
type="boolean"
commit 399bc2863d82d499158c00ccc7ae4e3b50cdfa04
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 26 09:05:15 2013 -0400
Bug 824010
Don't use custom FilePreferences by default at this time. Stick with
native prefs storage by default. We need to further evaluate upgrade
scenarios.
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.bat b/modules/enterprise/agent/src/etc/rhq-agent.bat
index 5cf1814..f94603c 100644
--- a/modules/enterprise/agent/src/etc/rhq-agent.bat
+++ b/modules/enterprise/agent/src/etc/rhq-agent.bat
@@ -175,7 +175,9 @@ if not defined RHQ_AGENT_MAINCLASS (
set RHQ_AGENT_MAINCLASS=org.rhq.enterprise.agent.AgentMain
)
-set CMD="%RHQ_AGENT_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %_JAVA_PREFERENCES_FACTORY_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
+rem note - currently not using custom Java Prefs as the default, use commented command line to activate
+rem set CMD="%RHQ_AGENT_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %_JAVA_PREFERENCES_FACTORY_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
+set CMD="%RHQ_AGENT_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
if not defined _SETENV_ONLY (
rem log4j 1.2.8 does not create the directory for us (later versions do)
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.sh b/modules/enterprise/agent/src/etc/rhq-agent.sh
index 52db5cd..9e8de03 100755
--- a/modules/enterprise/agent/src/etc/rhq-agent.sh
+++ b/modules/enterprise/agent/src/etc/rhq-agent.sh
@@ -279,7 +279,9 @@ if [ -z "$RHQ_AGENT_MAINCLASS" ]; then
fi
# Build the command line that starts the VM
-CMD="\"${RHQ_AGENT_JAVA_EXE_FILE_PATH}\" ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${_JAVA_PREFERENCES_FACTORY_OPT} ${_JNA_LIBRARY_PATH} ${RHQ_AGENT_JAVA_OPTS} ${RHQ_AGENT_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp \"${CLASSPATH}\" ${RHQ_AGENT_MAINCLASS} ${RHQ_AGENT_CMDLINE_OPTS}"
+# note - currently not using custom Java Prefs as the default, use commented command line to activate
+# CMD="\"${RHQ_AGENT_JAVA_EXE_FILE_PATH}\" ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${_JAVA_PREFERENCES_FACTORY_OPT} ${_JNA_LIBRARY_PATH} ${RHQ_AGENT_JAVA_OPTS} ${RHQ_AGENT_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp \"${CLASSPATH}\" ${RHQ_AGENT_MAINCLASS} ${RHQ_AGENT_CMDLINE_OPTS}"
+CMD="\"${RHQ_AGENT_JAVA_EXE_FILE_PATH}\" ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${_JNA_LIBRARY_PATH} ${RHQ_AGENT_JAVA_OPTS} ${RHQ_AGENT_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp \"${CLASSPATH}\" ${RHQ_AGENT_MAINCLASS} ${RHQ_AGENT_CMDLINE_OPTS}"
debug_msg "Executing the agent with this command line:"
debug_msg "$CMD"
commit c696de2117ac5d377b7dc3165a71a7bd485fe8fe
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 25 15:01:03 2013 -0400
Bug 824010
- remove extraneous parens
diff --git a/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.conf b/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.conf
index c5c1ab0..132a7b8 100644
--- a/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.conf
+++ b/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.conf
@@ -71,7 +71,7 @@ wrapper.java.additional.4=-Di18nlog.dump-stack-traces=false
wrapper.java.additional.5=-Dsigar.nativeLogging=false
wrapper.java.additional.6="-Djava.endorsed.dirs=%RHQ_AGENT_HOME%/lib/endorsed"
wrapper.java.additional.7="-Djava.util.prefs.PreferencesFactory=org.rhq.core.util.preferences.FilePreferencesFactory"
-wrapper.java.additional.8="-Drhq.preferences.file="%RHQ_AGENT_HOME%"/conf/agent-prefs.properties"
+wrapper.java.additional.8="-Drhq.preferences.file=%RHQ_AGENT_HOME%/conf/agent-prefs.properties"
# We want to make sure the agent starts in its install directory (quotes not needed)
wrapper.working.dir=%RHQ_AGENT_HOME%
commit 4ed6e54a08c3897fa5fa5df55581ec6b2db95fea
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 25 14:01:57 2013 -0400
remove duplicate itest debug profile
diff --git a/etc/eclipse-tools/RHQ Remote Debugging - Server.launch b/etc/eclipse-tools/RHQ Remote Debugging - Server.launch
index 6b68fc6..da6275c 100644
--- a/etc/eclipse-tools/RHQ Remote Debugging - Server.launch
+++ b/etc/eclipse-tools/RHQ Remote Debugging - Server.launch
@@ -1,19 +1,19 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/rhq"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="true"/>
-<mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP">
-<mapEntry key="port" value="8787"/>
-<mapEntry key="hostname" value="localhost"/>
-</mapAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="rhq"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/>
-</launchConfiguration>
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication">
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
+<listEntry value="/rhq"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
+<listEntry value="4"/>
+</listAttribute>
+<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
+<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
+</listAttribute>
+<booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="true"/>
+<mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP">
+<mapEntry key="hostname" value="localhost"/>
+<mapEntry key="port" value="8787"/>
+</mapAttribute>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="rhq"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/>
+</launchConfiguration>
diff --git a/etc/eclipse-tools/RHQ Remote Debugging - itest.launch b/etc/eclipse-tools/RHQ Remote Debugging - itest.launch
deleted file mode 100644
index 1ea5d31..0000000
--- a/etc/eclipse-tools/RHQ Remote Debugging - itest.launch
+++ /dev/null
@@ -1,21 +0,0 @@
-<?xml version="1.0" encoding="UTF-8" standalone="no"?>
-<launchConfiguration type="org.eclipse.jdt.launching.remoteJavaApplication">
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/rhq"/>
-</listAttribute>
-<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
-<listEntry value="4"/>
-</listAttribute>
-<stringAttribute key="org.eclipse.debug.core.source_locator_id" value="org.eclipse.jdt.launching.sourceLocator.JavaSourceLookupDirector"/>
-<stringAttribute key="org.eclipse.debug.core.source_locator_memento" value="<?xml version="1.0" encoding="UTF-8" standalone="no"?> <sourceLookupDirector> <sourceContainers duplicates="false"> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;javaProject name=&quot;rhq&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.javaProject"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/integration/jboss-profileservice-spi/5.1.0.SP1/jboss-profileservice-spi-5.1.0.SP1.jar&quot;/&gt;&#13;&#10;" typeId="org.ec
lipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/man/jboss-managed/2.1.1.GA/jboss-managed-2.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/man/jboss-metatype/2.1.1.GA/jboss-metatype-2.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encodi
ng=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/commons/commons-io/1.3.2/commons-io-1.3.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/sun/xml/bind/jaxb-impl/2.1.12/jaxb-impl-2.1.12.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/i18nlog/i18nlog/1.0.10/i18nlog-1.
0.10.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/gnu-getopt/getopt/1.0.13/getopt-1.0.13.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-httpclient/commons-httpclient/3.0.1/commons-httpclient-3.0.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento=
"&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-remoting/2.2.2.SP8/jboss-remoting-2.2.2.SP8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVari
able path=&quot;M2_REPO/rss4j/rss4j/0.92-on.2/rss4j-0.92-on.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ant/ant/1.8.0/ant-1.8.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ant/ant-nodeps/1.8.0/ant-nodeps-1.8.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"
/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/servlet/servlet-api/2.4/servlet-api-2.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/struts/struts/1.2.9/struts-1.2.9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;class
pathVariable path=&quot;M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-validator/commons-validator/1.1.4/commons-validator-1.1.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/testng/testng/6.1.1/testng-6.1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContai
ner.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/snmp4j/snmp4j/1.8.2/snmp4j-1.8.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&
#10;&lt;classpathVariable path=&quot;M2_REPO/tomcat/tomcat-jk/4.1.31/tomcat-jk-4.1.31.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jdom/jdom/1.0/jdom-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sour
ceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-jmx/4.2.3.GA/jboss-jmx-4.2.3.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&
;quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/tomcat/catalina/5.5.20/catalina-5.5.20.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/taglibs/standard/1.1.2/standard-1.1.2.jar&quot;/&gt;&#13;&#1
0;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-common/1.2.1.GA/jboss-common-1.2.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/servlet/jstl/1.1.2/jstl-1.1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&
quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/struts-menu/struts-menu/2.3/struts-menu-2.3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/junit/junit/3.8.2/junit-3.8.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/velocity/velocity/1.5/velocity-1.5.jar&quot;/&gt;&am
p;#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/xalan/xalan/2.5.1/xalan-2.5.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/xml/bind/jaxb-api/2.1/jaxb-api-2.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&qu
ot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/xml/bind/jsr173_api/1.0/jsr173_api-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-embeddable-ejb3/jboss-ejb3-all/1.0.0.Alpha9/jboss-ejb3-all-1.0.0.Alpha9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jbpm/3.1.1/j
bpm-3.1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-embeddable-ejb3/hibernate-all/1.0.0.Alpha9/hibernate-all-1.0.0.Alpha9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jetbrains/annotations/7.0.2/annotations-7.0.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/>
3; <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ant/ant-launcher/1.8.0/ant-launcher-1.8.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/cglib/cglib-nodep/2.1_3/cglib-nodep-2.1_3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&
lt;classpathVariable path=&quot;M2_REPO/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-lang/commons-lang/2.4/commons-lang-2.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/faces/jsf-api/1.2_14/jsf-api-1.2_14.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launch
ing.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/faces/jsf-impl/1.2_14/jsf-impl-1.2_14.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/el/el-api/1.0/el-api-1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?
&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/sun/facelets/jsf-facelets/1.1.15.B1/jsf-facelets-1.1.15.B1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/mc4j/org-mc4j-ems/1.2.16/org-mc4j-ems-1.2.16.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/opensymphony/quartz/quartz/1.6.5/quartz-1.6.5.jar&quot;/&gt;&#13;&#10;&q
uot; typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javax/mail/mail/1.4.2/mail-1.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-fileupload/commons-fileupload/1.2/commons-fileupload-1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encodi
ng=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/richfaces/framework/richfaces-api/3.3.3.Final/richfaces-api-3.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/richfaces/framework/richfaces-impl/3.3.3.Final/richfaces-impl-3.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&
amp;quot;M2_REPO/org/richfaces/ui/richfaces-ui/3.3.3.Final/richfaces-ui-3.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/postgresql/postgresql/9.0-801.jdbc4/postgresql-9.0-801.jdbc4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/jboss-cache/1.4.1.SP9/jboss-cache-1.4.1.SP9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.laun
ching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/hyperic/sigar/1.6.5.132/sigar-1.6.5.132.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/transaction/jboss-jta/4.2.3.SP5/jboss-jta-4.2.3.SP5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; s
tandalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/transaction/jboss-jts-common/4.2.3.SP5/jboss-jts-common-4.2.3.SP5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/jbossws-spi/1.1.1.GA/jbossws-spi-1.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/jbossws/jbossws-native-core/3
.1.1.GA/jbossws-native-core-3.1.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/maven/maven-project/2.0.8/maven-project-2.0.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/maven/maven-plugin-api/2.0.8/maven-plugin-api-2.0.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariabl
e"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/codehaus/swizzle/swizzle-confluence/1.6.1/swizzle-confluence-1.6.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jvnet/inflector/0.7.0/inflector-0.7.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot
;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/net/augeas/augeas/0.0.2/augeas-0.0.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/json/json/20080701/json-20080701.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/net/java/dev/jna/jna/3.2.5/jna-3.2.5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.s
ourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/freemarker/freemarker/2.3.11/freemarker-2.3.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/seam/jboss-seam/2.1.0.SP1/jboss-seam-2.1.0.SP1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standa
lone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/seam/jboss-seam-ui/2.1.0.SP1/jboss-seam-ui-2.1.0.SP1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/hibernate/hibernate3/3.2.r14201-2/hibernate3-3.2.r14201-2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jline/jline/0.9.94/jline-0.9.94.jar&quot;/&
gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/javassist/javassist/3.9.0.GA/javassist-3.9.0.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/net/sf/opencsv/opencsv/1.8/opencsv-1.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&
quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/bouncycastle/bcpg-jdk15/140/bcpg-jdk15-140.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/bouncycastle/bcprov-jdk15/140/bcprov-jdk15-140.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/xmlrpc/xmlrpc-client/3.1
.2/xmlrpc-client-3.1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/xmlrpc/xmlrpc-common/3.1.2/xmlrpc-common-3.1.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/ws/commons/util/ws-commons-util/1.0.2/ws-commons-util-1.0.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable&quo
t;/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&am
p;gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/pircbot/pircbot/1.4.2/pircbot-1.4.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/twitter4j/twitter4j-core/2.2.4/twitter4j-core-2.2.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jmock/jmock/2.5.1/jmock-2.5.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.l
aunching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/hamcrest/hamcrest-core/1.1/hamcrest-core-1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/hamcrest/hamcrest-library/1.1/hamcrest-library-1.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;
standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/antlr/antlr-runtime/3.2/antlr-runtime-3.2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/jboss/web/jbossweb/2.0.1.GA/jbossweb-2.0.1.GA.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/libvirt/libvirt/0.4.1/libvirt-0.4.1.jar&quot;/&gt;&#13;&am
p;#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/byteman/byteman/1.2.1/byteman-1.2.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/fedorahosted/cobbler/cobbler4j/0.1/cobbler4j-0.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quo
t; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/gwt/gwt-user/2.4.0/gwt-user-2.4.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/gwt/gwt-dev/2.4.0/gwt-dev-2.4.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/smartgwt/smartgwt/3.0/smartgwt-3.0.j
ar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/code/gwt-log/gwt-log/3.1.0/gwt-log-3.1.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/ca/nanometrics/gflot/1.0.0/gflot-1.0.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml vers
ion=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/jcraft/jsch/0.1.29/jsch-0.1.29.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/dbunit/dbun
it/2.4.8/dbunit-2.4.8.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/apache/poi/poi/3.7/poi-3.7.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/bsh/bsh/1.3.0/bsh-1.3.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot
;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils-core/3.1/unitils-core-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils-dbunit/3.1/unitils-dbunit-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils-
orm/3.1/unitils-orm-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/unitils/unitils-testng/3.1/unitils-testng-3.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/codehaus/jackson/jackson-core-asl/1.7.4/jackson-core-asl-1.7.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/>
; <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/codehaus/jackson/jackson-mapper-asl/1.7.4/jackson-mapper-asl-1.7.4.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/mongodb/mongo-java-driver/2.6.5/mongo-java-driver-2.6.5.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&qu
ot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/googlecode/java-diff-utils/diffutils/1.2.1/diffutils-1.2.1.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/com/google/code/morphia/morphia/1.00-SNAPSHOT/morphia-1.00-SNAPSHOT.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/resteasy-links/2.3.3.Final/resteasy-links-2.3.
3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/resteasy-jaxrs/2.3.3.Final/resteasy-jaxrs-2.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/resteasy-jackson-provider/2.3.3.Final/resteasy-jackson-provider-2.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContain
er.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/resteasy/jaxrs-api/2.3.3.Final/jaxrs-api-2.3.3.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/sasl/jboss-sasl/1.0.0.Beta9/jboss-sasl-1.0.0.Beta9.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; st
andalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;JDK_HOME/lib/tools.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/mockito/mockito-all/1.9.0/mockito-all-1.9.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-api-mockito/1.4.11/powermock-api-mockito-1.4.11.jar&quot;/&gt;&#13;&#
10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-core/1.4.11/powermock-core-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-api-support/1.4.11/powermock-api-support-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml v
ersion=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-module-testng-common/1.4.11/powermock-module-testng-common-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/powermock/powermock-module-testng/1.4.11/powermock-module-testng-1.4.11.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&
amp;#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/liquibase/liquibase-core/2.0.3/liquibase-core-2.0.3.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/shrinkwrap-impl-base/1.0.0/shrinkwrap-impl-base-1.0.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/shrinkwrap-api/1.0.0/shrinkwrap-api-1.0.0.jar&quot;/&
amp;gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/shrinkwrap-spi/1.0.0/shrinkwrap-spi-1.0.0.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/descriptors/shrinkwrap-descriptors-api-base/2.0.0-alpha-2/shrinkwrap-descriptors-api-base-2.0.0-alpha-2.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.
classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api/1.0.0-beta-6/shrinkwrap-resolver-api-1.0.0-beta-6.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/shrinkwrap/resolver/shrinkwrap-resolver-api-maven/1.0.0-beta-6/shrinkwrap-resolver-api-maven-1.0.0-beta-6.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container mem
ento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/test/arquillian-test-spi/1.0.0.Final/arquillian-test-spi-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/test/arquillian-test-api/1.0.0.Final/arquillian-test-api-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; stan
dalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/core/arquillian-core-spi/1.0.0.Final/arquillian-core-spi-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/core/arquillian-core-api/1.0.0.Final/arquillian-core-api-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quo
t;M2_REPO/org/jboss/arquillian/container/arquillian-container-spi/1.0.0.Final/arquillian-container-spi-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/container/arquillian-container-test-api/1.0.0.Final/arquillian-container-test-api-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;classpathVariable path=&quot;M2_REPO/org/jboss/arquillian/testng/arquillian-testng
-core/1.0.0.Final/arquillian-testng-core-1.0.0.Final.jar&quot;/&gt;&#13;&#10;" typeId="org.eclipse.jdt.launching.sourceContainer.classpathVariable"/> <container memento="&lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot; standalone=&quot;no&quot;?&gt;&#13;&#10;&lt;default/&gt;&#13;&#10;" typeId="org.eclipse.debug.core.containerType.default"/> </sourceContainers> </sourceLookupDirector> "/>
-<listAttribute key="org.eclipse.debug.ui.favoriteGroups">
-<listEntry value="org.eclipse.debug.ui.launchGroup.debug"/>
-</listAttribute>
-<booleanAttribute key="org.eclipse.jdt.launching.ALLOW_TERMINATE" value="true"/>
-<mapAttribute key="org.eclipse.jdt.launching.CONNECT_MAP">
-<mapEntry key="hostname" value="localhost"/>
-<mapEntry key="port" value="8798"/>
-</mapAttribute>
-<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="rhq"/>
-<stringAttribute key="org.eclipse.jdt.launching.VM_CONNECTOR_ID" value="org.eclipse.jdt.launching.socketAttachConnector"/>
-</launchConfiguration>
commit baef5c9d8ed4ca872ccb4f3240bbb603f00abd5c
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 25 14:01:25 2013 -0400
Bug 824010
Have agent store configuration on filesystem instead of Java preferences
The RHQ Agent now uses our custom FilePreferences Java Prefs impl to
store the ageng configuration. By default the prefs file is stored in
RHQ_AGENT_HOME/agent-prefs.properties, but the file placement is
configurable. The value is set in the RHQ_AGENT_JAVA_OPTS
as part of rhq-agent-env.sh|bat.
New agents will start using the new prefs approach immediately. For
existing agents the auto-update procedure will perform the one-time
migration from the native prefs store to the file prefs. By default
the native prefs will be removed as part of the migration, to leave
the native prefs clean of RHQ debris.
Also:
- make sure streams get closed in FilePreferences impl
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferences.java b/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferences.java
index f542329..e03ef1b 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferences.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferences.java
@@ -114,7 +114,15 @@ public class FilePreferences extends AbstractPreferences {
synchronized (file) {
Properties p = new Properties();
try {
- p.load(new FileInputStream(file));
+ FileInputStream fis = null;
+ try {
+ fis = new FileInputStream(file);
+ p.load(fis);
+ } finally {
+ if (null != fis) {
+ fis.close();
+ }
+ }
StringBuilder sb = new StringBuilder();
getPath(sb);
@@ -194,7 +202,16 @@ public class FilePreferences extends AbstractPreferences {
}
}
- p.store(new FileOutputStream(file), "FilePreferences");
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(file);
+ p.store(fos, "RHQ FilePreferences. Do not edit this file manually.");
+ } finally {
+ if (null != fos) {
+ fos.close();
+ }
+ }
+
} catch (IOException e) {
throw new BackingStoreException(e);
}
diff --git a/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.conf b/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.conf
index 25c99aa..c5c1ab0 100644
--- a/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.conf
+++ b/modules/enterprise/agent/src/etc/java-service-wrapper/rhq-agent-wrapper.conf
@@ -70,6 +70,8 @@ wrapper.java.additional.3=-Xmx128m
wrapper.java.additional.4=-Di18nlog.dump-stack-traces=false
wrapper.java.additional.5=-Dsigar.nativeLogging=false
wrapper.java.additional.6="-Djava.endorsed.dirs=%RHQ_AGENT_HOME%/lib/endorsed"
+wrapper.java.additional.7="-Djava.util.prefs.PreferencesFactory=org.rhq.core.util.preferences.FilePreferencesFactory"
+wrapper.java.additional.8="-Drhq.preferences.file="%RHQ_AGENT_HOME%"/conf/agent-prefs.properties"
# We want to make sure the agent starts in its install directory (quotes not needed)
wrapper.working.dir=%RHQ_AGENT_HOME%
diff --git a/modules/enterprise/agent/src/etc/rhq-agent-env.bat b/modules/enterprise/agent/src/etc/rhq-agent-env.bat
index dd82cbe..be6b6df 100644
--- a/modules/enterprise/agent/src/etc/rhq-agent-env.bat
+++ b/modules/enterprise/agent/src/etc/rhq-agent-env.bat
@@ -61,7 +61,7 @@ rem rhq-agent-wrapper.bat. The Java VM command line
rem options used by rhq-agent-wrapper.bat are set in
rem wrapper\rhq-agent-wrapper.conf.
rem
-rem set RHQ_AGENT_JAVA_OPTS=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true
+rem set RHQ_AGENT_JAVA_OPTS=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true -Drhq.preferences.file=%RHQ_AGENT_HOME%\conf\agent-prefs.properties
rem RHQ_AGENT_JAVA_ENDORSED_DIRS - Java VM command line option to set the
rem endorsed dirs for the agent's VM. If this
diff --git a/modules/enterprise/agent/src/etc/rhq-agent-env.sh b/modules/enterprise/agent/src/etc/rhq-agent-env.sh
index 4fa4311..512cec6 100755
--- a/modules/enterprise/agent/src/etc/rhq-agent-env.sh
+++ b/modules/enterprise/agent/src/etc/rhq-agent-env.sh
@@ -51,7 +51,7 @@
# to the agent's defaults, then you will want to
# use RHQ_AGENT_ADDITIONAL_JAVA_OPTS instead.
#
-#RHQ_AGENT_JAVA_OPTS="-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true"
+#RHQ_AGENT_JAVA_OPTS="-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true -Drhq.preferences.file=${RHQ_AGENT_HOME}/conf/agent-prefs.properties"
# RHQ_AGENT_JAVA_ENDORSED_DIRS - Java VM command line option to set the
# endorsed dirs for the agent's VM. If this
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.bat b/modules/enterprise/agent/src/etc/rhq-agent.bat
index 005e535..5cf1814 100644
--- a/modules/enterprise/agent/src/etc/rhq-agent.bat
+++ b/modules/enterprise/agent/src/etc/rhq-agent.bat
@@ -116,10 +116,15 @@ rem Prepare the VM command line options to be passed in
rem ----------------------------------------------------------------------
if not defined RHQ_AGENT_JAVA_OPTS (
- set RHQ_AGENT_JAVA_OPTS=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true
+ set RHQ_AGENT_JAVA_OPTS=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true -Drhq.preferences.file="%RHQ_AGENT_HOME%\conf\agent-prefs.properties"
)
if defined RHQ_AGENT_DEBUG echo RHQ_AGENT_JAVA_OPTS: %RHQ_AGENT_JAVA_OPTS%
+rem ----------------------------------------------------------------------
+rem Ensure the agent uses our custom JavaPreferences implementation
+rem ----------------------------------------------------------------------
+set _JAVA_PREFERENCES_FACTORY_OPT="-Djava.util.prefs.PreferencesFactory=org.rhq.core.util.preferences.FilePreferencesFactory"
+
if "%RHQ_AGENT_JAVA_ENDORSED_DIRS%" == "none" (
if defined RHQ_AGENT_DEBUG echo Not explicitly setting java.endorsed.dirs
goto :skip_java_endorsed_dirs
@@ -170,7 +175,7 @@ if not defined RHQ_AGENT_MAINCLASS (
set RHQ_AGENT_MAINCLASS=org.rhq.enterprise.agent.AgentMain
)
-set CMD="%RHQ_AGENT_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
+set CMD="%RHQ_AGENT_JAVA_EXE_FILE_PATH%" %_JAVA_ENDORSED_DIRS_OPT% %_JAVA_LIBRARY_PATH_OPT% %_JAVA_PREFERENCES_FACTORY_OPT% %RHQ_AGENT_JAVA_OPTS% %RHQ_AGENT_ADDITIONAL_JAVA_OPTS% %_LOG_CONFIG% -cp "%CLASSPATH%" %RHQ_AGENT_MAINCLASS% %RHQ_AGENT_CMDLINE_OPTS%
if not defined _SETENV_ONLY (
rem log4j 1.2.8 does not create the directory for us (later versions do)
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.sh b/modules/enterprise/agent/src/etc/rhq-agent.sh
index b3ee8a7..52db5cd 100755
--- a/modules/enterprise/agent/src/etc/rhq-agent.sh
+++ b/modules/enterprise/agent/src/etc/rhq-agent.sh
@@ -167,7 +167,7 @@ done
# ----------------------------------------------------------------------
if [ -z "$RHQ_AGENT_JAVA_OPTS" ]; then
- RHQ_AGENT_JAVA_OPTS="-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true"
+ RHQ_AGENT_JAVA_OPTS="-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=true -Drhq.preferences.file=${RHQ_AGENT_HOME}/conf/agent-prefs.properties"
fi
debug_msg "RHQ_AGENT_JAVA_OPTS: $RHQ_AGENT_JAVA_OPTS"
@@ -204,6 +204,11 @@ fi
debug_msg "RHQ_AGENT_ADDITIONAL_JAVA_OPTS: $RHQ_AGENT_ADDITIONAL_JAVA_OPTS"
# ----------------------------------------------------------------------
+# Ensure the agent uses our custom JavaPreferences implementation
+# ----------------------------------------------------------------------
+_JAVA_PREFERENCES_FACTORY_OPT="\"-Djava.util.prefs.PreferencesFactory=org.rhq.core.util.preferences.FilePreferencesFactory\""
+
+# ----------------------------------------------------------------------
# Prepare the command line arguments passed to the RHQ Agent
# ----------------------------------------------------------------------
if [ -z "$RHQ_AGENT_CMDLINE_OPTS" ]; then
@@ -274,7 +279,7 @@ if [ -z "$RHQ_AGENT_MAINCLASS" ]; then
fi
# Build the command line that starts the VM
-CMD="\"${RHQ_AGENT_JAVA_EXE_FILE_PATH}\" ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${_JNA_LIBRARY_PATH} ${RHQ_AGENT_JAVA_OPTS} ${RHQ_AGENT_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp \"${CLASSPATH}\" ${RHQ_AGENT_MAINCLASS} ${RHQ_AGENT_CMDLINE_OPTS}"
+CMD="\"${RHQ_AGENT_JAVA_EXE_FILE_PATH}\" ${_JAVA_ENDORSED_DIRS_OPT} ${_JAVA_LIBRARY_PATH_OPT} ${_JAVA_PREFERENCES_FACTORY_OPT} ${_JNA_LIBRARY_PATH} ${RHQ_AGENT_JAVA_OPTS} ${RHQ_AGENT_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp \"${CLASSPATH}\" ${RHQ_AGENT_MAINCLASS} ${RHQ_AGENT_CMDLINE_OPTS}"
debug_msg "Executing the agent with this command line:"
debug_msg "$CMD"
diff --git a/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/MigrateAgentPreferences.java b/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/MigrateAgentPreferences.java
new file mode 100644
index 0000000..333d9aa
--- /dev/null
+++ b/modules/enterprise/agentupdate/src/main/java/org/rhq/enterprise/agent/update/MigrateAgentPreferences.java
@@ -0,0 +1,141 @@
+/*
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.enterprise.agent.update;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Properties;
+import java.util.prefs.Preferences;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Task;
+
+/**
+ * This migrates agent preferences stored by the native preferences implementation to a file compatible with
+ * our custom FilePreferences implementation. It works as follows:
+ *
+ * @author Jay Shaughnessy
+ * @author John Mazzitelli
+ */
+public class MigrateAgentPreferences extends Task {
+ /**
+ * This is the top level parent node of all agent preferences and is directly under the userRoot preferences node.
+ */
+ static private final String NODE_PARENT = "rhq-agent";
+ static private final String NODE_DELIM = "/";
+ static private final String NODE_PREFIX = NODE_PARENT + NODE_DELIM;
+ static private final String DEFAULT_PREFS_FILE = "agent-prefs.properties";
+ static private final String MAINTAIN_NATIVE_PREFS_SYSPROP = "rhq.preferences.migrate.keep-native-prefs";
+ static private final Boolean MAINTAIN_NATIVE_PREFS;
+
+ static {
+ Boolean sysProp = Boolean.FALSE;
+ try {
+ sysProp = Boolean.valueOf(System.getProperty(MAINTAIN_NATIVE_PREFS_SYSPROP, "false"));
+ } catch (Throwable t) {
+ sysProp = Boolean.FALSE;
+ }
+ MAINTAIN_NATIVE_PREFS = sysProp;
+ }
+
+ private File toDir;
+ private Boolean failonerror = Boolean.FALSE;
+
+ public void setToDir(File toDir) {
+ this.toDir = toDir;
+ }
+
+ public void setFailonerror(Boolean flag) {
+ this.failonerror = flag;
+ }
+
+ /**
+ * @see org.apache.tools.ant.Task#execute()
+ */
+ @Override
+ public void execute() throws BuildException {
+ validateAttributes();
+
+ try {
+ // if the prefs file already exists we can assume migration already happened or is unnecessary
+ String filePath = System.getProperty("rhq.preferences.file");
+ File toFile = (null != filePath) ? new File(filePath) : new File(toDir, DEFAULT_PREFS_FILE);
+ if (toFile.exists()) {
+ return;
+ }
+
+ Preferences userRoot = Preferences.userRoot();
+
+ // if there are no rhq-agent prefs stored then there is nothing to migrate
+ if (!userRoot.nodeExists(NODE_PARENT)) {
+ return;
+ }
+
+ Properties configProps = new Properties();
+ Preferences topNode = userRoot.node(NODE_PARENT);
+
+ // each --pref, including the default preferences are just one level down from the parent
+ for (String pref : topNode.childrenNames()) {
+ Preferences prefNode = topNode.node(pref);
+
+ for (String key : prefNode.keys()) {
+ String configPropKey = NODE_PREFIX + prefNode.name() + NODE_DELIM + key;
+ String configPropVal = prefNode.get(key, "");
+ configProps.setProperty(configPropKey, configPropVal);
+ }
+
+ }
+
+ // write out the new prefs file with the migrated properties
+ FileOutputStream fos = null;
+ try {
+ fos = new FileOutputStream(toFile);
+ configProps.store(fos, "Created by RHQ MigrateAgentPreferences tool.");
+ } finally {
+ if (null != fos) {
+ fos.close();
+ }
+ }
+
+ // wipe the old prefs to leave a clean system. In general there will only be one --pref child node,
+ // typically "default". Which means only one agent is actually configured under the "rhq-agent" top node.
+ // So, cleaning up and removing the top node should be preferable as it removes litter in the native prefs.
+ // If for some unlikely reason multiple agents are configured (using multiple --pref settings) then the user
+ // can avoid this cleanup by setting the proper system prop.
+ if (!MAINTAIN_NATIVE_PREFS) {
+ topNode.removeNode();
+ }
+
+ } catch (Throwable e) {
+ if (failonerror.booleanValue()) {
+ throw new BuildException(e);
+ } else {
+ log("Failed, but will not exit of failure: " + e);
+ }
+ }
+
+ return;
+ }
+
+ private void validateAttributes() throws BuildException {
+ if (null == toDir || !toDir.exists()) {
+ throw new BuildException("Must specify existing 'todir' directory");
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build-tasks.properties b/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build-tasks.properties
index 77c41a9..bf58b2f 100644
--- a/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build-tasks.properties
+++ b/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build-tasks.properties
@@ -1,2 +1,3 @@
-# custom ANT tasks used by the update script
-copy-with-backup=org.rhq.enterprise.agent.update.CopyWithBackup
\ No newline at end of file
+# custom ANT tasks used by the update script
+copy-with-backup = org.rhq.enterprise.agent.update.CopyWithBackup
+migrate-agent-preferences = org.rhq.enterprise.agent.update.MigrateAgentPreferences
diff --git a/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml b/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml
index 376555e..6601de3 100644
--- a/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml
+++ b/modules/enterprise/agentupdate/src/main/resources/rhq-agent-update-build.xml
@@ -128,9 +128,13 @@
<fileset dir="${rhq.agent.update.update-agent-dir}/conf">
<include name="*keystore*"/>
<include name="*truststore*"/>
+ <include name="*prefs*"/>
</fileset>
</copy>
+ <!-- if necessary, migrate native prefs into our file prefs (since RHQ 4.7) -->
+ <migrate-agent-preferences todir="${_update.tmp.dir}/rhq-agent/conf" />
+
<!-- if there are any Windows wrapper environment or include files, copy them -->
<echo>Copy existing Java Service Wrapper configuration files from the old agent to the new agent</echo>
<copy todir="${_update.tmp.dir}/rhq-agent/bin/wrapper">
diff --git a/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc b/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
index 86f0c71..b76cd2f 100644
--- a/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
+++ b/modules/enterprise/server/appserver/src/main/dev-resources/bin/wrapper/rhq-server-wrapper.inc
@@ -1,14 +1,15 @@
#
-# Additional dev-only options for the RHQ Server Java Service Wrapper
+# Additional dev-only options for the RHQ Server Java Service Wrapper. Numbering should at N+1 where N is the
+# last wrapper.java.additional.N entry in rhq-agent-wrapper.conf.
#
# enable remote debugging
-wrapper.java.additional.21=-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
+wrapper.java.additional.9=-agentlib:jdwp=transport=dt_socket,address=8787,server=y,suspend=n
# enable jprofiler
#set.PATH=%PATH%;<jprofiler-install-dir>\bin\windows
-#wrapper.java.additional.22=-agentlib:jprofilerti=port=8849
-#wrapper.java.additional.23=-Xbootclasspath/a:<jprofiler-install-dir>\bin\agent.jar
+#wrapper.java.additional.10=-agentlib:jprofilerti=port=8849
+#wrapper.java.additional.11=-Xbootclasspath/a:<jprofiler-install-dir>\bin\agent.jar
# disable JVM startup timeout
wrapper.startup.timeout=0
commit cc100b6f0791bd5dec07c9d5cadf119cf744a8d2
Author: Ian Springer <ispringer(a)apptegic.com>
Date: Mon Mar 25 12:35:29 2013 -0400
update required jdk and maven versions to match what's on https://docs.jboss.org/author/display/RHQ/Building+RHQ
diff --git a/pom.xml b/pom.xml
index 136cd73..0d6a847 100644
--- a/pom.xml
+++ b/pom.xml
@@ -1193,10 +1193,10 @@
<configuration>
<rules>
<requireMavenVersion>
- <version>2.1.0</version>
+ <version>3.0</version>
</requireMavenVersion>
<requireJavaVersion>
- <version>[1.6,1.8)</version> <!-- 1.6.x, 1.7.x -->
+ <version>[1.7,1.8)</version> <!-- 1.7.x -->
</requireJavaVersion>
</rules>
</configuration>
commit 08d1940f310b9bf4089c59b4582039a2c4ade939
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 25 12:01:29 2013 -0400
provide cause when this error happens
diff --git a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/util/PluginContainerClassEnhancer.java b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/util/PluginContainerClassEnhancer.java
index 82e64bb..aefad84 100644
--- a/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/util/PluginContainerClassEnhancer.java
+++ b/modules/core/arquillian-integration/container/src/main/java/org/rhq/test/arquillian/impl/util/PluginContainerClassEnhancer.java
@@ -66,7 +66,7 @@ public class PluginContainerClassEnhancer {
pcClass.toClass(cl, null);
} catch (Exception e) {
- throw new IllegalStateException("Could not enhance the PluginContaier class");
+ throw new IllegalStateException("Could not enhance the PluginContainer class", e);
} finally {
initialized = true;
}
commit 93fe7c6c3d209598480d4bb06d1b537c1309d575
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Mar 25 11:24:15 2013 +0100
Use the maven compiler plugin instead of the (outdated) bsc annotation processor
diff --git a/modules/helpers/rest-docs-generator/pom.xml b/modules/helpers/rest-docs-generator/pom.xml
index 208d40b..1dff5bd 100644
--- a/modules/helpers/rest-docs-generator/pom.xml
+++ b/modules/helpers/rest-docs-generator/pom.xml
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
~ 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
@@ -14,8 +14,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
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
@@ -49,43 +49,56 @@
<plugins>
<plugin>
- <groupId>org.bsc.maven</groupId>
- <artifactId>maven-processor-plugin</artifactId>
- <version>2.0.6-redhat</version>
- <configuration>
- <processors>
- <processor>org.rhq.helpers.rest_docs_generator.ClassLevelProcessor</processor>
- </processors>
- <compilerArguments>-AtargetDirectory=${project.build.directory}/docs/xml</compilerArguments>
- <!-- comment in next line to get the xml on stdout for debugging -->
- <!--<compilerArguments>-Averbose=true</compilerArguments>-->
- </configuration>
+ <groupId>org.apache.maven.plugins</groupId>
+ <artifactId>maven-compiler-plugin</artifactId>
+ <version>3.0</version>
<executions>
<execution>
- <id>create-rest-api-report</id>
- <phase>process-classes</phase>
+ <!-- Compile the sources i.e. the processor plugin-->
+ <id>compile-processor</id>
+ <phase>compile</phase>
+ <goals>
+ <goal>compile</goal>
+ </goals>
+ <configuration>
+ <proc>none</proc>
+ <verbose>false</verbose>
+ </configuration>
+ </execution>
+ <execution>
+ <!-- Execute the compiled plugin on the test sources -->
+ <id>create-rest-api-reports</id>
+ <phase>process-test-classes</phase>
<goals>
<!-- We want to process the classes in test/ -->
- <goal>process-test</goal>
+ <goal>testCompile</goal>
</goals>
+ <configuration>
+ <annotationProcessors>
+ <processor>org.rhq.helpers.rest_docs_generator.ClassLevelProcessor</processor>
+ </annotationProcessors>
+ <proc>only</proc>
+ <compilerArguments>
+ <AtargetDirectory>${project.build.directory}/docs/xml</AtargetDirectory>
+ <AmodelPkg>org.rhq.helpers.rest_docs_generator.test</AmodelPkg>
+ <!-- enable the next line to have the output of the processor shown on console -->
+ <!--<Averbose>true</Averbose>-->
+ </compilerArguments>
+ <!-- set the next to true to enable verbose output of the compiler plugin; default from the evn is true, but this is too noisy -->
+ <verbose>false</verbose>
+ </configuration>
+
</execution>
</executions>
</plugin>
- <!-- Disable annotation processors during normal compilation -->
- <plugin>
- <groupId>org.apache.maven.plugins</groupId>
- <artifactId>maven-compiler-plugin</artifactId>
- <configuration>
- <compilerArgument>-proc:none</compilerArgument>
- </configuration>
- </plugin>
+
<!-- now xml translate the output from above to html -->
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<executions>
<execution>
- <phase>process-classes</phase>
+ <phase>process-test-classes</phase>
<goals>
<goal>transform</goal>
</goals>
commit 946eb10aae312260595d5c03d3a1989497b73dc8
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Sat Mar 23 00:05:21 2013 -0400
revert this change - it broke several tests.
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 5003a7f..ba5fd3d 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
@@ -76,7 +76,6 @@ import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.content.ContentManagerHelper;
import org.rhq.enterprise.server.content.ContentManagerLocal;
import org.rhq.enterprise.server.core.AgentManagerLocal;
-import org.rhq.enterprise.server.rest.ResourceHandlerBean;
/**
* Bean to handle interaction with the resource factory subsystem of the plugin container. !! Warning, the factory
@@ -685,11 +684,9 @@ public class ResourceFactoryManagerBean implements ResourceFactoryManagerLocal,
DeleteResourceRequest request = new DeleteResourceRequest(persistedHistory.getId(), resourceId);
try {
- if (agent.getName() == null || !agent.getName().startsWith(ResourceHandlerBean.DUMMY_AGENT_NAME_PREFIX)) { // synthetic agent? We can't do anything at the moment
- AgentClient agentClient = agentManager.getAgentClient(agent);
- ResourceFactoryAgentService resourceFactoryAgentService = agentClient.getResourceFactoryAgentService();
- resourceFactoryAgentService.deleteResource(request);
- }
+ AgentClient agentClient = agentManager.getAgentClient(agent);
+ ResourceFactoryAgentService resourceFactoryAgentService = agentClient.getResourceFactoryAgentService();
+ resourceFactoryAgentService.deleteResource(request);
return persistedHistory;
} catch (CannotConnectException e) {
commit 23cbdd1dca3dbe69daae924c5d931e18ddb3dda4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 22 21:36:33 2013 -0400
get the tests to pass
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 b1d0f3a..5003a7f 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
@@ -685,7 +685,7 @@ public class ResourceFactoryManagerBean implements ResourceFactoryManagerLocal,
DeleteResourceRequest request = new DeleteResourceRequest(persistedHistory.getId(), resourceId);
try {
- if (!agent.getName().startsWith(ResourceHandlerBean.DUMMY_AGENT_NAME_PREFIX)) { // synthetic agent? We can't do anything at the moment
+ if (agent.getName() == null || !agent.getName().startsWith(ResourceHandlerBean.DUMMY_AGENT_NAME_PREFIX)) { // synthetic agent? We can't do anything at the moment
AgentClient agentClient = agentManager.getAgentClient(agent);
ResourceFactoryAgentService resourceFactoryAgentService = agentClient.getResourceFactoryAgentService();
resourceFactoryAgentService.deleteResource(request);
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 d375b16..e6a9333 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
@@ -404,11 +404,13 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
// but not if this is a synthetic agent that was created in the REST-api
// See org.rhq.enterprise.server.rest.ResourceHandlerBean.createPlatformInternal()
// See also https://docs.jboss.org/author/display/RHQ/Virtual+platforms+and+synthetic...
- if (agentClient != null && !agentClient.getAgent().getName().startsWith(ResourceHandlerBean.DUMMY_AGENT_NAME_PREFIX)) { // don't do that on "REST-agents"
- try {
- agentClient.getDiscoveryAgentService().uninventoryResource(resourceId);
- } catch (Exception e) {
- log.warn(" Unable to inform agent of inventory removal for resource [" + resourceId + "]", e);
+ if (agentClient != null) {
+ if (agentClient.getAgent() == null || agentClient.getAgent().getName() == null || !agentClient.getAgent().getName().startsWith(ResourceHandlerBean.DUMMY_AGENT_NAME_PREFIX)) { // don't do that on "REST-agents"
+ try {
+ agentClient.getDiscoveryAgentService().uninventoryResource(resourceId);
+ } catch (Exception e) {
+ log.warn(" Unable to inform agent of inventory removal for resource [" + resourceId + "]", e);
+ }
}
}
commit 896e6c6a922e7d7bbe3feebee64dd868b81d3644
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Mar 22 12:51:14 2013 -0500
[BZ 923458] Fixing build errors due to bad scope added in root pom, dependency management section.
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index f14157e..91e83ff 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -100,13 +100,6 @@
<scope>test</scope>
</dependency>
- <dependency>
- <groupId>net.sourceforge.jtds</groupId>
- <artifactId>jtds</artifactId>
- <!-- NOTE: The version is defined in the root POM's dependencyManagement section. -->
- <scope>test</scope>
- </dependency>
-
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
@@ -182,13 +175,6 @@
</dependency>
<dependency>
- <groupId>trove</groupId>
- <artifactId>trove</artifactId>
- <version>1.0.2</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
<scope>test</scope>
diff --git a/pom.xml b/pom.xml
index b849d13..136cd73 100644
--- a/pom.xml
+++ b/pom.xml
@@ -667,7 +667,6 @@
<artifactId>jboss-javaee-6.0</artifactId>
<version>${jboss.javaee6.spec.version}</version>
<type>pom</type>
- <scope>import,provided</scope>
</dependency>
<!-- We want the shrinkwrap dependency resolver to be newer than that included in the Arquillian BOM.
@@ -679,6 +678,11 @@
<scope>import</scope>
<type>pom</type>
</dependency>
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <version>${shrinkwrap-resolver.version}</version>
+ </dependency>
<!-- This will pull in the compatible versions of shrinkwrap deps too. Note that we want to use an explicit
version for the shrinkwrap resolver, which revs more often and has bugfixes. -->
<dependency>
@@ -690,6 +694,12 @@
</dependency>
<dependency>
+ <groupId>org.jboss.arquillian.testng</groupId>
+ <artifactId>arquillian-testng-container</artifactId>
+ <version>${arquillian.version}</version>
+ </dependency>
+
+ <dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-jacoco</artifactId>
<version>${jacoco-arquillian-extension.version}</version>
commit ed813bd93929d0f5b81b0a877b3d0b17b10786ab
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Fri Mar 22 17:38:12 2013 +0100
More work on the rest-api. It is now possible to create content-based resources.
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 ba5fd3d..b1d0f3a 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
@@ -76,6 +76,7 @@ import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.content.ContentManagerHelper;
import org.rhq.enterprise.server.content.ContentManagerLocal;
import org.rhq.enterprise.server.core.AgentManagerLocal;
+import org.rhq.enterprise.server.rest.ResourceHandlerBean;
/**
* Bean to handle interaction with the resource factory subsystem of the plugin container. !! Warning, the factory
@@ -684,9 +685,11 @@ public class ResourceFactoryManagerBean implements ResourceFactoryManagerLocal,
DeleteResourceRequest request = new DeleteResourceRequest(persistedHistory.getId(), resourceId);
try {
- AgentClient agentClient = agentManager.getAgentClient(agent);
- ResourceFactoryAgentService resourceFactoryAgentService = agentClient.getResourceFactoryAgentService();
- resourceFactoryAgentService.deleteResource(request);
+ if (!agent.getName().startsWith(ResourceHandlerBean.DUMMY_AGENT_NAME_PREFIX)) { // synthetic agent? We can't do anything at the moment
+ AgentClient agentClient = agentManager.getAgentClient(agent);
+ ResourceFactoryAgentService resourceFactoryAgentService = agentClient.getResourceFactoryAgentService();
+ resourceFactoryAgentService.deleteResource(request);
+ }
return persistedHistory;
} catch (CannotConnectException e) {
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 6c46172..d375b16 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
@@ -127,6 +127,7 @@ 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.rest.ResourceHandlerBean;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.QueryUtility;
@@ -333,7 +334,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
+ "]. Unable to inform agent of inventory removal (this may be ok): " + t);
}
- // since we delete the resource asynchronously, make sure we remove things that would cause system
+ // since we delete the resource asynchronously, make sure we remove things that would cause system
// side effects after markForDeletion completed but before the resource is actually removed from the DB
// delete the resource and all its children
@@ -362,7 +363,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
log.debug("== Bounds " + i + ", " + j);
}
- // refresh overlord session for each batch to avoid session timeout
+ // refresh overlord session for each batch to avoid session timeout
overlord = subjectManager.getOverlord();
boolean hasErrors = uninventoryResourcesBulkDelete(overlord, idsToDelete);
if (hasErrors) {
@@ -400,7 +401,10 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
}
// still need to tell the agent about the removed resources so it stops avail reports
- if (agentClient != null) {
+ // but not if this is a synthetic agent that was created in the REST-api
+ // See org.rhq.enterprise.server.rest.ResourceHandlerBean.createPlatformInternal()
+ // See also https://docs.jboss.org/author/display/RHQ/Virtual+platforms+and+synthetic...
+ if (agentClient != null && !agentClient.getAgent().getName().startsWith(ResourceHandlerBean.DUMMY_AGENT_NAME_PREFIX)) { // don't do that on "REST-agents"
try {
agentClient.getDiscoveryAgentService().uninventoryResource(resourceId);
} catch (Exception e) {
@@ -2692,7 +2696,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
List<Integer> disableResourceIds = new ArrayList<Integer>();
- // one report for each agent, keyed by agent name
+ // one report for each agent, keyed by agent name
Map<Agent, AvailabilityReport> reports = resourceManager.getDisableResourcesReportInNewTransaction(subject,
resourceIds, disableResourceIds);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
index 0e337a7..2746823 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AbstractRestBean.java
@@ -35,13 +35,14 @@ import java.util.Set;
import javax.annotation.PostConstruct;
import javax.ejb.EJB;
+import javax.ws.rs.core.CacheControl;
+import javax.ws.rs.core.Response;
import javax.ws.rs.core.UriBuilder;
import javax.ws.rs.core.UriInfo;
import freemarker.cache.ClassTemplateLoader;
import freemarker.cache.MultiTemplateLoader;
import freemarker.cache.TemplateLoader;
-import freemarker.template.Configuration;
import freemarker.template.Template;
import freemarker.template.TemplateException;
@@ -51,6 +52,8 @@ import org.infinispan.Cache;
import org.infinispan.manager.CacheContainer;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.configuration.Configuration;
+import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.MeasurementSchedule;
@@ -110,7 +113,7 @@ public class AbstractRestBean {
*/
protected String renderTemplate(String templateName, Object objectToRender) {
try {
- freemarker.template.Configuration config = new Configuration();
+ freemarker.template.Configuration config = new freemarker.template.Configuration();
// XXX fall-over to ClassTL after failure in FTL seems not to work
// FileTemplateLoader ftl = new FileTemplateLoader(new File("src/main/resources"));
@@ -379,6 +382,10 @@ public class AbstractRestBean {
uriBuilder.path("/resource/{id}/children");
uri = uriBuilder.build(res.getId());
link = new Link("children", uri.toString());
+ uriBuilder = uriInfo.getBaseUriBuilder();
+ uriBuilder.path("/resource/{id}/alerts");
+ uri = uriBuilder.build(res.getId());
+ link = new Link("alerts", uri.toString());
rwt.addLink(link);
if (parent != null) {
uriBuilder = uriInfo.getBaseUriBuilder();
@@ -519,6 +526,31 @@ public class AbstractRestBean {
return ms;
}
+ Configuration mapToConfiguration(Map<String,Object> in) {
+ Configuration config = new Configuration();
+ for (Map.Entry<String,Object> entry : in.entrySet()) {
+ config.put(new PropertySimple(entry.getKey(),entry.getValue())); // TODO honor more types
+ }
+
+ return config;
+
+ }
+
+ /**
+ * Set the caching header on the response
+ * @param builder Response builder to put the caching header on
+ * @param maxAgeSecs Max retention time on the client. Only set if the value is > 0
+ */
+ protected void setCachingHeader(Response.ResponseBuilder builder, int maxAgeSecs) {
+ CacheControl cc = new CacheControl();
+ cc.setPrivate(false);
+ cc.setNoCache(false);
+ cc.setNoStore(false);
+ if (maxAgeSecs>-1)
+ cc.setMaxAge(maxAgeSecs);
+ builder.cacheControl(cc);
+ }
+
protected static class CacheKey {
private String namespace;
private int id;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ContentHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ContentHandlerBean.java
new file mode 100644
index 0000000..5a0c13a
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ContentHandlerBean.java
@@ -0,0 +1,169 @@
+/*
+ * 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.enterprise.server.rest;
+
+import java.io.BufferedInputStream;
+import java.io.BufferedOutputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.net.URI;
+
+import javax.ejb.Stateless;
+import javax.interceptor.Interceptors;
+import javax.ws.rs.Consumes;
+import javax.ws.rs.DELETE;
+import javax.ws.rs.GET;
+import javax.ws.rs.POST;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriBuilder;
+import javax.ws.rs.core.UriInfo;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+import org.rhq.enterprise.server.rest.domain.IntegerValue;
+import org.rhq.enterprise.server.rest.domain.StringValue;
+
+/**
+ * Deal with content
+ * @author Heiko W. Rupp
+ */
+@Path("/content")
+@Api(value="Resource related", description = "This endpoint deals with individual resources, not resource groups")
+(a)Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
+(a)Interceptors(SetCallerInterceptor.class)
+@Stateless
+public class ContentHandlerBean extends AbstractRestBean {
+
+
+ @POST
+ @Path("/fresh")
+ @Consumes(MediaType.APPLICATION_OCTET_STREAM)
+ @Produces({MediaType.APPLICATION_XML,MediaType.APPLICATION_JSON})
+ @ApiOperation("Upload content to the server. This will return a handle that can be used later to retrieve the content")
+ public Response uploadContent(
+ InputStream contentStream,
+ @Context HttpHeaders headers,
+ @Context UriInfo uriInfo) throws IOException
+ {
+
+ String tmpDirName = System.getProperty("java.io.tmpdir");
+
+ File tmpDir = new File(tmpDirName);
+ File outFile = File.createTempFile("rhq-rest-",".bin",tmpDir);
+
+ FileOutputStream fos = new FileOutputStream(outFile);
+ BufferedOutputStream bos = new BufferedOutputStream(fos);
+
+ BufferedInputStream bis = new BufferedInputStream(contentStream);
+
+ byte[] buf = new byte[32768]; // 32k
+
+ int data;
+ int off=0;
+ while ((data=bis.read(buf))!=-1) {
+ bos.write(buf,off,data);
+ off+=data;
+ }
+
+ bos.flush();
+ bos.close();
+ bis.close();
+
+ String fileHandle = outFile.getName();
+ StringValue sv = new StringValue(fileHandle);
+
+ System.out.println("Uploaded content to " + outFile.getAbsolutePath());
+
+ UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
+ uriBuilder.path("/content/{handle}");
+ URI uri = uriBuilder.build(fileHandle);
+
+
+ MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
+
+ Response.ResponseBuilder builder = Response.created(uri);
+ builder.entity(sv);
+ builder.type(mediaType);
+
+ return builder.build();
+ }
+
+ @GET
+ @Path("/{handle}/info")
+ public IntegerValue getInfo(
+ @PathParam("handle") String handle
+ )
+ {
+
+ File content = getFileForHandle(handle);
+
+ if (!content.exists() || !content.canRead())
+ throw new StuffNotFoundException("Content with handle " + handle);
+
+ long len = content.length();
+
+ IntegerValue iv = new IntegerValue((int)len); // TODO
+
+ return iv;
+ }
+
+
+ @DELETE
+ @Path("/{handle}")
+ public Response removeUploadedContent(
+ @PathParam("handle") String handle
+ )
+ {
+ File content = getFileForHandle(handle);
+
+ Response.ResponseBuilder builder;
+ if (!content.exists())
+ builder = Response.noContent();
+
+ else {
+ boolean deleted = content.delete();
+ if (deleted)
+ builder = Response.noContent();
+ else {
+ builder = Response.serverError();
+ System.err.println("Deletion of " + content.getAbsolutePath() + " failed");
+ }
+ }
+ return builder.build();
+ }
+
+ private File getFileForHandle(String handle) {
+ String tmpDirName = System.getProperty("java.io.tmpdir");
+
+ File tmpDir = new File(tmpDirName);
+ return new File(tmpDir,handle);
+ }
+
+}
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 a94b81c..ccfed9f 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
@@ -289,10 +289,8 @@ public class OperationsHandlerBean extends AbstractRestBean {
// submit
- Configuration parameters = new Configuration();
- for (Map.Entry<String,Object> entry : operation.getParams().entrySet()) {
- parameters.put(new PropertySimple(entry.getKey(),entry.getValue())); // TODO honor more types
- }
+ Configuration parameters = mapToConfiguration(operation.getParams());
+
ResourceOperationSchedule sched = opsManager.scheduleResourceOperation(caller,operation.getResourceId(),operation.getName(),0,0,0,-1,
parameters,"Test");
JobId jobId = new JobId(sched.getJobName(),sched.getJobGroup());
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 88a585f..1c2b516 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
@@ -22,6 +22,10 @@
*/
package org.rhq.enterprise.server.rest;
+import java.io.BufferedInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.IOException;
import java.net.URI;
import java.util.ArrayList;
import java.util.Date;
@@ -30,11 +34,13 @@ import java.util.Set;
import java.util.UUID;
import javax.ejb.EJB;
+import javax.ejb.EJBTransactionRolledbackException;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import javax.interceptor.Interceptors;
import javax.persistence.EntityManager;
+import javax.persistence.NoResultException;
import javax.persistence.PersistenceContext;
import javax.ws.rs.DELETE;
import javax.ws.rs.DefaultValue;
@@ -66,6 +72,7 @@ import org.jboss.resteasy.links.AddLinks;
import org.jboss.resteasy.links.LinkResource;
import org.rhq.core.domain.alert.Alert;
+import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.criteria.AlertCriteria;
import org.rhq.core.domain.criteria.AvailabilityCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
@@ -76,10 +83,13 @@ import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.MeasurementSchedule;
import org.rhq.core.domain.resource.Agent;
+import org.rhq.core.domain.resource.CreateResourceHistory;
+import org.rhq.core.domain.resource.CreateResourceStatus;
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.ResourceType;
+import org.rhq.core.domain.resource.composite.ResourceAvailabilitySummary;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -87,10 +97,12 @@ import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.alert.AlertManagerLocal;
import org.rhq.enterprise.server.core.AgentManagerLocal;
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.ResourceFactoryManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.rest.domain.AvailabilityRest;
+import org.rhq.enterprise.server.rest.domain.AvailabilitySummary;
+import org.rhq.enterprise.server.rest.domain.CreateCBRresourceRequest;
import org.rhq.enterprise.server.rest.domain.Link;
import org.rhq.enterprise.server.rest.domain.MetricSchedule;
import org.rhq.enterprise.server.rest.domain.ResourceWithChildren;
@@ -109,17 +121,21 @@ import org.rhq.enterprise.server.rest.domain.StringValue;
public class ResourceHandlerBean extends AbstractRestBean {
private static final String NO_RESOURCE_FOR_ID = "If no resource with the passed id exists";
+ private static final String DEFAULT_PACKAGE = "default.rest.package";
+
+ // Name prefix for synthetic/dummy agents created with the rest api. See #createPlatformInternal
+ public static final String DUMMY_AGENT_NAME_PREFIX = "dummy-agent:name";
@EJB
AvailabilityManagerLocal availMgr;
@EJB
- MeasurementScheduleManagerLocal scheduleManager;
- @EJB
AlertManagerLocal alertManager;
@EJB
ResourceTypeManagerLocal resourceTypeManager;
@EJB
AgentManagerLocal agentMgr;
+ @EJB
+ ResourceFactoryManagerLocal resourceFactory;
@PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME)
private EntityManager entityManager;
@@ -209,7 +225,7 @@ public class ResourceHandlerBean extends AbstractRestBean {
* @param uriInfo Uri from the request
* @param resources List of resources
* @param page Page of pageSize. If null, paging is ignored
- * @param pageSize numer of elements on a page
+ * @param pageSize number of elements on a page
* @return An initialized ResponseBuilder
*/
private Response.ResponseBuilder getResponseBuilderForResourceList(HttpHeaders headers, UriInfo uriInfo,
@@ -332,7 +348,7 @@ public class ResourceHandlerBean extends AbstractRestBean {
criteria.addFilterResourceId(resourceId);
criteria.addSortStartTime(PageOrdering.DESC);
- List<Availability> points = availMgr.findAvailabilityByCriteria(caller,criteria);
+ List<Availability> points = availMgr.findAvailabilityByCriteria(caller, criteria);
List<AvailabilityRest> ret = new ArrayList<AvailabilityRest>(points.size());
for (Availability avail : points) {
AvailabilityRest availabilityRest;
@@ -360,6 +376,26 @@ public class ResourceHandlerBean extends AbstractRestBean {
}
+ @GET
+ @Path("/{id}/availability/summary")
+ @ApiError(code = 404, reason = NO_RESOURCE_FOR_ID)
+ @ApiOperation(value = "Return the availability history for the passed resource", responseClass = "AvailabilitySummary", multiValueResponse = false)
+ public Response getAvailabilitySummary(
+ @ApiParam("Id of the resource to query") @PathParam("id") int resourceId,
+ @Context HttpHeaders headers) {
+
+ fetchResource(resourceId);
+ ResourceAvailabilitySummary summary = resMgr.getAvailabilitySummary(caller,resourceId);
+ AvailabilitySummary as = new AvailabilitySummary(resourceId,summary);
+
+ Response.ResponseBuilder builder = Response.ok(as);
+
+ MediaType type = headers.getAcceptableMediaTypes().get(0);
+ builder.type(type);
+
+ return builder.build();
+
+ }
@PUT
@Path("/{id}/availability")
@@ -487,7 +523,7 @@ public class ResourceHandlerBean extends AbstractRestBean {
}
private Resource obtainResource(int resourceId) {
- Resource resource = resMgr.getResource(caller,resourceId);
+ Resource resource = resMgr.getResource(caller, resourceId);
if (resource == null) {
resource = resMgr.getResource(caller, resourceId);
if (resource != null)
@@ -546,7 +582,7 @@ public class ResourceHandlerBean extends AbstractRestBean {
String typeName = resource.getTypeName();
String resourceName = resource.getResourceName();
- return createPlatformInternal(resourceName,typeName,uriInfo);
+ return createPlatformInternal(resourceName, typeName, uriInfo);
}
@@ -575,8 +611,9 @@ public class ResourceHandlerBean extends AbstractRestBean {
}
// Create a dummy agent per platform - otherwise we can't delete the platform later
+ // See also https://docs.jboss.org/author/display/RHQ/Virtual+platforms+and+synthetic...
Agent agent ;
- agent = new Agent("dummy-agent:name"+name,"-dummy-p:"+name,12345,"http://foo.com/p:name/"+name,"abc-"+name);
+ agent = new Agent(DUMMY_AGENT_NAME_PREFIX +name,"-dummy-p:"+name,12345,"http://foo.com/p:name/"+name,"abc-"+name);
agentMgr.createAgent(agent);
Resource platform = new Resource(resourceKey,name,type);
@@ -627,12 +664,19 @@ public class ResourceHandlerBean extends AbstractRestBean {
@POST
@Path("/")
- @ApiOperation("Create a new resource as a child of an existing resource<A1>")
+ @ApiOperation("Create a new resource as a child of an existing resource. If a handle is given, a content based resource is created.")
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,
- @Context UriInfo uriInfo)
+ @ApiParam("The info about the resource. You need to supply resource name, resource type name, plugin name, id of the parent") CreateCBRresourceRequest resource,
+ @Context HttpHeaders headers,
+ @QueryParam("handle") String handle,
+ @Context UriInfo uriInfo) throws IOException
{
- return createResourceInternal(resource.getResourceName(),resource.getPluginName(),resource.getParentId(),resource.getTypeName(),uriInfo);
+
+ if (handle!=null) {
+ return createContentBackedResource(resource,handle,headers,uriInfo);
+ } else {
+ return createResourceInternal(resource.getResourceName(),resource.getPluginName(),resource.getParentId(),resource.getTypeName(),uriInfo);
+ }
}
private Response createResourceInternal(String name, String plugin, int parentId, String typeName,
@@ -687,14 +731,154 @@ public class ResourceHandlerBean extends AbstractRestBean {
}
}
+ private Response createContentBackedResource(CreateCBRresourceRequest request, String handle, HttpHeaders headers, UriInfo uriInfo) throws IOException
+ {
+ int parentId = request.getParentId();
+ String typeName = request.getTypeName();
+ String plugin = request.getPluginName();
+ String name = request.getResourceName();
+
+ String tmpDirName = System.getProperty("java.io.tmpdir");
+
+ File tmpDir = new File(tmpDirName);
+ File content = new File(tmpDir,handle);
+
+ if (!content.exists() || !content.canRead())
+ throw new StuffNotFoundException("Content for handle " + handle);
+
+ BufferedInputStream resourceBits = new BufferedInputStream(new FileInputStream(content));
+
+ // Check for valid parent
+ fetchResource(parentId);
+
+ ResourceType resType = resourceTypeManager.getResourceTypeByNameAndPlugin(typeName,plugin);
+ if (resType==null)
+ throw new StuffNotFoundException("ResourceType with name [" + typeName + "] and plugin [" + plugin + "]");
+
+ Configuration pluginConfig = mapToConfiguration(request.getPluginConfig());
+ Configuration deployConfig = mapToConfiguration(request.getResourceConfig());
+
+ String packageName = DEFAULT_PACKAGE;
+
+ CreateResourceHistory history = resourceFactory.createResource(caller,parentId, resType.getId(),name,pluginConfig,
+ packageName, null,null,deployConfig,resourceBits);
+
+ CreateResourceStatus status = history.getStatus();
+
+
+ MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
+
+ Response.ResponseBuilder builder;
+
+ if ( status == CreateResourceStatus.SUCCESS) {
+
+ ResourceWithType rwt = findCreatedResource(history.getParentResource().getId(),history.getCreatedResourceName(),uriInfo);
+
+ builder = Response.ok();
+ builder.entity(rwt);
+ }
+ else if (status==CreateResourceStatus.IN_PROGRESS) {
+
+ try {
+ Thread.sleep(2000L); // give the agent time to do the work
+ } catch (InterruptedException e) {
+ ; // nothing
+ }
+
+ UriBuilder uriBuilder = uriInfo.getBaseUriBuilder();
+ uriBuilder.path("/resource/creationStatus/{id}");
+ URI uri = uriBuilder.build(history.getId());
+ builder = Response.status(302);
+ builder.location(uri); // redirect to self
+
+ }
+ else { // All kinds of failures
+ builder = Response.serverError();
+ builder.entity(new StringValue(history.getErrorMessage()));
+ }
+ builder.type(mediaType);
+
+ return builder.build();
+
+
+ }
+
+ @GET
+ @Path("/creationStatus/{id}")
+ @ApiOperation("Get the status of a resource creation for content based resources.")
+ public Response getHistoryItem(@PathParam("id") int historyId, @Context HttpHeaders headers, @Context UriInfo uriInfo) {
+
+ CreateResourceHistory history;
+ try {
+ history = resourceFactory.getCreateHistoryItem(historyId);
+ } catch (EJBTransactionRolledbackException e) {
+ if (e.getCause() instanceof NoResultException)
+ throw new StuffNotFoundException("Resource creation status with id " + historyId);
+ else
+ return Response.serverError().entity(e.getMessage()).build();
+ }
+
+ CreateResourceStatus status = history.getStatus();
+
+ Response.ResponseBuilder builder;
+ try {
+ Thread.sleep(2000L); // give the agent time to do the work
+ } catch (InterruptedException e) {
+ ; // nothing
+ }
+ if (status== CreateResourceStatus.SUCCESS) {
+
+ ResourceWithType rwt = findCreatedResource(history.getParentResource().getId(),history.getCreatedResourceName(),uriInfo);
+
+ builder = Response.ok();
+ setCachingHeader(builder, 600);
+ builder.entity(rwt);
+
+ }
+ else if (status==CreateResourceStatus.IN_PROGRESS) {
+
+
+ UriBuilder uriBuilder = uriInfo.getRequestUriBuilder();
+ URI uri = uriBuilder.build();
+ builder = Response.status(302);
+ builder.location(uri); // redirect to self
+ }
+ else {
+ builder = Response.serverError();
+ }
+
+ MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
+ builder.type(mediaType);
+
+ return builder.build();
+
+ }
+
+ private ResourceWithType findCreatedResource(int parentId, String name, UriInfo uriInfo) {
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.setStrict(true);
+ criteria.addFilterParentResourceId(parentId);
+ criteria.addFilterName(name);
+ criteria.addFilterInventoryStatus(InventoryStatus.COMMITTED);
+ List<Resource> resources = resMgr.findResourcesByCriteria(caller,criteria);
+ Resource res = resources.get(0);
+ return fillRWT(res,uriInfo);
+ }
+
+
@DELETE
@Path("/{id}")
@ApiOperation("Remove a resource from inventory")
public Response uninventoryOrDeleteResource(
@PathParam("id") int resourceId
- /*,@DefaultValue("false") @QueryParam("physical") boolean delete*/) {
+ ,@DefaultValue("false") @QueryParam("physical") boolean delete) {
- resMgr.uninventoryResource(caller,resourceId);
+ if (delete==false) {
+ resMgr.uninventoryResource(caller,resourceId);
+ }
+ else {
+ resourceFactory.deleteResource(caller,resourceId);
+ }
return Response.status(Response.Status.NO_CONTENT).build();
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceTypeHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceTypeHandlerBean.java
new file mode 100644
index 0000000..ad1fc3e
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceTypeHandlerBean.java
@@ -0,0 +1,97 @@
+/*
+ * 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.enterprise.server.rest;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+import javax.interceptor.Interceptors;
+import javax.ws.rs.GET;
+import javax.ws.rs.Path;
+import javax.ws.rs.PathParam;
+import javax.ws.rs.Produces;
+import javax.ws.rs.core.Context;
+import javax.ws.rs.core.HttpHeaders;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import com.wordnik.swagger.annotations.Api;
+import com.wordnik.swagger.annotations.ApiError;
+import com.wordnik.swagger.annotations.ApiOperation;
+
+import org.jboss.resteasy.annotations.cache.Cache;
+
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
+import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
+import org.rhq.enterprise.server.rest.domain.ResourceTypeRest;
+
+/**
+ * Deal with resource types
+ * @author Heiko W. Rupp
+ */
+(a)Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML})
+@Path("/resource/type")
+@Api(value="Resource type related", description = "This endpoint deals with resource types")
+(a)Interceptors(SetCallerInterceptor.class)
+@Stateless
+
+public class ResourceTypeHandlerBean extends AbstractRestBean {
+
+
+ @EJB
+ ResourceTypeManagerLocal typeManager;
+
+
+ @Cache(maxAge = 600)
+ @GET
+ @Path("{id}")
+ @ApiOperation(value = "Return information about the resource type with the passed id",responseClass = "ResourceTypeRest")
+ @ApiError(code = 404, reason = "There is no type with the passed id")
+ public Response getTypeById(
+ @PathParam("id") int resourceTypeId,
+ @Context HttpHeaders headers,
+ @Context UriInfo uriInfo) {
+
+
+ ResourceType type;
+ try {
+ type = typeManager.getResourceTypeById(caller,resourceTypeId);
+ } catch (ResourceTypeNotFoundException e) {
+ throw new StuffNotFoundException("Resource type with id " + resourceTypeId);
+ }
+
+ ResourceTypeRest rtr = new ResourceTypeRest();
+ rtr.setId(resourceTypeId);
+ rtr.setName(type.getName());
+ rtr.setPluginName(type.getPlugin());
+ rtr.setCreatePolicy(type.getCreateDeletePolicy());
+ rtr.setDataType(type.getCreationDataType());
+
+ MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
+
+ Response.ResponseBuilder builder = Response.ok();
+ builder.type(mediaType);
+ builder.entity(rtr);
+ return builder.build();
+
+ }
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/AvailabilitySummary.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/AvailabilitySummary.java
new file mode 100644
index 0000000..deb4f4d
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/AvailabilitySummary.java
@@ -0,0 +1,221 @@
+/*
+ * 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.enterprise.server.rest.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.wordnik.swagger.annotations.ApiClass;
+
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.resource.composite.ResourceAvailabilitySummary;
+
+/**
+ * Reports the summary of the availability for a resource
+ * @author Heiko W. Rupp
+ */
+@ApiClass("Describes the availability summary for a resource")
+@XmlRootElement
+public class AvailabilitySummary {
+
+ private long currentTime; // set to the current time when this object was created
+ private long upTime;
+ private long downTime;
+ private long disabledTime;
+ private long unknownTime;
+ private int failures;
+ private int disabled;
+ private long lastChange;
+ private AvailabilityType current;
+ private int resourceId;
+ private double disabledPercentage;
+ private double upPercentage;
+ private long knownTime;
+ private long mtbf;
+ private long mttr;
+ private double downPercentage;
+
+
+ List<Link> links = new ArrayList<Link>();
+
+ public AvailabilitySummary() {
+
+ }
+
+ public AvailabilitySummary(int resourceId, ResourceAvailabilitySummary ras) {
+
+ this.resourceId = resourceId;
+ currentTime = ras.getCurrentTime();
+ upTime = ras.getUpTime();
+ downTime = ras.getDownTime();
+ disabledTime = ras.getDisabledTime();
+ unknownTime = ras.getUnknownTime();
+ failures = ras.getFailures();
+ disabled = ras.getDisabled();
+ lastChange = ras.getLastChange().getTime();
+ current = ras.getCurrent();
+
+ disabledPercentage = ras.getDisabledPercentage();
+ downPercentage = ras.getDownPercentage();
+ upPercentage = ras.getUpPercentage();
+ knownTime = ras.getKnownTime();
+ unknownTime = ras.getUnknownTime();
+ mtbf = ras.getMTBF();
+ mttr = ras.getMTTR();
+ }
+
+ public AvailabilityType getCurrent() {
+ return current;
+ }
+
+ public void setCurrent(AvailabilityType current) {
+ this.current = current;
+ }
+
+ public int getDisabled() {
+ return disabled;
+ }
+
+ public void setDisabled(int disabled) {
+ this.disabled = disabled;
+ }
+
+ public long getDisabledTime() {
+ return disabledTime;
+ }
+
+ public void setDisabledTime(long disabledTime) {
+ this.disabledTime = disabledTime;
+ }
+
+ public long getDownTime() {
+ return downTime;
+ }
+
+ public void setDownTime(long downTime) {
+ this.downTime = downTime;
+ }
+
+ public int getFailures() {
+ return failures;
+ }
+
+ public void setFailures(int failures) {
+ this.failures = failures;
+ }
+
+ public long getLastChange() {
+ return lastChange;
+ }
+
+ public void setLastChange(long lastChange) {
+ this.lastChange = lastChange;
+ }
+
+ public List<Link> getLinks() {
+ return links;
+ }
+
+ public void setLinks(List<Link> links) {
+ this.links = links;
+ }
+
+ public long getCurrentTime() {
+ return currentTime;
+ }
+
+ public void setCurrentTime(long currentTime) {
+ this.currentTime = currentTime;
+ }
+
+ public int getResourceId() {
+ return resourceId;
+ }
+
+ public void setResourceId(int resourceId) {
+ this.resourceId = resourceId;
+ }
+
+ public long getUnknownTime() {
+ return unknownTime;
+ }
+
+ public void setUnknownTime(long unknownTime) {
+ this.unknownTime = unknownTime;
+ }
+
+ public long getUpTime() {
+ return upTime;
+ }
+
+ public void setUpTime(long upTime) {
+ this.upTime = upTime;
+ }
+
+ public double getDisabledPercentage() {
+ return disabledPercentage;
+ }
+
+ public void setDisabledPercentage(double disabledPercentage) {
+ this.disabledPercentage = disabledPercentage;
+ }
+
+ public double getDownPercentage() {
+ return downPercentage;
+ }
+
+ public void setDownPercentage(double downPercentage) {
+ this.downPercentage = downPercentage;
+ }
+
+ public long getKnownTime() {
+ return knownTime;
+ }
+
+ public void setKnownTime(long knownTime) {
+ this.knownTime = knownTime;
+ }
+
+ public long getMtbf() {
+ return mtbf;
+ }
+
+ public void setMtbf(long mtbf) {
+ this.mtbf = mtbf;
+ }
+
+ public long getMttr() {
+ return mttr;
+ }
+
+ public void setMttr(long mttr) {
+ this.mttr = mttr;
+ }
+
+ public double getUpPercentage() {
+ return upPercentage;
+ }
+
+ public void setUpPercentage(double upPercentage) {
+ this.upPercentage = upPercentage;
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBRresourceRequest.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBRresourceRequest.java
new file mode 100644
index 0000000..aa1679a
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/CreateCBRresourceRequest.java
@@ -0,0 +1,56 @@
+/*
+ * 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.enterprise.server.rest.domain;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import com.wordnik.swagger.annotations.ApiClass;
+import com.wordnik.swagger.annotations.ApiProperty;
+
+/**
+ * Request to create a content based resource
+ * @author Heiko W. Rupp
+ */
+@ApiClass("A request to create a content-based resource. For this to work, it is required that the content to be deployed is already uploaded to the server.")
+public class CreateCBRresourceRequest extends ResourceWithType {
+
+ Map<String,Object> pluginConfig = new HashMap<String, Object>();
+ Map<String,Object> resourceConfig = new HashMap<String, Object>();
+
+ @ApiProperty("The configuration of the connection properties")
+ public Map<String, Object> getPluginConfig() {
+ return pluginConfig;
+ }
+
+ public void setPluginConfig(Map<String, Object> pluginConfig) {
+ this.pluginConfig = pluginConfig;
+ }
+
+ @ApiProperty("The configuration of the resource to be created")
+ public Map<String, Object> getResourceConfig() {
+ return resourceConfig;
+ }
+
+ public void setResourceConfig(Map<String, Object> resourceConfig) {
+ this.resourceConfig = resourceConfig;
+ }
+
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/ResourceTypeRest.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/ResourceTypeRest.java
new file mode 100644
index 0000000..88988a0
--- /dev/null
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/domain/ResourceTypeRest.java
@@ -0,0 +1,98 @@
+/*
+ * 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.enterprise.server.rest.domain;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+import com.wordnik.swagger.annotations.ApiClass;
+
+import org.rhq.core.domain.resource.CreateDeletePolicy;
+import org.rhq.core.domain.resource.ResourceCreationDataType;
+
+/**
+ * A resource type
+ * @author Heiko W. Rupp
+ */
+@ApiClass("A resource type")
+@XmlRootElement(name = "resourceType")
+public class ResourceTypeRest {
+
+ int id;
+ String name;
+ String pluginName;
+ CreateDeletePolicy createPolicy;
+ ResourceCreationDataType dataType;
+
+ List<Link> links = new ArrayList<Link>();
+
+ public ResourceTypeRest() {
+ }
+
+ public CreateDeletePolicy getCreatePolicy() {
+ return createPolicy;
+ }
+
+ public void setCreatePolicy(CreateDeletePolicy createPolicy) {
+ this.createPolicy = createPolicy;
+ }
+
+ public ResourceCreationDataType getDataType() {
+ return dataType;
+ }
+
+ public void setDataType(ResourceCreationDataType dataType) {
+ this.dataType = dataType;
+ }
+
+ public int getId() {
+ return id;
+ }
+
+ public void setId(int id) {
+ this.id = id;
+ }
+
+ public List<Link> getLinks() {
+ return links;
+ }
+
+ public void setLinks(List<Link> links) {
+ this.links = links;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public String getPluginName() {
+ return pluginName;
+ }
+
+ public void setPluginName(String pluginName) {
+ this.pluginName = pluginName;
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/helper/LinkSerializer.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/helper/LinkSerializer.java
index 2863745..a58efd3 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/helper/LinkSerializer.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/helper/LinkSerializer.java
@@ -51,9 +51,4 @@ public class LinkSerializer extends JsonSerializer<Link> {
jsonGenerator.writeEndObject();
}
-
- @Override
- public Class<Link> handledType() {
- return Link.class;
- }
}
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
index 6a0c0a1..9f6a02b 100644
--- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
@@ -23,19 +23,15 @@ import java.util.Map;
import com.jayway.restassured.RestAssured;
import com.jayway.restassured.http.ContentType;
-import com.jayway.restassured.mapper.factory.DefaultJackson1ObjectMapperFactory;
import com.jayway.restassured.response.Header;
-import org.junit.After;
import org.junit.AfterClass;
import org.junit.Before;
-import org.junit.BeforeClass;
import org.rhq.modules.integrationTests.restApi.d.Resource;
import static com.jayway.restassured.RestAssured.basic;
import static com.jayway.restassured.RestAssured.given;
-import static com.jayway.restassured.RestAssured.objectMapper;
/**
* Common setup for the tests
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 96935f1..3d9f735 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
@@ -34,7 +34,9 @@ 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.CoreMatchers.not;
import static org.hamcrest.Matchers.contains;
+import static org.hamcrest.Matchers.emptyIterable;
import static org.hamcrest.Matchers.instanceOf;
import static org.hamcrest.Matchers.is;
import static org.hamcrest.Matchers.iterableWithSize;
@@ -1473,6 +1475,17 @@ public class AlertTest extends AbstractBase {
.get("/alert/{id}/notifications");
+ // See if the resource has an alert recorded
+ given()
+ .header(acceptJson)
+ .pathParam("resourceId",_platformId)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("",not(emptyIterable()))
+ .when()
+ .get("/resource/{resourceId}/alerts");
+
}
finally {
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ContentTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ContentTest.java
new file mode 100644
index 0000000..5532b13
--- /dev/null
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ContentTest.java
@@ -0,0 +1,333 @@
+/*
+ * 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;
+
+import java.io.ByteArrayOutputStream;
+import java.io.InputStream;
+import java.util.List;
+import java.util.Map;
+
+import com.jayway.restassured.http.ContentType;
+import com.jayway.restassured.response.Response;
+
+import org.junit.Test;
+
+import org.rhq.modules.integrationTests.restApi.d.CreateCBRRequest;
+
+import static com.jayway.restassured.RestAssured.given;
+import static org.hamcrest.Matchers.*;
+import static org.hamcrest.Matchers.isOneOf;
+
+/**
+ * Test content upload and creation of content based resources
+ * @author Heiko W. Rupp
+ */
+public class ContentTest extends AbstractBase {
+
+ @Test
+ public void testUpload() throws Exception {
+
+ InputStream in =
+ getClass().getClassLoader().getResourceAsStream("test-simple.war");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ int data;
+ while ((data = in.read())!=-1) {
+ baos.write(data);
+ }
+
+ byte[] bytes = baos.toByteArray();
+
+ given()
+ .auth().preemptive().basic("rhqadmin", "rhqadmin")
+ .body(bytes)
+ .contentType(ContentType.BINARY)
+ .header(acceptJson)
+ .log().everything()
+ .expect()
+ .statusCode(isOneOf(200, 201))
+ .body("value", startsWith("rhq-rest-"))
+ .body("value",endsWith(".bin"))
+ .log().ifError()
+ .when()
+ .post("/content/fresh");
+
+
+ }
+ @Test
+ public void testUploadAndDelete() throws Exception {
+
+ InputStream in =
+ getClass().getClassLoader().getResourceAsStream("test-simple.war");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ int data;
+ while ((data = in.read())!=-1) {
+ baos.write(data);
+ }
+
+ byte[] bytes = baos.toByteArray();
+ int size = bytes.length;
+
+ String handle =
+ given()
+ .auth().preemptive().basic("rhqadmin", "rhqadmin")
+ .body(bytes)
+ .contentType(ContentType.BINARY)
+ .header(acceptJson)
+ .expect()
+ .body("value", startsWith("rhq-rest-"))
+ .body("value", endsWith(".bin"))
+ .statusCode(isOneOf(200, 201))
+ .when()
+ .post("/content/fresh")
+ .jsonPath()
+ .getString("value");
+
+ Integer uploadedSize =
+ given()
+ .pathParam("handle", handle)
+ .header(acceptJson)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/content/{handle}/info")
+ .jsonPath().getInt("value");
+
+ assert uploadedSize!=null;
+ assert uploadedSize==size;
+
+ given()
+ .pathParam("handle",handle)
+ .header(acceptJson)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .delete("/content/{handle}");
+
+ }
+
+ @Test
+ public void testDeleteUnknownContent() throws Exception {
+
+ given()
+ .pathParam("handle","Frobnitz")
+ .header(acceptJson)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .delete("/content/{handle}");
+
+ }
+
+ @Test
+ public void testCreatePackageBasedResource() throws Exception {
+
+ InputStream in =
+ getClass().getClassLoader().getResourceAsStream("test-simple.war");
+
+ ByteArrayOutputStream baos = new ByteArrayOutputStream();
+
+ int data;
+ while ((data = in.read())!=-1) {
+ baos.write(data);
+ }
+
+ byte[] bytes = baos.toByteArray();
+
+ // Upload content
+ String handle =
+ given()
+ .auth().preemptive().basic("rhqadmin", "rhqadmin")
+ .body(bytes)
+ .contentType(ContentType.BINARY)
+ .header(acceptJson)
+ .expect()
+ .body("value",startsWith("rhq-rest-"))
+ .body("value",endsWith(".bin"))
+ .statusCode(isOneOf(200, 201))
+ .when()
+ .post("/content/fresh")
+ .jsonPath()
+ .getString("value");
+
+ // Find an EAP 6 server
+ List<Map<String,Object>> resources =
+ given()
+ .header(acceptJson)
+ .queryParam("q","EAP (127.0.0.1:9990)") // TODO fragile -- better search for it?
+ .queryParam("category","SERVER")
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .when()
+ .get("/resource")
+ .jsonPath().getList("$");
+
+ assert resources.size()>0;
+
+ int as7Id = Integer.valueOf((String)resources.get(0).get("resourceId"));
+
+ // create child of eap6 as deployment
+ try {
+ CreateCBRRequest resource = new CreateCBRRequest();
+ resource.setParentId(as7Id);
+ resource.setResourceName("test-simple.war");
+
+
+ // type of the new resource
+ resource.setTypeName("Deployment");
+ resource.setPluginName("JBossAS7");
+
+ // set plugin config (path) and deploy config (runtime-name)
+ resource.getPluginConfig().put("path","deployment");
+ resource.getResourceConfig().put("runtimeName","test-simple.war");
+
+ Response response =
+ given()
+ .body(resource) // Type of new resource
+ .queryParam("handle", handle)
+ .contentType(ContentType.JSON)
+ .header(acceptJson)
+ .log().everything()
+ .expect()
+ .statusCode(isOneOf(200, 201, 302))
+ .log().everything()
+ .when()
+ .post("/resource");
+
+ System.out.println("after post");
+ System.out.flush();
+
+ int status = response.getStatusCode();
+ String location = response.getHeader("Location");
+
+ System.out.println("Location " + location + "\n\n");
+ assert location!=null;
+
+ // We need to check what we got. A 302 means the deploy is still
+ // in progress, so we need to wait a little longer
+ while (status==302) {
+
+ status =
+ given()
+ .header(acceptJson)
+ .log().everything()
+ .expect()
+ .statusCode(isOneOf(200,201,302))
+ .log().everything()
+ .when()
+ .get(location)
+ .getStatusCode();
+ }
+
+ } finally {
+
+ // Remove the uploaded content
+ given()
+ .pathParam("handle",handle)
+ .header(acceptJson)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .delete("/content/{handle}");
+
+
+ // try to remove the created resource
+ Response response =
+ given()
+ .queryParam("q", "test-simple.war")
+ .header(acceptJson)
+ .expect()
+ .log().everything()
+ .when()
+ .get("/resource");
+
+ List links = response.body().jsonPath().getList("links");
+
+ System.out.println(links);
+ assert links!=null;
+
+ if (links.size()>0) {
+
+ String link = null;
+ @SuppressWarnings("unchecked")
+ List<Map<String,Map<String,String>>> listOfMaps = (List<Map<String, Map<String, String>>>) links.get(0);
+
+ for (Map<String,Map<String,String>> map : listOfMaps) {
+ if (map.containsKey("self")) {
+ link = map.get("self").get("href");
+ break;
+ }
+ }
+
+ assert link != null;
+
+ System.out.println("Link: " + link);
+
+ given()
+ .header(acceptJson)
+ .queryParam("physical","true") // Also remove target on the EAP instance
+ .expect()
+ .log().everything()
+ .when()
+ .delete(link);
+ }
+
+ }
+
+ }
+
+ @Test
+ public void testCreateCBRBadHandle() throws Exception {
+
+ CreateCBRRequest resource = new CreateCBRRequest();
+ resource.setParentId(123);
+ resource.setResourceName("test-simple.war");
+
+
+ // type of the new resource
+ resource.setTypeName("Deployment");
+ resource.setPluginName("JBossAS7");
+
+ // set plugin config (path) and deploy config (runtime-name)
+ resource.getPluginConfig().put("path","deployment");
+ resource.getResourceConfig().put("runtimeName","test-simple.war");
+
+ Response response =
+ given()
+ .body(resource) // Type of new resource
+ .queryParam("handle", "This is a joke")
+ .contentType(ContentType.JSON)
+ .header(acceptJson)
+ .log().everything()
+ .expect()
+ .statusCode(404)
+ .log().everything()
+ .when()
+ .post("/resource");
+
+ }
+}
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 40bf342..1dee0f1 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
@@ -23,8 +23,6 @@
package org.rhq.modules.integrationTests.restApi;
-import java.util.List;
-import java.util.Map;
import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.path.json.JsonPath;
@@ -33,7 +31,6 @@ import com.jayway.restassured.path.xml.element.Node;
import com.jayway.restassured.response.Response;
import org.apache.http.HttpStatus;
-import org.hamcrest.CoreMatchers;
import org.junit.Test;
import org.rhq.modules.integrationTests.restApi.d.Availability;
@@ -44,8 +41,8 @@ import static com.jayway.restassured.RestAssured.get;
import static com.jayway.restassured.RestAssured.given;
import static com.jayway.restassured.RestAssured.with;
import static org.hamcrest.CoreMatchers.containsString;
-import static org.hamcrest.CoreMatchers.hasItem;
-import static org.hamcrest.CoreMatchers.not;
+import static org.hamcrest.CoreMatchers.instanceOf;
+import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.CoreMatchers.notNullValue;
/**
@@ -80,6 +77,40 @@ public class ResourcesTest extends AbstractBase {
}
@Test
+ public void testGetPlatformAndTypeJson() {
+
+ Integer typeId =
+ given()
+ .header("Accept","application/json")
+ .pathParam("id",_platformId)
+ .expect()
+ .statusCode(200)
+ .contentType(ContentType.JSON)
+ .log().ifError()
+ .body("links.self", notNullValue())
+ .when()
+ .get("/resource/{id}")
+ .jsonPath().getInt("typeId");
+
+ assert typeId!=null;
+ assert typeId>0;
+
+ given()
+ .header(acceptJson)
+ .pathParam("typeId",typeId)
+ .log().everything()
+ .expect()
+ .statusCode(200)
+ .body("id",is(typeId))
+ .body("name",is("Linux"))
+ .body("pluginName",is("Platforms"))
+ .log().everything()
+ .when()
+ .get("/resource/type/{typeId}");
+
+ }
+
+ @Test
public void testGetPlatformUILink() {
Response response =
@@ -163,7 +194,7 @@ public class ResourcesTest extends AbstractBase {
given()
.header("Accept", "application/xml")
- .pathParam("id",_platformId)
+ .pathParam("id", _platformId)
.expect()
.statusCode(200)
.contentType(ContentType.XML)
@@ -224,6 +255,25 @@ public class ResourcesTest extends AbstractBase {
}
@Test
+ public void testCreatePlatformWithBadType() throws Exception {
+
+ Resource resource = new Resource();
+ resource.setResourceName("dummy-test");
+ resource.setTypeName("myGreatestOS");
+
+ given()
+ .header(acceptXml)
+ .contentType(ContentType.JSON)
+ .body(resource)
+ .expect()
+ .statusCode(404)
+ .log().ifError()
+ .when()
+ .post("/resource/platforms");
+
+ }
+
+ @Test
public void testCreatePlatformAndRemove() throws Exception {
Resource resource = new Resource();
@@ -339,17 +389,16 @@ public class ResourcesTest extends AbstractBase {
String platformId = response.jsonPath().getString("resourceId");
try {
- Response child =
- with().body("{\"value\":\"CPU\"}") // Type of new resource
- .header("Content-Type", "application/json")
- .header("Accept", "application/json")
- .pathParam("name", "test")
- .queryParam("plugin", "Platforms")
- .queryParam("parentId", platformId)
- .expect()
- .statusCode(201)
- .log().ifError()
- .when().post("/resource/{name}").andReturn();
+ with().body("{\"value\":\"CPU\"}") // Type of new resource
+ .header("Content-Type", "application/json")
+ .header("Accept", "application/json")
+ .pathParam("name", "test")
+ .queryParam("plugin", "Platforms")
+ .queryParam("parentId", platformId)
+ .expect()
+ .statusCode(201)
+ .log().ifError()
+ .when().post("/resource/{name}").andReturn();
}
finally {
given().pathParam("id",platformId)
@@ -419,29 +468,27 @@ public class ResourcesTest extends AbstractBase {
String platformId = response.jsonPath().getString("resourceId");
try {
- Response child =
- with().body("{\"value\":\"CPU\"}") // Type of new resource
- .header("Content-Type", "application/json")
- .header("Accept", "application/json")
- .pathParam("name", "test")
- .queryParam("plugin", "Platforms")
- .queryParam("parentId", platformId)
- .expect()
- .statusCode(201)
- .log().ifError()
- .when().post("/resource/{name}").andReturn();
-
- child =
- with().body("{\"value\":\"CPU\"}") // Type of new resource
- .header("Content-Type", "application/json")
- .header("Accept", "application/json")
- .pathParam("name", "test")
- .queryParam("plugin", "Platforms")
- .queryParam("parentId", platformId)
- .expect()
- .statusCode(201)
- .log().ifError()
- .when().post("/resource/{name}").andReturn();
+ with().body("{\"value\":\"CPU\"}") // Type of new resource
+ .header("Content-Type", "application/json")
+ .header("Accept", "application/json")
+ .pathParam("name", "test")
+ .queryParam("plugin", "Platforms")
+ .queryParam("parentId", platformId)
+ .expect()
+ .statusCode(201)
+ .log().ifError()
+ .when().post("/resource/{name}");
+
+ with().body("{\"value\":\"CPU\"}") // Type of new resource
+ .header("Content-Type", "application/json")
+ .header("Accept", "application/json")
+ .pathParam("name", "test")
+ .queryParam("plugin", "Platforms")
+ .queryParam("parentId", platformId)
+ .expect()
+ .statusCode(201)
+ .log().ifError()
+ .when().post("/resource/{name}");
}
finally {
given().pathParam("id",platformId)
@@ -474,9 +521,9 @@ public class ResourcesTest extends AbstractBase {
}
@Test
- public void testAvailabilityForResource() throws Exception {
+ public void testAvailabilityForResourceJson() throws Exception {
given()
- .header("Accept", "application/json")
+ .header(acceptJson)
.pathParam("id", _platformId)
.expect()
.statusCode(200)
@@ -485,9 +532,20 @@ public class ResourcesTest extends AbstractBase {
}
@Test
- public void testAvailabilityHistoryForResource() throws Exception {
+ public void testAvailabilityForResourceXml() throws Exception {
given()
- .header("Accept", "application/json")
+ .header(acceptXml)
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/availability");
+ }
+
+ @Test
+ public void testAvailabilityHistoryForResourceJson() throws Exception {
+ given()
+ .header(acceptJson)
.pathParam("id", _platformId)
.expect()
.statusCode(200)
@@ -496,6 +554,48 @@ public class ResourcesTest extends AbstractBase {
}
@Test
+ public void testAvailabilityHistoryForResourceXml() throws Exception {
+ given()
+ .header(acceptXml)
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/availability/history");
+ }
+
+ @Test
+ public void testAvailabilitySummaryForResourceJson() throws Exception {
+ given()
+ .header(acceptJson)
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .log().everything()
+ .body("currentTime", instanceOf(Long.class))
+ .body("failures", instanceOf(Integer.class))
+ .body("current", containsString("UNKNOWN"))
+ .body("upPercentage", instanceOf(Float.class))
+ .when()
+ .get("/resource/{id}/availability/summary");
+ }
+
+ @Test
+ public void testAvailabilitySummaryForResourceXml() throws Exception {
+
+ given()
+ .header(acceptXml)
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .body("availabilitySummary.current", containsString("UNKNOWN"))
+ .when()
+ .get("/resource/{id}/availability/summary");
+
+ }
+
+ @Test
public void testUpdateAvailability() throws Exception {
Response response =
@@ -552,7 +652,7 @@ public class ResourcesTest extends AbstractBase {
@Test
public void testNoDisabledForPlatforms() throws Exception {
- // Platforms should not be set to DISABLED according ot JSHAUGHN
+ // Platforms should not be set to DISABLED according to JSHAUGHN
long now = System.currentTimeMillis()-100;
Availability avail = new Availability(_platformId,now,"DISABLED");
@@ -569,4 +669,32 @@ public class ResourcesTest extends AbstractBase {
.put("/resource/{id}/availability");
}
+
+ @Test
+ public void testGetUnknownType() throws Exception {
+
+
+ given()
+ .header(acceptJson)
+ .pathParam("typeId",123)
+ .expect()
+ .statusCode(404)
+ .log().ifError()
+ .when()
+ .get("/resource/type/{typeId}");
+
+ }
+
+ @Test
+ public void testUnknownCreateResourceStatusId() throws Exception {
+
+ given()
+ .pathParam("id",123)
+ .expect()
+ .statusCode(404)
+ .when()
+ .get("/resource/creationStatus/{id}");
+
+
+ }
}
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/CreateCBRRequest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/CreateCBRRequest.java
new file mode 100644
index 0000000..2b26025
--- /dev/null
+++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/CreateCBRRequest.java
@@ -0,0 +1,49 @@
+/*
+ * 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;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * A request to create a content based resource via REST api
+ * @author Heiko W. Rupp
+ */
+public class CreateCBRRequest extends Resource {
+
+ Map<String,Object> pluginConfig = new HashMap<String, Object>();
+ Map<String,Object> resourceConfig = new HashMap<String, Object>();
+
+ public Map<String, Object> getPluginConfig() {
+ return pluginConfig;
+ }
+
+ public void setPluginConfig(Map<String, Object> pluginConfig) {
+ this.pluginConfig = pluginConfig;
+ }
+
+ public Map<String, Object> getResourceConfig() {
+ return resourceConfig;
+ }
+
+ public void setResourceConfig(Map<String, Object> resourceConfig) {
+ this.resourceConfig = resourceConfig;
+ }
+}
diff --git a/modules/integration-tests/rest-api/src/test/resources/test-simple.war b/modules/integration-tests/rest-api/src/test/resources/test-simple.war
new file mode 100644
index 0000000..bd427b1
Binary files /dev/null and b/modules/integration-tests/rest-api/src/test/resources/test-simple.war differ
commit 6e6361c5425a245bc6afe6030afb6351d6604d30
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Mar 21 22:25:51 2013 -0400
Bug 832398
RFE: Enable DynaGroups to be created based on the contents of another group
Add a test and small fix for detecting duplicate memberof expressions.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java
index 92919c5..3745d16 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java
@@ -801,6 +801,16 @@ public class ExpressionEvaluatorTest extends AbstractEJB3Test {
});
}
+ @Test(expectedExceptions = InvalidExpressionException.class, expectedExceptionsMessageRegExp = "Redundant.*")
+ public void doNotAllowDuplicateMemberOfExpressions() throws Exception {
+ evaluateExpressions(new ExpressionGenerator() {
+ @Override
+ public String[] getExpressions() {
+ return new String[] { "memberof = foo", "memberof = foo" };
+ }
+ });
+ }
+
private String cleanUp(String result) {
return result.replaceAll("\\s+", " ").trim();
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
index 363a663..2c2c4c2 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
@@ -1271,6 +1271,7 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
throw new InvalidExpressionException("Redundant 'memberof' expression[" + normalizedSubExpression
+ "] - these expressions must be unique");
}
+ memberSubExpressions.add(normalizedSubExpression);
} else {
if (groupedSubExpressions.contains(normalizedSubExpression)) {
throw new InvalidExpressionException(
commit 28cdcb1c56aeb7f66d608d300d74152e510c3249
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Thu Mar 21 15:26:52 2013 -0500
[BZ 923458] Maven dependency version cleanup.
(cherry picked from commit 98a076a4b1ab258efbf3e367a2f4fe65b9d5bc7a)
(cherry picked from commit fb84b4e89772479851ce4c6403d7cce6a170d761)
(cherry picked from commit 1308cc9399c63b7f68c89c62619e9f91014c8ed8)
(cherry picked from commit 6dd80cae4df923b2118936951d6fdbb0006b8294)
diff --git a/etc/augeas-utils/pom.xml b/etc/augeas-utils/pom.xml
index 8355748..ca5c540 100644
--- a/etc/augeas-utils/pom.xml
+++ b/etc/augeas-utils/pom.xml
@@ -28,10 +28,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
- <version>2.0.2</version>
+ <version>2.3.2</version>
<configuration>
- <source>1.5</source>
- <target>1.5</target>
+ <source>1.6</source>
</configuration>
</plugin>
</plugins>
diff --git a/modules/cli-tests/pom.xml b/modules/cli-tests/pom.xml
index 394dc13..c4dadc9 100644
--- a/modules/cli-tests/pom.xml
+++ b/modules/cli-tests/pom.xml
@@ -31,19 +31,16 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>${testng.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
</dependency>
<dependency>
diff --git a/modules/common/ant-bundle/pom.xml b/modules/common/ant-bundle/pom.xml
index 111b6f0..4cf6703 100644
--- a/modules/common/ant-bundle/pom.xml
+++ b/modules/common/ant-bundle/pom.xml
@@ -48,7 +48,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>1.1.0.jboss</version>
</dependency>
<dependency>
@@ -73,7 +72,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>1.0b3</version>
<scope>runtime</scope> <!-- needs to be runtime otherwise it will not be included by assembly plugin -->
<exclusions>
<exclusion>
@@ -86,7 +84,6 @@
<dependency>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
- <version>1.9.5</version>
</dependency>
</dependencies>
diff --git a/modules/common/drift/pom.xml b/modules/common/drift/pom.xml
index 190bc89..9d7a132 100644
--- a/modules/common/drift/pom.xml
+++ b/modules/common/drift/pom.xml
@@ -24,7 +24,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
</dependencies>
diff --git a/modules/common/jboss-as/pom.xml b/modules/common/jboss-as/pom.xml
index 17e5433..d3bf151 100644
--- a/modules/common/jboss-as/pom.xml
+++ b/modules/common/jboss-as/pom.xml
@@ -23,7 +23,6 @@
<dependency>
<groupId>jboss</groupId>
<artifactId>jbpm</artifactId>
- <version>3.1.1</version>
</dependency>
<dependency>
@@ -72,7 +71,6 @@
<artifactItem>
<groupId>jboss</groupId>
<artifactId>jbpm</artifactId>
- <version>3.1.1</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
diff --git a/modules/core/arquillian-integration/container/pom.xml b/modules/core/arquillian-integration/container/pom.xml
index 50e0fed..9dc7a99 100644
--- a/modules/core/arquillian-integration/container/pom.xml
+++ b/modules/core/arquillian-integration/container/pom.xml
@@ -112,13 +112,11 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-testng</artifactId>
- <version>${powermock.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
- <version>${powermock.version}</version>
</dependency>
<!-- test -->
@@ -133,7 +131,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.8.1</version>
<scope>test</scope>
</dependency>
diff --git a/modules/core/client-api/pom.xml b/modules/core/client-api/pom.xml
index a4f4b9e..c03f268 100644
--- a/modules/core/client-api/pom.xml
+++ b/modules/core/client-api/pom.xml
@@ -60,7 +60,6 @@
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
- <version>1.1</version>
<executions>
<execution>
<goals>
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index a48f2a4..41351ed 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -55,7 +55,6 @@
<dependency>
<groupId>i18nlog</groupId>
<artifactId>i18nlog</artifactId>
- <version>${i18nlog.version}</version>
</dependency>
<dependency>
<groupId>postgresql</groupId>
@@ -80,7 +79,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
- <version>1.2</version>
<dependencies>
<dependency>
<groupId>postgresql</groupId>
@@ -452,7 +450,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
- <version>1.2</version>
</plugin>
</plugins>
</build>
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index ef7c906..f14157e 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -152,21 +152,18 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
- <version>3.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>${commons-codec.version}</version>
<scope>test</scope>
</dependency>
@@ -194,7 +191,6 @@
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
- <version>${xercesImpl.version}</version>
<scope>test</scope>
</dependency>
</dependencies>
@@ -472,7 +468,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
- <version>2.1.2</version>
<executions>
<execution>
<id>attach-sources</id>
diff --git a/modules/core/gui/pom.xml b/modules/core/gui/pom.xml
index 9f1b724..365535a 100644
--- a/modules/core/gui/pom.xml
+++ b/modules/core/gui/pom.xml
@@ -57,7 +57,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.4</version>
<scope>provided</scope>
<!-- by JBossAS -->
<!-- transitive dependency needed for JspC -->
diff --git a/modules/core/native-system/pom.xml b/modules/core/native-system/pom.xml
index 21f1c48..04be12b 100644
--- a/modules/core/native-system/pom.xml
+++ b/modules/core/native-system/pom.xml
@@ -47,7 +47,6 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>1.9.0</version>
<scope>test</scope>
</dependency>
diff --git a/modules/core/plugin-api/pom.xml b/modules/core/plugin-api/pom.xml
index 4b828f7..a24c330 100644
--- a/modules/core/plugin-api/pom.xml
+++ b/modules/core/plugin-api/pom.xml
@@ -46,14 +46,12 @@
<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>
diff --git a/modules/core/plugin-container/pom.xml b/modules/core/plugin-container/pom.xml
index 8bff199..06395a2 100644
--- a/modules/core/plugin-container/pom.xml
+++ b/modules/core/plugin-container/pom.xml
@@ -82,7 +82,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
</dependencies>
diff --git a/modules/core/plugin-test-api/pom.xml b/modules/core/plugin-test-api/pom.xml
index f7abec9..9c91bc0 100644
--- a/modules/core/plugin-test-api/pom.xml
+++ b/modules/core/plugin-test-api/pom.xml
@@ -39,13 +39,11 @@
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-module-testng</artifactId>
- <version>${powermock.version}</version>
</dependency>
<dependency>
<groupId>org.powermock</groupId>
<artifactId>powermock-api-mockito</artifactId>
- <version>${powermock.version}</version>
</dependency>
<dependency>
diff --git a/modules/core/plugin-test-util/pom.xml b/modules/core/plugin-test-util/pom.xml
index dbb97fe..c75dcbc 100644
--- a/modules/core/plugin-test-util/pom.xml
+++ b/modules/core/plugin-test-util/pom.xml
@@ -24,7 +24,6 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>${testng.version}</version>
</dependency>
<dependency>
diff --git a/modules/core/plugin-validator/pom.xml b/modules/core/plugin-validator/pom.xml
index fc8ff80..d05b721 100644
--- a/modules/core/plugin-validator/pom.xml
+++ b/modules/core/plugin-validator/pom.xml
@@ -36,7 +36,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
</dependency>
<dependency>
diff --git a/modules/core/plugindoc/pom.xml b/modules/core/plugindoc/pom.xml
index 4528810..c3c7175 100644
--- a/modules/core/plugindoc/pom.xml
+++ b/modules/core/plugindoc/pom.xml
@@ -48,7 +48,6 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
</dependency>
<dependency>
@@ -119,7 +118,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
- <version>1.5</version>
<executions>
<execution>
<id>attach-installed-file-for-deployment</id>
diff --git a/modules/core/util/pom.xml b/modules/core/util/pom.xml
index ff2a247..b799891 100644
--- a/modules/core/util/pom.xml
+++ b/modules/core/util/pom.xml
@@ -42,7 +42,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
<scope>test</scope>
</dependency>
diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml
index 8e7d819..d1200f6 100644
--- a/modules/enterprise/agent/pom.xml
+++ b/modules/enterprise/agent/pom.xml
@@ -224,7 +224,6 @@ Build-Number=${buildNumber}
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.6</version>
</plugin>
</plugins>
@@ -243,7 +242,6 @@ Build-Number=${buildNumber}
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
- <version>1.5</version>
<executions>
<execution>
<id>attach-installed-file-for-deployment</id>
@@ -285,7 +283,6 @@ Build-Number=${buildNumber}
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.6</version>
</plugin>
</plugins>
diff --git a/modules/enterprise/agentupdate/pom.xml b/modules/enterprise/agentupdate/pom.xml
index ba0d852..3b66b92 100644
--- a/modules/enterprise/agentupdate/pom.xml
+++ b/modules/enterprise/agentupdate/pom.xml
@@ -135,7 +135,6 @@ rhq-agent.latest.build-number=${buildNumber}
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.6</version>
</plugin>
</plugins>
@@ -204,7 +203,6 @@ rhq-agent.latest.build-number=${buildNumber}
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.6</version>
</plugin>
</plugins>
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml
index a0cab6f..a41fb6c 100644
--- a/modules/enterprise/binding/pom.xml
+++ b/modules/enterprise/binding/pom.xml
@@ -182,14 +182,12 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>${testng.version}</version>
<scope>test</scope>
</dependency>
@@ -206,14 +204,12 @@
<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>
diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml
index 4adb84e..822d405 100644
--- a/modules/enterprise/comm/pom.xml
+++ b/modules/enterprise/comm/pom.xml
@@ -156,7 +156,6 @@
<plugins>
<plugin>
<artifactId>maven-surefire-report-plugin</artifactId>
- <version>2.6</version>
</plugin>
</plugins>
</reporting>
diff --git a/modules/enterprise/gui/content_http-war/pom.xml b/modules/enterprise/gui/content_http-war/pom.xml
index 61abd3a..19208e8 100644
--- a/modules/enterprise/gui/content_http-war/pom.xml
+++ b/modules/enterprise/gui/content_http-war/pom.xml
@@ -54,20 +54,11 @@
<artifactId>hibernate-entitymanager</artifactId>
<scope>provided</scope>
</dependency>
-
- <!--
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>jstl</artifactId>
- <version>1.1.2</version>
- </dependency>
- -->
<!-- adding to pick up javax.servlet.http.HttpServlet -->
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.4</version>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
@@ -84,7 +75,6 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>1.4</version>
</dependency>
<dependency>
@@ -96,7 +86,6 @@
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
- <version>${commons-httpclient.version}</version>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
@@ -109,7 +98,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
@@ -122,7 +110,6 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
</dependency>
</dependencies>
diff --git a/modules/enterprise/gui/portal-war/pom.xml b/modules/enterprise/gui/portal-war/pom.xml
index 9795f49..6c12259 100644
--- a/modules/enterprise/gui/portal-war/pom.xml
+++ b/modules/enterprise/gui/portal-war/pom.xml
@@ -70,7 +70,6 @@
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
- <version>3.2</version>
</dependency>
<dependency>
@@ -94,7 +93,6 @@
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
- <version>${commons-httpclient.version}</version>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
@@ -107,14 +105,12 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>1.0.4</version>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
- <version>1.1.4</version>
</dependency>
<!-- used by a test JSP -->
@@ -141,7 +137,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.4</version>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
@@ -186,7 +181,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>3.8.2</version>
</dependency>
<dependency>
@@ -282,7 +276,6 @@
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
- <version>${xercesImpl.version}</version>
<scope>provided</scope> <!-- by JBossAS -->
</dependency>
diff --git a/modules/enterprise/gui/remoting-war/pom.xml b/modules/enterprise/gui/remoting-war/pom.xml
index c4b63bf..9570336 100644
--- a/modules/enterprise/gui/remoting-war/pom.xml
+++ b/modules/enterprise/gui/remoting-war/pom.xml
@@ -39,7 +39,6 @@
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1-alpha-1</version>
<configuration>
<archive>
<manifest>
diff --git a/modules/enterprise/gui/rest-examples-war/pom.xml b/modules/enterprise/gui/rest-examples-war/pom.xml
index 87354d1..2a5091c 100644
--- a/modules/enterprise/gui/rest-examples-war/pom.xml
+++ b/modules/enterprise/gui/rest-examples-war/pom.xml
@@ -23,7 +23,6 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1-alpha-1</version>
<configuration>
<archive>
<manifest>
diff --git a/modules/enterprise/gui/rest-war/pom.xml b/modules/enterprise/gui/rest-war/pom.xml
index 1b5349c..0797145 100644
--- a/modules/enterprise/gui/rest-war/pom.xml
+++ b/modules/enterprise/gui/rest-war/pom.xml
@@ -59,7 +59,6 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
- <version>2.1-alpha-1</version>
<configuration>
<archive>
<manifest>
diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml
index ee672e2..fc164c9 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -77,7 +77,6 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/modules/enterprise/remoting/client-api/pom.xml b/modules/enterprise/remoting/client-api/pom.xml
index f5fbe0c..2c7b6f9 100644
--- a/modules/enterprise/remoting/client-api/pom.xml
+++ b/modules/enterprise/remoting/client-api/pom.xml
@@ -90,14 +90,12 @@
<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>
diff --git a/modules/enterprise/remoting/client-deps/pom.xml b/modules/enterprise/remoting/client-deps/pom.xml
index 006a9a6..61b7c19 100644
--- a/modules/enterprise/remoting/client-deps/pom.xml
+++ b/modules/enterprise/remoting/client-deps/pom.xml
@@ -18,19 +18,19 @@
<groupId>${project.groupId}</groupId>
<artifactId>rhq-remoting-client-api</artifactId>
<version>${project.version}</version>
- <exclusions>
+ <exclusions>
<exclusion>
- <groupId>com.google.gwt</groupId>
- <artifactId>gwt-user</artifactId>
- </exclusion>
+ <groupId>com.google.gwt</groupId>
+ <artifactId>gwt-user</artifactId>
+ </exclusion>
<exclusion>
- <groupId>javax.xml.bind</groupId>
- <artifactId>jaxb-api</artifactId>
- </exclusion>
+ <groupId>javax.xml.bind</groupId>
+ <artifactId>jaxb-api</artifactId>
+ </exclusion>
<exclusion>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
- </exclusion>
+ </exclusion>
<exclusion>
<groupId>org.antlr</groupId>
<artifactId>antlr</artifactId>
@@ -50,21 +50,20 @@
<artifactId>concurrent</artifactId>
<version>1.3.4-jboss-update1</version>
</dependency>
- <dependency>
- <groupId>i18nlog</groupId>
- <artifactId>i18nlog</artifactId>
- <version>1.0.10</version>
- </dependency>
- <dependency>
- <groupId>commons-logging</groupId>
- <artifactId>commons-logging</artifactId>
- <version>1.1.0.jboss</version>
- </dependency>
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>1.2.14</version>
- </dependency>
- </dependencies>
+ <dependency>
+ <groupId>i18nlog</groupId>
+ <artifactId>i18nlog</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-logging</groupId>
+ <artifactId>commons-logging</artifactId>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ </dependency>
+ </dependencies>
</project>
diff --git a/modules/enterprise/scripting/api/pom.xml b/modules/enterprise/scripting/api/pom.xml
index 5fdffe3..07768cd 100644
--- a/modules/enterprise/scripting/api/pom.xml
+++ b/modules/enterprise/scripting/api/pom.xml
@@ -41,7 +41,6 @@
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
- <version>1.1</version>
<executions>
<execution>
diff --git a/modules/enterprise/scripting/javascript/pom.xml b/modules/enterprise/scripting/javascript/pom.xml
index 208076a..b1d6553 100644
--- a/modules/enterprise/scripting/javascript/pom.xml
+++ b/modules/enterprise/scripting/javascript/pom.xml
@@ -87,7 +87,6 @@
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
- <version>1.1</version>
<executions>
<execution>
diff --git a/modules/enterprise/scripting/python/pom.xml b/modules/enterprise/scripting/python/pom.xml
index ab12edf..8e7ff39 100644
--- a/modules/enterprise/scripting/python/pom.xml
+++ b/modules/enterprise/scripting/python/pom.xml
@@ -86,7 +86,6 @@
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
- <version>1.1</version>
<executions>
<execution>
diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml
index 2ffdc7c..dc6bbb3 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -67,7 +67,6 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.7.3</version>
</dependency>
</dependencies>
diff --git a/modules/enterprise/server/client-api/pom.xml b/modules/enterprise/server/client-api/pom.xml
index ac92aec..c645073 100644
--- a/modules/enterprise/server/client-api/pom.xml
+++ b/modules/enterprise/server/client-api/pom.xml
@@ -53,14 +53,12 @@
<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>
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index a6cc2c7..939f107 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -169,7 +169,6 @@
<dependency>
<groupId>org.opensymphony.quartz</groupId>
<artifactId>quartz</artifactId>
- <version>${quartz.version}</version>
</dependency>
<dependency>
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index 83b8977..5e5cdd1 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -83,7 +83,6 @@
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-core</artifactId>
- <version>1.9.0</version>
<scope>test</scope>
</dependency>
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml
index cf6aa8d..24fb17b 100644
--- a/modules/enterprise/server/itests-2/pom.xml
+++ b/modules/enterprise/server/itests-2/pom.xml
@@ -559,7 +559,6 @@
<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>
@@ -567,7 +566,6 @@
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-arquillian-container-managed</artifactId>
- <version>${jboss.version}</version>
<scope>test</scope>
</dependency>
@@ -677,14 +675,12 @@
<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>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index b7621c5..b86af52 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -123,7 +123,6 @@
<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>
@@ -169,7 +168,6 @@
<dependency>
<groupId>org.infinispan</groupId>
<artifactId>infinispan-core</artifactId>
- <version>${infinispan.version}</version>
<scope>provided</scope>
</dependency>
@@ -185,26 +183,22 @@
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
- <version>3.2</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
- <version>${commons-httpclient.version}</version>
</dependency>
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
</dependency>
<!-- Required by a couple APL classes - TODO: Remove this once APL has been removed. -->
<dependency>
<groupId>commons-validator</groupId>
<artifactId>commons-validator</artifactId>
- <version>1.1.4</version>
</dependency>
<dependency>
@@ -279,7 +273,6 @@
<dependency>
<groupId>org.jboss.jbossts</groupId>
<artifactId>jbossjts</artifactId>
- <version>${jboss-jts.version}</version>
<scope>provided</scope>
</dependency>
@@ -407,14 +400,12 @@
<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>
@@ -449,7 +440,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-ejb-plugin</artifactId>
- <version>2.3</version>
<configuration>
<ejbVersion>3.0</ejbVersion>
<generateClient>true</generateClient>
@@ -574,7 +564,6 @@
<plugin>
<groupId>org.antlr</groupId>
<artifactId>antlr3-maven-plugin</artifactId>
- <version>3.2</version>
<executions>
<execution>
<phase>generate-sources</phase>
diff --git a/modules/enterprise/server/plugins/alert-operations/pom.xml b/modules/enterprise/server/plugins/alert-operations/pom.xml
index 3b08f01..24813ad 100644
--- a/modules/enterprise/server/plugins/alert-operations/pom.xml
+++ b/modules/enterprise/server/plugins/alert-operations/pom.xml
@@ -29,7 +29,6 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
- <version>1.1</version>
<executions>
<execution>
<!-- Generate tokens.xml file -->
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml b/modules/enterprise/server/plugins/ant-bundle/pom.xml
index 6f636d5..4226e21 100644
--- a/modules/enterprise/server/plugins/ant-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml
@@ -94,13 +94,11 @@
<artifactItem>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>1.0b3</version>
</artifactItem>
<artifactItem>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
- <version>1.9.5</version>
</artifactItem>
</artifactItems>
diff --git a/modules/enterprise/server/plugins/disk/pom.xml b/modules/enterprise/server/plugins/disk/pom.xml
index 5ecb7a9..c111bcc 100644
--- a/modules/enterprise/server/plugins/disk/pom.xml
+++ b/modules/enterprise/server/plugins/disk/pom.xml
@@ -27,14 +27,12 @@
<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>
diff --git a/modules/enterprise/server/plugins/drift-mongodb/pom.xml b/modules/enterprise/server/plugins/drift-mongodb/pom.xml
index ed72fd0..39d7127 100644
--- a/modules/enterprise/server/plugins/drift-mongodb/pom.xml
+++ b/modules/enterprise/server/plugins/drift-mongodb/pom.xml
@@ -74,7 +74,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
<scope>test</scope>
</dependency>
</dependencies>
diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml
index e844a56..ea20099 100644
--- a/modules/enterprise/server/plugins/groovy-script/pom.xml
+++ b/modules/enterprise/server/plugins/groovy-script/pom.xml
@@ -4,14 +4,14 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.5.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>groovy-script-server-plugin</artifactId>
- <version>4.5.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Groovy Script Plugin</name>
@@ -19,7 +19,6 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.7.3</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
@@ -27,9 +26,8 @@
<version>1.7.1</version>
</dependency>
<dependency>
- <groupId>quartz</groupId>
+ <groupId>org.opensymphony.quartz</groupId>
<artifactId>quartz</artifactId>
- <version>1.5.2</version>
<scope>test</scope>
</dependency>
<dependency>
@@ -54,6 +52,10 @@
<artifactId>reflections</artifactId>
<version>0.9.5-RC2</version>
</dependency>
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-core</artifactId>
+ </dependency>
</dependencies>
<build>
@@ -97,7 +99,6 @@
<artifactItem>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
- <version>${javassist.version}</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
@@ -109,7 +110,6 @@
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
- <version>1.0</version>
<executions>
<execution>
<goals>
diff --git a/modules/enterprise/server/plugins/jboss-software/pom.xml b/modules/enterprise/server/plugins/jboss-software/pom.xml
index 3d31342..33a11a1 100644
--- a/modules/enterprise/server/plugins/jboss-software/pom.xml
+++ b/modules/enterprise/server/plugins/jboss-software/pom.xml
@@ -26,7 +26,6 @@
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
- <version>${commons-httpclient.version}</version>
<scope>provided</scope>
</dependency>
@@ -40,7 +39,6 @@
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
- <version>${xercesImpl.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/enterprise/server/plugins/url/pom.xml b/modules/enterprise/server/plugins/url/pom.xml
index f677d6a..5660473 100644
--- a/modules/enterprise/server/plugins/url/pom.xml
+++ b/modules/enterprise/server/plugins/url/pom.xml
@@ -43,7 +43,6 @@
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
- <version>${xercesImpl.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/enterprise/server/sars/agent-sar/pom.xml b/modules/enterprise/server/sars/agent-sar/pom.xml
index 05cd715..6f2cc2e 100644
--- a/modules/enterprise/server/sars/agent-sar/pom.xml
+++ b/modules/enterprise/server/sars/agent-sar/pom.xml
@@ -31,21 +31,17 @@
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<!-- make sure you match that which is used by standalone agent! -->
- <version>1.1.0.jboss</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<!-- make sure you match that which is used by standalone agent! -->
- <version>1.2.14</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
- <!-- make sure you match that which is used by standalone agent! -->
- <version>2.0.2</version>
</dependency>
</dependencies>
diff --git a/modules/enterprise/server/sars/services-sar/pom.xml b/modules/enterprise/server/sars/services-sar/pom.xml
index 413c681..4586a8b 100644
--- a/modules/enterprise/server/sars/services-sar/pom.xml
+++ b/modules/enterprise/server/sars/services-sar/pom.xml
@@ -21,25 +21,6 @@
<build>
<finalName>rhq-enterprise-server-services-sar</finalName>
-
- <!-- we don't need this right now - only if we need deps stored in the sar META-INF/lib/ will we need this -->
- <!-- NOTE: extensions=true below allows Maven to grok the jboss-sar packaging type -->
- <!--
- <plugins>
-
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>jboss-packaging-maven-plugin</artifactId>
- <version>1.9.99</version>
- <extensions>true</extensions>
- <configuration>
- <libDirectory>${sarDirectory}/META-INF/lib</libDirectory>
- </configuration>
- </plugin>
-
- </plugins>
- -->
-
<resources>
<resource>
<directory>src/main/resources</directory>
diff --git a/modules/enterprise/server/xml-schemas/pom.xml b/modules/enterprise/server/xml-schemas/pom.xml
index 9c1bfdd..98783f1 100644
--- a/modules/enterprise/server/xml-schemas/pom.xml
+++ b/modules/enterprise/server/xml-schemas/pom.xml
@@ -44,7 +44,6 @@
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
- <version>1.1</version>
<executions>
<execution>
<goals>
diff --git a/modules/helpers/bundleGen/pom.xml b/modules/helpers/bundleGen/pom.xml
index 1c570fc..82fabfc 100644
--- a/modules/helpers/bundleGen/pom.xml
+++ b/modules/helpers/bundleGen/pom.xml
@@ -17,7 +17,6 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-jar-plugin</artifactId>
- <version>2.2</version>
<configuration>
<archive>
<manifest>
@@ -58,7 +57,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
</dependency>
<dependency>
diff --git a/modules/helpers/inventory-serializer/pom.xml b/modules/helpers/inventory-serializer/pom.xml
index a42effa..993250b 100644
--- a/modules/helpers/inventory-serializer/pom.xml
+++ b/modules/helpers/inventory-serializer/pom.xml
@@ -36,7 +36,6 @@
<dependency>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
- <version>3.2.1</version>
<scope>runtime</scope>
</dependency>
<dependency>
diff --git a/modules/helpers/perftest-support/pom.xml b/modules/helpers/perftest-support/pom.xml
index ceb5377..4136b47 100644
--- a/modules/helpers/perftest-support/pom.xml
+++ b/modules/helpers/perftest-support/pom.xml
@@ -42,12 +42,10 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>${testng.version}</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
diff --git a/modules/helpers/pluginGen/pom.xml b/modules/helpers/pluginGen/pom.xml
index f7f04ba..372c627 100644
--- a/modules/helpers/pluginGen/pom.xml
+++ b/modules/helpers/pluginGen/pom.xml
@@ -24,7 +24,6 @@
<plugin>
<artifactId>maven-jar-plugin</artifactId>
- <version>2.2</version>
<configuration>
<archive>
<manifest>
@@ -72,7 +71,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>1.1.0.jboss</version>
</dependency>
<dependency>
<groupId>org.freemarker</groupId>
diff --git a/modules/helpers/rest-docs-generator/pom.xml b/modules/helpers/rest-docs-generator/pom.xml
index 0996c3b..208d40b 100644
--- a/modules/helpers/rest-docs-generator/pom.xml
+++ b/modules/helpers/rest-docs-generator/pom.xml
@@ -147,7 +147,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
<scope>compile</scope>
</dependency>
</dependencies>
diff --git a/modules/helpers/rtfilter/pom.xml b/modules/helpers/rtfilter/pom.xml
index 98b8667..da9cf66 100644
--- a/modules/helpers/rtfilter/pom.xml
+++ b/modules/helpers/rtfilter/pom.xml
@@ -25,7 +25,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.3</version>
<scope>provided</scope> <!-- by servlet container -->
</dependency>
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 e574631..9469947 100644
--- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
+++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
@@ -181,7 +181,6 @@
<dependency>
<groupId>org.jboss.spec</groupId>
<artifactId>jboss-javaee-6.0</artifactId>
- <version>1.0.0.Final</version>
<type>pom</type>
<scope>provided</scope>
</dependency>
diff --git a/modules/integration-tests/jndi-access/remote-server/pom.xml b/modules/integration-tests/jndi-access/remote-server/pom.xml
index fd7e312..b28b9bf 100644
--- a/modules/integration-tests/jndi-access/remote-server/pom.xml
+++ b/modules/integration-tests/jndi-access/remote-server/pom.xml
@@ -38,7 +38,6 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>1.2.14</version>
</dependency>
</dependencies>
diff --git a/modules/integration-tests/mod_cluster-plugin-test/pom.xml b/modules/integration-tests/mod_cluster-plugin-test/pom.xml
index ad8df87..b3370a3 100644
--- a/modules/integration-tests/mod_cluster-plugin-test/pom.xml
+++ b/modules/integration-tests/mod_cluster-plugin-test/pom.xml
@@ -75,7 +75,6 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>1.2.14</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/integration-tests/rest-api/pom.xml b/modules/integration-tests/rest-api/pom.xml
index cea2a5c..6061752 100644
--- a/modules/integration-tests/rest-api/pom.xml
+++ b/modules/integration-tests/rest-api/pom.xml
@@ -50,7 +50,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
- <version>4.8.2</version>
<scope>test</scope>
</dependency>
<dependency>
diff --git a/modules/plugins/aliases/pom.xml b/modules/plugins/aliases/pom.xml
index a7a4469..14874eb 100644
--- a/modules/plugins/aliases/pom.xml
+++ b/modules/plugins/aliases/pom.xml
@@ -26,7 +26,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>${ant.contrib.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml
index 5390fcc..0c750b6 100644
--- a/modules/plugins/ant-bundle/pom.xml
+++ b/modules/plugins/ant-bundle/pom.xml
@@ -66,13 +66,11 @@
<artifactItem>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>1.0b3</version>
</artifactItem>
<artifactItem>
<groupId>org.liquibase</groupId>
<artifactId>liquibase-core</artifactId>
- <version>1.9.5</version>
</artifactItem>
</artifactItems>
diff --git a/modules/plugins/apache/pom.xml b/modules/plugins/apache/pom.xml
index 2ca9086..3f6bca5 100644
--- a/modules/plugins/apache/pom.xml
+++ b/modules/plugins/apache/pom.xml
@@ -24,7 +24,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>${ant.contrib.version}</version>
<scope>provided</scope>
</dependency>
@@ -63,7 +62,6 @@
<dependency>
<groupId>xerces</groupId>
<artifactId>xercesImpl</artifactId>
- <version>${xercesImpl.version}</version>
<scope>test</scope>
</dependency>
diff --git a/modules/plugins/augeas/pom.xml b/modules/plugins/augeas/pom.xml
index 9a8acb4..4e663e6 100644
--- a/modules/plugins/augeas/pom.xml
+++ b/modules/plugins/augeas/pom.xml
@@ -39,13 +39,11 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>${testng.version}</version>
</dependency>
<dependency>
@@ -196,7 +194,6 @@
<artifactItem>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml
index ac3d8ff..9888aa0 100644
--- a/modules/plugins/cassandra/pom.xml
+++ b/modules/plugins/cassandra/pom.xml
@@ -17,7 +17,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/modules/plugins/cobbler/pom.xml b/modules/plugins/cobbler/pom.xml
index 8321f4e..c01634b 100644
--- a/modules/plugins/cobbler/pom.xml
+++ b/modules/plugins/cobbler/pom.xml
@@ -25,7 +25,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>${ant.contrib.version}</version>
<scope>provided</scope>
</dependency>
@@ -38,7 +37,6 @@
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</dependency>
</dependencies>
@@ -271,7 +269,6 @@
<artifactItem>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
- <version>1.4</version>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.outputDirectory}/lib</outputDirectory>
diff --git a/modules/plugins/cron/pom.xml b/modules/plugins/cron/pom.xml
index 6ed701b..27f290b 100644
--- a/modules/plugins/cron/pom.xml
+++ b/modules/plugins/cron/pom.xml
@@ -24,7 +24,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>${ant.contrib.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/plugins/grub/pom.xml b/modules/plugins/grub/pom.xml
index d77acf5..4a3ad1d 100644
--- a/modules/plugins/grub/pom.xml
+++ b/modules/plugins/grub/pom.xml
@@ -24,7 +24,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>${ant.contrib.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/plugins/hadoop/pom.xml b/modules/plugins/hadoop/pom.xml
index 1a6c591..dd99a37 100644
--- a/modules/plugins/hadoop/pom.xml
+++ b/modules/plugins/hadoop/pom.xml
@@ -110,7 +110,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
</dependency>
<dependency>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/hosts/pom.xml b/modules/plugins/hosts/pom.xml
index 467397e..9ca39d3 100644
--- a/modules/plugins/hosts/pom.xml
+++ b/modules/plugins/hosts/pom.xml
@@ -26,7 +26,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>${ant.contrib.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/plugins/irc/pom.xml b/modules/plugins/irc/pom.xml
index fc69a41..875e82f 100644
--- a/modules/plugins/irc/pom.xml
+++ b/modules/plugins/irc/pom.xml
@@ -128,7 +128,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
</dependency>
<dependency>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml
index f2a81a1..3eb65a7 100644
--- a/modules/plugins/jboss-as-5/pom.xml
+++ b/modules/plugins/jboss-as-5/pom.xml
@@ -64,7 +64,6 @@
<dependency>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
</dependency>
<dependency>
@@ -144,14 +143,12 @@
<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>
@@ -188,7 +185,6 @@
<artifactItem>
<groupId>jboss</groupId>
<artifactId>jbpm</artifactId>
- <version>3.1.1</version>
</artifactItem>
<artifactItem>
<groupId>ant</groupId>
diff --git a/modules/plugins/jboss-as-5/testsuite/pom.xml b/modules/plugins/jboss-as-5/testsuite/pom.xml
index dd1949e..ca6399a 100644
--- a/modules/plugins/jboss-as-5/testsuite/pom.xml
+++ b/modules/plugins/jboss-as-5/testsuite/pom.xml
@@ -74,7 +74,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <version>2.4</version>
<scope>provided</scope>
<!-- by JBossAS -->
</dependency>
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 1f63c91..1a5f119 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -71,7 +71,6 @@
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
- <version>${commons-httpclient.version}</version>
<exclusions>
<exclusion>
<groupId>commons-codec</groupId>
@@ -83,7 +82,6 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
- <version>${commons-codec.version}</version>
</dependency>
<!-- === Test Deps === -->
diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml
index d1f4c74..8a5b6c9 100644
--- a/modules/plugins/jboss-as/pom.xml
+++ b/modules/plugins/jboss-as/pom.xml
@@ -74,14 +74,12 @@
<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>
@@ -124,7 +122,6 @@
<artifactItem>
<groupId>jboss</groupId>
<artifactId>jbpm</artifactId>
- <version>3.1.1</version>
</artifactItem>
<artifactItem>
<groupId>ant</groupId>
@@ -152,7 +149,6 @@
<artifactItem>
<groupId>jboss</groupId>
<artifactId>jbpm</artifactId>
- <version>3.1.1</version>
</artifactItem>
<artifactItem>
<groupId>ant</groupId>
diff --git a/modules/plugins/mod-cluster/pom.xml b/modules/plugins/mod-cluster/pom.xml
index 804b04a..62ffc81 100644
--- a/modules/plugins/mod-cluster/pom.xml
+++ b/modules/plugins/mod-cluster/pom.xml
@@ -40,7 +40,6 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <version>1.2.14</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 03a4cbd..22db736 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -25,12 +25,10 @@
<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 -->
@@ -141,7 +139,6 @@
<artifactItem>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
- <version>${commons-httpclient.version}</version>
</artifactItem>
<artifactItem>
<groupId>commons-codec</groupId>
diff --git a/modules/plugins/pattern-generator/pom.xml b/modules/plugins/pattern-generator/pom.xml
index 7fe46e5..1d40834 100644
--- a/modules/plugins/pattern-generator/pom.xml
+++ b/modules/plugins/pattern-generator/pom.xml
@@ -122,7 +122,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
</dependency>
<dependency>
<groupId>${rhq.groupId}</groupId>
diff --git a/modules/plugins/perftest/pom.xml b/modules/plugins/perftest/pom.xml
index 7ccffa7..593a70b 100644
--- a/modules/plugins/perftest/pom.xml
+++ b/modules/plugins/perftest/pom.xml
@@ -33,7 +33,6 @@
<plugin>
<groupId>com.sun.tools.xjc.maven2</groupId>
<artifactId>maven-jaxb-plugin</artifactId>
- <version>1.1</version>
<executions>
<execution>
<goals>
diff --git a/modules/plugins/postfix/pom.xml b/modules/plugins/postfix/pom.xml
index 69a3b7d..6ee7474 100644
--- a/modules/plugins/postfix/pom.xml
+++ b/modules/plugins/postfix/pom.xml
@@ -24,7 +24,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>${ant.contrib.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/plugins/raw-config-test/pom.xml b/modules/plugins/raw-config-test/pom.xml
index 80bf531..c615a39 100644
--- a/modules/plugins/raw-config-test/pom.xml
+++ b/modules/plugins/raw-config-test/pom.xml
@@ -6,7 +6,7 @@
<parent>
<artifactId>rhq-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.3.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.plugins</groupId>
@@ -28,13 +28,11 @@
<dependency>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.7.0</version>
</dependency>
<dependency>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
- <version>1.6</version>
</dependency>
</dependencies>
@@ -43,7 +41,6 @@
<plugin>
<groupId>org.codehaus.groovy.maven</groupId>
<artifactId>gmaven-plugin</artifactId>
- <version>1.0</version>
<executions>
<execution>
<goals>
@@ -68,7 +65,6 @@
<artifactItem>
<groupId>org.codehaus.groovy</groupId>
<artifactId>groovy-all</artifactId>
- <version>1.7.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
@@ -83,17 +79,14 @@
<artifactItem>
<groupId>commons-configuration</groupId>
<artifactId>commons-configuration</artifactId>
- <version>1.6</version>
</artifactItem>
<artifactItem>
<groupId>commons-collections</groupId>
<artifactId>commons-collections</artifactId>
- <version>3.2.1</version>
</artifactItem>
<artifactItem>
<groupId>commons-lang</groupId>
<artifactId>commons-lang</artifactId>
- <version>2.4</version>
</artifactItem>
<artifactItem>
<groupId>commons-logging</groupId>
diff --git a/modules/plugins/samba/pom.xml b/modules/plugins/samba/pom.xml
index a392c58..23dadb6 100644
--- a/modules/plugins/samba/pom.xml
+++ b/modules/plugins/samba/pom.xml
@@ -24,7 +24,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>${ant.contrib.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/plugins/snmptrapd/pom.xml b/modules/plugins/snmptrapd/pom.xml
index 4805c8f..ae92638 100644
--- a/modules/plugins/snmptrapd/pom.xml
+++ b/modules/plugins/snmptrapd/pom.xml
@@ -164,7 +164,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
diff --git a/modules/plugins/sshd/pom.xml b/modules/plugins/sshd/pom.xml
index 92e76ef..93856c9 100644
--- a/modules/plugins/sshd/pom.xml
+++ b/modules/plugins/sshd/pom.xml
@@ -24,7 +24,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>${ant.contrib.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/plugins/sudoers/pom.xml b/modules/plugins/sudoers/pom.xml
index 053fac0..d10ef73 100644
--- a/modules/plugins/sudoers/pom.xml
+++ b/modules/plugins/sudoers/pom.xml
@@ -24,7 +24,6 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>${ant.contrib.version}</version>
<scope>provided</scope>
</dependency>
diff --git a/modules/plugins/tomcat/pom.xml b/modules/plugins/tomcat/pom.xml
index 9ded2f5..8cdd836 100644
--- a/modules/plugins/tomcat/pom.xml
+++ b/modules/plugins/tomcat/pom.xml
@@ -27,14 +27,12 @@
<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>
diff --git a/modules/plugins/twitter/pom.xml b/modules/plugins/twitter/pom.xml
index 6f00f3f..52e155c 100644
--- a/modules/plugins/twitter/pom.xml
+++ b/modules/plugins/twitter/pom.xml
@@ -120,7 +120,6 @@
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
- <version>${commons-logging.version}</version>
</dependency>
<dependency>
<groupId>org.rhq</groupId>
diff --git a/modules/test-utils/pom.xml b/modules/test-utils/pom.xml
index ee5bbfd..07e3aa1 100644
--- a/modules/test-utils/pom.xml
+++ b/modules/test-utils/pom.xml
@@ -27,7 +27,6 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
- <version>${testng.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
@@ -84,7 +83,7 @@
<dependency>
<groupId>org.unitils</groupId>
<artifactId>unitils-testng</artifactId>
- <version>3.1</version>
+ <version>3.1</version>
<exclusions>
<exclusion>
<groupId>org.testng</groupId>
diff --git a/pom.xml b/pom.xml
index 9510607..b849d13 100644
--- a/pom.xml
+++ b/pom.xml
@@ -69,7 +69,7 @@
<!-- Start: JBoss AS Dependency Versions
The dependency versions below are declared together as the versions of each are dependent on the
overall JBoss AS Server version. Meaning, the AS provides these libs. When the Server
- version is changed the versions of each of these should be validated and updated as needed.
+ version is changed the versions of each of these should be validated and updated as needed.
-->
<jboss.version>7.1.1.Final</jboss.version>
<jboss.javaee6.spec.version>3.0.0.Final</jboss.javaee6.spec.version>
@@ -78,7 +78,7 @@
<antlr.version>2.7.7</antlr.version>
<hibernate.version>4.0.1.Final</hibernate.version>
<hibernate-annotations.version>3.5.6-Final</hibernate-annotations.version>
- <hibernate-jpa-2.0-api.version>1.0.1.Final</hibernate-jpa-2.0-api.version>
+ <hibernate-jpa-2.0-api.version>1.0.1.Final</hibernate-jpa-2.0-api.version>
<infinispan.version>5.1.2.FINAL</infinispan.version>
<javax.annotation.api.version>1.0.1.Final</javax.annotation.api.version>
<javax.ejb.api.version>1.0.2.Final</javax.ejb.api.version>
@@ -95,23 +95,23 @@
<jboss-remotingjmx.version>1.0.2.Final</jboss-remotingjmx.version>
<jboss-transaction-api.version>1.0.0.Final</jboss-transaction-api.version>
<picketbox.version>4.0.7.Final</picketbox.version>
- <resteasy.version>2.3.4.Final</resteasy.version>
+ <resteasy.version>2.3.4.Final</resteasy.version>
<jboss-staxmapper.version>1.1.0.Final</jboss-staxmapper.version>
<jboss-modules.version>1.1.1.GA</jboss-modules.version>
<jboss-dmr.version>1.1.1.Final</jboss-dmr.version>
<jboss-msc.version>1.0.2.GA</jboss-msc.version>
<!-- Not Provided - some of these are needed by the agent -->
- <jboss-annotations.version>4.2.3.GA</jboss-annotations.version>
+ <jboss-annotations.version>4.2.3.GA</jboss-annotations.version>
<jboss-cache.version>1.4.1.SP9</jboss-cache.version>
- <jboss-jmx.version>4.2.3.GA</jboss-jmx.version>
- <jboss-common.version>1.2.1.GA</jboss-common.version> <!-- note this is the old commons we used, not the newer commons-core -->
+ <jboss-jmx.version>4.2.3.GA</jboss-jmx.version>
+ <jboss-common.version>1.2.1.GA</jboss-common.version> <!-- note this is the old commons we used, not the newer commons-core -->
<jboss-remoting.version>2.5.4.SP4</jboss-remoting.version>
<jboss-serialization.version>1.0.3.GA</jboss-serialization.version>
- <jboss-system.version>4.2.3.GA</jboss-system.version>
+ <jboss-system.version>4.2.3.GA</jboss-system.version>
<jbosssx.version>4.2.3.GA</jbosssx.version>
-
-
+
+
<!-- End: JBoss AS Dependency Versions -->
<commons-logging.version>1.1.0.jboss</commons-logging.version>
@@ -121,7 +121,7 @@
<i18nlog.version>1.0.10</i18nlog.version>
<jsf-api.version>1.2_14</jsf-api.version>
<jsf-impl.version>1.2_14</jsf-impl.version>
- <log4j.version>1.2.16</log4j.version>
+ <log4j.version>1.2.14</log4j.version>
<ojdbc6.version>11.2.0.3.0</ojdbc6.version>
<ems.version>1.3</ems.version>
<postgresql.version>9.2-1002.jdbc4</postgresql.version>
@@ -148,9 +148,22 @@
<arquillian.jboss.container.version>7.1.1.Final</arquillian.jboss.container.version>
<shrinkwrap-resolver.version>2.0.0-alpha-7</shrinkwrap-resolver.version>
<xercesImpl.version>2.9.1-jbossas-2</xercesImpl.version> <!-- see BZ-820629 and CVE-2009-2625 -->
- <opencsv.version>1.8</opencsv.version>
+ <opencsv.version>1.8</opencsv.version>
<commons-httpclient.version>3.0.1</commons-httpclient.version>
-
+ <commons-io.version>1.4</commons-io.version>
+ <commons-lang.version>2.4</commons-lang.version>
+ <commons-codec.version>1.4</commons-codec.version>
+ <commons-validator.version>1.1.4</commons-validator.version>
+ <commons-collections.version>3.2.1</commons-collections.version>
+ <commons-configuration.version>1.6</commons-configuration.version>
+
+ <junit.version>4.8.2</junit.version>
+ <liquibase-core.version>1.9.5</liquibase-core.version>
+ <jbpm.version>3.1.1</jbpm.version>
+ <servlet-api.version>2.4</servlet-api.version>
+
+ <mockito-core.version>1.9.0</mockito-core.version>
+
<rhq.db.admin.username>rhqadmin</rhq.db.admin.username>
<rhq.db.admin.password>rhqadmin</rhq.db.admin.password>
@@ -233,7 +246,7 @@
<jacoco.version>0.6.0.201210061924</jacoco.version>
<jacoco-arquillian-extension.version>1.0.0.Alpha5</jacoco-arquillian-extension.version>
</properties>
-
+
<dependencyManagement>
@@ -243,7 +256,7 @@
The dependencies below are declared together as the versions of each are dependent on the
overall JBoss AS Server version. Meaning, the AS provides these libs. When the Server
version is changed the versions of each of these should be validated and updated as needed. -->
-
+
<dependency>
<groupId>org.jboss.as</groupId>
<artifactId>jboss-as-dist</artifactId>
@@ -275,18 +288,18 @@
<version>${javax.annotation.api.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.1_spec</artifactId>
<version>${javax.ejb.api.version}</version>
</dependency>
- <dependency>
+ <dependency>
<groupId>org.jboss.spec.javax.jms</groupId>
<artifactId>jboss-jms-api_1.1_spec</artifactId>
<version>${javax.jms.api.version}</version>
</dependency>
-
+
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
@@ -371,6 +384,12 @@
<version>${jboss-msc.version}</version>
</dependency>
+ <dependency>
+ <groupId>jboss</groupId>
+ <artifactId>jbpm</artifactId>
+ <version>${jbpm.version}</version>
+ </dependency>
+
<!-- see BZ-820629 and CVE-2009-2625 for why this is needed -->
<dependency>
<groupId>xerces</groupId>
@@ -386,6 +405,48 @@
<version>${commons-logging.version}</version>
</dependency>
+ <dependency>
+ <groupId>commons-lang</groupId>
+ <artifactId>commons-lang</artifactId>
+ <version>${commons-lang.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-io</groupId>
+ <artifactId>commons-io</artifactId>
+ <version>${commons-io.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-codec</groupId>
+ <artifactId>commons-codec</artifactId>
+ <version>${commons-codec.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-validator</groupId>
+ <artifactId>commons-validator</artifactId>
+ <version>${commons-validator.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ <version>${commons-collections.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-configuration</groupId>
+ <artifactId>commons-configuration</artifactId>
+ <version>${commons-configuration.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>commons-httpclient</groupId>
+ <artifactId>commons-httpclient</artifactId>
+ <version>${commons-httpclient.version}</version>
+ </dependency>
+
<!-- GNU GetOpt (any modules that need to do command-line argument parsing should use this) -->
<dependency>
<groupId>gnu-getopt</groupId>
@@ -606,7 +667,7 @@
<artifactId>jboss-javaee-6.0</artifactId>
<version>${jboss.javaee6.spec.version}</version>
<type>pom</type>
- <scope>import</scope>
+ <scope>import,provided</scope>
</dependency>
<!-- We want the shrinkwrap dependency resolver to be newer than that included in the Arquillian BOM.
@@ -617,7 +678,7 @@
<version>${shrinkwrap-resolver.version}</version>
<scope>import</scope>
<type>pom</type>
- </dependency>
+ </dependency>
<!-- This will pull in the compatible versions of shrinkwrap deps too. Note that we want to use an explicit
version for the shrinkwrap resolver, which revs more often and has bugfixes. -->
<dependency>
@@ -645,6 +706,54 @@
<artifactId>org.jacoco.core</artifactId>
<version>${jacoco.version}</version>
</dependency>
+
+ <dependency>
+ <groupId>org.liquibase</groupId>
+ <artifactId>liquibase-core</artifactId>
+ <version>${liquibase-core.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>${mockito-core.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-testng</artifactId>
+ <version>${powermock.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>${powermock.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>junit</groupId>
+ <artifactId>junit</artifactId>
+ <version>${junit.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>${servlet-api.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ <version>${testng.version}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4j.version}</version>
+ </dependency>
</dependencies>
</dependencyManagement>
@@ -705,7 +814,7 @@
<dependency>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
- <version>1.0b3</version>
+ <version>${ant.contrib.version}</version>
<exclusions>
<exclusion>
<groupId>ant</groupId>
@@ -821,7 +930,11 @@
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
- </plugin>
+ </plugin>
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
<!-- === Codehaus Mojo Plugins === -->
<plugin>
@@ -839,7 +952,7 @@
<artifactId>exec-maven-plugin</artifactId>
<!-- NOTE: Version 1.2 of this plugin appears to be broken, so do not
upgrade to that version. -->
- <version>1.1</version>
+ <version>1.2.1</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -867,11 +980,17 @@
<version>${clirr.version}</version>
</plugin>
<plugin>
- <groupId>org.codehaus.mojo</groupId>
+ <groupId>org.codehaus.mojo</groupId>
<artifactId>xml-maven-plugin</artifactId>
<version>1.0</version>
</plugin>
-
+
+ <plugin>
+ <groupId>org.codehaus.groovy.maven</groupId>
+ <artifactId>gmaven-plugin</artifactId>
+ <version>1.0</version>
+ </plugin>
+
<plugin>
<groupId>com.googlecode.maven-overview-plugin</groupId>
<artifactId>maven-overview-plugin</artifactId>
@@ -898,7 +1017,19 @@
<artifactId>jacoco-maven-plugin</artifactId>
<version>${jacoco.version}</version>
</plugin>
- </plugins>
+
+ <plugin>
+ <groupId>com.sun.tools.xjc.maven2</groupId>
+ <artifactId>maven-jaxb-plugin</artifactId>
+ <version>1.1</version>
+ </plugin>
+
+ <plugin>
+ <groupId>org.antlr</groupId>
+ <artifactId>antlr3-maven-plugin</artifactId>
+ <version>3.2</version>
+ </plugin>
+ </plugins>
</pluginManagement>
@@ -1353,21 +1484,21 @@
<name>code-coverage</name>
</property>
</activation>
-
+
<dependencies>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-jacoco</artifactId>
<scope>test</scope>
</dependency>
-
+
<dependency>
<groupId>org.jacoco</groupId>
<artifactId>org.jacoco.core</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
-
+
<build>
<plugins>
<!-- This definition creates the 2 independent coverage reports -
@@ -1786,8 +1917,13 @@
<reportSets>
<reportSet>
</reportSet>
- </reportSets>
- </plugin>
+ </reportSets>
+ </plugin>
+
+ <plugin>
+ <artifactId>maven-surefire-report-plugin</artifactId>
+ <version>2.6</version>
+ </plugin>
<!--
<plugin>
commit 438c80560c8faeff638f2640cd8278aa4c214aaf
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Mar 21 16:12:26 2013 -0400
Bug 832398
RFE: Enable DynaGroups to be created based on the contents of another group
Introduce 'memberof = GroupName' expression into the group definition
language. memberof will restrict the dynagroup members to be a subset
of the specified resource group. Specifying multiple memberof
conditions will restrict the dynagroup members to be a subset of the
union of members of the specified groups.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/selection/SingleCompatibleResourceGroupSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/selection/SingleCompatibleResourceGroupSelector.java
index d370861..7e31550 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/selection/SingleCompatibleResourceGroupSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/bundle/deploy/selection/SingleCompatibleResourceGroupSelector.java
@@ -31,6 +31,8 @@ import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
+@Deprecated
+// could use SingleResourceGroupSelectorItem seeded with addFilterBundleTargetableOnly(true);
public class SingleCompatibleResourceGroupSelector extends ComboBoxItem {
public SingleCompatibleResourceGroupSelector(String name, String title) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/SingleResourceGroupSelectorItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/SingleResourceGroupSelectorItem.java
new file mode 100644
index 0000000..027cafc
--- /dev/null
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/selector/SingleResourceGroupSelectorItem.java
@@ -0,0 +1,85 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser 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.enterprise.gui.coregui.client.components.selector;
+
+import com.smartgwt.client.data.DSRequest;
+import com.smartgwt.client.types.TextMatchStyle;
+import com.smartgwt.client.widgets.form.fields.ComboBoxItem;
+import com.smartgwt.client.widgets.grid.ListGridField;
+
+import org.rhq.core.domain.criteria.ResourceGroupCriteria;
+import org.rhq.enterprise.gui.coregui.client.CoreGUI;
+import org.rhq.enterprise.gui.coregui.client.inventory.groups.ResourceGroupsDataSource;
+
+public class SingleResourceGroupSelectorItem extends ComboBoxItem {
+
+ private ResourceGroupCriteria criteria;
+
+ /**
+ * @param name
+ * @param title
+ * @param criteria initial values for filterId and filterName may be edited in the drop down but will be applied to
+ * the initial fetch.
+ */
+ public SingleResourceGroupSelectorItem(String name, String title, ResourceGroupCriteria criteria) {
+ super(name, title);
+
+ ListGridField nameField = new ListGridField("name");
+ ListGridField descriptionField = new ListGridField("description");
+
+ setOptionDataSource(new CompatibleResourceGroupsDataSource());
+
+ setWidth(240);
+ setTitle(CoreGUI.getMessages().common_title_resource_group());
+
+ setValueField("id");
+ setDisplayField("name");
+ setPickListWidth(450);
+ setPickListFields(nameField, descriptionField);
+ setTextMatchStyle(TextMatchStyle.SUBSTRING);
+
+ this.criteria = (null == criteria) ? new ResourceGroupCriteria() : criteria;
+ }
+
+ protected class CompatibleResourceGroupsDataSource extends ResourceGroupsDataSource {
+
+ @Override
+ protected ResourceGroupCriteria getFetchCriteria(final DSRequest request) {
+ // We don't want to use the superclass's getFetchCriteria because our selected value
+ // is either a Integer (when a real group has been selected) or a String (when a partial search string is selected).
+ // So, here we create our own criteria. See BZ 802528.
+ ResourceGroupCriteria result = criteria;
+ String filterString = getFilter(request, "id", String.class);
+ if (filterString != null) {
+ try {
+ Integer id = new Integer(filterString);
+ result.addFilterId(id);
+ } catch (Exception e) {
+ result.addFilterName(filterString);
+ }
+ }
+
+ return result;
+ }
+ }
+}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionExpressionBuilder.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionExpressionBuilder.java
index e7e6181..bb49a93 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionExpressionBuilder.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/definitions/GroupDefinitionExpressionBuilder.java
@@ -54,6 +54,7 @@ import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.Messages;
import org.rhq.enterprise.gui.coregui.client.components.form.SortedSelectItem;
+import org.rhq.enterprise.gui.coregui.client.components.selector.SingleResourceGroupSelectorItem;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.gwt.GroupDefinitionExpressionBuilderGWTServiceAsync;
import org.rhq.enterprise.gui.coregui.client.util.enhanced.EnhancedVLayout;
@@ -78,6 +79,8 @@ public class GroupDefinitionExpressionBuilder extends Window {
private SelectItem expressionTypeItem;
private SelectItem resourceItem;
private RadioGroupItem groupByItem;
+ private RadioGroupItem memberOfItem;
+ private SingleResourceGroupSelectorItem memberOfGroupItem;
private TextAreaItem expressionItem;
private ArrayList<String> plugins = new ArrayList<String>();
@@ -276,6 +279,33 @@ public class GroupDefinitionExpressionBuilder extends Window {
}
});
+ this.memberOfItem = new RadioGroupItem("memberOf", MSG.view_dynagroup_exprBuilder_memberOf());
+ this.memberOfItem.setTooltip(MSG.view_dynagroup_exprBuilder_memberOf_tooltip());
+ this.memberOfItem.setHoverWidth(250);
+ this.memberOfItem.setDefaultValue(MSG.common_val_no());
+ this.memberOfItem.setValueMap(MSG.common_val_yes(), MSG.common_val_no());
+ this.memberOfItem.setVertical(false);
+ this.memberOfItem.addChangedHandler(new ChangedHandler() {
+ @Override
+ public void onChanged(ChangedEvent event) {
+ enableDisableComponents();
+ buildExpressionValue();
+ }
+ });
+
+ this.memberOfGroupItem = new SingleResourceGroupSelectorItem("memberOfGroup", MSG.common_title_group(), null);
+ this.memberOfGroupItem.setTooltip(MSG.view_dynagroup_exprBuilder_groupBy_tooltip());
+ this.memberOfGroupItem.setHoverWidth(250);
+ this.memberOfGroupItem.setRedrawOnChange(true);
+ this.memberOfGroupItem.setWidth("*");
+ this.memberOfGroupItem.setDefaultToFirstOption(true);
+ this.memberOfGroupItem.addChangedHandler(new ChangedHandler() {
+ @Override
+ public void onChanged(ChangedEvent event) {
+ buildExpressionValue();
+ }
+ });
+
this.groupByItem = new RadioGroupItem("groupBy", MSG.view_dynagroup_exprBuilder_groupBy());
this.groupByItem.setTooltip(MSG.view_dynagroup_exprBuilder_groupBy_tooltip());
this.groupByItem.setHoverWidth(250);
@@ -332,9 +362,9 @@ public class GroupDefinitionExpressionBuilder extends Window {
form.setAutoWidth();
form.setAutoHeight();
form.setCellPadding(5);
- form.setFields(this.expressionItem, this.groupByItem, this.resourceItem, this.expressionTypeItem,
- this.pluginItem, this.resourceTypeItem, this.propertyNameItem, this.unsetItem, this.compareTypeItem,
- this.valueItem, addButton, closeButton);
+ form.setFields(this.expressionItem, this.memberOfItem, this.memberOfGroupItem, this.groupByItem,
+ this.resourceItem, this.expressionTypeItem, this.pluginItem, this.resourceTypeItem, this.propertyNameItem,
+ this.unsetItem, this.compareTypeItem, this.valueItem, addButton, closeButton);
EnhancedVLayout layout = new EnhancedVLayout();
layout.setLayoutMargin(5);
@@ -369,56 +399,87 @@ public class GroupDefinitionExpressionBuilder extends Window {
public void addExpression(String newExpression);
}
+ private boolean shouldMemberOfGroupBeDisabled() {
+ String expressionType = this.expressionTypeItem.getValueAsString();
+
+ if (MSG.common_val_no().equals(this.memberOfItem.getValueAsString())) {
+ return true;
+ }
+ return false; // they are enabled otherwise
+ }
+
+ private boolean shouldResourceAndExpressionTypeBeDisabled() {
+ String expressionType = this.expressionTypeItem.getValueAsString();
+
+ if (MSG.common_val_yes().equals(this.memberOfItem.getValueAsString())) {
+ return true;
+ }
+ return false; // they are enabled otherwise
+ }
+
private boolean shouldPluginAndResourceTypeBeDisabled() {
String expressionType = this.expressionTypeItem.getValueAsString();
+ if (MSG.common_val_yes().equals(this.memberOfItem.getValueAsString())) {
+ return true;
+ }
if (MSG.view_dynagroup_exprBuilder_expressionType_resource().equals(expressionType)) {
return true;
- } else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceCategory().equals(expressionType)) {
+ }
+ if (MSG.view_dynagroup_exprBuilder_expressionType_resourceCategory().equals(expressionType)) {
return true;
- } else if ((MSG.view_dynagroup_exprBuilder_expressionType_resourceType().equals(expressionType))
+ }
+ if ((MSG.view_dynagroup_exprBuilder_expressionType_resourceType().equals(expressionType))
&& (MSG.common_val_yes().equals(groupByItem.getValueAsString()))) {
return true;
}
+
return false; // they are enabled otherwise
}
private boolean shouldComparisonTypeAndValueBeDisabled() {
+ boolean memberOf = MSG.common_val_yes().equals(this.memberOfItem.getValueAsString());
boolean groupBy = MSG.common_val_yes().equals(this.groupByItem.getValueAsString());
boolean unset = MSG.common_val_yes().equals(this.unsetItem.getValueAsString());
String expressionType = this.expressionTypeItem.getValueAsString();
- if (groupBy) {
+ if (groupBy || memberOf || unset) {
return true;
- } else if (unset) {
- return true;
- } else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceType().equals(expressionType)) {
+ }
+ if (MSG.view_dynagroup_exprBuilder_expressionType_resourceType().equals(expressionType)) {
return true;
}
+
return false; // they are enabled otherwise
}
private boolean shouldGroupByBeDisabled() {
+ boolean memberOf = MSG.common_val_yes().equals(this.memberOfItem.getValueAsString());
boolean unset = MSG.common_val_yes().equals(this.unsetItem.getValueAsString());
- if (unset) {
+ if (memberOf || unset) {
return true;
}
return false; // enabled otherwise
}
private boolean shouldUnsetBeDisabled() {
+ boolean memberOf = MSG.common_val_yes().equals(this.memberOfItem.getValueAsString());
boolean groupBy = MSG.common_val_yes().equals(this.groupByItem.getValueAsString());
- if (groupBy) {
+ if (groupBy || memberOf) {
return true;
}
return false; // enabled otherwise
}
private boolean shouldPropertyNameBeDisabled() {
+ boolean memberOf = MSG.common_val_yes().equals(this.memberOfItem.getValueAsString());
String expressionType = this.expressionTypeItem.getValueAsString();
+ if (memberOf) {
+ return true;
+ }
if (MSG.view_dynagroup_exprBuilder_expressionType_resourceType().equals(expressionType)) {
return true;
} else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceCategory().equals(expressionType)) {
@@ -546,12 +607,17 @@ public class GroupDefinitionExpressionBuilder extends Window {
}
private void enableDisableComponents() {
+ boolean memberOfGroupDisabled = shouldMemberOfGroupBeDisabled();
+ boolean resourceAndExpressionTypeDisabled = shouldResourceAndExpressionTypeBeDisabled();
boolean pluginAndResourceTypeDisabled = shouldPluginAndResourceTypeBeDisabled();
boolean comparisonTypeAndValueDisabled = shouldComparisonTypeAndValueBeDisabled();
boolean groupByDisabled = shouldGroupByBeDisabled();
boolean unsetDisabled = shouldUnsetBeDisabled();
boolean propertyNameDisabled = shouldPropertyNameBeDisabled();
+ this.memberOfGroupItem.setDisabled(memberOfGroupDisabled);
+ this.resourceItem.setDisabled(resourceAndExpressionTypeDisabled);
+ this.expressionTypeItem.setDisabled(resourceAndExpressionTypeDisabled);
this.pluginItem.setDisabled(pluginAndResourceTypeDisabled);
this.resourceTypeItem.setDisabled(pluginAndResourceTypeDisabled);
this.compareTypeItem.setDisabled(comparisonTypeAndValueDisabled);
@@ -565,83 +631,90 @@ public class GroupDefinitionExpressionBuilder extends Window {
private void buildExpressionValue() {
+ boolean memberOf = MSG.common_val_yes().equals(this.memberOfItem.getValueAsString());
boolean groupBy = MSG.common_val_yes().equals(groupByItem.getValueAsString());
boolean unset = MSG.common_val_yes().equals(unsetItem.getValueAsString());
StringBuilder buf = new StringBuilder();
- if (groupBy) {
- buf.append("groupby ");
- }
- if (unset) {
- buf.append("empty ");
- }
+ if (memberOf) {
+ buf.append("memberof = " + memberOfGroupItem.getDisplayValue());
- buf.append("resource.");
-
- String resourceLevel = resourceItem.getValueAsString();
- if (MSG.view_dynagroup_exprBuilder_resource_resource().equals(resourceLevel)) {
- // do nothing
- } else if (MSG.view_dynagroup_exprBuilder_resource_child().equals(resourceLevel)) {
- buf.append("child.");
- } else if (MSG.view_dynagroup_exprBuilder_resource_parent().equals(resourceLevel)) {
- buf.append("parent.");
- } else if (MSG.view_dynagroup_exprBuilder_resource_grandparent().equals(resourceLevel)) {
- buf.append("grandParent.");
- } else if (MSG.view_dynagroup_exprBuilder_resource_greatGrandparent().equals(resourceLevel)) {
- buf.append("greatGrandParent.");
- } else if (MSG.view_dynagroup_exprBuilder_resource_greatGreatGrandparent().equals(resourceLevel)) {
- buf.append("greatGreatGrandParent.");
- }
+ } else {
- String eType = expressionTypeItem.getValueAsString();
- if (MSG.view_dynagroup_exprBuilder_expressionType_resource().equals(eType)) {
- buf.append(propertyNameItem.getValueAsString());
- } else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceType().equals(eType)) {
- buf.append("type.plugin");
- } else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceCategory().equals(eType)) {
- buf.append("type.category");
- } else if (MSG.view_dynagroup_exprBuilder_expressionType_trait().equals(eType)) {
- buf.append("trait[" + propertyNameItem.getValueAsString() + "]");
- } else if (MSG.view_dynagroup_exprBuilder_expressionType_pluginConfig().equals(eType)) {
- buf.append("pluginConfiguration[" + propertyNameItem.getValueAsString() + "]");
- } else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceConfig().equals(eType)) {
- buf.append("resourceConfiguration[" + propertyNameItem.getValueAsString() + "]");
- }
+ if (groupBy) {
+ buf.append("groupby ");
+ }
+ if (unset) {
+ buf.append("empty ");
+ }
- if (!groupBy && !unset) {
+ buf.append("resource.");
- String selectedComparison = compareTypeItem.getValueAsString();
- if (MSG.view_dynagroup_exprBuilder_comparisonType_equals().equals(selectedComparison)) {
+ String resourceLevel = resourceItem.getValueAsString();
+ if (MSG.view_dynagroup_exprBuilder_resource_resource().equals(resourceLevel)) {
// do nothing
- } else if (MSG.view_dynagroup_exprBuilder_comparisonType_contains().equals(selectedComparison)) {
- buf.append(".contains");
- } else if (MSG.view_dynagroup_exprBuilder_comparisonType_startsWith().equals(selectedComparison)) {
- buf.append(".startsWith");
- } else if (MSG.view_dynagroup_exprBuilder_comparisonType_endsWith().equals(selectedComparison)) {
- buf.append(".endsWith");
+ } else if (MSG.view_dynagroup_exprBuilder_resource_child().equals(resourceLevel)) {
+ buf.append("child.");
+ } else if (MSG.view_dynagroup_exprBuilder_resource_parent().equals(resourceLevel)) {
+ buf.append("parent.");
+ } else if (MSG.view_dynagroup_exprBuilder_resource_grandparent().equals(resourceLevel)) {
+ buf.append("grandParent.");
+ } else if (MSG.view_dynagroup_exprBuilder_resource_greatGrandparent().equals(resourceLevel)) {
+ buf.append("greatGrandParent.");
+ } else if (MSG.view_dynagroup_exprBuilder_resource_greatGreatGrandparent().equals(resourceLevel)) {
+ buf.append("greatGreatGrandParent.");
+ }
+
+ String eType = expressionTypeItem.getValueAsString();
+ if (MSG.view_dynagroup_exprBuilder_expressionType_resource().equals(eType)) {
+ buf.append(propertyNameItem.getValueAsString());
+ } else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceType().equals(eType)) {
+ buf.append("type.plugin");
+ } else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceCategory().equals(eType)) {
+ buf.append("type.category");
+ } else if (MSG.view_dynagroup_exprBuilder_expressionType_trait().equals(eType)) {
+ buf.append("trait[" + propertyNameItem.getValueAsString() + "]");
+ } else if (MSG.view_dynagroup_exprBuilder_expressionType_pluginConfig().equals(eType)) {
+ buf.append("pluginConfiguration[" + propertyNameItem.getValueAsString() + "]");
+ } else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceConfig().equals(eType)) {
+ buf.append("resourceConfiguration[" + propertyNameItem.getValueAsString() + "]");
}
- buf.append(" = ");
+ if (!groupBy && !unset) {
+
+ String selectedComparison = compareTypeItem.getValueAsString();
+ if (MSG.view_dynagroup_exprBuilder_comparisonType_equals().equals(selectedComparison)) {
+ // do nothing
+ } else if (MSG.view_dynagroup_exprBuilder_comparisonType_contains().equals(selectedComparison)) {
+ buf.append(".contains");
+ } else if (MSG.view_dynagroup_exprBuilder_comparisonType_startsWith().equals(selectedComparison)) {
+ buf.append(".startsWith");
+ } else if (MSG.view_dynagroup_exprBuilder_comparisonType_endsWith().equals(selectedComparison)) {
+ buf.append(".endsWith");
+ }
- if (MSG.view_dynagroup_exprBuilder_expressionType_resource().equals(eType)
- || MSG.view_dynagroup_exprBuilder_expressionType_resourceCategory().equals(eType)) {
- buf.append(valueItem.getValueAsString());
+ buf.append(" = ");
+
+ if (MSG.view_dynagroup_exprBuilder_expressionType_resource().equals(eType)
+ || MSG.view_dynagroup_exprBuilder_expressionType_resourceCategory().equals(eType)) {
+ buf.append(valueItem.getValueAsString());
+ } else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceType().equals(eType)) {
+ String d = buf.toString();
+ buf.append(pluginItem.getValueAsString());
+ buf.append("\n");
+ buf.append(d.replaceAll("plugin", "name"));
+ buf.append(resourceTypeItem.getValueAsString());
+ } else if (MSG.view_dynagroup_exprBuilder_expressionType_trait().equals(eType)
+ || MSG.view_dynagroup_exprBuilder_expressionType_pluginConfig().equals(eType)
+ || MSG.view_dynagroup_exprBuilder_expressionType_resourceConfig().equals(eType)) {
+ buf.append(valueItem.getValueAsString());
+ }
} else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceType().equals(eType)) {
String d = buf.toString();
- buf.append(pluginItem.getValueAsString());
buf.append("\n");
buf.append(d.replaceAll("plugin", "name"));
- buf.append(resourceTypeItem.getValueAsString());
- } else if (MSG.view_dynagroup_exprBuilder_expressionType_trait().equals(eType)
- || MSG.view_dynagroup_exprBuilder_expressionType_pluginConfig().equals(eType)
- || MSG.view_dynagroup_exprBuilder_expressionType_resourceConfig().equals(eType)) {
- buf.append(valueItem.getValueAsString());
}
- } else if (MSG.view_dynagroup_exprBuilder_expressionType_resourceType().equals(eType)) {
- String d = buf.toString();
- buf.append("\n");
- buf.append(d.replaceAll("plugin", "name"));
}
String expressionValueString = buf.toString();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourceGroupSelector.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourceGroupSelector.java
index 8928066..fc9bda9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourceGroupSelector.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/selection/SingleResourceGroupSelector.java
@@ -24,7 +24,7 @@ import com.smartgwt.client.types.SelectionStyle;
import org.rhq.core.domain.resource.group.GroupCategory;
/**
- * This forces the user to only be able to select a single resource.
+ * This forces the user to only be able to select a single resource group.
*
* @author Jay Shaughnessy
*/
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 1f2e209..0d731ab 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
@@ -1472,6 +1472,8 @@ view_dynagroup_exprBuilder_expressionType_trait = Trait
view_dynagroup_exprBuilder_expression_tooltip = This is the full expression that is represented by the selections in the form below. This text will be added to your group definition expression text when you click the "Add Expression" button.
view_dynagroup_exprBuilder_groupBy = Group by
view_dynagroup_exprBuilder_groupBy_tooltip = GroupBy will cause the system to pivot on the values from the entered expressions creating a separate group for each value. For example, GroupBy on the cluster name to create a group for each cluster with all cluster members in it.
+view_dynagroup_exprBuilder_memberOf = Member of
+view_dynagroup_exprBuilder_memberOf_tooltip = memberof will restrict the dynagroup members to be a subset of the specified resource group. Specifying multiple memberof conditions will restrict the dynagroup members to be a subset of the union of members of the specified groups.
view_dynagroup_exprBuilder_noPlugins = --No plugins--
view_dynagroup_exprBuilder_noProperties = --No properties--
view_dynagroup_exprBuilder_noResourceTypes = --No resource types--
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
index 255391f..b4ba1e4 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
@@ -1486,6 +1486,8 @@ view_dynagroup_exprBuilder_expressionType_trait = Vlastnost (trait)
##view_dynagroup_exprBuilder_expression_tooltip = This is the full expression that is represented by the selections in the form below. This text will be added to your group definition expression text when you click the "Add Expression" button.
view_dynagroup_exprBuilder_groupBy = Seskupit podle
##view_dynagroup_exprBuilder_groupBy_tooltip = GroupBy will cause the system to pivot on the values from the entered expressions creating a separate group for each value. For example, GroupBy on the cluster name to create a group for each cluster with all cluster members in it.
+##view_dynagroup_exprBuilder_memberOf = Member of
+##view_dynagroup_exprBuilder_memberOf_tooltip = memberof will restrict the dynagroup members to be a subset of the specified resource group. Specifying multiple memberof conditions will restrict the dynagroup members to be a subset of the union of members of the specified groups.
view_dynagroup_exprBuilder_noPlugins = --Žádné zásuvné moduly--
view_dynagroup_exprBuilder_noProperties = --Žádné vlastnosti--
view_dynagroup_exprBuilder_noResourceTypes = --Žádné typy zdrojů--
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index 6f6743c..016b160 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1330,6 +1330,9 @@ view_dynagroup_exprBuilder_expressionType_resourceConfig = Ressourcen-Konfigurat
view_dynagroup_exprBuilder_expressionType_resourceType = Ressourcen-Typ
view_dynagroup_exprBuilder_expressionType_trait = Trait
view_dynagroup_exprBuilder_groupBy = Gruppieren nach
+##view_dynagroup_exprBuilder_groupBy_tooltip = groupby will cause the system to pivot on the values from the entered expressions creating a separate group for each value. For example, groupby on the cluster name to create a group for each cluster with all cluster members in it.
+##view_dynagroup_exprBuilder_memberOf = Member of
+##view_dynagroup_exprBuilder_memberOf_tooltip = memberof will restrict the dynagroup members to be a subset of the specified resource group. Specifying multiple memberof conditions will restrict the dynagroup members to be a subset of the union of members of the specified groups.
view_dynagroup_exprBuilder_noPlugins = --Keine Plugins--
view_dynagroup_exprBuilder_noProperties = --Keine Eigenschaften--
view_dynagroup_exprBuilder_noResourceTypes = --Keine Ressourcen-Typen--
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 09579ae..1f24034 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -1457,8 +1457,10 @@ view_dynagroup_exprBuilder_expressionType_resourceType = リソースタイプ
view_dynagroup_exprBuilder_expressionType_tooltip = この式のプロパティは以下のものに切り替わります。<br/> <b>リソース</b>: 名前やバージョンといったリソースプロパティ<br/> <b>リソースタイプ</b>: 特定タイプのリソースの検索<br/> <b>リソースカテゴリ</b>: プラットフォーム、サーバー、サービスといったカテゴリによるリソース検索<br/> <b>トレイト</b>: モニタされたトレイトのために選択された値を持つリソース<br/> <b>プラグイン構成</b>: コンポーネントのプラグインコンポーネント構成設定による検索<br/> <b>リソース構成</b>: 管理リソースの構成設定による検索
view_dynagroup_exprBuilder_expressionType_trait = トレイト
view_dynagroup_exprBuilder_expression_tooltip = これは以下のフォーム内の選択によって表現される完全な式です。このテキストは、"式の追加"ボタンをクリックすると、グループ定義式のテキストに追加されます。
-view_dynagroup_exprBuilder_groupBy = Group by
+##view_dynagroup_exprBuilder_groupBy = Group by
view_dynagroup_exprBuilder_groupBy_tooltip = GroupByはシステムが入力式からの値についてピボット解析ができるようにします。例えば、クラスター名によるGroupByによって、すべてのクラスターメンバーをその中に含むようなクラスタのグループを作成します。
+##view_dynagroup_exprBuilder_memberOf = Member of
+##view_dynagroup_exprBuilder_memberOf_tooltip = memberof will restrict the dynagroup members to be a subset of the specified resource group. Specifying multiple memberof conditions will restrict the dynagroup members to be a subset of the union of members of the specified groups.
view_dynagroup_exprBuilder_noPlugins = --プラグインなし--
view_dynagroup_exprBuilder_noProperties = --プラグインなし--
view_dynagroup_exprBuilder_noResourceTypes = --リソースタイプなし--
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
index 84e024a..f832c7d 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
@@ -1218,7 +1218,10 @@ view_dynagroup_exprBuilder_expressionType_pluginConfig = 플러그인 설정
view_dynagroup_exprBuilder_expressionType_resource = 리소스
view_dynagroup_exprBuilder_expressionType_resourceConfig = 리소스 설정
view_dynagroup_exprBuilder_expressionType_trait = 특성
-view_dynagroup_exprBuilder_groupBy = Group by
+##view_dynagroup_exprBuilder_groupBy = Group by
+##view_dynagroup_exprBuilder_groupBy_tooltip = groupby will cause the system to pivot on the values from the entered expressions creating a separate group for each value. For example, groupby on the cluster name to create a group for each cluster with all cluster members in it.
+##view_dynagroup_exprBuilder_memberOf = Member of
+##view_dynagroup_exprBuilder_memberOf_tooltip = memberof will restrict the dynagroup members to be a subset of the specified resource group. Specifying multiple memberof conditions will restrict the dynagroup members to be a subset of the union of members of the specified groups.
view_dynagroup_exprBuilder_noPlugins = --플러그인 없이--
view_dynagroup_exprBuilder_noProperties = --속성 없이--
view_dynagroup_exprBuilder_pluginLoadFailure = 플러그인 목록을 가져올 수 없습니다
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index 262c3c4..bb7d48b 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -1481,6 +1481,8 @@ view_dynagroup_exprBuilder_expressionType_trait = Caracter�stica
view_dynagroup_exprBuilder_expression_tooltip = Esta � a express�o completa com base nas defini��es do formul�rio abaixo. Este texto ser� adicionado ao campo de express�o da defini��o do grupo quando voc� clicar o bot�o "Adicionar Express�o"
view_dynagroup_exprBuilder_groupBy = Agrupado por
view_dynagroup_exprBuilder_groupBy_tooltip = GroupBy far� com que o resultado da busca seja agrupado de acordo com os valores informados na express�o. Por exemplo, usando GroupBy para o nome de um cluster JBossAS, o resultado criar� um grupo para cada cluster e seus membros.
+##view_dynagroup_exprBuilder_memberOf = Member of
+##view_dynagroup_exprBuilder_memberOf_tooltip = memberof will restrict the dynagroup members to be a subset of the specified resource group. Specifying multiple memberof conditions will restrict the dynagroup members to be a subset of the union of members of the specified groups.
view_dynagroup_exprBuilder_noPlugins = --Sem plugins--
view_dynagroup_exprBuilder_noProperties = --Sem propriedades--
view_dynagroup_exprBuilder_noResourceTypes = --Nehum tipo de recurso--
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index d96d127..f354bd8 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -2654,6 +2654,10 @@ view_admin_systemSettings_LDAPBindPW_name = Пароль
##view_configEdit_unset = Unset?
##view_configEdit_value = Value
##view_dashboardsManager_message_title_details = <h1>Welcome to {0}</h1>\n<p>This dashboard can be edited by clicking the (Edit Mode) button above.</p>\n<p>What would you like to do?</p>\n<p> <a href=\"{1}\">Import newly discovered resources.</a></p>\n<p> <a href=\"{2}\">Search for resources.</a></p>\n<p> <a href=\"{3}\">See help and documentation.</a></p>
+##view_dynagroup_exprBuilder_groupBy = Group by
+##view_dynagroup_exprBuilder_groupBy_tooltip = groupby will cause the system to pivot on the values from the entered expressions creating a separate group for each value. For example, groupby on the cluster name to create a group for each cluster with all cluster members in it.
+##view_dynagroup_exprBuilder_memberOf = Member of
+##view_dynagroup_exprBuilder_memberOf_tooltip = memberof will restrict the dynagroup members to be a subset of the specified resource group. Specifying multiple memberof conditions will restrict the dynagroup members to be a subset of the union of members of the specified groups.
##view_group_common_emptyGroup = An empty group is always considered as mixed.
##view_group_detail_explicitAvail = Group availability for explicit members (does not include recursive members).
##view_group_detail_failLoad = Failed to load group for group with ID [{0}]
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 9159a53..e19f5f2 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1459,6 +1459,8 @@ view_dynagroup_exprBuilder_expressionType_trait = \u7279\u5f81
view_dynagroup_exprBuilder_expression_tooltip = This is the full expression that is represented by the selections in the form below. This text will be added to your group definition expression text when you click the "Add Expression" button.
view_dynagroup_exprBuilder_groupBy = \u5206\u7ec4
view_dynagroup_exprBuilder_groupBy_tooltip = GroupBy will cause the system to pivot on the values from the entered expressions creating a separate group for each value. For example, GroupBy on the cluster name to create a group for each cluster with all cluster members in it.
+##view_dynagroup_exprBuilder_memberOf = Member of
+##view_dynagroup_exprBuilder_memberOf_tooltip = memberof will restrict the dynagroup members to be a subset of the specified resource group. Specifying multiple memberof conditions will restrict the dynagroup members to be a subset of the union of members of the specified groups.
view_dynagroup_exprBuilder_noPlugins = --\u65e0\u63d2\u4ef6--
view_dynagroup_exprBuilder_noProperties = -\u65e0\u5c5e\u6027--
view_dynagroup_exprBuilder_noResourceTypes = --\u65e0\u8d44\u6e90\u7c7b\u578b--
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java
index a1c8a65..92919c5 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/group/definition/framework/test/ExpressionEvaluatorTest.java
@@ -25,8 +25,8 @@ import java.util.List;
import org.testng.annotations.Test;
import org.rhq.core.domain.resource.group.DuplicateExpressionTypeException;
-import org.rhq.enterprise.server.resource.group.definition.framework.ExpressionEvaluator;
import org.rhq.core.domain.resource.group.InvalidExpressionException;
+import org.rhq.enterprise.server.resource.group.definition.framework.ExpressionEvaluator;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.util.QueryUtility;
@@ -154,7 +154,15 @@ public class ExpressionEvaluatorTest extends AbstractEJB3Test {
" AND simple.stringValue IS NULL " + //
" AND simple.configuration = pluginConf " + //
" AND simpleDef.configurationDefinition = pluginConfDef " + //
- " AND simple.name = simpleDef.name AND simpleDef.type != 'PASSWORD' " }, };
+ " AND simple.name = simpleDef.name AND simpleDef.type != 'PASSWORD' " },
+
+ { "resource.name = joseph; " + //
+ "memberof = Group Name",
+
+ "SELECT res.id FROM Resource res " + //
+ "JOIN res.implicitGroups implicitGroup " + //
+ "WHERE res.name = :arg1 " + //
+ " AND implicitGroup.name IN ('Group Name') " }, };
}
@Test(groups = "integration.session")
@@ -220,12 +228,14 @@ public class ExpressionEvaluatorTest extends AbstractEJB3Test {
String[] input = { "resource.child.name", //
"resource.pluginConfiguration[partition]", //
"resource.pluginConfiguration[partition].contains", //
- "resource.pluginConfiguration[partition.name].contains" };
+ "resource.pluginConfiguration[partition.name].contains", //
+ "memberof = GroupName" };
String[][] expectedOutput = { { "resource", "child", "name" }, //
{ "resource", "pluginConfiguration[partition]" }, //
{ "resource", "pluginConfiguration[partition]", "contains" }, //
- { "resource", "pluginConfiguration[partition.name]", "contains" } };
+ { "resource", "pluginConfiguration[partition.name]", "contains" }, //
+ { "memberof" } };
ExpressionEvaluator evaluator = new ExpressionEvaluator();
evaluator.setTestMode(true); // to prevent actual query from happening
@@ -274,686 +284,519 @@ public class ExpressionEvaluatorTest extends AbstractEJB3Test {
}
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleResourceTraitExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.trait[agentHomeDirectory] = /var/rhq-agent",
- "resource.trait[reasonForLastRestart] = OOMError"
- };
+ return new String[] { "resource.trait[agentHomeDirectory] = /var/rhq-agent",
+ "resource.trait[reasonForLastRestart] = OOMError" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleChildResourceTraitExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.child.trait[agentHomeDirectory] = /var/rhq-agent",
- "resource.child.trait[reasonForLastRestart] = OOMError"
- };
+ return new String[] { "resource.child.trait[agentHomeDirectory] = /var/rhq-agent",
+ "resource.child.trait[reasonForLastRestart] = OOMError" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleParentResourceTraitExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.parent.trait[agentHomeDirectory] = /var/rhq-agent",
- "resource.parent.trait[reasonForLastRestart] = OOMError"
- };
+ return new String[] { "resource.parent.trait[agentHomeDirectory] = /var/rhq-agent",
+ "resource.parent.trait[reasonForLastRestart] = OOMError" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGrandParentResourceTraitExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.grandParent.trait[agentHomeDirectory] = /var/rhq-agent",
- "resource.grandParent.trait[reasonForLastRestart] = OOMError"
- };
+ return new String[] { "resource.grandParent.trait[agentHomeDirectory] = /var/rhq-agent",
+ "resource.grandParent.trait[reasonForLastRestart] = OOMError" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGrandParentResourceTraitExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.greatGrandParent.trait[agentHomeDirectory] = /var/rhq-agent",
- "resource.greatGrandParent.trait[reasonForLastRestart] = OOMError"
- };
+ return new String[] { "resource.greatGrandParent.trait[agentHomeDirectory] = /var/rhq-agent",
+ "resource.greatGrandParent.trait[reasonForLastRestart] = OOMError" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGreatGrandParentResourceTraitExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.greatGreatGrandParent.trait[agentHomeDirectory] = /var/rhq-agent",
- "resource.greatGreatGrandParent.trait[reasonForLastRestart] = OOMError"
- };
+ return new String[] { "resource.greatGreatGrandParent.trait[agentHomeDirectory] = /var/rhq-agent",
+ "resource.greatGreatGrandParent.trait[reasonForLastRestart] = OOMError" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleResourceIdExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.id = 5",
- "resource.id = 6"
- };
+ return new String[] { "resource.id = 5", "resource.id = 6" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleChildResourceIdExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.child.id = 5",
- "resource.child.id = 6"
- };
+ return new String[] { "resource.child.id = 5", "resource.child.id = 6" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleParentResourceIdExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.parent.id = 5",
- "resource.parent.id = 6"
- };
+ return new String[] { "resource.parent.id = 5", "resource.parent.id = 6" };
}
});
}
- @Test(expectedExceptions = InvalidExpressionException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = InvalidExpressionException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGrandParentResourceIdExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.grandParent.id = 5",
- "resource.grandParent.id = 6"
- };
+ return new String[] { "resource.grandParent.id = 5", "resource.grandParent.id = 6" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGrandParentResourceIdExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.greatGrandParent.id = 5",
- "resource.greatGrandParent.id = 6"
- };
+ return new String[] { "resource.greatGrandParent.id = 5", "resource.greatGrandParent.id = 6" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGreatGrandParentResourceIdExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.greatGreatGrandParent.id = 5",
- "resource.greatGreatGrandParent.id = 6"
- };
+ return new String[] { "resource.greatGreatGrandParent.id = 5", "resource.greatGreatGrandParent.id = 6" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleResourceNameExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.name = foo",
- "resource.name = bar"
- };
+ return new String[] { "resource.name = foo", "resource.name = bar" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleChildResourceNameExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.child.name = foo",
- "resource.child.name = bar"
- };
+ return new String[] { "resource.child.name = foo", "resource.child.name = bar" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleParentResourceNameExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.parent.name = foo",
- "resource.parent.name = bar"
- };
+ return new String[] { "resource.parent.name = foo", "resource.parent.name = bar" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGrandParentResourceNameExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.grandParent.name = foo",
- "resource.grandParent.name = bar"
- };
+ return new String[] { "resource.grandParent.name = foo", "resource.grandParent.name = bar" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGrandParentResourceNameExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.greatGrandParent.name = foo",
- "resource.greatGrandParent.name = bar"
- };
+ return new String[] { "resource.greatGrandParent.name = foo", "resource.greatGrandParent.name = bar" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGreatGrandParentResourceNameExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.greatGreatGrandParent.name = foo",
- "resource.greatGreatGrandParent.name = bar"
- };
+ return new String[] { "resource.greatGreatGrandParent.name = foo",
+ "resource.greatGreatGrandParent.name = bar" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleResourceTypeExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.type.plugin = rhq-agent",
- "resource.type.name = RHQ Agent",
- "resource.type.plugin = rhq-server",
- "resource.type.name = RHQ Server"
- };
+ return new String[] { "resource.type.plugin = rhq-agent", "resource.type.name = RHQ Agent",
+ "resource.type.plugin = rhq-server", "resource.type.name = RHQ Server" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleChildResourceTypeExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.child.type.plugin = rhq-agent",
- "resource.child.type.name = RHQ Agent",
- "resource.child.type.plugin = rhq-server",
- "resource.child.type.name = RHQ Server"
- };
+ return new String[] { "resource.child.type.plugin = rhq-agent", "resource.child.type.name = RHQ Agent",
+ "resource.child.type.plugin = rhq-server", "resource.child.type.name = RHQ Server" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleParentResourceTypeExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.parent.type.plugin = rhq-agent",
- "resource.parent.type.name = RHQ Agent",
- "resource.parent.type.plugin = rhq-server",
- "resource.parent.type.name = RHQ Server"
- };
+ return new String[] { "resource.parent.type.plugin = rhq-agent",
+ "resource.parent.type.name = RHQ Agent", "resource.parent.type.plugin = rhq-server",
+ "resource.parent.type.name = RHQ Server" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGrandParentResourceTypeExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.grandParent.type.plugin = rhq-agent",
- "resource.grandParent.type.name = RHQ Agent",
- "resource.grandParent.type.plugin = rhq-server",
- "resource.grandParent.type.name = RHQ Server"
- };
+ return new String[] { "resource.grandParent.type.plugin = rhq-agent",
+ "resource.grandParent.type.name = RHQ Agent", "resource.grandParent.type.plugin = rhq-server",
+ "resource.grandParent.type.name = RHQ Server" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGrandParentResourceTypeExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.greatGrandParent.type.plugin = rhq-agent",
+ return new String[] { "resource.greatGrandParent.type.plugin = rhq-agent",
"resource.greatGrandParent.type.name = RHQ Agent",
"resource.greatGrandParent.type.plugin = rhq-server",
- "resource.greatGrandParent.type.name = RHQ Server"
- };
+ "resource.greatGrandParent.type.name = RHQ Server" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGreatGrandParentResourceTypeExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.greatGreatGrandParent.type.plugin = rhq-agent",
+ return new String[] { "resource.greatGreatGrandParent.type.plugin = rhq-agent",
"resource.greatGreatGrandParent.type.name = RHQ Agent",
"resource.greatGreatGrandParent.type.plugin = rhq-server",
- "resource.greatGreatGrandParent.type.name = RHQ Server"
- };
+ "resource.greatGreatGrandParent.type.name = RHQ Server" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleResourceCategoryExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.type.category = PLATFORM",
- "resource.type.category = SERVER"
- };
+ return new String[] { "resource.type.category = PLATFORM", "resource.type.category = SERVER" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleChildResourceCategoryExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.child.type.category = PLATFORM",
- "resource.child.type.category = SERVER"
- };
+ return new String[] { "resource.child.type.category = PLATFORM",
+ "resource.child.type.category = SERVER" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleParentResourceCategoryExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.parent.type.category = PLATFORM",
- "resource.parent.type.category = SERVER"
- };
+ return new String[] { "resource.parent.type.category = PLATFORM",
+ "resource.parent.type.category = SERVER" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGrandParentResourceCategoryExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.grandParent.type.category = PLATFORM",
- "resource.grandParent.type.category = SERVER"
- };
+ return new String[] { "resource.grandParent.type.category = PLATFORM",
+ "resource.grandParent.type.category = SERVER" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGrandParentResourceCategoryExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.greatGrandParent.type.category = PLATFORM",
- "resource.greatGrandParent.type.category = SERVER"
- };
+ return new String[] { "resource.greatGrandParent.type.category = PLATFORM",
+ "resource.greatGrandParent.type.category = SERVER" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGreatGrandParentResourceCategoryExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.greatGreatGrandParent.type.category = PLATFORM",
- "resource.greatGreatGrandParent.type.category = SERVER"
- };
+ return new String[] { "resource.greatGreatGrandParent.type.category = PLATFORM",
+ "resource.greatGreatGrandParent.type.category = SERVER" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleResourceAvailabilityExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.availability = UP",
- "resource.availability = UNKNOWN"
- };
+ return new String[] { "resource.availability = UP", "resource.availability = UNKNOWN" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleChildResourceAvailabilityExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.child.availability = UP",
- "resource.child.availability = UNKNOWN"
- };
+ return new String[] { "resource.child.availability = UP", "resource.child.availability = UNKNOWN" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleParentResourceAvailabilityExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.parent.availability = UP",
- "resource.parent.availability = UNKNOWN"
- };
+ return new String[] { "resource.parent.availability = UP", "resource.parent.availability = UNKNOWN" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGrandParentResourceAvailabilityExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.grandParent.availability = UP",
- "resource.grandParent.availability = UNKNOWN"
- };
+ return new String[] { "resource.grandParent.availability = UP",
+ "resource.grandParent.availability = UNKNOWN" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGrandParentResourceAvailabilityExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.greatGrandParent.availability = UP",
- "resource.greatGrandParent.availability = UNKNOWN"
- };
+ return new String[] { "resource.greatGrandParent.availability = UP",
+ "resource.greatGrandParent.availability = UNKNOWN" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGreatGrandParentResourceAvailabilityExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[] {
- "resource.greatGreatGrandParent.availability = UP",
- "resource.greatGreatGrandParent.availability = UNKNOWN"
- };
+ return new String[] { "resource.greatGreatGrandParent.availability = UP",
+ "resource.greatGreatGrandParent.availability = UNKNOWN" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleResourcePluginConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.pluginConfiguration[x] = 1",
- "resource.pluginConfiguration[y] = 2"
- };
+ return new String[] { "resource.pluginConfiguration[x] = 1", "resource.pluginConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleChildResourcePluginConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.child.pluginConfiguration[x] = 1",
- "resource.child.pluginConfiguration[y] = 2"
- };
+ return new String[] { "resource.child.pluginConfiguration[x] = 1",
+ "resource.child.pluginConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleParentResourcePluginConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.parent.pluginConfiguration[x] = 1",
- "resource.parent.pluginConfiguration[y] = 2"
- };
+ return new String[] { "resource.parent.pluginConfiguration[x] = 1",
+ "resource.parent.pluginConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGrandParentResourcePluginConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.grandParent.pluginConfiguration[x] = 1",
- "resource.grandParent.pluginConfiguration[y] = 2"
- };
+ return new String[] { "resource.grandParent.pluginConfiguration[x] = 1",
+ "resource.grandParent.pluginConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGrandParentResourcePluginConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.greatGrandParent.pluginConfiguration[x] = 1",
- "resource.greatGrandParent.pluginConfiguration[y] = 2"
- };
+ return new String[] { "resource.greatGrandParent.pluginConfiguration[x] = 1",
+ "resource.greatGrandParent.pluginConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGreatGrandParentResourcePluginConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.greatGreatGrandParent.pluginConfiguration[x] = 1",
- "resource.greatGreatGrandParent.pluginConfiguration[y] = 2"
- };
+ return new String[] { "resource.greatGreatGrandParent.pluginConfiguration[x] = 1",
+ "resource.greatGreatGrandParent.pluginConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleResourceConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.resourceConfiguration[x] = 1",
- "resource.resourceConfiguration[y] = 2"
- };
+ return new String[] { "resource.resourceConfiguration[x] = 1", "resource.resourceConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleChildResourceConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.child.resourceConfiguration[x] = 1",
- "resource.child.resourceConfiguration[y] = 2"
- };
+ return new String[] { "resource.child.resourceConfiguration[x] = 1",
+ "resource.child.resourceConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleParentResourceConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.parent.resourceConfiguration[x] = 1",
- "resource.parent.resourceConfiguration[y] = 2"
- };
+ return new String[] { "resource.parent.resourceConfiguration[x] = 1",
+ "resource.parent.resourceConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGrandParentResourceConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.grandParent.resourceConfiguration[x] = 1",
- "resource.grandParent.resourceConfiguration[y] = 2"
- };
+ return new String[] { "resource.grandParent.resourceConfiguration[x] = 1",
+ "resource.grandParent.resourceConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGrandParentResourceConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.greatGrandParent.resourceConfiguration[x] = 1",
- "resource.greatGrandParent.resourceConfiguration[y] = 2"
- };
+ return new String[] { "resource.greatGrandParent.resourceConfiguration[x] = 1",
+ "resource.greatGrandParent.resourceConfiguration[y] = 2" };
}
});
}
- @Test(expectedExceptions = DuplicateExpressionTypeException.class,
- expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
+ @Test(expectedExceptions = DuplicateExpressionTypeException.class, expectedExceptionsMessageRegExp = "You cannot specify multiple.*")
public void doNotAllowMultipleGreatGreatGrandParentResourceConfigExpressions() throws Exception {
evaluateExpressions(new ExpressionGenerator() {
@Override
public String[] getExpressions() {
- return new String[]{
- "resource.greatGreatGrandParent.resourceConfiguration[x] = 1",
- "resource.greatGreatGrandParent.resourceConfiguration[y] = 2"
- };
+ return new String[] { "resource.greatGreatGrandParent.resourceConfiguration[x] = 1",
+ "resource.greatGreatGrandParent.resourceConfiguration[y] = 2" };
}
});
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
index 7f42f55..363a663 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/definition/framework/ExpressionEvaluator.java
@@ -50,7 +50,7 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
private final Log log = LogFactory.getLog(ExpressionEvaluator.class);
private static final String INVALID_EXPRESSION_FORM_MSG = "Expression must be in one of the follow forms: " + //
- "'groupBy condition', 'condition = value', 'empty condition', 'not empty condition";
+ "'groupby condition', 'memberof = groupname', 'condition = value', 'empty condition', 'not empty condition";
private static final String PROP_SIMPLE_ALIAS = "simple";
private static final String PROP_SIMPLE_DEF_ALIAS = "simpleDef";
@@ -81,9 +81,11 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
private Map<String, Class<?>> whereReplacementTypes;
private Set<String> whereStatics;
private List<String> groupByElements;
+ private List<String> memberOfElements;
private List<String> simpleSubExpressions;
private List<String> groupedSubExpressions;
+ private List<String> memberSubExpressions;
private int expressionCount;
private boolean isInvalid;
@@ -112,9 +114,11 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
whereReplacementTypes = new HashMap<String, Class<?>>();
whereStatics = new LinkedHashSet<String>();
groupByElements = new ArrayList<String>();
+ memberOfElements = new ArrayList<String>();
simpleSubExpressions = new ArrayList<String>();
groupedSubExpressions = new ArrayList<String>();
+ memberSubExpressions = new ArrayList<String>();
expressionCount = 0;
isInvalid = false;
@@ -143,8 +147,8 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
resourceExpressions.put("res.parentResource.name", "resource name");
resourceExpressions.put("res.parentResource.parentResource.name", "resource name");
resourceExpressions.put("res.parentResource.parentResource.parentResource.name", "resource name");
- resourceExpressions.put("res.parentResource.parentResource.parentResource.parentResource.name",
- "resource name");
+ resourceExpressions
+ .put("res.parentResource.parentResource.parentResource.parentResource.name", "resource name");
resourceExpressions.put("res.version", "resource version");
resourceExpressions.put("child.version", "resource version");
@@ -162,8 +166,8 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
resourceExpressions.put("res.parentResource.resourceType.name", "resource type");
resourceExpressions.put("res.parentResource.parentResource.resourceType.plugin", "resource type");
resourceExpressions.put("res.parentResource.parentResource.resourceType.name", "resource type");
- resourceExpressions.put("res.parentResource.parentResource.parentResource.resourceType.plugin",
- "resource type");
+ resourceExpressions
+ .put("res.parentResource.parentResource.parentResource.resourceType.plugin", "resource type");
resourceExpressions.put("res.parentResource.parentResource.parentResource.resourceType.name", "resource type");
resourceExpressions.put("res.parentResource.parentResource.parentResource.parentResource.resourceType.plugin",
"resource type");
@@ -176,7 +180,8 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
resourceExpressions.put("res.parentResource.parentResource.resourceType.category", "resource category");
resourceExpressions.put("res.parentResource.parentResource.parentResource.resourceType.category",
"resource category");
- resourceExpressions.put("res.parentResource.parentResource.parentResource.parentResource.resourceType.category",
+ resourceExpressions.put(
+ "res.parentResource.parentResource.parentResource.parentResource.resourceType.category",
"resource category");
resourceExpressions.put("avail.availabilityType", "availability");
@@ -185,8 +190,8 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
resourceExpressions.put("res.parentResource.parentResource.avail.availabilityType", "availability");
resourceExpressions.put("res.parentResource.parentResource.parentResource.avail.availabilityType",
"availability");
- resourceExpressions.put("res.parentResource.parentResource.parentResource.parentResource.avail.availabilityType",
- "availability");
+ resourceExpressions.put(
+ "res.parentResource.parentResource.parentResource.parentResource.avail.availabilityType", "availability");
resourceExpressions.put("trait.value", "trait");
resourceExpressions.put("child.trait.value", "trait");
@@ -299,8 +304,9 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
Availability(true), //
Trait(true), //
Configuration(true), // includes 'pluginConfiguration' and 'resourceConfiguration'
- StringMatch(true), //
- END(true);
+ StringMatch(true), //
+ END(true), //
+ Membership(true);
private boolean canTerminateExpression;
@@ -337,6 +343,7 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
private ParseSubContext subcontext = null;
private int parseIndex = 0;
private boolean isGroupBy = false;
+ private boolean isMemberOf = false;
private ComparisonType comparisonType = null;
private Class<?> expressionType;
@@ -418,6 +425,8 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
// do not add modifiers to the normalized expression
if (subExpressionToken.equals("groupby")) {
continue;
+ } else if (subExpressionToken.equals("memberof")) {
+ continue;
} else if (subExpressionToken.equals("not")) {
continue;
} else if (subExpressionToken.equals("empty")) {
@@ -440,6 +449,7 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
subcontext = null;
parseIndex = 0;
isGroupBy = false; // this needs to be reset each time a new expression is added
+ isMemberOf = false; // this needs to be reset each time a new expression is added
comparisonType = ComparisonType.EQUALS; // assume equals, unless "(not) empty" found during the parse
deepestResourceContext = null;
@@ -452,17 +462,34 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
if (nextToken.equals("resource")) {
context = ParseContext.Resource;
deepestResourceContext = context;
+
+ } else if (nextToken.equals("memberof")) {
+ context = ParseContext.Membership; // ensure proper expression termination
+ String groupName = value;
+
+ if (null == groupName || groupName.isEmpty() || "=".equals(groupName)) {
+ throw new InvalidExpressionException(INVALID_EXPRESSION_FORM_MSG);
+ }
+
+ validateSubExpressionAgainstPreviouslySeen(groupName, false, true);
+ isMemberOf = true;
+ populatePredicateCollections(null, groupName);
+
} else if (nextToken.equals("groupby")) {
context = ParseContext.Modifier;
subcontext = ParseSubContext.Pivot;
+
} else if (nextToken.equals("not")) {
+
context = ParseContext.Modifier;
subcontext = ParseSubContext.Negated;
// 'not' must be followed by 'empty' today, but we won't know until next parse iteration
// furthermore, we may support other forms of negated expressions in the future
+
} else if (nextToken.equals("empty")) {
context = ParseContext.Modifier;
subcontext = ParseSubContext.Empty;
+
} else {
throw new InvalidExpressionException(
"Expression must either start with 'resource', 'groupby', 'empty', or 'not empty' tokens");
@@ -488,7 +515,7 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
// then perform individual processing based on current subcontext
if (subcontext == ParseSubContext.Pivot) {
// validates the uniqueness of the subexpression after checking for INVALID_EXPRESSION_FORM_MSG
- validateSubExpressionAgainstPreviouslySeen(normalizedSubExpression, true);
+ validateSubExpressionAgainstPreviouslySeen(normalizedSubExpression, true, false);
isGroupBy = true;
comparisonType = ComparisonType.NONE;
} else if (subcontext == ParseSubContext.NotEmpty) {
@@ -514,7 +541,7 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
// EQUALS filter expressions must HAVE "= <value>" part
throw new InvalidExpressionException(INVALID_EXPRESSION_FORM_MSG);
}
- validateSubExpressionAgainstPreviouslySeen(normalizedSubExpression, false);
+ validateSubExpressionAgainstPreviouslySeen(normalizedSubExpression, false, false);
}
if (nextToken.equals("parent")) {
@@ -578,7 +605,7 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
// (SELECT max(mdt.id.timestamp) FROM MeasurementDataTrait mdt WHERE sched.id = mdt.schedule.id)
String traitName = parseTraitName(originalTokens);
addJoinCondition(JoinCondition.SCHEDULES);
- populatePredicateCollections(METRIC_DEF_ALIAS + ".name", "%" + traitName + "%", false);
+ populatePredicateCollections(METRIC_DEF_ALIAS + ".name", "%" + traitName + "%", false, false);
populatePredicateCollections(TRAIT_ALIAS + ".value", value);
whereStatics.add(TRAIT_ALIAS + ".schedule = " + JoinCondition.SCHEDULES.alias);
whereStatics.add(TRAIT_ALIAS
@@ -616,7 +643,7 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
addJoinCondition(joinCondition);
addJoinCondition(definitionJoinCondition);
- populatePredicateCollections(PROP_SIMPLE_ALIAS + ".name", "%" + propertyName + "%", false);
+ populatePredicateCollections(PROP_SIMPLE_ALIAS + ".name", "%" + propertyName + "%", false, false);
populatePredicateCollections(PROP_SIMPLE_ALIAS + ".stringValue", value);
whereStatics.add(PROP_SIMPLE_ALIAS + ".configuration = " + joinCondition.alias);
@@ -757,13 +784,15 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
* isGroupBy field or the explicitly overriding groupBy 3rd argument
*/
private void populatePredicateCollections(String predicateName, Object value) throws InvalidExpressionException {
- populatePredicateCollections(predicateName, value, isGroupBy);
+ populatePredicateCollections(predicateName, value, isGroupBy, isMemberOf);
}
- private void populatePredicateCollections(String predicateName, Object value, boolean groupBy)
+ private void populatePredicateCollections(String predicateName, Object value, boolean groupBy, boolean memberOf)
throws InvalidExpressionException {
if (groupBy) {
groupByElements.add(predicateName);
+ } else if (memberOf) {
+ memberOfElements.add((String) value); // this is the group name in this situation
} else {
String argumentName = getNextArgumentName();
@@ -1089,6 +1118,11 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
}
}
+ // finally, if we are narrowing by group membership, add the join on implicit groups
+ if (!memberOfElements.isEmpty()) {
+ result += " JOIN res.implicitGroups implicitGroup";
+ }
+
return result;
}
@@ -1152,6 +1186,17 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
}
}
+ // finally, if we are narrowing by group membership, add the implicit groups condition
+ if (!memberOfElements.isEmpty()) {
+ result += " AND implicitGroup.name IN (";
+ String separator = "";
+ for (String groupName : memberOfElements) {
+ result += (separator + "'" + groupName + "'");
+ separator = ", ";
+ }
+ result += ")";
+ }
+
return result;
}
@@ -1206,8 +1251,8 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
return suffix.substring(1, suffix.length() - 1);
}
- private void validateSubExpressionAgainstPreviouslySeen(String normalizedSubExpression, boolean grouped)
- throws InvalidExpressionException {
+ private void validateSubExpressionAgainstPreviouslySeen(String normalizedSubExpression, boolean grouped,
+ boolean membership) throws InvalidExpressionException {
normalizedSubExpression = stripFunctionSuffix(normalizedSubExpression);
if (grouped) {
if (groupedSubExpressions.contains(normalizedSubExpression)) {
@@ -1220,6 +1265,12 @@ public class ExpressionEvaluator implements Iterable<ExpressionEvaluator.Result>
+ "]");
}
groupedSubExpressions.add(normalizedSubExpression);
+
+ } else if (membership) {
+ if (memberSubExpressions.contains(normalizedSubExpression)) {
+ throw new InvalidExpressionException("Redundant 'memberof' expression[" + normalizedSubExpression
+ + "] - these expressions must be unique");
+ }
} else {
if (groupedSubExpressions.contains(normalizedSubExpression)) {
throw new InvalidExpressionException(
commit 9b525e0d1655d0e28ba086604391e5ac07bfc7b7
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Thu Mar 21 15:40:29 2013 -0400
Bug 824010
Have agent store configuration on filesystem instead of Java preferences
Rename the file name property to be more succinct:
Was: org.rhq.core.util.preferences.FilePreferencesFactory.file
Now: rhq.preferences.file
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferencesFactory.java b/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferencesFactory.java
index 69f36da..f28aa46 100644
--- a/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferencesFactory.java
+++ b/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferencesFactory.java
@@ -17,7 +17,7 @@ import org.apache.commons.logging.LogFactory;
* property <tt>-Djava.util.prefs.PreferencesFactory=org.rhq.core.util.preferences.FilePreferencesFactory</tt>.
* <p/>
* The file defaults to ${user.home}/.fileprefs, but may be overridden with the system property
- * <tt>org.rhq.core.util.preferences.FilePreferencesFactory.file</tt>
+ * <tt>rhq.preferences.file</tt>
* <p/>
* Both the system root and user root default to the user.home system property by default.
* <p/>
@@ -30,7 +30,7 @@ import org.apache.commons.logging.LogFactory;
public class FilePreferencesFactory implements PreferencesFactory {
private static final Log log = LogFactory.getLog(FilePreferencesFactory.class);
- public static final String SYSTEM_PROPERTY_FILE = "org.rhq.core.util.preferences.FilePreferencesFactory.file";
+ public static final String SYSTEM_PROPERTY_FILE = "rhq.preferences.file";
private static File preferencesFile;
commit 3c08e936a3b3af65189e839d66c399a8ad9b835c
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Mar 20 14:31:16 2013 -0400
Bug 824010
Have agent store configuration on filesystem instead of Java preferences
Adds a file-based implementation of java Preferences that allows us to
override the native java impl and store prefs in a user-configured file.
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferences.java b/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferences.java
new file mode 100644
index 0000000..f542329
--- /dev/null
+++ b/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferences.java
@@ -0,0 +1,203 @@
+/*
+ * Adapted from http://www.davidc.net/programming/java/java-preferences-using-file-backin...
+ *
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+package org.rhq.core.util.preferences;
+
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.util.ArrayList;
+import java.util.Enumeration;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.TreeMap;
+import java.util.prefs.AbstractPreferences;
+import java.util.prefs.BackingStoreException;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * Preferences implementation that stores to a single user-defined file. See FilePreferencesFactory.
+ *
+ * @author David Croft (<a href="http://www.davidc.net">www.davidc.net</a>)
+ * @author Jay Shaughnessy (adapted from David Croft for RHQ)
+ */
+public class FilePreferences extends AbstractPreferences {
+ private final Log log = LogFactory.getLog(FilePreferences.class);
+
+ private Map<String, String> root;
+ private Map<String, FilePreferences> children;
+ private boolean isRemoved = false;
+
+ public FilePreferences(AbstractPreferences parent, String name) {
+ super(parent, name);
+
+ if (log.isDebugEnabled()) {
+ log.debug("Instantiating node " + name);
+ }
+
+ root = new TreeMap<String, String>();
+ children = new TreeMap<String, FilePreferences>();
+
+ try {
+ sync();
+
+ } catch (BackingStoreException e) {
+ log.error("Unable to sync on creation of node " + name, e);
+ }
+ }
+
+ protected void putSpi(String key, String value) {
+ root.put(key, value);
+
+ try {
+ flush();
+
+ } catch (BackingStoreException e) {
+ log.error("Unable to flush after putting " + key, e);
+ }
+ }
+
+ protected String getSpi(String key) {
+ String val = root.get(key);
+ return val;
+ }
+
+ protected void removeSpi(String key) {
+ root.remove(key);
+
+ try {
+ flush();
+ } catch (BackingStoreException e) {
+ log.error("Unable to flush after removing " + key, e);
+ }
+ }
+
+ protected void removeNodeSpi() throws BackingStoreException {
+ isRemoved = true;
+ flush();
+ }
+
+ protected String[] keysSpi() throws BackingStoreException {
+ return root.keySet().toArray(new String[root.keySet().size()]);
+ }
+
+ protected String[] childrenNamesSpi() throws BackingStoreException {
+ return children.keySet().toArray(new String[children.keySet().size()]);
+ }
+
+ protected FilePreferences childSpi(String name) {
+ FilePreferences child = children.get(name);
+ if (null == child || child.isRemoved()) {
+ child = new FilePreferences(this, name);
+ children.put(name, child);
+ }
+ return child;
+ }
+
+ protected void syncSpi() throws BackingStoreException {
+ if (isRemoved()) {
+ return;
+ }
+
+ final File file = FilePreferencesFactory.getPreferencesFile();
+
+ if (!file.exists()) {
+ return;
+ }
+
+ synchronized (file) {
+ Properties p = new Properties();
+ try {
+ p.load(new FileInputStream(file));
+
+ StringBuilder sb = new StringBuilder();
+ getPath(sb);
+ String path = sb.toString();
+
+ final Enumeration<?> pnen = p.propertyNames();
+ while (pnen.hasMoreElements()) {
+ String propKey = (String) pnen.nextElement();
+ if (propKey.startsWith(path)) {
+ String subKey = propKey.substring(path.length());
+ // Only load immediate descendants
+ if (subKey.indexOf('/') == -1) {
+ root.put(subKey, p.getProperty(propKey));
+ }
+ }
+ }
+ } catch (IOException e) {
+ throw new BackingStoreException(e);
+ }
+ }
+ }
+
+ private void getPath(StringBuilder sb) {
+ FilePreferences parent = null;
+ try {
+ parent = (FilePreferences) parent();
+ } catch (IllegalStateException e) {
+ // expected when Node has been removed
+ }
+ if (null == parent) {
+ return;
+ }
+
+ parent.getPath(sb);
+ sb.append(name()).append('/');
+ }
+
+ protected void flushSpi() throws BackingStoreException {
+ final File file = FilePreferencesFactory.getPreferencesFile();
+
+ synchronized (file) {
+ Properties p = new Properties();
+ try {
+
+ StringBuilder sb = new StringBuilder();
+ getPath(sb);
+ String path = sb.toString();
+
+ if (file.exists()) {
+ p.load(new FileInputStream(file));
+
+ List<String> toRemove = new ArrayList<String>();
+
+ // Make a list of all direct children of this node to be removed
+ final Enumeration<?> pnen = p.propertyNames();
+ while (pnen.hasMoreElements()) {
+ String propKey = (String) pnen.nextElement();
+ if (propKey.startsWith(path)) {
+ String subKey = propKey.substring(path.length());
+ // Only do immediate descendants
+ if (subKey.indexOf('/') == -1) {
+ toRemove.add(propKey);
+ }
+ }
+ }
+
+ // Remove them now that the enumeration is done with
+ for (String propKey : toRemove) {
+ p.remove(propKey);
+ }
+ }
+
+ // If this node hasn't been removed, add back in any values
+ if (!isRemoved) {
+ for (String s : root.keySet()) {
+ p.setProperty(path + s, root.get(s));
+ }
+ }
+
+ p.store(new FileOutputStream(file), "FilePreferences");
+ } catch (IOException e) {
+ throw new BackingStoreException(e);
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferencesFactory.java b/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferencesFactory.java
new file mode 100644
index 0000000..69f36da
--- /dev/null
+++ b/modules/core/util/src/main/java/org/rhq/core/util/preferences/FilePreferencesFactory.java
@@ -0,0 +1,71 @@
+/*
+ * Adapted from http://www.davidc.net/programming/java/java-preferences-using-file-backin...
+ *
+ * http://creativecommons.org/publicdomain/zero/1.0/
+ */
+package org.rhq.core.util.preferences;
+
+import java.io.File;
+import java.util.prefs.Preferences;
+import java.util.prefs.PreferencesFactory;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+/**
+ * PreferencesFactory implementation that stores the preferences in a single user-defined file. To use it, set the system
+ * property <tt>-Djava.util.prefs.PreferencesFactory=org.rhq.core.util.preferences.FilePreferencesFactory</tt>.
+ * <p/>
+ * The file defaults to ${user.home}/.fileprefs, but may be overridden with the system property
+ * <tt>org.rhq.core.util.preferences.FilePreferencesFactory.file</tt>
+ * <p/>
+ * Both the system root and user root default to the user.home system property by default.
+ * <p/>
+ * NOTE: This implementation does not allow a '/' character in the preference property names (although it's fine in
+ * the values).
+ *
+ * @author David Croft (<a href="http://www.davidc.net">www.davidc.net</a>)
+ * @author Jay Shaughnessy (adapted from David Croft for RHQ)
+ */
+public class FilePreferencesFactory implements PreferencesFactory {
+ private static final Log log = LogFactory.getLog(FilePreferencesFactory.class);
+
+ public static final String SYSTEM_PROPERTY_FILE = "org.rhq.core.util.preferences.FilePreferencesFactory.file";
+
+ private static File preferencesFile;
+
+ Preferences rootPreferences;
+
+ @Override
+ public Preferences systemRoot() {
+ return userRoot();
+ }
+
+ @Override
+ public Preferences userRoot() {
+ if (null == rootPreferences) {
+ log.debug("Instantiating root preferences");
+
+ rootPreferences = new FilePreferences(null, "");
+ }
+ return rootPreferences;
+ }
+
+ public static File getPreferencesFile() {
+ if (null == preferencesFile) {
+ String prefsFile = System.getProperty(SYSTEM_PROPERTY_FILE);
+
+ if (null == prefsFile || prefsFile.isEmpty()) {
+ prefsFile = System.getProperty("user.home") + File.separator + ".fileprefs";
+ }
+
+ preferencesFile = new File(prefsFile).getAbsoluteFile();
+
+ if (log.isDebugEnabled()) {
+ log.debug("Preferences file is " + preferencesFile);
+ }
+ }
+
+ return preferencesFile;
+ }
+}
\ No newline at end of file
commit 3614c3aec39af988a2d8e715cfcfee7cf8ee8a05
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Wed Mar 20 18:18:16 2013 +0100
Add itest for AlertDefinitionManagerBeanTest
Side-work: remove unused debugging var and try block from SavedSearchResultCountRecalculationJobTest
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBeanTest.java
new file mode 100644
index 0000000..09c3cc7
--- /dev/null
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/alert/AlertDefinitionManagerBeanTest.java
@@ -0,0 +1,273 @@
+/*
+ * 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.enterprise.server.alert;
+
+import java.util.LinkedList;
+import java.util.List;
+
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.alert.AlertDampening;
+import org.rhq.core.domain.alert.AlertDefinition;
+import org.rhq.core.domain.alert.AlertPriority;
+import org.rhq.core.domain.alert.BooleanExpression;
+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.resource.Resource;
+import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.collection.ArrayUtils;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.authz.RoleManagerLocal;
+import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
+import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.test.TransactionCallback;
+import org.rhq.enterprise.server.test.TransactionCallbackReturnable;
+import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.util.ResourceTreeHelper;
+import org.rhq.enterprise.server.util.SessionTestHelper;
+
+/**
+ * @author Thomas Segismont
+ */
+public class AlertDefinitionManagerBeanTest extends AbstractEJB3Test {
+
+ private AlertDefinitionManagerLocal alertDefinitionManager;
+
+ private ResourceGroupManagerLocal resourceGroupManager;
+
+ private RoleManagerLocal roleManager;
+
+ private SubjectManagerLocal subjectManager;
+
+ private TestData testData;
+
+ @Override
+ protected void beforeMethod() throws Exception {
+ alertDefinitionManager = LookupUtil.getAlertDefinitionManager();
+ subjectManager = LookupUtil.getSubjectManager();
+ resourceGroupManager = LookupUtil.getResourceGroupManager();
+ roleManager = LookupUtil.getRoleManager();
+ createTestData();
+ prepareScheduler();
+ }
+
+ private void createTestData() {
+ testData = executeInTransaction(false, new TransactionCallbackReturnable<TestData>() {
+ @Override
+ public TestData execute() throws Exception {
+ TestData newTestData = new TestData();
+ Subject subject = SessionTestHelper.createNewSubject(em, "fake subject");
+ newTestData.setSubject(subject);
+ Role role = SessionTestHelper.createNewRoleForSubject(em, subject, "fake role",
+ Permission.MANAGE_ALERTS);
+ newTestData.setRole(role);
+ ResourceType resourceType = SessionTestHelper.createNewResourceType(em);
+ newTestData.setResourceType(resourceType);
+ ResourceGroup resourceGroup = new ResourceGroup("fake group", resourceType);
+ resourceGroup = resourceGroupManager.createPrivateResourceGroup(subject, resourceGroup);
+ newTestData.setResourceGroup(resourceGroup);
+ roleManager.setAssignedResourceGroups(subjectManager.getOverlord(), role.getId(),
+ new int[] { resourceGroup.getId() });
+ Resource resource = SessionTestHelper.createNewResourceForGroup(em, resourceGroup, "fake resource");
+ newTestData.setResource(resource);
+ return newTestData;
+ }
+ });
+ }
+
+ @Override
+ protected void afterMethod() throws Exception {
+ try {
+ deleteTestData();
+ } finally {
+ unprepareScheduler();
+ }
+ }
+
+ private void deleteTestData() throws Exception {
+ if (testData != null) {
+ final TestData testDataToDelete = testData;
+ testData = null;
+ executeInTransaction(false, new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ for (Integer alertDefinitionId : testDataToDelete.getAlertDefinitionIds()) {
+ em.remove(em.find(AlertDefinition.class, alertDefinitionId));
+ }
+ resourceGroupManager.deleteResourceGroup(subjectManager.getOverlord(), testDataToDelete
+ .getResourceGroup().getId());
+ ResourceTreeHelper.deleteResource(em,
+ em.find(Resource.class, testDataToDelete.getResource().getId()));
+ em.remove(em.find(ResourceType.class, testDataToDelete.getResourceType().getId()));
+ subjectManager.deleteSubjects(subjectManager.getOverlord(), new int[] { testDataToDelete
+ .getSubject().getId() });
+ roleManager.deleteRoles(subjectManager.getOverlord(), new int[] { testDataToDelete.getRole()
+ .getId() });
+
+ }
+ });
+ }
+ }
+
+ @Test
+ public void testEnableAlertDefinitions() {
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ List<Integer> alertDefinitionIds = new LinkedList<Integer>();
+ for (int i = 0; i < 50; i++) {
+ alertDefinitionIds.add(createAlertDefinitionAndGetId("fake alertdef-" + String.valueOf(i), false));
+ }
+ List<Integer> alertDefinitionToEnableIds = alertDefinitionIds.subList(12, 37);
+ int enabledCount = alertDefinitionManager.enableAlertDefinitions(testData.getSubject(),
+ ArrayUtils.unwrapCollection(alertDefinitionToEnableIds));
+ assertEquals(alertDefinitionToEnableIds.size(), enabledCount);
+ }
+ });
+ }
+
+ @Test
+ public void testDisableAlertDefinitions() {
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ List<Integer> alertDefinitionIds = new LinkedList<Integer>();
+ for (int i = 0; i < 50; i++) {
+ alertDefinitionIds.add(createAlertDefinitionAndGetId("fake alertdef-" + String.valueOf(i), true));
+ }
+ List<Integer> alertDefinitionToDisableIds = alertDefinitionIds.subList(17, 48);
+ int disabledCount = alertDefinitionManager.disableAlertDefinitions(testData.getSubject(),
+ ArrayUtils.unwrapCollection(alertDefinitionToDisableIds));
+ assertEquals(alertDefinitionToDisableIds.size(), disabledCount);
+ }
+ });
+ }
+
+ @Test
+ public void testIsResourceOrGroupAlertDefinition() {
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ int resourceAlertDefinitionId = createAlertDefinitionAndGetId("fake resource alertdef", true);
+ int groupAlertDefinitionId = createGroupAlertDefinitionAndGetId("fake group alertdef");
+ assertTrue("Failed to detect a group alert definition",
+ alertDefinitionManager.isGroupAlertDefinition(groupAlertDefinitionId));
+ assertFalse("Should not have detected a group alert definition",
+ alertDefinitionManager.isGroupAlertDefinition(resourceAlertDefinitionId));
+ assertTrue("Failed to detect a resource alert definition",
+ alertDefinitionManager.isResourceAlertDefinition(resourceAlertDefinitionId));
+ assertFalse("Should not have detected a resource alert definition",
+ alertDefinitionManager.isResourceAlertDefinition(groupAlertDefinitionId));
+ }
+ });
+ }
+
+ private int createAlertDefinitionAndGetId(String name, boolean enabled) {
+ AlertDefinition alertDefinition = new AlertDefinition();
+ alertDefinition.setName(name);
+ alertDefinition.setPriority(AlertPriority.MEDIUM);
+ alertDefinition.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
+ alertDefinition.setConditionExpression(BooleanExpression.ANY);
+ alertDefinition.setRecoveryId(0);
+ alertDefinition.setEnabled(enabled);
+ int alertDefinitionId = alertDefinitionManager.createAlertDefinition(testData.getSubject(), alertDefinition,
+ testData.getResource().getId(), true);
+ testData.getAlertDefinitionIds().add(alertDefinitionId);
+ return alertDefinitionId;
+ }
+
+ private int createGroupAlertDefinitionAndGetId(String name) {
+ AlertDefinition alertDefinition = new AlertDefinition();
+ alertDefinition.setName(name);
+ alertDefinition.setPriority(AlertPriority.MEDIUM);
+ alertDefinition.setAlertDampening(new AlertDampening(AlertDampening.Category.NONE));
+ alertDefinition.setConditionExpression(BooleanExpression.ANY);
+ alertDefinition.setRecoveryId(0);
+ alertDefinition.setResourceGroup(testData.getResourceGroup());
+ alertDefinition.setEnabled(true);
+ int alertDefinitionId = alertDefinitionManager.createAlertDefinition(testData.getSubject(), alertDefinition,
+ null, true);
+ testData.getAlertDefinitionIds().add(alertDefinitionId);
+ return alertDefinitionId;
+ }
+
+ private static final class TestData {
+
+ private Subject subject;
+
+ private Role role;
+
+ private ResourceType resourceType;
+
+ private ResourceGroup resourceGroup;
+
+ private Resource resource;
+
+ private List<Integer> alertDefinitionIds = new LinkedList<Integer>();
+
+ public Subject getSubject() {
+ return subject;
+ }
+
+ public void setSubject(Subject subject) {
+ this.subject = subject;
+ }
+
+ public Role getRole() {
+ return role;
+ }
+
+ public void setRole(Role role) {
+ this.role = role;
+ }
+
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ public void setResourceType(ResourceType resourceType) {
+ this.resourceType = resourceType;
+ }
+
+ public ResourceGroup getResourceGroup() {
+ return resourceGroup;
+ }
+
+ public void setResourceGroup(ResourceGroup resourceGroup) {
+ this.resourceGroup = resourceGroup;
+ }
+
+ public Resource getResource() {
+ return resource;
+ }
+
+ public void setResource(Resource resource) {
+ this.resource = resource;
+ }
+
+ public List<Integer> getAlertDefinitionIds() {
+ return alertDefinitionIds;
+ }
+ }
+
+}
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/scheduler/jobs/SavedSearchResultCountRecalculationJobTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/scheduler/jobs/SavedSearchResultCountRecalculationJobTest.java
index 6f4e263..1441560 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/scheduler/jobs/SavedSearchResultCountRecalculationJobTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/scheduler/jobs/SavedSearchResultCountRecalculationJobTest.java
@@ -71,18 +71,13 @@ public class SavedSearchResultCountRecalculationJobTest extends AbstractEJB3Test
@Override
protected void beforeMethod() throws Exception {
- int i = 0;
- try {
- savedSearchManager = LookupUtil.getSavedSearchManager();
- subjectManager = LookupUtil.getSubjectManager();
- roleManager = LookupUtil.getRoleManager();
- resourceGroupManager = LookupUtil.getResourceGroupManager();
- scheduler = LookupUtil.getSchedulerBean();
- createTestData();
- prepareScheduler();
- } catch (Throwable t) {
- t.printStackTrace();
- }
+ savedSearchManager = LookupUtil.getSavedSearchManager();
+ subjectManager = LookupUtil.getSubjectManager();
+ roleManager = LookupUtil.getRoleManager();
+ resourceGroupManager = LookupUtil.getResourceGroupManager();
+ scheduler = LookupUtil.getSchedulerBean();
+ createTestData();
+ prepareScheduler();
}
private void createTestData() {
@@ -141,9 +136,9 @@ public class SavedSearchResultCountRecalculationJobTest extends AbstractEJB3Test
resourceGroupManager.deleteResourceGroup(subjectManager.getOverlord(), resourceGroup.getId());
}
for (Resource resource : testDataToDelete.getResources()) {
- ResourceTreeHelper.deleteResource(em, em.getReference(Resource.class, resource.getId()));
+ ResourceTreeHelper.deleteResource(em, em.find(Resource.class, resource.getId()));
}
- em.remove(em.getReference(ResourceType.class, testDataToDelete.getResourceType().getId()));
+ em.remove(em.find(ResourceType.class, testDataToDelete.getResourceType().getId()));
subjectManager.deleteSubjects(subjectManager.getOverlord(), new int[] { testDataToDelete
.getSearchesOwner().getId() });
roleManager.deleteRoles(subjectManager.getOverlord(), new int[] { testDataToDelete
commit 6a32fb992f985ab2dd4baef8ae3f260e0a65bb52
Author: mtho11 <mikecthompson(a)gmail.com>
Date: Tue Mar 19 14:20:12 2013 -0700
Charting - Move last remaining SVG properties out out JSNI and into charts.css.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
index 7c9aa4f..35f2932 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
@@ -147,16 +147,14 @@ public final class MetricStackedBarGraph extends AbstractGraph {
function createMinAvgPeakSidePanel( minLabel, minValue, avgLabel, avgValue, highLabel, highValue, uom ){
- var fontSize = 12,
- fgColor = "#003168",
- xLabel = 772,
+ var xLabel = 772,
xValue = 820,
yBase = 100,
yInc = 25,
- decimalPlaces = 0,
+ decimalPlaces = 0;
// title/header
- sidebar = chart.append("g").append("rect")
+ chart.append("g").append("rect")
.attr("class", "rightSidePanel")
.attr("x", xLabel -10)
.attr("y", margin.top + 60)
@@ -170,20 +168,13 @@ public final class MetricStackedBarGraph extends AbstractGraph {
.attr("class", "highLabel")
.attr("x", xLabel)
.attr("y", yBase)
- .attr("font-size", fontSize)
- .attr("font-weight", "bold")
- .attr("text-anchor", "left")
- .text(highLabel + " - ")
- .attr("fill", fgColor);
+ .text(highLabel + " - ");
chart.append("text")
.attr("class", "highText")
.attr("x", xValue)
.attr("y", yBase)
- .attr("font-size", fontSize)
- .attr("text-anchor", "left")
- .text(highValue.toFixed(decimalPlaces) + " "+ uom)
- .attr("fill", fgColor);
+ .text(highValue.toFixed(decimalPlaces) + " "+ uom);
//avg
@@ -191,20 +182,13 @@ public final class MetricStackedBarGraph extends AbstractGraph {
.attr("class", "avgLabel")
.attr("x", xLabel)
.attr("y", yBase + yInc)
- .attr("font-size", fontSize)
- .attr("font-weight", "bold")
- .attr("text-anchor", "left")
- .text(avgLabel + " - ")
- .attr("fill", fgColor);
+ .text(avgLabel + " - ");
chart.append("text")
.attr("class", "avgText")
.attr("x", xValue)
.attr("y", yBase + yInc)
- .attr("font-size", fontSize)
- .attr("text-anchor", "left")
- .text(avgValue.toFixed(decimalPlaces) + " "+uom)
- .attr("fill", fgColor);
+ .text(avgValue.toFixed(decimalPlaces) + " "+uom);
@@ -213,20 +197,13 @@ public final class MetricStackedBarGraph extends AbstractGraph {
.attr("class", "minLabel")
.attr("x", xLabel)
.attr("y", yBase + 2 * yInc)
- .attr("font-size", fontSize)
- .attr("font-weight", "bold")
- .attr("text-anchor", "left")
- .text(minLabel + " - ")
- .attr("fill", fgColor);
+ .text(minLabel + " - ");
chart.append("text")
.attr("class", "minText")
.attr("x", xValue)
.attr("y", yBase + 2 * yInc)
- .attr("font-size", fontSize)
- .attr("text-anchor", "left")
- .text(minValue.toFixed(decimalPlaces)+ " "+uom)
- .attr("fill", fgColor);
+ .text(minValue.toFixed(decimalPlaces)+ " "+uom);
}
@@ -323,8 +300,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
.attr("data-rhq-value", function(d){
return d.y;
})
- .attr("opacity", 0.9)
- .attr("fill", "#1794bc");
+ .attr("opacity", 0.9);
// lower portion representing avg to low
@@ -349,8 +325,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
.attr("width", function () {
return (width / chartContext.data.length - barOffset );
})
- .attr("opacity", 0.9)
- .attr("fill", "#70c4e2");
+ .attr("opacity", 0.9);
// if high == low put a "cap" on the bar to show non-aggregated bar
svg.selectAll("rect.singleValue")
@@ -375,7 +350,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
}
}
})
- .attr("width", function (d) {
+ .attr("width", function () {
return (width / chartContext.data.length - barOffset );
})
.attr("opacity", 0.9)
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/css/charts.css b/modules/enterprise/gui/coregui/src/main/webapp/css/charts.css
index 15910cf..750c117 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/css/charts.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/css/charts.css
@@ -47,12 +47,19 @@
.minLabel, .avgLabel, .highLabel {
font-family: Arial, Verdana, sans-serif;
font-size: 12px;
- font-weight: bold;
+ text-anchor: start;
+ stroke: #003168;
+ fill: #003168;
+ text-rendering: optimize-legibility;
}
.minText, .avgText, .highText {
font-family: Arial, Verdana, sans-serif;
font-size: 12px;
+ text-anchor: start;
+ stroke: #003168;
+ fill: #003168;
+ text-rendering: optimize-legibility;
}
.titleName {
@@ -61,6 +68,14 @@
font-weight: bold;
}
+rect.high {
+ fill: #1794bc;
+}
+
+rect.low {
+ fill: #70c4e2;
+}
+
/**
* CSS for html chart hovers.
*/
commit 33d2b666e4eda392dddfbbe071bcd24eacdb9f08
Author: mtho11 <mikecthompson(a)gmail.com>
Date: Tue Mar 19 13:20:31 2013 -0700
Charting - Make chart fonts more legible. Add svg text-rendering setting and change fonts to cleaner font.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
index d6d1152..7c9aa4f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
@@ -42,7 +42,6 @@ public final class MetricStackedBarGraph extends AbstractGraph {
console.log("Draw Stacked Bar jsni chart");
var global = this,
- fontFamily = "'Liberation Sans', Arial, Helvetica, sans-serif",
// create a chartContext object (from rhq.js) with the data required to render to a chart
// this same data could be passed to different chart types
@@ -284,7 +283,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
return height - yScale(d.low) - pixelsOffHeight;
}
})
- .attr("width", function (d) {
+ .attr("width", function () {
return (width / chartContext.data.length - barOffset );
})
@@ -318,7 +317,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
return yScale(d.y) - yScale(d.high);
}
})
- .attr("width", function (d) {
+ .attr("width", function () {
return (width / chartContext.data.length - barOffset );
})
.attr("data-rhq-value", function(d){
@@ -347,7 +346,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
return yScale(d.low) - yScale(d.y);
}
})
- .attr("width", function (d) {
+ .attr("width", function () {
return (width / chartContext.data.length - barOffset );
})
.attr("opacity", 0.9)
@@ -408,8 +407,6 @@ public final class MetricStackedBarGraph extends AbstractGraph {
svg.append("g")
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
- .attr("font-size", "10px")
- .attr("font-family", fontFamily)
.attr("letter-spacing", "3")
.style("text-anchor", "end")
.call(xAxis);
@@ -422,8 +419,6 @@ public final class MetricStackedBarGraph extends AbstractGraph {
.append("text")
.attr("transform", "rotate(-90),translate( -60,0)")
.attr("y", -30)
- .attr("font-size", "10px")
- .attr("font-family", fontFamily )
.attr("letter-spacing", "3")
.style("text-anchor", "end")
.text(chartContext.yAxisUnits === "NONE" ? "" : chartContext.yAxisUnits);
@@ -442,7 +437,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
.x(function (d) {
return timeScale(d.x)+ ((width / chartContext.data.length - barOffset)/ 2);
})
- .y(function (d,i) {
+ .y(function (d) {
if(showBarAvgTrendline){
return yScale(d.y);
}else {
diff --git a/modules/enterprise/gui/coregui/src/main/webapp/css/charts.css b/modules/enterprise/gui/coregui/src/main/webapp/css/charts.css
index 83f37f9..15910cf 100644
--- a/modules/enterprise/gui/coregui/src/main/webapp/css/charts.css
+++ b/modules/enterprise/gui/coregui/src/main/webapp/css/charts.css
@@ -27,11 +27,12 @@
}
.y.axis text, .x.axis text {
- font-family: Arial, Verdana, sans-serif;
+ font-family: 'Liberation Sans', Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: normal;
font-style: normal;
stroke: #50505a;
+ text-rendering: optimize-legibility;
}
commit 01283fb441b64e0be58f60d35312b8fe5d44a1ad
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Tue Mar 19 15:23:41 2013 +0100
itest for SavedSearchResultCountRecalculationJob
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/scheduler/jobs/SavedSearchResultCountRecalculationJobTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/scheduler/jobs/SavedSearchResultCountRecalculationJobTest.java
new file mode 100644
index 0000000..6f4e263
--- /dev/null
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/scheduler/jobs/SavedSearchResultCountRecalculationJobTest.java
@@ -0,0 +1,261 @@
+/*
+ * 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.enterprise.server.scheduler.jobs;
+
+import java.util.HashSet;
+import java.util.Set;
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import org.quartz.JobDetail;
+import org.quartz.JobExecutionContext;
+import org.quartz.JobExecutionException;
+import org.quartz.JobListener;
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.criteria.SavedSearchCriteria;
+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.search.SavedSearch;
+import org.rhq.core.domain.search.SearchSubsystem;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.authz.RoleManagerLocal;
+import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
+import org.rhq.enterprise.server.scheduler.SchedulerLocal;
+import org.rhq.enterprise.server.search.SavedSearchManagerLocal;
+import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.test.TransactionCallback;
+import org.rhq.enterprise.server.test.TransactionCallbackReturnable;
+import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.util.ResourceTreeHelper;
+import org.rhq.enterprise.server.util.SessionTestHelper;
+
+/**
+ * @author Thomas Segismont
+ */
+public class SavedSearchResultCountRecalculationJobTest extends AbstractEJB3Test {
+
+ private SavedSearchManagerLocal savedSearchManager;
+
+ private SubjectManagerLocal subjectManager;
+
+ private RoleManagerLocal roleManager;
+
+ private ResourceGroupManagerLocal resourceGroupManager;
+
+ private SchedulerLocal scheduler;
+
+ private TestData testData;
+
+ @Override
+ protected void beforeMethod() throws Exception {
+ int i = 0;
+ try {
+ savedSearchManager = LookupUtil.getSavedSearchManager();
+ subjectManager = LookupUtil.getSubjectManager();
+ roleManager = LookupUtil.getRoleManager();
+ resourceGroupManager = LookupUtil.getResourceGroupManager();
+ scheduler = LookupUtil.getSchedulerBean();
+ createTestData();
+ prepareScheduler();
+ } catch (Throwable t) {
+ t.printStackTrace();
+ }
+ }
+
+ private void createTestData() {
+ testData = executeInTransaction(false, new TransactionCallbackReturnable<TestData>() {
+ @Override
+ public TestData execute() throws Exception {
+ Subject searchesOwner = SessionTestHelper.createNewSubject(em, "fake subject");
+ Role searchesOwnerRole = SessionTestHelper.createNewRoleForSubject(em, searchesOwner, "fake role");
+ ResourceType resourceType = SessionTestHelper.createNewResourceType(em);
+ Set<Resource> resources = new HashSet<Resource>();
+ Set<ResourceGroup> resourceGroups = new HashSet<ResourceGroup>();
+ Set<SavedSearch> savedSearches = new HashSet<SavedSearch>();
+ for (int i = 0; i < 50; i++) {
+ String iStr = i > 9 ? String.valueOf(i) : "0" + String.valueOf(i);
+ if (i < 25) {
+ resources.add(SessionTestHelper.createNewResource(em, "resource-" + iStr, resourceType));
+ SavedSearch savedSearch = new SavedSearch(SearchSubsystem.RESOURCE, "search-" + iStr,
+ "resource-" + iStr, searchesOwner);
+ savedSearchManager.createSavedSearch(searchesOwner, savedSearch);
+ savedSearches.add(savedSearch);
+ } else {
+ resourceGroups.add(SessionTestHelper.createNewCompatibleGroupForRole(em, searchesOwnerRole,
+ "group-" + iStr, resourceType));
+ SavedSearch savedSearch = new SavedSearch(SearchSubsystem.GROUP, "search-" + iStr, "group-"
+ + iStr, searchesOwner);
+ savedSearchManager.createSavedSearch(searchesOwner, savedSearch);
+ savedSearches.add(savedSearch);
+ }
+ }
+ return new TestData(searchesOwner, searchesOwnerRole, resourceType, resources, resourceGroups,
+ savedSearches);
+ }
+ });
+ }
+
+ @Override
+ protected void afterMethod() throws Exception {
+ try {
+ deleteTestData();
+ } finally {
+ unprepareScheduler();
+ }
+ }
+
+ private void deleteTestData() {
+ if (testData != null) {
+ final TestData testDataToDelete = testData;
+ testData = null;
+ executeInTransaction(false, new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ for (SavedSearch savedSearch : testDataToDelete.getSavedSearches()) {
+ savedSearchManager.deleteSavedSearch(savedSearch.getSubject(), savedSearch.getId());
+ }
+ for (ResourceGroup resourceGroup : testDataToDelete.getResourceGroups()) {
+ resourceGroupManager.deleteResourceGroup(subjectManager.getOverlord(), resourceGroup.getId());
+ }
+ for (Resource resource : testDataToDelete.getResources()) {
+ ResourceTreeHelper.deleteResource(em, em.getReference(Resource.class, resource.getId()));
+ }
+ em.remove(em.getReference(ResourceType.class, testDataToDelete.getResourceType().getId()));
+ subjectManager.deleteSubjects(subjectManager.getOverlord(), new int[] { testDataToDelete
+ .getSearchesOwner().getId() });
+ roleManager.deleteRoles(subjectManager.getOverlord(), new int[] { testDataToDelete
+ .getSearchesOwnerRole().getId() });
+ }
+ });
+
+ }
+ }
+
+ @Test
+ public void testSavedSearchResultCountRecalculation() throws Exception {
+ runJobSynchronously();
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ SavedSearchCriteria criteria = new SavedSearchCriteria();
+ criteria.clearPaging();
+ criteria.addFilterSubjectId(testData.getSearchesOwner().getId());
+ PageList<SavedSearch> foundSavedSearches = savedSearchManager.findSavedSearchesByCriteria(
+ testData.getSearchesOwner(), criteria);
+ assertEquals(testData.getSavedSearches().size(), foundSavedSearches.size());
+ for (SavedSearch savedSearch : foundSavedSearches) {
+ assertTrue(savedSearch.toString() + " should have been computed",
+ savedSearch.getLastComputeTime() > 0);
+ assertEquals(Long.valueOf(1), savedSearch.getResultCount());
+ }
+ }
+ });
+ }
+
+ private void runJobSynchronously() throws Exception {
+ final CountDownLatch countDownLatch = new CountDownLatch(1);
+ final String jobName = SavedSearchResultCountRecalculationJob.class.getSimpleName();
+ final String jobGroup = SavedSearchResultCountRecalculationJobTest.class.getSimpleName();
+ scheduler.addGlobalJobListener(new JobListener() {
+ @Override
+ public String getName() {
+ return SavedSearchResultCountRecalculationJobTest.class.getSimpleName();
+ }
+
+ @Override
+ public void jobToBeExecuted(JobExecutionContext context) {
+ }
+
+ @Override
+ public void jobExecutionVetoed(JobExecutionContext context) {
+ }
+
+ @Override
+ public void jobWasExecuted(JobExecutionContext context, JobExecutionException jobException) {
+ if (context.getJobDetail().getGroup().equals(jobGroup)) {
+ countDownLatch.countDown();
+ }
+ }
+ });
+ scheduler.addJob(new JobDetail(jobName, jobGroup, SavedSearchResultCountRecalculationJob.class), true);
+ scheduler.triggerJob(jobName, jobGroup);
+ try {
+ countDownLatch.await(60, TimeUnit.SECONDS);
+ } finally {
+ scheduler.deleteJob(jobName, jobGroup);
+ }
+ }
+
+ private static final class TestData {
+
+ private final Subject searchesOwner;
+
+ private final Role searchesOwnerRole;
+
+ private final ResourceType resourceType;
+
+ private final Set<Resource> resources;
+
+ private final Set<ResourceGroup> resourceGroups;
+
+ private final Set<SavedSearch> savedSearches;
+
+ private TestData(Subject searchesOwner, Role searchesOwnerRole, ResourceType resourceType,
+ Set<Resource> resources, Set<ResourceGroup> resourceGroups, Set<SavedSearch> savedSearches) {
+ this.searchesOwner = searchesOwner;
+ this.searchesOwnerRole = searchesOwnerRole;
+ this.resourceType = resourceType;
+ this.resources = resources;
+ this.resourceGroups = resourceGroups;
+ this.savedSearches = savedSearches;
+ }
+
+ public Subject getSearchesOwner() {
+ return searchesOwner;
+ }
+
+ public Role getSearchesOwnerRole() {
+ return searchesOwnerRole;
+ }
+
+ public ResourceType getResourceType() {
+ return resourceType;
+ }
+
+ public Set<Resource> getResources() {
+ return resources;
+ }
+
+ public Set<ResourceGroup> getResourceGroups() {
+ return resourceGroups;
+ }
+
+ public Set<SavedSearch> getSavedSearches() {
+ return savedSearches;
+ }
+ }
+
+}
commit 8419d8dbf23a92f4f50a5ac08780e8a2e4ff2374
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Mar 18 13:52:03 2013 -0700
Charting - Bar avg line performance enhancement and simplification to code now that previous avg lines are not shown the logic is removed to calculate bar avg for missing data.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
index fafbeba..d6d1152 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
@@ -432,8 +432,9 @@ public final class MetricStackedBarGraph extends AbstractGraph {
function createAvgLines() {
console.time("drawAvgLine");
-
- var barAvgLine = $wnd.d3.svg.line()
+ var showBarAvgTrendline =
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AbstractGraph::showBarAvgTrendLine()(),
+ barAvgLine = $wnd.d3.svg.line()
.interpolate("linear")
.defined(function(d){
return !d.nodata ;
@@ -442,28 +443,8 @@ public final class MetricStackedBarGraph extends AbstractGraph {
return timeScale(d.x)+ ((width / chartContext.data.length - barOffset)/ 2);
})
.y(function (d,i) {
-
- var showBarAvgTrendline =
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AbstractGraph::showBarAvgTrendLine()();
-
if(showBarAvgTrendline){
- // on a bar avg line if the value is undefined then use the last defined value
- if(d.y == undefined){
- if(i >= 1){
- // count backward until there is a defined value
- for(var j=i; j>=1;j--){
- if(this.__data__[j].y != undefined){
- return yScale(this.__data__[j].y);
- }
- }
- return yScale(0);
- }else {
- return yScale(0);
- }
-
- }else {
- return yScale(+d.y);
- }
+ return yScale(d.y);
}else {
return yScale(0);
}
@@ -530,8 +511,8 @@ public final class MetricStackedBarGraph extends AbstractGraph {
xValue = (d.x == undefined) ? 0 : +d.x,
date = new Date(+xValue),
barDuration = d.barDuration,
- timeFormatter = $wnd.d3.time.format("%I:%M:%S %p"),
- dateFormatter = $wnd.d3.time.format("%m/%d/%y"),
+ timeFormatter = $wnd.d3.time.format(chartContext.chartHoverTimeFormat),
+ dateFormatter = $wnd.d3.time.format(chartContext.chartHoverDateFormat),
highValue = d.high.toFixed(2),
lowValue = d.low.toFixed(2),
avgValue = d.y.toFixed(2);
commit c627c8860626eb7bfbcf2f314191ac92f02bc472
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Mar 18 12:24:14 2013 -0700
Charting - NPE, Fix timing edge case bug for Group charts.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
index c976ef4..47b9c5d 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
@@ -190,6 +190,8 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
graphView.setWidth("95%");
graphView.setHeight(225);
- graphsVLayout.addMember(graphView);
+ if(graphsVLayout != null){
+ graphsVLayout.addMember(graphView);
+ }
}
}
commit 2fea3e4a95ef8dcc7e3f661f38e5c9a58ff55c00
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Mar 18 09:50:31 2013 -0700
Charting - Confine avg bar trendlines to bars that have data and eliminate trendlines from nodata (grey striped) bars.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
index c472a85..fafbeba 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
@@ -435,6 +435,9 @@ public final class MetricStackedBarGraph extends AbstractGraph {
var barAvgLine = $wnd.d3.svg.line()
.interpolate("linear")
+ .defined(function(d){
+ return !d.nodata ;
+ })
.x(function (d) {
return timeScale(d.x)+ ((width / chartContext.data.length - barOffset)/ 2);
})
commit 42c81cadb1b4fd0b48c775a440db02095961ef9d
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 18 17:12:47 2013 -0400
Bug 922050
Problems with new Availability charts
- Hook up the resource and group avail charts to the new back-end support.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupAvailability.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupAvailability.java
index da3d83c..44b76f0 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupAvailability.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupAvailability.java
@@ -50,6 +50,12 @@ public class ResourceGroupAvailability implements Serializable {
private Long startTime;
private Long endTime;
+ /**
+ * for serialization purposes only, do not use this.
+ */
+ public ResourceGroupAvailability() {
+ }
+
public ResourceGroupAvailability(int resourceGroupId) {
this(resourceGroupId, null, null, null);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AvailabilityGWTService.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AvailabilityGWTService.java
index d7bca47..9a682f1 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AvailabilityGWTService.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/gwt/AvailabilityGWTService.java
@@ -18,10 +18,13 @@
*/
package org.rhq.enterprise.gui.coregui.client.gwt;
+import java.util.List;
+
import com.google.gwt.user.client.rpc.RemoteService;
import org.rhq.core.domain.criteria.AvailabilityCriteria;
import org.rhq.core.domain.measurement.Availability;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupAvailability;
import org.rhq.core.domain.util.PageList;
/**
@@ -31,4 +34,10 @@ public interface AvailabilityGWTService extends RemoteService {
PageList<Availability> findAvailabilityByCriteria(AvailabilityCriteria criteria) throws RuntimeException;
+ List<Availability> getAvailabilitiesForResource(int resourceId, long startTime, long endTime)
+ throws RuntimeException;
+
+ List<ResourceGroupAvailability> getAvailabilitiesForResourceGroup(int groupId, long startTime, long endTime)
+ throws RuntimeException;
+
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
index 065bc7a..12ff64f 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
@@ -18,11 +18,13 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.common;
+import java.util.List;
import com.smartgwt.client.widgets.Label;
+import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.measurement.Availability;
-import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupAvailability;
import org.rhq.enterprise.gui.coregui.client.components.measurement.UserPreferencesMeasurementRangeEditor;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.avail.AvailabilityD3Graph;
import org.rhq.enterprise.gui.coregui.client.util.async.CountDownLatch;
@@ -33,9 +35,10 @@ import org.rhq.enterprise.gui.coregui.client.util.enhanced.EnhancedVLayout;
* and User Preferences pickers for the date range.
*/
public abstract class AbstractD3GraphListView extends EnhancedVLayout {
- protected PageList<Availability> availabilityList;
+ protected List<Availability> availabilityList;
+ protected List<ResourceGroupAvailability> groupAvailabilityList;
protected AvailabilityD3Graph availabilityGraph;
- protected static Label loadingLabel = new Label(MSG.common_msg_loading());
+ protected static Label loadingLabel = new Label(MSG.common_msg_loading());
protected UserPreferencesMeasurementRangeEditor measurementRangeEditor;
protected boolean showAvailabilityGraph = false;
@@ -46,6 +49,7 @@ public abstract class AbstractD3GraphListView extends EnhancedVLayout {
public abstract void redrawGraphs();
- protected abstract void queryAvailability(final int resourceId, Long startTime, Long endTime, final CountDownLatch countDownLatch);
+ protected abstract void queryAvailability(final EntityContext context, Long startTime, Long endTime,
+ final CountDownLatch countDownLatch);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java
index 2fa63af..ba13f7e 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java
@@ -19,10 +19,11 @@
package org.rhq.enterprise.gui.coregui.client.inventory.common.charttype;
import java.util.Date;
+import java.util.List;
import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.MeasurementUnits;
-import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupAvailability;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.Messages;
import org.rhq.enterprise.gui.coregui.client.util.Log;
@@ -30,15 +31,16 @@ import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
/**
* Contains the javascript chart definition for an implementation of the d3 availability chart. This implementation is
- * just a line that changes color based on availability type: up=green, down=red, orange=disabled, yellow=warn, unknown=grey.
- * This version of the availability graph shows continuous intervals.
+ * just a line that changes color based on availability type: up=green, down=red, orange=disabled, unknown=grey,
+ * empty=grey, warn=yellow. This version of the availability graph shows continuous intervals.
*
* @author Mike Thompson
*/
public class AvailabilityLineGraphType {
private static Messages MSG = CoreGUI.getMessages();
- private PageList<Availability> availabilityList;
+ private List<Availability> availabilityList;
+ private List<ResourceGroupAvailability> groupAvailabilityList;
private Integer entityId;
/**
@@ -49,20 +51,24 @@ public class AvailabilityLineGraphType {
this.entityId = entityId;
}
- public void setAvailabilityList(PageList<Availability> availabilityList) {
+ public void setAvailabilityList(List<Availability> availabilityList) {
this.availabilityList = availabilityList;
}
+ public void setGroupAvailabilityList(List<ResourceGroupAvailability> groupAvailabilityList) {
+ this.groupAvailabilityList = groupAvailabilityList;
+ }
+
public String getAvailabilityJson() {
StringBuilder sb = new StringBuilder("[");
if (null != availabilityList) {
- // loop through the avail down intervals
+ // loop through the avail intervals
for (Availability availability : availabilityList) {
sb.append("{ \"availType\":\"" + availability.getAvailabilityType() + "\", ");
sb.append(" \"availStart\":" + availability.getStartTime() + ", ");
// last record will be null
long endTime = availability.getEndTime() != null ? availability.getEndTime() : (new Date()).getTime();
- sb.append(" \"availEnd\":" + endTime + ", ");
+ sb.append(" \"availEnd\":" + endTime + ", ");
long availDuration = endTime - availability.getStartTime();
String availDurationString = MeasurementConverterClient.format((double) availDuration,
@@ -71,7 +77,26 @@ public class AvailabilityLineGraphType {
}
sb.setLength(sb.length() - 1);
+
+ } else if (null != groupAvailabilityList) {
+ // loop through the group avail down intervals
+ for (ResourceGroupAvailability groupAvailability : groupAvailabilityList) {
+ sb.append("{ \"availType\":\"" + groupAvailability.getGroupAvailabilityType() + "\", ");
+ sb.append(" \"availStart\":" + groupAvailability.getStartTime() + ", ");
+ // last record will be null
+ long endTime = groupAvailability.getEndTime() != null ? groupAvailability.getEndTime() : (new Date())
+ .getTime();
+ sb.append(" \"availEnd\":" + endTime + ", ");
+
+ long availDuration = endTime - groupAvailability.getStartTime();
+ String availDurationString = MeasurementConverterClient.format((double) availDuration,
+ MeasurementUnits.MILLISECONDS, true);
+ sb.append(" \"availDuration\": \"" + availDurationString + "\" },");
+
+ }
+ sb.setLength(sb.length() - 1);
}
+
sb.append("]");
Log.debug(sb.toString());
return sb.toString();
@@ -82,144 +107,147 @@ public class AvailabilityLineGraphType {
*/
public native void drawJsniChart() /*-{
- console.groupCollapsed("AvailabilityChart");
- console.time("availabilityChart");
- var global = this,
-
- // tidy up all of our interactions with java (via JSNI) thru AvailChartContext class
- // NOTE: rhq.js has the javascript object constructors in it.
- availChartContext = new $wnd.AvailChartContext(global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartId()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getAvailabilityJson()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartDateLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartTimeLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverStartLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverEndLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverBarLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverAvailabilityLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverTimeFormat()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverDateFormat()()
- );
-
-
- function draw(availChartContext) {
- "use strict";
-
- var margin = {top: 5, right: 5, bottom: 5, left: 40},
- width = 750 - margin.left - margin.right,
- height = 20 - margin.top - margin.bottom,
- pixelsOffHeight = 0,
- UP = 4, DOWN = 3, UNKNOWN = 2, DISABLED = 1, WARN = 0,
- xAxisMin = $wnd.d3.min(availChartContext.data, function (d) {
- return +d.availStart;
- }),
- xAxisMax = $wnd.d3.max(availChartContext.data, function (d) {
- return +d.availEnd;
- }),
-
- timeScale = $wnd.d3.time.scale()
- .range([0, width])
- .domain([xAxisMin, xAxisMax]),
-
- yScale = $wnd.d3.scale.linear()
- .clamp(true)
- .rangeRound([height, 0])
- .domain([0, 4]),
-
- svg = $wnd.d3.select(availChartContext.chartSelection).append("g")
- .attr("width", width + margin.left + margin.right)
- .attr("height", height + margin.top + margin.bottom)
- .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
-
-
- // The gray bars at the bottom leading up
- svg.selectAll("rect.availBars")
- .data(availChartContext.data)
- .enter().append("rect")
- .attr("class", "availBars")
- .attr("x", function (d) {
- return timeScale(+d.availStart);
- })
- .attr("y", function (d) {
- return yScale(0);
- })
- .attr("height", function (d) {
- return height - yScale(4) - pixelsOffHeight;
- })
- .attr("width", function (d) {
- return timeScale(+d.availEnd) - timeScale(+d.availStart);
- })
-
- .attr("opacity", ".9")
- .attr("fill", function (d) {
- if (d.availType === 'DOWN') {
- return "#FF1919"; // red
- }
- else if (d.availType === 'WARN') {
- return "#FFFF00"; // yellow
- }
- else if (d.availType === 'DISABLED') {
- return "#FF9933"; // orange
- }
- else if (d.availType === 'UNKNOWN') {
- return "#CCC"; // gray
- }
- else if (d.availType === 'UP') {
- return "#198C19"; // green
- }
- else {
- // should not ever happen, but...
- console.warn("AvailabilityType not valid.");
- return "#000"; //black
- }
- });
-
- createHovers();
-
- }
-
- function createHovers() {
- $wnd.jQuery('svg rect.availBars').tipsy({
- gravity: 'n',
- html: true,
- trigger: 'hover',
- title: function () {
- var d = this.__data__;
- return formatHovers(d);
- },
- show: function (e, el) {
- el.css({ 'z-index': '990000'})
- }
- });
- }
-
- function formatHovers(d) {
- var hoverString,
- timeFormatter = $wnd.d3.time.format(availChartContext.chartHoverTimeFormat),
- dateFormatter = $wnd.d3.time.format(availChartContext.chartHoverDateFormat),
- availType = d.availType,
- availStart = new Date(+d.availStart),
- availEnd = new Date(+d.availEnd),
- availDuration = d.availDuration;
-
- hoverString =
- '<div class="chartHoverEnclosingDiv">' +
- '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverBarAvailabilityLabel + ': </span><span style="width:50px;">' + availType + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverStartLabel + ': </span><span style="width:50px;">' + timeFormatter(availStart) + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availStart) + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverEndLabel + ': </span><span style="width:50px;">' + timeFormatter(availEnd) + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availEnd) + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverBarLabel + ': </span><span style="width:50px;">' + availDuration + '</span></div>' +
- '</div>';
- return hoverString;
-
- }
-
- if (availChartContext.data.length > 0) {
- draw(availChartContext);
- }
-
- console.timeEnd("availabilityChart");
- console.groupEnd("AvailabilityChart");
+ console.groupCollapsed("AvailabilityChart");
+ console.time("availabilityChart");
+ var global = this,
+
+ // tidy up all of our interactions with java (via JSNI) thru AvailChartContext class
+ // NOTE: rhq.js has the javascript object constructors in it.
+ availChartContext = new $wnd.AvailChartContext(global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartId()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getAvailabilityJson()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartDateLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartTimeLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverStartLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverEndLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverBarLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverAvailabilityLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverTimeFormat()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverDateFormat()()
+ );
+
+
+ function draw(availChartContext) {
+ "use strict";
+
+ var margin = {top: 5, right: 5, bottom: 5, left: 40},
+ width = 750 - margin.left - margin.right,
+ height = 20 - margin.top - margin.bottom,
+ pixelsOffHeight = 0,
+ UP = 4, DOWN = 3, UNKNOWN = 2, DISABLED = 1, WARN = 0,
+ xAxisMin = $wnd.d3.min(availChartContext.data, function (d) {
+ return +d.availStart;
+ }),
+ xAxisMax = $wnd.d3.max(availChartContext.data, function (d) {
+ return +d.availEnd;
+ }),
+
+ timeScale = $wnd.d3.time.scale()
+ .range([0, width])
+ .domain([xAxisMin, xAxisMax]),
+
+ yScale = $wnd.d3.scale.linear()
+ .clamp(true)
+ .rangeRound([height, 0])
+ .domain([0, 4]),
+
+ svg = $wnd.d3.select(availChartContext.chartSelection).append("g")
+ .attr("width", width + margin.left + margin.right)
+ .attr("height", height + margin.top + margin.bottom)
+ .attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
+
+ // The gray bars at the bottom leading up
+ svg.selectAll("rect.availBars")
+ .data(availChartContext.data)
+ .enter().append("rect")
+ .attr("class", "availBars")
+ .attr("x", function (d) {
+ return timeScale(+d.availStart);
+ })
+ .attr("y", function (d) {
+ return yScale(0);
+ })
+ .attr("height", function (d) {
+ return height - yScale(4) - pixelsOffHeight;
+ })
+ .attr("width", function (d) {
+ return timeScale(+d.availEnd) - timeScale(+d.availStart);
+ })
+
+ .attr("opacity", ".9")
+ .attr("fill", function (d) {
+ if (d.availType === 'DOWN') {
+ return "#FF1919"; // red
+ }
+ else if (d.availType === 'DISABLED') {
+ return "#FF9933"; // orange
+ }
+ else if (d.availType === 'UNKNOWN') {
+ return "#CCC"; // gray
+ }
+ else if (d.availType === 'UP') {
+ return "#198C19"; // green
+ }
+ else if (d.availType === 'WARN') {
+ return "#FFFF00"; // yellow
+ }
+ else if (d.availType === 'EMPTY') {
+ return "#CCC"; // gray
+ }
+ else {
+ // should not ever happen, but...
+ console.warn("AvailabilityType not valid.");
+ return "#000"; //black
+ }
+ });
+
+ createHovers();
+
+ }
+
+ function createHovers() {
+ $wnd.jQuery('svg rect.availBars').tipsy({
+ gravity: 'n',
+ html: true,
+ trigger: 'hover',
+ title: function () {
+ var d = this.__data__;
+ return formatHovers(d);
+ },
+ show: function (e, el) {
+ el.css({ 'z-index': '990000'})
+ }
+ });
+ }
+
+ function formatHovers(d) {
+ var hoverString,
+ timeFormatter = $wnd.d3.time.format(availChartContext.chartHoverTimeFormat),
+ dateFormatter = $wnd.d3.time.format(availChartContext.chartHoverDateFormat),
+ availType = d.availType,
+ availStart = new Date(+d.availStart),
+ availEnd = new Date(+d.availEnd),
+ availDuration = d.availDuration;
+
+ hoverString =
+ '<div class="chartHoverEnclosingDiv">' +
+ '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverBarAvailabilityLabel + ': </span><span style="width:50px;">' + availType + '</span></div>' +
+ '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverStartLabel + ': </span><span style="width:50px;">' + timeFormatter(availStart) + '</span></div>' +
+ '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availStart) + '</span></div>' +
+ '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverEndLabel + ': </span><span style="width:50px;">' + timeFormatter(availEnd) + '</span></div>' +
+ '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availEnd) + '</span></div>' +
+ '<div class="chartHoverAlignRight"><span >' + availChartContext.hoverBarLabel + ': </span><span style="width:50px;">' + availDuration + '</span></div>' +
+ '</div>';
+ return hoverString;
+
+ }
+
+ if (availChartContext.data.length > 0) {
+ draw(availChartContext);
+ }
+
+ console.timeEnd("availabilityChart");
+ console.groupEnd("AvailabilityChart");
}-*/;
public String getChartId() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
index cc42825..c976ef4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
@@ -28,16 +28,14 @@ import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.core.domain.criteria.AvailabilityCriteria;
-import org.rhq.core.domain.measurement.Availability;
+import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
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.core.domain.util.PageOrdering;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupAvailability;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractD3GraphListView;
@@ -95,7 +93,7 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
*/
public void redrawGraphs() {
- queryAvailability(resourceGroup.getId(), measurementRangeEditor.getStartTime(),
+ queryAvailability(EntityContext.forGroup(resourceGroup), measurementRangeEditor.getStartTime(),
measurementRangeEditor.getEndTime(), null);
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceGroup.getResourceType().getId(),
@@ -142,7 +140,7 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
for (List<MeasurementDataNumericHighLowComposite> data : result) {
buildIndividualGraph(measurementDefinitions.get(i++), data);
}
- availabilityGraph.setAvailabilityList(availabilityList);
+ availabilityGraph.setGroupAvailabilityList(groupAvailabilityList);
availabilityGraph.drawJsniChart();
}
}
@@ -152,19 +150,14 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
});
}
- protected void queryAvailability(final int entityId, Long startTime, Long endTime,
+ protected void queryAvailability(final EntityContext groupContext, Long startTime, Long endTime,
final CountDownLatch countDownLatch) {
final long timerStart = System.currentTimeMillis();
// now return the availability
- //@todo: prep for New GroupAvailability SLSB call
- AvailabilityCriteria c = new AvailabilityCriteria();
- c.addFilterResourceId(entityId);
- c.addFilterInterval(startTime, endTime);
- c.addSortStartTime(PageOrdering.ASC);
- GWTServiceLookup.getAvailabilityService().findAvailabilityByCriteria(c,
- new AsyncCallback<PageList<Availability>>() {
+ GWTServiceLookup.getAvailabilityService().getAvailabilitiesForResourceGroup(groupContext.getGroupId(),
+ startTime, endTime, new AsyncCallback<List<ResourceGroupAvailability>>() {
@Override
public void onFailure(Throwable caught) {
CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_availability_loadFailed(), caught);
@@ -174,18 +167,16 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
}
@Override
- public void onSuccess(PageList<Availability> availList) {
+ public void onSuccess(List<ResourceGroupAvailability> groupAvailList) {
Log.debug("\nSuccessfully queried group availability in: "
+ (System.currentTimeMillis() - timerStart) + " ms.");
- availabilityList = new PageList<Availability>();
- for (Availability availability : availList) {
- availabilityList.add(availability);
- }
+ groupAvailabilityList = groupAvailList;
if (countDownLatch != null) {
countDownLatch.countDown();
}
}
});
+
}
private void buildIndividualGraph(MeasurementDefinition measurementDefinition,
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
index 36efa45..38c394a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
@@ -31,7 +31,7 @@ import com.smartgwt.client.types.Overflow;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
-import org.rhq.core.domain.criteria.AvailabilityCriteria;
+import org.rhq.core.domain.common.EntityContext;
import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.DisplayType;
@@ -41,7 +41,6 @@ import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
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.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.measurement.UserPreferencesMeasurementRangeEditor;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -154,38 +153,35 @@ public class D3GraphListView extends AbstractD3GraphListView {
availabilityGraph.drawJsniChart();
}
- protected void queryAvailability(final int resourceId, Long startTime, Long endTime, final CountDownLatch countDownLatch) {
+ @Override
+ protected void queryAvailability(final EntityContext context, Long startTime, Long endTime,
+ final CountDownLatch countDownLatch) {
final long timerStart = System.currentTimeMillis();
// now return the availability
- AvailabilityCriteria c = new AvailabilityCriteria();
- c.addFilterResourceId(resourceId);
- c.addFilterInterval(startTime, endTime);
- c.addSortStartTime(PageOrdering.ASC);
- GWTServiceLookup.getAvailabilityService().findAvailabilityByCriteria(c,
- new AsyncCallback<PageList<Availability>>() {
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_availability_loadFailed(), caught);
- if (countDownLatch != null) {
- countDownLatch.countDown();
- }
+ GWTServiceLookup.getAvailabilityService().getAvailabilitiesForResource(context.getResourceId(), startTime,
+ endTime, new AsyncCallback<List<Availability>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_availability_loadFailed(), caught);
+ if (countDownLatch != null) {
+ countDownLatch.countDown();
}
+ }
- @Override
- public void onSuccess(PageList<Availability> availList) {
- Log.debug("\nSuccessfully queried availability in: " + (System.currentTimeMillis() - timerStart)
- + " ms.");
- availabilityList = new PageList<Availability>();
- for (Availability availability : availList) {
- availabilityList.add(availability);
- }
- if (countDownLatch != null) {
- countDownLatch.countDown();
- }
+ @Override
+ public void onSuccess(List<Availability> availList) {
+ if (Log.isDebugEnabled()) {
+ Log.debug("\nSuccessfully queried availability in: "
+ + (System.currentTimeMillis() - timerStart) + " ms.");
+ }
+ availabilityList = availList;
+ if (countDownLatch != null) {
+ countDownLatch.countDown();
}
- });
+ }
+ });
}
/**
@@ -195,8 +191,8 @@ public class D3GraphListView extends AbstractD3GraphListView {
private void buildGraphs() {
final long startTimer = System.currentTimeMillis();
- queryAvailability(resource.getId(), measurementRangeEditor.getStartTime(),
- measurementRangeEditor.getEndTime(), null);
+ queryAvailability(EntityContext.forResource(resource.getId()), measurementRangeEditor.getStartTime(),
+ measurementRangeEditor.getEndTime(), null);
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
@@ -271,7 +267,7 @@ public class D3GraphListView extends AbstractD3GraphListView {
private void queryMetricData(final int[] measDefIdArray, final CountDownLatch countDownLatch) {
GWTServiceLookup.getMeasurementDataService().findDataForResource(resource.getId(), measDefIdArray,
- measurementRangeEditor.getStartTime(),measurementRangeEditor.getEndTime(), 60,
+ measurementRangeEditor.getStartTime(), measurementRangeEditor.getEndTime(), 60,
new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
@Override
public void onFailure(Throwable caught) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/AvailabilityD3Graph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/AvailabilityD3Graph.java
index 5e6b9f9..d03fefe 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/AvailabilityD3Graph.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/AvailabilityD3Graph.java
@@ -18,11 +18,12 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.avail;
+import java.util.List;
import com.smartgwt.client.widgets.HTMLFlow;
import org.rhq.core.domain.measurement.Availability;
-import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupAvailability;
import org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityGraph;
import org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType;
import org.rhq.enterprise.gui.coregui.client.util.Log;
@@ -60,11 +61,14 @@ public class AvailabilityD3Graph extends EnhancedVLayout implements Availability
drawJsniChart();
}
-
- public void setAvailabilityList(PageList<Availability> availabilityList) {
+ public void setAvailabilityList(List<Availability> availabilityList) {
availabilityGraphType.setAvailabilityList(availabilityList);
}
+ public void setGroupAvailabilityList(List<ResourceGroupAvailability> groupAvailabilityList) {
+ availabilityGraphType.setGroupAvailabilityList(groupAvailabilityList);
+ }
+
/**
* Setup the page elements especially the div and svg elements that serve as
* placeholders for the d3 stuff to grab onto and add svg tags to render the chart.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AvailabilityGWTServiceImpl.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AvailabilityGWTServiceImpl.java
index 75621fb..0e6faa2 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AvailabilityGWTServiceImpl.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/server/gwt/AvailabilityGWTServiceImpl.java
@@ -18,8 +18,11 @@
*/
package org.rhq.enterprise.gui.coregui.server.gwt;
+import java.util.List;
+
import org.rhq.core.domain.criteria.AvailabilityCriteria;
import org.rhq.core.domain.measurement.Availability;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupAvailability;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.gwt.AvailabilityGWTService;
import org.rhq.enterprise.gui.coregui.server.util.SerialUtility;
@@ -44,4 +47,29 @@ public class AvailabilityGWTServiceImpl extends AbstractGWTServiceImpl implement
throw getExceptionToThrowToClient(t);
}
}
+
+ @Override
+ public List<Availability> getAvailabilitiesForResource(int resourceId, long startTime, long endTime)
+ throws RuntimeException {
+ try {
+ return SerialUtility.prepare(
+ availabilityManager.getAvailabilitiesForResource(getSessionSubject(), resourceId, startTime, endTime),
+ "AvailabilityService.getAvailabilitiesForResource");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
+ @Override
+ public List<ResourceGroupAvailability> getAvailabilitiesForResourceGroup(int groupId, long startTime, long endTime)
+ throws RuntimeException {
+ try {
+ return SerialUtility
+ .prepare(availabilityManager.getAvailabilitiesForResourceGroup(getSessionSubject(), groupId, startTime,
+ endTime), "AvailabilityService.getAvailabilitiesForResourceGroup");
+ } catch (Throwable t) {
+ throw getExceptionToThrowToClient(t);
+ }
+ }
+
}
commit 5fc9d979825e6d25554a7156e1f7dda41eb0ea2b
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 18 13:18:08 2013 -0400
Bug 922050
Problems with new Availability charts
- add new (Local) SLSB support for avail charting of resources and groups.
- keep avail processing server-side for Resource avail chart, as well as
add handling for some edge cases.
- add missing group avail chart support.
- add server itests for new methods
- remove broken test for legacy charting method
- deprecate AvailabilityPoint based availability charting support
- replace with discrete interval charting support for avail to support
new, simplified approach.
also:
- settle on explicit member avail in all group avail displays. This is for
speed (especially in the avail chart view) and consistency. For recursive
groups show the implicit avail as well with an new, additional avail icon.
- tweek some jdoc
- fix some MSGs while adding new ones for group avail icon support
One more check-in pending, still need to hook charts to new back-end support
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AvailabilityCriteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AvailabilityCriteria.java
index 838f5ba..b45a8bf 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AvailabilityCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AvailabilityCriteria.java
@@ -79,9 +79,9 @@ public class AvailabilityCriteria extends Criteria {
// specified interval. Things to note about the fragment below:
// - "startTime >= 0" is done on purpose, the fragment must start with "startTime" due to the generator
// - we do not use BETWEEN on purpose, it caused a problem with param assignment in hibernate. so, we use the expanded form
- // - startTime and endTime are persisted in seconds, so the paremeters should be in seconds
+ // - startTime and endTime are persisted in seconds, so the parameters should be in seconds
String filterFragment = "" //
- + "startTime >= 0" // innoccuous tautology just needed to get generated syntax correct
+ + "startTime >= 0" // innocuous tautology just needed to get generated syntax correct
+ " AND ( ( availability.startTime >= ? AND availability.startTime <= " + intervalEndTime + " )" // interval straddles :start
+ " OR ( availability.startTime <= ? AND ( availability.endTime >= ? OR availability.endTime IS NULL ) ) )"; // availability straddles :start
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/Availability.java b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/Availability.java
index 05217e1..2297af9 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/Availability.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/Availability.java
@@ -101,9 +101,9 @@ import org.rhq.core.domain.resource.Resource;
+ "ORDER BY av.startTime ASC"), //
@NamedQuery(name = Availability.FIND_FOR_RESOURCE_GROUP_WITHIN_INTERVAL, query = "" //
+ "SELECT av FROM Availability av " //
- + " WHERE av.resource.id IN ( SELECT ires.id " //
+ + " WHERE av.resource.id IN ( SELECT eres.id " //
+ " FROM ResourceGroup rg " //
- + " JOIN rg.implicitResources ires " //
+ + " JOIN rg.explicitResources eres " //
+ " WHERE rg.id = :groupId ) " //
+ " AND av.resource.inventoryStatus = 'COMMITTED' " //
+ " AND ((av.startTime <= :start AND (av.endTime >= :start OR av.endTime IS NULL) ) " /* availability straddles :start */
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupAvailability.java b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupAvailability.java
new file mode 100644
index 0000000..da3d83c
--- /dev/null
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/resource/group/composite/ResourceGroupAvailability.java
@@ -0,0 +1,94 @@
+/*
+ * 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, version 2, as
+ * published by the Free Software Foundation, and/or the GNU Lesser
+ * General Public License, version 2.1, also as published by the Free
+ * Software Foundation.
+ *
+ * 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 and the GNU Lesser General Public License
+ * for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * and the GNU Lesser 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.core.domain.resource.group.composite;
+
+import java.io.Serializable;
+
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite.GroupAvailabilityType;
+
+/**
+ * Each instance represents an availability interval for a group. Group availability is determined by looking at
+ * the resource availabilities of the group members for the period of time in question. The group availability is
+ * determined in the following way, processed top to bottom:
+ * <pre>
+ * Member Availability | Group Availability
+ * Empty Group | Grey / EMPTY
+ * All DOWN | Red / DOWN
+ * Some DOWN/UNKNOWN | Yellow / WARN
+ * Some DISABLED | Orange / DISABLED
+ * All UP | Green / UP
+ * </pre>
+ *
+ * @author Jay Shaughnessy
+ */
+public class ResourceGroupAvailability implements Serializable {
+
+ private static final long serialVersionUID = 1L;
+
+ private int resourceGroupId;
+ private GroupAvailabilityType groupAvailabilityType;
+ private Long startTime;
+ private Long endTime;
+
+ public ResourceGroupAvailability(int resourceGroupId) {
+ this(resourceGroupId, null, null, null);
+ }
+
+ public ResourceGroupAvailability(int resourceGroupId, GroupAvailabilityType groupAvailabilityType, Long startTime,
+ Long endTime) {
+ super();
+ this.resourceGroupId = resourceGroupId;
+ this.groupAvailabilityType = groupAvailabilityType;
+ this.startTime = startTime;
+ this.endTime = endTime;
+ }
+
+ public int getResourceGroupId() {
+ return resourceGroupId;
+ }
+
+ public GroupAvailabilityType getGroupAvailabilityType() {
+ return groupAvailabilityType;
+ }
+
+ public void setGroupAvailabilityType(GroupAvailabilityType groupAvailabilityType) {
+ this.groupAvailabilityType = groupAvailabilityType;
+ }
+
+ public Long getStartTime() {
+ return startTime;
+ }
+
+ public void setStartTime(Long startTime) {
+ this.startTime = startTime;
+ }
+
+ public Long getEndTime() {
+ return endTime;
+ }
+
+ public void setEndTime(Long endTime) {
+ this.endTime = endTime;
+ }
+
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
index 7515714..2ec1cca 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/footer/FavoritesButton.java
@@ -231,7 +231,7 @@ public class FavoritesButton extends IMenuButton {
MenuItem item = new MenuItem(String.valueOf(groupId));
item.setTitle(group.getName());
item.setIcon(ImageManager.getGroupIcon(group.getGroupCategory(),
- groupComposite.getImplicitAvailabilityType()));
+ groupComposite.getExplicitAvailabilityType()));
item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
public void onClick(MenuItemClickEvent event) {
@@ -300,7 +300,7 @@ public class FavoritesButton extends IMenuButton {
MenuItem item = new MenuItem(String.valueOf(groupId));
item.setTitle(group.getName());
item.setIcon(ImageManager.getGroupIcon(group.getGroupCategory(),
- groupComposite.getImplicitAvailabilityType()));
+ groupComposite.getExplicitAvailabilityType()));
item.addClickHandler(new com.smartgwt.client.widgets.menu.events.ClickHandler() {
public void onClick(MenuItemClickEvent event) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
index 5bbc47a..6e44286 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/ResourceGroupTitleBar.java
@@ -44,9 +44,9 @@ import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagEditorView;
import org.rhq.enterprise.gui.coregui.client.components.tagging.TagsChangedCallback;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
-import org.rhq.enterprise.gui.coregui.client.util.message.Message;
import org.rhq.enterprise.gui.coregui.client.util.enhanced.EnhancedHLayout;
import org.rhq.enterprise.gui.coregui.client.util.enhanced.EnhancedVLayout;
+import org.rhq.enterprise.gui.coregui.client.util.message.Message;
/**
* @author Greg Hinkle
@@ -67,7 +67,8 @@ public class ResourceGroupTitleBar extends EnhancedVLayout {
private Img badge;
private Img favoriteButton;
private HTMLFlow title;
- private Img availabilityImage;
+ private Img explicitAvailabilityImage;
+ private Img implicitAvailabilityImage;
private boolean favorite;
private boolean supportsFavorite;
private GeneralProperties generalProperties;
@@ -96,7 +97,10 @@ public class ResourceGroupTitleBar extends EnhancedVLayout {
this.title = new HTMLFlow();
this.title.setWidth("*");
- this.availabilityImage = new Img(ImageManager.getAvailabilityLargeIcon(null), 24, 24);
+ this.explicitAvailabilityImage = new Img(ImageManager.getAvailabilityLargeIcon(null), 24, 24);
+ this.explicitAvailabilityImage.setTooltip(MSG.view_group_detail_explicitAvail());
+ this.implicitAvailabilityImage = new Img(ImageManager.getAvailabilityLargeIcon(null), 24, 24);
+ this.implicitAvailabilityImage.setTooltip(MSG.view_group_detail_implicitAvail());
if (this.supportsFavorite) {
this.favoriteButton = new Img(NOT_FAV_ICON, 24, 24);
@@ -145,6 +149,7 @@ public class ResourceGroupTitleBar extends EnhancedVLayout {
generalProperties = new GeneralProperties(resultComposite, ResourceGroupTitleBar.this,
(!(isAutoGroup || isAutoCluster)));
generalProperties.setVisible(false);
+
ResourceGroupTitleBar.this.addMember(generalProperties);
expandCollapseArrow.addClickHandler(new ClickHandler() {
private boolean collapsed = true;
@@ -201,7 +206,8 @@ public class ResourceGroupTitleBar extends EnhancedVLayout {
hlayout.addMember(expandCollapseArrow);
hlayout.addMember(badge);
hlayout.addMember(title);
- hlayout.addMember(availabilityImage);
+ hlayout.addMember(explicitAvailabilityImage);
+ hlayout.addMember(implicitAvailabilityImage);
if (this.supportsFavorite) {
hlayout.addMember(favoriteButton);
}
@@ -291,10 +297,17 @@ public class ResourceGroupTitleBar extends EnhancedVLayout {
}
private void setGroupIcons(ResourceGroupComposite composite) {
- GroupAvailabilityType groupAvailType = composite.getExplicitAvailabilityType();
+ GroupAvailabilityType explicitGroupAvailType = composite.getExplicitAvailabilityType();
- this.badge.setSrc(ImageManager.getGroupLargeIcon(this.group.getGroupCategory(), groupAvailType));
- this.availabilityImage.setSrc(ImageManager.getAvailabilityGroupLargeIcon(groupAvailType));
+ this.badge.setSrc(ImageManager.getGroupLargeIcon(this.group.getGroupCategory(), explicitGroupAvailType));
+ this.explicitAvailabilityImage.setSrc(ImageManager.getAvailabilityGroupLargeIcon(explicitGroupAvailType));
+
+ if (composite.getResourceGroup().isRecursive()) {
+ GroupAvailabilityType implicitGroupAvailType = composite.getImplicitAvailabilityType();
+ this.implicitAvailabilityImage.setSrc(ImageManager.getAvailabilityGroupLargeIcon(implicitGroupAvailType));
+ } else {
+ this.implicitAvailabilityImage.setVisible(false);
+ }
}
private void updateFavoriteButton() {
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 6d0851d..1f2e209 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
@@ -1546,9 +1546,11 @@ view_groupCreateWizard_windowTitle = Create Group
view_groupInventoryMembers_button_updateMembership = Update Membership...
view_groupInventoryMembers_title_updateMembership = Update Membership
view_group_common_emptyGroup = An empty group is always considered as mixed.
+view_group_detail_explicitAvail = Group availability for explicit members (does not include recursive members).
view_group_detail_failLoad = Failed to load group for group with ID [{0}]
view_group_detail_failLoadComp = Group with id [{0}] does not exist or is not accessible
view_group_detail_failRecursiveChange = Failed to update the recursive setting for group [{0}]
+view_group_detail_implicitAvail = Group availability for all members (includes recursive members).
view_group_detail_recursiveChange = You successfully changed the recursive setting for group [{0}]
view_group_inventory_activity_no_recent_metrics = This group has no recent metrics
view_group_meas_schedules_title = Group Metric Collection Schedules
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
index 1a27856..255391f 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
@@ -1560,9 +1560,11 @@ view_groupCreateWizard_windowTitle = Vytvořit skupinu
view_groupInventoryMembers_button_updateMembership = Upravit členství...
view_groupInventoryMembers_title_updateMembership = Upravit členství
view_group_common_emptyGroup = Prázndá skupina je vždy považována jako smíšená.
+##view_group_detail_explicitAvail = Group availability for explicit members (does not include recursive members).
view_group_detail_failLoad = Nepodařilo se načíst skupinu s ID [{0}]
view_group_detail_failLoadComp = Skupina s id [{0}] neexistuje nebo není přístupná
view_group_detail_failRecursiveChange = Nepodařilo se změnit rekurzivní nastavení pro skupinu [{0}]
+view_group_detail_implicitAvail = Group availability for all members (includes recursive members).
view_group_detail_recursiveChange = Úspěšně jste změnili rekurzivní nastavení pro skupinu [{0}]
view_group_inventory_activity_no_recent_metrics = Tato skupina nemá žádná nedávná měření
view_group_meas_schedules_title = Rozvrhy sběru měření pro skupinu
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index a276a6b..6f6743c 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -1377,9 +1377,11 @@ view_groupCreateWizard_windowTitle = Gruppe anlegen
view_groupInventoryMembers_button_updateMembership = Mitgliedschaft aktualisieren...
view_groupInventoryMembers_title_updateMembership = Mitgliedschaft aktualisieren
##view_group_common_emptyGroup = An empty group is always considered as mixed.
+##view_group_detail_explicitAvail = Group availability for explicit members (does not include recursive members).
view_group_detail_failLoad = Konnte die Gruppe mit der ID [{0}] nicht laden
-view_group_detail_failLoadComp = Group with id [{0}] does not exist or is not accessible
+##view_group_detail_failLoadComp = Group with id [{0}] does not exist or is not accessible
view_group_detail_failRecursiveChange = Konnte die Einstellung ''Rekursiv'' für die Gruppe [{0}] nicht aktualisieren
+view_group_detail_implicitAvail = Group availability for all members (includes recursive members).
view_group_detail_recursiveChange = Sie haben erfolgreich die ''Rekursiv''-Einstellung für die Gruppe [{0}] geändert.
##view_group_meas_schedules_title = Group Metric Collection Schedules
view_group_membership_failFetch = Konnte die Ressourcen-Gruppe nicht laden
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 3ad6421..09579ae 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -1532,9 +1532,11 @@ view_groupCreateWizard_windowTitle = グループ作成
view_groupInventoryMembers_button_updateMembership = メンバーシップの更新...
view_groupInventoryMembers_title_updateMembership = メンバーシップの更新
##view_group_common_emptyGroup = An empty group is always considered as mixed.
+##view_group_detail_explicitAvail = Group availability for explicit members (does not include recursive members).
view_group_detail_failLoad = ID [{0}] の付いたグループのロードに失敗しました
-view_group_detail_failLoadComp = Group with id [{0}] does not exist or is not accessible
+##view_group_detail_failLoadComp = Group with id [{0}] does not exist or is not accessible
view_group_detail_failRecursiveChange = グループ [{0}] の再帰設定の更新に失敗しました
+view_group_detail_implicitAvail = Group availability for all members (includes recursive members).
view_group_detail_recursiveChange = グループ [{0}] の再帰設定の変更に成功しました
view_group_inventory_activity_no_recent_metrics = このグループは最近のメトリックスはありません
view_group_meas_schedules_title = グループメトリック収集スケジュール
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
index 8d8eaea..84e024a 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
@@ -1283,8 +1283,11 @@ view_groupCreateWizard_membersStepName = 선택된 멤버
view_groupCreateWizard_title = 그룹 만들기
view_groupCreateWizard_windowTitle = 그룹 만들기
view_group_common_emptyGroup = 빈 그룹은 항상 혼합으로 간주됩니다
+##view_group_detail_explicitAvail = Group availability for explicit members (does not include recursive members).
view_group_detail_failLoad = ID [{0}]이 있는 그룹의 로드에 실패했습니다
view_group_detail_failLoadComp = ID [{0}] 그룹이 존재하지 않거나 엑세스할 수 없습니다
+##view_group_detail_failRecursiveChange = Failed to update the recursive setting for group [{0}]
+view_group_detail_implicitAvail = Group availability for all members (includes recursive members).
view_group_detail_recursiveChange = 그룹 [{0}]의 재귀 설정 변경에 성공했습니다
view_group_inventory_activity_no_recent_metrics = 이 그룹의 최근 통계는 없습니다
view_group_meas_schedules_title = 그룹 통계 수집 일정
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index ea8827d..262c3c4 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -1555,9 +1555,11 @@ view_groupCreateWizard_windowTitle = Criar Novo Grupo
view_groupInventoryMembers_button_updateMembership = Atualizar Membros do Grupo...
view_groupInventoryMembers_title_updateMembership = Atualizar Membros
##view_group_common_emptyGroup = An empty group is always considered as mixed.
+##view_group_detail_explicitAvail = Group availability for explicit members (does not include recursive members).
view_group_detail_failLoad = Falha ao carregar o grupo com ID [{0}]
view_group_detail_failLoadComp = Falha ao carregar a composi��o do grupo com ID [{0}]
view_group_detail_failRecursiveChange = Falha ao alterar a recursividade do grupo [{0}]
+view_group_detail_implicitAvail = Group availability for all members (includes recursive members).
view_group_detail_recursiveChange = Recursividade alterada para o grupo [{0}]
view_group_inventory_activity_no_recent_metrics = Este grupo n�o possui m�tricas recentes
view_group_meas_schedules_title = Agendamento da Coleta de M�tricas do Grupo
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index 85cd1d9..d96d127 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -2655,6 +2655,12 @@ view_admin_systemSettings_LDAPBindPW_name = Пароль
##view_configEdit_value = Value
##view_dashboardsManager_message_title_details = <h1>Welcome to {0}</h1>\n<p>This dashboard can be edited by clicking the (Edit Mode) button above.</p>\n<p>What would you like to do?</p>\n<p> <a href=\"{1}\">Import newly discovered resources.</a></p>\n<p> <a href=\"{2}\">Search for resources.</a></p>\n<p> <a href=\"{3}\">See help and documentation.</a></p>
##view_group_common_emptyGroup = An empty group is always considered as mixed.
+##view_group_detail_explicitAvail = Group availability for explicit members (does not include recursive members).
+##view_group_detail_failLoad = Failed to load group for group with ID [{0}]
+##view_group_detail_failLoadComp = Group with id [{0}] does not exist or is not accessible
+##view_group_detail_failRecursiveChange = Failed to update the recursive setting for group [{0}]
+view_group_detail_implicitAvail = Group availability for all members (includes recursive members).
+##view_group_detail_recursiveChange = You successfully changed the recursive setting for group [{0}]
##view_inventory_resources_disableSuccessful = You have successfully disabled the selected resources and their children, [{0}] resources.
##view_messageCenter_messageRootCause = Root Cause
##view_operationHistoryList_cancelConfirm = Are you sure you want to cancel the selected operations? NOTE: Only those selected operations that are currently "in progress" will be attempted to be canceled.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 48dbdd8..9159a53 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -1533,9 +1533,11 @@ view_groupCreateWizard_windowTitle = \u521b\u5efa\u7ec4
view_groupInventoryMembers_button_updateMembership = \u66f4\u65b0\u6210\u5458\u5173\u7cfb\u4e2d...
view_groupInventoryMembers_title_updateMembership = \u66f4\u65b0\u6210\u5458\u5173\u7cfb
##view_group_common_emptyGroup = An empty group is always considered as mixed.
+##view_group_detail_explicitAvail = Group availability for explicit members (does not include recursive members).
view_group_detail_failLoad = \u52a0\u8f7d\u7ec4ID\u4e3a[{0}]\u7684\u7ec4\u4fe1\u606f\u5931\u8d25
-view_group_detail_failLoadComp = Group with id [{0}] does not exist or is not accessible
+##view_group_detail_failLoadComp = Group with id [{0}] does not exist or is not accessible
view_group_detail_failRecursiveChange = \u4fee\u6539\u7ec4[{0}]\u7684\u9012\u5f52\u8bbe\u7f6e\u5931\u8d25
+view_group_detail_implicitAvail = Group availability for all members (includes recursive members).
view_group_detail_recursiveChange = \u6210\u529f\u7684\u4fee\u6539\u7ec4[{0}]\u7684\u9012\u5f52\u8bbe\u7f6e
view_group_inventory_activity_no_recent_metrics = \u6b64\u7ec4\u6ca1\u6709\u6700\u65b0\u516c\u544a
view_group_meas_schedules_title = \u7ec4\u6307\u6807\u96c6\u8ba1\u5212\u4efb\u52a1
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 6826162..81edc82 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
@@ -24,7 +24,6 @@ import java.util.Date;
import java.util.List;
import java.util.Random;
-import javax.persistence.EntityManager;
import javax.persistence.Query;
import javax.transaction.Status;
@@ -44,6 +43,8 @@ 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.group.ResourceGroup;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupAvailability;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite.GroupAvailabilityType;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.server.measurement.AvailabilityManagerLocal;
import org.rhq.enterprise.server.measurement.AvailabilityPoint;
@@ -51,6 +52,7 @@ import org.rhq.enterprise.server.resource.ResourceAvailabilityManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.test.TestServerPluginService;
+import org.rhq.enterprise.server.test.TransactionCallback;
import org.rhq.enterprise.server.test.TransactionCallbackReturnable;
import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.enterprise.server.util.SessionTestHelper;
@@ -270,6 +272,262 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
}
@Test(enabled = ENABLE_TESTS)
+ public void testGetResourceAvailabilities() throws Exception {
+
+ executeInTransaction(false, new TransactionCallback() {
+ public void execute() throws Exception {
+ setupResource();
+ }
+ });
+ // platform: UNKNOWN(0) -->
+
+ Availability avail;
+ List<Availability> avails;
+ long now = System.currentTimeMillis();
+
+ AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
+
+ avails = availabilityManager.getAvailabilitiesForResource(overlord, theResource.getId(), 1, now);
+ assert avails.size() == 1 : "Should only be initial unknown avail data";
+ assert avails.get(0).getAvailabilityType() == UNKNOWN;
+ assert avails.get(0).getStartTime().equals(1L);
+ assert avails.get(0).getEndTime().equals(now);
+
+ Long startMillis = 60000L;
+ avail = new Availability(theResource, startMillis, UP);
+ report.addAvailability(avail);
+ availabilityManager.mergeAvailabilityReport(report);
+ // platform: UNKNOWN(0) --> UP(60000) -->
+
+ avails = availabilityManager.getAvailabilitiesForResource(overlord, theResource.getId(), 30000L,
+ startMillis + 10000);
+ assertEquals("Range should cover both avails", 2, avails.size());
+ assert avails.get(0).getAvailabilityType() == UNKNOWN;
+ assert avails.get(0).getStartTime().equals(30000L);
+ assert avails.get(0).getEndTime().equals(60000L);
+ assert avails.get(1).getAvailabilityType() == UP;
+ assert avails.get(1).getStartTime().equals(60000L);
+ assert avails.get(1).getEndTime().equals(startMillis + 10000);
+
+ avails = availabilityManager.getAvailabilitiesForResource(overlord, theResource.getId(), startMillis,
+ startMillis + 10000);
+ assertEquals("Range start on avail start border and extending to future", 1, avails.size());
+ assert avails.get(0).getAvailabilityType() == UP;
+ assert avails.get(0).getStartTime().equals(startMillis);
+ assert avails.get(0).getEndTime().equals(startMillis + 10000);
+
+ avails = availabilityManager.getAvailabilitiesForResource(overlord, theResource.getId(), 1000L,
+ startMillis - 10000);
+ assertEquals("Range completely in first avail", 1, avails.size());
+ assert avails.get(0).getAvailabilityType() == UNKNOWN;
+ assert avails.get(0).getStartTime().equals(1000L);
+ assert avails.get(0).getEndTime().equals(startMillis - 10000);
+
+ avails = availabilityManager.getAvailabilitiesForResource(overlord, theResource.getId(), startMillis + 5000,
+ startMillis + 10000);
+ assertEquals("Range completely in last avail", 1, avails.size());
+ assert avails.get(0).getAvailabilityType() == UP;
+ assert avails.get(0).getStartTime().equals(startMillis + 5000);
+ assert avails.get(0).getEndTime().equals(startMillis + 10000);
+
+ report = new AvailabilityReport(false, theAgent.getName()); // 70000
+ report.setEnablementReport(true); // simulate a real disable
+ report.addAvailability(new Availability(theResource, (startMillis + 10000L), DISABLED));
+ availabilityManager.mergeAvailabilityReport(report);
+ // UNKNOWN(0) --> UP(60000) --> DISABLED(70000) -->
+
+ // before setting other avails, must end disable with enablement report to unknown
+ report = new AvailabilityReport(false, theAgent.getName()); // 75000
+ report.setEnablementReport(true);
+ report.addAvailability(new Availability(theResource, (startMillis + 15000L), UNKNOWN));
+ availabilityManager.mergeAvailabilityReport(report);
+ // UNKNOWN(0) --> UP(60000) --> DISABLED(70000) --> UNKNOWN(75000) -->
+
+ report = new AvailabilityReport(false, theAgent.getName()); // 80000
+ report.addAvailability(new Availability(theResource, (startMillis + 20000L), UP));
+ availabilityManager.mergeAvailabilityReport(report);
+ // UNKNOWN(0) --> UP(60000) --> DISABLED(70000) --> UNKNOWN(75000) --> UP(80000)
+
+ report = new AvailabilityReport(false, theAgent.getName()); // 90000
+ report.addAvailability(new Availability(theResource, (startMillis + 30000L), DOWN));
+ availabilityManager.mergeAvailabilityReport(report);
+ // UNKNOWN(0) --> UP(60000) --> DISABLED(70000) --> UNKNOWN(75000) --> UP(80000) --> DOWN(90000) -->
+
+ avails = availabilityManager.getAvailabilitiesForResource(overlord, theResource.getId(), startMillis - 15000,
+ startMillis + 35000);
+ assertEquals("Range should cover 45000 - 95000", 6, avails.size());
+ assert avails.get(0).getAvailabilityType() == UNKNOWN;
+ assert avails.get(0).getStartTime().equals(45000L);
+ assert avails.get(0).getEndTime().equals(60000L);
+ assert avails.get(1).getAvailabilityType() == UP;
+ assert avails.get(1).getStartTime().equals(60000L);
+ assert avails.get(1).getEndTime().equals(70000L);
+ assert avails.get(2).getAvailabilityType() == DISABLED;
+ assert avails.get(2).getStartTime().equals(70000L);
+ assert avails.get(2).getEndTime().equals(75000L);
+ assert avails.get(3).getAvailabilityType() == UNKNOWN;
+ assert avails.get(3).getStartTime().equals(75000L);
+ assert avails.get(3).getEndTime().equals(80000L);
+ assert avails.get(4).getAvailabilityType() == UP;
+ assert avails.get(4).getStartTime().equals(80000L);
+ assert avails.get(4).getEndTime().equals(90000L);
+ assert avails.get(5).getAvailabilityType() == DOWN;
+ assert avails.get(5).getStartTime().equals(90000L);
+ assert avails.get(5).getEndTime().equals(95000L);
+ }
+
+ @Test(enabled = ENABLE_TESTS)
+ public void testGetResourceAvailabilities_2() throws Exception {
+
+ executeInTransaction(false, new TransactionCallback() {
+ public void execute() throws Exception {
+ setupResource();
+ }
+ });
+ // platform: UNKNOWN(0) -->
+
+ Availability avail;
+ List<Availability> avails;
+ long now = System.currentTimeMillis();
+
+ AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
+
+ avails = availabilityManager.getAvailabilitiesForResource(overlord, theResource.getId(), 1, now);
+ assert avails.size() == 1 : "Should only be initial unknown avail data";
+ assert avails.get(0).getAvailabilityType() == UNKNOWN;
+ assert avails.get(0).getStartTime().equals(1L);
+ assert avails.get(0).getEndTime().equals(now);
+
+ Long startMillis = 60000L;
+ avail = new Availability(theResource, startMillis, UP);
+ report.addAvailability(avail);
+ availabilityManager.mergeAvailabilityReport(report);
+ // platform: UNKNOWN(0) --> UP(60000) -->
+
+ avails = availabilityManager.getAvailabilitiesForResource(overlord, theResource.getId(), 30000L,
+ startMillis + 10000);
+ assertEquals("Range should cover both avails", 2, avails.size());
+ assert avails.get(0).getAvailabilityType() == UNKNOWN;
+ assert avails.get(0).getStartTime().equals(30000L);
+ assert avails.get(0).getEndTime().equals(60000L);
+ assert avails.get(1).getAvailabilityType() == UP;
+ assert avails.get(1).getStartTime().equals(60000L);
+ assert avails.get(1).getEndTime().equals(startMillis + 10000);
+
+ // purge away all but the most recent avail
+ availabilityManager.purgeAvailabilities(System.currentTimeMillis());
+ // platform: UP(60000) -->
+
+ avails = availabilityManager.getAvailabilitiesForResource(overlord, theResource.getId(), 10000L, 20000L);
+ assertEquals("all surrogate", 1, avails.size());
+ assert avails.get(0).getAvailabilityType() == UNKNOWN;
+ assert avails.get(0).getStartTime().equals(10000L);
+ assert avails.get(0).getEndTime().equals(20000L);
+
+ avails = availabilityManager.getAvailabilitiesForResource(overlord, theResource.getId(), 50000L, 70000L);
+ assertEquals("surrogate to start and then real avail", 2, avails.size());
+ assert avails.get(0).getAvailabilityType() == UNKNOWN;
+ assert avails.get(0).getStartTime().equals(50000L);
+ assert avails.get(0).getEndTime().equals(60000L);
+ assert avails.get(1).getAvailabilityType() == UP;
+ assert avails.get(1).getStartTime().equals(60000L);
+ assert avails.get(1).getEndTime().equals(70000L);
+ }
+
+ @Test(enabled = ENABLE_TESTS)
+ public void testGetResourceGroupAvailabilities() throws Exception {
+
+ executeInTransaction(false, new TransactionCallback() {
+ public void execute() throws Exception {
+ setupResource();
+ setupAnotherResource(1, theResource);
+ setupAnotherResource(2, theResource);
+ }
+ });
+
+ // Create some various group availability situations:
+ // T: 0 10000 20000 30000 40000
+ // R1: UNKNOWN DOWN UP
+ // R2: UNKNOWN DOWN UP
+ // R3: UNKNOWN DOWN UP DISABLED
+ // ----------------------------------------------------------
+ // AV: WARN DOWN WARN UP DISABLED
+
+ final Resource r1 = theResource;
+ final Resource r2 = additionalResources.get(0);
+ final Resource r3 = additionalResources.get(1);
+
+ AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
+
+ report.addAvailability(new Availability(r1, 10000L, DOWN));
+ report.addAvailability(new Availability(r2, 10000L, DOWN));
+ report.addAvailability(new Availability(r3, 10000L, DOWN));
+ report.addAvailability(new Availability(r1, 20000L, UP));
+ report.addAvailability(new Availability(r2, 20000L, UP));
+ report.addAvailability(new Availability(r3, 30000L, UP));
+ report.addAvailability(new Availability(r3, 40000L, DISABLED));
+ availabilityManager.mergeAvailabilityReport(report);
+
+ executeInTransaction(new TransactionCallback() {
+ public void execute() throws Exception {
+ // Create the test group
+ final Subject subject = SessionTestHelper.createNewSubject(em, "testSubject");
+ final Role roleWithSubject = SessionTestHelper
+ .createNewRoleForSubject(em, subject, "role with subject");
+ roleWithSubject.addPermission(Permission.VIEW_RESOURCE);
+ ResourceGroup group = SessionTestHelper.createNewCompatibleGroupForRole(em, roleWithSubject,
+ "accessible group");
+
+ // before adding resources check for EMPTY
+ List<ResourceGroupAvailability> avails;
+ int groupId = group.getId();
+ avails = availabilityManager.getAvailabilitiesForResourceGroup(overlord, groupId, 0, 20000L);
+ assertEquals("Should have 1 EMPTY rgAvail", 1, avails.size());
+ assertEquals("Should have 1 EMPTY rgAvail", GroupAvailabilityType.EMPTY, avails.get(0)
+ .getGroupAvailabilityType());
+ assertEquals("Should cover whole range", 0L, avails.get(0).getStartTime().longValue());
+ assertEquals("Should cover whole range", 20000L, avails.get(0).getEndTime().longValue());
+
+ // add the resources to the group
+ group.addExplicitResource(r1);
+ group.addExplicitResource(r2);
+ group.addExplicitResource(r3);
+ em.merge(group);
+ em.flush();
+
+ avails = availabilityManager.getAvailabilitiesForResourceGroup(overlord, groupId, 5000L, 50000);
+ assertEquals("Should have initial avail + 4 changes", 5, avails.size());
+ assertEquals("AV0 WARN 5000-10000", GroupAvailabilityType.WARN, avails.get(0)
+ .getGroupAvailabilityType());
+ assertEquals("AV0 WARN 5000-10000", 5000L, avails.get(0).getStartTime().longValue());
+ assertEquals("AV0 WARN 5000-10000", 10000L, avails.get(0).getEndTime().longValue());
+
+ assertEquals("AV1 DOWN 10000-20000", GroupAvailabilityType.DOWN, avails.get(1)
+ .getGroupAvailabilityType());
+ assertEquals("AV1 DOWN 10000-20000", 10000L, avails.get(1).getStartTime().longValue());
+ assertEquals("AV1 DOWN 10000-20000", 20000L, avails.get(1).getEndTime().longValue());
+
+ assertEquals("AV2 WARN 20000-30000", GroupAvailabilityType.WARN, avails.get(2)
+ .getGroupAvailabilityType());
+ assertEquals("AV2 WARN 20000-30000", 20000L, avails.get(2).getStartTime().longValue());
+ assertEquals("AV2 WARN 20000-30000", 30000L, avails.get(2).getEndTime().longValue());
+
+ assertEquals("AV3 DISABLED 30000-40000", GroupAvailabilityType.UP, avails.get(3)
+ .getGroupAvailabilityType());
+ assertEquals("AV3 DISABLED 30000-40000", 30000L, avails.get(3).getStartTime().longValue());
+ assertEquals("AV3 DISABLED 30000-40000", 40000L, avails.get(3).getEndTime().longValue());
+
+ assertEquals("AV4 DISABLED 40000-50000", GroupAvailabilityType.DISABLED, avails.get(4)
+ .getGroupAvailabilityType());
+ assertEquals("AV4 DISABLED 40000-50000", 40000L, avails.get(4).getStartTime().longValue());
+ assertEquals("AV4 DISABLED 40000-50000", 50000L, avails.get(4).getEndTime().longValue());
+ }
+ });
+ }
+
+ @Test(enabled = ENABLE_TESTS)
+ @Deprecated
+ // tests deprecated method
public void testGetAvailabilities() throws Exception {
beginTx();
@@ -847,68 +1105,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
}
}
- @Test(enabled = false)
- public void testAgentCurrentGroupAvailability() throws Exception {
- beginTx();
-
- try {
- setupResource(); // inserts initial UNKNOWN Availability at epoch
- commitAndClose();
-
- Availability avail;
- long now = System.currentTimeMillis();
-
- //initialize availabilty to up
- avail = new Availability(theResource, UP);
- AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
- report.addAvailability(avail);
- availabilityManager.mergeAvailabilityReport(report);
-
- //verify resource's availabilty is up.
- List<AvailabilityPoint> list = availabilityManager.findAvailabilitiesForResource(overlord,
- theResource.getId(), 0, now, 1, true);
- AvailabilityType returnedAvail = list.get(0).getAvailabilityType();
- assert returnedAvail == UP : "Expected current avail to be '" + UP + "' but was '" + returnedAvail + "'.";
-
- //add this resource to a group
- getTransactionManager().begin();
- EntityManager entityMgr = getEntityManager();
- final Subject subject = SessionTestHelper.createNewSubject(entityMgr, "testSubject");
-
- Role roleWithSubject = SessionTestHelper.createNewRoleForSubject(entityMgr, subject, "role with subject");
- roleWithSubject.addPermission(Permission.VIEW_RESOURCE);
-
- ResourceGroup theGroup = SessionTestHelper.createNewCompatibleGroupForRole(entityMgr, roleWithSubject,
- "accessible group");
-
- //explicitly add resource to group
- theGroup.addExplicitResource(theResource);
- entityMgr.merge(theGroup);
-
- //test that group member size is one
- int groupSize = theGroup.getExplicitResources().size();
- assert groupSize == 1 : "Group membership count incorrect. Expected '1' but was '" + groupSize + "'";
- Resource theGroupMember = null;
- for (Resource r : theGroup.getExplicitResources()) {
- theGroupMember = r;
- }
-
- //test group avail
- long rightNow = System.currentTimeMillis();
- list = availabilityManager.findAvailabilitiesForResourceGroup(overlord, theGroup.getId(), 0, rightNow, 1,
- true);
- returnedAvail = list.get(0).getAvailabilityType();
- assert returnedAvail == UP : "Expected current avail to be '" + UP + "' but was '" + returnedAvail + "'.";
- } catch (Exception e) {
- e.printStackTrace();
- throw e;
- } finally {
- if (Status.STATUS_ACTIVE == getTransactionManager().getStatus()) {
- getTransactionManager().rollback();
- }
- }
- }
-
@Test(enabled = ENABLE_TESTS)
public void testAgentOldReport2() throws Exception {
beginTx();
@@ -968,6 +1164,8 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
}
@Test(enabled = ENABLE_TESTS)
+ @Deprecated
+ // tests deprecated method
public void testGetAvailabilities2() throws Exception {
beginTx();
@@ -1573,7 +1771,10 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
theResourceType);
newResource.setUuid("" + new Random().nextInt());
newResource.setAgent(theAgent);
- parentResource.addChildResource(newResource);
+ newResource.setInventoryStatus(InventoryStatus.COMMITTED);
+ if (null != parentResource) {
+ parentResource.addChildResource(newResource);
+ }
em.persist(newResource);
additionalResources.add(newResource);
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 0181d7a..582ec69 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
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.measurement;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
+import java.util.Iterator;
import java.util.List;
import javax.ejb.EJB;
@@ -48,7 +49,9 @@ import org.rhq.core.domain.measurement.ResourceAvailability;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.composite.ResourceIdWithAvailabilityComposite;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupAvailability;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
+import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite.GroupAvailabilityType;
import org.rhq.core.domain.server.PersistenceUtility;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
@@ -155,6 +158,203 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
return retAvailability;
}
+ @Override
+ public List<Availability> getAvailabilitiesForResource(Subject subject, int resourceId, long startTime, long endTime) {
+
+ if (!authorizationManager.canViewResource(subject, resourceId)) {
+ throw new PermissionException("User [" + subject.getName() + "] does not have permission to view ["
+ + resourceId + "]");
+ }
+
+ List<Availability> result;
+ Date startDate = new Date(startTime);
+ Date endDate = new Date(endTime);
+
+ AvailabilityCriteria c = new AvailabilityCriteria();
+ c.addFilterResourceId(resourceId);
+ c.addFilterInterval(startTime, endTime); // reduce by 1 ms to fake exclusive end time on the range.
+ c.addSortStartTime(PageOrdering.ASC);
+ result = findAvailabilityByCriteria(subject, c);
+
+ // The criteria interval filter is inclusive. But since availN(endTime) == availN+1(startTime) we can get
+ // unwanted avails in the query result, when the range falls on an avail border.
+ // For example, assume the following three Availability records exist:
+ // AV-1 [0..100]
+ // AV-2 [100..200]
+ // AV-3 [200..300]
+ //
+ // If we happen to query for startTime=100 and endTime=200 we'll end up with 3 avails in the result:
+ // Result = { AV-1 [0..100], AV-2 [100..200], AV-3 [200..300] }. We really only want AV-2 [100..200] because
+ // the other two end up having 0 length, |100..100| and |200..200|.
+ //
+ // Remove any unwanted entries.
+ for (Iterator<Availability> i = result.iterator(); i.hasNext();) {
+ Availability av = i.next();
+ if ((null != av.getEndTime() && av.getEndTime().equals(startTime) || av.getStartTime().equals(endTime))) {
+ i.remove();
+ }
+ }
+
+ // Check if the availabilities obtained cover the startTime of the range.
+ // If not, we need to provide a "surrogate" for the beginning interval. The availabilities
+ // obtained from the DB are sorted in ascending order of time. So we can insert one
+ // pseudo-availability in front of the list if needed. Note that due to avail purging
+ // we can end up with periods without avail data. The surrogate will be for type UNKNOWN.
+ if (result.size() > 0) {
+ Availability firstAvailability = result.get(0);
+ if (firstAvailability.getStartTime() > startDate.getTime()) {
+ Availability surrogateAvailability = new Availability(firstAvailability.getResource(),
+ startDate.getTime(), AvailabilityType.UNKNOWN);
+ surrogateAvailability.setEndTime(firstAvailability.getStartTime());
+ result.add(0, surrogateAvailability); // add at the head of the list
+ }
+ } else {
+ Resource surrogateResource = entityManager.find(Resource.class, resourceId);
+ Availability surrogateAvailability = new Availability(surrogateResource, startDate.getTime(),
+ AvailabilityType.UNKNOWN);
+ surrogateAvailability.setEndTime(endDate.getTime());
+ result.add(surrogateAvailability); // add as the only element, covering the entire interval
+ }
+
+ // Now, limit the Availability ranges to the desired range. Detach the entities prior to to the update so
+ // the value changes are not propagated to the DB.
+ entityManager.detach(result.get(0));
+ if (result.size() > 1) {
+ entityManager.detach(result.get(result.size() - 1));
+ }
+ result.get(0).setStartTime(startDate.getTime());
+ result.get(result.size() - 1).setEndTime(endDate.getTime());
+
+ return result;
+ }
+
+ @Override
+ public List<ResourceGroupAvailability> getAvailabilitiesForResourceGroup(Subject subject, int groupId,
+ long startTime, long endTime) {
+
+ if (!authorizationManager.canViewGroup(subject, groupId)) {
+ throw new PermissionException("User [" + subject.getName() + "] does not have permission to view ["
+ + groupId + "]");
+ }
+
+ List<ResourceGroupAvailability> result = new ArrayList<ResourceGroupAvailability>();
+ Date startDate = new Date(startTime);
+ Date endDate = new Date(endTime);
+
+ // all avails for all explicit resources for the time range, ordered by asc startTime
+ List<Availability> allAvailabilities = findResourceGroupAvailabilityWithinInterval(groupId, startDate, endDate);
+
+ // If we have no availabilities we need to return a single group avail, either EMPTY or WARN (all UNKNOWN)
+ if (allAvailabilities.isEmpty()) {
+ ResourceGroupAvailability groupAvail = new ResourceGroupAvailability(groupId);
+ groupAvail.setStartTime(startTime);
+ groupAvail.setEndTime(endTime);
+ int explicitMemberCount = resourceGroupManager.getExplicitGroupMemberCount(groupId);
+ groupAvail.setGroupAvailabilityType((0 == explicitMemberCount) ? GroupAvailabilityType.EMPTY
+ : GroupAvailabilityType.WARN);
+ result.add(groupAvail);
+
+ return result;
+ }
+
+ // OK, let's try and explain explain what we are doing here. The goal is to have a continuous set of intervals
+ // extending from startTime to endTime showing all changes in group avail. Each avail change for any member
+ // could signify a change in the overall group avail. We must first establish the initial group avail and
+ // then walk forward, checking for changes at each resource avail startTime for a group member.
+ // One subtlety is that group membership can change over time. We don't track when resources come and go, we
+ // are dealing with the avails for the *current* explicit members. So, we'll only work with the avails we have
+ // and not worry about missing avails at any given time. In other words, no "surrogate" UNKNOWN avail insertion.
+
+ // OK, calculate the initial group avail
+ Long atTime = startTime;
+ int atTimeIndex = 0;
+ ResourceGroupAvailability currentGroupAvail = null;
+ int size = allAvailabilities.size();
+
+ do {
+ GroupAvailabilityType groupAvailTypeAtTime = getGroupAvailabilityType(atTime, allAvailabilities);
+
+ // if this is a change in group avail type then add it to the result
+ if (null == currentGroupAvail || currentGroupAvail.getGroupAvailabilityType() != groupAvailTypeAtTime) {
+ if (null != currentGroupAvail) {
+ currentGroupAvail.setEndTime(atTime);
+ }
+
+ // leave endTime unset, we don't know endTime until we know the next startTime, or are done
+ currentGroupAvail = new ResourceGroupAvailability(groupId);
+ currentGroupAvail.setStartTime(atTime);
+ currentGroupAvail.setGroupAvailabilityType(groupAvailTypeAtTime);
+ result.add(currentGroupAvail);
+ }
+
+ // move atTime to the next possible startTime
+ while (atTimeIndex < size && allAvailabilities.get(atTimeIndex).getStartTime() <= atTime) {
+ ++atTimeIndex;
+ }
+
+ if (atTimeIndex < size) {
+ atTime = allAvailabilities.get(atTimeIndex).getStartTime();
+ }
+
+ } while (atTimeIndex < size);
+
+ currentGroupAvail.setEndTime(endTime);
+
+ return result;
+ }
+
+ private GroupAvailabilityType getGroupAvailabilityType(long atTime, List<Availability> allAvailabilities) {
+
+ long count = 0;
+ long disabled = 0;
+ long down = 0;
+ long unknown = 0;
+ long up = 0;
+
+ for (Availability av : allAvailabilities) {
+ // if the Avail straddles startTime (startTime inclusive, endTime exclusive) then it is relevant.
+ // EndTime is exclusive because Avail(N).endTime=Avail(N+1).startTime and we don't want to consider
+ // two records. The relevant availType is the one starting, not ending at atTime.
+ Long startTime = av.getStartTime();
+ Long endTime = av.getEndTime();
+ if (startTime <= atTime && (null == endTime || endTime > atTime)) {
+ ++count;
+ switch (av.getAvailabilityType()) {
+ case UP:
+ ++up;
+ break;
+ case DOWN:
+ ++down;
+ break;
+ case UNKNOWN:
+ ++unknown;
+ break;
+ case DISABLED:
+ ++disabled;
+ break;
+ }
+ }
+ }
+
+ if (0 == count) {
+ return GroupAvailabilityType.EMPTY;
+ }
+
+ if (down == count) {
+ return GroupAvailabilityType.DOWN;
+ }
+
+ if (down > 0 || unknown > 0) {
+ return GroupAvailabilityType.WARN;
+ }
+
+ if (disabled > 0) {
+ return GroupAvailabilityType.DISABLED;
+ }
+
+ return GroupAvailabilityType.UP;
+ }
+
public List<AvailabilityPoint> findAvailabilitiesForResource(Subject subject, int resourceId,
long fullRangeBeginTime, long fullRangeEndTime, int numberOfPoints, boolean withCurrentAvailability) {
EntityContext context = new EntityContext(resourceId, -1, -1, -1);
@@ -1015,6 +1215,9 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
return result;
}
+ /**
+ * @return all avails for all member resources for the specified interval, ordered by asc startTime
+ */
@SuppressWarnings("unchecked")
private List<Availability> findResourceGroupAvailabilityWithinInterval(int groupId, Date startDate, Date endDate) {
Query q = entityManager.createNamedQuery(Availability.FIND_FOR_RESOURCE_GROUP_WITHIN_INTERVAL);
@@ -1073,4 +1276,5 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa
log.debug(callingMethod + ": " + stats.toString());
}
}
+
}
\ No newline at end of file
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 ed15c17..613b423 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.core.domain.resource.group.composite.ResourceGroupAvailability;
import org.rhq.enterprise.server.measurement.AvailabilityManagerBean.MergeInfo;
/**
@@ -59,6 +60,32 @@ public interface AvailabilityManagerLocal extends AvailabilityManagerRemote {
AvailabilityType getCurrentAvailabilityTypeForResource(Subject subject, int resourceId);
/**
+ * Get Availability records for a resource covering the desired time span.
+ *
+ * @param subject
+ * @param resourceId The relevant resource
+ * @param startTime If start time precedes recorded availability UNKNOWN will be used to fill the gap
+ * @param endTime If end time is in the future the current Availability will be extended to fill the gap
+ *
+ * @return the availabilities over the given time span, in increasing time order
+ */
+ List<Availability> getAvailabilitiesForResource(Subject subject, int resourceId, long startTime, long endTime);
+
+ /**
+ * Get ResourceGroupAvailability records for a resource group covering the desired time span. See
+ * {@link ResourceGroupAvailability} for more on how group availability is calculated.
+ *
+ * @param subject
+ * @param resourceGroupId The relevant resource group
+ * @param startTime If start time precedes recorded availability UNKNOWN will be used to fill the gap
+ * @param endTime If end time is in the future the current Availability will be extended to fill the gap
+ *
+ * @return the resource group availabilities over the given time span, in increasing time order
+ */
+ List<ResourceGroupAvailability> getAvailabilitiesForResourceGroup(Subject subject, int resourceGroupId,
+ long startTime, long endTime);
+
+ /**
* Get the individual availability data points for the given resource.
*
* @param subject
@@ -70,6 +97,7 @@ public interface AvailabilityManagerLocal extends AvailabilityManagerRemote {
* availability no matter what
*
* @return the availabilities over the given time span in a list
+ * @deprecated going away with portal war removal
*/
List<AvailabilityPoint> findAvailabilitiesForResource(Subject subject, int resourceId, long begin, long end,
int points, boolean withCurrentAvailability);
@@ -86,6 +114,7 @@ public interface AvailabilityManagerLocal extends AvailabilityManagerRemote {
* availability no matter what
*
* @return the availabilities over the given time span in a list
+ * @deprecated going away with portal war removal
*/
List<AvailabilityPoint> findAvailabilitiesForResourceGroup(Subject subject, int groupId, long begin, long end,
int points, boolean withCurrentAvailability);
@@ -103,6 +132,7 @@ public interface AvailabilityManagerLocal extends AvailabilityManagerRemote {
* availability no matter what
*
* @return the availabilities over the given time span in a list
+ * @deprecated going away with portal war removal
*/
List<AvailabilityPoint> findAvailabilitiesForAutoGroup(Subject subject, int parentResourceId, int resourceTypeId,
long begin, long end, int points, boolean withCurrentAvailability);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityPoint.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityPoint.java
index a7075c4..b5d9326 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityPoint.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityPoint.java
@@ -31,6 +31,7 @@ import org.rhq.core.domain.measurement.AvailabilityType;
*
* @author Heiko W. Rupp
* @author John Mazzitelli
+ * @deprecated going away with portal war removal.
*/
public class AvailabilityPoint implements Serializable {
private static final long serialVersionUID = 1L;
commit 87a83670d65ddfdb25b188b7ed674a3472543926
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 18 11:07:08 2013 -0400
remove old JPA lib
diff --git a/.classpath b/.classpath
index 434e811..d35bf95 100644
--- a/.classpath
+++ b/.classpath
@@ -220,7 +220,6 @@
<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"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar" sourcepath="/M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar" sourcepath="/M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-jmx/4.2.3.GA/jboss-jmx-4.2.3.GA.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/tomcat/catalina/5.5.20/catalina-5.5.20.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar"/>
commit c317c173dac2515ce2a3207dfb952b06668d4eea
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Mon Mar 18 12:22:39 2013 -0400
[BZ 922791] fix the creation of the self-signed cert. Also, make sure we have a truststore, otherwise, the https connector will not install (this supports external AS7 installations)
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 e72f133..98131a4 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
@@ -279,7 +279,8 @@ public class InstallerServiceImpl implements InstallerService {
ServerInstallUtil.configureLogging(mcc, serverProperties);
// create a keystore whose cert has a CN of this server's public endpoint address
- File keystoreFile = ServerInstallUtil.createKeystore(serverDetails, appServerConfigDir);
+ File keystoreFile = ServerInstallUtil.createKeystore(serverDetails != null ? serverDetails
+ : getServerDetailsFromPropertiesOnly(serverProperties), appServerConfigDir);
// make sure all necessary web connectors are configured
ServerInstallUtil.setupWebConnectors(mcc, appServerConfigDir, serverProperties);
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
index ca32ef0..bf4255f 100644
--- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
+++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/ServerInstallUtil.java
@@ -68,6 +68,7 @@ import org.rhq.core.db.PostgresqlDatabaseType;
import org.rhq.core.db.setup.DBSetup;
import org.rhq.core.util.PropertiesFileUpdate;
import org.rhq.core.util.exception.ThrowableUtil;
+import org.rhq.core.util.file.FileUtil;
import org.rhq.core.util.stream.StreamUtil;
import org.rhq.enterprise.communications.util.SecurityUtil;
@@ -1230,6 +1231,30 @@ public class ServerInstallUtil {
LOG.info("Creating https connector...");
ConnectorConfiguration connector = buildSecureConnectorConfiguration(configDirStr, serverProperties);
+
+ // verify that we have a truststore file - if user is relying on our self-signed certs, we'll have to create one for them
+ String truststoreFileString = connector.getSslConfiguration().getCaCertificateFile();
+ if (truststoreFileString == null) {
+ LOG.warn("Missing a valid truststore location - you must specify a valid truststore location!");
+ } else {
+ File truststoreFile = new File(truststoreFileString);
+ if (!truststoreFile.exists()) {
+ // user didn't provide a truststore file, copy the keystore and use it as the truststore; tell the user about this
+ File keystoreFile = new File(connector.getSslConfiguration().getCertificateKeyFile());
+ if (!keystoreFile.isFile()) {
+ LOG.warn("Missing both keystore [" + keystoreFile + "] and truststore [" + truststoreFile + "]");
+ } else {
+ LOG.warn("Missing the truststore [" + truststoreFile + "] - will copy the keystore ["
+ + keystoreFile + "] and make the copy the truststore.");
+ try {
+ FileUtil.copyFile(keystoreFile, truststoreFile);
+ } catch (Exception e) {
+ LOG.error("Failed to copy keystore to make truststore - a truststore still does not exist", e);
+ }
+ }
+ }
+ }
+
client.addConnector("https", connector);
LOG.info("https connector created.");
@@ -1342,7 +1367,7 @@ public class ServerInstallUtil {
/**
* Creates a keystore whose cert has a CN of this server's public endpoint address.
*
- * @param serverDetails details of the server being installed
+ * @param serverDetails details of the server being installed - must not be null and endpoint must be included in it
* @param configDirStr location of a configuration directory where the keystore is to be stored
* @return where the keystore file should be created (if an error occurs, this file won't exist)
*/
commit b61bd1a227440f52516b15e978a56ae27ed75607
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Mon Mar 18 08:08:20 2013 -0700
Fix summary resource measurements portlet as values are getting chopped off.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
index baf05ca..e3c45ec 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/dashboard/portlets/groups/GroupMetricsPortlet.java
@@ -421,6 +421,13 @@ public class GroupMetricsPortlet extends EnhancedVLayout implements CustomSettin
LinkItem oldLink = AbstractActivityView.newLinkItem("*",
destination);
oldLink.setTooltip("Link to Old Charts");
+ oldLink.setTitleVAlign(VerticalAlignment.TOP);
+ oldLink.setAlign(Alignment.LEFT);
+ oldLink.setClipValue(true);
+ oldLink.setWrap(true);
+ oldLink.setHeight(26);
+ oldLink.setWidth("100%");
+
oldLink.addClickHandler(new ClickHandler() {
@Override
public void onClick(ClickEvent event) {
@@ -438,10 +445,14 @@ public class GroupMetricsPortlet extends EnhancedVLayout implements CustomSettin
.convertLastValueForDisplay(lastValue, md);
StaticTextItem value = AbstractActivityView
.newTextItem(convertedValue);
+ value.setVAlign(VerticalAlignment.TOP);
+ value.setAlign(Alignment.RIGHT);
+ value.setWidth("100%");
row.setItems(graphContainer, link, oldLink, value);
+ row.setWidth100();
//if graph content returned
- if ((md.getName().trim().indexOf("Trait.") == -1)
+ if ((!md.getName().trim().contains("Trait."))
&& (lastValue != -1)) {
column.addMember(row);
someChartedData = true;
commit 755ea862750217ec1fa72e215a5b4b05f8678275
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Mon Mar 18 14:33:33 2013 +0100
[BZ 922687] - Enabling login on non-std SSL ports in non-interactive CLI
Added an overloaded method to be able to specify the transport used for
connection.
diff --git a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/Controller.java b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/Controller.java
index 1cd301e..7dec824 100644
--- a/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/Controller.java
+++ b/modules/enterprise/remoting/cli/src/main/java/org/rhq/enterprise/client/Controller.java
@@ -40,8 +40,12 @@ public class Controller {
}
public Subject login(String username, String password, String host, int port) throws Exception {
+ return login(username, password, host, port, null);
+ }
+
+ public Subject login(String username, String password, String host, int port, String transport) throws Exception {
LoginCommand cmd = (LoginCommand) client.getCommands().get("login");
- return cmd.execute(client, username, password, host, port, null);
+ return cmd.execute(client, username, password, host, port, transport);
}
public void logout() {
commit 14f3262d589f773918bae902f1783dc7b16f84a0
Author: Jeremie <jer(a)printstacktrace.org>
Date: Tue Mar 12 10:42:14 2013 +0100
Bug 919248 - RFE: Provide a metric of the time elapsed since the last build
tsegismont on behalf of jeremie (@fedorahosted)
diff --git a/modules/plugins/hudson/src/main/java/org/rhq/plugins/hudson/HudsonProjectComponent.java b/modules/plugins/hudson/src/main/java/org/rhq/plugins/hudson/HudsonProjectComponent.java
index 4a831a8..9a8d178 100644
--- a/modules/plugins/hudson/src/main/java/org/rhq/plugins/hudson/HudsonProjectComponent.java
+++ b/modules/plugins/hudson/src/main/java/org/rhq/plugins/hudson/HudsonProjectComponent.java
@@ -18,20 +18,25 @@
*/
package org.rhq.plugins.hudson;
+import java.util.Date;
+import java.util.Set;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;
-import org.rhq.core.domain.measurement.*;
+
+import org.rhq.core.domain.measurement.AvailabilityType;
+import org.rhq.core.domain.measurement.MeasurementDataNumeric;
+import org.rhq.core.domain.measurement.MeasurementDataTrait;
+import org.rhq.core.domain.measurement.MeasurementReport;
+import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.pluginapi.measurement.MeasurementFacet;
-import java.util.Date;
-import java.util.Set;
-
/**
* @author Greg Hinkle
*/
@@ -41,8 +46,8 @@ public class HudsonProjectComponent implements ResourceComponent<HudsonServerCom
private ResourceContext<HudsonServerComponent> resourceContext;
-
- public void start(ResourceContext<HudsonServerComponent> hudsonServerComponentResourceContext) throws InvalidPluginConfigurationException, Exception {
+ public void start(ResourceContext<HudsonServerComponent> hudsonServerComponentResourceContext)
+ throws InvalidPluginConfigurationException, Exception {
this.resourceContext = hudsonServerComponentResourceContext;
}
@@ -52,8 +57,8 @@ public class HudsonProjectComponent implements ResourceComponent<HudsonServerCom
public AvailabilityType getAvailability() {
try {
- JSONArray healthArray =
- this.resourceContext.getParentResourceComponent().getProjectHealth(this.resourceContext.getResourceKey());
+ JSONArray healthArray = this.resourceContext.getParentResourceComponent().getProjectHealth(
+ this.resourceContext.getResourceKey());
if (healthArray != null) {
JSONObject healthReport = healthArray.getJSONObject(0);
return (healthReport.getInt("score") == 100) ? AvailabilityType.UP : AvailabilityType.DOWN;
@@ -68,29 +73,42 @@ public class HudsonProjectComponent implements ResourceComponent<HudsonServerCom
public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
try {
+
String path = this.resourceContext.getResourceKey();
JSONObject job = HudsonJSONUtility.getData(path, 1);
- JSONObject lastSuccessfulBuild = job.getJSONObject("lastSuccessfulBuild");
- JSONObject lastBuild = job.getJSONObject("lastBuild");
- JSONArray healthArray = job.getJSONArray("healthReport");
- JSONObject healthReport = healthArray.getJSONObject(0);
+ JSONObject lastSuccessfulBuild = job.has("lastSuccessfulBuild") ? job.getJSONObject("lastSuccessfulBuild")
+ : null;
+ JSONObject lastBuild = job.has("lastBuild") ? job.getJSONObject("lastBuild") : null;
+ JSONArray healthArray = job.has("healthReport") ? job.getJSONArray("healthReport") : null;
+ JSONObject healthReport = (healthArray != null && healthArray.length() > 0) ? healthArray.getJSONObject(0)
+ : null;
+ long currentTime = System.currentTimeMillis();
for (MeasurementScheduleRequest request : metrics) {
try {
- if (request.getName().equals("lastSuccessfulBuildNumber")) {
+ if (request.getName().equals("lastSuccessfulBuildNumber") && lastSuccessfulBuild != null) {
report.addData(new MeasurementDataTrait(request, lastSuccessfulBuild.getString("number")));
- } else if (request.getName().equals("lastSuccessfulBuildTime")) {
- report.addData(new MeasurementDataTrait(request, new Date(lastSuccessfulBuild.getLong("timestamp")).toString()));
- } else if (request.getName().equals("lastBuildNumber")) {
+ } else if (request.getName().equals("lastSuccessfulBuildTime") && lastSuccessfulBuild != null) {
+ report.addData(new MeasurementDataTrait(request, new Date(lastSuccessfulBuild
+ .getLong("timestamp")).toString()));
+ } else if (request.getName().equals("lastSuccessfulBuildElapsedTime")
+ && lastSuccessfulBuild != null) {
+ report.addData(new MeasurementDataNumeric(request, (currentTime - lastSuccessfulBuild
+ .getLong("timestamp")) / 1000d));
+ } else if (request.getName().equals("lastBuildNumber") && lastBuild != null) {
report.addData(new MeasurementDataTrait(request, lastBuild.getString("number")));
- } else if (request.getName().equals("lastBuildTime")) {
- report.addData(new MeasurementDataTrait(request, new Date(lastBuild.getLong("timestamp")).toString()));
- } else if (request.getName().equals("lastBuildResult")) {
+ } else if (request.getName().equals("lastBuildTime") && lastBuild != null) {
+ report.addData(new MeasurementDataTrait(request, new Date(lastBuild.getLong("timestamp"))
+ .toString()));
+ } else if (request.getName().equals("lastBuildElapsedTime") && lastBuild != null) {
+ report.addData(new MeasurementDataNumeric(request, (currentTime - lastBuild
+ .getLong("timestamp")) / 1000d));
+ } else if (request.getName().equals("lastBuildResult") && lastBuild != null) {
report.addData(new MeasurementDataTrait(request, lastBuild.getString("result")));
- } else if (request.getName().equals("healthScore")) {
+ } else if (request.getName().equals("healthScore") && healthReport != null) {
report.addData(new MeasurementDataNumeric(request, healthReport.getDouble("score") / 100d));
- } else if (request.getName().equals("lastBuildDuration")) {
+ } else if (request.getName().equals("lastBuildDuration") && lastBuild != null) {
report.addData(new MeasurementDataNumeric(request, lastBuild.getDouble("duration")));
}
} catch (Exception e) {
diff --git a/modules/plugins/hudson/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/hudson/src/main/resources/META-INF/rhq-plugin.xml
index 472708e..3b88bb7 100644
--- a/modules/plugins/hudson/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/hudson/src/main/resources/META-INF/rhq-plugin.xml
@@ -22,17 +22,13 @@
class="HudsonProjectComponent">
<metric property="lastSuccessfulBuildNumber" dataType="trait" displayType="summary"/>
-
<metric property="lastSuccessfulBuildTime" dataType="trait" units="epoch_milliseconds"/>
-
+ <metric property="lastSuccessfulBuildElapsedTime" units="seconds"/>
<metric property="lastBuildNumber" dataType="trait"/>
<metric property="lastBuildTime" dataType="trait" units="epoch_milliseconds"/>
-
-
+ <metric property="lastBuildElapsedTime" units="seconds"/>
<metric property="lastBuildResult" dataType="trait" displayType="summary"/>
-
<metric property="healthScore" units="percentage" displayType="summary"/>
-
<metric property="lastBuildDuration" units="milliseconds" displayType="summary"/>
</service>
commit b5ae59fea861de9917a5390f23cf6a161c256d11
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Mon Mar 18 13:04:22 2013 +0100
itests for SavedSearchManagerBean
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/search/SavedSearchManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/search/SavedSearchManagerBeanTest.java
new file mode 100644
index 0000000..09ddaeb
--- /dev/null
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/search/SavedSearchManagerBeanTest.java
@@ -0,0 +1,192 @@
+/*
+ * 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.enterprise.server.search;
+
+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.SavedSearchCriteria;
+import org.rhq.core.domain.search.SavedSearch;
+import org.rhq.core.domain.search.SearchSubsystem;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.server.authz.PermissionException;
+import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.test.TransactionCallback;
+import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.util.SessionTestHelper;
+
+/**
+ * @author Thomas Segismont
+ */
+public class SavedSearchManagerBeanTest extends AbstractEJB3Test {
+
+ private SavedSearchManagerLocal savedSearchManager;
+
+ @Override
+ protected void beforeMethod() throws Exception {
+ savedSearchManager = LookupUtil.getSavedSearchManager();
+ }
+
+ @Test
+ public void testCRUD() {
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ Subject subject = SessionTestHelper.createNewSubject(em, "fake subject");
+ int entityId = savedSearchManager.createSavedSearch(subject, new SavedSearch(SearchSubsystem.GROUP,
+ "fake saved search", "pipo", subject));
+ SavedSearch entity = savedSearchManager.getSavedSearchById(subject, entityId);
+ assertNotNull(entity);
+ SavedSearch modifiedEntity = new SavedSearch(SearchSubsystem.RESOURCE, "fake saved search modified",
+ "molo", subject);
+ modifiedEntity.setId(entityId);
+ boolean updateSuccess = savedSearchManager.updateSavedSearch(subject, modifiedEntity);
+ assertTrue("Update save searched failed", updateSuccess);
+ savedSearchManager.deleteSavedSearch(subject, entityId);
+ assertNull(em.find(SavedSearch.class, entityId));
+ }
+ });
+ }
+
+ @Test
+ public void testgetSavedSearchByIdPermission() {
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ Subject subject1 = SessionTestHelper.createNewSubject(em, "fake subject 1");
+ SavedSearch savedSearch = new SavedSearch(SearchSubsystem.GROUP, "fake saved search", "pipo", subject1);
+ int entityId = savedSearchManager.createSavedSearch(subject1, savedSearch);
+ Subject subject2 = SessionTestHelper.createNewSubject(em, "fake subject 2");
+ try {
+ savedSearchManager.getSavedSearchById(subject2, entityId);
+ fail("Expected " + PermissionException.class.getSimpleName());
+ } catch (PermissionException e) {
+ assertTrue(e.getMessage().contains("view"));
+ }
+ }
+ });
+ }
+
+ @Test
+ public void testCreateSavedSearchPermission() {
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ final Subject subject1 = SessionTestHelper.createNewSubject(em, "fake subject 1");
+ final Subject subject2 = SessionTestHelper.createNewSubject(em, "fake subject 2");
+ assertManipulatePermissionExceptionThrown(new Runnable() {
+ @Override
+ public void run() {
+ savedSearchManager.createSavedSearch(subject2, new SavedSearch(SearchSubsystem.GROUP,
+ "fake saved search 2", "molo", subject1));
+ }
+ });
+ }
+ });
+ }
+
+ @Test
+ public void testDeleteSavedSearchPermission() {
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ final Subject subject1 = SessionTestHelper.createNewSubject(em, "fake subject 1");
+ final int entityId = savedSearchManager.createSavedSearch(subject1, new SavedSearch(
+ SearchSubsystem.GROUP, "fake saved search", "pipo", subject1));
+ final Subject subject2 = SessionTestHelper.createNewSubject(em, "fake subject 2");
+ assertManipulatePermissionExceptionThrown(new Runnable() {
+ @Override
+ public void run() {
+ savedSearchManager.deleteSavedSearch(subject2, entityId);
+ }
+ });
+ }
+ });
+ }
+
+ @Test
+ public void testUpdateSavedSearchPermission() {
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ final Subject subject1 = SessionTestHelper.createNewSubject(em, "fake subject 1");
+ final int entityId = savedSearchManager.createSavedSearch(subject1, new SavedSearch(
+ SearchSubsystem.GROUP, "fake saved search", "pipo", subject1));
+ final Subject subject2 = SessionTestHelper.createNewSubject(em, "fake subject 2");
+ assertManipulatePermissionExceptionThrown(new Runnable() {
+ @Override
+ public void run() {
+ SavedSearch modifiedEntity = new SavedSearch(SearchSubsystem.GROUP, "fake saved search 2",
+ "molo", subject1);
+ modifiedEntity.setId(entityId);
+ savedSearchManager.updateSavedSearch(subject2, modifiedEntity);
+ }
+ });
+ }
+ });
+ }
+
+ private void assertManipulatePermissionExceptionThrown(Runnable runnable) {
+ try {
+ runnable.run();
+ fail("Expected " + PermissionException.class.getSimpleName());
+ } catch (PermissionException e) {
+ assertTrue(e.getMessage().contains("manipulate"));
+ }
+ }
+
+ @Test
+ public void testFindSavedSearchesByCriteria() {
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+
+ Subject subject1 = SessionTestHelper.createNewSubject(em, "fake subject 1");
+ Subject subject2 = SessionTestHelper.createNewSubject(em, "fake subject 2");
+ Role inventoryManagerRole = SessionTestHelper.createNewRoleForSubject(em, subject2,
+ "inventory manager role", Permission.MANAGE_INVENTORY);
+
+ for (int i = 0; i < 1000; i++) {
+ String iStr = String.valueOf(i);
+ savedSearchManager.createSavedSearch(subject1, new SavedSearch(SearchSubsystem.GROUP,
+ "fake saved search " + iStr, "pipo " + iStr, subject1));
+ savedSearchManager.createSavedSearch(subject2, new SavedSearch(SearchSubsystem.GROUP,
+ "fake saved search " + iStr, "molo " + iStr, subject2));
+ }
+
+ SavedSearchCriteria criteria = new SavedSearchCriteria();
+ criteria.addFilterName("fake saved search");
+ criteria.clearPaging();
+
+ PageList<SavedSearch> foundEntities = savedSearchManager
+ .findSavedSearchesByCriteria(subject2, criteria);
+ assertTrue("User with manage inventory should see all saved searches", 2000 == foundEntities.size());
+
+ foundEntities = savedSearchManager.findSavedSearchesByCriteria(subject1, criteria);
+ assertTrue("User without manage inventory should see only its own saved searches",
+ 1000 == foundEntities.size());
+
+ }
+ });
+ }
+}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java
index 5ebf6c8..646a24a 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/SavedSearchManagerBean.java
@@ -93,7 +93,6 @@ public class SavedSearchManagerBean implements SavedSearchManagerLocal /* local
public PageList<SavedSearch> findSavedSearchesByCriteria(Subject subject, SavedSearchCriteria criteria) {
CriteriaQueryGenerator generator = new CriteriaQueryGenerator(subject, criteria);
- ;
if (!authorizationManager.isInventoryManager(subject)) {
generator.setAuthorizationCustomConditionFragment("(subject.id=" + subject.getId() + " OR global=true)");
commit 59039d5abfe923fdb22f692fe747db583817de70
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Sat Mar 16 12:29:16 2013 -0700
Charting - Only graph OOB data if OOB data exists. Show hover data on avg to low segment as well.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
index f9fac26..c472a85 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/MetricStackedBarGraph.java
@@ -42,6 +42,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
console.log("Draw Stacked Bar jsni chart");
var global = this,
+ fontFamily = "'Liberation Sans', Arial, Helvetica, sans-serif",
// create a chartContext object (from rhq.js) with the data required to render to a chart
// this same data could be passed to different chart types
@@ -408,7 +409,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
.attr("class", "x axis")
.attr("transform", "translate(0," + height + ")")
.attr("font-size", "10px")
- .attr("font-family", "Arial, Verdana, sans-serif")
+ .attr("font-family", fontFamily)
.attr("letter-spacing", "3")
.style("text-anchor", "end")
.call(xAxis);
@@ -422,7 +423,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
.attr("transform", "rotate(-90),translate( -60,0)")
.attr("y", -30)
.attr("font-size", "10px")
- .attr("font-family", "Arial, Verdana, sans-serif")
+ .attr("font-family", fontFamily )
.attr("letter-spacing", "3")
.style("text-anchor", "end")
.text(chartContext.yAxisUnits === "NONE" ? "" : chartContext.yAxisUnits);
@@ -430,25 +431,9 @@ public final class MetricStackedBarGraph extends AbstractGraph {
}
function createAvgLines() {
- console.time("drawLines");
+ console.time("drawAvgLine");
- var minBaselineLine = $wnd.d3.svg.line()
- .interpolate(interpolation)
- .x(function (d) {
- return timeScale(d.x);
- })
- .y(function (d) {
- return yScale(d.baselineMin);
- }),
- maxBaselineLine = $wnd.d3.svg.line()
- .interpolate(interpolation)
- .x(function (d) {
- return timeScale(d.x);
- })
- .y(function (d) {
- return yScale(d.baselineMax);
- }),
- barAvgLine = $wnd.d3.svg.line()
+ var barAvgLine = $wnd.d3.svg.line()
.interpolate("linear")
.x(function (d) {
return timeScale(d.x)+ ((width / chartContext.data.length - barOffset)/ 2);
@@ -481,6 +466,37 @@ public final class MetricStackedBarGraph extends AbstractGraph {
}
});
+ // Bar avg line
+ svg.append("path")
+ .datum(chartContext.data)
+ .attr("class", "barAvgLine")
+ .attr("fill", "none")
+ .attr("stroke", "#2e376a")
+ .attr("stroke-width", "1.5")
+ .attr("stroke-opacity", ".7")
+ .attr("d", barAvgLine);
+
+ console.timeEnd("drawAvgLine");
+ }
+
+ function createOOBLines(){
+
+ var minBaselineLine = $wnd.d3.svg.line()
+ .interpolate(interpolation)
+ .x(function (d) {
+ return timeScale(d.x);
+ })
+ .y(function (d) {
+ return yScale(d.baselineMin);
+ }),
+ maxBaselineLine = $wnd.d3.svg.line()
+ .interpolate(interpolation)
+ .x(function (d) {
+ return timeScale(d.x);
+ })
+ .y(function (d) {
+ return yScale(d.baselineMax);
+ });
// min baseline Line
svg.append("path")
@@ -504,17 +520,6 @@ public final class MetricStackedBarGraph extends AbstractGraph {
.attr("stroke-opacity", ".7")
.attr("d", maxBaselineLine);
- // Bar avg line
- svg.append("path")
- .datum(chartContext.data)
- .attr("class", "barAvgLine")
- .attr("fill", "none")
- .attr("stroke", "#2e376a")
- .attr("stroke-width", "1.5")
- .attr("stroke-opacity", ".7")
- .attr("d", barAvgLine);
-
- console.timeEnd("drawLines");
}
function formatHovers(chartContext, d) {
@@ -533,7 +538,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
if (d.y === 0 && d.high === 0 && d.low === 0 ) {
// no data
hoverString =
- '<div class="chartHoverEnclosingDiv"><span class="chartHoverTimeLabel" >' + chartContext.timeLabel + ': </span>' + timeFormatter(date) + '</div>' +
+ '<div class="chartHoverEnclosingDiv"><span class="chartHoverTimeLabel" >' + chartContext.timeLabel + ': </span>' + timeFormatter(date) +
'<div class="chartHoverAlignLeft"><span class="chartHoverDateLabel">' + chartContext.dateLabel + ': </span>' + dateFormatter(date) + '</div>' +
'<hr class="chartHoverDivider" ></hr>' +
'<div class="chartHoverAlignRight"><span class="chartHoverLabelSpan">'+chartContext.noDataLabel+'</span></div>' +
@@ -544,7 +549,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
else {
// regular bar hover
hoverString =
- '<div class="chartHoverEnclosingDiv"><span class="chartHoverTimeLabel">' + chartContext.timeLabel + ': </span><span style="width:50px;">' + timeFormatter(date) + '</span></div>' +
+ '<div class="chartHoverEnclosingDiv"><span class="chartHoverTimeLabel">' + chartContext.timeLabel + ': </span><span style="width:50px;">' + timeFormatter(date) + '</span>' +
'<div class="chartHoverAlignLeft"><span class="chartHoverDateLabel">' + chartContext.dateLabel + ': </span><span style="width:50px;">' + dateFormatter(date) + '</span></div>' +
'<div class="chartHoverAlignLeft"><span class="chartHoverLabelSpan">'+chartContext.hoverBarLabel+": "+ barDuration + '</span></div>' +
'<hr class="chartHoverDivider"></hr>' +
@@ -559,7 +564,7 @@ public final class MetricStackedBarGraph extends AbstractGraph {
function createHovers(chartContext) {
//console.log("Create Hovers");
- $wnd.jQuery('svg rect.leaderBar, svg rect.high, svg rect.low').tipsy({
+ $wnd.jQuery('svg rect.leaderBar, svg rect.high, svg rect.low, svg rect.singleValue').tipsy({
gravity: 'w',
html: true,
trigger: 'hover',
@@ -582,12 +587,23 @@ public final class MetricStackedBarGraph extends AbstractGraph {
console.time("chart");
//console.log("Json Data:\n"+chartContext.data);
+ var oobMax = $wnd.d3.max(chartContext.data.map(function (d) {
+ if(d.baselineMax == undefined){
+ return 0;
+ } else {
+ return +d.baselineMax;
+ }
+ }));
createHeader(chartContext.chartTitle);
createMinAvgPeakSidePanel(chartContext.minChartTitle, min, chartContext.avgChartTitle, avg, chartContext.peakChartTitle, peak, chartContext.yAxisUnits );
createYAxisGridLines();
createStackedBars();
createXandYAxes();
createAvgLines();
+ if(oobMax > 0){
+ console.info("Has OOB Data!");
+ createOOBLines();
+ }
createHovers(chartContext);
console.timeEnd("chart");
console.groupEnd();
commit 6afcfd4fd9d4750f88e9cd9c0a7a3173a72308b6
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Sat Mar 16 10:53:41 2013 -0700
Charting - For Group charts - Make availability not scroll off the screen when viewing multiple charts.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
index 0d544b4..065bc7a 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
@@ -19,18 +19,12 @@
package org.rhq.enterprise.gui.coregui.client.inventory.common;
-import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Label;
-import org.rhq.core.domain.criteria.AvailabilityCriteria;
import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.util.PageList;
-import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.measurement.UserPreferencesMeasurementRangeEditor;
-import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.avail.AvailabilityD3Graph;
-import org.rhq.enterprise.gui.coregui.client.util.Log;
import org.rhq.enterprise.gui.coregui.client.util.async.CountDownLatch;
import org.rhq.enterprise.gui.coregui.client.util.enhanced.EnhancedVLayout;
@@ -52,39 +46,6 @@ public abstract class AbstractD3GraphListView extends EnhancedVLayout {
public abstract void redrawGraphs();
- protected void queryAvailability(final int resourceId, Long startTime, Long endTime, final CountDownLatch countDownLatch) {
-
- final long timerStart = System.currentTimeMillis();
-
- // now return the availability
- AvailabilityCriteria c = new AvailabilityCriteria();
- c.addFilterResourceId(resourceId);
- c.addFilterInterval(startTime, endTime);
- c.addSortStartTime(PageOrdering.ASC);
- GWTServiceLookup.getAvailabilityService().findAvailabilityByCriteria(c,
- new AsyncCallback<PageList<Availability>>() {
- @Override
- public void onFailure(Throwable caught) {
- CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_availability_loadFailed(), caught);
- if (countDownLatch != null) {
- countDownLatch.countDown();
- }
- }
-
- @Override
- public void onSuccess(PageList<Availability> availList) {
- Log.debug("\nSuccessfully queried availability in: " + (System.currentTimeMillis() - timerStart)
- + " ms.");
- availabilityList = new PageList<Availability>();
- for (Availability availability : availList) {
- availabilityList.add(availability);
- }
- if (countDownLatch != null) {
- countDownLatch.countDown();
- }
- }
- });
- }
-
+ protected abstract void queryAvailability(final int resourceId, Long startTime, Long endTime, final CountDownLatch countDownLatch);
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
index 4377dfa..cc42825 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
@@ -26,13 +26,18 @@ import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.criteria.AvailabilityCriteria;
+import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
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.core.domain.util.PageOrdering;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
import org.rhq.enterprise.gui.coregui.client.inventory.common.AbstractD3GraphListView;
@@ -42,6 +47,8 @@ import org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.MetricSt
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.ResourceMetricD3Graph;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.avail.AvailabilityD3Graph;
import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTypeRepository;
+import org.rhq.enterprise.gui.coregui.client.util.Log;
+import org.rhq.enterprise.gui.coregui.client.util.async.CountDownLatch;
/**
* Build the Group version of the View that shows the individual graph views.
@@ -50,12 +57,13 @@ import org.rhq.enterprise.gui.coregui.client.inventory.resource.type.ResourceTyp
public final class D3GroupGraphListView extends AbstractD3GraphListView {
private ResourceGroup resourceGroup;
+ private VLayout graphsVLayout;
public D3GroupGraphListView(ResourceGroup resourceGroup, boolean monitorDetailView) {
super();
this.resourceGroup = resourceGroup;
this.showAvailabilityGraph = monitorDetailView;
- setOverflow(Overflow.AUTO);
+ setOverflow(Overflow.HIDDEN);
}
@Override
@@ -72,10 +80,14 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
availabilityGraph.createGraphMarker();
addMember(availabilityGraph);
}
+ graphsVLayout = new VLayout();
+ graphsVLayout.setOverflow(Overflow.AUTO);
+ graphsVLayout.setWidth100();
if (resourceGroup != null) {
redrawGraphs();
}
+ addMember(graphsVLayout);
}
/**
@@ -84,7 +96,7 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
public void redrawGraphs() {
queryAvailability(resourceGroup.getId(), measurementRangeEditor.getStartTime(),
- measurementRangeEditor.getEndTime(), null);
+ measurementRangeEditor.getEndTime(), null);
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceGroup.getResourceType().getId(),
EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
@@ -140,6 +152,42 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
});
}
+ protected void queryAvailability(final int entityId, Long startTime, Long endTime,
+ final CountDownLatch countDownLatch) {
+
+ final long timerStart = System.currentTimeMillis();
+
+ // now return the availability
+ //@todo: prep for New GroupAvailability SLSB call
+ AvailabilityCriteria c = new AvailabilityCriteria();
+ c.addFilterResourceId(entityId);
+ c.addFilterInterval(startTime, endTime);
+ c.addSortStartTime(PageOrdering.ASC);
+ GWTServiceLookup.getAvailabilityService().findAvailabilityByCriteria(c,
+ new AsyncCallback<PageList<Availability>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_availability_loadFailed(), caught);
+ if (countDownLatch != null) {
+ countDownLatch.countDown();
+ }
+ }
+
+ @Override
+ public void onSuccess(PageList<Availability> availList) {
+ Log.debug("\nSuccessfully queried group availability in: "
+ + (System.currentTimeMillis() - timerStart) + " ms.");
+ availabilityList = new PageList<Availability>();
+ for (Availability availability : availList) {
+ availabilityList.add(availability);
+ }
+ if (countDownLatch != null) {
+ countDownLatch.countDown();
+ }
+ }
+ });
+ }
+
private void buildIndividualGraph(MeasurementDefinition measurementDefinition,
List<MeasurementDataNumericHighLowComposite> data) {
@@ -151,6 +199,6 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
graphView.setWidth("95%");
graphView.setHeight(225);
- addMember(graphView);
+ graphsVLayout.addMember(graphView);
}
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
index 144e5bb..36efa45 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
@@ -28,10 +28,11 @@ import java.util.TreeSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
-import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
import com.smartgwt.client.widgets.layout.VLayout;
+import org.rhq.core.domain.criteria.AvailabilityCriteria;
+import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementDefinition;
@@ -40,6 +41,7 @@ import org.rhq.core.domain.measurement.composite.MeasurementOOBComposite;
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.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.components.measurement.UserPreferencesMeasurementRangeEditor;
import org.rhq.enterprise.gui.coregui.client.gwt.GWTServiceLookup;
@@ -152,6 +154,40 @@ public class D3GraphListView extends AbstractD3GraphListView {
availabilityGraph.drawJsniChart();
}
+ protected void queryAvailability(final int resourceId, Long startTime, Long endTime, final CountDownLatch countDownLatch) {
+
+ final long timerStart = System.currentTimeMillis();
+
+ // now return the availability
+ AvailabilityCriteria c = new AvailabilityCriteria();
+ c.addFilterResourceId(resourceId);
+ c.addFilterInterval(startTime, endTime);
+ c.addSortStartTime(PageOrdering.ASC);
+ GWTServiceLookup.getAvailabilityService().findAvailabilityByCriteria(c,
+ new AsyncCallback<PageList<Availability>>() {
+ @Override
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_resource_monitor_availability_loadFailed(), caught);
+ if (countDownLatch != null) {
+ countDownLatch.countDown();
+ }
+ }
+
+ @Override
+ public void onSuccess(PageList<Availability> availList) {
+ Log.debug("\nSuccessfully queried availability in: " + (System.currentTimeMillis() - timerStart)
+ + " ms.");
+ availabilityList = new PageList<Availability>();
+ for (Availability availability : availList) {
+ availabilityList.add(availability);
+ }
+ if (countDownLatch != null) {
+ countDownLatch.countDown();
+ }
+ }
+ });
+ }
+
/**
* Build whatever graph (summary or not) by grabbing the MeasurementDefinitions
* that are defined for the resource and then querying the metric and availability data.
commit 7818131faad15d825a911985e8e30adc5c1a4a6d
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Fri Mar 15 15:31:42 2013 -0700
Charting - Make availability not scroll off the screen when viewing multiple charts.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/UserPreferencesMeasurementRangeEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/UserPreferencesMeasurementRangeEditor.java
index a5a4196..66bfd57 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/UserPreferencesMeasurementRangeEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/UserPreferencesMeasurementRangeEditor.java
@@ -25,8 +25,8 @@ import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.util.preferences.MeasurementUserPreferences;
public class UserPreferencesMeasurementRangeEditor extends AbstractMeasurementRangeEditor {
- private int START_TIME_INDEX = 0;
- private int END_TIME_INDEX = 1;
+ private static final int START_TIME_INDEX = 0;
+ private static final int END_TIME_INDEX = 1;
private MeasurementUserPreferences measurementUserPrefs;
public UserPreferencesMeasurementRangeEditor() {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
index d64b892..0d544b4 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
@@ -18,7 +18,6 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.common;
-import java.util.List;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Label;
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
index bca95eb..144e5bb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
@@ -28,7 +28,9 @@ import java.util.TreeSet;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.types.Overflow;
+import com.smartgwt.client.widgets.Canvas;
import com.smartgwt.client.widgets.form.fields.events.ClickHandler;
+import com.smartgwt.client.widgets.layout.VLayout;
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.DisplayType;
@@ -67,6 +69,7 @@ public class D3GraphListView extends AbstractD3GraphListView {
private boolean useSummaryData = false;
private PageList<MeasurementOOBComposite> measurementOOBCompositeList;
private List<List<MeasurementDataNumericHighLowComposite>> metricsDataList;
+ private VLayout vLayout;
public static D3GraphListView createMultipleGraphs(Resource resource, Set<Integer> definitionIds,
boolean showAvailabilityGraph) {
@@ -108,7 +111,7 @@ public class D3GraphListView extends AbstractD3GraphListView {
private void commonConstructorSettings() {
measurementRangeEditor = new UserPreferencesMeasurementRangeEditor();
- setOverflow(Overflow.AUTO);
+ setOverflow(Overflow.HIDDEN);
}
public void addSetButtonClickHandler(ClickHandler clickHandler) {
@@ -121,6 +124,7 @@ public class D3GraphListView extends AbstractD3GraphListView {
super.onDraw();
Log.debug("D3GraphListView.onDraw() for: " + resource.getName());
destroyMembers();
+
addMember(measurementRangeEditor);
if (showAvailabilityGraph) {
@@ -132,9 +136,15 @@ public class D3GraphListView extends AbstractD3GraphListView {
}
+ vLayout = new VLayout();
+ vLayout.setOverflow(Overflow.AUTO);
+ vLayout.setWidth100();
+ vLayout.setHeight100();
+
if (resource != null) {
buildGraphs();
}
+ addMember(vLayout);
}
public void redrawGraphs() {
@@ -342,7 +352,7 @@ public class D3GraphListView extends AbstractD3GraphListView {
graphView.setWidth("95%");
graphView.setHeight(height);
- addMember(graphView);
+ vLayout.addMember(graphView);
}
}
commit b768148fd0db16a57616231b80963abebbce82ae
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Mar 15 16:10:31 2013 -0400
[BZ 921704] upgrade to JBoss/Remoting 2.5.4.SP4 to pick up better IPv6 support.
due to the way the invoker's ObjectName is now defined when registering,
we have to have our own remoting servlet so we can override a method to find our invoker MBean.
This is done in the new enterprise/gui/remoting-war module.
diff --git a/.classpath b/.classpath
index 4c4be2b..434e811 100644
--- a/.classpath
+++ b/.classpath
@@ -55,6 +55,7 @@
<classpathentry kind="src" path="modules/enterprise/gui/coregui/target/generated-sources/gwt"/>
<classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/gui/portal-war/src/test/java"/>
+ <classpathentry kind="src" path="modules/enterprise/gui/remoting-war/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/installer/src/main/java"/>
<classpathentry kind="src" path="modules/enterprise/server/installer/src/test/java"/>
<classpathentry kind="src" path="modules/enterprise/gui/content_http-war/src/main/java"/>
@@ -204,7 +205,7 @@
<classpathentry exported="true" kind="var" path="M2_REPO/i18nlog/i18nlog/1.0.10/i18nlog-1.0.10.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/gnu-getopt/getopt/1.0.13/getopt-1.0.13.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-httpclient/commons-httpclient/3.0.1/commons-httpclient-3.0.1.jar" sourcepath="/M2_REPO/commons-httpclient/commons-httpclient/3.0.1/commons-httpclient-3.0.1-sources.jar"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-remoting/2.2.2.SP8/jboss-remoting-2.2.2.SP8.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/remoting/jboss-remoting/2.5.4.SP4/jboss-remoting-2.5.4.SP4.jar" sourcepath="M2_REPO/org/jboss/remoting/jboss-remoting/2.5.4.SP4/jboss-remoting-2.5.4.SP4-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/oswego-concurrent/concurrent/1.3.4/concurrent-1.3.4.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/rss4j/rss4j/0.92-on.2/rss4j-0.92-on.2.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/org/apache/ant/ant/1.8.4/ant-1.8.4.jar" sourcepath="M2_REPO/org/apache/ant/ant/1.8.4/ant-1.8.4-sources.jar"/>
diff --git a/modules/enterprise/agent/ant-run.xml b/modules/enterprise/agent/ant-run.xml
index 8d2c998..4816e1c 100644
--- a/modules/enterprise/agent/ant-run.xml
+++ b/modules/enterprise/agent/ant-run.xml
@@ -47,9 +47,9 @@ Ant Script that provides ways to package the Agent.
<include name="commons-httpclient/commons-httpclient/2.0.2/commons-httpclient-2.0.2.jar" />
<include name="dom4j/dom4j/1.6/dom4j-1.6.jar" />
<include name="oswego-concurrent/concurrent/${concurrent.version}/concurrent-${concurrent.version}.jar" />
- <include name="jboss/jboss-common/${jboss-common.version}/jboss-common-${jboss-common.version}.jar" />
+ <include name="org/jboss/jboss-common-core/${jboss-common-core.version}/jboss-common-core-${jboss-common-core.version}.jar" />
<include name="jboss/jboss-jmx/${jboss-jmx.version}/jboss-jmx-${jboss-jmx.version}.jar" />
- <include name="jboss/jboss-remoting/${jboss-remoting.version}/jboss-remoting-${jboss-remoting.version}.jar" />
+ <include name="org/jboss/remoting/jboss-remoting/${jboss-remoting.version}/jboss-remoting-${jboss-remoting.version}.jar" />
<include name="org/jboss/logging/jboss-logging/${jboss-logging.version}/jboss-logging-${jboss-logging.version}.jar" />
<include name="jboss/jboss-serialization/${jboss-serialization.version}/jboss-serialization-${jboss-serialization.version}.jar" />
<include name="org/rhq/rhq-enterprise-comm/${project.version}/rhq-enterprise-comm-${project.version}.jar" />
diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml
index 99f9b40..8e7d819 100644
--- a/modules/enterprise/agent/pom.xml
+++ b/modules/enterprise/agent/pom.xml
@@ -80,7 +80,7 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
+ <groupId>org.jboss.remoting</groupId>
<artifactId>jboss-remoting</artifactId>
</dependency>
@@ -157,7 +157,7 @@ Build-Number=${buildNumber}
<property name="concurrent.version" value="${concurrent.version}" />
<property name="getopt.version" value="${getopt.version}" />
<property name="jboss-jmx.version" value="${jboss-jmx.version}" />
- <property name="jboss-common.version" value="${jboss-common.version}" />
+ <property name="jboss-common-core.version" value="${jboss-common-core.version}" />
<property name="jboss-remoting.version" value="${jboss-remoting.version}" />
<property name="jboss-logging.version" value="${jboss-logging.version}" />
<property name="jboss-serialization.version" value="${jboss-serialization.version}" />
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml
index 1ddf893..a0cab6f 100644
--- a/modules/enterprise/binding/pom.xml
+++ b/modules/enterprise/binding/pom.xml
@@ -145,15 +145,15 @@
<artifactId>rss4j</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
- <artifactId>jboss-common</artifactId>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
</exclusion>
<exclusion>
<groupId>jboss</groupId>
<artifactId>jboss-jmx</artifactId>
</exclusion>
<exclusion>
- <groupId>jboss</groupId>
+ <groupId>org.jboss.remoting</groupId>
<artifactId>jboss-remoting</artifactId>
</exclusion>
<exclusion>
diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml
index cf5b95f..4adb84e 100644
--- a/modules/enterprise/comm/pom.xml
+++ b/modules/enterprise/comm/pom.xml
@@ -65,9 +65,8 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-common</artifactId>
- <version>${jboss-common.version}</version>
+ <groupId>org.jboss</groupId>
+ <artifactId>jboss-common-core</artifactId>
</dependency>
<dependency>
@@ -76,7 +75,7 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
+ <groupId>org.jboss.remoting</groupId>
<artifactId>jboss-remoting</artifactId>
</dependency>
diff --git a/modules/enterprise/gui/pom.xml b/modules/enterprise/gui/pom.xml
index b71b130..1fa9ec1 100644
--- a/modules/enterprise/gui/pom.xml
+++ b/modules/enterprise/gui/pom.xml
@@ -32,6 +32,7 @@
<module>coregui</module>
<module>rest-war</module>
<module>rest-examples-war</module>
+ <module>remoting-war</module>
</modules>
</profile>
diff --git a/modules/enterprise/gui/remoting-war/pom.xml b/modules/enterprise/gui/remoting-war/pom.xml
new file mode 100644
index 0000000..c4b63bf
--- /dev/null
+++ b/modules/enterprise/gui/remoting-war/pom.xml
@@ -0,0 +1,147 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+ <modelVersion>4.0.0</modelVersion>
+
+ <parent>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-parent</artifactId>
+ <version>4.7.0-SNAPSHOT</version>
+ <relativePath>../../../../pom.xml</relativePath>
+ </parent>
+
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-remoting-war</artifactId>
+ <packaging>war</packaging>
+
+ <name>RHQ Remoting WAR</name>
+ <description>Provides the ServerInvokerServlet that receives requests via HTTP protocol from within
+ a web container and passes it onto the ServletServerInvoker for processing.</description>
+
+ <dependencies>
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-comm</artifactId>
+ <version>${project.version}</version>
+ <scope>provided</scope> <!-- by rhq.ear -->
+ </dependency>
+
+ <!-- 3rd Party Deps -->
+ <dependency>
+ <groupId>javax.servlet</groupId>
+ <artifactId>javax.servlet-api</artifactId>
+ <version>3.0.1</version>
+ <scope>provided</scope> <!-- by JBossAS -->
+ </dependency>
+ </dependencies>
+
+ <build>
+ <finalName>rhq-remoting</finalName>
+ <plugins>
+ <plugin>
+ <artifactId>maven-war-plugin</artifactId>
+ <version>2.1-alpha-1</version>
+ <configuration>
+ <archive>
+ <manifest>
+ <addDefaultSpecificationEntries>true</addDefaultSpecificationEntries>
+ <addDefaultImplementationEntries>true</addDefaultImplementationEntries>
+ </manifest>
+ <manifestEntries>
+ <Build-Number>${buildNumber}</Build-Number>
+ </manifestEntries>
+ </archive>
+ <webResources>
+ <resource>
+ <filtering>false</filtering>
+ <directory>${basedir}/src/main/webapp</directory>
+ </resource>
+ </webResources>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+
+ <profiles>
+ <profile>
+ <id>dev</id>
+ <properties>
+ <rhq.rootDir>../../../..</rhq.rootDir>
+ <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir>
+ <rhq.deploymentName>${project.build.finalName}.war</rhq.deploymentName>
+ <rhq.deploymentDir>${rhq.containerDir}/${rhq.earDeployDir}/${rhq.deploymentName}</rhq.deploymentDir>
+ </properties>
+
+ <build>
+ <plugins>
+ <plugin>
+ <artifactId>maven-antrun-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>deploy-classes</id>
+ <phase>compile</phase>
+ <configuration>
+ <target>
+ <property name="classes.dir" location="${rhq.deploymentDir}/WEB-INF/classes" />
+ <echo>*** Copying updated files from target/classes to ${classes.dir}...</echo>
+ <copy todir="${classes.dir}" verbose="${rhq.verbose}">
+ <fileset dir="target/classes" />
+ </copy>
+ <property name="deployment.dir" location="${rhq.deploymentDir}" />
+ <echo>*** Copying updated files from
+ src${file.separator}main${file.separator}webapp${file.separator}
+ to
+ ${deployment.dir}${file.separator}...</echo>
+ <copy todir="${deployment.dir}" verbose="${rhq.verbose}">
+ <fileset dir="${basedir}/src/main/webapp" />
+ </copy>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>deploy</id>
+ <phase>package</phase>
+ <configuration>
+ <target>
+ <property name="deployment.dir"
+ location="${rhq.deploymentDir}" />
+ <echo>*** Copying updated files from
+ target${file.separator}${project.build.finalName}${file.separator}
+ to
+ ${deployment.dir}${file.separator}...</echo>
+ <copy todir="${deployment.dir}" verbose="${rhq.verbose}">
+ <fileset dir="${basedir}/target/${project.build.finalName}" />
+ </copy>
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+
+ <execution>
+ <id>undeploy</id>
+ <phase>clean</phase>
+ <configuration>
+ <target>
+ <property name="deployment.dir" location="${rhq.deploymentDir}" />
+ <echo>*** Deleting ${deployment.dir}${file.separator}...</echo>
+ <delete dir="${deployment.dir}" />
+ </target>
+ </configuration>
+ <goals>
+ <goal>run</goal>
+ </goals>
+ </execution>
+ </executions>
+ </plugin>
+ </plugins>
+ </build>
+
+ </profile>
+ </profiles>
+
+</project>
diff --git a/modules/enterprise/gui/remoting-war/src/main/java/org/rhq/enterprise/communications/servlet/ServerInvokerServlet.java b/modules/enterprise/gui/remoting-war/src/main/java/org/rhq/enterprise/communications/servlet/ServerInvokerServlet.java
new file mode 100644
index 0000000..8aba99a
--- /dev/null
+++ b/modules/enterprise/gui/remoting-war/src/main/java/org/rhq/enterprise/communications/servlet/ServerInvokerServlet.java
@@ -0,0 +1,92 @@
+/*
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.communications.servlet;
+
+import java.util.Set;
+
+import javax.management.MBeanServer;
+import javax.management.MBeanServerInvocationHandler;
+import javax.management.MalformedObjectNameException;
+import javax.management.ObjectName;
+import javax.servlet.ServletConfig;
+import javax.servlet.ServletException;
+
+import org.jboss.remoting.transport.servlet.ServletServerInvokerMBean;
+
+/**
+ * Extends JBoss/Remoting 2's servlet that receives the inital http request for the ServletServerInvoker.
+ * This extension finds remoting ServletServerInvoker using our own mechanism. We need to do this since
+ * Remoting 2.4+ changed the ObjectName such that we can't statically define it in the web.xml.
+ * The new ObjectName that Remoting uses is:
+ * jboss.remoting:service=invoker,transport=servlet,host=myhost,port=7080,rhq.communications.connector.rhqtype=server
+ * but we can't assume users won't configure RHQ with a different port and we don't know at build time
+ * host name.
+ */
+public class ServerInvokerServlet extends org.jboss.remoting.transport.servlet.web.ServerInvokerServlet {
+ private static final long serialVersionUID = 1L;
+
+ /**
+ * Returns the servlet server invoker. In our implementation, this always returns
+ * the MBean.
+ *
+ * @param config the servlet configuration
+ * @return the servlet server invoker using the "invokerName" to query to find the MBean
+ * @throws ServletException
+ */
+ protected ServletServerInvokerMBean getInvokerFromInvokerName(ServletConfig config) throws ServletException {
+ // get the invokerName initial parameter as defined in web.xml
+ String invokerNameString = config.getInitParameter("invokerName");
+ if (invokerNameString == null) {
+ throw new ServletException("RHQ's use of this Servlet requires invokerName init parameter");
+ }
+
+ // the invoker name should be a query ObjectName that should find the 1 MBean we are looking for
+ ObjectName invokerObjectNameQuery = null;
+ try {
+ invokerObjectNameQuery = new ObjectName(invokerNameString);
+ log("invokerObjectNameQuery=" + invokerObjectNameQuery);
+ } catch (MalformedObjectNameException e) {
+ throw new ServletException("Failed to build invokerObjectNameQuery", e);
+ }
+
+ // Lookup the MBeanServer
+ String mbeanServerId = config.getInitParameter("mbeanServer");
+ MBeanServer mbeanServer = getMBeanServer(mbeanServerId);
+ if (mbeanServer == null) {
+ throw new ServletException("Failed to locate the MBeanServer");
+ }
+
+ Set<ObjectName> mbeans = mbeanServer.queryNames(invokerObjectNameQuery, null);
+ if (mbeans.isEmpty()) {
+ throw new ServletException("Could not find the remoting servlet invoker: " + invokerObjectNameQuery
+ + " - need to wait for remoting to be initialized later");
+ }
+ if (mbeans.size() > 1) {
+ throw new ServletException("Found more than one remoting servlet invoker at [" + invokerObjectNameQuery
+ + "]=" + mbeans);
+ }
+
+ ObjectName theInvokerObjectName = mbeans.iterator().next();
+ log("Found RHQ remoting servlet: " + theInvokerObjectName);
+
+ return (ServletServerInvokerMBean) MBeanServerInvocationHandler.newProxyInstance(mbeanServer,
+ theInvokerObjectName, ServletServerInvokerMBean.class, false);
+ }
+}
\ No newline at end of file
diff --git a/modules/enterprise/gui/remoting-war/src/main/webapp/WEB-INF/web.xml b/modules/enterprise/gui/remoting-war/src/main/webapp/WEB-INF/web.xml
new file mode 100644
index 0000000..cd278c0
--- /dev/null
+++ b/modules/enterprise/gui/remoting-war/src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE web-app PUBLIC
+ "-//Sun Microsystems, Inc.//DTD Web Application 3.0//EN"
+ "http://java.sun.com/dtd/web-app_3_0.dtd">
+
+<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
+
+ <servlet>
+ <servlet-name>ServerInvokerServlet</servlet-name>
+ <description>The ServerInvokerServlet receives requests via HTTP
+ protocol from within a web container and passes it onto the
+ ServletServerInvoker for processing.
+ </description>
+ <servlet-class>org.rhq.enterprise.communications.servlet.ServerInvokerServlet</servlet-class>
+ <init-param>
+ <param-name>mbeanServer</param-name>
+ <param-value>*platform*</param-value>
+ </init-param>
+ <init-param>
+ <param-name>invokerName</param-name>
+ <param-value>jboss.remoting:service=invoker,transport=servlet,rhq.communications.connector.rhqtype=server,*</param-value>
+ <description>The servlet server invoker - in RHQ's impl of the servlet, this is a query ObjectName that must find 1 bean</description>
+ </init-param>
+ <load-on-startup>-1</load-on-startup>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>ServerInvokerServlet</servlet-name>
+ <url-pattern>/ServerInvokerServlet/*</url-pattern>
+ </servlet-mapping>
+</web-app>
+
+
\ No newline at end of file
diff --git a/modules/enterprise/remoting/ant-run.xml b/modules/enterprise/remoting/ant-run.xml
index e2810a5..8ef08d7 100644
--- a/modules/enterprise/remoting/ant-run.xml
+++ b/modules/enterprise/remoting/ant-run.xml
@@ -16,9 +16,9 @@ ANT Script that provides ways to package the agent.
<property name="jaxb-api.version" value="2.1"/>
<property name="jaxb-impl.version" value="2.1"/>
<property name="concurrent.version" value="1.3.4-jboss"/>
- <property name="jboss-common.version" value="1.2.0.GA"/>
+ <property name="jboss-common-core.version" value="2.2.17.GA"/>
<property name="jboss.version" value="4.2.1.GA"/>
- <property name="jboss-remoting.version" value="2.2.2.SP8"/>
+ <property name="jboss-remoting.version" value="2.5.4.SP4"/>
<property name="jboss-serialization.version" value="1.0.3.GA"/>
<property name="jline.version" value="0.9.94"/>
<property name="jboss-ejb3.version" value="4.2.2.GA"/>
@@ -42,9 +42,10 @@ ANT Script that provides ways to package the agent.
<include name="javassist/javassist/${javassist.version}/javassist-${javassist.version}.jar" />
<include name="oswego-concurrent/concurrent/${concurrent.version}/concurrent-${concurrent.version}.jar" />
- <include name="jboss/jboss-common/${jboss-common.version}/jboss-common-${jboss-common.version}.jar" />
+ <include name="org/jboss/jboss-common-core/${jboss-common-core.version}/jboss-common-core-${jboss-common-core.version}.jar" />
+
<include name="jboss/jboss-j2ee/${jboss.version}/jboss-j2ee-${jboss.version}.jar" />
- <include name="jboss/jboss-remoting/${jboss-remoting.version}/jboss-remoting-${jboss-remoting.version}.jar" />
+ <include name="org/jboss/remoting/jboss-remoting/${jboss-remoting.version}/jboss-remoting-${jboss-remoting.version}.jar" />
<include name="jboss/jboss-serialization/${jboss-serialization.version}/jboss-serialization-${jboss-serialization.version}.jar" />
<include name="javax/persistence/persistence-api/${persistence-api.version}/persistence-api-${persistence-api.version}.jar" />
diff --git a/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml b/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
index 03166a1..1836e9f 100644
--- a/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
+++ b/modules/enterprise/remoting/cli/src/main/scripts/rhq-client.build.xml
@@ -58,7 +58,7 @@
<copy file="${settings.localRepository}/org/rhq/rhq-enterprise-comm/${project.version}/rhq-enterprise-comm-${project.version}.jar" tofile="${lib.home}/rhq-enterprise-comm-${project.version}.jar" verbose="true" />
<copy file="${settings.localRepository}/org/jboss/jboss-common-core/${jboss-common-core.version}/jboss-common-core-${jboss-common-core.version}.jar" tofile="${lib.home}/jboss-common-core-${jboss-common-core.version}.jar" verbose="true" />
<copy file="${settings.localRepository}/org/jboss/logging/jboss-logging/${jboss-logging.version}/jboss-logging-${jboss-logging.version}.jar" tofile="${lib.home}/jboss-logging-${jboss-logging.version}.jar" verbose="true" />
- <copy file="${settings.localRepository}/jboss/jboss-remoting/${jboss-remoting.version}/jboss-remoting-${jboss-remoting.version}.jar" tofile="${lib.home}/jboss-remoting-${jboss-remoting.version}.jar" verbose="true" />
+ <copy file="${settings.localRepository}/org/jboss/remoting/jboss-remoting/${jboss-remoting.version}/jboss-remoting-${jboss-remoting.version}.jar" tofile="${lib.home}/jboss-remoting-${jboss-remoting.version}.jar" verbose="true" />
<copy file="${settings.localRepository}/org/javassist/javassist/${jboss-javassist.version}/javassist-${jboss-javassist.version}.jar" tofile="${lib.home}/javassist-${jboss-javassist.version}.jar" verbose="true" />
<copy file="${settings.localRepository}/oswego-concurrent/concurrent/${concurrent.version}/concurrent-${concurrent.version}.jar" tofile="${lib.home}/concurrent-${concurrent.version}.jar" verbose="true" />
<!-- TODO: This can probaby go away after we stop using EJB classes as Exceptions in the RemoteAPI (TODO (jshaughn): add back if necessary)
diff --git a/modules/enterprise/remoting/client-api/pom.xml b/modules/enterprise/remoting/client-api/pom.xml
index 8f0978c..f5fbe0c 100644
--- a/modules/enterprise/remoting/client-api/pom.xml
+++ b/modules/enterprise/remoting/client-api/pom.xml
@@ -73,7 +73,7 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
+ <groupId>org.jboss.remoting</groupId>
<artifactId>jboss-remoting</artifactId>
</dependency>
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml
index d6a38d8..a6cc2c7 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -69,6 +69,13 @@
<dependency>
<groupId>${project.groupId}</groupId>
+ <artifactId>rhq-remoting-war</artifactId>
+ <version>${project.version}</version>
+ <type>war</type>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
<artifactId>rhq-content_http</artifactId>
<version>${project.version}</version>
<type>war</type>
@@ -155,12 +162,8 @@
<!-- 3rd Party Deps -->
<!-- ** WARs -->
- <dependency>
- <groupId>jboss</groupId>
- <artifactId>jboss-remoting-servlet-invoker</artifactId>
- <version>2x.r3040.jon</version>
- <type>war</type>
- </dependency>
+
+ <!-- none -->
<!-- ** JARs -->
<dependency>
@@ -280,6 +283,13 @@
<contextRoot>/rest-examples</contextRoot>
</webModule>
+ <webModule>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-remoting-war</artifactId>
+ <bundleFileName>rhq-remoting.war</bundleFileName>
+ <contextRoot>/jboss-remoting-servlet-invoker</contextRoot>
+ </webModule>
+
<!-- ** EJB-JARs -->
<ejbModule>
<groupId>${project.groupId}</groupId>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index bd5437a..b7621c5 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -31,13 +31,16 @@
(xnio e.g.) that require the up to date logging impl. Since server jar depends on
rhq-enterprise-comm to run, and arquillian to test, place the current version jboss-logging
as a dependency before the rhq-comm dependency. This ensure the classpath is set up to use the
- newer package impl. -->
- <dependency>
+ newer package impl.
+ NOTE 3/14/2013 - comm module has been upgraded to use jboss-common-core now so I commented below out -->
+<!--
+<dependency>
<groupId>org.jboss.logging</groupId>
<artifactId>jboss-logging</artifactId>
<version>${jboss-logging.version}</version>
<scope>test</scope>
</dependency>
+-->
<dependency>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-comm</artifactId>
diff --git a/pom.xml b/pom.xml
index 2a332b9..9510607 100644
--- a/pom.xml
+++ b/pom.xml
@@ -106,7 +106,7 @@
<jboss-cache.version>1.4.1.SP9</jboss-cache.version>
<jboss-jmx.version>4.2.3.GA</jboss-jmx.version>
<jboss-common.version>1.2.1.GA</jboss-common.version> <!-- note this is the old commons we used, not the newer commons-core -->
- <jboss-remoting.version>2.2.2.SP8</jboss-remoting.version>
+ <jboss-remoting.version>2.5.4.SP4</jboss-remoting.version>
<jboss-serialization.version>1.0.3.GA</jboss-serialization.version>
<jboss-system.version>4.2.3.GA</jboss-system.version>
<jbosssx.version>4.2.3.GA</jbosssx.version>
@@ -300,7 +300,7 @@
</dependency>
<dependency>
- <groupId>jboss</groupId>
+ <groupId>org.jboss.remoting</groupId>
<artifactId>jboss-remoting</artifactId>
<version>${jboss-remoting.version}</version>
</dependency>
commit 6e4054bceda3acf1fc32b81d8576bc05e088eb80
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Fri Mar 15 08:03:19 2013 -0700
[BZ 922141] - Availability graph change from 60 buckets to continuous intervals.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/UserPreferencesMeasurementRangeEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/UserPreferencesMeasurementRangeEditor.java
index f13b1d8..a5a4196 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/UserPreferencesMeasurementRangeEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/measurement/UserPreferencesMeasurementRangeEditor.java
@@ -25,9 +25,10 @@ import org.rhq.enterprise.gui.coregui.client.UserSessionManager;
import org.rhq.enterprise.gui.coregui.client.util.preferences.MeasurementUserPreferences;
public class UserPreferencesMeasurementRangeEditor extends AbstractMeasurementRangeEditor {
+ private int START_TIME_INDEX = 0;
+ private int END_TIME_INDEX = 1;
private MeasurementUserPreferences measurementUserPrefs;
-
public UserPreferencesMeasurementRangeEditor() {
super();
measurementUserPrefs = new MeasurementUserPreferences(UserSessionManager.getUserPreferences());
@@ -53,4 +54,14 @@ public class UserPreferencesMeasurementRangeEditor extends AbstractMeasurementRa
measurementUserPrefs.setMetricRangePreferences(prefs);
}
+ public Long getStartTime(){
+ List<Long> beginEndTimes = getBeginEndTimes();
+ return beginEndTimes.get(START_TIME_INDEX);
+
+ }
+ public Long getEndTime(){
+ List<Long> beginEndTimes = getBeginEndTimes();
+ return beginEndTimes.get(END_TIME_INDEX);
+
+ }
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
index f5f62d3..d64b892 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/AbstractD3GraphListView.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.common;
+import java.util.List;
+
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.smartgwt.client.widgets.Label;
@@ -51,14 +53,14 @@ public abstract class AbstractD3GraphListView extends EnhancedVLayout {
public abstract void redrawGraphs();
- protected void queryAvailability(final int resourceId, final CountDownLatch countDownLatch) {
+ protected void queryAvailability(final int resourceId, Long startTime, Long endTime, final CountDownLatch countDownLatch) {
- final long startTime = System.currentTimeMillis();
+ final long timerStart = System.currentTimeMillis();
// now return the availability
AvailabilityCriteria c = new AvailabilityCriteria();
c.addFilterResourceId(resourceId);
- c.addFilterInitialAvailability(false);
+ c.addFilterInterval(startTime, endTime);
c.addSortStartTime(PageOrdering.ASC);
GWTServiceLookup.getAvailabilityService().findAvailabilityByCriteria(c,
new AsyncCallback<PageList<Availability>>() {
@@ -72,7 +74,7 @@ public abstract class AbstractD3GraphListView extends EnhancedVLayout {
@Override
public void onSuccess(PageList<Availability> availList) {
- Log.debug("\nSuccessfully queried availability in: " + (System.currentTimeMillis() - startTime)
+ Log.debug("\nSuccessfully queried availability in: " + (System.currentTimeMillis() - timerStart)
+ " ms.");
availabilityList = new PageList<Availability>();
for (Availability availability : availList) {
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java
index 96f67d2..2fa63af 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/charttype/AvailabilityLineGraphType.java
@@ -19,11 +19,9 @@
package org.rhq.enterprise.gui.coregui.client.inventory.common.charttype;
import java.util.Date;
-import java.util.List;
import org.rhq.core.domain.measurement.Availability;
import org.rhq.core.domain.measurement.MeasurementUnits;
-import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.CoreGUI;
import org.rhq.enterprise.gui.coregui.client.Messages;
@@ -33,13 +31,13 @@ import org.rhq.enterprise.gui.coregui.client.util.MeasurementConverterClient;
/**
* Contains the javascript chart definition for an implementation of the d3 availability chart. This implementation is
* just a line that changes color based on availability type: up=green, down=red, orange=disabled, yellow=warn, unknown=grey.
+ * This version of the availability graph shows continuous intervals.
*
* @author Mike Thompson
*/
public class AvailabilityLineGraphType {
private static Messages MSG = CoreGUI.getMessages();
- private List<MeasurementDataNumericHighLowComposite> metricData;
private PageList<Availability> availabilityList;
private Integer entityId;
@@ -55,59 +53,24 @@ public class AvailabilityLineGraphType {
this.availabilityList = availabilityList;
}
- public void setMetricData(List<MeasurementDataNumericHighLowComposite> metricData) {
- this.metricData = metricData;
- }
-
public String getAvailabilityJson() {
StringBuilder sb = new StringBuilder("[");
- if (null != metricData) {
-
- for (MeasurementDataNumericHighLowComposite measurement : metricData) {
- sb.append("{ \"x\":" + measurement.getTimestamp() + ",");
-
- if (null != availabilityList) {
- // loop through the avail down intervals
- for (Availability availability : availabilityList) {
-
- boolean hasValidTimestamps = availability.getStartTime() != null
- && availability.getEndTime() != null;
- // we know we are in an interval
- if (hasValidTimestamps && measurement.getTimestamp() >= availability.getStartTime()
- && measurement.getTimestamp() <= availability.getEndTime()) {
-
- sb.append(" \"availType\":\"" + availability.getAvailabilityType() + "\", ");
- sb.append(" \"availStart\":" + availability.getStartTime() + ", ");
- sb.append(" \"availEnd\":" + availability.getEndTime() + ", ");
- long availDuration = availability.getEndTime() - availability.getStartTime();
- String availDurationString = MeasurementConverterClient.format((double)availDuration,
- MeasurementUnits.MILLISECONDS, true);
- sb.append(" \"availDuration\": \"" + availDurationString + "\" ");
- break;
- }
- else if (availability.getEndTime() == null) {
- // we are in the last, unbounded avail interval so assume that the end is now
- Date now = new Date();
- sb.append(" \"availType\":\"" + availability.getAvailabilityType() + "\", ");
- sb.append(" \"availStart\":" + availability.getStartTime() + ", ");
- sb.append(" \"availEnd\":" + now.getTime() + ",");
- long availDuration = (new Date()).getTime() - availability.getStartTime();
- String availDurationString = MeasurementConverterClient.format((double)availDuration,
- MeasurementUnits.MILLISECONDS, true);
- sb.append(" \"availDuration\": \"" + availDurationString + " +\" ");
- break;
- }
- }
- }
+ if (null != availabilityList) {
+ // loop through the avail down intervals
+ for (Availability availability : availabilityList) {
+ sb.append("{ \"availType\":\"" + availability.getAvailabilityType() + "\", ");
+ sb.append(" \"availStart\":" + availability.getStartTime() + ", ");
+ // last record will be null
+ long endTime = availability.getEndTime() != null ? availability.getEndTime() : (new Date()).getTime();
+ sb.append(" \"availEnd\":" + endTime + ", ");
+
+ long availDuration = endTime - availability.getStartTime();
+ String availDurationString = MeasurementConverterClient.format((double) availDuration,
+ MeasurementUnits.MILLISECONDS, true);
+ sb.append(" \"availDuration\": \"" + availDurationString + "\" },");
- if (sb.toString().endsWith(",")) {
- sb.setLength(sb.length() - 1); // delete the last ','
- }
- if (!sb.toString().endsWith("},")) {
- sb.append(" },");
- }
}
- sb.setLength(sb.length() - 1); // delete the last ','
+ sb.setLength(sb.length() - 1);
}
sb.append("]");
Log.debug(sb.toString());
@@ -125,17 +88,17 @@ public class AvailabilityLineGraphType {
// tidy up all of our interactions with java (via JSNI) thru AvailChartContext class
// NOTE: rhq.js has the javascript object constructors in it.
- availChartContext = new $wnd.AvailChartContext(global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartId()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getAvailabilityJson()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartDateLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartTimeLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverStartLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverEndLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverBarLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverAvailabilityLabel()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverTimeFormat()(),
- global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverDateFormat()()
- );
+ availChartContext = new $wnd.AvailChartContext(global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartId()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getAvailabilityJson()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartDateLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartTimeLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverStartLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverEndLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverBarLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverAvailabilityLabel()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverTimeFormat()(),
+ global.@org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType::getChartHoverDateFormat()()
+ );
function draw(availChartContext) {
@@ -144,46 +107,46 @@ public class AvailabilityLineGraphType {
var margin = {top: 5, right: 5, bottom: 5, left: 40},
width = 750 - margin.left - margin.right,
height = 20 - margin.top - margin.bottom,
- xAxisMin = $wnd.d3.min(availChartContext.data, function(d){
- return +d.x;
+ pixelsOffHeight = 0,
+ UP = 4, DOWN = 3, UNKNOWN = 2, DISABLED = 1, WARN = 0,
+ xAxisMin = $wnd.d3.min(availChartContext.data, function (d) {
+ return +d.availStart;
+ }),
+ xAxisMax = $wnd.d3.max(availChartContext.data, function (d) {
+ return +d.availEnd;
}),
- xAxisMax = $wnd.d3.max(availChartContext.data,function(d){
- return +d.x;
- }),
timeScale = $wnd.d3.time.scale()
.range([0, width])
- .domain($wnd.d3.extent(availChartContext.data, function(d){
- return +d.x;
- }));
+ .domain([xAxisMin, xAxisMax]),
- var yScale = $wnd.d3.scale.linear()
+ yScale = $wnd.d3.scale.linear()
.clamp(true)
.rangeRound([height, 0])
- .domain([0, 1]);
-
+ .domain([0, 4]),
- var svg = $wnd.d3.select(availChartContext.chartSelection).append("g")
+ svg = $wnd.d3.select(availChartContext.chartSelection).append("g")
.attr("width", width + margin.left + margin.right)
.attr("height", height + margin.top + margin.bottom)
.attr("transform", "translate(" + margin.left + "," + margin.top + ")");
+
// The gray bars at the bottom leading up
- svg.selectAll("rect.availBar")
+ svg.selectAll("rect.availBars")
.data(availChartContext.data)
.enter().append("rect")
- .attr("class", "availBar")
+ .attr("class", "availBars")
.attr("x", function (d) {
- return timeScale(d.x);
+ return timeScale(+d.availStart);
})
.attr("y", function (d) {
return yScale(0);
})
.attr("height", function (d) {
- return 8;
+ return height - yScale(4) - pixelsOffHeight;
})
.attr("width", function (d) {
- return (width / availChartContext.data.length);
+ return timeScale(+d.availEnd) - timeScale(+d.availStart);
})
.attr("opacity", ".9")
@@ -215,8 +178,7 @@ public class AvailabilityLineGraphType {
}
function createHovers() {
- //console.log("Create Hovers");
- $wnd.jQuery('svg rect.availBar').tipsy({
+ $wnd.jQuery('svg rect.availBars').tipsy({
gravity: 'n',
html: true,
trigger: 'hover',
@@ -232,8 +194,6 @@ public class AvailabilityLineGraphType {
function formatHovers(d) {
var hoverString,
- xValue = (d.x == undefined) ? 0 : +d.x,
- date = new Date(+xValue),
timeFormatter = $wnd.d3.time.format(availChartContext.chartHoverTimeFormat),
dateFormatter = $wnd.d3.time.format(availChartContext.chartHoverDateFormat),
availType = d.availType,
@@ -242,27 +202,25 @@ public class AvailabilityLineGraphType {
availDuration = d.availDuration;
hoverString =
- '<div class="chartHoverEnclosingDiv"><span class="chartHoverTimeLabel">' + availChartContext.timeLabel + ': </span><span style="width:50px;">' + timeFormatter(date) + '</span></div>' +
- '<div class="chartHoverAlignLeft"><span class="chartHoverDateLabel">' + availChartContext.dateLabel + ': </span><span style="width:50px;">' + dateFormatter(date) + '</span></div>' +
- '<hr class="chartHoverDivider"></hr>' +
+ '<div class="chartHoverEnclosingDiv">' +
'<div class="chartHoverAlignRight"><span >' + availChartContext.hoverBarAvailabilityLabel + ': </span><span style="width:50px;">' + availType + '</span></div>' +
'<div class="chartHoverAlignRight"><span >' + availChartContext.hoverStartLabel + ': </span><span style="width:50px;">' + timeFormatter(availStart) + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availStart) + '</span></div>' +
+ '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availStart) + '</span></div>' +
'<div class="chartHoverAlignRight"><span >' + availChartContext.hoverEndLabel + ': </span><span style="width:50px;">' + timeFormatter(availEnd) + '</span></div>' +
- '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availEnd) + '</span></div>' +
+ '<div class="chartHoverAlignRight"><span >' + ' </span><span style="width:50px;">' + dateFormatter(availEnd) + '</span></div>' +
'<div class="chartHoverAlignRight"><span >' + availChartContext.hoverBarLabel + ': </span><span style="width:50px;">' + availDuration + '</span></div>' +
'</div>';
return hoverString;
}
- if(availChartContext.data.length > 0){
+ if (availChartContext.data.length > 0) {
draw(availChartContext);
}
console.timeEnd("availabilityChart");
console.groupEnd("AvailabilityChart");
- }-*/;
+ }-*/;
public String getChartId() {
return String.valueOf(entityId);
@@ -295,6 +253,7 @@ public class AvailabilityLineGraphType {
public String getChartHoverTimeFormat() {
return MSG.chart_hover_time_format();
}
+
public String getChartHoverDateFormat() {
return MSG.chart_hover_date_format();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
index 2fa17eb..4377dfa 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/D3GroupGraphListView.java
@@ -83,11 +83,8 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
*/
public void redrawGraphs() {
- List<Long> startEndList = measurementRangeEditor.getBeginEndTimes();
- final long startTime = startEndList.get(0);
- final long endTime = startEndList.get(1);
-
- queryAvailability(resourceGroup.getId(), null);
+ queryAvailability(resourceGroup.getId(), measurementRangeEditor.getStartTime(),
+ measurementRangeEditor.getEndTime(), null);
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resourceGroup.getResourceType().getId(),
EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
@@ -114,7 +111,7 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
}
GWTServiceLookup.getMeasurementDataService().findDataForCompatibleGroup(resourceGroup.getId(),
- measDefIdArray, startTime, endTime, 60,
+ measDefIdArray, measurementRangeEditor.getStartTime(), measurementRangeEditor.getEndTime(), 60,
new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
@Override
public void onFailure(Throwable caught) {
@@ -133,7 +130,6 @@ public final class D3GroupGraphListView extends AbstractD3GraphListView {
for (List<MeasurementDataNumericHighLowComposite> data : result) {
buildIndividualGraph(measurementDefinitions.get(i++), data);
}
- availabilityGraph.setMetricData(result.get(0));
availabilityGraph.setAvailabilityList(availabilityList);
availabilityGraph.drawJsniChart();
}
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
index e0fb1b8..bca95eb 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/D3GraphListView.java
@@ -148,11 +148,9 @@ public class D3GraphListView extends AbstractD3GraphListView {
*/
private void buildGraphs() {
final long startTimer = System.currentTimeMillis();
- List<Long> startEndList = measurementRangeEditor.getBeginEndTimes();
- final long startTime = startEndList.get(0);
- final long endTime = startEndList.get(1);
- queryAvailability(resource.getId(), null);
+ queryAvailability(resource.getId(), measurementRangeEditor.getStartTime(),
+ measurementRangeEditor.getEndTime(), null);
ResourceTypeRepository.Cache.getInstance().getResourceTypes(resource.getResourceType().getId(),
EnumSet.of(ResourceTypeRepository.MetadataType.measurements),
@@ -211,7 +209,6 @@ public class D3GraphListView extends AbstractD3GraphListView {
if (availabilityGraph != null) {
// we only need the first metricData since we are only taking the
// availability data set in there for the dropdowns already
- availabilityGraph.setMetricData(metricsDataList.get(0));
availabilityGraph.setAvailabilityList(availabilityList);
availabilityGraph.drawJsniChart();
}
@@ -228,7 +225,7 @@ public class D3GraphListView extends AbstractD3GraphListView {
private void queryMetricData(final int[] measDefIdArray, final CountDownLatch countDownLatch) {
GWTServiceLookup.getMeasurementDataService().findDataForResource(resource.getId(), measDefIdArray,
- startTime, endTime, 60,
+ measurementRangeEditor.getStartTime(),measurementRangeEditor.getEndTime(), 60,
new AsyncCallback<List<List<MeasurementDataNumericHighLowComposite>>>() {
@Override
public void onFailure(Throwable caught) {
@@ -265,7 +262,7 @@ public class D3GraphListView extends AbstractD3GraphListView {
Log.debug("OOB Data size: " + measurementOOBCompositeList.size());
if (null != measurementOOBCompositeList) {
for (MeasurementOOBComposite measurementOOBComposite : measurementOOBComposites) {
- Log.debug("measurementOOBComposite = " + measurementOOBComposite);
+ //Log.debug("measurementOOBComposite = " + measurementOOBComposite);
}
}
countDownLatch.countDown();
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/AvailabilityD3Graph.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/AvailabilityD3Graph.java
index 3cd7349..5e6b9f9 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/AvailabilityD3Graph.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/monitoring/avail/AvailabilityD3Graph.java
@@ -18,12 +18,10 @@
*/
package org.rhq.enterprise.gui.coregui.client.inventory.resource.detail.monitoring.avail;
-import java.util.List;
import com.smartgwt.client.widgets.HTMLFlow;
import org.rhq.core.domain.measurement.Availability;
-import org.rhq.core.domain.measurement.composite.MeasurementDataNumericHighLowComposite;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityGraph;
import org.rhq.enterprise.gui.coregui.client.inventory.common.charttype.AvailabilityLineGraphType;
@@ -62,9 +60,6 @@ public class AvailabilityD3Graph extends EnhancedVLayout implements Availability
drawJsniChart();
}
- public void setMetricData(List<MeasurementDataNumericHighLowComposite> metricData) {
- availabilityGraphType.setMetricData(metricData);
- }
public void setAvailabilityList(PageList<Availability> availabilityList) {
availabilityGraphType.setAvailabilityList(availabilityList);
commit 99d8f5b0f1fab5e335b1a2b5db0a1b86ed995c7d
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Mar 14 22:27:13 2013 +0100
Adding "Adding method to an interface" to clirr API check.
diff --git a/modules/enterprise/server/jar/intentional-api-changes-since-4.6.0.xml b/modules/enterprise/server/jar/intentional-api-changes-since-4.6.0.xml
new file mode 100644
index 0000000..e675d9a
--- /dev/null
+++ b/modules/enterprise/server/jar/intentional-api-changes-since-4.6.0.xml
@@ -0,0 +1,9 @@
+<?xml version="1.0"?>
+<differences>
+ <difference>
+ <className>org/rhq/enterprise/server/resource/ResourceManagerRemote</className>
+ <differenceType>7012</differenceType> <!-- method added to an interface -->
+ <method>void uninventoryAllResourcesByAgent(org.rhq.core.domain.auth.Subject, org.rhq.core.domain.resource.Agent)</method>
+ <justification>Adding a method to a remote API interface is safe. This class is never to be implemented by users.</justification>
+ </difference>
+</differences>
commit ef949603530a7ee41e847ff8b2e18b568945db1f
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Mar 14 20:44:10 2013 +0100
Adding 2 more tests for the Server entity. CriteriaQuery finders. Now they are disabled, but they should pass after the BZ 921736 is resolved.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
index cdaeb32..3cadf38 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
@@ -322,9 +322,78 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
@Test(groups = "integration.ejb3")
- public void testParsingAllCriteriaQueryResults() throws Exception {
+ public void testParsingAllCriteriaQueryResults1() throws Exception {
+ testParsingHelperStartingPageEqualTo(0);
+ }
+
+ /**
+ * This test should pass if enabled, but doesn't :(
+ */
+ @Test(groups = "integration.ejb3", enabled = false)
+ public void testParsingAllCriteriaQueryResults2() throws Exception {
+ testParsingHelperStartingPageEqualTo(1);
+ }
+
+ /**
+ * This test should pass if enabled, but doesn't :(
+ */
+ @Test(groups = "integration.ejb3", enabled = false)
+ public void testParsingAllCriteriaQueryResults3() throws Exception {
+ testParsingHelperStartingPageEqualTo(5);
+ }
+
+ @Test(groups = "integration.ejb3")
+ public void testFindNonExistentServer() throws Exception {
+
+ final int serverCount = 5;
+
+ executeInTransaction(new TransactionCallback() {
+ public void execute() throws Exception {
+
+ final String namePrefix = "server";
+ final String addressPrefix = "address";
+
+ for (int i = 0; i < serverCount; i++) {
+ String name = namePrefix + String.format(" %03d", i + 1);
+ Server server = new Server();
+ server.setName(name);
+ server.setOperationMode(OperationMode.NORMAL);
+ server.setAddress(addressPrefix + i);
+ server.setPort(7080);
+ server.setSecurePort(7443);
+
+ em.persist(server);
+ em.flush();
+ }
+ em.flush();
+
+ ServerCriteria criteria = new ServerCriteria();
+ criteria.addFilterName("very unlikely name of a server");
+ criteria.setStrict(true);
+ PageList<Server> servers = topologyManager.findServersByCriteria(overlord, criteria);
+ assertNotNull("The result of topologyManager.findServersByCriteria() is null", servers);
+ assertTrue("Some servers have been found, even if they shouldn't", servers.isEmpty());
+
+ criteria = new ServerCriteria();
+ criteria.addFilterSecurePort(1000);
+ servers = topologyManager.findServersByCriteria(overlord, criteria);
+ assertNotNull("The result of topologyManager.findServersByCriteria() is null", servers);
+ assertTrue("Some servers have been found, even if they shouldn't", servers.isEmpty());
+
+ criteria = new ServerCriteria();
+ criteria.addFilterAffinityGroupId(Integer.MAX_VALUE / 2);
+ servers = topologyManager.findServersByCriteria(overlord, criteria);
+ assertNotNull("The result of topologyManager.findServersByCriteria() is null", servers);
+ assertTrue("Some servers have been found, even if they shouldn't", servers.isEmpty());
+ }
+ });
+ }
+
+
+ private void testParsingHelperStartingPageEqualTo(final int startPage) throws Exception {
final int serverCount = 605;
+ final int pageSize = 3;
executeInTransaction(new TransactionCallback() {
public void execute() throws Exception {
// verify that all server objects are actually parsed.
@@ -332,6 +401,7 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
final String namePrefix = "server";
final String addressPrefix = "address";
int shouldBeFoundCount = 0;
+ int shouldBeSkipped = pageSize * startPage;
for (int i = 0; i < serverCount; i++) {
String name = namePrefix + String.format(" %03d", i + 1);
@@ -343,7 +413,7 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
break;
case 1:
server.setOperationMode(OperationMode.MAINTENANCE);
- if (i % 20 == 9) {
+ if (i % 20 == 9 && shouldBeSkipped-- <= 0) {
shouldBeFoundCount++;
serverNames.add(name);
}
@@ -359,8 +429,6 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
em.flush();
// query the results and delete the servers
- final int pageSize = 3;
- final int startPage = 0;
ServerCriteria criteria = new ServerCriteria();
criteria.addFilterOperationMode(OperationMode.MAINTENANCE);
criteria.addFilterPort(7089);
@@ -399,7 +467,6 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
}
final int finderCallCounter = (int) Math.ceil((double) shouldBeFoundCount / pageSize) - startPage;
- // check if the page was flipped the correct amount of times (this formula works only for this particular case)
assertTrue("While iterating the servers, the findServersByCriteria() should be called "
+ finderCallCounter + " times. It was called " + pagesFlipped.get(0) + " times.",
pagesFlipped.get(0) == finderCallCounter);
@@ -413,52 +480,4 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
}
});
}
-
-
- @Test(groups = "integration.ejb3")
- public void testFindNonExistentServer() throws Exception {
-
- final int serverCount = 5;
-
- executeInTransaction(new TransactionCallback() {
- public void execute() throws Exception {
-
- final String namePrefix = "server";
- final String addressPrefix = "address";
-
- for (int i = 0; i < serverCount; i++) {
- String name = namePrefix + String.format(" %03d", i + 1);
- Server server = new Server();
- server.setName(name);
- server.setOperationMode(OperationMode.NORMAL);
- server.setAddress(addressPrefix + i);
- server.setPort(7080);
- server.setSecurePort(7443);
-
- em.persist(server);
- em.flush();
- }
- em.flush();
-
- ServerCriteria criteria = new ServerCriteria();
- criteria.addFilterName("very unlikely name of a server");
- criteria.setStrict(true);
- PageList<Server> servers = topologyManager.findServersByCriteria(overlord, criteria);
- assertNotNull("The result of topologyManager.findServersByCriteria() is null", servers);
- assertTrue("Some servers have been found, even if they shouldn't", servers.isEmpty());
-
- criteria = new ServerCriteria();
- criteria.addFilterSecurePort(1000);
- servers = topologyManager.findServersByCriteria(overlord, criteria);
- assertNotNull("The result of topologyManager.findServersByCriteria() is null", servers);
- assertTrue("Some servers have been found, even if they shouldn't", servers.isEmpty());
-
- criteria = new ServerCriteria();
- criteria.addFilterAffinityGroupId(Integer.MAX_VALUE / 2);
- servers = topologyManager.findServersByCriteria(overlord, criteria);
- assertNotNull("The result of topologyManager.findServersByCriteria() is null", servers);
- assertTrue("Some servers have been found, even if they shouldn't", servers.isEmpty());
- }
- });
- }
}
commit 0afba16dd8910f9bedd0555a36eb32a5a41427f6
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Mar 14 18:22:37 2013 +0100
Adding a new test for the Server entity. CriteriaQuery finders.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
new file mode 100644
index 0000000..cdaeb32
--- /dev/null
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
@@ -0,0 +1,464 @@
+/*
+ * 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., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.enterprise.server.cloud;
+
+import java.util.ArrayList;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Set;
+
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.cloud.Server;
+import org.rhq.core.domain.cloud.Server.OperationMode;
+import org.rhq.core.domain.criteria.ServerCriteria;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.test.TransactionCallback;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
+import org.rhq.enterprise.server.util.LookupUtil;
+
+/**
+ * @author Jirka Kremser
+ */
+@Test
+public class TopologyManagerBeanTest extends AbstractEJB3Test {
+
+ private TopologyManagerLocal topologyManager;
+ private Subject overlord;
+
+ @Override
+ protected void beforeMethod() throws Exception {
+ topologyManager = LookupUtil.getTopologyManager();
+ overlord = LookupUtil.getSubjectManager().getOverlord();
+ }
+
+ @Test(groups = "integration.ejb3")
+ public void testParsingCriteriaQueryResults1() throws Exception {
+
+ final int serverCount = 205;
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+ // verify that all server objects are actually parsed.
+ final Set<String> serverNames = new HashSet<String>(serverCount);
+
+ final String prefix = "server";
+
+ for (int i = 0; i < serverCount; i++) {
+ String name = prefix + String.format(" %03d", i + 1);
+ Server server = new Server();
+ server.setName(name);
+ server.setOperationMode(OperationMode.NORMAL);
+ server.setAddress("address" + i);
+ server.setPort(7080 + i);
+ server.setSecurePort(7443 + i);
+
+ em.persist(server);
+ serverNames.add(name);
+ em.flush();
+ }
+ em.flush();
+
+ assertTrue("The number of created servers should be " + serverCount + ". Was: " + serverNames.size(),
+ serverCount == serverNames.size());
+
+ // query the results and delete the servers
+ final int pageSize = 42;
+ ServerCriteria criteria = new ServerCriteria();
+ criteria.addFilterName(prefix);
+ criteria.addSortName(PageOrdering.DESC); // use DESC just to make sure sorting on name is different than insert order
+ criteria.setPaging(0, pageSize);
+
+ // the List is used because of the access from the anonymous class
+ final List<Integer> pagesFlipped = new ArrayList<Integer>();
+ pagesFlipped.add(0);
+
+ // iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Server, ServerCriteria> queryExecutor = new CriteriaQueryExecutor<Server, ServerCriteria>() {
+ @Override
+ public PageList<Server> execute(ServerCriteria criteria) {
+ pagesFlipped.set(0, pagesFlipped.get(0) + 1);
+ PageList<Server> list = topologyManager.findServersByCriteria(overlord, criteria);
+ return list;
+ }
+ };
+
+ // initiate first/(total depending on page size) request.
+ CriteriaQuery<Server, ServerCriteria> servers = new CriteriaQuery<Server, ServerCriteria>(criteria,
+ queryExecutor);
+
+ String prevName = null;
+ // iterate over the entire result set efficiently
+ int actualCount = 0;
+ for (Server s : servers) {
+ assert null == prevName || s.getName().compareTo(prevName) < 0 : "Results should be sorted by name DESC, something is out of order";
+ prevName = s.getName();
+ actualCount++;
+ serverNames.remove(s.getName());
+ }
+
+ final int finderCallCounter = (int) Math.ceil((double) serverCount / pageSize);
+ // check if the page was flipped the correct amount of times (this formula works only for this particular case)
+ assertTrue("While iterating the servers, the findServersByCriteria() should be called "
+ + finderCallCounter + " times. It was called " + pagesFlipped.get(0) + " times.",
+ pagesFlipped.get(0) == finderCallCounter);
+
+ // test that entire list parsed spanning multiple pages
+ assertTrue("Expected resourceNames to be empty. Still " + serverNames.size() + " name(s).",
+ serverNames.size() == 0);
+
+ assertTrue("Expected " + serverCount + " to be parsed, but there were parsed " + actualCount
+ + " servers", actualCount == serverCount);
+ }
+ });
+ }
+
+ @Test(groups = "integration.ejb3")
+ public void testParsingCriteriaQueryResults2() throws Exception {
+
+ final int serverCount = 305;
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+ // verify that all server objects are actually parsed.
+ final Set<String> serverNames = new HashSet<String>(serverCount);
+
+ final String prefix = "server";
+
+ int shouldBeFoundCount = 0;
+
+ for (int i = 0; i < serverCount; i++) {
+ String name = prefix + String.format(" %03d", i + 1);
+ Server server = new Server();
+ server.setName(name);
+ switch (i % 5) {
+ case 0:
+ case 1:
+ server.setOperationMode(OperationMode.NORMAL);
+ break;
+ case 2:
+ server.setOperationMode(OperationMode.MAINTENANCE);
+ shouldBeFoundCount++;
+ serverNames.add(name);
+ break;
+ case 3:
+ server.setOperationMode(OperationMode.DOWN);
+ shouldBeFoundCount++;
+ serverNames.add(name);
+ break;
+ case 4:
+ server.setOperationMode(OperationMode.INSTALLED);
+ shouldBeFoundCount++;
+ serverNames.add(name);
+ break;
+ }
+ server.setAddress("address" + i);
+ server.setPort(7080 + i);
+ server.setSecurePort(7443 + i);
+
+ em.persist(server);
+ em.flush();
+ }
+ em.flush();
+
+ // query the results and delete the servers
+ final int pageSize = 24;
+ ServerCriteria criteria = new ServerCriteria();
+ criteria.addFilterName(prefix);
+ criteria.addFilterOperationMode(OperationMode.MAINTENANCE, OperationMode.DOWN, OperationMode.INSTALLED);
+ criteria.addSortName(PageOrdering.DESC); // use DESC just to make sure sorting on name is different than insert order
+ criteria.setPaging(0, pageSize);
+
+ // the List is used because of the access from the anonymous class
+ final List<Integer> pagesFlipped = new ArrayList<Integer>();
+ pagesFlipped.add(0);
+
+ // iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Server, ServerCriteria> queryExecutor = new CriteriaQueryExecutor<Server, ServerCriteria>() {
+ @Override
+ public PageList<Server> execute(ServerCriteria criteria) {
+ pagesFlipped.set(0, pagesFlipped.get(0) + 1);
+ PageList<Server> list = topologyManager.findServersByCriteria(overlord, criteria);
+ return list;
+ }
+ };
+
+ // initiate first/(total depending on page size) request.
+ CriteriaQuery<Server, ServerCriteria> servers = new CriteriaQuery<Server, ServerCriteria>(criteria,
+ queryExecutor);
+
+ String prevName = null;
+ // iterate over the entire result set efficiently
+ int actualCount = 0;
+ for (Server s : servers) {
+ assert null == prevName || s.getName().compareTo(prevName) < 0 : "Results should be sorted by name DESC, something is out of order";
+ prevName = s.getName();
+ actualCount++;
+ if (!serverNames.contains(prevName)) {
+ fail("Following server entity shouldn't be here: " + s);
+ }
+ serverNames.remove(s.getName());
+ }
+
+ final int finderCallCounter = (int) Math.ceil((double) (3 * serverCount / 5) / pageSize);
+ // check if the page was flipped the correct amount of times (this formula works only for this particular case)
+ assertTrue("While iterating the servers, the findServersByCriteria() should be called "
+ + finderCallCounter + " times. It was called " + pagesFlipped.get(0) + " times.",
+ pagesFlipped.get(0) == finderCallCounter);
+
+ // test that entire list parsed spanning multiple pages
+ assertTrue("Expected resourceNames to be empty. Still " + serverNames.size() + " name(s).",
+ serverNames.size() == 0);
+
+ assertTrue("Expected " + shouldBeFoundCount + " to be parsed, but there were parsed " + actualCount
+ + " servers", actualCount == shouldBeFoundCount);
+ }
+ });
+ }
+
+
+ @Test(groups = "integration.ejb3")
+ public void testParsingCriteriaQueryResultsStrict() throws Exception {
+
+ final int serverCount = 10;
+ executeInTransaction(new TransactionCallback() {
+
+ public void execute() throws Exception {
+ // verify that all server objects are actually parsed.
+ final Set<String> serverNames = new HashSet<String>(serverCount);
+
+ final String namePrefix = "server";
+ final String addressPrefix = "address";
+
+ int shouldBeFoundCount = 1;
+ serverNames.add(namePrefix + " 007");
+
+ for (int i = 0; i < serverCount; i++) {
+ String name = namePrefix + String.format(" %03d", i + 1);
+ Server server = new Server();
+ server.setName(name);
+ server.setOperationMode(OperationMode.NORMAL);
+ server.setAddress(addressPrefix + i);
+ server.setPort(7080);
+ server.setSecurePort(7443);
+
+ em.persist(server);
+ em.flush();
+ }
+ em.flush();
+
+ // query the results and delete the servers
+ final int pageSize = 2;
+ final int startPage = 0;
+ ServerCriteria criteria = new ServerCriteria();
+ criteria.addFilterName(namePrefix + " 007");
+ criteria.setStrict(true);
+ criteria.setPaging(startPage, pageSize);
+
+ // the List is used because of the access from the anonymous class
+ final List<Integer> pagesFlipped = new ArrayList<Integer>();
+ pagesFlipped.add(0);
+
+ // iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Server, ServerCriteria> queryExecutor = new CriteriaQueryExecutor<Server, ServerCriteria>() {
+ @Override
+ public PageList<Server> execute(ServerCriteria criteria) {
+ pagesFlipped.set(0, pagesFlipped.get(0) + 1);
+ PageList<Server> list = topologyManager.findServersByCriteria(overlord, criteria);
+ return list;
+ }
+ };
+
+ // initiate first/(total depending on page size) request.
+ CriteriaQuery<Server, ServerCriteria> servers = new CriteriaQuery<Server, ServerCriteria>(criteria,
+ queryExecutor);
+
+ String prevName = null;
+ // iterate over the entire result set efficiently
+ int actualCount = 0;
+ for (Server s : servers) {
+ assert null == prevName || s.getName().compareTo(prevName) < 0 : "Results should be sorted by name DESC, something is out of order";
+ prevName = s.getName();
+ actualCount++;
+ serverNames.remove(s.getName());
+ }
+
+ final int finderCallCounter = 1;
+ // check if the page was flipped the correct amount of times (this formula works only for this particular case)
+ assertTrue("While iterating the servers, the findServersByCriteria() should be called "
+ + finderCallCounter + " times. It was called " + pagesFlipped.get(0) + " times.",
+ pagesFlipped.get(0) == finderCallCounter);
+
+ // test that entire list parsed spanning multiple pages
+ assertTrue("Expected resourceNames to be empty. Still " + serverNames.size() + " name(s).",
+ serverNames.size() == 0);
+
+ assertTrue("Expected " + shouldBeFoundCount + " to be parsed, but there were parsed " + actualCount
+ + " servers", actualCount == shouldBeFoundCount);
+ }
+ });
+ }
+
+
+ @Test(groups = "integration.ejb3")
+ public void testParsingAllCriteriaQueryResults() throws Exception {
+
+ final int serverCount = 605;
+ executeInTransaction(new TransactionCallback() {
+ public void execute() throws Exception {
+ // verify that all server objects are actually parsed.
+ final Set<String> serverNames = new HashSet<String>(serverCount);
+ final String namePrefix = "server";
+ final String addressPrefix = "address";
+ int shouldBeFoundCount = 0;
+
+ for (int i = 0; i < serverCount; i++) {
+ String name = namePrefix + String.format(" %03d", i + 1);
+ Server server = new Server();
+ server.setName(name);
+ switch (i % 2) {
+ case 0:
+ server.setOperationMode(OperationMode.NORMAL);
+ break;
+ case 1:
+ server.setOperationMode(OperationMode.MAINTENANCE);
+ if (i % 20 == 9) {
+ shouldBeFoundCount++;
+ serverNames.add(name);
+ }
+ break;
+ }
+ server.setAddress(addressPrefix + i);
+ server.setPort(7080 + (i % 20));
+ server.setSecurePort(7443 + (i % 20));
+
+ em.persist(server);
+ em.flush();
+ }
+ em.flush();
+
+ // query the results and delete the servers
+ final int pageSize = 3;
+ final int startPage = 0;
+ ServerCriteria criteria = new ServerCriteria();
+ criteria.addFilterOperationMode(OperationMode.MAINTENANCE);
+ criteria.addFilterPort(7089);
+ criteria.addFilterSecurePort(7452);
+ criteria.addFilterName(namePrefix);
+ criteria.addFilterAddress(addressPrefix);
+ criteria.addSortName(PageOrdering.DESC); // use DESC just to make sure sorting on name is different than insert order
+ criteria.setPaging(startPage, pageSize);
+
+ // the List is used because of the access from the anonymous class
+ final List<Integer> pagesFlipped = new ArrayList<Integer>();
+ pagesFlipped.add(0);
+
+ // iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Server, ServerCriteria> queryExecutor = new CriteriaQueryExecutor<Server, ServerCriteria>() {
+ @Override
+ public PageList<Server> execute(ServerCriteria criteria) {
+ pagesFlipped.set(0, pagesFlipped.get(0) + 1);
+ PageList<Server> list = topologyManager.findServersByCriteria(overlord, criteria);
+ return list;
+ }
+ };
+
+ // initiate first/(total depending on page size) request.
+ CriteriaQuery<Server, ServerCriteria> servers = new CriteriaQuery<Server, ServerCriteria>(criteria,
+ queryExecutor);
+
+ String prevName = null;
+ // iterate over the entire result set efficiently
+ int actualCount = 0;
+ for (Server s : servers) {
+ assert null == prevName || s.getName().compareTo(prevName) < 0 : "Results should be sorted by name DESC, something is out of order";
+ prevName = s.getName();
+ actualCount++;
+ serverNames.remove(s.getName());
+ }
+
+ final int finderCallCounter = (int) Math.ceil((double) shouldBeFoundCount / pageSize) - startPage;
+ // check if the page was flipped the correct amount of times (this formula works only for this particular case)
+ assertTrue("While iterating the servers, the findServersByCriteria() should be called "
+ + finderCallCounter + " times. It was called " + pagesFlipped.get(0) + " times.",
+ pagesFlipped.get(0) == finderCallCounter);
+
+ // test that entire list parsed spanning multiple pages
+ assertTrue("Expected resourceNames to be empty. Still " + serverNames.size() + " name(s).",
+ serverNames.size() == 0);
+
+ assertTrue("Expected " + shouldBeFoundCount + " to be parsed, but there were parsed " + actualCount
+ + " servers", actualCount == shouldBeFoundCount);
+ }
+ });
+ }
+
+
+ @Test(groups = "integration.ejb3")
+ public void testFindNonExistentServer() throws Exception {
+
+ final int serverCount = 5;
+
+ executeInTransaction(new TransactionCallback() {
+ public void execute() throws Exception {
+
+ final String namePrefix = "server";
+ final String addressPrefix = "address";
+
+ for (int i = 0; i < serverCount; i++) {
+ String name = namePrefix + String.format(" %03d", i + 1);
+ Server server = new Server();
+ server.setName(name);
+ server.setOperationMode(OperationMode.NORMAL);
+ server.setAddress(addressPrefix + i);
+ server.setPort(7080);
+ server.setSecurePort(7443);
+
+ em.persist(server);
+ em.flush();
+ }
+ em.flush();
+
+ ServerCriteria criteria = new ServerCriteria();
+ criteria.addFilterName("very unlikely name of a server");
+ criteria.setStrict(true);
+ PageList<Server> servers = topologyManager.findServersByCriteria(overlord, criteria);
+ assertNotNull("The result of topologyManager.findServersByCriteria() is null", servers);
+ assertTrue("Some servers have been found, even if they shouldn't", servers.isEmpty());
+
+ criteria = new ServerCriteria();
+ criteria.addFilterSecurePort(1000);
+ servers = topologyManager.findServersByCriteria(overlord, criteria);
+ assertNotNull("The result of topologyManager.findServersByCriteria() is null", servers);
+ assertTrue("Some servers have been found, even if they shouldn't", servers.isEmpty());
+
+ criteria = new ServerCriteria();
+ criteria.addFilterAffinityGroupId(Integer.MAX_VALUE / 2);
+ servers = topologyManager.findServersByCriteria(overlord, criteria);
+ assertNotNull("The result of topologyManager.findServersByCriteria() is null", servers);
+ assertTrue("Some servers have been found, even if they shouldn't", servers.isEmpty());
+ }
+ });
+ }
+}
11 years, 1 month
[rhq] modules/core modules/integration-tests modules/test-utils
by John Sanda
modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingProperties.java | 300 ++++++++++
modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingReader.java | 201 ++++++
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java | 2
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java | 2
modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java | 4
modules/test-utils/src/main/java/org/rhq/test/TokenReplacingProperties.java | 300 ----------
modules/test-utils/src/main/java/org/rhq/test/TokenReplacingReader.java | 201 ------
7 files changed, 505 insertions(+), 505 deletions(-)
New commits:
commit bb955e4a5ccf2f15803dddaf741fe496d1cf044b
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 27 21:36:13 2013 -0400
moving TokenReplacingProperties and TokenReplacingReader for use in production code
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingProperties.java b/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingProperties.java
new file mode 100644
index 0000000..12b36e1
--- /dev/null
+++ b/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingProperties.java
@@ -0,0 +1,300 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.util;
+
+import java.io.IOException;
+import java.io.Reader;
+import java.io.StringReader;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+
+/**
+ * This map is basically an extension of the {@link Properties} class that can resolve the references
+ * to values of other keys inside the values.
+ * <p>
+ * I.e., if the map is initialized with the following mappings:
+ * <p>
+ * <code>
+ * name => world <br />
+ * hello => Hello ${name}!
+ * </code>
+ * <p>
+ * then the call to:
+ * <p>
+ * <code>
+ * get("hello")
+ * </code>
+ * <p>
+ * will return:
+ * <code>
+ * "Hello world!"
+ * </code>
+ * <p>
+ * To access and modify the underlying unprocessed values, one can use the "raw" counterparts of the standard
+ * map methods (e.g. instead of {@link #get(Object)}, use {@link #getRaw(Object)}, etc.).
+ *
+ * @author Lukas Krejci
+ */
+public class TokenReplacingProperties extends HashMap<String, String> {
+ private static final long serialVersionUID = 1L;
+
+ private Map<String, String> wrapped;
+ private Map<Object, String> resolved = new HashMap<Object, String>();
+
+ private class Entry implements Map.Entry<String, String> {
+ private Map.Entry<String, String> wrapped;
+ private boolean process;
+
+ public Entry(Map.Entry<String, String> wrapped, boolean process) {
+ this.wrapped = wrapped;
+ this.process = process;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (obj == this) {
+ return true;
+ }
+
+ if (!(obj instanceof Entry)) {
+ return false;
+ }
+
+ Entry other = (Entry) obj;
+
+ String key = wrapped.getKey();
+ String otherKey = other.getKey();
+ String value = getValue();
+ String otherValue = other.getValue();
+
+ return (key == null ? otherKey == null : key.equals(otherKey)) &&
+ (value == null ? otherValue == null : value.equals(otherValue));
+ }
+
+ public String getKey() {
+ return wrapped.getKey();
+ }
+
+ public String getValue() {
+ if (process) {
+ return get(wrapped.getKey());
+ } else {
+ return wrapped.getValue();
+ }
+ }
+
+ @Override
+ public int hashCode() {
+ String key = wrapped.getKey();
+ String value = getValue();
+ return (key == null ? 0 : key.hashCode()) ^
+ (value == null ? 0 : value.hashCode());
+ }
+
+ public String setValue(String value) {
+ resolved.remove(wrapped.getKey());
+ return wrapped.setValue(value);
+ }
+
+ @Override
+ public String toString() {
+ return wrapped.toString();
+ }
+ }
+
+ public TokenReplacingProperties(Map<String, String> wrapped) {
+ this.wrapped = wrapped;
+ }
+
+ @SuppressWarnings("unchecked")
+ public TokenReplacingProperties(Properties properties) {
+ @SuppressWarnings("rawtypes")
+ Map map = properties;
+ this.wrapped = (Map<String, String>) map;
+ }
+
+ @Override
+ public String get(Object key) {
+ if (resolved.containsKey(key)) {
+ return resolved.get(key);
+ }
+
+ String rawValue = getRaw(key);
+
+ if (rawValue == null) {
+ return null;
+ }
+
+ String ret = readAll(new TokenReplacingReader(new StringReader(rawValue.toString()), this));
+
+ resolved.put(key, ret);
+
+ return ret;
+ }
+
+ public String getRaw(Object key) {
+ return wrapped.get(key);
+ }
+
+ @Override
+ public String put(String key, String value) {
+ resolved.remove(key);
+ return wrapped.put(key, value);
+ }
+
+ @Override
+ public void putAll(Map<? extends String, ? extends String> m) {
+ for(String key : m.keySet()) {
+ resolved.remove(key);
+ }
+ wrapped.putAll(m);
+ }
+
+ public void putAll(Properties properties) {
+ for(String propName : properties.stringPropertyNames()) {
+ put(propName, properties.getProperty(propName));
+ }
+ }
+
+ @Override
+ public void clear() {
+ wrapped.clear();
+ resolved.clear();
+ }
+
+ @Override
+ public boolean containsKey(Object key) {
+ return wrapped.containsKey(key);
+ }
+
+ @Override
+ public Set<String> keySet() {
+ return wrapped.keySet();
+ }
+
+ @Override
+ public boolean containsValue(Object value) {
+ for(String key : keySet()) {
+ String thisVal = get(key);
+ if (thisVal == null) {
+ if (value == null) {
+ return true;
+ }
+ } else {
+ if (thisVal.equals(value)) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks whether this map contains the unprocessed value.
+ *
+ * @param value
+ * @return
+ */
+ public boolean containsRawValue(Object value) {
+ return wrapped.containsValue(value);
+ }
+
+ /**
+ * The returned set <b>IS NOT</b> backed by this map
+ * (unlike in the default map implementations).
+ * <p>
+ * The {@link java.util.Map.Entry#setValue(Object)} method
+ * does modify this map though.
+ */
+ @Override
+ public Set<Map.Entry<String, String>> entrySet() {
+ Set<Map.Entry<String, String>> ret = new HashSet<Map.Entry<String, String>>();
+ for(Map.Entry<String, String> entry : wrapped.entrySet()) {
+ ret.add(new Entry(entry, true));
+ }
+
+ return ret;
+ }
+
+ public Set<Map.Entry<String, String>> getRawEntrySet() {
+ Set<Map.Entry<String, String>> ret = new HashSet<Map.Entry<String, String>>();
+ for(Map.Entry<String, String> entry : wrapped.entrySet()) {
+ ret.add(new Entry(entry, false));
+ }
+
+ return ret;
+ }
+
+ @Override
+ public String remove(Object key) {
+ resolved.remove(key);
+ return wrapped.remove(key).toString();
+ }
+
+ @Override
+ public int size() {
+ return wrapped.size();
+ }
+
+ /**
+ * Unlike in the default implementation the collection returned
+ * from this method <b>IS NOT</b> backed by this map.
+ */
+ @Override
+ public Collection<String> values() {
+ List<String> ret = new ArrayList<String>();
+ for(String key : keySet()) {
+ ret.add(get(key));
+ }
+
+ return ret;
+ }
+
+ public Collection<String> getRawValues() {
+ List<String> ret = new ArrayList<String>();
+ for(String key : keySet()) {
+ ret.add(wrapped.get(key));
+ }
+
+ return ret;
+ }
+
+ private String readAll(Reader rdr) {
+ int in = -1;
+ StringBuilder bld = new StringBuilder();
+ try {
+ while ((in = rdr.read()) != -1) {
+ bld.append((char) in);
+ }
+ } catch (IOException e) {
+ throw new IllegalStateException("Exception while reading a string.", e);
+ }
+
+ return bld.toString();
+ }
+}
\ No newline at end of file
diff --git a/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingReader.java b/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingReader.java
new file mode 100644
index 0000000..3303b76
--- /dev/null
+++ b/modules/core/util/src/main/java/org/rhq/core/util/TokenReplacingReader.java
@@ -0,0 +1,201 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2011 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+
+package org.rhq.core.util;
+
+import java.io.IOException;
+import java.io.PushbackReader;
+import java.io.Reader;
+import java.io.StringReader;
+import java.nio.CharBuffer;
+import java.util.ArrayDeque;
+import java.util.Deque;
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * Copied from http://tutorials.jenkov.com/java-howto/replace-strings-in-streams-arrays-...
+ * with fixes to {@link #read(char[], int, int)} and added support for escaping.
+ *
+ * @author Lukas Krejci
+ */
+public class TokenReplacingReader extends Reader {
+
+ private PushbackReader pushbackReader = null;
+ private Map<String, String> tokens = null;
+ private StringBuilder tokenNameBuffer = new StringBuilder();
+ private String tokenValue = null;
+ private int tokenValueIndex = 0;
+ private boolean escaping = false;
+ private Deque<String> activeTokens;
+ private Map<String, String> resolvedTokens;
+
+ public TokenReplacingReader(Reader source, Map<String, String> tokens) {
+ this.pushbackReader = new PushbackReader(source, 2);
+ this.tokens = tokens;
+ this.activeTokens = new ArrayDeque<String>();
+ this.resolvedTokens = new HashMap<String, String>();
+ }
+
+ protected TokenReplacingReader(String source, Map<String, String> tokens, Deque<String> activeTokens, Map<String, String> resolvedTokens) {
+ pushbackReader = new PushbackReader(new StringReader(source));
+ this.tokens = tokens;
+ this.activeTokens = activeTokens;
+ this.resolvedTokens = resolvedTokens;
+ }
+
+ public int read(CharBuffer target) throws IOException {
+ throw new RuntimeException("Operation Not Supported");
+ }
+
+ public int read() throws IOException {
+ if (this.tokenValue != null) {
+ if (this.tokenValueIndex < this.tokenValue.length()) {
+ return this.tokenValue.charAt(this.tokenValueIndex++);
+ }
+ if (this.tokenValueIndex == this.tokenValue.length()) {
+ this.tokenValue = null;
+ this.tokenValueIndex = 0;
+ }
+ }
+
+ int data = this.pushbackReader.read();
+
+ if (escaping) {
+ escaping = false;
+ return data;
+ }
+
+ if (data == '\\') {
+ escaping = true;
+ return data;
+ }
+
+ if (data != '$')
+ return data;
+
+ data = this.pushbackReader.read();
+ if (data != '{') {
+ this.pushbackReader.unread(data);
+ return '$';
+ }
+ this.tokenNameBuffer.delete(0, this.tokenNameBuffer.length());
+
+ data = this.pushbackReader.read();
+ while (data != '}') {
+ this.tokenNameBuffer.append((char) data);
+ data = this.pushbackReader.read();
+ }
+
+ String tokenName = tokenNameBuffer.toString();
+
+ if (resolvedTokens.containsKey(tokenName)) {
+ tokenValue = resolvedTokens.get(tokenName);
+ } else {
+ tokenValue = resolveToken(tokenName);
+ }
+
+ tokenValueIndex = 0;
+
+ if (!this.tokenValue.isEmpty()) {
+ return this.tokenValue.charAt(this.tokenValueIndex++);
+ } else {
+ return read();
+ }
+ }
+
+ public int read(char cbuf[]) throws IOException {
+ return read(cbuf, 0, cbuf.length);
+ }
+
+ public int read(char cbuf[], int off, int len) throws IOException {
+ int i = 0;
+ for (; i < len; i++) {
+ int nextChar = read();
+ if (nextChar == -1) {
+ if (i == 0) {
+ i = -1;
+ }
+ break;
+ }
+ cbuf[off + i] = (char) nextChar;
+ }
+ return i;
+ }
+
+ public void close() throws IOException {
+ this.pushbackReader.close();
+ }
+
+ public long skip(long n) throws IOException {
+ throw new UnsupportedOperationException("skip() not supported on TokenReplacingReader.");
+ }
+
+ public boolean ready() throws IOException {
+ return this.pushbackReader.ready();
+ }
+
+ public boolean markSupported() {
+ return false;
+ }
+
+ public void mark(int readAheadLimit) throws IOException {
+ throw new IOException("mark() not supported on TokenReplacingReader.");
+ }
+
+ public void reset() throws IOException {
+ throw new IOException("reset() not supported on TokenReplacingReader.");
+ }
+
+ private String readAll(Reader r) throws IOException {
+ int c;
+ StringBuilder bld = new StringBuilder();
+ while((c = r.read()) >= 0) {
+ bld.append((char)c);
+ }
+
+ return bld.toString();
+ }
+
+ private String resolveToken(String tokenName) throws IOException {
+ if (activeTokens.contains(tokenName)) {
+ throw new IllegalArgumentException("Token '" + tokenName + "' (indirectly) contains reference to itself in its value.");
+ }
+
+ activeTokens.push(tokenName);
+
+ String tokenValue = tokens.get(tokenName);
+
+ if (tokenValue != null) {
+ if (tokenValue.contains("${")) {
+ TokenReplacingReader childReader = new TokenReplacingReader(tokenValue, tokens, activeTokens, resolvedTokens);
+
+ tokenValue = readAll(childReader);
+ }
+ } else {
+ tokenValue = "${" + tokenName + "}";
+ }
+
+ resolvedTokens.put(tokenName, tokenValue);
+
+ activeTokens.pop();
+
+ return tokenValue;
+ }
+}
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 e0363af..908f7d7 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
@@ -60,7 +60,7 @@ import org.rhq.plugins.apache.util.HttpdAddressUtility;
import org.rhq.plugins.apache.util.ResourceTypes;
import org.rhq.plugins.apache.util.VHostSpec;
import org.rhq.test.ObjectCollectionSerializer;
-import org.rhq.test.TokenReplacingReader;
+import org.rhq.core.util.TokenReplacingReader;
import org.rhq.test.pc.PluginContainerTest;
public class ApacheTestSetup {
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 719a3dd..7c4eb1e 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
@@ -66,7 +66,7 @@ import org.rhq.plugins.apache.util.ApacheDeploymentUtil.DeploymentConfig;
import org.rhq.plugins.apache.util.ResourceTypes;
import org.rhq.plugins.apache.util.VHostSpec;
import org.rhq.plugins.apache.util.VirtualHostLegacyResourceKeyUtil;
-import org.rhq.test.TokenReplacingReader;
+import org.rhq.core.util.TokenReplacingReader;
import org.rhq.test.pc.PluginContainerTest;
diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
index d5a7e45..c7f176c 100644
--- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
+++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/util/ApacheDeploymentUtil.java
@@ -44,8 +44,8 @@ import org.rhq.core.util.file.FileUtil;
import org.rhq.core.util.stream.StreamUtil;
import org.rhq.plugins.apache.util.HttpdAddressUtility.Address;
import org.rhq.test.PortScout;
-import org.rhq.test.TokenReplacingProperties;
-import org.rhq.test.TokenReplacingReader;
+import org.rhq.core.util.TokenReplacingProperties;
+import org.rhq.core.util.TokenReplacingReader;
/**
*
diff --git a/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingProperties.java b/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingProperties.java
deleted file mode 100644
index 5708ee3..0000000
--- a/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingProperties.java
+++ /dev/null
@@ -1,300 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 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.test;
-
-import java.io.IOException;
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.List;
-import java.util.Map;
-import java.util.Properties;
-import java.util.Set;
-
-
-/**
- * This map is basically an extension of the {@link Properties} class that can resolve the references
- * to values of other keys inside the values.
- * <p>
- * I.e., if the map is initialized with the following mappings:
- * <p>
- * <code>
- * name => world <br />
- * hello => Hello ${name}!
- * </code>
- * <p>
- * then the call to:
- * <p>
- * <code>
- * get("hello")
- * </code>
- * <p>
- * will return:
- * <code>
- * "Hello world!"
- * </code>
- * <p>
- * To access and modify the underlying unprocessed values, one can use the "raw" counterparts of the standard
- * map methods (e.g. instead of {@link #get(Object)}, use {@link #getRaw(Object)}, etc.).
- *
- * @author Lukas Krejci
- */
-public class TokenReplacingProperties extends HashMap<String, String> {
- private static final long serialVersionUID = 1L;
-
- private Map<String, String> wrapped;
- private Map<Object, String> resolved = new HashMap<Object, String>();
-
- private class Entry implements Map.Entry<String, String> {
- private Map.Entry<String, String> wrapped;
- private boolean process;
-
- public Entry(Map.Entry<String, String> wrapped, boolean process) {
- this.wrapped = wrapped;
- this.process = process;
- }
-
- @Override
- public boolean equals(Object obj) {
- if (obj == this) {
- return true;
- }
-
- if (!(obj instanceof Entry)) {
- return false;
- }
-
- Entry other = (Entry) obj;
-
- String key = wrapped.getKey();
- String otherKey = other.getKey();
- String value = getValue();
- String otherValue = other.getValue();
-
- return (key == null ? otherKey == null : key.equals(otherKey)) &&
- (value == null ? otherValue == null : value.equals(otherValue));
- }
-
- public String getKey() {
- return wrapped.getKey();
- }
-
- public String getValue() {
- if (process) {
- return get(wrapped.getKey());
- } else {
- return wrapped.getValue();
- }
- }
-
- @Override
- public int hashCode() {
- String key = wrapped.getKey();
- String value = getValue();
- return (key == null ? 0 : key.hashCode()) ^
- (value == null ? 0 : value.hashCode());
- }
-
- public String setValue(String value) {
- resolved.remove(wrapped.getKey());
- return wrapped.setValue(value);
- }
-
- @Override
- public String toString() {
- return wrapped.toString();
- }
- }
-
- public TokenReplacingProperties(Map<String, String> wrapped) {
- this.wrapped = wrapped;
- }
-
- @SuppressWarnings("unchecked")
- public TokenReplacingProperties(Properties properties) {
- @SuppressWarnings("rawtypes")
- Map map = properties;
- this.wrapped = (Map<String, String>) map;
- }
-
- @Override
- public String get(Object key) {
- if (resolved.containsKey(key)) {
- return resolved.get(key);
- }
-
- String rawValue = getRaw(key);
-
- if (rawValue == null) {
- return null;
- }
-
- String ret = readAll(new TokenReplacingReader(new StringReader(rawValue.toString()), this));
-
- resolved.put(key, ret);
-
- return ret;
- }
-
- public String getRaw(Object key) {
- return wrapped.get(key);
- }
-
- @Override
- public String put(String key, String value) {
- resolved.remove(key);
- return wrapped.put(key, value);
- }
-
- @Override
- public void putAll(Map<? extends String, ? extends String> m) {
- for(String key : m.keySet()) {
- resolved.remove(key);
- }
- wrapped.putAll(m);
- }
-
- public void putAll(Properties properties) {
- for(String propName : properties.stringPropertyNames()) {
- put(propName, properties.getProperty(propName));
- }
- }
-
- @Override
- public void clear() {
- wrapped.clear();
- resolved.clear();
- }
-
- @Override
- public boolean containsKey(Object key) {
- return wrapped.containsKey(key);
- }
-
- @Override
- public Set<String> keySet() {
- return wrapped.keySet();
- }
-
- @Override
- public boolean containsValue(Object value) {
- for(String key : keySet()) {
- String thisVal = get(key);
- if (thisVal == null) {
- if (value == null) {
- return true;
- }
- } else {
- if (thisVal.equals(value)) {
- return true;
- }
- }
- }
-
- return false;
- }
-
- /**
- * Checks whether this map contains the unprocessed value.
- *
- * @param value
- * @return
- */
- public boolean containsRawValue(Object value) {
- return wrapped.containsValue(value);
- }
-
- /**
- * The returned set <b>IS NOT</b> backed by this map
- * (unlike in the default map implementations).
- * <p>
- * The {@link java.util.Map.Entry#setValue(Object)} method
- * does modify this map though.
- */
- @Override
- public Set<Map.Entry<String, String>> entrySet() {
- Set<Map.Entry<String, String>> ret = new HashSet<Map.Entry<String, String>>();
- for(Map.Entry<String, String> entry : wrapped.entrySet()) {
- ret.add(new Entry(entry, true));
- }
-
- return ret;
- }
-
- public Set<Map.Entry<String, String>> getRawEntrySet() {
- Set<Map.Entry<String, String>> ret = new HashSet<Map.Entry<String, String>>();
- for(Map.Entry<String, String> entry : wrapped.entrySet()) {
- ret.add(new Entry(entry, false));
- }
-
- return ret;
- }
-
- @Override
- public String remove(Object key) {
- resolved.remove(key);
- return wrapped.remove(key).toString();
- }
-
- @Override
- public int size() {
- return wrapped.size();
- }
-
- /**
- * Unlike in the default implementation the collection returned
- * from this method <b>IS NOT</b> backed by this map.
- */
- @Override
- public Collection<String> values() {
- List<String> ret = new ArrayList<String>();
- for(String key : keySet()) {
- ret.add(get(key));
- }
-
- return ret;
- }
-
- public Collection<String> getRawValues() {
- List<String> ret = new ArrayList<String>();
- for(String key : keySet()) {
- ret.add(wrapped.get(key));
- }
-
- return ret;
- }
-
- private String readAll(Reader rdr) {
- int in = -1;
- StringBuilder bld = new StringBuilder();
- try {
- while ((in = rdr.read()) != -1) {
- bld.append((char) in);
- }
- } catch (IOException e) {
- throw new IllegalStateException("Exception while reading a string.", e);
- }
-
- return bld.toString();
- }
-}
\ No newline at end of file
diff --git a/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingReader.java b/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingReader.java
deleted file mode 100644
index bc5aef6..0000000
--- a/modules/test-utils/src/main/java/org/rhq/test/TokenReplacingReader.java
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2005-2011 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.test;
-
-import java.io.IOException;
-import java.io.PushbackReader;
-import java.io.Reader;
-import java.io.StringReader;
-import java.nio.CharBuffer;
-import java.util.ArrayDeque;
-import java.util.Deque;
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * Copied from http://tutorials.jenkov.com/java-howto/replace-strings-in-streams-arrays-...
- * with fixes to {@link #read(char[], int, int)} and added support for escaping.
- *
- * @author Lukas Krejci
- */
-public class TokenReplacingReader extends Reader {
-
- private PushbackReader pushbackReader = null;
- private Map<String, String> tokens = null;
- private StringBuilder tokenNameBuffer = new StringBuilder();
- private String tokenValue = null;
- private int tokenValueIndex = 0;
- private boolean escaping = false;
- private Deque<String> activeTokens;
- private Map<String, String> resolvedTokens;
-
- public TokenReplacingReader(Reader source, Map<String, String> tokens) {
- this.pushbackReader = new PushbackReader(source, 2);
- this.tokens = tokens;
- this.activeTokens = new ArrayDeque<String>();
- this.resolvedTokens = new HashMap<String, String>();
- }
-
- protected TokenReplacingReader(String source, Map<String, String> tokens, Deque<String> activeTokens, Map<String, String> resolvedTokens) {
- pushbackReader = new PushbackReader(new StringReader(source));
- this.tokens = tokens;
- this.activeTokens = activeTokens;
- this.resolvedTokens = resolvedTokens;
- }
-
- public int read(CharBuffer target) throws IOException {
- throw new RuntimeException("Operation Not Supported");
- }
-
- public int read() throws IOException {
- if (this.tokenValue != null) {
- if (this.tokenValueIndex < this.tokenValue.length()) {
- return this.tokenValue.charAt(this.tokenValueIndex++);
- }
- if (this.tokenValueIndex == this.tokenValue.length()) {
- this.tokenValue = null;
- this.tokenValueIndex = 0;
- }
- }
-
- int data = this.pushbackReader.read();
-
- if (escaping) {
- escaping = false;
- return data;
- }
-
- if (data == '\\') {
- escaping = true;
- return data;
- }
-
- if (data != '$')
- return data;
-
- data = this.pushbackReader.read();
- if (data != '{') {
- this.pushbackReader.unread(data);
- return '$';
- }
- this.tokenNameBuffer.delete(0, this.tokenNameBuffer.length());
-
- data = this.pushbackReader.read();
- while (data != '}') {
- this.tokenNameBuffer.append((char) data);
- data = this.pushbackReader.read();
- }
-
- String tokenName = tokenNameBuffer.toString();
-
- if (resolvedTokens.containsKey(tokenName)) {
- tokenValue = resolvedTokens.get(tokenName);
- } else {
- tokenValue = resolveToken(tokenName);
- }
-
- tokenValueIndex = 0;
-
- if (!this.tokenValue.isEmpty()) {
- return this.tokenValue.charAt(this.tokenValueIndex++);
- } else {
- return read();
- }
- }
-
- public int read(char cbuf[]) throws IOException {
- return read(cbuf, 0, cbuf.length);
- }
-
- public int read(char cbuf[], int off, int len) throws IOException {
- int i = 0;
- for (; i < len; i++) {
- int nextChar = read();
- if (nextChar == -1) {
- if (i == 0) {
- i = -1;
- }
- break;
- }
- cbuf[off + i] = (char) nextChar;
- }
- return i;
- }
-
- public void close() throws IOException {
- this.pushbackReader.close();
- }
-
- public long skip(long n) throws IOException {
- throw new UnsupportedOperationException("skip() not supported on TokenReplacingReader.");
- }
-
- public boolean ready() throws IOException {
- return this.pushbackReader.ready();
- }
-
- public boolean markSupported() {
- return false;
- }
-
- public void mark(int readAheadLimit) throws IOException {
- throw new IOException("mark() not supported on TokenReplacingReader.");
- }
-
- public void reset() throws IOException {
- throw new IOException("reset() not supported on TokenReplacingReader.");
- }
-
- private String readAll(Reader r) throws IOException {
- int c;
- StringBuilder bld = new StringBuilder();
- while((c = r.read()) >= 0) {
- bld.append((char)c);
- }
-
- return bld.toString();
- }
-
- private String resolveToken(String tokenName) throws IOException {
- if (activeTokens.contains(tokenName)) {
- throw new IllegalArgumentException("Token '" + tokenName + "' (indirectly) contains reference to itself in its value.");
- }
-
- activeTokens.push(tokenName);
-
- String tokenValue = tokens.get(tokenName);
-
- if (tokenValue != null) {
- if (tokenValue.contains("${")) {
- TokenReplacingReader childReader = new TokenReplacingReader(tokenValue, tokens, activeTokens, resolvedTokens);
-
- tokenValue = readAll(childReader);
- }
- } else {
- tokenValue = "${" + tokenName + "}";
- }
-
- resolvedTokens.put(tokenName, tokenValue);
-
- activeTokens.pop();
-
- return tokenValue;
- }
-}
11 years, 1 month
[rhq] Branch 'bug/rhq-1' - 8 commits - modules/common modules/core modules/enterprise modules/helpers modules/plugins pom.xml
by mazz
modules/common/ant-bundle/pom.xml | 3
modules/common/jboss-as/pom.xml | 3
modules/core/dbutils/pom.xml | 6
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java | 99 ++++++++++
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 7
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties | 7
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties | 7
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties | 7
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties | 7
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties | 7
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties | 8
modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties | 7
modules/enterprise/server/installer/pom.xml | 11 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java | 19 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossLocal.java | 5
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 23 +-
modules/enterprise/server/plugins/ant-bundle/pom.xml | 4
modules/enterprise/server/plugins/groovy-script/pom.xml | 1
modules/helpers/perftest-support/pom.xml | 6
modules/plugins/ant-bundle/pom.xml | 4
modules/plugins/jboss-as-5/pom.xml | 3
modules/plugins/jboss-as/pom.xml | 6
modules/plugins/raw-config-test/pom.xml | 2
pom.xml | 9
24 files changed, 224 insertions(+), 37 deletions(-)
New commits:
commit 4b545a95669299ba3182286fe97f5a041bf404ab
Merge: 5074294 2227cbc
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 27 17:56:21 2013 -0400
Merge remote-tracking branch 'origin/master' into bug/rhq-1
commit 50742949ffa530c8840cea7c8d82684e91cd6445
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 27 17:55:48 2013 -0400
BZ 535289 - server-side support to ignore resources (except for committed platforms; requests to ignore them will be... ignored.)
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 3178da4..1a8cb05 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
@@ -1218,7 +1218,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
if (resourceIds == null || resourceIds.length == 0) {
return;
}
- checkStatus(subject, resourceIds, InventoryStatus.IGNORED, EnumSet.of(InventoryStatus.NEW));
+ checkStatus(subject, resourceIds, InventoryStatus.IGNORED,
+ EnumSet.of(InventoryStatus.NEW, InventoryStatus.COMMITTED));
}
public void unignoreResources(Subject subject, int[] resourceIds) {
@@ -1282,11 +1283,13 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
for (Resource resource : resources) {
ResourceCategory category = resource.getResourceType().getCategory();
if (category == ResourceCategory.PLATFORM) {
- platforms.add(resource);
- } else if (category == ResourceCategory.SERVER) {
- servers.add(resource);
+ if (target == InventoryStatus.IGNORED && (resource.getInventoryStatus() == InventoryStatus.COMMITTED)) {
+ log.warn("Cannot ignore a committed platform - skipping request to ignore:" + resource);
+ } else {
+ platforms.add(resource);
+ }
} else {
- throw new IllegalArgumentException("Can not directly change the inventory status of a service");
+ servers.add(resource); // we include services in here now (see BZ 535289)
}
}
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 a608d0e..7bf4131 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
@@ -688,19 +688,22 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage
@RequiredPermission(Permission.MANAGE_INVENTORY)
public Resource setResourceStatus(Subject user, Resource resource, InventoryStatus newStatus, boolean setDescendents) {
- if ((resource.getParentResource() != null)
- && (resource.getParentResource().getInventoryStatus() != InventoryStatus.COMMITTED)) {
- throw new IllegalStateException("Cannot commit resource [" + resource
- + "] to inventory, because its parent resource [" + resource.getParentResource()
- + "] has not yet been committed.");
- }
+ // do special processing if we are being asked to commit the resource to inventory
+ if (newStatus == InventoryStatus.COMMITTED) {
+ if ((resource.getParentResource() != null)
+ && (resource.getParentResource().getInventoryStatus() != InventoryStatus.COMMITTED)) {
+ throw new IllegalStateException("Cannot commit resource [" + resource
+ + "] to inventory, because its parent resource [" + resource.getParentResource()
+ + "] has not yet been committed.");
+ }
- if (newStatus == InventoryStatus.COMMITTED
- && ((resource.getResourceType() == null) || (resource.getResourceType().isIgnored()))) {
- log.debug("Not commiting resource [" + resource + "] to inventory because its type is ignored");
- return resource;
+ if ((resource.getResourceType() == null) || (resource.getResourceType().isIgnored())) {
+ log.debug("Not commiting resource [" + resource + "] to inventory because its type is ignored");
+ return resource;
+ }
}
+
long now = System.currentTimeMillis();
updateInventoryStatus(resource, newStatus, now);
resource = entityManager.merge(resource);
commit ed1c175c5375de1e1bf6fd94a674327de8d6f268
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 27 16:06:08 2013 -0400
BZ 535289 - use the newly renamed API
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 424eded..3178da4 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
@@ -336,7 +336,7 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
// Update and persist the actual inventory statuses
// This is done is a separate transaction to stop failures in the agent from rolling back the transaction
- discoveryBoss.updateInventoryStatus(user, status, platforms, servers);
+ discoveryBoss.updateInventoryStatusInNewTransaction(user, platforms, servers, status);
scheduleAgentInventoryOperationJob(platforms, servers);
commit e175b931d6b3043a26e6c67f62616230a8452a63
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 27 15:57:04 2013 -0400
BZ 535289 - change this method's signature so this API is not confused with the other one that looks identical (except for one parameter changing its location in the param list)
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 e14baf0..424eded 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
@@ -450,8 +450,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal, DiscoveryBossRemot
* version.
*/
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
- public void updateInventoryStatus(Subject user, InventoryStatus status, List<Resource> platforms,
- List<Resource> servers) {
+ public void updateInventoryStatusInNewTransaction(Subject user, List<Resource> platforms, List<Resource> servers,
+ InventoryStatus status) {
for (Resource platform : platforms) {
resourceManager.setResourceStatus(user, platform, status, false);
}
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossLocal.java
index 660a7db..5ea8fde 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossLocal.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossLocal.java
@@ -149,11 +149,12 @@ public interface DiscoveryBossLocal extends DiscoveryBossRemote {
* {@link #updateInventoryStatus(Subject, List, List, InventoryStatus)} for the "public" version.
*
* @param user the user that wants to change the status
- * @param status the new status the given resources will have
* @param platforms identifies the platforms that are to be updated
* @param servers identifies the servers that are to be updated
+ * @param status the new status the given resources will have
*/
- void updateInventoryStatus(Subject user, InventoryStatus status, List<Resource> platforms, List<Resource> servers);
+ void updateInventoryStatusInNewTransaction(Subject user, List<Resource> platforms, List<Resource> servers,
+ InventoryStatus status);
/**
* Manually add the resource of the specified type to inventory using the specified plugin configuration (i.e.
commit 002010b45b9b7f8376c29002d16310ae3f07990c
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 27 15:43:55 2013 -0400
BZ 535289 provide an ignore button on the Resource View in the GUI.
This does NOT work - the server side needs to support ignoring committed resources.
I will work on that next.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
index 06a3469..3e1c6cd 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/ResourceSearchView.java
@@ -331,6 +331,105 @@ public class ResourceSearchView extends Table {
}
});
+ addTableAction(MSG.common_button_ignore(), MSG.view_inventory_resources_ignoreConfirm(),
+ new ResourceAuthorizedTableAction(ResourceSearchView.this, TableActionEnablement.ANY,
+ Permission.DELETE_RESOURCE, new RecordExtractor<Integer>() {
+ public Collection<Integer> extract(Record[] records) {
+ List<Integer> result = new ArrayList<Integer>(records.length);
+ for (Record record : records) {
+ // we only care about those that are not platforms since you cannot ignore platforms outside of discovery queue anyway
+ String resCat = record.getAttribute(CATEGORY.propertyName());
+ if (ResourceCategory.valueOf(resCat) != ResourceCategory.PLATFORM) {
+ result.add(record.getAttributeAsInt("id"));
+ }
+ }
+ return result;
+ }
+ }) {
+
+ public boolean isEnabled(ListGridRecord[] selection) {
+ if (selection == null || selection.length == 0) {
+ return false;
+ }
+
+ // do not enable the ignore button if everything selected is a platform
+ boolean nonPlatformSelected = false;
+ for (Record record : selection) {
+ // we only care about those that are not platforms since you cannot ignore platforms outside of discovery queue anyway
+ String resCat = record.getAttribute(CATEGORY.propertyName());
+ if (ResourceCategory.valueOf(resCat) != ResourceCategory.PLATFORM) {
+ nonPlatformSelected = true;
+ break;
+ }
+ }
+
+ if (!nonPlatformSelected) {
+ return false; // everything selected is a platform - you can't ignore them
+ }
+
+ // at least one non-platform was selected, let's ask what our superclass thinks
+ return super.isEnabled(selection);
+ }
+
+ public void executeAction(final ListGridRecord[] selection, Object actionValue) {
+ if (selection == null || selection.length == 0) {
+ return; // should never happen, but ignore it if it does
+ }
+
+ final int[] numberOfPlatformsSelected = new int[] { 0 };
+ final ArrayList<Integer> resourceIdsList = new ArrayList<Integer>(selection.length);
+ for (ListGridRecord selectedRecord : selection) {
+ // we only include those that are not platforms (you cannot ignore platforms outside of discovery queue)
+ String resCat = selectedRecord.getAttribute(CATEGORY.propertyName());
+ if (ResourceCategory.valueOf(resCat) != ResourceCategory.PLATFORM) {
+ resourceIdsList.add(selectedRecord.getAttributeAsInt("id"));
+ } else {
+ numberOfPlatformsSelected[0]++;
+ }
+ }
+
+ if (resourceIdsList.isEmpty()) {
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_inventory_resources_ignoreSkipAllPlatforms(), Severity.Warning));
+ return;
+ } else if (numberOfPlatformsSelected[0] > 0) {
+ String n = Integer.toString(numberOfPlatformsSelected[0]);
+ CoreGUI.getMessageCenter().notify(
+ new Message(MSG.view_inventory_resources_ignoreSkipSomePlatforms(n), Severity.Warning));
+ }
+
+ // the remote API requires int[]
+ int[] resourceIds = new int[resourceIdsList.size()];
+ int i = 0;
+ for (Integer id : resourceIdsList) {
+ resourceIds[i++] = id;
+ }
+
+ // ask the server to ignore the selected non-platform resources
+ ResourceGWTServiceAsync resourceManager = GWTServiceLookup.getResourceService();
+ resourceManager.ignoreResources(resourceIds, new AsyncCallback<Void>() {
+ public void onFailure(Throwable caught) {
+ CoreGUI.getErrorHandler().handleError(MSG.view_inventory_resources_ignoreFailed(), caught);
+ refreshTableInfo();
+ }
+
+ public void onSuccess(Void result) {
+ String msg;
+ if (numberOfPlatformsSelected[0] > 0) {
+ String n = Integer.toString(numberOfPlatformsSelected[0]);
+ msg = MSG.view_inventory_resources_ignoreSuccessfulSkipPlatforms(n);
+ } else {
+ msg = MSG.view_inventory_resources_ignoreSuccessful();
+ }
+ CoreGUI.getMessageCenter().notify(new Message(msg, Severity.Info));
+ onUninventorySuccess(); // do the same thing as if we uninventoried the resource
+ }
+ });
+
+ return;
+ }
+ });
+
if (exportable) {
addExportAction();
}
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 cbb504d..7ad8ca1 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
@@ -43,6 +43,7 @@ common_button_enable = Enable
common_button_execute = Execute
common_button_finish = Finish
common_button_fixedWidth = Fixed Width
+common_button_ignore = Ignore
common_button_import = Import
common_button_new = New
common_button_next = Next
@@ -1692,6 +1693,12 @@ view_inventory_resources_disableSuccessful = You have successfully disabled the
view_inventory_resources_enableConfirm = Are you sure you want to enable the selected resources? When enabled the availability will be set to UNKNOWN until the agents next report availability for the resources. The agents will be requested to report the current availabilities at their earliest convenience.
view_inventory_resources_enableFailed = Failed to enable the selected resources.
view_inventory_resources_enableSuccessful = You have successfully enabled the selected resources and their children, [{0}] resources.
+view_inventory_resources_ignoreConfirm = Are you sure you want the selected resources to be ignored? They will no longer show up in inventory.
+view_inventory_resources_ignoreFailed = Failed to ignore Resources
+view_inventory_resources_ignoreSkipAllPlatforms = You cannot ignore platforms. All of your selections are platforms so nothing will be done. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+view_inventory_resources_ignoreSkipSomePlatforms = You cannot ignore platforms. The [{0}] platforms you selected will be skipped. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+view_inventory_resources_ignoreSuccessful = You have successfully ignored the selected Resources.
+view_inventory_resources_ignoreSuccessfulSkipPlatforms = You have successfully ignored some of the selected resources, however, the [{0}] platforms you selected were skipped. Platforms cannot be ignored. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
view_inventory_resources_loadFailed = Failed to load resource composite data
view_inventory_resources_members = Member Resources
view_inventory_resources_uninventoryConfirm = Are you sure you want to uninventory the selected resources? Note that if a selected resource still exists, then it will get rediscovered during its agent''s next discovery scan.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
index 6242c41..88ce396 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_cs.properties
@@ -66,6 +66,7 @@ common_button_enable = Povolit
common_button_execute = Spustit
common_button_finish = Ukončit
common_button_fixedWidth = Pevná šířka
+common_button_ignore = Ignorovaný
common_button_import = Import
common_button_new = Nový
common_button_next = Další
@@ -1705,6 +1706,12 @@ view_inventory_resources_disableSuccessful = Úspěšně jste zneplatnil vybran
view_inventory_resources_enableConfirm = Jste si jisti, že chcete povolit vybrané zdroje? Při povolení se dostupnost nastaví na neznámou (UNKNOWN) dokud neproběhne další agentovo hlášení o dostupnosti zdrojů. Agenti budou požádáni o tento report co nejdříve.
view_inventory_resources_enableFailed = Nepodařilo se povolit vybrané zdroje.
view_inventory_resources_enableSuccessful = Úspěšně jste povolili vybrané zdroje a jejich potomky, [{0}] zdrojů.
+##view_inventory_resources_ignoreConfirm = Are you sure you want the selected resources to be ignored? They will no longer show up in inventory.
+view_inventory_resources_ignoreFailed = Nepodařilo se ignorovat zdroje
+##view_inventory_resources_ignoreSkipAllPlatforms = You cannot ignore platforms. All of your selections are platforms so nothing will be done. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+##view_inventory_resources_ignoreSkipSomePlatforms = You cannot ignore platforms. The [{0}] platforms you selected will be skipped. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+view_inventory_resources_ignoreSuccessful = Vybrané zdroje byly úspěšně ignorovány.
+##view_inventory_resources_ignoreSuccessfulSkipPlatforms = You have successfully ignored some of the selected resources, however, the [{0}] platforms you selected were skipped. Platforms cannot be ignored. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
view_inventory_resources_loadFailed = Nepodařilo se načíst složená data zdroje
view_inventory_resources_members = Členské zdroje
view_inventory_resources_uninventoryConfirm = Chcete opravdu odstranit vybrané zdroje z inventáře? Pozn. pokud odstraněný zdroj stále existuje, bude znovuobjeven v příští fázi skenování agentem.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
index e019464..7760d06 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_de.properties
@@ -46,6 +46,7 @@ common_button_enable = Aktivieren
common_button_execute = Ausführen
common_button_finish = Beenden
common_button_fixedWidth = Konstante Breite
+common_button_ignore = Ignorieren
common_button_import = Importieren
common_button_new = Neu
common_button_next = Weiter
@@ -1483,6 +1484,12 @@ view_inventory_problemGroups = Gruppen mit Problemen
##view_inventory_resources_deleteFailed = Failed to delete the selected resources
##view_inventory_resources_deleteSuccessful = A request to perform the resource deletion has been submitted successfully to the agent(s).
##view_inventory_resources_disableSuccessful = You have successfully disabled the selected resources and their children, [{0}] resources.
+##view_inventory_resources_ignoreConfirm = Are you sure you want the selected resources to be ignored? They will no longer show up in inventory.
+view_inventory_resources_ignoreFailed = Konnte die Ressourcen nicht ignorieren
+##view_inventory_resources_ignoreSkipAllPlatforms = You cannot ignore platforms. All of your selections are platforms so nothing will be done. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+##view_inventory_resources_ignoreSkipSomePlatforms = You cannot ignore platforms. The [{0}] platforms you selected will be skipped. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+view_inventory_resources_ignoreSuccessful = Sie haben die ausgewählten Ressourcen erfolgreich ignoriert
+##view_inventory_resources_ignoreSuccessfulSkipPlatforms = You have successfully ignored some of the selected resources, however, the [{0}] platforms you selected were skipped. Platforms cannot be ignored. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
##view_inventory_resources_loadFailed = Failed to load resource composite data
##view_inventory_resources_members = Member Resources
view_inventory_sectionHelp = In diesem Abschnitt können neu gefundene Ressourcen, sowie Ressourcen und Gruppen im Inventar angesehen und verwaltet werden.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
index 89894fa..580ca6d 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ja.properties
@@ -46,6 +46,7 @@ common_button_enable = 有効
common_button_execute = 実行
common_button_finish = 完了
common_button_fixedWidth = 固定幅
+common_button_ignore = 無視
common_button_import = インポート
common_button_new = 新規
common_button_next = 次へ
@@ -1677,6 +1678,12 @@ view_inventory_resources_disableSuccessful = 選択されたリソースとそ
view_inventory_resources_enableConfirm = 本当に選択されたリソースを有効したいですか? 有効の間はエージェントがリソースのアベイラビリティを報告するまでアベイラビリティはUNKNOWNに設定されます。エージェントは直近の都合の良いときに現在のアベイラビリティを報告するように要求されます。
view_inventory_resources_enableFailed = 選択されたリソースを有効にするのに失敗しました。
view_inventory_resources_enableSuccessful = 選択されたリソースとその子となる [{0}] リソースを有効化するのに成功しました。
+##view_inventory_resources_ignoreConfirm = Are you sure you want the selected resources to be ignored? They will no longer show up in inventory.
+view_inventory_resources_ignoreFailed = リソースを無視するのに失敗しました
+##view_inventory_resources_ignoreSkipAllPlatforms = You cannot ignore platforms. All of your selections are platforms so nothing will be done. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+##view_inventory_resources_ignoreSkipSomePlatforms = You cannot ignore platforms. The [{0}] platforms you selected will be skipped. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+view_inventory_resources_ignoreSuccessful = 選択したリソースを無視するのに成功しました
+##view_inventory_resources_ignoreSuccessfulSkipPlatforms = You have successfully ignored some of the selected resources, however, the [{0}] platforms you selected were skipped. Platforms cannot be ignored. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
view_inventory_resources_loadFailed = リソース合成データのロードに失敗しました
view_inventory_resources_members = メンバーリソース
view_inventory_resources_uninventoryConfirm = 選択したリソースをアンインベントリしてもよろしいですか? もし選択したリソースがまだ存在しているなら、そのエージェントの次回のディスカバリスキャンの間にそれは再発見されます。
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
index e04b4c8..0af7cb4 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ko.properties
@@ -43,6 +43,7 @@ common_button_enable = 활성
common_button_execute = 실행
common_button_finish = 완료
common_button_fixedWidth = 고정폭
+common_button_ignore = 무시
common_button_import = 가져오기
common_button_new = 신규
common_button_next = 다음
@@ -1402,6 +1403,12 @@ view_inventory_resources_disableSuccessful = 선택된 리소스와 그의 자
view_inventory_resources_enableConfirm = 정말 선택된 리소스를 사용할까요? 활성화 동안 에이전트가 리소스의 가용성을 보고할 때까지 가용성은 UNKNOWN으로 설정됩니다. 에이전트는 최근의 편리한 시간에 현재의 가용성을 보고하도록 요구됩니다.
view_inventory_resources_enableFailed = 선택한 리소스를 활성화하는데 실패했습니다
view_inventory_resources_enableSuccessful = 선택된 리소스와 그의 자식이 되는 [{0}] 리소스를 활성화하는데 성공했습니다.
+##view_inventory_resources_ignoreConfirm = Are you sure you want the selected resources to be ignored? They will no longer show up in inventory.
+view_inventory_resources_ignoreFailed = 리소스를 무시하는데 실패했습니다
+##view_inventory_resources_ignoreSkipAllPlatforms = You cannot ignore platforms. All of your selections are platforms so nothing will be done. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+##view_inventory_resources_ignoreSkipSomePlatforms = You cannot ignore platforms. The [{0}] platforms you selected will be skipped. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+view_inventory_resources_ignoreSuccessful = 선택한 리소스를 무시하는데 성공했습니다
+##view_inventory_resources_ignoreSuccessfulSkipPlatforms = You have successfully ignored some of the selected resources, however, the [{0}] platforms you selected were skipped. Platforms cannot be ignored. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
view_inventory_resources_loadFailed = 리소스 합성 데이터 로드에 실패했습니다
view_inventory_resources_members = 멤버 리소스
view_inventory_resources_uninventoryConfirm = 선택한 리소스를 인벤토리에서 제거하시겠습니까? 만약 선택한 리소스가 존재하고 있다면, 그 에이전트의 다음 디스커버리 스캔 사이에 그것은 재발견됩니다.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
index f55123c..feda51d 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_pt.properties
@@ -43,6 +43,7 @@ common_button_enable = Habilitar
##common_button_execute = Execute
common_button_finish = Finalizar
##common_button_fixedWidth = Fixed Width
+common_button_ignore = Ignorar
common_button_import = Importar
common_button_new = Novo
common_button_next = Pr\u00F3ximo
@@ -1702,6 +1703,12 @@ view_inventory_resources_deleteConfirm = Are you sure you want to delete the sel
##view_inventory_resources_enableConfirm = Are you sure you want to enable the selected resources? When enabled the availability will be set to UNKNOWN until the agents next report availability for the resources. The agents will be requested to report the current availabilities at their earliest convenience.
##view_inventory_resources_enableFailed = Failed to enable the selected resources.
##view_inventory_resources_enableSuccessful = You have successfully enabled the selected resources and their children, [{0}] resources.
+##view_inventory_resources_ignoreConfirm = Are you sure you want the selected resources to be ignored? They will no longer show up in inventory.
+view_inventory_resources_ignoreFailed = Falha ao ignorar recursos.
+##view_inventory_resources_ignoreSkipAllPlatforms = You cannot ignore platforms. All of your selections are platforms so nothing will be done. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+##view_inventory_resources_ignoreSkipSomePlatforms = You cannot ignore platforms. The [{0}] platforms you selected will be skipped. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+view_inventory_resources_ignoreSuccessful = Os recursos selecionados foram ignorados com sucesso.
+##view_inventory_resources_ignoreSuccessfulSkipPlatforms = You have successfully ignored some of the selected resources, however, the [{0}] platforms you selected were skipped. Platforms cannot be ignored. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
##view_inventory_resources_loadFailed = Failed to load resource composite data
##view_inventory_resources_members = Member Resources
##view_inventory_resources_uninventoryConfirm = Are you sure you want to uninventory the selected resources? Note that if a selected resource still exists, then it will get rediscovered during its agent''s next discovery scan.
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
index afaeac3..b51233b 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_ru.properties
@@ -2151,6 +2151,7 @@ common_button_enable = Включить
common_button_execute = Выполнить
common_button_finish = Готово
common_button_fixedWidth = Фиксированная ширина
+##common_button_ignore = Ignore
common_button_import = Импорт
common_button_new = Новый
common_button_next = Следующий
@@ -2657,6 +2658,7 @@ view_admin_systemSettings_LDAPBindDN_name = Имя пользователя
view_admin_systemSettings_LDAPBindPW_name = Пароль
##view_alert_details_field_resource_ancestry = Resource Ancestry
##view_alert_details_field_watched_resource = Watched Resource
+##view_autoDiscoveryQ_ignore = Ignore
##view_bundle_revertWizard_getInfoStep_revertDeployDescFull = [REVERT From] {0} [REVERT To] {1}
##view_configEdit_description = Description
##view_configEdit_property = Vlastnost
@@ -2675,6 +2677,12 @@ view_admin_systemSettings_LDAPBindPW_name = Пароль
view_group_detail_implicitAvail = Group availability for all members (includes recursive members).
##view_group_detail_recursiveChange = You successfully changed the recursive setting for group [{0}]
##view_inventory_resources_disableSuccessful = You have successfully disabled the selected resources and their children, [{0}] resources.
+##view_inventory_resources_ignoreConfirm = Are you sure you want the selected resources to be ignored? They will no longer show up in inventory.
+##view_inventory_resources_ignoreFailed = Failed to ignore Resources
+##view_inventory_resources_ignoreSkipAllPlatforms = You cannot ignore platforms. All of your selections are platforms so nothing will be done. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+##view_inventory_resources_ignoreSkipSomePlatforms = You cannot ignore platforms. The [{0}] platforms you selected will be skipped. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+##view_inventory_resources_ignoreSuccessful = You have successfully ignored the selected Resources.
+##view_inventory_resources_ignoreSuccessfulSkipPlatforms = You have successfully ignored some of the selected resources, however, the [{0}] platforms you selected were skipped. Platforms cannot be ignored. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
##view_messageCenter_messageRootCause = Root Cause
##view_operationHistoryList_cancelConfirm = Are you sure you want to cancel the selected operations? NOTE: Only those selected operations that are currently "in progress" will be attempted to be canceled.
##view_operationHistoryList_cancelFailure = The cancel request failed for the operation with the history ID of [{0}].
diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
index 38844fc..bafd335 100644
--- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
+++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages_zh.properties
@@ -43,6 +43,7 @@ common_button_enable = \u542f\u7528
##common_button_execute = Execute
common_button_finish = \u5b8c\u6210
##common_button_fixedWidth = Fixed Width
+common_button_ignore = \u5ffd\u7565
common_button_import = \u5bfc\u5165
common_button_new = \u65b0\u5efa
common_button_next = \u4e0b\u4e00\u6b65
@@ -1678,6 +1679,12 @@ view_inventory_resources_deleteFailed = \u5220\u9664\u6307\u5b9a\u7684\u8d44\u6e
##view_inventory_resources_enableConfirm = Are you sure you want to enable the selected resources? When enabled the availability will be set to UNKNOWN until the agents next report availability for the resources. The agents will be requested to report the current availabilities at their earliest convenience.
##view_inventory_resources_enableFailed = Failed to enable the selected resources.
##view_inventory_resources_enableSuccessful = You have successfully enabled the selected resources and their children, [{0}] resources.
+##view_inventory_resources_ignoreConfirm = Are you sure you want the selected resources to be ignored? They will no longer show up in inventory.
+view_inventory_resources_ignoreFailed = \u5ffd\u7565\u8d44\u6e90\u5931\u8d25
+##view_inventory_resources_ignoreSkipAllPlatforms = You cannot ignore platforms. All of your selections are platforms so nothing will be done. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+##view_inventory_resources_ignoreSkipSomePlatforms = You cannot ignore platforms. The [{0}] platforms you selected will be skipped. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
+view_inventory_resources_ignoreSuccessful = \u6210\u529f\u5ffd\u7565\u9009\u5b9a\u8d44\u6e90.
+##view_inventory_resources_ignoreSuccessfulSkipPlatforms = You have successfully ignored some of the selected resources, however, the [{0}] platforms you selected were skipped. Platforms cannot be ignored. If you no longer want to manage a platform, shutdown its associated agent and uninventory the platform.
view_inventory_resources_loadFailed = \u52a0\u8f7d\u8d44\u6e90\u7ec4\u5408\u6570\u636e\u5931\u8d25
view_inventory_resources_members = \u6210\u5458\u8d44\u6e90
view_inventory_resources_uninventoryConfirm = \u786e\u5b9a\u628a\u9009\u4e2d\u7684\u8d44\u6e90\u4ece\u6e05\u5355\u4e2d\u5220\u9664? \u6ce8\u610f\uff1a\u5982\u679c\u67d0\u4e2a\u9009\u4e2d\u7684\u8d44\u6e90\u4f9d\u7136\u5b58\u5728, \u5219\u7cfb\u7edf\u4f1a\u5728\u6b64\u8d44\u6e90\u7684\u5ba2\u6237\u7aef\u7a0b\u5e8f\u4e0b\u6b21\u63a2\u7d22\u626b\u63cf\u65f6\u91cd\u65b0\u52a0\u8f7d\u6b64\u8d44\u6e90.
commit 2227cbc40dcfa6e922fbe8569e041b930bc2e627
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 27 09:02:48 2013 -0500
[BZ 923458] Roll back ant version to the latest version declared in child poms and not the root pom.
diff --git a/pom.xml b/pom.xml
index f3823c3..0a804a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -823,19 +823,19 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.4</version>
+ <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.8.4</version>
+ <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
- <version>1.8.1</version>
+ <version>1.8.0</version>
</dependency>
<dependency>
commit d15e5ceedb318119bc807d203f794ba56c0eabd3
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 27 08:56:49 2013 -0500
[BZ 923458] Revert ant version changes since they are used in bundles.
diff --git a/modules/common/ant-bundle/pom.xml b/modules/common/ant-bundle/pom.xml
index 26e7795..4cf6703 100644
--- a/modules/common/ant-bundle/pom.xml
+++ b/modules/common/ant-bundle/pom.xml
@@ -53,17 +53,20 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.8.0</version>
</dependency>
<!-- include some optional Ant tasks for users to be able to use -->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
+ <version>1.8.0</version>
</dependency>
<dependency>
diff --git a/modules/common/jboss-as/pom.xml b/modules/common/jboss-as/pom.xml
index a53545f..b9ee5be 100644
--- a/modules/common/jboss-as/pom.xml
+++ b/modules/common/jboss-as/pom.xml
@@ -16,8 +16,9 @@
<dependencies>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index f6d5f5a..085ba4c 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -37,8 +37,9 @@
<!-- 3rd Party Deps -->
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -46,9 +47,10 @@
<version>1.1.1</version>
</dependency>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
<scope>test</scope>
+ <version>1.6.5</version>
</dependency>
<dependency>
<groupId>i18nlog</groupId>
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index 4936d3f..0460892 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -63,13 +63,15 @@
<!-- we need to package this (and ant) in our module -->
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
@@ -134,11 +136,11 @@
<artifactId>rhq-jboss-as-dmr-client</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
</artifactItem>
<artifactItem>
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml b/modules/enterprise/server/plugins/ant-bundle/pom.xml
index 5227e8c..489b37b 100644
--- a/modules/enterprise/server/plugins/ant-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml
@@ -75,22 +75,26 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<!-- include some optional Ant tasks for users to be able to use -->
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
</artifactItem>
<artifactItem>
diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml
index ce163b8..ea20099 100644
--- a/modules/enterprise/server/plugins/groovy-script/pom.xml
+++ b/modules/enterprise/server/plugins/groovy-script/pom.xml
@@ -23,6 +23,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.opensymphony.quartz</groupId>
diff --git a/modules/helpers/perftest-support/pom.xml b/modules/helpers/perftest-support/pom.xml
index 43458a5..ed71426 100644
--- a/modules/helpers/perftest-support/pom.xml
+++ b/modules/helpers/perftest-support/pom.xml
@@ -14,12 +14,14 @@
</description>
<dependencies>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml
index cc1a8a5..9c3e48d 100644
--- a/modules/plugins/ant-bundle/pom.xml
+++ b/modules/plugins/ant-bundle/pom.xml
@@ -47,22 +47,26 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<!-- include some optional Ant tasks for users to be able to use -->
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
</artifactItem>
<artifactItem>
diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml
index abc21d5..d9838cf 100644
--- a/modules/plugins/jboss-as-5/pom.xml
+++ b/modules/plugins/jboss-as-5/pom.xml
@@ -187,8 +187,9 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>dom4j</groupId>
diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml
index 1fee627..bd58a06 100644
--- a/modules/plugins/jboss-as/pom.xml
+++ b/modules/plugins/jboss-as/pom.xml
@@ -124,8 +124,9 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>org.rhq</groupId>
@@ -150,8 +151,9 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>dom4j</groupId>
diff --git a/modules/plugins/raw-config-test/pom.xml b/modules/plugins/raw-config-test/pom.xml
index 19a48fe..c615a39 100644
--- a/modules/plugins/raw-config-test/pom.xml
+++ b/modules/plugins/raw-config-test/pom.xml
@@ -69,10 +69,12 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.7.1</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.7.1</version>
</artifactItem>
<artifactItem>
<groupId>commons-configuration</groupId>
commit 841631a84639d50e8a111b3574af1537d6fa6cb1
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 27 08:41:56 2013 -0500
Revert "fix installer ant references"
This reverts commit 9d24ff5f20e37996594ebc6fa2f9d9bcc7c955ca.
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index 185cafe..4936d3f 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -20,6 +20,7 @@
<properties>
<moduleName>org.rhq.${project.artifactId}</moduleName>
<moduleDir>org/rhq/${project.artifactId}</moduleDir>
+ <ant.version>1.6.5</ant.version> <!-- the version used by dbutils that we need to depend on -->
</properties>
<dependencies>
diff --git a/pom.xml b/pom.xml
index 665f7b8..f3823c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -156,7 +156,6 @@
<commons-validator.version>1.1.4</commons-validator.version>
<commons-collections.version>3.2.1</commons-collections.version>
<commons-configuration.version>1.6</commons-configuration.version>
- <ant.version>1.8.4</ant.version>
<junit.version>4.8.2</junit.version>
<liquibase-core.version>1.9.5</liquibase-core.version>
@@ -824,13 +823,13 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>${ant.version}</version>
+ <version>1.8.4</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>${ant.version}</version>
+ <version>1.8.4</version>
</dependency>
<dependency>
@@ -921,7 +920,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>${ant.version}</version>
+ <version>1.8.4</version>
</dependency>
<!-- This includes the <if> task, and a bunch of other handy tasks. -->
11 years, 1 month
[rhq] Branch 'feature/cassandra-backend' - modules/common
by John Sanda
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java | 28 +++-
modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstallerException.java | 57 ++++++++++
modules/common/cassandra-installer/src/main/resources/logging.properties | 4
3 files changed, 79 insertions(+), 10 deletions(-)
New commits:
commit 54472730a50ef27f374b4a4decdf4bdfbc183684
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Mar 27 17:46:17 2013 -0400
update error handling for directory checks
The installer now aborts if it detects that the storage node will not be able
to write to any of the external directories to which it needs write access.
diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
index db0a69d..91b19e8 100644
--- a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
+++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstaller.java
@@ -110,7 +110,7 @@ public class StorageInstaller {
logDir = new File(rhqBaseDir, "logs");
Option hostname = new Option("n", "hostname", true, "The hostname or IP address on which the node will listen for " +
- "requests. If not specified, defaults to the value returned by InetAddress.getLocalHost().getHostName().");
+ "requests. If not specified, defaults to the hostname for localhost.");
hostname.setArgName("HOSTNAME");
Option seeds = new Option("s", "seeds", true, "A comma-delimited list of hostnames or IP addresses that " +
@@ -215,9 +215,15 @@ public class StorageInstaller {
deploymentOptions.setSslStoragePort(getPort(cmdLine, "ssl-storage-port", sslStoragePort));
deploymentOptions.load();
- checkPerms(options.getOption("saved-caches"), savedCachesDir);
- checkPerms(options.getOption("commitlog"), commitLogDir);
- checkPerms(options.getOption("data"), dataDir);
+ List<String> errors = new ArrayList<String>();
+ checkPerms(options.getOption("saved-caches"), savedCachesDir, errors);
+ checkPerms(options.getOption("commitlog"), commitLogDir, errors);
+ checkPerms(options.getOption("data"), dataDir, errors);
+
+ if (!errors.isEmpty()) {
+ throw new StorageInstallerException("Problems have been detected with one or more of the directories " +
+ "to which the storage node will need to store data.", errors);
+ }
UnmanagedDeployer deployer = new UnmanagedDeployer();
deployer.unpackBundle();
@@ -259,17 +265,17 @@ public class StorageInstaller {
return Integer.parseInt(cmdLine.getOptionValue(option, Integer.toString(defaultValue)));
}
- private void checkPerms(Option option, String path) {
+ private void checkPerms(Option option, String path, List<String> errors) {
File dir = new File(path);
if (dir.exists()) {
if (dir.isFile()) {
- log.warn(path + " is not a directory. Use the --" + option.getLongOpt() + " to change this value.");
+ errors.add(path + " is not a directory. Use the --" + option.getLongOpt() + " to change this value.");
}
} else {
File parent = findParentDir(new File(path));
if (!parent.canWrite()) {
- log.warn("The user running this installer does not appear to have write permissions to " + parent +
+ errors.add("The user running this installer does not appear to have write permissions to " + parent +
". Either make sure that the user running the storage node has write permissions or use the --" +
option.getLongOpt() + " to change this value.");
}
@@ -387,7 +393,13 @@ public class StorageInstaller {
CommandLineParser parser = new PosixParser();
CommandLine cmdLine = parser.parse(installer.getOptions(), args);
installer.run(cmdLine);
- return;
+ } catch (StorageInstallerException e) {
+ installer.log.warn(e.getMessage());
+ for (String error : e.getErrors()) {
+ installer.log.error(error);
+ }
+ installer.log.error("The installer is exiting due to previous errors.");
+ System.exit(1);
} catch (ParseException e) {
installer.printUsage();
}
diff --git a/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstallerException.java b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstallerException.java
new file mode 100644
index 0000000..2ed5af2
--- /dev/null
+++ b/modules/common/cassandra-installer/src/main/java/org/rhq/storage/installer/StorageInstallerException.java
@@ -0,0 +1,57 @@
+/*
+ *
+ * * RHQ Management Platform
+ * * Copyright (C) 2005-2012 Red Hat, Inc.
+ * * All rights reserved.
+ * *
+ * * This program is free software; you can redistribute it and/or modify
+ * * it under the terms of the GNU General Public License, version 2, as
+ * * published by the Free Software Foundation, and/or the GNU Lesser
+ * * General Public License, version 2.1, also as published by the Free
+ * * Software Foundation.
+ * *
+ * * 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 and the GNU Lesser General Public License
+ * * for more details.
+ * *
+ * * You should have received a copy of the GNU General Public License
+ * * and the GNU Lesser 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.storage.installer;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * @author John Sanda
+ */
+public class StorageInstallerException extends Exception {
+
+ private List<String> errors = new ArrayList<String>();
+
+ public StorageInstallerException() {
+ }
+
+ public StorageInstallerException(String message) {
+ super(message);
+ }
+
+ public StorageInstallerException(String message, Throwable cause) {
+ super(message, cause);
+ }
+
+ public StorageInstallerException(String msg, List<String> errors) {
+ super(msg);
+ this.errors = errors;
+ }
+
+ public List<String> getErrors() {
+ return errors;
+ }
+}
diff --git a/modules/common/cassandra-installer/src/main/resources/logging.properties b/modules/common/cassandra-installer/src/main/resources/logging.properties
index 92288e1..15a0e92 100644
--- a/modules/common/cassandra-installer/src/main/resources/logging.properties
+++ b/modules/common/cassandra-installer/src/main/resources/logging.properties
@@ -1,5 +1,5 @@
# Additional logger names to configure (root logger is always configured)
-loggers=org.rhq, org.rhq.cassandra.installer.CassandraInstaller
+loggers=org.rhq, org.rhq.storage.installer.StorageInstaller
# Root logger level
logger.level=${rhq.storage.installer.loglevel:INFO}
@@ -7,7 +7,7 @@ logger.level=${rhq.storage.installer.loglevel:INFO}
logger.handlers=FILE,CONSOLE
logger.org.rhq.level=WARN
-logger.org.rhq.cassandra.installer.CassandraInstaller.level=INFO
+logger.org.rhq.storage.installer.StorageInstaller.level=INFO
# Console handler configuration
handler.CONSOLE=org.jboss.logmanager.handlers.ConsoleHandler
11 years, 1 month
[rhq] Branch 'bug/918677' - modules/plugins
by snegrea
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
New commits:
commit eea8af31ee1074cb99218cdea48e37f25e507601
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 27 13:31:14 2013 -0500
[BZ 918677] Throw the original exception in case a subsequent error occurs due to invalid credentials.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
index f8a86a0..b6329ae 100644
--- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
+++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ASConnection.java
@@ -331,7 +331,12 @@ public class ASConnection {
conn.disconnect();
if (retry) {
- return executeRaw(operation, timeoutSec, false);
+ try {
+ return executeRaw(operation, timeoutSec, false);
+ } catch (Exception e) {
+ log.error("Retry failed, throwing original error");
+ throw ipce;
+ }
} else {
throw ipce;
}
11 years, 1 month
[rhq] pom.xml
by snegrea
pom.xml | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
New commits:
commit 2227cbc40dcfa6e922fbe8569e041b930bc2e627
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 27 09:02:48 2013 -0500
[BZ 923458] Roll back ant version to the latest version declared in child poms and not the root pom.
diff --git a/pom.xml b/pom.xml
index f3823c3..0a804a7 100644
--- a/pom.xml
+++ b/pom.xml
@@ -823,19 +823,19 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>1.8.4</version>
+ <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>1.8.4</version>
+ <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
- <version>1.8.1</version>
+ <version>1.8.0</version>
</dependency>
<dependency>
11 years, 1 month
[rhq] 2 commits - modules/common modules/core modules/enterprise modules/helpers modules/plugins pom.xml
by snegrea
modules/common/ant-bundle/pom.xml | 3 +++
modules/common/jboss-as/pom.xml | 3 ++-
modules/core/dbutils/pom.xml | 6 ++++--
modules/enterprise/server/installer/pom.xml | 11 +++++++----
modules/enterprise/server/plugins/ant-bundle/pom.xml | 4 ++++
modules/enterprise/server/plugins/groovy-script/pom.xml | 1 +
modules/helpers/perftest-support/pom.xml | 6 ++++--
modules/plugins/ant-bundle/pom.xml | 4 ++++
modules/plugins/jboss-as-5/pom.xml | 3 ++-
modules/plugins/jboss-as/pom.xml | 6 ++++--
modules/plugins/raw-config-test/pom.xml | 2 ++
pom.xml | 7 +++----
12 files changed, 40 insertions(+), 16 deletions(-)
New commits:
commit d15e5ceedb318119bc807d203f794ba56c0eabd3
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 27 08:56:49 2013 -0500
[BZ 923458] Revert ant version changes since they are used in bundles.
diff --git a/modules/common/ant-bundle/pom.xml b/modules/common/ant-bundle/pom.xml
index 26e7795..4cf6703 100644
--- a/modules/common/ant-bundle/pom.xml
+++ b/modules/common/ant-bundle/pom.xml
@@ -53,17 +53,20 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.8.0</version>
</dependency>
<!-- include some optional Ant tasks for users to be able to use -->
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
+ <version>1.8.0</version>
</dependency>
<dependency>
diff --git a/modules/common/jboss-as/pom.xml b/modules/common/jboss-as/pom.xml
index a53545f..b9ee5be 100644
--- a/modules/common/jboss-as/pom.xml
+++ b/modules/common/jboss-as/pom.xml
@@ -16,8 +16,9 @@
<dependencies>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index f6d5f5a..085ba4c 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -37,8 +37,9 @@
<!-- 3rd Party Deps -->
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
@@ -46,9 +47,10 @@
<version>1.1.1</version>
</dependency>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
<scope>test</scope>
+ <version>1.6.5</version>
</dependency>
<dependency>
<groupId>i18nlog</groupId>
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index 4936d3f..0460892 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -63,13 +63,15 @@
<!-- we need to package this (and ant) in our module -->
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
@@ -134,11 +136,11 @@
<artifactId>rhq-jboss-as-dmr-client</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
</artifactItem>
<artifactItem>
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml b/modules/enterprise/server/plugins/ant-bundle/pom.xml
index 5227e8c..489b37b 100644
--- a/modules/enterprise/server/plugins/ant-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml
@@ -75,22 +75,26 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<!-- include some optional Ant tasks for users to be able to use -->
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
</artifactItem>
<artifactItem>
diff --git a/modules/enterprise/server/plugins/groovy-script/pom.xml b/modules/enterprise/server/plugins/groovy-script/pom.xml
index ce163b8..ea20099 100644
--- a/modules/enterprise/server/plugins/groovy-script/pom.xml
+++ b/modules/enterprise/server/plugins/groovy-script/pom.xml
@@ -23,6 +23,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.opensymphony.quartz</groupId>
diff --git a/modules/helpers/perftest-support/pom.xml b/modules/helpers/perftest-support/pom.xml
index 43458a5..ed71426 100644
--- a/modules/helpers/perftest-support/pom.xml
+++ b/modules/helpers/perftest-support/pom.xml
@@ -14,12 +14,14 @@
</description>
<dependencies>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</dependency>
<dependency>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.6.5</version>
<scope>runtime</scope>
</dependency>
<dependency>
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml
index cc1a8a5..9c3e48d 100644
--- a/modules/plugins/ant-bundle/pom.xml
+++ b/modules/plugins/ant-bundle/pom.xml
@@ -47,22 +47,26 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<!-- include some optional Ant tasks for users to be able to use -->
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-nodeps</artifactId>
+ <version>1.8.0</version>
</artifactItem>
<artifactItem>
<groupId>ant-contrib</groupId>
<artifactId>ant-contrib</artifactId>
+ <version>1.0b3</version>
</artifactItem>
<artifactItem>
diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml
index abc21d5..d9838cf 100644
--- a/modules/plugins/jboss-as-5/pom.xml
+++ b/modules/plugins/jboss-as-5/pom.xml
@@ -187,8 +187,9 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>dom4j</groupId>
diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml
index 1fee627..bd58a06 100644
--- a/modules/plugins/jboss-as/pom.xml
+++ b/modules/plugins/jboss-as/pom.xml
@@ -124,8 +124,9 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>org.rhq</groupId>
@@ -150,8 +151,9 @@
<artifactId>jbpm</artifactId>
</artifactItem>
<artifactItem>
- <groupId>org.apache.ant</groupId>
+ <groupId>ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.6.5</version>
</artifactItem>
<artifactItem>
<groupId>dom4j</groupId>
diff --git a/modules/plugins/raw-config-test/pom.xml b/modules/plugins/raw-config-test/pom.xml
index 19a48fe..c615a39 100644
--- a/modules/plugins/raw-config-test/pom.xml
+++ b/modules/plugins/raw-config-test/pom.xml
@@ -69,10 +69,12 @@
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
+ <version>1.7.1</version>
</artifactItem>
<artifactItem>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
+ <version>1.7.1</version>
</artifactItem>
<artifactItem>
<groupId>commons-configuration</groupId>
commit 841631a84639d50e8a111b3574af1537d6fa6cb1
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 27 08:41:56 2013 -0500
Revert "fix installer ant references"
This reverts commit 9d24ff5f20e37996594ebc6fa2f9d9bcc7c955ca.
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml
index 185cafe..4936d3f 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -20,6 +20,7 @@
<properties>
<moduleName>org.rhq.${project.artifactId}</moduleName>
<moduleDir>org/rhq/${project.artifactId}</moduleDir>
+ <ant.version>1.6.5</ant.version> <!-- the version used by dbutils that we need to depend on -->
</properties>
<dependencies>
diff --git a/pom.xml b/pom.xml
index 665f7b8..f3823c3 100644
--- a/pom.xml
+++ b/pom.xml
@@ -156,7 +156,6 @@
<commons-validator.version>1.1.4</commons-validator.version>
<commons-collections.version>3.2.1</commons-collections.version>
<commons-configuration.version>1.6</commons-configuration.version>
- <ant.version>1.8.4</ant.version>
<junit.version>4.8.2</junit.version>
<liquibase-core.version>1.9.5</liquibase-core.version>
@@ -824,13 +823,13 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>${ant.version}</version>
+ <version>1.8.4</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant-launcher</artifactId>
- <version>${ant.version}</version>
+ <version>1.8.4</version>
</dependency>
<dependency>
@@ -921,7 +920,7 @@
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
- <version>${ant.version}</version>
+ <version>1.8.4</version>
</dependency>
<!-- This includes the <if> task, and a bunch of other handy tasks. -->
11 years, 1 month
[rhq] Branch 'bug/927868' - modules/common modules/enterprise
by Heiko W. Rupp
modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java | 12 ++
modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/MCCHelper.java | 51 ++++++++++
modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java | 8 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemInfoManagerBean.java | 12 ++
4 files changed, 76 insertions(+), 7 deletions(-)
New commits:
commit 565a1d6a70451e41bb8350a59ba27a1ac702f6d5
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Mar 27 13:22:00 2013 +0100
Add app-server information (version etc.) to the system information dump.
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java
index 4521b35..5078d08 100644
--- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java
+++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/CoreJBossASClient.java
@@ -49,7 +49,7 @@ public class CoreJBossASClient extends JBossASClient {
* This returns the system properties that are set in the AS JVM. This is not the system properties
* in the JVM of this client object - it is actually the system properties in the remote
* JVM of the AS instance that the client is talking to.
- *
+ *
* @return the AS JVM's system properties
* @throws Exception
*/
@@ -86,6 +86,16 @@ public class CoreJBossASClient extends JBossASClient {
return version;
}
+ public String getServerProductVersion() throws Exception {
+ final String version = getStringAttribute("product-version", Address.root());
+ return version;
+ }
+
+ public String getServerProductName() throws Exception {
+ final String version = getStringAttribute("product-name", Address.root());
+ return version;
+ }
+
public String getAppServerHomeDir() throws Exception {
final String[] address = { CORE_SERVICE, SERVER_ENVIRONMENT };
final String dir = getStringAttribute(true, "home-dir", Address.root().add(address));
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/MCCHelper.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/MCCHelper.java
new file mode 100644
index 0000000..b344963
--- /dev/null
+++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/MCCHelper.java
@@ -0,0 +1,51 @@
+/*
+ * 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.common.jbossas.client.controller;
+
+import org.jboss.as.controller.client.ModelControllerClient;
+
+/**
+ * Helper class to get a ModelContollerClient for the RHQ default settings.
+ * This follows the methods in the Installer, but assumes defaults.
+ * @author Heiko W. Rupp
+ */
+public class MCCHelper {
+
+
+ public static ModelControllerClient getModelControllerClient() {
+ return getModelControllerClient("localhost",6999);
+ }
+
+ public static ModelControllerClient getModelControllerClient(String host,int port) {
+ ModelControllerClient client;
+ try {
+ if (host==null || host.isEmpty())
+ host = "localhost";
+
+ if (port <= 0)
+ port = 6999; // Default for RHQ TODO obtain from rhq-server.properties, jboss.management.native.port=6999 ?
+ client = ModelControllerClient.Factory.create(host, port);
+ } catch (Exception e) {
+ throw new RuntimeException("Cannot obtain client connection to the app server", e);
+ }
+ return client;
+ }
+
+}
diff --git a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
index 10df849..f977f0a 100644
--- a/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
+++ b/modules/common/jboss-as-dmr-client/src/main/java/org/rhq/common/jbossas/client/controller/SecurityDomainJBossASClient.java
@@ -147,8 +147,6 @@ public class SecurityDomainJBossASClient extends JBossASClient {
ModelNode batch = createBatchRequest(addTopNode, addAuthNode, loginModule);
- System.err.println("== security domain ==> " + batch.toJSONString(false));
-
ModelNode results = execute(batch);
if (!isSuccess(results)) {
throw new FailureException(results, "Failed to create security domain [" + securityDomainName + "]");
@@ -365,7 +363,7 @@ public class SecurityDomainJBossASClient extends JBossASClient {
}
- public void createNewSecurityDomain71(String securityDomainName, LoginModuleRequest... loginModules) throws Exception {
+ private void createNewSecurityDomain71(String securityDomainName, LoginModuleRequest... loginModules) throws Exception {
if (isSecurityDomain(securityDomainName)) {
removeSecurityDomain(securityDomainName);
@@ -379,8 +377,6 @@ public class SecurityDomainJBossASClient extends JBossASClient {
ModelNode addAuthNode = createRequest(ADD, addr.clone().add(AUTHENTICATION, CLASSIC));
ModelNode loginModulesNode = addAuthNode.get(LOGIN_MODULES);
- ModelNode[] loginModuleNodes = new ModelNode[loginModules.length];
-
for (int i = 0, len = loginModules.length; i < len; ++i) {
ModelNode loginModule = new ModelNode();
loginModule.get(CODE).set(loginModules[i].getLoginModuleFQCN());
@@ -410,7 +406,7 @@ public class SecurityDomainJBossASClient extends JBossASClient {
return;
}
- public void createNewSecurityDomain72(String securityDomainName, LoginModuleRequest... loginModules) throws Exception {
+ private void createNewSecurityDomain72(String securityDomainName, LoginModuleRequest... loginModules) throws Exception {
if (isSecurityDomain(securityDomainName)) {
removeSecurityDomain(securityDomainName);
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemInfoManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemInfoManagerBean.java
index 27d4dfc..0bd1103 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemInfoManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/system/SystemInfoManagerBean.java
@@ -9,6 +9,8 @@ import javax.ejb.Stateless;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+import org.rhq.common.jbossas.client.controller.CoreJBossASClient;
+import org.rhq.common.jbossas.client.controller.MCCHelper;
import org.rhq.core.domain.alert.Alert;
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
@@ -59,6 +61,16 @@ public class SystemInfoManagerBean implements SystemInfoManagerLocal{
result.put("FullName", productInfo.getFullName());
result.put("Name", productInfo.getName());
+ try {
+ CoreJBossASClient coreClient = new CoreJBossASClient(MCCHelper.getModelControllerClient());
+ result.put("AS version",coreClient.getAppServerVersion());
+ result.put("AS product version", coreClient.getServerProductVersion());
+ result.put("AS product name", coreClient.getServerProductName());
+ result.put("AS config dir", coreClient.getAppServerConfigDir());
+ } catch (Exception e) {
+ result.put("AS*", "Not able to get AS props due to " + e.getMessage());
+ }
+
SystemSettings systemSettings=systemManager.getSystemSettings(caller);
Map<String,String> settingsMap = systemSettings.toMap();
// Don't use putAll(), as we need to filter out passwords
11 years, 1 month
[rhq] Branch 'bug/rhq-1' - 4 commits - .classpath modules/enterprise
by mazz
.classpath | 2
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java | 112 +++++++---
modules/enterprise/server/jar/pom.xml | 5
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java | 1
4 files changed, 96 insertions(+), 24 deletions(-)
New commits:
commit e58aed61847d583ad964cf1f437cd32923d9aaeb
Merge: d2a561e 354f2d4
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 27 09:39:34 2013 -0400
Merge remote-tracking branch 'origin/master' into bug/rhq-1
commit 354f2d4ced38e4eb7f75a56d6b33dfa6b37bc278
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 27 09:37:46 2013 -0400
put back commons-collection dep, it is needed by quartz
diff --git a/.classpath b/.classpath
index d35bf95..b060cc7 100644
--- a/.classpath
+++ b/.classpath
@@ -219,7 +219,7 @@
<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"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar" sourcepath="/M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar" sourcepath="/M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-jmx/4.2.3.GA/jboss-jmx-4.2.3.GA.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/tomcat/catalina/5.5.20/catalina-5.5.20.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar"/>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index 1a70da8..acb8931 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -285,6 +285,11 @@
<scope>provided</scope> <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
</dependency>
+ <!-- this is needed by quartz -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
<dependency>
<groupId>org.snmp4j</groupId>
commit 592dfd81a99ec6d2b1486f2a99aa1ff95e771e5b
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Mar 27 14:10:12 2013 +0100
Enabling two tests that test the edge cases for criteria queries. Tesing possible regression of BZ 923458. Also added 8 more combinations of page size, start page and count of filtered elements.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
index 3cadf38..cd2523e 100644
--- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
+++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/cloud/TopologyManagerBeanTest.java
@@ -23,6 +23,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
+import java.util.TreeSet;
import org.testng.annotations.Test;
@@ -319,29 +320,87 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
}
});
}
-
-
+
@Test(groups = "integration.ejb3")
public void testParsingAllCriteriaQueryResults1() throws Exception {
- testParsingHelperStartingPageEqualTo(0);
+ int startPage = 0;
+ int pageSize = 3;
+ int serverCount = 605;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
}
-
- /**
- * This test should pass if enabled, but doesn't :(
- */
- @Test(groups = "integration.ejb3", enabled = false)
+
+ @Test(groups = "integration.ejb3", enabled = true)
public void testParsingAllCriteriaQueryResults2() throws Exception {
- testParsingHelperStartingPageEqualTo(1);
+ int startPage = 1;
+ int pageSize = 3;
+ int serverCount = 605;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
}
-
- /**
- * This test should pass if enabled, but doesn't :(
- */
- @Test(groups = "integration.ejb3", enabled = false)
+
+ @Test(groups = "integration.ejb3", enabled = true)
public void testParsingAllCriteriaQueryResults3() throws Exception {
- testParsingHelperStartingPageEqualTo(5);
+ int startPage = 2;
+ int pageSize = 3;
+ int serverCount = 609;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
}
-
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults4() throws Exception {
+ int startPage = 3;
+ int pageSize = 7;
+ int serverCount = 800;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults5() throws Exception {
+ int startPage = 4;
+ int pageSize = 2;
+ int serverCount = 444;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults6() throws Exception {
+ int startPage = 5;
+ int pageSize = 3;
+ int serverCount = 605;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults7() throws Exception {
+ int startPage = 1;
+ int pageSize = 5;
+ int serverCount = 934;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults8() throws Exception {
+ int startPage = 4;
+ int pageSize = 7;
+ int serverCount = 1234;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults9() throws Exception {
+ int startPage = 2;
+ int pageSize = 1;
+ int serverCount = 109;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
+ @Test(groups = "integration.ejb3", enabled = true)
+ public void testParsingAllCriteriaQueryResults10() throws Exception {
+ int startPage = 0;
+ int pageSize = 11;
+ int serverCount = 999;
+ testParsingHelperStartingPageEqualTo(startPage, pageSize, serverCount);
+ }
+
@Test(groups = "integration.ejb3")
public void testFindNonExistentServer() throws Exception {
@@ -390,19 +449,17 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
}
- private void testParsingHelperStartingPageEqualTo(final int startPage) throws Exception {
+ private void testParsingHelperStartingPageEqualTo(final int startPage, final int pageSize, final int serverCount) throws Exception {
- final int serverCount = 605;
- final int pageSize = 3;
executeInTransaction(new TransactionCallback() {
public void execute() throws Exception {
// verify that all server objects are actually parsed.
- final Set<String> serverNames = new HashSet<String>(serverCount);
+ final Set<String> serverNames = new TreeSet<String>();
final String namePrefix = "server";
final String addressPrefix = "address";
int shouldBeFoundCount = 0;
int shouldBeSkipped = pageSize * startPage;
-
+
for (int i = 0; i < serverCount; i++) {
String name = namePrefix + String.format(" %03d", i + 1);
Server server = new Server();
@@ -413,7 +470,7 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
break;
case 1:
server.setOperationMode(OperationMode.MAINTENANCE);
- if (i % 20 == 9 && shouldBeSkipped-- <= 0) {
+ if (i % 20 == 9) {
shouldBeFoundCount++;
serverNames.add(name);
}
@@ -427,6 +484,15 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
em.flush();
}
em.flush();
+
+ if (shouldBeSkipped > 0) {
+ // delete the members to be skipped because of the start page
+ String[] serverNamesArray = serverNames.toArray(new String[serverNames.size()]);
+ for (int i = 0; i < shouldBeSkipped; i++) {
+ serverNames.remove(serverNamesArray[serverNamesArray.length - i - 1]);
+ }
+ shouldBeFoundCount -= shouldBeSkipped;
+ }
// query the results and delete the servers
ServerCriteria criteria = new ServerCriteria();
@@ -466,7 +532,7 @@ public class TopologyManagerBeanTest extends AbstractEJB3Test {
serverNames.remove(s.getName());
}
- final int finderCallCounter = (int) Math.ceil((double) shouldBeFoundCount / pageSize) - startPage;
+ final int finderCallCounter = (int) Math.ceil((double) shouldBeFoundCount / pageSize);
assertTrue("While iterating the servers, the findServersByCriteria() should be called "
+ finderCallCounter + " times. It was called " + pagesFlipped.get(0) + " times.",
pagesFlipped.get(0) == finderCallCounter);
commit 902ce81c0fa6e6f0b66091c77977c68a05c3248d
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Mar 27 14:06:42 2013 +0100
[BZ 923458] - CriteriaQuery based finder fails if the start page is not zero and the totalSize is dividable by pageSize - Changing the initial value of variable count. It takes into consideration the possible offset made by using the non-zero start page set in the criteria.
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 ab6a915..2d40388 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
@@ -110,6 +110,7 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T> {
public QueryResultsIterator(PageList<T> firstPage) {
currentPage = firstPage;
iterator = currentPage.iterator();
+ count = firstPage == null || firstPage.getPageControl() == null ? 0 : firstPage.getPageControl().getStartRow();
}
@Override
11 years, 1 month
[rhq] .classpath modules/enterprise
by mazz
.classpath | 2 +-
modules/enterprise/server/jar/pom.xml | 5 +++++
2 files changed, 6 insertions(+), 1 deletion(-)
New commits:
commit 354f2d4ced38e4eb7f75a56d6b33dfa6b37bc278
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Mar 27 09:37:46 2013 -0400
put back commons-collection dep, it is needed by quartz
diff --git a/.classpath b/.classpath
index d35bf95..b060cc7 100644
--- a/.classpath
+++ b/.classpath
@@ -219,7 +219,7 @@
<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"/>
- <classpathentry exported="true" kind="var" path="M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar" sourcepath="/M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2-sources.jar"/>
+ <classpathentry exported="true" kind="var" path="M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1.jar" sourcepath="/M2_REPO/commons-collections/commons-collections/3.2.1/commons-collections-3.2.1-sources.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/jboss/jboss-jmx/4.2.3.GA/jboss-jmx-4.2.3.GA.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/tomcat/catalina/5.5.20/catalina-5.5.20.jar"/>
<classpathentry exported="true" kind="var" path="M2_REPO/commons-beanutils/commons-beanutils/1.7.0/commons-beanutils-1.7.0.jar"/>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml
index 1a70da8..acb8931 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -285,6 +285,11 @@
<scope>provided</scope> <!-- by JBossAS itself, which the container build has packaged with 1.6.5 -->
</dependency>
+ <!-- this is needed by quartz -->
+ <dependency>
+ <groupId>commons-collections</groupId>
+ <artifactId>commons-collections</artifactId>
+ </dependency>
<dependency>
<groupId>org.snmp4j</groupId>
11 years, 1 month