.classpath
| 11
.gitignore
| 5
.mailmap
| 5
code-coverage/pom.xml
| 2
etc/dev-utils/setup-rest/setup.sh
| 17
etc/scripts/createRelasenotes.pl
| 5
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/comm-api/pom.xml
| 2
modules/core/dbutils/pom.xml
| 4
modules/core/dbutils/src/main/java/org/rhq/core/db/DbUtilsI18NResourceKeys.java
| 5
modules/core/dbutils/src/main/java/org/rhq/core/db/upgrade/BundleVersionOrderUpgradeTask.java
| 140 ++++
modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
| 27
modules/core/domain/intentional-api-changes-since-4.6.0.xml
| 21
modules/core/domain/pom.xml
| 26
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
| 15
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
| 11
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AvailabilityCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BaseCriteria.java
| 7
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDestinationCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleResourceDeploymentCriteria.java
| 11
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
| 48 +
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionTemplateCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
| 50 +
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftCriteria.java
| 29
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageHistoryCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
| 36 -
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
| 21
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDataTraitCriteria.java
| 15
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PartitionEventCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
| 11
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
| 11
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
| 12
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
| 12
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java
| 5
modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
| 11
modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDataAccessTest.java
| 77 --
modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDefinitionTemplateTest.java
| 62 --
modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftFileTest.java
| 162 ++---
modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java
| 88 +--
modules/core/domain/src/test/resources/arquillian.xml
| 1
modules/core/gui/pom.xml
| 2
modules/core/native-system/ant-run.xml
| 2
modules/core/native-system/pom.xml
| 2
modules/core/native-system/src/test/java/org/rhq/core/system/DeadProcessInfoRefreshTest.java
| 65 +-
modules/core/native-system/src/test/resources/log4j.xml
| 4
modules/core/native-system/src/test/resources/org/rhq/core/system/bash-watch-echo.sh
| 7
modules/core/native-system/src/test/resources/org/rhq/core/system/win-watch-echo.bat
| 5
modules/core/plugin-api/pom.xml
| 2
modules/core/plugin-container-itest/pom.xml
| 2
modules/core/plugin-container/pom.xml
| 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
| 53 +
modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
| 2
modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
| 8
modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
| 23
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/apache/maven/artifact/versioning/ComparableVersion.java
| 9
modules/core/util/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java
| 6
modules/enterprise/agent/ant-run.xml
| 2
modules/enterprise/agent/pom.xml
| 2
modules/enterprise/agent/src/main/java/org/rhq/enterprise/agent/AgentMain.java
| 12
modules/enterprise/agentupdate/pom.xml
| 2
modules/enterprise/binding/pom.xml
| 4
modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
| 5
modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
| 42 +
modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
| 21
modules/enterprise/comm/pom.xml
| 2
modules/enterprise/gui/content_http-war/pom.xml
| 2
modules/enterprise/gui/content_http-war/src/main/java/org/rhq/gui/content/ContentHTTPServlet.java
| 1
modules/enterprise/gui/coregui/pom.xml
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsEditor.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
| 2
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
| 1
modules/enterprise/gui/pom.xml
| 2
modules/enterprise/gui/portal-war/pom.xml
| 2
modules/enterprise/gui/rest-examples-war/pom.xml
| 2
modules/enterprise/gui/rest-war/pom.xml
| 2
modules/enterprise/pom.xml
| 2
modules/enterprise/remoting/cli/pom.xml
| 2
modules/enterprise/remoting/client-api/pom.xml
| 2
modules/enterprise/remoting/client-deps/pom.xml
| 2
modules/enterprise/remoting/pom.xml
| 2
modules/enterprise/scripting/api/pom.xml
| 4
modules/enterprise/scripting/javascript/pom.xml
| 4
modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
| 15
modules/enterprise/scripting/pom.xml
| 4
modules/enterprise/scripting/python/pom.xml
| 4
modules/enterprise/server/appserver/pom.xml
| 2
modules/enterprise/server/client-api/pom.xml
| 4
modules/enterprise/server/ear/pom.xml
| 2
modules/enterprise/server/installer/pom.xml
| 2
modules/enterprise/server/itests-2/pom.xml
| 2
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/ScriptableAbstractEJB3Test.java
| 37 +
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
| 22
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
| 81 ++
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
| 222 ++++++-
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
| 293 +++++++++-
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
| 6
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBeanTest.java
| 66 ++
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
| 279 +++++++++
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
| 19
modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
| 4
modules/enterprise/server/jar/pom.xml
| 122 ----
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
| 55 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
| 24
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
| 78 +-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
| 10
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
| 26
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
| 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DeletedResourceTypeFilter.java
| 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
| 3
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
| 12
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
| 16
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
| 18
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java
| 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerBean.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
| 48 +
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceAlreadyExistsException.java
| 9
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeAlreadyExistsException.java
| 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
| 4
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupAlreadyExistsException.java
| 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerRemote.java
| 6
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupUpdateException.java
| 8
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
| 15
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
| 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
| 17
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
| 19
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
| 20
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
| 2
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
| 11
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
| 7
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
| 13
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
| 34 -
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
| 25
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
| 1
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
| 92 ++-
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
| 17
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
| 69 ++
modules/enterprise/server/plugins/alert-cli/pom.xml
| 4
modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
| 1
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-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServer.java
| 17
modules/enterprise/server/plugins/drift-rhq/pom.xml
| 2
modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
| 2
modules/enterprise/server/plugins/jboss-software/pom.xml
| 2
modules/enterprise/server/plugins/packagetype-cli/pom.xml
| 4
modules/enterprise/server/plugins/pom.xml
| 2
modules/enterprise/server/plugins/url/pom.xml
| 2
modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
| 2
modules/enterprise/server/plugins/yum/pom.xml
| 2
modules/enterprise/server/pom.xml
| 2
modules/enterprise/server/safe-invoker/pom.xml
| 2
modules/enterprise/server/sars/pom.xml
| 2
modules/enterprise/server/sars/services-sar/pom.xml
| 2
modules/enterprise/server/startup-subsystem/pom.xml
| 2
modules/enterprise/server/xml-schemas/pom.xml
| 2
modules/helpers/bundleGen/pom.xml
| 4
modules/helpers/jeeGen/pom.xml
| 2
modules/helpers/perftest-support/pom.xml
| 4
modules/helpers/pom.xml
| 2
modules/helpers/rest-docs-generator/pom.xml
| 2
modules/helpers/rtfilter-subsystem/pom.xml
| 2
modules/helpers/rtfilter/pom.xml
| 2
modules/integration-tests/apache-plugin-test/pom.xml
| 2
modules/integration-tests/jndi-access/jndi-access-test/pom.xml
| 2
modules/integration-tests/jndi-access/pom.xml
| 2
modules/integration-tests/jndi-access/remote-server/pom.xml
| 2
modules/integration-tests/pom.xml
| 2
modules/integration-tests/rest-api/pom.xml
| 2
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
| 89 +++
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AlertTest.java
| 38 -
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/EventTest.java
| 20
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/GroupTest.java
| 14
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/MetricsTest.java
| 9
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/OperationsTest.java
| 21
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ReportsTest.java
| 7
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ResourcesTest.java
| 122 ++--
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/UserTest.java
| 34 -
modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Resource.java
| 30 +
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
| 2
modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
| 20
modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
| 5
modules/plugins/jboss-as/pom.xml
| 2
modules/plugins/jboss-cache-v3/pom.xml
| 2
modules/plugins/jboss-cache/pom.xml
| 2
modules/plugins/jmx/pom.xml
| 2
modules/plugins/kickstart/pom.xml
| 2
modules/plugins/mod-cluster/pom.xml
| 2
modules/plugins/mysql/pom.xml
| 2
modules/plugins/netservices/pom.xml
| 19
modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/HTTPNetServiceComponentConfiguration.java
| 5
modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceComponent.java
| 151 +++++
modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceComponentConfiguration.java
| 51 +
modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceDiscoveryComponent.java
| 63 ++
modules/plugins/netservices/src/main/resources/META-INF/rhq-plugin.xml
| 18
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PortNetServiceDiscoveryComponentTest.java
| 128 ++++
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
| 25
modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java
| 152 +++++
modules/plugins/noop/pom.xml
| 2
modules/plugins/oracle/pom.xml
| 2
modules/plugins/pattern-generator/pom.xml
| 2
modules/plugins/perftest/pom.xml
| 2
modules/plugins/platform/pom.xml
| 2
modules/plugins/pom.xml
| 2
modules/plugins/postfix/pom.xml
| 2
modules/plugins/postgres/pom.xml
| 2
modules/plugins/rhq-agent/pom.xml
| 2
modules/plugins/rhq-server/pom.xml
| 2
modules/plugins/samba/pom.xml
| 2
modules/plugins/script/pom.xml
| 2
modules/plugins/script2/pom.xml
| 2
modules/plugins/snmptrapd/pom.xml
| 2
modules/plugins/sshd/pom.xml
| 2
modules/plugins/sudoers/pom.xml
| 2
modules/plugins/tomcat/pom.xml
| 2
modules/plugins/twitter/pom.xml
| 2
modules/plugins/validate-all-plugins/pom.xml
| 2
modules/plugins/virt/pom.xml
| 2
modules/pom.xml
| 2
modules/test-utils/pom.xml
| 2
pom.xml
| 35 -
288 files changed, 3405 insertions(+), 1223 deletions(-)
New commits:
commit 2a421f1032ad68d9138db60d5245a19c1d2d1c23
Merge: f92d8d9 e492e40
Author: Mike Thompson <mithomps(a)redhat.com>
Date: Wed Mar 6 12:52:20 2013 -0800
Merge branch 'master' into mtho11/d3-charts-master
commit e492e40dca0ab395b8594071b9998b78c88ba6b9
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Wed Mar 6 12:17:12 2013 -0600
Update Sigar version to 1.6.5.132-5.
diff --git a/.classpath b/.classpath
index 1a0df52..8ec7d9b 100644
--- a/.classpath
+++ b/.classpath
@@ -249,7 +249,7 @@
<classpathentry exported="true" kind="var"
path="M2_REPO/org/richfaces/ui/richfaces-ui/3.3.3.Final/richfaces-ui-3.3.3.Final.jar"
sourcepath="/M2_REPO/org/richfaces/ui/richfaces-ui/3.3.0.GA/richfaces-ui-3.3.0.GA-sources.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/postgresql/postgresql/9.2-1002.jdbc4/postgresql-9.2-1002.jdbc4.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/jboss/jboss-cache/1.4.1.SP9/jboss-cache-1.4.1.SP9.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/org/hyperic/sigar/1.6.5.132-3/sigar-1.6.5.132-3.jar"
sourcepath="/M2_REPO/org/hyperic/sigar/1.6.5.132-3/sigar-1.6.5.132-3-sources.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/org/hyperic/sigar/1.6.5.132-5/sigar-1.6.5.132-5.jar"
sourcepath="/M2_REPO/org/hyperic/sigar/1.6.5.132-5/sigar-1.6.5.132-5-sources.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/org/jboss/jbossts/jbossjts/4.16.2.Final/jbossjts-4.16.2.Final.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/org/apache/maven/maven-project/2.0.8/maven-project-2.0.8.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/org/apache/maven/maven-plugin-api/2.0.8/maven-plugin-api-2.0.8.jar"/>
diff --git a/modules/core/native-system/ant-run.xml
b/modules/core/native-system/ant-run.xml
index a98f94d..85b3363 100644
--- a/modules/core/native-system/ant-run.xml
+++ b/modules/core/native-system/ant-run.xml
@@ -11,7 +11,7 @@ Ant Script that builds a test jar to run SIGAR bug replication code.
<!-- in case it wasn't passed in, assume the default location -->
<property name="settings.localRepository"
location="${user.home}/.m2/repository"/>
<property name="project.version" value="3.0.0-SNAPSHOT"/>
- <property name="sigar.version" value="1.6.5.132-3"/>
+ <property name="sigar.version" value="1.6.5.132-5"/>
<property name="log4j.version" value="1.2.16"/>
<fileset dir="${settings.localRepository}"
id="jar.fileset">
diff --git a/modules/enterprise/agent/ant-run.xml b/modules/enterprise/agent/ant-run.xml
index 93ccd25..8d2c998 100644
--- a/modules/enterprise/agent/ant-run.xml
+++ b/modules/enterprise/agent/ant-run.xml
@@ -11,7 +11,7 @@ Ant Script that provides ways to package the Agent.
<!-- in case these weren't passed in (i.e. not invoked via maven), assume some
defaults -->
<property name="settings.localRepository"
location="${user.home}/.m2/repository"/>
<property name="project.version" value="2.0.0-SNAPSHOT"/>
- <property name="sigar.version" value="1.6.5.132-3"/>
+ <property name="sigar.version" value="1.6.5.132-5"/>
<property name="augeas.version" value="0.9.0-4"/>
<property name="augeas.classifier" value="el5"/>
<property name="augeas.zip.location"
value="${settings.localRepository}/net/augeas/augeas-native/${augeas.version}/"/>
diff --git a/pom.xml b/pom.xml
index b049493..2a332b9 100644
--- a/pom.xml
+++ b/pom.xml
@@ -129,7 +129,7 @@
<jtds.version>1.2.2</jtds.version>
<richfaces.version>3.3.3.Final</richfaces.version>
<jline.version>0.9.94</jline.version>
- <sigar.version>1.6.5.132-3</sigar.version>
+ <sigar.version>1.6.5.132-5</sigar.version>
<sigar.zip.version>1.6.5</sigar.zip.version>
<quartz.version>1.6.5</quartz.version>
<jna.version>3.2.5</jna.version>
commit 5396ba3aa0c36d12e6c67065c74a82758ba021f0
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Mar 6 17:25:40 2013 +0100
I18n for button's label within ConditionsTable.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsEditor.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsEditor.java
index f3317ed..d8e49e6 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsEditor.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/alert/definitions/ConditionsEditor.java
@@ -156,7 +156,7 @@ public class ConditionsEditor extends LocatableVLayout {
@Override
protected void configureTable() {
- addTableAction(this.extendLocatorId("add"), "Add", null,
new AbstractTableAction() {
+ addTableAction(this.extendLocatorId("add"),
MSG.common_button_add(), null, new AbstractTableAction() {
public void executeAction(ListGridRecord[] selection, Object actionValue)
{
// we need the drift definition templates (if there are any) so we
know if we should offer drift conditions as an option
commit 406d39854d0bc89e9e0e71bb0752a78130c4ec66
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Mar 6 14:16:20 2013 +0100
Adding "transaction.log" to .gitignore.
diff --git a/.gitignore b/.gitignore
index 32f606a..92b2176 100644
--- a/.gitignore
+++ b/.gitignore
@@ -10,6 +10,9 @@ dev-cli/
modules/enterprise/gui/portal-war/build/classes/
modules/enterprise/gui/coregui/build/classes/
modules/enterprise/gui/content_http-war/build/classes/
+#created by rhq-enterprise-server's unit tests
+modules/enterprise/server/jar/transaction.log
+
.idea/
.metadata/
*cache.html
@@ -26,4 +29,4 @@ modules/enterprise/gui/content_http-war/build/classes/
*~
#these are created by the python script engine during the tests
-cachedir/
\ No newline at end of file
+cachedir/
commit c0fe931b74ac8eccfc5be8af2275bea5d8c0c917
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Wed Mar 6 12:24:27 2013 +0100
[BZ 894493] - [as7] Start operation returns failure when start script returns exit
code 0 (success). Added the test for the exit[C code.
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 42c19ba..0b3cc5b 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
@@ -360,7 +360,7 @@ public abstract class BaseServerComponent<T extends
ResourceComponent<?>> extend
logExecutionResults(results);
if (results.getError() != null) {
operationResult.setErrorMessage(results.getError().getMessage());
- } else if (results.getExitCode() != null) {
+ } else if (results.getExitCode() != null && results.getExitCode() != 0)
{
operationResult.setErrorMessage("Start failed with error code " +
results.getExitCode() + ":\n"
+ results.getCapturedOutput());
} else {
commit 9d56ea4c0431e91ffb25ca1fab29e7fc17305534
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 5 14:41:13 2013 -0500
Several of our Exception classes need to be annotated as ApplicationExceptions.
This prevents them from being wrapped as EJBExceptions when returned out of
a transaction context (and therefore more easily caught as the expected exception
type).
Most of these, the specific "return-value-oriented" AlreadyExists exceptions
should not
mark the Txc for rollback.
More general exceptions can still be marked as ApplicationException, to avoid the
wrapping, but should in fact rollback the Tx, because the problem is not specific and
may be terminal to the logical operation.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceAlreadyExistsException.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceAlreadyExistsException.java
index 1afef20..6660e93 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceAlreadyExistsException.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceAlreadyExistsException.java
@@ -18,7 +18,14 @@
*/
package org.rhq.enterprise.server.resource;
-public class ResourceAlreadyExistsException extends Exception {
+import javax.ejb.ApplicationException;
+
+/**
+ * Declare this an {@link ApplicationException} because we don't want these to be
wrapped or to rollback an ongoing
+ * transaction.
+ */
+@ApplicationException(rollback = false, inherited = true)
+public class ResourceAlreadyExistsException extends RuntimeException {
private static final long serialVersionUID = -8394759185254688952L;
public ResourceAlreadyExistsException() {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeAlreadyExistsException.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeAlreadyExistsException.java
index 1a65ed7..d0c4b97 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeAlreadyExistsException.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeAlreadyExistsException.java
@@ -18,6 +18,13 @@
*/
package org.rhq.enterprise.server.resource;
+import javax.ejb.ApplicationException;
+
+/**
+ * Declare this an {@link ApplicationException} because we don't want these to be
wrapped or to rollback an ongoing
+ * transaction.
+ */
+@ApplicationException(rollback = false, inherited = true)
public class ResourceTypeAlreadyExistsException extends RuntimeException {
private static final long serialVersionUID = 1169791095984659926L;
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupAlreadyExistsException.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupAlreadyExistsException.java
index ddbd79f..eeedd2d 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupAlreadyExistsException.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupAlreadyExistsException.java
@@ -18,6 +18,13 @@
*/
package org.rhq.enterprise.server.resource.group;
+import javax.ejb.ApplicationException;
+
+/**
+ * Declare this an {@link ApplicationException} because we don't want these to be
wrapped or to rollback an ongoing
+ * transaction.
+ */
+@ApplicationException(rollback = false, inherited = true)
public class ResourceGroupAlreadyExistsException extends ResourceGroupUpdateException {
private static final long serialVersionUID = 1L;
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerRemote.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerRemote.java
index ceffcac..6e40bb5 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerRemote.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupManagerRemote.java
@@ -35,6 +35,12 @@ public interface ResourceGroupManagerRemote {
void addResourcesToGroup(Subject subject, int groupId, int[] resourceIds);
+ /**
+ * @param subject
+ * @param resourceGroup
+ * @return The new ResourceGroup
+ * @throws ResourceGroupAlreadyExistsException
+ */
ResourceGroup createResourceGroup(Subject subject, ResourceGroup resourceGroup);
void deleteResourceGroup(Subject subject, int groupId) throws
ResourceGroupNotFoundException,
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupUpdateException.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupUpdateException.java
index 7dd0701..c0dc346 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupUpdateException.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/group/ResourceGroupUpdateException.java
@@ -18,6 +18,14 @@
*/
package org.rhq.enterprise.server.resource.group;
+import javax.ejb.ApplicationException;
+
+/**
+ * Declare this an {@link ApplicationException} because we don't want these to be
wrapped. But, this is a general
+ * exception, so do allow the Tx to be marked for rollback. Only certain specific
exceptions should allow the Tx to
+ * continue.
+ */
+@ApplicationException(rollback = true, inherited = true)
public class ResourceGroupUpdateException extends RuntimeException {
private static final long serialVersionUID = 9079807311008826697L;
commit 92386ac7ed74e3ed05c80fd184733db794c9c197
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 5 14:37:24 2013 -0500
Add some overrides for unsupported global Criteria methods on the
drift criteria classes that must conform to the server plugin's interface.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
index b6c02da..97ce68b 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
@@ -292,6 +292,11 @@ public class JPADriftChangeSetCriteria extends Criteria implements
DriftChangeSe
}
@Override
+ public void addSortId(PageOrdering pageOrdering) {
+ throw new UnsupportedOperationException("The sort is not supported by
DriftChangeSetCriteria.");
+ }
+
+ @Override
public void addFilterIds(Integer... filterIds) {
throw new UnsupportedOperationException("The filter is not supported by
DriftChangeSetCriteria.");
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
index b222b58..56f0ddf 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
@@ -107,11 +107,6 @@ public class JPADriftCriteria extends Criteria implements
DriftCriteria {
}
@Override
- public void addFilterIds(Integer... filterIds) {
- throw new UnsupportedOperationException("The filter is not supported by
DriftCriteria.");
- }
-
- @Override
public String getFilterId() {
return (null == filterId) ? null : filterId.toString();
}
@@ -248,4 +243,15 @@ public class JPADriftCriteria extends Criteria implements
DriftCriteria {
public PageOrdering getSortCtime() {
return sortCtime;
}
+
+ @Override
+ public void addFilterIds(Integer... filterIds) {
+ throw new UnsupportedOperationException("The filter is not supported by
DriftCriteria.");
+ }
+
+ @Override
+ public void addSortId(PageOrdering pageOrdering) {
+ throw new UnsupportedOperationException("The sort is not supported by
DriftCriteria.");
+ }
+
}
commit 2ddc360da4203e3324b8aeb70726ab0106c26d13
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 5 12:20:32 2013 -0500
Add Unsupported exceptions for global filters
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
index bd86eb9..b6c02da 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
@@ -291,4 +291,9 @@ public class JPADriftChangeSetCriteria extends Criteria implements
DriftChangeSe
return (filterId == null) ? null : filterId.toString();
}
+ @Override
+ public void addFilterIds(Integer... filterIds) {
+ throw new UnsupportedOperationException("The filter is not supported by
DriftChangeSetCriteria.");
+ }
+
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
index 2d993b0..b222b58 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
@@ -107,6 +107,11 @@ public class JPADriftCriteria extends Criteria implements
DriftCriteria {
}
@Override
+ public void addFilterIds(Integer... filterIds) {
+ throw new UnsupportedOperationException("The filter is not supported by
DriftCriteria.");
+ }
+
+ @Override
public String getFilterId() {
return (null == filterId) ? null : filterId.toString();
}
commit f83221007972fe95022be238f4d22a563276eee4
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 5 12:10:14 2013 -0500
Fix issue with global filterId support for the JPA impls of the generic Drift
criterias. Don't have redundant filter fields and make sure the
copy constructor sets the filter. Also, allow null to be set on the filter.
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 e2d435c..abd05c4 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
@@ -120,13 +120,13 @@ public abstract class Criteria implements Serializable, BaseCriteria
{
private String searchExpression;
// All Criteria support sorting on ID
- private PageOrdering sortId;
+ protected PageOrdering sortId;
// All Criteria support filtering on ID
- private Integer filterId;
+ protected Integer filterId;
// All Criteria support filtering on IDs
- private List<Integer> filterIds;
+ protected List<Integer> filterIds;
/**
* This default constructor will set default paging to avoid unintended fetch of huge
results. The default is:
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
index 4b6a24b..bd86eb9 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
@@ -43,7 +43,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class JPADriftChangeSetCriteria extends Criteria implements DriftChangeSetCriteria
{
private static final long serialVersionUID = 1L;
- private Integer filterId;
private Integer filterInitial; // needs override
private Integer filterResourceId; // needs override
private Integer filterDriftDefinitionId; // needs override
@@ -91,6 +90,7 @@ public class JPADriftChangeSetCriteria extends Criteria implements
DriftChangeSe
+ " WHERE drift.path like ? )"); // note, this uses
'like' on purpose, it is always substring
if (null != changeSetCriteria) {
+ this.addFilterId(changeSetCriteria.getFilterId());
this.addFilterCategory(changeSetCriteria.getFilterCategory());
this.addFilterCreatedAfter(changeSetCriteria.getFilterCreatedAfter());
this.addFilterCreatedBefore(changeSetCriteria.getFilterCreatedBefore());
@@ -283,13 +283,12 @@ public class JPADriftChangeSetCriteria extends Criteria implements
DriftChangeSe
@Override
public void addFilterId(String filterId) {
- if (filterId != null) {
- this.filterId = Integer.parseInt(filterId);
- }
+ this.filterId = (filterId == null) ? null : Integer.parseInt(filterId);
}
@Override
public String getFilterId() {
- return filterId == null ? null : filterId.toString();
+ return (filterId == null) ? null : filterId.toString();
}
+
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
index 468d9b3..2d993b0 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftCriteria.java
@@ -26,8 +26,8 @@ import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlRootElement;
import org.rhq.core.domain.drift.DriftCategory;
-import org.rhq.core.domain.drift.JPADrift;
import org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode;
+import org.rhq.core.domain.drift.JPADrift;
import org.rhq.core.domain.util.CriteriaUtils;
import org.rhq.core.domain.util.PageOrdering;
@@ -41,7 +41,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class JPADriftCriteria extends Criteria implements DriftCriteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private List<DriftCategory> filterCategories = new
ArrayList<DriftCategory>();
private Integer filterChangeSetId; // needs override
private Integer filterChangeSetStartVersion; // needs override
@@ -77,6 +76,7 @@ public class JPADriftCriteria extends Criteria implements DriftCriteria
{
if (null != driftCriteria) {
this.fetchChangeSet(driftCriteria.isFetchChangeSet());
+ this.addFilterId(driftCriteria.getFilterId());
this.addFilterCategories(driftCriteria.getFilterCategories());
this.addFilterChangeSetId(driftCriteria.getFilterChangeSetId());
this.addFilterChangeSetStartVersion(driftCriteria.getFilterChangeSetStartVersion());
@@ -103,14 +103,12 @@ public class JPADriftCriteria extends Criteria implements
DriftCriteria {
@Override
public void addFilterId(String filterId) {
- if (filterId != null) {
- this.filterId = Integer.parseInt(filterId);
- }
+ this.filterId = (null == filterId) ? null : Integer.parseInt(filterId);
}
@Override
public String getFilterId() {
- return filterId == null ? null : filterId.toString();
+ return (null == filterId) ? null : filterId.toString();
}
@Override
commit 72e569540bdac7ea857b76a8b55203fba14e4d2e
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Mar 5 12:06:57 2013 -0500
Make this a little more efficient.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
index 67b6316..8f0d2cc 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
@@ -569,6 +569,7 @@ public final class CriteriaQueryGenerator {
List<Field> results = new ArrayList<Field>();
Class<?> currentLevelClass = criteria.getClass();
+ List<String> globalFields = fieldType.getGlobalFields();
boolean isCriteriaClass = false;
do {
@@ -577,7 +578,7 @@ public final class CriteriaQueryGenerator {
for (Field field : currentLevelClass.getDeclaredFields()) {
field.setAccessible(true);
if (isCriteriaClass) {
- if (fieldType.getGlobalFields().contains(field.getName()))
+ if (globalFields.contains(field.getName()))
results.add(field);
} else if (field.getName().startsWith(prefix)) {
commit 57a1d2701b3c249e1f56e34fad3cd355b4193d31
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Mar 5 16:09:06 2013 +0100
Deprecating inconsistent method (addFilterIds(List<Integer> filterIds)) since
all the other criteria classes use the addFilterIds(Integer... filterIds)
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
index b58f221..fbec172 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
@@ -58,6 +58,14 @@ public abstract class AbstractConfigurationUpdateCriteria extends
Criteria {
filterOverrides.put("endTime", "createdTime <= ?");
filterOverrides.put("statuses", "status IN ( ? )");
}
+
+ /**
+ * @param filterIds list of ids to filter
+ * @deprecated since 4.7.0 use {@link Criteria#addFilterIds(Integer... filterIds)}
instead
+ */
+ public void addFilterIds(List<Integer> filterIds) {
+ super.addFilterIds(filterIds != null ? filterIds.toArray(new
Integer[filterIds.size()]) : null);
+ }
public void addFilterStartTime(Long filterStartTime) {
this.filterStartTime = filterStartTime;
commit 04cdaa393c5b10441d246d09a3290504fb289c3e
Author: Thomas Segismont <tsegismont(a)gmail.com>
Date: Tue Mar 5 10:39:39 2013 +0100
Fix netservices itest failure
INetAddress.getLocalhostAddress was used to bind the server socket instead of
INetAddress.getLoopbackAddress
Removed pom commented section and let unit and integration tests be deactivated by
default like in all other modules
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 8a69866..03a4cbd 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -101,10 +101,6 @@
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
- <!-- TODO: Move this test execution to a profile or respect skipTests
- <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>
diff --git
a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java
b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java
index f97b222..75a9370 100644
---
a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java
+++
b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java
@@ -60,7 +60,7 @@ public class PortNetServiceComponentTest extends NetServiceComponentTest
{
private static final String SERVICE_NAME = "PortService";
- private static final String LOOPBACK = "127.0.0.1";
+ private static final InetAddress LOOPBACK_ADDRESS =
InetAddress.getLoopbackAddress();
private PortNetServiceComponent portNetServiceComponent;
@@ -76,10 +76,11 @@ public class PortNetServiceComponentTest extends
NetServiceComponentTest {
public void startSocketServer() throws Exception {
LOG.info("Setting up a socket server");
// Let's bind a server socket to any available port
- serverSocket = new ServerSocket(0, 50, InetAddress.getLocalHost());
+ serverSocket = new ServerSocket(0, 50, LOOPBACK_ADDRESS);
// Do not block indefinitely on call to #accept
serverSocket.setSoTimeout(1000);
serverSocketLocalPort = serverSocket.getLocalPort();
+ LOG.info("Using port " + serverSocketLocalPort + " for socket
server");
acceptorThread = new Thread(new Runnable() {
@Override
public void run() {
@@ -109,7 +110,7 @@ public class PortNetServiceComponentTest extends
NetServiceComponentTest {
@Test(dependsOnMethods = "testPluginLoad")
public void testManualAdd() throws Exception {
Configuration configuration = new Configuration();
- configuration.setSimpleValue(ConfigKeys.ADDRESS, LOOPBACK);
+ configuration.setSimpleValue(ConfigKeys.ADDRESS,
LOOPBACK_ADDRESS.getHostAddress());
configuration.setSimpleValue(ConfigKeys.PORT,
String.valueOf(serverSocketLocalPort));
MergeResourceResponse response = getInventoryManager().manuallyAddResource(
getPluginManager().getMetadataManager().getType(SERVICE_NAME, PLUGIN_NAME),
getPlatform().getId(),
@@ -143,7 +144,7 @@ public class PortNetServiceComponentTest extends
NetServiceComponentTest {
for (MeasurementData data : report.getTraitData()) {
datas.put(data.getName(), data.getValue());
}
- assertEquals(getTrait(datas, "ipAddress"), LOOPBACK);
+ assertEquals(getTrait(datas, "ipAddress"),
LOOPBACK_ADDRESS.getHostAddress());
assertTrue(StringUtil.isNotBlank(getTrait(datas, "hostName")));
assertTrue(getMetric(datas, "connectTime") >= 0);
}
commit 9932e9b4255b72a4161b293e52ffe8251dd6d046
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Tue Mar 5 00:45:49 2013 +0100
Removing the file that was accidentally introduced by commit c5b87b9f1.
diff --git a/condition b/condition
deleted file mode 100644
index 6e39775..0000000
--- a/condition
+++ /dev/null
@@ -1 +0,0 @@
-{"name":"AVAIL_GOES_UP","category":"AVAILABILITY","id":10001,"threshold":null,"option":null,"triggerId":null,"comparator":null,"measurementDefinition":0}
commit 23e810be1d0083da92c5ba00062c806144aa02d7
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 4 17:19:00 2013 -0500
Don't let the itests execute when skipTests is true. Maybe want to
move the itest exe to be profile activated like in AS7 plugin.
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 4a661a0..8a69866 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -101,8 +101,10 @@
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
+ <!-- TODO: Move this test execution to a profile or respect skipTests
<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>
commit f69ee11476dd5930ea6efb34e59d9a41b2aeb39f
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 4 15:48:22 2013 -0500
Make sure we have sufficent memory for the tests to run
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index 44dd0c2..ef7c906 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -18,7 +18,7 @@
<jboss.zip>${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip</jboss.zip>
<jboss.unzip.location>${basedir}/target/jboss-as-${jboss.version}</jboss.unzip.location>
<rhq.internal>false</rhq.internal>
- <jboss.vm.args></jboss.vm.args>
+ <jboss.vm.args>-Xmx700m -XX:MaxPermSize=200m</jboss.vm.args>
<jboss.vm.args.debug></jboss.vm.args.debug> <!-- -Ditest.debug can
override this, see below -->
<!-- These properties guide which datasources are used for integration tests.
Only one should be true.
The default is Postgres, specify -Pitest.oracle to use Oracle -->
commit c42180bd646fffe2621b5ea6298e48180ba8a0cb
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 4 15:20:13 2013 -0500
Fix some Drift domain itests, they stepped all over everything in
setup/cleanup.
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDataAccessTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDataAccessTest.java
deleted file mode 100644
index 083a756..0000000
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDataAccessTest.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
- * RHQ Management Platform
- * Copyright (C) 2011 Red Hat, Inc.
- * All rights reserved.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation version 2 of the License.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-package org.rhq.core.domain.drift;
-
-import javax.persistence.EntityManager;
-
-import org.testng.annotations.AfterGroups;
-import org.testng.annotations.BeforeMethod;
-
-import org.rhq.core.domain.shared.TransactionCallback;
-import org.rhq.core.domain.test.AbstractEJB3Test;
-
-public class DriftDataAccessTest extends AbstractEJB3Test {
-
- @BeforeMethod(groups = "drift.ejb")
- public final void initDB() {
- if (!inContainer()) {
- return;
- }
-
- executeInTransaction(false, new TransactionCallback() {
- @Override
- public void execute() throws Exception {
- try {
- purgeDB();
-
- } catch (Exception e) {
- System.out.println("BEFORE METHOD FAILURE, TEST DID NOT
RUN!!!");
- e.printStackTrace();
- throw e;
- }
- }
- });
- }
-
- @AfterGroups(groups = "drift.ejb")
- public void resetDB() {
- if (!inContainer()) {
- return;
- }
-
- executeInTransaction(false, new TransactionCallback() {
- @Override
- public void execute() throws Exception {
- purgeDB();
- }
- });
- }
-
- private void purgeDB() {
- EntityManager em = getEntityManager();
- em.createQuery("delete from JPADrift ").executeUpdate();
- em.createQuery("delete from JPADriftChangeSet").executeUpdate();
- em.createQuery("delete from JPADriftSet").executeUpdate();
- em.createQuery("delete from JPADriftFile").executeUpdate();
- em.createQuery("delete from DriftDefinition").executeUpdate();
- em.createQuery("delete from DriftDefinitionTemplate").executeUpdate();
- }
-
-}
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDefinitionTemplateTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDefinitionTemplateTest.java
index 49e4e26..3908284 100644
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDefinitionTemplateTest.java
+++
b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftDefinitionTemplateTest.java
@@ -28,32 +28,29 @@ import static org.rhq.test.AssertUtils.assertPropertiesMatch;
import java.util.List;
import org.testng.Assert;
-import org.testng.annotations.AfterClass;
-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.domain.shared.ResourceTypeBuilder;
import org.rhq.core.domain.shared.TransactionCallback;
+import org.rhq.core.domain.test.AbstractEJB3Test;
-public class DriftDefinitionTemplateTest extends DriftDataAccessTest {
+public class DriftDefinitionTemplateTest extends AbstractEJB3Test {
private final String RESOURCE_TYPE_NAME =
DriftDefinitionTemplateTest.class.getName();
private ResourceType resourceType;
- @BeforeMethod(groups = { "DriftDefinitionTemplate", "drift.ejb"
})
- public void init() {
- if (!inContainer()) {
- return;
- }
+ @Override
+ protected void beforeMethod() {
+
+ purgeDB();
executeInTransaction(false, new TransactionCallback() {
@Override
public void execute() throws Exception {
try {
- purgeDB();
createResourceType();
em.persist(resourceType);
@@ -66,33 +63,30 @@ public class DriftDefinitionTemplateTest extends DriftDataAccessTest
{
});
}
- @AfterClass(groups = { "DriftDefinitionTemplate", "drift.ejb" })
- public void cleanUp() {
- if (!inContainer()) {
- return;
- }
+ @Override
+ protected void afterMethod() {
+ purgeDB();
+ }
+ private void purgeDB() {
executeInTransaction(false, new TransactionCallback() {
@Override
public void execute() throws Exception {
- purgeDB();
+ List<?> results = em.createQuery("select t from ResourceType t
where t.name = :name")
+ .setParameter("name", RESOURCE_TYPE_NAME).getResultList();
+ if (results.isEmpty()) {
+ return;
+ }
+
+ ResourceType type = (ResourceType) results.get(0);
+ for (DriftDefinitionTemplate template :
type.getDriftDefinitionTemplates()) {
+ em.remove(template);
+ }
+ em.remove(type);
}
});
}
- private void purgeDB() {
- List<?> results = em.createQuery("select t from ResourceType t where
t.name = :name")
- .setParameter("name", RESOURCE_TYPE_NAME).getResultList();
- if (results.isEmpty()) {
- return;
- }
- ResourceType type = (ResourceType) results.get(0);
- for (DriftDefinitionTemplate template : type.getDriftDefinitionTemplates()) {
- em.remove(template);
- }
- em.remove(type);
- }
-
private void createResourceType() {
resourceType = new ResourceTypeBuilder().createResourceType().withId(0)
.withName(DriftDefinitionTemplateTest.class.getName()).withCategory(SERVER)
@@ -114,7 +108,7 @@ public class DriftDefinitionTemplateTest extends DriftDataAccessTest
{
driftDef.setBasedir(new DriftDefinition.BaseDirectory(fileSystem,
"/foo/bar/test"));
template.setTemplateDefinition(driftDef);
- executeInTransaction(false, new TransactionCallback() {
+ executeInTransaction(new TransactionCallback() {
@Override
public void execute() throws Exception {
em.persist(template);
@@ -145,7 +139,7 @@ public class DriftDefinitionTemplateTest extends DriftDataAccessTest
{
driftDef.setBasedir(new DriftDefinition.BaseDirectory(fileSystem,
"/foo/bar/test"));
template.setTemplateDefinition(driftDef);
- executeInTransaction(false, new TransactionCallback() {
+ executeInTransaction(new TransactionCallback() {
@Override
public void execute() throws Exception {
em.persist(template);
@@ -184,7 +178,7 @@ public class DriftDefinitionTemplateTest extends DriftDataAccessTest
{
driftDef.setBasedir(new DriftDefinition.BaseDirectory(fileSystem,
"/foo/bar/test"));
template.setTemplateDefinition(driftDef);
- executeInTransaction(false, new TransactionCallback() {
+ executeInTransaction(new TransactionCallback() {
@Override
public void execute() throws Exception {
resourceType.addDriftDefinitionTemplate(template);
@@ -217,7 +211,7 @@ public class DriftDefinitionTemplateTest extends DriftDataAccessTest
{
driftDef.setBasedir(new DriftDefinition.BaseDirectory(fileSystem,
"/foo/bar/test"));
template.setTemplateDefinition(driftDef);
- executeInTransaction(false, new TransactionCallback() {
+ executeInTransaction(new TransactionCallback() {
@Override
public void execute() throws Exception {
@@ -252,7 +246,7 @@ public class DriftDefinitionTemplateTest extends DriftDataAccessTest
{
template.setChangeSetId("1");
template.setTemplateDefinition(driftDef);
- executeInTransaction(false, new TransactionCallback() {
+ executeInTransaction(new TransactionCallback() {
@Override
public void execute() throws Exception {
@@ -289,7 +283,7 @@ public class DriftDefinitionTemplateTest extends DriftDataAccessTest
{
template.setChangeSetId("1");
template.setTemplateDefinition(driftDef);
- executeInTransaction(false, new TransactionCallback() {
+ executeInTransaction(new TransactionCallback() {
@Override
public void execute() throws Exception {
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftFileTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftFileTest.java
index e3fa25f..4cecf06 100644
--- a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftFileTest.java
+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/DriftFileTest.java
@@ -13,22 +13,22 @@ import java.sql.Blob;
import java.util.ArrayList;
import java.util.List;
-import javax.persistence.EntityManager;
-
import org.apache.commons.io.IOUtils;
+import org.hibernate.LobHelper;
import org.hibernate.Session;
import org.testng.annotations.Test;
import org.rhq.core.domain.shared.TransactionCallback;
+import org.rhq.core.domain.test.AbstractEJB3Test;
import org.rhq.core.util.MessageDigestGenerator;
-public class DriftFileTest extends DriftDataAccessTest {
+public class DriftFileTest extends AbstractEJB3Test {
static private final MessageDigestGenerator digestGen = new
MessageDigestGenerator(MessageDigestGenerator.SHA_256);
// Note, this test is more of a general Blob handling test. A real JPADriftFile never
has its content updated.
// But this is a useful test to just ensure Blob handling is working as expected.
- @Test(groups = {"driftFile", "drift.ejb"})
+ @Test(groups = { "driftFile", "drift.ejb" })
public void updateDriftFileData() throws Exception {
String content = "driftFile data";
String hashId = digestGen.calcDigestString(content);
@@ -36,36 +36,24 @@ public class DriftFileTest extends DriftDataAccessTest {
// Create the initial driftFile
final JPADriftFileBits df1 = new JPADriftFileBits(hashId);
df1.setDataSize((long) content.length());
- EntityManager em = getEntityManager();
Session session = (Session) em.getDelegate();
df1.setData(session.getLobHelper().createBlob(toInputStream(content),
content.length()));
- executeInTransaction(false, new TransactionCallback() {
+ executeInTransaction(new TransactionCallback() {
@Override
public void execute() {
- getEntityManager().persist(df1);
- }
- });
+ em.persist(df1);
+
+ // Make the update
+ final String newContent = "driftFile data updated...";
- // Make the update
- final String newContent = "driftFile data updated...";
- executeInTransaction(false, new TransactionCallback() {
- @Override
- public void execute() {
- EntityManager em = getEntityManager();
Session session = (Session) em.getDelegate();
JPADriftFileBits df2 = em.find(JPADriftFileBits.class, df1.getHashId());
df2.setData(session.getLobHelper().createBlob(toInputStream(newContent),
newContent.length()));
- getEntityManager().merge(df2);
- }
- });
+ em.merge(df2);
- // Fetch the driftFile to verify that the update was persisted
- executeInTransaction(false, new TransactionCallback() {
- @Override
- public void execute() {
try {
- JPADriftFileBits df3 =
getEntityManager().find(JPADriftFileBits.class, df1.getHashId());
+ JPADriftFileBits df3 = em.find(JPADriftFileBits.class,
df1.getHashId());
String expected = newContent;
String actual = IOUtils.toString(df3.getData());
@@ -73,6 +61,7 @@ public class DriftFileTest extends DriftDataAccessTest {
} catch (Exception e) {
fail("Failed to load driftFile data: " + e.getMessage());
}
+
}
});
}
@@ -82,100 +71,105 @@ public class DriftFileTest extends DriftDataAccessTest {
// In other words, to ensure LazyLoad semantics are working for Blobs
// Because of the amount data involved is very large the test is long
// running and should be moved to an integration test suite.
- @Test(groups = {"driftFile", "drift.ejb"})
+ @Test(groups = { "driftFile", "drift.ejb" })
public void loadMultipleDriftFilesWithoutLoadingData() throws Exception {
- int numDriftFiles = 3;
- final List<String> driftFileHashIds = new ArrayList<String>();
- for (int i = 0; i < numDriftFiles; ++i) {
- File dataFile = createDataFile("test_data.txt", 1, (char)
('a' + i));
- String hashId = digestGen.calcDigestString(dataFile);
- final JPADriftFileBits driftFile = new JPADriftFileBits(hashId);
- driftFile.setDataSize(dataFile.length());
- EntityManager em = getEntityManager();
- Session session = (Session) em.getDelegate();
- driftFile.setData(session.getLobHelper().createBlob(new
BufferedInputStream(new FileInputStream(dataFile)),
- dataFile.length()));
- dataFile.delete();
+ executeInTransaction(new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
- executeInTransaction(false, new TransactionCallback() {
- @Override
- public void execute() {
- getEntityManager().persist(driftFile);
+ int numDriftFiles = 3;
+ final List<String> driftFileHashIds = new
ArrayList<String>();
+
+ for (int i = 0; i < numDriftFiles; ++i) {
+ File dataFile = createDataFile("test_data.txt", 1, (char)
('a' + i));
+ String hashId = digestGen.calcDigestString(dataFile);
+ final JPADriftFileBits driftFile = new JPADriftFileBits(hashId);
+ driftFile.setDataSize(dataFile.length());
+
+ Session session = (Session) em.getDelegate();
+ driftFile.setData(session.getLobHelper().createBlob(
+ new BufferedInputStream(new FileInputStream(dataFile)),
dataFile.length()));
+ dataFile.delete();
+
+ em.persist(driftFile);
driftFileHashIds.add(driftFile.getHashId());
}
- });
- }
- final List<Blob> blobs = new ArrayList<Blob>();
- final List<JPADriftFileBits> driftFiles = new
ArrayList<JPADriftFileBits>();
- for (final String hashId : driftFileHashIds) {
- executeInTransaction(false, new TransactionCallback() {
- @Override
- public void execute() {
- EntityManager em = getEntityManager();
+ final List<Blob> blobs = new ArrayList<Blob>();
+ final List<JPADriftFileBits> driftFiles = new
ArrayList<JPADriftFileBits>();
+ for (final String hashId : driftFileHashIds) {
+
JPADriftFileBits driftFileBits = em.find(JPADriftFileBits.class,
hashId);
blobs.add(driftFileBits.getBlob());
driftFiles.add(driftFileBits);
}
- });
- }
- assertEquals("Failed to save or load " + numDriftFiles + "
driftFiles", numDriftFiles, driftFiles.size());
+ assertEquals("Failed to save or load " + numDriftFiles + "
driftFiles", numDriftFiles,
+ driftFiles.size());
+ }
+ });
}
// The purpose of this test is to ensure we won't store two drift files for
// the same content.
- @Test(groups = {"driftFile", "drift.ejb"})
+ @Test(groups = { "driftFile", "drift.ejb" })
public void loadSameFile() throws Exception {
+
int numDriftFiles = 2;
+ final List<JPADriftFileBits> driftFiles = new
ArrayList<JPADriftFileBits>();
final List<String> driftFileHashIds = new ArrayList<String>();
+ Session session = (Session) em.getDelegate();
+ LobHelper lobHelper = session.getLobHelper();
for (int driftFileNum = 0; driftFileNum < numDriftFiles; ++driftFileNum) {
File dataFile = createDataFile("test_data.txt", 10, 'X');
String hashId = digestGen.calcDigestString(dataFile);
final JPADriftFileBits driftFile = new JPADriftFileBits(hashId);
driftFile.setDataSize(dataFile.length());
- EntityManager em = getEntityManager();
- Session session = (Session) em.getDelegate();
- driftFile.setData(session.getLobHelper().createBlob(new
BufferedInputStream(new FileInputStream(dataFile)),
+
+ driftFile.setData(lobHelper.createBlob(new BufferedInputStream(new
FileInputStream(dataFile)),
dataFile.length()));
+ driftFiles.add(driftFile);
dataFile.delete();
-
- try {
- executeInTransaction(false, new TransactionCallback() {
- @Override
- public void execute() {
- getEntityManager().persist(driftFile);
- driftFileHashIds.add(driftFile.getHashId());
- }
- });
- if (driftFileNum >= 1) {
- fail("Should not be able to store JPADriftFile with same hashId
more than once.");
- }
-
- } catch (Exception e) {
- // expected for second file
- if (driftFileNum == 0) {
- fail("Should be able to store JPADriftFile with unique hashId -
cause: " + e);
- }
- }
}
- final List<Blob> blobs = new ArrayList<Blob>();
- final List<JPADriftFileBits> driftFiles = new
ArrayList<JPADriftFileBits>();
- for (final String hashId : driftFileHashIds) {
- executeInTransaction(false, new TransactionCallback() {
+ try {
+ executeInTransaction(new TransactionCallback() {
@Override
- public void execute() {
- JPADriftFileBits driftFileBits =
getEntityManager().find(JPADriftFileBits.class, hashId);
- blobs.add(driftFileBits.getBlob());
- driftFiles.add(driftFileBits);
+ public void execute() throws Exception {
+
+ for (JPADriftFileBits driftFile : driftFiles) {
+ try {
+ em.persist(driftFile);
+ driftFileHashIds.add(driftFile.getHashId());
+
+ if (driftFileHashIds.size() > 1) {
+ fail("Should not be able to store JPADriftFile with
same hashId more than once.");
+ }
+
+ } catch (Exception e) {
+ // expected for second file
+ if (driftFileHashIds.size() != 1) {
+ fail("Should be able to store JPADriftFile with
unique hashId - cause: " + e);
+ }
+ }
+ }
+
+ final List<Blob> blobs = new ArrayList<Blob>();
+ final List<JPADriftFileBits> driftFiles = new
ArrayList<JPADriftFileBits>();
+ for (final String hashId : driftFileHashIds) {
+ JPADriftFileBits driftFileBits = em.find(JPADriftFileBits.class,
hashId);
+ blobs.add(driftFileBits.getBlob());
+ driftFiles.add(driftFileBits);
+ }
}
});
+ } catch (Exception e) {
+ // expected because the rollback will fail as the transaction has already
terminated
}
- assertEquals("Failed to save or load " + numDriftFiles + "
driftFiles", numDriftFiles, driftFiles.size());
+ assertEquals("Failed to save or load " + driftFiles.size() + "
driftFiles", 2, driftFiles.size());
}
File workDir() throws URISyntaxException {
diff --git
a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java
b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java
index 2709158..fe30175 100644
---
a/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java
+++
b/modules/core/domain/src/test/java/org/rhq/core/domain/drift/JPADriftChangeSetTest.java
@@ -27,9 +27,6 @@ import static org.rhq.core.domain.resource.ResourceCategory.SERVER;
import java.util.List;
-import javax.persistence.EntityManager;
-
-import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import org.rhq.core.domain.configuration.Configuration;
@@ -40,8 +37,9 @@ import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.shared.ResourceBuilder;
import org.rhq.core.domain.shared.ResourceTypeBuilder;
import org.rhq.core.domain.shared.TransactionCallback;
+import org.rhq.core.domain.test.AbstractEJB3Test;
-public class JPADriftChangeSetTest extends DriftDataAccessTest {
+public class JPADriftChangeSetTest extends AbstractEJB3Test {
private final String RESOURCE_TYPE_NAME = JPADriftChangeSetTest.class.getName();
@@ -55,20 +53,15 @@ public class JPADriftChangeSetTest extends DriftDataAccessTest {
private DriftDefinition definition;
- @BeforeMethod(groups = {"JPADriftChangeSet", "drift.ejb"})
- public void init() {
- if (!inContainer()) {
- return;
- }
+ @Override
+ protected void beforeMethod() {
+
+ purgeDB();
executeInTransaction(false, new TransactionCallback() {
@Override
public void execute() throws Exception {
try {
- purgeDB();
-
- EntityManager em = getEntityManager();
-
resourceType = createResourceType();
em.persist(resourceType);
@@ -87,25 +80,45 @@ public class JPADriftChangeSetTest extends DriftDataAccessTest {
});
}
+ @Override
+ protected void afterMethod() {
+ purgeDB();
+ }
+
private void purgeDB() {
- EntityManager em = getEntityManager();
-
- List<Availability> avails = (List<Availability>)
em.createQuery("SELECT a FROM Availability a").getResultList();
- for (Availability a : avails) {
- em.remove(a);
- }
-
- List<Resource> resources = (List<Resource>) em.createQuery("from
Resource where resourceType.name = :name")
- .setParameter("name", RESOURCE_TYPE_NAME).getResultList();
- for (Resource resource : resources) {
- em.remove(resource);
- }
-
- List<ResourceType> resourceTypes = (List<ResourceType>)
em.createQuery("from ResourceType where name = :name")
- .setParameter("name", RESOURCE_TYPE_NAME).getResultList();
- for (ResourceType type : resourceTypes) {
- em.remove(type);
- }
+ executeInTransaction(false, new TransactionCallback() {
+ @Override
+ public void execute() throws Exception {
+ try {
+ // get rid of mandatory avail records on a resource
+ List<Availability> avails = (List<Availability>) em
+ .createQuery("SELECT a FROM Availability a WHERE
a.resource.resourceType.name = :name")
+ .setParameter("name",
RESOURCE_TYPE_NAME).getResultList();
+ for (Availability a : avails) {
+ em.remove(a);
+ }
+
+ List<Resource> resources = (List<Resource>) em
+ .createQuery("SELECT r from Resource r where
r.resourceType.name = :name")
+ .setParameter("name",
RESOURCE_TYPE_NAME).getResultList();
+ for (Resource resource : resources) {
+ em.remove(resource);
+ }
+
+ List<ResourceType> resourceTypes = (List<ResourceType>)
em
+ .createQuery("Select rt from ResourceType rt where rt.name =
:name")
+ .setParameter("name",
RESOURCE_TYPE_NAME).getResultList();
+ for (ResourceType type : resourceTypes) {
+ em.remove(type);
+ }
+
+ } catch (Exception e) {
+ System.out.println("AFTER METHOD FAILURE, TEST DID NOT
COMPLETE!!!");
+ e.printStackTrace();
+ throw e;
+ }
+ }
+ });
}
private ResourceType createResourceType() {
@@ -117,9 +130,7 @@ public class JPADriftChangeSetTest extends DriftDataAccessTest {
return new ResourceBuilder().createResource().withId(0)
.withName(JPADriftChangeSetTest.class.getSimpleName() + "_" +
resourceCount++)
.withResourceKey(JPADriftChangeSetTest.class.getSimpleName() + "_"
+ resourceCount)
- .withUuid(JPADriftChangeSetTest.class.getSimpleName() + "_" +
resourceCount)
- .withResourceType(type)
- .build();
+ .withUuid(JPADriftChangeSetTest.class.getSimpleName() + "_" +
resourceCount).withResourceType(type).build();
}
private DriftDefinition createDriftDefinition() {
@@ -133,12 +144,11 @@ public class JPADriftChangeSetTest extends DriftDataAccessTest {
return def;
}
- @Test(groups = {"JPADriftChangeSet", "drift.ejb"})
+ @Test(groups = { "JPADriftChangeSet", "drift.ejb" })
public void saveAndLoadInitialChangeSet() {
- executeInTransaction(false, new TransactionCallback() {
+ executeInTransaction(new TransactionCallback() {
@Override
public void execute() throws Exception {
- EntityManager em = getEntityManager();
JPADriftChangeSet changeSet = new JPADriftChangeSet(resource, 0,
COVERAGE, definition);
changeSet.setDriftHandlingMode(DriftHandlingMode.normal);
@@ -155,9 +165,7 @@ public class JPADriftChangeSetTest extends DriftDataAccessTest {
em.flush();
em.clear();
-
- JPADriftChangeSet savedChangeSet = em
- .find(JPADriftChangeSet.class, Integer.parseInt(changeSet.getId()));
+ JPADriftChangeSet savedChangeSet = em.find(JPADriftChangeSet.class,
Integer.parseInt(changeSet.getId()));
assertNotNull("Failed to persist change set", savedChangeSet);
JPADriftSet savedDriftSet = savedChangeSet.getInitialDriftSet();
commit de5cf74864f7f2b69d5e7cf15a4372b97e0c8728
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 4 15:11:58 2013 -0500
Fix itest.debug support for domain [integration] tests
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index 9775aa6..44dd0c2 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -18,6 +18,8 @@
<jboss.zip>${settings.localRepository}/org/jboss/as/jboss-as-dist/${jboss.version}/jboss-as-dist-${jboss.version}.zip</jboss.zip>
<jboss.unzip.location>${basedir}/target/jboss-as-${jboss.version}</jboss.unzip.location>
<rhq.internal>false</rhq.internal>
+ <jboss.vm.args></jboss.vm.args>
+ <jboss.vm.args.debug></jboss.vm.args.debug> <!-- -Ditest.debug can
override this, see below -->
<!-- These properties guide which datasources are used for integration tests.
Only one should be true.
The default is Postgres, specify -Pitest.oracle to use Oracle -->
<skip.postgres>false</skip.postgres>
@@ -680,17 +682,17 @@
</build>
</profile>
- <profile>
- <id>itest.debug</id>
- <activation>
- <property>
- <name>itest.debug</name>
- </property>
- </activation>
- <properties>
-
<jboss.vm.args.debug>-Xrunjdwp:transport=dt_socket,address=8798,server=y,suspend=y</jboss.vm.args.debug>
- </properties>
- </profile>
+ <profile>
+ <id>itest.debug</id>
+ <activation>
+ <property>
+ <name>itest.debug</name>
+ </property>
+ </activation>
+ <properties>
+
<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
diff --git a/modules/core/domain/src/test/resources/arquillian.xml
b/modules/core/domain/src/test/resources/arquillian.xml
index d0744f3..a55e28c 100644
--- a/modules/core/domain/src/test/resources/arquillian.xml
+++ b/modules/core/domain/src/test/resources/arquillian.xml
@@ -21,6 +21,7 @@
<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>
commit c5b87b9f1c8b77746d0a13313f8ad239385df950
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Mon Mar 4 20:22:14 2013 +0100
Added support for filtering by ID or by multiple IDs into Criteria class ->
subsequently for all derived criteria classes
diff --git a/condition b/condition
new file mode 100644
index 0000000..6e39775
--- /dev/null
+++ b/condition
@@ -0,0 +1 @@
+{"name":"AVAIL_GOES_UP","category":"AVAILABILITY","id":10001,"threshold":null,"option":null,"triggerId":null,"comparator":null,"measurementDefinition":0}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
index 242de00..b58f221 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AbstractConfigurationUpdateCriteria.java
@@ -43,8 +43,6 @@ public abstract class AbstractConfigurationUpdateCriteria extends
Criteria {
public static final String FETCH_FIELD_CONFIGURATION = "configuration";
- private Integer filterId;
- private List<Integer> filterIds; // requires overrides
private Long filterStartTime; // requires overrides
private Long filterEndTime; // requires overrides
private ConfigurationUpdateStatus filterStatus;
@@ -56,20 +54,11 @@ public abstract class AbstractConfigurationUpdateCriteria extends
Criteria {
private PageOrdering sortStatus; // requires sort override
public AbstractConfigurationUpdateCriteria() {
- filterOverrides.put("ids", "id IN ( ? )");
filterOverrides.put("startTime", "createdTime >= ?");
filterOverrides.put("endTime", "createdTime <= ?");
filterOverrides.put("statuses", "status IN ( ? )");
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
- public void addFilterIds(List<Integer> filterIds) {
- this.filterIds = filterIds;
- }
-
public void addFilterStartTime(Long filterStartTime) {
this.filterStartTime = filterStartTime;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
index b535141..e38fbcc 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AgentCriteria.java
@@ -42,7 +42,6 @@ public class AgentCriteria extends Criteria {
public static final String SORT_FIELD_NAME = "name";
- private Integer filterId;
private String filterName;
private String filterAddress;
private Integer filterPort;
@@ -65,10 +64,6 @@ public class AgentCriteria extends Criteria {
return Agent.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java
index 3e73c33..e138ef1 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertCriteria.java
@@ -52,7 +52,6 @@ public class AlertCriteria extends Criteria {
public static final String SORT_FIELD_RESOURCE_ID = "resourceId";
public static final String SORT_FIELD_RESOURCE_NAME = "resourceName";
- private Integer filterId;
private String filterTriggeredOperationName; // requires overrides
private Long filterStartTime; // requires overrides
private Long filterEndTime; // requires overrides
@@ -110,10 +109,6 @@ public class AlertCriteria extends Criteria {
return Alert.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterTriggeredOperationName(String filterTriggeredOperationName) {
this.filterTriggeredOperationName = filterTriggeredOperationName;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
index a11b88e..6ddb395 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AlertDefinitionCriteria.java
@@ -45,8 +45,6 @@ public class AlertDefinitionCriteria extends Criteria {
public static final String SORT_FIELD_RESOURCE_ID = "resourceId";
public static final String SORT_FIELD_RESOURCE_NAME = "resourceName";
- private Integer filterId;
- private List<Integer> filterIds;
private String filterName;
private String filterDescription;
private AlertPriority filterPriority;
@@ -85,7 +83,6 @@ public class AlertDefinitionCriteria extends Criteria {
filterOverrides.put("resourceOnly", "resource IS NOT NULL");
filterOverrides.put("notificationSenderNames", "id IN ("
+ "SELECT notif.alertDefinition.id FROM AlertNotification notif " +
"WHERE notif.senderName IN ( ? ))");
- filterOverrides.put("filterIds", "id IN ( ? )");
sortOverrides.put(SORT_FIELD_RESOURCE_ID, "resource.id");
sortOverrides.put(SORT_FIELD_RESOURCE_NAME, "resource.name");
@@ -98,14 +95,6 @@ public class AlertDefinitionCriteria extends Criteria {
return AlertDefinition.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
- public void addFilterIds(Integer... filterIds) {
- this.filterIds = Arrays.asList(filterIds);
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AvailabilityCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AvailabilityCriteria.java
index fcee832..838f5ba 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AvailabilityCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/AvailabilityCriteria.java
@@ -42,7 +42,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class AvailabilityCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
// this is used to perform an interval check, see below for more, or to filter out
the initial avail record
private Long filterStartTime;
private Integer filterResourceId; // requires overrides
@@ -62,10 +61,6 @@ public class AvailabilityCriteria extends Criteria {
return Availability.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
/**
* Return Availability where any portion of the Availability period falls into the
specified interval. This
* filter is mutually exclusive with filterInitialAvailability.
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
index 84018a8..abef183 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleCriteria.java
@@ -37,7 +37,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class BundleCriteria extends TaggedCriteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private List<Integer> filterBundleVersionIds; // needs overrides
private Integer filterBundleTypeId; // needs override
private String filterBundleTypeName; // needs override
@@ -75,10 +74,6 @@ public class BundleCriteria extends TaggedCriteria {
return Bundle.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
/** Convenience routine calls addFilterBundleVersionIds */
public void addFilterBundleVersionId(Integer filterBundleVersionId) {
List<Integer> ids = new ArrayList<Integer>(1);
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
index 8449905..3861cd1 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDeploymentCriteria.java
@@ -36,7 +36,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class BundleDeploymentCriteria extends TaggedCriteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private Boolean filterIsLive;
private String filterName;
private String filterDescription;
@@ -65,10 +64,6 @@ public class BundleDeploymentCriteria extends TaggedCriteria {
return BundleDeployment.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterIsLive(Boolean filterIsLive) {
this.filterIsLive = filterIsLive;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDestinationCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDestinationCriteria.java
index dcd99d8..4dfadf2 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDestinationCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleDestinationCriteria.java
@@ -35,7 +35,6 @@ import org.rhq.core.domain.bundle.BundleDestination;
public class BundleDestinationCriteria extends TaggedCriteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterName;
private String filterDescription;
private Integer filterBundleId; // needs override
@@ -60,10 +59,6 @@ public class BundleDestinationCriteria extends TaggedCriteria {
return BundleDestination.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
index 26f2b3e..71c1d7c 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleFileCriteria.java
@@ -34,7 +34,6 @@ import org.rhq.core.domain.bundle.BundleFile;
public class BundleFileCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private Integer filterBundleVersionId; // needs override
private Integer filterPackageVersionId; // needs override
@@ -51,10 +50,6 @@ public class BundleFileCriteria extends Criteria {
return BundleFile.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterBundleVersionId(Integer filterBundleVersionId) {
this.filterBundleVersionId = filterBundleVersionId;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleResourceDeploymentCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleResourceDeploymentCriteria.java
index 9e28999..7ec26d7 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleResourceDeploymentCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleResourceDeploymentCriteria.java
@@ -37,8 +37,6 @@ import org.rhq.core.domain.util.CriteriaUtils;
public class BundleResourceDeploymentCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
- private List<Integer> filterIds; // needs overrides
private Integer filterBundleDeploymentId; // requires override
private String filterBundleDeploymentName; // requires override
private Integer filterResourceId; // requires override
@@ -50,7 +48,6 @@ public class BundleResourceDeploymentCriteria extends Criteria {
private boolean fetchHistories;
public BundleResourceDeploymentCriteria() {
- filterOverrides.put("ids", "id IN ( ? )");
filterOverrides.put("bundleDeploymentId", "bundleDeployment.id =
?");
filterOverrides.put("bundleDeploymentName", "bundleDeployment.name
like ?");
filterOverrides.put("resourceId", "resource.id = ?");
@@ -62,14 +59,6 @@ public class BundleResourceDeploymentCriteria extends Criteria {
return BundleResourceDeployment.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
- public void addFilterIds(Integer... filterIds) {
- this.filterIds = CriteriaUtils.getListIgnoringNulls(filterIds);
- }
-
public void addFilterBundleDeploymentId(Integer filterBundleDeploymentId) {
this.filterBundleDeploymentId = filterBundleDeploymentId;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
index bf8b885..ef5f6e1 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BundleVersionCriteria.java
@@ -34,7 +34,6 @@ import org.rhq.core.domain.bundle.BundleVersion;
public class BundleVersionCriteria extends TaggedCriteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterDescription;
private String filterName;
private String filterVersion;
@@ -56,10 +55,6 @@ public class BundleVersionCriteria extends TaggedCriteria {
return BundleVersion.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterDescription(String filterDescription) {
this.filterDescription = filterDescription;
}
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 06f90e4..e2d435c 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
@@ -33,6 +33,7 @@ import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.util.CriteriaUtils;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
@@ -43,7 +44,7 @@ import org.rhq.core.domain.util.PageOrdering;
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class Criteria implements Serializable, BaseCriteria {
public enum Type {
- FILTER(), FETCH(), SORT(new String[] { "sortId" });
+ FILTER(new String[] { "filterId", "filterIds" }), FETCH(),
SORT(new String[] { "sortId" });
private List<String> globalFields;
@@ -59,7 +60,7 @@ public abstract class Criteria implements Serializable, BaseCriteria {
}
private Type() {
- this.globalFields = new ArrayList(0);
+ this.globalFields = new ArrayList<String>(0);
}
private Type(String[] globalFields) {
@@ -120,6 +121,12 @@ public abstract class Criteria implements Serializable, BaseCriteria
{
// All Criteria support sorting on ID
private PageOrdering sortId;
+
+ // All Criteria support filtering on ID
+ private Integer filterId;
+
+ // All Criteria support filtering on IDs
+ private List<Integer> filterIds;
/**
* This default constructor will set default paging to avoid unintended fetch of huge
results. The default is:
@@ -127,6 +134,7 @@ public abstract class Criteria implements Serializable, BaseCriteria
{
*/
public Criteria() {
this.filterOverrides = new HashMap<String, String>();
+ this.filterOverrides.put("ids", "id IN ( ? )");
this.sortOverrides = new HashMap<String, String>();
this.orderingFieldNames = new ArrayList<String>();
@@ -168,6 +176,14 @@ public abstract class Criteria implements Serializable, BaseCriteria
{
addSortField("id");
this.sortId = sortId;
}
+
+ public void addFilterId(Integer filterId) {
+ this.filterId = filterId;
+ }
+
+ public void addFilterIds(Integer... filterIds) {
+ this.filterIds = CriteriaUtils.getListIgnoringNulls(filterIds);
+ }
protected void addSortField(String fieldName) {
orderingFieldNames.add("sort" +
Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1));
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
index e1ef74a..13751f0 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DashboardCriteria.java
@@ -39,7 +39,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class DashboardCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private DashboardCategory filterCategory = DashboardCategory.INVENTORY;
private Integer filterGroupId; // needs overrides
private String filterName;
@@ -68,10 +67,6 @@ public class DashboardCriteria extends Criteria {
return Dashboard.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
/**
* If not set explicitly this defaults to {@link DashboardCategory.INVENTORY}.
* @param category
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionCriteria.java
index 708bb38..a047311 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionCriteria.java
@@ -40,7 +40,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class DriftDefinitionCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterName;
private List<Integer> filterResourceIds; // needs override
private Integer filterTemplateId;
@@ -61,10 +60,6 @@ public class DriftDefinitionCriteria extends Criteria {
return DriftDefinition.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String name) {
this.filterName = name;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionTemplateCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionTemplateCriteria.java
index d4ff131..9d27dc2 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionTemplateCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/DriftDefinitionTemplateCriteria.java
@@ -25,7 +25,6 @@ import org.rhq.core.domain.drift.DriftDefinitionTemplate;
public class DriftDefinitionTemplateCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterName;
private Integer filterResourceTypeId;
@@ -41,10 +40,6 @@ public class DriftDefinitionTemplateCriteria extends Criteria {
return DriftDefinitionTemplate.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java
index 3bf0a28..83d9678 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/EventCriteria.java
@@ -43,7 +43,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class EventCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterDetail;
private String filterSourceName; // requires overrides
private List<EventSeverity> filterSeverities;
@@ -89,10 +88,6 @@ public class EventCriteria extends Criteria {
return Event.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterDetail(String filterDetail) {
this.filterDetail = filterDetail;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
index c640bf0..a019f79 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
@@ -78,16 +78,6 @@ public class GenericDriftChangeSetCriteria implements Serializable,
DriftChangeS
private boolean strict;
@Override
- public void addFilterId(String filterId) {
- this.filterId = filterId;
- }
-
- @Override
- public String getFilterId() {
- return filterId;
- }
-
- @Override
public void addFilterVersion(String filterVersion) {
this.filterVersion = filterVersion;
}
@@ -264,4 +254,14 @@ public class GenericDriftChangeSetCriteria implements Serializable,
DriftChangeS
return result;
}
+ @Override
+ public void addFilterId(String filterId) {
+ this.filterId = filterId;
+ }
+
+ @Override
+ public String getFilterId() {
+ return filterId;
+ }
+
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java
index bf9ba40..5df6a4d 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageCriteria.java
@@ -11,7 +11,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class InstalledPackageCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private Long filterInstallationTimeMinimum; // requires overrides
private Long filterInstallationTimeMaximum; // requires overrides
private Integer filterPackageVersionId; // requires overrides
@@ -37,10 +36,6 @@ public class InstalledPackageCriteria extends Criteria {
return InstalledPackage.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterPackageVersionId(Integer filterPackageVersionId) {
this.filterPackageVersionId = filterPackageVersionId;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageHistoryCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageHistoryCriteria.java
index e640369..f2ea35b 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageHistoryCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/InstalledPackageHistoryCriteria.java
@@ -14,7 +14,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class InstalledPackageHistoryCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private Long filterInstallationTimeMinimum; // requires overrides
private Long filterInstallationTimeMaximum; // requires overrides
private Integer filterPackageVersionId; // requires overrides
@@ -49,10 +48,6 @@ public class InstalledPackageHistoryCriteria extends Criteria {
return InstalledPackageHistory.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterPackageVersionId(Integer filterPackageVersionId) {
this.filterPackageVersionId = filterPackageVersionId;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
index c80cb72..4b6a24b 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/JPADriftChangeSetCriteria.java
@@ -96,7 +96,6 @@ public class JPADriftChangeSetCriteria extends Criteria implements
DriftChangeSe
this.addFilterCreatedBefore(changeSetCriteria.getFilterCreatedBefore());
this.addFilterDriftDefinitionId(changeSetCriteria.getFilterDriftDefinitionId());
this.addFilterEndVersion(changeSetCriteria.getFilterEndVersion());
- this.addFilterId(changeSetCriteria.getFilterId());
this.addFilterResourceId(changeSetCriteria.getFilterResourceId());
this.addFilterStartVersion(changeSetCriteria.getFilterStartVersion());
this.addFilterVersion(changeSetCriteria.getFilterVersion());
@@ -117,18 +116,6 @@ public class JPADriftChangeSetCriteria extends Criteria implements
DriftChangeSe
return JPADriftChangeSet.class;
}
- @Override
- public void addFilterId(String filterId) {
- if (filterId != null) {
- this.filterId = Integer.parseInt(filterId);
- }
- }
-
- @Override
- public String getFilterId() {
- return filterId == null ? null : filterId.toString();
- }
-
public void addFilterVersion(Integer filterVersion) {
this.filterVersion = filterVersion;
}
@@ -293,4 +280,16 @@ public class JPADriftChangeSetCriteria extends Criteria implements
DriftChangeSe
public PageOrdering getSortVersion() {
return sortVersion;
}
+
+ @Override
+ public void addFilterId(String filterId) {
+ if (filterId != null) {
+ this.filterId = Integer.parseInt(filterId);
+ }
+ }
+
+ @Override
+ public String getFilterId() {
+ return filterId == null ? null : filterId.toString();
+ }
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDataTraitCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDataTraitCriteria.java
index 22df940..c032c48 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDataTraitCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDataTraitCriteria.java
@@ -133,4 +133,19 @@ public class MeasurementDataTraitCriteria extends Criteria {
addSortField(SORT_FIELD_RESOURCE_NAME);
this.sortResourceName = sortResourceName;
}
+
+ @Override
+ public void addSortId(PageOrdering sortId) {
+ throw new UnsupportedOperationException("The id column is not defined on
this entity.");
+ }
+
+ @Override
+ public void addFilterId(Integer filterId) {
+ throw new UnsupportedOperationException("The id column is not defined on
this entity.");
+ }
+
+ @Override
+ public void addFilterIds(Integer... filterIds) {
+ throw new UnsupportedOperationException("The id column is not defined on
this entity.");
+ }
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java
index 0e22859..23efae9 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementDefinitionCriteria.java
@@ -41,7 +41,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class MeasurementDefinitionCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterName;
private String filterDisplayName;
private String filterDescription;
@@ -80,10 +79,6 @@ public class MeasurementDefinitionCriteria extends Criteria {
return MeasurementDefinition.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
index f82a2cd..60b4b92 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/MeasurementScheduleCriteria.java
@@ -52,7 +52,6 @@ public class MeasurementScheduleCriteria extends Criteria {
public static final String FILTER_FIELD_AUTO_GROUP_RESOURCE_TYPE_ID =
"autoGroupResourceTypeId";
public static final String FILTER_FIELD_AUTO_GROUP_PARENT_RESOURCE_ID =
"autoGroupParentResourceId";
- private Integer filterId;
private Boolean filterEnabled;
private List<Integer> filterDefinitionIds; // requires overrides
private Integer filterResourceId; // requires overrides
@@ -99,10 +98,6 @@ public class MeasurementScheduleCriteria extends Criteria {
return MeasurementSchedule.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterEnabled(Boolean filterEnabled) {
this.filterEnabled = filterEnabled;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java
index 854a561..e89361b 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationDefinitionCriteria.java
@@ -39,7 +39,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class OperationDefinitionCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterName;
private String filterDisplayName;
private String filterDescription;
@@ -76,10 +75,6 @@ public class OperationDefinitionCriteria extends Criteria {
return OperationDefinition.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java
index 86e4554..7a82678 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/OperationHistoryCriteria.java
@@ -41,7 +41,6 @@ import org.rhq.core.domain.util.PageOrdering;
public abstract class OperationHistoryCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterJobName;
private String filterJobGroup;
private OperationRequestStatus filterStatus;
@@ -83,10 +82,6 @@ public abstract class OperationHistoryCriteria extends Criteria {
return OperationHistory.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterJobId(JobId filterJobId) {
this.filterJobName = filterJobId.getJobName();
this.filterJobGroup = filterJobId.getJobGroup();
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageCriteria.java
index 306ce0a..176931b 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageCriteria.java
@@ -36,7 +36,6 @@ public class PackageCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterName;
private String filterClassification;
private Integer filterPackageTypeId;
@@ -56,10 +55,6 @@ public class PackageCriteria extends Criteria {
public Class<?> getPersistentClass() {
return Package.class;
}
-
- public void addFilterId(Integer id) {
- this.filterId = id;
- }
public void addFilterName(String name) {
this.filterName = name;
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
index 592cea1..77387cd 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PackageVersionCriteria.java
@@ -11,7 +11,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class PackageVersionCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private Integer filterPackageId; // requires override
private Integer filterRepoId; // requires overrides
private Integer filterResourceId; // requires overrides
@@ -55,10 +54,6 @@ public class PackageVersionCriteria extends Criteria {
return PackageVersion.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterRepoId(Integer filterRepoId) {
this.filterRepoId = filterRepoId;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PartitionEventCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PartitionEventCriteria.java
index 975d425..40ff836 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PartitionEventCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/PartitionEventCriteria.java
@@ -44,7 +44,6 @@ public class PartitionEventCriteria extends Criteria {
public static final String SORT_FIELD_CTIME = "ctime";
- private Integer filterId;
private List<PartitionEventType> filterEventType; // requires override
private List<ExecutionStatus> filterExecutionStatus; // requires override
private String filterEventDetail;
@@ -60,10 +59,6 @@ public class PartitionEventCriteria extends Criteria {
return PartitionEvent.class;
}
- public void addFilterId(Integer id) {
- this.filterId = id;
- }
-
public void addFilterEventType(PartitionEventType... filterEventType) {
if (filterEventType != null && filterEventType.length > 0) {
this.filterEventType = Arrays.asList(filterEventType);
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java
index f6912b0..26f3923 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RepoCriteria.java
@@ -39,7 +39,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class RepoCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterName;
private String filterDescription;
private List<Integer> filterResourceIds; // needs overrides
@@ -71,10 +70,6 @@ public class RepoCriteria extends Criteria {
return Repo.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
index 24e5bb9..e8a5e0f 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceCriteria.java
@@ -45,7 +45,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class ResourceCriteria extends TaggedCriteria {
private static final long serialVersionUID = 2L;
- private Integer filterId;
private String filterName;
private String filterResourceKey;
private InventoryStatus filterInventoryStatus = InventoryStatus.COMMITTED; //
default
@@ -66,7 +65,6 @@ public class ResourceCriteria extends TaggedCriteria {
private AvailabilityType filterCurrentAvailability; // needs overrides
private Long filterStartItime;
private Long filterEndItime;
- private List<Integer> filterIds; // needs overrides
private List<Integer> filterExplicitGroupIds; // requires overrides
private List<Integer> filterImplicitGroupIds; // requires overrides
private Integer filterRootResourceId; // requires overrides
@@ -129,7 +127,6 @@ public class ResourceCriteria extends TaggedCriteria {
filterOverrides.put("currentAvailability",
"currentAvailability.availabilityType = ?");
filterOverrides.put("startItime", "itime >= ?");
filterOverrides.put("endItime", "itime <= ?");
- filterOverrides.put("ids", "id IN ( ? )");
filterOverrides.put("explicitGroupIds", "" //
+ "id IN ( SELECT ires.id " //
+ " FROM Resource ires " //
@@ -158,10 +155,6 @@ public class ResourceCriteria extends TaggedCriteria {
return Resource.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
@@ -254,10 +247,6 @@ public class ResourceCriteria extends TaggedCriteria {
filterEndItime = itime;
}
- public void addFilterIds(Integer... filterIds) {
- this.filterIds = CriteriaUtils.getListIgnoringNulls(filterIds);
- }
-
public void addFilterExplicitGroupIds(Integer... filterExplicitGroupIds) {
this.filterExplicitGroupIds =
CriteriaUtils.getListIgnoringNulls(filterExplicitGroupIds);
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
index dda954f..2bbb609 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupCriteria.java
@@ -41,7 +41,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class ResourceGroupCriteria extends TaggedCriteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterName;
private Boolean filterRecursive;
private Integer filterResourceTypeId; // requires overrides
@@ -59,7 +58,6 @@ public class ResourceGroupCriteria extends TaggedCriteria {
private Integer filterGroupDefinitionId; // requires overrides
private Boolean filterPrivate; /* if true, show only private groups for the calling
user */
private Boolean filterVisible = true; /* only show visible groups by default */
- private List<Integer> filterIds; // requires overrides
private NonBindingOverrideFilter filterBundleTargetableOnly; // requires overrides -
finds only those that have bundle config - that is, can be targeted for bundle deployment
private boolean fetchExplicitResources;
@@ -116,7 +114,6 @@ public class ResourceGroupCriteria extends TaggedCriteria {
+ " JOIN res.explicitGroups explicitGroup " //
+ " WHERE resourcegroup.id = explicitGroup.id AND NOT
res.resourceType.name = ? AND res.inventoryStatus = 'COMMITTED' )");
filterOverrides.put("groupDefinitionId", "groupDefinition.id =
?");
- filterOverrides.put("ids", "id IN ( ? )");
filterOverrides.put("bundleTargetableOnly",
"resourceType.bundleConfiguration IS NOT NULL");
sortOverrides.put("resourceTypeName", "resourceType.name");
@@ -128,10 +125,6 @@ public class ResourceGroupCriteria extends TaggedCriteria {
return ResourceGroup.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
/**
* Only returns groups with at least this many downed implicit resource members
*/
@@ -236,10 +229,6 @@ public class ResourceGroupCriteria extends TaggedCriteria {
return (Boolean.TRUE.equals(this.filterVisible));
}
- public void addFilterIds(Integer... filterIds) {
- this.filterIds = CriteriaUtils.getListIgnoringNulls(filterIds);
- }
-
/**
* If true is passed in, only those groups that can be targeted for bundle
deployments will
* be fetched. By definition, this means no mixed groups are ever fetched and only
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java
index 356dabc..188c3f0 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceGroupDefinitionCriteria.java
@@ -36,7 +36,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class ResourceGroupDefinitionCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterName;
private String filterDescription;
private Boolean filterRecursive;
@@ -58,10 +57,6 @@ public class ResourceGroupDefinitionCriteria extends Criteria {
return GroupDefinition.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
index 1641ab2..073741c 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ResourceTypeCriteria.java
@@ -46,9 +46,7 @@ import org.rhq.core.domain.util.PageOrdering;
public class ResourceTypeCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private Integer filterParentId; // required overrides
- private List<Integer> filterIds; // requires overrides
private String filterName;
private String filterDescription;
@@ -92,7 +90,6 @@ public class ResourceTypeCriteria extends Criteria {
+ " JOIN innerRt.parentResourceTypes innerParentRt " //
+ " WHERE innerParentRt.id IN ( ? ) )");
filterOverrides.put("pluginName", "plugin like ?");
- filterOverrides.put("ids", "id in ( ? )");
filterOverrides.put("bundleTypeId", "bundleType.id = ?");
filterOverrides.put("categories", "category in ( ? )");
filterOverrides.put("parentResourceTypesEmpty", "" //
@@ -109,18 +106,10 @@ public class ResourceTypeCriteria extends Criteria {
return ResourceType.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterParentId(Integer filterParentId) {
this.filterParentId = filterParentId;
}
- public void addFilterIds(Integer... filterIds) {
- this.filterIds = Arrays.asList(filterIds);
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
@@ -253,5 +242,4 @@ public class ResourceTypeCriteria extends Criteria {
addSortField("pluginName");
this.sortPluginName = sortPluginName;
}
-
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
index 4cbdf7c..21ea647 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/RoleCriteria.java
@@ -40,12 +40,10 @@ public class RoleCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterDescription;
private String filterName;
private Integer filterSubjectId; // needs overrides
private Integer filterLdapSubjectId; // needs overrides
- private List<Integer> filterIds; // needs overrides
private boolean fetchPermissions;
private boolean fetchResourceGroups;
@@ -67,8 +65,6 @@ public class RoleCriteria extends Criteria {
+ " FROM Role innerRole " //
+ " JOIN innerRole.ldapSubjects innerSubject " //
+ " WHERE innerSubject.id = ? )");
-
- filterOverrides.put("ids", "id IN ( ? )");
}
@Override
@@ -76,10 +72,6 @@ public class RoleCriteria extends Criteria {
return Role.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
@@ -96,10 +88,6 @@ public class RoleCriteria extends Criteria {
this.filterLdapSubjectId = filterLdapSubjectId;
}
- public void addFilterIds(Integer... filterIds) {
- this.filterIds = CriteriaUtils.getListIgnoringNulls(filterIds);
- }
-
/**
* Requires MANAGE_SECURITY
*
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
index 634dc15..7efbbb1 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SavedSearchCriteria.java
@@ -37,7 +37,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class SavedSearchCriteria extends Criteria {
public static final long serialVersionUID = 1L;
- private Integer filterId;
private SearchSubsystem filterSearchSubsystem;
private String filterName;
private String filterDescription;
@@ -69,10 +68,6 @@ public class SavedSearchCriteria extends Criteria {
return SavedSearch.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterSearchSubsystem(SearchSubsystem filterSearchSubsystem) {
this.filterSearchSubsystem = filterSearchSubsystem;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java
index ebbdbc6..b693890 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/ServerCriteria.java
@@ -47,7 +47,6 @@ public class ServerCriteria extends Criteria {
public static final String SORT_FIELD_COMPUTE_POWER = "computePower";
- private Integer filterId;
private String filterName;
private String filterAddress;
private Integer filterPort;
@@ -72,10 +71,6 @@ public class ServerCriteria extends Criteria {
return Server.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
index 71c2bea..f3ed640 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/SubjectCriteria.java
@@ -41,7 +41,6 @@ import org.rhq.core.domain.util.PageOrdering;
public class SubjectCriteria extends Criteria {
private static final long serialVersionUID = 1L;
- private Integer filterId;
private String filterName;
private String filterFirstName;
private String filterLastName;
@@ -52,7 +51,6 @@ public class SubjectCriteria extends Criteria {
private Boolean filterFactive;
private Boolean filterFsystem;
private Integer filterRoleId; // needs overrides
- private List<Integer> filterIds; // needs overrides
private boolean fetchConfiguration;
private boolean fetchRoles;
@@ -72,7 +70,6 @@ public class SubjectCriteria extends Criteria {
+ " JOIN innerSubject.roles innerRole " //
+ " WHERE innerRole.id = ? )");
- filterOverrides.put("ids", "id IN ( ? )");
}
@Override
@@ -80,10 +77,6 @@ public class SubjectCriteria extends Criteria {
return Subject.class;
}
- public void addFilterId(Integer filterId) {
- this.filterId = filterId;
- }
-
public void addFilterName(String filterName) {
this.filterName = filterName;
}
@@ -124,10 +117,6 @@ public class SubjectCriteria extends Criteria {
this.filterRoleId = filterRoleId;
}
- public void addFilterIds(Integer... filterIds) {
- this.filterIds = CriteriaUtils.getListIgnoringNulls(filterIds);
- }
-
public void fetchConfiguration(boolean fetchConfiguration) {
this.fetchConfiguration = fetchConfiguration;
}
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
index cdce132..de448fa 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/AbstractConfigurationHistoryDataSource.java
@@ -335,7 +335,7 @@ public abstract class AbstractConfigurationHistoryDataSource<T
extends AbstractR
List<Integer> ids = getFilter(request, CriteriaField.IDS, List.class);
if (ids != null) {
- criteria.addFilterIds(ids);
+ criteria.addFilterIds(ids.toArray(new Integer[0]));
}
Boolean fetchConfiguration =
request.getAttributeAsBoolean(RequestProperty.FETCH_CONFIGURATION);
commit 157e81481a43db6991e544f5fd9f3f3fb4d1e33a
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Mon Mar 4 16:26:17 2013 +0100
New PortService in netservices plugin
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
index b28d03f..0072004 100644
---
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
@@ -35,8 +35,7 @@ class HTTPNetServiceComponentConfiguration {
private Pattern responseValidationPattern;
- public HTTPNetServiceComponentConfiguration(URL endPointUrl, HttpMethod httpMethod,
- Pattern responseValidationPattern) {
+ HTTPNetServiceComponentConfiguration(URL endPointUrl, HttpMethod httpMethod, Pattern
responseValidationPattern) {
this.endPointUrl = endPointUrl;
this.httpMethod = httpMethod;
this.responseValidationPattern = responseValidationPattern;
@@ -54,4 +53,4 @@ class HTTPNetServiceComponentConfiguration {
return responseValidationPattern;
}
-}
\ No newline at end of file
+}
diff --git
a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceComponent.java
b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceComponent.java
new file mode 100644
index 0000000..618fb5a
--- /dev/null
+++
b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceComponent.java
@@ -0,0 +1,151 @@
+/*
+ * 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 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.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.util.StringUtil;
+
+import java.io.Closeable;
+import java.io.IOException;
+import java.net.InetAddress;
+import java.net.InetSocketAddress;
+import java.net.Socket;
+import java.net.UnknownHostException;
+import java.util.Set;
+
+/**
+ * @author Thomas Segismont
+ */
+public class PortNetServiceComponent implements ResourceComponent, MeasurementFacet {
+
+ public static final class ConfigKeys {
+
+ private ConfigKeys() {
+ // Defensive
+ }
+
+ public static final String ADDRESS = "address";
+ public static final String PORT = "port";
+
+ }
+
+ private static final Log LOG = LogFactory.getLog(PortNetServiceComponent.class);
+
+ private static final int CONNECTION_TIMEOUT = 2000;
+
+ private PortNetServiceComponentConfiguration componentConfiguration;
+
+ @Override
+ public void start(ResourceContext resourceContext) throws
InvalidPluginConfigurationException {
+ componentConfiguration =
createComponentConfiguration(resourceContext.getPluginConfiguration());
+ }
+
+ static PortNetServiceComponentConfiguration
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");
+ }
+ String portString = pluginConfig.getSimpleValue(ConfigKeys.PORT,
StringUtil.EMPTY_STRING);
+ if (StringUtil.isBlank(portString)) {
+ throw new InvalidPluginConfigurationException("Port is not
defined");
+ }
+ int port;
+ try {
+ port = Integer.parseInt(portString);
+ } catch (NumberFormatException e) {
+ throw new InvalidPluginConfigurationException("Invalid port number:
" + portString);
+ }
+ InetAddress address;
+ try {
+ address = InetAddress.getByName(addressString);
+ } catch (UnknownHostException uhe) {
+ throw new InvalidPluginConfigurationException(uhe);
+ }
+ return new PortNetServiceComponentConfiguration(address, port);
+ }
+
+ @Override
+ public void stop() {
+ componentConfiguration = null;
+ }
+
+ @Override
+ public AvailabilityType getAvailability() {
+ return portReachable() ? AvailabilityType.UP : AvailabilityType.DOWN;
+ }
+
+ @Override
+ public void getValues(MeasurementReport report, Set<MeasurementScheduleRequest>
metrics) throws Exception {
+ for (MeasurementScheduleRequest request : metrics) {
+ if (request.getName().equals("ipAddress")) {
+ report.addData(new MeasurementDataTrait(request,
componentConfiguration.getAddress().getHostAddress()));
+ } else if (request.getName().equals("hostName")) {
+ report.addData(new MeasurementDataTrait(request,
componentConfiguration.getAddress()
+ .getCanonicalHostName()));
+ } else if (request.getName().equals("connectTime")) {
+ long start = System.currentTimeMillis();
+ if (portReachable()) {
+ report.addData(new MeasurementDataNumeric(request, (double)
(System.currentTimeMillis() - start)));
+ }
+ }
+ }
+ }
+
+ private boolean portReachable() {
+ Socket socket = null;
+ try {
+ socket = new Socket();
+ socket.connect(
+ new InetSocketAddress(componentConfiguration.getAddress(),
componentConfiguration.getPort()),
+ CONNECTION_TIMEOUT);
+ return true;
+ } catch (Exception e) {
+ if (LOG.isWarnEnabled()) {
+ LOG.warn("Unable to reach remote port: " +
componentConfiguration.toString(), e);
+ }
+ } finally {
+ if (socket != null) {
+ closeQuietly(socket);
+ }
+ }
+ return false;
+ }
+
+ private void closeQuietly(Closeable closeable) {
+ try {
+ closeable.close();
+ } catch (IOException ignore) {
+ }
+ }
+
+}
diff --git
a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceComponentConfiguration.java
b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceComponentConfiguration.java
new file mode 100644
index 0000000..1419434
--- /dev/null
+++
b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceComponentConfiguration.java
@@ -0,0 +1,51 @@
+/*
+ * 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 java.net.InetAddress;
+
+/**
+ * @author Thomas Segismont
+ */
+class PortNetServiceComponentConfiguration {
+
+ private InetAddress address;
+
+ private int port;
+
+ PortNetServiceComponentConfiguration(InetAddress address, int port) {
+ this.address = address;
+ this.port = port;
+ }
+
+ public InetAddress getAddress() {
+ return address;
+ }
+
+ public int getPort() {
+ return port;
+ }
+
+ @Override
+ public String toString() {
+ return "PortNetServiceComponentConfiguration[" + "address=" +
address + ", port=" + port + ']';
+ }
+}
diff --git
a/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceDiscoveryComponent.java
b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceDiscoveryComponent.java
new file mode 100644
index 0000000..227d941
--- /dev/null
+++
b/modules/plugins/netservices/src/main/java/org/rhq/plugins/netservices/PortNetServiceDiscoveryComponent.java
@@ -0,0 +1,63 @@
+/*
+ * 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 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.pluginapi.inventory.ResourceDiscoveryComponent;
+import org.rhq.core.pluginapi.inventory.ResourceDiscoveryContext;
+
+import java.util.Collections;
+import java.util.Set;
+
+/**
+ * @author Thomas Segismont
+ */
+public class PortNetServiceDiscoveryComponent implements ResourceDiscoveryComponent,
ManualAddFacet {
+
+ private static final String RESOURCE_PREFIX = "Port ";
+
+ private static final String SEPARATOR = ":";
+
+ @Override
+ public Set<DiscoveredResourceDetails>
discoverResources(ResourceDiscoveryContext context)
+ throws InvalidPluginConfigurationException, Exception {
+ // No automatic discovery
+ return Collections.EMPTY_SET;
+ }
+
+ @Override
+ public DiscoveredResourceDetails discoverResource(Configuration pluginConfiguration,
+ ResourceDiscoveryContext context) throws InvalidPluginConfigurationException {
+ PortNetServiceComponentConfiguration componentConfiguration =
PortNetServiceComponent
+ .createComponentConfiguration(pluginConfiguration);
+ String resourceKey = createResourceKey(componentConfiguration);
+ return new DiscoveredResourceDetails(context.getResourceType(), resourceKey,
resourceKey, null, null,
+ pluginConfiguration, null);
+ }
+
+ private String createResourceKey(PortNetServiceComponentConfiguration
componentConfiguration) {
+ return RESOURCE_PREFIX + componentConfiguration.getAddress().getHostAddress() +
SEPARATOR
+ + componentConfiguration.getPort();
+ }
+}
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 16a48d5..c4aee62 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
@@ -64,7 +64,21 @@
</service>
+ <service name="PortService"
+ discovery="PortNetServiceDiscoveryComponent"
+ class="PortNetServiceComponent"
+ supportsManualAdd="true"
+ description="Remote Port monitoring service">
-</plugin>
+ <plugin-configuration>
+ <c:simple-property name="address" description="Remote IP
address" />
+ <c:simple-property name="port" description="Remote
port" type="integer" />
+ </plugin-configuration>
+
+ <metric property="ipAddress" displayType="summary"
dataType="trait" description="The ip address of the host"/>
+ <metric property="hostName" displayType="summary"
dataType="trait" description="The hostname of the host"/>
+ <metric property="connectTime" units="milliseconds"
displayType="summary" description="Time to establish connection"/>
-
\ No newline at end of file
+ </service>
+
+</plugin>
diff --git
a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PortNetServiceDiscoveryComponentTest.java
b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PortNetServiceDiscoveryComponentTest.java
new file mode 100644
index 0000000..ec50f91
--- /dev/null
+++
b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/PortNetServiceDiscoveryComponentTest.java
@@ -0,0 +1,128 @@
+/*
+ * 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 org.mockito.Mock;
+import org.mockito.MockitoAnnotations;
+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.PortNetServiceComponent.ConfigKeys;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import java.net.UnknownHostException;
+
+import static org.mockito.Mockito.when;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.fail;
+
+/**
+ * @author Thomas Segismont
+ */
+public class PortNetServiceDiscoveryComponentTest {
+
+ private PortNetServiceDiscoveryComponent portNetServiceDiscoveryComponent;
+
+ private Configuration configuration;
+
+ @Mock
+ private ResourceDiscoveryContext<?> resourceDiscoveryContext;
+
+ @Mock
+ private ResourceType resourceType;
+
+ @BeforeMethod(alwaysRun = true)
+ protected void setUp() throws Exception {
+ portNetServiceDiscoveryComponent = new PortNetServiceDiscoveryComponent();
+ configuration = new Configuration();
+ configuration.setSimpleValue(ConfigKeys.ADDRESS, "127.0.0.1");
+ configuration.setSimpleValue(ConfigKeys.PORT, "8080");
+ MockitoAnnotations.initMocks(this);
+ when(resourceDiscoveryContext.getResourceType()).thenReturn(resourceType);
+ }
+
+ @Test
+ public void testDiscoverResources() throws Exception {
+ // Manual add only, should always return empty set
+ assertEquals(0,
portNetServiceDiscoveryComponent.discoverResources(null).size());
+ }
+
+ @Test
+ public void testValidComponentConfiguration() {
+ try {
+ DiscoveredResourceDetails resourceDetails =
portNetServiceDiscoveryComponent.discoverResource(
+ configuration, resourceDiscoveryContext);
+ assertEquals(resourceDetails.getResourceType(), resourceType);
+ } catch (InvalidPluginConfigurationException e) {
+ fail("Component configuration should be valid", e);
+ }
+ }
+
+ @Test
+ public void testMissingAddress() {
+ configuration.remove(ConfigKeys.ADDRESS);
+ try {
+ portNetServiceDiscoveryComponent.discoverResource(configuration,
resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getMessage(), "Address is not defined");
+ }
+ }
+
+ @Test
+ public void testMissingPort() {
+ configuration.remove(ConfigKeys.PORT);
+ try {
+ portNetServiceDiscoveryComponent.discoverResource(configuration,
resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getMessage(), "Port is not defined");
+ }
+ }
+
+ @Test
+ public void testInvalidPortNumberFormat() {
+ String configPort = "NaN";
+ configuration.setSimpleValue(ConfigKeys.PORT, configPort);
+ try {
+ portNetServiceDiscoveryComponent.discoverResource(configuration,
resourceDiscoveryContext);
+ fail("Component configuration should be invalid");
+ } catch (InvalidPluginConfigurationException e) {
+ assertEquals(e.getMessage(), "Invalid port number: " +
configPort);
+ }
+ }
+
+ @Test
+ public void testMalformedAddress() {
+ String configAddress = "pipomolo";
+ configuration.setSimpleValue(ConfigKeys.ADDRESS, configAddress);
+ try {
+ portNetServiceDiscoveryComponent.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/PortNetServiceComponentTest.java
b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java
new file mode 100644
index 0000000..f97b222
--- /dev/null
+++
b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/PortNetServiceComponentTest.java
@@ -0,0 +1,151 @@
+/*
+ * 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.InetAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Map;
+import java.util.Set;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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.core.util.StringUtil;
+import org.rhq.plugins.netservices.PortNetServiceComponent;
+import org.rhq.plugins.netservices.PortNetServiceComponent.ConfigKeys;
+
+/**
+ * @author Thomas Segismont
+ */
+public class PortNetServiceComponentTest extends NetServiceComponentTest {
+
+ private static final Log LOG = LogFactory.getLog(PortNetServiceComponentTest.class);
+
+ private static final String SERVICE_NAME = "PortService";
+
+ private static final String LOOPBACK = "127.0.0.1";
+
+ private PortNetServiceComponent portNetServiceComponent;
+
+ private ServerSocket serverSocket;
+
+ private int serverSocketLocalPort;
+
+ private Thread acceptorThread;
+
+ private volatile boolean stopListening = false;
+
+ @BeforeClass
+ public void startSocketServer() throws Exception {
+ LOG.info("Setting up a socket server");
+ // Let's bind a server socket to any available port
+ serverSocket = new ServerSocket(0, 50, InetAddress.getLocalHost());
+ // Do not block indefinitely on call to #accept
+ serverSocket.setSoTimeout(1000);
+ serverSocketLocalPort = serverSocket.getLocalPort();
+ acceptorThread = new Thread(new Runnable() {
+ @Override
+ public void run() {
+ while (!stopListening) {
+ try {
+ Socket socket = serverSocket.accept();
+ socket.close();
+ } catch (IOException ignore) {
+ }
+ }
+ }
+ });
+ acceptorThread.setDaemon(true);
+ acceptorThread.start();
+ }
+
+ @AfterClass
+ public void stopSocketServer() {
+ LOG.info("Shutting down socket server");
+ stopListening = true;
+ try {
+ serverSocket.close();
+ } catch (IOException ignore) {
+ }
+ }
+
+ @Test(dependsOnMethods = "testPluginLoad")
+ public void testManualAdd() throws Exception {
+ Configuration configuration = new Configuration();
+ configuration.setSimpleValue(ConfigKeys.ADDRESS, LOOPBACK);
+ configuration.setSimpleValue(ConfigKeys.PORT,
String.valueOf(serverSocketLocalPort));
+ 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(), PortNetServiceComponent.class);
+ portNetServiceComponent = (PortNetServiceComponent) resourceComponent;
+ }
+
+ @Test(dependsOnMethods = "testManualAdd")
+ public void testAvailability() throws Exception {
+ assertEquals(portNetServiceComponent.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++, "connectTime",
1000, true, DataType.MEASUREMENT));
+ portNetServiceComponent.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, "connectTime") >= 0);
+ }
+
+}
commit b4d437e04fa3153c344735f5e6e0e2a2cba4917f
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Mar 4 09:22:04 2013 -0500
Remove a jdoc @link to a class not accessible to the domain module.
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 6088098..06f90e4 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
@@ -50,7 +50,7 @@ public abstract class Criteria implements Serializable, BaseCriteria {
/**
* Use this to get the global fields for this Criteria field type. Don't use
inspection as the field names
* for this abstract base class do not conform (for legacy reasons) to the prefix
convention help by the
- * subclasses. This is likely only relevant to {@link CriteriaQueryGenerator}.
+ * subclasses.
*
* @return The set of global fields for this Criteria field type. Meaning, usable
by all subclasses.
*/
commit 4b5df1a09b151990762b43998d247a4f1b884bcf
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Mon Mar 4 13:44:49 2013 +0100
Removing an import to a class from unreachable modul (fixing the build).
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 84c31e2..6088098 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
@@ -36,7 +36,6 @@ import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
-import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
/**
* @author Joseph Marques
commit 6b83d05c24d61097441e36ddf995428ebb3870df
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 1 17:59:52 2013 -0500
A fix to the Criteria class's sortId support, recently added to support
default ID sorting in CriteriaQuery.
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 2ae6859..84c31e2 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
@@ -36,6 +36,7 @@ import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
+import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
/**
* @author Joseph Marques
@@ -43,7 +44,28 @@ import org.rhq.core.domain.util.PageOrdering;
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class Criteria implements Serializable, BaseCriteria {
public enum Type {
- FILTER, FETCH, SORT;
+ FILTER(), FETCH(), SORT(new String[] { "sortId" });
+
+ private List<String> globalFields;
+
+ /**
+ * Use this to get the global fields for this Criteria field type. Don't use
inspection as the field names
+ * for this abstract base class do not conform (for legacy reasons) to the prefix
convention help by the
+ * subclasses. This is likely only relevant to {@link CriteriaQueryGenerator}.
+ *
+ * @return The set of global fields for this Criteria field type. Meaning, usable
by all subclasses.
+ */
+ public List<String> getGlobalFields() {
+ return globalFields;
+ }
+
+ private Type() {
+ this.globalFields = new ArrayList(0);
+ }
+
+ private Type(String[] globalFields) {
+ this.globalFields = Arrays.asList(globalFields);
+ }
}
/**
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index b1ca9fe..ca80dd7 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -960,7 +960,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertNotNull(r);
assertEquals(b.getName(), r.getName());
}
-
+
@Test(enabled = TESTS_ENABLED)
public void testFindBundlesByCriteriaPaging() throws Exception {
Bundle b = null;
@@ -1009,14 +1009,13 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertEquals(1, bs.size());
assertEquals(b10, bs.get(0));
}
-
-
+
@Test(enabled = TESTS_ENABLED)
public void testFindAndDeleteBundlesByCriteriaQuery() throws Exception {
// verify that all bundle version objects are actually parsed.
Map<String, Bundle> bundleNames = new HashMap<String, Bundle>();
- final int bundleCount = 50;
-
+ final int bundleCount = 50;
+
Bundle b01 = createBundle("name01");
for (int i = 1; i < bundleCount; i++) {
createBundle("name" + String.format("%02d", i + 1));
@@ -1030,7 +1029,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
final List<Integer> pagesFlipped = new ArrayList<Integer>();
pagesFlipped.add(0);
-
+
// iterate over the results with CriteriaQuery
CriteriaQueryExecutor<Bundle, BundleCriteria> queryExecutor = new
CriteriaQueryExecutor<Bundle, BundleCriteria>() {
@Override
@@ -1040,8 +1039,8 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
}
};
- CriteriaQuery<Bundle, BundleCriteria> bundles = new
CriteriaQuery<Bundle, BundleCriteria>(
- criteria, queryExecutor);
+ CriteriaQuery<Bundle, BundleCriteria> bundles = new
CriteriaQuery<Bundle, BundleCriteria>(criteria,
+ queryExecutor);
List<Integer> toRemove = new ArrayList<Integer>(bundleNames.size());
String prevName = null;
@@ -1053,7 +1052,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
toRemove.add(b.getId());
bundleNames.remove(String.valueOf(b.getName()));
}
-
+
// remove the bundles
for (int id : toRemove) {
bundleManager.deleteBundle(overlord, id);
@@ -1062,14 +1061,14 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
// check if the page was flipped the correct amount of times
assertTrue("While iterating the bundles, the findBundlesByCriteria should be
called " + bundleCount / pageSize
+ " times" + pageSize, pagesFlipped.get(0) == bundleCount /
pageSize);
-
+
// check if the last name is equal to "name01"
assertEquals("The name should be \"name01\"", b01.getName(),
prevName);
// test that entire list parsed spanning multiple pages
- assertTrue("Expected bundleNames to be empty. Still " +
bundleNames.size()
- + " bundle(s).", bundleNames.isEmpty());
-
+ assertTrue("Expected bundleNames to be empty. Still " +
bundleNames.size() + " bundle(s).",
+ bundleNames.isEmpty());
+
// check if everything is deleted
PageList<Bundle> bvs = null;
criteria = new BundleCriteria();
@@ -1118,7 +1117,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertNotNull(bvOut.getBundleDeployments());
assertTrue(bvOut.getBundleDeployments().isEmpty());
}
-
+
@Test(enabled = TESTS_ENABLED)
public void testFindBundleVersionsByCriteriaPaging() throws Exception {
Bundle b1 = createBundle("one");
@@ -1148,16 +1147,12 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertFalse(bvs.get(0).equals(bvs.get(1)));
assertEquals(bv60, bvs.get(2));
}
-
- // This test is disabled, because it is failing. The sorting by id, defined on the
Criteria class does not work
- // if the sortId field is not defined on the criteria sub-class. This is because of
the fact that getPageControl()
- // defined on class CriteriaQueryGenerator calls CriteriaQueryGenerator.getFields()
that ignores fields defined
- // on the Criteria class (takes into considerations fields from the sub-classes).
- @Test(enabled = DISABLED)
+
+ @Test(enabled = ENABLED)
public void testFindAndDeleteBundleVersionsByCriteriaQuery() throws Exception {
//verify that all bundle version objects are actually parsed.
Map<String, BundleVersion> bundleVersionVersions = new HashMap<String,
BundleVersion>();
-
+
final int bundleVersionCount = 220;
Bundle bundle = createBundle("one");
for (int i = 0; i < bundleVersionCount; i++) {
@@ -1175,7 +1170,7 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
// the List is used because of the access from the anonymous class
final List<Integer> pagesFlipped = new ArrayList<Integer>();
pagesFlipped.add(0);
-
+
// iterate over the results with CriteriaQuery
CriteriaQueryExecutor<BundleVersion, BundleVersionCriteria> queryExecutor =
new CriteriaQueryExecutor<BundleVersion, BundleVersionCriteria>() {
@Override
@@ -1199,24 +1194,24 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
toDelete.add(bv.getId());
bundleVersionVersions.remove(String.valueOf(bv.getVersion()));
}
-
+
// check if the page was flipped the correct amount of times (this formula works
only for this particular case)
- assertTrue("While iterating the bundle versions, the
findBundleVersionsByCriteria() should be called " + bundleVersionCount / pageSize
- + " times" + pageSize, pagesFlipped.get(0) == bundleVersionCount /
pageSize);
-
+ assertTrue("While iterating the bundle versions, the
findBundleVersionsByCriteria() should be called "
+ + bundleVersionCount / pageSize + " times" + pageSize,
pagesFlipped.get(0) == bundleVersionCount / pageSize);
+
// delete all
for (int id : toDelete) {
bundleManager.deleteBundleVersion(overlord, id, true);
}
-
+
// check whether every record was processed when iterating over the
bundleVersions
- assertTrue("Expected bundleVersions to be empty. Still " +
bundleVersionVersions.size()
- + " version(s).", bundleVersionVersions.isEmpty());
+ assertTrue("Expected bundleVersions to be empty. Still " +
bundleVersionVersions.size() + " version(s).",
+ bundleVersionVersions.isEmpty());
// test that entire list parsed spanning multiple pages
- assertTrue("Expected bundleVersions to be empty. Still " +
bundleVersionVersions.size()
- + " version(s).", bundleVersionVersions.isEmpty());
-
+ assertTrue("Expected bundleVersions to be empty. Still " +
bundleVersionVersions.size() + " version(s).",
+ bundleVersionVersions.isEmpty());
+
// check if everything is deleted
PageList<BundleVersion> bvs = null;
criteria = new BundleVersionCriteria();
@@ -1288,7 +1283,6 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertEquals(1, bundles.size());
}
-
// helper methods
private BundleType createBundleType(String name) throws Exception {
final String fullName = TEST_PREFIX + "-type-" + name;
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
index 54fce8f..67b6316 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQueryGenerator.java
@@ -569,15 +569,25 @@ public final class CriteriaQueryGenerator {
List<Field> results = new ArrayList<Field>();
Class<?> currentLevelClass = criteria.getClass();
- while (currentLevelClass.equals(Criteria.class) == false) {
+ boolean isCriteriaClass = false;
+
+ do {
+ isCriteriaClass = currentLevelClass.equals(Criteria.class);
+
for (Field field : currentLevelClass.getDeclaredFields()) {
field.setAccessible(true);
- if (field.getName().startsWith(prefix)) {
+ if (isCriteriaClass) {
+ if (fieldType.getGlobalFields().contains(field.getName()))
+ results.add(field);
+
+ } else if (field.getName().startsWith(prefix)) {
results.add(field);
}
}
+
currentLevelClass = currentLevelClass.getSuperclass();
- }
+
+ } while (!isCriteriaClass);
return results;
}
commit 379b3039453268e473ed402d4bd317b1544e9af8
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Fri Mar 1 15:35:23 2013 -0500
Rearrange tests to vacuum comes before analyze. There is no real good reason
for this, we're seeing if it resolves an issue with a Jenkins run.
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
index 104ff85..3d9e15e 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/system/SystemManagerBeanTest.java
@@ -55,13 +55,17 @@ public class SystemManagerBeanTest extends AbstractEJB3Test {
unprepareServerPluginService();
}
- @SuppressWarnings("deprecation")
- public void testGetSystemConfiguration() {
- assert null != systemManager.getSystemConfiguration(overlord);
+ public void testVacuum() {
+ System.out.println("Starting Vacuum");
+ systemManager.vacuum(overlord);
+ System.out.println("Done with Vacuum");
}
+ @Test(dependsOnMethods = { "testVacuum" })
public void testAnalyze() {
+ System.out.println("Starting Analyze");
systemManager.analyze(overlord);
+ System.out.println("Done with Analyze");
}
public void testEnableHibernateStatistics() {
@@ -76,15 +80,16 @@ public class SystemManagerBeanTest extends AbstractEJB3Test {
systemManager.reindex(overlord);
}
- public void testVacuum() {
- systemManager.vacuum(overlord);
- }
-
public void testVacuumAppdef() {
systemManager.vacuumAppdef(overlord);
}
@SuppressWarnings("deprecation")
+ public void testGetSystemConfiguration() {
+ assert null != systemManager.getSystemConfiguration(overlord);
+ }
+
+ @SuppressWarnings("deprecation")
public void testLegacySystemSettingsInCorrectFormat() throws Exception {
//some of the properties are represented differently
//in the new style settings and the the old style
commit 65393aa5cd02369ec38bd0da674c2f6d37f7a8db
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Fri Mar 1 18:48:50 2013 +0100
Don't fail DeadProcessInfoRefreshTest on Mac OSX
It fails because Sigar returns a wrong value of the process state (see community
thread URL)
diff --git
a/modules/core/native-system/src/test/java/org/rhq/core/system/DeadProcessInfoRefreshTest.java
b/modules/core/native-system/src/test/java/org/rhq/core/system/DeadProcessInfoRefreshTest.java
index 9ee811e..d49e6b4 100644
---
a/modules/core/native-system/src/test/java/org/rhq/core/system/DeadProcessInfoRefreshTest.java
+++
b/modules/core/native-system/src/test/java/org/rhq/core/system/DeadProcessInfoRefreshTest.java
@@ -26,6 +26,7 @@ import static org.testng.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
+import org.hyperic.sigar.OperatingSystem;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
@@ -96,10 +97,17 @@ public class DeadProcessInfoRefreshTest {
/**
* We want to be sure that once the process has been reported down, subsequent calls
to refresh will not report it
* up. See this thread on VMWare forum:
http://communities.vmware.com/message/2187972#2187972
+ *
+ * Unfortunately there is no work around for this failure on Mac OSX so the test will
silently return on this
+ * platform.
+ *
* @throws Exception
*/
@Test(timeOut = 1000 * 10)
public void testRefreshInterval() throws Exception {
+ if (OperatingSystem.getInstance().getName().equals(OperatingSystem.NAME_MACOSX))
{
+ return;
+ }
// Sigar should see the process running
assertTrue(testProcessInfo.freshSnapshot().isRunning());
// Send kill
commit eb6e853f45e8ac412cdc38cd9f8428badbf79594
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Fri Mar 1 16:05:05 2013 +0100
Higher logging level by default in native system tests
diff --git a/modules/core/native-system/src/test/resources/log4j.xml
b/modules/core/native-system/src/test/resources/log4j.xml
index 05d0951..014dc36 100644
--- a/modules/core/native-system/src/test/resources/log4j.xml
+++ b/modules/core/native-system/src/test/resources/log4j.xml
@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE log4j:configuration SYSTEM "log4j.dtd">
-<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="true">
+<log4j:configuration
xmlns:log4j="http://jakarta.apache.org/log4j/"
debug="false">
<appender name="CONSOLE"
class="org.apache.log4j.ConsoleAppender">
<param name="Target" value="System.out"/>
- <param name="Threshold" value="DEBUG"/>
+ <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>
commit fa74bbe0d6c89363a63b580f28946c182d3a157c
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Fri Mar 1 14:32:16 2013 +0100
Two more tests added testing the CriteriaQuery api and BundleManagerBean.
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index dfe2c72..b1ca9fe 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -83,6 +83,8 @@ import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.test.TestAgentClient;
import org.rhq.enterprise.server.test.TestServerCommunicationsService;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.enterprise.server.util.ResourceTreeHelper;
@@ -1007,6 +1009,76 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertEquals(1, bs.size());
assertEquals(b10, bs.get(0));
}
+
+
+ @Test(enabled = TESTS_ENABLED)
+ public void testFindAndDeleteBundlesByCriteriaQuery() throws Exception {
+ // verify that all bundle version objects are actually parsed.
+ Map<String, Bundle> bundleNames = new HashMap<String, Bundle>();
+ final int bundleCount = 50;
+
+ Bundle b01 = createBundle("name01");
+ for (int i = 1; i < bundleCount; i++) {
+ createBundle("name" + String.format("%02d", i + 1));
+ }
+
+ BundleCriteria criteria = new BundleCriteria();
+ criteria.addFilterName(TEST_PREFIX);
+ final int pageSize = 10;
+ criteria.setPaging(0, pageSize);
+ criteria.addSortName(PageOrdering.DESC);
+
+ final List<Integer> pagesFlipped = new ArrayList<Integer>();
+ pagesFlipped.add(0);
+
+ // iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Bundle, BundleCriteria> queryExecutor = new
CriteriaQueryExecutor<Bundle, BundleCriteria>() {
+ @Override
+ public PageList<Bundle> execute(BundleCriteria criteria) {
+ pagesFlipped.set(0, pagesFlipped.get(0) + 1);
+ return bundleManager.findBundlesByCriteria(overlord, criteria);
+ }
+ };
+
+ CriteriaQuery<Bundle, BundleCriteria> bundles = new
CriteriaQuery<Bundle, BundleCriteria>(
+ criteria, queryExecutor);
+
+ List<Integer> toRemove = new ArrayList<Integer>(bundleNames.size());
+ String prevName = null;
+ // iterate over the entire result set efficiently
+ String errMsg = "Results should be sorted by names, something is out of
order";
+ for (Bundle b : bundles) {
+ assertTrue(errMsg, null == prevName || prevName.compareTo(b.getName()) >
0);
+ prevName = b.getName();
+ toRemove.add(b.getId());
+ bundleNames.remove(String.valueOf(b.getName()));
+ }
+
+ // remove the bundles
+ for (int id : toRemove) {
+ bundleManager.deleteBundle(overlord, id);
+ }
+
+ // check if the page was flipped the correct amount of times
+ assertTrue("While iterating the bundles, the findBundlesByCriteria should be
called " + bundleCount / pageSize
+ + " times" + pageSize, pagesFlipped.get(0) == bundleCount /
pageSize);
+
+ // check if the last name is equal to "name01"
+ assertEquals("The name should be \"name01\"", b01.getName(),
prevName);
+
+ // test that entire list parsed spanning multiple pages
+ assertTrue("Expected bundleNames to be empty. Still " +
bundleNames.size()
+ + " bundle(s).", bundleNames.isEmpty());
+
+ // check if everything is deleted
+ PageList<Bundle> bvs = null;
+ criteria = new BundleCriteria();
+ criteria.addFilterName(TEST_PREFIX);
+ criteria.clearPaging(); // fetch all
+ bvs = bundleManager.findBundlesByCriteria(overlord, criteria);
+ assertNotNull(bvs);
+ assertTrue(bvs.isEmpty());
+ }
@Test(enabled = TESTS_ENABLED)
public void testFindBundleVersionsByCriteria() throws Exception {
@@ -1076,6 +1148,84 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertFalse(bvs.get(0).equals(bvs.get(1)));
assertEquals(bv60, bvs.get(2));
}
+
+ // This test is disabled, because it is failing. The sorting by id, defined on the
Criteria class does not work
+ // if the sortId field is not defined on the criteria sub-class. This is because of
the fact that getPageControl()
+ // defined on class CriteriaQueryGenerator calls CriteriaQueryGenerator.getFields()
that ignores fields defined
+ // on the Criteria class (takes into considerations fields from the sub-classes).
+ @Test(enabled = DISABLED)
+ public void testFindAndDeleteBundleVersionsByCriteriaQuery() throws Exception {
+ //verify that all bundle version objects are actually parsed.
+ Map<String, BundleVersion> bundleVersionVersions = new HashMap<String,
BundleVersion>();
+
+ final int bundleVersionCount = 220;
+ Bundle bundle = createBundle("one");
+ for (int i = 0; i < bundleVersionCount; i++) {
+ String version = "1." + String.format("%03d", i + 1);
+ BundleVersion bundleVersion = createBundleVersion(bundle.getName(), version,
bundle);
+ bundleVersionVersions.put(version, bundleVersion);
+ }
+
+ final int pageSize = 20;
+ BundleVersionCriteria criteria = new BundleVersionCriteria();
+ criteria.addFilterName(TEST_PREFIX);
+ criteria.setPaging(0, pageSize);
+ criteria.addSortId(PageOrdering.DESC);
+
+ // the List is used because of the access from the anonymous class
+ final List<Integer> pagesFlipped = new ArrayList<Integer>();
+ pagesFlipped.add(0);
+
+ // iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<BundleVersion, BundleVersionCriteria> queryExecutor =
new CriteriaQueryExecutor<BundleVersion, BundleVersionCriteria>() {
+ @Override
+ public PageList<BundleVersion> execute(BundleVersionCriteria criteria)
{
+ pagesFlipped.set(0, pagesFlipped.get(0) + 1);
+ return bundleManager.findBundleVersionsByCriteria(overlord, criteria);
+ }
+ };
+
+ // initiate first/(total depending on page size) request.
+ CriteriaQuery<BundleVersion, BundleVersionCriteria> bundleVersions = new
CriteriaQuery<BundleVersion, BundleVersionCriteria>(
+ criteria, queryExecutor);
+
+ List<Integer> toDelete = new
ArrayList<Integer>(bundleVersionVersions.size());
+ Integer prevId = null;
+ // iterate over the entire result set efficiently
+ String errMsg = "Results should be sorted by id, something is out of
order";
+ for (BundleVersion bv : bundleVersions) {
+ assertTrue(errMsg, null == prevId || prevId > bv.getId());
+ prevId = bv.getId();
+ toDelete.add(bv.getId());
+ bundleVersionVersions.remove(String.valueOf(bv.getVersion()));
+ }
+
+ // check if the page was flipped the correct amount of times (this formula works
only for this particular case)
+ assertTrue("While iterating the bundle versions, the
findBundleVersionsByCriteria() should be called " + bundleVersionCount / pageSize
+ + " times" + pageSize, pagesFlipped.get(0) == bundleVersionCount /
pageSize);
+
+ // delete all
+ for (int id : toDelete) {
+ bundleManager.deleteBundleVersion(overlord, id, true);
+ }
+
+ // check whether every record was processed when iterating over the
bundleVersions
+ assertTrue("Expected bundleVersions to be empty. Still " +
bundleVersionVersions.size()
+ + " version(s).", bundleVersionVersions.isEmpty());
+
+ // test that entire list parsed spanning multiple pages
+ assertTrue("Expected bundleVersions to be empty. Still " +
bundleVersionVersions.size()
+ + " version(s).", bundleVersionVersions.isEmpty());
+
+ // check if everything is deleted
+ PageList<BundleVersion> bvs = null;
+ criteria = new BundleVersionCriteria();
+ criteria.addFilterName(TEST_PREFIX);
+ criteria.clearPaging(); // fetch all
+ bvs = bundleManager.findBundleVersionsByCriteria(overlord, criteria);
+ assertNotNull(bvs);
+ assertTrue(bvs.isEmpty());
+ }
@Test(enabled = TESTS_ENABLED)
public void testGetAllBundleVersionFilenames() throws Exception {
commit 61803672ded5471c17b57a6d1d7d93646acf0462
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Feb 28 15:01:32 2013 +0100
Getting the API check ready for separately versioned parts of RHQ.
To execute an API check build, you only need to -Psignature-check. No need
specify the base version anymore because that is now resolved per module
from maven as the latest RELEASED and published version (as opposed to
LATEST).
diff --git a/modules/enterprise/server/jar/pom.xml
b/modules/enterprise/server/jar/pom.xml
index d59460f..bd5437a 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -621,6 +621,16 @@
</execution>
</executions>
</plugin>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>clirr-maven-plugin</artifactId>
+ <configuration>
+ <includes>
+ <include>**/*Remote</include>
+ <include>**/ServerVersion</include>
+ </includes>
+ </configuration>
+ </plugin>
</plugins>
</build>
@@ -987,116 +997,6 @@
</plugins>
</build>
</profile>
-
- <profile>
- <id>cobertura</id>
- <build>
- <plugins>
- <plugin>
- <artifactId>maven-antrun-plugin</artifactId>
- <dependencies>
- <dependency>
- <groupId>net.sourceforge.cobertura</groupId>
- <artifactId>cobertura</artifactId>
- <version>${cobertura.version}</version>
- </dependency>
- </dependencies>
- <executions>
- <execution>
- <id>cobertura-instrument</id>
- <phase>process-test-classes</phase>
- <configuration>
- <target>
- <!-- prepare directory structure for cobertura-->
- <mkdir dir="target/cobertura"/>
- <mkdir dir="target/cobertura/backup"/>
- <!-- backup all classes so that we can instrument the original
classes-->
- <copy toDir="target/cobertura/backup"
verbose="true" overwrite="true">
- <fileset dir="target/classes">
- <include name="**/*.class"/>
- </fileset>
- </copy>
- <!-- create a properties file and save there location of cobertura
data file-->
- <touch file="target/classes/cobertura.properties"/>
- <echo
file="target/classes/cobertura.properties">net.sourceforge.cobertura.datafile=${project.build.directory}/cobertura/cobertura.ser</echo>
- <taskdef classpathref="maven.plugin.classpath"
resource="tasks.properties"/>
- <!-- instrument all classes in target/classes directory -->
- <cobertura-instrument
datafile="${project.build.directory}/cobertura/cobertura.ser"
- todir="${project.build.directory}/classes">
- <fileset dir="${project.build.directory}/classes">
- <include name="**/*.class"/>
- <exclude
name="**/DynamicConfigurationPropertyLocal.class"/>
- <exclude
name="**/DynamicConfigurationPropertyBean.class"/>
- </fileset>
- </cobertura-instrument>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>cobertura-report</id>
- <phase>prepare-package</phase>
- <configuration>
- <target>
- <taskdef classpathref="maven.plugin.classpath"
resource="tasks.properties"/>
- <!-- prepare directory structure for cobertura-->
- <mkdir dir="target/cobertura"/>
- <mkdir dir="target/site/cobertura"/>
- <!-- restore classes from backup folder to classes folder -->
- <copy toDir="target/classes" verbose="true"
overwrite="true">
- <fileset dir="target/cobertura/backup">
- <include name="**/*.class"/>
- </fileset>
- </copy>
- <!-- delete backup folder-->
- <delete dir="target/cobertura/backup"/>
- <!-- create a code coverage report -->
- <cobertura-report format="html"
datafile="${project.build.directory}/cobertura/cobertura.ser"
- destdir="${project.build.directory}/site/cobertura">
- <fileset dir="${basedir}/src/main/java">
- <include name="**/*.java"/>
- </fileset>
- </cobertura-report>
- <!-- delete cobertura.properties file -->
- <delete file="target/classes/cobertura.properties"/>
- </target>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- </executions>
- </plugin>
- </plugins>
- </build>
- </profile>
-
- <profile>
- <id>signature-check</id>
- <activation>
- <property>
- <name>signature-check-base-version</name>
- </property>
- </activation>
- <build>
- <plugins>
- <plugin>
- <groupId>org.codehaus.mojo</groupId>
- <artifactId>clirr-maven-plugin</artifactId>
- <version>${clirr.version}</version>
- <configuration>
- <includes>
- <include>**/*Remote</include>
- <include>**/ServerVersion</include>
- </includes>
- </configuration>
- </plugin>
- </plugins>
- </build>
- </profile>
-
</profiles>
<reporting>
diff --git a/pom.xml b/pom.xml
index afd1a61..b049493 100644
--- a/pom.xml
+++ b/pom.xml
@@ -230,10 +230,6 @@
part of our public API and is therefore not API-checked. -->
<rhq.internal>true</rhq.internal>
- <!-- The name of the file in the module's root dir that contains the
intentional
- api changes to be ignored by Clirr api checks -->
-
<intentional-api-changes-file>intentional-api-changes-since-${signature-check-base-version}.xml</intentional-api-changes-file>
-
<jacoco.version>0.6.0.201210061924</jacoco.version>
<jacoco-arquillian-extension.version>1.0.0.Alpha5</jacoco-arquillian-extension.version>
</properties>
@@ -831,7 +827,7 @@
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
- <version>1.5</version>
+ <version>1.7</version>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
@@ -1689,17 +1685,26 @@
<profile>
<id>signature-check</id>
- <activation>
- <property>
- <name>signature-check-base-version</name>
- </property>
- </activation>
<build>
<plugins>
<plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>build-helper-maven-plugin</artifactId>
+ <executions>
+ <execution>
+ <id>version-resolver</id>
+ <goals>
+ <goal>released-version</goal>
+ </goals>
+ <configuration>
+
<propertyPrefix>signature-check-base</propertyPrefix>
+ </configuration>
+ </execution>
+ </executions>
+ </plugin>
+ <plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>clirr-maven-plugin</artifactId>
- <version>${clirr.version}</version>
<executions>
<execution>
<id>signature-check</id>
@@ -1711,7 +1716,7 @@
<comparisonArtifact>
<groupId>${project.groupId}</groupId>
<artifactId>${project.artifactId}</artifactId>
-
<version>${signature-check-base-version}</version>
+
<version>${signature-check-base.version}</version>
</comparisonArtifact>
</comparisonArtifacts>
<logResults>true</logResults>
@@ -1719,7 +1724,7 @@
<failOnError>true</failOnError>
<failOnWarning>true</failOnWarning>
<skip>${rhq.internal}</skip>
-
<ignoredDifferencesFile>${intentional-api-changes-file}</ignoredDifferencesFile>
+
<ignoredDifferencesFile>intentional-api-changes-since-${signature-check-base.version}.xml</ignoredDifferencesFile>
</configuration>
</execution>
</executions>
commit 8beb34b07d0b669db6e28d1452cae6c4092441ce
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 28 17:48:17 2013 -0500
[BZ 916790] fix the case where the version string has a long "number" which
really should be treated as a string
diff --git
a/modules/core/util/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java
b/modules/core/util/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java
index 5e16ac6..07f34d7 100644
---
a/modules/core/util/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java
+++
b/modules/core/util/src/main/java/org/apache/maven/artifact/versioning/ComparableVersion.java
@@ -424,7 +424,14 @@ public class ComparableVersion
private static Item parseItem( boolean isDigit, String buf )
{
- return isDigit ? new IntegerItem( new Integer( buf ) ) : new StringItem( buf,
false );
+ if (isDigit) {
+ try {
+ return new IntegerItem(new Integer(buf));
+ } catch (Exception e) {
+ // fall through - just use it as a string - its probably too long, like a
timestamp. e.g. 201302281030
+ }
+ }
+ return new StringItem(buf, false);
}
public int compareTo( Object o )
diff --git
a/modules/core/util/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java
b/modules/core/util/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java
index 1dab605..c6efdba 100644
---
a/modules/core/util/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java
+++
b/modules/core/util/src/test/java/org/apache/maven/artifact/versioning/ComparableVersionTest.java
@@ -131,6 +131,12 @@ public class ComparableVersionTest {
compareVersions("4.0.0.Beta1", "4.0.0.GA");
}
+ public void testBZ916790() {
+ new ComparableVersion("3.13.1.201302221022"); // a bug caused this to
throw an exception before
+ compareVersions("3.13.1.201302221022",
"3.13.1.201302221023");
+ compareVersions("3.13.1.201202221022",
"3.13.1.201302221022");
+ }
+
private void compareVersions(String ver1String, String ver2String) {
//System.out.println("Testing: " + ver1String + "\t" +
ver2String);
commit 9759daf74bf650e13764d80ef8fc4f67d1b8d269
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 28 15:26:10 2013 -0500
[BZ 916380] add java dbupgrade step to fix bundle version ordering
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index 109eb3a..a48f2a4 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.129</db.schema.version>
+ <db.schema.version>2.130</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/java/org/rhq/core/db/DbUtilsI18NResourceKeys.java
b/modules/core/dbutils/src/main/java/org/rhq/core/db/DbUtilsI18NResourceKeys.java
index a200076..f74a823 100644
--- a/modules/core/dbutils/src/main/java/org/rhq/core/db/DbUtilsI18NResourceKeys.java
+++ b/modules/core/dbutils/src/main/java/org/rhq/core/db/DbUtilsI18NResourceKeys.java
@@ -32,6 +32,11 @@ import mazz.i18n.annotation.I18NResourceBundle;
*/
@I18NResourceBundle(baseName = "dbutils-messages", defaultLocale =
"en")
public interface DbUtilsI18NResourceKeys {
+ @I18NMessages({ @I18NMessage("Error: {0}"), @I18NMessage(value =
"Fehler: {0}", locale = "de") })
+ String ERROR = "DatabaseType.generic-error";
+
+ @I18NMessages({ @I18NMessage("Message: {0}"), @I18NMessage(value =
"Nachricht: {0}", locale = "de") })
+ String MESSAGE = "DatabaseType.generic-message";
@I18NMessages( { @I18NMessage("Executing the following SQL: {0}"),
@I18NMessage(value = "FÃŒhre das nachfolgnde SQL aus: {0}", locale =
"de") })
diff --git
a/modules/core/dbutils/src/main/java/org/rhq/core/db/upgrade/BundleVersionOrderUpgradeTask.java
b/modules/core/dbutils/src/main/java/org/rhq/core/db/upgrade/BundleVersionOrderUpgradeTask.java
new file mode 100644
index 0000000..e3b00c3
--- /dev/null
+++
b/modules/core/dbutils/src/main/java/org/rhq/core/db/upgrade/BundleVersionOrderUpgradeTask.java
@@ -0,0 +1,140 @@
+/*
+ * RHQ Management Platform
+ * Copyright (C) 2005-2008 Red Hat, Inc.
+ * All rights reserved.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ */
+package org.rhq.core.db.upgrade;
+
+import java.sql.Connection;
+import java.sql.ResultSet;
+import java.sql.SQLException;
+import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.List;
+import java.util.TreeMap;
+
+import mazz.i18n.Logger;
+
+import org.apache.maven.artifact.versioning.ComparableVersion;
+
+import org.rhq.core.db.DatabaseType;
+import org.rhq.core.db.DbUtilsI18NFactory;
+import org.rhq.core.db.DbUtilsI18NResourceKeys;
+
+/**
+ * Database upgrade task 2.130 to fix BZ 916380 where bundle version orders got
disordered when deleting bundles.
+ *
+ * @author John Mazzitelli
+ */
+public class BundleVersionOrderUpgradeTask implements DatabaseUpgradeTask {
+
+ private static final Logger LOG =
DbUtilsI18NFactory.getLogger(BundleVersionOrderUpgradeTask.class);
+
+ public void execute(DatabaseType databaseType, Connection connection) throws
SQLException {
+ List<Integer> bundleIds = getAllBundleIds(databaseType, connection);
+ if (bundleIds != null && !bundleIds.isEmpty()) {
+ for (Integer bundleId : bundleIds) {
+ List<VersionInfo> versionInfos = getBundleVersions(bundleId,
databaseType, connection);
+ if (versionInfos != null && !versionInfos.isEmpty()) {
+
+ // make sure we order the versions properly by comparing version
strings
+ TreeMap<ComparableVersion, VersionInfo> ordered = new
TreeMap<ComparableVersion, VersionInfo>();
+ for (VersionInfo versionInfo : versionInfos) {
+ ComparableVersion comparableVersion = new
ComparableVersion(versionInfo.version);
+ ordered.put(comparableVersion, versionInfo);
+ }
+
+ // now make sure all version ordering is correct - starting from 0
and monotonically increasing
+ int expectedNext = 0;
+ for (VersionInfo orderedBundleVersion : ordered.values()) {
+ if (orderedBundleVersion.versionOrder != expectedNext) {
+ String sql = "UPDATE RHQ_BUNDLE_VERSION SET
VERSION_ORDER=" + expectedNext + " WHERE ID="
+ + orderedBundleVersion.id;
+ Statement s = null;
+ try {
+ LOG.debug(DbUtilsI18NResourceKeys.MESSAGE,
+ "Correcting version order for bundle version ID
[" + orderedBundleVersion.id + "]");
+ LOG.debug(DbUtilsI18NResourceKeys.EXECUTING_SQL, sql);
+ s = connection.createStatement();
+ int rowsUpdated = s.executeUpdate(sql);
+ if (rowsUpdated != 1) {
+ LOG.error(DbUtilsI18NResourceKeys.ERROR,
+ "Failed to update version order for bundle
version ID ["
+ + orderedBundleVersion.id + "]. Will
continue but problems may persist.");
+ }
+ } finally {
+ databaseType.closeStatement(s);
+ }
+ }
+ expectedNext++;
+ }
+ }
+ }
+ } else {
+ LOG.debug(DbUtilsI18NResourceKeys.MESSAGE, "No bundles exist - nothing
to fix.");
+ }
+ }
+
+ private List<Integer> getAllBundleIds(DatabaseType databaseType, Connection
connection) throws SQLException {
+ List<Integer> ids = new ArrayList<Integer>();
+ Statement s = null;
+ try {
+ String sql = "SELECT ID FROM RHQ_BUNDLE";
+ LOG.debug(DbUtilsI18NResourceKeys.EXECUTING_SQL, sql);
+
+ s = connection.createStatement();
+ ResultSet rs = s.executeQuery(sql);
+
+ while (rs.next()) {
+ int id = rs.getInt(1);
+ ids.add(Integer.valueOf(id));
+ }
+ } finally {
+ databaseType.closeStatement(s);
+ }
+ return ids;
+ }
+
+ private List<VersionInfo> getBundleVersions(int bundleId, DatabaseType
databaseType, Connection connection)
+ throws SQLException {
+ List<VersionInfo> infos = new ArrayList<VersionInfo>();
+ Statement s = null;
+ try {
+ String sql = "SELECT ID, VERSION_ORDER, VERSION FROM RHQ_BUNDLE_VERSION
WHERE BUNDLE_ID = " + bundleId;
+ LOG.debug(DbUtilsI18NResourceKeys.EXECUTING_SQL, sql);
+
+ s = connection.createStatement();
+ ResultSet rs = s.executeQuery(sql);
+
+ while (rs.next()) {
+ VersionInfo info = new VersionInfo();
+ info.id = rs.getInt(1);
+ info.versionOrder = rs.getInt(2);
+ info.version = rs.getString(3);
+ infos.add(info);
+ }
+ } finally {
+ databaseType.closeStatement(s);
+ }
+ return infos;
+ }
+
+ private class VersionInfo {
+ int id;
+ int versionOrder;
+ String version;
+ }
+}
\ No newline at end of file
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 936c7bf..33388ce 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -2010,6 +2010,10 @@
</schema-directSQL>
</schemaSpec>
+ <!-- BZ 916380 -->
+ <schemaSpec version="2.130">
+ <schema-javaTask className="BundleVersionOrderUpgradeTask"
/>
+ </schemaSpec>
</dbupgrade>
</target>
commit b63460a52459b4bd6515bf7176621e8c8c9f4091
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Feb 28 21:24:26 2013 +0100
Fix DeadProcessInfoRefreshTest (will now work on all platforms)
diff --git
a/modules/core/native-system/src/test/java/org/rhq/core/system/DeadProcessInfoRefreshTest.java
b/modules/core/native-system/src/test/java/org/rhq/core/system/DeadProcessInfoRefreshTest.java
index b8d7d74..9ee811e 100644
---
a/modules/core/native-system/src/test/java/org/rhq/core/system/DeadProcessInfoRefreshTest.java
+++
b/modules/core/native-system/src/test/java/org/rhq/core/system/DeadProcessInfoRefreshTest.java
@@ -23,25 +23,33 @@ package org.rhq.core.system;
import static org.testng.Assert.assertFalse;
import static org.testng.Assert.assertTrue;
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
+import java.util.ArrayList;
import java.util.List;
-import org.hyperic.sigar.OperatingSystem;
import org.testng.annotations.AfterTest;
import org.testng.annotations.BeforeTest;
import org.testng.annotations.Test;
-import org.rhq.core.util.stream.StreamUtil;
-
/**
* @author Thomas Segismont
*/
public class DeadProcessInfoRefreshTest {
- private static final String KNOWN_ARG = "hellosigar";
+ private static final class SampleProgram {
+
+ @SuppressWarnings("unused")
+ public static void main(String[] args) {
+ while (true) {
+ try {
+ Thread.sleep(5000);
+ } catch (Exception ignore) {
+ }
+ }
+ }
+
+ }
+
+ private static final String SAMPLE_PROGRAM_NAME = SampleProgram.class.getName();
private Process testProcess;
@@ -54,33 +62,26 @@ public class DeadProcessInfoRefreshTest {
throw new RuntimeException("Test process is not alive");
}
NativeSystemInfo systemInfo = new NativeSystemInfo();
- List<ProcessInfo> foundProcesses = systemInfo.getProcesses("arg|"
+ KNOWN_ARG + "|match=.*");
+ List<ProcessInfo> foundProcesses = systemInfo.getProcesses("arg|"
+ SAMPLE_PROGRAM_NAME + "|match=.*");
if (foundProcesses.size() != 1) {
- throw new RuntimeException("Found " + foundProcesses.size() +
" with arg [" + KNOWN_ARG + "]");
+ throw new RuntimeException("Found " + foundProcesses.size() +
" processes with arg ["
+ + SampleProgram.class.getName() + "]");
}
testProcessInfo = foundProcesses.iterator().next();
}
private Process createTestProcess() throws Exception {
- if (OperatingSystem.IS_WIN32) {
- // On Windows run a simple bat file which behaves like 'watch echo'
- File batFile = File.createTempFile("win-watch-echo",
".bat");
- batFile.deleteOnExit();
- InputStream is =
getClass().getClassLoader().getResourceAsStream("org/rhq/core/system/win-watch-echo.bat");
- OutputStream os = new FileOutputStream(batFile);
- StreamUtil.copy(is, os, true);
- ProcessBuilder processBuilder = new ProcessBuilder("cmd",
batFile.getAbsolutePath(), KNOWN_ARG);
- return processBuilder.start();
- } else {
- // On other systems run a simple bash file which behaves like 'watch
echo'
- File bashFile = File.createTempFile("bash-watch-echo",
".sh");
- bashFile.deleteOnExit();
- InputStream is =
getClass().getClassLoader().getResourceAsStream("org/rhq/core/system/bash-watch-echo.sh");
- OutputStream os = new FileOutputStream(bashFile);
- StreamUtil.copy(is, os, true);
- ProcessBuilder processBuilder = new ProcessBuilder("bash",
bashFile.getAbsolutePath(), KNOWN_ARG);
- return processBuilder.start();
- }
+ String javaHome = System.getProperty("java.home");
+ String javaCmd = javaHome + "/bin/java";
+ List<String> args = new ArrayList<String>();
+ args.add(javaCmd);
+ args.add("-cp");
+ args.add("target/test-classes");
+ args.add(SampleProgram.class.getName());
+ ProcessBuilder processBuilder = new ProcessBuilder(args);
+ processBuilder.inheritIO();
+ Process process = processBuilder.start();
+ return process;
}
@AfterTest(alwaysRun = true)
diff --git
a/modules/core/native-system/src/test/resources/org/rhq/core/system/bash-watch-echo.sh
b/modules/core/native-system/src/test/resources/org/rhq/core/system/bash-watch-echo.sh
deleted file mode 100644
index 7d0f4c0..0000000
---
a/modules/core/native-system/src/test/resources/org/rhq/core/system/bash-watch-echo.sh
+++ /dev/null
@@ -1,7 +0,0 @@
-#!/bin/bash
-
-while :
-do
- echo $1
- sleep 1
-done
diff --git
a/modules/core/native-system/src/test/resources/org/rhq/core/system/win-watch-echo.bat
b/modules/core/native-system/src/test/resources/org/rhq/core/system/win-watch-echo.bat
deleted file mode 100644
index 4404159..0000000
---
a/modules/core/native-system/src/test/resources/org/rhq/core/system/win-watch-echo.bat
+++ /dev/null
@@ -1,5 +0,0 @@
-@ECHO OFF
-:loop
- echo %1
- timeout /t 2
-goto loop
commit 3bb788b5b3d472e1500df7b4bec304814a45bcac
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Feb 28 18:38:03 2013 +0100
Better coverage of SubjectManagerBean following criteria API changes
diff --git a/.classpath b/.classpath
index f6ced85..1a0df52 100644
--- a/.classpath
+++ b/.classpath
@@ -218,7 +218,7 @@
<classpathentry exported="true" kind="var"
path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/tomcat/tomcat-jk/4.1.31/tomcat-jk-4.1.31.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/jdom/jdom/1.0/jdom-1.0.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2.jar"
sourcepath="/M2_REPO/commons-collections/commons-collections/3.2/commons-collections-3.2-sources.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0.jar"
sourcepath="/M2_REPO/javax/persistence/persistence-api/1.0/persistence-api-1.0-sources.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/jboss/jboss-jmx/4.2.3.GA/jboss-jmx-4.2.3.GA.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/tomcat/catalina/5.5.20/catalina-5.5.20.jar"/>
@@ -344,7 +344,7 @@
<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/picketbox/picketbox/4.0.7.Final/picketbox-4.0.7.Final.jar"
sourcepath="/M2_REPO/org/picketbox/picketbox/4.0.7.Final/picketbox-4.0.7.Final-sources.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/org/python/jython-standalone/2.5.2/jython-standalone-2.5.2.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/com/wordnik/swagger-annotations_2.9.1/1.1.1-SNAPSHOT/swagger-annotations_2.9.1-1.1.1-20121031.024335-6.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/joda-time/joda-time/2.1/joda-time-2.1.jar"/>
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
index fe7691d..4b17dc5 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
@@ -25,11 +25,14 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
+import javax.ejb.EJBException;
import javax.persistence.EntityManager;
import javax.security.auth.login.LoginException;
import javax.transaction.NotSupportedException;
import javax.transaction.SystemException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
@@ -48,6 +51,7 @@ import org.rhq.enterprise.server.authz.AuthorizationManagerLocal;
import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.authz.RoleManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.test.TransactionCallback;
import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.enterprise.server.util.SessionTestHelper;
@@ -57,18 +61,27 @@ import org.rhq.enterprise.server.util.SessionTestHelper;
@Test
public class SubjectManagerBeanTest extends AbstractEJB3Test {
+ private static final Log LOG = LogFactory.getLog(SubjectManagerBeanTest.class);
+
+ private static final String RHQADMIN = "rhqadmin";
+
+ private static final String ITEST_USER = "smb_itest_user";
+
private SubjectManagerLocal subjectManager;
private AuthorizationManagerLocal authorizationManager;
private RoleManagerLocal roleManager;
- /**
- * Prepares things for the entire test class.
- */
@Override
protected void beforeMethod() {
subjectManager = LookupUtil.getSubjectManager();
authorizationManager = LookupUtil.getAuthorizationManager();
roleManager = LookupUtil.getRoleManager();
+ createITestSubject();
+ }
+
+ private Subject createITestSubject() {
+ Subject subjectToCreate = new Subject(ITEST_USER, true, false);
+ return subjectManager.createSubject(subjectManager.getOverlord(),
subjectToCreate, ITEST_USER);
}
/**
@@ -76,11 +89,14 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
*/
@Override
protected void afterMethod() {
+ deleteITestSubject();
+
// create a list of all users we know our tests have used
List<String> usernames = new ArrayList<String>();
usernames.add("admin");
- usernames.add("rhqadmin");
+ usernames.add(RHQADMIN);
usernames.add("new_user");
+ usernames.add(ITEST_USER);
SessionManager session_manager = SessionManager.getInstance();
@@ -95,6 +111,13 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
}
}
+ private void deleteITestSubject() {
+ Subject subject = subjectManager.getSubjectByName(ITEST_USER);
+ if (subject != null) {
+ subjectManager.deleteSubjects(subjectManager.getOverlord(), new int[] {
subject.getId() });
+ }
+ }
+
/**
* Tests persisting and retrieving user configuration.
*
@@ -173,7 +196,7 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
getTransactionManager().begin();
try {
superuser = subjectManager.getOverlord();
- rhqadmin = subjectManager.getSubjectByName("rhqadmin");
+ rhqadmin = subjectManager.getSubjectByName(RHQADMIN);
rhqadmin = createSession(rhqadmin);
try {
@@ -214,7 +237,7 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
try {
superuser = subjectManager.getOverlord();
superuser = createSession(superuser);
- rhqadmin = subjectManager.getSubjectByName("rhqadmin");
+ rhqadmin = subjectManager.getSubjectByName(RHQADMIN);
rhqadmin = createSession(rhqadmin);
try {
@@ -268,9 +291,9 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
assert
authorizationManager.getExplicitGlobalPermissions(superuser).containsAll(all_global_perms);
// get the rhqadmin subject
- Subject rhqadmin = subjectManager.getSubjectByName("rhqadmin");
+ Subject rhqadmin = subjectManager.getSubjectByName(RHQADMIN);
assert rhqadmin.getId() == 2;
- assert rhqadmin.getName().equals("rhqadmin");
+ assert rhqadmin.getName().equals(RHQADMIN);
assert
authorizationManager.getExplicitGlobalPermissions(rhqadmin).containsAll(all_global_perms);
rhqadmin = createSession(rhqadmin); // our test needs to ensure the rhqadmin user
has a session
@@ -286,7 +309,7 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
Subject subject = null;
try {
- subject = subjectManager.loginUnauthenticated("rhqadmin");
+ subject = subjectManager.loginUnauthenticated(RHQADMIN);
} catch (Exception e) {
assert false : "There must be at least rhqadmin user";
}
@@ -441,30 +464,30 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
getTransactionManager().begin();
try {
- Subject subject1 =
subjectManager.loginUnauthenticated("rhqadmin");
+ Subject subject1 = subjectManager.loginUnauthenticated(RHQADMIN);
int session1 = subject1.getSessionId();
Thread.sleep(500); // just wait a bit
- Subject subject2 =
subjectManager.loginUnauthenticated("rhqadmin");
+ Subject subject2 = subjectManager.loginUnauthenticated(RHQADMIN);
int session2 = subject2.getSessionId();
assert session1 != session2 : "The same sessionId should never be
assigned when logging in twice";
assert subject1.equals(subject2);
- Subject s = subjectManager.getSubjectByNameAndSessionId("rhqadmin",
subject1.getSessionId());
+ Subject s = subjectManager.getSubjectByNameAndSessionId(RHQADMIN,
subject1.getSessionId());
assert s.getSessionId() == session1;
- s = subjectManager.getSubjectByNameAndSessionId("rhqadmin",
subject2.getSessionId());
+ s = subjectManager.getSubjectByNameAndSessionId(RHQADMIN,
subject2.getSessionId());
assert s.getSessionId() == session2;
subjectManager.logout(session1);
try {
- s = subjectManager.getSubjectByNameAndSessionId("rhqadmin",
subject1.getSessionId());
+ s = subjectManager.getSubjectByNameAndSessionId(RHQADMIN,
subject1.getSessionId());
assert false : "Session should be invalid";
} catch (SessionNotFoundException ok) {
}
- s = subjectManager.getSubjectByNameAndSessionId("rhqadmin",
subject2.getSessionId());
+ s = subjectManager.getSubjectByNameAndSessionId(RHQADMIN,
subject2.getSessionId());
assert s.getSessionId() == session2;
// this should ne a no-op, no exception
@@ -472,7 +495,7 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
subjectManager.logout(session2);
try {
- s = subjectManager.getSubjectByNameAndSessionId("rhqadmin",
subject2.getSessionId());
+ s = subjectManager.getSubjectByNameAndSessionId(RHQADMIN,
subject2.getSessionId());
fail("Session should be invalid");
} catch (SessionNotFoundException e) {
// expected
@@ -521,7 +544,7 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
try {
Subject overlord = subjectManager.getOverlord();
- Subject rhqadmin = subjectManager.getSubjectByName("rhqadmin");
+ Subject rhqadmin = subjectManager.getSubjectByName(RHQADMIN);
Role roleWithViewUsersPerm = new Role("role" + UUID.randomUUID());
roleWithViewUsersPerm.addPermission(Permission.VIEW_USERS);
@@ -552,7 +575,7 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
try {
Subject overlord = subjectManager.getOverlord();
- Subject rhqadmin = subjectManager.getSubjectByName("rhqadmin");
+ Subject rhqadmin = subjectManager.getSubjectByName(RHQADMIN);
rhqadmin = subjectManager.loginUnauthenticated(rhqadmin.getName());
Subject anotherSubject = new Subject("subject" + UUID.randomUUID(),
true, false);
@@ -618,4 +641,119 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
}
}
+ public void subjectCannotUpdateAnotherSubjectWithoutPermission() throws
LoginException {
+ executeInTransaction(new TransactionCallback() {
+
+ @Override
+ public void execute() throws Exception {
+ Subject fakeSubject = new Subject("fakeUser", true, false);
+ Subject itestSubject = subjectManager.loginUnauthenticated(ITEST_USER);
+ try {
+ subjectManager.updateSubject(itestSubject, fakeSubject,
"newPassword");
+ fail("Subject without permission should not be able to update
another subject");
+ } catch (PermissionException e) {
+ assertTrue(e.getMessage().contains("do not have permission to
update user"));
+ }
+ }
+ });
+ }
+
+ public void nobodyCanDisableASystemSubject() {
+ executeInTransaction(new TransactionCallback() {
+
+ @Override
+ public void execute() throws Exception {
+ Subject rhqAdminSubject = subjectManager.getSubjectByName(RHQADMIN);
+ try {
+ Subject changedSubject = new Subject(rhqAdminSubject.getName(),
false, rhqAdminSubject.getFsystem());
+ changedSubject.setId(rhqAdminSubject.getId());
+ subjectManager.updateSubject(subjectManager.getOverlord(),
changedSubject, "newPassword");
+ fail("Nobody should be able to disable a system subject");
+ } catch (PermissionException e) {
+ assertTrue(e.getMessage().startsWith("You cannot disable the
system user"));
+ }
+ }
+ });
+ }
+
+ public void nobodyCanChangeASubjectName() {
+ executeInTransaction(new TransactionCallback() {
+
+ @Override
+ public void execute() throws Exception {
+ Subject itestSubject = subjectManager.getSubjectByName(ITEST_USER);
+ Subject changedSubject = new Subject("pipo",
itestSubject.getFactive(), itestSubject.getFsystem());
+ changedSubject.setId(itestSubject.getId());
+ try {
+ subjectManager.updateSubject(subjectManager.getOverlord(),
changedSubject, "newPassword");
+ fail("Nobody should be able to change a subject name");
+ } catch (EJBException e) {
+ Exception cause = e.getCausedByException();
+ assertEquals(IllegalArgumentException.class, cause.getClass());
+ assertTrue(cause.getMessage().equals("You cannot change a
user's username."));
+ }
+ }
+ });
+ }
+
+ public void nobodyCanChangeAnUnknowSubject() {
+ executeInTransaction(new TransactionCallback() {
+
+ @Override
+ public void execute() throws Exception {
+ try {
+ Subject fakeSubject = new Subject("fakeUser", true,
false);
+ subjectManager.updateSubject(subjectManager.getOverlord(),
fakeSubject, "newPassword");
+ fail("Nobody should be able to change an unknown
subject");
+ } catch (EJBException e) {
+ Exception cause = e.getCausedByException();
+ assertEquals(IllegalArgumentException.class, cause.getClass());
+ assertTrue(cause.getMessage().startsWith("No user exists with
id"));
+ }
+ }
+ });
+ }
+
+ public void subjectCanUpdateItself() {
+ executeInTransaction(new TransactionCallback() {
+
+ @Override
+ public void execute() throws Exception {
+ Subject itestSubject = subjectManager.loginUnauthenticated(ITEST_USER);
+ Subject changedSubject = new Subject(itestSubject.getName(),
itestSubject.getFactive(),
+ itestSubject.getFsystem());
+ changedSubject.setId(itestSubject.getId());
+ changedSubject.setEmailAddress("pipo(a)molo.com");
+ try {
+ changedSubject = subjectManager.updateSubject(itestSubject,
changedSubject, "newPassword");
+ assertEquals("pipo(a)molo.com",
changedSubject.getEmailAddress());
+ } catch (Exception e) {
+ LOG.error(e);
+ fail("Subject should be able to update itself");
+ }
+ }
+ });
+ }
+
+ public void subjectWhitoutManageSecurityPermissionCannotUpdateItsRoles() throws
LoginException {
+ executeInTransaction(new TransactionCallback() {
+
+ @Override
+ public void execute() throws Exception {
+ Subject itestSubject = subjectManager.loginUnauthenticated(ITEST_USER);
+ final PageList<Role> allRoles =
roleManager.findRoles(PageControl.getUnlimitedInstance());
+ Subject changedSubject = new Subject(itestSubject.getName(),
itestSubject.getFactive(),
+ itestSubject.getFsystem());
+ changedSubject.setId(itestSubject.getId());
+ changedSubject.getRoles().addAll(allRoles);
+ try {
+ subjectManager.updateSubject(itestSubject, changedSubject,
"newPassword");
+ fail("Subject whitout " + Permission.MANAGE_SECURITY
+ + " permission should not be able to update its
roles");
+ } catch (PermissionException e) {
+ assertTrue(e.getMessage().contains("is not authorized
for"));
+ }
+ }
+ });
+ }
}
\ No newline at end of file
commit 69de100614c9dcd0be575c6622775c6d20a6f7ec
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 28 09:27:08 2013 -0500
Add new test exercising criteriQuery change, ConfigurationManagerBean and increasing
code coverage that was lacking.
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 7d0343b..700cfc5 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
@@ -21,6 +21,7 @@ package org.rhq.enterprise.server.configuration;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
@@ -41,6 +42,10 @@ import org.rhq.core.domain.configuration.ConfigurationUpdateStatus;
import org.rhq.core.domain.configuration.PluginConfigurationUpdate;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.ResourceConfigurationUpdate;
+import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinition;
+import org.rhq.core.domain.configuration.definition.PropertyDefinitionSimple;
+import org.rhq.core.domain.configuration.definition.PropertySimpleType;
import org.rhq.core.domain.configuration.group.GroupPluginConfigurationUpdate;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.discovery.AvailabilityReport;
@@ -735,6 +740,67 @@ public class ConfigurationManagerBeanTest extends AbstractEJB3Test {
assert requests.size() == 1; // it will create one for us from the
"live" configuration
}
+ /** Exercise the ConfigurationManagerBean getOptionsForConfigurationDefinition.
+ *
+ * @throws Exception
+ */
+ @Test(enabled = ENABLE_TESTS)
+ public void testResourceConfigurationDefinitionsOptions() throws Exception {
+ Resource resource = newResource1;
+ Subject overlord = LookupUtil.getSubjectManager().getOverlord();
+ ConfigurationManagerLocal configurationManager =
LookupUtil.getConfigurationManager();
+ getTransactionManager().begin();
+
+ try {
+ // this is simulating what the UI would be doing, build the config and call
the server-side API
+ // we'll pretend the user is the overlord - another test will check a
real user to see permission errors
+ ResourceType newResource1Type = resource.getResourceType();
+ ConfigurationDefinition initialDefinition =
newResource1Type.getResourceConfigurationDefinition();
+ int loadCount = 300;
+ HashSet<String> parsedNames = new HashSet<String>();
+ for (int i = 0; i < loadCount; i++) {
+ String name = "fake property" + i;
+ initialDefinition
+ .put(new PropertyDefinitionSimple(name, "fake" + i, false,
PropertySimpleType.BOOLEAN));
+ parsedNames.add(name);
+ }
+ newResource1Type.setResourceConfigurationDefinition(initialDefinition);
+ em.merge(newResource1Type);
+ em.flush();
+
+ Configuration configuration = new Configuration();
+ configuration.put(new PropertySimple("myboolean",
"true"));
+
+ ConfigurationDefinition configurationDefinition =
newResource1.getResourceType()
+ .getResourceConfigurationDefinition();
+ assert configurationDefinition != null : "Configuration Definition could
not be located.";
+ //retrieve the options for ConfigurationDefinition
+ ConfigurationDefinition options =
configurationManager.getOptionsForConfigurationDefinition(overlord,
+ newResource1.getId(), configurationDefinition);
+ assert options != null : "Unable able to retrieve options for resource
with id [" + newResource1.getId()
+ + "].";
+ assert !options.getPropertyDefinitions().entrySet().isEmpty() : "No
PropertyDefinitionSimple instances found.";
+
+ PropertyDefinitionSimple locatedPropertyDefSimple = null;
+ int locatedCount = 0;
+ for (Map.Entry<String, PropertyDefinition> entry :
options.getPropertyDefinitions().entrySet()) {
+ PropertyDefinition pd = entry.getValue();
+ if (pd instanceof PropertyDefinitionSimple) {
+ PropertyDefinitionSimple pds = (PropertyDefinitionSimple) pd;
+ locatedPropertyDefSimple = pds;
+ locatedCount++;
+ parsedNames.remove(pds.getName());
+ }
+ }
+ assert locatedPropertyDefSimple != null : "PropertyDefinitionSimple was
not located!";
+ assert locatedCount >= loadCount : "All expected properties were not
loaded. Found '" + locatedCount + "'.";
+ assert parsedNames.size() == 0 : "Not all loaded options were
parsed.";
+
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
@Test(enabled = ENABLE_TESTS)
public void testConfigurationRollback() throws Exception {
Resource resource = newResource1;
commit 1cb2426bcd2aefdf458d8edcb1baaf07c7f8e198
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 28 05:43:33 2013 -0500
Add new test for available subjects and increments test coverage for
PersistenceUtility.
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
index 9fba041..fe7691d 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/auth/test/SubjectManagerBeanTest.java
@@ -25,7 +25,10 @@ import java.util.List;
import java.util.Set;
import java.util.UUID;
+import javax.persistence.EntityManager;
import javax.security.auth.login.LoginException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.SystemException;
import org.testng.annotations.Test;
@@ -35,6 +38,7 @@ import org.rhq.core.domain.authz.Role;
import org.rhq.core.domain.configuration.Configuration;
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.criteria.SubjectCriteria;
+import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.server.auth.SessionManager;
@@ -45,6 +49,7 @@ import org.rhq.enterprise.server.authz.PermissionException;
import org.rhq.enterprise.server.authz.RoleManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.util.SessionTestHelper;
/**
* Tests the subject manager.
@@ -360,6 +365,49 @@ public class SubjectManagerBeanTest extends AbstractEJB3Test {
getTransactionManager().commit();
}
+ /**
+ * Tests finding Subjects with Roles.
+ * @throws SystemException
+ * @throws NotSupportedException
+ */
+ public void testFindSubjectsWithRoles() throws NotSupportedException, SystemException
{
+ getTransactionManager().begin();
+ EntityManager entityMgr = getEntityManager();
+ SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
+ RoleManagerLocal roleManager = LookupUtil.getRoleManager();
+ Subject overlord = subjectManager.getOverlord();
+
+ try {
+ //create new subject
+ Subject subject = SessionTestHelper.createNewSubject(entityMgr,
"testSubject");
+ //create new role for subject
+ Role roleWithSubject = SessionTestHelper.createNewRoleForSubject(entityMgr,
subject, "role with subject");
+ roleWithSubject.addPermission(Permission.VIEW_RESOURCE);
+ Role newRole = new Role("role without subject");
+ Role roleWithoutSubject = roleManager.createRole(overlord, newRole);
+
+ //exercise findAvailableSubjectsForRole
+ Integer[] pendingSubjectIds = new Integer[0];
+ PageList<Subject> subjects =
subjectManager.findAvailableSubjectsForRole(subjectManager.getOverlord(),
+ roleWithoutSubject.getId(), pendingSubjectIds,
PageControl.getUnlimitedInstance());
+ assert subjects.size() > 0 : "Unable to locate subject(s) available
for role with id '"
+ + roleWithSubject.getId() + "'.";//Should be at least one.
+ // boolean located = false;
+ Subject locatedSubject = null;
+ for (Subject s : subjects) {
+ if (s.getName().equals(subject.getName())) {
+ locatedSubject = s;
+ }
+ }
+ assert locatedSubject != null : "Unable to located subject with name
'" + subject.getName() + "'.";
+ assert locatedSubject.getId() == subject.getId() : "Subject id does not
match expected subject identifier '"
+ + subject.getId() + "'";//should match.
+
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
/**
* Tests getting a super user subject.
*
commit b6ee3734896a67da1dee6fd17f5bd30f641270cf
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Feb 28 15:04:57 2013 +0100
More integration tests for BundleManagerBean. Focus on searching by criteria.
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
index 062d91a..dfe2c72 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/BundleManagerBeanTest.java
@@ -143,7 +143,6 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
try {
getTransactionManager().begin();
-
Query q;
List<?> doomed;
@@ -889,17 +888,17 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertNotNull(bv1);
Set<String> filenames = bundleManager.getBundleVersionFilenames(overlord,
bv1.getId(), true);
assertNotNull(filenames);
- assertEquals(2, filenames.size());
+ assertEquals(DEFAULT_CRITERIA_PAGE_SIZE + 2, filenames.size());
BundleFile bf1 = bundleManager.addBundleFileViaByteArray(overlord, bv1.getId(),
TEST_PREFIX + "-bundlefile-1",
"1.0", null, "Test Bundle File # 1".getBytes());
filenames = bundleManager.getBundleVersionFilenames(overlord, bv1.getId(),
true);
assertNotNull(filenames);
- assertEquals(1, filenames.size());
+ assertEquals(DEFAULT_CRITERIA_PAGE_SIZE + 1, filenames.size());
BundleFile bf2 = bundleManager.addBundleFileViaByteArray(overlord, bv1.getId(),
TEST_PREFIX + "-bundlefile-2",
"1.0", null, "Test Bundle File # 2".getBytes());
filenames = bundleManager.getBundleVersionFilenames(overlord, bv1.getId(),
true);
assertNotNull(filenames);
- assertEquals(0, filenames.size());
+ assertEquals(DEFAULT_CRITERIA_PAGE_SIZE, filenames.size());
}
@Test(enabled = TESTS_ENABLED)
@@ -959,6 +958,55 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertNotNull(r);
assertEquals(b.getName(), r.getName());
}
+
+ @Test(enabled = TESTS_ENABLED)
+ public void testFindBundlesByCriteriaPaging() throws Exception {
+ Bundle b = null;
+ for (int i = 0; i < 9; i++) {
+ createBundle("name" + (i + 1));
+ }
+ Bundle b10 = createBundle("name10");
+
+ BundleCriteria c = new BundleCriteria();
+ PageList<Bundle> bs = null;
+
+ // return first 5
+ c.addFilterName(TEST_PREFIX);
+ c.setPaging(0, 5);
+ c.fetchBundleVersions(true);
+ c.fetchDestinations(true);
+ c.fetchPackageType(true);
+ c.fetchRepo(true);
+ bs = bundleManager.findBundlesByCriteria(overlord, c);
+ assertNotNull(bs);
+ assertEquals(5, bs.size());
+ assertFalse(bs.get(0).equals(bs.get(1)));
+
+ // return last 2
+ c.addFilterName(TEST_PREFIX);
+ c.setPaging(4, 2);
+ c.fetchBundleVersions(true);
+ c.fetchDestinations(true);
+ c.fetchPackageType(true);
+ c.fetchRepo(true);
+ bs = bundleManager.findBundlesByCriteria(overlord, c);
+ assertNotNull(bs);
+ assertEquals(2, bs.size());
+ assertEquals(b10, bs.get(1));
+
+ // return last 1
+ c.addFilterName(TEST_PREFIX);
+ c.setCaseSensitive(true);
+ c.setPaging(1, 9);
+ c.fetchBundleVersions(true);
+ c.fetchDestinations(true);
+ c.fetchPackageType(true);
+ c.fetchRepo(true);
+ bs = bundleManager.findBundlesByCriteria(overlord, c);
+ assertNotNull(bs);
+ assertEquals(1, bs.size());
+ assertEquals(b10, bs.get(0));
+ }
@Test(enabled = TESTS_ENABLED)
public void testFindBundleVersionsByCriteria() throws Exception {
@@ -998,7 +1046,100 @@ public class BundleManagerBeanTest extends AbstractEJB3Test {
assertNotNull(bvOut.getBundleDeployments());
assertTrue(bvOut.getBundleDeployments().isEmpty());
}
+
+ @Test(enabled = TESTS_ENABLED)
+ public void testFindBundleVersionsByCriteriaPaging() throws Exception {
+ Bundle b1 = createBundle("one");
+ for (int i = 0; i < 59; i++) {
+ createBundleVersion(b1.getName(), "1." +
String.format("%02d", i + 1), b1);
+ }
+ BundleVersion bv60 = createBundleVersion(b1.getName(), "1.60", b1);
+
+ BundleVersionCriteria c = new BundleVersionCriteria();
+ PageList<BundleVersion> bvs = null;
+ BundleVersion bvOut = null;
+
+ // return first ten
+ c.addFilterName(TEST_PREFIX);
+ c.setPaging(0, 10);
+ bvs = bundleManager.findBundleVersionsByCriteria(overlord, c);
+ assertNotNull(bvs);
+ assertEquals(10, bvs.size());
+ assertFalse(bvs.get(0).equals(bvs.get(1)));
+
+ // return last 3
+ c.addFilterName(TEST_PREFIX);
+ c.setPaging(19, 3);
+ bvs = bundleManager.findBundleVersionsByCriteria(overlord, c);
+ assertNotNull(bvs);
+ assertEquals(3, bvs.size());
+ assertFalse(bvs.get(0).equals(bvs.get(1)));
+ assertEquals(bv60, bvs.get(2));
+ }
+
+ @Test(enabled = TESTS_ENABLED)
+ public void testGetAllBundleVersionFilenames() throws Exception {
+ final Bundle b1 = createBundle("one");
+ assertNotNull(b1);
+ final BundleVersion bv1 = createBundleVersion(b1.getName(), "1.0",
b1);
+ assertNotNull(bv1);
+ final HashMap<String, Boolean> files =
bundleManager.getAllBundleVersionFilenames(overlord, bv1.getId());
+ assertNotNull(files);
+ assertEquals(DEFAULT_CRITERIA_PAGE_SIZE + 2, files.keySet().size());
+ }
+
+ @Test(enabled = TESTS_ENABLED)
+ public void testCreateBundleAndBundleVersionStrictName1() throws Exception {
+ final Bundle b1 = createBundle("one");
+ final String name = "on";
+ final String fullName = TEST_PREFIX + "-bundle-" + name;
+ final BundleType type = createBundleType(name);
+ final String recipe = "deploy -f " + TEST_PREFIX + ".zip -d @@
test.path @@";
+ final BundleVersion bundleVerison =
bundleManager.createBundleAndBundleVersion(overlord, fullName,
+ "description", type.getId(), fullName, fullName +
"-desc", "3.0", recipe);
+ assertNotNull(bundleVerison);
+
+ // find the previously created bundle
+ BundleCriteria c = new BundleCriteria();
+ PageList<Bundle> bundles1 = null;
+ c.addFilterName(TEST_PREFIX + "-bundle-one");
+ c.setStrict(true);
+ bundles1 = bundleManager.findBundlesByCriteria(overlord, c);
+ assertNotNull(bundles1);
+ assertEquals(1, bundles1.size());
+ Bundle fetchedBundle1 = bundles1.get(0);
+
+ // find the newly created bundle
+ c = new BundleCriteria();
+ PageList<Bundle> bundles2 = null;
+ c.addFilterName(fullName);
+ c.setStrict(true);
+ bundles2 = bundleManager.findBundlesByCriteria(overlord, c);
+ assertNotNull(bundles2);
+ assertEquals(1, bundles2.size());
+ }
+
+ @Test(enabled = TESTS_ENABLED)
+ public void testCreateBundleAndBundleVersionStrictName2() throws Exception {
+ final String name = "one";
+ final Bundle bundle = createBundle(name);
+ final String fullName = TEST_PREFIX + "-bundle-" + name;
+ final String recipe = "deploy -f " + TEST_PREFIX + ".zip -d @@
test.path @@";
+ final BundleVersion bundleVerison =
bundleManager.createBundleAndBundleVersion(overlord, fullName,
+ "description", bundle.getBundleType().getId(), fullName, fullName +
"-desc", "3.0", recipe);
+
+ // find the newly created bundle
+ BundleCriteria c = new BundleCriteria();
+ PageList<Bundle> bundles = null;
+ c.addFilterName(fullName);
+ c.setStrict(true);
+ bundles = bundleManager.findBundlesByCriteria(overlord, c);
+ assertNotNull(bundles);
+ assertEquals(1, bundles.size());
+ }
+
+ // helper methods
private BundleType createBundleType(String name) throws Exception {
final String fullName = TEST_PREFIX + "-type-" + name;
ResourceType rt = createResourceTypeForBundleType(name);
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
index 7481496..7c95cb5 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/bundle/TestBundleServerPluginService.java
@@ -50,6 +50,7 @@ import
org.rhq.enterprise.server.plugin.pc.bundle.BundleServerPluginManager;
import org.rhq.enterprise.server.plugin.pc.content.ContentServerPluginContainer;
import org.rhq.enterprise.server.plugin.pc.content.ContentServerPluginManager;
import org.rhq.enterprise.server.plugin.pc.content.PackageTypeServerPluginContainer;
+import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.xmlschema.ServerPluginDescriptorMetadataParser;
import
org.rhq.enterprise.server.xmlschema.generated.serverplugin.ServerPluginDescriptorType;
@@ -226,8 +227,9 @@ public class TestBundleServerPluginService extends ServerPluginService
implement
"Test property for BundleVersion Config Def testing", true,
PropertySimpleType.STRING));
bundleFileNames = new HashSet<String>();
- bundleFileNames.add("bundletest-bundlefile-1");
- bundleFileNames.add("bundletest-bundlefile-2");
+ for (int i = 0; i < AbstractEJB3Test.DEFAULT_CRITERIA_PAGE_SIZE + 2; i++)
{
+ bundleFileNames.add("bundletest-bundlefile-" + i);
+ }
return new RecipeParseResults(metadata, configDef, bundleFileNames);
}
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
index 1750167..41acc0d 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/test/AbstractEJB3Test.java
@@ -76,6 +76,10 @@ import org.rhq.test.PropertyMatcher;
public abstract class AbstractEJB3Test extends Arquillian {
+ // this value should correspond with the value passed in the default constructor in
+ // org.rhq.core.domain.criteria.Criteria class
+ public static final int DEFAULT_CRITERIA_PAGE_SIZE = 200;
+
protected static final String JNDI_RHQDS = "java:jboss/datasources/RHQDS";
protected static File tmpdirRoot = new File("./target/test-tmpdir");
commit 3bed8cb705a9c4662b69891c1ec1c833ba8dbc64
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 27 17:59:39 2013 -0500
[Bug 888070 - Agent prompt-command doesn't properly parse command-line arguments]
A sort of annoying parsing issue affecting topmost command line parsing in
AgentMain.
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 0c95199..d959552 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
@@ -3314,9 +3314,9 @@ public class AgentMain {
}
if (nextToken == java.io.StreamTokenizer.TT_WORD) {
- args.add(strtok.sval);
+ args.add(safeArg(strtok.sval));
} else if (nextToken == '\"') {
- args.add(strtok.sval);
+ args.add(safeArg(strtok.sval));
} else if ((nextToken == java.io.StreamTokenizer.TT_EOF) || (nextToken ==
java.io.StreamTokenizer.TT_EOL)) {
keep_going = false;
}
@@ -3325,6 +3325,14 @@ public class AgentMain {
return args.toArray(new String[args.size()]);
}
+ // perform any other massaging
+ private String safeArg(String arg) {
+ // remove trailing '=' from long option args. For example --plugin=
should just be --plugin for
+ // downstream processing.
+ String result = (arg.startsWith("--") &&
arg.endsWith("=")) ? arg.substring(0, arg.length() - 1) : arg;
+ return result;
+ }
+
/**
* Returns the preferences for this agent. The node returned is where all preferences
are to be stored.
*
commit b0b1589b891e6377b06fdb8ef0c947a8ee8e8551
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 27 14:00:38 2013 -0500
[Bug 911681 - Globally Uncaught exception while viewing resource configuration]
If there actually is no resource configuration available, for whatever reason,
there was a bug in the handling of this rare use case. We try to disable
the save button, which at this point does not actually exist.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
index f0947ac..10d8760 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/resource/detail/configuration/ResourceConfigurationEditView.java
@@ -130,7 +130,6 @@ public class ResourceConfigurationEditView extends LocatableVLayout
implements P
Message message = new
Message(MSG.view_configurationDetails_noConfigurationFetched(),
Message.Severity.Info);
CoreGUI.getMessageCenter().notify(message);
- saveButton.disable();
refreshing = false;
return;
}
commit 0f973b4b8ef0f9f261a6bcc7563d823907fa5f44
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 27 12:10:54 2013 -0500
[Bug 808231 - [plugin-container] NullPointerExceptions (NPE's) occur during PC
shutdown, because the PC does not wait for ExecutorServices that have been shut down to
terminate]
A follow-on to commit 5ef9c47ee8edab0fd0558a208911cc31dfb5d1dc. It seems this
existing BZ had the same intention and actually had support built-in to
deal with this problem, but had not applied it to production. So:
- Enable WAIT_FOR_SHUTDOWN_SERVICE_TERMINATION_DEFAULT such that we wait
5 minutes for executors to finish their work. This is good for
operation execution, avail checking, and discovery.
- Keep isRunning(), added in the previous commit, but make it a lightweight
check by taking away the lock request. Continue to use it to safeguard
against ERROR generation even if discovery takes longer than 5 minutes to
complete.
- Complement the outer guards in intialize() and shutdown() with guards
that are inside the lock aquisition, to prevent sequentially executing
the init or shutdown logic.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
index 7c0a21b..3705505 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
@@ -260,17 +260,15 @@ public class PluginContainer {
/**
* If the plugin container has been initialized, the plugins have started work, and
the container is
- * not actively shutting down, this returns <code>true</code>.
+ * not actively shutting down, this returns <code>true</code>.
+ *
+ * <p>Note! that there is no locking on this method. Therefore it returns
quickly and is likely correct, but if
+ * called outside of locking the return value is not guaranteed. As such, use this
only as a lightweight check.</p>
*
* @return <code>true</code> if the plugin container was initialized,
started and is not shutting down; <code>false</code> otherwise
*/
public boolean isRunning() {
- Lock lock = obtainReadLock();
- try {
- return started && !shuttingDown;
- } finally {
- releaseLock(lock);
- }
+ return !shuttingDown && started;
}
/**
@@ -283,12 +281,18 @@ public class PluginContainer {
* <p>If the plugin container has already been initialized, this method does
nothing and returns.</p>
*/
public void initialize() {
+ // this quick guard is OK but doesn't prevent several calls to initialize()
from stacking up while waiting for the lock
if (started) {
log.info("Plugin container is already initialized.");
}
Lock lock = obtainWriteLock();
try {
+ // this guard prevents us from executing initialize logic multiple times in a
row
+ if (started) {
+ return;
+ }
+
version = PluginContainer.class.getPackage().getImplementationVersion();
log.info("Initializing Plugin Container" + ((version != null) ?
(" v" + version) : "") + "...");
@@ -354,7 +358,8 @@ public class PluginContainer {
* this method does nothing and returns.
*/
public boolean shutdown() {
- if (!started) {
+ // this quick guard is OK but doesn't prevent several calls to shutdown()
from stacking up while waiting for the lock
+ if (!isRunning()) {
log.info("Plugin container is already shut down.");
}
@@ -362,6 +367,11 @@ public class PluginContainer {
// end up deadlocked.
Lock lock = (configuration.isWaitForShutdownServiceTermination()) ?
obtainReadLock() : obtainWriteLock();
try {
+ // this guard prevents us from executing shutdown logic multiple times in a
row
+ if (!isRunning()) {
+ return true;
+ }
+
shuttingDown = true;
shutdownGracefully = true;
shutdownStartTime = System.currentTimeMillis();
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
index 41dbda7..22f8150 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainerConfiguration.java
@@ -52,7 +52,7 @@ public class PluginContainerConfiguration {
private static final String CREATE_RESOURCE_CLASSLOADERS = PROP_PREFIX +
"create-resource-classloaders";
private static final String START_MANAGEMENT_BEAN_PROP = PROP_PREFIX +
"start-management-bean";
private static final String WAIT_FOR_SHUTDOWN_SERVICE_TERMINATION = PROP_PREFIX +
"wait-for-shutdown-service-termination";
- public static final boolean WAIT_FOR_SHUTDOWN_SERVICE_TERMINATION_DEFAULT = false;
+ public static final boolean WAIT_FOR_SHUTDOWN_SERVICE_TERMINATION_DEFAULT = true;
private static final String SHUTDOWN_SERVICE_TERMINATION_TIMEOUT = PROP_PREFIX +
"shutdown-service-termination-timeout";
public static final long SHUTDOWN_SERVICE_TERMINATION_TIMEOUT_DEFAULT = 5 * 60L; //
in seconds
commit ac0be216834e9fc362f4ba5fa006fdd2001609b1
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Wed Feb 27 11:19:13 2013 +0100
Add some more mappings and improve generator.
diff --git a/.mailmap b/.mailmap
index 67f51f8..384ec04 100644
--- a/.mailmap
+++ b/.mailmap
@@ -30,6 +30,8 @@ Jason Dobies <jason.dobies(a)redhat.com> <jdobies(a)redhat.com>
Jay Shaughnessy <jshaughn(a)redhat.com>
Jay Shaughnessy <jshaughn(a)redhat.com> <jshaughnessy@jshaughnessy-PC>
Jay Shaughnessy <jshaughn(a)redhat.com> <jshaughnessy@.(none)>
+Jay Shaughnessy <jshaughn(a)redhat.com> <jshaughn(a)jshaughn.csb>
+Jay Shaughnessy <jshaughn(a)redhat.com> Jay Shaughnessy
<jshaughn(a)jshaughn.csb>
Jeff Ortel <jortel(a)redhat.com>
Jessica Sant <jsant(a)redhat.com>
Jijun Liu <lxjijun(a)gmail.com>
@@ -64,6 +66,7 @@ Shannon Hughes <shughes(a)redhat.com>
<shughes(a)fred.hughes.lan>
Simeon Pinder <spinder(a)redhat.com> <simeonpinder(a)gmail.com>
Simeon Pinder <spinder(a)redhat.com> <spinder(a)cacaphonix.conchfritter.com>
Simeon Pinder <spinder(a)redhat.com> <spinder(a)fulliautomatix.conchfritter.com>
+Simeon Pinder <spinder(a)redhat.com> <spinder(a)spinder.csb>
Simeon Pinder <spinder(a)redhat.com>
Stefan Negrea <snegrea(a)redhat.com>
Steve Millidge <smillidge(a)c2b2.co.uk>
@@ -71,4 +74,6 @@ Ted Won ìì¢
ì <tedd824(a)gmail.com>
Test JON User <test_jon(a)jon01.qa.atl2.redhat.com>
Todd B Sanders <tsanders(a)dhcp231-67.rdu.redhat.com>
Torben JÀger <torben(a)jit-central.com>
+Thomas Segismont <tsegismo(a)redhat.com> Thomas SEGISMONT
<tsegismo(a)redhat.com>
+Thomas Segismont <tsegismo(a)redhat.com>
hudson auto <wnstb(a)yahoo.com>
diff --git a/etc/scripts/createRelasenotes.pl b/etc/scripts/createRelasenotes.pl
index 7984d8f..fe42631 100644
--- a/etc/scripts/createRelasenotes.pl
+++ b/etc/scripts/createRelasenotes.pl
@@ -27,7 +27,10 @@ while(<GIT>) {
# print "IN: ", $_;
next if /^$/;
- s/^[\s\[]*BZ\s([0-9]{5,7})(\]? .*)$/ [BZ
$1|https:\/\/bugzilla.redhat.com\/show_bug.cgi\?id\=$1] $2/;
+ s/\${/\$\\{/g;
+ s/^[\s\[]*BZ\s([0-9]{5,7})\s?(\]? .*)$/ [BZ
$1|https:\/\/bugzilla.redhat.com\/show_bug.cgi\?id\=$1] $2/;
+ s/^[\s\[]*BZ-([0-9]{5,7})\s?(\]? .*)$/ [BZ
$1|https:\/\/bugzilla.redhat.com\/show_bug.cgi\?id\=$1] $2/;
+ s/^[\s\[]*BZ([0-9]{5,7})\s?(\]? .*)$/ [BZ
$1|https:\/\/bugzilla.redhat.com\/show_bug.cgi\?id\=$1] $2/;
s/^[\s\[]*Bug\s([0-9]{5,7})(\]? .*)$/ [BZ
$1|https:\/\/bugzilla.redhat.com\/show_bug.cgi\?id\=$1] $2/;
if (/ .*/) {
s/^ (.*)/** $1/;
commit 8f1cc42d33c5221e1e37df61fcb663ee27554d2d
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Tue Feb 26 17:27:40 2013 +0100
No longer needed
diff --git a/etc/dev-utils/setup-rest/setup.sh b/etc/dev-utils/setup-rest/setup.sh
deleted file mode 100644
index 0634cd9..0000000
--- a/etc/dev-utils/setup-rest/setup.sh
+++ /dev/null
@@ -1,17 +0,0 @@
-#!/bin/sh
-
-# Set the DEV_CONTAINER to your dev container location
-DEV_CONTAINER=/im/dev-container
-
-
-cd $DEV_CONTAINER/jbossas/server/default/lib
-cp
~/.m2/repository/org/jboss/resteasy/resteasy-jaxrs/2.2.1.GA/resteasy-jaxrs-2.2.1.GA.jar .
-cp
~/.m2/repository/org/jboss/resteasy/resteasy-links/2.2.0.GA/resteasy-links-2.2.0.GA.jar .
-cp
~/.m2/repository/org/jboss/resteasy/resteasy-jettison-provider/2.2.0.GA/resteasy-jettison-provider-2.2.0.GA.jar
.
-cp
~/.m2/repository/org/jboss/resteasy/resteasy-jaxb-provider/2.2.1.GA/resteasy-jaxb-provider-2.2.1.GA.jar
.
-cp ~/.m2/repository/org/scannotation/scannotation/1.0.3/scannotation-1.0.3.jar .
-cp ~/.m2/repository/net/jcip/jcip-annotations/1.0/jcip-annotations-1.0.jar .
-cp ~/.m2/repository/org/codehaus/jettison/1.2/jessison-1.2.jar .
-cp ~/.m2/repository/org/codehaus/jettison/jettison/1.2/jettison-1.2.jar .
-cp ~/.m2/repository/org/jboss/el/jboss-el/2.0.1.GA/jboss-el-2.0.1.GA.jar .
-cp ~/.m2/repository/org/freemarker/freemarker/2.3.18/freemarker-2.3.18.jar .
commit 3eb0ac487e92e5f26174deb2b19eaffc1729937a
Author: Heiko W. Rupp <hwr(a)redhat.com>
Date: Mon Feb 25 16:37:15 2013 +0100
Make tests independent of a specific id for the platform
diff --git
a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
index 3d06335..1794062 100644
---
a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
+++
b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/AbstractBase.java
@@ -18,12 +18,22 @@
*/
package org.rhq.modules.integrationTests.restApi;
+import java.util.List;
+import java.util.Map;
+
import com.jayway.restassured.RestAssured;
+import com.jayway.restassured.http.ContentType;
import com.jayway.restassured.response.Header;
+import org.junit.After;
+import org.junit.AfterClass;
import org.junit.Before;
+import org.junit.BeforeClass;
+
+import org.rhq.modules.integrationTests.restApi.d.Resource;
import static com.jayway.restassured.RestAssured.basic;
+import static com.jayway.restassured.RestAssured.given;
/**
* Common setup for the tests
@@ -35,11 +45,15 @@ public abstract class AbstractBase {
private static final String APPLICATION_XML = "application/xml";
private static final String TEXT_CSV = "text/csv";
private static final String TEXT_HTML = "text/html";
+ static final String REST_TEST_DUMMY = "-rest-test-dummy-";
static Header acceptJson = new Header("Accept", APPLICATION_JSON);
static Header acceptXml = new Header("Accept", APPLICATION_XML);
static Header acceptHtml = new Header("Accept", TEXT_HTML);
static Header acceptCsv = new Header("Accept", TEXT_CSV);
+ int _platformId ;
+ int _platformTypeId;
+
@Before
public void setUp() throws Exception {
@@ -48,5 +62,80 @@ public abstract class AbstractBase {
RestAssured.basePath = "/rest/";
RestAssured.authentication = basic("rhqadmin","rhqadmin");
+ Resource resource = new Resource();
+ resource.setResourceName(REST_TEST_DUMMY);
+ resource.setTypeName("Linux");
+
+ Resource platform =
+ given()
+ .header(acceptJson)
+ .contentType(ContentType.JSON)
+ .body(resource)
+ .expect()
+ .statusCode(201)
+ .log().ifError()
+ .when()
+ .post("/resource/platforms")
+ .as(Resource.class);
+
+ _platformId = platform.getResourceId();
+ _platformTypeId = platform.getTypeId();
+
+ }
+
+ @AfterClass
+ public static void tearDownClass() throws Exception {
+
+
+ List res =
+ given()
+ .header(acceptJson)
+ .queryParam("q",REST_TEST_DUMMY)
+ .expect()
+ .statusCode(200)
+ .log().ifError()
+ .when()
+ .get("/resource")
+ .as(List.class);
+
+ if (res!=null && res.get(0)!=null) {
+
+ String tmp = ((Map
<String,String>)res.get(0)).get("resourceId");
+ int pid =Integer.valueOf(tmp);
+
+ given()
+ .pathParam("id", pid)
+ .expect()
+ .statusCode(204)
+ .log().ifError()
+ .when()
+ .delete("/resource/{id}");
+
+ }
+ }
+
+ protected int findIdOfARealPlatform() {
+ List res =
+ given()
+ .header(acceptJson)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/platforms")
+ .as(List.class);
+
+ assert res != null;
+ for (Object entry : res) {
+ if (entry instanceof Map) {
+ Map<String,String> map = (Map<String, String>) entry;
+ if (!map.get("resourceName").equals(REST_TEST_DUMMY)) {
+ return Integer.valueOf(map.get("resourceId"));
+ }
+ }
+ }
+
+ assert true : "No real platform found in inventory. Please add one";
+
+ return 0;
}
}
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 aa56a46..c3accf3 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
@@ -259,7 +259,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(201)
.body("dampeningCategory",is("NONE"))
@@ -289,7 +289,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(406)
.log().everything()
@@ -316,7 +316,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(201)
.body("dampeningCategory",is("PARTIAL_COUNT"))
@@ -351,7 +351,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId", 10001)
+ .queryParam("resourceId", _platformId)
.expect()
.statusCode(201)
.body("dampeningCategory",is("DURATION_COUNT"))
@@ -800,7 +800,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(201)
.log().ifError()
@@ -933,7 +933,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.body(alertDefinition)
.log().everything()
- .queryParam("resourceId", 10001)
+ .queryParam("resourceId", _platformId)
.expect()
.statusCode(201)
.log().ifError()
@@ -999,7 +999,7 @@ public class AlertTest extends AbstractBase {
.contentType(ContentType.JSON)
.header(acceptJson)
.body(alertDefinition)
- .queryParam("resourceId", 10001)
+ .queryParam("resourceId", _platformId)
.expect()
.statusCode(201)
.body("priority", is("HIGH"))
@@ -1146,10 +1146,12 @@ public class AlertTest extends AbstractBase {
@Test
public void testCreateDefinitionForGroup() throws Exception {
+ assert _platformTypeId!=0 : "Set up did not run or failed";
+
// Create a group
Group group = new Group("test-group-" +
System.currentTimeMillis()/1000);
group.setCategory("COMPATIBLE");
- group.setResourceTypeId(10001);
+ group.setResourceTypeId(_platformTypeId);
String groupUri =
given()
@@ -1204,7 +1206,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceTypeId",10001)
+ .queryParam("resourceTypeId",_platformTypeId)
.expect()
.statusCode(201)
.log().ifError()
@@ -1242,10 +1244,10 @@ public class AlertTest extends AbstractBase {
// Send a avail down/up sequence -> alert definition should fire
long now = System.currentTimeMillis();
- Availability a = new Availability(10001,now-2000,"DOWN");
+ Availability a = new Availability(_platformId,now-2000,"DOWN");
given()
.contentType(ContentType.JSON)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.body(a)
.expect()
.statusCode(204)
@@ -1253,10 +1255,10 @@ public class AlertTest extends AbstractBase {
.when()
.put("/resource/{id}/availability");
- a = new Availability(10001,now-1000,"UP");
+ a = new Availability(_platformId,now-1000,"UP");
given()
.contentType(ContentType.JSON)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.body(a)
.expect()
.statusCode(204)
@@ -1370,10 +1372,10 @@ public class AlertTest extends AbstractBase {
// Send a avail down/up sequence -> alert definition should fire
long now = System.currentTimeMillis();
- Availability a = new Availability(10001,now-2000,"DOWN");
+ Availability a = new Availability(_platformId,now-2000,"DOWN");
given()
.contentType(ContentType.JSON)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.body(a)
.expect()
.statusCode(204)
@@ -1381,10 +1383,10 @@ public class AlertTest extends AbstractBase {
.when()
.put("/resource/{id}/availability");
- a = new Availability(10001,now-1000,"UP");
+ a = new Availability(_platformId,now-1000,"UP");
given()
.contentType(ContentType.JSON)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.body(a)
.expect()
.statusCode(204)
@@ -1479,7 +1481,7 @@ public class AlertTest extends AbstractBase {
.header(acceptJson)
.contentType(ContentType.JSON)
.body(alertDefinition)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(201)
.log().ifError()
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 20caca4..2e74181 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
@@ -43,7 +43,7 @@ public class EventTest extends AbstractBase {
given()
.header(acceptJson)
- .pathParam("id",10001)
+ .pathParam("id",_platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -57,7 +57,7 @@ public class EventTest extends AbstractBase {
given()
.header(acceptJson)
- .pathParam("id",10001)
+ .pathParam("id",_platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -89,14 +89,14 @@ public class EventTest extends AbstractBase {
public void testAddEventSourceForUnknownDefinition() throws Exception {
EventSource es = new EventSource();
- es.setResourceId(10001);
+ es.setResourceId(_platformId);
es.setName("Frobnitz"); // Name of the event definition
es.setLocation("-x-test-location");
given()
.header(acceptJson)
.contentType(ContentType.JSON)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.body(es)
.expect()
.statusCode(404)
@@ -108,7 +108,7 @@ public class EventTest extends AbstractBase {
public void testAddGetDeleteEventSource() throws Exception {
EventSource es = new EventSource();
- es.setResourceId(10001);
+ es.setResourceId(_platformId);
es.setName("Event Log"); // Name of the event definition
es.setLocation("-x-test-location");
@@ -116,7 +116,7 @@ public class EventTest extends AbstractBase {
given()
.header(acceptJson)
.contentType(ContentType.JSON)
- .pathParam("id",10001)
+ .pathParam("id",_platformId)
.body(es)
.expect()
.statusCode(200)
@@ -148,7 +148,7 @@ public class EventTest extends AbstractBase {
response =
given()
.header(acceptJson)
- .pathParam("id",10001)
+ .pathParam("id",_platformId)
.expect()
.statusCode(200)
.when()
@@ -178,7 +178,7 @@ public class EventTest extends AbstractBase {
public void testAddGetEventOnSource() throws Exception {
EventSource es = new EventSource();
- es.setResourceId(10001);
+ es.setResourceId(_platformId);
es.setName("Event Log"); // Name of the event definition
es.setLocation("-x-test-location");
@@ -186,7 +186,7 @@ public class EventTest extends AbstractBase {
given()
.header(acceptJson)
.contentType(ContentType.JSON)
- .pathParam("id",10001)
+ .pathParam("id",_platformId)
.body(es)
.expect()
.statusCode(200)
@@ -235,7 +235,7 @@ public class EventTest extends AbstractBase {
response =
given()
.header(acceptJson)
- .pathParam("id", 10001)
+ .pathParam("id", _platformId)
.queryParam("startTime",now - 10)
.queryParam("endTime",now + 10)
.expect()
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 f6ffbe7..646f81c 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
@@ -46,7 +46,6 @@ public class GroupTest extends AbstractBase {
private static final String X_TEST_GROUP = "-x-test-group";
- @Override
@Before
public void setUp() throws Exception {
super.setUp();
@@ -214,6 +213,9 @@ public class GroupTest extends AbstractBase {
@Test
public void testAddResourceToGroup() throws Exception {
+
+ assert _platformId !=0 : "Set up did not run or was not successful";
+
Group group = new Group(X_TEST_GROUP);
// Generate the group
@@ -237,7 +239,7 @@ public class GroupTest extends AbstractBase {
.contentType(ContentType.JSON)
.body(group)
.pathParam("id", id)
- .pathParam("resourceId",10001)
+ .pathParam("resourceId",_platformId)
.expect()
.statusCode(HttpStatus.SC_OK)
.log().ifError()
@@ -281,7 +283,7 @@ public class GroupTest extends AbstractBase {
.contentType(ContentType.JSON)
.body(group)
.pathParam("gid", groupId)
- .pathParam("resourceId",10001)
+ .pathParam("resourceId",_platformId)
.expect()
.statusCode(HttpStatus.SC_OK)
.log().ifError()
@@ -390,7 +392,7 @@ public class GroupTest extends AbstractBase {
.contentType(ContentType.JSON)
.body(group)
.pathParam("id",id)
- .pathParam("resourceId",10001)
+ .pathParam("resourceId",_platformId)
.expect()
.statusCode(HttpStatus.SC_OK)
.log().ifError()
@@ -401,7 +403,7 @@ public class GroupTest extends AbstractBase {
given()
.header(acceptJson)
.pathParam("id",id)
- .pathParam("resourceId",10001)
+ .pathParam("resourceId",_platformId)
.expect()
.statusCode(HttpStatus.SC_OK)
.log().ifError()
@@ -425,7 +427,7 @@ public class GroupTest extends AbstractBase {
public void testGetMetricDefinitionsForGroup() throws Exception {
Group group = new Group(X_TEST_GROUP);
group.setCategory("COMPATIBLE");
- group.setResourceTypeId(10001);
+ group.setResourceTypeId(_platformTypeId);
// Generate the group
Response response =
diff --git
a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/MetricsTest.java
b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/MetricsTest.java
index 28fa806..0e7506d 100644
---
a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/MetricsTest.java
+++
b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/MetricsTest.java
@@ -46,21 +46,21 @@ public class MetricsTest extends AbstractBase {
private int numericScheduleId;
private long defaultInterval;
- @Override
@Before
public void setUp() throws Exception {
- super.setUp();// is not called by junit before this one
+ super.setUp();
// Determine a schedule id for the common cases
Response r =
given()
.header(acceptJson)
.queryParam("type", "metric")
+ .pathParam("rid",_platformId)
.expect()
.statusCode(200)
.log().ifError()
.when()
- .get("/resource/10001/schedules");
+ .get("/resource/{rid}/schedules");
JsonPath jp = r.jsonPath();
numericScheduleId = jp.getInt("[0].scheduleId");
@@ -216,11 +216,12 @@ public class MetricsTest extends AbstractBase {
given()
.header(acceptJson)
.queryParam("type", "trait")
+ .pathParam("rid",_platformId)
.expect()
.statusCode(200)
.log().ifError()
.when()
- .get("/resource/10001/schedules");
+ .get("/resource/{rid}/schedules");
JsonPath jp = r.jsonPath();
int tsId = jp.getInt("[0].scheduleId");
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 18b0297..b4dc580 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
@@ -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
@@ -43,14 +43,14 @@ public class OperationsTest extends AbstractBase {
private int definitionId;
- @Override
@Before
public void setUp() throws Exception {
- super.setUp(); // Junit does not call that for us
+ super.setUp();
+
Response r =
given()
.header(acceptJson)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -90,7 +90,7 @@ public class OperationsTest extends AbstractBase {
given()
.header(acceptJson)
.pathParam("definitionId",definitionId)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -118,7 +118,7 @@ public class OperationsTest extends AbstractBase {
given()
.header(acceptJson)
.pathParam("definitionId",definitionId)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",_platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -156,11 +156,13 @@ public class OperationsTest extends AbstractBase {
@Test
public void testCreateDraftOperationAndScheduleExecution() throws Exception {
+ int platformId = findIdOfARealPlatform();
+
Operation draft =
given()
.header(acceptJson)
.pathParam("definitionId",definitionId)
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",platformId)
.expect()
.statusCode(200)
.log().ifError()
@@ -174,7 +176,7 @@ public class OperationsTest extends AbstractBase {
int draftId = draft.getId();
draft.setReadyToSubmit(true);
- draft.getParams().put("detailed", true);
+ draft.getParams().put("detailedDiscovery", false);
// update to schedule
Operation scheduled =
@@ -213,7 +215,7 @@ public class OperationsTest extends AbstractBase {
// See if we also find it when we are looking for histories on the resource
Response response =
given()
- .queryParam("resourceId",10001)
+ .queryParam("resourceId",platformId)
.header(acceptJson)
.expect()
.statusCode(200)
@@ -269,7 +271,6 @@ public class OperationsTest extends AbstractBase {
.delete("/operation/history/{hid}");
}
-
}
}
diff --git
a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ReportsTest.java
b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ReportsTest.java
index a76a640..2c16ba2 100644
---
a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ReportsTest.java
+++
b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/ReportsTest.java
@@ -38,13 +38,6 @@ public class ReportsTest extends AbstractBase {
private static final int NUMBER_REPORTS = 9;
- @Override
- @Before
- public void setUp() throws Exception {
- super.setUp();
-
- }
-
@Test
public void testReportListJson() throws Exception {
given()
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 27bf5a2..a889ffc 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
@@ -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
@@ -33,6 +33,7 @@ import org.apache.http.HttpStatus;
import org.hamcrest.CoreMatchers;
import org.junit.Test;
+import org.rhq.modules.integrationTests.restApi.d.Availability;
import org.rhq.modules.integrationTests.restApi.d.Resource;
import static com.jayway.restassured.RestAssured.expect;
@@ -61,12 +62,14 @@ public class ResourcesTest extends AbstractBase {
given()
.header("Accept","application/json")
+ .pathParam("id",_platformId)
.expect()
.statusCode(200)
.contentType(ContentType.JSON)
+ .log().ifError()
.body("links.rel", CoreMatchers.hasItem("self"))
.when()
- .get("/resource/10001");
+ .get("/resource/{id}");
}
@@ -132,33 +135,40 @@ public class ResourcesTest extends AbstractBase {
@Test
public void testGetPlatformXml() {
+
+ assert _platformId!=0 : "Setup did not run or was no success";
+
given()
.header("Accept", "application/xml")
+ .pathParam("id",_platformId)
.expect()
.statusCode(200)
.contentType(ContentType.XML)
.when()
- .get("/resource/10001");
+ .get("/resource/{id}");
}
@Test
public void testGetPlatformSchedules() {
given()
.header("Accept", "application/json")
+ .pathParam("id", _platformId)
.expect()
.statusCode(200)
+ .log().ifError()
.when()
- .get("/resource/10001/schedules");
+ .get("/resource/{id}/schedules");
}
@Test
public void testGetPlatformChildren() {
given()
- .header("Accept","application/json")
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
.expect()
.statusCode(200)
.when()
- .get("/resource/10001/children");
+ .get("/resource/{id}/children");
}
@Test
@@ -421,60 +431,81 @@ public class ResourcesTest extends AbstractBase {
@Test
public void testAlertsForResource() throws Exception {
given()
- .header("Accept","application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/alerts");
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/alerts");
}
@Test
public void testSchedulesForResource() throws Exception {
given()
- .header("Accept","application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/schedules");
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/schedules");
}
@Test
public void testAvailabilityForResource() throws Exception {
given()
- .header("Accept", "application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/availability");
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/availability");
}
@Test
public void testAvailabilityHistoryForResource() throws Exception {
given()
- .header("Accept", "application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/availability/history");
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/availability/history");
}
@Test
public void testUpdateAvailability() throws Exception {
- Response response = given()
+ Response response =
+ given()
.header("Accept", "application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/availability");
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/availability");
String oldType = response.jsonPath().get("type");
try {
long now = System.currentTimeMillis()-100;
- given().body("{\"since\":" + now +
",\"type\":\"DOWN\",\"resourceId\":10001}")
- .header("Content-Type","application/json")
- .header("Accept","application/json")
- .pathParam("id",10001)
+ 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");
+ .statusCode(HttpStatus.SC_NO_CONTENT)
+ .log().ifError()
+ .when()
+ .put("/resource/{id}/availability");
response = given()
.header("Accept", "application/json")
- .expect().statusCode(200)
- .when().get("/resource/10001/availability");
+ .pathParam("id", _platformId)
+ .expect()
+ .statusCode(200)
+ .when()
+ .get("/resource/{id}/availability");
String currentType = response.jsonPath().get("type");
assert currentType.equals("DOWN"); // TODO small window where an
agent may have sent an update
@@ -482,13 +513,14 @@ public class ResourcesTest extends AbstractBase {
// Set back to original value
long now = System.currentTimeMillis()-100;
- given().body("{\"since\":" + now +
",\"type\":\""+oldType+"\",\"resourceId\":10001}")
- .header("Content-Type","application/json")
- .header("Accept","application/json")
- .pathParam("id",10001)
+ given()
+ .body("{\"since\":" + now +
",\"type\":\"" + oldType +
"\",\"resourceId\":" + _platformId + "}")
+ .header("Content-Type", "application/json")
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
.expect()
- .statusCode(HttpStatus.SC_NO_CONTENT)
- .log().ifError()
+ .statusCode(HttpStatus.SC_NO_CONTENT)
+ .log().ifError()
.when().put("/resource/{id}/availability");
}
@@ -500,14 +532,18 @@ public class ResourcesTest extends AbstractBase {
// Platforms should not be set to DISABLED according ot JSHAUGHN
long now = System.currentTimeMillis()-100;
- given().body("{\"since\":" + now +
",\"type\":\"DISABLED\",\"resourceId\":10001}")
- .header("Content-Type","application/json")
- .header("Accept","application/json")
- .pathParam("id",10001)
+ Availability avail = new Availability(_platformId,now,"DISABLED");
+
+ given()
+ .body(avail)
+ .header("Content-Type", "application/json")
+ .header("Accept", "application/json")
+ .pathParam("id", _platformId)
.expect()
- .statusCode(HttpStatus.SC_NOT_ACCEPTABLE)
- .log().ifError()
- .when().put("/resource/{id}/availability");
+ .statusCode(HttpStatus.SC_NOT_ACCEPTABLE)
+ .log().ifError()
+ .when()
+ .put("/resource/{id}/availability");
}
}
diff --git
a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/UserTest.java
b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/UserTest.java
index 07e2f29..e199dc5 100644
---
a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/UserTest.java
+++
b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/UserTest.java
@@ -40,38 +40,50 @@ public class UserTest extends AbstractBase {
@Test
public void testGetFavoritesResources() throws Exception {
- expect().statusCode(200)
- .log().ifError()
- .when().get("/user/favorites/resource");
+ expect()
+ .statusCode(200)
+ .log().ifError()
+ .when()
+ .get("/user/favorites/resource");
}
@Test
public void testGetFavoriteGroups() throws Exception {
- expect().statusCode(200)
- .log().ifError()
- .when().get("/user/favorites/group");
+ expect()
+ .statusCode(200)
+ .log().ifError()
+ .when()
+ .get("/user/favorites/group");
}
@Test
public void testAddRemoveFavoriteResources() throws Exception {
- expect().statusCode(204)
- .when().put("/user/favorites/resource/10001");
+ given()
+ .pathParam("rid",_platformId)
+ .expect()
+ .statusCode(204)
+ .when()
+ .put("/user/favorites/resource/{rid}");
try {
Response r =
expect()
.statusCode(200)
+ .log().everything()
.when()
.get("/user/favorites/resource");
JsonPath jp = r.jsonPath();
- assert jp.getList("resourceId").contains("10001");
+ assert
jp.getList("resourceId").contains(String.valueOf(_platformId));
}
finally {
- expect()
+ given()
+ .pathParam("rid",_platformId)
+ .expect()
.statusCode(204)
- .when().delete("/user/favorites/resource/10001");
+ .when()
+ .delete("/user/favorites/resource/{rid}");
}
}
diff --git
a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Resource.java
b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Resource.java
index 9c3c1a3..6cbcea0 100644
---
a/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Resource.java
+++
b/modules/integration-tests/rest-api/src/test/java/org/rhq/modules/integrationTests/restApi/d/Resource.java
@@ -19,6 +19,9 @@
package org.rhq.modules.integrationTests.restApi.d;
+import java.util.List;
+import java.util.Map;
+
/**
* A resource for testing purposes
* @author Heiko W. Rupp
@@ -30,6 +33,9 @@ public class Resource {
String typeName;
String pluginName;
Integer parentId;
+ int typeId;
+ List<Map> links;
+ String ancestry;
public Resource() {
}
@@ -73,4 +79,28 @@ public class Resource {
public void setTypeName(String typeName) {
this.typeName = typeName;
}
+
+ public int getTypeId() {
+ return typeId;
+ }
+
+ public void setTypeId(int typeId) {
+ this.typeId = typeId;
+ }
+
+ public List<Map> getLinks() {
+ return links;
+ }
+
+ public void setLinks(List<Map> links) {
+ this.links = links;
+ }
+
+ public String getAncestry() {
+ return ancestry;
+ }
+
+ public void setAncestry(String ancestry) {
+ this.ancestry = ancestry;
+ }
}
commit 5ef9c47ee8edab0fd0558a208911cc31dfb5d1dc
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 27 09:15:20 2013 -0500
Try to stop generating as many ERRORs in the agent.log when the PC is shut
down, typically for normal reasons.
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
index 0470d9b..7c0a21b 100644
--- a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
+++ b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/PluginContainer.java
@@ -259,6 +259,21 @@ public class PluginContainer {
}
/**
+ * If the plugin container has been initialized, the plugins have started work, and
the container is
+ * not actively shutting down, this returns <code>true</code>.
+ *
+ * @return <code>true</code> if the plugin container was initialized,
started and is not shutting down; <code>false</code> otherwise
+ */
+ public boolean isRunning() {
+ Lock lock = obtainReadLock();
+ try {
+ return started && !shuttingDown;
+ } finally {
+ releaseLock(lock);
+ }
+ }
+
+ /**
* Initializes the plugin container which initializes all internal managers. Once
initialized, all plugins will be
* activated, metrics will begin getting collected and automatic discovery will
start.
*
@@ -360,8 +375,8 @@ public class PluginContainer {
if (configuration.isWaitForShutdownServiceTermination()) {
log.info("Plugin container shutdown will wait up to "
- + configuration.getShutdownServiceTerminationTimeout()
- + " seconds for shut down background threads to
terminate.");
+ + configuration.getShutdownServiceTerminationTimeout()
+ + " seconds for shut down background threads to
terminate.");
}
driftManager.shutdown();
@@ -389,12 +404,12 @@ public class PluginContainer {
if (configuration.isWaitForShutdownServiceTermination()) {
if (shutdownGracefully) {
long elapsedMillis = System.currentTimeMillis() -
this.shutdownStartTime;
- String elapsedTimeString = (elapsedMillis >= 1000) ?
- (elapsedMillis / 1000) + " seconds" : "less
than 1 second";
+ String elapsedTimeString = (elapsedMillis >= 1000) ?
(elapsedMillis / 1000) + " seconds"
+ : "less than 1 second";
log.info("All shut down background threads have terminated
(" + elapsedTimeString + " elapsed).");
} else {
log.warn("Timed out after " +
configuration.getShutdownServiceTerminationTimeout()
- + " seconds while waiting for shut down background
threads to terminate.");
+ + " seconds while waiting for shut down background threads
to terminate.");
}
}
@@ -770,14 +785,14 @@ public class PluginContainer {
try {
logWaitingForExecutorServiceTerminationDebugMessage(executorService,
remainingShutdownTimeoutMillis);
boolean executorTerminated =
executorService.awaitTermination(remainingShutdownTimeoutMillis,
- TimeUnit.MILLISECONDS);
+ TimeUnit.MILLISECONDS);
if (!executorTerminated) {
String poolName = getPoolName(executorService);
if (poolName != null) {
int activeThreadsInPool = getActiveThreadCount(poolName);
log.warn("Timed out after [" +
(remainingShutdownTimeoutMillis / 1000)
- + "] seconds while waiting for all threads in
pool [" + poolName + "] to terminate - ["
- + activeThreadsInPool + "] threads in the pool
are still active.");
+ + "] seconds while waiting for all threads in pool
[" + poolName + "] to terminate - ["
+ + activeThreadsInPool + "] threads in the pool are
still active.");
}
}
} catch (InterruptedException e) {
@@ -795,13 +810,13 @@ public class PluginContainer {
}
private void logWaitingForExecutorServiceTerminationDebugMessage(ExecutorService
executorService,
- long
remainingShutdownTimeoutMillis) {
+ long remainingShutdownTimeoutMillis) {
if (log.isDebugEnabled()) {
String poolName = getPoolName(executorService);
if (poolName != null) {
int activeThreadsInPool = getActiveThreadCount(poolName);
log.debug("Waiting up to [" + (remainingShutdownTimeoutMillis /
1000) + "] seconds for ["
- + activeThreadsInPool + "] threads in pool [" +
poolName + "] to terminate...");
+ + activeThreadsInPool + "] threads in pool [" + poolName +
"] to terminate...");
}
}
}
@@ -812,8 +827,8 @@ public class PluginContainer {
int activeThreadsInPool = getActiveThreadCount(poolName);
if (activeThreadsInPool > 0) {
log.debug("Not waiting for all threads in pool [" + poolName
- + "] to terminate, since the configured plugin container
shutdown timeout has already elapsed - ["
- + activeThreadsInPool + "] threads in the pool are still
active.");
+ + "] to terminate, since the configured plugin container
shutdown timeout has already elapsed - ["
+ + activeThreadsInPool + "] threads in the pool are still
active.");
}
}
}
@@ -822,7 +837,7 @@ public class PluginContainer {
if (executorService instanceof ThreadPoolExecutor) {
ThreadFactory threadFactory = ((ThreadPoolExecutor)
executorService).getThreadFactory();
if (threadFactory instanceof LoggingThreadFactory) {
- return ((LoggingThreadFactory)threadFactory).getPoolName();
+ return ((LoggingThreadFactory) threadFactory).getPoolName();
}
}
return null;
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
index 7231360..caa9260 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/inventory/InventoryManager.java
@@ -2614,8 +2614,12 @@ public class InventoryManager extends AgentService implements
ContainerService,
} catch (Throwable e) {
// TODO GH: Add server/parent - up/down semantics so this won't happen
just because a server is not up
long elapsedTime = System.currentTimeMillis() - startTime;
- log.warn("Failure during discovery for [" + resourceType.getName()
+ "] Resources - failed after "
- + elapsedTime + " ms.", e);
+ if (!PluginContainer.getInstance().isRunning()) {
+ log.warn("Could not complete discovery, plugin container was shut
down.");
+ } else {
+ log.warn("Failure during discovery for [" +
resourceType.getName() + "] Resources - failed after "
+ + elapsedTime + " ms.", e);
+ }
return Collections.EMPTY_SET;
}
diff --git
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
index 61733b9..c160b78 100644
---
a/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
+++
b/modules/core/plugin-container/src/main/java/org/rhq/core/pc/util/DiscoveryComponentProxyFactory.java
@@ -74,8 +74,8 @@ public class DiscoveryComponentProxyFactory {
*/
@SuppressWarnings("unchecked")
public <T> T getDiscoveryComponentProxy(ResourceType type,
ResourceDiscoveryComponent component, long timeout,
- Class<T> componentInterface,
ResourceContainer parentResourceContainer)
- throws PluginContainerException, BlacklistedException {
+ Class<T> componentInterface, ResourceContainer parentResourceContainer)
throws PluginContainerException,
+ BlacklistedException {
if (isResourceTypeBlacklisted(type)) {
throw new BlacklistedException("Discovery component for resource type
[" + type + "] has been blacklisted");
@@ -84,8 +84,8 @@ public class DiscoveryComponentProxyFactory {
try {
PluginComponentFactory pluginComponentFactory =
PluginContainer.getInstance().getPluginComponentFactory();
- ClassLoader pluginClassLoader =
-
pluginComponentFactory.getDiscoveryComponentClassLoader(parentResourceContainer,
type.getPlugin());
+ ClassLoader pluginClassLoader =
pluginComponentFactory.getDiscoveryComponentClassLoader(
+ parentResourceContainer, type.getPlugin());
// This is the handler that will actually invoke the method calls.
ResourceDiscoveryComponentInvocationHandler handler = new
ResourceDiscoveryComponentInvocationHandler(type,
@@ -120,11 +120,10 @@ public class DiscoveryComponentProxyFactory {
*/
@SuppressWarnings("unchecked")
public ResourceDiscoveryComponent getDiscoveryComponentProxy(ResourceType type,
-
ResourceDiscoveryComponent component, long timeout,
- ResourceContainer
parentResourceContainer)
- throws PluginContainerException, BlacklistedException {
+ ResourceDiscoveryComponent component, long timeout, ResourceContainer
parentResourceContainer)
+ throws PluginContainerException, BlacklistedException {
return getDiscoveryComponentProxy(type, component, timeout,
ResourceDiscoveryComponent.class,
- parentResourceContainer);
+ parentResourceContainer);
}
public void initialize() {
@@ -181,7 +180,7 @@ public class DiscoveryComponentProxyFactory {
private final ResourceType resourceType;
private final ClassLoader pluginClassLoader;
private Class<?> componentInterface;
-
+
public ResourceDiscoveryComponentInvocationHandler(ResourceType type,
ResourceDiscoveryComponent component,
long timeout, ClassLoader pluginClassLoader, Class<?>
componentInterface) {
if (timeout <= 0) {
@@ -220,7 +219,9 @@ public class DiscoveryComponentProxyFactory {
try {
return future.get(this.timeout, TimeUnit.MILLISECONDS);
} catch (InterruptedException e) {
- log.error("Thread [" + Thread.currentThread().getName() +
"] was interrupted.");
+ if (log.isDebugEnabled()) {
+ log.debug("Thread [" + Thread.currentThread().getName() +
"] was interrupted.");
+ }
future.cancel(true); // this is a daemon thread, let's try to cancel
it
throw new RuntimeException(invokedMethodString(method, args, "was
interrupted."), e);
} catch (ExecutionException e) {
@@ -236,7 +237,7 @@ public class DiscoveryComponentProxyFactory {
if (thread != null) {
StackTraceElement[] stackTrace = thread.getStackTrace();
cause = new Exception(thread + " with id [" +
thread.getId()
- + "] is hung. This exception contains its stack
trace.");
+ + "] is hung. This exception contains its stack
trace.");
cause.setStackTrace(stackTrace);
} else {
cause = null;
commit 160d916ef9a258f5ef47d5bb0213541cbd2045d4
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Wed Feb 27 14:46:57 2013 +0100
Modified Eclipse classpath file for javassist sources
diff --git a/.classpath b/.classpath
index 632aa9a..f6ced85 100644
--- a/.classpath
+++ b/.classpath
@@ -75,8 +75,8 @@
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-email/src/main/java"/>
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-operations/src/main/java"/>
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-cli/src/main/java"/>
- <classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-snmp/src/main/java"/>
- <classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-snmp/src/main/resources"/>
+ <classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-snmp/src/main/java"/>
+ <classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-snmp/src/main/resources"/>
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-irc/src/main/java"/>
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-microblog/src/main/java"/>
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-mobicents/src/main/java"/>
@@ -260,7 +260,7 @@
<classpathentry exported="true" kind="var"
path="M2_REPO/net/java/dev/jna/jna/3.2.5/jna-3.2.5.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/org/freemarker/freemarker/2.3.11/freemarker-2.3.11.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/jline/jline/0.9.94/jline-0.9.94.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA.jar"
sourcepath="/M2_REPO/javassist/javassist/3.12.1.GA/javassist-3.12.1.GA-sources.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/net/sf/opencsv/opencsv/1.8/opencsv-1.8.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/commons-digester/commons-digester/1.8.1/commons-digester-1.8.1.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/commons-codec/commons-codec/1.4/commons-codec-1.4.jar"/>
commit 5f74ac330228be62050d1b387ea2cf9a47639c36
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 27 14:40:52 2013 +0100
[BZ 726673] - be more robust against different types of bean properties.
Rhino doesn't handle indexed properties automagically as it does normal
basic javabean properties, so we should offer no code completion on such
advanced property types.
diff --git
a/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
b/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
index f33e029..0d5e25d 100644
---
a/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
+++
b/modules/enterprise/scripting/javascript/src/main/java/org/rhq/scripting/javascript/JavascriptCompletor.java
@@ -191,9 +191,20 @@ public class JavascriptCompletor implements CodeCompletion {
Object rootObject = nextList.get(0);
if (rootObject instanceof PropertyDescriptor && !(baseObject
instanceof Class)) {
try {
- rootObject = invoke(baseObject, ((PropertyDescriptor)
rootObject).getReadMethod());
+ Method readMethod = ((PropertyDescriptor)
rootObject).getReadMethod();
+ //the read method might be null for for example indexed bean
properties.
+ //Rhino doesn't interpret any more complex bean properties.
+ if (readMethod != null) {
+ rootObject = invoke(baseObject, readMethod);
+ } else {
+ return -1;
+ }
} catch (Exception e) {
- e.printStackTrace();
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Exception while reading a java bean
property.", e);
+ }
+
+ return -1;
}
} else if (rootObject instanceof Method) {
rootObject = ((Method) rootObject).getReturnType();
commit 244a9489ab126f59fc7559f6547a7949b3c0b2dd
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Wed Feb 27 13:58:43 2013 +0100
Netservices plugin: make itest http port configurable (useful for Jenkins multijob
context)
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 184f1db..4a661a0 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -16,6 +16,10 @@
<name>RHQ Network Services Plugin</name>
<description>A plugin for monitoring network services.</description>
+ <properties>
+
<netservices.itest.http.server.port>31158</netservices.itest.http.server.port>
+ </properties>
+
<dependencies>
<dependency>
@@ -111,6 +115,9 @@
</properties>
<useSystemClassLoader>false</useSystemClassLoader>
<argLine>${jacoco.integration-test.args}</argLine>
+ <systemPropertyVariables>
+
<netservices.itest.http.server.port>${netservices.itest.http.server.port}</netservices.itest.http.server.port>
+ </systemPropertyVariables>
</configuration>
<executions>
<execution>
@@ -167,11 +174,9 @@
<build>
<plugins>
-
<plugin>
<artifactId>maven-antrun-plugin</artifactId>
<executions>
-
<execution>
<id>deploy</id>
<phase>compile</phase>
@@ -187,7 +192,6 @@
<goal>run</goal>
</goals>
</execution>
-
<execution>
<id>deploy-jar-meta-inf</id>
<phase>package</phase>
@@ -209,7 +213,6 @@
<goal>run</goal>
</goals>
</execution>
-
<execution>
<id>undeploy</id>
<phase>clean</phase>
@@ -224,13 +227,13 @@
<goal>run</goal>
</goals>
</execution>
-
</executions>
</plugin>
-
</plugins>
</build>
+
</profile>
+
</profiles>
</project>
diff --git
a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
index 24b6644..fc02516 100644
---
a/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
+++
b/modules/plugins/netservices/src/test/java/org/rhq/plugins/netservices/itest/HTTPNetServiceComponentTest.java
@@ -53,6 +53,7 @@ import org.rhq.core.domain.measurement.MeasurementData;
import org.rhq.core.domain.measurement.MeasurementReport;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.core.util.StringUtil;
import org.rhq.plugins.netservices.HTTPNetServiceComponent;
import org.rhq.plugins.netservices.HTTPNetServiceComponent.ConfigKeys;
import org.rhq.plugins.netservices.HTTPNetServiceComponent.HttpMethod;
@@ -70,8 +71,12 @@ public class HTTPNetServiceComponentTest extends
NetServiceComponentTest {
private static final int HTTP_PORT = 31158;
+ private static final String HTTP_PORT_VARIABLE =
"netservices.itest.http.server.port";
+
private static final int SERVLET_SLEEP = 1000;
+ private int httpPort;
+
private Server jettyServer;
private HTTPNetServiceComponent httpNetServiceComponent;
@@ -79,7 +84,8 @@ public class HTTPNetServiceComponentTest extends NetServiceComponentTest
{
@BeforeClass
public void startJetty() throws Exception {
LOG.info("Setting up Jetty test server");
- jettyServer = new Server(new InetSocketAddress(HTTP_HOST, HTTP_PORT));
+ httpPort = getJettyPort();
+ jettyServer = new Server(new InetSocketAddress(HTTP_HOST, httpPort));
ServletContextHandler context = new
ServletContextHandler(ServletContextHandler.SESSIONS);
context.setContextPath("/");
jettyServer.setHandler(context);
@@ -101,6 +107,21 @@ public class HTTPNetServiceComponentTest extends
NetServiceComponentTest {
jettyServer.start();
}
+ private static int getJettyPort() {
+ String httpPortVariable = System.getProperty(HTTP_PORT_VARIABLE);
+ if (StringUtil.isNotBlank(httpPortVariable)) {
+ try {
+ int port = Integer.parseInt(httpPortVariable);
+ LOG.info("Using port " + httpPortVariable + " for http
server");
+ return port;
+ } catch (NumberFormatException e) {
+ LOG.warn("Invalid port variable: " + httpPortVariable);
+ }
+ }
+ LOG.info("Using default port " + String.valueOf(HTTP_PORT) + " for
http server");
+ return HTTP_PORT;
+ }
+
@AfterClass
public void stopJetty() {
LOG.info("Shutting down Jetty test server");
@@ -115,7 +136,7 @@ public class HTTPNetServiceComponentTest extends
NetServiceComponentTest {
@Test(dependsOnMethods = "testPluginLoad")
public void testManualAdd() throws Exception {
Configuration configuration = new Configuration();
- configuration.setSimpleValue(ConfigKeys.URL, "http://" + HTTP_HOST +
":" + HTTP_PORT + "/pipo/molo");
+ configuration.setSimpleValue(ConfigKeys.URL, "http://" + HTTP_HOST +
":" + httpPort + "/pipo/molo");
configuration.setSimpleValue(ConfigKeys.METHOD, HttpMethod.GET.name());
configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_CODE,
"true");
configuration.setSimpleValue(ConfigKeys.VALIDATE_RESPONSE_PATTERN,
"success");
commit 160c2ddbb281694e07e83ce556b97e0e611e1c5f
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Wed Feb 27 10:39:00 2013 +0100
Eclipse classpath file settings for SNMP alerts
diff --git a/.classpath b/.classpath
index dd5d354..632aa9a 100644
--- a/.classpath
+++ b/.classpath
@@ -75,7 +75,8 @@
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-email/src/main/java"/>
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-operations/src/main/java"/>
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-cli/src/main/java"/>
- <classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-snmp/src/main/java"/>
+ <classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-snmp/src/main/java"/>
+ <classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-snmp/src/main/resources"/>
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-irc/src/main/java"/>
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-microblog/src/main/java"/>
<classpathentry kind="src"
path="modules/enterprise/server/plugins/alert-mobicents/src/main/java"/>
@@ -213,7 +214,7 @@
<classpathentry exported="true" kind="var"
path="M2_REPO/javax/servlet/jsp-api/2.0/jsp-api-2.0.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/commons-validator/commons-validator/1.1.4/commons-validator-1.1.4.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/org/testng/testng/6.5.2/testng-6.5.2.jar"
sourcepath="/M2_REPO/org/testng/testng/6.5.2/testng-6.5.2-sources.jar"/>
- <classpathentry exported="true" kind="var"
path="M2_REPO/org/snmp4j/snmp4j/1.8.2/snmp4j-1.8.2.jar"/>
+ <classpathentry exported="true" kind="var"
path="M2_REPO/org/snmp4j/snmp4j/1.8.2/snmp4j-1.8.2.jar"
sourcepath="M2_REPO/org/snmp4j/snmp4j/1.8.2/snmp4j-1.8.2-sources.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/log4j/log4j/1.2.14/log4j-1.2.14.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/tomcat/tomcat-jk/4.1.31/tomcat-jk-4.1.31.jar"/>
<classpathentry exported="true" kind="var"
path="M2_REPO/jdom/jdom/1.0/jdom-1.0.jar"/>
commit 3c46c9036d8bff55df035bade9a81365d582d09e
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 26 13:47:33 2013 -0500
Adding in justification for api changes. This should fix api check once 4.6.0 is
published.
diff --git a/modules/core/domain/intentional-api-changes-since-4.6.0.xml
b/modules/core/domain/intentional-api-changes-since-4.6.0.xml
new file mode 100644
index 0000000..7554092
--- /dev/null
+++ b/modules/core/domain/intentional-api-changes-since-4.6.0.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0"?>
+<differences>
+ <difference>
+ <className>org/rhq/core/domain/criteria/BaseCriteria</className>
+ <differenceType>7012</differenceType><!-- method added -->
+ <method>void
addSortId(org.rhq.core.domain.util.PageOrdering)</method>
+ <justification>
+ We are adding a default addSortId operation to all criteria to support paging
through
+ large result sets.
+ </justification>
+ </difference>
+ <difference>
+ <className>org/rhq/core/domain/criteria/BaseCriteria</className>
+ <differenceType>7012</differenceType><!-- method added -->
+ <method>java.util.List getOrderingFieldNames()</method>
+ <justification>
+ We are adding an operation to return FieldOrdering to support paging through
+ large result sets.
+ </justification>
+ </difference>
+</differences>
commit 9957e3f699a021b08093e3fd6a96421577be9725
Merge: a9352d7 c367f45
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 26 10:04:15 2013 -0500
Merge branch 'track_master' into spinder/criteriaUsage
commit c367f45a05cd488d4822d51f4c6368f5924c8223
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Feb 21 11:34:05 2013 +0100
BZ911327 - [EAP 6.1] Restarting servers in server-group fails
While the bug was detected because of the underlying EAP operation failing, it appears
that the RHQ timeout for this operation is pretty low. The operation timeout is now
configurable and should be adjusted by users for their particular environment. It defaults
to 2 minutes.
diff --git
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
index 71967e5..eb97042 100644
---
a/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
+++
b/modules/plugins/jboss-as-7/src/main/java/org/rhq/modules/plugins/jbossas7/ServerGroupComponent.java
@@ -55,29 +55,30 @@ import org.rhq.modules.plugins.jbossas7.json.Result;
* Component dealing with server group specific things
* @author Heiko W. Rupp
*/
-@SuppressWarnings("unused")
public class ServerGroupComponent extends BaseComponent implements ContentFacet,
CreateChildResourceFacet,
OperationFacet {
- private static final String SUCCESS = "success";
private static final String OUTCOME = "outcome";
+ private static final String RESTART_SERVERS = "restart-servers";
@Override
public OperationResult invokeOperation(String name, Configuration parameters) throws
InterruptedException,
Exception {
-
Operation op = new Operation(name, getAddress());
- Result res = getASConnection().execute(op);
-
+ Result res = null;
+ if (RESTART_SERVERS.equals(name)) {
+ // This operation as a timeout parameter as it can run for quite a long time
+ res = getASConnection().execute(op,
parameters.getSimple("responseTimeout").getIntegerValue());
+ } else {
+ res = getASConnection().execute(op);
+ }
OperationResult result = new OperationResult();
-
if (res.isSuccess()) {
- result.setSimpleResult(SUCCESS);
+ result.setSimpleResult(Result.SUCCESS);
} else {
result.setErrorMessage(res.getFailureDescription());
}
return result;
-
}
@Override
@@ -119,7 +120,7 @@ public class ServerGroupComponent extends BaseComponent implements
ContentFacet,
if (uploadResult.has(OUTCOME)) {
String outcome = uploadResult.get(OUTCOME).getTextValue();
- if (outcome.equals(SUCCESS)) { // Upload was successful, so now add the
file to the server group
+ if (outcome.equals(Result.SUCCESS)) { // Upload was successful, so now
add the file to the server group
JsonNode resultNode = uploadResult.get("result");
String hash =
resultNode.get("BYTES_VALUE").getTextValue();
ASConnection connection = getASConnection();
@@ -202,6 +203,7 @@ public class ServerGroupComponent extends BaseComponent implements
ContentFacet,
return null; // TODO: Customise this generated block
}
+ @SuppressWarnings("unused")
private String serverGroupFromKey() {
String key1 = context.getResourceKey();
return key1.substring(key1.lastIndexOf("/") + 1);
diff --git a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
index 2509073..cf01d5f 100644
--- a/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
+++ b/modules/plugins/jboss-as-7/src/main/resources/META-INF/rhq-plugin.xml
@@ -1016,7 +1016,10 @@
<c:simple-property name="operationResult"/>
</results>
</operation>
- <operation name="restart-servers" description="Restarts all
servers belonging to the server group currently running in the domain.">
+ <operation name="restart-servers" description="Restarts all
servers belonging to the server group currently running in the domain."
timeout="180">
+ <parameters>
+ <c:simple-property name="responseTimeout"
default="120" type="long" description="Amount of time the agent
will be waiting for domain host response. Defaults to 120 seconds." />
+ </parameters>
<results>
<c:simple-property name="operationResult"/>
</results>
commit 068f664483a2013fa84123cb6b6ba85b54ee7c5c
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Mon Feb 25 16:36:41 2013 -0500
[Bug 881848 - Resource availability type remains in state unknown after application of
workaround from bug 865166]
Ensure after upgrade that all resources, including those in the ADQ, have
at least an intial UNKNOWN Availability.
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index d4bc14c..109eb3a 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -17,7 +17,7 @@
<description>Database schema setup, upgrade and other
utilities</description>
<properties>
- <db.schema.version>2.128</db.schema.version>
+ <db.schema.version>2.129</db.schema.version>
<rhq.ds.type-mapping>${rhq.test.ds.type-mapping}</rhq.ds.type-mapping>
<rhq.ds.server-name>${rhq.test.ds.server-name}</rhq.ds.server-name>
<rhq.ds.db-name>${rhq.test.ds.db-name}</rhq.ds.db-name>
diff --git a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
index 19ac9dd..936c7bf 100644
--- a/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
+++ b/modules/core/dbutils/src/main/scripts/dbupgrade/db-upgrade.xml
@@ -1944,6 +1944,7 @@
</schemaSpec>
<schemaSpec version="2.125">
+ <!-- Note, JON 3.1.2 includes this already but it is safe to re-execute
-->
<!-- We were using a buggy version of password obfuscation from JBoss
AS. This task sets the affected
passwords to NULL. Fortunately, this currently affects only CSP
content sources, so the damage
is not huge from the user perspective. -->
@@ -1952,6 +1953,7 @@
<!-- BZ 865167 -->
<schemaSpec version="2.126">
+ <!-- Note, JON 3.1.2 includes this already but it is safe to
re-execute -->
<schema-directSQL>
<statement targetDBVendor="postgresql">
INSERT INTO RHQ_RESOURCE_AVAIL ( ID, RESOURCE_ID,
AVAILABILITY_TYPE )
@@ -1988,6 +1990,27 @@
</schema-directSQL>
</schemaSpec>
+<!-- RHQ 4.6.0 uses DB Schema 2.128 -->
+
+ <!-- BZ 881848 -->
+ <schemaSpec version="2.129">
+ <schema-directSQL>
+ <statement targetDBVendor="postgresql">
+ INSERT INTO RHQ_AVAILABILITY ( ID, RESOURCE_ID, START_TIME,
END_TIME, AVAILABILITY_TYPE )
+ SELECT nextval('RHQ_AVAILABILITY_ID_SEQ'::text),
res.ID, 0, NULL, 2
+ FROM RHQ_RESOURCE res
+ WHERE NOT EXISTS ( SELECT * FROM RHQ_AVAILABILITY WHERE
RESOURCE_ID = res.ID )
+ </statement>
+ <statement targetDBVendor="oracle">
+ INSERT INTO RHQ_AVAILABILITY ( ID, RESOURCE_ID, START_TIME,
END_TIME, AVAILABILITY_TYPE )
+ SELECT RHQ_AVAILABILITY_ID_SEQ.nextval, res.ID, 0, NULL, 2
+ FROM RHQ_RESOURCE res
+ WHERE NOT EXISTS ( SELECT * FROM RHQ_AVAILABILITY WHERE
RESOURCE_ID = res.ID )
+ </statement>
+ </schema-directSQL>
+ </schemaSpec>
+
+
</dbupgrade>
</target>
</project>
commit c6ddc8538eb130703a276752b05e85b9da5faabc
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Mon Feb 25 17:31:02 2013 -0600
Update development version to 4.7.0-SNAPSHOT.
diff --git a/code-coverage/pom.xml b/code-coverage/pom.xml
index 7bce055..cacf523 100644
--- a/code-coverage/pom.xml
+++ b/code-coverage/pom.xml
@@ -3,7 +3,7 @@
<parent>
<artifactId>rhq-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-code-coverage</artifactId>
diff --git a/modules/cli-tests/pom.xml b/modules/cli-tests/pom.xml
index ecd5c00..394dc13 100644
--- a/modules/cli-tests/pom.xml
+++ b/modules/cli-tests/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/common/ant-bundle/pom.xml b/modules/common/ant-bundle/pom.xml
index f69c49e..111b6f0 100644
--- a/modules/common/ant-bundle/pom.xml
+++ b/modules/common/ant-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/common/drift/pom.xml b/modules/common/drift/pom.xml
index 2b0a46a..190bc89 100644
--- a/modules/common/drift/pom.xml
+++ b/modules/common/drift/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-common-drift</artifactId>
diff --git a/modules/common/filetemplate-bundle/pom.xml
b/modules/common/filetemplate-bundle/pom.xml
index 7dc4571..32692b5 100644
--- a/modules/common/filetemplate-bundle/pom.xml
+++ b/modules/common/filetemplate-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-filetemplate-bundle-common</artifactId>
diff --git a/modules/common/jboss-as-dmr-client/pom.xml
b/modules/common/jboss-as-dmr-client/pom.xml
index 260bd92..4f43692 100644
--- a/modules/common/jboss-as-dmr-client/pom.xml
+++ b/modules/common/jboss-as-dmr-client/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-jboss-as-dmr-client</artifactId>
diff --git a/modules/common/jboss-as/pom.xml b/modules/common/jboss-as/pom.xml
index c8f844c..17e5433 100644
--- a/modules/common/jboss-as/pom.xml
+++ b/modules/common/jboss-as/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-common-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-jboss-as-common</artifactId>
diff --git a/modules/common/pom.xml b/modules/common/pom.xml
index 960909d..4ed6d92 100644
--- a/modules/common/pom.xml
+++ b/modules/common/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/core/arquillian-integration/archive/pom.xml
b/modules/core/arquillian-integration/archive/pom.xml
index 2e9dc48..7c7e949 100644
--- a/modules/core/arquillian-integration/archive/pom.xml
+++ b/modules/core/arquillian-integration/archive/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-arquillian-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<!-- Model Version -->
diff --git a/modules/core/arquillian-integration/container/pom.xml
b/modules/core/arquillian-integration/container/pom.xml
index 65043aa..50e0fed 100644
--- a/modules/core/arquillian-integration/container/pom.xml
+++ b/modules/core/arquillian-integration/container/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-arquillian-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<!-- Model Version -->
diff --git a/modules/core/arquillian-integration/pom.xml
b/modules/core/arquillian-integration/pom.xml
index cbdc2a9..fb6f3ee 100644
--- a/modules/core/arquillian-integration/pom.xml
+++ b/modules/core/arquillian-integration/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/arquillian-integration/suite-extension/pom.xml
b/modules/core/arquillian-integration/suite-extension/pom.xml
index 3ccb886..5d80c3f 100644
--- a/modules/core/arquillian-integration/suite-extension/pom.xml
+++ b/modules/core/arquillian-integration/suite-extension/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-arquillian-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<!-- Model Version -->
diff --git a/modules/core/client-api/pom.xml b/modules/core/client-api/pom.xml
index ee8f1dc..a4f4b9e 100644
--- a/modules/core/client-api/pom.xml
+++ b/modules/core/client-api/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/comm-api/pom.xml b/modules/core/comm-api/pom.xml
index bf4b745..9fd9f98 100644
--- a/modules/core/comm-api/pom.xml
+++ b/modules/core/comm-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/dbutils/pom.xml b/modules/core/dbutils/pom.xml
index aa9a2ce..d4bc14c 100644
--- a/modules/core/dbutils/pom.xml
+++ b/modules/core/dbutils/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/domain/pom.xml b/modules/core/domain/pom.xml
index 21af6e4..9775aa6 100644
--- a/modules/core/domain/pom.xml
+++ b/modules/core/domain/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-domain</artifactId>
diff --git a/modules/core/gui/pom.xml b/modules/core/gui/pom.xml
index d17353c..9f1b724 100644
--- a/modules/core/gui/pom.xml
+++ b/modules/core/gui/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/native-system/pom.xml b/modules/core/native-system/pom.xml
index 08e5675..21f1c48 100644
--- a/modules/core/native-system/pom.xml
+++ b/modules/core/native-system/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/core/plugin-api/pom.xml b/modules/core/plugin-api/pom.xml
index fd717f7..4b828f7 100644
--- a/modules/core/plugin-api/pom.xml
+++ b/modules/core/plugin-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/plugin-container-itest/pom.xml
b/modules/core/plugin-container-itest/pom.xml
index f439dab..900eb72 100644
--- a/modules/core/plugin-container-itest/pom.xml
+++ b/modules/core/plugin-container-itest/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-plugin-container-itest</artifactId>
diff --git a/modules/core/plugin-container/pom.xml
b/modules/core/plugin-container/pom.xml
index f7451c5..8bff199 100644
--- a/modules/core/plugin-container/pom.xml
+++ b/modules/core/plugin-container/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-plugin-container</artifactId>
diff --git a/modules/core/plugin-test-api/pom.xml b/modules/core/plugin-test-api/pom.xml
index 5d80afc..f7abec9 100644
--- a/modules/core/plugin-test-api/pom.xml
+++ b/modules/core/plugin-test-api/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-plugin-test-api</artifactId>
diff --git a/modules/core/plugin-test-util/pom.xml
b/modules/core/plugin-test-util/pom.xml
index 40d29ec..dbb97fe 100644
--- a/modules/core/plugin-test-util/pom.xml
+++ b/modules/core/plugin-test-util/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/plugin-validator/pom.xml
b/modules/core/plugin-validator/pom.xml
index aff829f..fc8ff80 100644
--- a/modules/core/plugin-validator/pom.xml
+++ b/modules/core/plugin-validator/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/plugindoc/pom.xml b/modules/core/plugindoc/pom.xml
index e8a53b5..4528810 100644
--- a/modules/core/plugindoc/pom.xml
+++ b/modules/core/plugindoc/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/core/pom.xml b/modules/core/pom.xml
index d0eff4c..c51fb51 100644
--- a/modules/core/pom.xml
+++ b/modules/core/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/core/util/pom.xml b/modules/core/util/pom.xml
index ef4b285..ff2a247 100644
--- a/modules/core/util/pom.xml
+++ b/modules/core/util/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-core-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-core-util</artifactId>
diff --git a/modules/enterprise/agent/pom.xml b/modules/enterprise/agent/pom.xml
index f8c7720..99f9b40 100644
--- a/modules/enterprise/agent/pom.xml
+++ b/modules/enterprise/agent/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/agentupdate/pom.xml
b/modules/enterprise/agentupdate/pom.xml
index b26d8e3..ba0d852 100644
--- a/modules/enterprise/agentupdate/pom.xml
+++ b/modules/enterprise/agentupdate/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/binding/pom.xml b/modules/enterprise/binding/pom.xml
index 709a213..1ddf893 100644
--- a/modules/enterprise/binding/pom.xml
+++ b/modules/enterprise/binding/pom.xml
@@ -3,10 +3,10 @@
<parent>
<artifactId>rhq-enterprise-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-script-bindings</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Script Bindings</name>
<description>Abstraction of different facilities and default configurations for
script bindings</description>
diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml
index 48fad0c..cf5b95f 100644
--- a/modules/enterprise/comm/pom.xml
+++ b/modules/enterprise/comm/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/content_http-war/pom.xml
b/modules/enterprise/gui/content_http-war/pom.xml
index 104b50d..61abd3a 100644
--- a/modules/enterprise/gui/content_http-war/pom.xml
+++ b/modules/enterprise/gui/content_http-war/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-gui-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/gui/coregui/pom.xml
b/modules/enterprise/gui/coregui/pom.xml
index 0f58d9b..f60ae8b 100644
--- a/modules/enterprise/gui/coregui/pom.xml
+++ b/modules/enterprise/gui/coregui/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/pom.xml b/modules/enterprise/gui/pom.xml
index f864813..b71b130 100644
--- a/modules/enterprise/gui/pom.xml
+++ b/modules/enterprise/gui/pom.xml
@@ -8,7 +8,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/portal-war/pom.xml
b/modules/enterprise/gui/portal-war/pom.xml
index d032b6d..9795f49 100644
--- a/modules/enterprise/gui/portal-war/pom.xml
+++ b/modules/enterprise/gui/portal-war/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/rest-examples-war/pom.xml
b/modules/enterprise/gui/rest-examples-war/pom.xml
index 1eb1ad2..87354d1 100644
--- a/modules/enterprise/gui/rest-examples-war/pom.xml
+++ b/modules/enterprise/gui/rest-examples-war/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/gui/rest-war/pom.xml
b/modules/enterprise/gui/rest-war/pom.xml
index 9e1ac5a..1b5349c 100644
--- a/modules/enterprise/gui/rest-war/pom.xml
+++ b/modules/enterprise/gui/rest-war/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/pom.xml b/modules/enterprise/pom.xml
index 7fe3331..489d603 100644
--- a/modules/enterprise/pom.xml
+++ b/modules/enterprise/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/cli/pom.xml
b/modules/enterprise/remoting/cli/pom.xml
index e6daa0f..ee672e2 100644
--- a/modules/enterprise/remoting/cli/pom.xml
+++ b/modules/enterprise/remoting/cli/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/client-api/pom.xml
b/modules/enterprise/remoting/client-api/pom.xml
index c2addd5..8f0978c 100644
--- a/modules/enterprise/remoting/client-api/pom.xml
+++ b/modules/enterprise/remoting/client-api/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/client-deps/pom.xml
b/modules/enterprise/remoting/client-deps/pom.xml
index 0c81641..006a9a6 100644
--- a/modules/enterprise/remoting/client-deps/pom.xml
+++ b/modules/enterprise/remoting/client-deps/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/remoting/pom.xml b/modules/enterprise/remoting/pom.xml
index 3e76a1c..3ab9e66 100644
--- a/modules/enterprise/remoting/pom.xml
+++ b/modules/enterprise/remoting/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/scripting/api/pom.xml
b/modules/enterprise/scripting/api/pom.xml
index 2a705b3..5fdffe3 100644
--- a/modules/enterprise/scripting/api/pom.xml
+++ b/modules/enterprise/scripting/api/pom.xml
@@ -3,10 +3,10 @@
<parent>
<artifactId>rhq-scripting-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-api</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Scripting API</name>
<description>Provides API for adding scripting support to RHQ using different
javax.scripting - based interpreters</description>
diff --git a/modules/enterprise/scripting/javascript/pom.xml
b/modules/enterprise/scripting/javascript/pom.xml
index c2363a5..208076a 100644
--- a/modules/enterprise/scripting/javascript/pom.xml
+++ b/modules/enterprise/scripting/javascript/pom.xml
@@ -4,10 +4,10 @@
<parent>
<artifactId>rhq-scripting-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-javascript</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Javascript support</name>
<description>Provides RHQ scripting in Javascript using
Rhino</description>
diff --git a/modules/enterprise/scripting/pom.xml b/modules/enterprise/scripting/pom.xml
index d6faff8..5c82958 100644
--- a/modules/enterprise/scripting/pom.xml
+++ b/modules/enterprise/scripting/pom.xml
@@ -3,12 +3,12 @@
<parent>
<artifactId>rhq-enterprise-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-parent</artifactId>
<packaging>pom</packaging>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Scripting Parent Module</name>
<modules>
diff --git a/modules/enterprise/scripting/python/pom.xml
b/modules/enterprise/scripting/python/pom.xml
index 34e5231..ab12edf 100644
--- a/modules/enterprise/scripting/python/pom.xml
+++ b/modules/enterprise/scripting/python/pom.xml
@@ -3,10 +3,10 @@
<parent>
<artifactId>rhq-scripting-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>rhq-scripting-python</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Python support</name>
<description>Provides RHQ scripting in Python using Jython</description>
diff --git a/modules/enterprise/server/appserver/pom.xml
b/modules/enterprise/server/appserver/pom.xml
index d8c7d6f..2ffdc7c 100644
--- a/modules/enterprise/server/appserver/pom.xml
+++ b/modules/enterprise/server/appserver/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/client-api/pom.xml
b/modules/enterprise/server/client-api/pom.xml
index 87a99b7..ac92aec 100644
--- a/modules/enterprise/server/client-api/pom.xml
+++ b/modules/enterprise/server/client-api/pom.xml
@@ -5,13 +5,13 @@
<parent>
<artifactId>rhq-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-server-client-api</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Client API</name>
<description>The implementation of the client API when accessing the server
locally</description>
diff --git a/modules/enterprise/server/ear/pom.xml
b/modules/enterprise/server/ear/pom.xml
index 09b0def..d6a38d8 100644
--- a/modules/enterprise/server/ear/pom.xml
+++ b/modules/enterprise/server/ear/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/installer/pom.xml
b/modules/enterprise/server/installer/pom.xml
index a1b2dab..83b8977 100644
--- a/modules/enterprise/server/installer/pom.xml
+++ b/modules/enterprise/server/installer/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/itests-2/pom.xml
b/modules/enterprise/server/itests-2/pom.xml
index 49d79f5..cf6aa8d 100644
--- a/modules/enterprise/server/itests-2/pom.xml
+++ b/modules/enterprise/server/itests-2/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/jar/pom.xml
b/modules/enterprise/server/jar/pom.xml
index 2eb3668..d59460f 100644
--- a/modules/enterprise/server/jar/pom.xml
+++ b/modules/enterprise/server/jar/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/plugins/alert-cli/pom.xml
b/modules/enterprise/server/plugins/alert-cli/pom.xml
index 6a9c1fd..68ea87a 100644
--- a/modules/enterprise/server/plugins/alert-cli/pom.xml
+++ b/modules/enterprise/server/plugins/alert-cli/pom.xml
@@ -3,11 +3,11 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
<artifactId>alert-cli</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server CLI Script Alert Plugin</name>
<description>An alert sender able to execute an arbitrary CLI script as a
response to an alert</description>
diff --git a/modules/enterprise/server/plugins/alert-email/pom.xml
b/modules/enterprise/server/plugins/alert-email/pom.xml
index cfd0d9b..ec91baf 100644
--- a/modules/enterprise/server/plugins/alert-email/pom.xml
+++ b/modules/enterprise/server/plugins/alert-email/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq.server</groupId>
<artifactId>alert-email</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Email Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-irc/pom.xml
b/modules/enterprise/server/plugins/alert-irc/pom.xml
index 67fa7a2..ea7bd90 100644
--- a/modules/enterprise/server/plugins/alert-irc/pom.xml
+++ b/modules/enterprise/server/plugins/alert-irc/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-irc</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server IRC Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-log4j/pom.xml
b/modules/enterprise/server/plugins/alert-log4j/pom.xml
index 358861c..c50b5cb 100644
--- a/modules/enterprise/server/plugins/alert-log4j/pom.xml
+++ b/modules/enterprise/server/plugins/alert-log4j/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-log4j</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Log4J Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-microblog/pom.xml
b/modules/enterprise/server/plugins/alert-microblog/pom.xml
index eecd72a..c576b41 100644
--- a/modules/enterprise/server/plugins/alert-microblog/pom.xml
+++ b/modules/enterprise/server/plugins/alert-microblog/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-microblog</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Microblog Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-mobicents/pom.xml
b/modules/enterprise/server/plugins/alert-mobicents/pom.xml
index 975858f..5d9fb43 100644
--- a/modules/enterprise/server/plugins/alert-mobicents/pom.xml
+++ b/modules/enterprise/server/plugins/alert-mobicents/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-mobicents</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Mobicents Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-operations/pom.xml
b/modules/enterprise/server/plugins/alert-operations/pom.xml
index 90df568..3b08f01 100644
--- a/modules/enterprise/server/plugins/alert-operations/pom.xml
+++ b/modules/enterprise/server/plugins/alert-operations/pom.xml
@@ -2,14 +2,14 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-operations</artifactId>
<packaging>jar</packaging>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Opertions Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-roles/pom.xml
b/modules/enterprise/server/plugins/alert-roles/pom.xml
index 7ba6e6f..4f8c6a5 100644
--- a/modules/enterprise/server/plugins/alert-roles/pom.xml
+++ b/modules/enterprise/server/plugins/alert-roles/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-roles</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Roles Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-snmp/pom.xml
b/modules/enterprise/server/plugins/alert-snmp/pom.xml
index dfb59aa..909053a 100644
--- a/modules/enterprise/server/plugins/alert-snmp/pom.xml
+++ b/modules/enterprise/server/plugins/alert-snmp/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-snmp</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server SNMP Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/alert-subject/pom.xml
b/modules/enterprise/server/plugins/alert-subject/pom.xml
index de85cf5..cd0263b 100644
--- a/modules/enterprise/server/plugins/alert-subject/pom.xml
+++ b/modules/enterprise/server/plugins/alert-subject/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>alert-subject</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Subject Alert Plugin</name>
diff --git a/modules/enterprise/server/plugins/ant-bundle/pom.xml
b/modules/enterprise/server/plugins/ant-bundle/pom.xml
index 6a1b367..6f636d5 100644
--- a/modules/enterprise/server/plugins/ant-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/ant-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/cobbler/pom.xml
b/modules/enterprise/server/plugins/cobbler/pom.xml
index 5b41896..2c81751 100644
--- a/modules/enterprise/server/plugins/cobbler/pom.xml
+++ b/modules/enterprise/server/plugins/cobbler/pom.xml
@@ -4,14 +4,14 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>rhq-serverplugin-cobbler</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server Cobbler Plugin</name>
diff --git a/modules/enterprise/server/plugins/disk/pom.xml
b/modules/enterprise/server/plugins/disk/pom.xml
index 570caa3..5ecb7a9 100644
--- a/modules/enterprise/server/plugins/disk/pom.xml
+++ b/modules/enterprise/server/plugins/disk/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/drift-rhq/pom.xml
b/modules/enterprise/server/plugins/drift-rhq/pom.xml
index 0afed7e..52b3a7c 100644
--- a/modules/enterprise/server/plugins/drift-rhq/pom.xml
+++ b/modules/enterprise/server/plugins/drift-rhq/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
index 7d0ba17..b43da47 100644
--- a/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
+++ b/modules/enterprise/server/plugins/filetemplate-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/jboss-software/pom.xml
b/modules/enterprise/server/plugins/jboss-software/pom.xml
index 55b2aea..3d31342 100644
--- a/modules/enterprise/server/plugins/jboss-software/pom.xml
+++ b/modules/enterprise/server/plugins/jboss-software/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/packagetype-cli/pom.xml
b/modules/enterprise/server/plugins/packagetype-cli/pom.xml
index 38bb3f4..80799ab 100644
--- a/modules/enterprise/server/plugins/packagetype-cli/pom.xml
+++ b/modules/enterprise/server/plugins/packagetype-cli/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq</groupId>
<artifactId>packagetype-cli</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>RHQ Enterprise Server CLI Package Type Plugin</name>
diff --git a/modules/enterprise/server/plugins/pom.xml
b/modules/enterprise/server/plugins/pom.xml
index 77f4d79..827bc41 100644
--- a/modules/enterprise/server/plugins/pom.xml
+++ b/modules/enterprise/server/plugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/plugins/url/pom.xml
b/modules/enterprise/server/plugins/url/pom.xml
index e4f17ed..f677d6a 100644
--- a/modules/enterprise/server/plugins/url/pom.xml
+++ b/modules/enterprise/server/plugins/url/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
index bd8c3b1..0d80df3 100644
--- a/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
+++ b/modules/enterprise/server/plugins/validate-all-serverplugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/plugins/yum/pom.xml
b/modules/enterprise/server/plugins/yum/pom.xml
index 75c478c..75b3cdc 100644
--- a/modules/enterprise/server/plugins/yum/pom.xml
+++ b/modules/enterprise/server/plugins/yum/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/pom.xml b/modules/enterprise/server/pom.xml
index d64e981..494e98e 100644
--- a/modules/enterprise/server/pom.xml
+++ b/modules/enterprise/server/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/safe-invoker/pom.xml
b/modules/enterprise/server/safe-invoker/pom.xml
index d216e87..8c509f4 100644
--- a/modules/enterprise/server/safe-invoker/pom.xml
+++ b/modules/enterprise/server/safe-invoker/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/sars/pom.xml
b/modules/enterprise/server/sars/pom.xml
index 2fad1d7..2b00e67 100644
--- a/modules/enterprise/server/sars/pom.xml
+++ b/modules/enterprise/server/sars/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/sars/services-sar/pom.xml
b/modules/enterprise/server/sars/services-sar/pom.xml
index 40044b2..413c681 100644
--- a/modules/enterprise/server/sars/services-sar/pom.xml
+++ b/modules/enterprise/server/sars/services-sar/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-enterprise-server-sars-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/enterprise/server/startup-subsystem/pom.xml
b/modules/enterprise/server/startup-subsystem/pom.xml
index a7ed12f..3359f33 100644
--- a/modules/enterprise/server/startup-subsystem/pom.xml
+++ b/modules/enterprise/server/startup-subsystem/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/enterprise/server/xml-schemas/pom.xml
b/modules/enterprise/server/xml-schemas/pom.xml
index a060587..9c1bfdd 100644
--- a/modules/enterprise/server/xml-schemas/pom.xml
+++ b/modules/enterprise/server/xml-schemas/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../../../pom.xml</relativePath>
</parent>
diff --git a/modules/helpers/bundleGen/pom.xml b/modules/helpers/bundleGen/pom.xml
index c83a433..1c570fc 100644
--- a/modules/helpers/bundleGen/pom.xml
+++ b/modules/helpers/bundleGen/pom.xml
@@ -3,13 +3,13 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<groupId>org.rhq.helpers</groupId>
<artifactId>bundleGen</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<build>
<plugins>
diff --git a/modules/helpers/jeeGen/pom.xml b/modules/helpers/jeeGen/pom.xml
index 14530ff..348b780 100644
--- a/modules/helpers/jeeGen/pom.xml
+++ b/modules/helpers/jeeGen/pom.xml
@@ -9,7 +9,7 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
diff --git a/modules/helpers/perftest-support/pom.xml
b/modules/helpers/perftest-support/pom.xml
index 3350726..ceb5377 100644
--- a/modules/helpers/perftest-support/pom.xml
+++ b/modules/helpers/perftest-support/pom.xml
@@ -3,11 +3,11 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
<artifactId>perftest-support</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<name>Performance Testing Support</name>
<description>To support performance testing, this is a basic tool to support
extracting and later reimporting of
data from/to a database.
diff --git a/modules/helpers/pom.xml b/modules/helpers/pom.xml
index 20f1f76..bd47d23 100644
--- a/modules/helpers/pom.xml
+++ b/modules/helpers/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/helpers/rest-docs-generator/pom.xml
b/modules/helpers/rest-docs-generator/pom.xml
index f97d2de..0996c3b 100644
--- a/modules/helpers/rest-docs-generator/pom.xml
+++ b/modules/helpers/rest-docs-generator/pom.xml
@@ -24,7 +24,7 @@
<parent>
<artifactId>rhq-helpers</artifactId>
<groupId>org.rhq.helpers</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/modules/helpers/rtfilter-subsystem/pom.xml
b/modules/helpers/rtfilter-subsystem/pom.xml
index d08c7c6..f3cbb2e 100644
--- a/modules/helpers/rtfilter-subsystem/pom.xml
+++ b/modules/helpers/rtfilter-subsystem/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq.helpers</groupId>
<artifactId>rhq-helpers</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
diff --git a/modules/helpers/rtfilter/pom.xml b/modules/helpers/rtfilter/pom.xml
index dcb0402..98b8667 100644
--- a/modules/helpers/rtfilter/pom.xml
+++ b/modules/helpers/rtfilter/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq.helpers</groupId>
<artifactId>rhq-helpers</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq.helpers</groupId>
diff --git a/modules/integration-tests/apache-plugin-test/pom.xml
b/modules/integration-tests/apache-plugin-test/pom.xml
index e161160..ce66fd5 100644
--- a/modules/integration-tests/apache-plugin-test/pom.xml
+++ b/modules/integration-tests/apache-plugin-test/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>rhq-integration-tests</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
index b20dfa0..e574631 100644
--- a/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
+++ b/modules/integration-tests/jndi-access/jndi-access-test/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>jndi-access-test-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>jndi-access-test</artifactId>
diff --git a/modules/integration-tests/jndi-access/pom.xml
b/modules/integration-tests/jndi-access/pom.xml
index 8dfe58e..caef075 100644
--- a/modules/integration-tests/jndi-access/pom.xml
+++ b/modules/integration-tests/jndi-access/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>rhq-integration-tests</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/integration-tests/jndi-access/remote-server/pom.xml
b/modules/integration-tests/jndi-access/remote-server/pom.xml
index 2bc2fdd..fd7e312 100644
--- a/modules/integration-tests/jndi-access/remote-server/pom.xml
+++ b/modules/integration-tests/jndi-access/remote-server/pom.xml
@@ -4,7 +4,7 @@
<parent>
<artifactId>jndi-access-test-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>jndi-access-remote-server</artifactId>
diff --git a/modules/integration-tests/pom.xml b/modules/integration-tests/pom.xml
index 4c31380..f110387 100644
--- a/modules/integration-tests/pom.xml
+++ b/modules/integration-tests/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/modules/integration-tests/rest-api/pom.xml
b/modules/integration-tests/rest-api/pom.xml
index 3ba07c4..cea2a5c 100644
--- a/modules/integration-tests/rest-api/pom.xml
+++ b/modules/integration-tests/rest-api/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-integration-tests</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
diff --git a/modules/plugins/aliases/pom.xml b/modules/plugins/aliases/pom.xml
index 2244a12..a7a4469 100644
--- a/modules/plugins/aliases/pom.xml
+++ b/modules/plugins/aliases/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/ant-bundle/pom.xml b/modules/plugins/ant-bundle/pom.xml
index 172cce8..5390fcc 100644
--- a/modules/plugins/ant-bundle/pom.xml
+++ b/modules/plugins/ant-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/apache/pom.xml b/modules/plugins/apache/pom.xml
index e887a4e..2ca9086 100644
--- a/modules/plugins/apache/pom.xml
+++ b/modules/plugins/apache/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/augeas/pom.xml b/modules/plugins/augeas/pom.xml
index 3617648..9a8acb4 100644
--- a/modules/plugins/augeas/pom.xml
+++ b/modules/plugins/augeas/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/byteman/pom.xml b/modules/plugins/byteman/pom.xml
index 8366602..6a85842 100644
--- a/modules/plugins/byteman/pom.xml
+++ b/modules/plugins/byteman/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/cassandra/pom.xml b/modules/plugins/cassandra/pom.xml
index d8cfd68..ac3d8ff 100644
--- a/modules/plugins/cassandra/pom.xml
+++ b/modules/plugins/cassandra/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/cobbler/pom.xml b/modules/plugins/cobbler/pom.xml
index b333ad2..8321f4e 100644
--- a/modules/plugins/cobbler/pom.xml
+++ b/modules/plugins/cobbler/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/cron/pom.xml b/modules/plugins/cron/pom.xml
index b0e4004..6ed701b 100644
--- a/modules/plugins/cron/pom.xml
+++ b/modules/plugins/cron/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/database/pom.xml b/modules/plugins/database/pom.xml
index eaf49b8..7959a32 100644
--- a/modules/plugins/database/pom.xml
+++ b/modules/plugins/database/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/filetemplate-bundle/pom.xml
b/modules/plugins/filetemplate-bundle/pom.xml
index 70f6d22..c67fc10 100644
--- a/modules/plugins/filetemplate-bundle/pom.xml
+++ b/modules/plugins/filetemplate-bundle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/grub/pom.xml b/modules/plugins/grub/pom.xml
index 0b00df8..d77acf5 100644
--- a/modules/plugins/grub/pom.xml
+++ b/modules/plugins/grub/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/hadoop/pom.xml b/modules/plugins/hadoop/pom.xml
index 9d488f5..1a6c591 100644
--- a/modules/plugins/hadoop/pom.xml
+++ b/modules/plugins/hadoop/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/hibernate/pom.xml b/modules/plugins/hibernate/pom.xml
index a0eac76..0303046 100644
--- a/modules/plugins/hibernate/pom.xml
+++ b/modules/plugins/hibernate/pom.xml
@@ -6,7 +6,7 @@
<groupId>org.rhq</groupId>
<!-- Bypass the jopr-plugins-parent which can not have children. It must build
after the plugins in order to execute integration tests on them. -->
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/hosts/pom.xml b/modules/plugins/hosts/pom.xml
index 06315b2..467397e 100644
--- a/modules/plugins/hosts/pom.xml
+++ b/modules/plugins/hosts/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/hudson/pom.xml b/modules/plugins/hudson/pom.xml
index 9c7f6d2..1a8d193 100644
--- a/modules/plugins/hudson/pom.xml
+++ b/modules/plugins/hudson/pom.xml
@@ -6,12 +6,12 @@
<parent>
<artifactId>rhq-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-hudson-plugin</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<packaging>jar</packaging>
<name>RHQ Hudson Plugin</name>
diff --git a/modules/plugins/iis/pom.xml b/modules/plugins/iis/pom.xml
index b8f1f5a..69f1dbb 100644
--- a/modules/plugins/iis/pom.xml
+++ b/modules/plugins/iis/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/irc/pom.xml b/modules/plugins/irc/pom.xml
index 9787a1d..fc69a41 100644
--- a/modules/plugins/irc/pom.xml
+++ b/modules/plugins/irc/pom.xml
@@ -5,7 +5,7 @@
<parent>
<artifactId>rhq-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/jboss-as-5/pom.xml b/modules/plugins/jboss-as-5/pom.xml
index 9c71f33..f2a81a1 100644
--- a/modules/plugins/jboss-as-5/pom.xml
+++ b/modules/plugins/jboss-as-5/pom.xml
@@ -9,7 +9,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jboss-as-7/pom.xml b/modules/plugins/jboss-as-7/pom.xml
index 75d5b51..1f63c91 100644
--- a/modules/plugins/jboss-as-7/pom.xml
+++ b/modules/plugins/jboss-as-7/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/jboss-as/pom.xml b/modules/plugins/jboss-as/pom.xml
index 53e8149..d1f4c74 100644
--- a/modules/plugins/jboss-as/pom.xml
+++ b/modules/plugins/jboss-as/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jboss-cache-v3/pom.xml
b/modules/plugins/jboss-cache-v3/pom.xml
index aa4f232..34bdffe 100644
--- a/modules/plugins/jboss-cache-v3/pom.xml
+++ b/modules/plugins/jboss-cache-v3/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jboss-cache/pom.xml b/modules/plugins/jboss-cache/pom.xml
index 35d919b..421f24d 100644
--- a/modules/plugins/jboss-cache/pom.xml
+++ b/modules/plugins/jboss-cache/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/jmx/pom.xml b/modules/plugins/jmx/pom.xml
index 16d4245..48e3f93 100644
--- a/modules/plugins/jmx/pom.xml
+++ b/modules/plugins/jmx/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/kickstart/pom.xml b/modules/plugins/kickstart/pom.xml
index 5d85bc4..9255d09 100644
--- a/modules/plugins/kickstart/pom.xml
+++ b/modules/plugins/kickstart/pom.xml
@@ -7,7 +7,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/mod-cluster/pom.xml b/modules/plugins/mod-cluster/pom.xml
index 64620e1..804b04a 100644
--- a/modules/plugins/mod-cluster/pom.xml
+++ b/modules/plugins/mod-cluster/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/mysql/pom.xml b/modules/plugins/mysql/pom.xml
index 9e5a24e..14e39a3 100644
--- a/modules/plugins/mysql/pom.xml
+++ b/modules/plugins/mysql/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/netservices/pom.xml b/modules/plugins/netservices/pom.xml
index 4afa8a5..184f1db 100644
--- a/modules/plugins/netservices/pom.xml
+++ b/modules/plugins/netservices/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/noop/pom.xml b/modules/plugins/noop/pom.xml
index 1ab336f..1f43ea4 100644
--- a/modules/plugins/noop/pom.xml
+++ b/modules/plugins/noop/pom.xml
@@ -26,7 +26,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/oracle/pom.xml b/modules/plugins/oracle/pom.xml
index 5ce8144..dc4f4aa 100644
--- a/modules/plugins/oracle/pom.xml
+++ b/modules/plugins/oracle/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/pattern-generator/pom.xml
b/modules/plugins/pattern-generator/pom.xml
index b8fdab2..7fe46e5 100644
--- a/modules/plugins/pattern-generator/pom.xml
+++ b/modules/plugins/pattern-generator/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/perftest/pom.xml b/modules/plugins/perftest/pom.xml
index e8b68fe..7ccffa7 100644
--- a/modules/plugins/perftest/pom.xml
+++ b/modules/plugins/perftest/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/platform/pom.xml b/modules/plugins/platform/pom.xml
index 143872e..ef210b6 100644
--- a/modules/plugins/platform/pom.xml
+++ b/modules/plugins/platform/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/pom.xml b/modules/plugins/pom.xml
index 73947ae..9af3938 100644
--- a/modules/plugins/pom.xml
+++ b/modules/plugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>
diff --git a/modules/plugins/postfix/pom.xml b/modules/plugins/postfix/pom.xml
index 29ea010..69a3b7d 100644
--- a/modules/plugins/postfix/pom.xml
+++ b/modules/plugins/postfix/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/postgres/pom.xml b/modules/plugins/postgres/pom.xml
index c565c89..1e323fb 100644
--- a/modules/plugins/postgres/pom.xml
+++ b/modules/plugins/postgres/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/rhq-agent/pom.xml b/modules/plugins/rhq-agent/pom.xml
index 1dcf822..e187c17 100644
--- a/modules/plugins/rhq-agent/pom.xml
+++ b/modules/plugins/rhq-agent/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/rhq-server/pom.xml b/modules/plugins/rhq-server/pom.xml
index 9d1557b..5327977 100644
--- a/modules/plugins/rhq-server/pom.xml
+++ b/modules/plugins/rhq-server/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/samba/pom.xml b/modules/plugins/samba/pom.xml
index dd8150c..a392c58 100644
--- a/modules/plugins/samba/pom.xml
+++ b/modules/plugins/samba/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/script/pom.xml b/modules/plugins/script/pom.xml
index 77d117e..3772829 100644
--- a/modules/plugins/script/pom.xml
+++ b/modules/plugins/script/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/script2/pom.xml b/modules/plugins/script2/pom.xml
index 672ac51..3bec031 100644
--- a/modules/plugins/script2/pom.xml
+++ b/modules/plugins/script2/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/snmptrapd/pom.xml b/modules/plugins/snmptrapd/pom.xml
index 35121e0..4805c8f 100644
--- a/modules/plugins/snmptrapd/pom.xml
+++ b/modules/plugins/snmptrapd/pom.xml
@@ -2,7 +2,7 @@
<parent>
<artifactId>rhq-plugins-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
diff --git a/modules/plugins/sshd/pom.xml b/modules/plugins/sshd/pom.xml
index 6d880e3..92e76ef 100644
--- a/modules/plugins/sshd/pom.xml
+++ b/modules/plugins/sshd/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/sudoers/pom.xml b/modules/plugins/sudoers/pom.xml
index 91bfbee..053fac0 100644
--- a/modules/plugins/sudoers/pom.xml
+++ b/modules/plugins/sudoers/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/tomcat/pom.xml b/modules/plugins/tomcat/pom.xml
index 52c9b13..9ded2f5 100644
--- a/modules/plugins/tomcat/pom.xml
+++ b/modules/plugins/tomcat/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.jboss.on</groupId>
diff --git a/modules/plugins/twitter/pom.xml b/modules/plugins/twitter/pom.xml
index 6b0ad95..6f00f3f 100644
--- a/modules/plugins/twitter/pom.xml
+++ b/modules/plugins/twitter/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/validate-all-plugins/pom.xml
b/modules/plugins/validate-all-plugins/pom.xml
index fbc5f94..1e8c6fc 100644
--- a/modules/plugins/validate-all-plugins/pom.xml
+++ b/modules/plugins/validate-all-plugins/pom.xml
@@ -5,7 +5,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/plugins/virt/pom.xml b/modules/plugins/virt/pom.xml
index a2a48da..1c2bbca 100644
--- a/modules/plugins/virt/pom.xml
+++ b/modules/plugins/virt/pom.xml
@@ -4,7 +4,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-plugins-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/pom.xml b/modules/pom.xml
index d1745b2..82d911d 100644
--- a/modules/pom.xml
+++ b/modules/pom.xml
@@ -6,7 +6,7 @@
<parent>
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.rhq</groupId>
diff --git a/modules/test-utils/pom.xml b/modules/test-utils/pom.xml
index a04cf92..ee5bbfd 100644
--- a/modules/test-utils/pom.xml
+++ b/modules/test-utils/pom.xml
@@ -7,7 +7,7 @@
<parent>
<artifactId>rhq-modules-parent</artifactId>
<groupId>org.rhq</groupId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
</parent>
<artifactId>test-utils</artifactId>
diff --git a/pom.xml b/pom.xml
index 711cad0..afd1a61 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,7 +6,7 @@
<groupId>org.rhq</groupId>
<artifactId>rhq-parent</artifactId>
- <version>4.6.0-SNAPSHOT</version>
+ <version>4.7.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>RHQ</name>
commit a9352d74a8eff4e9517af200d5f81b2f6f7b9f2b
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 21 16:36:29 2013 -0500
refactor to expose the ScriptEngine for these and other tests.
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/ScriptableAbstractEJB3Test.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/ScriptableAbstractEJB3Test.java
new file mode 100644
index 0000000..1cc66c5
--- /dev/null
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/ScriptableAbstractEJB3Test.java
@@ -0,0 +1,37 @@
+package org.rhq.enterprise.client;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.PrintWriter;
+import java.security.PermissionCollection;
+import java.util.Collections;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+
+import org.testng.annotations.Test;
+
+import org.rhq.bindings.ScriptEngineFactory;
+import org.rhq.bindings.StandardBindings;
+import org.rhq.bindings.StandardScriptPermissions;
+import org.rhq.bindings.util.PackageFinder;
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.enterprise.server.test.AbstractEJB3Test;
+
+/**
+ *
+ * @author Simeon Pinder
+ *
+ */
+@Test
+public class ScriptableAbstractEJB3Test extends AbstractEJB3Test {
+
+ protected ScriptEngine getEngine(Subject subject) throws ScriptException, IOException
{
+ StandardBindings bindings = new StandardBindings(new PrintWriter(System.out), new
LocalClient(subject));
+
+ PermissionCollection perms = new StandardScriptPermissions();
+
+ return ScriptEngineFactory.getSecuredScriptEngine("javascript",
+ new PackageFinder(Collections.<File> emptyList()), bindings, perms);
+ }
+}
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
index 8489f1d..349a8ce 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
@@ -18,11 +18,7 @@
*/
package org.rhq.enterprise.client.security.test;
-import java.io.File;
import java.io.IOException;
-import java.io.PrintWriter;
-import java.security.PermissionCollection;
-import java.util.Collections;
import javax.naming.Context;
import javax.script.ScriptEngine;
@@ -31,15 +27,10 @@ import javax.script.ScriptException;
import org.testng.Assert;
import org.testng.annotations.Test;
-import org.rhq.bindings.ScriptEngineFactory;
-import org.rhq.bindings.StandardBindings;
-import org.rhq.bindings.StandardScriptPermissions;
-import org.rhq.bindings.util.PackageFinder;
import org.rhq.core.domain.auth.Subject;
-import org.rhq.enterprise.client.LocalClient;
+import org.rhq.enterprise.client.ScriptableAbstractEJB3Test;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.system.SystemManagerBean;
-import org.rhq.enterprise.server.test.AbstractEJB3Test;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -48,7 +39,7 @@ import org.rhq.enterprise.server.util.LookupUtil;
* @author Lukas Krejci
*/
@Test
-public class JndiAccessTest extends AbstractEJB3Test {
+public class JndiAccessTest extends ScriptableAbstractEJB3Test {
public void testScriptCantOverrideSystemProperties() throws Exception {
Subject overlord = LookupUtil.getSubjectManager().getOverlord();
@@ -272,15 +263,6 @@ public class JndiAccessTest extends AbstractEJB3Test {
// }
// }
- protected ScriptEngine getEngine(Subject subject) throws ScriptException, IOException
{
- StandardBindings bindings = new StandardBindings(new PrintWriter(System.out), new
LocalClient(subject));
-
- PermissionCollection perms = new StandardScriptPermissions();
-
- return ScriptEngineFactory.getSecuredScriptEngine("javascript",
- new PackageFinder(Collections.<File> emptyList()), bindings, perms);
- }
-
private static void checkIsDesiredSecurityException(ScriptException e) {
String message = e.getMessage();
String permissionTrace = "org.rhq.allow.server.internals.access";
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
index 98ad38c..6768021 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
@@ -17,7 +17,7 @@ import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.util.PageList;
-import org.rhq.enterprise.client.security.test.JndiAccessTest;
+import org.rhq.enterprise.client.ScriptableAbstractEJB3Test;
import org.rhq.enterprise.server.util.LookupUtil;
import org.rhq.enterprise.server.util.SessionTestHelper;
@@ -26,7 +26,7 @@ import org.rhq.enterprise.server.util.SessionTestHelper;
* @author Simeon Pinder
*/
@Test
-public class ScriptTest extends JndiAccessTest {
+public class ScriptTest extends ScriptableAbstractEJB3Test {
/** Exercise the ScriptUtil.findResoruces
*
commit 0d130abb277d988190ac2577879d6eb40ea0814a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 21 16:29:01 2013 -0500
Deprecate ScriptUtil.findResources() usage as does not properly support paging
and can produce result sets difficult to parse for large result sets.
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
index 6b86b61..7d64eab 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
@@ -70,6 +70,25 @@ public class ScriptUtil {
this.scriptEngine = scriptEngine;
}
+ /** This convenience method has been deprecated as it was not designed to support
paging
+ * which is a requirement to efficiently handle large results sets. This methods
returns
+ * all inexact matches to the String parameter passed in. Clients may have
difficulty
+ * retrieving all results.
+ *
+ * Instead to page through large/small result sets you should create
+ * i)ResourceCriteria instances to be passed into
+ * ii)ResourceManager.findResourcesByCriteria(ResourceCriteria criteria)
+ *
+ * NOTE: ResourceCriteria by default has a page size of 200 and starts on page 0.
Ex. criteria.setPaging(0,200);
+ *
+ * To iterate over a larger result set you can
+ * i)get access to the total number of resources, as the PageList<Resource>
return includes a getTotalSize() method
+ * ii)iterate through the pages of results by using Ex. criteria.setPaging(1,200),
criteria.setPaging(2,200), [N,PageSize]
+ *
+ * @param string
+ * @return PageList<Resource> Resources with inexact name matches to the string
passed in.
+ */
+ @Deprecated
public PageList<Resource> findResources(String string) {
if (remoteClient == null) {
throw new IllegalStateException("The findResources() method requires a
connection to the RHQ server.");
commit bf664e0f63aabbd22b242450d0f673c4064c4215
Merge: 76458a3 b452250
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 21 14:49:53 2013 -0500
Merge branch 'track_master' into spinder/criteriaUsage
commit 76458a3ca5762cec0512e8ed6b607cdafeddf71a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 21 14:16:16 2013 -0500
Add integration test to exercise some CLI functionality specifically findResources.
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
index fabe6ae..8489f1d 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/security/test/JndiAccessTest.java
@@ -272,7 +272,7 @@ public class JndiAccessTest extends AbstractEJB3Test {
// }
// }
- private ScriptEngine getEngine(Subject subject) throws ScriptException, IOException
{
+ protected ScriptEngine getEngine(Subject subject) throws ScriptException, IOException
{
StandardBindings bindings = new StandardBindings(new PrintWriter(System.out), new
LocalClient(subject));
PermissionCollection perms = new StandardScriptPermissions();
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
new file mode 100644
index 0000000..98ad38c
--- /dev/null
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/client/util/ScriptTest.java
@@ -0,0 +1,81 @@
+package org.rhq.enterprise.client.util;
+
+import java.io.IOException;
+import java.util.Random;
+
+import javax.persistence.EntityManager;
+import javax.script.ScriptEngine;
+import javax.script.ScriptException;
+import javax.transaction.HeuristicMixedException;
+import javax.transaction.HeuristicRollbackException;
+import javax.transaction.NotSupportedException;
+import javax.transaction.RollbackException;
+import javax.transaction.SystemException;
+
+import org.testng.annotations.Test;
+
+import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.resource.Resource;
+import org.rhq.core.domain.util.PageList;
+import org.rhq.enterprise.client.security.test.JndiAccessTest;
+import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.util.SessionTestHelper;
+
+/**Exercise some of the methods available via cli an integration tests/using a running
server.
+
+ * @author Simeon Pinder
+ */
+@Test
+public class ScriptTest extends JndiAccessTest {
+
+ /** Exercise the ScriptUtil.findResoruces
+ *
+ * @throws ScriptException
+ * @throws IOException
+ * @throws NotSupportedException
+ * @throws SystemException
+ * @throws SecurityException
+ * @throws IllegalStateException
+ * @throws RollbackException
+ * @throws HeuristicMixedException
+ * @throws HeuristicRollbackException
+ */
+ @Test
+ public void testScriptUtilFindResources() throws ScriptException, IOException,
NotSupportedException,
+ SystemException,
+ SecurityException, IllegalStateException, RollbackException,
HeuristicMixedException,
+ HeuristicRollbackException {
+
+ //Instantiate ScriptEngine.
+ Subject overlord = LookupUtil.getSubjectManager().getOverlord();
+ ScriptEngine engine = getEngine(overlord);
+
+ //create resources to query.
+ getTransactionManager().begin();
+ EntityManager entityMgr = getEntityManager();
+ String tuid = "" + new Random().nextInt();
+ String prefix = "CLI-TEST-" + tuid + "-";
+ int resourceCount = 201; //assuming 200 per page at least 2 pages of results.
+ int[] resourceIds = new int[resourceCount];
+ try {
+ System.out.println("-------- Creating " + resourceCount + "
resource(s). This may take a while ....");
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < resourceCount; i++) {
+ String name = prefix + i;
+ Resource r = SessionTestHelper.createNewResource(entityMgr, name);
+ resourceIds[i] = r.getId();
+ }
+ entityMgr.flush();
+
+ System.out.println("----------- Created " + resourceCount + "
resource(s) in "
+ + (System.currentTimeMillis() - start) + " ms.");
+
+ //now get the Resources back by CLI
+ PageList<Resource> result = (PageList<Resource>)
engine.eval("findResources('" + prefix + "');");
+ assert result.size() == resourceCount : "Expected to get '" +
resourceCount
+ + "' result(s) from across two pages but instead got '"
+ result.size() + "'.";
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+}
commit 6a2b2c0c8c19cc52cbf39ddee7c49ea9ad0a3de1
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Thu Feb 21 10:13:48 2013 -0500
Apply fixes for CriteriaQueryTest incorrectly using paging.
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
index faa14ad..2e1c897 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
@@ -73,7 +73,9 @@ public class CriteriaQueryTest {
}
public void addPage(List<FakeEntity> entities) {
- pages.add(new PageList<FakeEntity>(entities, totalSize, pc));
+ int pageNumber = pages.size();
+ pages
+ .add(new PageList<FakeEntity>(entities, totalSize, new
PageControl(pageNumber, this.pc.getPageSize())));
}
@Override
@@ -113,7 +115,8 @@ public class CriteriaQueryTest {
queryExecutor.addPage(expected.subList(2, 4));
FakeEntityCriteria criteria = new FakeEntityCriteria();
- criteria.setPageControl(pc);
+ //spinder 2-20-13: DO NOT use criteria.setPageControl(pc) here as it causes
ignore of pageNumber/pageSize
+ criteria.setPaging(pc.getPageNumber(), pc.getPageSize());
CriteriaQuery<FakeEntity, FakeEntityCriteria> query = new
CriteriaQuery<FakeEntity, FakeEntityCriteria>(
criteria, queryExecutor);
@@ -164,7 +167,7 @@ public class CriteriaQueryTest {
//build criteria and attach pageControl
FakeEntityCriteria criteria = new FakeEntityCriteria();
- //DO NOT use criteria.setPageControl(pc) here as it causes ignore of
pageNumber/pageSize
+ //spinder 2-20-13:DO NOT use criteria.setPageControl(pc) here as it causes ignore
of pageNumber/pageSize
criteria.setPaging(pc.getPageNumber(), pc.getPageSize());
//?? So which pageControl has the right details? Criteria.pageControl? OR
PageControl passed into the QueryExecutor.
commit 650d2c0b7c326c1528acf309ddb22e2792b6d65c
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Wed Feb 20 14:03:52 2013 -0500
Clarify dirty read javadoc for test.
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
index f48d360..40b0623 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
@@ -221,9 +221,12 @@ public class ResourceStorageTest extends AbstractEJB3Test {
}
/** Test creates a large number of resources and pages through them using
CriteriaQuery.
+ *
* NOTE: CriteriaQuery uses PageList instances underneath and are susceptible to
dirty
- * read issues if the total number of resources being parsed is i)very large or
ii)processing
- * each instance takes a significant amount of time. Ex. Begin parsing all resource
types,
+ * read issues if the underlying dataset changes because the total number of
resources being
+ * parsed is i)very large or ii)processing each instance takes a significant amount
of
+ * time such that another action/process/object may have changed the original
resources
+ * before resultset processing could be completed. Ex. Begin parsing all resource
types,
* while plugin update is removing some of those same types.
*
* @throws Exception
commit 962b33d40299d5076e57e5e5949c4d664d62ab15
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 20 13:53:51 2013 -0500
CriteriaQuery should always have a sort applied in the Criteria supplied to
it. Otherwise the implicit chunking will be unreliable, as queries will
have no guaranteed ordering, the DB is free to order results in any way it
likes.
To do this I've done two things:
1) I added the ability to sort by ID on all subclasses of Criteria
2) If no sort is specified in the CriteriaQuery Criteria, an ID sort is added
This default ASC sort on ID provides consistent chunking and the fastest
ordering given that it's an indexed (PK) field.
AND, DONE DURING MERGE:
Fix merge issue.
Also:
- fix issue when using CriteriaQuery with pageControlOverrides
- update tests to cover a few more scenarios
- remove the unnecessary pagecontrol overrides forwarding in CriteriaQuery.next
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BaseCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BaseCriteria.java
index c4993c1..5b931aa 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BaseCriteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/BaseCriteria.java
@@ -18,7 +18,10 @@
*/
package org.rhq.core.domain.criteria;
+import java.util.List;
+
import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageOrdering;
/**
* All criteria, regardless of the backend storage that will be queried with this
criteria, needs
@@ -28,6 +31,10 @@ import org.rhq.core.domain.util.PageControl;
*/
public interface BaseCriteria {
+ void addSortId(PageOrdering sortId);
+
+ List<String> getOrderingFieldNames();
+
PageControl getPageControlOverrides();
void setPageControl(PageControl pageControl);
diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
index afcff6f..2ae6859 100644
--- a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/Criteria.java
@@ -35,6 +35,7 @@ import javax.xml.bind.annotation.XmlAccessorType;
import org.rhq.core.domain.authz.Permission;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
/**
* @author Joseph Marques
@@ -96,6 +97,9 @@ public abstract class Criteria implements Serializable, BaseCriteria {
private String searchExpression;
+ // All Criteria support sorting on ID
+ private PageOrdering sortId;
+
/**
* This default constructor will set default paging to avoid unintended fetch of huge
results. The default is:
* <pre>setPaging(0, 200);</pre>
@@ -139,6 +143,11 @@ public abstract class Criteria implements Serializable, BaseCriteria
{
return pageControlOverrides;
}
+ public void addSortId(PageOrdering sortId) {
+ addSortField("id");
+ this.sortId = sortId;
+ }
+
protected void addSortField(String fieldName) {
orderingFieldNames.add("sort" +
Character.toUpperCase(fieldName.charAt(0)) + fieldName.substring(1));
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
index 0cb6bfa..c640bf0 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftChangeSetCriteria.java
@@ -18,15 +18,16 @@
*/
package org.rhq.core.domain.criteria;
-import org.rhq.core.domain.drift.DriftCategory;
-import org.rhq.core.domain.drift.DriftChangeSetCategory;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageOrdering;
+import static org.rhq.core.domain.util.CriteriaUtils.getListIgnoringNulls;
import java.io.Serializable;
+import java.util.ArrayList;
import java.util.List;
-import static org.rhq.core.domain.util.CriteriaUtils.getListIgnoringNulls;
+import org.rhq.core.domain.drift.DriftCategory;
+import org.rhq.core.domain.drift.DriftChangeSetCategory;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageOrdering;
/**
* The generic implementation of DriftChangeSetCriteria makes no assumptions about the
actual drift server
@@ -68,6 +69,8 @@ public class GenericDriftChangeSetCriteria implements Serializable,
DriftChangeS
private boolean fetchDrifts;
+ private PageOrdering sortId;
+
private PageOrdering sortVersion;
private PageControl pageControl;
@@ -209,6 +212,11 @@ public class GenericDriftChangeSetCriteria implements Serializable,
DriftChangeS
}
@Override
+ public void addSortId(PageOrdering sortId) {
+ this.sortId = sortId;
+ }
+
+ @Override
public void addSortVersion(PageOrdering sortVersion) {
this.sortVersion = sortVersion;
}
@@ -244,4 +252,16 @@ public class GenericDriftChangeSetCriteria implements Serializable,
DriftChangeS
pageControl.setPageSize(pageSize);
}
+ @Override
+ public List<String> getOrderingFieldNames() {
+ List<String> result = new ArrayList<String>(2);
+ if (null != sortId) {
+ result.add("id");
+ }
+ if (null != sortVersion) {
+ result.add("version");
+ }
+ return result;
+ }
+
}
diff --git
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftCriteria.java
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftCriteria.java
index 3146b16..1c53353 100644
---
a/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftCriteria.java
+++
b/modules/core/domain/src/main/java/org/rhq/core/domain/criteria/GenericDriftCriteria.java
@@ -18,16 +18,16 @@
*/
package org.rhq.core.domain.criteria;
-import org.rhq.core.domain.drift.DriftCategory;
-import org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode;
-import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageOrdering;
+import static org.rhq.core.domain.util.CriteriaUtils.getListIgnoringNulls;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
-import static org.rhq.core.domain.util.CriteriaUtils.getListIgnoringNulls;
+import org.rhq.core.domain.drift.DriftCategory;
+import org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode;
+import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageOrdering;
/**
* The generic implementation of DriftCriteria makes no assumptions about the actual
drift server
@@ -71,6 +71,8 @@ public class GenericDriftCriteria implements Serializable, DriftCriteria
{
private PageControl pageControl;
+ private PageOrdering sortId;
+
private PageOrdering sortCtime;
private boolean strict;
@@ -206,6 +208,11 @@ public class GenericDriftCriteria implements Serializable,
DriftCriteria {
}
@Override
+ public void addSortId(PageOrdering sortId) {
+ this.sortId = sortId;
+ }
+
+ @Override
public void addSortCtime(PageOrdering sortCtime) {
this.sortCtime = sortCtime;
}
@@ -241,4 +248,16 @@ public class GenericDriftCriteria implements Serializable,
DriftCriteria {
pageControl.setPageSize(pageSize);
}
+ @Override
+ public List<String> getOrderingFieldNames() {
+ List<String> result = new ArrayList<String>(2);
+ if (null != sortId) {
+ result.add("id");
+ }
+ if (null != sortCtime) {
+ result.add("ctime");
+ }
+ return result;
+ }
+
}
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
index e746deb..f48d360 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
@@ -132,8 +132,8 @@ public class ResourceStorageTest extends AbstractEJB3Test {
ResourceGroupManagerLocal groupManager =
LookupUtil.getResourceGroupManager();
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
PageControl pc = new PageControl(0, 5, new OrderingField("rg.name",
PageOrdering.ASC));
- PageList<ResourceGroupComposite> groups =
groupManager.findResourceGroupComposites(subjectManager
- .getOverlord(), GroupCategory.COMPATIBLE, null, null, null, null, null,
null, pc);
+ PageList<ResourceGroupComposite> groups =
groupManager.findResourceGroupComposites(
+ subjectManager.getOverlord(), GroupCategory.COMPATIBLE, null, null, null,
null, null, null, pc);
System.out.println("Found compatible groups: " +
groups.getTotalSize());
for (ResourceGroupComposite group : groups) {
System.out.println("\t" + group);
@@ -195,8 +195,8 @@ public class ResourceStorageTest extends AbstractEJB3Test {
Subject rhqadmin =
subjectManager.loginUnauthenticated("rhqadmin");
rhqadmin = createSession(rhqadmin);
- Map<Resource, List<Resource>> queue =
discoveryBoss.getQueuedPlatformsAndServers(rhqadmin, PageControl
- .getUnlimitedInstance());
+ Map<Resource, List<Resource>> queue =
discoveryBoss.getQueuedPlatformsAndServers(rhqadmin,
+ PageControl.getUnlimitedInstance());
for (Resource root : queue.keySet()) {
System.out.println("Queue root resource: " + root);
}
@@ -228,7 +228,6 @@ public class ResourceStorageTest extends AbstractEJB3Test {
*
* @throws Exception
*/
- @SuppressWarnings("unused")
@Test(groups = "integration.ejb3")
public void testParsingCriteriaQueryResults() throws Exception {
getTransactionManager().begin();
@@ -251,8 +250,7 @@ public class ResourceStorageTest extends AbstractEJB3Test {
String tuid = "" + new Random().nextInt();
//create large number of resources
String prefix = "largeResultSet-" + tuid + "-";
- System.out.println("-------- Creating " + resourceCount
- + " resource(s). This may take a while ....");
+ System.out.println("-------- Creating " + resourceCount + "
resource(s). This may take a while ....");
long start = System.currentTimeMillis();
for (int i = 0; i < resourceCount; i++) {
@@ -264,15 +262,14 @@ public class ResourceStorageTest extends AbstractEJB3Test {
entityMgr.flush();
System.out.println("----------- Created " + resourceCount + "
resource(s) in "
- + (System.currentTimeMillis() - start)
- + " ms.");
+ + (System.currentTimeMillis() - start) + " ms.");
assert resourceNames.size() == resourceCount;//assert all resources
loaded/created
//query the results and delete the resources
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterName(prefix);
- criteria.addSortName(PageOrdering.ASC);
+ criteria.addSortName(PageOrdering.DESC); // use DESC just to make sure
sorting on name is different than insert order
criteria.setPaging(0, 47);
//iterate over the results with CriteriaQuery
@@ -288,10 +285,95 @@ public class ResourceStorageTest extends AbstractEJB3Test {
criteria, queryExecutor);
start = System.currentTimeMillis();
+ String prevName = null;
+ //iterate over the entire result set efficiently
+ ArrayList<String> alreadySeen = new ArrayList<String>();
+ int actualCount = 0;
+ for (Resource r : resources) {
+ assert null == prevName || r.getName().compareTo(prevName) < 0 :
"Results should be sorted by name DESC, something is out of order";
+ prevName = r.getName();
+ actualCount++;
+ // System.out.println(actualCount + " @@@ " +
r.getId() + ":"
+ // +
((resourceNames.containsKey(String.valueOf(r.getId()))) ? "NEW" :
"DIRTY") + ":" + r.getName());
+ resourceNames.remove(String.valueOf(r.getId()));
+ }
+
+ System.out.println("----------- Parsed " + actualCount + "
resource(s) in "
+ + (System.currentTimeMillis() - start) + " ms.");
+
+ //test that entire list parsed spanning multiple pages
+ assert resourceNames.size() == 0 : "Expected resourceNames to be empty.
Still " + resourceNames.size()
+ + " name(s).";
+
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
+ @Test(groups = "integration.ejb3")
+ public void testParsingCriteriaQueryResults_2() throws Exception {
+ // Same test as above but makes sure default id search works. use different
numbers just for variety
+ getTransactionManager().begin();
+ EntityManager entityMgr = getEntityManager();
+ final ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
+
+ //verify that all resource objects are actually parsed.
+ Map<String, Object> resourceNames = new HashMap<String, Object>();
+ int resourceCount = 344;
+
+ try {
+ final Subject subject = SessionTestHelper.createNewSubject(entityMgr,
"testSubject");
+
+ Role roleWithSubject = SessionTestHelper.createNewRoleForSubject(entityMgr,
subject, "role with subject");
+ roleWithSubject.addPermission(Permission.VIEW_RESOURCE);
+
+ ResourceGroup group =
SessionTestHelper.createNewCompatibleGroupForRole(entityMgr, roleWithSubject,
+ "accessible group");
+
+ String tuid = "" + new Random().nextInt();
+ //create large number of resources
+ String prefix = "largeResultSet-" + tuid + "-";
+ System.out.println("-------- Creating " + resourceCount + "
resource(s). This may take a while ....");
+
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < resourceCount; i++) {
+ String name = prefix + i;
+ Resource r = SessionTestHelper.createNewResourceForGroup(entityMgr,
group, name);
+ //store away each resource name/key
+ resourceNames.put(String.valueOf(r.getId()), name);
+ }
+ entityMgr.flush();
+
+ System.out.println("----------- Created " + resourceCount + "
resource(s) in "
+ + (System.currentTimeMillis() - start) + " ms.");
+
+ assert resourceNames.size() == resourceCount;//assert all resources
loaded/created
+
+ //query the results and delete the resources, use default ID search
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterName(prefix);
+ criteria.setPaging(0, 25);
+
+ //iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new
CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceManager.findResourcesByCriteria(subject, criteria);
+ }
+ };
+
+ //initiate first/(total depending on page size) request.
+ CriteriaQuery<Resource, ResourceCriteria> resources = new
CriteriaQuery<Resource, ResourceCriteria>(
+ criteria, queryExecutor);
+
+ start = System.currentTimeMillis();
+ int prevId = 0;
//iterate over the entire result set efficiently
ArrayList<String> alreadySeen = new ArrayList<String>();
int actualCount = 0;
for (Resource r : resources) {
+ assert r.getId() > prevId : "Results should be sorted by ID ASC,
something is out of order";
+ prevId = r.getId();
actualCount++;
// System.out.println(actualCount + " @@@ " +
r.getId() + ":"
// +
((resourceNames.containsKey(String.valueOf(r.getId()))) ? "NEW" :
"DIRTY") + ":" + r.getName());
@@ -299,8 +381,7 @@ public class ResourceStorageTest extends AbstractEJB3Test {
}
System.out.println("----------- Parsed " + actualCount + "
resource(s) in "
- + (System.currentTimeMillis() - start)
- + " ms.");
+ + (System.currentTimeMillis() - start) + " ms.");
//test that entire list parsed spanning multiple pages
assert resourceNames.size() == 0 : "Expected resourceNames to be empty.
Still " + resourceNames.size()
@@ -310,4 +391,89 @@ public class ResourceStorageTest extends AbstractEJB3Test {
getTransactionManager().rollback();
}
}
+
+ @Test(groups = "integration.ejb3")
+ public void testParsingCriteriaQueryResults_3() throws Exception {
+ // Same test as above but makes sure pageoverrides default id search works. use
different numbers just for variety
+ getTransactionManager().begin();
+ EntityManager entityMgr = getEntityManager();
+ final ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
+
+ //verify that all resource objects are actually parsed.
+ Map<String, Object> resourceNames = new HashMap<String, Object>();
+ int resourceCount = 423;
+
+ try {
+ final Subject subject = SessionTestHelper.createNewSubject(entityMgr,
"testSubject");
+
+ Role roleWithSubject = SessionTestHelper.createNewRoleForSubject(entityMgr,
subject, "role with subject");
+ roleWithSubject.addPermission(Permission.VIEW_RESOURCE);
+
+ ResourceGroup group =
SessionTestHelper.createNewCompatibleGroupForRole(entityMgr, roleWithSubject,
+ "accessible group");
+
+ String tuid = "" + new Random().nextInt();
+ //create large number of resources
+ String prefix = "largeResultSet-" + tuid + "-";
+ System.out.println("-------- Creating " + resourceCount + "
resource(s). This may take a while ....");
+
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < resourceCount; i++) {
+ String name = prefix + i;
+ Resource r = SessionTestHelper.createNewResourceForGroup(entityMgr,
group, name);
+ //store away each resource name/key
+ resourceNames.put(String.valueOf(r.getId()), name);
+ }
+ entityMgr.flush();
+
+ System.out.println("----------- Created " + resourceCount + "
resource(s) in "
+ + (System.currentTimeMillis() - start) + " ms.");
+
+ assert resourceNames.size() == resourceCount;//assert all resources
loaded/created
+
+ //query the results and delete the resources, use default ID search
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterName(prefix);
+ PageControl pc = new PageControl(0, 73);
+ criteria.setPageControl(pc);
+ assert pc.getOrderingFields().isEmpty() : "Should not have had any
sorting defined";
+
+ //iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new
CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceManager.findResourcesByCriteria(subject, criteria);
+ }
+ };
+
+ //initiate first/(total depending on page size) request.
+ CriteriaQuery<Resource, ResourceCriteria> resources = new
CriteriaQuery<Resource, ResourceCriteria>(
+ criteria, queryExecutor);
+
+ start = System.currentTimeMillis();
+ int prevId = 0;
+ //iterate over the entire result set efficiently
+ ArrayList<String> alreadySeen = new ArrayList<String>();
+ int actualCount = 0;
+ for (Resource r : resources) {
+ System.out.println(actualCount + " @@@ " + r.getId() +
":"
+ + ((resourceNames.containsKey(String.valueOf(r.getId()))) ?
"NEW" : "DIRTY") + ":" + r.getName());
+ assert r.getId() > prevId : "Results should be sorted by ID ASC,
something is out of order";
+ prevId = r.getId();
+ actualCount++;
+ resourceNames.remove(String.valueOf(r.getId()));
+ }
+
+ System.out.println("----------- Parsed " + actualCount + "
resource(s) in "
+ + (System.currentTimeMillis() - start) + " ms.");
+
+ //test that entire list parsed spanning multiple pages
+ assert resourceNames.size() == 0 : "Expected resourceNames to be empty.
Still " + resourceNames.size()
+ + " name(s).";
+
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
+
}
\ No newline at end of file
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
index 5e30b87..ab6a915 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
@@ -27,6 +27,7 @@ import java.util.NoSuchElementException;
import org.rhq.core.domain.criteria.BaseCriteria;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+import org.rhq.core.domain.util.PageOrdering;
/** This class provides a way to make PageList results easily iterable with 'for
each','while',etc. loops
* and importantly automatically handles iteration through all PageControl results.
This
@@ -50,9 +51,28 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements
Iterable<T> {
//Executor
private CriteriaQueryExecutor<T, C> queryExecutor;
+ /**
+ * It is important that the <code>criteria</code> includes sorting. If
not then paging is nonsensical as the DB
+ * provides no guarantee of ordering. If no sort is specified, an implicit sort on
ID is added.
+ *
+ * @param criteria The criteria applied to each execution of the fetch. If no sort is
specified, an implicit sort on
+ * ID is added.
+ * @param queryExecutor
+ */
public CriteriaQuery(C criteria, CriteriaQueryExecutor<T, C> queryExecutor) {
this.criteria = criteria;
this.queryExecutor = queryExecutor;
+
+ // make sure we have at least a default sort, otherwise chunking doesn't
work
+ PageControl pageControlOverrides = this.criteria.getPageControlOverrides();
+ if (null != pageControlOverrides) {
+ if (pageControlOverrides.getOrderingFields().isEmpty()) {
+ pageControlOverrides.addDefaultOrderingField("id");
+ }
+
+ } else if (this.criteria.getOrderingFieldNames().isEmpty()) {
+ this.criteria.addSortId(PageOrdering.ASC);
+ }
}
/** Returns iterator for a single page of results as defined by
@@ -104,21 +124,31 @@ public class CriteriaQuery<T, C extends BaseCriteria>
implements Iterable<T> {
if (count == currentPage.getTotalSize()) {
throw new NoSuchElementException();
}
- deletable = null;//reset deletable.
+
+ deletable = null; // reset deletable.
+
//remove all flagged instances of T
if (!forDeletion.isEmpty()) {
currentPage.removeAll(forDeletion);
forDeletion.clear();
}
- PageControl pc = currentPage.getPageControl();
- criteria.setPaging(pc.getPageNumber() + 1, pc.getPageSize());
+ // advance the page. Although strange to be using a page control override
in conjunction with
+ // CriteriaQuery, nonetheless make sure we advance it if it exists,
because the normal setPaging is
+ // ignored when their is an overrides.
+ PageControl pcCurrent = currentPage.getPageControl();
+ PageControl pcOverrides = criteria.getPageControlOverrides();
+
+ if (null != pcOverrides) {
+ pcOverrides.setPageNumber(pcOverrides.getPageNumber() + 1);
+ } else {
+ criteria.setPaging(pcCurrent.getPageNumber() + 1,
pcCurrent.getPageSize());
+ }
+
//help out the GC.
currentPage.clear();
- //move the current pagelist forward one
currentPage = queryExecutor.execute(criteria);
- currentPage.setPageControl(new PageControl(pc.getPageNumber() + 1,
pc.getPageSize()));
iterator = currentPage.iterator();
}
commit ee7aabd4672dde076ed804fcb65c4b84f9d4c5b3
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Wed Feb 20 10:40:34 2013 -0500
small change to help out GC for large parses.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
index 82c4b21..5e30b87 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
@@ -113,6 +113,9 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements
Iterable<T> {
PageControl pc = currentPage.getPageControl();
criteria.setPaging(pc.getPageNumber() + 1, pc.getPageSize());
+ //help out the GC.
+ currentPage.clear();
+
//move the current pagelist forward one
currentPage = queryExecutor.execute(criteria);
currentPage.setPageControl(new PageControl(pc.getPageNumber() + 1,
pc.getPageSize()));
commit ed395405ae926481cf23b1f0d402a69463726ed7
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Wed Feb 20 10:26:02 2013 -0500
Fix issue with CriteriaQuery where no sorting was being applied resulting in dirty
reads for large parses.
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
index 6b93f7a..e746deb 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
@@ -237,9 +237,6 @@ public class ResourceStorageTest extends AbstractEJB3Test {
//verify that all resource objects are actually parsed.
Map<String, Object> resourceNames = new HashMap<String, Object>();
-
- ArrayList<Resource> allResources = new ArrayList<Resource>();
-
int resourceCount = 700; //assuming 200 per page at least 4 pages of results.
try {
@@ -275,8 +272,8 @@ public class ResourceStorageTest extends AbstractEJB3Test {
//query the results and delete the resources
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterName(prefix);
+ criteria.addSortName(PageOrdering.ASC);
criteria.setPaging(0, 47);
- // PageList<Resource> resources =
resourceManager.findResourcesByCriteria(subject, criteria);
//iterate over the results with CriteriaQuery
CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new
CriteriaQueryExecutor<Resource, ResourceCriteria>() {
@@ -292,12 +289,16 @@ public class ResourceStorageTest extends AbstractEJB3Test {
start = System.currentTimeMillis();
//iterate over the entire result set efficiently
+ ArrayList<String> alreadySeen = new ArrayList<String>();
+ int actualCount = 0;
for (Resource r : resources) {
- allResources.add(r);
+ actualCount++;
+ // System.out.println(actualCount + " @@@ " +
r.getId() + ":"
+ // +
((resourceNames.containsKey(String.valueOf(r.getId()))) ? "NEW" :
"DIRTY") + ":" + r.getName());
resourceNames.remove(String.valueOf(r.getId()));
}
- System.out.println("----------- Parsed " + resourceCount + "
resource(s) in "
+ System.out.println("----------- Parsed " + actualCount + "
resource(s) in "
+ (System.currentTimeMillis() - start)
+ " ms.");
commit e705b8b0d4f1013079d8370e172034e5985f22db
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Wed Feb 20 09:17:20 2013 -0500
Add delete support to CriteriaQuery during iteration process.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
index eb65599..82c4b21 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
@@ -20,6 +20,7 @@
*/
package org.rhq.enterprise.server.util;
+import java.util.ArrayList;
import java.util.Iterator;
import java.util.NoSuchElementException;
@@ -27,13 +28,13 @@ import org.rhq.core.domain.criteria.BaseCriteria;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
-/** This class provides a way to make PageList results easily iterable for 'for
each' loops
+/** This class provides a way to make PageList results easily iterable with 'for
each','while',etc. loops
* and importantly automatically handles iteration through all PageControl results.
This
* means that with a CriteriaQuery instance once can do:
*
* for (Resource entity : query) {
*
- * and automatically page through the results in PageControl.getPageSize(def. 200)
chunks.
+ * and automatically page through all of the results in PageControl.getPageSize(def. 200)
chunks.
*
* @author John Sanda
* @author Simeon Pinder
@@ -71,14 +72,18 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements
Iterable<T> {
// i)creates page sized chunks results
// ii)at the end of each pageList, moves the iterator to next page and continues
iteration
//
- //NOTE: Assumes criteria page iteration starts with page 0. If that is not the case
- private class QueryResultsIterator implements Iterator<T> {
+ //NOTE: Assumes criteria page iteration starts with page 0. Will continue to iterate
over N members.
+ protected class QueryResultsIterator implements Iterator<T> {
private int count;
private PageList<T> currentPage;
private Iterator<T> iterator;
+ private T deletable = null;
+
+ private ArrayList<T> forDeletion = new ArrayList<T>();
+
/**The first pageList returned by the criteria instance is where iteration
begins.
* @param firstPage
*/
@@ -99,6 +104,12 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements
Iterable<T> {
if (count == currentPage.getTotalSize()) {
throw new NoSuchElementException();
}
+ deletable = null;//reset deletable.
+ //remove all flagged instances of T
+ if (!forDeletion.isEmpty()) {
+ currentPage.removeAll(forDeletion);
+ forDeletion.clear();
+ }
PageControl pc = currentPage.getPageControl();
criteria.setPaging(pc.getPageNumber() + 1, pc.getPageSize());
@@ -109,22 +120,20 @@ public class CriteriaQuery<T, C extends BaseCriteria>
implements Iterable<T> {
}
T next = iterator.next();
+ deletable = next;
count++;
return next;
}
@Override
public void remove() {
- throw new UnsupportedOperationException("This iterator does not support
removal.");
- }
- }
-
- public PageList<T> loadAsList() {
- Iterator<T> iterator = iterator();
- PageList<T> list = new PageList<T>();
- while (iterator.hasNext()) {
- list.add(iterator.next());
+ if (deletable != null) {
+ forDeletion.add(deletable);
+ deletable = null;
+ } else {
+ throw new IllegalStateException(
+ "Not allowed to call remove() without calling next() just before
this call.");
+ }
}
- return list;
}
}
commit d6081f71933379e8d1455f7003eac5fcbaae5d1b
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 10:35:20 2013 -0500
Fix issue with conversion to CriteriaQuery usage.
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
index 9fd49a7..368f5d8 100644
---
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
+++
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
@@ -125,7 +125,8 @@ public class RepoScriptSourceProvider extends
BaseRhqSchemeScriptSourceProvider
CriteriaQuery<PackageAndLatestVersionComposite, PackageCriteria>
pvs = new CriteriaQuery<PackageAndLatestVersionComposite, PackageCriteria>(
pCrit, pQueryExecutor);
- if (!pvs.iterator().hasNext()) {
+ // if (!pvs.iterator().hasNext()) {
+ if (pvs.iterator().hasNext()) {
PackageAndLatestVersionComposite pv = pvs.iterator().next();
byte[] bytes =
repoManager.getPackageVersionBytes(rhqFacade.getSubject(), repo.getId(), pv
commit b22eeffcdaf0f5f37033705bd697faa0327d5076
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 06:05:15 2013 -0500
Removing earlier paging/CriteriaQuery changes as REST will be handling this
differently.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
index 6b4c4ba..032bf97 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
@@ -83,8 +83,6 @@ import org.rhq.enterprise.server.rest.domain.GroupRest;
import org.rhq.enterprise.server.rest.domain.Link;
import org.rhq.enterprise.server.rest.domain.MetricSchedule;
import org.rhq.enterprise.server.rest.domain.ResourceWithType;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Deal with group related things.
@@ -124,16 +122,7 @@ public class GroupHandlerBean extends AbstractRestBean {
criteria.addFilterName(q);
}
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<ResourceGroup, ResourceGroupCriteria> queryExecutor =
new CriteriaQueryExecutor<ResourceGroup, ResourceGroupCriteria>() {
- @Override
- public PageList<ResourceGroup> execute(ResourceGroupCriteria criteria)
{
- return resourceGroupManager.findResourceGroupsByCriteria(caller,
criteria);
- }
- };
-
- CriteriaQuery<ResourceGroup, ResourceGroupCriteria> groups = new
CriteriaQuery<ResourceGroup, ResourceGroupCriteria>(
- criteria, queryExecutor);
+ PageList<ResourceGroup> groups =
resourceGroupManager.findResourceGroupsByCriteria(caller, criteria);
List<GroupRest> list = new ArrayList<GroupRest>();
for (ResourceGroup group : groups) {
@@ -415,16 +404,7 @@ public class GroupHandlerBean extends AbstractRestBean {
criteria.addFilterName(q);
}
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<GroupDefinition, ResourceGroupDefinitionCriteria>
queryExecutor = new CriteriaQueryExecutor<GroupDefinition,
ResourceGroupDefinitionCriteria>() {
- @Override
- public PageList<GroupDefinition>
execute(ResourceGroupDefinitionCriteria criteria) {
- return definitionManager.findGroupDefinitionsByCriteria(caller,
criteria);
- }
- };
-
- CriteriaQuery<GroupDefinition, ResourceGroupDefinitionCriteria> gdlist =
new CriteriaQuery<GroupDefinition, ResourceGroupDefinitionCriteria>(
- criteria, queryExecutor);
+ PageList<GroupDefinition> gdlist =
definitionManager.findGroupDefinitionsByCriteria(caller, criteria);
List<GroupDefinitionRest> list = new
ArrayList<GroupDefinitionRest>();
for (GroupDefinition def: gdlist) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
index 2e8f99c..a94b81c 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
@@ -76,8 +76,6 @@ import org.rhq.enterprise.server.rest.domain.OperationDefinitionRest;
import org.rhq.enterprise.server.rest.domain.OperationHistoryRest;
import org.rhq.enterprise.server.rest.domain.OperationRest;
import org.rhq.enterprise.server.rest.domain.SimplePropDef;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Deal with operations
@@ -390,16 +388,7 @@ public class OperationsHandlerBean extends AbstractRestBean {
criteria.addSortEndTime(PageOrdering.DESC);
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<ResourceOperationHistory,
ResourceOperationHistoryCriteria> queryExecutor = new
CriteriaQueryExecutor<ResourceOperationHistory, ResourceOperationHistoryCriteria>()
{
- @Override
- public PageList<ResourceOperationHistory>
execute(ResourceOperationHistoryCriteria criteria) {
- return opsManager.findResourceOperationHistoriesByCriteria(caller,
criteria);
- }
- };
-
- CriteriaQuery<ResourceOperationHistory, ResourceOperationHistoryCriteria>
list = new CriteriaQuery<ResourceOperationHistory,
ResourceOperationHistoryCriteria>(
- criteria, queryExecutor);
+ PageList<ResourceOperationHistory> list =
opsManager.findResourceOperationHistoriesByCriteria(caller, criteria);
List<OperationHistoryRest> result = new
ArrayList<OperationHistoryRest>();
for (ResourceOperationHistory roh : list) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
index b748833..f518952 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
@@ -329,7 +329,6 @@ public class ResourceHandlerBean extends AbstractRestBean {
criteria.addFilterInterval(start,end);
criteria.addFilterResourceId(resourceId);
criteria.addSortStartTime(PageOrdering.DESC);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
List<Availability> points =
availMgr.findAvailabilityByCriteria(caller,criteria);
List<AvailabilityRest> ret = new
ArrayList<AvailabilityRest>(points.size());
@@ -524,7 +523,6 @@ public class ResourceHandlerBean extends AbstractRestBean {
public List<Link> getAlertsForResource(@ApiParam("Id of the resource to
query") @PathParam("id") int resourceId) {
AlertCriteria criteria = new AlertCriteria();
criteria.addFilterResourceIds(resourceId);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
List<Alert> alerts = alertManager.findAlertsByCriteria(caller, criteria);
List<Link> links = new ArrayList<Link>(alerts.size());
commit 9ba9f80aaa95d4f5ee3e209d26315d1cb70e12b8
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:43:55 2013 -0500
Remove any paging changes as REST will handle paging differently.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
index e550bd2..becb680 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
@@ -61,14 +61,11 @@ import org.rhq.core.domain.event.EventSource;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageControl;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.event.EventManagerLocal;
import org.rhq.enterprise.server.rest.domain.EventDefinitionRest;
import org.rhq.enterprise.server.rest.domain.EventRest;
import org.rhq.enterprise.server.rest.domain.EventSourceRest;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Handle event related things
@@ -308,16 +305,8 @@ public class EventHandlerBean extends AbstractRestBean {
private Response.ResponseBuilder getEventsAsBuilderForCriteria(HttpHeaders headers,
EventCriteria criteria) {
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<Event, EventCriteria> queryExecutor = new
CriteriaQueryExecutor<Event, EventCriteria>() {
- @Override
- public PageList<Event> execute(EventCriteria criteria) {
- return eventManager.findEventsByCriteria(caller, criteria);
- }
- };
-
- CriteriaQuery<Event, EventCriteria> eventList = new CriteriaQuery<Event,
EventCriteria>(criteria, queryExecutor);
- List<EventRest> restEvents = new ArrayList<EventRest>();
+ List<Event> eventList = eventManager.findEventsByCriteria(caller,
criteria);
+ List<EventRest> restEvents = new
ArrayList<EventRest>(eventList.size());
for (Event event : eventList) {
restEvents.add(convertEvent(event));
}
commit 2cb4c49448eeb7730ba064a2692929ddc45aa9c1
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:37:31 2013 -0500
Commenting out unused code. No need to execute the query if we don't process the
results.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 6521730..a1ff092 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -83,7 +83,6 @@ import
org.rhq.core.domain.criteria.GroupResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.PluginConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceConfigurationUpdateCriteria;
import org.rhq.core.domain.criteria.ResourceCriteria;
-import org.rhq.core.domain.criteria.ResourceGroupCriteria;
import org.rhq.core.domain.resource.Agent;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceError;
@@ -2625,12 +2624,12 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
}
} else if (tt == PropertyOptionsSource.TargetType.GROUP) {
- // for groups we need to talk to the group manager
- ResourceGroupCriteria criteria = new ResourceGroupCriteria();
- criteria.setSearchExpression(expression);
-
- //?? spinder 2-12-13: We don't do anything with the composite
results here?
- resourceGroupManager.findResourceGroupCompositesByCriteria(subject,
criteria);
+ // spinder 2-15-13: commenting out this code below as we don't appear
to be using any of it. Half done.
+ // // for groups we need to talk to the group manager
+ // ResourceGroupCriteria criteria = new
ResourceGroupCriteria();
+ // criteria.setSearchExpression(expression);
+ //
+ //
resourceGroupManager.findResourceGroupCompositesByCriteria(subject, criteria);
}
// TODO plugin and resourceType
}
commit bacb200a03eb9ac474a61bf10c9121fd56e4e13e
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:32:12 2013 -0500
Removing criteriaQuery usage here as paging needs to be handled by caller instead.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
index 239cf35..5d149a1 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
@@ -82,8 +82,6 @@ import org.rhq.enterprise.server.agentclient.AgentClient;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.plugin.pc.drift.DriftChangeSetSummary;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -180,24 +178,13 @@ public class JPADriftServerBean implements JPADriftServerLocal {
}
@Override
- public PageList<DriftComposite> findDriftCompositesByCriteria(final Subject
subject, DriftCriteria criteria) {
+ public PageList<DriftComposite> findDriftCompositesByCriteria(Subject subject,
DriftCriteria criteria) {
JPADriftCriteria jpaCriteria = (criteria instanceof JPADriftCriteria) ?
(JPADriftCriteria) criteria
: new JPADriftCriteria(criteria);
jpaCriteria.fetchChangeSet(true);
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<JPADrift, JPADriftCriteria> queryExecutor = new
CriteriaQueryExecutor<JPADrift, JPADriftCriteria>() {
- @Override
- public PageList<JPADrift> execute(JPADriftCriteria jpaCriteria) {
- return findDriftsByCriteria(subject, jpaCriteria);
- }
- };
-
- CriteriaQuery<JPADrift, JPADriftCriteria> drifts = new
CriteriaQuery<JPADrift, JPADriftCriteria>(jpaCriteria,
- queryExecutor);
-
+ PageList<JPADrift> drifts = findDriftsByCriteria(subject, jpaCriteria);
PageList<DriftComposite> result = new PageList<DriftComposite>();
for (JPADrift drift : drifts) {
JPADriftChangeSet changeSet = drift.getChangeSet();
commit 835f4a546bfdd626c9519e3a4c2b9245e2cfee1a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:25:30 2013 -0500
Remove this occurrence of CriteriaQuery usage.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index 68af1e7..f749c9c 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -111,8 +111,6 @@ import
org.rhq.enterprise.server.plugin.pc.content.PackageTypeBehavior;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -1595,26 +1593,17 @@ public class ContentManagerBean implements ContentManagerLocal,
ContentManagerRe
return runner.execute();
}
- public PageList<PackageAndLatestVersionComposite>
findPackagesWithLatestVersion(final Subject subject,
+ public PageList<PackageAndLatestVersionComposite>
findPackagesWithLatestVersion(Subject subject,
PackageCriteria criteria) {
if (criteria.getFilterRepoId() == null) {
throw new IllegalArgumentException("The criteria query has to have a
filter for a specific repo.");
}
criteria.fetchVersions(true);
+ PageList<Package> packages = findPackagesByCriteria(subject, criteria);
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<Package, PackageCriteria> queryExecutor = new
CriteriaQueryExecutor<Package, PackageCriteria>() {
- @Override
- public PageList<Package> execute(PackageCriteria criteria) {
- return findPackagesByCriteria(subject, criteria);
- }
- };
-
- CriteriaQuery<Package, PackageCriteria> packages = new
CriteriaQuery<Package, PackageCriteria>(criteria,
- queryExecutor);
-
- PageList<PackageAndLatestVersionComposite> ret = new
PageList<PackageAndLatestVersionComposite>();
+ PageList<PackageAndLatestVersionComposite> ret = new
PageList<PackageAndLatestVersionComposite>(
+ packages.getTotalSize(), packages.getPageControl());
for(Package p : packages) {
PackageVersion latest = repoManager.getLatestPackageVersion(subject,
p.getId(), criteria.getFilterRepoId());
commit f7146a6313337bfe23b9e0a52edb817b5df4e222
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:17:00 2013 -0500
Revert to just use clearPaging as CriteriaQuery usage not needed.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
index 711a653..a52c4c2 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
@@ -1,6 +1,6 @@
package org.rhq.enterprise.server.resource.metadata;
-import java.util.ArrayList;
+import java.util.List;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -12,11 +12,8 @@ import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertTemplateManagerLocal;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class AlertMetadataManagerBean implements AlertMetadataManagerLocal {
@@ -30,32 +27,21 @@ public class AlertMetadataManagerBean implements
AlertMetadataManagerLocal {
private AlertTemplateManagerLocal alertTemplateMgr;
@Override
- public void deleteAlertTemplates(final Subject subject, ResourceType resourceType) {
+ public void deleteAlertTemplates(Subject subject, ResourceType resourceType) {
log.debug("Deleting alert templates for " + resourceType);
AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
criteria.addFilterAlertTemplateResourceTypeId(resourceType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<AlertDefinition, AlertDefinitionCriteria>
queryExecutor = new CriteriaQueryExecutor<AlertDefinition,
AlertDefinitionCriteria>() {
- @Override
- public PageList<AlertDefinition> execute(AlertDefinitionCriteria
criteria) {
- return alertDefinitionMgr.findAlertDefinitionsByCriteria(subject,
criteria);
- }
- };
+ List<AlertDefinition> templates =
alertDefinitionMgr.findAlertDefinitionsByCriteria(subject, criteria);
- CriteriaQuery<AlertDefinition, AlertDefinitionCriteria> templates = new
CriteriaQuery<AlertDefinition, AlertDefinitionCriteria>(
- criteria, queryExecutor);
-
- ArrayList<Integer> templateIdList = new ArrayList<Integer>();
+ Integer[] templateIds = new Integer[templates.size()];
int i = 0;
for (AlertDefinition template : templates) {
- templateIdList.add(template.getId());
+ templateIds[i++] = template.getId();
}
- Integer[] templateIds = new Integer[templateIdList.size()];
- templateIds = templateIdList.toArray(templateIds);
-
// Alert definitions associated with individual resources and with groups
// are deleted as part of resource deletion. This commit adds support for
// templates which are alert definitions associated with the resource
commit 3f33214af914fb3411f0d297020347f275cfc95b
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 05:10:37 2013 -0500
Revert to only clearpaging updates here as CriteriaQuery usage is unnecessary.
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index 773176b..9b20aef 100644
---
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -74,8 +74,6 @@ import
org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerRemote;
import org.rhq.enterprise.server.operation.OperationManagerRemote;
import org.rhq.enterprise.server.resource.ResourceManagerRemote;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Implements a local object that exposes resource related data as
@@ -237,18 +235,9 @@ public class ResourceClientProxy {
private void initChildren() {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterParentResourceId(resourceId);
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new
CriteriaQueryExecutor<Resource, ResourceCriteria>() {
- @Override
- public PageList<Resource> execute(ResourceCriteria criteria) {
- return
remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
- remoteClient.getSubject(), criteria);
- }
- };
-
- CriteriaQuery<Resource, ResourceCriteria> childResources = new
CriteriaQuery<Resource, ResourceCriteria>(
- criteria, queryExecutor);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+ PageList<Resource> childResources =
remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
+ remoteClient.getSubject(), criteria);
for (Resource child : childResources) {
this.children.add(proxyFactory.getResource(child.getId()));
@@ -258,26 +247,14 @@ public class ResourceClientProxy {
private void initMeasurements() {
MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
criteria.addFilterResourceTypeId(resource.getResourceType().getId());
- //
criteria.addFilterResourceTypeName(resource.getResourceType().getName());
- // criteria.setStrict(true);
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria>
queryExecutor = new CriteriaQueryExecutor<MeasurementDefinition,
MeasurementDefinitionCriteria>() {
- @Override
- public PageList<MeasurementDefinition>
execute(MeasurementDefinitionCriteria criteria) {
- return remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
- .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(),
criteria);
- }
- };
-
- CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria>
measurementDefIterator = new CriteriaQuery<MeasurementDefinition,
MeasurementDefinitionCriteria>(
- criteria, queryExecutor);
+ //
criteria.addFilterResourceTypeName(resource.getResourceType().getName());
+ // criteria.setStrict(true);
- this.measurementDefinitions = new PageList<MeasurementDefinition>();
+ this.measurementDefinitions =
remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
+ .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
this.measurementMap = new HashMap<String, Measurement>();
- for (MeasurementDefinition def : measurementDefIterator) {
- this.measurementDefinitions.add(def);
+ for (MeasurementDefinition def : measurementDefinitions) {
Measurement m = new Measurement(def);
String name = def.getDisplayName().replaceAll("\\W",
"");
commit 8d55baaac5f93f222dd14383884fe8538d752cc5
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 18 04:52:36 2013 -0500
Remove CriteriaQuery usage as unnecessary here.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index e005121..13baa3c 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -126,8 +126,6 @@ import
org.rhq.enterprise.server.resource.disambiguation.DisambiguationUpdateStr
import org.rhq.enterprise.server.resource.disambiguation.Disambiguator;
import org.rhq.enterprise.server.resource.group.ResourceGroupDeleteException;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
-import org.rhq.enterprise.server.util.CriteriaQuery;
-import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.QueryUtility;
@@ -882,7 +880,7 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
return resourceLineage;
}
- public Map<Integer, String> getResourcesAncestry(final Subject subject,
Integer[] resourceIds,
+ public Map<Integer, String> getResourcesAncestry(Subject subject, Integer[]
resourceIds,
ResourceAncestryFormat format) {
Map<Integer, String> result = new HashMap<Integer,
String>(resourceIds.length);
@@ -890,20 +888,10 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
return result;
}
- final ResourceCriteria resourceCriteria = new ResourceCriteria();
+ ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterIds(resourceIds);
resourceCriteria.fetchResourceType(true);
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new
CriteriaQueryExecutor<Resource, ResourceCriteria>() {
- @Override
- public PageList<Resource> execute(ResourceCriteria criteria) {
- return findResourcesByCriteria(subject, resourceCriteria);
- }
- };
-
- CriteriaQuery<Resource, ResourceCriteria> resources = new
CriteriaQuery<Resource, ResourceCriteria>(
- resourceCriteria, queryExecutor);
+ List<Resource> resources = findResourcesByCriteria(subject,
resourceCriteria);
if (ResourceAncestryFormat.RAW == format) {
for (Resource resource : resources) {
@@ -925,36 +913,17 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
// In addition to the types of the result resources, get the types of their
ancestry
typesSet.addAll(getAncestryTypeIds(ancestries));
- final ResourceTypeCriteria resourceTypeCriteria = new ResourceTypeCriteria();
+ ResourceTypeCriteria resourceTypeCriteria = new ResourceTypeCriteria();
resourceTypeCriteria.addFilterIds(typesSet.toArray(new
Integer[typesSet.size()]));
-
- //Use CriteriaQuery to automatically chunk/page through criteria query results
- CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria> rtQueryExecutor
=
- new CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria>() {
- @Override
- public PageList<ResourceType> execute(ResourceTypeCriteria
criteria) {
- return typeManager.findResourceTypesByCriteria(subject,
resourceTypeCriteria);
- }
- };
-
- CriteriaQuery<ResourceType, ResourceTypeCriteria> types =
- new CriteriaQuery<ResourceType,
ResourceTypeCriteria>(resourceTypeCriteria, rtQueryExecutor);
+ List<ResourceType> types = typeManager.findResourceTypesByCriteria(subject,
resourceTypeCriteria);
for (Resource resource : resources) {
- String decodedAncestry = getDecodedAncestry(resource,
loadAsList(types.iterator()), format);
+ String decodedAncestry = getDecodedAncestry(resource, types, format);
result.put(resource.getId(), decodedAncestry);
}
return result;
}
- private List<ResourceType> loadAsList(Iterator<ResourceType> iterator) {
- PageList<ResourceType> list = new PageList<ResourceType>();
- while(iterator.hasNext()){
- list.add(iterator.next());
- }
- return list;
- }
-
/**
* Get the complete set of resource type Ids in the ancestries provided. This is
useful for
* being able to load all the types in advance of generating decoded values.
commit 1d2618a3e388ad46f390732bc5101fef67c94e8c
Merge: db38ce2 f7409c5
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Sun Feb 17 22:19:02 2013 -0500
Merge branch 'track_master' into spinder/criteriaUsage
Conflicts:
modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
commit db38ce2e7137d4507194ee296fbc51358b6719ed
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Sun Feb 17 22:10:41 2013 -0500
Add test to exercise CriteriaQuery iteration for large result sets.
diff --git
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
index d748109..6b93f7a 100644
---
a/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
+++
b/modules/enterprise/server/itests-2/src/test/java/org/rhq/enterprise/server/resource/test/ResourceStorageTest.java
@@ -18,9 +18,13 @@
*/
package org.rhq.enterprise.server.resource.test;
+import java.util.ArrayList;
+import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.Random;
+import javax.persistence.EntityManager;
import javax.persistence.Query;
import org.apache.commons.logging.Log;
@@ -28,11 +32,15 @@ import org.apache.commons.logging.LogFactory;
import org.testng.annotations.Test;
import org.rhq.core.domain.auth.Subject;
+import org.rhq.core.domain.authz.Permission;
+import org.rhq.core.domain.authz.Role;
+import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
+import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
import org.rhq.core.domain.util.OrderingField;
import org.rhq.core.domain.util.PageControl;
@@ -44,7 +52,10 @@ import org.rhq.enterprise.server.discovery.DiscoveryBossLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.test.AbstractEJB3Test;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
+import org.rhq.enterprise.server.util.SessionTestHelper;
public class ResourceStorageTest extends AbstractEJB3Test {
private Log log = LogFactory.getLog(ResourceStorageTest.class);
@@ -208,4 +219,94 @@ public class ResourceStorageTest extends AbstractEJB3Test {
Subject rhqadmin = subjectManager.loginUnauthenticated("rhqadmin");
System.out.println(rhqadmin);
}
+
+ /** Test creates a large number of resources and pages through them using
CriteriaQuery.
+ * NOTE: CriteriaQuery uses PageList instances underneath and are susceptible to
dirty
+ * read issues if the total number of resources being parsed is i)very large or
ii)processing
+ * each instance takes a significant amount of time. Ex. Begin parsing all resource
types,
+ * while plugin update is removing some of those same types.
+ *
+ * @throws Exception
+ */
+ @SuppressWarnings("unused")
+ @Test(groups = "integration.ejb3")
+ public void testParsingCriteriaQueryResults() throws Exception {
+ getTransactionManager().begin();
+ EntityManager entityMgr = getEntityManager();
+ final ResourceManagerLocal resourceManager = LookupUtil.getResourceManager();
+
+ //verify that all resource objects are actually parsed.
+ Map<String, Object> resourceNames = new HashMap<String, Object>();
+
+ ArrayList<Resource> allResources = new ArrayList<Resource>();
+
+ int resourceCount = 700; //assuming 200 per page at least 4 pages of results.
+
+ try {
+ final Subject subject = SessionTestHelper.createNewSubject(entityMgr,
"testSubject");
+
+ Role roleWithSubject = SessionTestHelper.createNewRoleForSubject(entityMgr,
subject, "role with subject");
+ roleWithSubject.addPermission(Permission.VIEW_RESOURCE);
+
+ ResourceGroup group =
SessionTestHelper.createNewCompatibleGroupForRole(entityMgr, roleWithSubject,
+ "accessible group");
+
+ String tuid = "" + new Random().nextInt();
+ //create large number of resources
+ String prefix = "largeResultSet-" + tuid + "-";
+ System.out.println("-------- Creating " + resourceCount
+ + " resource(s). This may take a while ....");
+
+ long start = System.currentTimeMillis();
+ for (int i = 0; i < resourceCount; i++) {
+ String name = prefix + i;
+ Resource r = SessionTestHelper.createNewResourceForGroup(entityMgr,
group, name);
+ //store away each resource name/key
+ resourceNames.put(String.valueOf(r.getId()), name);
+ }
+ entityMgr.flush();
+
+ System.out.println("----------- Created " + resourceCount + "
resource(s) in "
+ + (System.currentTimeMillis() - start)
+ + " ms.");
+
+ assert resourceNames.size() == resourceCount;//assert all resources
loaded/created
+
+ //query the results and delete the resources
+ ResourceCriteria criteria = new ResourceCriteria();
+ criteria.addFilterName(prefix);
+ criteria.setPaging(0, 47);
+ // PageList<Resource> resources =
resourceManager.findResourcesByCriteria(subject, criteria);
+
+ //iterate over the results with CriteriaQuery
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new
CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceManager.findResourcesByCriteria(subject, criteria);
+ }
+ };
+
+ //initiate first/(total depending on page size) request.
+ CriteriaQuery<Resource, ResourceCriteria> resources = new
CriteriaQuery<Resource, ResourceCriteria>(
+ criteria, queryExecutor);
+
+ start = System.currentTimeMillis();
+ //iterate over the entire result set efficiently
+ for (Resource r : resources) {
+ allResources.add(r);
+ resourceNames.remove(String.valueOf(r.getId()));
+ }
+
+ System.out.println("----------- Parsed " + resourceCount + "
resource(s) in "
+ + (System.currentTimeMillis() - start)
+ + " ms.");
+
+ //test that entire list parsed spanning multiple pages
+ assert resourceNames.size() == 0 : "Expected resourceNames to be empty.
Still " + resourceNames.size()
+ + " name(s).";
+
+ } finally {
+ getTransactionManager().rollback();
+ }
+ }
}
\ No newline at end of file
commit 42593fc93ee5fffe4c270b60fedcce0101a25e66
Author: Thomas Segismont <tsegismo(a)redhat.com>
Date: Thu Feb 14 18:23:36 2013 +0100
Fix JMX plugin test failure
diff --git a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
index b841a38..9757c7a 100644
--- a/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
+++ b/modules/plugins/jmx/src/test/java/org/rhq/plugins/jmx/test/JMXPluginTest.java
@@ -72,8 +72,6 @@ import org.rhq.plugins.jmx.util.JvmResourceKey;
* @author Greg Hinkle
* @author Ian Springer
*/
-// Disabled until we find a fix for Sigar getProcCredName issue
-@Test(enabled = false)
public class JMXPluginTest {
private static final int JMX_REMOTING_PORT1 = 9921;
@@ -95,8 +93,9 @@ public class JMXPluginTest {
this.testServerJvms.add(startTestServerJvm("-Dcom.sun.management.jmxremote.port="
+ JMX_REMOTING_PORT1,
"-Dcom.sun.management.jmxremote.ssl=false",
"-Dcom.sun.management.jmxremote.authenticate=false"));
- this.testServerJvms.add(startTestServerJvm("-D" +
JMXDiscoveryComponent.SYSPROP_RHQ_RESOURCE_KEY + "="
- + EXPLICIT_RESOURCE_KEY1));
+ // FIXME: Disabled until we find a fix for Sigar getProcCredName issue
+ // this.testServerJvms.add(startTestServerJvm("-D" +
JMXDiscoveryComponent.SYSPROP_RHQ_RESOURCE_KEY + "="
+ // + EXPLICIT_RESOURCE_KEY1));
this.testServerJvms.add(startTestServerJvm("-Dcom.sun.management.jmxremote.port="
+ JMX_REMOTING_PORT2,
"-Dcom.sun.management.jmxremote.ssl=false",
"-Dcom.sun.management.jmxremote.authenticate=false",
@@ -206,7 +205,8 @@ public class JMXPluginTest {
}
}
assert foundJmxRemotingServer : "JMX Remoting server not found.";
- assert foundExplicitKey1Server : "Explicit key server not found.";
+ // FIXME: Disabled until we find a fix for Sigar getProcCredName issue
+ //assert foundExplicitKey1Server : "Explicit key server not found.";
assert foundExplicitKey2Server : "JMX Remoting + explicit key server not
found.";
}
commit e7311690dd0c28a9d75b6b7a481291bcd13634db
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 13 20:09:02 2013 +0100
Fix the expectations of the JMock-based apache plugin integration tests
after the fixes in the inventory report processing that changed the workflow
slightly.
This should make the apache integration tests pass again.
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
index a7f6697..37d8433 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
@@ -117,7 +117,7 @@ public class FakeServerInventory {
InventoryReport inventoryReport = (InventoryReport)
invocation.getParameter(0);
for (Resource res : inventoryReport.getAddedRoots()) {
- Resource persisted = fakePersist(res, judge, new
HashSet<String>());
+ Resource persisted = fakePersist(res, requiredInventoryStatus,
new HashSet<String>());
if (res.getParentResource() == Resource.ROOT) {
platform = persisted;
@@ -333,7 +333,7 @@ public class FakeServerInventory {
}
}
- private Resource fakePersist(Resource agentSideResource, InventoryStatusJudge
statusJudge,
+ private Resource fakePersist(Resource agentSideResource, InventoryStatus
requiredInventoryStatus,
Set<String> inProgressUUIds) {
Resource persisted = resourceStore.get(agentSideResource.getUuid());
if (!inProgressUUIds.add(agentSideResource.getUuid())) {
commit 5c5706794ad060158ca832fcbd876dedb811d716
Author: Jirka Kremser <jkremser(a)redhat.com>
Date: Thu Feb 14 15:28:02 2013 +0100
[BZ 909157 - Operation parameters are not shown in schedule operation details.] If the
method refreshOperationParametersItem() is called when scheduling a new operation, the
existent parameters are not forget.
diff --git
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
index 0f54af0..8436c2ab 100644
---
a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
+++
b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/inventory/common/detail/operation/schedule/AbstractOperationScheduleDetailsView.java
@@ -355,7 +355,6 @@ public abstract class AbstractOperationScheduleDetailsView extends
this.operationParameters = (Configuration) record
.getAttributeAsObject(AbstractOperationScheduleDataSource.Field.PARAMETERS);
-
super.editExistingRecord(record);
}
@@ -426,11 +425,14 @@ public abstract class AbstractOperationScheduleDetailsView extends
private void refreshOperationParametersItem() {
String operationName = getSelectedOperationName();
String value;
- operationParameters = null; // reset params between dropdown selects
- // make sure we wipe out anything left by the previous op def
- for (Canvas child : this.operationParametersConfigurationHolder.getChildren()) {
- child.destroy();
+ if (isNewRecord()) { // BZ 909157: do it only for new schedule
+ operationParameters = null; // reset params between dropdown selects
+ // make sure we wipe out anything left by the previous op def
+ for (Canvas child :
this.operationParametersConfigurationHolder.getChildren()) {
+ child.destroy();
+ }
}
+
if (operationName == null) {
value = "<i>" +
MSG.view_operationScheduleDetails_fieldDefault_parameters() + "</i>";
this.operationParametersConfigurationHolder.hide();
@@ -453,8 +455,6 @@ public abstract class AbstractOperationScheduleDetailsView extends
ConfigurationTemplate defaultTemplate =
parametersDefinition.getDefaultTemplate();
this.operationParameters = (defaultTemplate != null) ?
defaultTemplate.createConfiguration()
: new Configuration();
- } else {
- this.operationParameters = new Configuration();
}
ConfigurationGWTServiceAsync configurationService =
GWTServiceLookup.getConfigurationService();
commit 56f8cf4ff1a4ef2c3aa7959d25487e57897778bb
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Thu Feb 14 09:22:47 2013 -0500
installer now provides a "--force" option - this lets you re-run the
installer even if you didn't set autoinstall.enabled=true
and it also lets you attempt another installation if a previous one failed in the
middle of its prior attempt.
diff --git
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
index 48defbc..b8a83fc 100644
---
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
+++
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/Installer.java
@@ -157,6 +157,7 @@ public class Installer {
usage.append("\t--host=<hostname>, -h: hostname where the app server
is running").append("\n");
usage.append("\t--port=<port>, -p: talk to the app server over this
management port").append("\n");
usage.append("\t--test, -t: test the validity of the server properties
(install not performed)").append("\n");
+ usage.append("\t--force, -f: force the installer to try to install
everything").append("\n");
usage.append("\t--listservers, -l: show list of known installed servers
(install not performed)").append("\n");
usage.append("\t--setupdb, -b: only perform database schema creation or
update").append("\n");
usage.append("\t--reconfig, -r: resets some configuration settings in an
installed server").append("\n");
@@ -166,7 +167,7 @@ public class Installer {
}
private WhatToDo[] processArguments(String[] args) throws Exception {
- String sopts = "-:HD:h:p:d:blrt";
+ String sopts = "-:HD:h:p:d:bflrt";
LongOpt[] lopts = { new LongOpt("help", LongOpt.NO_ARGUMENT, null,
'H'),
new LongOpt("host", LongOpt.REQUIRED_ARGUMENT, null, 'h'),
new LongOpt("port", LongOpt.REQUIRED_ARGUMENT, null, 'p'),
@@ -174,6 +175,7 @@ public class Installer {
new LongOpt("setupdb", LongOpt.NO_ARGUMENT, null, 'b'),
new LongOpt("listservers", LongOpt.NO_ARGUMENT, null,
'l'),
new LongOpt("reconfig", LongOpt.NO_ARGUMENT, null, 'r'),
+ new LongOpt("force", LongOpt.NO_ARGUMENT, null, 'f'),
new LongOpt("test", LongOpt.NO_ARGUMENT, null, 't') };
boolean test = false;
@@ -255,6 +257,11 @@ public class Installer {
break; // don't return, in case we need to allow more args
}
+ case 'f': {
+ this.installerConfig.setForceInstall(true);
+ break; // don't return, in case we need to allow more args
+ }
+
case 'l': {
listservers = true;
break; // don't return, we need to allow more args to be processed,
like -p or -h
diff --git
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java
index 0852b78..3adecbe 100644
---
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java
+++
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerConfiguration.java
@@ -28,6 +28,7 @@ package org.rhq.enterprise.server.installer;
public class InstallerConfiguration {
private String managementHost = "127.0.0.1";
private int managementPort = 9999; // this is the default AS port
+ private boolean forceInstall = false;
public InstallerConfiguration() {
}
@@ -59,4 +60,12 @@ public class InstallerConfiguration {
}
this.managementPort = port;
}
+
+ public boolean isForceInstall() {
+ return this.forceInstall;
+ }
+
+ public void setForceInstall(boolean flag) {
+ this.forceInstall = flag;
+ }
}
diff --git
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
index 3ece569..e72f133 100644
---
a/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
+++
b/modules/enterprise/server/installer/src/main/java/org/rhq/enterprise/server/installer/InstallerServiceImpl.java
@@ -86,7 +86,7 @@ public class InstallerServiceImpl implements InstallerService {
return;
}
if (allServerDetails.size() == 0) {
- log.info("There are no known servers currently registered");
+ log("There are no known servers currently registered");
return;
}
@@ -108,7 +108,7 @@ public class InstallerServiceImpl implements InstallerService {
info.append(serverDetails.getEndpointSecurePortString());
info.append("\n");
}
- log.info(info.toString());
+ log(info.toString());
return;
}
@@ -136,15 +136,21 @@ public class InstallerServiceImpl implements InstallerService {
ServerDetails detailsFromProps =
getServerDetailsFromPropertiesOnly(serverProperties);
ServerDetails detailsFromDb = getServerDetails(dbUrl, dbUsername,
clearTextDbPassword,
detailsFromProps.getName());
+ ExistingSchemaOption existingSchemaOption =
getAutoinstallExistingSchemaOption(serverProperties);
+
if (detailsFromDb == null) {
- log.info("This will be considered a new server: " +
detailsFromProps);
+ log("This will be considered a new server: " + detailsFromProps);
} else {
- log.info("This [" + detailsFromProps + "] will be considered a
reinstallation of an existing server ["
- + detailsFromDb + "]");
+ if (existingSchemaOption == ExistingSchemaOption.OVERWRITE) {
+ log("This [" + detailsFromProps + "] will OVERWRITE the
existing server [" + detailsFromDb
+ + "] that already exists in the database.");
+ } else {
+ log("This [" + detailsFromProps + "] will be considered a
reinstallation of an existing server ["
+ + detailsFromDb + "]");
+ }
}
// just warns if the schema will be overwritten
- ExistingSchemaOption existingSchemaOption =
getAutoinstallExistingSchemaOption(serverProperties);
if (existingSchemaOption == ExistingSchemaOption.OVERWRITE) {
log.warn("The installer has been configured to OVERWRITE any existing
data in the database. "
+ "If you do install with this configuration, realize that all
existing data in the database "
@@ -153,10 +159,10 @@ public class InstallerServiceImpl implements InstallerService {
// just logs the location of the AS instance where RHQ will be installed
String appServerHomeDir = getAppServerHomeDir();
- log.info("The app server where the installation will go is found at: "
+ appServerHomeDir);
+ log("The app server where the installation will go is found at: " +
appServerHomeDir);
// give some message to indicate everything looks OK and the user can start the
real install
- log.info("It looks like everything is OK and you can start the
installation.");
+ log("It looks like everything is OK and you can start the
installation.");
}
@Override
@@ -177,8 +183,12 @@ public class InstallerServiceImpl implements InstallerService {
if (autoInstallMode) {
log("The server is preconfigured and ready for auto-install.");
} else {
- throw new AutoInstallDisabledException(
- "Auto-installation is disabled. Please fully configure
rhq-server.properties");
+ if (this.installerConfiguration.isForceInstall()) {
+ log("Auto-installation would have been disabled, but installer was
asked to force the install... continuing.");
+ } else {
+ throw new AutoInstallDisabledException(
+ "Auto-installation is disabled. Please fully configure
rhq-server.properties");
+ }
}
// make an attempt to connect to the app server - we must make sure its running
and we can connect to it
@@ -189,11 +199,21 @@ public class InstallerServiceImpl implements InstallerService {
final String installationResults = getInstallationResults();
if (installationResults != null) {
if (installationResults.length() == 0) {
- throw new AlreadyInstalledException(
- "The installer has already been told to perform its work. The
server should be ready soon.");
+ if (this.installerConfiguration.isForceInstall()) {
+ log("The installer appears to have already been told to perform
its work, but the installer was asked for force the install... continuing.");
+ } else {
+ throw new AlreadyInstalledException(
+ "The installer has already been told to perform its work.
The server should be ready soon.");
+ }
} else {
- throw new Exception("The installer has already attempted to install
the server but errors occurred:\n"
- + installationResults);
+ if (this.installerConfiguration.isForceInstall()) {
+ log("The installer is going to force another installation
attempt, even though a previous attempt encountered errors:\n"
+ + installationResults);
+ } else {
+ throw new Exception(
+ "The installer has already attempted to install the server
but errors occurred:\n"
+ + installationResults);
+ }
}
}
@@ -225,8 +245,12 @@ public class InstallerServiceImpl implements InstallerService {
String existingSchemaOption) throws AutoInstallDisabledException,
AlreadyInstalledException, Exception {
if (isEarDeployed()) {
- throw new AlreadyInstalledException(
- "It looks like the installation has already been completed - there
is nothing for the installer to do.");
+ if (this.installerConfiguration.isForceInstall()) {
+ log("It looks like the installation has already been completed, but
the installer was asked for force the install... continuing.");
+ } else {
+ throw new AlreadyInstalledException(
+ "It looks like the installation has already been completed -
there is nothing for the installer to do.");
+ }
}
prepareDatabase(serverProperties, serverDetails, existingSchemaOption);
@@ -930,7 +954,8 @@ public class InstallerServiceImpl implements InstallerService {
// Not only do we want to make sure we can connect, but we also want to
wait for the subsystems to initialize.
// Let's wait for one of the subsystems to exist; once we know this
is up, the rest are probably ready too.
if (!(new WebJBossASClient(getModelControllerClient()).isWebSubsystem()))
{
- throw new IllegalStateException("The server does not appear to
be fully started yet");
+ throw new IllegalStateException(
+ "The server does not appear to be fully started yet (the web
subsystem did not start)");
}
return retVal;
@@ -1096,8 +1121,13 @@ public class InstallerServiceImpl implements InstallerService {
try {
mcc = getModelControllerClient();
CoreJBossASClient client = new CoreJBossASClient(mcc);
- log("Installing RHQ EAR startup subsystem extension");
- client.addExtension(RHQ_EXTENSION_NAME);
+ boolean isDeployed = client.isExtension(RHQ_EXTENSION_NAME);
+ if (!isDeployed) {
+ log("Installing RHQ EAR startup subsystem extension");
+ client.addExtension(RHQ_EXTENSION_NAME);
+ } else {
+ log("RHQ EAR startup subsystem extension is already
deployed");
+ }
} finally {
safeClose(mcc);
}
@@ -1108,8 +1138,13 @@ public class InstallerServiceImpl implements InstallerService {
try {
mcc = getModelControllerClient();
CoreJBossASClient client = new CoreJBossASClient(mcc);
- log("Installing RHQ EAR subsystem");
- client.addSubsystem(RHQ_SUBSYSTEM_NAME);
+ boolean isDeployed = client.isSubsystem(RHQ_SUBSYSTEM_NAME);
+ if (!isDeployed) {
+ log("Installing RHQ EAR subsystem");
+ client.addSubsystem(RHQ_SUBSYSTEM_NAME);
+ } else {
+ log("RHQ EAR subsystem is already deployed");
+ }
} finally {
safeClose(mcc);
}
commit 36316a5917684ae2bfe811c682a553e7b7149772
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Feb 14 15:04:35 2013 +0100
The apache integration tests are now resilient against apache servers running on the
target machine out of the test control. These will no longer affect the test results.
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
index 8bc25ca..a7f6697 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
@@ -59,6 +59,10 @@ import org.rhq.core.domain.resource.ResourceType;
*/
public class FakeServerInventory {
+ public interface InventoryStatusJudge {
+ InventoryStatus judge(Resource resource);
+ }
+
private Resource platform;
private Map<String, Resource> resourceStore = new HashMap<String,
Resource>();
private int counter;
@@ -77,6 +81,13 @@ public class FakeServerInventory {
}
};
+ private static final Comparator<Resource> RESOURCE_TYPE_AND_STATUS_COMPARATOR =
new Comparator<Resource>() {
+ public int compare(Resource o1, Resource o2) {
+ return o1.getResourceType().equals(o2.getResourceType())
+ && o1.getInventoryStatus() == o2.getInventoryStatus() ? 0 :
o1.getId() - o2.getId();
+ }
+ };
+
public FakeServerInventory() {
this(false);
}
@@ -86,14 +97,18 @@ public class FakeServerInventory {
}
public synchronized void prepopulateInventory(Resource platform,
Collection<Resource> topLevelServers) {
- this.platform = fakePersist(platform, InventoryStatus.COMMITTED, new
HashSet<String>());
+ this.platform = fakePersist(platform, getSimpleJudge(InventoryStatus.COMMITTED),
new HashSet<String>());
for (Resource res : topLevelServers) {
res.setParentResource(this.platform);
- fakePersist(res, InventoryStatus.COMMITTED, new HashSet<String>());
+ fakePersist(res, getSimpleJudge(InventoryStatus.COMMITTED), new
HashSet<String>());
}
}
public synchronized CustomAction mergeInventoryReport(final InventoryStatus
requiredInventoryStatus) {
+ return mergeInventoryReport(getSimpleJudge(requiredInventoryStatus));
+ }
+
+ public synchronized CustomAction mergeInventoryReport(final InventoryStatusJudge
judge) {
return new CustomAction("updateServerSideInventory") {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
@@ -102,7 +117,7 @@ public class FakeServerInventory {
InventoryReport inventoryReport = (InventoryReport)
invocation.getParameter(0);
for (Resource res : inventoryReport.getAddedRoots()) {
- Resource persisted = fakePersist(res, requiredInventoryStatus,
new HashSet<String>());
+ Resource persisted = fakePersist(res, judge, new
HashSet<String>());
if (res.getParentResource() == Resource.ROOT) {
platform = persisted;
@@ -265,6 +280,23 @@ public class FakeServerInventory {
}
@SuppressWarnings("serial")
+ public synchronized Set<Resource> findResourcesByTypeAndStatus(final
ResourceType type, final InventoryStatus status) {
+ Set<Resource> result = new HashSet<Resource>();
+ if (platform != null) {
+ findResources(platform, new Resource() {
+ public ResourceType getResourceType() {
+ return type;
+ }
+
+ public InventoryStatus getInventoryStatus() {
+ return status;
+ }
+ }, result, RESOURCE_TYPE_AND_STATUS_COMPARATOR);
+ }
+ return result;
+ }
+
+ @SuppressWarnings("serial")
private Set<Resource> getResources(Set<Integer> resourceIds, boolean
includeDescendants) {
//it is important to keep the hierarchical order of the resource in the returned
set
//so that plugin container can merge the resources from top to bottom.
@@ -301,7 +333,7 @@ public class FakeServerInventory {
}
}
- private Resource fakePersist(Resource agentSideResource, InventoryStatus
requiredInventoryStatus,
+ private Resource fakePersist(Resource agentSideResource, InventoryStatusJudge
statusJudge,
Set<String> inProgressUUIds) {
Resource persisted = resourceStore.get(agentSideResource.getUuid());
if (!inProgressUUIds.add(agentSideResource.getUuid())) {
@@ -316,6 +348,7 @@ public class FakeServerInventory {
persisted.setUuid(agentSideResource.getUuid());
resourceStore.put(persisted.getUuid(), persisted);
}
+
persisted.setAgent(agentSideResource.getAgent());
persisted.setCurrentAvailability(agentSideResource.getCurrentAvailability());
persisted.setDescription(agentSideResource.getDescription());
@@ -323,13 +356,15 @@ public class FakeServerInventory {
persisted.setPluginConfiguration(agentSideResource.getPluginConfiguration().clone());
persisted.setResourceConfiguration(agentSideResource.getResourceConfiguration().clone());
persisted.setVersion(agentSideResource.getVersion());
- persisted.setInventoryStatus(requiredInventoryStatus);
persisted.setResourceKey(agentSideResource.getResourceKey());
persisted.setResourceType(agentSideResource.getResourceType());
+ InventoryStatus status = statusJudge.judge(persisted);
+ persisted.setInventoryStatus(status);
+
Resource parent = agentSideResource.getParentResource();
if (parent != null && parent != Resource.ROOT) {
- parent = fakePersist(agentSideResource.getParentResource(),
requiredInventoryStatus,
+ parent = fakePersist(agentSideResource.getParentResource(), statusJudge,
inProgressUUIds);
persisted.setParentResource(parent);
parent.getChildResources().add(persisted);
@@ -340,7 +375,7 @@ public class FakeServerInventory {
//persist the children
Set<Resource> childResources = new LinkedHashSet<Resource>();
for (Resource child : agentSideResource.getChildResources()) {
- childResources.add(fakePersist(child, requiredInventoryStatus,
inProgressUUIds));
+ childResources.add(fakePersist(child, statusJudge, inProgressUUIds));
}
//now update the list with whatever the persisted resource contained in the past
//i.e. we prefer the current results from the agent but keep the children we used
to
@@ -398,6 +433,7 @@ public class FakeServerInventory {
children.add(syncChild);
}
+
getPrivateField(clazz, "childSyncInfos").set(ret, children);
return ret;
@@ -444,4 +480,14 @@ public class FakeServerInventory {
}
}
}
+
+ private InventoryStatusJudge getSimpleJudge(final InventoryStatus requiredStatus) {
+ return new InventoryStatusJudge() {
+
+ @Override
+ public InventoryStatus judge(Resource resource) {
+ return requiredStatus;
+ }
+ };
+ }
}
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java
index b1c8a24..85d5f52 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java
+++
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/augeas/AugeasReferenceLeakingTest.java
@@ -49,6 +49,7 @@ import org.rhq.core.pc.configuration.ConfigurationManager;
import org.rhq.core.pc.inventory.InventoryManager;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pc.upgrade.FakeServerInventory;
+import org.rhq.plugins.apache.ApacheServerComponent;
import org.rhq.plugins.apache.PluginLocation;
import org.rhq.plugins.apache.setup.ApacheTestConfiguration;
import org.rhq.plugins.apache.setup.ApacheTestSetup;
@@ -58,7 +59,7 @@ import org.rhq.test.pc.PluginContainerSetup;
import org.rhq.test.pc.PluginContainerTest;
/**
- *
+ *
*
* @author Lukas Krejci
*/
@@ -126,13 +127,13 @@ public class AugeasReferenceLeakingTest extends BMNGRunner {
configureApacheServerToUseAugeas();
PluginContainer pc = PluginContainer.getInstance();
- Resource platform = pc.getInventoryManager().getPlatform();
+ Resource apacheServer = findApacheServerResource().getResource();
for (int i = 0; i < configurationReadingInvocationCount; ++i) {
- checkConfigurationRecursively(platform, pc.getConfigurationManager());
+ checkApacheServerConfigurationRecursively(apacheServer,
pc.getConfigurationManager());
Thread.sleep(10000);
}
-
+
//wait a couple of seconds for the loadConfig calls to finish
Thread.sleep(60000);
} finally {
@@ -192,14 +193,14 @@ public class AugeasReferenceLeakingTest extends BMNGRunner {
}
}
- private void checkConfigurationRecursively(Resource resource, ConfigurationManager
cm)
+ private void checkApacheServerConfigurationRecursively(Resource resource,
ConfigurationManager cm)
throws PluginContainerException {
if (resource.getResourceType().getResourceConfigurationDefinition() != null) {
cm.loadResourceConfiguration(resource.getId());
}
for (Resource child : resource.getChildResources()) {
- checkConfigurationRecursively(child, cm);
+ checkApacheServerConfigurationRecursively(child, cm);
}
}
@@ -208,32 +209,36 @@ public class AugeasReferenceLeakingTest extends BMNGRunner {
InventoryManager im = PluginContainer.getInstance().getInventoryManager();
- ResourceContainer apacheServer =
findResource(resourceTypes.findByName("Apache HTTP Server"));
+ ResourceContainer apacheServer = findApacheServerResource();
Configuration config =
apacheServer.getResourceContext().getPluginConfiguration();
config.getSimple("augeasEnabled").setValue("yes");
im.updatePluginConfiguration(apacheServer.getResource().getId(), config);
-
+
//and run discovery so that the new resources can go into inventory
-
+
im.executeServiceScanImmediately();
}
- private ResourceContainer findResource(ResourceType resourceType) {
+ private ResourceContainer findApacheServerResource() throws Exception {
InventoryManager im = PluginContainer.getInstance().getInventoryManager();
+ ResourceTypes resourceTypes = new ResourceTypes(PluginLocation.APACHE_PLUGIN);
+ ResourceType apacheServerResourceType = resourceTypes.findByName("Apache
HTTP Server");
- return findResource(im, resourceType, im.getPlatform());
+ return findApacheServerResource(im, apacheServerResourceType, im.getPlatform());
}
- private ResourceContainer findResource(InventoryManager im, ResourceType rt, Resource
root) {
- if (root.getResourceType().equals(rt)) {
+ private ResourceContainer findApacheServerResource(InventoryManager im, ResourceType
rt, Resource root) {
+ if (root.getResourceType().equals(rt)
+ &&
root.getPluginConfiguration().getSimpleValue(ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT)
+ .equals(setup.getDeploymentConfig().serverRoot)) {
return im.getResourceContainer(root);
}
for (Resource child : root.getChildResources()) {
- ResourceContainer rc = findResource(im, rt, child);
+ ResourceContainer rc = findApacheServerResource(im, rt, child);
if (rc != null) {
return rc;
}
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
index 37e74d9..e0363af 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
+++
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
@@ -41,6 +41,7 @@ import org.rhq.core.domain.discovery.AvailabilityReport;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceError;
+import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.pc.ServerServices;
import org.rhq.core.pc.upgrade.FakeServerInventory;
import org.rhq.core.system.SystemInfoFactory;
@@ -257,9 +258,23 @@ public class ApacheTestSetup {
public void addDefaultExceptations(Expectations expectations) throws Exception {
ServerServices ss =
PluginContainerTest.getCurrentPluginContainerConfiguration().getServerServices();
+ //only import the apache servers we actually care about - we can't assume
another apache won't be present
+ //on the machine running the test...
+ final ResourceType serverResourceType =
apacheResourceTypes.findByName("Apache HTTP Server");
expectations.allowing(ss.getDiscoveryServerService()).mergeInventoryReport(
expectations.with(Expectations.any(InventoryReport.class)));
-
expectations.will(fakeInventory.mergeInventoryReport(InventoryStatus.COMMITTED));
+ expectations.will(fakeInventory.mergeInventoryReport(new
FakeServerInventory.InventoryStatusJudge() {
+ @Override
+ public InventoryStatus judge(Resource resource) {
+ if (serverResourceType.equals(resource.getResourceType())) {
+ return
deploymentConfig.serverRoot.equals(resource.getPluginConfiguration().getSimpleValue(
+ ApacheServerComponent.PLUGIN_CONFIG_PROP_SERVER_ROOT)) ?
InventoryStatus.COMMITTED
+ : InventoryStatus.IGNORED;
+ } else {
+ return InventoryStatus.COMMITTED;
+ }
+ }
+ }));
expectations.allowing(ss.getDiscoveryServerService()).upgradeResources(
expectations.with(Expectations.any(Set.class)));
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java
index aebea53..719a3dd 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java
+++
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/upgrade/UpgradeTestBase.java
@@ -42,6 +42,7 @@ import org.testng.annotations.BeforeClass;
import org.rhq.core.clientapi.agent.metadata.PluginMetadataParser;
import org.rhq.core.clientapi.descriptor.AgentPluginDescriptorUtil;
import org.rhq.core.clientapi.descriptor.plugin.PluginDescriptor;
+import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceError;
@@ -77,15 +78,15 @@ import org.rhq.test.pc.PluginContainerTest;
public class UpgradeTestBase extends PluginContainerTest {
private static final Log LOG = LogFactory.getLog(UpgradeTestBase.class);
-
+
public enum ResourceKeyFormat {
SNMP, RHQ3, RHQ4
};
-
+
protected static final String DEPLOYMENT_SIMPLE_WITH_RESOLVABLE_SERVERNAMES =
"simpleWithResolvableServerNames";
protected static final String DEPLOYMENT_SIMPLE_WITH_UNRESOLVABLE_SERVER_NAMES =
"simpleWithUnresolvableServerNames";
protected static final String DEPLOYMENT_SIMPLE_WITH_WILDCARD_LISTENS =
"simpleWithWildcardListens";
-
+
private ResourceTypes apacheResourceTypes;
protected Resource platform;
@@ -101,15 +102,15 @@ public class UpgradeTestBase extends PluginContainerTest {
apacheResourceTypes);
boolean testFailed = false;
try {
-
+
String[] configFiles =
Arrays.copyOf(testConfiguration.apacheConfigurationFiles,
testConfiguration.apacheConfigurationFiles.length + 1);
configFiles[testConfiguration.apacheConfigurationFiles.length] =
"/snmpd.conf";
-
+
setup.withInventoryFrom(testConfiguration.inventoryFile)
.withPlatformResource(platform).withDefaultExpectations().withDefaultOverrides(testConfiguration.defaultOverrides)
.withApacheSetup().withConfigurationFiles(configFiles)
.withServerRoot(testConfiguration.serverRoot).withExePath(testConfiguration.binPath);
-
+
testConfiguration.beforeTestSetup(setup);
LOG.debug("----------------------------------------------------------
Starting the upgrade test for: "
@@ -117,46 +118,46 @@ public class UpgradeTestBase extends PluginContainerTest {
LOG.debug("Deployment configuration: " +
setup.getDeploymentConfig());
setup.setup();
-
+
testConfiguration.beforePluginContainerStart(setup);
-
+
startConfiguredPluginContainer();
-
+
testConfiguration.beforeTests(setup);
-
+
//ok, now we should see the resources upgraded in the fake server inventory.
ResourceType serverResourceType = apacheResourceTypes.findByName("Apache
HTTP Server");
ResourceType vhostResourceType = apacheResourceTypes.findByName("Apache
Virtual Host");
-
- Set<Resource> servers =
setup.getFakeInventory().findResourcesByType(serverResourceType);
+
+ Set<Resource> servers =
setup.getFakeInventory().findResourcesByTypeAndStatus(serverResourceType,
InventoryStatus.COMMITTED);
assertEquals(servers.size(), 1, "There should be exactly one apache
server discovered.");
-
+
Resource server = servers.iterator().next();
-
+
String expectedResourceKey =
ApacheServerDiscoveryComponent.formatResourceKey(testConfiguration.serverRoot,
testConfiguration.serverRoot
+ "/conf/httpd.conf");
-
+
assertEquals(server.getResourceKey(), expectedResourceKey,
"The server resource key doesn't seem to be upgraded.");
-
- Set<Resource> vhosts =
setup.getFakeInventory().findResourcesByType(vhostResourceType);
-
+
+ Set<Resource> vhosts =
setup.getFakeInventory().findResourcesByTypeAndStatus(vhostResourceType,
InventoryStatus.COMMITTED);
+
String[] expectedRKs =
testConfiguration.getExpectedResourceKeysAfterUpgrade(setup);
-
+
assertEquals(vhosts.size(), expectedRKs.length, "Unexpected number of
vhosts discovered found");
-
+
List<String> expectedResourceKeys = Arrays.asList(expectedRKs);
-
+
for (Resource vhost : vhosts) {
assertTrue(expectedResourceKeys.contains(vhost.getResourceKey()),
"Unexpected virtual host resource key: '" +
vhost.getResourceKey() + "'. Only expecting " + expectedResourceKeys);
}
-
+
String[] expectedFailureRKs =
testConfiguration.getExpectedResourceKeysWithFailures(setup);
if (expectedFailureRKs != null && expectedFailureRKs.length > 0)
{
Set<Resource> failingResources = new HashSet<Resource>();
-
+
for(String rk : expectedFailureRKs) {
for(Resource r : vhosts) {
if (rk.equals(r.getResourceKey())) {
@@ -165,21 +166,21 @@ public class UpgradeTestBase extends PluginContainerTest {
}
}
}
-
+
assertEquals(failingResources.size(), expectedFailureRKs.length,
"Couldn't find all the resources that should have failed.");
-
+
for(Resource failingResource : failingResources) {
List<ResourceError> errors =
failingResource.getResourceErrors(ResourceErrorType.UPGRADE);
assertNotNull(errors, "The main vhost doesn't have any
upgrade errors.");
assertEquals(errors.size(), 1, "There should be exactly one
upgrade error on the main vhost.");
}
-
+
//check that all other vhosts were not upgraded but have no errors
for(Resource r : vhosts) {
if (failingResources.contains(r)) {
continue;
}
-
+
assertEquals(r.getResourceErrors(ResourceErrorType.UPGRADE).size(),
0, "Unexpected number of resource upgrade errors on vhost " + r);
}
} else {
@@ -213,31 +214,31 @@ public class UpgradeTestBase extends PluginContainerTest {
setup.withApacheSetup().init();
ApacheServerComponent component = setup.withApacheSetup().getServerComponent();
ApacheDirectiveTree config = component.parseRuntimeConfiguration(false);
-
+
DeploymentConfig deployConfig = setup.getDeploymentConfig();
-
+
VirtualHostLegacyResourceKeyUtil keyUtil = new
VirtualHostLegacyResourceKeyUtil(component, config);
-
+
Map<String, String> replacements = deployConfig.getTokenReplacements();
-
+
testConfig.defaultOverrides.put("main.rhq3.resource.key",
keyUtil.getRHQ3NonSNMPLegacyMainServerResourceKey());
-
- if (deployConfig.vhost1 != null) {
+
+ if (deployConfig.vhost1 != null) {
testConfig.defaultOverrides.put("vhost1.rhq3.resource.key",
keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost1.getVHostSpec(replacements)));
}
-
+
if (deployConfig.vhost2 != null) {
testConfig.defaultOverrides.put("vhost2.rhq3.resource.key",
keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost2.getVHostSpec(replacements)));
}
-
+
if (deployConfig.vhost3 != null) {
testConfig.defaultOverrides.put("vhost3.rhq3.resource.key",
keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost3.getVHostSpec(replacements)));
}
-
+
if (deployConfig.vhost4 != null) {
testConfig.defaultOverrides.put("vhost4.rhq3.resource.key",
keyUtil.getRHQ3NonSNMPLegacyVirtualHostResourceKey(deployConfig.vhost4.getVHostSpec(replacements)));
}
-
+
setup.withDefaultOverrides(testConfig.defaultOverrides);
}
@@ -248,13 +249,13 @@ public class UpgradeTestBase extends PluginContainerTest {
protected static String[] getVHostRKs(ApacheTestSetup setup, int[]
successfulUpgrades, int[] failedUpgrades, ResourceKeyFormat rkFormat) {
int sucLen = successfulUpgrades == null ? 0 : successfulUpgrades.length;
int failLen = failedUpgrades == null ? 0 : failedUpgrades.length;
-
+
String[] ret = new String[sucLen + failLen];
-
+
int retIdx = 0;
-
+
Map<String, String> replacements = setup.getInventoryFileReplacements();
-
+
for(int i = 0; i < sucLen; ++i, ++retIdx) {
int vhostNum = successfulUpgrades[i];
if (vhostNum == 0) {
@@ -264,7 +265,7 @@ public class UpgradeTestBase extends PluginContainerTest {
ret[retIdx] =
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(vhost.serverName,
vhost.hosts);
}
}
-
+
for(int i = 0; i < failLen; ++i, ++retIdx) {
String variableName = null;
if (failedUpgrades[i] == 0) {
@@ -280,7 +281,7 @@ public class UpgradeTestBase extends PluginContainerTest {
variableName = "vhost" + failedUpgrades[i] +
".rhq";
}
}
-
+
switch (rkFormat) {
case RHQ3:
variableName += "3.resource.key";
@@ -292,10 +293,10 @@ public class UpgradeTestBase extends PluginContainerTest {
variableName += "snmp.identifier";
break;
}
-
+
ret[retIdx] = replacements.get(variableName);
}
-
+
return ret;
}
@@ -305,7 +306,7 @@ public class UpgradeTestBase extends PluginContainerTest {
.toURL());
PluginMetadataParser parser = new PluginMetadataParser(descriptor,
Collections.<String, PluginMetadataParser> emptyMap());
-
+
List<ResourceType> platformTypes = parser.getAllTypes();
//this is the default container name in case of no plugin explicit plugin
configuration, which we don't have.
@@ -317,20 +318,20 @@ public class UpgradeTestBase extends PluginContainerTest {
}
Class discoveryClass = Class.forName(parser.getDiscoveryComponentClass(rt));
-
+
ResourceDiscoveryComponent discoveryComponent = (ResourceDiscoveryComponent)
discoveryClass.newInstance();
-
+
ResourceDiscoveryContext context = new ResourceDiscoveryContext(rt, null,
null,
SystemInfoFactory.createSystemInfo(), Collections.emptyList(),
Collections.emptyList(), containerName,
PluginContainerDeployment.AGENT);
-
+
Set<DiscoveredResourceDetails> results =
discoveryComponent.discoverResources(context);
-
+
if (!results.isEmpty()) {
DiscoveredResourceDetails details = results.iterator().next();
-
+
Resource platform = new Resource();
-
+
platform.setDescription(details.getResourceDescription());
platform.setResourceKey(details.getResourceKey());
platform.setName(details.getResourceName());
@@ -339,11 +340,11 @@ public class UpgradeTestBase extends PluginContainerTest {
platform.setResourceType(rt);
platform.setUuid(UUID.randomUUID().toString());
platform.setId(1);
-
+
return platform;
}
}
-
+
return null;
}
@@ -352,12 +353,12 @@ public class UpgradeTestBase extends PluginContainerTest {
if (prefix != null && !prefix.isEmpty()) {
bld.append(prefix).append(".");
}
-
+
bld.append(name);
-
+
return bld.toString();
}
-
+
protected static InetAddress determineLocalhost() {
try {
return InetAddress.getLocalHost();
commit 9b30d84de016542bad1f9490a9b24e93dce9c162
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Wed Feb 13 16:11:34 2013 -0500
append to the installer log so we don't lose any installer log messages when
rhq-installer.sh is run multiple times
diff --git a/modules/enterprise/server/installer/src/main/resources/logging.properties
b/modules/enterprise/server/installer/src/main/resources/logging.properties
index 6a48b2b..0affd97 100644
--- a/modules/enterprise/server/installer/src/main/resources/logging.properties
+++ b/modules/enterprise/server/installer/src/main/resources/logging.properties
@@ -16,8 +16,9 @@ handler.CONSOLE.formatter=PATTERN
# File handler configuration
handler.FILE=org.jboss.logmanager.handlers.FileHandler
handler.FILE.level=${rhq.server.installer.loglevel:DEBUG}
-handler.FILE.properties=autoFlush,fileName
+handler.FILE.properties=autoFlush,append,fileName
handler.FILE.autoFlush=true
+handler.FILE.append=true
handler.FILE.fileName=${rhq.server.installer.logdir:.}/rhq-installer.log
handler.FILE.formatter=PATTERN
commit d3465f9300f95680fda57fab996401870a39ffa6
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Wed Feb 13 20:09:02 2013 +0100
Fix the expectations of the JMock-based apache plugin integration tests
after the fixes in the inventory report processing that changed the workflow
slightly.
This should make the apache integration tests pass again.
diff --git
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
index 17beb1e..8bc25ca 100644
---
a/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
+++
b/modules/core/plugin-container/src/test/java/org/rhq/core/pc/upgrade/FakeServerInventory.java
@@ -26,6 +26,8 @@ package org.rhq.core.pc.upgrade;
import static org.testng.Assert.fail;
import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
import java.util.Comparator;
@@ -52,7 +54,7 @@ import org.rhq.core.domain.resource.ResourceType;
/**
* This class represents a server side database store of the inventory for the purposes
* of the ResourceUpgradeTest unit test.
- *
+ *
* @author Lukas Krejci
*/
public class FakeServerInventory {
@@ -62,7 +64,7 @@ public class FakeServerInventory {
private int counter;
private boolean failing;
private boolean failUpgrade;
-
+
private static final Comparator<Resource> ID_COMPARATOR = new
Comparator<Resource>() {
public int compare(Resource o1, Resource o2) {
return o1.getId() - o2.getId();
@@ -90,18 +92,18 @@ public class FakeServerInventory {
fakePersist(res, InventoryStatus.COMMITTED, new HashSet<String>());
}
}
-
+
public synchronized CustomAction mergeInventoryReport(final InventoryStatus
requiredInventoryStatus) {
return new CustomAction("updateServerSideInventory") {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
throwIfFailing();
-
+
InventoryReport inventoryReport = (InventoryReport)
invocation.getParameter(0);
-
+
for (Resource res : inventoryReport.getAddedRoots()) {
Resource persisted = fakePersist(res, requiredInventoryStatus,
new HashSet<String>());
-
+
if (res.getParentResource() == Resource.ROOT) {
platform = persisted;
}
@@ -117,9 +119,9 @@ public class FakeServerInventory {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
throwIfFailing();
-
+
platform = null;
-
+
return getSyncInfo();
}
}
@@ -131,36 +133,36 @@ public class FakeServerInventory {
public Object invoke(Invocation invocation) throws Throwable {
synchronized(FakeServerInventory.this) {
throwIfFailing();
-
+
ResourceError error = (ResourceError) invocation.getParameter(0);
-
+
Resource serverSideResource =
resourceStore.get(error.getResource().getUuid());
-
+
if (serverSideResource != null) {
List<ResourceError> currentErrors =
serverSideResource.getResourceErrors();
currentErrors.add(error);
}
-
+
return null;
}
}
};
}
-
+
public synchronized CustomAction upgradeResources() {
return new CustomAction("upgradeServerSideInventory") {
@SuppressWarnings({ "serial", "unchecked" })
public Object invoke(Invocation invocation) throws Throwable {
synchronized(FakeServerInventory.this) {
throwIfFailing();
-
+
if (failUpgrade) {
- throw new RuntimeException("Failing the upgrade
purposefully.");
+ throw new RuntimeException("Failing the upgrade
purposefully.");
}
-
+
Set<ResourceUpgradeRequest> requests =
(Set<ResourceUpgradeRequest>) invocation.getParameter(0);
Set<ResourceUpgradeResponse> responses = new
HashSet<ResourceUpgradeResponse>();
-
+
for (final ResourceUpgradeRequest request : requests) {
Resource resource = findResource(platform, new Resource() {
public int getId() {
@@ -174,18 +176,18 @@ public class FakeServerInventory {
if (request.getNewName() != null) {
resource.setName(request.getNewName());
}
-
+
if (request.getNewResourceKey() != null) {
resource.setResourceKey(request.getNewResourceKey());
}
-
+
if (request.getUpgradeErrorMessage() != null) {
ResourceError error = new ResourceError(resource,
ResourceErrorType.UPGRADE,
request.getUpgradeErrorMessage(),
request.getUpgradeErrorStackTrace(),
request.getTimestamp());
resource.getResourceErrors().add(error);
}
-
+
ResourceUpgradeResponse resp = new
ResourceUpgradeResponse();
resp.setResourceId(resource.getId());
resp.setUpgradedResourceName(resource.getName());
@@ -206,16 +208,33 @@ public class FakeServerInventory {
public Object invoke(Invocation invocation) throws Throwable {
synchronized (FakeServerInventory.this) {
throwIfFailing();
-
+
Set<Integer> resourceIds = (Set<Integer>)
invocation.getParameter(0);
boolean includeDescendants = (Boolean) invocation.getParameter(1);
-
+
return getResources(resourceIds, includeDescendants);
}
}
};
}
+ public synchronized CustomAction getResourcesAsList() {
+ return new CustomAction("getResourcesAsList") {
+ @Override
+ public Object invoke(Invocation invocation) throws Throwable {
+ synchronized(FakeServerInventory.this) {
+ throwIfFailing();
+
+ Integer[] resourceIds = (Integer[]) invocation.getParameter(0);
+
+ Set<Resource> resources = getResources(new
LinkedHashSet<Integer>(Arrays.asList(resourceIds)), false);
+
+ return new ArrayList<Resource>(resources);
+ }
+ }
+ };
+ }
+
public synchronized boolean isFailing() {
return failing;
}
@@ -227,11 +246,11 @@ public class FakeServerInventory {
public synchronized boolean isFailUpgrade() {
return failUpgrade;
}
-
+
public synchronized void setFailUpgrade(boolean failUpgrade) {
this.failUpgrade = failUpgrade;
}
-
+
@SuppressWarnings("serial")
public synchronized Set<Resource> findResourcesByType(final ResourceType type)
{
Set<Resource> result = new HashSet<Resource>();
@@ -281,7 +300,7 @@ public class FakeServerInventory {
removeResource(child);
}
}
-
+
private Resource fakePersist(Resource agentSideResource, InventoryStatus
requiredInventoryStatus,
Set<String> inProgressUUIds) {
Resource persisted = resourceStore.get(agentSideResource.getUuid());
@@ -327,9 +346,9 @@ public class FakeServerInventory {
//i.e. we prefer the current results from the agent but keep the children we used
to
//have in the past. This is the same behavior as the actual RHQ server has.
childResources.addAll(persisted.getChildResources());
-
+
persisted.setChildResources(childResources);
-
+
inProgressUUIds.remove(agentSideResource.getUuid());
return persisted;
diff --git
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
index 9f12166..37e74d9 100644
---
a/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
+++
b/modules/integration-tests/apache-plugin-test/src/test/java/org/rhq/plugins/apache/setup/ApacheTestSetup.java
@@ -74,14 +74,14 @@ public class ApacheTestSetup {
private Mockery context;
private ResourceTypes apacheResourceTypes;
private String testId;
-
+
public class ApacheSetup {
private String serverRoot;
private String exePath;
private Collection<String> configurationFiles;
private ApacheExecutionUtil execution;
private boolean deploy = true;
-
+
private ApacheSetup() {
}
@@ -162,16 +162,16 @@ public class ApacheTestSetup {
+ serverRootDir + "'.");
File logsDir = new File(serverRootDir, "logs");
-
+
assertTrue(logsDir.exists(), "The configured server root denotes a
directory that doesn't have a 'logs' subdirectory. This is
unexpected.");
-
+
File confDir = new File(serverRootDir, "conf");
assertTrue(confDir.exists(),
"The configured server root denotes a directory that doesn't
have a 'conf' subdirectory. This is unexpected.");
-
+
String confFilePath = confDir.getAbsolutePath() + File.separatorChar +
"httpd.conf";
-
+
String snmpHost = null;
int snmpPort = 0;
String pingUrl = null;
@@ -185,11 +185,11 @@ public class ApacheTestSetup {
new File(binDir, "envvars-std"));
ApacheDeploymentUtil.deployConfiguration(confDir, configurationFiles,
additionalFilesToProcess, deploymentConfig);
}
-
+
//ok, now try to find the ping URL. The best thing is to actually invoke
- //the same code the apache server discovery does.
+ //the same code the apache server discovery does.
ApacheDirectiveTree tree =
ApacheServerDiscoveryComponent.parseRuntimeConfiguration(confFilePath, null,
ApacheBinaryInfo.getInfo(exePath, SystemInfoFactory.createSystemInfo()));
-
+
//XXX this hardcodes apache2 as the only option we have...
HttpdAddressUtility.Address addrToUse =
HttpdAddressUtility.APACHE_2_x.getMainServerSampleAddress(tree, null, -1);
pingUrl = addrToUse.toString();
@@ -205,7 +205,7 @@ public class ApacheTestSetup {
}
private void doSetup() throws Exception {
- init();
+ init();
startApache();
}
@@ -228,12 +228,12 @@ public class ApacheTestSetup {
return this;
}
- public ApacheTestSetup withDefaultOverrides(Map<String, String>
defaultOverrides) {
+ public ApacheTestSetup withDefaultOverrides(Map<String, String>
defaultOverrides) {
this.defaultOverrides = defaultOverrides == null ? new HashMap<String,
String>() : defaultOverrides;
deploymentConfig =
ApacheDeploymentUtil.getDeploymentConfigurationFromSystemProperties(configurationName,
this.defaultOverrides);
return this;
}
-
+
public ApacheTestSetup withPlatformResource(Resource platform) {
this.platform = platform;
return this;
@@ -271,7 +271,7 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDiscoveryServerService()).setResourceError(expectations.with(Expectations.any(ResourceError.class)));
expectations.will(fakeInventory.setResourceError());
-
+
expectations.allowing(ss.getDiscoveryServerService()).mergeAvailabilityReport(
expectations.with(Expectations.any(AvailabilityReport.class)));
@@ -280,7 +280,7 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDiscoveryServerService()).clearResourceConfigError(
expectations.with(Expectations.any(int.class)));
-
+
expectations.allowing(ss.getDiscoveryServerService()).setResourceEnablement(
expectations.with(Expectations.any(int.class)),
expectations.with(Expectations.any(boolean.class)));
@@ -289,7 +289,10 @@ public class ApacheTestSetup {
expectations.allowing(ss.getDriftServerService()).getDriftDefinitions(expectations.with(Expectations.any(Set.class)));
expectations.will(Expectations.returnValue(Collections.emptyMap()));
-
+
+
expectations.allowing(ss.getDiscoveryServerService()).getResourcesAsList(expectations.with(Expectations.any(Integer[].class)));
+ expectations.will(fakeInventory.getResourcesAsList());
+
expectations.ignoring(ss.getBundleServerService());
expectations.ignoring(ss.getConfigurationServerService());
expectations.ignoring(ss.getContentServerService());
@@ -307,14 +310,14 @@ public class ApacheTestSetup {
public DeploymentConfig getDeploymentConfig() {
return deploymentConfig;
}
-
+
public ApacheTestSetup setup() throws Exception {
apacheSetup.doSetup();
- Map<String, String> replacements = deploymentConfig.getTokenReplacements();
+ Map<String, String> replacements =
deploymentConfig.getTokenReplacements();
replacements.put("server.root", apacheSetup.serverRoot);
replacements.put("exe.path", apacheSetup.exePath);
-
+
ApacheDeploymentUtil.addDefaultVariables(replacements, null);
HttpdAddressUtility addressUtility = apacheSetup.getServerComponent()
@@ -325,18 +328,18 @@ public class ApacheTestSetup {
addressUtility.getHttpdInternalMainServerAddressRepresentation(runtimeConfig).toString(false,
false));
replacements.put("main.rhq4.resource.key",
ApacheVirtualHostServiceComponent.MAIN_SERVER_RESOURCE_KEY);
-
+
VHostSpec vhost1 = deploymentConfig.vhost1 == null ? null :
deploymentConfig.vhost1.getVHostSpec(replacements);
VHostSpec vhost2 = deploymentConfig.vhost2 == null ? null :
deploymentConfig.vhost2.getVHostSpec(replacements);
VHostSpec vhost3 = deploymentConfig.vhost3 == null ? null :
deploymentConfig.vhost3.getVHostSpec(replacements);
VHostSpec vhost4 = deploymentConfig.vhost4 == null ? null :
deploymentConfig.vhost4.getVHostSpec(replacements);
-
+
if (vhost1 != null) {
replacements.put(
"vhost1.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig,
vhost1.hosts.get(0),
vhost1.serverName).toString(false, false));
-
+
replacements.put(
"vhost1.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -348,7 +351,7 @@ public class ApacheTestSetup {
"vhost2.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig,
vhost2.hosts.get(0),
vhost2.serverName).toString(false, false));
-
+
replacements.put(
"vhost2.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -360,7 +363,7 @@ public class ApacheTestSetup {
"vhost3.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig,
vhost3.hosts.get(0),
vhost3.serverName).toString(false, false));
-
+
replacements.put(
"vhost3.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -372,7 +375,7 @@ public class ApacheTestSetup {
"vhost4.snmp.identifier",
addressUtility.getHttpdInternalVirtualHostAddressRepresentation(runtimeConfig,
vhost4.hosts.get(0),
vhost4.serverName).toString(false, false));
-
+
replacements.put(
"vhost4.rhq4.resource.key",
ApacheVirtualHostServiceDiscoveryComponent.createResourceKey(
@@ -381,35 +384,35 @@ public class ApacheTestSetup {
//let the user override everything we just did
replacements.putAll(defaultOverrides);
-
+
inventoryFileReplacements = replacements;
-
+
if (inventoryFile != null) {
InputStream dataStream = getClass().getResourceAsStream(inventoryFile);
-
+
Reader rdr = new TokenReplacingReader(new InputStreamReader(dataStream),
replacements);
-
+
@SuppressWarnings("unchecked")
List<Resource> inventory = (List<Resource>) new
ObjectCollectionSerializer().deserialize(rdr);
-
- //fix up the parent relationships, because they might not be reconstructed
correctly by
+
+ //fix up the parent relationships, because they might not be reconstructed
correctly by
//JAXB - we're missing XmlID and XmlIDRef annotations in our model
fixupParent(null, inventory);
-
+
fakeInventory.prepopulateInventory(platform, inventory);
}
return this;
}
/**
- * After the setup, this returns all the variables used to update the tokens in the
inventory file.
- *
+ * After the setup, this returns all the variables used to update the tokens in the
inventory file.
+ *
* @return
*/
public Map<String, String> getInventoryFileReplacements() {
return inventoryFileReplacements;
}
-
+
private void fixupParent(Resource parent, Collection<Resource> children) {
for (Resource child : children) {
child.setParentResource(parent);
commit a23490d9053904f0e78cb5b0ce7c43a92b7c4f36
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 13 11:51:45 2013 -0500
Fix issues in mergeAvailabilityReport "repair code". This is code that
attempts to fix problems in the Availability records, if they somehow get
corrupted. In general, it doesn't execute. But if and when it did, it
wasn't repairing things as well as it could. This makes improvements.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
index 2946d40..0181d7a 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
@@ -591,52 +591,13 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
// availability reports only tell us the current state at the start time; end
time is ignored/must be null
reported.setEndTime(null);
- try {
- q.setParameter("resourceId", reported.getResource().getId());
- Availability latest = (Availability) q.getSingleResult();
- AvailabilityType latestType = latest.getAvailabilityType();
- AvailabilityType reportedType = reported.getAvailabilityType();
-
- // If the current avail is DISABLED, and this report is not trying to
re-enable the resource,
- // Then ignore the reported avail.
- if (AvailabilityType.DISABLED == latestType) {
- if (!(mergeInfo.isEnablementReport() &&
(AvailabilityType.UNKNOWN == reportedType))) {
- disabledAvailabilities.add(reported);
- continue;
- }
- }
-
- if (reported.getStartTime() >= latest.getStartTime()) {
- //log.info( "new avail (latest/reported)-->" + latest +
"/" + reported );
-
- // the new availability data is for a time after our last known state
change
- // we are run-length encoded, so only persist data if the
availability changed
- if (latest.getAvailabilityType() != reported.getAvailabilityType())
{
- entityManager.persist(reported);
- mergeInfo.incrementNumInserted();
-
- latest.setEndTime(reported.getStartTime());
- latest = entityManager.merge(latest);
-
- updateResourceAvailability(reported);
- }
-
- // our last known state was unknown, ask for a full report to ensure
we are in sync with agent
- if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) {
- mergeInfo.setAskForFullReport(true);
- }
- } else {
- //log.info( "past avail (latest/reported)==>" + latest +
"/" + reported );
+ // get the latest avail for the reported resource
+ q.setParameter("resourceId", reported.getResource().getId());
+ Availability latest = null;
- // The new data is for a time in the past, probably an agent sending
a report after
- // a network outage has been corrected but after we have already
backfilled.
- // We need to insert it into our past timeline.
- insertAvailability(reported);
- mergeInfo.incrementNumInserted();
+ try {
+ latest = (Availability) q.getSingleResult();
- // this is an unusual report - ask the agent for a full report so as
to ensure we are in sync with agent
- mergeInfo.setAskForFullReport(true);
- }
} catch (NoResultException nre) {
// This should not happen unless the Resource in the report is stale,
which can happen in certain
// sync scenarios. A Resource is given its initial
Availability/ResourceAvailability when it is
@@ -644,37 +605,47 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
// it must not exist in my utopian view of the world. Let's just make
sure...
Resource attachedResource = (Resource) entityManager.find(Resource.class,
reported.getResource()
.getId());
- if (null == attachedResource) {
+
+ if ((null == attachedResource) || (InventoryStatus.COMMITTED !=
attachedResource.getInventoryStatus())) {
// expected case
log.info("Skipping mergeAvailabilityReport() for stale resource
[" + reported.getResource()
+ "]. These messages should go away after the next agent
synchronization with the server.");
- } else if (InventoryStatus.COMMITTED ==
attachedResource.getInventoryStatus()) {
- // this should not happen, it means the resource exists but has no
latest Availability
- // record (i.e. sendTime == null). Try to correct the situation.
+ continue;
+
+ } else {
+ // this should not really happen but is possible in rare failure
situations, it means the resource
+ // exists but has no latest Availability record (i.e. sendTime ==
null). Correct the situation and
+ // then process the reported avail.
log.warn("Resource [" + reported.getResource()
+ "] has no latest availability record (i.e. no endtime) -
will attempt to repair.\n"
+ mergeInfo.toString(false));
+
try {
List<Availability> attachedAvails =
attachedResource.getAvailability();
+ Availability attachedLastAvail = null;
+
if (attachedAvails.isEmpty()) {
- attachedResource.initCurrentAvailability();
- entityManager.merge(attachedResource);
+ latest = new Availability(attachedResource, 0L,
AvailabilityType.UNKNOWN);
+ entityManager.persist(latest);
} else {
- Availability attachedLastAvail =
attachedAvails.get(attachedAvails.size() - 1);
- attachedLastAvail.setEndTime(null);
- entityManager.merge(attachedLastAvail);
+ latest = attachedAvails.get(attachedAvails.size() - 1);
+ latest.setEndTime(null);
+ latest = entityManager.merge(latest);
}
+ updateResourceAvailability(latest);
+
// ask the agent for a full report so as to ensure we are in sync
with agent
mergeInfo.setAskForFullReport(true);
} catch (Throwable t) {
- log.warn("Unable to repair latest availablity for Resource
[" + reported.getResource() + "]", t);
+ log.warn("Unable to repair NoResult latest availablity for
Resource [" + reported.getResource()
+ + "]", t);
+ continue;
}
}
-
} catch (NonUniqueResultException nure) {
// This condition should never happen. In my world of la-la land,
I've done everything
// correctly so this never happens. But, due to the asynchronous nature
of things,
@@ -686,15 +657,69 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
log.warn("Resource [" + reported.getResource() + "] has
multiple availabilities without an endtime ["
+ nure.getMessage() + "] - will attempt to remove the extra
ones\n" + mergeInfo.toString(false));
- q.setParameter("resourceId", reported.getResource().getId());
- List<Availability> latest = q.getResultList();
+ try {
+
+ List<Availability> latestList = q.getResultList();
+
+ // delete all but the last one (our query sorts in ASC start time
order)
+ int latestCount = latestList.size();
+ for (int i = 0; i < (latestCount - 1); i++) {
+ entityManager.remove(latestList.get(i));
+ }
+
+ latest = latestList.get(latestCount - 1);
+ updateResourceAvailability(latest);
+
+ // this is an unusual report - ask the agent for a full report so as
to ensure we are in sync with agent
+ mergeInfo.setAskForFullReport(true);
+
+ } catch (Throwable t) {
+ log.warn(
+ "Unable to repair NonUnique Result latest availablity for
Resource [" + reported.getResource()
+ + "]", t);
+ continue;
+ }
+ }
+
+ AvailabilityType latestType = latest.getAvailabilityType();
+ AvailabilityType reportedType = reported.getAvailabilityType();
- // delete all but the last one (our query sorts in ASC start time order)
- int latestCount = latest.size();
- for (int i = 0; i < (latestCount - 1); i++) {
- entityManager.remove(latest.get(i));
+ // If the current avail is DISABLED, and this report is not trying to
re-enable the resource,
+ // Then ignore the reported avail.
+ if (AvailabilityType.DISABLED == latestType) {
+ if (!(mergeInfo.isEnablementReport() && (AvailabilityType.UNKNOWN
== reportedType))) {
+ disabledAvailabilities.add(reported);
+ continue;
}
- updateResourceAvailability(latest.get(latestCount - 1));
+ }
+
+ if (reported.getStartTime() >= latest.getStartTime()) {
+ //log.info( "new avail (latest/reported)-->" + latest +
"/" + reported );
+
+ // the new availability data is for a time after our last known state
change
+ // we are run-length encoded, so only persist data if the availability
changed
+ if (latest.getAvailabilityType() != reported.getAvailabilityType()) {
+ entityManager.persist(reported);
+ mergeInfo.incrementNumInserted();
+
+ latest.setEndTime(reported.getStartTime());
+ latest = entityManager.merge(latest);
+
+ updateResourceAvailability(reported);
+ }
+
+ // our last known state was unknown, ask for a full report to ensure we
are in sync with agent
+ if (latest.getAvailabilityType() == AvailabilityType.UNKNOWN) {
+ mergeInfo.setAskForFullReport(true);
+ }
+ } else {
+ //log.info( "past avail (latest/reported)==>" + latest +
"/" + reported );
+
+ // The new data is for a time in the past, probably an agent sending a
report after
+ // a network outage has been corrected but after we have already
backfilled.
+ // We need to insert it into our past timeline.
+ insertAvailability(reported);
+ mergeInfo.incrementNumInserted();
// this is an unusual report - ask the agent for a full report so as to
ensure we are in sync with agent
mergeInfo.setAskForFullReport(true);
commit 9c6886bf1be548b195ac14e81c76805b988c149a
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Wed Feb 13 09:22:40 2013 -0500
Fix test given slight change in avail behavior. In commit
c516ad09fcebcedfd1a505d6bfd434997ac6642d
we stopped kicking off an immediate avail scan when new resources were discovered,
simplifying the code, and approach, to just wait for the next scheduled scan,
which likely occurs nearly as fast. From the test's perspective this meant one
resource, the platform, had its avail change at a slightly different time.
diff --git
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
index 005e900..956fb97 100644
---
a/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
+++
b/modules/core/plugin-container-itest/src/test/java/org/rhq/core/pc/avail/AvailTest.java
@@ -24,13 +24,13 @@ import org.rhq.core.domain.measurement.AvailabilityType;
import org.rhq.core.domain.measurement.MeasurementScheduleRequest;
import org.rhq.core.domain.resource.InventoryStatus;
import org.rhq.core.pc.PluginContainer;
-import org.rhq.plugins.test.avail.AvailDiscoveryComponent;
-import org.rhq.plugins.test.avail.AvailResourceComponent;
import org.rhq.core.pc.inventory.AvailabilityExecutor;
import org.rhq.core.pc.inventory.AvailabilityExecutor.Scan;
import org.rhq.core.pc.inventory.ForceAvailabilityExecutor;
import org.rhq.core.pc.inventory.ResourceContainer;
import org.rhq.core.pluginapi.inventory.ResourceComponent;
+import org.rhq.plugins.test.avail.AvailDiscoveryComponent;
+import org.rhq.plugins.test.avail.AvailResourceComponent;
import org.rhq.test.arquillian.AfterDiscovery;
import org.rhq.test.arquillian.BeforeDiscovery;
import org.rhq.test.arquillian.FakeServerInventory;
@@ -184,7 +184,7 @@ public class AvailTest extends Arquillian {
Assert.assertEquals(datum.getAvailabilityType(), AvailabilityType.UP,
"should be UP at the start");
}
AvailabilityExecutor.Scan scan = executor.getMostRecentScanHistory();
- assertScan(scan, true, true, 29, 28, 29, 28, 0, 0);
+ assertScan(scan, true, true, 29, 29, 29, 28, 0, 0);
// do a forced avail check again - nothing changed, so we should have an empty
report
report = executor.call();
@@ -514,7 +514,7 @@ public class AvailTest extends Arquillian {
Assert.assertEquals(scan.getNumResources(), numResources,
"Unexpected numResources, remember to include the implied
platform?");
Assert.assertEquals(scan.getNumAvailabilityChanges(), numChanges,
- "Unexpected numChanges, remember to omit the implied platform");
+ "Unexpected numChanges, remember to include the implied
platform");
Assert.assertEquals(scan.getNumGetAvailabilityCalls(), numCalls,
"Unexpected numGetAvailCalls, remember to include the implied
platform");
Assert.assertEquals(scan.getNumScheduledRandomly(), numSched,
commit 1b1e78f7a8c6a364d563a9bae4ea73116e5381c1
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Feb 12 17:20:00 2013 -0500
To maintain the test dep ordering, which is sometimes important, and definitel
is important here, move all of the test deps to the new test.dependencies profile.
diff --git a/modules/enterprise/server/itests-2/pom.xml
b/modules/enterprise/server/itests-2/pom.xml
index d5daa17..5961627 100644
--- a/modules/enterprise/server/itests-2/pom.xml
+++ b/modules/enterprise/server/itests-2/pom.xml
@@ -35,144 +35,7 @@
</properties>
<dependencies>
- <!--================ Test Deps ================ -->
-
- <!-- Note, the test dep ordering can be important. Maven orders the [test]
classpath in the order listed in the pom. -->
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-dist</artifactId>
- <type>zip</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.spec</groupId>
- <artifactId>jboss-javaee-6.0</artifactId>
- <version>${jboss.javaee6.spec.version}</version>
- <scope>provided</scope>
- <type>pom</type>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.testng</groupId>
- <artifactId>arquillian-testng-container</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.shrinkwrap.resolver</groupId>
- <artifactId>shrinkwrap-resolver-depchain</artifactId>
- <type>pom</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.arquillian.protocol</groupId>
- <artifactId>arquillian-protocol-servlet</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-arquillian-suite-extension</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-enterprise-server</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-script-bindings</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>rhq-server-client-api</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-serverplugin-drift</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq</groupId>
- <artifactId>test-utils</artifactId>
- <version>${project.version}</version>
- <exclusions>
- <exclusion>
- <groupId>org.testng</groupId>
- <artifactId>testng</artifactId>
- </exclusion>
- </exclusions>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.rhq.helpers</groupId>
- <artifactId>perftest-support</artifactId>
- <version>${project.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.hibernate</groupId>
- <artifactId>hibernate-entitymanager</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-module-testng</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.powermock</groupId>
- <artifactId>powermock-api-mockito</artifactId>
- <version>${powermock.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.opensymphony.quartz</groupId>
- <artifactId>quartz</artifactId>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.liquibase</groupId>
- <artifactId>liquibase-core</artifactId>
- <version>${liquibase.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>joda-time</groupId>
- <artifactId>joda-time</artifactId>
- <version>2.1</version>
- <scope>test</scope>
- </dependency>
+ <!-- see the test.dependencies profile below -->
</dependencies>
<build>
@@ -669,46 +532,183 @@
<profiles>
- <profile>
- <!--
- This profile has been created to avoid unnecessary resolution of test
dependencies during a build that
- does not run, compile or need tests.
- More test dependencies are to be moved here if the set of sub-dependencies is
complex, references project
- test jars, or conflicts with changing the container version.
- -->
- <id>test.dependencies</id>
- <activation>
- <property>
- <name>maven.test.skip</name>
- <value>!true</value>
- </property>
- </activation>
-
- <dependencies>
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-core-client-api</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>org.jboss.as</groupId>
- <artifactId>jboss-as-arquillian-container-managed</artifactId>
- <version>${jboss.version}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>${project.groupId}</groupId>
- <artifactId>rhq-core-domain</artifactId>
- <version>${project.version}</version>
- <type>test-jar</type>
- <scope>test</scope>
- </dependency>
- </dependencies>
- </profile>
+ <profile>
+ <!-- This profile has been created to avoid unnecessary resolution of test
dependencies during a build that does not
+ run, compile or need tests. There are product build dependencies on this profile,
don't remove. -->
+
+ <id>test.dependencies</id>
+ <activation>
+ <property>
+ <name>maven.test.skip</name>
+ <value>!true</value>
+ </property>
+ </activation>
+
+
+ <dependencies>
+ <!-- Note, the test dep ordering can be important. Maven orders the [test]
classpath in the order listed in the pom. -->
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-dist</artifactId>
+ <type>zip</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.spec</groupId>
+ <artifactId>jboss-javaee-6.0</artifactId>
+ <version>${jboss.javaee6.spec.version}</version>
+ <scope>provided</scope>
+ <type>pom</type>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-arquillian-container-managed</artifactId>
+ <version>${jboss.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.testng</groupId>
+ <artifactId>arquillian-testng-container</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.shrinkwrap.resolver</groupId>
+ <artifactId>shrinkwrap-resolver-depchain</artifactId>
+ <type>pom</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.jboss.arquillian.protocol</groupId>
+ <artifactId>arquillian-protocol-servlet</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-arquillian-suite-extension</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-domain</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-enterprise-server</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-script-bindings</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>rhq-server-client-api</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-serverplugin-drift</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>${project.groupId}</groupId>
+ <artifactId>rhq-core-client-api</artifactId>
+ <version>${project.version}</version>
+ <type>test-jar</type>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq</groupId>
+ <artifactId>test-utils</artifactId>
+ <version>${project.version}</version>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ </exclusions>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.rhq.helpers</groupId>
+ <artifactId>perftest-support</artifactId>
+ <version>${project.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-entitymanager</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-module-testng</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.powermock</groupId>
+ <artifactId>powermock-api-mockito</artifactId>
+ <version>${powermock.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.opensymphony.quartz</groupId>
+ <artifactId>quartz</artifactId>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.liquibase</groupId>
+ <artifactId>liquibase-core</artifactId>
+ <version>${liquibase.version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>joda-time</groupId>
+ <artifactId>joda-time</artifactId>
+ <version>2.1</version>
+ <scope>test</scope>
+ </dependency>
+
+ </dependencies>
+ </profile>
<!-- If testing against oracle, override the default property settings -->
<profile>
commit 1c247adee91e2d82a2dd28905345067efa546a85
Author: Jay Shaughnessy <jshaughn(a)redhat.com>
Date: Tue Feb 12 15:48:32 2013 -0500
Fix a transactioning issue with agent backfill. It was possible for the Agent to
be marked backfilled in one transaction yet have the actual avail changes fail
in a second transaction, leaving the dead agent and its children with UP avail
and no longer eligible for backfill due to the flag being set.
Additionally, avoid large transactions if many agents need to be backfilled
sumultaneously.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
index 29c3ad3..d01dbd0 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerBean.java
@@ -192,7 +192,7 @@ public class AgentManagerBean implements AgentManagerLocal {
server_bootstrap.removeDownedAgent(downedAgent.getRemoteEndpoint());
log.info("Agent with name [" + agentName + "] just went
down");
- agentManager.backfillAgent(subjectManager.getOverlord(), agentName,
downedAgent.getId());
+ agentManager.backfillAgentInNewTransaction(subjectManager.getOverlord(),
agentName, downedAgent.getId());
return;
}
@@ -272,7 +272,8 @@ public class AgentManagerBean implements AgentManagerLocal {
log.info("Have not heard from agent [" + record.getAgentName()
+ "] since ["
+ new Date(record.getLastAvailabilityPing()) + "]. Will be
backfilled since we suspect it is down");
- agentManager.backfillAgent(subjectManager.getOverlord(),
record.getAgentName(), record.getAgentId());
+ agentManager.backfillAgentInNewTransaction(subjectManager.getOverlord(),
record.getAgentName(),
+ record.getAgentId());
}
}
@@ -281,7 +282,8 @@ public class AgentManagerBean implements AgentManagerLocal {
return;
}
- public void backfillAgent(Subject subject, String agentName, int agentId) {
+ @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
+ public void backfillAgentInNewTransaction(Subject subject, String agentName, int
agentId) {
// make sure we lock out all processing of any availability reports that might
come our way to avoid concurrency
// problems
AvailabilityReportSerializer.getSingleton().lock(agentName);
@@ -299,7 +301,6 @@ public class AgentManagerBean implements AgentManagerLocal {
}
}
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void setAgentBackfilled(int agentId, boolean backfilled) {
Query query = entityManager.createNamedQuery(Agent.QUERY_SET_AGENT_BACKFILLED);
query.setParameter("agentId", agentId);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
index 6cb50f2..842d5d8 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/core/AgentManagerLocal.java
@@ -45,15 +45,16 @@ import org.rhq.enterprise.server.agentclient.AgentClient;
public interface AgentManagerLocal {
/**
- * Call this method to set the agent down and mark it 'backfilled'. Also,
sets all of its monitored resources
- * to an UNKNOWN avail state since the agent is no longer reporting availability.
+ * Call this method to set the agent DOWN and mark it 'backfilled'. Also,
sets all of its monitored resources
+ * to an UNKNOWN avail state since the agent is no longer reporting availability.
Done in its own transaction to
+ * avoid large transactions if many agents are simultaneously backfilled.
*
* @param subject
* @param agentName
* @param agentId
*/
// This method should not be remoted.
- void backfillAgent(Subject subject, String agentName, int agentId);
+ void backfillAgentInNewTransaction(Subject subject, String agentName, int agentId);
/**
* Persists a new agent.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
index d92cbc4..2946d40 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/AvailabilityManagerBean.java
@@ -749,7 +749,6 @@ public class AvailabilityManagerBean implements
AvailabilityManagerLocal, Availa
}
@SuppressWarnings("unchecked")
- @TransactionAttribute(TransactionAttributeType.REQUIRES_NEW)
public void updateAgentResourceAvailabilities(int agentId, AvailabilityType
platformAvailType,
AvailabilityType childAvailType) {
commit 6bcb845e3a3fd76fed93444c64eb0d2d98dd93d1
Merge: 08de25a c516ad0
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 15:14:41 2013 -0500
Merge branch 'track_master' into testMerge
Conflicts:
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
diff --cc
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index c239cb1,b2492cf..00c12c3
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@@ -450,10 -448,9 +450,11 @@@ public class BundleManagerBean implemen
// first see if the bundle exists or not; if not, create one
BundleCriteria criteria = new BundleCriteria();
+ criteria.setStrict(true);
criteria.addFilterBundleTypeId(Integer.valueOf(bundleTypeId));
criteria.addFilterName(bundleName);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
PageList<Bundle> bundles = findBundlesByCriteria(subject, criteria);
Bundle bundle;
if (bundles.getTotalSize() == 0) {
diff --cc
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index d6c6f50,319319f..68af1e7
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@@ -107,10 -108,9 +108,11 @@@ import org.rhq.enterprise.server.authz.
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.plugin.pc.content.PackageDetailsValidationException;
import org.rhq.enterprise.server.plugin.pc.content.PackageTypeBehavior;
+ import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
diff --cc
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index 63cb44d,e7f5b68..f604468
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@@ -1077,30 -1078,18 +1078,17 @@@ public class DiscoveryBossBean implemen
if (null == resourceType) {
try {
- ResourceTypeCriteria criteria = new ResourceTypeCriteria();
- criteria.addFilterPluginName(plugin);
- criteria.addFilterName(name);
- criteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
-
- List<ResourceType> result =
resourceTypeManager.findResourceTypesByCriteria(
- subjectManager.getOverlord(), criteria);
-
- if (!result.isEmpty()) {
- resourceType = result.get(0);
- loadedTypeMap.put(key.toString(), resourceType);
- }
+ resourceType =
this.resourceTypeManager.getResourceTypeByNameAndPlugin(name, plugin);
-
} catch (RuntimeException e) {
- log.error("Failed to lookup Resource type [" +
resource.getResourceType() + "] for reported Resource ["
- + resource + "] - this should not have happened.");
- return false;
+ resourceType = null;
}
- }
- if (null == resourceType) {
- log.error("Reported resource [" + resource + "] has an
unknown type [" + resource.getResourceType()
- + "]. The Agent most likely has a plugin named '" +
resource.getResourceType().getPlugin()
- + "' installed that is not installed on the Server. Resource
will be ignored...");
- return false;
+ if (null == resourceType) {
+ log.error("Reported resource [" + resource + "] has an
unknown type [" + resource.getResourceType()
+ + "]. The Agent most likely has a plugin named '" +
plugin
+ + "' installed that is not installed on the Server.
Resource will be ignored...");
+ return false;
+ }
}
resource.setResourceType(resourceType);
diff --cc
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index 53241d9,1495710..3b4f2ec
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@@ -504,10 -501,9 +505,11 @@@ public class DriftManagerBean implement
}
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
+ criteria.setStrict(true);
criteria.addFilterName(summary.getDriftDefinitionName());
criteria.addFilterResourceIds(resourceId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
PageList<DriftDefinition> definitions =
findDriftDefinitionsByCriteria(subject, criteria);
if (definitions.isEmpty()) {
diff --cc
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
index 95b5f9d,a6002a97..43d5240
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
@@@ -64,8 -64,8 +65,10 @@@ import org.rhq.enterprise.server.resour
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupDeleteException;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
+ import org.rhq.enterprise.server.scheduler.jobs.AsyncResourceDeleteJob;
+ import org.rhq.enterprise.server.scheduler.jobs.PurgeResourceTypesJob;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* This class manages the metadata for resources. Plugins are registered against this
bean so that their metadata can be
diff --cc
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
index 5d64970,ddf29b6..faa14ad
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
@@@ -126,60 -122,48 +126,104 @@@ public class CriteriaQueryTest
assertEquals(actual, expected);
}
+ /** This is like executeQueryThatReturnsMultiplePagesOfResults(), creates more
+ * that two pages of ordered entries and iterates over them. This is to test
+ * a nasty bug in CriteriaQuery where results beyond the first two pages were
+ * not being parsed.
+ */
+ @Test
+ public void executeQueryThatReturnsTotalPagesOfResults() {
+ //create page control to browse entries 100 at a time and start at page 0
+ int pageSize = 100;
+ PageControl pc = new PageControl(0, pageSize);
+
+ //Total size of result set is 500.
+ int totalSize = 500;
+
+ //Create list and populate with all entries.
+ List<FakeEntity> total = new ArrayList<FakeEntity>();
+ for (int i = 0; i < totalSize; i++) {
+ total.add(new FakeEntity(i));
+ }
+
+ //build executor to parse a given list with using PageControl passed in
+ FakeCriteriaQueryExecutor queryExecutor = new
FakeCriteriaQueryExecutor(totalSize, pc);
+
+ //add pages of results to simulate PageList results as returned by db queries
+ //todo: spinder, modify to support fractional results below and add last page.
+ int bucketCount = totalSize / pageSize;//number of full pages to list
+ int start = 0;
+ int end = pageSize;
+ //add bucketCount pages of data to read from.
+ for (int i = 0; i < bucketCount; i++) {
+ //Ex. first two pages (0, 100), (100,200), etc.
+ queryExecutor.addPage(total.subList(start, end));
+ start += pageSize;
+ end += pageSize;
+ }
+
+ //build criteria and attach pageControl
+ FakeEntityCriteria criteria = new FakeEntityCriteria();
+ //DO NOT use criteria.setPageControl(pc) here as it causes ignore of
pageNumber/pageSize
+ criteria.setPaging(pc.getPageNumber(), pc.getPageSize());
+
+ //?? So which pageControl has the right details? Criteria.pageControl? OR
PageControl passed into the QueryExecutor.
+
+ //Start off the initial query to page through the items in chunks defined by the
pageControl instance
+ CriteriaQuery<FakeEntity, FakeEntityCriteria> query = new
CriteriaQuery<FakeEntity, FakeEntityCriteria>(
+ criteria, queryExecutor);
+
+ //Now iterate over the list and make sure that iteration happens in order as
expected
+ //monotonically increasing.
+ int last = -1;
+ for (FakeEntity entity : query) {
+ //this fails with earlier bug in CriteriaQuery
+ assertEquals(true, (last < entity.getId()));
+ last = entity.getId();
+ }
+ }
++
+ @Test
+ public void singleResultTest() {
+ // This test doesn't really fit here but I;m adding it for convenience
+ List<FakeEntity> result = null;
+
+ try {
+ FakeEntityCriteria.getSingleResult(result);
+ assert false : "Should have thrown Runtime Exception";
+
+ } catch (RuntimeException e) {
+ assert e.getMessage().contains("NoResultException");
+ }
+
+ result = new ArrayList<FakeEntity>(2);
+
+ try {
+ FakeEntityCriteria.getSingleResult(result);
+ assert false : "Should have thrown Runtime Exception";
+
+ } catch (RuntimeException e) {
+ assert e.getMessage().contains("NoResultException");
+ }
+
+ result.add(new FakeEntity(1));
+
+ try {
+ FakeEntity r = FakeEntityCriteria.getSingleResult(result);
+ assert r.getId() == 1 : "Should have retuned expected entity but
returned: " + r;
+
+ } catch (Throwable t) {
+ assert false : "Should have returned single result";
+ }
+
+ result.add(new FakeEntity(2));
+
+ try {
+ FakeEntityCriteria.getSingleResult(result);
+ assert false : "Should have thrown Runtime Exception";
+
+ } catch (RuntimeException e) {
+ assert e.getMessage().contains("NonUniqueResultException");
+ }
+ }
-
}
commit 08de25a9c5d952594e4226f47e4cdd52e75b0137
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 15:00:02 2013 -0500
i)update DriftManagerBean to eliminate unnecessary page clearing
ii)Update ConfigurationManagerBean to use CriteriaQuery where possible instead of
unbounded criteria queries.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 141b910..6521730 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -120,6 +120,8 @@ import
org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupNotFoundException;
import org.rhq.enterprise.server.resource.group.ResourceGroupUpdateException;
import org.rhq.enterprise.server.scheduler.SchedulerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.QuartzUtil;
@@ -2560,7 +2562,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
* @param subject Subject of the caller - may limit search results
* @param pds the PropertyDefinitionSimple to work on
*/
- private void handlePDS(Subject subject, int resourceId, PropertyDefinitionSimple pds)
{
+ private void handlePDS(final Subject subject, int resourceId,
PropertyDefinitionSimple pds) {
if (pds.getOptionsSource() != null) {
// evaluate the source parameters
@@ -2574,8 +2576,16 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
if (tt == PropertyOptionsSource.TargetType.RESOURCE || tt ==
PropertyOptionsSource.TargetType.CONFIGURATION) {
List<Resource> resources = null;
+ CriteriaQuery<Resource, ResourceCriteria> resourcesPaged = null;
ResourceCriteria criteria = new ResourceCriteria();
- criteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query
results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor =
new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceManager.findResourcesByCriteria(subject,
criteria);
+ }
+ };
if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
// split out expression part for target=configuration
@@ -2586,7 +2596,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
if (!"self".equals(expr)) {
criteria.setSearchExpression(expr);
- resources = resourceManager.findResourcesByCriteria(subject,
criteria);
+ resourcesPaged = new CriteriaQuery<Resource,
ResourceCriteria>(criteria, queryExecutor);
} else if (resourceId >= 0) {
resources = new ArrayList<Resource>();
resources.add(resourceManager.getResourceById(subject,
resourceId));
@@ -2602,37 +2612,24 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
} else {
criteria.setSearchExpression(expression);
- resources = resourceManager.findResourcesByCriteria(subject,
criteria);
+ resourcesPaged = new CriteriaQuery<Resource,
ResourceCriteria>(criteria, queryExecutor);
}
+ if (resources != null) {//process resources
for (Resource resource : resources) {
- if (tt == PropertyOptionsSource.TargetType.RESOURCE) {
- String name = resource.getName();
-
- // filter if the user provided a filter
- if (filterPattern != null) {
- Matcher m = filterPattern.matcher(name);
- if (m.matches()) {
- PropertyDefinitionEnumeration pde = new
PropertyDefinitionEnumeration(name, "" + name);
- pds.getEnumeratedValues().add(pde);
- }
- } else { // Filter is null -> none provided -> do not
filter
- PropertyDefinitionEnumeration pde = new
PropertyDefinitionEnumeration(name, "" + name);
- pds.getEnumeratedValues().add(pde);
- }
- } else if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
- // for configuration we need to drill down into the resource
configuration
- if (!handleConfigurationTarget(pds, expression, resource))
- return;
-
+ processPropertyOptionsSource(pds, tt, expression, filterPattern,
resource);
+ }
+ } else {// process resourcesPaged(CriteriaQuery parsing)
+ for (Resource resource : resourcesPaged) {
+ processPropertyOptionsSource(pds, tt, expression, filterPattern,
resource);
}
}
} else if (tt == PropertyOptionsSource.TargetType.GROUP) {
// for groups we need to talk to the group manager
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.setSearchExpression(expression);
- criteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
+ //?? spinder 2-12-13: We don't do anything with the composite
results here?
resourceGroupManager.findResourceGroupCompositesByCriteria(subject,
criteria);
}
// TODO plugin and resourceType
@@ -2640,6 +2637,30 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
}
+ private void processPropertyOptionsSource(PropertyDefinitionSimple pds,
PropertyOptionsSource.TargetType tt,
+ String expression, Pattern filterPattern, Resource resource) {
+ if (tt == PropertyOptionsSource.TargetType.RESOURCE) {
+ String name = resource.getName();
+
+ // filter if the user provided a filter
+ if (filterPattern != null) {
+ Matcher m = filterPattern.matcher(name);
+ if (m.matches()) {
+ PropertyDefinitionEnumeration pde = new
PropertyDefinitionEnumeration(name, "" + name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ } else { // Filter is null -> none provided -> do not filter
+ PropertyDefinitionEnumeration pde = new
PropertyDefinitionEnumeration(name, "" + name);
+ pds.getEnumeratedValues().add(pde);
+ }
+ } else if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
+ // for configuration we need to drill down into the resource configuration
+ if (!handleConfigurationTarget(pds, expression, resource))
+ return;
+
+ }
+ }
+
/**
* Drill down in the case the user set up a target of "configuration". We
need to check
* that the target property actually exists and that it has a format we understand
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index dcc08d8..53241d9 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -208,7 +208,6 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
DriftDefinitionCriteria driftDefCriteria = new DriftDefinitionCriteria();
driftDefCriteria.addFilterResourceIds(resourceId);
driftDefCriteria.addFilterName(driftDefName);
- driftDefCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
PageList<DriftDefinition> defs = findDriftDefinitionsByCriteria(overlord,
driftDefCriteria);
if (defs.isEmpty()) {
@@ -223,7 +222,6 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
criteria.addFilterDriftDefinitionId(driftDef.getId());
criteria.addFilterVersion(Integer.toString(version));
criteria.fetchDrifts(true);
- criteria.setPageControl(PageControl.getUnlimitedInstance());//disable paging as
the code assumes all the results will be returned.
PageList<? extends DriftChangeSet<?>> changeSets =
driftServerPlugin.findDriftChangeSetsByCriteria(overlord,
criteria);
commit 074bb5d7cdb8512e3a3d7738ca45f08018696ed3
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 13:27:03 2013 -0500
Update unbounded criteria usage to CriteriaQuery usage to scale for larger
deployments.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index 4fabe9a..c239cb1 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -84,7 +84,6 @@ import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
-import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.StringUtils;
import org.rhq.core.util.NumberUtil;
@@ -105,6 +104,8 @@ import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility;
import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility.SerializationType;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -376,7 +377,6 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
criteria.addFilterDestinationId(bundleDestination.getId());
criteria.addFilterIsLive(true);
criteria.fetchBundleVersion(true);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
List<BundleDeployment> liveDeployments =
bundleManager.findBundleDeploymentsByCriteria(subject, criteria);
BundleDeployment liveDeployment = (liveDeployments.isEmpty()) ? null :
liveDeployments.get(0);
@@ -634,7 +634,6 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
criteria.setStrict(true);
criteria.addFilterBundleTypeId(bundleType.getId());
criteria.addFilterName(bundleName);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
PageList<Bundle> bundles = bundleManager.findBundlesByCriteria(subject,
criteria);
Bundle bundle;
@@ -702,15 +701,25 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
bundleVersion = bundleVersions.get(0);
List<BundleFile> bundleFiles = bundleVersion.getBundleFiles();
if (bundleFiles != null && bundleFiles.size() > 0) {
- BundleFileCriteria bfCriteria = new BundleFileCriteria();
+ final BundleFileCriteria bfCriteria = new BundleFileCriteria();
bfCriteria.addFilterBundleVersionId(bundleVersion.getId());
bfCriteria.fetchPackageVersion(true);
- bfCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
- PageList<BundleFile> bfs =
bundleManager.findBundleFilesByCriteria(subjectManager.getOverlord(),
- bfCriteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query
results
+ CriteriaQueryExecutor<BundleFile, BundleFileCriteria> queryExecutor
= new CriteriaQueryExecutor<BundleFile, BundleFileCriteria>() {
+ @Override
+ public PageList<BundleFile> execute(BundleFileCriteria
criteria) {
+ return
bundleManager.findBundleFilesByCriteria(subjectManager.getOverlord(), bfCriteria);
+ }
+ };
+
+ CriteriaQuery<BundleFile, BundleFileCriteria> bfs = new
CriteriaQuery<BundleFile, BundleFileCriteria>(
+ bfCriteria, queryExecutor);
+
bundleFiles.clear();
- bundleFiles.addAll(bfs);
+ for (BundleFile bf : bfs) {
+ bundleFiles.add(bf);
+ }
}
bundleVersion.setBundleDeployments(new ArrayList<BundleDeployment>());
} else {
@@ -854,7 +863,7 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
@Override
@RequiredPermission(Permission.MANAGE_BUNDLE)
@TransactionAttribute(TransactionAttributeType.NEVER)
- public void purgeBundleDestination(Subject subject, int bundleDestinationId) throws
Exception {
+ public void purgeBundleDestination(final Subject subject, int bundleDestinationId)
throws Exception {
// find the live bundle deployment for this destination, and get all the resource
deployments for that live deployment
BundleDeploymentCriteria bdc = new BundleDeploymentCriteria();
bdc.addFilterDestinationId(bundleDestinationId);
@@ -890,16 +899,28 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
for (BundleResourceDeployment resourceDeploy : resourceDeploys) {
resourceDeployIds.add(resourceDeploy.getId());
}
- BundleResourceDeploymentCriteria brdc = new BundleResourceDeploymentCriteria();
+ final BundleResourceDeploymentCriteria brdc = new
BundleResourceDeploymentCriteria();
brdc.addFilterIds(resourceDeployIds.toArray(new
Integer[resourceDeployIds.size()]));
brdc.fetchResource(true);
- brdc.setPageControl(PageControl.getUnlimitedInstance());
- PageList<BundleResourceDeployment> brdResults =
bundleManager.findBundleResourceDeploymentsByCriteria(subject,
- brdc);
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<BundleResourceDeployment,
BundleResourceDeploymentCriteria> queryExecutor = new
CriteriaQueryExecutor<BundleResourceDeployment, BundleResourceDeploymentCriteria>()
{
+ @Override
+ public PageList<BundleResourceDeployment>
execute(BundleResourceDeploymentCriteria criteria) {
+ return bundleManager.findBundleResourceDeploymentsByCriteria(subject,
brdc);
+ }
+ };
+
+ CriteriaQuery<BundleResourceDeployment, BundleResourceDeploymentCriteria>
brdResults = new CriteriaQuery<BundleResourceDeployment,
BundleResourceDeploymentCriteria>(
+ brdc, queryExecutor);
+
+ // PageList<BundleResourceDeployment> brdResults =
bundleManager.findBundleResourceDeploymentsByCriteria(subject,
+ // brdc);
resourceDeploys.clear();
- resourceDeploys.addAll(brdResults);
+ // resourceDeploys.addAll(brdResults);
// need to wire the live bundle deployment back in - no need for another query or
fetch it above because we have it already
for (BundleResourceDeployment brd : brdResults) {
+ resourceDeploys.add(brd);
brd.setBundleDeployment(liveDeployment);
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
index 0ca5b82..a78d7e9 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
@@ -33,11 +33,14 @@ import org.rhq.core.domain.bundle.BundleResourceDeploymentHistory;
import org.rhq.core.domain.content.PackageVersion;
import org.rhq.core.domain.criteria.BundleFileCriteria;
import org.rhq.core.domain.criteria.PackageVersionCriteria;
+import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.exception.WrappedRemotingException;
import org.rhq.enterprise.server.content.ContentManagerLocal;
import org.rhq.enterprise.server.content.ContentSourceManagerLocal;
import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility;
import org.rhq.enterprise.server.safeinvoker.HibernateDetachUtility.SerializationType;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -63,18 +66,27 @@ public class BundleServerServiceImpl implements BundleServerService {
public List<PackageVersion> getAllBundleVersionPackageVersions(int
bundleVersionId) {
try {
- BundleManagerLocal bm = LookupUtil.getBundleManager();
+ final BundleManagerLocal bm = LookupUtil.getBundleManager();
ContentManagerLocal cm = LookupUtil.getContentManager();
- Subject subject = LookupUtil.getSubjectManager().getOverlord();
- BundleFileCriteria bfc = new BundleFileCriteria();
+ final Subject subject = LookupUtil.getSubjectManager().getOverlord();
+ final BundleFileCriteria bfc = new BundleFileCriteria();
PackageVersionCriteria pvc = new PackageVersionCriteria();
bfc.addFilterBundleVersionId(bundleVersionId);
bfc.fetchPackageVersion(true);
- bfc.clearPaging();//disable paging as the code assumes all the results will
be returned.
- List<BundleFile> bundleFiles = bm.findBundleFilesByCriteria(subject,
bfc);
- List<PackageVersion> packageVersions = new
ArrayList<PackageVersion>(bundleFiles.size());
+ //Use CriteriaQuery to automatically chunk/page through criteria query
results
+ CriteriaQueryExecutor<BundleFile, BundleFileCriteria> queryExecutor =
new CriteriaQueryExecutor<BundleFile, BundleFileCriteria>() {
+ @Override
+ public PageList<BundleFile> execute(BundleFileCriteria criteria) {
+ return bm.findBundleFilesByCriteria(subject, bfc);
+ }
+ };
+
+ CriteriaQuery<BundleFile, BundleFileCriteria> bundleFiles = new
CriteriaQuery<BundleFile, BundleFileCriteria>(
+ bfc, queryExecutor);
+
+ List<PackageVersion> packageVersions = new
ArrayList<PackageVersion>();
PackageVersion packageVersion = null;
for (BundleFile bundleFile : bundleFiles) {
pvc.addFilterId(bundleFile.getPackageVersion().getId());
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DeletedResourceTypeFilter.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DeletedResourceTypeFilter.java
index c2371bd..347bc03 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DeletedResourceTypeFilter.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DeletedResourceTypeFilter.java
@@ -9,11 +9,12 @@ import org.rhq.core.domain.criteria.ResourceTypeCriteria;
import org.rhq.core.domain.plugin.Plugin;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.metadata.PluginManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
public class DeletedResourceTypeFilter {
@@ -41,9 +42,17 @@ public class DeletedResourceTypeFilter {
private void loadDeletedTypes() {
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterDeleted(true);
- criteria.setPageControl(PageControl.getUnlimitedInstance());
- PageList<ResourceType> results =
resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
- criteria);
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria> queryExecutor =
new CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria>() {
+ @Override
+ public PageList<ResourceType> execute(ResourceTypeCriteria criteria) {
+ return
resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(), criteria);
+ }
+ };
+
+ CriteriaQuery<ResourceType, ResourceTypeCriteria> results = new
CriteriaQuery<ResourceType, ResourceTypeCriteria>(
+ criteria, queryExecutor);
for (ResourceType type : results) {
deletedTypes.add(type.getName() + "::" + type.getPlugin());
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
index 1629926..ca9bfab 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
@@ -33,10 +33,13 @@ import org.rhq.core.domain.search.SavedSearch;
import org.rhq.core.domain.search.SearchSubsystem;
import org.rhq.core.domain.search.SearchSuggestion;
import org.rhq.core.domain.search.SearchSuggestion.Kind;
+import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.server.search.SavedSearchManagerLocal;
import org.rhq.enterprise.server.search.assist.SearchAssistant;
import org.rhq.enterprise.server.search.assist.SearchAssistantFactory;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -606,9 +609,17 @@ public class SearchAssistManager {
criteria.setCaseSensitive(false);
criteria.addSortName(PageOrdering.ASC);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- List<SavedSearch> savedSearchResults =
savedSearchManager.findSavedSearchesByCriteria(subject, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<SavedSearch, SavedSearchCriteria> queryExecutor = new
CriteriaQueryExecutor<SavedSearch, SavedSearchCriteria>() {
+ @Override
+ public PageList<SavedSearch> execute(SavedSearchCriteria criteria) {
+ return savedSearchManager.findSavedSearchesByCriteria(subject,
criteria);
+ }
+ };
+
+ CriteriaQuery<SavedSearch, SavedSearchCriteria> savedSearchResults = new
CriteriaQuery<SavedSearch, SavedSearchCriteria>(
+ criteria, queryExecutor);
List<SearchSuggestion> results = new ArrayList<SearchSuggestion>();
for (SavedSearch next : savedSearchResults) {
@@ -637,9 +648,17 @@ public class SearchAssistManager {
criteria.setCaseSensitive(false);
criteria.addSortName(PageOrdering.ASC);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- List<SavedSearch> savedSearchResults =
savedSearchManager.findSavedSearchesByCriteria(subject, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<SavedSearch, SavedSearchCriteria> queryExecutor = new
CriteriaQueryExecutor<SavedSearch, SavedSearchCriteria>() {
+ @Override
+ public PageList<SavedSearch> execute(SavedSearchCriteria criteria) {
+ return savedSearchManager.findSavedSearchesByCriteria(subject,
criteria);
+ }
+ };
+
+ CriteriaQuery<SavedSearch, SavedSearchCriteria> savedSearchResults = new
CriteriaQuery<SavedSearch, SavedSearchCriteria>(
+ criteria, queryExecutor);
List<SearchSuggestion> results = new ArrayList<SearchSuggestion>();
for (SavedSearch next : savedSearchResults) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
index 944f799..27b2bf7 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
@@ -84,7 +84,6 @@ public class TagManagerBean implements TagManagerLocal, TagManagerRemote
{
criteria.addFilterSemantic(tag.getSemantic());
criteria.addFilterName(tag.getName());
criteria.setStrict(true);
- criteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
List<Tag> found = findTagsByCriteria(subject, criteria);
if (!found.isEmpty()) {
commit 03bd442a7270443572a8e17c77551a2d72bf4951
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 12:04:30 2013 -0500
i)update ContentSourceMangerBean and several rest instances using unbounded criteria
to use CriteriaQuery specifically.
ii)modified CriteriaQuery to be able to return list of types
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
index e6bdf1b..b1dc1bc 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
@@ -122,6 +122,8 @@ import
org.rhq.enterprise.server.plugin.pc.content.InitializationException;
import org.rhq.enterprise.server.plugin.pc.content.PackageSyncReport;
import org.rhq.enterprise.server.plugin.pc.content.RepoDetails;
import org.rhq.enterprise.server.resource.ProductVersionManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -746,16 +748,25 @@ public class ContentSourceManagerBean implements
ContentSourceManagerLocal {
// Following same sort of workaround done in ContentProviderManager for
synchronizeContentProvider
// Assume this will need to be updated when we place syncing in repo layer
//
- RepoCriteria reposForContentSource = new RepoCriteria();
+ final RepoCriteria reposForContentSource = new RepoCriteria();
reposForContentSource.addFilterContentSourceIds(contentSourceId);
reposForContentSource.addFilterCandidate(false); // Don't sync
distributions for candidates
- reposForContentSource.clearPaging();//disable paging as the code assumes all
the results will be returned.
- Subject overlord = LookupUtil.getSubjectManager().getOverlord();
- List<Repo> repos = repoManager.findReposByCriteria(overlord,
reposForContentSource);
- log.debug("downloadDistributionBits found " + repos.size() + "
repos associated with this contentSourceId "
- + contentSourceId);
+ final Subject overlord = LookupUtil.getSubjectManager().getOverlord();
+ //Use CriteriaQuery to automatically chunk/page through criteria query
results
+ CriteriaQueryExecutor<Repo, RepoCriteria> queryExecutor = new
CriteriaQueryExecutor<Repo, RepoCriteria>() {
+ @Override
+ public PageList<Repo> execute(RepoCriteria criteria) {
+ return repoManager.findReposByCriteria(overlord,
reposForContentSource);
+ }
+ };
+
+ CriteriaQuery<Repo, RepoCriteria> repos = new CriteriaQuery<Repo,
RepoCriteria>(reposForContentSource,
+ queryExecutor);
+
+ int repoCount = 0;
for (Repo repo : repos) {
+ repoCount++;
log.debug("downloadDistributionBits operating on repo: " +
repo.getName() + " id = " + repo.getId());
// Look up Distributions associated with this ContentSource.
PageControl pageControl = PageControl.getUnlimitedInstance();
@@ -798,6 +809,9 @@ public class ContentSourceManagerBean implements
ContentSourceManagerLocal {
}
}
}
+ log.debug("downloadDistributionBits found and processed " +
repoCount
+ + " repos associated with this contentSourceId "
+ + contentSourceId);
} catch (Throwable t) {
log.error(t);
throw new RuntimeException(t);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
index 3d7abe0..786a8b1 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/EventHandlerBean.java
@@ -59,11 +59,14 @@ import org.rhq.core.domain.event.EventSource;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.util.PageControl;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.event.EventManagerLocal;
import org.rhq.enterprise.server.rest.domain.EventDefinitionRest;
import org.rhq.enterprise.server.rest.domain.EventRest;
import org.rhq.enterprise.server.rest.domain.EventSourceRest;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Handle event related things
@@ -297,8 +300,16 @@ public class EventHandlerBean extends AbstractRestBean {
private Response.ResponseBuilder getEventsAsBuilderForCriteria(HttpHeaders headers,
EventCriteria criteria) {
- List<Event> eventList =
eventManager.findEventsByCriteria(caller,criteria);
- List<EventRest> restEvents = new
ArrayList<EventRest>(eventList.size());
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Event, EventCriteria> queryExecutor = new
CriteriaQueryExecutor<Event, EventCriteria>() {
+ @Override
+ public PageList<Event> execute(EventCriteria criteria) {
+ return eventManager.findEventsByCriteria(caller, criteria);
+ }
+ };
+
+ CriteriaQuery<Event, EventCriteria> eventList = new CriteriaQuery<Event,
EventCriteria>(criteria, queryExecutor);
+ List<EventRest> restEvents = new ArrayList<EventRest>();
for (Event event : eventList) {
restEvents.add(convertEvent(event));
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
index ebaf451..8f9b360 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
@@ -80,6 +80,8 @@ import org.rhq.enterprise.server.rest.domain.GroupRest;
import org.rhq.enterprise.server.rest.domain.Link;
import org.rhq.enterprise.server.rest.domain.MetricSchedule;
import org.rhq.enterprise.server.rest.domain.ResourceWithType;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Deal with group related things.
@@ -114,11 +116,19 @@ public class GroupHandlerBean extends AbstractRestBean {
if (q!=null) {
criteria.addFilterName(q);
}
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- List<ResourceGroup> groups =
resourceGroupManager.findResourceGroupsByCriteria(caller, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<ResourceGroup, ResourceGroupCriteria> queryExecutor =
new CriteriaQueryExecutor<ResourceGroup, ResourceGroupCriteria>() {
+ @Override
+ public PageList<ResourceGroup> execute(ResourceGroupCriteria criteria)
{
+ return resourceGroupManager.findResourceGroupsByCriteria(caller,
criteria);
+ }
+ };
+
+ CriteriaQuery<ResourceGroup, ResourceGroupCriteria> groups = new
CriteriaQuery<ResourceGroup, ResourceGroupCriteria>(
+ criteria, queryExecutor);
- List<GroupRest> list = new ArrayList<GroupRest>(groups.size());
+ List<GroupRest> list = new ArrayList<GroupRest>();
for (ResourceGroup group : groups) {
list.add(fillGroup(group, uriInfo));
}
@@ -373,10 +383,19 @@ public class GroupHandlerBean extends AbstractRestBean {
if (q!=null) {
criteria.addFilterName(q);
}
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- PageList<GroupDefinition> gdlist =
definitionManager.findGroupDefinitionsByCriteria(caller, criteria);
- List<GroupDefinitionRest> list = new
ArrayList<GroupDefinitionRest>(gdlist.getTotalSize());
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<GroupDefinition, ResourceGroupDefinitionCriteria>
queryExecutor = new CriteriaQueryExecutor<GroupDefinition,
ResourceGroupDefinitionCriteria>() {
+ @Override
+ public PageList<GroupDefinition>
execute(ResourceGroupDefinitionCriteria criteria) {
+ return definitionManager.findGroupDefinitionsByCriteria(caller,
criteria);
+ }
+ };
+
+ CriteriaQuery<GroupDefinition, ResourceGroupDefinitionCriteria> gdlist =
new CriteriaQuery<GroupDefinition, ResourceGroupDefinitionCriteria>(
+ criteria, queryExecutor);
+
+ List<GroupDefinitionRest> list = new
ArrayList<GroupDefinitionRest>();
for (GroupDefinition def: gdlist) {
GroupDefinitionRest definitionRest = buildGDRestFromDefinition(def);
createLinksForGDRest(uriInfo,definitionRest);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
index fbf81fb..2e8f99c 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
@@ -67,6 +67,7 @@ import org.rhq.core.domain.operation.ResourceOperationHistory;
import org.rhq.core.domain.operation.bean.ResourceOperationSchedule;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
import org.rhq.core.domain.util.PageOrdering;
import org.rhq.enterprise.server.operation.OperationManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
@@ -75,6 +76,8 @@ import org.rhq.enterprise.server.rest.domain.OperationDefinitionRest;
import org.rhq.enterprise.server.rest.domain.OperationHistoryRest;
import org.rhq.enterprise.server.rest.domain.OperationRest;
import org.rhq.enterprise.server.rest.domain.SimplePropDef;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Deal with operations
@@ -343,7 +346,6 @@ public class OperationsHandlerBean extends AbstractRestBean {
ResourceOperationHistoryCriteria criteria = new
ResourceOperationHistoryCriteria();
JobId jobId = new JobId(jobName);
criteria.addFilterJobId(jobId);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
ResourceOperationHistory history ;//=
opsManager.getOperationHistoryByJobId(caller,jobName);
List<ResourceOperationHistory> list =
opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
@@ -387,11 +389,19 @@ public class OperationsHandlerBean extends AbstractRestBean {
criteria.addFilterResourceIds(resourceId);
criteria.addSortEndTime(PageOrdering.DESC);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- List<ResourceOperationHistory> list =
opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<ResourceOperationHistory,
ResourceOperationHistoryCriteria> queryExecutor = new
CriteriaQueryExecutor<ResourceOperationHistory, ResourceOperationHistoryCriteria>()
{
+ @Override
+ public PageList<ResourceOperationHistory>
execute(ResourceOperationHistoryCriteria criteria) {
+ return opsManager.findResourceOperationHistoriesByCriteria(caller,
criteria);
+ }
+ };
+
+ CriteriaQuery<ResourceOperationHistory, ResourceOperationHistoryCriteria>
list = new CriteriaQuery<ResourceOperationHistory,
ResourceOperationHistoryCriteria>(
+ criteria, queryExecutor);
- List<OperationHistoryRest> result = new
ArrayList<OperationHistoryRest>(list.size());
+ List<OperationHistoryRest> result = new
ArrayList<OperationHistoryRest>();
for (ResourceOperationHistory roh : list) {
OperationHistoryRest historyRest = historyToHistoryRest(roh,uriInfo);
result.add(historyRest);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
index 0a4509d..eb65599 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
@@ -118,4 +118,13 @@ public class CriteriaQuery<T, C extends BaseCriteria>
implements Iterable<T> {
throw new UnsupportedOperationException("This iterator does not support
removal.");
}
}
+
+ public PageList<T> loadAsList() {
+ Iterator<T> iterator = iterator();
+ PageList<T> list = new PageList<T>();
+ while (iterator.hasNext()) {
+ list.add(iterator.next());
+ }
+ return list;
+ }
}
commit 60692c34e375615b5b772f32bd92d4da0cf904b7
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 09:12:50 2013 -0500
Update ContentMangerBean to use CriteriaQuery.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index a957d00..d6c6f50 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -109,6 +109,8 @@ import
org.rhq.enterprise.server.plugin.pc.content.PackageDetailsValidationExcep
import org.rhq.enterprise.server.plugin.pc.content.PackageTypeBehavior;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -1588,17 +1590,26 @@ public class ContentManagerBean implements ContentManagerLocal,
ContentManagerRe
return runner.execute();
}
- public PageList<PackageAndLatestVersionComposite>
findPackagesWithLatestVersion(Subject subject, PackageCriteria criteria) {
+ public PageList<PackageAndLatestVersionComposite>
findPackagesWithLatestVersion(final Subject subject,
+ PackageCriteria criteria) {
if (criteria.getFilterRepoId() == null) {
throw new IllegalArgumentException("The criteria query has to have a
filter for a specific repo.");
}
criteria.fetchVersions(true);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- PageList<Package> packages = findPackagesByCriteria(subject, criteria);
-
- PageList<PackageAndLatestVersionComposite> ret = new
PageList<PackageAndLatestVersionComposite>(packages.getTotalSize(),
packages.getPageControl());
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Package, PackageCriteria> queryExecutor = new
CriteriaQueryExecutor<Package, PackageCriteria>() {
+ @Override
+ public PageList<Package> execute(PackageCriteria criteria) {
+ return findPackagesByCriteria(subject, criteria);
+ }
+ };
+
+ CriteriaQuery<Package, PackageCriteria> packages = new
CriteriaQuery<Package, PackageCriteria>(criteria,
+ queryExecutor);
+
+ PageList<PackageAndLatestVersionComposite> ret = new
PageList<PackageAndLatestVersionComposite>();
for(Package p : packages) {
PackageVersion latest = repoManager.getLatestPackageVersion(subject,
p.getId(), criteria.getFilterRepoId());
commit 3806efcdd4e34a1089d08137f53137d80c9e1879
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 09:00:29 2013 -0500
more unbounded criteria usages converted to CriteriaQuery.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
index 0ab7dee..cf813ca 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
@@ -26,10 +26,13 @@ import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.measurement.NumericType;
import org.rhq.core.domain.resource.ResourceCategory;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class MeasurementMetadataManagerBean implements MeasurementMetadataManagerLocal {
@@ -216,10 +219,18 @@ public class MeasurementMetadataManagerBean implements
MeasurementMetadataManage
MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- List<MeasurementDefinition> definitions =
measurementDefinitionMgr.findMeasurementDefinitionsByCriteria(
- subjectMgr.getOverlord(), criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria>
queryExecutor = new CriteriaQueryExecutor<MeasurementDefinition,
MeasurementDefinitionCriteria>() {
+ @Override
+ public PageList<MeasurementDefinition>
execute(MeasurementDefinitionCriteria criteria) {
+ return measurementDefinitionMgr
+ .findMeasurementDefinitionsByCriteria(subjectMgr.getOverlord(),
criteria);
+ }
+ };
+
+ CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria>
definitions = new CriteriaQuery<MeasurementDefinition,
MeasurementDefinitionCriteria>(
+ criteria, queryExecutor);
// Remove the type's metric definitions. We do this separately, rather than
just relying on cascade
// upon deletion of the ResourceType, because the removeMeasurementDefinition()
will also take care
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
index f833bc5..0c2fdcb 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
@@ -1,7 +1,5 @@
package org.rhq.enterprise.server.resource.metadata;
-import java.util.List;
-
import javax.ejb.EJB;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
@@ -21,11 +19,14 @@ import
org.rhq.core.domain.configuration.definition.PropertyDefinition;
import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import
org.rhq.enterprise.server.configuration.metadata.ConfigurationDefinitionUpdateReport;
import
org.rhq.enterprise.server.configuration.metadata.ConfigurationMetadataManagerLocal;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class PluginConfigurationMetadataManagerBean implements
PluginConfigurationMetadataManagerLocal {
@@ -73,12 +74,20 @@ public class PluginConfigurationMetadataManagerBean implements
PluginConfigurati
if (updateReport.getNewPropertyDefinitions().size() > 0
|| updateReport.getUpdatedPropertyDefinitions().size() > 0) {
- Subject overlord = subjectMgr.getOverlord();
+ final Subject overlord = subjectMgr.getOverlord();
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
- criteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
- List<Resource> resources =
resourceMgr.findResourcesByCriteria(overlord, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria
query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor
= new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria
criteria) {
+ return resourceMgr.findResourcesByCriteria(overlord,
criteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> resources = new
CriteriaQuery<Resource, ResourceCriteria>(
+ criteria, queryExecutor);
for (Resource resource : resources) {
updateResourcePluginConfiguration(resource, updateReport);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
index 08a4775..2845fcf 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
@@ -18,6 +18,8 @@
*/
package org.rhq.enterprise.server.scheduler.jobs;
+import java.util.ArrayList;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.quartz.Job;
@@ -35,6 +37,8 @@ import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.content.ContentSourceManagerLocal;
import org.rhq.enterprise.server.content.RepoManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
/**
@@ -113,19 +117,31 @@ public class ContentProviderSyncJob implements StatefulJob {
private void syncImportedRepos(ContentSource contentSource) throws
InterruptedException {
SubjectManagerLocal subjectManager = LookupUtil.getSubjectManager();
- Subject overlord = subjectManager.getOverlord();
- RepoCriteria repoCriteria = new RepoCriteria();
+ final Subject overlord = subjectManager.getOverlord();
+ final RepoCriteria repoCriteria = new RepoCriteria();
repoCriteria.addFilterContentSourceIds(contentSource.getId());
repoCriteria.addFilterCandidate(false);
- repoCriteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
-
- RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
- PageList<Repo> repos = repoManager.findReposByCriteria(overlord,
repoCriteria);
- Integer[] repoIds = new Integer[repos.size()];
- for (int i = 0; i < repos.size(); i++) {
- Repo repo = repos.get(i);
- repoIds[i] = repo.getId();
+
+ final RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Repo, RepoCriteria> queryExecutor = new
CriteriaQueryExecutor<Repo, RepoCriteria>() {
+ @Override
+ public PageList<Repo> execute(RepoCriteria criteria) {
+ return repoManager.findReposByCriteria(overlord, repoCriteria);
+ }
+ };
+
+ CriteriaQuery<Repo, RepoCriteria> repos = new CriteriaQuery<Repo,
RepoCriteria>(repoCriteria, queryExecutor);
+
+
+ ArrayList<Integer> repoIdList = new ArrayList<Integer>();
+ for (Repo repo : repos) {
+ repoIdList.add(repo.getId());
}
+ Integer[] repoIds = new Integer[repoIdList.size()];
+ repoIds = repoIdList.toArray(repoIds);
+
repoManager.internalSynchronizeRepos(overlord, repoIds);
}
commit 4b2d458e0dcab67e5123ca9b28f280076ddaffba
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 08:38:53 2013 -0500
Update criteria usage to use CriteriaQuery where possible instead of unbounded
queries.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
index a52c4c2..711a653 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
@@ -1,6 +1,6 @@
package org.rhq.enterprise.server.resource.metadata;
-import java.util.List;
+import java.util.ArrayList;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -12,8 +12,11 @@ import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertTemplateManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class AlertMetadataManagerBean implements AlertMetadataManagerLocal {
@@ -27,21 +30,32 @@ public class AlertMetadataManagerBean implements
AlertMetadataManagerLocal {
private AlertTemplateManagerLocal alertTemplateMgr;
@Override
- public void deleteAlertTemplates(Subject subject, ResourceType resourceType) {
+ public void deleteAlertTemplates(final Subject subject, ResourceType resourceType) {
log.debug("Deleting alert templates for " + resourceType);
AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
criteria.addFilterAlertTemplateResourceTypeId(resourceType.getId());
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- List<AlertDefinition> templates =
alertDefinitionMgr.findAlertDefinitionsByCriteria(subject, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<AlertDefinition, AlertDefinitionCriteria>
queryExecutor = new CriteriaQueryExecutor<AlertDefinition,
AlertDefinitionCriteria>() {
+ @Override
+ public PageList<AlertDefinition> execute(AlertDefinitionCriteria
criteria) {
+ return alertDefinitionMgr.findAlertDefinitionsByCriteria(subject,
criteria);
+ }
+ };
- Integer[] templateIds = new Integer[templates.size()];
+ CriteriaQuery<AlertDefinition, AlertDefinitionCriteria> templates = new
CriteriaQuery<AlertDefinition, AlertDefinitionCriteria>(
+ criteria, queryExecutor);
+
+ ArrayList<Integer> templateIdList = new ArrayList<Integer>();
int i = 0;
for (AlertDefinition template : templates) {
- templateIds[i++] = template.getId();
+ templateIdList.add(template.getId());
}
+ Integer[] templateIds = new Integer[templateIdList.size()];
+ templateIds = templateIdList.toArray(templateIds);
+
// Alert definitions associated with individual resources and with groups
// are deleted as part of resource deletion. This commit adds support for
// templates which are alert definitions associated with the resource
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
index cd54bf0..6ebdc20 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
@@ -24,9 +24,12 @@ import
org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.content.PackageType;
import org.rhq.core.domain.criteria.BundleCriteria;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.bundle.BundleManagerLocal;
import
org.rhq.enterprise.server.configuration.metadata.ConfigurationMetadataManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
@Stateless
public class ContentMetadataManagerBean implements ContentMetadataManagerLocal {
@@ -230,7 +233,7 @@ public class ContentMetadataManagerBean implements
ContentMetadataManagerLocal {
}
}
- private void deleteBundles(Subject subject, ResourceType resourceType) throws
Exception {
+ private void deleteBundles(final Subject subject, ResourceType resourceType) throws
Exception {
BundleType bundleType = resourceType.getBundleType();
if (bundleType == null) {
@@ -239,9 +242,18 @@ public class ContentMetadataManagerBean implements
ContentMetadataManagerLocal {
BundleCriteria criteria = new BundleCriteria();
criteria.addFilterBundleTypeId(bundleType.getId());
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- List<Bundle> bundles = bundleMgr.findBundlesByCriteria(subject, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Bundle, BundleCriteria> queryExecutor = new
CriteriaQueryExecutor<Bundle, BundleCriteria>() {
+ @Override
+ public PageList<Bundle> execute(BundleCriteria criteria) {
+ return bundleMgr.findBundlesByCriteria(subject, criteria);
+ }
+ };
+
+ CriteriaQuery<Bundle, BundleCriteria> bundles = new
CriteriaQuery<Bundle, BundleCriteria>(criteria,
+ queryExecutor);
+
for (Bundle bundle : bundles) {
bundleMgr.deleteBundle(subject, bundle.getId());
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
index 6f0c9df..95b5f9d 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
@@ -56,6 +56,7 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceSubCategory;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.group.ResourceGroup;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.authz.RequiredPermission;
@@ -63,6 +64,8 @@ import org.rhq.enterprise.server.resource.ResourceManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.group.ResourceGroupDeleteException;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* This class manages the metadata for resources. Plugins are registered against this
bean so that their metadata can be
@@ -270,7 +273,7 @@ public class ResourceMetadataManagerBean implements
ResourceMetadataManagerLocal
c.addFilterInventoryStatus(null);
List<Resource> resources = resourceManager.findResourcesByCriteria(subject,
c);
//Chunk through the results in 200(default) page element batches to avoid
excessive
- //memory usage for large deployments
+ //memory usage for large deployments. No need to use CriteriaQuery here as this
loop is more efficient at catching stragglers
while ((resources != null) && (!resources.isEmpty())) {
Iterator<Resource> resIter = resources.iterator();
while (resIter.hasNext()) {
@@ -678,13 +681,22 @@ public class ResourceMetadataManagerBean implements
ResourceMetadataManagerLocal
private void moveResourcesToNewParent(ResourceType existingType, ResourceType
obsoleteParentType,
Set<ResourceType> newParentTypes) {
- Subject overlord = subjectManager.getOverlord();
+ final Subject overlord = subjectManager.getOverlord();
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
criteria.addFilterParentResourceTypeId(obsoleteParentType.getId());
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- List<Resource> resources =
resourceManager.findResourcesByCriteria(overlord, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new
CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceManager.findResourcesByCriteria(overlord, criteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> resources = new
CriteriaQuery<Resource, ResourceCriteria>(criteria,
+ queryExecutor);
+
for (Resource resource : resources) {
Resource newParent = null;
newParentTypes: for (ResourceType newParentType : newParentTypes) {
commit 74602ae63e196bbbf3e4c6d156d6a385bd208c6f
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 08:20:28 2013 -0500
Update ResourceManagerBean criteria usage to CriteriaQuery where possible. Still
required to clearPaging in some cases.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 205252d..e8758ec 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -126,6 +126,8 @@ import
org.rhq.enterprise.server.resource.disambiguation.DisambiguationUpdateStr
import org.rhq.enterprise.server.resource.disambiguation.Disambiguator;
import org.rhq.enterprise.server.resource.group.ResourceGroupDeleteException;
import org.rhq.enterprise.server.resource.group.ResourceGroupManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
import org.rhq.enterprise.server.util.QueryUtility;
@@ -853,7 +855,7 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
return resourceLineage;
}
- public Map<Integer, String> getResourcesAncestry(Subject subject, Integer[]
resourceIds,
+ public Map<Integer, String> getResourcesAncestry(final Subject subject,
Integer[] resourceIds,
ResourceAncestryFormat format) {
Map<Integer, String> result = new HashMap<Integer,
String>(resourceIds.length);
@@ -861,12 +863,20 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
return result;
}
- ResourceCriteria resourceCriteria = new ResourceCriteria();
+ final ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterIds(resourceIds);
resourceCriteria.fetchResourceType(true);
- resourceCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
- List<Resource> resources = findResourcesByCriteria(subject,
resourceCriteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new
CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return findResourcesByCriteria(subject, resourceCriteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> resources = new
CriteriaQuery<Resource, ResourceCriteria>(
+ resourceCriteria, queryExecutor);
if (ResourceAncestryFormat.RAW == format) {
for (Resource resource : resources) {
@@ -888,19 +898,36 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
// In addition to the types of the result resources, get the types of their
ancestry
typesSet.addAll(getAncestryTypeIds(ancestries));
- ResourceTypeCriteria resourceTypeCriteria = new ResourceTypeCriteria();
+ final ResourceTypeCriteria resourceTypeCriteria = new ResourceTypeCriteria();
resourceTypeCriteria.addFilterIds(typesSet.toArray(new
Integer[typesSet.size()]));
- resourceCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria> rtQueryExecutor
=
+ new CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria>() {
+ @Override
+ public PageList<ResourceType> execute(ResourceTypeCriteria
criteria) {
+ return typeManager.findResourceTypesByCriteria(subject,
resourceTypeCriteria);
+ }
+ };
- List<ResourceType> types = typeManager.findResourceTypesByCriteria(subject,
resourceTypeCriteria);
+ CriteriaQuery<ResourceType, ResourceTypeCriteria> types =
+ new CriteriaQuery<ResourceType,
ResourceTypeCriteria>(resourceTypeCriteria, rtQueryExecutor);
for (Resource resource : resources) {
- String decodedAncestry = getDecodedAncestry(resource, types, format);
+ String decodedAncestry = getDecodedAncestry(resource,
loadAsList(types.iterator()), format);
result.put(resource.getId(), decodedAncestry);
}
return result;
}
+ private List<ResourceType> loadAsList(Iterator<ResourceType> iterator) {
+ PageList<ResourceType> list = new PageList<ResourceType>();
+ while(iterator.hasNext()){
+ list.add(iterator.next());
+ }
+ return list;
+ }
+
/**
* Get the complete set of resource type Ids in the ancestries provided. This is
useful for
* being able to load all the types in advance of generating decoded values.
commit 6f2a62643acafde67e9726219b2d358adcb0a60b
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 08:16:49 2013 -0500
Update more criteriaQuery usages with CriteriaQuery instead of unbounded.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
index 3eb83e0..4638e25 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
@@ -41,6 +41,8 @@ import org.rhq.core.domain.drift.DriftSnapshot;
import org.rhq.core.domain.drift.DriftSnapshotRequest;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
public class DriftServerServiceImpl implements DriftServerService {
@@ -80,10 +82,19 @@ public class DriftServerServiceImpl implements DriftServerService {
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
criteria.addFilterResourceIds(resourceIds.toArray(new
Integer[resourceIds.size()]));
criteria.fetchConfiguration(true);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- Subject overlord = getSubjectManager().getOverlord();
- PageList<DriftDefinition> definitions =
getDriftManager().findDriftDefinitionsByCriteria(overlord, criteria);
+ final Subject overlord = getSubjectManager().getOverlord();
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<DriftDefinition, DriftDefinitionCriteria>
queryExecutor = new CriteriaQueryExecutor<DriftDefinition,
DriftDefinitionCriteria>() {
+ @Override
+ public PageList<DriftDefinition> execute(DriftDefinitionCriteria
criteria) {
+ return getDriftManager().findDriftDefinitionsByCriteria(overlord,
criteria);
+ }
+ };
+
+ CriteriaQuery<DriftDefinition, DriftDefinitionCriteria> definitions = new
CriteriaQuery<DriftDefinition, DriftDefinitionCriteria>(
+ criteria, queryExecutor);
Map<Integer, List<DriftDefinition>> result = new HashMap<Integer,
List<DriftDefinition>>();
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
index 39bda2c..5457e49 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
@@ -47,6 +47,8 @@ import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.authz.RequiredPermission;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -120,7 +122,7 @@ public class DriftTemplateManagerBean implements
DriftTemplateManagerLocal, Drif
@RequiredPermission(Permission.MANAGE_SETTINGS)
@Override
@TransactionAttribute(NEVER)
- public void pinTemplate(Subject subject, int templateId, int driftDefId, int
snapshotVersion) {
+ public void pinTemplate(final Subject subject, int templateId, int driftDefId, int
snapshotVersion) {
templateMgr.createTemplateChangeSet(subject, templateId, driftDefId,
snapshotVersion);
DriftDefinitionTemplateCriteria templateCriteria = new
DriftDefinitionTemplateCriteria();
@@ -135,9 +137,18 @@ public class DriftTemplateManagerBean implements
DriftTemplateManagerLocal, Drif
criteria.addFilterTemplateId(templateId);
criteria.fetchConfiguration(true);
criteria.fetchResource(true);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- PageList<DriftDefinition> definitions =
driftMgr.findDriftDefinitionsByCriteria(subject, criteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<DriftDefinition, DriftDefinitionCriteria>
queryExecutor = new CriteriaQueryExecutor<DriftDefinition,
DriftDefinitionCriteria>() {
+ @Override
+ public PageList<DriftDefinition> execute(DriftDefinitionCriteria
criteria) {
+ return driftMgr.findDriftDefinitionsByCriteria(subject, criteria);
+ }
+ };
+
+ CriteriaQuery<DriftDefinition, DriftDefinitionCriteria> definitions = new
CriteriaQuery<DriftDefinition, DriftDefinitionCriteria>(
+ criteria, queryExecutor);
+
for (DriftDefinition def : definitions) {
if (def.isAttached()) {
int resourceId = def.getResource().getId();
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
index 72eb3e4..239cf35 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
@@ -82,6 +82,8 @@ import org.rhq.enterprise.server.agentclient.AgentClient;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
import org.rhq.enterprise.server.core.AgentManagerLocal;
import org.rhq.enterprise.server.plugin.pc.drift.DriftChangeSetSummary;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.CriteriaQueryGenerator;
import org.rhq.enterprise.server.util.CriteriaQueryRunner;
@@ -178,15 +180,24 @@ public class JPADriftServerBean implements JPADriftServerLocal {
}
@Override
- public PageList<DriftComposite> findDriftCompositesByCriteria(Subject subject,
DriftCriteria criteria) {
+ public PageList<DriftComposite> findDriftCompositesByCriteria(final Subject
subject, DriftCriteria criteria) {
JPADriftCriteria jpaCriteria = (criteria instanceof JPADriftCriteria) ?
(JPADriftCriteria) criteria
: new JPADriftCriteria(criteria);
jpaCriteria.fetchChangeSet(true);
- jpaCriteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
- PageList<JPADrift> drifts = findDriftsByCriteria(subject, jpaCriteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<JPADrift, JPADriftCriteria> queryExecutor = new
CriteriaQueryExecutor<JPADrift, JPADriftCriteria>() {
+ @Override
+ public PageList<JPADrift> execute(JPADriftCriteria jpaCriteria) {
+ return findDriftsByCriteria(subject, jpaCriteria);
+ }
+ };
+
+ CriteriaQuery<JPADrift, JPADriftCriteria> drifts = new
CriteriaQuery<JPADrift, JPADriftCriteria>(jpaCriteria,
+ queryExecutor);
+
PageList<DriftComposite> result = new PageList<DriftComposite>();
for (JPADrift drift : drifts) {
JPADriftChangeSet changeSet = drift.getChangeSet();
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
index a7bd5c3..e114171 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
@@ -50,6 +50,8 @@ import
org.rhq.core.domain.resource.composite.PlatformMetricsSummary.SwapMetric;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.collection.ArrayUtils;
import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* @author jsanda
@@ -70,24 +72,42 @@ public class PlatformUtilizationManagerBean implements
PlatformUtilizationManage
private PlatformUtilizationManagerLocal platformUtilizationMgr;
@Override
- public PageList<PlatformMetricsSummary> loadPlatformMetrics(Subject subject) {
- ResourceTypeCriteria typeCriteria = new ResourceTypeCriteria();
+ public PageList<PlatformMetricsSummary> loadPlatformMetrics(final Subject
subject) {
+ final ResourceTypeCriteria typeCriteria = new ResourceTypeCriteria();
typeCriteria.addFilterCategory(PLATFORM);
typeCriteria.fetchMetricDefinitions(true);
- typeCriteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
- PageList<ResourceType> resourceTypes =
resourceTypeMgr.findResourceTypesByCriteria(subject, typeCriteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria> queryExecutor =
new CriteriaQueryExecutor<ResourceType, ResourceTypeCriteria>() {
+ @Override
+ public PageList<ResourceType> execute(ResourceTypeCriteria criteria) {
+ return resourceTypeMgr.findResourceTypesByCriteria(subject,
typeCriteria);
+ }
+ };
+
+ CriteriaQuery<ResourceType, ResourceTypeCriteria> resourceTypes = new
CriteriaQuery<ResourceType, ResourceTypeCriteria>(
+ typeCriteria, queryExecutor);
+
Map<Integer, Set<Integer>> platformMetricDefs = new
HashMap<Integer, Set<Integer>>();
for (ResourceType resourceType : resourceTypes) {
platformMetricDefs.put(resourceType.getId(),
getPlatformMetricDefIds(resourceType));
}
- ResourceCriteria resourceCriteria = new ResourceCriteria();
+ final ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterResourceCategories(PLATFORM);
resourceCriteria.addFilterInventoryStatus(COMMITTED);
- resourceCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
- PageList<Resource> platforms = resourceMgr.findResourcesByCriteria(subject,
resourceCriteria);
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> resourceQueryExecutor =
new CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceMgr.findResourcesByCriteria(subject, resourceCriteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> platforms = new
CriteriaQuery<Resource, ResourceCriteria>(
+ resourceCriteria, resourceQueryExecutor);
+
PageList<PlatformMetricsSummary> summaries = new
PageList<PlatformMetricsSummary>();
for (Resource platform : platforms) {
commit 05224b4bd31adfec2a24a4892a90f104a5bce779
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 03:19:51 2013 -0500
i)remove incorrect page clearing on CliComponent
ii)update more usages of criteria to also use CriteriaQuery.
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
index b9ca613..9fd49a7 100644
---
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
+++
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
@@ -25,7 +25,6 @@ import java.io.InputStreamReader;
import java.io.Reader;
import java.net.URI;
import java.nio.charset.Charset;
-import java.util.List;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -36,8 +35,11 @@ import org.rhq.core.domain.content.Repo;
import org.rhq.core.domain.content.composite.PackageAndLatestVersionComposite;
import org.rhq.core.domain.criteria.PackageCriteria;
import org.rhq.core.domain.criteria.RepoCriteria;
+import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.content.ContentManagerRemote;
import org.rhq.enterprise.server.content.RepoManagerRemote;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* The implementation of script source provider that is able to locate the script files
@@ -86,30 +88,45 @@ public class RepoScriptSourceProvider extends
BaseRhqSchemeScriptSourceProvider
String scriptName = path.substring(slashIdx + 1);
try {
- RepoManagerRemote repoManager = rhqFacade.getProxy(RepoManagerRemote.class);
+ final RepoManagerRemote repoManager =
rhqFacade.getProxy(RepoManagerRemote.class);
- RepoCriteria repoCrit = new RepoCriteria();
+ final RepoCriteria repoCrit = new RepoCriteria();
repoCrit.addFilterName(repoName);
- repoCrit.clearPaging();//disable paging as the code assumes all the results
will be returned.
- List<Repo> repos =
repoManager.findReposByCriteria(rhqFacade.getSubject(), repoCrit);
- if (repos.isEmpty()) {
+ //Use CriteriaQuery to automatically chunk/page through criteria query
results
+ CriteriaQueryExecutor<Repo, RepoCriteria> queryExecutor = new
CriteriaQueryExecutor<Repo, RepoCriteria>() {
+ @Override
+ public PageList<Repo> execute(RepoCriteria criteria) {
+ return repoManager.findReposByCriteria(rhqFacade.getSubject(),
repoCrit);
+ }
+ };
+
+ CriteriaQuery<Repo, RepoCriteria> repos = new CriteriaQuery<Repo,
RepoCriteria>(repoCrit, queryExecutor);
+
+ if (!repos.iterator().hasNext()) {
return null;
}
- ContentManagerRemote contentManager =
rhqFacade.getProxy(ContentManagerRemote.class);
+ final ContentManagerRemote contentManager =
rhqFacade.getProxy(ContentManagerRemote.class);
for (Repo repo : repos) {
- PackageCriteria pCrit = new PackageCriteria();
+ final PackageCriteria pCrit = new PackageCriteria();
pCrit.addFilterName(scriptName);
pCrit.addFilterRepoId(repo.getId());
- pCrit.clearPaging();//disable paging as the code assumes all the results
will be returned.
- List<PackageAndLatestVersionComposite> pvs =
contentManager.findPackagesWithLatestVersion(
- rhqFacade.getSubject(), pCrit);
+ //Use CriteriaQuery to automatically chunk/page through criteria query
results
+ CriteriaQueryExecutor<PackageAndLatestVersionComposite,
PackageCriteria> pQueryExecutor = new
CriteriaQueryExecutor<PackageAndLatestVersionComposite, PackageCriteria>() {
+ @Override
+ public PageList<PackageAndLatestVersionComposite>
execute(PackageCriteria criteria) {
+ return
contentManager.findPackagesWithLatestVersion(rhqFacade.getSubject(), pCrit);
+ }
+ };
+
+ CriteriaQuery<PackageAndLatestVersionComposite, PackageCriteria>
pvs = new CriteriaQuery<PackageAndLatestVersionComposite, PackageCriteria>(
+ pCrit, pQueryExecutor);
- if (!pvs.isEmpty()) {
- PackageAndLatestVersionComposite pv = pvs.get(0);
+ if (!pvs.iterator().hasNext()) {
+ PackageAndLatestVersionComposite pv = pvs.iterator().next();
byte[] bytes =
repoManager.getPackageVersionBytes(rhqFacade.getSubject(), repo.getId(), pv
.getLatestPackageVersion().getId());
diff --git
a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
index 2c1f874..d73b42e 100644
---
a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
+++
b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
@@ -304,7 +304,6 @@ public class CliComponent implements ServerPluginComponent,
ControlFacet {
String packageId =
cliNotification.getConfiguration().getSimpleValue(CliSender.PROP_PACKAGE_ID, null);
if (packageId != null) {
crit.addFilterPackageId(Integer.valueOf(packageId));
- crit.clearPaging();//disable paging as the code assumes all the results
will be returned.
PageList<PackageVersion> res =
contentManager.findPackageVersionsByCriteria(overlord, crit);
count = res.getTotalSize();
diff --git
a/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServer.java
b/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServer.java
index 9d25a30..f80b111 100644
---
a/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServer.java
+++
b/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServer.java
@@ -84,6 +84,8 @@ import
org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSet
import org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSetEntry;
import org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBFile;
import org.rhq.enterprise.server.resource.ResourceManagerLocal;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
import org.rhq.enterprise.server.util.LookupUtil;
public class MongoDBDriftServer implements DriftServerPluginFacet, ServerPluginComponent
{
@@ -397,12 +399,21 @@ public class MongoDBDriftServer implements DriftServerPluginFacet,
ServerPluginC
return new String(StreamUtil.slurp(file.getInputStream()));
}
- Map<Integer, Resource> loadResourceMap(Subject subject, Integer[] resourceIds)
{
+ Map<Integer, Resource> loadResourceMap(final Subject subject, Integer[]
resourceIds) {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterIds(resourceIds);
- ResourceManagerLocal resourceMgr = getResourceManager();
- PageList<Resource> resources = resourceMgr.findResourcesByCriteria(subject,
criteria);
+ final ResourceManagerLocal resourceMgr = getResourceManager();
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new
CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return resourceMgr.findResourcesByCriteria(subject, criteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> resources = new
CriteriaQuery<Resource, ResourceCriteria>(criteria,
+ queryExecutor);
Map<Integer, Resource> map = new HashMap<Integer, Resource>();
for (Resource r : resources) {
commit 2100a34c6176ea5f11eab5fc09e68b87bb6e8a1d
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 02:29:32 2013 -0500
Update unbounded criteria usage to instead use CriteriaQuery to iterate through
result sets.
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index e2738ee..773176b 100644
---
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -74,6 +74,8 @@ import
org.rhq.enterprise.server.measurement.MeasurementDefinitionManagerRemote;
import org.rhq.enterprise.server.operation.OperationManagerRemote;
import org.rhq.enterprise.server.resource.ResourceManagerRemote;
import org.rhq.enterprise.server.resource.ResourceTypeNotFoundException;
+import org.rhq.enterprise.server.util.CriteriaQuery;
+import org.rhq.enterprise.server.util.CriteriaQueryExecutor;
/**
* Implements a local object that exposes resource related data as
@@ -235,9 +237,18 @@ public class ResourceClientProxy {
private void initChildren() {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterParentResourceId(resourceId);
- criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
- PageList<Resource> childResources =
remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
- remoteClient.getSubject(), criteria);
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<Resource, ResourceCriteria> queryExecutor = new
CriteriaQueryExecutor<Resource, ResourceCriteria>() {
+ @Override
+ public PageList<Resource> execute(ResourceCriteria criteria) {
+ return
remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
+ remoteClient.getSubject(), criteria);
+ }
+ };
+
+ CriteriaQuery<Resource, ResourceCriteria> childResources = new
CriteriaQuery<Resource, ResourceCriteria>(
+ criteria, queryExecutor);
for (Resource child : childResources) {
this.children.add(proxyFactory.getResource(child.getId()));
@@ -247,14 +258,26 @@ public class ResourceClientProxy {
private void initMeasurements() {
MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
criteria.addFilterResourceTypeId(resource.getResourceType().getId());
-// criteria.addFilterResourceTypeName(resource.getResourceType().getName());
-// criteria.setStrict(true);
+ //
criteria.addFilterResourceTypeName(resource.getResourceType().getName());
+ // criteria.setStrict(true);
+
+ //Use CriteriaQuery to automatically chunk/page through criteria query results
+ CriteriaQueryExecutor<MeasurementDefinition, MeasurementDefinitionCriteria>
queryExecutor = new CriteriaQueryExecutor<MeasurementDefinition,
MeasurementDefinitionCriteria>() {
+ @Override
+ public PageList<MeasurementDefinition>
execute(MeasurementDefinitionCriteria criteria) {
+ return remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
+ .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(),
criteria);
+ }
+ };
+
+ CriteriaQuery<MeasurementDefinition, MeasurementDefinitionCriteria>
measurementDefIterator = new CriteriaQuery<MeasurementDefinition,
MeasurementDefinitionCriteria>(
+ criteria, queryExecutor);
- this.measurementDefinitions =
remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
- .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
+ this.measurementDefinitions = new PageList<MeasurementDefinition>();
this.measurementMap = new HashMap<String, Measurement>();
- for (MeasurementDefinition def : measurementDefinitions) {
+ for (MeasurementDefinition def : measurementDefIterator) {
+ this.measurementDefinitions.add(def);
Measurement m = new Measurement(def);
String name = def.getDisplayName().replaceAll("\\W",
"");
commit 53f0e721c12eac53044893bb0cd6778791a80b29
Author: Simeon Pinder <spinder(a)spinder.csb>
Date: Tue Feb 12 01:06:44 2013 -0500
i)Fixes nasty bug with CriteriaQuery that cause iteration to fail after two pages
ii)Added new unit test for regression testing of the fix.
iii)Added basic javadoc for CriteriaQuery.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
index be5b5a3..0a4509d 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/util/CriteriaQuery.java
@@ -27,10 +27,26 @@ import org.rhq.core.domain.criteria.BaseCriteria;
import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
+/** This class provides a way to make PageList results easily iterable for 'for
each' loops
+ * and importantly automatically handles iteration through all PageControl results.
This
+ * means that with a CriteriaQuery instance once can do:
+ *
+ * for (Resource entity : query) {
+ *
+ * and automatically page through the results in PageControl.getPageSize(def. 200)
chunks.
+ *
+ * @author John Sanda
+ * @author Simeon Pinder
+ *
+ * @param <T> The return type included by the PageList.
+ * @param <C> The Criteria subclass used to generate/execute the query.
+ */
public class CriteriaQuery<T, C extends BaseCriteria> implements Iterable<T>
{
+ //Criteria instance used by Executor to page through results
private C criteria;
+ //Executor
private CriteriaQueryExecutor<T, C> queryExecutor;
public CriteriaQuery(C criteria, CriteriaQueryExecutor<T, C> queryExecutor) {
@@ -38,6 +54,10 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements
Iterable<T> {
this.queryExecutor = queryExecutor;
}
+ /** Returns iterator for a single page of results as defined by
+ * i)the Criteria instance
+ * ii)the paging details applied to the Criteria instance
+ */
@Override
public Iterator<T> iterator() {
return new QueryResultsIterator(executeQuery());
@@ -47,6 +67,11 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements
Iterable<T> {
return queryExecutor.execute(criteria);
}
+ //Defines the iterator that:
+ // i)creates page sized chunks results
+ // ii)at the end of each pageList, moves the iterator to next page and continues
iteration
+ //
+ //NOTE: Assumes criteria page iteration starts with page 0. If that is not the case
private class QueryResultsIterator implements Iterator<T> {
private int count;
@@ -54,6 +79,9 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements
Iterable<T> {
private Iterator<T> iterator;
+ /**The first pageList returned by the criteria instance is where iteration
begins.
+ * @param firstPage
+ */
public QueryResultsIterator(PageList<T> firstPage) {
currentPage = firstPage;
iterator = currentPage.iterator();
@@ -66,6 +94,7 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements
Iterable<T> {
@Override
public T next() {
+ //define logic for the end of a pagelist to move the iterator onto next page
if (!iterator.hasNext()) {
if (count == currentPage.getTotalSize()) {
throw new NoSuchElementException();
@@ -73,7 +102,9 @@ public class CriteriaQuery<T, C extends BaseCriteria> implements
Iterable<T> {
PageControl pc = currentPage.getPageControl();
criteria.setPaging(pc.getPageNumber() + 1, pc.getPageSize());
+ //move the current pagelist forward one
currentPage = queryExecutor.execute(criteria);
+ currentPage.setPageControl(new PageControl(pc.getPageNumber() + 1,
pc.getPageSize()));
iterator = currentPage.iterator();
}
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
index cdccd6c..5d64970 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/CriteriaQueryTest.java
@@ -57,12 +57,16 @@ public class CriteriaQueryTest {
private static class FakeCriteriaQueryExecutor implements
CriteriaQueryExecutor<FakeEntity, FakeEntityCriteria> {
+ //list of pagelists
private List<PageList<FakeEntity>> pages = new
ArrayList<PageList<FakeEntity>>();
+ //total size
private int totalSize;
+ // the pageControl instance to use
private PageControl pc;
+ //
public FakeCriteriaQueryExecutor(int totalSize, PageControl pc) {
this.totalSize = totalSize;
this.pc = pc;
@@ -122,4 +126,60 @@ public class CriteriaQueryTest {
assertEquals(actual, expected);
}
+ /** This is like executeQueryThatReturnsMultiplePagesOfResults(), creates more
+ * that two pages of ordered entries and iterates over them. This is to test
+ * a nasty bug in CriteriaQuery where results beyond the first two pages were
+ * not being parsed.
+ */
+ @Test
+ public void executeQueryThatReturnsTotalPagesOfResults() {
+ //create page control to browse entries 100 at a time and start at page 0
+ int pageSize = 100;
+ PageControl pc = new PageControl(0, pageSize);
+
+ //Total size of result set is 500.
+ int totalSize = 500;
+
+ //Create list and populate with all entries.
+ List<FakeEntity> total = new ArrayList<FakeEntity>();
+ for (int i = 0; i < totalSize; i++) {
+ total.add(new FakeEntity(i));
+ }
+
+ //build executor to parse a given list with using PageControl passed in
+ FakeCriteriaQueryExecutor queryExecutor = new
FakeCriteriaQueryExecutor(totalSize, pc);
+
+ //add pages of results to simulate PageList results as returned by db queries
+ //todo: spinder, modify to support fractional results below and add last page.
+ int bucketCount = totalSize / pageSize;//number of full pages to list
+ int start = 0;
+ int end = pageSize;
+ //add bucketCount pages of data to read from.
+ for (int i = 0; i < bucketCount; i++) {
+ //Ex. first two pages (0, 100), (100,200), etc.
+ queryExecutor.addPage(total.subList(start, end));
+ start += pageSize;
+ end += pageSize;
+ }
+
+ //build criteria and attach pageControl
+ FakeEntityCriteria criteria = new FakeEntityCriteria();
+ //DO NOT use criteria.setPageControl(pc) here as it causes ignore of
pageNumber/pageSize
+ criteria.setPaging(pc.getPageNumber(), pc.getPageSize());
+
+ //?? So which pageControl has the right details? Criteria.pageControl? OR
PageControl passed into the QueryExecutor.
+
+ //Start off the initial query to page through the items in chunks defined by the
pageControl instance
+ CriteriaQuery<FakeEntity, FakeEntityCriteria> query = new
CriteriaQuery<FakeEntity, FakeEntityCriteria>(
+ criteria, queryExecutor);
+
+ //Now iterate over the list and make sure that iteration happens in order as
expected
+ //monotonically increasing.
+ int last = -1;
+ for (FakeEntity entity : query) {
+ //this fails with earlier bug in CriteriaQuery
+ assertEquals(true, (last < entity.getId()));
+ last = entity.getId();
+ }
+ }
}
commit a782494672c097804bedbee316bd42a75f033975
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 16:43:11 2013 -0500
Update default criteria usages for i)ScriptUtil and
ii)for ContentManagerBean.findPackagesWithLatestVersion usages as is a criteria
search but does not
include 'Criteria' in the method name as all the other criteria methods.
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
index 607263a..b9ca613 100644
---
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
+++
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
@@ -103,6 +103,7 @@ public class RepoScriptSourceProvider extends
BaseRhqSchemeScriptSourceProvider
PackageCriteria pCrit = new PackageCriteria();
pCrit.addFilterName(scriptName);
pCrit.addFilterRepoId(repo.getId());
+ pCrit.clearPaging();//disable paging as the code assumes all the results
will be returned.
List<PackageAndLatestVersionComposite> pvs =
contentManager.findPackagesWithLatestVersion(
rhqFacade.getSubject(), pCrit);
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
index bd121e7..6b86b61 100644
--- a/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
+++ b/modules/enterprise/binding/src/main/java/org/rhq/bindings/util/ScriptUtil.java
@@ -79,6 +79,8 @@ public class ScriptUtil {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterName(string);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
return resourceManager.findResourcesByCriteria(getSubjectFromEngine(),
criteria);
}
commit b5983f41c53750286601a16e2fca0eb17d31366e
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 16:34:28 2013 -0500
Update default criteria usages for ConfigurationMangerBean.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
index 50e5fd4..141b910 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/configuration/ConfigurationManagerBean.java
@@ -89,7 +89,6 @@ import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceError;
import org.rhq.core.domain.resource.ResourceErrorType;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.core.domain.resource.composite.ResourceComposite;
import org.rhq.core.domain.resource.group.GroupCategory;
import org.rhq.core.domain.resource.group.ResourceGroup;
import org.rhq.core.domain.resource.group.composite.ResourceGroupComposite;
@@ -2576,6 +2575,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
if (tt == PropertyOptionsSource.TargetType.RESOURCE || tt ==
PropertyOptionsSource.TargetType.CONFIGURATION) {
List<Resource> resources = null;
ResourceCriteria criteria = new ResourceCriteria();
+ criteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
if (tt == PropertyOptionsSource.TargetType.CONFIGURATION) {
// split out expression part for target=configuration
@@ -2631,6 +2631,7 @@ public class ConfigurationManagerBean implements
ConfigurationManagerLocal, Conf
// for groups we need to talk to the group manager
ResourceGroupCriteria criteria = new ResourceGroupCriteria();
criteria.setSearchExpression(expression);
+ criteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
resourceGroupManager.findResourceGroupCompositesByCriteria(subject,
criteria);
}
commit 4655782edfffe9706abe97948002d35b71d5d624
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 16:29:06 2013 -0500
Update more default criteria usages by SubjectManager bean and for Bundles as that
logic already assumes as much.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
index c9002ba..efe86fb 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/auth/SubjectManagerBean.java
@@ -216,6 +216,8 @@ public class SubjectManagerBean implements SubjectManagerLocal,
SubjectManagerRe
if (newLdapRoles != null) {
RoleCriteria subjectLdapRolesCriteria = new RoleCriteria();
subjectLdapRolesCriteria.addFilterLdapSubjectId(subjectToModify.getId());
+ subjectLdapRolesCriteria.clearPaging();//disable paging as the code assumes
all the results will be returned.
+
PageList<Role> currentLdapRoles =
roleManager.findRolesByCriteria(whoami, subjectLdapRolesCriteria);
ldapRolesModified = !(currentLdapRoles.containsAll(newLdapRoles) &&
newLdapRoles
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
index a6302de..4fabe9a 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleManagerBean.java
@@ -376,6 +376,8 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
criteria.addFilterDestinationId(bundleDestination.getId());
criteria.addFilterIsLive(true);
criteria.fetchBundleVersion(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
List<BundleDeployment> liveDeployments =
bundleManager.findBundleDeploymentsByCriteria(subject, criteria);
BundleDeployment liveDeployment = (liveDeployments.isEmpty()) ? null :
liveDeployments.get(0);
@@ -450,6 +452,8 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
BundleCriteria criteria = new BundleCriteria();
criteria.addFilterBundleTypeId(Integer.valueOf(bundleTypeId));
criteria.addFilterName(bundleName);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
PageList<Bundle> bundles = findBundlesByCriteria(subject, criteria);
Bundle bundle;
if (bundles.getTotalSize() == 0) {
@@ -630,6 +634,8 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
criteria.setStrict(true);
criteria.addFilterBundleTypeId(bundleType.getId());
criteria.addFilterName(bundleName);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
PageList<Bundle> bundles = bundleManager.findBundlesByCriteria(subject,
criteria);
Bundle bundle;
if (bundles.getTotalSize() == 0) {
@@ -699,6 +705,8 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
BundleFileCriteria bfCriteria = new BundleFileCriteria();
bfCriteria.addFilterBundleVersionId(bundleVersion.getId());
bfCriteria.fetchPackageVersion(true);
+ bfCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
+
PageList<BundleFile> bfs =
bundleManager.findBundleFilesByCriteria(subjectManager.getOverlord(),
bfCriteria);
bundleFiles.clear();
@@ -1477,6 +1485,8 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
Bundle bundle = version.getBundle();
BundleDestinationCriteria destinationCriteria = new
BundleDestinationCriteria();
destinationCriteria.addFilterBundleId(bundle.getId());
+ destinationCriteria.clearPaging();//disable paging as the code assumes all
the results will be returned.
+
List<BundleDestination> destinations =
findBundleDestinationsByCriteria(subject,destinationCriteria);
List<BundleDeployment> resultingDeployments = new
ArrayList<BundleDeployment>(version.getBundleDeployments().size());
// We now have visible destinations - go over the resultingDeployments and
only include the ones with vis. destinations
@@ -1534,6 +1544,8 @@ public class BundleManagerBean implements BundleManagerLocal,
BundleManagerRemot
for (Bundle bundle : bundles.getValues()) { // TODO clone the bundle and return
the modified clones
BundleDestinationCriteria destinationCriteria = new
BundleDestinationCriteria();
destinationCriteria.addFilterBundleId(bundle.getId());
+ destinationCriteria.clearPaging();//disable paging as the code assumes all
the results will be returned.
+
List<BundleDestination> destinations =
findBundleDestinationsByCriteria(subject,destinationCriteria);
bundle.setDestinations(destinations);
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
index 65a1209..0ca5b82 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/bundle/BundleServerServiceImpl.java
@@ -71,6 +71,8 @@ public class BundleServerServiceImpl implements BundleServerService {
bfc.addFilterBundleVersionId(bundleVersionId);
bfc.fetchPackageVersion(true);
+ bfc.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
List<BundleFile> bundleFiles = bm.findBundleFilesByCriteria(subject,
bfc);
List<PackageVersion> packageVersions = new
ArrayList<PackageVersion>(bundleFiles.size());
PackageVersion packageVersion = null;
commit 12dca890e6f2d53405a3f440f214d4020a315982
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 12:46:40 2013 -0500
i)Update several more instances of default criteria where logic assumed all results
returned.
ii)small cosmetic fix in rest description.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
index c75246f..a957d00 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentManagerBean.java
@@ -1593,7 +1593,9 @@ public class ContentManagerBean implements ContentManagerLocal,
ContentManagerRe
throw new IllegalArgumentException("The criteria query has to have a
filter for a specific repo.");
}
- criteria.fetchVersions(true);
+ criteria.fetchVersions(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
PageList<Package> packages = findPackagesByCriteria(subject, criteria);
PageList<PackageAndLatestVersionComposite> ret = new
PageList<PackageAndLatestVersionComposite>(packages.getTotalSize(),
packages.getPageControl());
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
index 775a1e8..e6bdf1b 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/ContentSourceManagerBean.java
@@ -749,6 +749,8 @@ public class ContentSourceManagerBean implements
ContentSourceManagerLocal {
RepoCriteria reposForContentSource = new RepoCriteria();
reposForContentSource.addFilterContentSourceIds(contentSourceId);
reposForContentSource.addFilterCandidate(false); // Don't sync
distributions for candidates
+ reposForContentSource.clearPaging();//disable paging as the code assumes all
the results will be returned.
+
Subject overlord = LookupUtil.getSubjectManager().getOverlord();
List<Repo> repos = repoManager.findReposByCriteria(overlord,
reposForContentSource);
log.debug("downloadDistributionBits found " + repos.size() + "
repos associated with this contentSourceId "
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
index c8234bb..64dde49 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/content/RepoManagerBean.java
@@ -582,6 +582,7 @@ public class RepoManagerBean implements RepoManagerLocal,
RepoManagerRemote {
RepoCriteria candidateReposCriteria = new RepoCriteria();
candidateReposCriteria.addFilterContentSourceIds(contentSourceId);
candidateReposCriteria.addFilterCandidate(true);
+ candidateReposCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
PageList<Repo> candidatesForThisProvider = findReposByCriteria(subject,
candidateReposCriteria);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
index f9143ce..ebaf451 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/GroupHandlerBean.java
@@ -54,7 +54,6 @@ import com.wordnik.swagger.annotations.ApiParam;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
-import org.jboss.resteasy.annotations.Form;
import org.jboss.resteasy.annotations.GZIP;
import org.jboss.resteasy.annotations.cache.Cache;
@@ -115,6 +114,8 @@ public class GroupHandlerBean extends AbstractRestBean {
if (q!=null) {
criteria.addFilterName(q);
}
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
List<ResourceGroup> groups =
resourceGroupManager.findResourceGroupsByCriteria(caller, criteria);
List<GroupRest> list = new ArrayList<GroupRest>(groups.size());
@@ -372,6 +373,8 @@ public class GroupHandlerBean extends AbstractRestBean {
if (q!=null) {
criteria.addFilterName(q);
}
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
PageList<GroupDefinition> gdlist =
definitionManager.findGroupDefinitionsByCriteria(caller, criteria);
List<GroupDefinitionRest> list = new
ArrayList<GroupDefinitionRest>(gdlist.getTotalSize());
for (GroupDefinition def: gdlist) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
index 92287d5..fbf81fb 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/OperationsHandlerBean.java
@@ -343,6 +343,7 @@ public class OperationsHandlerBean extends AbstractRestBean {
ResourceOperationHistoryCriteria criteria = new
ResourceOperationHistoryCriteria();
JobId jobId = new JobId(jobName);
criteria.addFilterJobId(jobId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
ResourceOperationHistory history ;//=
opsManager.getOperationHistoryByJobId(caller,jobName);
List<ResourceOperationHistory> list =
opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
@@ -386,6 +387,7 @@ public class OperationsHandlerBean extends AbstractRestBean {
criteria.addFilterResourceIds(resourceId);
criteria.addSortEndTime(PageOrdering.DESC);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
List<ResourceOperationHistory> list =
opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
@@ -413,6 +415,8 @@ public class OperationsHandlerBean extends AbstractRestBean {
ResourceOperationHistoryCriteria criteria = new
ResourceOperationHistoryCriteria();
criteria.addFilterJobId(new JobId(jobName));
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
List<ResourceOperationHistory> list =
opsManager.findResourceOperationHistoriesByCriteria(caller,criteria);
if ((list != null && !list.isEmpty())) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
index 8142f17..b748833 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/rest/ResourceHandlerBean.java
@@ -88,7 +88,12 @@ import org.rhq.enterprise.server.measurement.AvailabilityManagerLocal;
import org.rhq.enterprise.server.measurement.MeasurementScheduleManagerLocal;
import org.rhq.enterprise.server.resource.ResourceAlreadyExistsException;
import org.rhq.enterprise.server.resource.ResourceTypeManagerLocal;
-import org.rhq.enterprise.server.rest.domain.*;
+import org.rhq.enterprise.server.rest.domain.AvailabilityRest;
+import org.rhq.enterprise.server.rest.domain.Link;
+import org.rhq.enterprise.server.rest.domain.MetricSchedule;
+import org.rhq.enterprise.server.rest.domain.ResourceWithChildren;
+import org.rhq.enterprise.server.rest.domain.ResourceWithType;
+import org.rhq.enterprise.server.rest.domain.StringValue;
/**
* Class that deals with getting data about resources
@@ -324,6 +329,8 @@ public class ResourceHandlerBean extends AbstractRestBean {
criteria.addFilterInterval(start,end);
criteria.addFilterResourceId(resourceId);
criteria.addSortStartTime(PageOrdering.DESC);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
List<Availability> points =
availMgr.findAvailabilityByCriteria(caller,criteria);
List<AvailabilityRest> ret = new
ArrayList<AvailabilityRest>(points.size());
for (Availability avail : points) {
@@ -517,6 +524,8 @@ public class ResourceHandlerBean extends AbstractRestBean {
public List<Link> getAlertsForResource(@ApiParam("Id of the resource to
query") @PathParam("id") int resourceId) {
AlertCriteria criteria = new AlertCriteria();
criteria.addFilterResourceIds(resourceId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
List<Alert> alerts = alertManager.findAlertsByCriteria(caller, criteria);
List<Link> links = new ArrayList<Link>(alerts.size());
for (Alert al : alerts) {
@@ -638,9 +647,9 @@ public class ResourceHandlerBean extends AbstractRestBean {
@POST
@Path("/")
- @ApiOperation("Create a new resource as a child of an existing resource¡")
+ @ApiOperation("Create a new resource as a child of an existing
resource<A1>")
public Response createResource(
- @ApiParam("THe info about the resource. You need to supply resource name,
resource type name, plugin name, id of the parent") ResourceWithType resource,
+ @ApiParam("The info about the resource. You need to supply resource name,
resource type name, plugin name, id of the parent") ResourceWithType resource,
@Context UriInfo uriInfo)
{
return
createResourceInternal(resource.getResourceName(),resource.getPluginName(),resource.getParentId(),resource.getTypeName(),uriInfo);
commit 5b4db0d3246d9e43da722d4dd6a679481e17023a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 10:29:58 2013 -0500
Update some more default criteria usages to disable paging where logic already
assumes it.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
index b59ca8b..134dedf 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/authz/RoleManagerBean.java
@@ -140,6 +140,8 @@ public class RoleManagerBean implements RoleManagerLocal,
RoleManagerRemote {
// Make sure there's not an existing role with the same name.
RoleCriteria criteria = new RoleCriteria();
criteria.addFilterName(newRole.getName());
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
PageList<Role> roles = findRolesByCriteria(whoami, criteria);
if (!roles.isEmpty()) {
throw new EntityExistsException("A user role [" + newRole.getName()
+ "] already exists.");
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
index d5d7128..63cb44d 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/discovery/DiscoveryBossBean.java
@@ -1080,6 +1080,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterPluginName(plugin);
criteria.addFilterName(name);
+ criteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
+
List<ResourceType> result =
resourceTypeManager.findResourceTypesByCriteria(
subjectManager.getOverlord(), criteria);
@@ -1266,6 +1268,8 @@ public class DiscoveryBossBean implements DiscoveryBossLocal,
DiscoveryBossRemot
ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterParentResourceId(parentResource.getId());
resourceCriteria.addFilterResourceTypeId(resourceType.getId());
+ resourceCriteria.clearPaging();//Doc: disable paging as the code assumes all
the results will be returned.
+
PageList<Resource> childResourcesOfType =
resourceManager.findResourcesByCriteria(
subjectManager.getOverlord(), resourceCriteria);
if (childResourcesOfType.size() >= 1) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java
index c159275..9f7fc00 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/inventory/InventoryManagerBean.java
@@ -1,10 +1,6 @@
package org.rhq.enterprise.server.inventory;
-import java.util.HashSet;
import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.SortedSet;
import javax.ejb.EJB;
import javax.ejb.Stateless;
@@ -14,9 +10,7 @@ import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
-import org.rhq.core.domain.criteria.ResourceCriteria;
import org.rhq.core.domain.criteria.ResourceTypeCriteria;
-import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.auth.SubjectManagerLocal;
@@ -78,6 +72,7 @@ public class InventoryManagerBean implements InventoryManagerLocal {
public List<ResourceType> getDeletedTypes() {
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterDeleted(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
return resourceTypeMgr.findResourceTypesByCriteria(subjectMgr.getOverlord(),
criteria);
}
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
index bfc2164..1629926 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/search/execution/SearchAssistManager.java
@@ -606,6 +606,7 @@ public class SearchAssistManager {
criteria.setCaseSensitive(false);
criteria.addSortName(PageOrdering.ASC);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
List<SavedSearch> savedSearchResults =
savedSearchManager.findSavedSearchesByCriteria(subject, criteria);
@@ -636,6 +637,7 @@ public class SearchAssistManager {
criteria.setCaseSensitive(false);
criteria.addSortName(PageOrdering.ASC);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
List<SavedSearch> savedSearchResults =
savedSearchManager.findSavedSearchesByCriteria(subject, criteria);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
index a7e05a2..944f799 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/tagging/TagManagerBean.java
@@ -84,6 +84,8 @@ public class TagManagerBean implements TagManagerLocal, TagManagerRemote
{
criteria.addFilterSemantic(tag.getSemantic());
criteria.addFilterName(tag.getName());
criteria.setStrict(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
+
List<Tag> found = findTagsByCriteria(subject, criteria);
if (!found.isEmpty()) {
assert found.size() == 1; // should never be more than one
commit 9b0f4a401362baed1e1a0b0d171195403b31a554
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 09:36:09 2013 -0500
Update criteria usage by job to explicitly return all the results and not the
default.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
index 574dea2..08a4775 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/scheduler/jobs/ContentProviderSyncJob.java
@@ -117,6 +117,8 @@ public class ContentProviderSyncJob implements StatefulJob {
RepoCriteria repoCriteria = new RepoCriteria();
repoCriteria.addFilterContentSourceIds(contentSource.getId());
repoCriteria.addFilterCandidate(false);
+ repoCriteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
+
RepoManagerLocal repoManager = LookupUtil.getRepoManagerLocal();
PageList<Repo> repos = repoManager.findReposByCriteria(overlord,
repoCriteria);
Integer[] repoIds = new Integer[repos.size()];
commit 122db27657ac9b66573c2695cd38de76b42045c6
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 09:19:56 2013 -0500
Update Resource type and metadata default usages of criteria to return all results as
assumed by logic.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
index 0e4c2c9..a7bd5c3 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/PlatformUtilizationManagerBean.java
@@ -21,6 +21,11 @@
package org.rhq.enterprise.server.resource;
+import static java.util.Arrays.asList;
+import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
+import static org.rhq.core.domain.resource.InventoryStatus.COMMITTED;
+import static org.rhq.core.domain.resource.ResourceCategory.PLATFORM;
+
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@@ -39,18 +44,13 @@ import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceType;
import org.rhq.core.domain.resource.composite.PlatformMetricsSummary;
+import org.rhq.core.domain.resource.composite.PlatformMetricsSummary.CPUMetric;
+import org.rhq.core.domain.resource.composite.PlatformMetricsSummary.MemoryMetric;
+import org.rhq.core.domain.resource.composite.PlatformMetricsSummary.SwapMetric;
import org.rhq.core.domain.util.PageList;
import org.rhq.core.util.collection.ArrayUtils;
import org.rhq.enterprise.server.measurement.MeasurementDataManagerLocal;
-import static java.util.Arrays.asList;
-import static javax.ejb.TransactionAttributeType.REQUIRES_NEW;
-import static org.rhq.core.domain.resource.InventoryStatus.COMMITTED;
-import static org.rhq.core.domain.resource.ResourceCategory.PLATFORM;
-import static org.rhq.core.domain.resource.composite.PlatformMetricsSummary.CPUMetric;
-import static
org.rhq.core.domain.resource.composite.PlatformMetricsSummary.MemoryMetric;
-import static org.rhq.core.domain.resource.composite.PlatformMetricsSummary.SwapMetric;
-
/**
* @author jsanda
*/
@@ -74,6 +74,7 @@ public class PlatformUtilizationManagerBean implements
PlatformUtilizationManage
ResourceTypeCriteria typeCriteria = new ResourceTypeCriteria();
typeCriteria.addFilterCategory(PLATFORM);
typeCriteria.fetchMetricDefinitions(true);
+ typeCriteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
PageList<ResourceType> resourceTypes =
resourceTypeMgr.findResourceTypesByCriteria(subject, typeCriteria);
Map<Integer, Set<Integer>> platformMetricDefs = new
HashMap<Integer, Set<Integer>>();
@@ -84,6 +85,7 @@ public class PlatformUtilizationManagerBean implements
PlatformUtilizationManage
ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterResourceCategories(PLATFORM);
resourceCriteria.addFilterInventoryStatus(COMMITTED);
+ resourceCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
PageList<Resource> platforms = resourceMgr.findResourcesByCriteria(subject,
resourceCriteria);
PageList<PlatformMetricsSummary> summaries = new
PageList<PlatformMetricsSummary>();
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
index ad81fb1..a7f7433 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceFactoryManagerBean.java
@@ -717,6 +717,8 @@ public class ResourceFactoryManagerBean implements
ResourceFactoryManagerLocal,
ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterParentResourceId(parentResource.getId());
resourceCriteria.addFilterResourceTypeId(resourceType.getId());
+ resourceCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
+
PageList<Resource> childResourcesOfType =
resourceManager.findResourcesByCriteria(
subjectManager.getOverlord(), resourceCriteria);
if (childResourcesOfType.size() >= 1) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
index 0b06d92..205252d 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceManagerBean.java
@@ -814,6 +814,8 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterParentResourceId(ancestor.getResource().getId());
criteria.addSortName(PageOrdering.ASC);
+ criteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
+
List<Resource> children = findResourcesByCriteriaBounded(subject,
criteria, 0, 0);
// Remove any that are in the lineage to avoid repeated handling.
children.removeAll(rawResourceLineage);
@@ -862,6 +864,8 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
ResourceCriteria resourceCriteria = new ResourceCriteria();
resourceCriteria.addFilterIds(resourceIds);
resourceCriteria.fetchResourceType(true);
+ resourceCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
+
List<Resource> resources = findResourcesByCriteria(subject,
resourceCriteria);
if (ResourceAncestryFormat.RAW == format) {
@@ -886,6 +890,8 @@ public class ResourceManagerBean implements ResourceManagerLocal,
ResourceManage
ResourceTypeCriteria resourceTypeCriteria = new ResourceTypeCriteria();
resourceTypeCriteria.addFilterIds(typesSet.toArray(new
Integer[typesSet.size()]));
+ resourceCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
+
List<ResourceType> types = typeManager.findResourceTypesByCriteria(subject,
resourceTypeCriteria);
for (Resource resource : resources) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
index f93a935..d4f9bb9 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/ResourceTypeManagerBean.java
@@ -525,6 +525,8 @@ public class ResourceTypeManagerBean implements
ResourceTypeManagerLocal, Resour
if (sawTopLevelServer) {
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
criteria.addFilterCategory(ResourceCategory.PLATFORM);
+ criteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
+
List<ResourceType> platforms = findResourceTypesByCriteria(subject,
criteria);
results.addAll(platforms);
}
@@ -539,6 +541,8 @@ public class ResourceTypeManagerBean implements
ResourceTypeManagerLocal, Resour
if (first.getCategory() == ResourceCategory.PLATFORM) {
ResourceTypeCriteria criteria = new ResourceTypeCriteria();
+ criteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
+
List<ResourceType> allResourceTypes =
findResourceTypesByCriteria(subject, criteria);
List<ResourceType> results = new ArrayList<ResourceType>();
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
index 25ea666..a52c4c2 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/AlertMetadataManagerBean.java
@@ -1,21 +1,20 @@
package org.rhq.enterprise.server.resource.metadata;
+import java.util.List;
+
+import javax.ejb.EJB;
+import javax.ejb.Stateless;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
+
import org.rhq.core.domain.alert.AlertDefinition;
import org.rhq.core.domain.auth.Subject;
import org.rhq.core.domain.criteria.AlertDefinitionCriteria;
import org.rhq.core.domain.resource.ResourceType;
-import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.alert.AlertDefinitionManagerLocal;
import org.rhq.enterprise.server.alert.AlertTemplateManagerLocal;
-import javax.ejb.EJB;
-import javax.ejb.Stateless;
-import javax.persistence.EntityManager;
-import javax.persistence.PersistenceContext;
-import java.util.List;
-
@Stateless
public class AlertMetadataManagerBean implements AlertMetadataManagerLocal {
@@ -33,6 +32,8 @@ public class AlertMetadataManagerBean implements
AlertMetadataManagerLocal {
AlertDefinitionCriteria criteria = new AlertDefinitionCriteria();
criteria.addFilterAlertTemplateResourceTypeId(resourceType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
List<AlertDefinition> templates =
alertDefinitionMgr.findAlertDefinitionsByCriteria(subject, criteria);
Integer[] templateIds = new Integer[templates.size()];
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
index 6fc58d6..cd54bf0 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ContentMetadataManagerBean.java
@@ -239,6 +239,7 @@ public class ContentMetadataManagerBean implements
ContentMetadataManagerLocal {
BundleCriteria criteria = new BundleCriteria();
criteria.addFilterBundleTypeId(bundleType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
List<Bundle> bundles = bundleMgr.findBundlesByCriteria(subject, criteria);
for (Bundle bundle : bundles) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
index 7b03d73..0ab7dee 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/MeasurementMetadataManagerBean.java
@@ -216,6 +216,8 @@ public class MeasurementMetadataManagerBean implements
MeasurementMetadataManage
MeasurementDefinitionCriteria criteria = new MeasurementDefinitionCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
List<MeasurementDefinition> definitions =
measurementDefinitionMgr.findMeasurementDefinitionsByCriteria(
subjectMgr.getOverlord(), criteria);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
index 841fe03..f833bc5 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginConfigurationMetadataManagerBean.java
@@ -76,6 +76,8 @@ public class PluginConfigurationMetadataManagerBean implements
PluginConfigurati
Subject overlord = subjectMgr.getOverlord();
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
+
List<Resource> resources =
resourceMgr.findResourcesByCriteria(overlord, criteria);
for (Resource resource : resources) {
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
index f3c7158..6f0c9df 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/ResourceMetadataManagerBean.java
@@ -682,6 +682,8 @@ public class ResourceMetadataManagerBean implements
ResourceMetadataManagerLocal
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterResourceTypeId(existingType.getId());
criteria.addFilterParentResourceTypeId(obsoleteParentType.getId());
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
List<Resource> resources =
resourceManager.findResourcesByCriteria(overlord, criteria);
for (Resource resource : resources) {
Resource newParent = null;
commit 91cd383c9b82499340009922e8ed6ba5db919760
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Tue Feb 5 08:51:30 2013 -0500
i)Update drift component criteria usage to use explicitly request resources as
already assumed by the logic.
ii)Updated one or two spots to explicitly request single result pagesets where
already assumed by logic.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index 35339cc..dcc08d8 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -208,6 +208,7 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
DriftDefinitionCriteria driftDefCriteria = new DriftDefinitionCriteria();
driftDefCriteria.addFilterResourceIds(resourceId);
driftDefCriteria.addFilterName(driftDefName);
+ driftDefCriteria.clearPaging();//disable paging as the code assumes all the
results will be returned.
PageList<DriftDefinition> defs = findDriftDefinitionsByCriteria(overlord,
driftDefCriteria);
if (defs.isEmpty()) {
@@ -286,6 +287,7 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
criteria.setStrict(true);
criteria.fetchDrifts(true);
criteria.addSortVersion(PageOrdering.ASC);
+ criteria.setPageControl(PageControl.getUnlimitedInstance());//disable paging as
the code assumes all the results will be returned.
PageList<? extends DriftChangeSet<?>> changeSets =
findDriftChangeSetsByCriteria(subject, criteria);
for (DriftChangeSet<? extends Drift<?, ?>> changeSet : changeSets) {
@@ -303,6 +305,7 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
criteria.addFilterDriftDefinitionId(request.getDriftDefinitionId());
criteria.addFilterId(request.getTemplateChangeSetId());
criteria.fetchDrifts(true);
+ criteria.setPageControl(PageControl.getUnlimitedInstance());//disable paging as
the code assumes all the results will be returned.
PageList<? extends DriftChangeSet<?>> changeSets =
findDriftChangeSetsByCriteria(subject, criteria);
if (changeSets.isEmpty()) {
@@ -353,6 +356,8 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
criteria.addFilterName(driftDefName);
criteria.addFilterResourceIds(resourceId);
criteria.setStrict(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
+
PageList<DriftDefinition> results =
driftManager.findDriftDefinitionsByCriteria(subject, criteria);
DriftDefinition doomedDriftDef = null;
if (results != null && results.size() == 1) {
@@ -503,6 +508,8 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
criteria.addFilterName(summary.getDriftDefinitionName());
criteria.addFilterResourceIds(resourceId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
+
PageList<DriftDefinition> definitions =
findDriftDefinitionsByCriteria(subject, criteria);
if (definitions.isEmpty()) {
@@ -692,6 +699,8 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
GenericDriftCriteria criteria = new GenericDriftCriteria();
criteria.addFilterId(driftId1);
+ criteria.setPageControl(PageControl.getSingleRowInstance());
+
List<? extends Drift<?, ?>> result =
driftServerPlugin.findDriftsByCriteria(subject, criteria);
if (result.size() != 1) {
throw new IllegalArgumentException("Drift record not found: " +
driftId1);
@@ -699,6 +708,8 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
Drift drift1 = result.get(0);
criteria.addFilterId(driftId2);
+ criteria.setPageControl(PageControl.getSingleRowInstance());
+
result = driftServerPlugin.findDriftsByCriteria(subject, criteria);
if (result.size() != 1) {
throw new IllegalArgumentException("Drift record not found: " +
driftId2);
@@ -889,6 +900,7 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
GenericDriftCriteria criteria = new GenericDriftCriteria();
criteria.addFilterId(driftId);
criteria.fetchChangeSet(true);
+ criteria.setPageControl(PageControl.getSingleRowInstance());
DriftDetails driftDetails = new DriftDetails();
DriftServerPluginFacet driftServerPlugin = getServerPlugin();
@@ -946,6 +958,7 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
criteria.addFilterResourceId(drift.getChangeSet().getResourceId());
criteria.addFilterDriftDefinitionId(drift.getChangeSet().getDriftDefinitionId());
criteria.addFilterVersion(Integer.toString(drift.getChangeSet().getVersion() -
1));
+ criteria.setPageControl(PageControl.getSingleRowInstance());
PageList<? extends DriftChangeSet<?>> results =
findDriftChangeSetsByCriteria(subject, criteria);
// TODO handle empty results
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
index b206b54..3eb83e0 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftServerServiceImpl.java
@@ -80,6 +80,7 @@ public class DriftServerServiceImpl implements DriftServerService {
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
criteria.addFilterResourceIds(resourceIds.toArray(new
Integer[resourceIds.size()]));
criteria.fetchConfiguration(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
Subject overlord = getSubjectManager().getOverlord();
PageList<DriftDefinition> definitions =
getDriftManager().findDriftDefinitionsByCriteria(overlord, criteria);
@@ -119,6 +120,7 @@ public class DriftServerServiceImpl implements DriftServerService {
DriftDefinitionCriteria criteria = new DriftDefinitionCriteria();
criteria.addFilterResourceIds(resourceId);
criteria.addFilterName(drfitDefName);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
DriftManagerLocal driftMgr = getDriftManager();
SubjectManagerLocal subjectMgr = getSubjectManager();
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
index 5d149a1..72eb3e4 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/JPADriftServerBean.java
@@ -184,6 +184,8 @@ public class JPADriftServerBean implements JPADriftServerLocal {
: new JPADriftCriteria(criteria);
jpaCriteria.fetchChangeSet(true);
+ jpaCriteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
+
PageList<JPADrift> drifts = findDriftsByCriteria(subject, jpaCriteria);
PageList<DriftComposite> result = new PageList<DriftComposite>();
for (JPADrift drift : drifts) {
commit 7fd0b56fcaa9a506ad409d52636a8dbf8b405e7b
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 17:21:14 2013 -0500
Update criteria usage to explicitly support all or one search resource where
applicable as already expected by the code.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
index 528fd7a..39bda2c 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftTemplateManagerBean.java
@@ -41,6 +41,7 @@ import org.rhq.core.domain.drift.DriftSnapshot;
import org.rhq.core.domain.drift.DriftSnapshotRequest;
import org.rhq.core.domain.drift.dto.DriftChangeSetDTO;
import org.rhq.core.domain.resource.ResourceType;
+import org.rhq.core.domain.util.PageControl;
import org.rhq.core.domain.util.PageList;
import org.rhq.enterprise.server.RHQConstants;
import org.rhq.enterprise.server.authz.RequiredPermission;
@@ -125,6 +126,7 @@ public class DriftTemplateManagerBean implements
DriftTemplateManagerLocal, Drif
DriftDefinitionTemplateCriteria templateCriteria = new
DriftDefinitionTemplateCriteria();
templateCriteria.addFilterId(templateId);
templateCriteria.fetchDriftDefinitions(true);
+ templateCriteria.setPageControl(PageControl.getSingleRowInstance());
PageList<DriftDefinitionTemplate> templates =
templateMgr.findTemplatesByCriteria(subject, templateCriteria);
DriftDefinitionTemplate template = templates.get(0);
@@ -133,6 +135,7 @@ public class DriftTemplateManagerBean implements
DriftTemplateManagerLocal, Drif
criteria.addFilterTemplateId(templateId);
criteria.fetchConfiguration(true);
criteria.fetchResource(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
PageList<DriftDefinition> definitions =
driftMgr.findDriftDefinitionsByCriteria(subject, criteria);
for (DriftDefinition def : definitions) {
commit f7e7b33e564c123750c5d40a7fbb4df2ab6e5a64
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 17:12:33 2013 -0500
Update measurementSchedule default criteria usage to support larger then default
result sets.
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerBean.java
index 934dcd1..9ca60bc 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/measurement/MeasurementChartsManagerBean.java
@@ -461,6 +461,8 @@ public class MeasurementChartsManagerBean implements
MeasurementChartsManagerLoc
criteria.addFilterAutoGroupResourceTypeId(context.resourceTypeId);
}
criteria.addFilterDefinitionIds(definitionId);
+ criteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
+
PageList<MeasurementSchedule> theSchedules =
scheduleManager.findSchedulesByCriteria(subject, criteria);
int totalScheduleCount = theSchedules.getTotalSize();
commit b7c248012959381e365b1afca4a01a373ed12755
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 16:54:58 2013 -0500
update default criteria instances in the server side plugins as code already assumes
as much.
diff --git
a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
index d73b42e..2c1f874 100644
---
a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
+++
b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliComponent.java
@@ -304,6 +304,7 @@ public class CliComponent implements ServerPluginComponent,
ControlFacet {
String packageId =
cliNotification.getConfiguration().getSimpleValue(CliSender.PROP_PACKAGE_ID, null);
if (packageId != null) {
crit.addFilterPackageId(Integer.valueOf(packageId));
+ crit.clearPaging();//disable paging as the code assumes all the results
will be returned.
PageList<PackageVersion> res =
contentManager.findPackageVersionsByCriteria(overlord, crit);
count = res.getTotalSize();
diff --git
a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
index 5eb9360..2d2cd63 100644
---
a/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
+++
b/modules/enterprise/server/plugins/alert-cli/src/main/java/org/rhq/enterprise/server/plugins/alertCli/CliSender.java
@@ -397,6 +397,7 @@ public class CliSender extends AlertSender<CliComponent> {
RepoCriteria criteria = new RepoCriteria();
criteria.addFilterId(config.repoId);
+ criteria.clearPaging();//disable paging as the code assumes all the results
will be returned.
List<Repo> repos = rm.findReposByCriteria(overlord, criteria);
commit b42ab9daa335de32779daf8d0563f5720afe9dca
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 16:36:42 2013 -0500
update some more usages of Criteria to return all results as code already assumes
this.
diff --git
a/modules/enterprise/gui/content_http-war/src/main/java/org/rhq/gui/content/ContentHTTPServlet.java
b/modules/enterprise/gui/content_http-war/src/main/java/org/rhq/gui/content/ContentHTTPServlet.java
index cfcf1ec..9990bda 100644
---
a/modules/enterprise/gui/content_http-war/src/main/java/org/rhq/gui/content/ContentHTTPServlet.java
+++
b/modules/enterprise/gui/content_http-war/src/main/java/org/rhq/gui/content/ContentHTTPServlet.java
@@ -563,6 +563,7 @@ public class ContentHTTPServlet extends DefaultServlet {
criteria.addFilterFileName(fileName);
criteria.addFilterRepoId(repo.getId());
criteria.setStrict(true);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
log.debug("Created criteria for repoId = " + repo.getId() + ",
fileName = " + fileName);
List<PackageVersion> pkgVers =
contentMgr.findPackageVersionsByCriteria(LookupUtil.getSubjectManager()
.getOverlord(), criteria);
diff --git
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
index 7abdd49..35339cc 100644
---
a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
+++
b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/drift/DriftManagerBean.java
@@ -222,6 +222,7 @@ public class DriftManagerBean implements DriftManagerLocal,
DriftManagerRemote {
criteria.addFilterDriftDefinitionId(driftDef.getId());
criteria.addFilterVersion(Integer.toString(version));
criteria.fetchDrifts(true);
+ criteria.setPageControl(PageControl.getUnlimitedInstance());//disable paging as
the code assumes all the results will be returned.
PageList<? extends DriftChangeSet<?>> changeSets =
driftServerPlugin.findDriftChangeSetsByCriteria(overlord,
criteria);
commit 6f83ea4895cf4fe44e569d0fd837a4c78353c2b5
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 16:09:35 2013 -0500
Modify criteria to return all instances as logic assumes as much.
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
index 2a1f944..607263a 100644
---
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
+++
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/script/RepoScriptSourceProvider.java
@@ -90,6 +90,7 @@ public class RepoScriptSourceProvider extends
BaseRhqSchemeScriptSourceProvider
RepoCriteria repoCrit = new RepoCriteria();
repoCrit.addFilterName(repoName);
+ repoCrit.clearPaging();//disable paging as the code assumes all the results
will be returned.
List<Repo> repos =
repoManager.findReposByCriteria(rhqFacade.getSubject(), repoCrit);
if (repos.isEmpty()) {
commit 0ffe7828cbd10a63142e1fa3b69b8bac05d61565
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 15:54:23 2013 -0500
modify ResourceClientProxy to now process all child resources.
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index 7361fe8..e2738ee 100644
---
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -235,6 +235,7 @@ public class ResourceClientProxy {
private void initChildren() {
ResourceCriteria criteria = new ResourceCriteria();
criteria.addFilterParentResourceId(resourceId);
+ criteria.clearPaging();//disable paging as the code assumes all the results will
be returned.
PageList<Resource> childResources =
remoteClient.getProxy(ResourceManagerRemote.class).findResourcesByCriteria(
remoteClient.getSubject(), criteria);
commit 9fcf54993de428e43db31366345ab6fd25dddb5a
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Feb 4 15:37:01 2013 -0500
Reverting " update ResourceClientProxy to handle larger metric definition
results." as this approach is particularly problematic to implement when i)the same
processed elements could be available in subsequent chunk queries and with ii)large
deployments when parsing full list or resources can take long enough to span other
transactions.
This reverts commit 42d955fc9e59c1ae0a1e69aead9c0d25fca60ba6.
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index a9c272a..7361fe8 100644
---
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -253,23 +253,14 @@ public class ResourceClientProxy {
.findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
this.measurementMap = new HashMap<String, Measurement>();
- //Chunk through the results in 200(default) page element batches to avoid
excessive
- //memory usage for large deployments
- while (!measurementDefinitions.isEmpty()) {
- for (MeasurementDefinition def : measurementDefinitions) {
- Measurement m = new Measurement(def);
+ for (MeasurementDefinition def : measurementDefinitions) {
+ Measurement m = new Measurement(def);
- String name = def.getDisplayName().replaceAll("\\W",
"");
- name = decapitalize(name);
+ String name = def.getDisplayName().replaceAll("\\W",
"");
+ name = decapitalize(name);
- this.measurementMap.put(name, m);
- this.allProperties.put(name, m);
- }
- //process next batch if available with new criteria instance
- criteria = new MeasurementDefinitionCriteria();
- criteria.addFilterResourceTypeId(resource.getResourceType().getId());
- this.measurementDefinitions =
remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
- .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(),
criteria);
+ this.measurementMap.put(name, m);
+ this.allProperties.put(name, m);
}
}
commit 42d955fc9e59c1ae0a1e69aead9c0d25fca60ba6
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Fri Feb 1 09:25:14 2013 -0500
update ResourceClientProxy to handle larger metric definition results.
diff --git
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
index 7361fe8..a9c272a 100644
---
a/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
+++
b/modules/enterprise/binding/src/main/java/org/rhq/bindings/client/ResourceClientProxy.java
@@ -253,14 +253,23 @@ public class ResourceClientProxy {
.findMeasurementDefinitionsByCriteria(remoteClient.getSubject(), criteria);
this.measurementMap = new HashMap<String, Measurement>();
- for (MeasurementDefinition def : measurementDefinitions) {
- Measurement m = new Measurement(def);
+ //Chunk through the results in 200(default) page element batches to avoid
excessive
+ //memory usage for large deployments
+ while (!measurementDefinitions.isEmpty()) {
+ for (MeasurementDefinition def : measurementDefinitions) {
+ Measurement m = new Measurement(def);
- String name = def.getDisplayName().replaceAll("\\W",
"");
- name = decapitalize(name);
+ String name = def.getDisplayName().replaceAll("\\W",
"");
+ name = decapitalize(name);
- this.measurementMap.put(name, m);
- this.allProperties.put(name, m);
+ this.measurementMap.put(name, m);
+ this.allProperties.put(name, m);
+ }
+ //process next batch if available with new criteria instance
+ criteria = new MeasurementDefinitionCriteria();
+ criteria.addFilterResourceTypeId(resource.getResourceType().getId());
+ this.measurementDefinitions =
remoteClient.getProxy(MeasurementDefinitionManagerRemote.class)
+ .findMeasurementDefinitionsByCriteria(remoteClient.getSubject(),
criteria);
}
}