Search in sources :

Example 1 with ComponentData

use of alma.acs.monitoring.DAO.ComponentData in project ACS by ACS-Community.

the class BlobberWorkerUnitTest method testCorrelatorULongLong.

public void testCorrelatorULongLong() 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 ulonglong 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" };
    uLongLongSeqBlobData[] dataUp = new uLongLongSeqBlobData[dataUpMatrix.length];
    int index = 0;
    for (long[] value : dataUpMatrix) {
        dataUp[index] = new uLongLongSeqBlobData(BASE_TIME + index, value);
        index++;
    }
    uLongLongSeqBlobDataSeqHelper.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);
}
Also used : ComponentData(alma.acs.monitoring.DAO.ComponentData) Any(org.omg.CORBA.Any) MonitorBlob(alma.TMCDB.MonitorBlob) TMCDB.uLongLongSeqBlobData(alma.TMCDB.uLongLongSeqBlobData) MonitorDataBlock(alma.TMCDB.MonitorDataBlock)

Example 2 with ComponentData

use of alma.acs.monitoring.DAO.ComponentData in project ACS by ACS-Community.

the class BlobberWorkerUnitTest method testCorrelatorHandling.

public void testCorrelatorHandling() throws Exception {
    blobber.setCollectorIntervalSeconds(100);
    getTestWorker().setCanHandle(true);
    // Collector "TestCase" is just a dummy name to trick the worker to believe that 
    // there is a collector registered and start operating. "TestCase" is not used at all.
    getTestWorker().addCollector("TestCase");
    String componentName = "CONTROL/DV01/PSA";
    String serialNumber = "3456328928847";
    String propertyName = "VOLTAGE_MID_1";
    Any anyUp = create_any();
    double[] doubleDataUp1 = { 1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0 };
    double[] doubleDataUp2 = { 11.0, 12.0, 13.0, 14.0, 15.0, 16.0, 17.0, 18.0, 19.0, 20.0 };
    double[] doubleDataUp3 = { 21.0, 22.0, 23.0, 24.0, 25.0, 26.0, 27.0, 28.0, 29.0, 30.0 };
    double[][] doubleDataUpMatrix = { doubleDataUp1, doubleDataUp2, doubleDataUp3 };
    String[] serialNumbers = { "A", "B", "C", "D", "E", "F", "G", "H", "I", "J" };
    doubleSeqBlobData[] dataUp = createDoubleSeqBlobData(doubleDataUpMatrix);
    doubleSeqBlobDataSeqHelper.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);
    m_logger.fine("About to call getTestWorker().fetchData()");
    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);
    data = getTestWorker().fetchData();
    clob = BASE_TIME + "|4.0|" + (BASE_TIME + 1) + "|14.0|" + (BASE_TIME + 2) + "|24.0\n";
    propertyName = "" + propertyName;
    checkData(data, clob, 3, componentName, propertyName, "D", startTime, stopTime);
    checkStatistics(data, 4.0, 24.0, 14.0, 10.0);
    data = getTestWorker().fetchData();
    clob = BASE_TIME + "|5.0|" + (BASE_TIME + 1) + "|15.0|" + (BASE_TIME + 2) + "|25.0\n";
    propertyName = "" + propertyName;
    checkData(data, clob, 3, componentName, propertyName, "E", startTime, stopTime);
    checkStatistics(data, 5.0, 25.0, 15.0, 10.0);
    data = getTestWorker().fetchData();
    clob = BASE_TIME + "|6.0|" + (BASE_TIME + 1) + "|16.0|" + (BASE_TIME + 2) + "|26.0\n";
    propertyName = "" + propertyName;
    checkData(data, clob, 3, componentName, propertyName, "F", startTime, stopTime);
    checkStatistics(data, 6.0, 26.0, 16.0, 10.0);
    data = getTestWorker().fetchData();
    clob = BASE_TIME + "|7.0|" + (BASE_TIME + 1) + "|17.0|" + (BASE_TIME + 2) + "|27.0\n";
    propertyName = "" + propertyName;
    checkData(data, clob, 3, componentName, propertyName, "G", startTime, stopTime);
    checkStatistics(data, 7.0, 27.0, 17.0, 10.0);
    data = getTestWorker().fetchData();
    clob = BASE_TIME + "|8.0|" + (BASE_TIME + 1) + "|18.0|" + (BASE_TIME + 2) + "|28.0\n";
    propertyName = "" + propertyName;
    checkData(data, clob, 3, componentName, propertyName, "H", startTime, stopTime);
    checkStatistics(data, 8.0, 28.0, 18.0, 10.0);
    data = getTestWorker().fetchData();
    clob = BASE_TIME + "|9.0|" + (BASE_TIME + 1) + "|19.0|" + (BASE_TIME + 2) + "|29.0\n";
    propertyName = "" + propertyName;
    checkData(data, clob, 3, componentName, propertyName, "I", startTime, stopTime);
    checkStatistics(data, 9.0, 29.0, 19.0, 10.0);
    data = getTestWorker().fetchData();
    clob = BASE_TIME + "|10.0|" + (BASE_TIME + 1) + "|20.0|" + (BASE_TIME + 2) + "|30.0\n";
    propertyName = "" + propertyName;
    checkData(data, clob, 3, componentName, propertyName, "J", startTime, stopTime);
    checkStatistics(data, 10.0, 30.0, 20.0, 10.0);
}
Also used : ComponentData(alma.acs.monitoring.DAO.ComponentData) Any(org.omg.CORBA.Any) TMCDB.doubleSeqBlobData(alma.TMCDB.doubleSeqBlobData) MonitorBlob(alma.TMCDB.MonitorBlob) MonitorDataBlock(alma.TMCDB.MonitorDataBlock)

