use of alma.TMCDB.MonitorBlob in project ACS by ACS-Community.
the class BlobberWorkerUnitTest method testStandardString.
public void testStandardString() throws Exception {
// was 0, which is now illegal
blobber.setCollectorIntervalSeconds(1);
getTestWorker().setCanHandle(true);
// Collector "TestCollector" is just a dummy to trick the worker to believe that
// there is a collector registered and start operating. "TestCollector" is not used at all.
// The TestBlobberWorker creates its own single collector from which the blobber worker will get data.
getTestWorker().addCollector("TestCollector");
String componentName = "CONTROL/DV01/PSA";
String serialNumber = "3456328928847";
String propertyName = "VOLTAGE_MID_1";
Any anyUp = create_any();
String[] dataArrayUp = { "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
stringBlobData[] dataUp = new stringBlobData[dataArrayUp.length];
int index = 0;
for (String value : dataArrayUp) {
dataUp[index] = new stringBlobData(BASE_TIME + index, value);
index++;
}
stringBlobDataSeqHelper.insert(anyUp, dataUp);
MonitorBlob blobUp = new MonitorBlob(false, (short) 0, null, "wrong:" + propertyName, anyUp);
MonitorBlob[] blobs = new MonitorBlob[1];
blobs[0] = blobUp;
long startTime = BASE_TIME + 100;
long stopTime = BASE_TIME + 101;
MonitorDataBlock block = new MonitorDataBlock(startTime, stopTime, componentName, serialNumber, blobs);
MonitorDataBlock[] blocks = new MonitorDataBlock[1];
blocks[0] = block;
getTestWorker().getCollector().setMonitorData(blocks);
ComponentData data = getTestWorker().fetchData();
String clob = BASE_TIME + "|Q|" + (BASE_TIME + 1) + "|R|" + (BASE_TIME + 2) + "|S|" + (BASE_TIME + 3) + "|T|" + (BASE_TIME + 4) + "|U|" + (BASE_TIME + 5) + "|V|" + (BASE_TIME + 6) + "|W|" + (BASE_TIME + 7) + "|X|" + (BASE_TIME + 8) + "|Y|" + (BASE_TIME + 9) + "|Z\n";
checkData(data, clob, 10, componentName, propertyName, serialNumber, startTime, stopTime);
checkStatistics(data);
}
use of alma.TMCDB.MonitorBlob in project ACS by ACS-Community.
the class BlobberWorkerUnitTest method testCorrelatorLongLong.
public void testCorrelatorLongLong() throws Exception {
// was 0, which is now illegal
blobber.setCollectorIntervalSeconds(1);
getTestWorker().setCanHandle(true);
// Collector "TestCollector" is just a dummy to trick the worker to believe that
// there is a collector registered and start operating. "TestCollector" is not used at all.
// The TestBlobberWorker creates its own single collector from which the blobber worker will get data.
getTestWorker().addCollector("TestCollector");
String componentName = "CONTROL/DV01/PSA";
String serialNumber = "3456328928847";
String propertyName = "VOLTAGE_MID_1";
// Note that CORBA longlong means Java long.
Any anyUp = create_any();
long[] dataArrayUp1 = { 1, 2, 3 };
long[] dataArrayUp2 = { 11, 12, 13 };
long[] dataArrayUp3 = { 21, 22, 23 };
long[][] dataUpMatrix = { dataArrayUp1, dataArrayUp2, dataArrayUp3 };
String[] serialNumbers = { "A", "B", "C" };
longLongSeqBlobData[] dataUp = new longLongSeqBlobData[dataUpMatrix.length];
int index = 0;
for (long[] value : dataUpMatrix) {
dataUp[index] = new longLongSeqBlobData(BASE_TIME + index, value);
index++;
}
longLongSeqBlobDataSeqHelper.insert(anyUp, dataUp);
MonitorBlob blobUp = new MonitorBlob(false, (short) 0, serialNumbers, "wrong:" + propertyName, anyUp);
MonitorBlob[] blobs = new MonitorBlob[1];
blobs[0] = blobUp;
long startTime = BASE_TIME + 100;
long stopTime = BASE_TIME + 101;
MonitorDataBlock block = new MonitorDataBlock(startTime, stopTime, componentName, serialNumber, blobs);
MonitorDataBlock[] blocks = new MonitorDataBlock[1];
blocks[0] = block;
getTestWorker().getCollector().setMonitorData(blocks);
ComponentData data = getTestWorker().fetchData();
String clob = BASE_TIME + "|1|" + (BASE_TIME + 1) + "|11|" + (BASE_TIME + 2) + "|21\n";
checkData(data, clob, 3, componentName, propertyName, "A", startTime, stopTime);
checkStatistics(data, 1.0, 21.0, 11.0, 10.0);
data = getTestWorker().fetchData();
clob = BASE_TIME + "|2|" + (BASE_TIME + 1) + "|12|" + (BASE_TIME + 2) + "|22\n";
propertyName = "" + propertyName;
checkData(data, clob, 3, componentName, propertyName, "B", startTime, stopTime);
checkStatistics(data, 2.0, 22.0, 12.0, 10.0);
data = getTestWorker().fetchData();
clob = BASE_TIME + "|3|" + (BASE_TIME + 1) + "|13|" + (BASE_TIME + 2) + "|23\n";
propertyName = "" + propertyName;
checkData(data, clob, 3, componentName, propertyName, "C", startTime, stopTime);
checkStatistics(data, 3.0, 23.0, 13.0, 10.0);
}
use of alma.TMCDB.MonitorBlob in project ACS by ACS-Community.
the class BlobberWorkerUnitTest method testStandardHandling.
public void testStandardHandling() throws Exception {
// was 0, which is now illegal
blobber.setCollectorIntervalSeconds(1);
getTestWorker().setCanHandle(true);
// Collector "TestCollector" is just a dummy to trick the worker to believe that
// there is a collector registered and start operating. "TestCollector" is not used at all.
// The TestBlobberWorker creates its own single collector from which the blobber worker will get data.
getTestWorker().addCollector("TestCollector");
String componentName = "CONTROL/DV01/PSA";
String serialNumber = "3456328928847";
String propertyName = "VOLTAGE_MID_1";
Any anyUp = create_any();
double[] doubleDataUp = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 };
doubleBlobData[] dataUp = createDoubleBlobData(doubleDataUp);
doubleBlobDataSeqHelper.insert(anyUp, dataUp);
MonitorBlob blobUp = new MonitorBlob(false, (short) 0, null, "wrong:" + propertyName, anyUp);
Any anyDown = create_any();
double[] doubleDataDown = { 10.0, 9.0, 8.0, 7.0, 6.0, 5.0, 4.0, 3.0, 2.0, 1.0 };
doubleBlobData[] dataDown = createDoubleBlobData(doubleDataDown);
doubleBlobDataSeqHelper.insert(anyDown, dataDown);
MonitorBlob blobDown = new MonitorBlob(false, (short) 0, null, "wrong:" + propertyName, anyDown);
Any anyNegUp = create_any();
double[] doubleDataNegUp = { -10.0, -9.0, -8.0, -7.0, -6.0, -5.0, -4.0, -3.0, -2.0, -1.0 };
doubleBlobData[] dataNegUp = createDoubleBlobData(doubleDataNegUp);
doubleBlobDataSeqHelper.insert(anyNegUp, dataNegUp);
MonitorBlob blobNegUp = new MonitorBlob(false, (short) 0, null, "wrong:" + propertyName, anyNegUp);
Any anyNegDown = create_any();
double[] doubleDataNegDown = { -1.0, -2.0, -3.0, -4.0, -5.0, -6.0, -7.0, -8.0, -9.0, -10.0 };
doubleBlobData[] dataNegDown = createDoubleBlobData(doubleDataNegDown);
doubleBlobDataSeqHelper.insert(anyNegDown, dataNegDown);
MonitorBlob blobNegDown = new MonitorBlob(false, (short) 0, null, "wrong:" + propertyName, anyNegDown);
MonitorBlob[] blobs = new MonitorBlob[4];
blobs[0] = blobUp;
blobs[1] = blobDown;
blobs[2] = blobNegUp;
blobs[3] = blobNegDown;
long startTime = BASE_TIME + 100;
long stopTime = BASE_TIME + 101;
MonitorDataBlock block = new MonitorDataBlock(startTime, stopTime, componentName, serialNumber, blobs);
MonitorDataBlock[] blocks = new MonitorDataBlock[] { block };
// Feeds the above test data to the mock monitor collector
getTestWorker().getCollector().setMonitorData(blocks);
// Reads data for the 4 properties from the test blobber worker.
// Fetching the data blocks until data arrives from the mock collector in the next blobber cycle.
m_logger.info("Will wait for blobber worker to read data from collector.");
ComponentData data = getTestWorker().fetchData();
String clob = BASE_TIME + "|1.0|" + (BASE_TIME + 1) + "|2.0|" + (BASE_TIME + 2) + "|3.0|" + (BASE_TIME + 3) + "|4.0|" + (BASE_TIME + 4) + "|5.0|" + (BASE_TIME + 5) + "|6.0|" + (BASE_TIME + 6) + "|7.0|" + (BASE_TIME + 7) + "|8.0|" + (BASE_TIME + 8) + "|9.0|" + (BASE_TIME + 9) + "|10.0\n";
checkData(data, clob, 10, componentName, propertyName, serialNumber, startTime, stopTime);
checkStatistics(data, 1.0, 10.0, 5.5, 3.0276503540);
m_logger.info("Validated collector data retrieved from blobber worker.");
// the data for the second property is available in the same blobber worker cycle,
// as soon as the previous property data has been fetched.
data = getTestWorker().fetchData();
clob = BASE_TIME + "|10.0|" + (BASE_TIME + 1) + "|9.0|" + (BASE_TIME + 2) + "|8.0|" + (BASE_TIME + 3) + "|7.0|" + (BASE_TIME + 4) + "|6.0|" + (BASE_TIME + 5) + "|5.0|" + (BASE_TIME + 6) + "|4.0|" + (BASE_TIME + 7) + "|3.0|" + (BASE_TIME + 8) + "|2.0|" + (BASE_TIME + 9) + "|1.0\n";
checkData(data, clob, 10, componentName, propertyName, serialNumber, startTime, stopTime);
checkStatistics(data, 1.0, 10.0, 5.5, 3.0276503541);
data = getTestWorker().fetchData();
clob = BASE_TIME + "|-10.0|" + (BASE_TIME + 1) + "|-9.0|" + (BASE_TIME + 2) + "|-8.0|" + (BASE_TIME + 3) + "|-7.0|" + (BASE_TIME + 4) + "|-6.0|" + (BASE_TIME + 5) + "|-5.0|" + (BASE_TIME + 6) + "|-4.0|" + (BASE_TIME + 7) + "|-3.0|" + (BASE_TIME + 8) + "|-2.0|" + (BASE_TIME + 9) + "|-1.0\n";
checkStatistics(data, -10.0, -1.0, -5.5, 3.0276503541);
checkData(data, clob, 10, componentName, propertyName, serialNumber, startTime, stopTime);
checkStatistics(data, -10.0, -1.0, -5.5, 3.0276503541);
data = getTestWorker().fetchData();
clob = BASE_TIME + "|-1.0|" + (BASE_TIME + 1) + "|-2.0|" + (BASE_TIME + 2) + "|-3.0|" + (BASE_TIME + 3) + "|-4.0|" + (BASE_TIME + 4) + "|-5.0|" + (BASE_TIME + 5) + "|-6.0|" + (BASE_TIME + 6) + "|-7.0|" + (BASE_TIME + 7) + "|-8.0|" + (BASE_TIME + 8) + "|-9.0|" + (BASE_TIME + 9) + "|-10.0\n";
checkData(data, clob, 10, componentName, propertyName, serialNumber, startTime, stopTime);
checkStatistics(data, -10.0, -1.0, -5.5, 3.0276503541);
Any anyEmpty = create_any();
double[] doubleDataEmpty = {};
doubleBlobData[] dataEmpty = createDoubleBlobData(doubleDataEmpty);
doubleBlobDataSeqHelper.insert(anyEmpty, dataEmpty);
MonitorBlob blobEmpty = new MonitorBlob(false, (short) 0, null, "wrong:" + propertyName, anyEmpty);
blobs = new MonitorBlob[2];
blobs[0] = blobEmpty;
blobs[1] = blobUp;
block = new MonitorDataBlock(startTime, stopTime, componentName, serialNumber, blobs);
blocks = new MonitorDataBlock[1];
blocks[0] = block;
getTestWorker().getCollector().setMonitorData(blocks);
data = getTestWorker().fetchData();
clob = BASE_TIME + "|1.0|" + (BASE_TIME + 1) + "|2.0|" + (BASE_TIME + 2) + "|3.0|" + (BASE_TIME + 3) + "|4.0|" + (BASE_TIME + 4) + "|5.0|" + (BASE_TIME + 5) + "|6.0|" + (BASE_TIME + 6) + "|7.0|" + (BASE_TIME + 7) + "|8.0|" + (BASE_TIME + 8) + "|9.0|" + (BASE_TIME + 9) + "|10.0\n";
checkData(data, clob, 10, componentName, propertyName, serialNumber, startTime, stopTime);
checkStatistics(data, 1.0, 10.0, 5.5, 3.0276503541);
}
use of alma.TMCDB.MonitorBlob in project ACS by ACS-Community.
the class BlobberWorkerUnitTest method testStandardLongLong.
public void testStandardLongLong() throws Exception {
// was 0, which is now illegal
blobber.setCollectorIntervalSeconds(1);
getTestWorker().setCanHandle(true);
// Collector "TestCollector" is just a dummy to trick the worker to believe that
// there is a collector registered and start operating. "TestCollector" is not used at all.
// The TestBlobberWorker creates its own single collector from which the blobber worker will get data.
getTestWorker().addCollector("TestCollector");
String componentName = "CONTROL/DV01/PSA";
String serialNumber = "3456328928847";
String propertyName = "VOLTAGE_MID_1";
// Note that CORBA longlong means Java long.
Any anyUp = create_any();
long[] dataArrayUp = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
longLongBlobData[] dataUp = new longLongBlobData[dataArrayUp.length];
int index = 0;
for (long value : dataArrayUp) {
dataUp[index] = new longLongBlobData(BASE_TIME + index, value);
index++;
}
longLongBlobDataSeqHelper.insert(anyUp, dataUp);
MonitorBlob blobUp = new MonitorBlob(false, (short) 0, null, "wrong:" + propertyName, anyUp);
MonitorBlob[] blobs = new MonitorBlob[1];
blobs[0] = blobUp;
long startTime = BASE_TIME + 100;
long stopTime = BASE_TIME + 101;
MonitorDataBlock block = new MonitorDataBlock(startTime, stopTime, componentName, serialNumber, blobs);
MonitorDataBlock[] blocks = new MonitorDataBlock[1];
blocks[0] = block;
getTestWorker().getCollector().setMonitorData(blocks);
ComponentData data = getTestWorker().fetchData();
String clob = BASE_TIME + "|1|" + (BASE_TIME + 1) + "|2|" + (BASE_TIME + 2) + "|3|" + (BASE_TIME + 3) + "|4|" + (BASE_TIME + 4) + "|5|" + (BASE_TIME + 5) + "|6|" + (BASE_TIME + 6) + "|7|" + (BASE_TIME + 7) + "|8|" + (BASE_TIME + 8) + "|9|" + (BASE_TIME + 9) + "|10\n";
checkData(data, clob, 10, componentName, propertyName, serialNumber, startTime, stopTime);
checkStatistics(data, 1.0, 10.0, 5.5, 3.0276503541);
}
use of alma.TMCDB.MonitorBlob in project ACS by ACS-Community.
the class BlobberWorkerUnitTest method testCorrelatorFloat.
public void testCorrelatorFloat() throws Exception {
// was 0, which is now illegal
blobber.setCollectorIntervalSeconds(1);
getTestWorker().setCanHandle(true);
// Collector "TestCollector" is just a dummy to trick the worker to believe that
// there is a collector registered and start operating. "TestCollector" is not used at all.
// The TestBlobberWorker creates its own single collector from which the blobber worker will get data.
getTestWorker().addCollector("TestCollector");
String componentName = "CONTROL/DV01/PSA";
String serialNumber = "3456328928847";
String propertyName = "VOLTAGE_MID_1";
Any anyUp = create_any();
float[] dataArrayUp1 = { 1.0F, 2.0F, 3.0F };
float[] dataArrayUp2 = { 11.0F, 12.0F, 13.0F };
float[] dataArrayUp3 = { 21.0F, 22.0F, 23.0F };
float[][] dataUpMatrix = { dataArrayUp1, dataArrayUp2, dataArrayUp3 };
String[] serialNumbers = { "A", "B", "C" };
floatSeqBlobData[] dataUp = new floatSeqBlobData[dataUpMatrix.length];
int index = 0;
for (float[] value : dataUpMatrix) {
dataUp[index] = new floatSeqBlobData(BASE_TIME + index, value);
index++;
}
floatSeqBlobDataSeqHelper.insert(anyUp, dataUp);
MonitorBlob blobUp = new MonitorBlob(false, (short) 0, serialNumbers, "wrong:" + propertyName, anyUp);
MonitorBlob[] blobs = new MonitorBlob[1];
blobs[0] = blobUp;
long startTime = BASE_TIME + 100;
long stopTime = BASE_TIME + 101;
MonitorDataBlock block = new MonitorDataBlock(startTime, stopTime, componentName, serialNumber, blobs);
MonitorDataBlock[] blocks = new MonitorDataBlock[1];
blocks[0] = block;
getTestWorker().getCollector().setMonitorData(blocks);
ComponentData data = getTestWorker().fetchData();
String clob = BASE_TIME + "|1.0|" + (BASE_TIME + 1) + "|11.0|" + (BASE_TIME + 2) + "|21.0\n";
checkData(data, clob, 3, componentName, propertyName, "A", startTime, stopTime);
checkStatistics(data, 1.0, 21.0, 11.0, 10.0);
data = getTestWorker().fetchData();
clob = BASE_TIME + "|2.0|" + (BASE_TIME + 1) + "|12.0|" + (BASE_TIME + 2) + "|22.0\n";
propertyName = "" + propertyName;
checkData(data, clob, 3, componentName, propertyName, "B", startTime, stopTime);
checkStatistics(data, 2.0, 22.0, 12.0, 10.0);
data = getTestWorker().fetchData();
clob = BASE_TIME + "|3.0|" + (BASE_TIME + 1) + "|13.0|" + (BASE_TIME + 2) + "|23.0\n";
propertyName = "" + propertyName;
checkData(data, clob, 3, componentName, propertyName, "C", startTime, stopTime);
checkStatistics(data, 3.0, 23.0, 13.0, 10.0);
}
Aggregations