Author: ips
Date: 2012-05-18 10:43:08 -0400 (Fri, 18 May 2012)
New Revision: 1047
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/bean/MeasurementUtils.java
trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java
trunk/core/src/test/java/org/jboss/on/embedded/manager/pc/test/PluginContainerResourceManagerTest.java
Log:
get everything compiling w/ RHQ 4.4
Modified: trunk/core/src/main/java/org/jboss/on/embedded/bean/MeasurementUtils.java
===================================================================
--- trunk/core/src/main/java/org/jboss/on/embedded/bean/MeasurementUtils.java 2012-05-18
13:40:06 UTC (rev 1046)
+++ trunk/core/src/main/java/org/jboss/on/embedded/bean/MeasurementUtils.java 2012-05-18
14:43:08 UTC (rev 1047)
@@ -33,6 +33,7 @@
import org.rhq.core.domain.measurement.DataType;
import org.rhq.core.domain.measurement.DisplayType;
import org.rhq.core.domain.measurement.MeasurementData;
+import org.rhq.core.domain.measurement.MeasurementDataRequest;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.measurement.MeasurementUnits;
import org.rhq.core.domain.measurement.composite.MeasurementNumericValueAndUnits;
@@ -123,9 +124,14 @@
int resourceId = this.resource.getResource().getId();
String[] measurementNamesArray = requestedMetricDefs.keySet().toArray(
new String[requestedMetricDefs.size()]);
- Set<MeasurementData> measurementDataSet = measurementAgentService
- .getRealTimeMeasurementValue(resourceId, dataType,
- measurementNamesArray);
+ List<org.rhq.core.domain.measurement.MeasurementDataRequest>
metricDataRequests =
+ new ArrayList<MeasurementDataRequest>(requestedMetricDefs.size());
+ for (MeasurementDefinition metricDef : requestedMetricDefs.values()) {
+ MeasurementDataRequest metricDataRequest = new
MeasurementDataRequest(metricDef);
+ metricDataRequests.add(metricDataRequest);
+ }
+ Set<MeasurementData> measurementDataSet = measurementAgentService
+ .getRealTimeMeasurementValue(resourceId, metricDataRequests);
// @TODO when displayOrder is implemented this should use displayOrder,
// but right now the displayOrder
// for all MeasurementData is set to "0" which will cause only the last
Modified:
trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java
===================================================================
---
trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java 2012-05-18
13:40:06 UTC (rev 1046)
+++
trunk/core/src/main/java/org/jboss/on/embedded/manager/pc/PluginContainerResourceManager.java 2012-05-18
14:43:08 UTC (rev 1047)
@@ -1,6 +1,6 @@
/*
* Embedded Jopr Project
- * Copyright (C) 2006-2009 Red Hat, Inc.
+ * Copyright (C) 2006-2012 Red Hat, Inc.
* All rights reserved.
*
* This program is free software; you can redistribute it and/or modify
@@ -129,7 +129,6 @@
// ResourceManager Implementation --------------------------------------------
// @TODO need to check this. In tests this causes NPE, something might have changed
and we might need a different way to do this
-
public ResourceType getResourceType(String resourceTypeName)
{
ResourceType resourceType = null;
@@ -264,25 +263,30 @@
return response;
}
- public CreateResourceResponse createResource(String resourceName, ResourceType
resourceType, Resource parentResource, Configuration pluginConfiguration, Configuration
resourceConfiguration)
+ public CreateResourceResponse createResource(String resourceName, ResourceType
resourceType, Resource parentResource,
+ Configuration pluginConfiguration,
Configuration resourceConfiguration)
{
CreateResourceResponse response;
- CreateResourceRequest request = new CreateResourceRequest(1,
parentResource.getId(), resourceName, resourceType.getName(), resourceType.getPlugin(),
pluginConfiguration, resourceConfiguration);
+ CreateResourceRequest request = new CreateResourceRequest(1,
parentResource.getId(), resourceName,
+ resourceType.getName(), resourceType.getPlugin(), pluginConfiguration,
resourceConfiguration, null);
response = createResource(resourceType, parentResource, request);
return response;
}
- public CreateResourceResponse createResource(String resourceName, ResourceType
resourceType, Resource parentResource, Configuration pluginConfiguration,
ResourcePackageDetails packageDetails)
+ public CreateResourceResponse createResource(String resourceName, ResourceType
resourceType, Resource parentResource,
+ Configuration pluginConfiguration,
ResourcePackageDetails packageDetails)
{
CreateResourceResponse response;
- CreateResourceRequest request = new CreateResourceRequest(1,
parentResource.getId(), resourceName, resourceType.getName(), resourceType.getPlugin(),
pluginConfiguration, packageDetails);
+ CreateResourceRequest request = new CreateResourceRequest(1,
parentResource.getId(), resourceName,
+ resourceType.getName(), resourceType.getPlugin(), pluginConfiguration,
packageDetails, null);
response = createResource(resourceType, parentResource, request);
return response;
}
// tries to create a resource using the specified CreateResourceRequest
// if successful it will try to refresh the inventory by calling
discoverServicesSync
- private CreateResourceResponse createResource(ResourceType resourceType, Resource
parentResource, CreateResourceRequest request)
+ private CreateResourceResponse createResource(ResourceType resourceType, Resource
parentResource,
+ CreateResourceRequest request)
{
CreateResourceResponse response;
try
Modified:
trunk/core/src/test/java/org/jboss/on/embedded/manager/pc/test/PluginContainerResourceManagerTest.java
===================================================================
---
trunk/core/src/test/java/org/jboss/on/embedded/manager/pc/test/PluginContainerResourceManagerTest.java 2012-05-18
13:40:06 UTC (rev 1046)
+++
trunk/core/src/test/java/org/jboss/on/embedded/manager/pc/test/PluginContainerResourceManagerTest.java 2012-05-18
14:43:08 UTC (rev 1047)
@@ -21,6 +21,7 @@
import java.util.ArrayList;
import java.util.HashSet;
+import java.util.List;
import java.util.Set;
import org.rhq.core.clientapi.agent.measurement.MeasurementAgentService;
@@ -29,6 +30,7 @@
import org.rhq.core.domain.configuration.PropertySimple;
import org.rhq.core.domain.configuration.definition.ConfigurationDefinition;
import org.rhq.core.domain.measurement.MeasurementData;
+import org.rhq.core.domain.measurement.MeasurementDataRequest;
import org.rhq.core.domain.measurement.MeasurementDefinition;
import org.rhq.core.domain.resource.Resource;
import org.rhq.core.domain.resource.ResourceCategory;
@@ -198,9 +200,14 @@
Set<String> measurementNames = new HashSet<String>();
Set<MeasurementDefinition> metricDefinitions =
resourceType.getMetricDefinitions();
+
+ List<MeasurementDataRequest> metricDataRequests =
+ new
ArrayList<MeasurementDataRequest>(metricDefinitions.size());
for (MeasurementDefinition md : metricDefinitions)
{
measurementNames.add(md.getName());
+ MeasurementDataRequest metricDataRequest = new MeasurementDataRequest(md);
+ metricDataRequests.add(metricDataRequest);
}
// get the actual measurement data for those measurement names
@@ -209,7 +216,7 @@
MeasurementAgentService measurementAgentService =
PluginContainer.getInstance().getMeasurementAgentService();
ArrayList measurementDataList = new
ArrayList<MeasurementData>(measurementAgentService.getRealTimeMeasurementValue(
- resourceId, null, measurementNamesArray));
+ resourceId, metricDataRequests));
assert measurementDataList.size() == 3 : "there should be 3 measurement data
items for RHQDS";
}