Example 3 with ComponentData

use of alma.acs.monitoring.DAO.ComponentData in project ACS by ACS-Community.

the class BlobberWorkerUnitTest method testTimestamps.

public void testTimestamps() 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";
    long startTime1 = BASE_TIME + 2000000;
    long stopTime1 = BASE_TIME + 2010000;
    Any anyUp = create_any();
    int[] dataArrayUp1 = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    enumBlobData[] dataUp = new enumBlobData[dataArrayUp1.length];
    int index = 0;
    for (int value : dataArrayUp1) {
        dataUp[index] = new enumBlobData(startTime1 + index, value);
        index++;
    }
    enumBlobDataSeqHelper.insert(anyUp, dataUp);
    MonitorBlob blobUp = new MonitorBlob(false, (short) 0, null, "wrong:" + propertyName, anyUp);
    MonitorBlob[] blobs = new MonitorBlob[1];
    blobs[0] = blobUp;
    MonitorDataBlock block = new MonitorDataBlock(startTime1, stopTime1, componentName, serialNumber, blobs);
    MonitorDataBlock[] blocks = new MonitorDataBlock[1];
    blocks[0] = block;
    blobber.setCollectorIntervalSeconds(2);
    getTestWorker().getCollector().setMonitorData(blocks);
    long startTime2 = BASE_TIME + 4000000;
    long stopTime2 = BASE_TIME + 4010000;
    anyUp = create_any();
    int[] dataArrayUp2 = { 11, 12, 13, 14, 15, 16, 17, 18, 19, 20 };
    dataUp = new enumBlobData[dataArrayUp2.length];
    index = 0;
    for (int value : dataArrayUp2) {
        dataUp[index] = new enumBlobData(startTime2 + index, value);
        index++;
    }
    enumBlobDataSeqHelper.insert(anyUp, dataUp);
    blobUp = new MonitorBlob(false, (short) 0, null, "wrong:" + propertyName, anyUp);
    blobs = new MonitorBlob[1];
    blobs[0] = blobUp;
    block = new MonitorDataBlock(startTime2, stopTime2, componentName, serialNumber, blobs);
    blocks = new MonitorDataBlock[1];
    blocks[0] = block;
    getTestWorker().getCollector().setMonitorData(blocks);
    ComponentData data = getTestWorker().fetchData();
    String clob = startTime1 + "|1|" + (startTime1 + 1) + "|2|" + (startTime1 + 2) + "|3|" + (startTime1 + 3) + "|4|" + (startTime1 + 4) + "|5|" + (startTime1 + 5) + "|6|" + (startTime1 + 6) + "|7|" + (startTime1 + 7) + "|8|" + (startTime1 + 8) + "|9|" + (startTime1 + 9) + "|10\n";
    checkData(data, clob, 10, componentName, propertyName, serialNumber, startTime1, stopTime1);
    checkStatistics(data);
    data = getTestWorker().fetchData();
    clob = startTime2 + "|11|" + (startTime2 + 1) + "|12|" + (startTime2 + 2) + "|13|" + (startTime2 + 3) + "|14|" + (startTime2 + 4) + "|15|" + (startTime2 + 5) + "|16|" + (startTime2 + 6) + "|17|" + (startTime2 + 7) + "|18|" + (startTime2 + 8) + "|19|" + (startTime2 + 9) + "|20\n";
    checkData(data, clob, 10, componentName, propertyName, serialNumber, startTime2, stopTime2);
    checkStatistics(data);
    long startTime3 = BASE_TIME + 6000000;
    long stopTime3 = BASE_TIME + 6010000;
    anyUp = create_any();
    int[] dataArrayUp3 = { 21, 22, 23, 24, 25, 26, 27, 28, 29, 20 };
    dataUp = new enumBlobData[dataArrayUp3.length];
    index = 0;
    for (int value : dataArrayUp3) {
        dataUp[index] = new enumBlobData(startTime3 + index, value);
        index++;
    }
    enumBlobDataSeqHelper.insert(anyUp, dataUp);
    blobUp = new MonitorBlob(false, (short) 0, null, "wrong:" + propertyName, anyUp);
    blobs = new MonitorBlob[1];
    blobs[0] = blobUp;
    block = new MonitorDataBlock(startTime3, stopTime3, componentName, serialNumber, blobs);
    blocks = new MonitorDataBlock[1];
    blocks[0] = block;
    //blobber.setCollectorIntervalSeconds(0);
    getTestWorker().getCollector().setMonitorData(blocks);
    data = getTestWorker().fetchData();
    clob = startTime3 + "|21|" + (startTime3 + 1) + "|22|" + (startTime3 + 2) + "|23|" + (startTime3 + 3) + "|24|" + (startTime3 + 4) + "|25|" + (startTime3 + 5) + "|26|" + (startTime3 + 6) + "|27|" + (startTime3 + 7) + "|28|" + (startTime3 + 8) + "|29|" + (startTime3 + 9) + "|20\n";
    checkData(data, clob, 10, componentName, propertyName, serialNumber, startTime3, stopTime3);
    checkStatistics(data);
}
Also used : MonitorBlob(alma.TMCDB.MonitorBlob) TMCDB.enumBlobData(alma.TMCDB.enumBlobData) ComponentData(alma.acs.monitoring.DAO.ComponentData) Any(org.omg.CORBA.Any) MonitorDataBlock(alma.TMCDB.MonitorDataBlock)

