.classpath | 36 code-coverage/pom.xml | 2 dev/null |binary etc/agentspawn/src/scripts/agentcopy.properties | 4 modules/cli-tests/pom.xml | 2 modules/common/ant-bundle/pom.xml | 2 modules/common/drift/pom.xml | 2 modules/common/filetemplate-bundle/pom.xml | 2 modules/common/jboss-as-dmr-client/pom.xml | 2 modules/common/jboss-as/pom.xml | 2 modules/common/pom.xml | 2 modules/core/arquillian-integration/archive/pom.xml | 2 modules/core/arquillian-integration/container/pom.xml | 2 modules/core/arquillian-integration/pom.xml | 2 modules/core/arquillian-integration/suite-extension/pom.xml | 2 modules/core/client-api/pom.xml | 2 modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/configuration/ConfigurationServerService.java | 4 modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java | 23 modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java | 1 modules/core/comm-api/pom.xml | 2 modules/core/dbutils/pom.xml | 4 modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseType.java | 13 modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java | 15 modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml | 23 modules/core/domain/pom.xml | 36 modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java | 17 modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java | 24 modules/core/domain/src/test/resources/arquillian.xml | 4 modules/core/gui/pom.xml | 2 modules/core/native-system/pom.xml | 2 modules/core/plugin-api/pom.xml | 2 modules/core/plugin-container-itest/pom.xml | 2 modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java | 8 modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/LateMeasurementRescheduleTest.java | 4 modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/ReadOnlyScheduleSetTest.java | 4 modules/core/plugin-container/pom.xml | 2 modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java | 64 - modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java | 133 ++ modules/core/plugin-test-api/pom.xml | 2 modules/core/plugin-test-util/pom.xml | 2 modules/core/plugin-validator/pom.xml | 2 modules/core/plugindoc/pom.xml | 2 modules/core/pom.xml | 2 modules/core/util/pom.xml | 2 modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java | 20 modules/enterprise/agent/pom.xml | 2 modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java | 12 modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentManagement.java | 4 modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java | 8 modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java | 38 modules/enterprise/agentupdate/pom.xml | 2 modules/enterprise/binding/pom.xml | 64 + modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java | 10 modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java | 11 modules/enterprise/comm/pom.xml | 2 modules/enterprise/gui/content_http-war/pom.xml | 2 modules/enterprise/gui/coregui/pom.xml | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java | 3 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java | 78 - modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java | 1 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java | 14 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java | 24 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java | 2 modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java | 4 modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties | 2 modules/enterprise/gui/pom.xml | 2 modules/enterprise/gui/portal-war/pom.xml | 2 modules/enterprise/gui/rest-examples-war/pom.xml | 2 modules/enterprise/gui/rest-war/pom.xml | 2 modules/enterprise/pom.xml | 2 modules/enterprise/remoting/cli/pom.xml | 36 modules/enterprise/remoting/client-api/pom.xml | 2 modules/enterprise/remoting/client-deps/pom.xml | 2 modules/enterprise/remoting/pom.xml | 2 modules/enterprise/scripting/api/pom.xml | 4 modules/enterprise/scripting/javascript/pom.xml | 4 modules/enterprise/scripting/pom.xml | 4 modules/enterprise/scripting/python/pom.xml | 4 modules/enterprise/server/appserver/pom.xml | 2 modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml | 1 modules/enterprise/server/client-api/pom.xml | 4 modules/enterprise/server/ear/pom.xml | 2 modules/enterprise/server/installer/pom.xml | 2 modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java | 9 modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java | 9 modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java | 77 + modules/enterprise/server/installer/src/main/resources/logging.properties | 3 modules/enterprise/server/itests-2/pom.xml | 361 ++++--- modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java | 96 +- modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java | 53 - modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerCommunicationsService.java | 7 modules/enterprise/server/itests-2/src/test/resources/arquillian.xml | 4 modules/enterprise/server/jar/pom.xml | 39 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java | 124 +- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java | 7 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java | 8 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java | 4 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java | 9 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java | 21 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java | 3 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsService.java | 12 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsServiceMBean.java | 17 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java | 353 ++++--- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java | 10 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java | 133 +- modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java | 11 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java | 58 + modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java | 35 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/BadArgumentException.java | 3 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java | 20 modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java | 81 + modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java | 8 modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java | 10 modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java | 52 + modules/enterprise/server/plugins/alert-cli/pom.xml | 4 modules/enterprise/server/plugins/alert-email/pom.xml | 4 modules/enterprise/server/plugins/alert-irc/pom.xml | 4 modules/enterprise/server/plugins/alert-log4j/pom.xml | 4 modules/enterprise/server/plugins/alert-microblog/pom.xml | 4 modules/enterprise/server/plugins/alert-mobicents/pom.xml | 4 modules/enterprise/server/plugins/alert-operations/pom.xml | 4 modules/enterprise/server/plugins/alert-roles/pom.xml | 4 modules/enterprise/server/plugins/alert-snmp/pom.xml | 4 modules/enterprise/server/plugins/alert-subject/pom.xml | 4 modules/enterprise/server/plugins/ant-bundle/pom.xml | 2 modules/enterprise/server/plugins/cobbler/pom.xml | 4 modules/enterprise/server/plugins/disk/pom.xml | 2 modules/enterprise/server/plugins/drift-rhq/pom.xml | 2 modules/enterprise/server/plugins/filetemplate-bundle/pom.xml | 2 modules/enterprise/server/plugins/jboss-software/pom.xml | 2 modules/enterprise/server/plugins/packagetype-cli/pom.xml | 4 modules/enterprise/server/plugins/pom.xml | 2 modules/enterprise/server/plugins/url/pom.xml | 2 modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml | 2 modules/enterprise/server/plugins/yum/pom.xml | 2 modules/enterprise/server/pom.xml | 4 modules/enterprise/server/safe-invoker/pom.xml | 2 modules/enterprise/server/sars/pom.xml | 2 modules/enterprise/server/sars/services-sar/pom.xml | 2 modules/enterprise/server/startup-subsystem/pom.xml | 2 modules/enterprise/server/xml-schemas/pom.xml | 2 modules/helpers/bundleGen/pom.xml | 4 modules/helpers/jeeGen/pom.xml | 2 modules/helpers/perftest-support/pom.xml | 4 modules/helpers/pom.xml | 2 modules/helpers/rest-docs-generator/pom.xml | 2 modules/helpers/rtfilter-subsystem/pom.xml | 2 modules/helpers/rtfilter/pom.xml | 2 modules/integration-tests/apache-plugin-test/pom.xml | 40 modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java | 33 modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java | 88 + modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java | 115 +- modules/integration-tests/jndi-access/jndi-access-test/pom.xml | 59 - modules/integration-tests/jndi-access/pom.xml | 2 modules/integration-tests/jndi-access/remote-server/pom.xml | 2 modules/integration-tests/pom.xml | 2 modules/integration-tests/rest-api/pom.xml | 2 modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java | 383 +++++++- modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java | 54 + modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java | 232 ++++ modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java | 25 modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java | 55 + modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Availability.java | 64 + modules/plugins/aliases/pom.xml | 2 modules/plugins/ant-bundle/pom.xml | 2 modules/plugins/apache/pom.xml | 2 modules/plugins/augeas/pom.xml | 2 modules/plugins/byteman/pom.xml | 2 modules/plugins/cassandra/pom.xml | 2 modules/plugins/cobbler/pom.xml | 2 modules/plugins/cron/pom.xml | 2 modules/plugins/database/pom.xml | 2 modules/plugins/filetemplate-bundle/pom.xml | 2 modules/plugins/grub/pom.xml | 2 modules/plugins/hadoop/pom.xml | 2 modules/plugins/hibernate/pom.xml | 2 modules/plugins/hosts/pom.xml | 2 modules/plugins/hudson/pom.xml | 4 modules/plugins/iis/pom.xml | 2 modules/plugins/irc/pom.xml | 2 modules/plugins/jboss-as-5/pom.xml | 2 modules/plugins/jboss-as-7/pom.xml | 2 modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java | 171 ++- modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java | 20 modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml | 12 modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java | 20 modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java | 1 modules/plugins/jboss-as/pom.xml | 2 modules/plugins/jboss-cache-v3/pom.xml | 2 modules/plugins/jboss-cache/pom.xml | 2 modules/plugins/jmx/pom.xml | 2 modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java | 20 modules/plugins/kickstart/pom.xml | 2 modules/plugins/mod-cluster/pom.xml | 2 modules/plugins/mysql/pom.xml | 2 modules/plugins/netservices/pom.xml | 468 ++++------ modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponent.java | 214 +++- modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponentConfiguration.java | 57 + modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponent.java | 51 - modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceComponent.java | 77 - modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponent.java | 41 modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml | 37 modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponentTest.java | 178 +++ modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponentTest.java | 105 ++ modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java | 162 +++ modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java | 154 +++ modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PingNetServiceComponentTest.java | 98 ++ modules/plugins/netservices/src/test/resources/log4j.xml | 32 modules/plugins/noop/pom.xml | 2 modules/plugins/oracle/pom.xml | 2 modules/plugins/pattern-generator/pom.xml | 2 modules/plugins/perftest/pom.xml | 2 modules/plugins/platform/pom.xml | 2 modules/plugins/pom.xml | 36 modules/plugins/postfix/pom.xml | 2 modules/plugins/postgres/pom.xml | 2 modules/plugins/rhq-agent/pom.xml | 2 modules/plugins/rhq-server/pom.xml | 2 modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml | 7 modules/plugins/samba/pom.xml | 2 modules/plugins/script/pom.xml | 2 modules/plugins/script2/pom.xml | 2 modules/plugins/snmptrapd/pom.xml | 2 modules/plugins/sshd/pom.xml | 2 modules/plugins/sudoers/pom.xml | 2 modules/plugins/tomcat/pom.xml | 2 modules/plugins/twitter/pom.xml | 2 modules/plugins/validate-all-plugins/pom.xml | 2 modules/plugins/virt/pom.xml | 2 modules/pom.xml | 2 modules/test-utils/pom.xml | 2 pom.xml | 2 234 files changed, 4118 insertions(+), 1687 deletions(-)
New commits: commit 95ea451aaf0d230c76f0e446e4965fb929250aa2 Merge: 0d09f03 c367f45 Author: John Mazzitelli mazz@redhat.com Date: Tue Feb 26 09:35:51 2013 -0500
Merge branch 'master' into bug/783603
commit c367f45a05cd488d4822d51f4c6368f5924c8223 Author: Thomas Segismont tsegismo@redhat.com Date: Thu Feb 21 11:34:05 2013 +0100
BZ911327 - [EAP 6.1] Restarting servers in server-group fails
While the bug was detected because of the underlying EAP operation failing, it appears that the RHQ timeout for this operation is pretty low. The operation timeout is now configurable and should be adjusted by users for their particular environment. It defaults to 2 minutes.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java index 71967e5..eb97042 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java @@ -55,29 +55,30 @@ import org.rhq.modules.plugins.jbossas7.json.Result; * Component dealing with server group specific things * @author Heiko W. Rupp */ -@SuppressWarnings("unused") public class ServerGroupComponent extends BaseComponent implements ContentFacet, CreateChildResourceFacet, OperationFacet {
- private static final String SUCCESS = "success"; private static final String OUTCOME = "outcome"; + private static final String RESTART_SERVERS = "restart-servers";
@Override public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException, Exception { - Operation op = new Operation(name, getAddress()); - Result res = getASConnection().execute(op); - + Result res = null; + if (RESTART_SERVERS.equals(name)) { + // This operation as a timeout parameter as it can run for quite a long time + res = getASConnection().execute(op, parameters.getSimple("responseTimeout").getIntegerValue()); + } else { + res = getASConnection().execute(op); + } OperationResult result = new OperationResult(); - if (res.isSuccess()) { - result.setSimpleResult(SUCCESS); + result.setSimpleResult(Result.SUCCESS); } else { result.setErrorMessage(res.getFailureDescription()); } return result; - }
@Override @@ -119,7 +120,7 @@ public class ServerGroupComponent extends BaseComponent implements ContentFacet,
if (uploadResult.has(OUTCOME)) { String outcome = uploadResult.get(OUTCOME).getTextValue(); - if (outcome.equals(SUCCESS)) { // Upload was successful, so now add the file to the server group + if (outcome.equals(Result.SUCCESS)) { // Upload was successful, so now add the file to the server group JsonNode resultNode = uploadResult.get("result"); String hash = resultNode.get("BYTES_VALUE").getTextValue(); ASConnection connection = getASConnection(); @@ -202,6 +203,7 @@ public class ServerGroupComponent extends BaseComponent implements ContentFacet, return null; // TODO: Customise this generated block }
+ @SuppressWarnings("unused") private String serverGroupFromKey() { String key1 = context.getResourceKey(); return key1.substring(key1.lastIndexOf("/") + 1); diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml index 2509073..cf01d5f 100644 --- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml @@ -1016,7 +1016,10 @@ <c:simple-property name="operationResult"/> </results> </operation> - <operation name="restart-servers" description="Restarts all servers belonging to the server group currently running in the domain."> + <operation name="restart-servers" description="Restarts all servers belonging to the server group currently running in the domain." timeout="180"> + <parameters> + <c:simple-property name="responseTimeout" default="120" type="long" description="Amount of time the agent will be waiting for domain host response. Defaults to 120 seconds." /> + </parameters> <results> <c:simple-property name="operationResult"/> </results>
commit 068f664483a2013fa84123cb6b6ba85b54ee7c5c Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Feb 25 16:36:41 2013 -0500
[Bug 881848 - Resource availability type remains in state unknown after application of workaround from bug 865166] Ensure after upgrade that all resources, including those in the ADQ, have at least an intial UNKNOWN Availability.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml index d4bc14c..109eb3a 100644 --- a/modules/core/dbutils/pom.xml +++ b/modules/core/dbutils/pom.xml @@ -17,7 +17,7 @@ <description>Database schema setup, upgrade and other utilities</description>
<properties> - <db.schema.version>2.128</db.schema.version> + <db.schema.version>2.129</db.schema.version> <rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping> <rhq.ds.server-name>${rhq.test.ds.server-name}</rhq.ds.server-name> <rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name> diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml index 19ac9dd..936c7bf 100644 --- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml +++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml @@ -1944,6 +1944,7 @@ </schemaSpec>
<schemaSpec version="2.125"> + <!-- Note, JON 3.1.2 includes this already but it is safe to re-execute --> <!-- We were using a buggy version of password obfuscation from JBoss AS. This task sets the affected passwords to NULL. Fortunately, this currently affects only CSP content sources, so the damage is not huge from the user perspective. --> @@ -1952,6 +1953,7 @@
<!-- BZ 865167 --> <schemaSpec version="2.126"> + <!-- Note, JON 3.1.2 includes this already but it is safe to re-execute --> <schema-directSQL> <statement targetDBVendor="postgresql"> INSERT INTO RHQ_RESOURCE_AVAIL ( ID, RESOURCE_ID, AVAILABILITY_TYPE ) @@ -1988,6 +1990,27 @@ </schema-directSQL> </schemaSpec>
+<!-- RHQ 4.6.0 uses DB Schema 2.128 --> + + <!-- BZ 881848 --> + <schemaSpec version="2.129"> + <schema-directSQL> + <statement targetDBVendor="postgresql"> + INSERT INTO RHQ_AVAILABILITY ( ID, RESOURCE_ID, START_TIME, END_TIME, AVAILABILITY_TYPE ) + SELECT nextval('RHQ_AVAILABILITY_ID_SEQ'::text), res.ID, 0, NULL, 2 + FROM RHQ_RESOURCE res + WHERE NOT EXISTS ( SELECT * FROM RHQ_AVAILABILITY WHERE RESOURCE_ID = res.ID ) + </statement> + <statement targetDBVendor="oracle"> + INSERT INTO RHQ_AVAILABILITY ( ID, RESOURCE_ID, START_TIME, END_TIME, AVAILABILITY_TYPE ) + SELECT RHQ_AVAILABILITY_ID_SEQ.nextval, res.ID, 0, NULL, 2 + FROM RHQ_RESOURCE res + WHERE NOT EXISTS ( SELECT * FROM RHQ_AVAILABILITY WHERE RESOURCE_ID = res.ID ) + </statement> + </schema-directSQL> + </schemaSpec> + + </dbupgrade> </target> </project>
commit c6ddc8538eb130703a276752b05e85b9da5faabc Author: Stefan Negrea snegrea@redhat.com Date: Mon Feb 25 17:31:02 2013 -0600
Update development version to 4.7.0-SNAPSHOT.
diff --git a/code-coverage/pom.xml b/code-coverage/pom.xml index 7bce055..cacf523 100644 --- a/code-coverage/pom.xml +++ b/code-coverage/pom.xml @@ -3,7 +3,7 @@ <parent> <artifactId>rhq-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>rhq-code-coverage</artifactId> diff --git a/modules/cli-tests/pom.xml b/modules/cli-tests/pom.xml index ecd5c00..394dc13 100644 --- a/modules/cli-tests/pom.xml +++ b/modules/cli-tests/pom.xml @@ -8,7 +8,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/modules/common/ant-bundle/pom.xml b/modules/common/ant-bundle/pom.xml index f69c49e..111b6f0 100644 --- a/modules/common/ant-bundle/pom.xml +++ b/modules/common/ant-bundle/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-common-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/common/drift/pom.xml b/modules/common/drift/pom.xml index 2b0a46a..190bc89 100644 --- a/modules/common/drift/pom.xml +++ b/modules/common/drift/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-common-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>rhq-common-drift</artifactId> diff --git a/modules/common/filetemplate-bundle/pom.xml b/modules/common/filetemplate-bundle/pom.xml index 7dc4571..32692b5 100644 --- a/modules/common/filetemplate-bundle/pom.xml +++ b/modules/common/filetemplate-bundle/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-common-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>rhq-filetemplate-bundle-common</artifactId> diff --git a/modules/common/jboss-as-dmr-client/pom.xml b/modules/common/jboss-as-dmr-client/pom.xml index 260bd92..4f43692 100644 --- a/modules/common/jboss-as-dmr-client/pom.xml +++ b/modules/common/jboss-as-dmr-client/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-common-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>rhq-jboss-as-dmr-client</artifactId> diff --git a/modules/common/jboss-as/pom.xml b/modules/common/jboss-as/pom.xml index c8f844c..17e5433 100644 --- a/modules/common/jboss-as/pom.xml +++ b/modules/common/jboss-as/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-common-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>rhq-jboss-as-common</artifactId> diff --git a/modules/common/pom.xml b/modules/common/pom.xml index 960909d..4ed6d92 100644 --- a/modules/common/pom.xml +++ b/modules/common/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/modules/core/arquillian-integration/archive/pom.xml b/modules/core/arquillian-integration/archive/pom.xml index 2e9dc48..7c7e949 100644 --- a/modules/core/arquillian-integration/archive/pom.xml +++ b/modules/core/arquillian-integration/archive/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-arquillian-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<!-- Model Version --> diff --git a/modules/core/arquillian-integration/container/pom.xml b/modules/core/arquillian-integration/container/pom.xml index 65043aa..50e0fed 100644 --- a/modules/core/arquillian-integration/container/pom.xml +++ b/modules/core/arquillian-integration/container/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-arquillian-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<!-- Model Version --> diff --git a/modules/core/arquillian-integration/pom.xml b/modules/core/arquillian-integration/pom.xml index cbdc2a9..fb6f3ee 100644 --- a/modules/core/arquillian-integration/pom.xml +++ b/modules/core/arquillian-integration/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/core/arquillian-integration/suite-extension/pom.xml b/modules/core/arquillian-integration/suite-extension/pom.xml index 3ccb886..5d80c3f 100644 --- a/modules/core/arquillian-integration/suite-extension/pom.xml +++ b/modules/core/arquillian-integration/suite-extension/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-arquillian-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<!-- Model Version --> diff --git a/modules/core/client-api/pom.xml b/modules/core/client-api/pom.xml index ee8f1dc..a4f4b9e 100644 --- a/modules/core/client-api/pom.xml +++ b/modules/core/client-api/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/core/comm-api/pom.xml b/modules/core/comm-api/pom.xml index bf4b745..9fd9f98 100644 --- a/modules/core/comm-api/pom.xml +++ b/modules/core/comm-api/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml index aa9a2ce..d4bc14c 100644 --- a/modules/core/dbutils/pom.xml +++ b/modules/core/dbutils/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml index 21af6e4..9775aa6 100644 --- a/modules/core/domain/pom.xml +++ b/modules/core/domain/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>rhq-core-domain</artifactId> diff --git a/modules/core/gui/pom.xml b/modules/core/gui/pom.xml index d17353c..9f1b724 100644 --- a/modules/core/gui/pom.xml +++ b/modules/core/gui/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/core/native-system/pom.xml b/modules/core/native-system/pom.xml index 08e5675..21f1c48 100644 --- a/modules/core/native-system/pom.xml +++ b/modules/core/native-system/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../pom.xml</relativePath> </parent>
diff --git a/modules/core/plugin-api/pom.xml b/modules/core/plugin-api/pom.xml index fd717f7..4b828f7 100644 --- a/modules/core/plugin-api/pom.xml +++ b/modules/core/plugin-api/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/core/plugin-container-itest/pom.xml b/modules/core/plugin-container-itest/pom.xml index f439dab..900eb72 100644 --- a/modules/core/plugin-container-itest/pom.xml +++ b/modules/core/plugin-container-itest/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>rhq-core-plugin-container-itest</artifactId> diff --git a/modules/core/plugin-container/pom.xml b/modules/core/plugin-container/pom.xml index f7451c5..8bff199 100644 --- a/modules/core/plugin-container/pom.xml +++ b/modules/core/plugin-container/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>rhq-core-plugin-container</artifactId> diff --git a/modules/core/plugin-test-api/pom.xml b/modules/core/plugin-test-api/pom.xml index 5d80afc..f7abec9 100644 --- a/modules/core/plugin-test-api/pom.xml +++ b/modules/core/plugin-test-api/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>rhq-core-plugin-test-api</artifactId> diff --git a/modules/core/plugin-test-util/pom.xml b/modules/core/plugin-test-util/pom.xml index 40d29ec..dbb97fe 100644 --- a/modules/core/plugin-test-util/pom.xml +++ b/modules/core/plugin-test-util/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/core/plugin-validator/pom.xml b/modules/core/plugin-validator/pom.xml index aff829f..fc8ff80 100644 --- a/modules/core/plugin-validator/pom.xml +++ b/modules/core/plugin-validator/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/core/plugindoc/pom.xml b/modules/core/plugindoc/pom.xml index e8a53b5..4528810 100644 --- a/modules/core/plugindoc/pom.xml +++ b/modules/core/plugindoc/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/core/pom.xml b/modules/core/pom.xml index d0eff4c..c51fb51 100644 --- a/modules/core/pom.xml +++ b/modules/core/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/modules/core/util/pom.xml b/modules/core/util/pom.xml index ef4b285..ff2a247 100644 --- a/modules/core/util/pom.xml +++ b/modules/core/util/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-core-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>rhq-core-util</artifactId> diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml index f8c7720..99f9b40 100644 --- a/modules/enterprise/agent/pom.xml +++ b/modules/enterprise/agent/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/agentupdate/pom.xml b/modules/enterprise/agentupdate/pom.xml index b26d8e3..ba0d852 100644 --- a/modules/enterprise/agentupdate/pom.xml +++ b/modules/enterprise/agentupdate/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml index 709a213..1ddf893 100644 --- a/modules/enterprise/binding/pom.xml +++ b/modules/enterprise/binding/pom.xml @@ -3,10 +3,10 @@ <parent> <artifactId>rhq-enterprise-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <artifactId>rhq-script-bindings</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <name>RHQ Script Bindings</name> <description>Abstraction of different facilities and default configurations for script bindings</description>
diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml index 48fad0c..cf5b95f 100644 --- a/modules/enterprise/comm/pom.xml +++ b/modules/enterprise/comm/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/gui/content_http-war/pom.xml b/modules/enterprise/gui/content_http-war/pom.xml index 104b50d..61abd3a 100644 --- a/modules/enterprise/gui/content_http-war/pom.xml +++ b/modules/enterprise/gui/content_http-war/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-gui-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/enterprise/gui/coregui/pom.xml b/modules/enterprise/gui/coregui/pom.xml index 0f58d9b..f60ae8b 100644 --- a/modules/enterprise/gui/coregui/pom.xml +++ b/modules/enterprise/gui/coregui/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/gui/pom.xml b/modules/enterprise/gui/pom.xml index f864813..b71b130 100644 --- a/modules/enterprise/gui/pom.xml +++ b/modules/enterprise/gui/pom.xml @@ -8,7 +8,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/gui/portal-war/pom.xml b/modules/enterprise/gui/portal-war/pom.xml index d032b6d..9795f49 100644 --- a/modules/enterprise/gui/portal-war/pom.xml +++ b/modules/enterprise/gui/portal-war/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/gui/rest-examples-war/pom.xml b/modules/enterprise/gui/rest-examples-war/pom.xml index 1eb1ad2..87354d1 100644 --- a/modules/enterprise/gui/rest-examples-war/pom.xml +++ b/modules/enterprise/gui/rest-examples-war/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/gui/rest-war/pom.xml b/modules/enterprise/gui/rest-war/pom.xml index 9e1ac5a..1b5349c 100644 --- a/modules/enterprise/gui/rest-war/pom.xml +++ b/modules/enterprise/gui/rest-war/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/pom.xml b/modules/enterprise/pom.xml index 7fe3331..489d603 100644 --- a/modules/enterprise/pom.xml +++ b/modules/enterprise/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml index e6daa0f..ee672e2 100644 --- a/modules/enterprise/remoting/cli/pom.xml +++ b/modules/enterprise/remoting/cli/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/remoting/client-api/pom.xml b/modules/enterprise/remoting/client-api/pom.xml index c2addd5..8f0978c 100644 --- a/modules/enterprise/remoting/client-api/pom.xml +++ b/modules/enterprise/remoting/client-api/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/remoting/client-deps/pom.xml b/modules/enterprise/remoting/client-deps/pom.xml index 0c81641..006a9a6 100644 --- a/modules/enterprise/remoting/client-deps/pom.xml +++ b/modules/enterprise/remoting/client-deps/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/remoting/pom.xml b/modules/enterprise/remoting/pom.xml index 3e76a1c..3ab9e66 100644 --- a/modules/enterprise/remoting/pom.xml +++ b/modules/enterprise/remoting/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/scripting/api/pom.xml b/modules/enterprise/scripting/api/pom.xml index 2a705b3..5fdffe3 100644 --- a/modules/enterprise/scripting/api/pom.xml +++ b/modules/enterprise/scripting/api/pom.xml @@ -3,10 +3,10 @@ <parent> <artifactId>rhq-scripting-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <artifactId>rhq-scripting-api</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <name>RHQ Scripting API</name> <description>Provides API for adding scripting support to RHQ using different javax.scripting - based interpreters</description>
diff --git a/modules/enterprise/scripting/javascript/pom.xml b/modules/enterprise/scripting/javascript/pom.xml index c2363a5..208076a 100644 --- a/modules/enterprise/scripting/javascript/pom.xml +++ b/modules/enterprise/scripting/javascript/pom.xml @@ -4,10 +4,10 @@ <parent> <artifactId>rhq-scripting-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <artifactId>rhq-scripting-javascript</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <name>RHQ Javascript support</name> <description>Provides RHQ scripting in Javascript using Rhino</description>
diff --git a/modules/enterprise/scripting/pom.xml b/modules/enterprise/scripting/pom.xml index d6faff8..5c82958 100644 --- a/modules/enterprise/scripting/pom.xml +++ b/modules/enterprise/scripting/pom.xml @@ -3,12 +3,12 @@ <parent> <artifactId>rhq-enterprise-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <artifactId>rhq-scripting-parent</artifactId> <packaging>pom</packaging>
- <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <name>RHQ Scripting Parent Module</name>
<modules> diff --git a/modules/enterprise/scripting/python/pom.xml b/modules/enterprise/scripting/python/pom.xml index 34e5231..ab12edf 100644 --- a/modules/enterprise/scripting/python/pom.xml +++ b/modules/enterprise/scripting/python/pom.xml @@ -3,10 +3,10 @@ <parent> <artifactId>rhq-scripting-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <artifactId>rhq-scripting-python</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <name>RHQ Python support</name> <description>Provides RHQ scripting in Python using Jython</description>
diff --git a/modules/enterprise/server/appserver/pom.xml b/modules/enterprise/server/appserver/pom.xml index d8c7d6f..2ffdc7c 100644 --- a/modules/enterprise/server/appserver/pom.xml +++ b/modules/enterprise/server/appserver/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/server/client-api/pom.xml b/modules/enterprise/server/client-api/pom.xml index 87a99b7..ac92aec 100644 --- a/modules/enterprise/server/client-api/pom.xml +++ b/modules/enterprise/server/client-api/pom.xml @@ -5,13 +5,13 @@ <parent> <artifactId>rhq-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
<groupId>org.rhq</groupId> <artifactId>rhq-server-client-api</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <name>RHQ Enterprise Server Client API</name> <description>The implementation of the client API when accessing the server locally</description>
diff --git a/modules/enterprise/server/ear/pom.xml b/modules/enterprise/server/ear/pom.xml index 09b0def..d6a38d8 100644 --- a/modules/enterprise/server/ear/pom.xml +++ b/modules/enterprise/server/ear/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/server/installer/pom.xml b/modules/enterprise/server/installer/pom.xml index a1b2dab..83b8977 100644 --- a/modules/enterprise/server/installer/pom.xml +++ b/modules/enterprise/server/installer/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index 49d79f5..cf6aa8d 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml index 2eb3668..d59460f 100644 --- a/modules/enterprise/server/jar/pom.xml +++ b/modules/enterprise/server/jar/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/server/plugins/alert-cli/pom.xml b/modules/enterprise/server/plugins/alert-cli/pom.xml index 6a9c1fd..68ea87a 100644 --- a/modules/enterprise/server/plugins/alert-cli/pom.xml +++ b/modules/enterprise/server/plugins/alert-cli/pom.xml @@ -3,11 +3,11 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <groupId>org.rhq</groupId> <artifactId>alert-cli</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <name>RHQ Enterprise Server CLI Script Alert Plugin</name> <description>An alert sender able to execute an arbitrary CLI script as a response to an alert</description>
diff --git a/modules/enterprise/server/plugins/alert-email/pom.xml b/modules/enterprise/server/plugins/alert-email/pom.xml index cfd0d9b..ec91baf 100644 --- a/modules/enterprise/server/plugins/alert-email/pom.xml +++ b/modules/enterprise/server/plugins/alert-email/pom.xml @@ -3,13 +3,13 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq.server</groupId> <artifactId>alert-email</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Email Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-irc/pom.xml b/modules/enterprise/server/plugins/alert-irc/pom.xml index 67fa7a2..ea7bd90 100644 --- a/modules/enterprise/server/plugins/alert-irc/pom.xml +++ b/modules/enterprise/server/plugins/alert-irc/pom.xml @@ -3,13 +3,13 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId> <artifactId>alert-irc</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server IRC Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-log4j/pom.xml b/modules/enterprise/server/plugins/alert-log4j/pom.xml index 358861c..c50b5cb 100644 --- a/modules/enterprise/server/plugins/alert-log4j/pom.xml +++ b/modules/enterprise/server/plugins/alert-log4j/pom.xml @@ -3,13 +3,13 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId> <artifactId>alert-log4j</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Log4J Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-microblog/pom.xml b/modules/enterprise/server/plugins/alert-microblog/pom.xml index eecd72a..c576b41 100644 --- a/modules/enterprise/server/plugins/alert-microblog/pom.xml +++ b/modules/enterprise/server/plugins/alert-microblog/pom.xml @@ -3,13 +3,13 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId> <artifactId>alert-microblog</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Microblog Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-mobicents/pom.xml b/modules/enterprise/server/plugins/alert-mobicents/pom.xml index 975858f..5d9fb43 100644 --- a/modules/enterprise/server/plugins/alert-mobicents/pom.xml +++ b/modules/enterprise/server/plugins/alert-mobicents/pom.xml @@ -3,13 +3,13 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId> <artifactId>alert-mobicents</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Mobicents Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-operations/pom.xml b/modules/enterprise/server/plugins/alert-operations/pom.xml index 90df568..3b08f01 100644 --- a/modules/enterprise/server/plugins/alert-operations/pom.xml +++ b/modules/enterprise/server/plugins/alert-operations/pom.xml @@ -2,14 +2,14 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId> <artifactId>alert-operations</artifactId> <packaging>jar</packaging> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Opertions Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-roles/pom.xml b/modules/enterprise/server/plugins/alert-roles/pom.xml index 7ba6e6f..4f8c6a5 100644 --- a/modules/enterprise/server/plugins/alert-roles/pom.xml +++ b/modules/enterprise/server/plugins/alert-roles/pom.xml @@ -3,13 +3,13 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId> <artifactId>alert-roles</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Roles Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-snmp/pom.xml b/modules/enterprise/server/plugins/alert-snmp/pom.xml index dfb59aa..909053a 100644 --- a/modules/enterprise/server/plugins/alert-snmp/pom.xml +++ b/modules/enterprise/server/plugins/alert-snmp/pom.xml @@ -3,13 +3,13 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId> <artifactId>alert-snmp</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server SNMP Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-subject/pom.xml b/modules/enterprise/server/plugins/alert-subject/pom.xml index de85cf5..cd0263b 100644 --- a/modules/enterprise/server/plugins/alert-subject/pom.xml +++ b/modules/enterprise/server/plugins/alert-subject/pom.xml @@ -3,13 +3,13 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId> <artifactId>alert-subject</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Subject Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml b/modules/enterprise/server/plugins/ant-bundle/pom.xml index 6a1b367..6f636d5 100644 --- a/modules/enterprise/server/plugins/ant-bundle/pom.xml +++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/enterprise/server/plugins/cobbler/pom.xml b/modules/enterprise/server/plugins/cobbler/pom.xml index 5b41896..2c81751 100644 --- a/modules/enterprise/server/plugins/cobbler/pom.xml +++ b/modules/enterprise/server/plugins/cobbler/pom.xml @@ -4,14 +4,14 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId> <artifactId>rhq-serverplugin-cobbler</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Cobbler Plugin</name>
diff --git a/modules/enterprise/server/plugins/disk/pom.xml b/modules/enterprise/server/plugins/disk/pom.xml index 570caa3..5ecb7a9 100644 --- a/modules/enterprise/server/plugins/disk/pom.xml +++ b/modules/enterprise/server/plugins/disk/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/enterprise/server/plugins/drift-rhq/pom.xml b/modules/enterprise/server/plugins/drift-rhq/pom.xml index 0afed7e..52b3a7c 100644 --- a/modules/enterprise/server/plugins/drift-rhq/pom.xml +++ b/modules/enterprise/server/plugins/drift-rhq/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml index 7d0ba17..b43da47 100644 --- a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml +++ b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/enterprise/server/plugins/jboss-software/pom.xml b/modules/enterprise/server/plugins/jboss-software/pom.xml index 55b2aea..3d31342 100644 --- a/modules/enterprise/server/plugins/jboss-software/pom.xml +++ b/modules/enterprise/server/plugins/jboss-software/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/enterprise/server/plugins/packagetype-cli/pom.xml b/modules/enterprise/server/plugins/packagetype-cli/pom.xml index 38bb3f4..80799ab 100644 --- a/modules/enterprise/server/plugins/packagetype-cli/pom.xml +++ b/modules/enterprise/server/plugins/packagetype-cli/pom.xml @@ -3,13 +3,13 @@ <parent> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId> <artifactId>packagetype-cli</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server CLI Package Type Plugin</name>
diff --git a/modules/enterprise/server/plugins/pom.xml b/modules/enterprise/server/plugins/pom.xml index 77f4d79..827bc41 100644 --- a/modules/enterprise/server/plugins/pom.xml +++ b/modules/enterprise/server/plugins/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/server/plugins/url/pom.xml b/modules/enterprise/server/plugins/url/pom.xml index e4f17ed..f677d6a 100644 --- a/modules/enterprise/server/plugins/url/pom.xml +++ b/modules/enterprise/server/plugins/url/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml index bd8c3b1..0d80df3 100644 --- a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml +++ b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/enterprise/server/plugins/yum/pom.xml b/modules/enterprise/server/plugins/yum/pom.xml index 75c478c..75b3cdc 100644 --- a/modules/enterprise/server/plugins/yum/pom.xml +++ b/modules/enterprise/server/plugins/yum/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/enterprise/server/pom.xml b/modules/enterprise/server/pom.xml index d64e981..494e98e 100644 --- a/modules/enterprise/server/pom.xml +++ b/modules/enterprise/server/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/server/safe-invoker/pom.xml b/modules/enterprise/server/safe-invoker/pom.xml index d216e87..8c509f4 100644 --- a/modules/enterprise/server/safe-invoker/pom.xml +++ b/modules/enterprise/server/safe-invoker/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/server/sars/pom.xml b/modules/enterprise/server/sars/pom.xml index 2fad1d7..2b00e67 100644 --- a/modules/enterprise/server/sars/pom.xml +++ b/modules/enterprise/server/sars/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/server/sars/services-sar/pom.xml b/modules/enterprise/server/sars/services-sar/pom.xml index 40044b2..413c681 100644 --- a/modules/enterprise/server/sars/services-sar/pom.xml +++ b/modules/enterprise/server/sars/services-sar/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server-sars-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/enterprise/server/startup-subsystem/pom.xml b/modules/enterprise/server/startup-subsystem/pom.xml index a7ed12f..3359f33 100644 --- a/modules/enterprise/server/startup-subsystem/pom.xml +++ b/modules/enterprise/server/startup-subsystem/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/enterprise/server/xml-schemas/pom.xml b/modules/enterprise/server/xml-schemas/pom.xml index a060587..9c1bfdd 100644 --- a/modules/enterprise/server/xml-schemas/pom.xml +++ b/modules/enterprise/server/xml-schemas/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../../../pom.xml</relativePath> </parent>
diff --git a/modules/helpers/bundleGen/pom.xml b/modules/helpers/bundleGen/pom.xml index c83a433..1c570fc 100644 --- a/modules/helpers/bundleGen/pom.xml +++ b/modules/helpers/bundleGen/pom.xml @@ -3,13 +3,13 @@ <parent> <artifactId>rhq-helpers</artifactId> <groupId>org.rhq.helpers</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
<groupId>org.rhq.helpers</groupId> <artifactId>bundleGen</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version>
<build> <plugins> diff --git a/modules/helpers/jeeGen/pom.xml b/modules/helpers/jeeGen/pom.xml index 14530ff..348b780 100644 --- a/modules/helpers/jeeGen/pom.xml +++ b/modules/helpers/jeeGen/pom.xml @@ -9,7 +9,7 @@ <parent> <artifactId>rhq-helpers</artifactId> <groupId>org.rhq.helpers</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq.helpers</groupId> diff --git a/modules/helpers/perftest-support/pom.xml b/modules/helpers/perftest-support/pom.xml index 3350726..ceb5377 100644 --- a/modules/helpers/perftest-support/pom.xml +++ b/modules/helpers/perftest-support/pom.xml @@ -3,11 +3,11 @@ <parent> <artifactId>rhq-helpers</artifactId> <groupId>org.rhq.helpers</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <groupId>org.rhq.helpers</groupId> <artifactId>perftest-support</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <name>Performance Testing Support</name> <description>To support performance testing, this is a basic tool to support extracting and later reimporting of data from/to a database. diff --git a/modules/helpers/pom.xml b/modules/helpers/pom.xml index 20f1f76..bd47d23 100644 --- a/modules/helpers/pom.xml +++ b/modules/helpers/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/modules/helpers/rest-docs-generator/pom.xml b/modules/helpers/rest-docs-generator/pom.xml index f97d2de..0996c3b 100644 --- a/modules/helpers/rest-docs-generator/pom.xml +++ b/modules/helpers/rest-docs-generator/pom.xml @@ -24,7 +24,7 @@ <parent> <artifactId>rhq-helpers</artifactId> <groupId>org.rhq.helpers</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent> <modelVersion>4.0.0</modelVersion>
diff --git a/modules/helpers/rtfilter-subsystem/pom.xml b/modules/helpers/rtfilter-subsystem/pom.xml index d08c7c6..f3cbb2e 100644 --- a/modules/helpers/rtfilter-subsystem/pom.xml +++ b/modules/helpers/rtfilter-subsystem/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>org.rhq.helpers</groupId> <artifactId>rhq-helpers</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq.helpers</groupId> diff --git a/modules/helpers/rtfilter/pom.xml b/modules/helpers/rtfilter/pom.xml index dcb0402..98b8667 100644 --- a/modules/helpers/rtfilter/pom.xml +++ b/modules/helpers/rtfilter/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq.helpers</groupId> <artifactId>rhq-helpers</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq.helpers</groupId> diff --git a/modules/integration-tests/apache-plugin-test/pom.xml b/modules/integration-tests/apache-plugin-test/pom.xml index e161160..ce66fd5 100644 --- a/modules/integration-tests/apache-plugin-test/pom.xml +++ b/modules/integration-tests/apache-plugin-test/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>rhq-integration-tests</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml index b20dfa0..e574631 100644 --- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml +++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>jndi-access-test-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>jndi-access-test</artifactId> diff --git a/modules/integration-tests/jndi-access/pom.xml b/modules/integration-tests/jndi-access/pom.xml index 8dfe58e..caef075 100644 --- a/modules/integration-tests/jndi-access/pom.xml +++ b/modules/integration-tests/jndi-access/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>rhq-integration-tests</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/integration-tests/jndi-access/remote-server/pom.xml b/modules/integration-tests/jndi-access/remote-server/pom.xml index 2bc2fdd..fd7e312 100644 --- a/modules/integration-tests/jndi-access/remote-server/pom.xml +++ b/modules/integration-tests/jndi-access/remote-server/pom.xml @@ -4,7 +4,7 @@ <parent> <artifactId>jndi-access-test-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>jndi-access-remote-server</artifactId> diff --git a/modules/integration-tests/pom.xml b/modules/integration-tests/pom.xml index 4c31380..f110387 100644 --- a/modules/integration-tests/pom.xml +++ b/modules/integration-tests/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent> <modelVersion>4.0.0</modelVersion> diff --git a/modules/integration-tests/rest-api/pom.xml b/modules/integration-tests/rest-api/pom.xml index 3ba07c4..cea2a5c 100644 --- a/modules/integration-tests/rest-api/pom.xml +++ b/modules/integration-tests/rest-api/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-integration-tests</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../pom.xml</relativePath> </parent>
diff --git a/modules/plugins/aliases/pom.xml b/modules/plugins/aliases/pom.xml index 2244a12..a7a4469 100644 --- a/modules/plugins/aliases/pom.xml +++ b/modules/plugins/aliases/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml index 172cce8..5390fcc 100644 --- a/modules/plugins/ant-bundle/pom.xml +++ b/modules/plugins/ant-bundle/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/apache/pom.xml b/modules/plugins/apache/pom.xml index e887a4e..2ca9086 100644 --- a/modules/plugins/apache/pom.xml +++ b/modules/plugins/apache/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/augeas/pom.xml b/modules/plugins/augeas/pom.xml index 3617648..9a8acb4 100644 --- a/modules/plugins/augeas/pom.xml +++ b/modules/plugins/augeas/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/byteman/pom.xml b/modules/plugins/byteman/pom.xml index 8366602..6a85842 100644 --- a/modules/plugins/byteman/pom.xml +++ b/modules/plugins/byteman/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml index d8cfd68..ac3d8ff 100644 --- a/modules/plugins/cassandra/pom.xml +++ b/modules/plugins/cassandra/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/cobbler/pom.xml b/modules/plugins/cobbler/pom.xml index b333ad2..8321f4e 100644 --- a/modules/plugins/cobbler/pom.xml +++ b/modules/plugins/cobbler/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/cron/pom.xml b/modules/plugins/cron/pom.xml index b0e4004..6ed701b 100644 --- a/modules/plugins/cron/pom.xml +++ b/modules/plugins/cron/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/database/pom.xml b/modules/plugins/database/pom.xml index eaf49b8..7959a32 100644 --- a/modules/plugins/database/pom.xml +++ b/modules/plugins/database/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/filetemplate-bundle/pom.xml b/modules/plugins/filetemplate-bundle/pom.xml index 70f6d22..c67fc10 100644 --- a/modules/plugins/filetemplate-bundle/pom.xml +++ b/modules/plugins/filetemplate-bundle/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/grub/pom.xml b/modules/plugins/grub/pom.xml index 0b00df8..d77acf5 100644 --- a/modules/plugins/grub/pom.xml +++ b/modules/plugins/grub/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/hadoop/pom.xml b/modules/plugins/hadoop/pom.xml index 9d488f5..1a6c591 100644 --- a/modules/plugins/hadoop/pom.xml +++ b/modules/plugins/hadoop/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/hibernate/pom.xml b/modules/plugins/hibernate/pom.xml index a0eac76..0303046 100644 --- a/modules/plugins/hibernate/pom.xml +++ b/modules/plugins/hibernate/pom.xml @@ -6,7 +6,7 @@ <groupId>org.rhq</groupId> <!-- Bypass the jopr-plugins-parent which can not have children. It must build after the plugins in order to execute integration tests on them. --> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.jboss.on</groupId> diff --git a/modules/plugins/hosts/pom.xml b/modules/plugins/hosts/pom.xml index 06315b2..467397e 100644 --- a/modules/plugins/hosts/pom.xml +++ b/modules/plugins/hosts/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/hudson/pom.xml b/modules/plugins/hudson/pom.xml index 9c7f6d2..1a8d193 100644 --- a/modules/plugins/hudson/pom.xml +++ b/modules/plugins/hudson/pom.xml @@ -6,12 +6,12 @@ <parent> <artifactId>rhq-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> <artifactId>rhq-hudson-plugin</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <packaging>jar</packaging>
<name>RHQ Hudson Plugin</name> diff --git a/modules/plugins/iis/pom.xml b/modules/plugins/iis/pom.xml index b8f1f5a..69f1dbb 100644 --- a/modules/plugins/iis/pom.xml +++ b/modules/plugins/iis/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/irc/pom.xml b/modules/plugins/irc/pom.xml index 9787a1d..fc69a41 100644 --- a/modules/plugins/irc/pom.xml +++ b/modules/plugins/irc/pom.xml @@ -5,7 +5,7 @@ <parent> <artifactId>rhq-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml index 9c71f33..f2a81a1 100644 --- a/modules/plugins/jboss-as-5/pom.xml +++ b/modules/plugins/jboss-as-5/pom.xml @@ -9,7 +9,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.jboss.on</groupId> diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml index 75d5b51..1f63c91 100644 --- a/modules/plugins/jboss-as-7/pom.xml +++ b/modules/plugins/jboss-as-7/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml index 53e8149..d1f4c74 100644 --- a/modules/plugins/jboss-as/pom.xml +++ b/modules/plugins/jboss-as/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.jboss.on</groupId> diff --git a/modules/plugins/jboss-cache-v3/pom.xml b/modules/plugins/jboss-cache-v3/pom.xml index aa4f232..34bdffe 100644 --- a/modules/plugins/jboss-cache-v3/pom.xml +++ b/modules/plugins/jboss-cache-v3/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.jboss.on</groupId> diff --git a/modules/plugins/jboss-cache/pom.xml b/modules/plugins/jboss-cache/pom.xml index 35d919b..421f24d 100644 --- a/modules/plugins/jboss-cache/pom.xml +++ b/modules/plugins/jboss-cache/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.jboss.on</groupId> diff --git a/modules/plugins/jmx/pom.xml b/modules/plugins/jmx/pom.xml index 16d4245..48e3f93 100644 --- a/modules/plugins/jmx/pom.xml +++ b/modules/plugins/jmx/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/kickstart/pom.xml b/modules/plugins/kickstart/pom.xml index 5d85bc4..9255d09 100644 --- a/modules/plugins/kickstart/pom.xml +++ b/modules/plugins/kickstart/pom.xml @@ -7,7 +7,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/mod-cluster/pom.xml b/modules/plugins/mod-cluster/pom.xml index 64620e1..804b04a 100644 --- a/modules/plugins/mod-cluster/pom.xml +++ b/modules/plugins/mod-cluster/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/mysql/pom.xml b/modules/plugins/mysql/pom.xml index 9e5a24e..14e39a3 100644 --- a/modules/plugins/mysql/pom.xml +++ b/modules/plugins/mysql/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml index 4afa8a5..184f1db 100644 --- a/modules/plugins/netservices/pom.xml +++ b/modules/plugins/netservices/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/noop/pom.xml b/modules/plugins/noop/pom.xml index 1ab336f..1f43ea4 100644 --- a/modules/plugins/noop/pom.xml +++ b/modules/plugins/noop/pom.xml @@ -26,7 +26,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/oracle/pom.xml b/modules/plugins/oracle/pom.xml index 5ce8144..dc4f4aa 100644 --- a/modules/plugins/oracle/pom.xml +++ b/modules/plugins/oracle/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/pattern-generator/pom.xml b/modules/plugins/pattern-generator/pom.xml index b8fdab2..7fe46e5 100644 --- a/modules/plugins/pattern-generator/pom.xml +++ b/modules/plugins/pattern-generator/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/perftest/pom.xml b/modules/plugins/perftest/pom.xml index e8b68fe..7ccffa7 100644 --- a/modules/plugins/perftest/pom.xml +++ b/modules/plugins/perftest/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/platform/pom.xml b/modules/plugins/platform/pom.xml index 143872e..ef210b6 100644 --- a/modules/plugins/platform/pom.xml +++ b/modules/plugins/platform/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml index 73947ae..9af3938 100644 --- a/modules/plugins/pom.xml +++ b/modules/plugins/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <relativePath>../../pom.xml</relativePath> </parent>
diff --git a/modules/plugins/postfix/pom.xml b/modules/plugins/postfix/pom.xml index 29ea010..69a3b7d 100644 --- a/modules/plugins/postfix/pom.xml +++ b/modules/plugins/postfix/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/postgres/pom.xml b/modules/plugins/postgres/pom.xml index c565c89..1e323fb 100644 --- a/modules/plugins/postgres/pom.xml +++ b/modules/plugins/postgres/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/rhq-agent/pom.xml b/modules/plugins/rhq-agent/pom.xml index 1dcf822..e187c17 100644 --- a/modules/plugins/rhq-agent/pom.xml +++ b/modules/plugins/rhq-agent/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/rhq-server/pom.xml b/modules/plugins/rhq-server/pom.xml index 9d1557b..5327977 100644 --- a/modules/plugins/rhq-server/pom.xml +++ b/modules/plugins/rhq-server/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/samba/pom.xml b/modules/plugins/samba/pom.xml index dd8150c..a392c58 100644 --- a/modules/plugins/samba/pom.xml +++ b/modules/plugins/samba/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/script/pom.xml b/modules/plugins/script/pom.xml index 77d117e..3772829 100644 --- a/modules/plugins/script/pom.xml +++ b/modules/plugins/script/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/script2/pom.xml b/modules/plugins/script2/pom.xml index 672ac51..3bec031 100644 --- a/modules/plugins/script2/pom.xml +++ b/modules/plugins/script2/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/snmptrapd/pom.xml b/modules/plugins/snmptrapd/pom.xml index 35121e0..4805c8f 100644 --- a/modules/plugins/snmptrapd/pom.xml +++ b/modules/plugins/snmptrapd/pom.xml @@ -2,7 +2,7 @@ <parent> <artifactId>rhq-plugins-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<modelVersion>4.0.0</modelVersion> diff --git a/modules/plugins/sshd/pom.xml b/modules/plugins/sshd/pom.xml index 6d880e3..92e76ef 100644 --- a/modules/plugins/sshd/pom.xml +++ b/modules/plugins/sshd/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/sudoers/pom.xml b/modules/plugins/sudoers/pom.xml index 91bfbee..053fac0 100644 --- a/modules/plugins/sudoers/pom.xml +++ b/modules/plugins/sudoers/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/tomcat/pom.xml b/modules/plugins/tomcat/pom.xml index 52c9b13..9ded2f5 100644 --- a/modules/plugins/tomcat/pom.xml +++ b/modules/plugins/tomcat/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.jboss.on</groupId> diff --git a/modules/plugins/twitter/pom.xml b/modules/plugins/twitter/pom.xml index 6b0ad95..6f00f3f 100644 --- a/modules/plugins/twitter/pom.xml +++ b/modules/plugins/twitter/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/validate-all-plugins/pom.xml b/modules/plugins/validate-all-plugins/pom.xml index fbc5f94..1e8c6fc 100644 --- a/modules/plugins/validate-all-plugins/pom.xml +++ b/modules/plugins/validate-all-plugins/pom.xml @@ -5,7 +5,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/plugins/virt/pom.xml b/modules/plugins/virt/pom.xml index a2a48da..1c2bbca 100644 --- a/modules/plugins/virt/pom.xml +++ b/modules/plugins/virt/pom.xml @@ -4,7 +4,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/pom.xml b/modules/pom.xml index d1745b2..82d911d 100644 --- a/modules/pom.xml +++ b/modules/pom.xml @@ -6,7 +6,7 @@ <parent> <groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<groupId>org.rhq</groupId> diff --git a/modules/test-utils/pom.xml b/modules/test-utils/pom.xml index a04cf92..ee5bbfd 100644 --- a/modules/test-utils/pom.xml +++ b/modules/test-utils/pom.xml @@ -7,7 +7,7 @@ <parent> <artifactId>rhq-modules-parent</artifactId> <groupId>org.rhq</groupId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> </parent>
<artifactId>test-utils</artifactId> diff --git a/pom.xml b/pom.xml index 711cad0..afd1a61 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@
<groupId>org.rhq</groupId> <artifactId>rhq-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> + <version>4.7.0-SNAPSHOT</version> <packaging>pom</packaging>
<name>RHQ</name>
commit 503f985d13d376f388b3cf1842f3e2904f5ed549 Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Feb 22 15:28:28 2013 -0500
Don't access the resource to delete transactionally and hold it while trying to then uninventory it via slsb calls. This could cause a deadlock.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java index 1fcda30..213d75d 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java @@ -105,26 +105,21 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { @Override protected void afterMethod() throws Exception { try { + prepareForTestAgents(); + if (theResource != null) { // perform in-band and out-of-band work in quick succession // this also deletes our attached agent - prepareForTestAgents(); resourceManager.uninventoryResource(overlord, theResource.getId()); resourceManager.uninventoryResourceAsyncWork(overlord, theResource.getId()); - unprepareForTestAgents(); theResource = null; }
if (additionalResources != null) { - getTransactionManager().begin(); - for (Resource res : additionalResources) { - Resource res2 = em.find(Resource.class, res.getId()); - resourceManager.uninventoryResource(overlord, res2.getId()); - resourceManager.uninventoryResourceAsyncWork(overlord, res2.getId()); - + resourceManager.uninventoryResource(overlord, res.getId()); + resourceManager.uninventoryResourceAsyncWork(overlord, res.getId()); } - getTransactionManager().commit(); }
if (theResourceType != null) { @@ -141,6 +136,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { }
finally { + unprepareForTestAgents(); unprepareScheduler(); unprepareServerPluginService(); testServerPluginService.stopMasterPluginContainer(); @@ -280,7 +276,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { // platform: UNKNOWN(0) --> commitAndClose();
- AvailabilityReport report = new AvailabilityReport(false, theAgent.getName());
availPoints = availabilityManager.findAvailabilitiesForResource(overlord, theResource.getId(), 1, @@ -431,7 +426,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { setupResource(); commitAndClose();
- // setAllAgentResourceAvails will only operate on those that have at least 1 avail row Availability avail = new Availability(theResource, UNKNOWN); persistAvailability(avail); @@ -461,7 +455,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { setupResource(); commitAndClose();
- // have never heard from the new agent yet - we do not backfill anything in this case LookupUtil.getAgentManager().checkForSuspectAgents(); assert availabilityManager.getCurrentAvailabilityTypeForResource(overlord, theResource.getId()) == UNKNOWN; @@ -491,7 +484,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { setupResource(); commitAndClose();
- // add a report that says the resource was up 20 minutes ago Availability avail = new Availability(theResource, (System.currentTimeMillis() - 12000000), UP); AvailabilityReport report = new AvailabilityReport(false, theAgent.getName()); @@ -507,7 +499,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { agent.setLastAvailabilityPing(System.currentTimeMillis() - (1000 * 60 * 18)); // 18 mins commitAndClose();
- // the agent should be suspect and will be considered down, the platform resource should be down // (although children should be UNKNOWN) LookupUtil.getAgentManager().checkForSuspectAgents(); // checks for 5 mins !! @@ -523,7 +514,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { assert allAvails.size() == 3; commitAndClose();
- Availability a1 = allAvails.get(0); Availability a2 = allAvails.get(1); Availability a3 = allAvails.get(2); @@ -571,7 +561,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
commitAndClose();
- for (Resource res : allResources) { int resId = res.getId(); Availability currentAvailability = availabilityManager.getCurrentAvailabilityForResource(overlord, @@ -600,7 +589,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { agent.setLastAvailabilityPing(System.currentTimeMillis() - (1000 * 60 * 18)); // 18 mins commitAndClose();
- // the agent should be suspect and will be considered down. the resources have their initial // UNKNOWN avails. The platform should get a new DOWN Availability row. The rest should remain // as is since they are already UNKNOWN. @@ -641,7 +629,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { agent.setLastAvailabilityPing(System.currentTimeMillis() - (1000 * 60 * 18)); commitAndClose();
- // the agent should be suspect and will be considered down // all of the resources have availabilities now, so another row will be added to them if they are not disabled start = System.currentTimeMillis(); @@ -670,7 +657,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { assert allAvails.size() == ((expected == DOWN) ? 4 : ((expected == DISABLED) ? 2 : 3)) : allAvails; commitAndClose();
- Availability a0 = allAvails.get(0); Availability a1 = allAvails.get(1); Availability a2 = null; @@ -716,7 +702,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { System.out.println("testAgentBackfillPerformance: checking validity of data took " + (System.currentTimeMillis() - start) + "ms");
- } catch (Exception e) { e.printStackTrace(); throw e; @@ -737,7 +722,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { setupResource(); // inserts initial UNKNOWN Availability at epoch commitAndClose();
- Availability avail; long now = System.currentTimeMillis();
@@ -824,7 +808,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { setupResource(); commitAndClose();
- long now = System.currentTimeMillis();
// add a report that says the resource is down - reports can't have the same resource in it twice, @@ -885,7 +868,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { setupResource(); commitAndClose();
- Calendar cal = Calendar.getInstance(); cal.set(Calendar.YEAR, 2000); cal.set(Calendar.MONTH, 0); @@ -973,7 +955,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { setupResource(); commitAndClose();
- long allAvailCount = setUpAvailabilities();
// we now have 1:00 UP, 1:20 DOWN, 1:40 UP @@ -1170,7 +1151,7 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { avail = avails.get(0); // 0..1:00 assertTrue(avail.toString(), Math.abs(avail.getStartTime() - 0L) < 1000L); assertEquals(avail.toString(), AvailabilityType.UNKNOWN, avail.getAvailabilityType()); - assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(1).getStartTime()) < 1000L); + assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(1).getStartTime()) < 1000L); avail = avails.get(1); // 1:00..1:20 assertTrue(avail.toString(), Math.abs(currentStartTime - (avail.getStartTime() + (40 * 60 * 1000))) < 1000L); assertEquals(avail.toString(), AvailabilityType.UP, avail.getAvailabilityType()); @@ -1297,7 +1278,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test {
commitAndClose();
- // add a report that says the resources are now up - the report will add one avail for each resource // at this point, the resources do not yet have a row in availability - after the merge they will have 1 AvailabilityReport report = new AvailabilityReport(false, theAgent.getName()); @@ -1371,7 +1351,6 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { System.out.println("testMergeReportPerformance: checking validity of data 3 took " + (System.currentTimeMillis() - start) + "ms");
- } catch (Exception e) { e.printStackTrace(); throw e;
commit 17aa29bfb17f8e4ab25f7f26c852a386985c6781 Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Feb 22 10:42:48 2013 -0500
Fix tests so they run on windows as well.
diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java index bb8adcd..534e9f4 100644 --- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java +++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/AS7CommandLineTest.java @@ -48,6 +48,8 @@ import org.rhq.core.util.stream.StreamUtil; public class AS7CommandLineTest { private static final File FAKE_JBOSS_HOME = new File(".");
+ private static final String FILE_URL_PREFIX = (File.separatorChar == '/') ? "file://" : "file:///"; + private interface CommandLineProducer { AS7CommandLine get(); } @@ -73,8 +75,8 @@ public class AS7CommandLineTest { File propsFile1 = File.createTempFile("jboss1-", ".properties"); File propsFile2 = File.createTempFile("jboss2-", ".properties");
- String propsFile1Path = "file://" + propsFile1; - String propsFile2Path = "file://" + propsFile2; + String propsFile1Path = FILE_URL_PREFIX + propsFile1; + String propsFile2Path = FILE_URL_PREFIX + propsFile2;
try { testSysProps(propsFile1, propsFile2, FAKE_JBOSS_HOME, @@ -197,8 +199,8 @@ public class AS7CommandLineTest { File propsFile1 = File.createTempFile("jboss1-", ".properties"); File propsFile2 = File.createTempFile("jboss2-", ".properties");
- String propsFile1Path = "file://" + propsFile1; - String propsFile2Path = "file://" + propsFile2; + String propsFile1Path = FILE_URL_PREFIX + propsFile1; + String propsFile2Path = FILE_URL_PREFIX + propsFile2;
FakeServerProcess fakeServer = startFakeServer(FAKE_JBOSS_HOME, FAKE_JBOSS_HOME, propsFile1Path, propsFile2Path);
@@ -218,8 +220,8 @@ public class AS7CommandLineTest { File propsFile1 = File.createTempFile("jboss1-", ".properties"); File propsFile2 = File.createTempFile("jboss2-", ".properties");
- String propsFile1Path = "file://" + propsFile1; - String propsFile2Path = "file://" + propsFile2; + String propsFile1Path = FILE_URL_PREFIX + propsFile1; + String propsFile2Path = FILE_URL_PREFIX + propsFile2;
FakeServerProcess fakeServer = startFakeServer(new File(".."), FAKE_JBOSS_HOME, propsFile1Path, propsFile2Path);
@@ -385,11 +387,7 @@ public class AS7CommandLineTest {
Assert .fail("The fake jboss as server process has finished even though it should keep running. The exit value was " - + exitValue - + ". Stdout was:\n" - + stdout - + "\n\nStderr was:\n" - + stderr); + + exitValue + ". Stdout was:\n" + stdout + "\n\nStderr was:\n" + stderr); } catch (IllegalThreadStateException e) { //expected }
commit ad131fe3d7a38287857fcf5d34e6b3d3983acc96 Author: Jirka Kremser jkremser@redhat.com Date: Fri Feb 22 11:40:25 2013 +0100
Unifying the width of buttons in the toolstrip (removing autoFit by default, autoFit property is set if the title length is greater than 15 characters) and removing unused class SimpleCollapsiblePanel.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java index b9b16ed..d7b8c81 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/AgentPluginTableView.java @@ -223,7 +223,6 @@ public class AgentPluginTableView extends TableSection<AgentPluginDataSource> {
IButton scanForUpdatesButton = new LocatableIButton(extendLocatorId("scanButton"), MSG.view_admin_plugins_scan()); - scanForUpdatesButton.setAutoFit(true); scanForUpdatesButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { GWTServiceLookup.getPluginService().scanAndRegister(new AsyncCallback<Void>() { @@ -246,7 +245,6 @@ public class AgentPluginTableView extends TableSection<AgentPluginDataSource> {
final IButton showDeletedButton = new LocatableIButton(extendLocatorId("showDeletedButton"), MSG.view_admin_plugins_showDeleted()); - showDeletedButton.setAutoFit(true); showDeletedButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showDeleted = !showDeleted; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java index c83d93f..f3f72f4 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/admin/ServerPluginTableView.java @@ -223,7 +223,6 @@ public class ServerPluginTableView extends TableSection<ServerPluginDataSource>
IButton scanForUpdatesButton = new LocatableIButton(extendLocatorId("scanButton"), MSG.view_admin_plugins_scan()); - scanForUpdatesButton.setAutoFit(true); scanForUpdatesButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { GWTServiceLookup.getPluginService().scanAndRegister(new AsyncCallback<Void>() { @@ -246,7 +245,6 @@ public class ServerPluginTableView extends TableSection<ServerPluginDataSource>
IButton restartMasterPCButton = new LocatableIButton(extendLocatorId("restartMasterPCButton"), MSG.view_admin_plugins_restartMasterPC()); - restartMasterPCButton.setAutoFit(true); restartMasterPCButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { Message msg = new Message(MSG.view_admin_plugins_restartMasterPCStarted(), Severity.Info); @@ -272,7 +270,6 @@ public class ServerPluginTableView extends TableSection<ServerPluginDataSource>
final IButton showUndeployedButton = new LocatableIButton(extendLocatorId("showUndeployedButton"), MSG.view_admin_plugins_showUndeployed()); - showUndeployedButton.setAutoFit(true); showUndeployedButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent event) { showUndeployed = !showUndeployed; diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java deleted file mode 100644 index ed9163d..0000000 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/SimpleCollapsiblePanel.java +++ /dev/null @@ -1,78 +0,0 @@ -/* - * RHQ Management Platform - * Copyright (C) 2005-2010 Red Hat, Inc. - * All rights reserved. - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation version 2 of the License. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ -package org.rhq.enterprise.gui.coregui.client.components; - -import com.smartgwt.client.types.SelectionType; -import com.smartgwt.client.widgets.Button; -import com.smartgwt.client.widgets.Canvas; -import com.smartgwt.client.widgets.events.ClickEvent; -import com.smartgwt.client.widgets.events.ClickHandler; -import com.smartgwt.client.widgets.layout.VLayout; - -/** - * TODO: Not Quite Working. For some reason the icon is not clickable. - * - * @author Greg Hinkle - */ -public class SimpleCollapsiblePanel extends VLayout { - - private Canvas content; - private String title; - - private boolean expanded = true; - - public SimpleCollapsiblePanel(String title, Canvas content) { - this.content = content; - this.title = title; - setWidth100(); - } - - @Override - protected void onInit() { - super.onInit(); - - final Button button = new Button(title); - button.setShowRollOver(false); - button.setActionType(SelectionType.RADIO); - //button.setBorder(null); - button.setAutoFit(true); - - button.setIcon("[skin]/images/SectionHeader/opener_opened.png"); - //button.setBaseStyle("SimpleButton"); - - button.addClickHandler(new ClickHandler() { - public void onClick(ClickEvent clickEvent) { - expanded = !expanded; - if (expanded) { - button.setIcon("[skin]/images/SectionHeader/opener_opened.png"); - content.show(); - } else { - button.setIcon("[skin]/images/SectionHeader/opener_closed.png"); - content.hide(); - setHeight(30); - } - getParentElement().markForRedraw(); - markForRedraw(); - } - }); - - addMember(button); - addMember(content); - } -} diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java index d82d2ee..cd1a396 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/carousel/Carousel.java @@ -362,7 +362,6 @@ public abstract class Carousel extends LocatableHLayout implements RefreshableVi .getTitle()); menuButton.setMenu(menu); menuButton.setDisabled(true); - menuButton.setAutoFit(true); // this makes it pretty tight, but maybe better than the default, which is pretty wide menuButton.setOverflow(Overflow.VISIBLE); menuButton.setShowMenuBelow(false);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java index 991098e..8cdb741 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/groups/detail/summary/ActivityView.java @@ -153,7 +153,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG .common_title_edit_mode()); - editButton.setAutoFit(true); editButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { editMode = !editMode; @@ -163,7 +162,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer });
resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset()); - resetButton.setAutoFit(true); resetButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { String message = MSG.view_summaryDashboard_resetConfirm(); diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java index 77a729d..ceca886 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/summary/ActivityView.java @@ -122,7 +122,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer
editButton = new LocatableIButton(footer.extendLocatorId("Mode"), editMode ? MSG.common_title_view_mode() : MSG .common_title_edit_mode()); - editButton.setAutoFit(true); editButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { editMode = !editMode; @@ -132,7 +131,6 @@ public class ActivityView extends LocatableVLayout implements DashboardContainer });
resetButton = new LocatableIButton(footer.extendLocatorId("Reset"), MSG.common_button_reset()); - resetButton.setAutoFit(true); resetButton.addClickHandler(new ClickHandler() { public void onClick(ClickEvent clickEvent) { String message = MSG.view_summaryDashboard_resetConfirm();
commit 29b87752782a07869894b5c3eccb8d47dd11f46a Author: Lukas Krejci lkrejci@redhat.com Date: Thu Feb 21 23:56:16 2013 +0100
Adding the API checks to the script bindings.
Also corrected a minor incompatible change that was introduced since 4.5.1.
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml index 08cfdd4..709a213 100644 --- a/modules/enterprise/binding/pom.xml +++ b/modules/enterprise/binding/pom.xml @@ -12,6 +12,7 @@
<properties> <filtered.location>src/main/java</filtered.location> + <rhq.internal>false</rhq.internal> </properties>
<dependencies> @@ -240,6 +241,23 @@ </configuration> </plugin>
+ <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>clirr-maven-plugin</artifactId> + <configuration> + <includes> + <!-- Hand picked stuff that corresponds to what is the script context initialized to + in the org/rhq/bindings/StandardBindings. --> + <include>org/rhq/bindings/client/*</include> + <include>org/rhq/bindings/export/*</include> + <include>org/rhq/bindings/output/*</include> + <include>org/rhq/bindings/util/ScriptAssert</include> + <include>org/rhq/bindings/util/ScriptAssertException</include> + <include>org/rhq/bindings/util/ScriptUtil</include> + </includes> + </configuration> + </plugin> + </plugins> </build>
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java index 3e1e137..e0e794c 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/StandardBindings.java @@ -46,6 +46,10 @@ import org.rhq.core.domain.util.PageControl; * is available for all the users of this class. The user is however able to later modify these defaults to provide * use-case specific overrides (for example the CLI might want to supply impls that hook into the console to provide * interactivity with user in some workflows, which, generically, is not possible in a common case). + * <p> + * *NOTE*: any change in what is exposed to the scripting clients needs to be reflected in the API check configuration + * in the pom.xml of the corresponding modules, because any class that gets exposed in the script context essentially + * becomes a public API. * * @author Lukas Krejci */ @@ -118,10 +122,10 @@ public class StandardBindings extends HashMap<String, Object> {
/** * If you want to preserve non-client-dependent bindings when the facade changes, call this as opposed to - * constructing new StandardBindings. + * constructing new StandardBindings. */ public void setFacade(PrintWriter output, RhqFacade rhqFacade) { - // remove any existing managers + // remove any existing managers if (null != managers) { for (RhqManager manager : managers.keySet()) { remove(manager.name()); @@ -204,7 +208,7 @@ public class StandardBindings extends HashMap<String, Object> { }
public Map<RhqManager, Object> getManagers() { - //XXX ideally this should be a projection into our map + //XXX ideally this should be a projection into our map return (null == managers) ? managers = Collections.emptyMap() : managers; }
diff --git a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java index 32832b2..2c781a1 100644 --- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java +++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/RhqManager.java @@ -101,7 +101,7 @@ public enum RhqManager { this.beanName = this.name() + "Bean"; localInterfaceClassName = getLocalInterfaceClassName(remote);
- //defaults and evaluates to TRUE unless the string contains "false". Done to defend against + //defaults and evaluates to TRUE unless the string contains "false". Done to defend against //possible errors in string replacement during rhq build. this.enabled = true; if ((enable != null) && (enable.trim().length() > 0)) { @@ -123,6 +123,15 @@ public enum RhqManager { return this.remote; }
+ /** + * @deprecated since 4.6.0, use the {@link #remote()} method instead + * @return the class name of the remote interface + */ + @Deprecated + public String remoteName() { + return this.remote.getName(); + } + public String localInterfaceClassName() { return localInterfaceClassName; }
commit 6f71c2d100c564e2f52894eca3238a6f5c7b73d7 Author: John Mazzitelli mazz@redhat.com Date: Thu Feb 21 21:22:24 2013 -0500
[BZ 913778] fix NPE
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java index 6fdaf95..0aecd4d 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java @@ -37,7 +37,8 @@ public class LocatableIButton extends IButton implements Locatable { private void init(String locatorId) { this.locatorId = locatorId; SeleniumUtility.setID(this, locatorId); - if (getTitle().length() > 15) { + String title = getTitle(); + if (title != null && title.length() > 15) { setAutoFit(true); } }
commit 277c8b1fc4379e6a652931b7db1bbdd4ce3ce5ac Author: John Mazzitelli mazz@redhat.com Date: Thu Feb 21 16:25:40 2013 -0500
[BZ 913606] agent will send a full avail report if the server tells it at connect time that it has been backfilled. the server will also update the last ping time of the agent when the connect comes in.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java index 47be78b..3bcf47b 100644 --- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java +++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/core/ConnectAgentResults.java @@ -32,10 +32,12 @@ import java.io.Serializable; public class ConnectAgentResults implements Serializable { private static final long serialVersionUID = 1L;
- private long serverTime; + private final long serverTime; + private final boolean isDown;
- public ConnectAgentResults(long serverTime) { + public ConnectAgentResults(long serverTime, boolean isDown) { this.serverTime = serverTime; + this.isDown = isDown; }
/** @@ -49,10 +51,23 @@ public class ConnectAgentResults implements Serializable { }
/** - * @see java.lang.Object#toString() + * If true, this indicates if the server thinks the agent is down. This happens if the agent + * hasn't connected in a long time and the server had "backfilled" the agent's resources + * as DOWN/UNKNOWN. + * + * When an agent connects to a server, and the server thinks that agent was down, the agent needs + * to prepare to notify the server of its state - for example, the agent should soon send up + * a full availability report so the server can get the up-to-date availability statuses of all + * resources. + * + * @return true if the server had this agent's resources marked as DOWN/UNKNOWN. */ + public boolean isDown() { + return isDown; + } + @Override public String toString() { - return "ConnectAgentResults: [server-time=" + this.serverTime + "]"; + return "ConnectAgentResults: [server-time=" + this.serverTime + ", is-down=" + this.isDown + "]"; } } \ No newline at end of file diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java index 6c01d67..0c95199 100644 --- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java +++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java @@ -2146,6 +2146,18 @@ public class AgentMain { ConnectAgentResults results = (ConnectAgentResults) connectResponse.getResults(); long serverTime = results.getServerTime(); serverClockNotification(serverTime); + + // If the server thinks we are down, we need to do some things to get this agent in sync with the server. + // Anything we do in here should be very fast. + boolean serverThinksWeAreDown = results.isDown(); + if (serverThinksWeAreDown) { + LOG.warn(AgentI18NResourceKeys.SERVER_THINKS_AGENT_IS_DOWN); + PluginContainer plugin_container = PluginContainer.getInstance(); + if (plugin_container.isStarted()) { + // tell the plugin container to send a full avail report up so the server knows we are UP + plugin_container.getInventoryManager().requestFullAvailabilityReport(); + } + } } catch (Throwable t) { // should never happen, should always cast to non-null ConnectAgentResults LOG.error(AgentI18NResourceKeys.TIME_UNKNOWN, ThrowableUtil.getAllMessages(t)); diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java index 57f427c..10761ff 100644 --- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java +++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java @@ -170,6 +170,9 @@ public interface AgentI18NResourceKeys { @I18NMessage("Failed to determine the server time. Cause: {0}") String TIME_UNKNOWN = "AgentMain.time-unknown";
+ @I18NMessage("The server thinks this agent is down. Will notify the server of up-to-date information when possible.") + String SERVER_THINKS_AGENT_IS_DOWN = "AgentMain.server-thinks-agent-is-down"; + @I18NMessage("Timed out waiting for the connectAgent R/W lock to avoid a possible deadlock") String TIMEOUT_WAITING_FOR_CONNECT_LOCK = "AgentMain.connect-lock-timeout";
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java index 23bcbcf..9818ac3 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/CoreServerServiceImpl.java @@ -320,6 +320,7 @@ public class CoreServerServiceImpl implements CoreServerService {
Server server = getServerManager().getServer(); agent.setServer(server); + agent.setLastAvailabilityPing(Long.valueOf(System.currentTimeMillis())); getAgentManager().updateAgent(agent);
getAlertConditionCacheManager().reloadCachesForAgent(agent.getId()); @@ -328,7 +329,7 @@ public class CoreServerServiceImpl implements CoreServerService { PartitionEventType.AGENT_CONNECT, agentName + " - " + server.getName());
log.info("Agent [" + agentName + "] has connected to this server at " + new Date()); - return new ConnectAgentResults(System.currentTimeMillis()); + return new ConnectAgentResults(System.currentTimeMillis(), agent.isBackFilled()); }
/**
commit 369633cd9ab6a42d24c98a8c599f8a134fb5cc95 Author: John Mazzitelli mazz@redhat.com Date: Thu Feb 21 15:12:05 2013 -0500
this should not be here
diff --git a/modules/enterprise/server/jar/lib/log4jdbc4-1.2beta2.jar b/modules/enterprise/server/jar/lib/log4jdbc4-1.2beta2.jar deleted file mode 100644 index 3d6f466..0000000 Binary files a/modules/enterprise/server/jar/lib/log4jdbc4-1.2beta2.jar and /dev/null differ
commit b4522507d1a18a20cabff9cd2097c730c5d5f42e Author: Jay Shaughnessy jshaughn@redhat.com Date: Thu Feb 21 11:21:27 2013 -0500
This should allow us to run Arquillian's spawned AS7 instances (for domain and server jar itests) on non-default ports. This can be helpful in environments where you want to run multiple AS7 instances at the same time.
Arquillian will now inspect, through the AS7 management port (assumed to be on the local machine for now), to find out what ports it needs to deal with.
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml index 3eec8ad..21af6e4 100644 --- a/modules/core/domain/pom.xml +++ b/modules/core/domain/pom.xml @@ -235,6 +235,16 @@ <echo>Will now add test configuration to JBossAS config file: ${jboss.conf}</echo> <replace file="${jboss.conf}"> <replacefilter> + <replacetoken></extensions></replacetoken> + <replacevalue><![CDATA[ + </extensions> + + <!-- FOR RHQ TESTING --> + <system-properties> + <property name="jboss.socket.binding.port-offset" value="${jboss.socket.binding.port-offset}" /> + </system-properties>]]></replacevalue> + </replacefilter> + <replacefilter> <replacetoken></drivers></replacetoken> <replacevalue><![CDATA[ <!-- FOR RHQ TESTING --> @@ -681,6 +691,22 @@ <jboss.vm.args.debug>-Xrunjdwp:transport=dt_socket,address=8798,server=y,suspend=y</jboss.vm.args.debug> </properties> </profile> + + <!-- These two properties allow Arquillian to inspect AS7 through the mgmt port, to determine the ports it needs to interact + with when spawning the AS7 instance. This allows the AS7 to run on non-default ports. If these properties are not set (for + example, in settings.xml) then we must set the defaults here. The offset is then provided via the standalone.xml properties --> + <profile> + <id>arquillian-ports</id> + <activation> + <property> + <name>!jboss.socket.binding.port-offset</name> + </property> + </activation> + <properties> + <jboss.socket.binding.port-offset>0</jboss.socket.binding.port-offset> + <jboss.management.native.port>9999</jboss.management.native.port> + </properties> + </profile>
</profiles>
diff --git a/modules/core/domain/src/test/resources/arquillian.xml b/modules/core/domain/src/test/resources/arquillian.xml index 368ce23..d0744f3 100644 --- a/modules/core/domain/src/test/resources/arquillian.xml +++ b/modules/core/domain/src/test/resources/arquillian.xml @@ -21,6 +21,10 @@
<configuration> <property name="jbossHome">${jboss.unzip.location}</property> + <!-- These two properties allow Arquillian to inspect AS7 through the mgmt port, to determine the ports it needs + to interact with when spawning the AS7 instance. This allows the AS7 to run on non-default ports. --> + <property name="managementAddress">127.0.0.1</property> + <property name="managementPort">${jboss.management.native.port}</property> </configuration> </container>
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index 5961627..49d79f5 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -91,6 +91,7 @@ <system-properties> <property name="project.version" value="${project.version}"/> <property name="rhq.server.content.filesystem" value="${jboss.unzip.location}/standalone/data/packagebits" /> + <property name="jboss.socket.binding.port-offset" value="${jboss.socket.binding.port-offset}" /> </system-properties>]]></replacevalue> </replacefilter>
@@ -741,5 +742,22 @@ <jboss.vm.args.debug>-Xrunjdwp:transport=dt_socket,address=8798,server=y,suspend=y</jboss.vm.args.debug> </properties> </profile> + + <!-- These two properties allow Arquillian to inspect AS7 through the mgmt port, to determine the ports it needs to interact + with when spawning the AS7 instance. This allows the AS7 to run on non-default ports. If these properties are not set (for + example, in settings.xml) then we must set the defaults here. The offset is then provided via the standalone.xml properties --> + <profile> + <id>arquillian-ports</id> + <activation> + <property> + <name>!jboss.socket.binding.port-offset</name> + </property> + </activation> + <properties> + <jboss.socket.binding.port-offset>0</jboss.socket.binding.port-offset> + <jboss.management.native.port>9999</jboss.management.native.port> + </properties> + </profile> + </profiles> </project> diff --git a/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml b/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml index 72f8bdc..ffaa79e 100644 --- a/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml +++ b/modules/enterprise/server/itests-2/src/test/resources/arquillian.xml @@ -33,6 +33,10 @@ <configuration> <property name="jbossHome">${jboss.unzip.location}</property> <property name="javaVmArguments">${jboss.vm.args} ${jboss.vm.args.debug}</property> + <!-- These two properties allow Arquillian to inspect AS7 through the mgmt port, to determine the ports it needs + to interact with when spawning the AS7 instance. This allows the AS7 to run on non-default ports. --> + <property name="managementAddress">127.0.0.1</property> + <property name="managementPort">${jboss.management.native.port}</property> </configuration> </container> </arquillian>
commit 93fb46966bfce20ec918191ec78408d20ce6b010 Author: John Mazzitelli mazz@redhat.com Date: Thu Feb 21 10:35:59 2013 -0500
don't deprecate these methods - criteria is nice, but these specific methods are very efficient and can be used when we need to eek out as much performance as possible. no need to go through the criteria API just to get a single agent using very targeted WHERE conditions.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java index 842d5d8..7e2c3b9 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java @@ -134,47 +134,51 @@ public interface AgentManagerLocal { /** * Given an agent name, this will look up and return the {@link Agent} with that name. If no agent with the given * name exists, <code>null</code> is returned. - * + * This method is very efficient if you want to find a single agent by its name. + * If you need to get more than one agent, you could use <code>findAgentsByCriteria</code>. + * * @param agentName * * @return the agent whose name matches the given name; <code>null</code> if there is no agent with the given name - * @deprecated Use <code>findAgentsByCriteria()</code> instead */ Agent getAgentByName(String agentName);
/** * Given an agent id, this will look up and return the {@link Agent} with that id. If no agent with the given * name exists, <code>null</code> is returned. + * This method is very efficient if you want to find a single agent by its ID. + * If you need to get more than one agent, you could use <code>findAgentsByCriteria</code>. * * @param agentId * * @return the agent whose id matches the given id; <code>null</code> if there is no agent with the given id - * @deprecated Use <code>findAgentsByCriteria()</code> instead */ Agent getAgentByID(int agentId);
/** * Given an agent token string, this will look up and return the {@link Agent} associated with that token. If the * given token is invalid, <code>null</code> is returned. + * This method is very efficient if you want to find a single agent by its token. + * If you need to get more than one agent, you could use <code>findAgentsByCriteria</code>. * * @param token the agent token * * @return the agent whose agent token matches the given token; <code>null</code> if there is no agent with the * given token - * @deprecated Use <code>findAgentsByCriteria()</code> instead */ Agent getAgentByAgentToken(String token);
/** * Given an agent's address and port, this will look up and return the {@link Agent} associated with that address * and port. If no agent is found, <code>null</code> is returned. + * This method is very efficient if you want to find a single agent by its endpoint. + * If you need to get more than one agent, you could use <code>findAgentsByCriteria</code>. * * @param address the address that the agent is bound to * @param port the port at the given address that the agent is listening on * * @return the agent to be known at the given address and port; <code>null</code> if there is no agent with the * given token - * @deprecated Use <code>findAgentsByCriteria()</code> instead */ Agent getAgentByAddressAndPort(String address, int port);
commit e0ea2fd840197301df934d34088b419e97279d83 Author: Thomas Segismont tsegismo@redhat.com Date: Tue Feb 12 10:23:51 2013 +0100
netservices plugin strengthening
Added Unit tests for HTTPNetServiceDiscoveryComponent
Added HTTPNetServiceComponent itest and verified code coverage
Added Unit tests for PingNetServiceDiscoveryComponent
Added PingNetServiceComponent itest and verified code coverage
Implemented missing parts and cleaned up code
diff --git a/.classpath b/.classpath index 9af3a50..dd5d354 100644 --- a/.classpath +++ b/.classpath @@ -24,9 +24,9 @@ <classpathentry kind="src" path="modules/core/util/src/test/java"/> <classpathentry kind="src" path="modules/core/dbutils/src/main/java"/> <classpathentry kind="src" path="modules/core/dbutils/src/test/java"/> - <classpathentry kind="src" path="modules/core/native-system/src/main/java"/> - <classpathentry kind="src" path="modules/core/native-system/src/test/java"/> - <classpathentry kind="src" path="modules/core/native-system/src/test/resources"/> + <classpathentry kind="src" path="modules/core/native-system/src/main/java"/> + <classpathentry kind="src" path="modules/core/native-system/src/test/java"/> + <classpathentry kind="src" path="modules/core/native-system/src/test/resources"/> <classpathentry kind="src" path="modules/core/domain/src/main/java"/> <classpathentry kind="src" path="modules/core/domain/src/test/java"/> <classpathentry kind="src" path="modules/core/plugin-api/src/main/java"/> @@ -124,6 +124,9 @@ <classpathentry kind="src" path="modules/plugins/apache/src/test/resources"/> <classpathentry kind="src" path="modules/plugins/script/src/main/java"/> <classpathentry kind="src" path="modules/plugins/netservices/src/main/java"/> + <classpathentry kind="src" path="modules/plugins/netservices/src/main/resources"/> + <classpathentry kind="src" path="modules/plugins/netservices/src/test/java"/> + <classpathentry kind="src" path="modules/plugins/netservices/src/test/resources"/> <classpathentry kind="src" path="modules/plugins/ant-bundle/src/main/java"/> <classpathentry kind="src" path="modules/plugins/ant-bundle/src/test/java"/> <classpathentry kind="src" path="modules/plugins/ant-bundle/src/test/resources"/> @@ -178,11 +181,11 @@ <classpathentry kind="src" path="modules/core/arquillian-integration/container/src/test/java"/> <classpathentry kind="src" path="modules/core/arquillian-integration/container/src/test/resources"/> <classpathentry kind="src" path="modules/test-utils/src/main/java"/> - <classpathentry kind="src" path="modules/integration-tests/apache-plugin-test/src/test/java"/> - <classpathentry kind="src" path="modules/integration-tests/apache-plugin-test/src/test/resources"/> - <classpathentry kind="src" path="modules/integration-tests/jndi-access/jndi-access-test/src/test/java"/> - <classpathentry kind="src" path="modules/integration-tests/jndi-access/jndi-access-test/src/test/resources"/> - <classpathentry kind="src" path="modules/integration-tests/mod_cluster-plugin-test/src/test/java"/> + <classpathentry kind="src" path="modules/integration-tests/apache-plugin-test/src/test/java"/> + <classpathentry kind="src" path="modules/integration-tests/apache-plugin-test/src/test/resources"/> + <classpathentry kind="src" path="modules/integration-tests/jndi-access/jndi-access-test/src/test/java"/> + <classpathentry kind="src" path="modules/integration-tests/jndi-access/jndi-access-test/src/test/resources"/> + <classpathentry kind="src" path="modules/integration-tests/mod_cluster-plugin-test/src/test/java"/> <classpathentry kind="src" path="etc/samples/skeleton-plugin/src/main/java"/> <classpathentry kind="src" path="etc/samples/custom-serverplugin/src/main/java"/> <classpathentry kind="src" path="etc/samples/simplereport-serverplugin/src/main/java"/> @@ -336,9 +339,9 @@ <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/jms/jboss-jms-api_1.1_spec/1.0.0.Final/jboss-jms-api_1.1_spec-1.0.0.Final.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/interceptor/jboss-interceptors-api_1.1_spec/1.0.0.Final/jboss-interceptors-api_1.1_spec-1.0.0.Final.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/spec/javax/transaction/jboss-transaction-api_1.1_spec/1.0.0.Final/jboss-transaction-api_1.1_spec-1.0.0.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/remotingjmx/remoting-jmx/1.0.2.Final/remoting-jmx-1.0.2.Final.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/javax/enterprise/cdi-api/1.0-SP4/cdi-api-1.0-SP4.jar" sourcepath="M2_REPO/javax/enterprise/cdi-api/1.0-SP4/cdi-api-1.0-SP4-sources.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar" sourcepath="M2_REPO/javax/inject/javax.inject/1/javax.inject-1-sources.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/remotingjmx/remoting-jmx/1.0.2.Final/remoting-jmx-1.0.2.Final.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/javax/enterprise/cdi-api/1.0-SP4/cdi-api-1.0-SP4.jar" sourcepath="M2_REPO/javax/enterprise/cdi-api/1.0-SP4/cdi-api-1.0-SP4-sources.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/javax/inject/javax.inject/1/javax.inject-1.jar" sourcepath="M2_REPO/javax/inject/javax.inject/1/javax.inject-1-sources.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/mozilla/rhino/1.7R4/rhino-1.7R4.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/picketbox/picketbox/4.0.7.Final/picketbox-4.0.7.Final.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/python/jython-standalone/2.5.2/jython-standalone-2.5.2.jar"/> @@ -346,9 +349,10 @@ <classpathentry exported="true" kind="var" path="M2_REPO/joda-time/joda-time/2.1/joda-time-2.1.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/apache/cassandra/cassandra-thrift/1.1.5/cassandra-thrift-1.1.5.jar"/> <classpathentry exported="true" kind="var" path="M2_REPO/org/hectorclient/hector-core/1.1-1/hector-core-1.1-1.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-install/1.5.2/byteman-install-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-install/1.5.2/byteman-install-1.5.2-sources.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-submit/1.5.2/byteman-submit-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-submit/1.5.2/byteman-submit-1.5.2-sources.jar"/> - <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-bmunit/1.5.2/byteman-bmunit-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-bmunit/1.5.2/byteman-bmunit-1.5.2-sources.jar"/> - <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/> - <classpathentry kind="output" path="eclipse-classes"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-install/1.5.2/byteman-install-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-install/1.5.2/byteman-install-1.5.2-sources.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-submit/1.5.2/byteman-submit-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-submit/1.5.2/byteman-submit-1.5.2-sources.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/jboss/byteman/byteman-bmunit/1.5.2/byteman-bmunit-1.5.2.jar" sourcepath="M2_REPO/org/jboss/byteman/byteman-bmunit/1.5.2/byteman-bmunit-1.5.2-sources.jar"/> + <classpathentry exported="true" kind="var" path="M2_REPO/org/eclipse/jetty/aggregate/jetty-all/8.1.8.v20121106/jetty-all-8.1.8.v20121106.jar" sourcepath="M2_REPO/org/eclipse/jetty/aggregate/jetty-all/8.1.8.v20121106/jetty-all-8.1.8.v20121106-sources.jar"/> + <classpathentry exported="true" kind="var" path="JDK_HOME/lib/tools.jar"/> + <classpathentry kind="output" path="eclipse-classes"/> </classpath> diff --git a/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java b/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java index 59a09f2..21e81c4 100644 --- a/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java +++ b/modules/core/util/src/main/java/org/rhq/core/util/StringUtil.java @@ -39,6 +39,8 @@ public class StringUtil {
private static final Log log = LogFactory.getLog(StringUtil.class);
+ public static final String EMPTY_STRING = ""; + /** * @param source The source string to perform replacements on. * @param find The substring to find in source. @@ -119,7 +121,7 @@ public class StringUtil { * * @return The Iterator's elements in a user-friendly string format. */ - public static String iteratorToString(Iterator i, String delim) { + public static String iteratorToString(Iterator<?> i, String delim) { return iteratorToString(i, delim, ""); }
@@ -132,7 +134,7 @@ public class StringUtil { * * @return The Iterator's elements in a user-friendly string format. */ - public static String iteratorToString(Iterator i, String delim, String quoteChar) { + public static String iteratorToString(Iterator<?> i, String delim, String quoteChar) { Object elt = null; StringBuilder rstr = new StringBuilder(); String s; @@ -166,21 +168,21 @@ public class StringUtil { * * @return The List in a user-friendly string format. */ - public static String listToString(List list, String delim) { + public static String listToString(List<?> list, String delim) { if (list == null) { return "NULL"; }
- Iterator i = list.iterator(); + Iterator<?> i = list.iterator(); return iteratorToString(i, delim, null); }
- public static String collectionToString(Collection collection, String delim) { + public static String collectionToString(Collection<?> collection, String delim) { if (collection == null) { return "NULL"; }
- Iterator i = collection.iterator(); + Iterator<?> i = collection.iterator(); return iteratorToString(i, delim, null); }
@@ -191,11 +193,11 @@ public class StringUtil { * * @return The List in a user-friendly string format. */ - public static String listToString(List list) { + public static String listToString(List<?> list) { return listToString(list, ","); }
- public static String collectionToString(Collection collection) { + public static String collectionToString(Collection<?> collection) { return collectionToString(collection, ","); }
@@ -278,7 +280,7 @@ public class StringUtil { * * @return A string with objects in the list seperated by delim */ - public static String implode(List objs, String delim) { + public static String implode(List<?> objs, String delim) { StringBuilder buf = new StringBuilder(); int size = objs.size();
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml index 7805daa..4afa8a5 100644 --- a/modules/plugins/netservices/pom.xml +++ b/modules/plugins/netservices/pom.xml @@ -1,240 +1,236 @@ -<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> - - <modelVersion>4.0.0</modelVersion> - - <parent> - <groupId>org.rhq</groupId> - <artifactId>rhq-plugins-parent</artifactId> - <version>4.6.0-SNAPSHOT</version> - </parent> - - <groupId>org.rhq</groupId> - <artifactId>rhq-netservices-plugin</artifactId> - <packaging>jar</packaging> - - <name>RHQ Network Services Plugin</name> - <description> - A plugin for monitoring network services. - </description> - - <dependencies> - - <dependency> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>${commons-httpclient.version}</version> - </dependency> - <dependency> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - <version>${commons-codec.version}</version> - </dependency> - - </dependencies> - - <build> - - <plugins> - - <plugin> - <artifactId>maven-dependency-plugin</artifactId> - <executions> - <execution> - <id>copy-dependency-jars</id> - <phase>process-resources</phase> - <goals> - <goal>copy</goal> - </goals> - <configuration> - <artifactItems> - <artifactItem> - <groupId>commons-httpclient</groupId> - <artifactId>commons-httpclient</artifactId> - <version>${commons-httpclient.version}</version> - </artifactItem> - <artifactItem> - <groupId>commons-codec</groupId> - <artifactId>commons-codec</artifactId> - <version>1.2</version> - </artifactItem> - </artifactItems> - <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory> - </configuration> - </execution> - </executions> - </plugin> - - </plugins> - - </build> - - - <profiles> - <profile> - <id>integration-tests</id> - <activation> +<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd%22%3E + + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.rhq</groupId> + <artifactId>rhq-plugins-parent</artifactId> + <version>4.6.0-SNAPSHOT</version> + </parent> + + <groupId>org.rhq</groupId> + <artifactId>rhq-netservices-plugin</artifactId> + <packaging>jar</packaging> + + <name>RHQ Network Services Plugin</name> + <description>A plugin for monitoring network services.</description> + + <dependencies> + + <dependency> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>${commons-httpclient.version}</version> + </dependency> + <dependency> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>${commons-codec.version}</version> + </dependency> + + <!-- Test dependencies --> + + <dependency> + <groupId>org.mockito</groupId> + <artifactId>mockito-core</artifactId> + <version>1.9.5</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.eclipse.jetty.aggregate</groupId> + <artifactId>jetty-all</artifactId> + <version>8.1.8.v20121106</version> + <scope>test</scope> + </dependency> + + </dependencies> + + <build> + <plugins> + + <plugin> + <artifactId>maven-surefire-plugin</artifactId> + <configuration> + <excludes> + <exclude>org/rhq/plugins/netservices/itest/**</exclude> + </excludes> + <properties> <property> - <name>maven.test.skip</name> - <value>!true</value> + <name>listener</name> + <value>org.rhq.test.testng.StdoutReporter</value> </property> - </activation> - - <build> - <plugins> - - <!-- Integration testing voodoo to load and test this plugin with its plugin dependencies --> - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - <execution> - <phase>pre-integration-test</phase> - <configuration> - <target> - <echo>Setting up plugin dependencies for ${project.artifactId}-${project.version}.jar...</echo> - <property name="settings.localRepository" location="${user.home}/.m2/repository" /> - <mkdir dir="target/itest" /> - <mkdir dir="target/itest/plugins" /> - <mkdir dir="target/itest/lib" /> - <copy toDir="target/itest/plugins" flatten="true"> - <fileset dir="${project.build.directory}"> - <include name="${project.artifactId}-${project.version}.jar" /> - </fileset> - </copy> - <unzip dest="target/itest/lib"> - <fileset dir="${settings.localRepository}/org/hyperic/sigar-dist/${sigar.version}" includes="*.zip" /> - <patternset> - <include name="**/lib/sigar.jar" /> - <include name="**/lib/bcel*.jar" /> - <include name="**/lib/*.so" /> - <include name="**/lib/*.sl" /> - <include name="**/lib/*.dll" /> - <include name="**/lib/*.dylib" /> - </patternset> - </unzip> - <move todir="target/itest/lib" flatten="true"> - <fileset dir="target/itest/lib"> - <include name="**/lib/*" /> - </fileset> - </move> - <delete dir="target/itest/lib/hyperic-sigar-${sigar.version}" /> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - </executions> - </plugin> - - <plugin> - <artifactId>maven-surefire-plugin</artifactId> - <configuration> - <skip>true</skip> - </configuration> - <executions> - <execution> - <id>surefire-it</id> - <phase>integration-test</phase> - <goals> - <goal>test</goal> - </goals> - <configuration> - <skip>${maven.test.skip}</skip> - <excludedGroups>${rhq.testng.excludedGroups}</excludedGroups> - <useSystemClassLoader>false</useSystemClassLoader> - <argLine>${jacoco.integration-test.args} -Dorg.hyperic.sigar.path=${basedir}/target/itest/lib</argLine> - <!--<argLine>${jacoco.integration-test.args} -Dorg.hyperic.sigar.path=${basedir}/target/itest/lib -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>--> - <systemProperties> - <property> - <name>project.artifactId</name> - <value>${project.artifactId}</value> - </property> - <property> - <name>project.version</name> - <value>${project.version}</value> - </property> - </systemProperties> - </configuration> - </execution> - </executions> - </plugin> - - </plugins> - </build> - </profile> - - <profile> - <id>dev</id> - - <properties> - <rhq.rootDir>../../..</rhq.rootDir> - <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> - <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> - </properties> - - <build> - <plugins> - - <plugin> - <artifactId>maven-antrun-plugin</artifactId> - <executions> - - <execution> - <id>deploy</id> - <phase>compile</phase> - <configuration> - <target> - <mkdir dir="${rhq.deploymentDir}" /> - <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" /> - <echo>*** Updating ${deployment.file}...</echo> - <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" /> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - <execution> - <id>deploy-jar-meta-inf</id> - <phase>package</phase> - <configuration> - <target> - <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" /> - <echo>*** Updating META-INF dir in ${deployment.file}...</echo> - <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}"> - <patternset><include name="META-INF/**" /></patternset> - </unjar> - <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF" update="true"> - </jar> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - <execution> - <id>undeploy</id> - <phase>clean</phase> - <configuration> - <target> - <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" /> - <echo>*** Deleting ${deployment.file}...</echo> - <delete file="${deployment.file}" /> - </target> - </configuration> - <goals> - <goal>run</goal> - </goals> - </execution> - - </executions> - </plugin> - - </plugins> - </build> - </profile> - </profiles> + </properties> + <useSystemClassLoader>false</useSystemClassLoader> + <argLine>${jacoco.unit-test.args}</argLine> + </configuration> + </plugin> + + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + <execution> + <phase>pre-integration-test</phase> + <configuration> + <target> + <echo>Setting up itest plugin container...</echo> + <property name="settings.localRepository" location="${user.home}/.m2/repository" /> + <mkdir dir="target/itest/plugins" /> + <copy toDir="target/itest/plugins" flatten="true" verbose="true"> + <fileset dir="${settings.localRepository}/"> + <include name="org/rhq/rhq-platform-plugin/${project.version}/rhq-platform-plugin-${project.version}.jar" /> + </fileset> + <fileset dir="${project.build.directory}"> + <include name="${project.artifactId}-${project.version}.jar" /> + </fileset> + </copy> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-failsafe-plugin</artifactId> + <configuration> + <skipTests>false</skipTests> + <skipITs>false</skipITs> + <includes> + <!-- only include integration tests; normal unit tests are handled above by surefire plugin --> + <include>org/rhq/plugins/netservices/itest/**/*Test.java</include> + </includes> + <properties> + <property> + <name>listener</name> + <value>org.rhq.test.testng.StdoutReporter</value> + </property> + </properties> + <useSystemClassLoader>false</useSystemClassLoader> + <argLine>${jacoco.integration-test.args}</argLine> + </configuration> + <executions> + <execution> + <goals> + <goal>integration-test</goal> + <goal>verify</goal> + </goals> + </execution> + </executions> + </plugin> + + <plugin> + <artifactId>maven-dependency-plugin</artifactId> + <executions> + <execution> + <id>copy-dependency-jars</id> + <phase>process-resources</phase> + <goals> + <goal>copy</goal> + </goals> + <configuration> + <artifactItems> + <artifactItem> + <groupId>commons-httpclient</groupId> + <artifactId>commons-httpclient</artifactId> + <version>${commons-httpclient.version}</version> + </artifactItem> + <artifactItem> + <groupId>commons-codec</groupId> + <artifactId>commons-codec</artifactId> + <version>1.2</version> + </artifactItem> + </artifactItems> + <outputDirectory>${project.build.outputDirectory}/lib</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + + </plugins> + </build> + + <profiles> + + <profile> + + <id>dev</id> + + <properties> + <rhq.rootDir>../../..</rhq.rootDir> + <rhq.containerDir>${rhq.rootDir}/${rhq.defaultDevContainerPath}</rhq.containerDir> + <rhq.deploymentDir>${rhq.containerDir}/${rhq.agentPluginDir}</rhq.deploymentDir> + </properties> + + <build> + <plugins> + + <plugin> + <artifactId>maven-antrun-plugin</artifactId> + <executions> + + <execution> + <id>deploy</id> + <phase>compile</phase> + <configuration> + <target> + <mkdir dir="${rhq.deploymentDir}" /> + <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" /> + <echo>*** Updating ${deployment.file}...</echo> + <jar destfile="${deployment.file}" basedir="${project.build.outputDirectory}" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + <execution> + <id>deploy-jar-meta-inf</id> + <phase>package</phase> + <configuration> + <target> + <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" /> + <echo>*** Updating META-INF dir in ${deployment.file}...</echo> + <unjar src="${project.build.directory}/${project.build.finalName}.jar" dest="${project.build.outputDirectory}"> + <patternset> + <include name="META-INF/**" /> + </patternset> + </unjar> + <jar destfile="${deployment.file}" manifest="${project.build.outputDirectory}/META-INF/MANIFEST.MF" + update="true"> + </jar> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + <execution> + <id>undeploy</id> + <phase>clean</phase> + <configuration> + <target> + <property name="deployment.file" location="${rhq.deploymentDir}/${project.build.finalName}.jar" /> + <echo>*** Deleting ${deployment.file}...</echo> + <delete file="${deployment.file}" /> + </target> + </configuration> + <goals> + <goal>run</goal> + </goals> + </execution> + + </executions> + </plugin> + + </plugins> + </build> + </profile> + </profiles>
</project> diff --git a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponent.java b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponent.java index 54d9256..42cbcee 100644 --- a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponent.java +++ b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponent.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2008 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -19,14 +19,22 @@
package org.rhq.plugins.netservices;
-import java.text.SimpleDateFormat; +import java.net.MalformedURLException; +import java.net.URL; import java.util.Date; -import java.util.Locale; import java.util.Set; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException;
import org.apache.commons.httpclient.Header; import org.apache.commons.httpclient.HttpClient; +import org.apache.commons.httpclient.HttpMethodBase; +import org.apache.commons.httpclient.SimpleHttpConnectionManager; +import org.apache.commons.httpclient.UsernamePasswordCredentials; +import org.apache.commons.httpclient.auth.AuthScope; import org.apache.commons.httpclient.methods.GetMethod; +import org.apache.commons.httpclient.methods.HeadMethod; +import org.apache.commons.httpclient.util.DateUtil; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
@@ -39,43 +47,114 @@ import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; import org.rhq.core.pluginapi.inventory.ResourceComponent; import org.rhq.core.pluginapi.inventory.ResourceContext; import org.rhq.core.pluginapi.measurement.MeasurementFacet; -import org.rhq.core.pluginapi.operation.OperationFacet; -import org.rhq.core.pluginapi.operation.OperationResult; +import org.rhq.core.util.StringUtil;
/** * Monitoring of HTTP Servers * * @author Greg Hinkle */ -public class HTTPNetServiceComponent implements ResourceComponent, MeasurementFacet, OperationFacet { - private final Log log = LogFactory.getLog(this.getClass()); +public class HTTPNetServiceComponent implements ResourceComponent, MeasurementFacet {
- public static final String CONFIG_URL = "url"; - public static final String CONFIG_USER = "user"; - public static final String CONFIG_PASSWORD = "password"; - public static final String CONFIG_REALM = "realm"; + public static final class ConfigKeys {
- // One of { none, SSL, TLS } - public static final String CONFIG_SSL_PROTOCOL = "sslProtocol"; + private ConfigKeys() { + // Defensive + } + + public static final String URL = "url"; + public static final String USER = "user"; + public static final String PASSWORD = "password"; + public static final String REALM = "realm"; + public static final String METHOD = "method"; + public static final String FOLOW_REDIRECTS = "followRedirects"; + public static final String VALIDATE_RESPONSE_CODE = "validateResponseCode"; + public static final String VALIDATE_RESPONSE_PATTERN = "validateResponsePattern";
- // One of { HEAD, GET } - public static final String CONFIG_METHOD = "method"; - public static final String CONFIG_FOLOW_REDIRECTS = "followRedirects"; - public static final String CONFIG_RESPONSE_PATTERN = "responsePattern"; + } + + public static enum HttpMethod { + GET, HEAD + } + + private static final Log LOG = LogFactory.getLog(HTTPNetServiceComponent.class);
private ResourceContext resourceContext;
+ private Configuration pluginConfig; + + private HTTPNetServiceComponentConfiguration componentConfig; + + @Override public void start(ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception { this.resourceContext = resourceContext; - String url = resourceContext.getPluginConfiguration().getSimple(CONFIG_URL).getStringValue(); - if (!url.startsWith("http:") && !url.startsWith("https")) { - throw new InvalidPluginConfigurationException("Url not valid. Must start with 'http:' or 'https:'"); + pluginConfig = resourceContext.getPluginConfiguration(); + componentConfig = createComponentConfiguration(pluginConfig); + } + + /** + * Create a foram {@link HTTPNetServiceComponentConfiguration} instance with the supplied {@link Configuration}. + * May throw {@link InvalidPluginConfigurationException} if: + * <ul> + * <li>Url is empty, invalid, or pointing an non http/https resource</li> + * <li>Http method is not HEAD or GET</li> + * <li>If both content validation and HEAD method are configured</li> + * <li>If the content validation pattern is invalid</li> + * <ul> + * + * @param pluginConfig + * @return + * @throws InvalidPluginConfigurationException + */ + static HTTPNetServiceComponentConfiguration createComponentConfiguration(Configuration pluginConfig) { + + URL endPointUrl = null; + String configUrl = pluginConfig.getSimpleValue(ConfigKeys.URL, StringUtil.EMPTY_STRING); + if (StringUtil.isBlank(configUrl)) { + throw new InvalidPluginConfigurationException("Endpoint URL is not defined"); + } + try { + endPointUrl = new URL(configUrl); + } catch (MalformedURLException e) { + throw new InvalidPluginConfigurationException(configUrl + " is not a valid URL"); } + String protocol = endPointUrl.getProtocol(); + if (!protocol.equals("http") && !protocol.equals("https")) { + throw new InvalidPluginConfigurationException(configUrl + "does not point to an http(s) resource"); + } + + HttpMethod httpMethod = null; + String configMethod = pluginConfig.getSimpleValue(ConfigKeys.METHOD, StringUtil.EMPTY_STRING); + try { + httpMethod = HttpMethod.valueOf(configMethod); + } catch (IllegalArgumentException e) { + throw new InvalidPluginConfigurationException("Invalid http method: " + configMethod); + } + + Pattern responseValidationPattern = null; + String configValidateResponsePattern = pluginConfig.getSimpleValue(ConfigKeys.VALIDATE_RESPONSE_PATTERN); + if (configValidateResponsePattern != null) { + if (httpMethod.equals(HttpMethod.HEAD)) { + throw new InvalidPluginConfigurationException("Cannot validate response content with HEAD request"); + } + try { + responseValidationPattern = Pattern.compile(configValidateResponsePattern); + } catch (PatternSyntaxException e) { + throw new InvalidPluginConfigurationException("Invalid pattern: " + configValidateResponsePattern); + } + } + + return new HTTPNetServiceComponentConfiguration(endPointUrl, httpMethod, responseValidationPattern); }
+ @Override public void stop() { + resourceContext = null; + pluginConfig = null; + componentConfig = null; }
+ @Override public AvailabilityType getAvailability() { try { return getValuesOrAvailability(null, null) ? AvailabilityType.UP : AvailabilityType.DOWN; @@ -84,53 +163,60 @@ public class HTTPNetServiceComponent implements ResourceComponent, MeasurementFa } }
+ @Override public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception { getValuesOrAvailability(report, metrics); }
- public boolean getValuesOrAvailability(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) + private boolean getValuesOrAvailability(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception {
- try { - - Configuration config = resourceContext.getPluginConfiguration(); - - HttpClient httpClient = new HttpClient(); + SimpleHttpConnectionManager httpConnectionManager = new SimpleHttpConnectionManager(); + HttpClient client = new HttpClient(httpConnectionManager); + + String userName = pluginConfig.getSimpleValue(ConfigKeys.USER, StringUtil.EMPTY_STRING); + // Set credentials only if a user name is configured + if (StringUtil.isNotBlank(userName)) { + String password = pluginConfig.getSimpleValue(ConfigKeys.PASSWORD, StringUtil.EMPTY_STRING); + String realm = pluginConfig.getSimpleValue(ConfigKeys.REALM, AuthScope.ANY_REALM); + client.getState().setCredentials( + new AuthScope(componentConfig.getEndPointUrl().getHost(), componentConfig.getEndPointUrl().getPort(), + realm), new UsernamePasswordCredentials(userName, password)); + }
- GetMethod method = new GetMethod(config.getSimple(CONFIG_URL).getStringValue()); + HttpMethodBase method = null; + switch (componentConfig.getHttpMethod()) { + case GET: + method = new GetMethod(componentConfig.getEndPointUrl().toExternalForm()); + break; + case HEAD: + method = new HeadMethod(componentConfig.getEndPointUrl().toExternalForm()); + break; + default: + throw new RuntimeException("Unsupported http method: '" + componentConfig.getHttpMethod() + "'"); + } + Boolean followRedirects = pluginConfig.getSimple(ConfigKeys.FOLOW_REDIRECTS).getBooleanValue(); + method.setFollowRedirects(followRedirects == null ? false : followRedirects.booleanValue());
- method.setFollowRedirects(config.getSimple(CONFIG_FOLOW_REDIRECTS).getBooleanValue()); + try {
long start = System.currentTimeMillis(); - int responseCode = httpClient.executeMethod(method); + int responseCode = client.executeMethod(method); long connectTime = System.currentTimeMillis() - start;
- boolean success = !config.getSimple("validateResponseCode").getBooleanValue() + // Availability may depend on reponse code value + boolean success = !pluginConfig.getSimple(ConfigKeys.VALIDATE_RESPONSE_CODE).getBooleanValue() || (responseCode >= 200 && responseCode <= 299); - - String response = method.getResponseBodyAsString(); + // Availability may depend on reponse content matching a pattern + success = success + && (componentConfig.getResponseValidationPattern() == null || componentConfig + .getResponseValidationPattern().matcher(method.getResponseBodyAsString()).find());
long readTime = (System.currentTimeMillis() - start);
- // TODO: may need to allow plugin to configure the locale, but for this fixed string, make sure we - // ignore default locale, this works for english. - SimpleDateFormat sdf = new SimpleDateFormat("EEE, d MMM yyyy HH:mm:ss zzz", Locale.ENGLISH); Header dateHeader = method.getResponseHeader("Date"); - Date contentDate = dateHeader == null ? new Date(System.currentTimeMillis()) : sdf.parse(dateHeader.getValue()); - - // System.out.println("Success: " + success); - // System.out.println("Response: " + responseCode); - // System.out.println("Connect Time: " + connectTime); - // System.out.println("Read Time: " + readTime); - // System.out.println("Content Length: " + response.length()); - // System.out.println("Content Date: " + contentDate); - // System.out.println("Content Charset: " + method.getResponseCharSet()); - // System.out.println("Content Age: " + (System.currentTimeMillis() - contentDate.getTime())); - - // System.out.println("-----------------------"); - // for (Header header : method.getResponseHeaders()) { - // System.out.println(header.getName() + " = " + header.getValue()); - // } + Date contentDate = dateHeader == null ? new Date(System.currentTimeMillis()) : DateUtil + .parseDate(dateHeader.getValue());
if (metrics != null) { for (MeasurementScheduleRequest request : metrics) { @@ -139,7 +225,7 @@ public class HTTPNetServiceComponent implements ResourceComponent, MeasurementFa } else if (request.getName().equals("readTime")) { report.addData(new MeasurementDataNumeric(request, (double) readTime)); } else if (request.getName().equals("contentLength")) { - report.addData(new MeasurementDataNumeric(request, (double) response.length())); + report.addData(new MeasurementDataNumeric(request, (double) method.getResponseContentLength())); } else if (request.getName().equals("contentAge")) { report.addData(new MeasurementDataNumeric(request, (double) (System.currentTimeMillis() - contentDate.getTime()))); @@ -150,28 +236,14 @@ public class HTTPNetServiceComponent implements ResourceComponent, MeasurementFa return success;
} catch (Exception e) { - // e.printStackTrace(); - log.error(e); + LOG.error(e); + } finally { + // First release connection + method.releaseConnection(); + // Then force close + httpConnectionManager.closeIdleConnections(0); } return false; }
- // TODO GH: This really only makes sense to offer to go get the content if we can support long config content for responses bigger than 4k - public OperationResult invokeOperation(String name, Configuration parameters) throws InterruptedException, - Exception { - Configuration config = resourceContext.getPluginConfiguration(); - - HttpClient httpClient = new HttpClient(); - - GetMethod method = new GetMethod(config.getSimple(CONFIG_URL).getStringValue()); - - method.setFollowRedirects(config.getSimple(CONFIG_FOLOW_REDIRECTS).getBooleanValue()); - - int responseCode = httpClient.executeMethod(method); - - String response = method.getResponseBodyAsString(); - - OperationResult result = new OperationResult(response); - return result; - } } diff --git a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponentConfiguration.java b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponentConfiguration.java new file mode 100644 index 0000000..b28d03f --- /dev/null +++ b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponentConfiguration.java @@ -0,0 +1,57 @@ +/* + * RHQ Management Platform + * Copyright (C) 2013 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.plugins.netservices; + +import java.net.URL; +import java.util.regex.Pattern; + +import org.rhq.plugins.netservices.HTTPNetServiceComponent.HttpMethod; + +/** + * @author Thomas Segismont + */ +class HTTPNetServiceComponentConfiguration { + + private URL endPointUrl; + + private HttpMethod httpMethod; + + private Pattern responseValidationPattern; + + public HTTPNetServiceComponentConfiguration(URL endPointUrl, HttpMethod httpMethod, + Pattern responseValidationPattern) { + this.endPointUrl = endPointUrl; + this.httpMethod = httpMethod; + this.responseValidationPattern = responseValidationPattern; + } + + public URL getEndPointUrl() { + return endPointUrl; + } + + public HttpMethod getHttpMethod() { + return httpMethod; + } + + public Pattern getResponseValidationPattern() { + return responseValidationPattern; + } + +} \ No newline at end of file diff --git a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponent.java b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponent.java index f0d693b..6b259b3 100644 --- a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponent.java +++ b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponent.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2008 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -19,48 +19,37 @@
package org.rhq.plugins.netservices;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; -import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; -import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; +import java.util.Collections; +import java.util.Set; + +import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; import org.rhq.core.pluginapi.inventory.ManualAddFacet; -import org.rhq.core.domain.configuration.Configuration; - -import java.util.Set; -import java.util.Collections; -import java.net.URL; -import java.net.MalformedURLException; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
/** * @author Greg Hinkle */ public class HTTPNetServiceDiscoveryComponent implements ResourceDiscoveryComponent, ManualAddFacet { - public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException, Exception { + + @Override + public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) + throws InvalidPluginConfigurationException, Exception { // We don't support auto-discovery. return Collections.emptySet(); }
+ @Override public DiscoveredResourceDetails discoverResource(Configuration config, - ResourceDiscoveryContext resourceDiscoveryContext) - throws InvalidPluginConfigurationException { - String configURL = config.getSimple(HTTPNetServiceComponent.CONFIG_URL).getStringValue(); - URL url; - try { - url = new URL(configURL); - } - catch (MalformedURLException e) { - throw new InvalidPluginConfigurationException("Property '" + HTTPNetServiceComponent.CONFIG_URL - + "' is not a valid URL."); - } - DiscoveredResourceDetails details = - new DiscoveredResourceDetails( - resourceDiscoveryContext.getResourceType(), - url.toExternalForm(), - url.toExternalForm(), - null, - null, - config, - null); + ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException { + // Get the component configuration. This call will also make configuration checks + HTTPNetServiceComponentConfiguration componentConfiguration = HTTPNetServiceComponent + .createComponentConfiguration(config); + String endPointUrl = componentConfiguration.getEndPointUrl().toExternalForm(); + DiscoveredResourceDetails details = new DiscoveredResourceDetails(resourceDiscoveryContext.getResourceType(), + endPointUrl, endPointUrl, null, null, config, null); return details; } } diff --git a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceComponent.java b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceComponent.java index f219e05..f416140 100644 --- a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceComponent.java +++ b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceComponent.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2008 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -19,78 +19,93 @@
package org.rhq.plugins.netservices;
-import org.apache.commons.httpclient.Header; -import org.apache.commons.httpclient.HttpClient; -import org.apache.commons.httpclient.methods.GetMethod; +import java.net.InetAddress; +import java.net.UnknownHostException; +import java.util.Set; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; + import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.measurement.AvailabilityType; import org.rhq.core.domain.measurement.MeasurementDataNumeric; +import org.rhq.core.domain.measurement.MeasurementDataTrait; import org.rhq.core.domain.measurement.MeasurementReport; import org.rhq.core.domain.measurement.MeasurementScheduleRequest; -import org.rhq.core.domain.measurement.MeasurementDataTrait; import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; import org.rhq.core.pluginapi.inventory.ResourceComponent; import org.rhq.core.pluginapi.inventory.ResourceContext; import org.rhq.core.pluginapi.measurement.MeasurementFacet; -import org.rhq.core.pluginapi.operation.OperationFacet; -import org.rhq.core.pluginapi.operation.OperationResult; - -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.Set; -import java.net.InetAddress; -import java.net.Inet4Address; -import java.net.UnknownHostException; - +import org.rhq.core.util.StringUtil;
/** - * Monitoring of HTTP Servers + * Monitoring of IP addresses * * @author Greg Hinkle */ public class PingNetServiceComponent implements ResourceComponent, MeasurementFacet {
- public static final String CONFIG_ADDRESS = "address"; + public static final class ConfigKeys {
+ private ConfigKeys() { + // Defensive + } + + public static final String ADDRESS = "address"; + }
- private ResourceContext resourceContext; + private static final Log LOG = LogFactory.getLog(PingNetServiceComponent.class);
- public void start(ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception { - this.resourceContext = resourceContext; - String addressString = resourceContext.getPluginConfiguration().getSimple(CONFIG_ADDRESS).getStringValue(); + private static final int PING_TIMEOUT = 5000; + + private InetAddress address; + + @Override + public void start(@SuppressWarnings("rawtypes") + ResourceContext resourceContext) throws InvalidPluginConfigurationException, Exception { + address = createComponentConfiguration(resourceContext.getPluginConfiguration()); + } + + static InetAddress createComponentConfiguration(Configuration pluginConfig) + throws InvalidPluginConfigurationException { + String addressString = pluginConfig.getSimpleValue(ConfigKeys.ADDRESS, StringUtil.EMPTY_STRING); + if (StringUtil.isBlank(addressString)) { + throw new InvalidPluginConfigurationException("Address is not defined"); + } try { - InetAddress address = InetAddress.getByName(addressString); + return InetAddress.getByName(addressString); } catch (UnknownHostException uhe) { throw new InvalidPluginConfigurationException(uhe); } }
+ @Override public void stop() { + address = null; }
+ @Override public AvailabilityType getAvailability() { try { - String addressString = resourceContext.getPluginConfiguration().getSimple(CONFIG_ADDRESS).getStringValue(); - InetAddress address = InetAddress.getByName(addressString); - return address.isReachable(5000) ? AvailabilityType.UP : AvailabilityType.DOWN; + return address.isReachable(PING_TIMEOUT) ? AvailabilityType.UP : AvailabilityType.DOWN; } catch (Exception e) { + if (LOG.isWarnEnabled()) { + LOG.warn(address.getHostAddress() + " not reachable", e); + } return AvailabilityType.DOWN; } }
- + @Override public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> metrics) throws Exception { - String addressString = resourceContext.getPluginConfiguration().getSimple(CONFIG_ADDRESS).getStringValue(); - InetAddress address = InetAddress.getByName(addressString); - - for (MeasurementScheduleRequest request :metrics) { + for (MeasurementScheduleRequest request : metrics) { if (request.getName().equals("ipAddress")) { report.addData(new MeasurementDataTrait(request, address.getHostAddress())); } else if (request.getName().equals("hostName")) { report.addData(new MeasurementDataTrait(request, address.getCanonicalHostName())); } else if (request.getName().equals("responseTime")) { long start = System.currentTimeMillis(); - address.isReachable(5000); + address.isReachable(PING_TIMEOUT); report.addData(new MeasurementDataNumeric(request, (double) (System.currentTimeMillis() - start))); } } diff --git a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponent.java b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponent.java index 3f41a7e..da87c1b 100644 --- a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponent.java +++ b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponent.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2008 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -19,40 +19,37 @@
package org.rhq.plugins.netservices;
-import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; -import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; -import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; +import java.net.InetAddress; +import java.util.Collections; +import java.util.Set; + +import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; import org.rhq.core.pluginapi.inventory.ManualAddFacet; -import org.rhq.core.domain.configuration.Configuration; - -import java.util.Set; -import java.util.Collections; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
/** * @author Greg Hinkle */ public class PingNetServiceDiscoveryComponent implements ResourceDiscoveryComponent, ManualAddFacet { + + private static final String RESOURCE_NAME_PREFIX = "Ping "; + + @Override public Set discoverResources(ResourceDiscoveryContext resourceDiscoveryContext) - throws InvalidPluginConfigurationException, Exception { + throws InvalidPluginConfigurationException, Exception { // We don't support auto-discovery. return Collections.emptySet(); }
+ @Override public DiscoveredResourceDetails discoverResource(Configuration config, - ResourceDiscoveryContext resourceDiscoveryContext) - throws InvalidPluginConfigurationException { - String address = config.getSimple(PingNetServiceComponent.CONFIG_ADDRESS).getStringValue(); - // TODO: Validate the address is a valid host name or IP address. - DiscoveredResourceDetails details = - new DiscoveredResourceDetails( - resourceDiscoveryContext.getResourceType(), - address, - "Ping " + address, - null, - null, - config, - null); + ResourceDiscoveryContext resourceDiscoveryContext) throws InvalidPluginConfigurationException { + InetAddress address = PingNetServiceComponent.createComponentConfiguration(config); + DiscoveredResourceDetails details = new DiscoveredResourceDetails(resourceDiscoveryContext.getResourceType(), + address.getHostAddress(), RESOURCE_NAME_PREFIX + address.getHostAddress(), null, null, config, null); return details; } } \ No newline at end of file diff --git a/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml index b6b0cd3..16a48d5 100644 --- a/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml @@ -11,30 +11,29 @@ <service name="HTTPService" discovery="HTTPNetServiceDiscoveryComponent" class="HTTPNetServiceComponent" - supportsManualAdd="true"> + supportsManualAdd="true" + description="HTTP Endpoint monitoring service">
<plugin-configuration> - <c:simple-property name="url"/> - <c:simple-property name="user" required="false"/> - <c:simple-property name="password" required="false"/> - <c:simple-property name="realm" required="false"/> - <c:simple-property name="validateResponseCode" type="boolean" default="false" - description="Codes in the 200-299 range are considered success"/> - <c:simple-property name="sslProtocol" default="none"> - <c:property-options> - <c:option value="none"/> - <c:option value="SSL"/> - <c:option value="TLS"/> - </c:property-options> - </c:simple-property> + <c:simple-property name="url" description="Http URL of the endpoint" /> + <c:simple-property name="user" required="false" + description="User name if http endpoint requires authentication." /> + <c:simple-property name="password" required="false" + description="Password if http endpoint requires authentication." /> + <c:simple-property name="realm" required="false" + description="Authentication Realm. By default user name and password will be used with any realm." /> <c:simple-property name="method" default="GET"> <c:property-options> <c:option value="HEAD"/> <c:option value="GET"/> </c:property-options> </c:simple-property> - <c:simple-property name="followRedirects" type="boolean" default="false"/> - <c:simple-property name="responsePattern" required="false"/> + <c:simple-property name="followRedirects" type="boolean" default="false" + description="Follow http redirects when contacting endpoints?" /> + <c:simple-property name="validateResponseCode" type="boolean" default="false" + description="Set this to true if response code should determine availability. Codes in the 200-299 range are considered success." /> + <c:simple-property name="validateResponsePattern" required="false" + description="If not empty, availability will depend on http response having content matching this (Java style) regular expression."/> </plugin-configuration>
<metric property="connectTime" units="milliseconds" displayType="summary" @@ -46,17 +45,17 @@ <metric property="contentAge" units="milliseconds" description="The declared age of the requested page"/>
- </service>
<service name="PingService" discovery="PingNetServiceDiscoveryComponent" class="PingNetServiceComponent" - supportsManualAdd="true"> + supportsManualAdd="true" + description="IP address ping service">
<plugin-configuration> - <c:simple-property name="address"/> + <c:simple-property name="address" description="IP address"/> </plugin-configuration>
<metric property="ipAddress" displayType="summary" dataType="trait" description="The ip address of the host"/> diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponentTest.java new file mode 100644 index 0000000..0745a34 --- /dev/null +++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/HTTPNetServiceDiscoveryComponentTest.java @@ -0,0 +1,178 @@ +/* + * RHQ Management Platform + * Copyright 2013, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.plugins.netservices; + +import static org.mockito.Mockito.when; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.resource.ResourceType; +import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; +import org.rhq.plugins.netservices.HTTPNetServiceComponent.ConfigKeys; +import org.rhq.plugins.netservices.HTTPNetServiceComponent.HttpMethod; + +/** + * @author Thomas Segismont + */ +public class HTTPNetServiceDiscoveryComponentTest { + + private HTTPNetServiceDiscoveryComponent httpNetServiceDiscoveryComponent; + + private Configuration configuration; + + @Mock + private ResourceDiscoveryContext<?> resourceDiscoveryContext; + + @Mock + private ResourceType resourceType; + + @BeforeMethod(alwaysRun = true) + protected void setUp() throws Exception { + httpNetServiceDiscoveryComponent = new HTTPNetServiceDiscoveryComponent(); + configuration = new Configuration(); + configuration.setSimpleValue(ConfigKeys.URL, "http://www.myhost.com/pipo/molo"); + configuration.setSimpleValue(ConfigKeys.METHOD, HttpMethod.GET.name()); + configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_PATTERN, "(ok|success)"); + MockitoAnnotations.initMocks(this); + when(resourceDiscoveryContext.getResourceType()).thenReturn(resourceType); + } + + @Test + public void testDiscoverResources() throws Exception { + // Manual add only, should always return empty set + assertEquals(0, httpNetServiceDiscoveryComponent.discoverResources(null).size()); + } + + @Test + public void testValidComponentConfiguration() { + try { + DiscoveredResourceDetails resourceDetails = httpNetServiceDiscoveryComponent.discoverResource( + configuration, resourceDiscoveryContext); + assertEquals(resourceDetails.getResourceType(), resourceType); + } catch (InvalidPluginConfigurationException e) { + fail("Component configuration should be valid", e); + } + } + + @Test + public void testMissingUrl() { + try { + configuration.remove(ConfigKeys.URL); + httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext); + fail("Component configuration should be invalid"); + } catch (InvalidPluginConfigurationException e) { + assertEquals(e.getMessage(), "Endpoint URL is not defined"); + } + } + + @Test + public void testMalformedUrl() { + String configUrl = "pipomolo"; + try { + configuration.setSimpleValue(ConfigKeys.URL, configUrl); + httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext); + fail("Component configuration should be invalid"); + } catch (InvalidPluginConfigurationException e) { + assertEquals(e.getMessage(), configUrl + " is not a valid URL"); + } + } + + @Test + public void testNotHttpOrHttpsUrl() { + String configUrl = "ftp://pipo.com/molo.zipo"; + try { + configuration.setSimpleValue(ConfigKeys.URL, configUrl); + httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext); + fail("Component configuration should be invalid"); + } catch (InvalidPluginConfigurationException e) { + assertEquals(e.getMessage(), configUrl + "does not point to an http(s) resource"); + } + } + + @Test + public void testHttpsUrl() { + try { + configuration.setSimpleValue(ConfigKeys.URL, "https://www.myhost.com/pipo/molo"); + DiscoveredResourceDetails resourceDetails = httpNetServiceDiscoveryComponent.discoverResource( + configuration, resourceDiscoveryContext); + assertEquals(resourceDetails.getResourceType(), resourceType); + } catch (InvalidPluginConfigurationException e) { + fail("Component configuration should be valid", e); + } + } + + @Test + public void testInvalidHttpMethod() { + String configMethod = "DELETE"; + try { + configuration.setSimpleValue(ConfigKeys.METHOD, configMethod); + httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext); + fail("Component configuration should be invalid"); + } catch (InvalidPluginConfigurationException e) { + assertEquals(e.getMessage(), "Invalid http method: " + configMethod); + } + } + + @Test + public void testHeadMethod() { + try { + configuration.setSimpleValue(ConfigKeys.METHOD, HttpMethod.HEAD.name()); + configuration.remove(ConfigKeys.VALIDATE_RESPONSE_PATTERN); + DiscoveredResourceDetails resourceDetails = httpNetServiceDiscoveryComponent.discoverResource( + configuration, resourceDiscoveryContext); + assertEquals(resourceDetails.getResourceType(), resourceType); + } catch (InvalidPluginConfigurationException e) { + fail("Component configuration should be valid", e); + } + } + + @Test + public void testUnableToValidateContentWithHeadRequest() { + try { + configuration.setSimpleValue(ConfigKeys.METHOD, HttpMethod.HEAD.name()); + httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext); + fail("Component configuration should be invalid"); + } catch (InvalidPluginConfigurationException e) { + assertEquals(e.getMessage(), "Cannot validate response content with HEAD request"); + } + } + + @Test + public void testInvalidPatternSyntax() { + String configValidateResponsePattern = "(pipo"; + try { + configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_PATTERN, configValidateResponsePattern); + httpNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext); + fail("Component configuration should be invalid"); + } catch (InvalidPluginConfigurationException e) { + assertEquals(e.getMessage(), "Invalid pattern: " + configValidateResponsePattern); + } + } + +} diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponentTest.java new file mode 100644 index 0000000..961a81c --- /dev/null +++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PingNetServiceDiscoveryComponentTest.java @@ -0,0 +1,105 @@ +/* + * RHQ Management Platform + * Copyright 2013, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.plugins.netservices; + +import static org.mockito.Mockito.when; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.fail; + +import java.net.UnknownHostException; + +import org.mockito.Mock; +import org.mockito.MockitoAnnotations; +import org.testng.annotations.BeforeMethod; +import org.testng.annotations.Test; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.resource.ResourceType; +import org.rhq.core.pluginapi.inventory.DiscoveredResourceDetails; +import org.rhq.core.pluginapi.inventory.InvalidPluginConfigurationException; +import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext; +import org.rhq.plugins.netservices.PingNetServiceComponent.ConfigKeys; + +/** + * @author Thomas Segismont + */ +public class PingNetServiceDiscoveryComponentTest { + + private PingNetServiceDiscoveryComponent pingNetServiceDiscoveryComponent; + + private Configuration configuration; + + @Mock + private ResourceDiscoveryContext<?> resourceDiscoveryContext; + + @Mock + private ResourceType resourceType; + + @BeforeMethod(alwaysRun = true) + protected void setUp() throws Exception { + pingNetServiceDiscoveryComponent = new PingNetServiceDiscoveryComponent(); + configuration = new Configuration(); + configuration.setSimpleValue(ConfigKeys.ADDRESS, "127.0.0.1"); + MockitoAnnotations.initMocks(this); + when(resourceDiscoveryContext.getResourceType()).thenReturn(resourceType); + } + + @Test + public void testDiscoverResources() throws Exception { + // Manual add only, should always return empty set + assertEquals(0, pingNetServiceDiscoveryComponent.discoverResources(null).size()); + } + + @Test + public void testValidComponentConfiguration() { + try { + DiscoveredResourceDetails resourceDetails = pingNetServiceDiscoveryComponent.discoverResource( + configuration, resourceDiscoveryContext); + assertEquals(resourceDetails.getResourceType(), resourceType); + } catch (InvalidPluginConfigurationException e) { + fail("Component configuration should be valid", e); + } + } + + @Test + public void testMissingAddress() { + try { + configuration.remove(ConfigKeys.ADDRESS); + pingNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext); + fail("Component configuration should be invalid"); + } catch (InvalidPluginConfigurationException e) { + assertEquals(e.getMessage(), "Address is not defined"); + } + } + + @Test + public void testMalformedAddress() { + String configAddress = "pipomolo"; + try { + configuration.setSimpleValue(ConfigKeys.ADDRESS, configAddress); + pingNetServiceDiscoveryComponent.discoverResource(configuration, resourceDiscoveryContext); + fail("Component configuration should be invalid"); + } catch (InvalidPluginConfigurationException e) { + assertEquals(e.getCause().getClass(), UnknownHostException.class); + } + } + +} diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java new file mode 100644 index 0000000..24b6644 --- /dev/null +++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java @@ -0,0 +1,162 @@ +/* + * RHQ Management Platform + * Copyright 2013, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.plugins.netservices.itest; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + +import java.io.IOException; +import java.net.InetSocketAddress; +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import javax.servlet.ServletException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.eclipse.jetty.server.Server; +import org.eclipse.jetty.servlet.ServletContextHandler; +import org.eclipse.jetty.servlet.ServletHolder; +import org.testng.annotations.AfterClass; +import org.testng.annotations.BeforeClass; +import org.testng.annotations.Test; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.discovery.MergeResourceResponse; +import org.rhq.core.domain.measurement.AvailabilityType; +import org.rhq.core.domain.measurement.DataType; +import org.rhq.core.domain.measurement.MeasurementData; +import org.rhq.core.domain.measurement.MeasurementReport; +import org.rhq.core.domain.measurement.MeasurementScheduleRequest; +import org.rhq.core.pluginapi.inventory.ResourceComponent; +import org.rhq.plugins.netservices.HTTPNetServiceComponent; +import org.rhq.plugins.netservices.HTTPNetServiceComponent.ConfigKeys; +import org.rhq.plugins.netservices.HTTPNetServiceComponent.HttpMethod; + +/** + * @author Thomas Segismont + */ +public class HTTPNetServiceComponentTest extends NetServiceComponentTest { + + private static final Log LOG = LogFactory.getLog(NetServiceComponentTest.class); + + private static final String SERVICE_NAME = "HTTPService"; + + private static final String HTTP_HOST = "localhost"; + + private static final int HTTP_PORT = 31158; + + private static final int SERVLET_SLEEP = 1000; + + private Server jettyServer; + + private HTTPNetServiceComponent httpNetServiceComponent; + + @BeforeClass + public void startJetty() throws Exception { + LOG.info("Setting up Jetty test server"); + jettyServer = new Server(new InetSocketAddress(HTTP_HOST, HTTP_PORT)); + ServletContextHandler context = new ServletContextHandler(ServletContextHandler.SESSIONS); + context.setContextPath("/"); + jettyServer.setHandler(context); + @SuppressWarnings("serial") + HttpServlet testServlet = new HttpServlet() { + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { + resp.getWriter().println("Test servlet request: success view"); + long start = System.currentTimeMillis(); + do { + try { + Thread.sleep(SERVLET_SLEEP); + } catch (InterruptedException e) { + } + } while (System.currentTimeMillis() - start < SERVLET_SLEEP); + } + }; + context.addServlet(new ServletHolder(testServlet), "/*"); + jettyServer.start(); + } + + @AfterClass + public void stopJetty() { + LOG.info("Shutting down Jetty test server"); + try { + if (jettyServer != null) { + jettyServer.stop(); + } + } catch (Exception ignore) { + } + } + + @Test(dependsOnMethods = "testPluginLoad") + public void testManualAdd() throws Exception { + Configuration configuration = new Configuration(); + configuration.setSimpleValue(ConfigKeys.URL, "http://" + HTTP_HOST + ":" + HTTP_PORT + "/pipo/molo"); + configuration.setSimpleValue(ConfigKeys.METHOD, HttpMethod.GET.name()); + configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_CODE, "true"); + configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_PATTERN, "success"); + MergeResourceResponse response = getInventoryManager().manuallyAddResource( + getPluginManager().getMetadataManager().getType(SERVICE_NAME, PLUGIN_NAME), getPlatform().getId(), + configuration, -1); + assertNotNull(response, "Manual add response is null"); + @SuppressWarnings("rawtypes") + ResourceComponent resourceComponent = getInventoryManager().getResourceContainer(response.getResourceId()) + .getResourceComponent(); + assertEquals(resourceComponent.getClass(), HTTPNetServiceComponent.class); + httpNetServiceComponent = (HTTPNetServiceComponent) resourceComponent; + } + + @Test(dependsOnMethods = "testManualAdd") + public void testAvailability() throws Exception { + assertEquals(httpNetServiceComponent.getAvailability(), AvailabilityType.UP); + } + + @Test(dependsOnMethods = "testAvailability") + public void testMeasurement() throws Exception { + MeasurementReport report = new MeasurementReport(); + Set<MeasurementScheduleRequest> metrics = new HashSet<MeasurementScheduleRequest>(); + int scheduleId = 1; + metrics.add(new MeasurementScheduleRequest(scheduleId++, "connectTime", 1000, true, DataType.MEASUREMENT)); + metrics.add(new MeasurementScheduleRequest(scheduleId++, "readTime", 1000, true, DataType.MEASUREMENT)); + metrics.add(new MeasurementScheduleRequest(scheduleId++, "contentLength", 1000, true, DataType.MEASUREMENT)); + metrics.add(new MeasurementScheduleRequest(scheduleId++, "contentAge", 1000, true, DataType.MEASUREMENT)); + httpNetServiceComponent.getValues(report, metrics); + Map<String, Object> datas = new HashMap<String, Object>(); + for (MeasurementData data : report.getNumericData()) { + datas.put(data.getName(), data.getValue()); + } + Double value = getMetric(datas, "connectTime"); + assertTrue(value > SERVLET_SLEEP); + value = getMetric(datas, "readTime"); + assertTrue(value > SERVLET_SLEEP); + value = getMetric(datas, "contentLength"); + assertTrue(value > 0); + value = getMetric(datas, "contentAge"); + assertTrue(value > 0); + } + +} diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java new file mode 100644 index 0000000..503e359 --- /dev/null +++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/NetServiceComponentTest.java @@ -0,0 +1,154 @@ +/* + * RHQ Management Platform + * Copyright 2013, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.plugins.netservices.itest; + +import static org.mockito.Matchers.any; +import static org.mockito.Matchers.anyInt; +import static org.mockito.Mockito.when; +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + +import java.io.File; +import java.util.Map; +import java.util.concurrent.atomic.AtomicInteger; + +import org.apache.commons.logging.Log; +import org.apache.commons.logging.LogFactory; +import org.mockito.Mockito; +import org.mockito.invocation.InvocationOnMock; +import org.mockito.stubbing.Answer; +import org.testng.annotations.AfterSuite; +import org.testng.annotations.BeforeSuite; +import org.testng.annotations.Test; + +import org.rhq.core.clientapi.server.discovery.DiscoveryServerService; +import org.rhq.core.domain.discovery.MergeResourceResponse; +import org.rhq.core.domain.resource.Resource; +import org.rhq.core.pc.PluginContainer; +import org.rhq.core.pc.PluginContainerConfiguration; +import org.rhq.core.pc.ServerServices; +import org.rhq.core.pc.inventory.InventoryManager; +import org.rhq.core.pc.plugin.FileSystemPluginFinder; +import org.rhq.core.pc.plugin.PluginEnvironment; +import org.rhq.core.pc.plugin.PluginManager; + +/** + * @author Thomas Segismont + */ +public abstract class NetServiceComponentTest { + + public static final String PLUGIN_NAME = "NetworkServices"; + + private static final Log LOG = LogFactory.getLog(NetServiceComponentTest.class); + + private static final AtomicInteger resourceIdGenerator = new AtomicInteger(Integer.MIN_VALUE / 2); + + private static PluginContainer pluginContainer; + + private static InventoryManager inventoryManager; + + private static Resource platform; + + private static PluginManager pluginManager; + + private static PluginEnvironment pluginEnvironment; + + protected PluginContainer getPluginContainer() { + return pluginContainer; + } + + protected InventoryManager getInventoryManager() { + return inventoryManager; + } + + protected Resource getPlatform() { + return platform; + } + + protected PluginManager getPluginManager() { + return pluginManager; + } + + protected PluginEnvironment getPluginEnvironment() { + return pluginEnvironment; + } + + @BeforeSuite + public static void startPluginContainer() throws Exception { + LOG.info("Setting up plugin container"); + File pluginDir = new File("target/itest/plugins"); + PluginContainerConfiguration containerConfig = new PluginContainerConfiguration(); + containerConfig.setPluginFinder(new FileSystemPluginFinder(pluginDir)); + containerConfig.setPluginDirectory(pluginDir); + containerConfig.setInsideAgent(false); + // netservices plugin has resources which can only be manually added so we have to mock server integration. + DiscoveryServerService discoveryServerService = Mockito.mock(DiscoveryServerService.class); + when(discoveryServerService.addResource(any(Resource.class), anyInt())).thenAnswer( + new Answer<MergeResourceResponse>() { + + @Override + public MergeResourceResponse answer(InvocationOnMock invocation) throws Throwable { + return new MergeResourceResponse(resourceIdGenerator.decrementAndGet(), false); + } + }); + ServerServices serverServices = new ServerServices(); + serverServices.setDiscoveryServerService(discoveryServerService); + containerConfig.setServerServices(serverServices); + pluginContainer = PluginContainer.getInstance(); + pluginContainer.setConfiguration(containerConfig); + pluginContainer.initialize(); + inventoryManager = pluginContainer.getInventoryManager(); + platform = inventoryManager.getPlatform(); + pluginManager = pluginContainer.getPluginManager(); + pluginEnvironment = pluginManager.getPlugin(PLUGIN_NAME); + } + + @AfterSuite + public static void stopPluginContainer() { + LOG.info("Shutting down plugin container"); + try { + if (pluginContainer != null) { + pluginContainer.shutdown(); + } + } catch (Exception ignore) { + } + } + + @Test + public static void testPluginLoad() { + assertNotNull(pluginEnvironment, "Plugin not loaded"); + assertEquals(pluginEnvironment.getPluginName(), PLUGIN_NAME); + } + + public static Double getMetric(Map<String, Object> datas, String metricName) { + assertTrue(datas.containsKey(metricName), metricName + " metric not found"); + assertTrue(datas.get(metricName).getClass().equals(Double.class), metricName + " metric value is not a Double"); + return (Double) datas.get(metricName); + } + + public static String getTrait(Map<String, Object> datas, String traitName) { + assertTrue(datas.containsKey(traitName), traitName + " trait not found"); + assertTrue(datas.get(traitName).getClass().equals(String.class), traitName + " traitName value is not a String"); + return (String) datas.get(traitName); + } + +} diff --git a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PingNetServiceComponentTest.java b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PingNetServiceComponentTest.java new file mode 100644 index 0000000..ea1a374 --- /dev/null +++ b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PingNetServiceComponentTest.java @@ -0,0 +1,98 @@ +/* + * RHQ Management Platform + * Copyright 2013, Red Hat Middleware LLC, and individual contributors + * as indicated by the @author tags. See the copyright.txt file in the + * distribution for a full listing of individual contributors. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + */ + +package org.rhq.plugins.netservices.itest; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertNotNull; +import static org.testng.Assert.assertTrue; + +import java.util.HashMap; +import java.util.HashSet; +import java.util.Map; +import java.util.Set; + +import org.testng.annotations.Test; + +import org.rhq.core.domain.configuration.Configuration; +import org.rhq.core.domain.discovery.MergeResourceResponse; +import org.rhq.core.domain.measurement.AvailabilityType; +import org.rhq.core.domain.measurement.DataType; +import org.rhq.core.domain.measurement.MeasurementData; +import org.rhq.core.domain.measurement.MeasurementReport; +import org.rhq.core.domain.measurement.MeasurementScheduleRequest; +import org.rhq.core.pluginapi.inventory.ResourceComponent; +import org.rhq.core.util.StringUtil; +import org.rhq.plugins.netservices.PingNetServiceComponent; +import org.rhq.plugins.netservices.PingNetServiceComponent.ConfigKeys; + +/** + * @author Thomas Segismont + */ +public class PingNetServiceComponentTest extends NetServiceComponentTest { + + private static final String SERVICE_NAME = "PingService"; + + private static final String LOOPBACK = "127.0.0.1"; + + private PingNetServiceComponent pingNetServiceComponent; + + @Test(dependsOnMethods = "testPluginLoad") + public void testManualAdd() throws Exception { + Configuration configuration = new Configuration(); + configuration.setSimpleValue(ConfigKeys.ADDRESS, LOOPBACK); + MergeResourceResponse response = getInventoryManager().manuallyAddResource( + getPluginManager().getMetadataManager().getType(SERVICE_NAME, PLUGIN_NAME), getPlatform().getId(), + configuration, -1); + assertNotNull(response, "Manual add response is null"); + @SuppressWarnings("rawtypes") + ResourceComponent resourceComponent = getInventoryManager().getResourceContainer(response.getResourceId()) + .getResourceComponent(); + assertEquals(resourceComponent.getClass(), PingNetServiceComponent.class); + pingNetServiceComponent = (PingNetServiceComponent) resourceComponent; + } + + @Test(dependsOnMethods = "testManualAdd") + public void testAvailability() throws Exception { + assertEquals(pingNetServiceComponent.getAvailability(), AvailabilityType.UP); + } + + @Test(dependsOnMethods = "testAvailability") + public void testMeasurement() throws Exception { + MeasurementReport report = new MeasurementReport(); + Set<MeasurementScheduleRequest> metrics = new HashSet<MeasurementScheduleRequest>(); + int scheduleId = 1; + metrics.add(new MeasurementScheduleRequest(scheduleId++, "ipAddress", 1000, true, DataType.TRAIT)); + metrics.add(new MeasurementScheduleRequest(scheduleId++, "hostName", 1000, true, DataType.TRAIT)); + metrics.add(new MeasurementScheduleRequest(scheduleId++, "responseTime", 1000, true, DataType.MEASUREMENT)); + pingNetServiceComponent.getValues(report, metrics); + Map<String, Object> datas = new HashMap<String, Object>(); + for (MeasurementData data : report.getNumericData()) { + datas.put(data.getName(), data.getValue()); + } + for (MeasurementData data : report.getTraitData()) { + datas.put(data.getName(), data.getValue()); + } + assertEquals(getTrait(datas, "ipAddress"), LOOPBACK); + assertTrue(StringUtil.isNotBlank(getTrait(datas, "hostName"))); + assertTrue(getMetric(datas, "responseTime") >= 0); + } + +} diff --git a/modules/plugins/netservices/src/test/resources/log4j.xml b/modules/plugins/netservices/src/test/resources/log4j.xml new file mode 100644 index 0000000..4815936 --- /dev/null +++ b/modules/plugins/netservices/src/test/resources/log4j.xml @@ -0,0 +1,32 @@ +<?xml version="1.0" encoding="UTF-8"?> + +<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd"> + +<!-- | For more configuration information and examples, see the Jakarta Log4j | website: http://jakarta.apache.org/log4j --> + +<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/%22%3E + + <appender name="CONSOLE" class="org.apache.log4j.ConsoleAppender"> + <param name="Target" value="System.out" /> + <param name="Threshold" value="INFO" /> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) - %m%n" /> + </layout> + </appender> + + <appender name="FILE" class="org.apache.log4j.RollingFileAppender"> + <param name="File" value="target/test.log" /> + <param name="Append" value="false" /> + <param name="Threshold" value="DEBUG" /> + <layout class="org.apache.log4j.PatternLayout"> + <param name="ConversionPattern" value="%-5p %d{dd-MM HH:mm:ss,SSS} (%F:%M:%L) - %m%n" /> + </layout> + </appender> + + <root> + <level value="DEBUG" /> + <appender-ref ref="CONSOLE" /> + <appender-ref ref="FILE" /> + </root> + +</log4j:configuration>
commit b3b316f4b6761183fa75738008a94acc3bad918a Author: Heiko W. Rupp hwr@redhat.com Date: Thu Feb 21 15:16:37 2013 +0100
Add getAlerts4Definition, extend testing
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java index ce208a3..ce1ad76 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertHandlerBean.java @@ -45,6 +45,8 @@ import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo;
import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiError; +import com.wordnik.swagger.annotations.ApiErrors; import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiParam;
@@ -86,18 +88,40 @@ public class AlertHandlerBean extends AbstractRestBean { @GZIP @GET @Path("/") - @ApiOperation(value = "List all alerts", multiValueResponse = true, responseClass = "List<AlertRest>") + @ApiOperation(value = "List all alerts, possibly limiting by resource or alert definition, priority and start time", multiValueResponse = true, responseClass = "List<AlertRest>") + @ApiErrors({ + @ApiError(code = 406, reason = "There are 'resourceId' and 'definitionId' passed as query parameters"), + @ApiError(code = 406, reason = "Page size was 0"), + @ApiError(code = 406, reason = "Page number was < 1") + }) public Response listAlerts( - @ApiParam(value = "Page number", defaultValue = "1") @QueryParam("page") int page, + @ApiParam(value = "Page number") @QueryParam("page") @DefaultValue("1") int page, + @ApiParam(value = "Page size; use -1 for 'unlimited'") @QueryParam("size") @DefaultValue("100")int size, @ApiParam(value = "Limit to priority", allowableValues = "High, Medium, Low, All") @DefaultValue("All") @QueryParam("prio") String prio, @ApiParam(value = "Should full resources and definitions be sent") @QueryParam("slim") @DefaultValue("false") boolean slim, - @ApiParam( value = "If non-null only send alerts that have fired after this time, time is millisecond since epoch") @QueryParam("since") Long since, + @ApiParam(value = "If non-null only send alerts that have fired after this time, time is millisecond since epoch") @QueryParam("since") Long since, @ApiParam(value = "Id of a resource to limit search for") @QueryParam("resourceId") Integer resourceId, + @ApiParam(value = "If of an alert definition to search for") @QueryParam("definitionId") Integer definitionId, @Context UriInfo uriInfo, @Context HttpHeaders headers) {
+ if (resourceId!=null && definitionId!=null) { + throw new BadArgumentException("At most one of 'resourceId' and 'definitionId' may be given"); + } + if (size==0) + throw new BadArgumentException("size","Must not be 0"); + if (page<1) + throw new BadArgumentException("page","Must be >=1");
AlertCriteria criteria = new AlertCriteria(); - criteria.setPaging(page,20); // TODO implement linking to next page + + if (size==-1) { + PageControl pageControl = PageControl.getUnlimitedInstance(); + pageControl.setPageNumber(page); + criteria.setPageControl(pageControl); + } + else + criteria.setPaging(page-1, size); // TODO implement linking to next page + if (since!=null) { criteria.addFilterStartTime(since); } @@ -105,6 +129,9 @@ public class AlertHandlerBean extends AbstractRestBean { if (resourceId!=null) { criteria.addFilterResourceIds(resourceId); } + if (definitionId!=null) { + criteria.addFilterAlertDefinitionIds(definitionId); + }
if (!prio.equals("All")) { AlertPriority alertPriority = AlertPriority.valueOf(prio.toUpperCase()); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/BadArgumentException.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/BadArgumentException.java index c07b4ce..cea84c2 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/BadArgumentException.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/BadArgumentException.java @@ -32,7 +32,7 @@ public class BadArgumentException extends RuntimeException { private static final long serialVersionUID = 1L;
public BadArgumentException(String message) { - super("Bad parameter given: " + message); + super("Bad parameter(s) given: " + message); }
/** @@ -43,4 +43,5 @@ public class BadArgumentException extends RuntimeException { public BadArgumentException(String parameterName, String cause) { super("Parameter " + parameterName + " is bad: " + cause); } + } diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java index 7e9fa70..aa56a46 100644 --- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java +++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java @@ -27,11 +27,13 @@ import org.junit.Test; import org.rhq.modules.integrationTests.restApi.d.AlertCondition; import org.rhq.modules.integrationTests.restApi.d.AlertDefinition; import org.rhq.modules.integrationTests.restApi.d.AlertNotification; +import org.rhq.modules.integrationTests.restApi.d.Availability; import org.rhq.modules.integrationTests.restApi.d.Group;
import static com.jayway.restassured.RestAssured.delete; import static com.jayway.restassured.RestAssured.expect; import static com.jayway.restassured.RestAssured.given; +import static org.hamcrest.Matchers.contains; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.iterableWithSize; @@ -115,7 +117,43 @@ public class AlertTest extends AbstractBase { .get("/alert/count") .xmlPath();
- int count = xmlPath.getInt("value.@value"); + xmlPath.getInt("value.@value"); + } + + @Test + public void testGetAlertByBadId() throws Exception { + given() + .header(acceptJson) + .pathParam("id",123) + .expect() + .statusCode(404) + .log().ifError() + .when() + .get("/alert/{id}"); + } + + @Test + public void testGetAlertConditionLogsByBadId() throws Exception { + given() + .header(acceptJson) + .pathParam("id",123) + .expect() + .statusCode(404) + .log().ifError() + .when() + .get("/alert/{id}/conditions"); + } + + @Test + public void testGetAlertNotificationLogsByBadId() throws Exception { + given() + .header(acceptJson) + .pathParam("id",123) + .expect() + .statusCode(404) + .log().everything() + .when() + .get("/alert/{id}/notifications"); }
@Test @@ -200,7 +238,7 @@ public class AlertTest extends AbstractBase { @Test public void testCreateDeleteBasicAlertDefinition() throws Exception {
- int definitionId = createEmptyAlertDefinition(); + int definitionId = createEmptyAlertDefinition(false);
cleanupDefinition(definitionId); } @@ -333,7 +371,7 @@ public class AlertTest extends AbstractBase { @Test public void testCreateDeleteAlertDefinitionWith1Condition() throws Exception {
- int definitionId = createEmptyAlertDefinition(); + int definitionId = createEmptyAlertDefinition(false);
// Now add a condition try { @@ -376,7 +414,7 @@ public class AlertTest extends AbstractBase { @Test public void testCreateDeleteAlertDefinitionWith2Conditions() throws Exception {
- int definitionId = createEmptyAlertDefinition(); + int definitionId = createEmptyAlertDefinition(false);
try { @@ -446,7 +484,7 @@ public class AlertTest extends AbstractBase { @Test public void testCreateDeleteAlertDefinitionWith1Notification() throws Exception {
- int definitionId = createEmptyAlertDefinition(); + int definitionId = createEmptyAlertDefinition(false);
// Now add a condition try { @@ -491,7 +529,7 @@ public class AlertTest extends AbstractBase { @Test public void testCRUDNotification() throws Exception {
- int definitionId = createEmptyAlertDefinition(); + int definitionId = createEmptyAlertDefinition(false);
// Now add a condition try { @@ -563,7 +601,7 @@ public class AlertTest extends AbstractBase { @Test public void testCRUDCondition() throws Exception {
- int definitionId = createEmptyAlertDefinition(); + int definitionId = createEmptyAlertDefinition(false);
// Now add a condition try { @@ -723,7 +761,7 @@ public class AlertTest extends AbstractBase { @Test public void testCreateDeleteAlertDefinitionWithUnknwonSender() throws Exception {
- int definitionId = createEmptyAlertDefinition(); + int definitionId = createEmptyAlertDefinition(false);
// Now add a condition try { @@ -802,7 +840,7 @@ public class AlertTest extends AbstractBase { @Test public void testCreateDeleteAlertDefinitionWith2Notifications() throws Exception {
- int definitionId = createEmptyAlertDefinition(); + int definitionId = createEmptyAlertDefinition(false);
// Now add a condition try { @@ -1049,7 +1087,7 @@ public class AlertTest extends AbstractBase { @Test public void testUpdateDefinition() throws Exception {
- int definitionId = createEmptyAlertDefinition(); + int definitionId = createEmptyAlertDefinition(false); try { AlertDefinition definition = given() @@ -1177,6 +1215,245 @@ public class AlertTest extends AbstractBase { cleanupDefinition(result.getId()); }
+ @Test + public void testCreateDeleteAlertDefinitionWith1ConditionAndFire() throws Exception { + + int definitionId = createEmptyAlertDefinition(true); + + // Now add a condition + try { + + AlertCondition alertCondition = new AlertCondition("AVAIL_GOES_UP","AVAILABILITY"); + given() + .header(acceptJson) + .contentType(ContentType.JSON) + .body(alertCondition) + .pathParam("defId",definitionId) + .expect() + .statusCode(201) + .log().ifError() + .when() + .post("/alert/definition/{defId}/conditions"); + + System.out.println("Definition created, waiting 60s for it to become active"); + + // Wait a while - see https://bugzilla.redhat.com/show_bug.cgi?id=830299 + Thread.sleep(60*1000); + + // Send a avail down/up sequence -> alert definition should fire + long now = System.currentTimeMillis(); + Availability a = new Availability(10001,now-2000,"DOWN"); + given() + .contentType(ContentType.JSON) + .pathParam("id", 10001) + .body(a) + .expect() + .statusCode(204) + .log().ifError() + .when() + .put("/resource/{id}/availability"); + + a = new Availability(10001,now-1000,"UP"); + given() + .contentType(ContentType.JSON) + .pathParam("id", 10001) + .body(a) + .expect() + .statusCode(204) + .log().ifError() + .when() + .put("/resource/{id}/availability"); + + // wait a little + Thread.sleep(5000); + + int alertId = + given() + .header(acceptJson) + .queryParam("definitionId",definitionId) + .queryParam("since", now - 3000) + .expect() + .statusCode(200) + .log().ifError() + .body("alertDefinition.name",contains("-x-test-definition")) + .body("",iterableWithSize(1)) + .when() + .get("/alert") + .body().jsonPath().getInt("id[0]"); + + System.out.println(alertId); + + // Find this alert by id and then its condition logs and notification logs + given() + .header(acceptJson) + .pathParam("id",alertId) + .log().everything() + .expect() + .statusCode(200) + .log().ifError() + .body("id",is(alertId)) + .when() + .get("/alert/{id}"); + + + given() + .header(acceptJson) + .pathParam("id", alertId) + .log().everything() + .expect() + .statusCode(200) + .log().ifError() + .body("",iterableWithSize(1)) + .when() + .get("/alert/{id}/conditions"); + + given() + .header(acceptJson) + .pathParam("id", alertId) + .expect() + .statusCode(200) + .log().ifError() + .body("",iterableWithSize(0)) + .when() + .get("/alert/{id}/notifications"); + + + } + + finally { + // delete the definition again + cleanupDefinition(definitionId); + } + } + + + @Test + public void testCreateDeleteAlertDefinitionWith1ConditionAndNotificationAndFire() throws Exception { + + int definitionId = createEmptyAlertDefinition(true); + + // Now add a condition + try { + + AlertCondition alertCondition = new AlertCondition("AVAIL_GOES_UP","AVAILABILITY"); + given() + .header(acceptJson) + .contentType(ContentType.JSON) + .body(alertCondition) + .pathParam("defId",definitionId) + .expect() + .statusCode(201) + .log().ifError() + .when() + .post("/alert/definition/{defId}/conditions"); + + AlertNotification notification = new AlertNotification("Direct Emails"); // short-name from server plugin descriptor + notification.getConfig().put("emailAddress", "root@eruditorium.org"); + + given() + .header(acceptJson) + .contentType(ContentType.JSON) + .body(notification) + .pathParam("defId", definitionId) + .log().everything() + .expect() + .statusCode(201) + .log().ifError() + .when() + .post("/alert/definition/{defId}/notifications"); + + + System.out.println("Definition created, waiting 60s for it to become active"); + + // Wait a while - see https://bugzilla.redhat.com/show_bug.cgi?id=830299 + Thread.sleep(60*1000); + + // Send a avail down/up sequence -> alert definition should fire + long now = System.currentTimeMillis(); + Availability a = new Availability(10001,now-2000,"DOWN"); + given() + .contentType(ContentType.JSON) + .pathParam("id", 10001) + .body(a) + .expect() + .statusCode(204) + .log().ifError() + .when() + .put("/resource/{id}/availability"); + + a = new Availability(10001,now-1000,"UP"); + given() + .contentType(ContentType.JSON) + .pathParam("id", 10001) + .body(a) + .expect() + .statusCode(204) + .log().ifError() + .when() + .put("/resource/{id}/availability"); + + // wait a little + Thread.sleep(5000); + + int alertId = + given() + .header(acceptJson) + .queryParam("definitionId",definitionId) + .queryParam("since", now - 3000) + .expect() + .statusCode(200) + .log().ifError() + .body("alertDefinition.name",contains("-x-test-definition")) + .body("",iterableWithSize(1)) + .when() + .get("/alert") + .body().jsonPath().getInt("id[0]"); + + System.out.println(alertId); + + // Find this alert by id and then its condition logs and notification logs + given() + .header(acceptJson) + .pathParam("id",alertId) + .expect() + .statusCode(200) + .log().ifError() + .body("id",is(alertId)) + .when() + .get("/alert/{id}"); + + + given() + .header(acceptJson) + .pathParam("id", alertId) + .log().everything() + .expect() + .statusCode(200) + .log().ifError() + .body("",iterableWithSize(1)) + .when() + .get("/alert/{id}/conditions"); + + given() + .header(acceptJson) + .pathParam("id", alertId) + .expect() + .statusCode(200) + .log().ifError() + .body("",iterableWithSize(1)) + .when() + .get("/alert/{id}/notifications"); + + + } + + finally { + // delete the definition again + cleanupDefinition(definitionId); + } + } + + private void cleanupDefinition(int definitionId) {
if (definitionId==0) @@ -1190,10 +1467,10 @@ public class AlertTest extends AbstractBase { .delete("/alert/definition/{id}"); }
- private int createEmptyAlertDefinition() { + private int createEmptyAlertDefinition(boolean enabled) { AlertDefinition alertDefinition = new AlertDefinition(); alertDefinition.setName("-x-test-definition"); - alertDefinition.setEnabled(false); + alertDefinition.setEnabled(enabled); alertDefinition.setPriority("LOW"); alertDefinition.setDampeningCategory("NONE");
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Availability.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Availability.java new file mode 100644 index 0000000..fdacbb8 --- /dev/null +++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Availability.java @@ -0,0 +1,64 @@ +/* + * RHQ Management Platform + * Copyright (C) 2005-2013 Red Hat, Inc. + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation version 2 of the License. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA + */ + +package org.rhq.modules.integrationTests.restApi.d; + +/** + * Availability for testing + * @author Heiko W. Rupp + */ +public class Availability { + + long since; + String type; + int resourceId; + + public Availability() { + } + + public Availability(int resourceId, long since, String type) { + this.resourceId = resourceId; + this.since = since; + this.type = type; + } + + public int getResourceId() { + return resourceId; + } + + public void setResourceId(int resourceId) { + this.resourceId = resourceId; + } + + public long getSince() { + return since; + } + + public void setSince(long since) { + this.since = since; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } +}
commit ac5b2e13dbd2e3648169ddbbefb85a37eb2fdc35 Author: Heiko W. Rupp hwr@redhat.com Date: Wed Feb 20 20:55:25 2013 +0100
Add a get group by id case with valid id
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java index ce338bb..f6ffbe7 100644 --- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java +++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java @@ -35,6 +35,7 @@ import org.rhq.modules.integrationTests.restApi.d.GroupDef; import static com.jayway.restassured.RestAssured.expect; import static com.jayway.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.hasItem; +import static org.hamcrest.Matchers.is; import static org.hamcrest.Matchers.iterableWithSize;
/** @@ -118,6 +119,20 @@ public class GroupTest extends AbstractBase { int groupId = jsonPath.get("[0].id"); assert groupId == createdId;
+ // Fetch id by id + given() + .pathParam("id",groupId) + .header(acceptJson) + .expect() + .statusCode(200) + .body("name",is(X_TEST_GROUP)) + .body("id",is(groupId)) + .body("explicitCount",is(0)) + .log().ifError() + .when() + .get("/group/{id}"); + + // delete the group again given() .pathParam("id",groupId) @@ -429,7 +444,6 @@ public class GroupTest extends AbstractBase { int id = Integer.parseInt(location.substring(location.lastIndexOf("/")+1));
try { - response = given() .header(acceptJson) .pathParam("id",id) @@ -472,7 +486,6 @@ public class GroupTest extends AbstractBase { list.add("resource.name"); gd.setExpression(list);
- Response response = given() .contentType(ContentType.JSON) .header("Accept","application/json") @@ -507,19 +520,18 @@ public class GroupTest extends AbstractBase {
String location = response.getHeader("Location"); - int defintionId = Integer.parseInt(location.substring(location.lastIndexOf("/")+1)); + int definitionId = Integer.parseInt(location.substring(location.lastIndexOf("/")+1));
try { // retrieve by id given() - .pathParam("id", defintionId) + .pathParam("id", definitionId) .expect() .statusCode(200) .when() .get("/group/definition/{id}");
// retrieve by query - Response resp = given() .queryParam("q", "-x-test-def") .expect() @@ -534,7 +546,7 @@ public class GroupTest extends AbstractBase { expect() .statusCode(204) .when() - .delete("/group/definition/" + defintionId); + .delete("/group/definition/" + definitionId); }
}
commit 2b908fa04815c7758e0486eb5e5055c6e13f1d15 Author: Stefan Negrea snegrea@redhat.com Date: Wed Feb 20 14:00:02 2013 -0600
[BZ 912478] Add managed server deployment as parent for the web subsystem resource type.
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml index 03dd318..2509073 100644 --- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml @@ -8834,6 +8834,7 @@ <runs-inside> <parent-resource-type name="Deployment" plugin="&pluginName;"/> <parent-resource-type name="Subdeployment" plugin="&pluginName;"/> + <parent-resource-type name="ManagedServerDeployment" plugin="&pluginName;"/> </runs-inside>
<plugin-configuration>
commit 68d2e82cc37e7109d5d989a58387b9e368b5f03a Author: Jirka Kremser jkremser@redhat.com Date: Wed Feb 20 19:16:56 2013 +0100
[BZ 913121 - Manual import from resource tree's context menu opens the create child child wizard instead] Both import and create option led to the openint the same wizzard. Also some typos in javadoc has been fixed.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java index c38e77a..b4be93c 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/ResourceTreeView.java @@ -573,7 +573,7 @@ public class ResourceTreeView extends LocatableVLayout { Integer[] singletonChildTypes = getSingletonChildTypes(resourceType);
// To properly filter Create Child and Import menus we need existing singleton child resources. If the - // user has creat permission and the parent type has singleton child types and creatable or importable child + // user has created permission and the parent type has singleton child types and creatable or importable child // types, perform an async call to fetch the singleton children. if (canCreate && singletonChildTypes.length > 0 && (hasCreatableTypes || hasImportableTypes)) {
@@ -587,12 +587,14 @@ public class ResourceTreeView extends LocatableVLayout { public void onSuccess(PageList<Resource> singletonChildren) { if (hasCreatableTypes) { Map<String, ResourceType> displayNameMap = getDisplayNames(creatableChildTypes); - addMenu(MSG.common_button_create_child(), true, singletonChildren, resource, displayNameMap); + addMenu(MSG.common_button_create_child(), true, singletonChildren, resource, + displayNameMap, true); }
if (hasImportableTypes) { Map<String, ResourceType> displayNameMap = getDisplayNames(importableChildTypes); - addMenu(MSG.common_button_import(), true, singletonChildren, resource, displayNameMap); + addMenu(MSG.common_button_import(), true, singletonChildren, resource, displayNameMap, + false); }
resourceContextMenu.showContextMenu(); @@ -607,22 +609,22 @@ public class ResourceTreeView extends LocatableVLayout { } else if (canCreate && singletonChildTypes.length == 0 && (hasCreatableTypes || hasImportableTypes)) { if (hasCreatableTypes) { Map<String, ResourceType> displayNameMap = getDisplayNames(creatableChildTypes); - addMenu(MSG.common_button_create_child(), true, null, resource, displayNameMap); + addMenu(MSG.common_button_create_child(), true, null, resource, displayNameMap, true); }
if (hasImportableTypes) { Map<String, ResourceType> displayNameMap = getDisplayNames(importableChildTypes); - addMenu(MSG.common_button_import(), true, null, resource, displayNameMap); + addMenu(MSG.common_button_import(), true, null, resource, displayNameMap, false); }
resourceContextMenu.showContextMenu();
} else { if (!canCreate && hasCreatableTypes) { - addMenu(MSG.common_button_create_child(), false, null, null, null); + addMenu(MSG.common_button_create_child(), false, null, null, null, true); } if (!canCreate && hasImportableTypes) { - addMenu(MSG.common_button_import(), false, null, null, null); + addMenu(MSG.common_button_import(), false, null, null, null, false); }
resourceContextMenu.showContextMenu(); @@ -630,12 +632,12 @@ public class ResourceTreeView extends LocatableVLayout { }
private void addMenu(String name, boolean enabled, List<Resource> singletonChildren, Resource resource, - Map<String, ResourceType> displayNameMap) { + Map<String, ResourceType> displayNameMap, boolean isCreate) { MenuItem menu = new MenuItem(name); if (enabled) { Menu subMenu = new Menu(); - singletonChildren = (null == singletonChildren) ? new ArrayList() : singletonChildren; - Menu filteredSubMenu = checkForSingletons(singletonChildren, resource, displayNameMap, subMenu, true); + singletonChildren = (null == singletonChildren) ? new ArrayList<Resource>() : singletonChildren; + Menu filteredSubMenu = checkForSingletons(singletonChildren, resource, displayNameMap, subMenu, isCreate); menu.setSubmenu(filteredSubMenu); } else { menu.setEnabled(false); @@ -676,7 +678,7 @@ public class ResourceTreeView extends LocatableVLayout {
// omit the type's menu item if the singleton already exists, otherwise add the necessary click handler. // note: we omit as opposed to disable the menu item to match the behavior of the buttons in the Inventory - // -> Child Resources view, which has no facility to do the anologous disabling. + // -> Child Resources view, which has no facility to do the analogous disabling. if (!exists) { itemToAdd.addClickHandler(new ClickHandler() { public void onClick(MenuItemClickEvent event) {
commit b3d6756033305f1d6a02ebded33864c4303d3a10 Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Feb 20 09:37:52 2013 -0500
Add another test for the work done in Bug 912871.
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java index 0900ce6..7d0343b 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java @@ -78,11 +78,8 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test { private Agent agent; private Subject overlord;
- /** - * Prepares things for the entire test class. - */ - //@BeforeClass don't use BeforeClass as Arquillian 1.0.2 invokes it on every test method - protected void beforeClass() { + @Override + protected void beforeMethod() throws Exception { // Make sure page control sorts so the latest config update is last (the default is for the latest to be first). configUpdatesPageControl = PageControl.getUnlimitedInstance(); // (ips, 04/01/10): Use createdTime, rather than id, to order by, since the id's are not guaranteed to be @@ -92,12 +89,6 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
configurationManager = LookupUtil.getConfigurationManager(); resourceManager = LookupUtil.getResourceManager(); - overlord = LookupUtil.getSubjectManager().getOverlord(); - } - - @Override - protected void beforeMethod() throws Exception { - beforeClass();
prepareScheduler();
@@ -106,6 +97,8 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test { agentServiceContainer.configurationService = testServices; agentServiceContainer.discoveryService = testServices;
+ overlord = LookupUtil.getSubjectManager().getOverlord(); + getTransactionManager().begin();
try { @@ -257,6 +250,87 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test { }
@Test(enabled = ENABLE_TESTS) + public void testInProgressConfiguration() throws Exception { + int resourceId = newResource1.getId(); + + Subject overlord = LookupUtil.getSubjectManager().getOverlord(); + + // create 3 configs: config1 will be stored as current. config2 will be in progress, config3 should get + // blocked from updating by the inprogress update + Configuration configuration1 = new Configuration(); + configuration1.put(new PropertySimple("myboolean", "true")); + + Configuration configuration2 = new Configuration(); + configuration2.put(new PropertySimple("myboolean", "false")); + configuration2.put(new PropertySimple("mysleep", "7000")); + + Configuration configuration3 = new Configuration(); + configuration3.put(new PropertySimple("mysleep", "10000")); + + // make config1 the current + configurationManager.updateResourceConfiguration(overlord, resourceId, configuration1); + Thread.sleep(2000); // wait for the test agent to complete the request + + ResourceConfigurationUpdate history1; + history1 = configurationManager.getLatestResourceConfigurationUpdate(overlord, resourceId); + assert history1 != null; + PropertySimple myprop = history1.getConfiguration().getSimple("myboolean"); + assert myprop != null; + assert "true".equals(myprop.getStringValue()); + + // now update to config2 - the "agent" will sleep for a bit before it completes + // so we will have an INPROGRESS configuration for a few seconds before it goes to SUCCESS + configurationManager.updateResourceConfiguration(overlord, resourceId, configuration2); + + // now update to config3 - this should fail as you can't update while there is one in progress + try { + configurationManager.updateResourceConfiguration(overlord, resourceId, configuration3); + assert false : "Should have thrown an in progress exception"; + + } catch (ConfigurationUpdateStillInProgressException e) { + System.out.println("======> " + e); + + // make sure everything works as expected (like the above test) + + boolean inProgress = false; + boolean inProgressTested = false; + + do { + ResourceConfigurationUpdate history2 = configurationManager.getLatestResourceConfigurationUpdate( + overlord, resourceId); + inProgress = configurationManager.isResourceConfigurationUpdateInProgress(overlord, resourceId); + + if (inProgress) { + // history2 should be history1 since the update is not complete + assert history2 != null; + assert history2.getId() == history1.getId(); + myprop = history2.getConfiguration().getSimple("myboolean"); + assert myprop != null; + assert "true".equals(myprop.getStringValue()); + myprop = history2.getConfiguration().getSimple("mysleep"); // this wasn't in the first config + assert myprop == null; + // record that this test case ran, we expect it will if the agent delay is there + inProgressTested = true; + } else { + // update is complete, history 2 should be different + history2 = configurationManager.getLatestResourceConfigurationUpdate(overlord, resourceId); + assert history2 != null; + assert history2.getId() != history1.getId(); + myprop = history2.getConfiguration().getSimple("myboolean"); + assert myprop != null; + assert "false".equals(myprop.getStringValue()); + myprop = history2.getConfiguration().getSimple("mysleep"); + assert myprop.getLongValue() != null; + assert myprop.getLongValue().longValue() == 7000L; + } + } while (inProgress); + + } catch (Throwable t) { + assert false : "Should have thrown an in progress exception, not: " + t; + } + } + + @Test(enabled = ENABLE_TESTS) public void testDeleteType() throws Exception { // the purpose of this little test is to test an error condition I'm getting when attempting to delete // a resource type - just forces a run with before/afterMethod
commit 4385fbb69a2dfd9aced1f8802e9477dfb44860ae Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Feb 19 16:40:32 2013 -0500
[Bug 912871 - Perf: resource configuration update taking a lot of backend resources] Scalability work for resource config update. We already added concurrency limits that should throttle how many config updates the server gets hit with at one time but we also want to see if we can relieve the intense banging on the db and speed up the update time for each resource.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java index c2d4767..69ebb9d 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/configuration/ResourceConfigurationUpdate.java @@ -38,7 +38,7 @@ import org.rhq.core.domain.resource.Resource;
@DiscriminatorValue("resource") @Entity -@NamedQueries( { +@NamedQueries({ @NamedQuery(name = ResourceConfigurationUpdate.QUERY_FIND_ALL_IN_STATUS, query = "" // + "SELECT cu " // + " FROM ResourceConfigurationUpdate cu " // @@ -58,7 +58,8 @@ import org.rhq.core.domain.resource.Resource; + " WHERE icu.resource.id = res.id) " // + " ) " // + " )"), - @NamedQuery(name = ResourceConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG, query = "" // + // Note: Changes to this query should also be applied to QUERY_FIND_CURRENT_AND_IN_PROGRESS_CONFIGS, below. + @NamedQuery(name = ResourceConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG, query = "" // + "SELECT cu " // + " FROM ResourceConfigurationUpdate cu " // + " WHERE cu.resource.id = :resourceId " // @@ -67,6 +68,17 @@ import org.rhq.core.domain.resource.Resource; + " FROM ResourceConfigurationUpdate cu2 " // + " WHERE cu2.resource.id = :resourceId " // + " AND cu2.status = 'SUCCESS' ) "), + @NamedQuery(name = ResourceConfigurationUpdate.QUERY_FIND_CURRENT_AND_IN_PROGRESS_CONFIGS, query = "" // + + "SELECT cu " // + + " FROM ResourceConfigurationUpdate cu " // + + " WHERE cu.resource.id = :resourceId " // + + " AND ( ( cu.status = 'INPROGRESS' ) " // + + " OR ( cu.status = 'SUCCESS' " // + + " AND cu.modifiedTime = ( SELECT MAX(cu2.modifiedTime) " // + + " FROM ResourceConfigurationUpdate cu2 " // + + " WHERE cu2.resource.id = :resourceId " // + + " AND cu2.status = 'SUCCESS' ) " // + + " ) ) "), @NamedQuery(name = ResourceConfigurationUpdate.QUERY_FIND_LATEST_BY_RESOURCE_ID, query = "" // + "SELECT cu " // + " FROM ResourceConfigurationUpdate cu " // @@ -178,6 +190,7 @@ public class ResourceConfigurationUpdate extends AbstractResourceConfigurationUp public static final String QUERY_FIND_ALL_IN_STATUS = "ResourceConfigurationUpdate.findAllInStatus"; public static final String QUERY_FIND_ALL_BY_RESOURCE_ID = "ResourceConfigurationUpdate.findAllByResourceId"; public static final String QUERY_FIND_CURRENTLY_ACTIVE_CONFIG = "ResourceConfigurationUpdate.findCurrentlyActiveConfig"; + public static final String QUERY_FIND_CURRENT_AND_IN_PROGRESS_CONFIGS = "ResourceConfigurationUpdate.findCurrentAndInProgressConfigs"; public static final String QUERY_FIND_LATEST_BY_RESOURCE_ID = "ResourceConfigurationUpdate.findByLatestByResourceId"; public static final String QUERY_FIND_BY_GROUP_ID_AND_STATUS = "ResourceConfigurationUpdate.findByGroupIdAndStatus"; public static final String QUERY_FIND_BY_PARENT_UPDATE_ID_AND_STATUS = "ResourceConfigurationUpdate.findByParentUpdateIdAndStatus"; diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java index 50e5fd4..04c15b7 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java @@ -89,7 +89,6 @@ import org.rhq.core.domain.resource.Resource; import org.rhq.core.domain.resource.ResourceError; import org.rhq.core.domain.resource.ResourceErrorType; import org.rhq.core.domain.resource.ResourceType; -import org.rhq.core.domain.resource.composite.ResourceComposite; import org.rhq.core.domain.resource.group.GroupCategory; import org.rhq.core.domain.resource.group.ResourceGroup; import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite; @@ -487,9 +486,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf * is triggering save based on the semantics that we want to provide for configuration updates. * For the same reason, we pass null as the subject. */ - ResourceConfigurationUpdate update = this.configurationManager.persistNewResourceConfigurationUpdateHistory( - this.subjectManager.getOverlord(), resource.getId(), liveConfig, ConfigurationUpdateStatus.SUCCESS, null, - false); + ResourceConfigurationUpdate update = this.configurationManager + .persistResourceConfigurationUpdateInNewTransaction(this.subjectManager.getOverlord(), resource.getId(), + liveConfig, ConfigurationUpdateStatus.SUCCESS, null, false);
// resource.setResourceConfiguration(liveConfig.deepCopy(false)); resource.setResourceConfiguration(liveConfig.deepCopyWithoutProxies()); @@ -1248,8 +1247,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf return resourceConfigurationUpdate; }
- ResourceConfigurationUpdate newUpdate = configurationManager.persistNewResourceConfigurationUpdateHistory( - subject, resourceId, configToUpdate, ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false); + ResourceConfigurationUpdate newUpdate = configurationManager + .persistResourceConfigurationUpdateInNewTransaction(subject, resourceId, configToUpdate, + ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false); executeResourceConfigurationUpdate(newUpdate); return newUpdate; } @@ -1307,9 +1307,9 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf // configuration. // TODO: Consider synchronizing to avoid the condition where someone calls this method twice quickly in two // different tx's, which would put two updates in INPROGRESS and cause havoc. - ResourceConfigurationUpdate newUpdate = configurationManager.persistNewResourceConfigurationUpdateHistory( - subject, resourceId, newResourceConfiguration, ConfigurationUpdateStatus.INPROGRESS, subject.getName(), - false); + ResourceConfigurationUpdate newUpdate = configurationManager + .persistResourceConfigurationUpdateInNewTransaction(subject, resourceId, newResourceConfiguration, + ConfigurationUpdateStatus.INPROGRESS, subject.getName(), false);
executeResourceConfigurationUpdate(newUpdate);
@@ -1382,91 +1382,83 @@ public class ConfigurationManagerBean implements ConfigurationManagerLocal, Conf
@Override @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) - public ResourceConfigurationUpdate persistNewResourceConfigurationUpdateHistory(Subject subject, int resourceId, - Configuration newConfiguration, ConfigurationUpdateStatus newStatus, String newSubject, + public ResourceConfigurationUpdate persistResourceConfigurationUpdateInNewTransaction(Subject subject, + int resourceId, Configuration newConfiguration, ConfigurationUpdateStatus newStatus, String newSubject, boolean isPartofGroupUpdate) throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException { - // get the resource that we will be updating - Resource resource = resourceManager.getResourceById(subject, resourceId);
- // make sure the user has the proper permissions to do this - if (!authorizationManager.hasResourcePermission(subject, Permission.CONFIGURE_WRITE, resource.getId())) { - throw new PermissionException("User [" + subject.getName() - + "] does not have permission to modify configuration for resource [" + resource + "]"); - } + ResourceConfigurationUpdate current = null; + String errorMessage = null;
- // see if there was a previous update request and make sure it isn't still in progress - List<ResourceConfigurationUpdate> previousRequests = resource.getResourceConfigurationUpdates(); + // for efficiency, in one query fetch IN_PROGRESS and/or the current update + Query query = entityManager + .createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_CURRENT_AND_IN_PROGRESS_CONFIGS); + query.setParameter("resourceId", resourceId); + List<?> updates = query.getResultList(); + for (Object result : updates) { + current = (ResourceConfigurationUpdate) result; + + if (ConfigurationUpdateStatus.INPROGRESS == current.getStatus()) { + // A previous update is still in progress for this Resource. If this update is part of a group + // update, persist it with FAILURE status, so it is still listed as part of the group history. + // Otherwise, throw an exception that can bubble up to the GUI. + if (isPartofGroupUpdate) { + newStatus = ConfigurationUpdateStatus.FAILURE; + errorMessage = "Resource configuration Update was aborted because an update request for the Resource was already in progress.";
- String errorMessage = null; - if (previousRequests != null) { - for (ResourceConfigurationUpdate previousRequest : previousRequests) { - if (previousRequest.getStatus() == ConfigurationUpdateStatus.INPROGRESS) { - // A previous update is still in progresss for this Resource. If this update is part of a group - // update, persist it with FAILURE status, so it is still listed as part of the group history. - // Otherwise, throw an exception that can bubble up to the GUI. - if (isPartofGroupUpdate) { - newStatus = ConfigurationUpdateStatus.FAILURE; - errorMessage = "Resource configuration Update was aborted because an update request for the Resource was already in progress."; - } else { - // NOTE: If you change this to another exception, make sure you change getLatestResourceConfigurationUpdate(). - throw new ConfigurationUpdateStillInProgressException( - "Resource [" - + resource - + "] has a resource configuration update request already in progress - please wait for it to finish: " - + previousRequest); - } + } else { + // NOTE: If you change this to another exception, make sure you change getLatestResourceConfigurationUpdate(). + throw new ConfigurationUpdateStillInProgressException( + "Resource [" + + resourceId + + "] has a resource configuration update request already in progress - please wait for it to finish: " + + current); } } }
- ResourceConfigurationUpdate current; + Resource resource = null; + + if (null != current) { + // Always persist a group update because each member must have an update. Otherwise, only persist a + // single resource update if it has changed. + if (!isPartofGroupUpdate) { + Configuration currentConfiguration = current.getConfiguration(); + Hibernate.initialize(currentConfiguration.getMap()); + if (currentConfiguration.equals(newConfiguration)) { + return null; + } + }
- // Get the latest configuration as known to the server (i.e. persisted in the DB). - try { - Query query = entityManager - .createNamedQuery(ResourceConfigurationUpdate.QUERY_FIND_CURRENTLY_ACTIVE_CONFIG); - query.setParameter("resourceId", resourceId); - current = (ResourceConfigurationUpdate) query.getSingleResult(); resource = current.getResource(); - } catch (NoResultException nre) { - current = null; // The resource hasn't been successfully configured yet. - }
- // If this update is not part of an group update, don't bother persisting a new entry if the Configuration - // hasn't changed. If it's part of an group update, persist a new entry no matter what, so the group - // update isn't missing any member updates. - if (!isPartofGroupUpdate && current != null) { - Configuration currentConfiguration = current.getConfiguration(); - Hibernate.initialize(currentConfiguration.getMap()); - if (currentConfiguration.equals(newConfiguration)) { - return null; - } + } else { + // make sure the resource exists + resource = resourceManager.getResourceById(subject, resourceId); }
- //Configuration zeroedConfiguration = newConfiguration.deepCopy(false); Configuration zeroedConfiguration = newConfiguration.deepCopyWithoutProxies();
- // create our new update request and assign it to our resource - its status will initially be "in progress" + // create our new update request and assign it to our resource - its status will initially be INPROGRESS ResourceConfigurationUpdate newUpdateRequest = new ResourceConfigurationUpdate(resource, zeroedConfiguration, newSubject); - newUpdateRequest.setStatus(newStatus); - if (newStatus == ConfigurationUpdateStatus.FAILURE) { + + if (ConfigurationUpdateStatus.FAILURE == newStatus) { newUpdateRequest.setErrorMessage(errorMessage); }
entityManager.persist(newUpdateRequest); - if (current != null) { - if (newStatus == ConfigurationUpdateStatus.SUCCESS) { - // If this is the first configuration update since the resource was imported, don't alert + + // No need to alert on the first configuration update, only on subsequent change + if (null != current) { + if (ConfigurationUpdateStatus.SUCCESS == newStatus) { notifyAlertConditionCacheManager("persistNewResourceConfigurationUpdateHistory", newUpdateRequest); } }
resource.addResourceConfigurationUpdates(newUpdateRequest);
- // agent and childResources fields are LAZY - force them to load, because the caller will need them. - Hibernate.initialize(resource.getChildResources()); + // provide the agent while we have the entity, it's typically needed by the caller Hibernate.initialize(resource.getAgent());
return newUpdateRequest; diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java index f5b28ee..85c1247 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerLocal.java @@ -188,7 +188,7 @@ public interface ConfigurationManagerLocal extends ConfigurationManagerRemote { * {@link #getLatestResourceConfigurationUpdate(Subject, int)} and * {@link #scheduleGroupResourceConfigurationUpdate}. * - * @param subject + * @param subject ASSUMES CONFIGURE_WRITE perm for resource in question, no authz checks in this method. * @param resourceId * @param newConfiguration * @param newStatus @@ -196,10 +196,11 @@ public interface ConfigurationManagerLocal extends ConfigurationManagerRemote { * * @param isPartofGroupUpdate * @return the persisted Resource Configuration update, or null if the specified Configuration is identical to the - * currently persisted Configuration + * currently persisted Configuration. Note, on success the normally lazy-loaded + * ResourceConfigurationUpdate.resource.agent will be provided. */ @Nullable - ResourceConfigurationUpdate persistNewResourceConfigurationUpdateHistory(Subject subject, int resourceId, + ResourceConfigurationUpdate persistResourceConfigurationUpdateInNewTransaction(Subject subject, int resourceId, Configuration newConfiguration, ConfigurationUpdateStatus newStatus, String newSubject, boolean isPartofGroupUpdate) throws ResourceNotFoundException, ConfigurationUpdateStillInProgressException;
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java index a36f35d..be32c53 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationServerServiceImpl.java @@ -43,8 +43,8 @@ public class ConfigurationServerServiceImpl implements ConfigurationServerServic SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
int configUpdateId = response.getConfigurationUpdateId(); - ResourceConfigurationUpdate configUpdate = configurationManager.getResourceConfigurationUpdate(subjectManager - .getOverlord(), configUpdateId); + ResourceConfigurationUpdate configUpdate = configurationManager.getResourceConfigurationUpdate( + subjectManager.getOverlord(), configUpdateId);
if (configUpdate != null) { Resource resource = configUpdate.getResource(); @@ -67,7 +67,7 @@ public class ConfigurationServerServiceImpl implements ConfigurationServerServic SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
Subject overlord = subjectManager.getOverlord(); - ResourceConfigurationUpdate update = configurationManager.persistNewResourceConfigurationUpdateHistory( + ResourceConfigurationUpdate update = configurationManager.persistResourceConfigurationUpdateInNewTransaction( overlord, resourceId, resourceConfiguration, ConfigurationUpdateStatus.SUCCESS, null, false);
if (update == null) { @@ -76,7 +76,7 @@ public class ConfigurationServerServiceImpl implements ConfigurationServerServic return; }
- Configuration configuration = update.getConfiguration().deepCopy(false); // clone the config, zeroing out ids + Configuration configuration = update.getConfiguration().deepCopy(false); // clone the config, zeroing out ids configurationManager.setResourceConfiguration(resourceId, configuration); // now set it as the current config on the Resource } } diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java index d51798d..d29ad16 100644 --- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanUnitTest.java @@ -149,7 +149,7 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest {
allowing(entityMgr).find(Resource.class, fixture.resourceId); will(returnValue(fixture.resource));
- oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject, + oneOf(configurationMgrLocal).persistResourceConfigurationUpdateInNewTransaction(fixture.subject, fixture.resourceId, fixture.configuration, INPROGRESS, fixture.subject.getName(), fixture.isPartOfGroupUpdate); will(returnValue(expectedUpdate)); @@ -191,7 +191,7 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest { oneOf(authorizationMgr).hasResourcePermission(fixture.subject, CONFIGURE_WRITE, fixture.resourceId); will(returnValue(true));
- oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject, + oneOf(configurationMgrLocal).persistResourceConfigurationUpdateInNewTransaction(fixture.subject, fixture.resourceId, fixture.configuration, INPROGRESS, fixture.subject.getName(), fixture.isPartOfGroupUpdate); will(returnValue(expectedUpdate)); @@ -252,7 +252,7 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest { oneOf(configAgentService).validate(fixture.configuration, fixture.resourceId, FROM_STRUCTURED); inSequence(configUdpate);
- oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject, + oneOf(configurationMgrLocal).persistResourceConfigurationUpdateInNewTransaction(fixture.subject, fixture.resourceId, fixture.configuration, INPROGRESS, fixture.subject.getName(), fixture.isPartOfGroupUpdate); will(returnValue(expectedUpdate)); @@ -302,7 +302,7 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest { oneOf(configAgentService).merge(fixture.configuration, fixture.resourceId, FROM_RAW); will(returnValue(translatedConfig)); inSequence(configUdpate);
- oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject, + oneOf(configurationMgrLocal).persistResourceConfigurationUpdateInNewTransaction(fixture.subject, fixture.resourceId, translatedConfig, INPROGRESS, fixture.subject.getName(), fixture.isPartOfGroupUpdate); will(returnValue(expectedUpdate)); @@ -350,7 +350,7 @@ public class ConfigurationManagerBeanUnitTest extends JMockTest { oneOf(authorizationMgr).hasResourcePermission(fixture.subject, CONFIGURE_WRITE, fixture.resourceId); will(returnValue(true));
- oneOf(configurationMgrLocal).persistNewResourceConfigurationUpdateHistory(fixture.subject, fixture.resourceId, + oneOf(configurationMgrLocal).persistResourceConfigurationUpdateInNewTransaction(fixture.subject, fixture.resourceId, fixture.configuration, INPROGRESS, fixture.subject.getName(), fixture.isPartOfGroupUpdate); will(returnValue(expectedUpdate));
commit 3005a262a20961e6c8583e02953d9af1501d8c68 Author: John Mazzitelli mazz@redhat.com Date: Tue Feb 19 13:56:03 2013 -0500
[BZ 912525] add new concurrency limit for configuration updates
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/configuration/ConfigurationServerService.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/configuration/ConfigurationServerService.java index caa1a91..e9e5b36 100644 --- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/configuration/ConfigurationServerService.java +++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/configuration/ConfigurationServerService.java @@ -23,6 +23,7 @@ package org.rhq.core.clientapi.server.configuration;
import org.rhq.core.communications.command.annotation.Asynchronous; +import org.rhq.core.communications.command.annotation.LimitedConcurrency; import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.configuration.ConfigurationUpdateStatus; import org.rhq.core.domain.configuration.Property; @@ -31,6 +32,8 @@ import org.rhq.core.domain.configuration.Property; * Interface that allows an agent to provide information about a resource's configuration. */ public interface ConfigurationServerService { + String CONCURRENCY_LIMIT_CONFIG_UPDATE = "rhq.server.concurrency-limit.configuration-update"; + /** * The agent will notify the server when a configuration update request has been completed by calling this method. * @@ -65,6 +68,7 @@ public interface ConfigurationServerService { * @param resourceConfiguration the newly detected configuration */ @Asynchronous(guaranteedDelivery = true) + @LimitedConcurrency(CONCURRENCY_LIMIT_CONFIG_UPDATE) void persistUpdatedResourceConfiguration(int resourceId, Configuration resourceConfiguration);
} \ No newline at end of file diff --git a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml index f7f781e..544dfbf 100644 --- a/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml +++ b/modules/enterprise/server/appserver/src/main/scripts/rhq-container.build.xml @@ -557,6 +557,7 @@ rhq.server.concurrency-limit.content-report=5 rhq.server.concurrency-limit.content-download=5 rhq.server.concurrency-limit.measurement-report=10 rhq.server.concurrency-limit.measurement-schedule-request=10 +rhq.server.concurrency-limit.configuration-update=10
# Content Local Filesystem Repository rhq.server.content.filesystem=${jboss.server.data.dir}/packagebits diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerCommunicationsService.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerCommunicationsService.java index 0a1c625..7ed7ffd 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerCommunicationsService.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/TestServerCommunicationsService.java @@ -142,6 +142,13 @@ public class TestServerCommunicationsService implements TestServerCommunications public void setMeasurementScheduleRequestConcurrencyLimit(Integer maxConcurrency) { }
+ public Integer getConfigurationUpdateConcurrencyLimit() { + return 1; + } + + public void setConfigurationUpdateConcurrencyLimit(Integer maxConcurrency) { + } + public Boolean getMaintenanceModeAtStartup() { return Boolean.FALSE; } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsService.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsService.java index 9c7909e..0d88020 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsService.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsService.java @@ -45,6 +45,7 @@ import mazz.i18n.Logger; import org.jboss.remoting.InvokerLocator; import org.jboss.util.StringPropertyReplacer;
+import org.rhq.core.clientapi.server.configuration.ConfigurationServerService; import org.rhq.core.clientapi.server.content.ContentServerService; import org.rhq.core.clientapi.server.discovery.DiscoveryServerService; import org.rhq.core.clientapi.server.measurement.MeasurementServerService; @@ -645,6 +646,17 @@ public class ServerCommunicationsService implements ServerCommunicationsServiceM }
@Override + public Integer getConfigurationUpdateConcurrencyLimit() { + return getServiceContainer().getConcurrencyManager().getConfiguredNumberOfPermitsAllowed( + ConfigurationServerService.CONCURRENCY_LIMIT_CONFIG_UPDATE); + } + + @Override + public void setConfigurationUpdateConcurrencyLimit(Integer maxConcurrency) { + setConcurrencyLimit(ConfigurationServerService.CONCURRENCY_LIMIT_CONFIG_UPDATE, maxConcurrency, true); + } + + @Override public Boolean getMaintenanceModeAtStartup() { InputStream inputStream = null; Boolean flag; diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsServiceMBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsServiceMBean.java index 9c8c993..5d4c319 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsServiceMBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/comm/ServerCommunicationsServiceMBean.java @@ -340,6 +340,23 @@ public interface ServerCommunicationsServiceMBean extends ServiceContainerMetric void setMeasurementScheduleRequestConcurrencyLimit(Integer maxConcurrency);
/** + * Gets the concurrency limit for configuration updates. This is the amount of new configuration updates that the server + * will allow to be processed concurrently. A configuration update is something the agent originates when it needs to + * let the server know when a resource's configuration has changed. + * + * @return number of concurrent calls allowed + */ + Integer getConfigurationUpdateConcurrencyLimit(); + + /** + * Sets the new concurrency limit for configuration updates. This new number is the amount of configuration updates + * that the server will allow to be processed concurrently. + * + * @param maxConcurrency + */ + void setConfigurationUpdateConcurrencyLimit(Integer maxConcurrency); + + /** * Returns <code>true</code> if the server should always start up in maintenance mode. * If <code>false</code>, the server will startup in the same state it was in when it * was shutdown. diff --git a/modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml index 84289ad..ee3fbd1 100644 --- a/modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/rhq-server/src/main/resources/META-INF/rhq-plugin.xml @@ -616,6 +616,13 @@ required="true" activationPolicy="immediate" description="Number of measurement schedule requests that can be processed concurrently; if zero or less, there is no limit" /> + <c:simple-property + name="ConfigurationUpdateConcurrencyLimit" + displayName="Configuration Update Concurrency Limit" + type="integer" + required="true" + activationPolicy="immediate" + description="Number of configuration updates originating from agents that can be processed concurrently; if zero or less, there is no limit" /> </c:group> <c:group name="ha"
commit 532c73f05d278ef150056370ad84e4f12eb0de36 Author: Heiko W. Rupp hwr@redhat.com Date: Tue Feb 19 17:02:19 2013 +0100
Follow the recent changes in availability handling and add another test.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java index 8142f17..ec42c3c 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java @@ -31,6 +31,8 @@ import java.util.UUID;
import javax.ejb.EJB; import javax.ejb.Stateless; +import javax.ejb.TransactionAttribute; +import javax.ejb.TransactionAttributeType; import javax.interceptor.Interceptors; import javax.persistence.EntityManager; import javax.persistence.PersistenceContext; @@ -356,6 +358,7 @@ public class ResourceHandlerBean extends AbstractRestBean { @PUT @Path("/{id}/availability") @ApiOperation("Set the current availability of the passed resource") + @TransactionAttribute(TransactionAttributeType.NEVER) public void reportAvailability(@ApiParam("Id of the resource to update") @PathParam("id") int resourceId, @ApiParam(value= "New Availability setting", required = true) AvailabilityRest avail) { if (avail.getResourceId() != resourceId) @@ -368,11 +371,12 @@ public class ResourceHandlerBean extends AbstractRestBean {
// According to jshaughn, plaforms must not be set to DISABLED, so catch this case here. if (resource.getResourceType().getCategory()==ResourceCategory.PLATFORM && at==AvailabilityType.DISABLED) { - throw new BadArgumentException("Availabilty","Platforms must not be set to DISABLED"); + throw new BadArgumentException("Availability","Platforms must not be set to DISABLED"); }
+ Agent agent = agentMgr.getAgentByResourceId(caller,resourceId);
- AvailabilityReport report = new AvailabilityReport(true, resource.getAgent().getName()); + AvailabilityReport report = new AvailabilityReport(true, agent.getName()); Availability availability = new Availability(resource, avail.getSince(), at); report.addAvailability(availability);
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java index 6899995..27bf5a2 100644 --- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java +++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java @@ -220,6 +220,61 @@ public class ResourcesTest extends AbstractBase { }
@Test + public void testCreatePlatformUpdateAvailabilityAndRemove() throws Exception { + + Resource resource = new Resource(); + resource.setResourceName("dummy-test"); + resource.setTypeName("Linux"); + + Response response = + given() + .header(acceptXml) + .contentType(ContentType.JSON) + .body(resource) + .expect() + .statusCode(201) + .log().ifError() + .when() + .post("/resource/platforms"); + + XmlPath xmlPath = response.xmlPath(); + Node resource1 = xmlPath.get("resource"); + Node platformIdNode = resource1.get("resourceId"); + String platformId = platformIdNode.value(); + + try { + long now = System.currentTimeMillis()-100; + given().body("{"since":" + now + ","type":"DOWN","resourceId":" + platformId + "}") + .header("Content-Type","application/json") + .header("Accept","application/json") + .pathParam("id",platformId) + .expect() + .statusCode(HttpStatus.SC_NO_CONTENT) + .log().ifError() + .when().put("/resource/{id}/availability"); + + now += 50; + given().body("{"since":" + now + ","type":"UP","resourceId":" + platformId + "}") + .header("Content-Type","application/json") + .header("Accept","application/json") + .pathParam("id",platformId) + .expect() + .statusCode(HttpStatus.SC_NO_CONTENT) + .log().ifError() + .when().put("/resource/{id}/availability"); + + + } + + finally { + given().pathParam("id", platformId) + .expect().statusCode(HttpStatus.SC_NO_CONTENT) + .when().delete("/resource/{id}"); + } + + } + + @Test public void testCreatePlatformOLDAndRemove() throws Exception {
Response response =
commit 7189891da688fc90f5b3b5dc78a6706f1cd57060 Author: Thomas Segismont tsegismo@redhat.com Date: Mon Feb 18 19:39:10 2013 +0100
BZ911172 - Creating mail server fails with EAP 6.1.0.DR4 if outbound-socket-binding-ref is not filled
Mail server outbound-socket-binding-ref now mandatory in UI
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml index ba4fe29..03dd318 100644 --- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml +++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml @@ -11670,7 +11670,7 @@ </plugin-configuration>
<resource-configuration> - <c:simple-property name="outbound-socket-binding-ref" required="false" type="string" readOnly="false" description="Outbound Socket binding to SMTP server"> + <c:simple-property name="outbound-socket-binding-ref" required="true" type="string" readOnly="false" description="Outbound Socket binding to SMTP server"> <c:option-source target="configuration" expression="*1/remote-destination-outbound-socket-binding=name:type=SocketBindingGroup"/> </c:simple-property> <c:simple-property name="password" required="false" type="string" readOnly="false" description="Password to authenticate on server"/> @@ -11694,7 +11694,7 @@ </plugin-configuration>
<resource-configuration> - <c:simple-property name="outbound-socket-binding-ref" required="false" type="string" readOnly="false" description="Outbound Socket binding to IMAP server"> + <c:simple-property name="outbound-socket-binding-ref" required="true" type="string" readOnly="false" description="Outbound Socket binding to IMAP server"> <c:option-source target="configuration" expression="*1/remote-destination-outbound-socket-binding=name:type=SocketBindingGroup"/> </c:simple-property> <c:simple-property name="password" required="false" type="string" readOnly="false" description="Password to authenticate on server"/> @@ -11718,7 +11718,7 @@ </plugin-configuration>
<resource-configuration> - <c:simple-property name="outbound-socket-binding-ref" required="false" type="string" readOnly="false" description="Outbound Socket binding to POP3 server"> + <c:simple-property name="outbound-socket-binding-ref" required="true" type="string" readOnly="false" description="Outbound Socket binding to POP3 server"> <c:option-source target="configuration" expression="*1/remote-destination-outbound-socket-binding=name:type=SocketBindingGroup"/> </c:simple-property> <c:simple-property name="password" required="false" type="string" readOnly="false" description="Password to authenticate on server"/>
commit 3dfeb0200b33373de0e9899f659b76c8d27a8648 Author: Thomas Segismont tsegismo@redhat.com Date: Tue Feb 19 11:07:16 2013 +0100
Fix AS7 plugin itest failures due to misuse of context.getNativeProcess
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java index dcf21d3..42c19ba 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java @@ -51,6 +51,7 @@ import org.rhq.core.pluginapi.util.ProcessExecutionUtility; import org.rhq.core.pluginapi.util.StartScriptConfiguration; import org.rhq.core.system.ProcessExecution; import org.rhq.core.system.ProcessExecutionResults; +import org.rhq.core.system.ProcessInfo; import org.rhq.core.system.SystemInfo; import org.rhq.core.util.PropertiesFileUpdate; import org.rhq.modules.plugins.jbossas7.helper.HostConfiguration; @@ -69,8 +70,8 @@ import org.rhq.modules.plugins.jbossas7.json.Result; * @author Heiko W. Rupp * @author Ian Springer */ -public abstract class BaseServerComponent<T extends ResourceComponent<?>> extends BaseComponent<T> - implements MeasurementFacet { +public abstract class BaseServerComponent<T extends ResourceComponent<?>> extends BaseComponent<T> implements + MeasurementFacet {
private static final String SEPARATOR = "\n-----------------------\n";
@@ -88,9 +89,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
serverPluginConfig = new ServerPluginConfiguration(pluginConfiguration); connection = new ASConnection(serverPluginConfig.getHostname(), serverPluginConfig.getPort(), - serverPluginConfig.getUser(), serverPluginConfig.getPassword()); - @SuppressWarnings("UnusedDeclaration") - AvailabilityType avail = getAvailability(); + serverPluginConfig.getUser(), serverPluginConfig.getPassword()); + getAvailability(); logFileEventDelegate = new LogFileEventResourceComponentHelper(context); logFileEventDelegate.startLogFileEventPollers(); startScriptConfig = new StartScriptConfiguration(pluginConfiguration); @@ -127,7 +127,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend private void validateServerAttributes() throws InvalidPluginConfigurationException { // Validate the base dir (e.g. /opt/jboss-as-7.1.1.Final/standalone). File runtimeBaseDir; - File baseDir=null; + File baseDir = null; try { String runtimeBaseDirString = readAttribute(getEnvironmentAddress(), getBaseDirAttributeName()); // Canonicalize both paths before comparing them! @@ -142,12 +142,12 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend log.error("Failed to validate base dir for " + getResourceDescription() + ".", e); } if ((runtimeBaseDir != null) && (baseDir != null)) { - if(!runtimeBaseDir.equals(baseDir)) { + if (!runtimeBaseDir.equals(baseDir)) { throw new InvalidPluginConfigurationException("The server listening on " - + serverPluginConfig.getHostname() + ":" + serverPluginConfig.getPort() - + " has base dir [" + runtimeBaseDir + "], but the base dir we expected was [" + baseDir - + "]. Perhaps the management hostname or port has been changed for the server with base dir [" - + baseDir + "]."); + + serverPluginConfig.getHostname() + ":" + serverPluginConfig.getPort() + " has base dir [" + + runtimeBaseDir + "], but the base dir we expected was [" + baseDir + + "]. Perhaps the management hostname or port has been changed for the server with base dir [" + + baseDir + "]."); } }
@@ -161,9 +161,9 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend } if (runtimeMode != null) { String mode = getMode().name(); - if(!runtimeMode.equals(mode)) { - throw new InvalidPluginConfigurationException("The original mode discovered for this AS7 server was " + - getMode() + ", but the server is now reporting its mode is [" + runtimeMode + "]."); + if (!runtimeMode.equals(mode)) { + throw new InvalidPluginConfigurationException("The original mode discovered for this AS7 server was " + + getMode() + ", but the server is now reporting its mode is [" + runtimeMode + "]."); } }
@@ -171,8 +171,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend JBossProductType runtimeType; try { String runtimeTypeString = readAttribute("product-name"); - runtimeType = (runtimeTypeString != null && !runtimeTypeString.isEmpty()) ? - JBossProductType.getValueByProductName(runtimeTypeString) : JBossProductType.AS; + runtimeType = (runtimeTypeString != null && !runtimeTypeString.isEmpty()) ? JBossProductType + .getValueByProductName(runtimeTypeString) : JBossProductType.AS; } catch (Exception e) { runtimeType = null; log.error("Failed to validate product type for " + getResourceDescription() + ".", e); @@ -180,8 +180,9 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend if (runtimeType != null) { JBossProductType type = serverPluginConfig.getProductType(); if (runtimeType != type) { - throw new InvalidPluginConfigurationException("The original product type discovered for this AS7 server was " - + type + ", but the server is now reporting its product type is [" + runtimeType + "]."); + throw new InvalidPluginConfigurationException( + "The original product type discovered for this AS7 server was " + type + + ", but the server is now reporting its product type is [" + runtimeType + "]."); } } } @@ -225,7 +226,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
List<String> errors = validateStartScriptPluginConfigProps(); if (!errors.isEmpty()) { - OperationResult result = new OperationResult(); + OperationResult result = new OperationResult(); setErrorMessage(result, errors); return result; } @@ -279,9 +280,17 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
if (hostPort.isLocal) { // lets be paranoid here - while (context.getNativeProcess() != null && context.getNativeProcess().priorSnaphot() != null - && context.getNativeProcess().priorSnaphot().isRunning() - && count++ <= 20) { + for (; count <= 20; count++) { + ProcessInfo processInfo = context.getNativeProcess(); + if (processInfo == null) { + // Process not found, so it died, that's fine + break; + } + if (!processInfo.priorSnaphot().isRunning()) { + // Process info says process is no longer running, that's fine + break; + } + // Process is still running, wait a second and check again try { Thread.sleep(1000); // Wait 1s } catch (InterruptedException e) { @@ -314,7 +323,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend String startScriptPrefix = startScriptConfig.getStartScriptPrefix(); File startScriptFile = getStartScriptFile(); ProcessExecution processExecution = ProcessExecutionUtility.createProcessExecution(startScriptPrefix, - startScriptFile); + startScriptFile);
List<String> arguments = processExecution.getArguments(); if (arguments == null) { @@ -352,7 +361,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend if (results.getError() != null) { operationResult.setErrorMessage(results.getError().getMessage()); } else if (results.getExitCode() != null) { - operationResult.setErrorMessage("Start failed with error code " + results.getExitCode() + ":\n" + results.getCapturedOutput()); + operationResult.setErrorMessage("Start failed with error code " + results.getExitCode() + ":\n" + + results.getCapturedOutput()); } else { // Try to connect to the server - ping once per second, timing out after 20s. boolean up = waitForServerToStart(); @@ -368,7 +378,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend }
private boolean isManuallyAddedServer(OperationResult operationResult, String operation) { - if (pluginConfiguration.get("manuallyAdded")!=null) { + if (pluginConfiguration.get("manuallyAdded") != null) { operationResult.setErrorMessage(operation + " is not enabled for manually added servers"); return true; } @@ -410,8 +420,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend Map<String, String> startScriptEnv = startScriptConfig.getStartScriptEnv(); if (startScriptEnv.isEmpty()) { errors.add("No start script environment variables are set. At a minimum, PATH should be set " - + "(on UNIX, it should contain at least /bin and /usr/bin). It is recommended that " - + "JAVA_HOME also be set, otherwise the PATH will be used to find java."); + + "(on UNIX, it should contain at least /bin and /usr/bin). It is recommended that " + + "JAVA_HOME also be set, otherwise the PATH will be used to find java."); }
return errors; @@ -438,7 +448,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend int count = 0; while (!up) { Operation op = new ReadAttribute(new Address(), "release-version"); - try{ + try { Result res = getASConnection().execute(op); if (res.isSuccess()) { // If op succeeds, server is not down up = true; @@ -478,7 +488,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend */ protected OperationResult postProcessResult(String name, Result res) { OperationResult operationResult = new OperationResult(); - if (res==null) { + if (res == null) { operationResult.setErrorMessage("No result received from server"); return operationResult; } @@ -490,29 +500,29 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend * reading, this is a good sign. */ if (!res.isSuccess()) { - if (res.getRhqThrowable()!=null && (res.getRhqThrowable() instanceof ConnectException || res.getRhqThrowable().getMessage().equals("Connection refused"))) { + if (res.getRhqThrowable() != null + && (res.getRhqThrowable() instanceof ConnectException || res.getRhqThrowable().getMessage() + .equals("Connection refused"))) { operationResult.setSimpleResult("Success"); - log.debug("Got a ConnectionRefused for operation " + name + " this is considered ok, as the remote server sometimes closes the communications channel before sending a reply"); + log.debug("Got a ConnectionRefused for operation " + + name + + " this is considered ok, as the remote server sometimes closes the communications channel before sending a reply"); } if (res.getFailureDescription().contains("Socket closed")) { // See https://issues.jboss.org/browse/AS7-4192 operationResult.setSimpleResult("Success"); - log.debug("Got a 'Socket closed' result from AS for operation " + name ); - } - else + log.debug("Got a 'Socket closed' result from AS for operation " + name); + } else operationResult.setErrorMessage(res.getFailureDescription()); - } - else { + } else { operationResult.setSimpleResult("Success"); } - } - else { + } else { if (res.isSuccess()) { - if (res.getResult()!=null) + if (res.getResult() != null) operationResult.setSimpleResult(res.getResult().toString()); else operationResult.setSimpleResult("-None provided by server-"); - } - else + } else operationResult.setErrorMessage(res.getFailureDescription()); } return operationResult; @@ -525,8 +535,9 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend OperationResult result = new OperationResult();
PropertySimple remoteProp = pluginConfig.getSimple("manuallyAdded"); - if (remoteProp!=null && remoteProp.getBooleanValue()!= null && remoteProp.getBooleanValue()) { - result.setErrorMessage("This is a manually added server. This operation can not be used to install a management user. Use the server's 'bin/add-user.sh'"); + if (remoteProp != null && remoteProp.getBooleanValue() != null && remoteProp.getBooleanValue()) { + result + .setErrorMessage("This is a manually added server. This operation can not be used to install a management user. Use the server's 'bin/add-user.sh'"); return result; }
@@ -537,7 +548,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
File baseDir = serverPluginConfig.getBaseDir(); if (baseDir == null) { - result.setErrorMessage("'" + ServerPluginConfiguration.Property.BASE_DIR + "' plugin config prop is not set."); + result.setErrorMessage("'" + ServerPluginConfiguration.Property.BASE_DIR + + "' plugin config prop is not set."); return result; }
@@ -562,14 +574,13 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend PropertiesFileUpdate propsFileUpdate = new PropertiesFileUpdate(propertiesFile.getPath()); userAlreadyExisted = propsFileUpdate.update(user, encryptedPassword); } catch (Exception e) { - throw new RuntimeException("Failed to update management users properties file [" + propertiesFile + "].", - e); + throw new RuntimeException("Failed to update management users properties file [" + propertiesFile + "].", e); }
String verb = (userAlreadyExisted) ? "updated" : "added"; result.setSimpleResult("Management user [" + user + "] " + verb + "."); log.info("Management user [" + user + "] " + verb + " for " + context.getResourceType().getName() - + " server with key [" + context.getResourceKey() + "]."); + + " server with key [" + context.getResourceKey() + "].");
context.getAvailabilityContext().requestAvailabilityCheck(); context.getInventoryContext().requestDeferredChildResourcesDiscovery(); @@ -588,7 +599,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest> requests) throws Exception { Set<MeasurementScheduleRequest> skmRequests = new HashSet<MeasurementScheduleRequest>(requests.size()); Set<MeasurementScheduleRequest> leftovers = new HashSet<MeasurementScheduleRequest>(requests.size()); - for (MeasurementScheduleRequest request: requests) { + for (MeasurementScheduleRequest request : requests) { String requestName = request.getName(); if (requestName.equals("startTime")) { collectStartTimeTrait(report, request); @@ -681,14 +692,14 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend op.includeRuntime(true); ComplexResult res = getASConnection().executeComplex(op); if (res.isSuccess()) { - Map<String,Object> props = res.getResult(); + Map<String, Object> props = res.getResult();
- for (MeasurementScheduleRequest request: skmRequests) { + for (MeasurementScheduleRequest request : skmRequests) { String requestName = request.getName(); String realName = requestName.substring(requestName.indexOf(':') + 1); - String val=null; + String val = null; if (props.containsKey(realName)) { - val = getStringValue( props.get(realName) ); + val = getStringValue(props.get(realName)); }
if ("null".equals(val)) { @@ -699,7 +710,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend else log.debug("Value for " + realName + " was 'null' and no replacement found"); } - MeasurementDataTrait data = new MeasurementDataTrait(request,val); + MeasurementDataTrait data = new MeasurementDataTrait(request, val); report.addData(data); } } else { diff --git a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java index f6f1502..7aa92b6 100644 --- a/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java +++ b/modules/plugins/jboss-as-7/src/test/java/org/rhq/modules/plugins/jbossas7/itest/AbstractServerComponentTest.java @@ -62,6 +62,7 @@ public abstract class AbstractServerComponentTest extends AbstractJBossAS7Plugin private static final Map<String, String> EAP6_VERSION_TO_AS7_VERSION_MAP = new HashMap<String, String>(); static { EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.0", "7.1.2.Final-redhat-1"); + EAP6_VERSION_TO_AS7_VERSION_MAP.put("6.0.1", "7.1.3.Final-redhat-4"); }
private static final String RELEASE_VERSION_TRAIT_NAME = "_skm:release-version";
commit 43a268f07024873ad666fb3fda5713199f163dde Author: Jay Shaughnessy jshaughn@jshaughn.csb Date: Mon Feb 18 14:09:31 2013 -0500
Fix resource bulk delete when the resource is a member of groups, on oracle. The issue is that a native Query is used that returns resource group ids and since Oracle represents integers as Number, it actually returns a BigDecimal, not an Integer, for the Ids. Deal with it in the generic way we deal with DB type differences.
diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseType.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseType.java index fb62e4c..9e141a8 100644 --- a/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseType.java +++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/DatabaseType.java @@ -274,6 +274,19 @@ public abstract class DatabaseType { }
/** + * Get the Integer representation of the number type supplied by the db vendor for an integer field value. + * The default implementation simply applies a cast to the passed in number and is appropriate for DB types + * that support a native integer field type (like Postgres). Other db types should override this method + * (like Oracle). + * + * @param number + * @return + */ + public Integer getInteger(Object number) { + return (Integer) number; + } + + /** * Fill out a <code>PreparedStatement</code> correctly with a boolean. * * @param bool the boolean you want diff --git a/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java b/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java index 9dcbb89..15ee0af 100644 --- a/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java +++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/OracleDatabaseType.java @@ -18,6 +18,7 @@ */ package org.rhq.core.db;
+import java.math.BigDecimal; import java.sql.Connection; import java.sql.PreparedStatement; import java.sql.ResultSet; @@ -46,6 +47,7 @@ public abstract class OracleDatabaseType extends DatabaseType { * * @see DatabaseType#getVendor() */ + @Override public String getVendor() { return VENDOR; } @@ -55,10 +57,23 @@ public abstract class OracleDatabaseType extends DatabaseType { * * @see DatabaseType#getBooleanValue(boolean) */ + @Override public String getBooleanValue(boolean bool) { return bool ? "1" : "0"; }
+ /* (non-Javadoc) + * @see org.rhq.core.db.DatabaseType#getInteger(java.lang.Object) + * + * Oracle stores integer fields as Numbers and returns a BigDecimal. It is assumed <code>number</code> is actually + * an integer value, otherwise precision will be lost in this conversion. + */ + @Override + public Integer getInteger(Object number) { + BigDecimal intField = (BigDecimal) number; + return intField.intValue(); + } + /** * For Oracle databases, the boolean parameter will actually be of type "int" with a value of 0 or 1. * diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java index 384a432..d3fd1ee 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java @@ -45,6 +45,7 @@ import org.apache.commons.logging.LogFactory; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable;
+import org.rhq.core.db.DatabaseType; import org.rhq.core.db.DatabaseTypeFactory; import org.rhq.core.domain.alert.Alert; import org.rhq.core.domain.alert.AlertCondition; @@ -499,7 +500,10 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage // In other words, the implicit resources of a group have no impact on the group type (compatible/mixed). Query nativeQuery = entityManager.createNativeQuery(ResourceGroup.QUERY_GET_GROUP_IDS_BY_RESOURCE_IDS); nativeQuery.setParameter("resourceIds", resourceIds); - List<Integer> groupIds = nativeQuery.getResultList(); + // Note that different DB vendors return different types for IDs because the representation + // is different at the storage layer. This is an em native query so we need to handle the differences. + // Postgres will return an Integer, but Oracle returns a BigDecimal, etc. + List<?> rs = nativeQuery.getResultList();
String[] nativeQueriesToExecute = new String[] { // ResourceGroup.QUERY_DELETE_EXPLICIT_BY_RESOURCE_IDS, // unmap from explicit groups @@ -514,9 +518,13 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage }
// update the resource type of affected groups by calling setResouceType() - for (int groupId : groupIds) { + DatabaseType dbType = DatabaseTypeFactory.getDefaultDatabaseType(); + Integer groupId = null; + for (int i = 0, size = rs.size(); i < size; ++i) { try { + groupId = dbType.getInteger(rs.get(i)); resourceGroupManager.setResourceType(groupId); + } catch (ResourceGroupDeleteException rgde) { log.warn("Unable to change resource type for group with id [" + groupId + "]", rgde); }
commit f7409c5649029ba91d1d25ced972196b677ab14d Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Feb 15 21:29:54 2013 -0500
Inventory sync no longer schedules avail check runs in response to unknown/modified resources, instead just waiting for the next scheduled run, which is soon given only 30s intervals.
These test classes, perhaps unwittingly, depended on that behavior, so now run the avail checker as a post-discovery task, to fully initialize the resource containers.
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/LateMeasurementRescheduleTest.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/LateMeasurementRescheduleTest.java index c79988b..301d613 100644 --- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/LateMeasurementRescheduleTest.java +++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/LateMeasurementRescheduleTest.java @@ -18,6 +18,7 @@ import org.jboss.shrinkwrap.api.ShrinkWrap; import org.rhq.core.clientapi.server.discovery.InventoryReport; import org.rhq.core.domain.resource.InventoryStatus; import org.rhq.core.pc.PluginContainer; +import org.rhq.core.pc.inventory.ForceAvailabilityExecutor; import org.rhq.core.pc.inventory.ResourceContainer; import org.rhq.plugins.test.SingleResourceDiscoveryComponent; import org.rhq.plugins.test.measurement.BZ834019ResourceComponent; @@ -85,6 +86,9 @@ public class LateMeasurementRescheduleTest extends Arquillian { public void waitForAsyncDiscoveries() throws Exception { if (discoveryCompleteChecker != null) { discoveryCompleteChecker.waitForDiscoveryComplete(10000); + + // Since the avail job is not running, make sure our discovered resources get their initial UP avail + new ForceAvailabilityExecutor(pluginContainer.getInventoryManager()).call(); } }
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/ReadOnlyScheduleSetTest.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/ReadOnlyScheduleSetTest.java index dedf968..4747851 100644 --- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/ReadOnlyScheduleSetTest.java +++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/measurement/ReadOnlyScheduleSetTest.java @@ -19,6 +19,7 @@ import org.jboss.shrinkwrap.api.ShrinkWrap; import org.rhq.core.clientapi.server.discovery.InventoryReport; import org.rhq.core.domain.resource.InventoryStatus; import org.rhq.core.pc.PluginContainer; +import org.rhq.core.pc.inventory.ForceAvailabilityExecutor; import org.rhq.core.pc.inventory.ResourceContainer; import org.rhq.plugins.test.SingleResourceDiscoveryComponent; import org.rhq.plugins.test.measurement.BZ821058ResourceComponent; @@ -84,6 +85,9 @@ public class ReadOnlyScheduleSetTest extends Arquillian { public void waitForAsyncDiscoveries() throws Exception { if (discoveryCompleteChecker != null) { discoveryCompleteChecker.waitForDiscoveryComplete(10000); + + // Since the avail job is not running, make sure our discovered resources get their initial UP avail + new ForceAvailabilityExecutor(pluginContainer.getInventoryManager()).call(); } }
commit f7da6afeb80a4a3a18906d7ae3f8318e2d3640a9 Author: John Mazzitelli mazz@redhat.com Date: Fri Feb 15 15:43:50 2013 -0500
the name of the perftest sysprops are different now
diff --git a/etc/agentspawn/src/scripts/agentcopy.properties b/etc/agentspawn/src/scripts/agentcopy.properties index 52f3cba..8e15c26 100644 --- a/etc/agentspawn/src/scripts/agentcopy.properties +++ b/etc/agentspawn/src/scripts/agentcopy.properties @@ -32,8 +32,8 @@ agentcopy.agent.javaopts-default=-Xms64m -Xmx128m -Djava.net.preferIPv4Stack=tru # you do not specify -D options for a specific agent index, the # sysprops-default will be used for that agent. agentcopy.agent.sysprops-default= -#agentcopy.agent.sysprops-default=-Don.perftest.scenario=configurable-alphaomega -Don.perftest.server-omega-count=10 -Don.perftest.service-alpha-count=25 -Don.perftest.service-beta-count=50 -#agentcopy.agent.sysprops.#####=-Don.perftest.scenario=configurable-3 -Don.perftest.server-b-count=10 -Don.perftest.service-b-count=50 +#agentcopy.agent.sysprops-default=-Drhq.perftest.scenario=configurable-alphaomega -Drhq.perftest.server-omega-count=10 -Drhq.perftest.service-alpha-count=25 -Drhq.perftest.service-beta-count=50 +#agentcopy.agent.sysprops.#####=-Drhq.perftest.scenario=configurable-3 -Drhq.perftest.server-b-count=10 -Drhq.perftest.service-b-count=50
# These are additional agent command line options that you can pass to an # agent. These are added to the normal command line options that are always
commit 93a79d386873d8ecf9261fa7dee1d11772c9d591 Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Feb 15 14:33:14 2013 -0500
Fix test to reflect the improved behavior when mergeAvailabilityReport performs Availability "repair".
diff --git a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java index d6ac8b2..1fcda30 100644 --- a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java +++ b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/measurement/test/AvailabilityManagerTest.java @@ -1242,26 +1242,32 @@ public class AvailabilityManagerTest extends AbstractEJB3Test { Thread.sleep(1000); availabilityManager.mergeAvailabilityReport(report);
+ // the end time of avail 4 should have been reset to the start time of avail 5. Avail 5 should have been + // added and should be DOWN avails = getResourceAvailabilities(theResource); - assertEquals(avails.toString(), 4, avails.size()); + assertEquals(avails.toString(), 5, avails.size());
- // avail start times should now be 0, 1:00 (UP), 1:10(DOWN), 1:40(UP) + // avail start times should now be 0, 1:00 (UP), 1:20(DOWN), 1:40(UP), 1:45(DOWN) avail = avails.get(0); // 0..1:00 assertTrue(avail.toString(), Math.abs(avail.getStartTime() - 0L) < 1000L); assertEquals(avail.toString(), AvailabilityType.UNKNOWN, avail.getAvailabilityType()); assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(1).getStartTime()) < 1000L); avail = avails.get(1); // 1:00..1:20 - assertTrue(avail.toString(), Math.abs(currentStartTime - (avail.getStartTime() + (40 * 60 * 1000))) < 1000L); + assertTrue(avail.toString(), Math.abs(newStartTime - (avail.getStartTime() + (45 * 60 * 1000))) < 1000L); assertEquals(avail.toString(), AvailabilityType.UP, avail.getAvailabilityType()); assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(2).getStartTime()) < 1000L); avail = avails.get(2); // 1:20..1:40 - assertTrue(avail.toString(), Math.abs(currentStartTime - (avail.getStartTime() + (20 * 60 * 1000))) < 1000L); + assertTrue(avail.toString(), Math.abs(newStartTime - (avail.getStartTime() + (25 * 60 * 1000))) < 1000L); assertEquals(avail.toString(), AvailabilityType.DOWN, avail.getAvailabilityType()); assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(3).getStartTime()) < 1000L); - avail = avails.get(3); // 1:40 - assertTrue(avail.toString(), Math.abs(currentStartTime - avail.getStartTime()) < 1000L); + avail = avails.get(3); // 1:40..1:45 + assertTrue(avail.toString(), Math.abs(newStartTime - (avail.getStartTime() + (5 * 60 * 1000))) < 1000L); assertEquals(avail.toString(), AvailabilityType.UP, avail.getAvailabilityType()); - assertEquals(avail.toString(), null, avail.getEndTime()); // THIS IS THE CHANGE + assertTrue(avail.toString(), Math.abs(avail.getEndTime() - avails.get(4).getStartTime()) < 1000L); // THE FIX + avail = avails.get(4); // 1:45..null + assertTrue(avail.toString(), Math.abs(newStartTime - avail.getStartTime()) < 1000L); + assertEquals(avail.toString(), AvailabilityType.DOWN, avail.getAvailabilityType()); + assertEquals(avail.toString(), null, avail.getEndTime());
} catch (Exception e) { e.printStackTrace();
commit 0ec2c91347728df8462b2587f7ecc01e9245b73d Author: Lukas Krejci lkrejci@redhat.com Date: Fri Feb 15 16:14:38 2013 +0100
Fix the JNDI access integration test. Default activation of profiles in Maven just doesn't work the way I expected it to ;)
diff --git a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml index 74e563c..b20dfa0 100644 --- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml +++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml @@ -155,14 +155,15 @@ <profile> <id>managed-test-server</id> <activation> - <activeByDefault>true</activeByDefault> + <property> + <name>!remote-test-server</name> + </property> </activation>
<dependencies> <dependency> <groupId>org.jboss.as</groupId> <artifactId>jboss-as-arquillian-container-managed</artifactId> - <version>${jboss.version}</version> <scope>test</scope> </dependency> </dependencies> @@ -170,6 +171,11 @@
<profile> <id>remote-test-server</id> + <activation> + <property> + <name>remote-test-server</name> + </property> + </activation>
<dependencies> <dependency>
commit d124641fbb254087544f8f6dda17ae0dc8b3d967 Author: Thomas Segismont tsegismo@redhat.com Date: Thu Feb 14 18:23:36 2013 +0100
Fix JMX plugin test failure
diff --git a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java index b841a38..9757c7a 100644 --- a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java +++ b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java @@ -72,8 +72,6 @@ import org.rhq.plugins.jmx.util.JvmResourceKey; * @author Greg Hinkle * @author Ian Springer */ -// Disabled until we find a fix for Sigar getProcCredName issue -@Test(enabled = false) public class JMXPluginTest {
private static final int JMX_REMOTING_PORT1 = 9921; @@ -95,8 +93,9 @@ public class JMXPluginTest { this.testServerJvms.add(startTestServerJvm("-Dcom.sun.management.jmxremote.port=" + JMX_REMOTING_PORT1, "-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.authenticate=false"));
- this.testServerJvms.add(startTestServerJvm("-D" + JMXDiscoveryComponent.SYSPROP_RHQ_RESOURCE_KEY + "=" - + EXPLICIT_RESOURCE_KEY1)); + // FIXME: Disabled until we find a fix for Sigar getProcCredName issue + // this.testServerJvms.add(startTestServerJvm("-D" + JMXDiscoveryComponent.SYSPROP_RHQ_RESOURCE_KEY + "=" + // + EXPLICIT_RESOURCE_KEY1));
this.testServerJvms.add(startTestServerJvm("-Dcom.sun.management.jmxremote.port=" + JMX_REMOTING_PORT2, "-Dcom.sun.management.jmxremote.ssl=false", "-Dcom.sun.management.jmxremote.authenticate=false", @@ -206,7 +205,8 @@ public class JMXPluginTest { } } assert foundJmxRemotingServer : "JMX Remoting server not found."; - assert foundExplicitKey1Server : "Explicit key server not found."; + // FIXME: Disabled until we find a fix for Sigar getProcCredName issue + //assert foundExplicitKey1Server : "Explicit key server not found."; assert foundExplicitKey2Server : "JMX Remoting + explicit key server not found."; }
commit f5104b4e3523c481a768a6411e87122371c002ec Author: Jirka Kremser jkremser@redhat.com Date: Thu Feb 14 15:28:02 2013 +0100
[BZ 909157 - Operation parameters are not shown in schedule operation details.] If the method refreshOperationParametersItem() is called when scheduling a new operation, the existent parameters are not forget.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java index 0f54af0..8436c2ab 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java @@ -355,7 +355,6 @@ public abstract class AbstractOperationScheduleDetailsView extends
this.operationParameters = (Configuration) record .getAttributeAsObject(AbstractOperationScheduleDataSource.Field.PARAMETERS); - super.editExistingRecord(record); }
@@ -426,11 +425,14 @@ public abstract class AbstractOperationScheduleDetailsView extends private void refreshOperationParametersItem() { String operationName = getSelectedOperationName(); String value; - operationParameters = null; // reset params between dropdown selects - // make sure we wipe out anything left by the previous op def - for (Canvas child : this.operationParametersConfigurationHolder.getChildren()) { - child.destroy(); + if (isNewRecord()) { // BZ 909157: do it only for new schedule + operationParameters = null; // reset params between dropdown selects + // make sure we wipe out anything left by the previous op def + for (Canvas child : this.operationParametersConfigurationHolder.getChildren()) { + child.destroy(); + } } + if (operationName == null) { value = "<i>" + MSG.view_operationScheduleDetails_fieldDefault_parameters() + "</i>"; this.operationParametersConfigurationHolder.hide(); @@ -453,8 +455,6 @@ public abstract class AbstractOperationScheduleDetailsView extends ConfigurationTemplate defaultTemplate = parametersDefinition.getDefaultTemplate(); this.operationParameters = (defaultTemplate != null) ? defaultTemplate.createConfiguration() : new Configuration(); - } else { - this.operationParameters = new Configuration(); }
ConfigurationGWTServiceAsync configurationService = GWTServiceLookup.getConfigurationService();
commit 75938dac1e630e1f71a6a31e59f7b6124084a2c3 Author: John Mazzitelli mazz@redhat.com Date: Thu Feb 14 09:22:47 2013 -0500
installer now provides a "--force" option - this lets you re-run the installer even if you didn't set autoinstall.enabled=true and it also lets you attempt another installation if a previous one failed in the middle of its prior attempt.
diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java index 48defbc..b8a83fc 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java @@ -157,6 +157,7 @@ public class Installer { usage.append("\t--host=<hostname>, -h: hostname where the app server is running").append("\n"); usage.append("\t--port=<port>, -p: talk to the app server over this management port").append("\n"); usage.append("\t--test, -t: test the validity of the server properties (install not performed)").append("\n"); + usage.append("\t--force, -f: force the installer to try to install everything").append("\n"); usage.append("\t--listservers, -l: show list of known installed servers (install not performed)").append("\n"); usage.append("\t--setupdb, -b: only perform database schema creation or update").append("\n"); usage.append("\t--reconfig, -r: resets some configuration settings in an installed server").append("\n"); @@ -166,7 +167,7 @@ public class Installer { }
private WhatToDo[] processArguments(String[] args) throws Exception { - String sopts = "-:HD:h:p:d:blrt"; + String sopts = "-:HD:h:p:d:bflrt"; LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null, 'H'), new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'h'), new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'), @@ -174,6 +175,7 @@ public class Installer { new LongOpt("setupdb", LongOpt.NO_ARGUMENT, null, 'b'), new LongOpt("listservers", LongOpt.NO_ARGUMENT, null, 'l'), new LongOpt("reconfig", LongOpt.NO_ARGUMENT, null, 'r'), + new LongOpt("force", LongOpt.NO_ARGUMENT, null, 'f'), new LongOpt("test", LongOpt.NO_ARGUMENT, null, 't') };
boolean test = false; @@ -255,6 +257,11 @@ public class Installer { break; // don't return, in case we need to allow more args }
+ case 'f': { + this.installerConfig.setForceInstall(true); + break; // don't return, in case we need to allow more args + } + case 'l': { listservers = true; break; // don't return, we need to allow more args to be processed, like -p or -h diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java index 0852b78..3adecbe 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java @@ -28,6 +28,7 @@ package org.rhq.enterprise.server.installer; public class InstallerConfiguration { private String managementHost = "127.0.0.1"; private int managementPort = 9999; // this is the default AS port + private boolean forceInstall = false;
public InstallerConfiguration() { } @@ -59,4 +60,12 @@ public class InstallerConfiguration { } this.managementPort = port; } + + public boolean isForceInstall() { + return this.forceInstall; + } + + public void setForceInstall(boolean flag) { + this.forceInstall = flag; + } } diff --git a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java index 3ece569..e72f133 100644 --- a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java +++ b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java @@ -86,7 +86,7 @@ public class InstallerServiceImpl implements InstallerService { return; } if (allServerDetails.size() == 0) { - log.info("There are no known servers currently registered"); + log("There are no known servers currently registered"); return; }
@@ -108,7 +108,7 @@ public class InstallerServiceImpl implements InstallerService { info.append(serverDetails.getEndpointSecurePortString()); info.append("\n"); } - log.info(info.toString()); + log(info.toString()); return; }
@@ -136,15 +136,21 @@ public class InstallerServiceImpl implements InstallerService { ServerDetails detailsFromProps = getServerDetailsFromPropertiesOnly(serverProperties); ServerDetails detailsFromDb = getServerDetails(dbUrl, dbUsername, clearTextDbPassword, detailsFromProps.getName()); + ExistingSchemaOption existingSchemaOption = getAutoinstallExistingSchemaOption(serverProperties); + if (detailsFromDb == null) { - log.info("This will be considered a new server: " + detailsFromProps); + log("This will be considered a new server: " + detailsFromProps); } else { - log.info("This [" + detailsFromProps + "] will be considered a reinstallation of an existing server [" - + detailsFromDb + "]"); + if (existingSchemaOption == ExistingSchemaOption.OVERWRITE) { + log("This [" + detailsFromProps + "] will OVERWRITE the existing server [" + detailsFromDb + + "] that already exists in the database."); + } else { + log("This [" + detailsFromProps + "] will be considered a reinstallation of an existing server [" + + detailsFromDb + "]"); + } }
// just warns if the schema will be overwritten - ExistingSchemaOption existingSchemaOption = getAutoinstallExistingSchemaOption(serverProperties); if (existingSchemaOption == ExistingSchemaOption.OVERWRITE) { log.warn("The installer has been configured to OVERWRITE any existing data in the database. " + "If you do install with this configuration, realize that all existing data in the database " @@ -153,10 +159,10 @@ public class InstallerServiceImpl implements InstallerService {
// just logs the location of the AS instance where RHQ will be installed String appServerHomeDir = getAppServerHomeDir(); - log.info("The app server where the installation will go is found at: " + appServerHomeDir); + log("The app server where the installation will go is found at: " + appServerHomeDir);
// give some message to indicate everything looks OK and the user can start the real install - log.info("It looks like everything is OK and you can start the installation."); + log("It looks like everything is OK and you can start the installation."); }
@Override @@ -177,8 +183,12 @@ public class InstallerServiceImpl implements InstallerService { if (autoInstallMode) { log("The server is preconfigured and ready for auto-install."); } else { - throw new AutoInstallDisabledException( - "Auto-installation is disabled. Please fully configure rhq-server.properties"); + if (this.installerConfiguration.isForceInstall()) { + log("Auto-installation would have been disabled, but installer was asked to force the install... continuing."); + } else { + throw new AutoInstallDisabledException( + "Auto-installation is disabled. Please fully configure rhq-server.properties"); + } }
// make an attempt to connect to the app server - we must make sure its running and we can connect to it @@ -189,11 +199,21 @@ public class InstallerServiceImpl implements InstallerService { final String installationResults = getInstallationResults(); if (installationResults != null) { if (installationResults.length() == 0) { - throw new AlreadyInstalledException( - "The installer has already been told to perform its work. The server should be ready soon."); + if (this.installerConfiguration.isForceInstall()) { + log("The installer appears to have already been told to perform its work, but the installer was asked for force the install... continuing."); + } else { + throw new AlreadyInstalledException( + "The installer has already been told to perform its work. The server should be ready soon."); + } } else { - throw new Exception("The installer has already attempted to install the server but errors occurred:\n" - + installationResults); + if (this.installerConfiguration.isForceInstall()) { + log("The installer is going to force another installation attempt, even though a previous attempt encountered errors:\n" + + installationResults); + } else { + throw new Exception( + "The installer has already attempted to install the server but errors occurred:\n" + + installationResults); + } } }
@@ -225,8 +245,12 @@ public class InstallerServiceImpl implements InstallerService { String existingSchemaOption) throws AutoInstallDisabledException, AlreadyInstalledException, Exception {
if (isEarDeployed()) { - throw new AlreadyInstalledException( - "It looks like the installation has already been completed - there is nothing for the installer to do."); + if (this.installerConfiguration.isForceInstall()) { + log("It looks like the installation has already been completed, but the installer was asked for force the install... continuing."); + } else { + throw new AlreadyInstalledException( + "It looks like the installation has already been completed - there is nothing for the installer to do."); + } }
prepareDatabase(serverProperties, serverDetails, existingSchemaOption); @@ -930,7 +954,8 @@ public class InstallerServiceImpl implements InstallerService { // Not only do we want to make sure we can connect, but we also want to wait for the subsystems to initialize. // Let's wait for one of the subsystems to exist; once we know this is up, the rest are probably ready too. if (!(new WebJBossASClient(getModelControllerClient()).isWebSubsystem())) { - throw new IllegalStateException("The server does not appear to be fully started yet"); + throw new IllegalStateException( + "The server does not appear to be fully started yet (the web subsystem did not start)"); }
return retVal; @@ -1096,8 +1121,13 @@ public class InstallerServiceImpl implements InstallerService { try { mcc = getModelControllerClient(); CoreJBossASClient client = new CoreJBossASClient(mcc); - log("Installing RHQ EAR startup subsystem extension"); - client.addExtension(RHQ_EXTENSION_NAME); + boolean isDeployed = client.isExtension(RHQ_EXTENSION_NAME); + if (!isDeployed) { + log("Installing RHQ EAR startup subsystem extension"); + client.addExtension(RHQ_EXTENSION_NAME); + } else { + log("RHQ EAR startup subsystem extension is already deployed"); + } } finally { safeClose(mcc); } @@ -1108,8 +1138,13 @@ public class InstallerServiceImpl implements InstallerService { try { mcc = getModelControllerClient(); CoreJBossASClient client = new CoreJBossASClient(mcc); - log("Installing RHQ EAR subsystem"); - client.addSubsystem(RHQ_SUBSYSTEM_NAME); + boolean isDeployed = client.isSubsystem(RHQ_SUBSYSTEM_NAME); + if (!isDeployed) { + log("Installing RHQ EAR subsystem"); + client.addSubsystem(RHQ_SUBSYSTEM_NAME); + } else { + log("RHQ EAR subsystem is already deployed"); + } } finally { safeClose(mcc); }
commit a7172ed168f77a6de4c6eb020666fa142aaa5569 Author: Lukas Krejci lkrejci@redhat.com Date: Thu Feb 14 15:04:35 2013 +0100
The apache integration tests are now resilient against apache servers running on the target machine out of the test control. These will no longer affect the test results.
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java index 8bc25ca..a7f6697 100644 --- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java +++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java @@ -59,6 +59,10 @@ import org.rhq.core.domain.resource.ResourceType; */ public class FakeServerInventory {
+ public interface InventoryStatusJudge { + InventoryStatus judge(Resource resource); + } + private Resource platform; private Map<String, Resource> resourceStore = new HashMap<String, Resource>(); private int counter; @@ -77,6 +81,13 @@ public class FakeServerInventory { } };
+ private static final Comparator<Resource> RESOURCE_TYPE_AND_STATUS_COMPARATOR = new Comparator<Resource>() { + public int compare(Resource o1, Resource o2) { + return o1.getResourceType().equals(o2.getResourceType()) + && o1.getInventoryStatus() == o2.getInventoryStatus() ? 0 : o1.getId() - o2.getId(); + } + }; + public FakeServerInventory() { this(false); } @@ -86,14 +97,18 @@ public class FakeServerInventory { }
public synchronized void prepopulateInventory(Resource platform, Collection<Resource> topLevelServers) { - this.platform = fakePersist(platform, InventoryStatus.COMMITTED, new HashSet<String>()); + this.platform = fakePersist(platform, getSimpleJudge(InventoryStatus.COMMITTED), new HashSet<String>()); for (Resource res : topLevelServers) { res.setParentResource(this.platform); - fakePersist(res, InventoryStatus.COMMITTED, new HashSet<String>()); + fakePersist(res, getSimpleJudge(InventoryStatus.COMMITTED), new HashSet<String>()); } }
public synchronized CustomAction mergeInventoryReport(final InventoryStatus requiredInventoryStatus) { + return mergeInventoryReport(getSimpleJudge(requiredInventoryStatus)); + } + + public synchronized CustomAction mergeInventoryReport(final InventoryStatusJudge judge) { return new CustomAction("updateServerSideInventory") { public Object invoke(Invocation invocation) throws Throwable { synchronized (FakeServerInventory.this) { @@ -102,7 +117,7 @@ public class FakeServerInventory { InventoryReport inventoryReport = (InventoryReport) invocation.getParameter(0);
for (Resource res : inventoryReport.getAddedRoots()) { - Resource persisted = fakePersist(res, requiredInventoryStatus, new HashSet<String>()); + Resource persisted = fakePersist(res, judge, new HashSet<String>());
if (res.getParentResource() == Resource.ROOT) { platform = persisted; @@ -265,6 +280,23 @@ public class FakeServerInventory { }
@SuppressWarnings("serial") + public synchronized Set<Resource> findResourcesByTypeAndStatus(final ResourceType type, final InventoryStatus status) { + Set<Resource> result = new HashSet<Resource>(); + if (platform != null) { + findResources(platform, new Resource() { + public ResourceType getResourceType() { + return type; + } + + public InventoryStatus getInventoryStatus() { + return status; + } + }, result, RESOURCE_TYPE_AND_STATUS_COMPARATOR); + } + return result; + } + + @SuppressWarnings("serial") private Set<Resource> getResources(Set<Integer> resourceIds, boolean includeDescendants) { //it is important to keep the hierarchical order of the resource in the returned set //so that plugin container can merge the resources from top to bottom. @@ -301,7 +333,7 @@ public class FakeServerInventory { } }
- private Resource fakePersist(Resource agentSideResource, InventoryStatus requiredInventoryStatus, + private Resource fakePersist(Resource agentSideResource, InventoryStatusJudge statusJudge, Set<String> inProgressUUIds) { Resource persisted = resourceStore.get(agentSideResource.getUuid()); if (!inProgressUUIds.add(agentSideResource.getUuid())) { @@ -316,6 +348,7 @@ public class FakeServerInventory { persisted.setUuid(agentSideResource.getUuid()); resourceStore.put(persisted.getUuid(), persisted); } + persisted.setAgent(agentSideResource.getAgent()); persisted.setCurrentAvailability(agentSideResource.getCurrentAvailability()); persisted.setDescription(agentSideResource.getDescription()); @@ -323,13 +356,15 @@ public class FakeServerInventory { persisted.setPluginConfiguration(agentSideResource.getPluginConfiguration().clone()); persisted.setResourceConfiguration(agentSideResource.getResourceConfiguration().clone()); persisted.setVersion(agentSideResource.getVersion()); - persisted.setInventoryStatus(requiredInventoryStatus); persisted.setResourceKey(agentSideResource.getResourceKey()); persisted.setResourceType(agentSideResource.getResourceType());
+ InventoryStatus status = statusJudge.judge(persisted); + persisted.setInventoryStatus(status); + Resource parent = agentSideResource.getParentResource(); if (parent != null && parent != Resource.ROOT) { - parent = fakePersist(agentSideResource.getParentResource(), requiredInventoryStatus, + parent = fakePersist(agentSideResource.getParentResource(), statusJudge, inProgressUUIds); persisted.setParentResource(parent); parent.getChildResources().add(persisted); @@ -340,7 +375,7 @@ public class FakeServerInventory { //persist the children Set<Resource> childResources = new LinkedHashSet<Resource>(); for (Resource child : agentSideResource.getChildResources()) { - childResources.add(fakePersist(child, requiredInventoryStatus, inProgressUUIds)); + childResources.add(fakePersist(child, statusJudge, inProgressUUIds)); } //now update the list with whatever the persisted resource contained in the past //i.e. we prefer the current results from the agent but keep the children we used to @@ -398,6 +433,7 @@ public class FakeServerInventory {
children.add(syncChild); } + getPrivateField(clazz, "childSyncInfos").set(ret, children);
return ret; @@ -444,4 +480,14 @@ public class FakeServerInventory { } } } + + private InventoryStatusJudge getSimpleJudge(final InventoryStatus requiredStatus) { + return new InventoryStatusJudge() { + + @Override + public InventoryStatus judge(Resource resource) { + return requiredStatus; + } + }; + } } diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java index b1c8a24..85d5f52 100644 --- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java +++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java @@ -49,6 +49,7 @@ import org.rhq.core.pc.configuration.ConfigurationManager; import org.rhq.core.pc.inventory.InventoryManager; import org.rhq.core.pc.inventory.ResourceContainer; import org.rhq.core.pc.upgrade.FakeServerInventory; +import org.rhq.plugins.apache.ApacheServerComponent; import org.rhq.plugins.apache.PluginLocation; import org.rhq.plugins.apache.setup.ApacheTestConfiguration; import org.rhq.plugins.apache.setup.ApacheTestSetup; @@ -58,7 +59,7 @@ import org.rhq.test.pc.PluginContainerSetup; import org.rhq.test.pc.PluginContainerTest;
/** - * + * * * @author Lukas Krejci */ @@ -126,13 +127,13 @@ public class AugeasReferenceLeakingTest extends BMNGRunner { configureApacheServerToUseAugeas();
PluginContainer pc = PluginContainer.getInstance(); - Resource platform = pc.getInventoryManager().getPlatform(); + Resource apacheServer = findApacheServerResource().getResource();
for (int i = 0; i < configurationReadingInvocationCount; ++i) { - checkConfigurationRecursively(platform, pc.getConfigurationManager()); + checkApacheServerConfigurationRecursively(apacheServer, pc.getConfigurationManager()); Thread.sleep(10000); } - + //wait a couple of seconds for the loadConfig calls to finish Thread.sleep(60000); } finally { @@ -192,14 +193,14 @@ public class AugeasReferenceLeakingTest extends BMNGRunner { } }
- private void checkConfigurationRecursively(Resource resource, ConfigurationManager cm) + private void checkApacheServerConfigurationRecursively(Resource resource, ConfigurationManager cm) throws PluginContainerException { if (resource.getResourceType().getResourceConfigurationDefinition() != null) { cm.loadResourceConfiguration(resource.getId()); }
for (Resource child : resource.getChildResources()) { - checkConfigurationRecursively(child, cm); + checkApacheServerConfigurationRecursively(child, cm); } }
@@ -208,32 +209,36 @@ public class AugeasReferenceLeakingTest extends BMNGRunner {
InventoryManager im = PluginContainer.getInstance().getInventoryManager();
- ResourceContainer apacheServer = findResource(resourceTypes.findByName("Apache HTTP Server")); + ResourceContainer apacheServer = findApacheServerResource();
Configuration config = apacheServer.getResourceContext().getPluginConfiguration();
config.getSimple("augeasEnabled").setValue("yes");
im.updatePluginConfiguration(apacheServer.getResource().getId(), config); - + //and run discovery so that the new resources can go into inventory - + im.executeServiceScanImmediately(); }
- private ResourceContainer findResource(ResourceType resourceType) { + private ResourceContainer findApacheServerResource() throws Exception { InventoryManager im = PluginContainer.getInstance().getInventoryManager(); + ResourceTypes resourceTypes = new ResourceTypes(PluginLocation.APACHE_PLUGIN); + ResourceType apacheServerResourceType = resourceTypes.findByName("Apache HTTP Server");
- return findResource(im, resourceType, im.getPlatform()); + return findApacheServerResource(im, apacheServerResourceType, im.getPlatform()); }
- private ResourceContainer findResource(InventoryManager im, ResourceType rt, Resource root) { - if (root.getResourceType().equals(rt)) { + private ResourceContainer findApacheServerResource(InventoryManager im, ResourceType rt, Resource root) { + if (root.getResourceType().equals(rt) + && root.getPluginConfiguration().getSimpleValue(ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT) + .equals(setup.getDeploymentConfig().serverRoot)) { return im.getResourceContainer(root); }
for (Resource child : root.getChildResources()) { - ResourceContainer rc = findResource(im, rt, child); + ResourceContainer rc = findApacheServerResource(im, rt, child); if (rc != null) { return rc; } diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java index 37e74d9..e0363af 100644 --- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java +++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java @@ -41,6 +41,7 @@ import org.rhq.core.domain.discovery.AvailabilityReport; import org.rhq.core.domain.resource.InventoryStatus; import org.rhq.core.domain.resource.Resource; import org.rhq.core.domain.resource.ResourceError; +import org.rhq.core.domain.resource.ResourceType; import org.rhq.core.pc.ServerServices; import org.rhq.core.pc.upgrade.FakeServerInventory; import org.rhq.core.system.SystemInfoFactory; @@ -257,9 +258,23 @@ public class ApacheTestSetup { public void addDefaultExceptations(Expectations expectations) throws Exception { ServerServices ss = PluginContainerTest.getCurrentPluginContainerConfiguration().getServerServices();
+ //only import the apache servers we actually care about - we can't assume another apache won't be present + //on the machine running the test... + final ResourceType serverResourceType = apacheResourceTypes.findByName("Apache HTTP Server"); expectations.allowing(ss.getDiscoveryServerService()).mergeInventoryReport( expectations.with(Expectations.any(InventoryReport.class))); - expectations.will(fakeInventory.mergeInventoryReport(InventoryStatus.COMMITTED)); + expectations.will(fakeInventory.mergeInventoryReport(new FakeServerInventory.InventoryStatusJudge() { + @Override + public InventoryStatus judge(Resource resource) { + if (serverResourceType.equals(resource.getResourceType())) { + return deploymentConfig.serverRoot.equals(resource.getPluginConfiguration().getSimpleValue( + ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT)) ? InventoryStatus.COMMITTED + : InventoryStatus.IGNORED; + } else { + return InventoryStatus.COMMITTED; + } + } + }));
expectations.allowing(ss.getDiscoveryServerService()).upgradeResources( expectations.with(Expectations.any(Set.class))); diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java index aebea53..719a3dd 100644 --- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java +++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java @@ -42,6 +42,7 @@ import org.testng.annotations.BeforeClass; import org.rhq.core.clientapi.agent.metadata.PluginMetadataParser; import org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil; import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor; +import org.rhq.core.domain.resource.InventoryStatus; import org.rhq.core.domain.resource.Resource; import org.rhq.core.domain.resource.ResourceCategory; import org.rhq.core.domain.resource.ResourceError; @@ -77,15 +78,15 @@ import org.rhq.test.pc.PluginContainerTest; public class UpgradeTestBase extends PluginContainerTest {
private static final Log LOG = LogFactory.getLog(UpgradeTestBase.class); - + public enum ResourceKeyFormat { SNMP, RHQ3, RHQ4 }; - + protected static final String DEPLOYMENT_SIMPLE_WITH_RESOLVABLE_SERVERNAMES = "simpleWithResolvableServerNames"; protected static final String DEPLOYMENT_SIMPLE_WITH_UNRESOLVABLE_SERVER_NAMES = "simpleWithUnresolvableServerNames"; protected static final String DEPLOYMENT_SIMPLE_WITH_WILDCARD_LISTENS = "simpleWithWildcardListens"; - + private ResourceTypes apacheResourceTypes; protected Resource platform;
@@ -101,15 +102,15 @@ public class UpgradeTestBase extends PluginContainerTest { apacheResourceTypes); boolean testFailed = false; try { - + String[] configFiles = Arrays.copyOf(testConfiguration.apacheConfigurationFiles, testConfiguration.apacheConfigurationFiles.length + 1); configFiles[testConfiguration.apacheConfigurationFiles.length] = "/snmpd.conf"; - + setup.withInventoryFrom(testConfiguration.inventoryFile) .withPlatformResource(platform).withDefaultExpectations().withDefaultOverrides(testConfiguration.defaultOverrides) .withApacheSetup().withConfigurationFiles(configFiles) .withServerRoot(testConfiguration.serverRoot).withExePath(testConfiguration.binPath); - + testConfiguration.beforeTestSetup(setup);
LOG.debug("---------------------------------------------------------- Starting the upgrade test for: " @@ -117,46 +118,46 @@ public class UpgradeTestBase extends PluginContainerTest { LOG.debug("Deployment configuration: " + setup.getDeploymentConfig());
setup.setup(); - + testConfiguration.beforePluginContainerStart(setup); - + startConfiguredPluginContainer(); - + testConfiguration.beforeTests(setup); - + //ok, now we should see the resources upgraded in the fake server inventory. ResourceType serverResourceType = apacheResourceTypes.findByName("Apache HTTP Server"); ResourceType vhostResourceType = apacheResourceTypes.findByName("Apache Virtual Host"); - - Set<Resource> servers = setup.getFakeInventory().findResourcesByType(serverResourceType); + + Set<Resource> servers = setup.getFakeInventory().findResourcesByTypeAndStatus(serverResourceType, InventoryStatus.COMMITTED);
assertEquals(servers.size(), 1, "There should be exactly one apache server discovered."); - + Resource server = servers.iterator().next(); - + String expectedResourceKey = ApacheServerDiscoveryComponent.formatResourceKey(testConfiguration.serverRoot, testConfiguration.serverRoot + "/conf/httpd.conf"); - + assertEquals(server.getResourceKey(), expectedResourceKey, "The server resource key doesn't seem to be upgraded."); - - Set<Resource> vhosts = setup.getFakeInventory().findResourcesByType(vhostResourceType); - + + Set<Resource> vhosts = setup.getFakeInventory().findResourcesByTypeAndStatus(vhostResourceType, InventoryStatus.COMMITTED); + String[] expectedRKs = testConfiguration.getExpectedResourceKeysAfterUpgrade(setup); - + assertEquals(vhosts.size(), expectedRKs.length, "Unexpected number of vhosts discovered found"); - + List<String> expectedResourceKeys = Arrays.asList(expectedRKs); - + for (Resource vhost : vhosts) { assertTrue(expectedResourceKeys.contains(vhost.getResourceKey()), "Unexpected virtual host resource key: '" + vhost.getResourceKey() + "'. Only expecting " + expectedResourceKeys); } - + String[] expectedFailureRKs = testConfiguration.getExpectedResourceKeysWithFailures(setup); if (expectedFailureRKs != null && expectedFailureRKs.length > 0) { Set<Resource> failingResources = new HashSet<Resource>(); - + for(String rk : expectedFailureRKs) { for(Resource r : vhosts) { if (rk.equals(r.getResourceKey())) { @@ -165,21 +166,21 @@ public class UpgradeTestBase extends PluginContainerTest { } } } - + assertEquals(failingResources.size(), expectedFailureRKs.length, "Couldn't find all the resources that should have failed."); - + for(Resource failingResource : failingResources) { List<ResourceError> errors = failingResource.getResourceErrors(ResourceErrorType.UPGRADE); assertNotNull(errors, "The main vhost doesn't have any upgrade errors."); assertEquals(errors.size(), 1, "There should be exactly one upgrade error on the main vhost."); } - + //check that all other vhosts were not upgraded but have no errors for(Resource r : vhosts) { if (failingResources.contains(r)) { continue; } - + assertEquals(r.getResourceErrors(ResourceErrorType.UPGRADE).size(), 0, "Unexpected number of resource upgrade errors on vhost " + r); } } else { @@ -213,31 +214,31 @@ public class UpgradeTestBase extends PluginContainerTest { setup.withApacheSetup().init(); ApacheServerComponent component = setup.withApacheSetup().getServerComponent(); ApacheDirectiveTree config = component.parseRuntimeConfiguration(false); - + DeploymentConfig deployConfig = setup.getDeploymentConfig(); - + VirtualHostLegacyResourceKeyUtil keyUtil = new VirtualHostLegacyResourceKeyUtil(component, config); - + Map<String, String> replacements = deployConfig.getTokenReplacements(); - + testConfig.defaultOverrides.put("main.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyMainServerResourceKey()); - - if (deployConfig.vhost1 != null) { + + if (deployConfig.vhost1 != null) { testConfig.defaultOverrides.put("vhost1.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost1.getVHostSpec(replacements))); } - + if (deployConfig.vhost2 != null) { testConfig.defaultOverrides.put("vhost2.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost2.getVHostSpec(replacements))); } - + if (deployConfig.vhost3 != null) { testConfig.defaultOverrides.put("vhost3.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost3.getVHostSpec(replacements))); } - + if (deployConfig.vhost4 != null) { testConfig.defaultOverrides.put("vhost4.rhq3.resource.key", keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost4.getVHostSpec(replacements))); } - + setup.withDefaultOverrides(testConfig.defaultOverrides); }
@@ -248,13 +249,13 @@ public class UpgradeTestBase extends PluginContainerTest { protected static String[] getVHostRKs(ApacheTestSetup setup, int[] successfulUpgrades, int[] failedUpgrades, ResourceKeyFormat rkFormat) { int sucLen = successfulUpgrades == null ? 0 : successfulUpgrades.length; int failLen = failedUpgrades == null ? 0 : failedUpgrades.length; - + String[] ret = new String[sucLen + failLen]; - + int retIdx = 0; - + Map<String, String> replacements = setup.getInventoryFileReplacements(); - + for(int i = 0; i < sucLen; ++i, ++retIdx) { int vhostNum = successfulUpgrades[i]; if (vhostNum == 0) { @@ -264,7 +265,7 @@ public class UpgradeTestBase extends PluginContainerTest { ret[retIdx] = ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(vhost.serverName, vhost.hosts); } } - + for(int i = 0; i < failLen; ++i, ++retIdx) { String variableName = null; if (failedUpgrades[i] == 0) { @@ -280,7 +281,7 @@ public class UpgradeTestBase extends PluginContainerTest { variableName = "vhost" + failedUpgrades[i] + ".rhq"; } } - + switch (rkFormat) { case RHQ3: variableName += "3.resource.key"; @@ -292,10 +293,10 @@ public class UpgradeTestBase extends PluginContainerTest { variableName += "snmp.identifier"; break; } - + ret[retIdx] = replacements.get(variableName); } - + return ret; }
@@ -305,7 +306,7 @@ public class UpgradeTestBase extends PluginContainerTest { .toURL()); PluginMetadataParser parser = new PluginMetadataParser(descriptor, Collections.<String, PluginMetadataParser> emptyMap()); - + List<ResourceType> platformTypes = parser.getAllTypes();
//this is the default container name in case of no plugin explicit plugin configuration, which we don't have. @@ -317,20 +318,20 @@ public class UpgradeTestBase extends PluginContainerTest { }
Class discoveryClass = Class.forName(parser.getDiscoveryComponentClass(rt)); - + ResourceDiscoveryComponent discoveryComponent = (ResourceDiscoveryComponent) discoveryClass.newInstance(); - + ResourceDiscoveryContext context = new ResourceDiscoveryContext(rt, null, null, SystemInfoFactory.createSystemInfo(), Collections.emptyList(), Collections.emptyList(), containerName, PluginContainerDeployment.AGENT); - + Set<DiscoveredResourceDetails> results = discoveryComponent.discoverResources(context); - + if (!results.isEmpty()) { DiscoveredResourceDetails details = results.iterator().next(); - + Resource platform = new Resource(); - + platform.setDescription(details.getResourceDescription()); platform.setResourceKey(details.getResourceKey()); platform.setName(details.getResourceName()); @@ -339,11 +340,11 @@ public class UpgradeTestBase extends PluginContainerTest { platform.setResourceType(rt); platform.setUuid(UUID.randomUUID().toString()); platform.setId(1); - + return platform; } } - + return null; }
@@ -352,12 +353,12 @@ public class UpgradeTestBase extends PluginContainerTest { if (prefix != null && !prefix.isEmpty()) { bld.append(prefix).append("."); } - + bld.append(name); - + return bld.toString(); } - + protected static InetAddress determineLocalhost() { try { return InetAddress.getLocalHost();
commit 21a5d14f5577f71245d62456ffabab7e4c647698 Author: John Mazzitelli mazz@redhat.com Date: Wed Feb 13 16:11:34 2013 -0500
append to the installer log so we don't lose any installer log messages when rhq-installer.sh is run multiple times
diff --git a/modules/enterprise/server/installer/src/main/resources/logging.properties b/modules/enterprise/server/installer/src/main/resources/logging.properties index 6a48b2b..0affd97 100644 --- a/modules/enterprise/server/installer/src/main/resources/logging.properties +++ b/modules/enterprise/server/installer/src/main/resources/logging.properties @@ -16,8 +16,9 @@ handler.CONSOLE.formatter=PATTERN # File handler configuration handler.FILE=org.jboss.logmanager.handlers.FileHandler handler.FILE.level=${rhq.server.installer.loglevel:DEBUG} -handler.FILE.properties=autoFlush,fileName +handler.FILE.properties=autoFlush,append,fileName handler.FILE.autoFlush=true +handler.FILE.append=true handler.FILE.fileName=${rhq.server.installer.logdir:.}/rhq-installer.log handler.FILE.formatter=PATTERN
commit 842814143212160f2a88f3a83b5ae71eb3a6d506 Author: Lukas Krejci lkrejci@redhat.com Date: Wed Feb 13 20:09:02 2013 +0100
Fix the expectations of the JMock-based apache plugin integration tests after the fixes in the inventory report processing that changed the workflow slightly.
This should make the apache integration tests pass again.
diff --git a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java index 17beb1e..8bc25ca 100644 --- a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java +++ b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java @@ -26,6 +26,8 @@ package org.rhq.core.pc.upgrade; import static org.testng.Assert.fail;
import java.lang.reflect.Field; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Collection; import java.util.Collections; import java.util.Comparator; @@ -52,7 +54,7 @@ import org.rhq.core.domain.resource.ResourceType; /** * This class represents a server side database store of the inventory for the purposes * of the ResourceUpgradeTest unit test. - * + * * @author Lukas Krejci */ public class FakeServerInventory { @@ -62,7 +64,7 @@ public class FakeServerInventory { private int counter; private boolean failing; private boolean failUpgrade; - + private static final Comparator<Resource> ID_COMPARATOR = new Comparator<Resource>() { public int compare(Resource o1, Resource o2) { return o1.getId() - o2.getId(); @@ -90,18 +92,18 @@ public class FakeServerInventory { fakePersist(res, InventoryStatus.COMMITTED, new HashSet<String>()); } } - + public synchronized CustomAction mergeInventoryReport(final InventoryStatus requiredInventoryStatus) { return new CustomAction("updateServerSideInventory") { public Object invoke(Invocation invocation) throws Throwable { synchronized (FakeServerInventory.this) { throwIfFailing(); - + InventoryReport inventoryReport = (InventoryReport) invocation.getParameter(0); - + for (Resource res : inventoryReport.getAddedRoots()) { Resource persisted = fakePersist(res, requiredInventoryStatus, new HashSet<String>()); - + if (res.getParentResource() == Resource.ROOT) { platform = persisted; } @@ -117,9 +119,9 @@ public class FakeServerInventory { public Object invoke(Invocation invocation) throws Throwable { synchronized (FakeServerInventory.this) { throwIfFailing(); - + platform = null; - + return getSyncInfo(); } } @@ -131,36 +133,36 @@ public class FakeServerInventory { public Object invoke(Invocation invocation) throws Throwable { synchronized(FakeServerInventory.this) { throwIfFailing(); - + ResourceError error = (ResourceError) invocation.getParameter(0); - + Resource serverSideResource = resourceStore.get(error.getResource().getUuid()); - + if (serverSideResource != null) { List<ResourceError> currentErrors = serverSideResource.getResourceErrors(); currentErrors.add(error); } - + return null; } } }; } - + public synchronized CustomAction upgradeResources() { return new CustomAction("upgradeServerSideInventory") { @SuppressWarnings({ "serial", "unchecked" }) public Object invoke(Invocation invocation) throws Throwable { synchronized(FakeServerInventory.this) { throwIfFailing(); - + if (failUpgrade) { - throw new RuntimeException("Failing the upgrade purposefully."); + throw new RuntimeException("Failing the upgrade purposefully."); } - + Set<ResourceUpgradeRequest> requests = (Set<ResourceUpgradeRequest>) invocation.getParameter(0); Set<ResourceUpgradeResponse> responses = new HashSet<ResourceUpgradeResponse>(); - + for (final ResourceUpgradeRequest request : requests) { Resource resource = findResource(platform, new Resource() { public int getId() { @@ -174,18 +176,18 @@ public class FakeServerInventory { if (request.getNewName() != null) { resource.setName(request.getNewName()); } - + if (request.getNewResourceKey() != null) { resource.setResourceKey(request.getNewResourceKey()); } - + if (request.getUpgradeErrorMessage() != null) { ResourceError error = new ResourceError(resource, ResourceErrorType.UPGRADE, request.getUpgradeErrorMessage(), request.getUpgradeErrorStackTrace(), request.getTimestamp()); resource.getResourceErrors().add(error); } - + ResourceUpgradeResponse resp = new ResourceUpgradeResponse(); resp.setResourceId(resource.getId()); resp.setUpgradedResourceName(resource.getName()); @@ -206,16 +208,33 @@ public class FakeServerInventory { public Object invoke(Invocation invocation) throws Throwable { synchronized (FakeServerInventory.this) { throwIfFailing(); - + Set<Integer> resourceIds = (Set<Integer>) invocation.getParameter(0); boolean includeDescendants = (Boolean) invocation.getParameter(1); - + return getResources(resourceIds, includeDescendants); } } }; }
+ public synchronized CustomAction getResourcesAsList() { + return new CustomAction("getResourcesAsList") { + @Override + public Object invoke(Invocation invocation) throws Throwable { + synchronized(FakeServerInventory.this) { + throwIfFailing(); + + Integer[] resourceIds = (Integer[]) invocation.getParameter(0); + + Set<Resource> resources = getResources(new LinkedHashSet<Integer>(Arrays.asList(resourceIds)), false); + + return new ArrayList<Resource>(resources); + } + } + }; + } + public synchronized boolean isFailing() { return failing; } @@ -227,11 +246,11 @@ public class FakeServerInventory { public synchronized boolean isFailUpgrade() { return failUpgrade; } - + public synchronized void setFailUpgrade(boolean failUpgrade) { this.failUpgrade = failUpgrade; } - + @SuppressWarnings("serial") public synchronized Set<Resource> findResourcesByType(final ResourceType type) { Set<Resource> result = new HashSet<Resource>(); @@ -281,7 +300,7 @@ public class FakeServerInventory { removeResource(child); } } - + private Resource fakePersist(Resource agentSideResource, InventoryStatus requiredInventoryStatus, Set<String> inProgressUUIds) { Resource persisted = resourceStore.get(agentSideResource.getUuid()); @@ -327,9 +346,9 @@ public class FakeServerInventory { //i.e. we prefer the current results from the agent but keep the children we used to //have in the past. This is the same behavior as the actual RHQ server has. childResources.addAll(persisted.getChildResources()); - + persisted.setChildResources(childResources); - + inProgressUUIds.remove(agentSideResource.getUuid());
return persisted; diff --git a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java index 9f12166..37e74d9 100644 --- a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java +++ b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java @@ -74,14 +74,14 @@ public class ApacheTestSetup { private Mockery context; private ResourceTypes apacheResourceTypes; private String testId; - + public class ApacheSetup { private String serverRoot; private String exePath; private Collection<String> configurationFiles; private ApacheExecutionUtil execution; private boolean deploy = true; - + private ApacheSetup() {
} @@ -162,16 +162,16 @@ public class ApacheTestSetup { + serverRootDir + "'.");
File logsDir = new File(serverRootDir, "logs"); - + assertTrue(logsDir.exists(), "The configured server root denotes a directory that doesn't have a 'logs' subdirectory. This is unexpected."); - + File confDir = new File(serverRootDir, "conf");
assertTrue(confDir.exists(), "The configured server root denotes a directory that doesn't have a 'conf' subdirectory. This is unexpected."); - + String confFilePath = confDir.getAbsolutePath() + File.separatorChar + "httpd.conf"; - + String snmpHost = null; int snmpPort = 0; String pingUrl = null; @@ -185,11 +185,11 @@ public class ApacheTestSetup { new File(binDir, "envvars-std")); ApacheDeploymentUtil.deployConfiguration(confDir, configurationFiles, additionalFilesToProcess, deploymentConfig); } - + //ok, now try to find the ping URL. The best thing is to actually invoke - //the same code the apache server discovery does. + //the same code the apache server discovery does. ApacheDirectiveTree tree = ApacheServerDiscoveryComponent.parseRuntimeConfiguration(confFilePath, null, ApacheBinaryInfo.getInfo(exePath, SystemInfoFactory.createSystemInfo())); - + //XXX this hardcodes apache2 as the only option we have... HttpdAddressUtility.Address addrToUse = HttpdAddressUtility.APACHE_2_x.getMainServerSampleAddress(tree, null, -1); pingUrl = addrToUse.toString(); @@ -205,7 +205,7 @@ public class ApacheTestSetup { }
private void doSetup() throws Exception { - init(); + init(); startApache(); }
@@ -228,12 +228,12 @@ public class ApacheTestSetup { return this; }
- public ApacheTestSetup withDefaultOverrides(Map<String, String> defaultOverrides) { + public ApacheTestSetup withDefaultOverrides(Map<String, String> defaultOverrides) { this.defaultOverrides = defaultOverrides == null ? new HashMap<String, String>() : defaultOverrides; deploymentConfig = ApacheDeploymentUtil.getDeploymentConfigurationFromSystemProperties(configurationName, this.defaultOverrides); return this; } - + public ApacheTestSetup withPlatformResource(Resource platform) { this.platform = platform; return this; @@ -271,7 +271,7 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDiscoveryServerService()).setResourceError(expectations.with(Expectations.any(ResourceError.class))); expectations.will(fakeInventory.setResourceError()); - + expectations.allowing(ss.getDiscoveryServerService()).mergeAvailabilityReport( expectations.with(Expectations.any(AvailabilityReport.class)));
@@ -280,7 +280,7 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDiscoveryServerService()).clearResourceConfigError( expectations.with(Expectations.any(int.class))); - + expectations.allowing(ss.getDiscoveryServerService()).setResourceEnablement( expectations.with(Expectations.any(int.class)), expectations.with(Expectations.any(boolean.class)));
@@ -289,7 +289,10 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDriftServerService()).getDriftDefinitions(expectations.with(Expectations.any(Set.class))); expectations.will(Expectations.returnValue(Collections.emptyMap())); - + + expectations.allowing(ss.getDiscoveryServerService()).getResourcesAsList(expectations.with(Expectations.any(Integer[].class))); + expectations.will(fakeInventory.getResourcesAsList()); + expectations.ignoring(ss.getBundleServerService()); expectations.ignoring(ss.getConfigurationServerService()); expectations.ignoring(ss.getContentServerService()); @@ -307,14 +310,14 @@ public class ApacheTestSetup { public DeploymentConfig getDeploymentConfig() { return deploymentConfig; } - + public ApacheTestSetup setup() throws Exception { apacheSetup.doSetup();
- Map<String, String> replacements = deploymentConfig.getTokenReplacements(); + Map<String, String> replacements = deploymentConfig.getTokenReplacements(); replacements.put("server.root", apacheSetup.serverRoot); replacements.put("exe.path", apacheSetup.exePath); - + ApacheDeploymentUtil.addDefaultVariables(replacements, null);
HttpdAddressUtility addressUtility = apacheSetup.getServerComponent() @@ -325,18 +328,18 @@ public class ApacheTestSetup { addressUtility.getHttpdInternalMainServerAddressRepresentation(runtimeConfig).toString(false, false));
replacements.put("main.rhq4.resource.key", ApacheVirtualHostServiceComponent.MAIN_SERVER_RESOURCE_KEY); - + VHostSpec vhost1 = deploymentConfig.vhost1 == null ? null : deploymentConfig.vhost1.getVHostSpec(replacements); VHostSpec vhost2 = deploymentConfig.vhost2 == null ? null : deploymentConfig.vhost2.getVHostSpec(replacements); VHostSpec vhost3 = deploymentConfig.vhost3 == null ? null : deploymentConfig.vhost3.getVHostSpec(replacements); VHostSpec vhost4 = deploymentConfig.vhost4 == null ? null : deploymentConfig.vhost4.getVHostSpec(replacements); - + if (vhost1 != null) { replacements.put( "vhost1.snmp.identifier", addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost1.hosts.get(0), vhost1.serverName).toString(false, false)); - + replacements.put( "vhost1.rhq4.resource.key", ApacheVirtualHostServiceDiscoveryComponent.createResourceKey( @@ -348,7 +351,7 @@ public class ApacheTestSetup { "vhost2.snmp.identifier", addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost2.hosts.get(0), vhost2.serverName).toString(false, false)); - + replacements.put( "vhost2.rhq4.resource.key", ApacheVirtualHostServiceDiscoveryComponent.createResourceKey( @@ -360,7 +363,7 @@ public class ApacheTestSetup { "vhost3.snmp.identifier", addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost3.hosts.get(0), vhost3.serverName).toString(false, false)); - + replacements.put( "vhost3.rhq4.resource.key", ApacheVirtualHostServiceDiscoveryComponent.createResourceKey( @@ -372,7 +375,7 @@ public class ApacheTestSetup { "vhost4.snmp.identifier", addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig, vhost4.hosts.get(0), vhost4.serverName).toString(false, false)); - + replacements.put( "vhost4.rhq4.resource.key", ApacheVirtualHostServiceDiscoveryComponent.createResourceKey( @@ -381,35 +384,35 @@ public class ApacheTestSetup {
//let the user override everything we just did replacements.putAll(defaultOverrides); - + inventoryFileReplacements = replacements; - + if (inventoryFile != null) { InputStream dataStream = getClass().getResourceAsStream(inventoryFile); - + Reader rdr = new TokenReplacingReader(new InputStreamReader(dataStream), replacements); - + @SuppressWarnings("unchecked") List<Resource> inventory = (List<Resource>) new ObjectCollectionSerializer().deserialize(rdr); - - //fix up the parent relationships, because they might not be reconstructed correctly by + + //fix up the parent relationships, because they might not be reconstructed correctly by //JAXB - we're missing XmlID and XmlIDRef annotations in our model fixupParent(null, inventory); - + fakeInventory.prepopulateInventory(platform, inventory); } return this; }
/** - * After the setup, this returns all the variables used to update the tokens in the inventory file. - * + * After the setup, this returns all the variables used to update the tokens in the inventory file. + * * @return */ public Map<String, String> getInventoryFileReplacements() { return inventoryFileReplacements; } - + private void fixupParent(Resource parent, Collection<Resource> children) { for (Resource child : children) { child.setParentResource(parent);
commit 955ef8974d5c8782c048704550ad8da395365e93 Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Feb 13 11:51:45 2013 -0500
Fix issues in mergeAvailabilityReport "repair code". This is code that attempts to fix problems in the Availability records, if they somehow get corrupted. In general, it doesn't execute. But if and when it did, it wasn't repairing things as well as it could. This makes improvements.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java index 2946d40..0181d7a 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java @@ -591,52 +591,13 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa // availability reports only tell us the current state at the start time; end time is ignored/must be null reported.setEndTime(null);
- try { - q.setParameter("resourceId", reported.getResource().getId()); - Availability latest = (Availability) q.getSingleResult(); - AvailabilityType latestType = latest.getAvailabilityType(); - AvailabilityType reportedType = reported.getAvailabilityType(); - - // If the current avail is DISABLED, and this report is not trying to re-enable the resource, - // Then ignore the reported avail. - if (AvailabilityType.DISABLED == latestType) { - if (!(mergeInfo.isEnablementReport() && (AvailabilityType.UNKNOWN == reportedType))) { - disabledAvailabilities.add(reported); - continue; - } - } - - if (reported.getStartTime() >= latest.getStartTime()) { - //log.info( "new avail (latest/reported)-->" + latest + "/" + reported ); - - // the new availability data is for a time after our last known state change - // we are run-length encoded, so only persist data if the availability changed - if (latest.getAvailabilityType() != reported.getAvailabilityType()) { - entityManager.persist(reported); - mergeInfo.incrementNumInserted(); - - latest.setEndTime(reported.getStartTime()); - latest = entityManager.merge(latest); - - updateResourceAvailability(reported); - } - - // our last known state was unknown, ask for a full report to ensure we are in sync with agent - if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) { - mergeInfo.setAskForFullReport(true); - } - } else { - //log.info( "past avail (latest/reported)==>" + latest + "/" + reported ); + // get the latest avail for the reported resource + q.setParameter("resourceId", reported.getResource().getId()); + Availability latest = null;
- // The new data is for a time in the past, probably an agent sending a report after - // a network outage has been corrected but after we have already backfilled. - // We need to insert it into our past timeline. - insertAvailability(reported); - mergeInfo.incrementNumInserted(); + try { + latest = (Availability) q.getSingleResult();
- // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent - mergeInfo.setAskForFullReport(true); - } } catch (NoResultException nre) { // This should not happen unless the Resource in the report is stale, which can happen in certain // sync scenarios. A Resource is given its initial Availability/ResourceAvailability when it is @@ -644,37 +605,47 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa // it must not exist in my utopian view of the world. Let's just make sure... Resource attachedResource = (Resource) entityManager.find(Resource.class, reported.getResource() .getId()); - if (null == attachedResource) { + + if ((null == attachedResource) || (InventoryStatus.COMMITTED != attachedResource.getInventoryStatus())) { // expected case log.info("Skipping mergeAvailabilityReport() for stale resource [" + reported.getResource() + "]. These messages should go away after the next agent synchronization with the server.");
- } else if (InventoryStatus.COMMITTED == attachedResource.getInventoryStatus()) { - // this should not happen, it means the resource exists but has no latest Availability - // record (i.e. sendTime == null). Try to correct the situation. + continue; + + } else { + // this should not really happen but is possible in rare failure situations, it means the resource + // exists but has no latest Availability record (i.e. sendTime == null). Correct the situation and + // then process the reported avail. log.warn("Resource [" + reported.getResource() + "] has no latest availability record (i.e. no endtime) - will attempt to repair.\n" + mergeInfo.toString(false)); + try { List<Availability> attachedAvails = attachedResource.getAvailability(); + Availability attachedLastAvail = null; + if (attachedAvails.isEmpty()) { - attachedResource.initCurrentAvailability(); - entityManager.merge(attachedResource); + latest = new Availability(attachedResource, 0L, AvailabilityType.UNKNOWN); + entityManager.persist(latest);
} else { - Availability attachedLastAvail = attachedAvails.get(attachedAvails.size() - 1); - attachedLastAvail.setEndTime(null); - entityManager.merge(attachedLastAvail); + latest = attachedAvails.get(attachedAvails.size() - 1); + latest.setEndTime(null); + latest = entityManager.merge(latest); }
+ updateResourceAvailability(latest); + // ask the agent for a full report so as to ensure we are in sync with agent mergeInfo.setAskForFullReport(true);
} catch (Throwable t) { - log.warn("Unable to repair latest availablity for Resource [" + reported.getResource() + "]", t); + log.warn("Unable to repair NoResult latest availablity for Resource [" + reported.getResource() + + "]", t); + continue; } } - } catch (NonUniqueResultException nure) { // This condition should never happen. In my world of la-la land, I've done everything // correctly so this never happens. But, due to the asynchronous nature of things, @@ -686,15 +657,69 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa log.warn("Resource [" + reported.getResource() + "] has multiple availabilities without an endtime [" + nure.getMessage() + "] - will attempt to remove the extra ones\n" + mergeInfo.toString(false));
- q.setParameter("resourceId", reported.getResource().getId()); - List<Availability> latest = q.getResultList(); + try { + + List<Availability> latestList = q.getResultList(); + + // delete all but the last one (our query sorts in ASC start time order) + int latestCount = latestList.size(); + for (int i = 0; i < (latestCount - 1); i++) { + entityManager.remove(latestList.get(i)); + } + + latest = latestList.get(latestCount - 1); + updateResourceAvailability(latest); + + // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent + mergeInfo.setAskForFullReport(true); + + } catch (Throwable t) { + log.warn( + "Unable to repair NonUnique Result latest availablity for Resource [" + reported.getResource() + + "]", t); + continue; + } + } + + AvailabilityType latestType = latest.getAvailabilityType(); + AvailabilityType reportedType = reported.getAvailabilityType();
- // delete all but the last one (our query sorts in ASC start time order) - int latestCount = latest.size(); - for (int i = 0; i < (latestCount - 1); i++) { - entityManager.remove(latest.get(i)); + // If the current avail is DISABLED, and this report is not trying to re-enable the resource, + // Then ignore the reported avail. + if (AvailabilityType.DISABLED == latestType) { + if (!(mergeInfo.isEnablementReport() && (AvailabilityType.UNKNOWN == reportedType))) { + disabledAvailabilities.add(reported); + continue; } - updateResourceAvailability(latest.get(latestCount - 1)); + } + + if (reported.getStartTime() >= latest.getStartTime()) { + //log.info( "new avail (latest/reported)-->" + latest + "/" + reported ); + + // the new availability data is for a time after our last known state change + // we are run-length encoded, so only persist data if the availability changed + if (latest.getAvailabilityType() != reported.getAvailabilityType()) { + entityManager.persist(reported); + mergeInfo.incrementNumInserted(); + + latest.setEndTime(reported.getStartTime()); + latest = entityManager.merge(latest); + + updateResourceAvailability(reported); + } + + // our last known state was unknown, ask for a full report to ensure we are in sync with agent + if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) { + mergeInfo.setAskForFullReport(true); + } + } else { + //log.info( "past avail (latest/reported)==>" + latest + "/" + reported ); + + // The new data is for a time in the past, probably an agent sending a report after + // a network outage has been corrected but after we have already backfilled. + // We need to insert it into our past timeline. + insertAvailability(reported); + mergeInfo.incrementNumInserted();
// this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent mergeInfo.setAskForFullReport(true);
commit ae56056671aba575d8b3c2c9064497bacfe00661 Author: Jay Shaughnessy jshaughn@redhat.com Date: Wed Feb 13 09:22:40 2013 -0500
Fix test given slight change in avail behavior. In commit c516ad09fcebcedfd1a505d6bfd434997ac6642d we stopped kicking off an immediate avail scan when new resources were discovered, simplifying the code, and approach, to just wait for the next scheduled scan, which likely occurs nearly as fast. From the test's perspective this meant one resource, the platform, had its avail change at a slightly different time.
diff --git a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java index 005e900..956fb97 100644 --- a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java +++ b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java @@ -24,13 +24,13 @@ import org.rhq.core.domain.measurement.AvailabilityType; import org.rhq.core.domain.measurement.MeasurementScheduleRequest; import org.rhq.core.domain.resource.InventoryStatus; import org.rhq.core.pc.PluginContainer; -import org.rhq.plugins.test.avail.AvailDiscoveryComponent; -import org.rhq.plugins.test.avail.AvailResourceComponent; import org.rhq.core.pc.inventory.AvailabilityExecutor; import org.rhq.core.pc.inventory.AvailabilityExecutor.Scan; import org.rhq.core.pc.inventory.ForceAvailabilityExecutor; import org.rhq.core.pc.inventory.ResourceContainer; import org.rhq.core.pluginapi.inventory.ResourceComponent; +import org.rhq.plugins.test.avail.AvailDiscoveryComponent; +import org.rhq.plugins.test.avail.AvailResourceComponent; import org.rhq.test.arquillian.AfterDiscovery; import org.rhq.test.arquillian.BeforeDiscovery; import org.rhq.test.arquillian.FakeServerInventory; @@ -184,7 +184,7 @@ public class AvailTest extends Arquillian { Assert.assertEquals(datum.getAvailabilityType(), AvailabilityType.UP, "should be UP at the start"); } AvailabilityExecutor.Scan scan = executor.getMostRecentScanHistory(); - assertScan(scan, true, true, 29, 28, 29, 28, 0, 0); + assertScan(scan, true, true, 29, 29, 29, 28, 0, 0);
// do a forced avail check again - nothing changed, so we should have an empty report report = executor.call(); @@ -514,7 +514,7 @@ public class AvailTest extends Arquillian { Assert.assertEquals(scan.getNumResources(), numResources, "Unexpected numResources, remember to include the implied platform?"); Assert.assertEquals(scan.getNumAvailabilityChanges(), numChanges, - "Unexpected numChanges, remember to omit the implied platform"); + "Unexpected numChanges, remember to include the implied platform"); Assert.assertEquals(scan.getNumGetAvailabilityCalls(), numCalls, "Unexpected numGetAvailCalls, remember to include the implied platform"); Assert.assertEquals(scan.getNumScheduledRandomly(), numSched,
commit d5acca52875c8aabcf784bf512fc63f1ebab373a Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Feb 12 17:20:00 2013 -0500
To maintain the test dep ordering, which is sometimes important, and definitel is important here, move all of the test deps to the new test.dependencies profile.
diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index d5daa17..5961627 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -35,144 +35,7 @@ </properties>
<dependencies> - <!--================ Test Deps ================ --> - - <!-- Note, the test dep ordering can be important. Maven orders the [test] classpath in the order listed in the pom. --> - <dependency> - <groupId>org.jboss.as</groupId> - <artifactId>jboss-as-dist</artifactId> - <type>zip</type> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.jboss.spec</groupId> - <artifactId>jboss-javaee-6.0</artifactId> - <version>${jboss.javaee6.spec.version}</version> - <scope>provided</scope> - <type>pom</type> - </dependency> - - <dependency> - <groupId>org.jboss.arquillian.testng</groupId> - <artifactId>arquillian-testng-container</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.jboss.shrinkwrap.resolver</groupId> - <artifactId>shrinkwrap-resolver-depchain</artifactId> - <type>pom</type> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.jboss.arquillian.protocol</groupId> - <artifactId>arquillian-protocol-servlet</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-arquillian-suite-extension</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-core-domain</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-enterprise-server</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-script-bindings</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-server-client-api</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>rhq-serverplugin-drift</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>test-utils</artifactId> - <version>${project.version}</version> - <exclusions> - <exclusion> - <groupId>org.testng</groupId> - <artifactId>testng</artifactId> - </exclusion> - </exclusions> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.rhq.helpers</groupId> - <artifactId>perftest-support</artifactId> - <version>${project.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.hibernate</groupId> - <artifactId>hibernate-entitymanager</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-module-testng</artifactId> - <version>${powermock.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.powermock</groupId> - <artifactId>powermock-api-mockito</artifactId> - <version>${powermock.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.opensymphony.quartz</groupId> - <artifactId>quartz</artifactId> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.liquibase</groupId> - <artifactId>liquibase-core</artifactId> - <version>${liquibase.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>joda-time</groupId> - <artifactId>joda-time</artifactId> - <version>2.1</version> - <scope>test</scope> - </dependency> + <!-- see the test.dependencies profile below --> </dependencies>
<build> @@ -669,46 +532,183 @@
<profiles>
- <profile> - <!-- - This profile has been created to avoid unnecessary resolution of test dependencies during a build that - does not run, compile or need tests. - More test dependencies are to be moved here if the set of sub-dependencies is complex, references project - test jars, or conflicts with changing the container version. - --> - <id>test.dependencies</id> - <activation> - <property> - <name>maven.test.skip</name> - <value>!true</value> - </property> - </activation> - - <dependencies> - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>rhq-core-client-api</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.jboss.as</groupId> - <artifactId>jboss-as-arquillian-container-managed</artifactId> - <version>${jboss.version}</version> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>rhq-core-domain</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - </dependencies> - </profile> + <profile> + <!-- This profile has been created to avoid unnecessary resolution of test dependencies during a build that does not + run, compile or need tests. There are product build dependencies on this profile, don't remove. --> + + <id>test.dependencies</id> + <activation> + <property> + <name>maven.test.skip</name> + <value>!true</value> + </property> + </activation> + + + <dependencies> + <!-- Note, the test dep ordering can be important. Maven orders the [test] classpath in the order listed in the pom. --> + + <dependency> + <groupId>org.jboss.as</groupId> + <artifactId>jboss-as-dist</artifactId> + <type>zip</type> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.spec</groupId> + <artifactId>jboss-javaee-6.0</artifactId> + <version>${jboss.javaee6.spec.version}</version> + <scope>provided</scope> + <type>pom</type> + </dependency> + + <dependency> + <groupId>org.jboss.as</groupId> + <artifactId>jboss-as-arquillian-container-managed</artifactId> + <version>${jboss.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.arquillian.testng</groupId> + <artifactId>arquillian-testng-container</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.shrinkwrap.resolver</groupId> + <artifactId>shrinkwrap-resolver-depchain</artifactId> + <type>pom</type> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.arquillian.protocol</groupId> + <artifactId>arquillian-protocol-servlet</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-arquillian-suite-extension</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-core-domain</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-core-domain</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-enterprise-server</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-script-bindings</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-server-client-api</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-serverplugin-drift</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-core-client-api</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.rhq</groupId> + <artifactId>test-utils</artifactId> + <version>${project.version}</version> + <exclusions> + <exclusion> + <groupId>org.testng</groupId> + <artifactId>testng</artifactId> + </exclusion> + </exclusions> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.rhq.helpers</groupId> + <artifactId>perftest-support</artifactId> + <version>${project.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.hibernate</groupId> + <artifactId>hibernate-entitymanager</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-module-testng</artifactId> + <version>${powermock.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.powermock</groupId> + <artifactId>powermock-api-mockito</artifactId> + <version>${powermock.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.opensymphony.quartz</groupId> + <artifactId>quartz</artifactId> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.liquibase</groupId> + <artifactId>liquibase-core</artifactId> + <version>${liquibase.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>joda-time</groupId> + <artifactId>joda-time</artifactId> + <version>2.1</version> + <scope>test</scope> + </dependency> + + </dependencies> + </profile>
<!-- If testing against oracle, override the default property settings --> <profile>
commit 0057e40c03683899f3cc454a9958aba188984d03 Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Feb 12 15:48:32 2013 -0500
Fix a transactioning issue with agent backfill. It was possible for the Agent to be marked backfilled in one transaction yet have the actual avail changes fail in a second transaction, leaving the dead agent and its children with UP avail and no longer eligible for backfill due to the flag being set.
Additionally, avoid large transactions if many agents need to be backfilled sumultaneously.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java index 29c3ad3..d01dbd0 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java @@ -192,7 +192,7 @@ public class AgentManagerBean implements AgentManagerLocal { server_bootstrap.removeDownedAgent(downedAgent.getRemoteEndpoint()); log.info("Agent with name [" + agentName + "] just went down");
- agentManager.backfillAgent(subjectManager.getOverlord(), agentName, downedAgent.getId()); + agentManager.backfillAgentInNewTransaction(subjectManager.getOverlord(), agentName, downedAgent.getId()); return; }
@@ -272,7 +272,8 @@ public class AgentManagerBean implements AgentManagerLocal { log.info("Have not heard from agent [" + record.getAgentName() + "] since [" + new Date(record.getLastAvailabilityPing()) + "]. Will be backfilled since we suspect it is down");
- agentManager.backfillAgent(subjectManager.getOverlord(), record.getAgentName(), record.getAgentId()); + agentManager.backfillAgentInNewTransaction(subjectManager.getOverlord(), record.getAgentName(), + record.getAgentId()); } }
@@ -281,7 +282,8 @@ public class AgentManagerBean implements AgentManagerLocal { return; }
- public void backfillAgent(Subject subject, String agentName, int agentId) { + @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) + public void backfillAgentInNewTransaction(Subject subject, String agentName, int agentId) { // make sure we lock out all processing of any availability reports that might come our way to avoid concurrency // problems AvailabilityReportSerializer.getSingleton().lock(agentName); @@ -299,7 +301,6 @@ public class AgentManagerBean implements AgentManagerLocal { } }
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void setAgentBackfilled(int agentId, boolean backfilled) { Query query = entityManager.createNamedQuery(Agent.QUERY_SET_AGENT_BACKFILLED); query.setParameter("agentId", agentId); diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java index 6cb50f2..842d5d8 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java @@ -45,15 +45,16 @@ import org.rhq.enterprise.server.agentclient.AgentClient; public interface AgentManagerLocal {
/** - * Call this method to set the agent down and mark it 'backfilled'. Also, sets all of its monitored resources - * to an UNKNOWN avail state since the agent is no longer reporting availability. + * Call this method to set the agent DOWN and mark it 'backfilled'. Also, sets all of its monitored resources + * to an UNKNOWN avail state since the agent is no longer reporting availability. Done in its own transaction to + * avoid large transactions if many agents are simultaneously backfilled. * * @param subject * @param agentName * @param agentId */ // This method should not be remoted. - void backfillAgent(Subject subject, String agentName, int agentId); + void backfillAgentInNewTransaction(Subject subject, String agentName, int agentId);
/** * Persists a new agent. diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java index d92cbc4..2946d40 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java @@ -749,7 +749,6 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa }
@SuppressWarnings("unchecked") - @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) public void updateAgentResourceAvailabilities(int agentId, AvailabilityType platformAvailType, AvailabilityType childAvailType) {
commit c516ad09fcebcedfd1a505d6bfd434997ac6642d Author: Jay Shaughnessy jshaughn@redhat.com Date: Tue Feb 12 12:20:13 2013 -0500
Simplify availability logic by removing the legacy assumption that an availability check may not report avail changes to the server. Previously the caller of the avail check could optionally send the report. Now avail checks will always forward the resulting report to the server (although empty reports will not actually be sent). The legacy behavior was likely due to the old always-perform-a-full-scan approach. The new behavior gives us a scalability enhancement. We no longer have to follow up on-demand avail checks (like the 'avail' prompt command or agent operation) with full reports, which can be costly for agents with large inventory.
- fix up relevant jdoc and inline comments - remove the special case code handling the legacy assumption - always pass off the resulting report to InventoryManager.handleReport() - remove the unnecessary performAvailabilityChecks() method, with the short avail check intervals it can just be replaced with a request for a full report
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java index 1e2ee9f..6747645 100644 --- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java +++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/server/discovery/DiscoveryServerService.java @@ -80,7 +80,6 @@ public interface DiscoveryServerService { * in sync. <code>true</code> should always be returned if the given availability report is already a full * report. */ - // GH: Disabled temporarily (JBNADM-2385) @Asynchronous( guaranteedDelivery = true ) @LimitedConcurrency(CONCURRENCY_LIMIT_AVAILABILITY_REPORT) boolean mergeAvailabilityReport(AvailabilityReport availabilityReport);
diff --git a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java index 684db76..7231360 100644 --- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java +++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java @@ -613,12 +613,25 @@ public class InventoryManager extends AgentService implements ContainerService, inventoryThreadPoolExecutor.submit((Callable<InventoryReport>) discoveryExecutor); }
- /** this will NOT send a availability report up to the server! */ + /** + * This method implicitly calls {@link #handleReport(AvailabilityReport)} so any report generating entries + * *will be sent to the server*. Callers should subsequently *NOT* send the report. + * + * @param changedOnlyReport + * @return The report, for inspection + */ public AvailabilityReport executeAvailabilityScanImmediately(boolean changedOnlyReport) { return executeAvailabilityScanImmediately(changedOnlyReport, false); }
- /** this will NOT send a availability report up to the server! */ + /** + * This method implicitly calls {@link #handleReport(AvailabilityReport)} so any report generating entries + * *will be sent to the server*. Callers should subsequently *NOT* send the report. + * + * @param changedOnlyReport + * @param forceChecks + * @return The report, for inspection + */ public AvailabilityReport executeAvailabilityScanImmediately(boolean changedOnlyReport, boolean forceChecks) { try { AvailabilityExecutor availExec = (forceChecks) ? new ForceAvailabilityExecutor(this) @@ -633,19 +646,11 @@ public class InventoryManager extends AgentService implements ContainerService, AvailabilityReport availabilityReport = availabilityThreadPoolExecutor.submit( (Callable<AvailabilityReport>) availExec).get();
- // because the above uses the Callable interface (on purpose), the avail executor will not - // hand the report off to the Inventory Manager for sending to the server. Because this report - // will not be sent to the server, we need to be careful because our ResourceContainers will - // still have their availabilities updated. This may mean a change in availability detected - // in the above scan will not make its way to the server. To avoid the possibility of losing - // availability status changes, we need to tell the real availability executor to send a - // full report next time it runs its periodic scan. (RHQ-1997) So, if the report contains - // any entries, request the full report. - if (!(null == availabilityReport || availabilityReport.getResourceAvailability().isEmpty())) { - this.availabilityExecutor.sendFullReportNextTime(); - } + // make sure the server is notified of any changes in availability + handleReport(availabilityReport);
return availabilityReport; + } catch (InterruptedException e) { throw new RuntimeException("Availability scan execution was interrupted", e); } catch (ExecutionException e) { @@ -1160,10 +1165,13 @@ public class InventoryManager extends AgentService implements ContainerService, (System.currentTimeMillis() - startTime))); }
- // If we synced any Resources, one or more Resource components were probably started, - // so run an avail check to report on their availabilities immediately. Also kick off - // a service scan to scan those Resources for new child Resources. Kick both tasks off + // If we synced any Resources, one or more Resource components were probably started, request a + // full avail report to make sure their availabilities are determined on the next avail run (typically + // < 30s away). A full avail report will ensure an initial avail check is performed for a resource. + // + // Also kick off a service scan to scan those Resources for new child Resources. Kick both tasks off // asynchronously. + // // Do this only if we are finished with resource upgrade because no availability checks // or discoveries can happen during upgrade. This is to ensure maximum consistency of the // inventory with the server side as well as to disallow any other server-agent traffic during @@ -1171,7 +1179,11 @@ public class InventoryManager extends AgentService implements ContainerService, // time the upgrade kicks in.. if (!isResourceUpgradeActive() && (!syncedResources.isEmpty() || !unknownResourceSyncInfos.isEmpty() || !modifiedResourceIds.isEmpty())) { - performAvailabilityChecks(true); + + // TODO: If someday this is undesirable for scalability reasons, we could probably instead call + // requestAvailabilityCheck on each unknown or modified resource. + requestFullAvailabilityReport(); + this.inventoryThreadPoolExecutor.schedule((Callable<? extends Object>) this.serviceScanExecutor, configuration.getChildResourceDiscoveryDelay(), TimeUnit.SECONDS); } @@ -2382,24 +2394,6 @@ public class InventoryManager extends AgentService implements ContainerService, return mgr; }
- /** - * Calling this method will immediately perform an availability check on all inventories resources. The availability - * checks will be made asynchronously; this method will not block. - * - * @param sendFullReport if <code>true</code>, the availability report that is sent will contain availability - * records for all resources; if <code>false</code> the report will only contain records for - * those resources whose availability changed from their last known state. - */ - private void performAvailabilityChecks(boolean sendFullReport) { - if (sendFullReport) { - availabilityExecutor.sendFullReportNextTime(); - } - - if (!availabilityThreadPoolExecutor.isShutdown()) { - availabilityThreadPoolExecutor.schedule((Runnable) availabilityExecutor, 0, TimeUnit.MILLISECONDS); - } - } - public void requestFullAvailabilityReport() { if (null != availabilityExecutor) { availabilityExecutor.sendFullReportNextTime(); diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentManagement.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentManagement.java index 1a51f43..0bce074 100644 --- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentManagement.java +++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentManagement.java @@ -249,14 +249,10 @@ public class AgentManagement implements AgentManagementMBean, MBeanRegistration AvailabilityReport report; InventoryManager inventoryManager = PluginContainer.getInstance().getInventoryManager();
- // ask for the report and tell the inventory manager to handle it. We must hand it off to IM - // because we need to send the report to the server - otherwise, the "real" availability executor - // will not send changed resources thinking someone else did. ClassLoader originalCL = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(this.getClass().getClassLoader()); report = inventoryManager.executeAvailabilityScanImmediately(changes); - inventoryManager.handleReport(report); } finally { Thread.currentThread().setContextClassLoader(originalCL); } diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java index c9b7fc7..0247389 100644 --- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java +++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java @@ -181,10 +181,7 @@ public class AvailabilityPromptCommand implements AgentPromptCommand { } }
- // we need to send the report to the server - otherwise, the "real" availability executor - // will not send changed resources thinking someone else did - out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_SENDING)); - inventoryManager.handleReport(report); + // out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_SENDING)); out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_SENT));
return;
commit c7199465b2ab8bf9cd253fdffcc278577d557a7a Author: Jirka Kremser jkremser@redhat.com Date: Tue Feb 12 17:06:56 2013 +0100
[BZĀ 902823 - Nonsense data returned as backing content of non-content-backed resources] Instead of throwing the exception, the null is returned. Now it's in compliance w/ the the method's jdoc.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java index e329d46..319319f 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java @@ -1614,11 +1614,11 @@ public class ContentManagerBean implements ContentManagerLocal, ContentManagerRe public InstalledPackage getBackingPackageForResource(Subject subject, int resourceId) { InstalledPackage result = null;
- // check if the resource is content backed + // check if the resource is content backed if not, return null Resource res = resourceManager.getResourceById(subject, resourceId); ResourceType type = res.getResourceType(); if (!ResourceCreationDataType.CONTENT.equals(type.getCreationDataType())) { - throw new UnsupportedOperationException("Resource [" + resourceId + "] is not content backed."); + return null; }
InstalledPackageCriteria criteria = new InstalledPackageCriteria();
commit da8012a65541b86ba02ed2405b983f9b6cd0cb3f Author: Jirka Kremser jkremser@redhat.com Date: Tue Feb 12 16:58:31 2013 +0100
[BZ 893802 [as7] Restart operation fails to start AS when shutdown hasn't completed when start script is invoked] I have added NPE check, because I got NPE in certain circumstances.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java index 5e3373b..dcf21d3 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java @@ -279,7 +279,8 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend
if (hostPort.isLocal) { // lets be paranoid here - while (context.getNativeProcess() != null && context.getNativeProcess().priorSnaphot().isRunning() + while (context.getNativeProcess() != null && context.getNativeProcess().priorSnaphot() != null + && context.getNativeProcess().priorSnaphot().isRunning() && count++ <= 20) { try { Thread.sleep(1000); // Wait 1s
commit bc2c090dd5f6d6a114b7d8450580d039504e7ca0 Author: Thomas Segismont tsegismo@redhat.com Date: Tue Feb 12 10:29:18 2013 +0100
Disable JMXPluginTest (Sigar getProcCredName issue)
diff --git a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java index ee172ba..b841a38 100644 --- a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java +++ b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java @@ -39,22 +39,20 @@ import java.util.HashSet; import java.util.List; import java.util.Set;
-import org.rhq.core.domain.configuration.Configuration; -import org.rhq.core.domain.resource.ResourceCategory; -import org.rhq.core.domain.resource.ResourceType; -import org.rhq.plugins.jmx.JMXDiscoveryComponent; -import org.rhq.plugins.jmx.util.JvmResourceKey; import org.testng.annotations.AfterSuite; import org.testng.annotations.BeforeSuite; import org.testng.annotations.Test;
import org.rhq.core.clientapi.server.discovery.InventoryReport; +import org.rhq.core.domain.configuration.Configuration; import org.rhq.core.domain.measurement.AvailabilityType; import org.rhq.core.domain.measurement.DataType; import org.rhq.core.domain.measurement.MeasurementData; import org.rhq.core.domain.measurement.MeasurementReport; import org.rhq.core.domain.measurement.MeasurementScheduleRequest; import org.rhq.core.domain.resource.Resource; +import org.rhq.core.domain.resource.ResourceCategory; +import org.rhq.core.domain.resource.ResourceType; import org.rhq.core.pc.PluginContainer; import org.rhq.core.pc.PluginContainerConfiguration; import org.rhq.core.pc.inventory.InventoryManager; @@ -65,6 +63,8 @@ import org.rhq.core.pc.util.InventoryPrinter; import org.rhq.core.pluginapi.inventory.ResourceComponent; import org.rhq.core.pluginapi.measurement.MeasurementFacet; import org.rhq.core.pluginapi.operation.OperationFacet; +import org.rhq.plugins.jmx.JMXDiscoveryComponent; +import org.rhq.plugins.jmx.util.JvmResourceKey;
/** * Integration test for the JMX plugin. @@ -72,6 +72,8 @@ import org.rhq.core.pluginapi.operation.OperationFacet; * @author Greg Hinkle * @author Ian Springer */ +// Disabled until we find a fix for Sigar getProcCredName issue +@Test(enabled = false) public class JMXPluginTest {
private static final int JMX_REMOTING_PORT1 = 9921; @@ -85,7 +87,7 @@ public class JMXPluginTest { private List<Process> testServerJvms = new ArrayList<Process>();
private InventoryManager inventoryManager; - + @BeforeSuite public void start() { try {
commit 8fd2a8c339f4ee9428a8af49015c447edf0ccaac Author: Stefan Negrea snegrea@redhat.com Date: Mon Feb 11 16:23:03 2013 -0600
Move few more test-jar dependencies to the test specific profile.
diff --git a/modules/enterprise/remoting/cli/pom.xml b/modules/enterprise/remoting/cli/pom.xml index 3c50a21..e6daa0f 100644 --- a/modules/enterprise/remoting/cli/pom.xml +++ b/modules/enterprise/remoting/cli/pom.xml @@ -33,14 +33,6 @@ <version>${project.version}</version> <scope>runtime</scope> </dependency> - - <dependency> - <groupId>${project.groupId}</groupId> - <artifactId>rhq-core-domain</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency>
<dependency> <groupId>commons-logging</groupId> @@ -185,6 +177,32 @@
<profiles>
+ <profile> + <!-- + This profile has been created to avoid unnecessary resolution of test dependencies during a build that + does not run, compile or need tests. + More test dependencies are to be moved here if the set of sub-dependencies is complex, references project + test jars, or conflicts with changing the container version. + --> + <id>test.dependencies</id> + <activation> + <property> + <name>maven.test.skip</name> + <value>!true</value> + </property> + </activation> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-core-domain</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <!-- NOTE: this profile HAS TO have the same activation policy as the profile with the same name in the root pom.xml of RHQ --> <profile> <id>bundle-additional-script-languages</id> diff --git a/modules/integration-tests/apache-plugin-test/pom.xml b/modules/integration-tests/apache-plugin-test/pom.xml index 4411185..e161160 100644 --- a/modules/integration-tests/apache-plugin-test/pom.xml +++ b/modules/integration-tests/apache-plugin-test/pom.xml @@ -52,15 +52,6 @@ <version>${project.version}</version> <scope>test</scope> </dependency> - - <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-core-plugin-container</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - <!-- The expected layout of the httpd zip is:
httpd-${httpd.version}-${system.type}-${system.architecture}.zip @@ -120,6 +111,35 @@ </dependency> </dependencies>
+ + <profiles> + <profile> + <!-- + This profile has been created to avoid unnecessary resolution of test dependencies during a build that + does not run, compile or need tests. + More test dependencies are to be moved here if the set of sub-dependencies is complex, references project + test jars, or conflicts with changing the container version. + --> + <id>test.dependencies</id> + <activation> + <property> + <name>maven.test.skip</name> + <value>!true</value> + </property> + </activation> + + <dependencies> + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-core-plugin-container</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + </profiles> + <build> <plugins> <!-- Integration testing voodoo to load and test this plugin diff --git a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml index b619cb2..74e563c 100644 --- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml +++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml @@ -79,20 +79,6 @@ <scope>test</scope> </dependency>
- <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-server-itests-2</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - <exclusions> - <exclusion> - <groupId>org.rhq</groupId> - <artifactId>rhq-arquillian-suite-extension</artifactId> - </exclusion> - </exclusions> - </dependency> - <!-- Arquillian --> <dependency> <groupId>org.jboss.arquillian.testng</groupId> @@ -133,6 +119,39 @@ </dependencies>
<profiles> + + <profile> + <!-- + This profile has been created to avoid unnecessary resolution of test dependencies during a build that + does not run, compile or need tests. + More test dependencies are to be moved here if the set of sub-dependencies is complex, references project + test jars, or conflicts with changing the container version. + --> + <id>test.dependencies</id> + <activation> + <property> + <name>maven.test.skip</name> + <value>!true</value> + </property> + </activation> + + <dependencies> + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-server-itests-2</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + <exclusions> + <exclusion> + <groupId>org.rhq</groupId> + <artifactId>rhq-arquillian-suite-extension</artifactId> + </exclusion> + </exclusions> + </dependency> + </dependencies> + </profile> + <profile> <id>managed-test-server</id> <activation>
commit 025f3d793338ef9dde0de59b4338a281d419f0ca Author: Stefan Negrea snegrea@redhat.com Date: Mon Feb 11 15:41:19 2013 -0600
Move more dependencies to special test profile to avoid resolution if tests are disabled.
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml index e0e88af..08cfdd4 100644 --- a/modules/enterprise/binding/pom.xml +++ b/modules/enterprise/binding/pom.xml @@ -59,14 +59,6 @@
<dependency> <groupId>${project.groupId}</groupId> - <artifactId>rhq-core-domain</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>${project.groupId}</groupId> <artifactId>rhq-enterprise-server</artifactId> <version>${project.version}</version> <type>ejb-client</type> @@ -253,6 +245,32 @@
<profiles>
+ <profile> + <!-- + This profile has been created to avoid unnecessary resolution of test dependencies during a build that + does not run, compile or need tests. + More test dependencies are to be moved here if the set of sub-dependencies is complex, references project + test jars, or conflicts with changing the container version. + --> + <id>test.dependencies</id> + <activation> + <property> + <name>maven.test.skip</name> + <value>!true</value> + </property> + </activation> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-core-domain</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <profile> <id>dev</id>
@@ -357,10 +375,10 @@ </build>
</profile> - - <!-- Profile activated explicitly by command line call, or brew property. --> - <profile> - <id>disable-tags</id> + + <!-- Profile activated explicitly by command line call, or brew property. --> + <profile> + <id>disable-tags</id> <activation> <property> <name>brew</name> diff --git a/modules/enterprise/server/itests-2/pom.xml b/modules/enterprise/server/itests-2/pom.xml index 5c0da0d..d5daa17 100644 --- a/modules/enterprise/server/itests-2/pom.xml +++ b/modules/enterprise/server/itests-2/pom.xml @@ -54,13 +54,6 @@ </dependency>
<dependency> - <groupId>org.jboss.as</groupId> - <artifactId>jboss-as-arquillian-container-managed</artifactId> - <version>${jboss.version}</version> - <scope>test</scope> - </dependency> - - <dependency> <groupId>org.jboss.arquillian.testng</groupId> <artifactId>arquillian-testng-container</artifactId> <scope>test</scope> @@ -95,14 +88,6 @@
<dependency> <groupId>org.rhq</groupId> - <artifactId>rhq-core-domain</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>org.rhq</groupId> <artifactId>rhq-enterprise-server</artifactId> <version>${project.version}</version> <scope>test</scope> @@ -130,14 +115,6 @@ </dependency>
<dependency> - <groupId>${project.groupId}</groupId> - <artifactId>rhq-core-client-api</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - - <dependency> <groupId>org.rhq</groupId> <artifactId>test-utils</artifactId> <version>${project.version}</version> @@ -691,6 +668,48 @@ </build>
<profiles> + + <profile> + <!-- + This profile has been created to avoid unnecessary resolution of test dependencies during a build that + does not run, compile or need tests. + More test dependencies are to be moved here if the set of sub-dependencies is complex, references project + test jars, or conflicts with changing the container version. + --> + <id>test.dependencies</id> + <activation> + <property> + <name>maven.test.skip</name> + <value>!true</value> + </property> + </activation> + + <dependencies> + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-core-client-api</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>org.jboss.as</groupId> + <artifactId>jboss-as-arquillian-container-managed</artifactId> + <version>${jboss.version}</version> + <scope>test</scope> + </dependency> + + <dependency> + <groupId>${project.groupId}</groupId> + <artifactId>rhq-core-domain</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + <!-- If testing against oracle, override the default property settings --> <profile> <id>itest.oracle</id>
commit 65536a1e114e28b768f142f5ef3a80ecb1a64609 Author: Jay Shaughnessy jshaughn@redhat.com Date: Mon Feb 11 12:24:33 2013 -0500
Add Criteria.getSingleResult() convenience method.
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java index 40a2092..afcff6f 100644 --- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java +++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java @@ -274,4 +274,28 @@ public abstract class Criteria implements Serializable, BaseCriteria { } return this.alias; } + + /** + * Somewhat analogous to JPA's Query.getSingleResult. Wrap a CriteriaQuery result with this method when + * expecting a single result from the fetch. If the result set has only one entry it is returned. Otherwise + * a RuntimeException is thrown, indicating whether no results, or multiple results were found. + * + * @param result + * @return + * @throws RuntimeException In not exactly one result is found. The message will include either the String + * "NoResultException" or "NonUniqueResultException", appropriately. The JPA exceptions are not used so that there + * is no dependency on a JPA implementation jar for the caller. + */ + public static <T> T getSingleResult(List<T> result) throws RuntimeException { + if (null == result || result.isEmpty()) { + throw new RuntimeException("NoResultException: Expected exactly one result but no result was found."); + } + + if (1 != result.size()) { + throw new RuntimeException( + "NonUniqueResultException: Expected exactly one result but found multiple results: " + result); + } + + return result.get(0); + } } diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java index cdccd6c..ddf29b6 100644 --- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java +++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java @@ -87,8 +87,8 @@ public class CriteriaQueryTest {
FakeEntityCriteria criteria = new FakeEntityCriteria();
- CriteriaQuery<FakeEntity, FakeEntityCriteria> query = - new CriteriaQuery<FakeEntity, FakeEntityCriteria>(criteria, queryExecutor); + CriteriaQuery<FakeEntity, FakeEntityCriteria> query = new CriteriaQuery<FakeEntity, FakeEntityCriteria>( + criteria, queryExecutor);
List<FakeEntity> actual = new ArrayList<FakeEntity>(); for (FakeEntity entity : query) { @@ -111,8 +111,8 @@ public class CriteriaQueryTest { FakeEntityCriteria criteria = new FakeEntityCriteria(); criteria.setPageControl(pc);
- CriteriaQuery<FakeEntity, FakeEntityCriteria> query = - new CriteriaQuery<FakeEntity, FakeEntityCriteria>(criteria, queryExecutor); + CriteriaQuery<FakeEntity, FakeEntityCriteria> query = new CriteriaQuery<FakeEntity, FakeEntityCriteria>( + criteria, queryExecutor);
List<FakeEntity> actual = new ArrayList<FakeEntity>(); for (FakeEntity entity : query) { @@ -122,4 +122,48 @@ public class CriteriaQueryTest { assertEquals(actual, expected); }
+ @Test + public void singleResultTest() { + // This test doesn't really fit here but I;m adding it for convenience + List<FakeEntity> result = null; + + try { + FakeEntityCriteria.getSingleResult(result); + assert false : "Should have thrown Runtime Exception"; + + } catch (RuntimeException e) { + assert e.getMessage().contains("NoResultException"); + } + + result = new ArrayList<FakeEntity>(2); + + try { + FakeEntityCriteria.getSingleResult(result); + assert false : "Should have thrown Runtime Exception"; + + } catch (RuntimeException e) { + assert e.getMessage().contains("NoResultException"); + } + + result.add(new FakeEntity(1)); + + try { + FakeEntity r = FakeEntityCriteria.getSingleResult(result); + assert r.getId() == 1 : "Should have retuned expected entity but returned: " + r; + + } catch (Throwable t) { + assert false : "Should have returned single result"; + } + + result.add(new FakeEntity(2)); + + try { + FakeEntityCriteria.getSingleResult(result); + assert false : "Should have thrown Runtime Exception"; + + } catch (RuntimeException e) { + assert e.getMessage().contains("NonUniqueResultException"); + } + } + }
commit f59ff0205726f31fcf08911d3f4acf1661e2638a Author: Stefan Negrea snegrea@redhat.com Date: Mon Feb 11 08:29:18 2013 -0600
Move test jar dependency to test specific profile.
diff --git a/modules/enterprise/server/jar/pom.xml b/modules/enterprise/server/jar/pom.xml index 88a6e82..2eb3668 100644 --- a/modules/enterprise/server/jar/pom.xml +++ b/modules/enterprise/server/jar/pom.xml @@ -138,16 +138,7 @@ </exclusions> </dependency>
- <dependency> - <groupId>org.rhq</groupId> - <artifactId>rhq-core-domain</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - - - <!-- 3rd Party Deps --> + <!-- 3rd Party Deps -->
<!-- do we really need this version, for now use the version provided by AS7, declare just below --> <dependency> @@ -647,6 +638,32 @@ <profiles>
<profile> + <!-- + This profile has been created to avoid unnecessary resolution of test dependencies during a build that + does not run, compile or need tests. + More test dependencies are to be moved here if the set of sub-dependencies is complex, references project + test jars, or conflicts with changing the container version. + --> + <id>test.dependencies</id> + <activation> + <property> + <name>maven.test.skip</name> + <value>!true</value> + </property> + </activation> + + <dependencies> + <dependency> + <groupId>org.rhq</groupId> + <artifactId>rhq-core-domain</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + + <profile> <!-- only if we are not running an individual set of tests via -Dtest do we do this --> <id>no-individual-test</id> <activation>
commit 69c6ff1dea4473aef4d281137cc888ae0704c2b0 Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Feb 8 21:52:50 2013 -0500
Scalability work to chunk processing of availability reports. Start outside of a transaction and execute one transaction per chunk.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java index 31f1040..d92cbc4 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java @@ -28,7 +28,6 @@ import javax.ejb.Stateless; import javax.ejb.TransactionAttribute; import javax.ejb.TransactionAttributeType; import javax.persistence.EntityManager; -import javax.persistence.FlushModeType; import javax.persistence.NoResultException; import javax.persistence.NonUniqueResultException; import javax.persistence.PersistenceContext; @@ -78,6 +77,19 @@ import org.rhq.enterprise.server.util.CriteriaQueryRunner; public class AvailabilityManagerBean implements AvailabilityManagerLocal, AvailabilityManagerRemote { private final Log log = LogFactory.getLog(AvailabilityManagerBean.class);
+ static private final int MERGE_BATCH_SIZE; + + static { + + int mergeBatchSize = 200; + try { + mergeBatchSize = Integer.parseInt(System.getProperty("rhq.server.availability.merge.batch.size", "200")); + } catch (Throwable t) { + // + } + MERGE_BATCH_SIZE = mergeBatchSize; + } + @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME) private EntityManager entityManager;
@@ -449,6 +461,7 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa }
@SuppressWarnings("unchecked") + @TransactionAttribute(TransactionAttributeType.NEVER) public boolean mergeAvailabilityReport(AvailabilityReport report) { int reportSize = report.getResourceAvailability().size(); String agentName = report.getAgentName(); @@ -472,158 +485,220 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa .getAvailabilityType())); }
- // We will alert only on the avails for enabled resources. Keep track of any that are disabled. - List<Availability> disabledAvailabilities = new ArrayList<Availability>(); - - boolean askForFullReport = false; Integer agentToUpdate = agentManager.getAgentIdByName(agentName);
- // if this report is from an agent update the lastAvailreport time + // if this report is from an agent update the lastAvailReport time if (!report.isEnablementReport() && agentToUpdate != null) { - // do this now, before we might clear() the entity manager - availabilityManager.updateLastAvailabilityReport(agentToUpdate.intValue()); + availabilityManager.updateLastAvailabilityReportInNewTransaction(agentToUpdate.intValue()); }
- int numInserted = 0; + MergeInfo mergeInfo = new MergeInfo(report);
// if this report is from an agent, and is a changes-only report, and the agent appears backfilled, - // then we need to skip this report so as not to waste our time> Then, immediately request and process + // then we need to skip this report so as not to waste our time. Then, immediately request and process // a full report because, obviously, the agent is no longer down but the server thinks // it still is down - we need to know the availabilities for all the resources on that agent if (!report.isEnablementReport() && report.isChangesOnlyReport() && agentManager.isAgentBackfilled(agentToUpdate.intValue())) { - askForFullReport = true; + + mergeInfo.setAskForFullReport(true);
} else { - Query q = entityManager.createNamedQuery(Availability.FIND_CURRENT_BY_RESOURCE); - q.setFlushMode(FlushModeType.COMMIT); + // process the report in batches to avoid an overly long transaction and to potentially increase the + // speed in which an avail change becomes visible. + + while (!availabilities.isEmpty()) { + int size = availabilities.size(); + int end = (MERGE_BATCH_SIZE < size) ? MERGE_BATCH_SIZE : size;
- int count = 0; - for (Availability reported : availabilities) { - if ((++count % 100) == 0) { - entityManager.flush(); - entityManager.clear(); + List<Availability> availBatch = availabilities.subList(0, end); + availabilityManager.mergeAvailabilitiesInNewTransaction(availBatch, mergeInfo); + + // Advance our progress and possibly help GC. This will remove the processed avails from the backing list + availBatch.clear(); + } + + MeasurementMonitor.getMBean().incrementAvailabilityReports(report.isChangesOnlyReport()); + MeasurementMonitor.getMBean().incrementAvailabilitiesInserted(mergeInfo.getNumInserted()); + MeasurementMonitor.getMBean().incrementAvailabilityInsertTime(watch.getElapsed()); + watch.reset(); + } + + if (!report.isEnablementReport()) { + if (agentToUpdate != null) { + // don't bother asking for a full report if the one we are currently processing is already full + if (mergeInfo.isAskForFullReport() && report.isChangesOnlyReport()) { + log.debug("The server is unsure that it has up-to-date availabilities for agent [" + agentName + + "]; asking for a full report to be sent"); + return false; } + } else { + log.error("Could not figure out which agent sent availability report. " + + "This error is harmless and should stop appearing after a short while if the platform of the agent [" + + agentName + "] was recently removed. In any other case this is a bug." + report); + } + }
- // availability reports only tell us the current state at the start time; end time is ignored/must be null - reported.setEndTime(null); - - try { - q.setParameter("resourceId", reported.getResource().getId()); - Availability latest = (Availability) q.getSingleResult(); - AvailabilityType latestType = latest.getAvailabilityType(); - AvailabilityType reportedType = reported.getAvailabilityType(); - - // If the current avail is DISABLED, and this report is not trying to re-enable the resource, - // Then ignore the reported avail. - if (AvailabilityType.DISABLED == latestType) { - if (!(report.isEnablementReport() && (AvailabilityType.UNKNOWN == reportedType))) { - disabledAvailabilities.add(reported); - continue; - } - } + return true; // everything is OK and things look to be in sync + }
- if (reported.getStartTime() >= latest.getStartTime()) { - //log.info( "new avail (latest/reported)-->" + latest + "/" + reported ); + static class MergeInfo { + private AvailabilityReport report; + private int numInserted = 0; + private boolean askForFullReport = false;
- // the new availability data is for a time after our last known state change - // we are runlength encoded, so only persist data if the availability changed - if (latest.getAvailabilityType() != reported.getAvailabilityType()) { - entityManager.persist(reported); - numInserted++; + public MergeInfo(AvailabilityReport report) { + super(); + this.report = report; + }
- latest.setEndTime(reported.getStartTime()); - latest = entityManager.merge(latest); + public int getNumInserted() { + return numInserted; + }
- updateResourceAvailability(reported); - } + public void incrementNumInserted() { + ++this.numInserted; + }
- // our last known state was unknown, ask for a full report to ensure we are in sync with agent - if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) { - askForFullReport = true; - } - } else { - //log.info( "past avail (latest/reported)==>" + latest + "/" + reported ); + public boolean isAskForFullReport() { + return askForFullReport; + }
- // The new data is for a time in the past, probably an agent sending a report after - // a network outage has been corrected but after we have already backfilled. - // We need to insert it into our past timeline. - insertAvailability(reported); - numInserted++; + public void setAskForFullReport(boolean askForFullReport) { + this.askForFullReport = askForFullReport; + }
- // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent - askForFullReport = true; + public boolean isEnablementReport() { + return report.isEnablementReport(); + } + + public String toString(boolean includeAll) { + return report.toString(includeAll); + } + } + + @Override + @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) + public void mergeAvailabilitiesInNewTransaction(List<Availability> availabilities, MergeInfo mergeInfo) { + + // We will alert only on the avails for enabled resources. Keep track of any that are disabled. + List<Availability> disabledAvailabilities = new ArrayList<Availability>(); + Query q = entityManager.createNamedQuery(Availability.FIND_CURRENT_BY_RESOURCE); + int count = 0; + + for (Availability reported : availabilities) { + + // availability reports only tell us the current state at the start time; end time is ignored/must be null + reported.setEndTime(null); + + try { + q.setParameter("resourceId", reported.getResource().getId()); + Availability latest = (Availability) q.getSingleResult(); + AvailabilityType latestType = latest.getAvailabilityType(); + AvailabilityType reportedType = reported.getAvailabilityType(); + + // If the current avail is DISABLED, and this report is not trying to re-enable the resource, + // Then ignore the reported avail. + if (AvailabilityType.DISABLED == latestType) { + if (!(mergeInfo.isEnablementReport() && (AvailabilityType.UNKNOWN == reportedType))) { + disabledAvailabilities.add(reported); + continue; } - } catch (NoResultException nre) { - // This should not happen unless the Resource in the report is stale, which can happen in certain - // sync scenarios. A Resource is given its initial Availability/ResourceAvailability when it is - // persisted so it is guaranteed to have Availability, so, the Resource must not exist. At least - // it must not exist in my utopian view of the world. Let's just make sure... - Resource attachedResource = (Resource) entityManager.find(Resource.class, reported.getResource() - .getId()); - if (null == attachedResource) { - // expected case - log.info("Skipping mergeAvailabilityReport() for stale resource [" + reported.getResource() - + "]. These messages should go away after the next agent synchronization with the server."); - - } else if (InventoryStatus.COMMITTED == attachedResource.getInventoryStatus()) { - // this should not happen, it means the resource exists but has no latest Availability - // record (i.e. sendTime == null). Try to correct the situation. - log.warn("Resource [" + reported.getResource() - + "] has no latest availability record (i.e. no endtime) - will attempt to repair.\n" - + report.toString(false)); - try { - List<Availability> attachedAvails = attachedResource.getAvailability(); - if (attachedAvails.isEmpty()) { - attachedResource.initCurrentAvailability(); - entityManager.merge(attachedResource); - - } else { - Availability attachedLastAvail = attachedAvails.get(attachedAvails.size() - 1); - attachedLastAvail.setEndTime(null); - entityManager.merge(attachedLastAvail); - } - - // ask the agent for a full report so as to ensure we are in sync with agent - askForFullReport = true; - - } catch (Throwable t) { - log.warn("Unable to repair latest availablity for Resource [" + reported.getResource() - + "]", t); - } + } + + if (reported.getStartTime() >= latest.getStartTime()) { + //log.info( "new avail (latest/reported)-->" + latest + "/" + reported ); + + // the new availability data is for a time after our last known state change + // we are run-length encoded, so only persist data if the availability changed + if (latest.getAvailabilityType() != reported.getAvailabilityType()) { + entityManager.persist(reported); + mergeInfo.incrementNumInserted(); + + latest.setEndTime(reported.getStartTime()); + latest = entityManager.merge(latest); + + updateResourceAvailability(reported); }
- } catch (NonUniqueResultException nure) { - // This condition should never happen. In my world of la-la land, I've done everything - // correctly so this never happens. But, due to the asynchronous nature of things, - // I have to believe that this still might happen (albeit rarely). If it does happen, - // and we do nothing about it - bad things arise. So, if we find that a resource - // has 2 or more availabilities with endTime of null, we need to delete all but the - // latest one (the one whose start time is the latest). This should correct the - // problem and allow us to continue processing availability reports for that resource + // our last known state was unknown, ask for a full report to ensure we are in sync with agent + if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) { + mergeInfo.setAskForFullReport(true); + } + } else { + //log.info( "past avail (latest/reported)==>" + latest + "/" + reported ); + + // The new data is for a time in the past, probably an agent sending a report after + // a network outage has been corrected but after we have already backfilled. + // We need to insert it into our past timeline. + insertAvailability(reported); + mergeInfo.incrementNumInserted(); + + // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent + mergeInfo.setAskForFullReport(true); + } + } catch (NoResultException nre) { + // This should not happen unless the Resource in the report is stale, which can happen in certain + // sync scenarios. A Resource is given its initial Availability/ResourceAvailability when it is + // persisted so it is guaranteed to have Availability, so, the Resource must not exist. At least + // it must not exist in my utopian view of the world. Let's just make sure... + Resource attachedResource = (Resource) entityManager.find(Resource.class, reported.getResource() + .getId()); + if (null == attachedResource) { + // expected case + log.info("Skipping mergeAvailabilityReport() for stale resource [" + reported.getResource() + + "]. These messages should go away after the next agent synchronization with the server."); + + } else if (InventoryStatus.COMMITTED == attachedResource.getInventoryStatus()) { + // this should not happen, it means the resource exists but has no latest Availability + // record (i.e. sendTime == null). Try to correct the situation. log.warn("Resource [" + reported.getResource() - + "] has multiple availabilities without an endtime [" + nure.getMessage() - + "] - will attempt to remove the extra ones\n" + report.toString(false)); + + "] has no latest availability record (i.e. no endtime) - will attempt to repair.\n" + + mergeInfo.toString(false)); + try { + List<Availability> attachedAvails = attachedResource.getAvailability(); + if (attachedAvails.isEmpty()) { + attachedResource.initCurrentAvailability(); + entityManager.merge(attachedResource); + + } else { + Availability attachedLastAvail = attachedAvails.get(attachedAvails.size() - 1); + attachedLastAvail.setEndTime(null); + entityManager.merge(attachedLastAvail); + }
- q.setParameter("resourceId", reported.getResource().getId()); - List<Availability> latest = q.getResultList(); + // ask the agent for a full report so as to ensure we are in sync with agent + mergeInfo.setAskForFullReport(true);
- // delete all but the last one (our query sorts in ASC start time order) - int latestCount = latest.size(); - for (int i = 0; i < (latestCount - 1); i++) { - entityManager.remove(latest.get(i)); + } catch (Throwable t) { + log.warn("Unable to repair latest availablity for Resource [" + reported.getResource() + "]", t); } - updateResourceAvailability(latest.get(latestCount - 1)); + }
- // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent - askForFullReport = true; + } catch (NonUniqueResultException nure) { + // This condition should never happen. In my world of la-la land, I've done everything + // correctly so this never happens. But, due to the asynchronous nature of things, + // I have to believe that this still might happen (albeit rarely). If it does happen, + // and we do nothing about it - bad things arise. So, if we find that a resource + // has 2 or more availabilities with endTime of null, we need to delete all but the + // latest one (the one whose start time is the latest). This should correct the + // problem and allow us to continue processing availability reports for that resource + log.warn("Resource [" + reported.getResource() + "] has multiple availabilities without an endtime [" + + nure.getMessage() + "] - will attempt to remove the extra ones\n" + mergeInfo.toString(false)); + + q.setParameter("resourceId", reported.getResource().getId()); + List<Availability> latest = q.getResultList(); + + // delete all but the last one (our query sorts in ASC start time order) + int latestCount = latest.size(); + for (int i = 0; i < (latestCount - 1); i++) { + entityManager.remove(latest.get(i)); } - } + updateResourceAvailability(latest.get(latestCount - 1));
- MeasurementMonitor.getMBean().incrementAvailabilityReports(report.isChangesOnlyReport()); - MeasurementMonitor.getMBean().incrementAvailabilitiesInserted(numInserted); - MeasurementMonitor.getMBean().incrementAvailabilityInsertTime(watch.getElapsed()); - watch.reset(); + // this is an unusual report - ask the agent for a full report so as to ensure we are in sync with agent + mergeInfo.setAskForFullReport(true); + } }
// notify alert condition cache manager for all reported avails for for enabled resources @@ -631,23 +706,7 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa notifyAlertConditionCacheManager("mergeAvailabilityReport", availabilities.toArray(new Availability[availabilities.size()]));
- if (!report.isEnablementReport()) { - // a single report comes from a single agent - update the agent's last availability report timestamp - if (agentToUpdate != null) { - // don't bother asking for a full report if the one we are currently processing is already full - if (askForFullReport && report.isChangesOnlyReport()) { - log.debug("The server is unsure that it has up-to-date availabilities for agent [" + agentName - + "]; asking for a full report to be sent"); - return false; - } - } else { - log.error("Could not figure out which agent sent availability report. " - + "This error is harmless and should stop appearing after a short while if the platform of the agent [" - + agentName + "] was recently removed. In any other case this is a bug." + report); - } - } - - return true; // everything is OK and things look to be in sync + return; }
private void updateResourceAvailability(Availability reported) { @@ -670,7 +729,7 @@ public class AvailabilityManagerBean implements AvailabilityManagerLocal, Availa }
@TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) - public void updateLastAvailabilityReport(int agentId) { + public void updateLastAvailabilityReportInNewTransaction(int agentId) { // should we catch exceptions here, or allow them to bubble up and be caught?
/* diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java index 5d9a5fd..ed15c17 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerLocal.java @@ -27,6 +27,7 @@ import org.rhq.core.domain.auth.Subject; import org.rhq.core.domain.discovery.AvailabilityReport; import org.rhq.core.domain.measurement.Availability; import org.rhq.core.domain.measurement.AvailabilityType; +import org.rhq.enterprise.server.measurement.AvailabilityManagerBean.MergeInfo;
/** * Manager that is used to determine a resource's availability over a span of time. @@ -125,12 +126,19 @@ public interface AvailabilityManagerLocal extends AvailabilityManagerRemote { boolean mergeAvailabilityReport(AvailabilityReport report);
/** + * Internal use only. Used only for transactional processing purposes. + * @param availabilities + * @param mergeInfo + */ + void mergeAvailabilitiesInNewTransaction(List<Availability> availabilities, MergeInfo mergeInfo); + + /** * Executing this method will update the given agent's lastAvailabilityReport time * in a new transaction * * @param agentId the id of the agent */ - void updateLastAvailabilityReport(int agentId); + void updateLastAvailabilityReportInNewTransaction(int agentId);
/** * Update availabilities for all resources managed by the given agent to the given availability type (which may be diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java index 0a87342..384a432 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java @@ -2664,12 +2664,39 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage }
@Override + @TransactionAttribute(TransactionAttributeType.NEVER) public List<Integer> disableResources(Subject subject, int[] resourceIds) { + List<Integer> disableResourceIds = new ArrayList<Integer>(); + + // one report for each agent, keyed by agent name + Map<Agent, AvailabilityReport> reports = resourceManager.getDisableResourcesReportInNewTransaction(subject, + resourceIds, disableResourceIds); + + // Set the resources disabled via the standard mergeInventoryReport mechanism, from the server service + // level. We do this for a few reasons: + // - The server service uses locking to ensure we don't conflict with an actual report from the agent + // - It ensure all necessary db modifications take place, like avail history and current avail + // - It ensures that all ancillary avail change logic, like alerting, still happens. + DiscoveryServerServiceImpl service = new DiscoveryServerServiceImpl(); + for (AvailabilityReport report : reports.values()) { + service.mergeAvailabilityReport(report); + } + + return disableResourceIds; + } + + @Override + @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) + public Map<Agent, AvailabilityReport> getDisableResourcesReportInNewTransaction(Subject subject, int[] resourceIds, + List<Integer> disableResourceIds) { + // one report for each agent Map<Agent, AvailabilityReport> reports = new HashMap<Agent, AvailabilityReport>(); long now = System.currentTimeMillis();
+ boolean isInventoryManager = authorizationManager.isInventoryManager(subject); + for (Integer resourceId : resourceIds) { if (disableResourceIds.contains(resourceId)) { continue; @@ -2678,7 +2705,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage // make sure the user is authorized to disable this resource (which implies you can disable all its children) // TODO: this may require its own permission, but until someone needs it we'll piggyback on DELETE, at least // that gives a resource-level permission option. - if (!authorizationManager.hasResourcePermission(subject, Permission.DELETE_RESOURCE, resourceId)) { + if (!isInventoryManager + && !authorizationManager.hasResourcePermission(subject, Permission.DELETE_RESOURCE, resourceId)) { throw new PermissionException("You do not have permission to disable resource [" + resourceId + "]"); }
@@ -2717,17 +2745,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage } }
- // Set the resources disabled via the standard mergeInventoryReport mechanism, from the server service - // level. We do this for a few reasons: - // - The server service uses locking to ensure we don't conflict with an actual report from the agent - // - It ensure all necessary db modifications take place, like avail history and current avail - // - It ensures that all ancillary avail change logic, like alerting, still happens. - DiscoveryServerServiceImpl service = new DiscoveryServerServiceImpl(); - for (AvailabilityReport report : reports.values()) { - service.mergeAvailabilityReport(report); - } - - return disableResourceIds; + return reports; }
private List<Integer> getFamily(Resource resource) { @@ -2742,12 +2760,56 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage }
@Override + @TransactionAttribute(TransactionAttributeType.NEVER) public List<Integer> enableResources(Subject subject, int[] resourceIds) { + List<Integer> enableResourceIds = new ArrayList<Integer>(); + + // one report for each agent, keyed by agent name + Map<Agent, AvailabilityReport> reports = resourceManager.getEnableResourcesReportInNewTransaction(subject, + resourceIds, enableResourceIds); + + // Set the resources disabled via the standard mergeInventoryReport mechanism, from the server service + // level. We do this for a few reasons: + // - The server service uses locking to ensure we don't conflict with an actual report from the agent + // - It ensure all necessary db modifications take place, like avail history and current avail + // - It ensures that all ancillary avail change logic, like alerting, still happens. + DiscoveryServerServiceImpl service = new DiscoveryServerServiceImpl(); + for (AvailabilityReport report : reports.values()) { + service.mergeAvailabilityReport(report); + } + + // On a best effort basic, ask the relevant agents that their next avail report be full, so that we get + // the current avail type for the newly enabled resources. If we can't contact the agent don't worry about + // it; if it's down we'll get a full report when it comes up. + // TODO: This may need to be made out of band if perf becomes an issue. + for (Agent agent : reports.keySet()) { + try { + AgentClient agentClient = agentManager.getAgentClient(agent); + agentClient.getDiscoveryAgentService().requestFullAvailabilityReport(); + } catch (Throwable t) { + if (log.isDebugEnabled()) { + log.debug("Failed to notify Agent [" + + agent + + "] of enabled resources. The agent is likely down. This is ok, the avails will be updated when the agent is restarted or prompt command 'avail --force is executed'."); + } + } + } + + return enableResourceIds; + } + + @Override + @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW) + public Map<Agent, AvailabilityReport> getEnableResourcesReportInNewTransaction(Subject subject, int[] resourceIds, + List<Integer> enableResourceIds) { + // one report for each agent, keyed by agent name Map<Agent, AvailabilityReport> reports = new HashMap<Agent, AvailabilityReport>(); long now = System.currentTimeMillis();
+ boolean isInventoryManager = authorizationManager.isInventoryManager(subject); + for (Integer resourceId : resourceIds) { if (enableResourceIds.contains(resourceId)) { continue; @@ -2756,7 +2818,8 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage // make sure the user is authorized to enable this resource (which implies you can enable all its children) // TODO: this may require its own permission, but until someone needs it we'll piggyback on DELETE, at least // that gives a resource-level permission option. - if (!authorizationManager.hasResourcePermission(subject, Permission.DELETE_RESOURCE, resourceId)) { + if (!isInventoryManager + && !authorizationManager.hasResourcePermission(subject, Permission.DELETE_RESOURCE, resourceId)) { throw new PermissionException("You do not have permission to enable resource [" + resourceId + "]"); }
@@ -2794,33 +2857,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage } }
- // Set the resources disabled via the standard mergeInventoryReport mechanism, from the server service - // level. We do this for a few reasons: - // - The server service uses locking to ensure we don't conflict with an actual report from the agent - // - It ensure all necessary db modifications take place, like avail history and current avail - // - It ensures that all ancillary avail change logic, like alerting, still happens. - DiscoveryServerServiceImpl service = new DiscoveryServerServiceImpl(); - for (AvailabilityReport report : reports.values()) { - service.mergeAvailabilityReport(report); - } - - // On a best effort basic, ask the relevant agents that their next avail report be full, so that we get - // the current avail type for the newly enabled resources. If we can't contact the agent don't worry about - // it; if it's down we'll get a full report when it comes up. - // TODO: This may need to be made out of band if perf becomes an issue. - for (Agent agent : reports.keySet()) { - try { - AgentClient agentClient = agentManager.getAgentClient(agent); - agentClient.getDiscoveryAgentService().requestFullAvailabilityReport(); - } catch (Throwable t) { - if (log.isDebugEnabled()) { - log.debug("Failed to notify Agent [" - + agent - + "] of enabled resources. The agent is likely down. This is ok, the avails will be updated when the agent is restarted or prompt command 'avail --force is executed'."); - } - } - } - - return enableResourceIds; + return reports; } + } diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java index 80bfee7..b4c90f2 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerLocal.java @@ -28,6 +28,7 @@ import org.jetbrains.annotations.Nullable;
import org.rhq.core.domain.auth.Subject; import org.rhq.core.domain.criteria.ResourceCriteria; +import org.rhq.core.domain.discovery.AvailabilityReport; import org.rhq.core.domain.measurement.ResourceAvailability; import org.rhq.core.domain.resource.Agent; import org.rhq.core.domain.resource.InventoryStatus; @@ -206,8 +207,8 @@ public interface ResourceManagerLocal { * @return the resource, or null if no such resource exists */ @Nullable - Resource getResourceByParentAndKey(Subject user, @Nullable Resource parent, String key, String plugin, - String typeName); + Resource getResourceByParentAndKey(Subject user, @Nullable + Resource parent, String key, String plugin, String typeName);
PageList<Resource> findResourceByParentAndInventoryStatus(Subject user, Resource parent, InventoryStatus status, PageControl pageControl); @@ -478,6 +479,12 @@ public interface ResourceManagerLocal { List<Resource> findResourcesByCriteriaBounded(Subject subject, ResourceCriteria criteria, int maxResources, int maxResourcesByType);
+ Map<Agent, AvailabilityReport> getDisableResourcesReportInNewTransaction(Subject subject, int[] resourceIds, + List<Integer> disableResourceIds); + + Map<Agent, AvailabilityReport> getEnableResourcesReportInNewTransaction(Subject subject, int[] resourceIds, + List<Integer> enableResourceIds); + // !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! // // The following are shared with the Remote Interface
commit e7990be973b7c3ca524a0bd41eb83e69c831344e Author: John Mazzitelli mazz@redhat.com Date: Fri Feb 8 15:13:05 2013 -0500
provide a --quiet option to avail prompt command
diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java index f25f62b..57f427c 100644 --- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java +++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/i18n/AgentI18NResourceKeys.java @@ -2076,7 +2076,7 @@ public interface AgentI18NResourceKeys { @I18NMessage("avail") String AVAILABILITY = "PromptCommand.availability";
- @I18NMessage("avail [--changed] [--force] [--verbose]") + @I18NMessage("avail [--changed] [--force] [--verbose|--quiet]") String AVAILABILITY_SYNTAX = "PromptCommand.availability.syntax";
@I18NMessage("Get availability of inventoried resources") @@ -2092,7 +2092,8 @@ public interface AgentI18NResourceKeys { + "\ for only those resources whose status changed.\n\\n" + "\ -f, --force : if specified, the report will force availability\n\\n" + "\ checks for all resources.\n\\n" - + "\ -v, --verbose : if true, additional information is displayed.") + + "\ -v, --verbose : if specified, additional resource information is displayed.\n\\n" + + "\ -q, --quiet : if specified, don't show individual resource information.") String AVAILABILITY_DETAILED_HELP = "PromptCommand.availability.detailed-help";
@I18NMessage("The agent/plugin container must be started to get availability data.\n\\n" diff --git a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java index 6dcc49d..c9b7fc7 100644 --- a/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java +++ b/modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/promptcmd/AvailabilityPromptCommand.java @@ -88,11 +88,13 @@ public class AvailabilityPromptCommand implements AgentPromptCommand { PrintWriter out = agent.getOut(); boolean changedOnly = false; boolean verbose = false; + boolean quiet = false; boolean force = false;
- String sopts = "-cvf"; + String sopts = "-cvqf"; LongOpt[] lopts = { new LongOpt("changed", LongOpt.NO_ARGUMENT, null, 'c'), new LongOpt("verbose", LongOpt.NO_ARGUMENT, null, 'v'), + new LongOpt("quiet", LongOpt.NO_ARGUMENT, null, 'q'), new LongOpt("force", LongOpt.NO_ARGUMENT, null, 'f') };
Getopt getopt = new Getopt(getPromptCommandString(), args, sopts, lopts); @@ -117,6 +119,11 @@ public class AvailabilityPromptCommand implements AgentPromptCommand { break; }
+ case 'q': { + quiet = true; + break; + } + case 'f': { force = true; break; @@ -158,17 +165,19 @@ public class AvailabilityPromptCommand implements AgentPromptCommand { return; }
- for (AvailabilityReport.Datum datum : availabilities) { - // lookup the heavy-weight resource object - int resourceId = datum.getResourceId(); - Resource resource = inventoryManager.getResourceContainer(resourceId).getResource(); - - if (verbose) { - out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_RESOURCE_VERBOSE, - datum.getAvailabilityType(), resource.getName(), resource.getId(), resource.getResourceKey())); - } else { - out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_RESOURCE, datum.getAvailabilityType(), - resource.getName())); + if (!quiet) { + for (AvailabilityReport.Datum datum : availabilities) { + // lookup the heavy-weight resource object + int resourceId = datum.getResourceId(); + Resource resource = inventoryManager.getResourceContainer(resourceId).getResource(); + + if (verbose) { + out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_RESOURCE_VERBOSE, + datum.getAvailabilityType(), resource.getName(), resource.getId(), resource.getResourceKey())); + } else { + out.println(MSG.getMsg(AgentI18NResourceKeys.AVAILABILITY_REPORT_RESOURCE, + datum.getAvailabilityType(), resource.getName())); + } } }
commit 43893d0b4e4fd58e074fa8819fe69f4404aeca5d Author: Stefan Negrea snegrea@redhat.com Date: Fri Feb 8 10:00:41 2013 -0600
Move test-jar dependencies to the special test profile.
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml index 7d795f7..3eec8ad 100644 --- a/modules/core/domain/pom.xml +++ b/modules/core/domain/pom.xml @@ -525,10 +525,10 @@ <profiles> <profile> <!-- - This profile has been created to avoid unnecessary resolution of test dependencies during a build that - does not run, compile or need tests. - More test dependencies are to be moved here if the set of sub-dependencies is complex or conflicts - with changing the container version. + This profile has been created to avoid unnecessary resolution of test dependencies during a build that + does not run, compile or need tests. + More test dependencies are to be moved here if the set of sub-dependencies is complex, references project + test jars, or conflicts with changing the container version. --> <id>test.dependencies</id> <activation> diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml index e6fbe33..73947ae 100644 --- a/modules/plugins/pom.xml +++ b/modules/plugins/pom.xml @@ -48,14 +48,6 @@
<dependency> <groupId>${rhq.groupId}</groupId> - <artifactId>rhq-core-plugin-container</artifactId> - <version>${project.version}</version> - <type>test-jar</type> - <scope>test</scope> - </dependency> - - <dependency> - <groupId>${rhq.groupId}</groupId> <artifactId>test-utils</artifactId> <version>${project.version}</version> <scope>test</scope> @@ -100,6 +92,32 @@ <profiles>
<profile> + <!-- + This profile has been created to avoid unnecessary resolution of test dependencies during a build that + does not run, compile or need tests. + More test dependencies are to be moved here if the set of sub-dependencies is complex, references project + test jars, or conflicts with changing the container version. + --> + <id>test.dependencies</id> + <activation> + <property> + <name>maven.test.skip</name> + <value>!true</value> + </property> + </activation> + + <dependencies> + <dependency> + <groupId>${rhq.groupId}</groupId> + <artifactId>rhq-core-plugin-container</artifactId> + <version>${project.version}</version> + <type>test-jar</type> + <scope>test</scope> + </dependency> + </dependencies> + </profile> + + <profile> <id>jboss-plugins</id> <activation> <property>
commit 3125d4e96856d39de9b81bc52e54ef26fd25ede2 Author: Jirka Kremser jkremser@redhat.com Date: Fri Feb 8 16:43:20 2013 +0100
Setting auto fit for button's width when title consits from more than 15 chars
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java index ea6a2f1..6fdaf95 100644 --- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java +++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/selenium/LocatableIButton.java @@ -37,6 +37,9 @@ public class LocatableIButton extends IButton implements Locatable { private void init(String locatorId) { this.locatorId = locatorId; SeleniumUtility.setID(this, locatorId); + if (getTitle().length() > 15) { + setAutoFit(true); + } }
public String getLocatorId() { diff --git a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties index 4c29ae3..ebb423a 100644 --- a/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties +++ b/modules/enterprise/gui/coregui/src/main/resources/org/rhq/enterprise/gui/coregui/client/Messages.properties @@ -22,7 +22,7 @@ common_button_create_child = Create Child common_button_delete = Delete common_button_delete_all = Delete All common_button_disable = Disable -common_button_dump_sysInfo_to_log = Dump system info +common_button_dump_sysInfo_to_log = Dump System Info common_button_edit = Edit common_button_enable = Enable common_button_execute = Execute
commit 12921ea02422df0ef34b0d241828b35ec4d26a62 Author: Heiko W. Rupp hwr@redhat.com Date: Fri Feb 8 16:12:41 2013 +0100
Improvements in the Events and Group area of the REST-api
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java index 3d7abe0..5c50907 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java @@ -46,6 +46,8 @@ import javax.ws.rs.core.Request; import javax.ws.rs.core.Response;
import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiError; +import com.wordnik.swagger.annotations.ApiErrors; import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiParam;
@@ -86,7 +88,6 @@ public class EventHandlerBean extends AbstractRestBean { @Path("/{id}/sources") @ApiOperation(value = "List the defined event sources for the resource", responseClass = "EventSourceRest", multiValueResponse = true) public Response listEventSourcesForResource(@ApiParam("id of the resource") @PathParam("id") int resourceId, - @Context Request request, @Context HttpHeaders headers) {
Resource res = fetchResource(resourceId); @@ -115,8 +116,7 @@ public class EventHandlerBean extends AbstractRestBean { @Path("/{id}/definitions") @ApiOperation(value = "List the defined event source definitions for the resource", responseClass = "EventDefintionRest", multiValueResponse = true) public Response listEventDefinitionsForResource(@ApiParam("id of the resource") @PathParam("id") int resourceId, - @Context Request request, - @Context HttpHeaders headers) { + @Context HttpHeaders headers) {
Resource res = fetchResource(resourceId); ResourceType resourceType = res.getResourceType(); @@ -148,6 +148,7 @@ public class EventHandlerBean extends AbstractRestBean { @GET @Path("/source/{id}") @ApiOperation(value = "Retrieve the event source with the passed id", responseClass = "EventSourceRest") + @ApiError(code = 404, reason = "There is no event source with the passed id") public EventSourceRest getEventSource(@ApiParam("Id of the source to retrieve") @PathParam("id") int sourceId) {
EventSource source = findEventSourceById(sourceId); @@ -162,6 +163,11 @@ public class EventHandlerBean extends AbstractRestBean { "The source.name must match an existing definition fo this resource. " + "If an event source for the definition name and resource with the same location already exists, no new source is created. " + "NOTE: An Event source added this way will not show up in the connection properties.") + @ApiErrors({ + @ApiError(code = 404, reason = "Resource with the passed id does not exist"), + @ApiError(code = 404, reason = "Event definition with the passed name not found"), + @ApiError(code = 406, reason = "Tried to create an event source on the same definition with the same location") + }) public EventSourceRest addEventSource(@ApiParam("id of the resource") @PathParam("id") int resourceId, EventSourceRest esr) {
@@ -204,10 +210,12 @@ public class EventHandlerBean extends AbstractRestBean { @ApiOperation(value = "Delete the event source with the passed id") public Response deleteEventSource(@ApiParam("Id of the source to delete") @PathParam("id") int sourceId) {
- EventSource source = findEventSourceById(sourceId); - em.remove(source); // We have a cascade delete on the events TODO make operation async ? + EventSource source = em.find(EventSource.class,sourceId); + if (source!=null) { + em.remove(source); // We have a cascade delete on the events TODO make operation async ? + }
- return Response.ok().build(); + return Response.noContent().build(); }
@GET @GZIP diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java index f9143ce..7a3f8e2 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java @@ -1,6 +1,6 @@ /* * RHQ Management Platform - * Copyright (C) 2005-2012 Red Hat, Inc. + * Copyright (C) 2005-2013 Red Hat, Inc. * All rights reserved. * * This program is free software; you can redistribute it and/or modify @@ -13,8 +13,8 @@ * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + * along with this program; if not, write to the Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ package org.rhq.enterprise.server.rest;
@@ -27,6 +27,8 @@ import java.util.Set; import javax.ejb.EJB; import javax.ejb.Stateless; import javax.interceptor.Interceptors; +import javax.persistence.EntityManager; +import javax.persistence.PersistenceContext; import javax.ws.rs.Consumes; import javax.ws.rs.DELETE; import javax.ws.rs.DefaultValue; @@ -54,7 +56,6 @@ import com.wordnik.swagger.annotations.ApiParam; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory;
-import org.jboss.resteasy.annotations.Form; import org.jboss.resteasy.annotations.GZIP; import org.jboss.resteasy.annotations.cache.Cache;
@@ -67,6 +68,7 @@ import org.rhq.core.domain.resource.ResourceType; import org.rhq.core.domain.resource.group.GroupDefinition; import org.rhq.core.domain.resource.group.ResourceGroup; import org.rhq.core.domain.util.PageList; +import org.rhq.enterprise.server.RHQConstants; import org.rhq.enterprise.server.resource.ResourceManagerLocal; import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal; import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException; @@ -90,7 +92,7 @@ import org.rhq.enterprise.server.rest.domain.ResourceWithType; @Interceptors(SetCallerInterceptor.class) @Path("/group") @Api(value="Deal with groups and DynaGroups", description = "Api that deals with resource groups and group definitions") -@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML, "application/yaml"}) +@Produces({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML,MediaType.TEXT_HTML}) public class GroupHandlerBean extends AbstractRestBean {
private final Log log = LogFactory.getLog(GroupHandlerBean.class); @@ -104,10 +106,14 @@ public class GroupHandlerBean extends AbstractRestBean { @EJB GroupDefinitionManagerLocal definitionManager;
+ @PersistenceContext(unitName = RHQConstants.PERSISTENCE_UNIT_NAME) + EntityManager em; + + @GZIP @GET @Path("/") - @ApiOperation(value = "List all groups", multiValueResponse = true) + @ApiOperation(value = "List all groups", multiValueResponse = true, responseClass = "GroupRest") public Response getGroups(@ApiParam("String to search in the group name") @QueryParam("q") String q, @Context HttpHeaders headers, @Context UriInfo uriInfo) {
@@ -123,14 +129,15 @@ public class GroupHandlerBean extends AbstractRestBean { }
MediaType mediaType = headers.getAcceptableMediaTypes().get(0); - Response.ResponseBuilder builder; + Response.ResponseBuilder builder = Response.ok(); + builder.type(mediaType);
if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) { - builder = Response.ok(renderTemplate("listGroup", list), mediaType); + builder.entity(renderTemplate("listGroup", list)); } else { GenericEntity<List<GroupRest>> ret = new GenericEntity<List<GroupRest>>(list) {}; - builder = Response.ok(ret); + builder.entity(ret); }
return builder.build(); @@ -141,6 +148,7 @@ public class GroupHandlerBean extends AbstractRestBean { @GET @Path("{id}") @ApiOperation(value = "Get the group with the passed id") + @ApiError(code = 404, reason = "Group with passed id not found") public Response getGroup(@ApiParam(value = "Id of the group") @PathParam("id") int id, @Context HttpHeaders headers, @Context UriInfo uriInfo) { @@ -151,13 +159,14 @@ public class GroupHandlerBean extends AbstractRestBean {
MediaType mediaType = headers.getAcceptableMediaTypes().get(0);
- Response.ResponseBuilder builder; + Response.ResponseBuilder builder = Response.ok(); + builder.type(mediaType);
if (mediaType.equals(MediaType.TEXT_HTML_TYPE)) { - builder = Response.ok(renderTemplate("group", groupRest), mediaType); + builder.entity(renderTemplate("group", groupRest)); } else { - builder = Response.ok(groupRest,mediaType); + builder.entity(groupRest); }
return builder.build(); @@ -166,6 +175,11 @@ public class GroupHandlerBean extends AbstractRestBean { @POST @Path("/") @ApiOperation(value = "Create a new group") + @ApiErrors({ + @ApiError(code = 404, reason = "Resource type for provided type id does not exist"), + @ApiError(code = 406, reason = "No group provided"), + @ApiError(code = 406, reason = "Provided group has no name") + }) public Response createGroup( @ApiParam(value = "A GroupRest object containing at least a name for the group") GroupRest group, @Context HttpHeaders headers, @Context UriInfo uriInfo) { @@ -209,6 +223,10 @@ public class GroupHandlerBean extends AbstractRestBean { @PUT @Path("{id}") @ApiOperation(value = "Update the passed group. Currently only name change is supported") + @ApiErrors({ + @ApiError(code = 404, reason = "Group with the passed id does not exist"), + @ApiError(code = 406, reason = "Updating the name failed") + }) public Response updateGroup(@ApiParam(value = "Id of the group to update") @PathParam("id") int id, @ApiParam(value = "New version of the group") GroupRest in, @Context HttpHeaders headers, @@ -237,18 +255,19 @@ public class GroupHandlerBean extends AbstractRestBean { try { resourceGroupManager.deleteResourceGroup(caller,id); removeFromCache(id,ResourceGroup.class); - return Response.ok().build(); } catch (ResourceGroupDeleteException e) { e.printStackTrace(); // TODO: Customise this generated block return Response.serverError().build(); // TODO what exactly ? } + return Response.noContent().build(); }
@GZIP @GET @Path("{id}/resources") @Cache(isPrivate = true,maxAge = 60) - @ApiOperation(value="Get the resources of the group", multiValueResponse = true) + @ApiOperation(value="Get the resources of the group", multiValueResponse = true, responseClass = "ResourceWithType") + @ApiError(code = 404, reason = "Group with passed id does not exist") public Response getResources(@ApiParam("Id of the group to retrieve the resources for") @PathParam("id") int id, @Context HttpHeaders headers, @Context UriInfo uriInfo) { @@ -298,15 +317,25 @@ public class GroupHandlerBean extends AbstractRestBean { }
// TODO if comp group and no resourceTypeId set, shall we allow to have it change to a mixed group? - resourceGroup.addExplicitResource(res); + resourceGroupManager.addResourcesToGroup(caller,id,new int[]{resourceId});
- return Response.ok().build(); // TODO right code? + resourceGroup = fetchGroup(id, false); + GroupRest gr = fillGroup(resourceGroup,uriInfo); + + Response.ResponseBuilder builder = Response.ok(); // TODO right code? + builder.entity(gr); + builder.type(headers.getAcceptableMediaTypes().get(0)); + return builder.build();
}
@DELETE @Path("{id}/resource/{resourceId}") @ApiOperation("Remove the resource with the passed id from the group") + @ApiErrors({ + @ApiError(code = 404, reason = "Group with the passed id does not exist"), + @ApiError(code = 404, reason = "Resource with the passed id does not exist") + }) public Response removeResource(@ApiParam("Id of the existing group") @PathParam("id") int id, @ApiParam("Id of the resource to remove") @PathParam("resourceId") int resourceId, @Context HttpHeaders headers, @Context UriInfo uriInfo) { @@ -326,6 +355,7 @@ public class GroupHandlerBean extends AbstractRestBean { @GZIP @Path("{id}/metricDefinitions") @ApiOperation(value = "Get the metric definitions for the compatible group with the passed id") + @ApiError(code = 404, reason = "Group with the passed id does not exist") public Response getMetricDefinitionsForGroup(@ApiParam(value = "Id of the group") @PathParam("id") int id, @Context HttpHeaders headers, @Context UriInfo uriInfo) { @@ -362,7 +392,7 @@ public class GroupHandlerBean extends AbstractRestBean { @GZIP @GET @Path("/definitions") - @ApiOperation(value="List all existing GroupDefinitions",multiValueResponse = true) + @ApiOperation(value="List all existing GroupDefinitions",multiValueResponse = true, responseClass = "GroupDefinitionRest") public Response getGroupDefinitions( @ApiParam("String to search in the group definition name") @QueryParam("q") String q, @Context HttpHeaders headers, @@ -399,7 +429,8 @@ public class GroupHandlerBean extends AbstractRestBean { @GET @Path("/definition/{id}") @Cache(isPrivate = true,maxAge = 60) - @ApiOperation(value = "Retrieve a single GroupDefinition by id") + @ApiOperation(value = "Retrieve a single GroupDefinition by id", responseClass = "GroupDefinitionRest") + @ApiError(code = 404, reason = "Group definition with the passed id does not exist.") public Response getGroupDefinition( @ApiParam("The id of the definition to retrieve") @PathParam("id") int definitionId, @Context HttpHeaders headers, @Context UriInfo uriInfo) { @@ -465,6 +496,11 @@ public class GroupHandlerBean extends AbstractRestBean { @Path("/definitions") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @ApiOperation("Create a new GroupDefinition. The name of the group is required in the passed definition.") + @ApiErrors({ + @ApiError(code = 406, reason = "Passed group definition has no name"), + @ApiError(code = 409, reason = "There already exists a definition by this name"), + @ApiError(code = 406, reason = "Group creation failed") + }) public Response createGroupDefinition(GroupDefinitionRest definition, @Context HttpHeaders headers, @Context UriInfo uriInfo) { @@ -519,6 +555,10 @@ public class GroupHandlerBean extends AbstractRestBean { @Path("/definition/{id}") @Consumes({MediaType.APPLICATION_JSON,MediaType.APPLICATION_XML}) @ApiOperation("Update an existing GroupDefinition or recalculate it if the query param 'recalculate' is set to true") + @ApiErrors({ + @ApiError(code = 404, reason = "Group with the passed id does not exist"), + @ApiError(code = 406, reason = "Group membership calculation failed") + }) public Response updateGroupDefinition(@ApiParam("Id fo the definition to update") @PathParam("id") int definitionId, @ApiParam("If true, trigger a re-calculation") @QueryParam( "recalculate") @DefaultValue("false") boolean recalculate, @@ -579,9 +619,12 @@ public class GroupHandlerBean extends AbstractRestBean {
builder = Response.ok(gdr); } catch (GroupDefinitionNotFoundException e) { - throw new StuffNotFoundException("Group Definition with id " + gd.getId()); + builder = Response.status(Response.Status.INTERNAL_SERVER_ERROR); + builder.entity("Group Definition with id " + gd.getId()); }
+ MediaType mediaType = headers.getAcceptableMediaTypes().get(0); + builder.type(mediaType); return builder.build(); }
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java index 697d6f0..20caca4 100644 --- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java +++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java @@ -67,6 +67,44 @@ public class EventTest extends AbstractBase { }
@Test + public void testAddEventSourceForUnknownResource() throws Exception { + + EventSource es = new EventSource(); + es.setResourceId(15); + es.setName("Event Log"); // Name of the event definition + es.setLocation("-x-test-location"); + + given() + .header(acceptJson) + .contentType(ContentType.JSON) + .pathParam("id",15) + .body(es) + .expect() + .statusCode(404) + .when() + .post("/event/{id}/sources"); + } + + @Test + public void testAddEventSourceForUnknownDefinition() throws Exception { + + EventSource es = new EventSource(); + es.setResourceId(10001); + es.setName("Frobnitz"); // Name of the event definition + es.setLocation("-x-test-location"); + + given() + .header(acceptJson) + .contentType(ContentType.JSON) + .pathParam("id", 10001) + .body(es) + .expect() + .statusCode(404) + .when() + .post("/event/{id}/sources"); + } + + @Test public void testAddGetDeleteEventSource() throws Exception {
EventSource es = new EventSource(); @@ -130,11 +168,12 @@ public class EventTest extends AbstractBase { given() .pathParam("id", result.getId()) .expect() - .statusCode(200) + .statusCode(204) .when() .delete("/event/source/{id}"); } } + @Test public void testAddGetEventOnSource() throws Exception {
@@ -215,9 +254,20 @@ public class EventTest extends AbstractBase { given() .pathParam("id", eventSource.getId()) .expect() - .statusCode(200) + .statusCode(204) .when() .delete("/event/source/{id}"); } } + + @Test + public void testDeleteUnknownSource() throws Exception { + given() + .pathParam("id", 123) + .expect() + .statusCode(204) + .when() + .delete("/event/source/{id}"); + + } } diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java index 3023732..ce338bb 100644 --- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java +++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java @@ -26,6 +26,7 @@ import com.jayway.restassured.path.json.JsonPath; import com.jayway.restassured.response.Response;
import org.apache.http.HttpStatus; +import org.junit.Before; import org.junit.Test;
import org.rhq.modules.integrationTests.restApi.d.Group; @@ -34,7 +35,7 @@ import org.rhq.modules.integrationTests.restApi.d.GroupDef; import static com.jayway.restassured.RestAssured.expect; import static com.jayway.restassured.RestAssured.given; import static org.hamcrest.CoreMatchers.hasItem; -import static org.hamcrest.CoreMatchers.is; +import static org.hamcrest.Matchers.iterableWithSize;
/** * Test group related stuff @@ -42,6 +43,30 @@ import static org.hamcrest.CoreMatchers.is; */ public class GroupTest extends AbstractBase {
+ private static final String X_TEST_GROUP = "-x-test-group"; + + @Override + @Before + public void setUp() throws Exception { + super.setUp(); + + // Remove group that was left over (just in case) + Response response = + given() + .header(acceptJson) + .queryParam("q", X_TEST_GROUP) + .when() + .get("/group"); + + JsonPath jsonPath = response.jsonPath(); + if (jsonPath.get("id[0]")!=null) { + int groupId = jsonPath.getInt("id[0]"); + given() + .pathParam("id", groupId) + .delete("/group/{id}"); + } + } + @Test public void testGetGroups() throws Exception { expect().statusCode(200) @@ -59,7 +84,7 @@ public class GroupTest extends AbstractBase {
@Test public void testCreateGroupAndRemove() throws Exception { - Group group = new Group("-x-test-group"); + Group group = new Group(X_TEST_GROUP);
// create the group Response created = @@ -81,14 +106,15 @@ public class GroupTest extends AbstractBase { // Search for it Response response = given() - .queryParam("q", "-x-test-group") + .header(acceptJson) + .queryParam("q", X_TEST_GROUP) .expect() - .statusCode(200) + .statusCode(200) .when() - .get("/group"); + .get("/group");
JsonPath jsonPath = response.jsonPath(); - assert jsonPath.get("[0].name").equals("-x-test-group"); // [0] as the query returns a list + assert jsonPath.get("[0].name").equals(X_TEST_GROUP); // [0] as the query returns a list int groupId = jsonPath.get("[0].id"); assert groupId == createdId;
@@ -96,7 +122,7 @@ public class GroupTest extends AbstractBase { given() .pathParam("id",groupId) .expect() - .statusCode(200) + .statusCode(204) .log().ifError() .when() .delete("/group/{id}"); @@ -104,8 +130,32 @@ public class GroupTest extends AbstractBase { }
@Test + public void testGetGroupWithInvalidId() throws Exception { + given() + .pathParam("gid", 42) + .expect() + .statusCode(404) + .when() + .get("/group/{gid}"); + } + + @Test + public void testUpdateGroupWithInvalidId() throws Exception { + Group group = new Group(X_TEST_GROUP); + given() + .pathParam("gid",42) + .header(acceptJson) + .contentType(ContentType.JSON) + .body(group) + .expect() + .statusCode(404) + .when() + .put("/group/{gid}"); + } + + @Test public void testUpdateGroup() throws Exception { - Group group = new Group("-x-test-group"); + Group group = new Group(X_TEST_GROUP);
// Generate the group Response response = @@ -140,7 +190,7 @@ public class GroupTest extends AbstractBase { given() .pathParam("id", id) .expect() - .statusCode(200) + .statusCode(204) .log().ifError() .when() .delete("/group/{id}"); @@ -149,7 +199,7 @@ public class GroupTest extends AbstractBase {
@Test public void testAddResourceToGroup() throws Exception { - Group group = new Group("-x-test-group"); + Group group = new Group(X_TEST_GROUP);
// Generate the group Response response = @@ -171,7 +221,7 @@ public class GroupTest extends AbstractBase { .header(acceptJson) .contentType(ContentType.JSON) .body(group) - .pathParam("id",id) + .pathParam("id", id) .pathParam("resourceId",10001) .expect() .statusCode(HttpStatus.SC_OK) @@ -184,7 +234,7 @@ public class GroupTest extends AbstractBase { given() .pathParam("id",id) .expect() - .statusCode(200) + .statusCode(204) .log().ifError() .when() .delete("/group/{id}"); @@ -192,8 +242,72 @@ public class GroupTest extends AbstractBase { }
@Test + public void testAddResourceToGroupAndGetResources() throws Exception { + Group group = new Group(X_TEST_GROUP); + + // Generate the group + Response response = + given() + .header(acceptJson) + .contentType(ContentType.JSON) + .body(group) + .expect() + .statusCode(HttpStatus.SC_CREATED) + .log().ifError() + .when() + .post("/group"); + + String location = response.header("Location"); + int groupId = Integer.parseInt(location.substring(location.lastIndexOf("/")+1)); + + try { + given() + .header(acceptJson) + .contentType(ContentType.JSON) + .body(group) + .pathParam("gid", groupId) + .pathParam("resourceId",10001) + .expect() + .statusCode(HttpStatus.SC_OK) + .log().ifError() + .when() + .put("/group/{gid}/resource/{resourceId}"); + + given() + .pathParam("groupId",groupId) + .expect() + .statusCode(200) + .log().ifError() + .body("", iterableWithSize(1)) // Expect one + .when() + .get("/group/{groupId}/resources"); + + } + finally { + // delete the group + given() + .pathParam("id",groupId) + .expect() + .statusCode(204) + .log().ifError() + .when() + .delete("/group/{id}"); + } + } + + @Test + public void testGetResourcesForGroupWithInvalidId() throws Exception { + given() + .pathParam("groupId", 14) + .expect() + .statusCode(404) + .when() + .get("/group/{groupId}/resources"); + } + + @Test public void testAddNonExistingResourceToGroup() throws Exception { - Group group = new Group("-x-test-group"); + Group group = new Group(X_TEST_GROUP);
// Generate the group Response response = @@ -228,7 +342,7 @@ public class GroupTest extends AbstractBase { given() .pathParam("id",id) .expect() - .statusCode(200) + .statusCode(204) .log().ifError() .when() .delete("/group/{id}"); @@ -237,7 +351,7 @@ public class GroupTest extends AbstractBase {
@Test public void testRemoveResourceFromGroup() throws Exception { - Group group = new Group("-x-test-group"); + Group group = new Group(X_TEST_GROUP);
// Generate the group Response response = @@ -285,7 +399,7 @@ public class GroupTest extends AbstractBase { given() .pathParam("id",id) .expect() - .statusCode(200) + .statusCode(204) .log().ifError() .when() .delete("/group/{id}"); @@ -294,7 +408,7 @@ public class GroupTest extends AbstractBase {
@Test public void testGetMetricDefinitionsForGroup() throws Exception { - Group group = new Group("-x-test-group"); + Group group = new Group(X_TEST_GROUP); group.setCategory("COMPATIBLE"); group.setResourceTypeId(10001);
@@ -331,7 +445,7 @@ public class GroupTest extends AbstractBase { given() .pathParam("id",id) .expect() - .statusCode(200) + .statusCode(204) .log().ifError() .when() .delete("/group/{id}"); @@ -349,6 +463,28 @@ public class GroupTest extends AbstractBase { }
@Test + public void testCreateDefinitionWithoutName() throws Exception { + + GroupDef gd = new GroupDef(); + gd.setDescription("Just testing"); + List<String> list = new ArrayList<String>(); + list.add("groupby resource"); + list.add("resource.name"); + gd.setExpression(list); + + Response response = + given() + .contentType(ContentType.JSON) + .header("Accept","application/json") + .body(gd) + .expect() + .statusCode(406) + .log().ifError() + .when() + .post("/group/definitions"); + } + + @Test public void testCreateRetrieveDeleteDefinition() throws Exception {
GroupDef gd = new GroupDef("-x-test-def"); @@ -404,6 +540,44 @@ public class GroupTest extends AbstractBase { }
@Test + public void testGetUnknownGroupDefinition() throws Exception { + + given() + .pathParam("id", 44) + .expect() + .statusCode(404) + .when() + .get("/group/definition/{id}"); + } + + @Test + public void testUpdateUnknownGroupDefinition() throws Exception { + + GroupDef gd = new GroupDef("-x-test-def"); + gd.setDescription("Just testing"); + + given() + .contentType(ContentType.JSON) + .header("Accept","application/json") + .body(gd) + .pathParam("id", 44) + .expect() + .statusCode(404) + .when() + .put("/group/definition/{id}"); + } + + @Test + public void testDeleteUnknownGroupDefinition() throws Exception { + given() + .pathParam("id", 44) + .expect() + .statusCode(204) + .when() + .delete("/group/definition/{id}"); + } + + @Test public void testCreateUpdateRecalcDeleteDefinition() throws Exception {
GroupDef gd = new GroupDef("-x-test-def2"); diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java index 9472059..18b0297 100644 --- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java +++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java @@ -22,6 +22,7 @@ import java.util.List; import java.util.Map;
import com.jayway.restassured.http.ContentType; +import com.jayway.restassured.path.json.JsonPath; import com.jayway.restassured.response.Response;
import org.junit.Before; @@ -183,12 +184,12 @@ public class OperationsTest extends AbstractBase { .body(draft) .expect() .statusCode(200) - .log().ifError() + .log().everything() .when() .put("/operation/{id}") .as(Operation.class);
- System.out.println(scheduled); + System.out.println(scheduled.getId()); String history = null; List<Map<String,Object>> links = scheduled.getLinks(); for (Map<String,Object> link : links) { @@ -199,7 +200,7 @@ public class OperationsTest extends AbstractBase {
String historyId = history.substring(history.lastIndexOf("/")+1); try { - Thread.sleep(5000); // we need to wait a little as the execution may take time + Thread.sleep(15000); // we need to wait a little as the execution may take time
given() .pathParam("hid",historyId) @@ -236,21 +237,23 @@ public class OperationsTest extends AbstractBase { boolean done = false; int count = 0; while (!done) { - String status = + Response response = given() - .pathParam("hid",historyId) - .expect() - .statusCode(200) - .log().everything() + .header(acceptJson) + .pathParam("hid", historyId) .when() - .get("/operation/history/{hid}") - .jsonPath().getString("status"); + .get("/operation/history/{hid}"); + + JsonPath jsonPath = response.jsonPath(); + String status= jsonPath.getString("status"); + int code = response.statusCode();
- if (status.equals("Success") || status.equals("Failed")) { + if (code==200 && (status.equals("Success") || status.equals("Failed"))) { done = true; } else { Thread.sleep(2000); } + count ++; assert count < 10 :"Waited for 20sec -- something is wrong"; }
commit 58d2f793f5b07d62aeb9cb550b5a4fd071b0022f Author: Heiko W. Rupp hwr@redhat.com Date: Fri Feb 8 15:25:25 2013 +0100
Itests are now itests-2
diff --git a/modules/enterprise/server/pom.xml b/modules/enterprise/server/pom.xml index 556efa3..d64e981 100644 --- a/modules/enterprise/server/pom.xml +++ b/modules/enterprise/server/pom.xml @@ -33,7 +33,7 @@ <module>installer</module> <module>safe-invoker</module> <module>client-api</module> - <module>itests</module> + <module>itests-2</module> </modules> </profile>
commit 62b3f19350fcdbb5f1b64f6d516a6c7a84e9225f Author: Heiko W. Rupp hwr@redhat.com Date: Thu Feb 7 13:09:11 2013 +0100
Improve documentation and harden the alert definition part of the REST api
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java index d2fa410e..5897644 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/AlertDefinitionHandlerBean.java @@ -31,6 +31,7 @@ import javax.ejb.EJB; import javax.ejb.Stateless; import javax.interceptor.Interceptors; import javax.persistence.EntityManager; +import javax.persistence.NoResultException; import javax.persistence.PersistenceContext; import javax.persistence.Query; import javax.ws.rs.DELETE; @@ -52,6 +53,8 @@ import javax.ws.rs.core.UriBuilder; import javax.ws.rs.core.UriInfo;
import com.wordnik.swagger.annotations.Api; +import com.wordnik.swagger.annotations.ApiError; +import com.wordnik.swagger.annotations.ApiErrors; import com.wordnik.swagger.annotations.ApiOperation; import com.wordnik.swagger.annotations.ApiParam;
@@ -159,6 +162,7 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @GET @Path("/definition/{id}") @ApiOperation(value = "Get one AlertDefinition by id", responseClass = "AlertDefinitionRest") + @ApiError(code = 404, reason = "No definition found with the passed id.") public Response getAlertDefinition(@ApiParam("Id of the alert definition to retrieve") @PathParam("id") int definitionId, @ApiParam("Should conditions be returned too?") @QueryParam("full") @DefaultValue("false") boolean full, @Context Request request) { @@ -181,6 +185,10 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @POST @Path("/definitions") @ApiOperation("Create an AlertDefinition for the resource/group/resource type passed as query param. One and only one of the three params must be given at any time.") + @ApiErrors({ + @ApiError(code = 406, reason = "There was not exactly one of 'resourceId','groupId' or 'resourceTypeId' given"), + @ApiError(code = 404, reason = "A non existing alert notification sender was requested.") + }) public Response createAlertDefinition(@ApiParam("The id of the resource to attach the definition to") @QueryParam("resourceId") Integer resourceId, @ApiParam("The id of the group to attach the definition to") @QueryParam("groupId") Integer groupId, @ApiParam("The id of the resource type to attach the definition to") @QueryParam("resourceTypeId") Integer resourceTypeId, @@ -266,6 +274,7 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @PUT @Path("/definition/{id}") @ApiOperation(value = "Update the alert definition (priority, enablement, dampening, recovery)", notes = "Priority must be HIGH,LOW,MEDIUM. If not provided, LOW is assumed.") + @ApiError(code = 404, reason = "No AlertDefinition with the passed id exists") public Response updateDefinition( @ApiParam("Id of the alert definition to update") @PathParam("id") int definitionId, @ApiParam("Data for the update") AlertDefinitionRest definitionRest) { @@ -385,6 +394,7 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @POST @Path("definition/{id}/conditions") @ApiOperation("Add a new alert condition to an existing alert definition") + @ApiError(code = 404, reason = "No AlertDefinition with the passed id exists") public Response addConditionToDefinition( @ApiParam("The id of the alert definition") @PathParam("id") int definitionId, @ApiParam("The condition to add") AlertConditionRest conditionRest, @Context UriInfo uriInfo) { @@ -409,9 +419,17 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @ApiOperation("Remove an alert condition") public Response deleteCondition( @ApiParam("The id of the condition to remove")@PathParam("cid") int conditionId) { - Integer definitionId = findDefinitionIdForConditionId(conditionId);
- AlertDefinition definition2 = entityManager.find(AlertDefinition.class,definitionId); + Integer definitionId; + try { + definitionId = findDefinitionIdForConditionId(conditionId); + } + catch (NoResultException nre) { + return Response.noContent().build(); + } + + AlertDefinition definition2; + definition2 = entityManager.find(AlertDefinition.class,definitionId); AlertCondition condition=null; for (AlertCondition c: definition2.getConditions()) { if (c.getId() == conditionId) @@ -444,11 +462,18 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @PUT @Path("condition/{cid}") @ApiOperation("Update an existing condition of an alert definition.Note that the update will change the id of the condition") + @ApiError(code = 404, reason = "Condition with passed id does not exist") public Response updateCondition( @ApiParam("The id of the condition to update") @PathParam("cid") int conditionId, @ApiParam("The updated condition") AlertConditionRest conditionRest, @Context UriInfo uriInfo) {
- Integer definitionId = findDefinitionIdForConditionId(conditionId); + Integer definitionId; + try { + definitionId = findDefinitionIdForConditionId(conditionId); + } + catch (NoResultException nre) { + throw new StuffNotFoundException("Condition with id " + conditionId); + }
AlertDefinition definition = entityManager.find(AlertDefinition.class,definitionId); AlertCondition condition=null; @@ -485,10 +510,13 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @GET @Path("condition/{cid}") @ApiOperation("Retrieve a condition of an alert definition by its condition id") + @ApiError(code = 404, reason = "No condition with the passed id exists") public Response getCondition( @ApiParam("The id of the condition to retrieve") @PathParam("cid") int conditionId) {
AlertCondition condition = conditionMgr.getAlertConditionById(conditionId); + if (condition==null) + throw new StuffNotFoundException("No condition with id " + conditionId); AlertConditionRest acr = conditionToConditionRest(condition);
return Response.ok(acr).build(); @@ -543,10 +571,13 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @GET @Path("notification/{nid}") @ApiOperation("Return a notification definition by its id") + @ApiError(code = 404, reason = "No notification with the passed id found") public Response getNotification( @ApiParam("The id of the notification definition to retrieve") @PathParam("nid") int notificationId) {
AlertNotification notification = notificationMgr.getAlertNotification(caller,notificationId); + if (notification==null) + throw new StuffNotFoundException("No notification with id " + notificationId); AlertNotificationRest anr = notificationToNotificationRest(notification);
return Response.ok(anr).build(); @@ -559,26 +590,30 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @ApiParam("The id of the notification definition to remove") @PathParam("nid") int notificationId) {
AlertNotification notification = notificationMgr.getAlertNotification(caller,notificationId); - AlertDefinition definition = alertDefinitionManager.getAlertDefinition(caller,notification.getAlertDefinition().getId()); - - definition.getAlertNotifications().remove(notification); + if (notification!=null) { + AlertDefinition definition = alertDefinitionManager.getAlertDefinition(caller,notification.getAlertDefinition().getId());
- alertDefinitionManager.updateAlertDefinitionInternal(caller,definition.getId(),definition,true,true,true); -// alertDefinitionManager.updateAlertDefinition(caller, definition.getId(), copiedDef, true); + definition.getAlertNotifications().remove(notification);
- entityManager.flush(); + alertDefinitionManager.updateAlertDefinitionInternal(caller,definition.getId(),definition,true,true,true);
+ entityManager.flush(); + } return Response.noContent().build(); }
@PUT @Path("notification/{nid}") @ApiOperation("Update a notification definition") + @ApiError(code = 404, reason = "There is no notification with the passed id") public Response updateNotification( @ApiParam("The id of the notification definition to update") @PathParam("nid") int notificationId, @ApiParam("The updated notification definition to use") AlertNotificationRest notificationRest) {
AlertNotification notification = notificationMgr.getAlertNotification(caller,notificationId); + if (notification==null) + throw new StuffNotFoundException("No notification with id " + notificationId); + AlertDefinition definition = alertDefinitionManager.getAlertDefinition(caller,notification.getAlertDefinition().getId());
AlertNotification newNotif = notificationRestToNotification(definition,notificationRest); @@ -607,6 +642,10 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @POST @Path("definition/{id}/notifications") @ApiOperation("Add a new notification definition to an alert definition") + @ApiErrors({ + @ApiError(code = 404, reason = "Requested alert notification sender does not exist"), + @ApiError(code = 404, reason = "There is no alert definition with the passed id") + }) public Response addNotificationToDefinition( @ApiParam("Id of the alert definition that should get the notification definition") @PathParam("id") int definitionId, @ApiParam("The notification definition to add") AlertNotificationRest notificationRest, @Context UriInfo uriInfo) { @@ -701,6 +740,7 @@ public class AlertDefinitionHandlerBean extends AbstractRestBean { @ApiOperation("Return an alert notification sender by name. This includes information about the configuration it expects") @GET @GZIP @Path("sender/{name}") + @ApiError(code = 404, reason = "There is no sender with the passed name") public Response getAlertSenderByName( @ApiParam("Name of the sender to retrieve") @PathParam("name")String senderName, @Context UriInfo uriInfo) {
diff --git a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java index 283e152..7e9fa70 100644 --- a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java +++ b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java @@ -639,6 +639,88 @@ public class AlertTest extends AbstractBase { }
@Test + public void testGetNonExistingCondition() throws Exception { + + given() + .header(acceptJson) + .pathParam("cid",14) + .expect() + .statusCode(404) + .log().ifError() + .when() + .get("/alert/condition/{cid}"); + + } + + @Test + public void testGetNonExistingNotification() throws Exception { + + given() + .header(acceptXml) + .pathParam("cid",14) + .expect() + .statusCode(404) + .log().ifError() + .when() + .get("/alert/notification/{cid}"); + + } + + @Test + public void testUpdateNonExistingCondition() throws Exception { + + given() + .header(acceptJson) + .pathParam("cid",14) + .expect() + .statusCode(404) + .log().ifError() + .when() + .put("/alert/condition/{cid}"); + + } + + @Test + public void testUpdateNonExistingNotification() throws Exception { + + given() + .header(acceptXml) + .pathParam("cid",14) + .expect() + .statusCode(404) + .log().ifError() + .when() + .put("/alert/notification/{cid}"); + + } + + @Test + public void testDeleteNonExistingNotification() throws Exception { + + given() + .header(acceptJson) + .pathParam("cid",14) + .expect() + .statusCode(204) + .log().ifError() + .when() + .delete("/alert/notification/{cid}"); + } + + @Test + public void testDeleteNonExistingCondition() throws Exception { + + given() + .header(acceptJson) + .pathParam("cid",14) + .expect() + .statusCode(204) + .log().ifError() + .when() + .delete("/alert/condition/{cid}"); + } + + @Test public void testCreateDeleteAlertDefinitionWithUnknwonSender() throws Exception {
int definitionId = createEmptyAlertDefinition();
commit 572fca628aa0c492347f1661ef723c3834b2cde5 Author: Jay Shaughnessy jshaughn@redhat.com Date: Fri Feb 8 10:17:15 2013 -0500
Fix issue with SLSB invocation.
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java index ea4b5aa..0a87342 100644 --- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java +++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java @@ -279,7 +279,7 @@ public class ResourceManagerBean implements ResourceManagerLocal, ResourceManage throw new PermissionException("You do not have permission to uninventory resource [" + resourceId + "]"); }
- return uninventoryResourceInNewTransaction(resourceId); + return resourceManager.uninventoryResourceInNewTransaction(resourceId); }
@Override
commit c17aa632dca792707a4c84ba16245efb9c4ed99a Author: Jirka Kremser jkremser@redhat.com Date: Fri Feb 8 15:18:40 2013 +0100
[BZ BugĀ 893802 - [as7] Restart operation fails to start AS when shutdown hasn't completed when start script is invoked] If the AS is deployed on the same node as the agent, the check whether the process is runing or not is done in a loop once a second. This new check was added after the original (using the DMR api polling) check. In total, the AS has up to 20 second to finish its work and completely shut down.
diff --git a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java index 98a46d2..5e3373b 100644 --- a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java +++ b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/BaseServerComponent.java @@ -54,6 +54,7 @@ import org.rhq.core.system.ProcessExecutionResults; import org.rhq.core.system.SystemInfo; import org.rhq.core.util.PropertiesFileUpdate; import org.rhq.modules.plugins.jbossas7.helper.HostConfiguration; +import org.rhq.modules.plugins.jbossas7.helper.HostPort; import org.rhq.modules.plugins.jbossas7.helper.ServerPluginConfiguration; import org.rhq.modules.plugins.jbossas7.json.Address; import org.rhq.modules.plugins.jbossas7.json.ComplexResult; @@ -242,24 +243,24 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend }
protected boolean waitUntilDown() throws InterruptedException { - boolean down=false; - int count=0; + boolean notAnswering = false; + int count = 0;
- while (!down) { - Operation op = new ReadAttribute(new Address(),"release-version"); + while (!notAnswering) { + Operation op = new ReadAttribute(new Address(), "release-version");
- try{ + try { Result res = getASConnection().execute(op); if (!res.isSuccess()) { // If op succeeds, server is not down - down = true; + notAnswering = true; } else if (count > 20) { break; } } catch (Exception e) { - down = true; + notAnswering = true; }
- if (!down) { + if (!notAnswering) { try { Thread.sleep(1000); // Wait 1s } catch (InterruptedException e) { @@ -269,8 +270,27 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend count++; }
- log.debug("waitUntilDown: Used " + count + " delay round(s) to shut down. Server down=" + down); - return down; + // BZ 893802: wait until server (the process) is really down + HostConfiguration hostConfig = getHostConfig(); + // commandLine instance is not important for determining whether the HostPort is local or not + AS7CommandLine commandLine = new AS7CommandLine(new String[] { "java", "foo.Main", + "org.jboss.as.host-controller" }); + HostPort hostPort = hostConfig.getDomainControllerHostPort(commandLine); + + if (hostPort.isLocal) { + // lets be paranoid here + while (context.getNativeProcess() != null && context.getNativeProcess().priorSnaphot().isRunning() + && count++ <= 20) { + try { + Thread.sleep(1000); // Wait 1s + } catch (InterruptedException e) { + // ignore + } + } + } + + log.debug("waitUntilDown: Used " + count + " delay round(s) to shut down. Server down=" + notAnswering); + return notAnswering; }
/** @@ -520,14 +540,7 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend return result; }
- File configFile = getHostConfigFile(); - HostConfiguration hostConfig; - try { - hostConfig = new HostConfiguration(configFile); - } catch (Exception e) { - throw new RuntimeException("Failed to parse configuration file [" + configFile + "].", e); - } - + HostConfiguration hostConfig = getHostConfig(); String realm = pluginConfig.getSimpleValue("realm", "ManagementRealm"); File propertiesFile = hostConfig.getSecurityPropertyFile(baseDir, getMode(), realm); if (!propertiesFile.canWrite()) { @@ -635,8 +648,9 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend } }
- private File getHostConfigFile() { + private HostConfiguration getHostConfig() { File configFile; + HostConfiguration hostConfig; try { String config = readAttribute(getEnvironmentAddress(), getMode().getHostConfigAttributeName()); configFile = new File(config); @@ -652,7 +666,12 @@ public abstract class BaseServerComponent<T extends ResourceComponent<?>> extend throw new RuntimeException("Failed to determine config file path.", e); } } - return configFile; + try { + hostConfig = new HostConfiguration(configFile); + } catch (Exception e) { + throw new RuntimeException("Failed to parse configuration file [" + configFile + "].", e); + } + return hostConfig; }
private void collectServerKindTraits(MeasurementReport report, Set<MeasurementScheduleRequest> skmRequests) {
rhq-commits@lists.fedorahosted.org