[rhq] modules/core
by ips
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityCollectorRunnable.java | 5 +--
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployRequest.java | 1
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployResult.java | 2 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleFacet.java | 3 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleManagerProvider.java | 3 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundlePurgeRequest.java | 8 +++++
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundlePurgeResult.java | 1
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ConfigurationFacet.java | 2 -
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java | 3 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationUpdateException.java | 2 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java | 5 ++-
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ClassLoaderFacet.java | 1
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/CreateResourceReport.java | 13 +++++++-
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ManualAddFacet.java | 1
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/PluginContainerDeployment.java | 3 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java | 12 ++++++-
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryContext.java | 9 +++++
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/operation/OperationResult.java | 5 +++
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginContext.java | 2 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginLifecycleListener.java | 2 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SnapshotReportRequest.java | 2 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SnapshotReportResults.java | 2 +
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SupportFacet.java | 1
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java | 16 ++++++++--
modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeFacet.java | 3 +
25 files changed, 92 insertions(+), 15 deletions(-)
New commits:
commit ee4985638f67feed8d9eda5c69c0d192b8b41420
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Sun Feb 26 17:25:20 2012 -0500
[BZ 749368] add Javadoc @since tags to plugin API classes (https://bugzilla.redhat.com/show_bug.cgi?id=749368)
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityCollectorRunnable.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityCollectorRunnable.java
index 94e475d..e6d5bf2 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityCollectorRunnable.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/availability/AvailabilityCollectorRunnable.java
@@ -42,13 +42,14 @@ import org.rhq.core.util.exception.ThrowableUtil;
* reporting for the rest of the resources being managed within the system.
*
* This class provides an implementation to help resource components that can't guarantee how fast its
- * availability checks will be. Some managed resources simply can't respond to avaiability checks fast enough. In this
+ * availability checks will be. Some managed resources simply can't respond to availability checks fast enough. In this
* case, this class will provide an asynchronous method that will collect availability without a timeout being involved
* (in other words, availability will be retrieved by waiting as long as it takes). In order to tell the plugin container
* what the managed resource's current availability is, this class will provide a fast method to return the last known
* availability of the resource. In other words, it will be able to return the last know availability that was last retrieved
* by the asynchronous task - this retrieval of the last known availability will be very fast.
- *
+ *
+ * @since 1.3
* @author John Mazzitelli
*/
public class AvailabilityCollectorRunnable implements Runnable {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployRequest.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployRequest.java
index 8130ee3..07f2c18 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployRequest.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployRequest.java
@@ -30,6 +30,7 @@ import org.rhq.core.domain.content.PackageVersion;
/**
* A request to deploy a bundle.
*
+ * @since 3.0
* @author John Mazzitelli
*/
public class BundleDeployRequest implements Serializable {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployResult.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployResult.java
index b2b3628..cd7f9ac 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployResult.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleDeployResult.java
@@ -28,6 +28,8 @@ import org.rhq.core.util.exception.ThrowableUtil;
/**
* The results after an attempt to deploy a bundle has been completed.
+ *
+ * @since 3.0
* @author John Mazzitelli
*/
public class BundleDeployResult implements Serializable {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleFacet.java
index 592e63f..18cc0f4 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleFacet.java
@@ -24,7 +24,8 @@ package org.rhq.core.pluginapi.bundle;
/**
* Facet that exposes a component's capabilities to process a bundle.
- *
+ *
+ * @since 3.0
* @author John Mazzitelli
*/
public interface BundleFacet {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleManagerProvider.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleManagerProvider.java
index 5eed5c0..4fd5dac 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleManagerProvider.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundleManagerProvider.java
@@ -28,7 +28,8 @@ import org.rhq.core.domain.content.PackageVersion;
/**
* Provides bundle functionality that plugin components will need in order to process bundles.
- *
+ *
+ * @since 3.0
* @author John Mazzitelli
*/
public interface BundleManagerProvider {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundlePurgeRequest.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundlePurgeRequest.java
index 8e9456d..3a6a481 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundlePurgeRequest.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundlePurgeRequest.java
@@ -28,6 +28,7 @@ import org.rhq.core.domain.bundle.BundleResourceDeployment;
/**
* A request to purge a bundle, essentially erasing the bundle files from the destination.
*
+ * @since 4.0
* @author John Mazzitelli
*/
public class BundlePurgeRequest implements Serializable {
@@ -45,11 +46,18 @@ public class BundlePurgeRequest implements Serializable {
* where the bundle should be deployed. This is the bundle destination's
* {@link BundleDestination#getDeployDir() relative destination directory} under the
* {@link BundleDestination#getDestinationBaseDirectoryName() destination base directory}.
+ *
+ * @since 4.1
*/
public File getAbsoluteDestinationDirectory() {
return this.absDestDir;
}
+ /**
+ * @since 4.1
+ *
+ * @param absoluteDestDir
+ */
public void setAbsoluteDestinationDirectory(File absoluteDestDir) {
this.absDestDir = absoluteDestDir;
}
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundlePurgeResult.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundlePurgeResult.java
index 71e0dfb..20eb016 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundlePurgeResult.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/bundle/BundlePurgeResult.java
@@ -29,6 +29,7 @@ import org.rhq.core.util.exception.ThrowableUtil;
/**
* The results after an attempt to purge a bundle has been completed.
*
+ * @since 4.0
* @author John Mazzitelli
*/
public class BundlePurgeResult implements Serializable {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ConfigurationFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ConfigurationFacet.java
index 02b58a2..95965fd 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ConfigurationFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ConfigurationFacet.java
@@ -31,7 +31,7 @@ import org.rhq.core.domain.configuration.Property;
*
* @author Jason Dobies
*/
-public interface ConfigurationFacet extends ConfigurationFacetSupport {
+public interface ConfigurationFacet {
/**
* Returns the current values for the specified resource. Note that the returns configuration is the configuration
* settings for the managed resource itself, not to be confused with the <i>plugin configuration</i> which is used
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
index b277663..788f432 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationFacet.java
@@ -28,6 +28,9 @@ import org.rhq.core.domain.configuration.RawConfiguration;
import java.util.Set;
+/**
+ * @since 3.0
+ */
public interface ResourceConfigurationFacet {
Configuration loadStructuredConfiguration();
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationUpdateException.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationUpdateException.java
index fdc3018..4770f58 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationUpdateException.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/configuration/ResourceConfigurationUpdateException.java
@@ -39,6 +39,8 @@ package org.rhq.core.pluginapi.configuration;
* <br/><br/>
* With any other exception, the plugin container cannot reasonably assume that any errors were handled and as such
* reports the entire stack trace back to the server to provide additional information for debugging if necessary.
+ *
+ * @since 3.0
*/
public class ResourceConfigurationUpdateException extends RuntimeException {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
index d134638..937c032 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/event/log/LogFileEventResourceComponentHelper.java
@@ -43,7 +43,10 @@ import org.rhq.core.pluginapi.inventory.ResourceContext;
import org.rhq.core.system.SystemInfoFactory;
/**
- * @author Ian Springer
+ * A helper class that plugins can use to start and stop {@link LogFileEventPoller}s.
+ *
+ * @since 1.3
+ * @author Ian Springer
*/
public class LogFileEventResourceComponentHelper {
public static final String LOG_ENTRY_EVENT_TYPE = "logEntry";
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ClassLoaderFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ClassLoaderFacet.java
index df7dc31..98cb71b 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ClassLoaderFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ClassLoaderFacet.java
@@ -35,6 +35,7 @@ import java.util.List;
*
* @param <T> the parent resource component type for those resources discovered by this discovery component
*
+ * @since 1.3
* @author John Mazzitelli
*/
public interface ClassLoaderFacet<T extends ResourceComponent<?>> {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/CreateResourceReport.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/CreateResourceReport.java
index 54a6d41..5f6ad56 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/CreateResourceReport.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/CreateResourceReport.java
@@ -65,7 +65,9 @@ public class CreateResourceReport {
* may be <code>null</code>
* @param resourceConfiguration any configuration values necessary for the resource; may be <code>null</code>
* @param packageDetails information regarding the package to be deployed when creating the new
- * resource; may be <code>null</code>
+ * resource; may be <code>null</code>
+ *
+ * @since 1.1
*/
public CreateResourceReport(String userSpecifiedResourceName, ResourceType resourceType, Configuration pluginConfiguration,
Configuration resourceConfiguration, ResourcePackageDetails packageDetails) {
@@ -78,10 +80,16 @@ public class CreateResourceReport {
// Public --------------------------------------------
+ /**
+ * @since 1.1
+ */
public String getUserSpecifiedResourceName() {
return userSpecifiedResourceName;
}
+ /**
+ * @since 1.1
+ */
public void setUserSpecifiedResourceName(String userSpecifiedResourceName) {
this.userSpecifiedResourceName = userSpecifiedResourceName;
}
@@ -118,6 +126,9 @@ public class CreateResourceReport {
return resourceConfiguration;
}
+ /**
+ * @since 1.1
+ */
public ResourcePackageDetails getPackageDetails() {
return packageDetails;
}
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ManualAddFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ManualAddFacet.java
index 476e8d8..54f71a1 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ManualAddFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ManualAddFacet.java
@@ -38,6 +38,7 @@ import org.rhq.core.domain.configuration.Configuration;
*
* @param <T> the parent resource component type for those resources discovered by this discovery component
*
+ * @since 3.0
* @author Ian Springer
*/
public interface ManualAddFacet<T extends ResourceComponent<?>> {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/PluginContainerDeployment.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/PluginContainerDeployment.java
index ec253ae..ef46294 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/PluginContainerDeployment.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/PluginContainerDeployment.java
@@ -24,7 +24,8 @@ package org.rhq.core.pluginapi.inventory;
/**
* This enum indicates where the plugin container (and therefore the plugins) are deployed.
- *
+ *
+ * @since 1.3
* @author John Mazzitelli
*/
public enum PluginContainerDeployment {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
index bcb16a1..20d7d17 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceContext.java
@@ -119,8 +119,10 @@ public class ResourceContext<T extends ResourceComponent<?>> {
private static Map<Children, ResourceTypeProcesses> PROCESSES_PER_PARENT_PER_RESOURCE_TYPE = new HashMap<Children, ResourceTypeProcesses>();
/**
- * Creates a new {@link ResourceContext} object. The plugin container is responsible for instantiating these
- * objects; plugin writers should never have to actually create context objects.
+ * Creates a new {@link ResourceContext} object.
+ *
+ * <b>NOTE:</b> The plugin container is responsible for instantiating these objects; plugin writers should never
+ * have to actually create context objects.
*
* @param resource the resource whose {@link org.rhq.core.pluginapi.inventory.ResourceComponent}
* will be given this context object of the plugin
@@ -206,6 +208,8 @@ public class ResourceContext<T extends ResourceComponent<?>> {
* The {@link Resource#getVersion() version} of the resource this context is associated with.
*
* @return the resource's version string
+ *
+ * @since 1.2
*/
public String getVersion() {
return this.version;
@@ -408,6 +412,8 @@ public class ResourceContext<T extends ResourceComponent<?>> {
* See {@link PluginContainerDeployment} for more information on what the return value means.
*
* @return indicator of where the plugin container is deployed and running
+ *
+ * @since 1.3
*/
public PluginContainerDeployment getPluginContainerDeployment() {
return pluginContainerDeployment;
@@ -468,6 +474,8 @@ public class ResourceContext<T extends ResourceComponent<?>> {
* for this parameter is {@link AvailabilityCollectorRunnable#MIN_INTERVAL}.
*
* @return the availability collector runnable that will perform the asynchronous checking
+ *
+ * @since 1.3
*/
public AvailabilityCollectorRunnable createAvailabilityCollectorRunnable(AvailabilityFacet availChecker,
long interval) {
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryContext.java
index b9e9bcd..d3bedd5 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/inventory/ResourceDiscoveryContext.java
@@ -85,6 +85,8 @@ public class ResourceDiscoveryContext<T extends ResourceComponent<?>> {
* @param pluginContainerName the name of the plugin container in which the discovery component is running. Components
* can be assured this name is unique across <b>all</b> plugin containers/agents running
* @param pluginContainerDeployment indicates where the plugin container is running
+ *
+ * @since 3.0
*/
public ResourceDiscoveryContext(ResourceType resourceType, T parentComponent,
ResourceContext<?> parentResourceContext, SystemInfo systemInfo, List<ProcessScanResult> processScanResults,
@@ -115,6 +117,8 @@ public class ResourceDiscoveryContext<T extends ResourceComponent<?>> {
* @param pluginContainerName the name of the plugin container in which the discovery component is running. Components
* can be assured this name is unique across <b>all</b> plugin containers/agents running
* @param pluginContainerDeployment indicates where the plugin container is running
+ *
+ * @since 1.3
*/
@SuppressWarnings("unchecked")
public ResourceDiscoveryContext(ResourceType resourceType, T parentComponent,
@@ -158,7 +162,8 @@ public class ResourceDiscoveryContext<T extends ResourceComponent<?>> {
* plugin configuration values for use in discovery of the children.
*
* @return the resource context for the parent
- * @since 1.0.1
+ *
+ * @since 1.1
*/
public ResourceContext<?> getParentResourceContext() {
return parentResourceContext;
@@ -243,6 +248,8 @@ public class ResourceDiscoveryContext<T extends ResourceComponent<?>> {
* See {@link PluginContainerDeployment} for more information on what the return value means.
*
* @return indicator of where the plugin container is deployed and running
+ *
+ * @since 1.3
*/
public PluginContainerDeployment getPluginContainerDeployment() {
return pluginContainerDeployment;
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/operation/OperationResult.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/operation/OperationResult.java
index 59ca30f..715880d 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/operation/OperationResult.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/operation/OperationResult.java
@@ -93,7 +93,10 @@ public class OperationResult {
/**
* Returns the plugin-specific error message for this operation, or null if the operation was successful.
+ *
* @return The stored message or null.
+ *
+ * @since 1.2
*/
public String getErrorMessage() {
return this.errorMessage;
@@ -106,6 +109,8 @@ public class OperationResult {
* be marked as FAILURE
*
* @param errorMessage a plugin specific error that indicates why this operation has failed
+ *
+ * @since 1.2
*/
public void setErrorMessage(String errorMessage) {
this.errorMessage = errorMessage;
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginContext.java
index 029ae26..b9d52ab 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginContext.java
@@ -8,6 +8,8 @@ import org.rhq.core.system.SystemInfo;
* A global context containing information about a plugin.
*
* @author John Mazzitelli
+ *
+ * @since 1.2
*/
public class PluginContext {
private final String pluginName;
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginLifecycleListener.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginLifecycleListener.java
index 9acc0ab..e68abb4 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginLifecycleListener.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/plugin/PluginLifecycleListener.java
@@ -29,6 +29,8 @@ package org.rhq.core.pluginapi.plugin;
* a place to clean up those resources.
*
* @author John Mazzitelli
+ *
+ * @since 1.2
*/
public interface PluginLifecycleListener {
/**
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SnapshotReportRequest.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SnapshotReportRequest.java
index cbd1b4b..84b3a5f 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SnapshotReportRequest.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SnapshotReportRequest.java
@@ -28,6 +28,8 @@ import java.io.Serializable;
* Encapsulates information about a snapshot report request.
*
* @author John Mazzitelli
+ *
+ * @since 1.3
*/
public class SnapshotReportRequest implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SnapshotReportResults.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SnapshotReportResults.java
index cad67f2..30d8882 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SnapshotReportResults.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SnapshotReportResults.java
@@ -29,6 +29,8 @@ import java.io.Serializable;
* Contains the results of a snapshot report, including a stream to the contents of the snapshot.
*
* @author John Mazzitelli
+ *
+ * @since 1.3
*/
public class SnapshotReportResults implements Serializable {
private static final long serialVersionUID = 1L;
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SupportFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SupportFacet.java
index 538eef6..c673923 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SupportFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/support/SupportFacet.java
@@ -28,6 +28,7 @@ package org.rhq.core.pluginapi.support;
*
* @author John Mazzitelli
*
+ * @since 1.3
*/
public interface SupportFacet {
/**
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
index 702a768..f1d6807 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeContext.java
@@ -20,7 +20,6 @@
* if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
-
package org.rhq.core.pluginapi.upgrade;
import java.io.File;
@@ -41,7 +40,8 @@ import org.rhq.core.system.SystemInfo;
* Represents a resource during the resource upgrade phase of discovery.
*
* @see ResourceUpgradeFacet
- *
+ *
+ * @since 3.0
* @author Lukas Krejci
*/
public class ResourceUpgradeContext<T extends ResourceComponent<?>> extends ResourceContext<T> {
@@ -51,7 +51,9 @@ public class ResourceUpgradeContext<T extends ResourceComponent<?>> extends Reso
private final String description;
/**
- * @see ResourceContext#ResourceContext(Resource, ResourceComponent, ResourceDiscoveryComponent, SystemInfo, File, File, String, EventContext, OperationContext, ContentContext, Executor, PluginContainerDeployment)
+ * @see ResourceContext#ResourceContext(org.rhq.core.domain.resource.Resource, org.rhq.core.pluginapi.inventory.ResourceComponent, org.rhq.core.pluginapi.inventory.ResourceContext, org.rhq.core.pluginapi.inventory.ResourceDiscoveryComponent, org.rhq.core.system.SystemInfo, java.io.File, java.io.File, String, org.rhq.core.pluginapi.event.EventContext, org.rhq.core.pluginapi.operation.OperationContext, org.rhq.core.pluginapi.content.ContentContext, java.util.concurrent.Executor, org.rhq.core.pluginapi.inventory.PluginContainerDeployment)
+ *
+ * @since 4.0
*/
public ResourceUpgradeContext(Resource resource, ResourceContext<?> parentResourceContext,
T parentResourceComponent, ResourceDiscoveryComponent<T> resourceDiscoveryComponent, SystemInfo systemInfo,
@@ -68,6 +70,13 @@ public class ResourceUpgradeContext<T extends ResourceComponent<?>> extends Reso
this.description = resource.getDescription();
}
+ /**
+ * Returns the context of the Resource component's parent Resource component.
+ *
+ * @return the context of the Resource component's parent Resource component
+ *
+ * @since 4.0
+ */
@Override
public ResourceContext<?> getParentResourceContext() {
return super.getParentResourceContext();
@@ -84,4 +93,5 @@ public class ResourceUpgradeContext<T extends ResourceComponent<?>> extends Reso
public String getDescription() {
return description;
}
+
}
diff --git a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeFacet.java b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeFacet.java
index 13c155a..55d541f 100644
--- a/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeFacet.java
+++ b/modules/core/plugin-api/src/main/java/org/rhq/core/pluginapi/upgrade/ResourceUpgradeFacet.java
@@ -31,7 +31,8 @@ import org.rhq.core.pluginapi.inventory.ResourceComponent;
* upgrading the existing resources to a new format needed by an updated resource component.
* This is useful for example in the case when a new version of plugin redefined a resource
* key generation algorithm and wants to upgrade the legacy resources to use the new format.
- *
+ *
+ * @since 3.0
* @author Lukas Krejci
*/
public interface ResourceUpgradeFacet<T extends ResourceComponent<?>> {
12 years, 2 months
[rhq] modules/enterprise modules/plugins pom.xml
by ips
modules/enterprise/comm/pom.xml | 2 +-
modules/plugins/rhq-agent/pom.xml | 14 ++++----------
pom.xml | 4 ++--
3 files changed, 7 insertions(+), 13 deletions(-)
New commits:
commit d71b22a573d7f9e576b23407fcdc4ad4c0c3d846
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Sat Feb 25 14:36:33 2012 -0500
use correct syntax for passing sysprop to surefire (fixes my previous commit)
diff --git a/modules/enterprise/comm/pom.xml b/modules/enterprise/comm/pom.xml
index ae11a4b..f8aa8f9 100644
--- a/modules/enterprise/comm/pom.xml
+++ b/modules/enterprise/comm/pom.xml
@@ -146,7 +146,7 @@
<!--
<argLine>-Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=8787,server=y,suspend=y</argLine>
-->
- <systemPropertyVariables>
+ <systemPropertyVariables combine.children="append">
<rhq.comm.test.connectorBindPort>${rhq.comm.test.connectorBindPort}</rhq.comm.test.connectorBindPort>
<rhq.comm.test.connector2BindPort>${rhq.comm.test.connector2BindPort}</rhq.comm.test.connector2BindPort>
</systemPropertyVariables>
diff --git a/modules/plugins/rhq-agent/pom.xml b/modules/plugins/rhq-agent/pom.xml
index 92068fd..47f2f1c 100644
--- a/modules/plugins/rhq-agent/pom.xml
+++ b/modules/plugins/rhq-agent/pom.xml
@@ -111,16 +111,10 @@
<excludedGroups>${rhq.testng.excludedGroups}</excludedGroups>
<useSystemClassLoader>true</useSystemClassLoader>
<argLine>-Dorg.hyperic.sigar.path=${basedir}/target/itest/lib</argLine>
- <systemProperties>
- <property>
- <name>project.artifactId</name>
- <value>${project.artifactId}</value>
- </property>
- <property>
- <name>project.version</name>
- <value>${project.version}</value>
- </property>
- </systemProperties>
+ <systemPropertyVariables combine.children="append">
+ <project.artifactId>${project.artifactId}</project.artifactId>
+ <project.version>${project.version}</project.version>
+ </systemPropertyVariables>
</configuration>
</execution>
</executions>
diff --git a/pom.xml b/pom.xml
index 2e346f8..e07cf64 100644
--- a/pom.xml
+++ b/pom.xml
@@ -820,9 +820,9 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<trimStackTrace>false</trimStackTrace>
- <systemProperties>
+ <systemPropertyVariables>
<java.util.prefs.userRoot>${java.io.tmpdir}/${user.name}</java.util.prefs.userRoot>
- </systemProperties>
+ </systemPropertyVariables>
</configuration>
</plugin>
12 years, 3 months
[rhq] Branch 'jsanda/drift-mongodb' - 2 commits - modules/enterprise
by John Sanda
modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/entities/MongoDBFile.java | 16 +
modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServerTest.java | 55 +++-
modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBTest.java | 130 ++++++++++
modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/dao/ChangeSetDAOTest.java | 84 ------
4 files changed, 189 insertions(+), 96 deletions(-)
New commits:
commit 6a2753b1f574c5f3cab6901e149ca4d0aa4dcf10
Author: John Sanda <jsanda(a)redhat.com>
Date: Sat Feb 25 10:46:38 2012 -0500
Adding some more verification logic
diff --git a/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServerTest.java b/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServerTest.java
index f3f6fcf..242da58 100644
--- a/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServerTest.java
+++ b/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServerTest.java
@@ -27,6 +27,7 @@ import com.google.code.morphia.Morphia;
import com.google.code.morphia.query.Query;
import com.mongodb.Mongo;
+import org.bson.types.ObjectId;
import org.jmock.Expectations;
import org.rhq.common.drift.ChangeSetWriter;
import org.rhq.common.drift.ChangeSetWriterImpl;
@@ -55,6 +56,7 @@ import static java.util.Arrays.asList;
import static org.rhq.common.drift.FileEntry.addedFileEntry;
import static org.rhq.core.domain.drift.DriftCategory.FILE_ADDED;
import static org.rhq.core.domain.drift.DriftChangeSetCategory.COVERAGE;
+import static org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode.normal;
import static org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode.plannedChanges;
import static org.testng.Assert.assertEquals;
@@ -121,23 +123,28 @@ public class MongoDBDriftServerTest extends MongoDBTest {
// verify that the change set was persisted
ChangeSetDAO changeSetDAO = new ChangeSetDAO(morphia, connection, "rhqtest");
- List<MongoDBChangeSet> actual = changeSetDAO.find().asList();
+ List<MongoDBChangeSet> changeSets = changeSetDAO.find().asList();
- MongoDBChangeSet changeSet = new MongoDBChangeSet();
- changeSet.setDriftDefinitionId(driftDefId);
- changeSet.setResourceId(resourceId);
- changeSet.setDriftDefinitionName(driftDefName);
- changeSet.setCategory(COVERAGE);
- changeSet.setVersion(0);
- changeSet.setDriftHandlingMode(plannedChanges);
+ assertEquals(changeSets.size(), 1, "Expected to find one change set in the database.");
+ MongoDBChangeSet actual = changeSets.get(0);
+
+ MongoDBChangeSet expected = new MongoDBChangeSet();
+ // Need to set the id to actual.id. Since ids are random, we cannot use a canned
+ // value. We have to set it the same value that is in the database.
+ expected.setId(actual.getId());
+ expected.setDriftDefinitionId(driftDefId);
+ expected.setResourceId(resourceId);
+ expected.setDriftDefinitionName(driftDefName);
+ expected.setCategory(COVERAGE);
+ expected.setVersion(0);
+ expected.setDriftHandlingMode(normal);
MongoDBChangeSetEntry entry = new MongoDBChangeSetEntry("1.txt", FILE_ADDED);
entry.setNewFileHash(sha256("1a2b3c4d"));
- changeSet.add(entry);
+ expected.add(entry);
- List<MongoDBChangeSet> expected = asList(changeSet);
-
- assertEquals(actual.size(), 1, "Expected to find one change set");
+ String[] ignore = new String[] {"id", "objectId", "ctime"};
+ assertChangeSetMatches("Failed to persist change set", expected, actual, ignore);
}
protected File createChangeSetZipFile(Headers headers, FileEntry... fileEntries) throws Exception {
diff --git a/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBTest.java b/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBTest.java
index 75a086b..847ccbd 100644
--- a/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBTest.java
+++ b/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBTest.java
@@ -12,8 +12,10 @@ import org.rhq.test.JMockTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
+import java.util.ArrayList;
import java.util.List;
+import static java.util.Arrays.asList;
import static org.rhq.test.AssertUtils.assertCollectionMatchesNoOrder;
import static org.rhq.test.AssertUtils.assertPropertiesMatch;
import static org.testng.Assert.assertEquals;
@@ -40,6 +42,14 @@ public class MongoDBTest extends JMockTest {
ds = morphia.createDatastore(connection, "rhqtest");
}
+ /**
+ * Verifies that the actual list of change sets match the expected list of change sets.
+ * The order of the lists is expected to be the same.
+ *
+ * @param msg
+ * @param expected
+ * @param actual
+ */
protected void assertChangeSetsMatch(String msg, List<MongoDBChangeSet> expected, List<MongoDBChangeSet> actual) {
assertEquals(actual.size(), expected.size(), "The number of change sets differ: " + msg);
int i = 0;
@@ -74,6 +84,31 @@ public class MongoDBTest extends JMockTest {
* This method first checks that the actual change set is not null. It then performs a
* property-wise comparison against the expected change set using
* {@link org.rhq.test.AssertUtils#assertPropertiesMatch(String, Object, Object, String...) assertPropertiesMatch}.
+ * The {@link MongoDBChangeSet#getDrifts() drifts} property is then tested separately
+ * using
+ * {@link org.rhq.test.AssertUtils#assertCollectionMatchesNoOrder(String, java.util.Collection, java.util.Collection, String...) assertCollectionMatches}.
+ *
+ * @param msg An error message
+ * @param expected The expected change set to test against
+ * @param actual The actual change set under test
+ * @param ignoredProperties Properties of the MongoDBChangeSet to exclude from comparison
+ */
+ protected void assertChangeSetMatches(String msg, MongoDBChangeSet expected, MongoDBChangeSet actual,
+ String... ignoredProperties) {
+ assertNotNull(actual, msg + ": change set is null");
+
+ List<String> ignore = new ArrayList<String>(asList(ignoredProperties));
+ ignore.add("drifts");
+ assertPropertiesMatch(msg, expected, actual, ignore);
+
+ assertCollectionMatchesNoOrder(msg + ": " + "change set entries do not match expected entries.", expected
+ .getDrifts(), actual.getDrifts(), "changeSet", "ctime");
+ }
+
+ /**
+ * This method first checks that the actual change set is not null. It then performs a
+ * property-wise comparison against the expected change set using
+ * {@link org.rhq.test.AssertUtils#assertPropertiesMatch(String, Object, Object, String...) assertPropertiesMatch}.
* The {@link org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSet#getDrifts() drifts}
* property is then tested separately using
* {@link org.rhq.test.AssertUtils#assertCollectionMatchesNoOrder(String, java.util.Collection, java.util.Collection, String...) assertCollectionMatches}.
commit f8167735f7cad6c01efca7a9fec0cf315f06b316
Author: John Sanda <jsanda(a)redhat.com>
Date: Mon Feb 20 09:50:27 2012 -0500
Refactoring tests to pull common test code into base test class
This is the initial commit for MongoDBTest. A previous commit added the
oldDriftFile and newDriftFile properties in MongoDBChangeSetEntry. This
broke some tests in ChangeSetDAOTest since MongoDBFile does not
implement equals/hashCode. I have implemented equals/hashCode for
MongoDBFile in this commit to fix those failing tests.
diff --git a/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/entities/MongoDBFile.java b/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/entities/MongoDBFile.java
index 344614b..1da12e3 100644
--- a/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/entities/MongoDBFile.java
+++ b/modules/enterprise/server/plugins/drift-mongodb/src/main/java/org/rhq/enterprise/server/plugins/drift/mongodb/entities/MongoDBFile.java
@@ -71,4 +71,20 @@ public class MongoDBFile implements Serializable, DriftFile {
this.status = status;
}
+ @Override
+ public boolean equals(Object o) {
+ if (this == o) return true;
+ if (o == null || getClass() != o.getClass()) return false;
+
+ MongoDBFile that = (MongoDBFile) o;
+
+ if (hash != null ? !hash.equals(that.hash) : that.hash != null) return false;
+
+ return true;
+ }
+
+ @Override
+ public int hashCode() {
+ return hash != null ? hash.hashCode() : 0;
+ }
}
diff --git a/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServerTest.java b/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServerTest.java
index 5ad406f..f3f6fcf 100644
--- a/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServerTest.java
+++ b/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBDriftServerTest.java
@@ -24,6 +24,7 @@ import java.util.List;
import com.google.code.morphia.Datastore;
import com.google.code.morphia.Morphia;
+import com.google.code.morphia.query.Query;
import com.mongodb.Mongo;
import org.jmock.Expectations;
@@ -32,7 +33,9 @@ import org.rhq.common.drift.ChangeSetWriterImpl;
import org.rhq.common.drift.FileEntry;
import org.rhq.common.drift.Headers;
import org.rhq.core.clientapi.agent.drift.DriftAgentService;
+import org.rhq.core.domain.drift.DriftCategory;
import org.rhq.core.domain.drift.DriftChangeSetCategory;
+import org.rhq.core.domain.drift.DriftConfigurationDefinition;
import org.rhq.core.domain.drift.DriftFile;
import org.rhq.core.domain.drift.dto.DriftFileDTO;
import org.rhq.core.util.MessageDigestGenerator;
@@ -43,37 +46,32 @@ 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.test.JMockTest;
+import org.testng.Assert;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
import static java.util.Arrays.asList;
import static org.rhq.common.drift.FileEntry.addedFileEntry;
+import static org.rhq.core.domain.drift.DriftCategory.FILE_ADDED;
import static org.rhq.core.domain.drift.DriftChangeSetCategory.COVERAGE;
+import static org.rhq.core.domain.drift.DriftConfigurationDefinition.DriftHandlingMode.plannedChanges;
+import static org.testng.Assert.assertEquals;
-public class MongoDBDriftServerTest extends JMockTest {
-
- Mongo connection;
-
- Morphia morphia;
-
- Datastore ds;
-
- String db = "rhqtest";
+public class MongoDBDriftServerTest extends MongoDBTest {
MessageDigestGenerator digestGenerator;
@BeforeClass
- public void initDB() throws Exception {
- connection = new Mongo("127.0.0.1");
- morphia = new Morphia().map(MongoDBChangeSet.class).map(MongoDBChangeSetEntry.class).map(MongoDBFile.class);
- ds = morphia.createDatastore(connection, db);
-
+ public void initClass() throws Exception {
digestGenerator = new MessageDigestGenerator(MessageDigestGenerator.SHA_256);
}
@BeforeMethod
public void initTest() {
+ Query deleteAll = ds.createQuery(MongoDBChangeSet.class);
+ ds.delete(deleteAll);
+
File basedir = getBaseDir();
basedir.delete();
getBaseDir().mkdirs();
@@ -103,7 +101,7 @@ public class MongoDBDriftServerTest extends JMockTest {
driftServer.setConnection(connection);
driftServer.setMorphia(morphia);
driftServer.setDatastore(ds);
- driftServer.setChangeSetDAO(new ChangeSetDAO(morphia, connection, db));
+ driftServer.setChangeSetDAO(new ChangeSetDAO(morphia, connection, "rhqtest"));
driftServer.setFileDAO(new FileDAO(ds.getDB()));
final List<? extends DriftFile> missingContent = asList(new TestDriftFile(sha256("1a2b3c4d")));
@@ -120,6 +118,26 @@ public class MongoDBDriftServerTest extends JMockTest {
// We can pass null for the subject because MongoDBDriftServer currently does not
// use the subject argument.
driftServer.saveChangeSet(null, resourceId, changeSetZip);
+
+ // verify that the change set was persisted
+ ChangeSetDAO changeSetDAO = new ChangeSetDAO(morphia, connection, "rhqtest");
+ List<MongoDBChangeSet> actual = changeSetDAO.find().asList();
+
+ MongoDBChangeSet changeSet = new MongoDBChangeSet();
+ changeSet.setDriftDefinitionId(driftDefId);
+ changeSet.setResourceId(resourceId);
+ changeSet.setDriftDefinitionName(driftDefName);
+ changeSet.setCategory(COVERAGE);
+ changeSet.setVersion(0);
+ changeSet.setDriftHandlingMode(plannedChanges);
+
+ MongoDBChangeSetEntry entry = new MongoDBChangeSetEntry("1.txt", FILE_ADDED);
+ entry.setNewFileHash(sha256("1a2b3c4d"));
+ changeSet.add(entry);
+
+ List<MongoDBChangeSet> expected = asList(changeSet);
+
+ assertEquals(actual.size(), 1, "Expected to find one change set");
}
protected File createChangeSetZipFile(Headers headers, FileEntry... fileEntries) throws Exception {
diff --git a/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBTest.java b/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBTest.java
new file mode 100644
index 0000000..75a086b
--- /dev/null
+++ b/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/MongoDBTest.java
@@ -0,0 +1,95 @@
+package org.rhq.enterprise.server.plugins.drift.mongodb;
+
+import com.google.code.morphia.Datastore;
+import com.google.code.morphia.Morphia;
+import com.google.code.morphia.query.Query;
+import com.mongodb.Mongo;
+import org.rhq.enterprise.server.plugins.drift.mongodb.dao.ChangeSetDAO;
+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.test.JMockTest;
+import org.testng.annotations.BeforeClass;
+import org.testng.annotations.BeforeMethod;
+
+import java.util.List;
+
+import static org.rhq.test.AssertUtils.assertCollectionMatchesNoOrder;
+import static org.rhq.test.AssertUtils.assertPropertiesMatch;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertNotNull;
+
+public class MongoDBTest extends JMockTest {
+
+ // Tests need to be disabled when committed/pushed to the remote repo until we get
+ // mongodb installed on the hudson slave
+ public static final boolean ENABLED = true;
+
+ protected Mongo connection;
+
+ protected Morphia morphia;
+
+ protected Datastore ds;
+
+ @BeforeClass
+ public void initDB() throws Exception {
+ connection = new Mongo("127.0.0.1");
+
+ morphia = new Morphia().map(MongoDBChangeSet.class).map(MongoDBChangeSetEntry.class).map(MongoDBFile.class);
+
+ ds = morphia.createDatastore(connection, "rhqtest");
+ }
+
+ protected void assertChangeSetsMatch(String msg, List<MongoDBChangeSet> expected, List<MongoDBChangeSet> actual) {
+ assertEquals(actual.size(), expected.size(), "The number of change sets differ: " + msg);
+ int i = 0;
+ for (MongoDBChangeSet expectedChangeSet : expected) {
+ assertChangeSetMatches("Change sets do not match: " + msg, expectedChangeSet, actual.get(i++));
+ }
+ }
+
+ protected void assertChangeSetsMatchNoOrder(String msg, List<MongoDBChangeSet> expected,
+ List<MongoDBChangeSet> actual) {
+ assertEquals(actual.size(), expected.size(), "The number of change sets differ: " + msg);
+ for (MongoDBChangeSet expectedChangeSet : expected) {
+ MongoDBChangeSet actualChangeSet = null;
+ for (MongoDBChangeSet changeSet : actual) {
+ if (expectedChangeSet.getObjectId().equals(changeSet.getObjectId())) {
+ actualChangeSet = changeSet;
+ break;
+ }
+ }
+ assertNotNull(actualChangeSet, msg + ": expected to find change set " + expectedChangeSet);
+ assertChangeSetMatches(msg, expectedChangeSet, actualChangeSet);
+ }
+ }
+
+ protected void assertEntriesMatch(String msg, List<MongoDBChangeSetEntry> expected,
+ List<MongoDBChangeSetEntry> actual) {
+ assertEquals(actual.size(), expected.size(), "The number of entries differ: " + msg);
+ assertCollectionMatchesNoOrder(msg, expected, actual, "changeSet");
+ }
+
+ /**
+ * This method first checks that the actual change set is not null. It then performs a
+ * property-wise comparison against the expected change set using
+ * {@link org.rhq.test.AssertUtils#assertPropertiesMatch(String, Object, Object, String...) assertPropertiesMatch}.
+ * The {@link org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSet#getDrifts() drifts}
+ * property is then tested separately using
+ * {@link org.rhq.test.AssertUtils#assertCollectionMatchesNoOrder(String, java.util.Collection, java.util.Collection, String...) assertCollectionMatches}.
+ *
+ * @param msg An error message
+ * @param expected The expected change set to test against
+ * @param actual The actual change set under test
+ */
+ protected void assertChangeSetMatches(String msg, MongoDBChangeSet expected, MongoDBChangeSet actual) {
+ assertNotNull(actual, msg + ": change set is null");
+
+ String ignore = "drifts";
+ assertPropertiesMatch(msg, expected, actual, ignore);
+
+ ignore = "changeSet";
+ assertCollectionMatchesNoOrder(msg + ": " + "change set entries do not match expected entries.", expected
+ .getDrifts(), actual.getDrifts(), ignore);
+ }
+}
diff --git a/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/dao/ChangeSetDAOTest.java b/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/dao/ChangeSetDAOTest.java
index 4e9c0e0..aaee50c 100644
--- a/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/dao/ChangeSetDAOTest.java
+++ b/modules/enterprise/server/plugins/drift-mongodb/src/test/java/org/rhq/enterprise/server/plugins/drift/mongodb/dao/ChangeSetDAOTest.java
@@ -21,14 +21,10 @@ package org.rhq.enterprise.server.plugins.drift.mongodb.dao;
import java.util.List;
-import com.google.code.morphia.Datastore;
-import com.google.code.morphia.Morphia;
import com.google.code.morphia.query.Query;
-import com.mongodb.Mongo;
-
import org.rhq.core.domain.criteria.GenericDriftChangeSetCriteria;
import org.rhq.core.domain.util.PageOrdering;
-import org.testng.annotations.BeforeClass;
+import org.rhq.enterprise.server.plugins.drift.mongodb.MongoDBTest;
import org.testng.annotations.BeforeMethod;
import org.testng.annotations.Test;
@@ -36,7 +32,6 @@ import org.rhq.core.domain.criteria.GenericDriftCriteria;
import org.rhq.core.domain.drift.DriftChangeSetCategory;
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 static java.util.Arrays.asList;
import static org.rhq.core.domain.drift.DriftCategory.FILE_ADDED;
@@ -51,34 +46,14 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertNotNull;
import static org.testng.Assert.assertTrue;
-public class ChangeSetDAOTest {
-
- // Tests need to be disabled when committed/pushed to the remote repo until we get
- // mongodb installed on the hudson slave
- static final boolean ENABLED = true;
-
- Mongo connection;
-
- Morphia morphia;
-
- Datastore ds;
+public class ChangeSetDAOTest extends MongoDBTest {
ChangeSetDAO dao;
- @BeforeClass
- public void initDB() throws Exception {
- connection = new Mongo("127.0.0.1");
-
- morphia = new Morphia().map(MongoDBChangeSet.class).map(MongoDBChangeSetEntry.class).map(MongoDBFile.class);
-
- ds = morphia.createDatastore(connection, "rhqtest");
- }
-
@BeforeMethod
- public void clearCollections() throws Exception {
+ public void initDAO() {
Query deleteAll = ds.createQuery(MongoDBChangeSet.class);
ds.delete(deleteAll);
-
dao = new ChangeSetDAO(morphia, connection, "rhqtest");
}
@@ -965,59 +940,6 @@ public class ChangeSetDAOTest {
assertTrue(dao.find().asList().isEmpty(), "Failed to delete one or more change sets");
}
-
- private void assertChangeSetsMatch(String msg, List<MongoDBChangeSet> expected, List<MongoDBChangeSet> actual) {
- assertEquals(actual.size(), expected.size(), "The number of change sets differ: " + msg);
- int i = 0;
- for (MongoDBChangeSet expectedChangeSet : expected) {
- assertChangeSetMatches("Change sets do not match: " + msg, expectedChangeSet, actual.get(i++));
- }
- }
-
- private void assertChangeSetsMatchNoOrder(String msg, List<MongoDBChangeSet> expected,
- List<MongoDBChangeSet> actual) {
- assertEquals(actual.size(), expected.size(), "The number of change sets differ: " + msg);
- for (MongoDBChangeSet expectedChangeSet : expected) {
- MongoDBChangeSet actualChangeSet = null;
- for (MongoDBChangeSet changeSet : actual) {
- if (expectedChangeSet.getObjectId().equals(changeSet.getObjectId())) {
- actualChangeSet = changeSet;
- break;
- }
- }
- assertNotNull(actualChangeSet, msg + ": expected to find change set " + expectedChangeSet);
- assertChangeSetMatches(msg, expectedChangeSet, actualChangeSet);
- }
- }
-
- private void assertEntriesMatch(String msg, List<MongoDBChangeSetEntry> expected,
- List<MongoDBChangeSetEntry> actual) {
- assertEquals(actual.size(), expected.size(), "The number of entries differ: " + msg);
- assertCollectionMatchesNoOrder(msg, expected, actual, "changeSet");
- }
-
- /**
- * This method first checks that the actual change set is not null. It then performs a
- * property-wise comparison against the expected change set using
- * {@link org.rhq.test.AssertUtils#assertPropertiesMatch(String, Object, Object, String...) assertPropertiesMatch}.
- * The {@link org.rhq.enterprise.server.plugins.drift.mongodb.entities.MongoDBChangeSet#getDrifts() drifts}
- * property is then tested separately using
- * {@link org.rhq.test.AssertUtils#assertCollectionMatchesNoOrder(String, java.util.Collection, java.util.Collection, String...) assertCollectionMatches}.
- *
- * @param msg An error message
- * @param expected The expected change set to test against
- * @param actual The actual change set under test
- */
- void assertChangeSetMatches(String msg, MongoDBChangeSet expected, MongoDBChangeSet actual) {
- assertNotNull(actual, msg + ": change set is null");
-
- String ignore = "drifts";
- assertPropertiesMatch(msg, expected, actual, ignore);
-
- ignore = "changeSet";
- assertCollectionMatchesNoOrder(msg + ": " + "change set entries do not match expected entries.", expected
- .getDrifts(), actual.getDrifts(), ignore);
- }
/**
* A convenience factory method for creating a change set.
12 years, 3 months
[rhq] pom.xml
by ips
pom.xml | 3 +++
1 file changed, 3 insertions(+)
New commits:
commit 82bd4233ab03a113f51e46021bf94c36deba5dd3
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Sat Feb 25 10:45:45 2012 -0500
write user prefs to /tmp/user, rather than /home/user, when running tests,
to avoid locking errors when running with NFS home dirs via Jenkins
diff --git a/pom.xml b/pom.xml
index 290a193..2e346f8 100644
--- a/pom.xml
+++ b/pom.xml
@@ -820,6 +820,9 @@
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<trimStackTrace>false</trimStackTrace>
+ <systemProperties>
+ <java.util.prefs.userRoot>${java.io.tmpdir}/${user.name}</java.util.prefs.userRoot>
+ </systemProperties>
</configuration>
</plugin>
12 years, 3 months
[rhq] modules/enterprise
by snegrea
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
New commits:
commit 4a808b506c8ece503ec32fbd006d1dd1314fa3e5
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Feb 24 22:08:54 2012 -0600
Delete only changesets directory to preserve classes and resource created by the build process.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java
index 195cb4b..3f2f46f 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java
@@ -134,9 +134,8 @@ public class DriftManagerBeanTest extends AbstractEJB3Test {
@Test
public void testStoreChangeSet() throws Exception {
File rootDir = toFile(getClass().getResource("."));
- deleteDirectory(rootDir);
-
File changeSetsDir = new File(rootDir, "changesets");
+ deleteDirectory(changeSetsDir);
changeSetsDir.mkdirs();
Headers headers = new Headers();
12 years, 3 months
[rhq] modules/enterprise
by snegrea
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
New commits:
commit f09ea66e14910e5fa3490cd1c12cf8278fa6145b
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Feb 24 19:04:47 2012 -0600
No need to enable tests based on a local private variable.
Because this test class was not compiled, TestDefService was not compiled either resulting in build errors in integration tests component.
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java
index 276b669..195cb4b 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/drift/DriftManagerBeanTest.java
@@ -79,12 +79,9 @@ import org.rhq.enterprise.server.util.LookupUtil;
*/
// TODO: Figure out how to get this test class to run without causing issues in the test-jar generation. I don't
// understand exactly what the deal is but removing this dependency on an itests group causes the server test jar to
-// not correctly generate the drift package contents.
-@Test
+// not correctly generate the drift package contents.
public class DriftManagerBeanTest extends AbstractEJB3Test {
- private static final boolean ENABLE_TESTS = true;
-
private JPADriftServerLocal jpaDriftServer;
private DriftManagerLocal driftManager;
private Subject overlord;
@@ -134,7 +131,7 @@ public class DriftManagerBeanTest extends AbstractEJB3Test {
}
}
- @Test(enabled = ENABLE_TESTS)
+ @Test
public void testStoreChangeSet() throws Exception {
File rootDir = toFile(getClass().getResource("."));
deleteDirectory(rootDir);
@@ -214,7 +211,7 @@ public class DriftManagerBeanTest extends AbstractEJB3Test {
assertEquals(DriftFileStatus.REQUESTED, driftFile.getStatus());
}
- @Test(enabled = ENABLE_TESTS)
+ @Test
public void testDriftDef() throws Exception {
Configuration config = new Configuration();
DriftDefinition driftDefPojo = new DriftDefinition(config);
12 years, 3 months
[rhq] Branch 'bug/747925' - modules/enterprise
by mazz
modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBean.java | 2 ++
1 file changed, 2 insertions(+)
New commits:
commit aff60fc38e07fdde534313cd35344493432d9245
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 24 19:59:01 2012 -0500
[BZ 747925] add a debug log message so we know when the re-registration happens
diff --git a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBean.java b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBean.java
index 002ae27..4bc097f 100644
--- a/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBean.java
+++ b/modules/enterprise/server/jar/src/main/java/org/rhq/enterprise/server/resource/metadata/PluginManagerBean.java
@@ -362,6 +362,8 @@ public class PluginManagerBean implements PluginManagerLocal {
for (Map.Entry<String, PluginDescriptor> entry : extensions.entrySet()) {
String extPluginName = entry.getKey();
PluginDescriptor extPluginDescriptor = entry.getValue();
+ log.debug("Plugin [" + extPluginName
+ + "] will be re-registered because it embeds types from plugin [" + plugin.getName() + "]");
pluginMgr.registerPluginTypes(extPluginName, extPluginDescriptor, false, true);
resourceMetadataManager.removeObsoleteTypes(subject, extPluginName, metadataManager);
}
12 years, 3 months
[rhq] Branch 'bug/747925' - modules/core
by mazz
modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataManager.java | 27 +++++-----
1 file changed, 15 insertions(+), 12 deletions(-)
New commits:
commit 4dcc098db6a1dc828122b74afefc3f25fa3c7dfb
Author: John Mazzitelli <mazz(a)redhat.com>
Date: Fri Feb 24 17:17:28 2012 -0500
[BZ 747925] hot deploying a new plugin wasn't working because the metadata manager wasn't looking at the new descriptor, it was reusing the old descriptor. this hopefully fixes the problem.
diff --git a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataManager.java b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataManager.java
index fa67bcc..7e3485f 100644
--- a/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataManager.java
+++ b/modules/core/client-api/src/main/java/org/rhq/core/clientapi/agent/metadata/PluginMetadataManager.java
@@ -45,10 +45,12 @@ import org.rhq.core.domain.resource.ResourceType;
* metadata for the rest of the services in the form of the domain object classes and the jaxb version of the
* descriptors.
*
- * This object can also be used to separately store plugin descriptors without converting them into types.
+ * This object can also be used to separately store plugin descriptors without converting them into types (i.e.
+ * the descriptor staging area).
* The thinking here is the server has the ability to get all the plugin descriptors early on and in any order;
* only later does it load/register those plugins (because it needs to order them via the proper dependency graph.
- * There may be times when we need a plugin's descriptor but before that plugin has been loaded/registered.
+ * There may be times when we need a plugin's descriptor but before that plugin has been loaded/registered. This
+ * manager lets us stage those descriptors prior to converting them into types.
*
* @author Greg Hinkle
* @author John Mazzitelli
@@ -82,21 +84,22 @@ public class PluginMetadataManager {
}
/**
- * Get the plugin descriptor for the named plugin. If the descriptor was previous loaded/parsed
- * via {@link #loadPlugin(PluginDescriptor)}, it will be used. If it hasn't been loaded yet, but
- * previously stored via {@link #storePluginDescriptor(PluginDescriptor)}, the stored descriptor
- * will be returned. If the descriptor cannot be found anywhere, returns null.
+ * Get the plugin descriptor for the named plugin. If the descriptor was previously staged
+ * via {@link #storePluginDescriptor(PluginDescriptor)}, it will be used. If a new descriptor
+ * hasn't been staged, but a previous descriptor was loaded and converted into types,
+ * via {@link #loadPlugin(PluginDescriptor)}, it will be used.
+ * If the descriptor cannot be found anywhere, returns null.
*
* @param pluginName name of the plugin whose descriptor is to be returned.
* @return the descriptor or null if not available
*/
public PluginDescriptor getPluginDescriptor(String pluginName) {
- PluginDescriptor descriptor = null;
- PluginMetadataParser parser = this.parsersByPlugin.get(pluginName);
- if (parser != null) {
- descriptor = parser.getDescriptor();
- } else {
- descriptor = this.descriptorsByPlugin.get(pluginName);
+ PluginDescriptor descriptor = this.descriptorsByPlugin.get(pluginName);
+ if (descriptor == null) {
+ PluginMetadataParser parser = this.parsersByPlugin.get(pluginName);
+ if (parser != null) {
+ descriptor = parser.getDescriptor();
+ }
}
return descriptor;
}
12 years, 3 months
[rhq] modules/enterprise
by ips
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/DbSetupUtility.java | 84 +++++++---
modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/util/test-ds.properties | 7
2 files changed, 74 insertions(+), 17 deletions(-)
New commits:
commit 00d6ba36588ff34470a018db685fe145c9ca507e
Author: Ian Springer <ian.springer(a)redhat.com>
Date: Fri Feb 24 17:08:27 2012 -0500
in DbSetupUtility, read the test datasource connection props from Maven's rhq.test.ds.* props, rather than using hard-coded values
diff --git a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/DbSetupUtility.java b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/DbSetupUtility.java
index 753b8f5..5affecb 100644
--- a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/DbSetupUtility.java
+++ b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/util/DbSetupUtility.java
@@ -20,6 +20,7 @@ package org.rhq.enterprise.server.util;
import java.io.File;
import java.io.FileOutputStream;
+import java.io.IOException;
import java.io.InputStream;
import java.io.PrintWriter;
import java.net.URL;
@@ -48,24 +49,35 @@ public class DbSetupUtility {
public static final String JON300_SCHEMA_VERSION = "2.116";
- private static final String DB_NAME = System.getProperty("rhq.test.ds.db-name", "rhq");
- private static final String DB_SERVER_NAME = System.getProperty("rhq.test.ds.server-name", "127.0.0.1");
- private static final String DB_CONNECTION_URL = System.getProperty("rhq.test.ds.connection-url",
- "jdbc:postgresql://" + DB_SERVER_NAME + ":5432/" + DB_NAME);
- private static final String DB_USER_NAME = System.getProperty("rhq.test.ds.user-name", "rhqadmin");
- private static final String DB_PASSWORD = System.getProperty("rhq.test.ds.password", "rhqadmin");
-
private static final String BASE_RESOURCE_PATH = DbSetupUtility.class.getPackage().getName().replace('.', '/');
+ private static TestDatasourceConfiguration testDsConfig;
+
+ private static TestDatasourceConfiguration getTestDatasourceConfiguration() {
+ if (testDsConfig == null) {
+ Properties testDsProperties = new Properties();
+ InputStream resourceAsStream = DbSetupUtility.class.getResourceAsStream("test-ds.properties");
+ try {
+ testDsProperties.load(resourceAsStream);
+ } catch (IOException e) {
+ throw new RuntimeException("Failed to load test-ds.properties from classloader.", e);
+ }
+ testDsConfig = new TestDatasourceConfiguration(testDsProperties);
+ System.out.println("Using test datasource with config " + testDsConfig + "...");
+ }
+ return testDsConfig;
+ }
+
public static void dbreset() throws Exception {
- System.out.println("Resetting DB at " + DB_CONNECTION_URL + "...");
+ TestDatasourceConfiguration testDs = getTestDatasourceConfiguration();
+ System.out.println("Resetting DB at " + testDs.connectionUrl + "...");
// NOTE: We do not use DBReset.performDBReset() here, since DBReset deletes the schema, which requires there to
// be no active connections to the DB. Liquibase.dropAll(), on the other hand, just deletes all the
// objects in the DB, which has no such requirement.
- String dbDriver = DatabaseFactory.getInstance().findDefaultDriver(DB_CONNECTION_URL);
+ String dbDriver = DatabaseFactory.getInstance().findDefaultDriver(testDs.connectionUrl);
Database database = CommandLineUtils.createDatabaseObject(DbSetupUtility.class.getClassLoader(),
- DB_CONNECTION_URL, DB_USER_NAME, DB_PASSWORD, dbDriver, null, null, null);
+ testDs.connectionUrl, testDs.userName, testDs.password, dbDriver, null, null, null);
//Database database = DatabaseFactory.getInstance().findCorrectDatabaseImplementation(
// new JdbcConnection(AbstractEJB3Test.getConnection()));
Liquibase liquibase = new Liquibase(null, new ClassLoaderResourceAccessor(), database);
@@ -92,7 +104,9 @@ public class DbSetupUtility {
dataFileResourcePath = "db-data-combined.xml";
}
- DBSetup dbsetup = new DBSetup(DB_CONNECTION_URL, DB_USER_NAME, DB_PASSWORD);
+ TestDatasourceConfiguration testDs = getTestDatasourceConfiguration();
+
+ DBSetup dbsetup = new DBSetup(testDs.connectionUrl, testDs.userName, testDs.password);
dbsetup.setup(schemaFileResourcePath);
dbsetup.setup(dataFileResourcePath);
}
@@ -101,20 +115,21 @@ public class DbSetupUtility {
System.out.println("Upgrading RHQ DB to schema version [" + targetSchemaVersion + "]...");
File logfile = File.createTempFile("rhq.test", "dbupgrade.log");
+ TestDatasourceConfiguration testDs = getTestDatasourceConfiguration();
try {
- // get the URL for the dbupgrade Ant script, which is located in the dbutils jar
+ // Get the URL for the dbupgrade Ant script, which is located in the dbutils jar.
URL dbupgradeXmlFileUrl = DbSetupUtility.class.getClassLoader().getResource("db-upgrade.xml");
Properties antProps = new Properties();
- antProps.setProperty("jdbc.url", DB_CONNECTION_URL);
- antProps.setProperty("jdbc.user", DB_USER_NAME);
- antProps.setProperty("jdbc.password", DB_PASSWORD);
+ antProps.setProperty("jdbc.url", testDs.connectionUrl);
+ antProps.setProperty("jdbc.user", testDs.userName);
+ antProps.setProperty("jdbc.password", testDs.password);
antProps.setProperty("target.schema.version", targetSchemaVersion);
startAnt(dbupgradeXmlFileUrl, "db-ant-tasks.properties", antProps, logfile);
} catch (Exception e) {
- throw new RuntimeException("Cannot upgrade the RHQ DB at URL " + DB_CONNECTION_URL + " to schema version "
- + targetSchemaVersion + ".", e);
+ throw new RuntimeException("Cannot upgrade the RHQ DB at [" + testDs.connectionUrl + "] to schema version ["
+ + targetSchemaVersion + "].", e);
}
return;
@@ -205,5 +220,40 @@ public class DbSetupUtility {
}
}
}
+
+ private static class TestDatasourceConfiguration {
+ abstract class Property {
+ public static final String DB_CONNECTION_URL = "rhq.test.ds.connection-url";
+ public static final String DB_SERVER_NAME = "rhq.test.ds.server-name";
+ public static final String DB_NAME = "rhq.test.ds.db-name";
+ public static final String DB_USER_NAME = "rhq.test.ds.user-name";
+ public static final String DB_PASSWORD = "rhq.test.ds.password";
+ }
+
+ String connectionUrl;
+ String serverName;
+ String dbName;
+ String userName;
+ String password;
+
+ private TestDatasourceConfiguration(Properties props) {
+ connectionUrl = props.getProperty(Property.DB_CONNECTION_URL);
+ serverName = props.getProperty(Property.DB_SERVER_NAME);
+ dbName = props.getProperty(Property.DB_NAME);
+ userName = props.getProperty(Property.DB_USER_NAME);
+ password = props.getProperty(Property.DB_PASSWORD);
+ }
+
+ @Override
+ public String toString() {
+ // NOTE: For the sake of security, we don't include the password here.
+ return "{" +
+ "connectionUrl='" + connectionUrl + '\'' +
+ ", serverName='" + serverName + '\'' +
+ ", dbName='" + dbName + '\'' +
+ ", userName='" + userName + '\'' +
+ '}';
+ }
+ }
}
diff --git a/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/util/test-ds.properties b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/util/test-ds.properties
new file mode 100644
index 0000000..448c69e
--- /dev/null
+++ b/modules/enterprise/server/jar/src/test/resources/org/rhq/enterprise/server/util/test-ds.properties
@@ -0,0 +1,7 @@
+# The values of these properties get substituted by Maven during the test:resources phase.
+rhq.test.ds.driver-class = ${rhq.test.ds.driver-class}
+rhq.test.ds.connection-url = ${rhq.test.ds.connection-url}
+rhq.test.ds.server-name = ${rhq.test.ds.server-name}
+rhq.test.ds.db-name = ${rhq.test.ds.db-name}
+rhq.test.ds.user-name = ${rhq.test.ds.user-name}
+rhq.test.ds.password = ${rhq.test.ds.password}
12 years, 3 months
[rhq] modules/enterprise
by snegrea
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java | 7 +++++++
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/DurationItem.java | 1 +
modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java | 7 +++++++
3 files changed, 15 insertions(+)
New commits:
commit 44ef286191883ac429d0eddb04b7a76bffc21a68
Author: Stefan Negrea <snegrea(a)redhat.com>
Date: Fri Feb 24 15:36:12 2012 -0600
[BZ 749315] Set max and min values for integer validators to corresponding integer limits when they are not specified other config properties.
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
index 2b76531..06330a8 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/configuration/ConfigurationEditor.java
@@ -1563,9 +1563,16 @@ public class ConfigurationEditor extends LocatableVLayout {
if (integerConstraint.getMinimum() != null) {
validator.setMin(integerConstraint.getMinimum().intValue());
}
+ else {
+ validator.setMin(Integer.MIN_VALUE);
+ }
if (integerConstraint.getMaximum() != null) {
validator.setMax(integerConstraint.getMaximum().intValue());
}
+ else {
+ validator.setMax(Integer.MAX_VALUE);
+ }
+
validators.add(validator);
} else if (constraint instanceof FloatRangeConstraint) {
FloatRangeConstraint floatConstraint = ((FloatRangeConstraint) constraint);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/DurationItem.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/DurationItem.java
index ef4e20f..486b20b 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/DurationItem.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/components/form/DurationItem.java
@@ -125,6 +125,7 @@ public class DurationItem extends CanvasItem {
valueItem.setValue(getValue());
IntegerRangeValidator integerRangeValidator = new IntegerRangeValidator();
integerRangeValidator.setMin(1);
+ integerRangeValidator.setMax(Integer.MAX_VALUE);
valueItem.setValidators(integerRangeValidator);
valueItem.setValidateOnChange(true);
diff --git a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
index 20c3d2a..00a4567 100644
--- a/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
+++ b/modules/enterprise/gui/coregui/src/main/java/org/rhq/enterprise/gui/coregui/client/util/RPCDataSource.java
@@ -672,9 +672,16 @@ public abstract class RPCDataSource<T, C extends BaseCriteria> extends DataSourc
if (minValue != null) {
integerRangeValidator.setMin(minValue);
}
+ else {
+ integerRangeValidator.setMin(Integer.MIN_VALUE);
+ }
if (maxValue != null) {
integerRangeValidator.setMax(maxValue);
}
+ else {
+ integerRangeValidator.setMax(Integer.MAX_VALUE);
+ }
+
textField.setValidators(integerRangeValidator);
}
return textField;
12 years, 3 months