Example 4 with ComponentData

use of alma.acs.monitoring.DAO.ComponentData in project ACS by ACS-Community.

the class BlobberWorkerUnitTest method testCorrelatorString.

public void testCorrelatorString() 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 ulonglong means Java long.
    Any anyUp = create_any();
    String[] dataArrayUp1 = { "R", "S", "T" };
    String[] dataArrayUp2 = { "U", "V", "W" };
    String[] dataArrayUp3 = { "X", "Y", "Z" };
    String[][] dataUpMatrix = { dataArrayUp1, dataArrayUp2, dataArrayUp3 };
    String[] serialNumbers = { "A", "B", "C" };
    stringSeqBlobData[] dataUp = new stringSeqBlobData[dataUpMatrix.length];
    int index = 0;
    for (String[] value : dataUpMatrix) {
        dataUp[index] = new stringSeqBlobData(BASE_TIME + index, value);
        index++;
    }
    stringSeqBlobDataSeqHelper.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 + "|R|" + (BASE_TIME + 1) + "|U|" + (BASE_TIME + 2) + "|X\n";
    checkData(data, clob, 3, componentName, propertyName, "A", startTime, stopTime);
    checkStatistics(data);
    data = getTestWorker().fetchData();
    clob = BASE_TIME + "|S|" + (BASE_TIME + 1) + "|V|" + (BASE_TIME + 2) + "|Y\n";
    propertyName = "" + propertyName;
    checkData(data, clob, 3, componentName, propertyName, "B", startTime, stopTime);
    checkStatistics(data);
    data = getTestWorker().fetchData();
    clob = BASE_TIME + "|T|" + (BASE_TIME + 1) + "|W|" + (BASE_TIME + 2) + "|Z\n";
    propertyName = "" + propertyName;
    checkData(data, clob, 3, componentName, propertyName, "C", startTime, stopTime);
    checkStatistics(data);
}
Also used : ComponentData(alma.acs.monitoring.DAO.ComponentData) Any(org.omg.CORBA.Any) MonitorBlob(alma.TMCDB.MonitorBlob) TMCDB.stringSeqBlobData(alma.TMCDB.stringSeqBlobData) MonitorDataBlock(alma.TMCDB.MonitorDataBlock)

