modules/core/domain/intentional-api-changes-since-4.4.0.JON311GA.xml
| 10 ++
modules/enterprise/agent/src/etc/rhq-agent.sh
| 13 ++
modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java
| 46 +++++++---
3 files changed, 57 insertions(+), 12 deletions(-)
New commits:
commit b17bd0074707cf101dcca638832734a1de2bbb6e
Author: Lukas Krejci <lkrejci(a)redhat.com>
Date: Thu Dec 20 00:18:51 2012 +0100
[BZ 880795] - The upgraded Augeas library no longer contains the file
"libaugeas.so", which causes the default native library lookup mechanisms
to fail. Standard ld should be able to find the .so.x.y files, too,
but the presence of java.library.path system property seems to be causing
this not to kick in during the library loading as done by the JVM.
To work around this problem, we need to instruct JNA to have a "backup
plan" in case the standard lookup mechanisms fail. This can be done using
the "jna.platform.library.path" system property, which instructs JNA to use
that path to look up libraries if everything else fails (and do the .so.x.y
resolution on its own).
We set this variable to the same value as we override LD_LIBRARY_PATH to
so that JNA library loading and native (as in system-wide) library loading
works the same for the agent process. This way we can load the JNA
libraries using the .so.x.y resolution the same way as the system resolves
the native libraries using stadard ld mechanisms in spite of there being
the java.library.path variable set (which is needed by SIGAR).
(cherry picked from commit e437f5771c4b79ce570ad24cb3c545078d9a944a)
diff --git a/modules/enterprise/agent/src/etc/rhq-agent.sh
b/modules/enterprise/agent/src/etc/rhq-agent.sh
index e80581d..b3ee8a7 100755
--- a/modules/enterprise/agent/src/etc/rhq-agent.sh
+++ b/modules/enterprise/agent/src/etc/rhq-agent.sh
@@ -212,7 +212,9 @@ fi
debug_msg "RHQ_AGENT_CMDLINE_OPTS: $RHQ_AGENT_CMDLINE_OPTS"
# ----------------------------------------------------------------------
-# Prepare LD_LIBRARY_PATH to include libraries shipped with the agent
+# Prepare LD_LIBRARY_PATH to include libraries shipped with the agent and
+# prepare jna.platform.library.path for JNA to be able to load augeas from our
+# custom location.
# ----------------------------------------------------------------------
if [ -n "$_LINUX" ]; then
@@ -230,6 +232,13 @@ if [ -n "$_LINUX" ]; then
fi
fi
export LD_LIBRARY_PATH
+
+ # We need to force our custom library path as the "system" look up path to
+ # JNA. Without this, the lookup of .so.x.y versions wouldn't work.
+ # We also need to keep the LD_LIBRARY_PATH in place so that the default
+ # system lookup works for libfa, which libaugeas depends on.
+
_JNA_LIBRARY_PATH="\"-Djna.platform.library.path=${LD_LIBRARY_PATH}\""
+
debug_msg "LD_LIBRARY_PATH: $LD_LIBRARY_PATH"
fi
@@ -265,7 +274,7 @@ if [ -z "$RHQ_AGENT_MAINCLASS" ]; then
fi
# Build the command line that starts the VM
-CMD="\"${RHQ_AGENT_JAVA_EXE_FILE_PATH}\" ${_JAVA_ENDORSED_DIRS_OPT}
${_JAVA_LIBRARY_PATH_OPT} ${RHQ_AGENT_JAVA_OPTS} ${RHQ_AGENT_ADDITIONAL_JAVA_OPTS}
${_LOG_CONFIG} -cp \"${CLASSPATH}\" ${RHQ_AGENT_MAINCLASS}
${RHQ_AGENT_CMDLINE_OPTS}"
+CMD="\"${RHQ_AGENT_JAVA_EXE_FILE_PATH}\" ${_JAVA_ENDORSED_DIRS_OPT}
${_JAVA_LIBRARY_PATH_OPT} ${_JNA_LIBRARY_PATH} ${RHQ_AGENT_JAVA_OPTS}
${RHQ_AGENT_ADDITIONAL_JAVA_OPTS} ${_LOG_CONFIG} -cp \"${CLASSPATH}\"
${RHQ_AGENT_MAINCLASS} ${RHQ_AGENT_CMDLINE_OPTS}"
debug_msg "Executing the agent with this command line:"
debug_msg "$CMD"
commit 8623993dd46785e359383c0cc54dc51c168d0c96
Author: John Sanda <jsanda(a)redhat.com>
Date: Wed Dec 19 10:00:20 2012 -0500
fixing a few issues with test failures
Test clean was failing because we were not purging the resource from the db.
The uuid constant in the test class did not match the one actually used.
When setting the uuid, Resource pads it out to 36 characters.
The other issue involves dealing with decimal precision. I have added a
function to use up to 4 decimal places.
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java
index cbbbdaf..b40efbe 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java
@@ -31,10 +31,14 @@ import static org.rhq.core.domain.measurement.NumericType.DYNAMIC;
import static org.rhq.core.domain.resource.ResourceCategory.SERVER;
import static org.rhq.test.AssertUtils.assertPropertiesMatch;
+import java.math.BigDecimal;
+import java.math.MathContext;
+import java.math.RoundingMode;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import java.sql.Statement;
+import java.text.DecimalFormat;
import java.util.Collections;
import java.util.List;
@@ -91,7 +95,7 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test {
private final String RESOURCE_NAME = getClass().getName() + "_NAME";
- private final String RESOURCE_UUID = getClass().getSimpleName() + "_UUID";
+ private final String RESOURCE_UUID = "MeasurementDataManagerBeanTest_UUID
";
private ResourceType resourceType;
@@ -114,7 +118,7 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test
{
insertDummyReport();
}
- @AfterMethod
+ @AfterMethod(alwaysRun = true)
public void tearDown() {
purgeDB();
}
@@ -146,17 +150,17 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test
{
assertEquals("Expected to get back 60 data points.",
buckets.getNumDataPoints(), actualData.size());
MeasurementDataNumericHighLowComposite expectedBucket0Data = new
MeasurementDataNumericHighLowComposite(
- buckets.get(0), (1.1 + 2.2 + 3.3) / 3, 3.3, 1.1);
+ buckets.get(0), divide(1.1 + 2.2 + 3.3, 3), 3.3, 1.1);
MeasurementDataNumericHighLowComposite expectedBucket59Data = new
MeasurementDataNumericHighLowComposite(
- buckets.get(59), (4.4 + 5.5 + 6.6) / 3, 6.6, 4.4);
+ buckets.get(59), divide(4.4 + 5.5 + 6.6, 3), 6.6, 4.4);
MeasurementDataNumericHighLowComposite expectedBucket29Data = new
MeasurementDataNumericHighLowComposite(
buckets.get(29), Double.NaN, Double.NaN, Double.NaN);
- assertPropertiesMatch("The data for bucket 0 does not match the expected
values.", expectedBucket0Data,
+ assertMeasurementDataMatches("The data for bucket 0 does not match the
expected values.", expectedBucket0Data,
actualData.get(0));
- assertPropertiesMatch("The data for bucket 59 does not match the expected
values.", expectedBucket59Data,
+ assertMeasurementDataMatches("The data for bucket 59 does not match the
expected values.", expectedBucket59Data,
actualData.get(59));
- assertPropertiesMatch("The data for bucket 29 does not match the expected
values.", expectedBucket29Data,
+ assertMeasurementDataMatches("The data for bucket 29 does not match the
expected values.", expectedBucket29Data,
actualData.get(29));
}
@@ -191,16 +195,38 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test
{
assertEquals("Expected to get back 60 data points.",
buckets.getNumDataPoints(), actualData.size());
MeasurementDataNumericHighLowComposite expectedBucket0Data = new
MeasurementDataNumericHighLowComposite(
- buckets.get(0), (2.0 + 5.0 + 3.0) / 3, 6.0, 1.0);
+ buckets.get(0), divide(2.0 + 5.0 + 3.0, 3), 6.0, 1.0);
MeasurementDataNumericHighLowComposite expectedBucket59Data = new
MeasurementDataNumericHighLowComposite(
- buckets.get(59), (5.0 + 5.0 + 3.0) / 3, 9.0, 2.0);
+ buckets.get(59), divide(5.0 + 5.0 + 3.0, 3), 9.0, 2.0);
- assertPropertiesMatch("The data for bucket 0 does not match the expected
values.", expectedBucket0Data,
+ assertMeasurementDataMatches("The data for bucket 0 does not match the
expected values.", expectedBucket0Data,
actualData.get(0));
assertPropertiesMatch("The data for bucket 59 does not match the expected
values.", expectedBucket59Data,
actualData.get(59));
}
+ private void assertMeasurementDataMatches(String msg,
MeasurementDataNumericHighLowComposite expected,
+ MeasurementDataNumericHighLowComposite actual) {
+
+ if (Double.isNaN(expected.getValue())) {
+ assertPropertiesMatch(msg, expected, actual);
+ } else {
+ assertPropertiesMatch(msg, expected, actual, "value");
+
+ DecimalFormat df = new DecimalFormat("#########0.0000");
+ MathContext context = new MathContext(16, RoundingMode.CEILING);
+ BigDecimal expectedValue = new BigDecimal(df.format(expected.getValue()),
context);
+ BigDecimal actualValue = new BigDecimal(df.format(actual.getValue()),
context);
+
+ assertEquals(msg + " - The average value does not match.",
expectedValue, actualValue);
+ }
+ }
+
+ private double divide(double dividend, int divisor) {
+ return new BigDecimal(Double.toString(dividend)).divide(new
BigDecimal(Integer.toString(divisor)),
+ MathContext.DECIMAL64).doubleValue();
+ }
+
private void createInventory() throws Exception {
purgeDB();
executeInTransaction(new TransactionCallback() {
@@ -287,7 +313,6 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test
{
.setParameter("key", RESOURCE_KEY)
.setParameter("uuid", RESOURCE_UUID)
.executeUpdate();
- em.flush();
}
private void deleteMeasurementSchedules(EntityManager em) {
commit 0ecbebbf556353cd4b5aadef7e9e62e9a09ffcc0
Author: John Sanda <jsanda(a)redhat.com>
Date: Tue Dec 18 10:29:17 2012 -0500
trying to resolve oracle test failure
We are hitting a constraint violation when attemtping to delete the agent
record, even though we have already executed a statement to delete the
resource. Adding call to EntityManager.flush after deleting the resource to
ensure that the resource deletion is performed prior to deleting the agent.
diff --git
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java
index 96a72ed..cbbbdaf 100644
---
a/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java
+++
b/modules/enterprise/server/jar/src/test/java/org/rhq/enterprise/server/measurement/MeasurementDataManagerBeanTest.java
@@ -287,6 +287,7 @@ public class MeasurementDataManagerBeanTest extends AbstractEJB3Test
{
.setParameter("key", RESOURCE_KEY)
.setParameter("uuid", RESOURCE_UUID)
.executeUpdate();
+ em.flush();
}
private void deleteMeasurementSchedules(EntityManager em) {
commit 17ea914e821eb2ec331c8fe454e5793bb4b2f856
Author: Simeon Pinder <spinder(a)fulliautomatix.conchfritter.com>
Date: Mon Dec 17 14:00:37 2012 -0500
[BZ 878661] add justification for reverting unintentional api changes.
diff --git a/modules/core/domain/intentional-api-changes-since-4.4.0.JON311GA.xml
b/modules/core/domain/intentional-api-changes-since-4.4.0.JON311GA.xml
new file mode 100644
index 0000000..427b809
--- /dev/null
+++ b/modules/core/domain/intentional-api-changes-since-4.4.0.JON311GA.xml
@@ -0,0 +1,10 @@
+<?xml version="1.0"?>
+<differences>
+ <difference>
+
<className>org/rhq/core/domain/configuration/definition/PropertyDefinitionMap</className>
+ <differenceType>7006</differenceType><!-- return type changed
-->
+ <method>java.util.List getPropertyDefinitions()</method>
+ <to>java.util.Map</to>
+ <justification>[BZ 878661] reverting unintentional api
changes.</justification>
+ </difference>
+</differences>