Login
[x]
Log in using an account from:
Fedora Account System
Red Hat Associate
Red Hat Customer
Or login using a Red Hat Bugzilla account
Forgot Password
Login:
Hide Forgot
Create an Account
Red Hat Bugzilla – Attachment 626300 Details for
Bug 865950
Expose method to set timestamp on MeasurementDataNumeric
[?]
New
Simple Search
Advanced Search
My Links
Browse
Requests
Reports
Current State
Search
Tabular reports
Graphical reports
Duplicates
Other Reports
User Changes
Plotly Reports
Bug Status
Bug Severity
Non-Defaults
|
Product Dashboard
Help
Page Help!
Bug Writing Guidelines
What's new
Browser Support Policy
5.0.4.rh83 Release notes
FAQ
Guides index
User guide
Web Services
Contact
Legal
This site requires JavaScript to be enabled to function correctly, please enable it.
[patch]
simple patch for this feature
0001-BZ-865950-Expose-method-to-set-timestamp-on-Measurem.patch (text/plain), 4.62 KB, created by
Elias Ross
on 2012-10-12 21:31:17 UTC
(
hide
)
Description:
simple patch for this feature
Filename:
MIME Type:
Creator:
Elias Ross
Created:
2012-10-12 21:31:17 UTC
Size:
4.62 KB
patch
obsolete
>From 89c5dd3d99bf8e39565a9f0f4d35a23ea4411bbd Mon Sep 17 00:00:00 2001 >From: Elias Ross <elias_ross@apple.com> >Date: Fri, 12 Oct 2012 14:29:10 -0700 >Subject: [PATCH] [BZ 865950] Expose method to set timestamp on > MeasurementDataNumeric > >Add test to test this feature >--- > .../domain/measurement/MeasurementDataNumeric.java | 31 +++++++++++++++++- > .../measurement/test/MeasurementDataTest.java | 34 ++++++++++++++++++++ > 2 files changed, 64 insertions(+), 1 deletion(-) > create mode 100644 modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/MeasurementDataTest.java > >diff --git a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric.java b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric.java >index 1cae19b..874f3d0 100644 >--- a/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric.java >+++ b/modules/core/domain/src/main/java/org/rhq/core/domain/measurement/MeasurementDataNumeric.java >@@ -47,19 +47,48 @@ protected MeasurementDataNumeric() { > super(); > } > >+ /** >+ * Constructs a measurement data numeric, from a request, with a value. >+ * @param request scheduled request being handled >+ * @param value value of the measurement >+ */ > public MeasurementDataNumeric(MeasurementScheduleRequest request, Double value) { > super(request); > this.value = value; > this.rawNumericType = request.getRawNumericType(); > } > >+ /** >+ * Constructs a measurement data numeric, from a request, with a value and timestamp. >+ * @param request scheduled request being handled >+ * @param value value of the measurement >+ * @param timestamp when the value was taken >+ */ >+ public MeasurementDataNumeric(MeasurementScheduleRequest request, Double value, long timestamp) { >+ super(timestamp, request); >+ this.value = value; >+ this.rawNumericType = request.getRawNumericType(); >+ } >+ >+ /** >+ * Constructs a measurement data numeric, with collection time, from a request, with a value. >+ * @param collectionTime how long it took to collect data, in milliseconds >+ * @param request scheduled request being handled >+ * @param value value of the measurement >+ */ > public MeasurementDataNumeric(long collectionTime, MeasurementScheduleRequest request, Double value) { > super(collectionTime, request); > this.value = value; > this.rawNumericType = request.getRawNumericType(); > } > >- public MeasurementDataNumeric(long collectionTime, int scheduleId,Double value) { >+ /** >+ * Constructs a measurement data numeric, with collection time, schedule ID, and value. >+ * @param collectionTime how long it took to collect data, in milliseconds >+ * @param schedule ID schedule ID being handled >+ * @param value value of the measurement >+ */ >+ public MeasurementDataNumeric(long collectionTime, int scheduleId, Double value) { > super(collectionTime,scheduleId); > this.value = value; > } >diff --git a/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/MeasurementDataTest.java b/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/MeasurementDataTest.java >new file mode 100644 >index 0000000..9204f7c >--- /dev/null >+++ b/modules/core/domain/src/test/java/org/rhq/core/domain/measurement/test/MeasurementDataTest.java >@@ -0,0 +1,34 @@ >+package org.rhq.core.domain.measurement.test; >+ >+import org.rhq.core.domain.measurement.DataType; >+import org.rhq.core.domain.measurement.MeasurementDataNumeric; >+import org.rhq.core.domain.measurement.MeasurementDataTrait; >+import org.rhq.core.domain.measurement.MeasurementScheduleRequest; >+import org.testng.annotations.Test; >+ >+@Test >+public class MeasurementDataTest { >+ >+ DataType dataType = DataType.MEASUREMENT; >+ MeasurementScheduleRequest request = new MeasurementScheduleRequest(3, "name", 0, true, dataType); >+ long ts = 42; >+ >+ public void testNumeric() { >+ double value = 55; >+ MeasurementDataNumeric mdn = new MeasurementDataNumeric(request, value, ts); >+ assert mdn.getTimestamp() == ts; >+ assert mdn.getScheduleId() == request.getScheduleId(); >+ assert mdn.getValue().equals(Double.valueOf(value)); >+ mdn.toString(); >+ } >+ >+ public void testTrait() { >+ String value = "55"; >+ MeasurementDataTrait mdt = new MeasurementDataTrait(ts, request, value); >+ assert mdt.getTimestamp() == ts; >+ assert mdt.getScheduleId() == request.getScheduleId(); >+ assert mdt.getValue().equals(value); >+ mdt.toString(); >+ } >+ >+} >-- >1.7.9.3 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 865950
: 626300