Example 5 with ComponentData

use of alma.acs.monitoring.DAO.ComponentData in project ACS by ACS-Community.

the class BlobberWorkerUnitTest method testStandardEnum.

public void testStandardEnum() 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();
    int[] dataArrayUp = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 };
    enumBlobData[] dataUp = new enumBlobData[dataArrayUp.length];
    int index = 0;
    for (int value : dataArrayUp) {
        dataUp[index] = new enumBlobData(BASE_TIME + index, value);
        index++;
    }
    enumBlobDataSeqHelper.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);
}
Also used : MonitorBlob(alma.TMCDB.MonitorBlob) TMCDB.enumBlobData(alma.TMCDB.enumBlobData) ComponentData(alma.acs.monitoring.DAO.ComponentData) Any(org.omg.CORBA.Any) MonitorDataBlock(alma.TMCDB.MonitorDataBlock)

Aggregations

MonitorBlob (alma.TMCDB.MonitorBlob)15 MonitorDataBlock (alma.TMCDB.MonitorDataBlock)15 ComponentData (alma.acs.monitoring.DAO.ComponentData)15 Any (org.omg.CORBA.Any)15 TMCDB.enumBlobData (alma.TMCDB.enumBlobData)2 TMCDB.doubleBlobData (alma.TMCDB.doubleBlobData)1 TMCDB.doubleSeqBlobData (alma.TMCDB.doubleSeqBlobData)1 TMCDB.floatBlobData (alma.TMCDB.floatBlobData)1 TMCDB.floatSeqBlobData (alma.TMCDB.floatSeqBlobData)1 TMCDB.longBlobData (alma.TMCDB.longBlobData)1 TMCDB.longLongBlobData (alma.TMCDB.longLongBlobData)1 TMCDB.longLongSeqBlobData (alma.TMCDB.longLongSeqBlobData)1 TMCDB.longSeqBlobData (alma.TMCDB.longSeqBlobData)1 TMCDB.patternBlobData (alma.TMCDB.patternBlobData)1 TMCDB.stringBlobData (alma.TMCDB.stringBlobData)1 TMCDB.stringSeqBlobData (alma.TMCDB.stringSeqBlobData)1 TMCDB.uLongLongBlobData (alma.TMCDB.uLongLongBlobData)1 TMCDB.uLongLongSeqBlobData (alma.TMCDB.uLongLongSeqBlobData)1