Search in sources :

Example 1 with DataTagCacheObject

use of cern.c2mon.server.common.datatag.DataTagCacheObject in project c2mon by c2mon.

the class CacheObjectCreation method createTestDataTag3.

/**
 * Need to first insert test equipment using EquipmentMapper
 * @return the DataTag
 */
public static DataTagCacheObject createTestDataTag3() {
    // construct fake DataTagCacheObject, setting all fields
    DataTagCacheObject cacheObject = new DataTagCacheObject();
    // must be non null in DB
    cacheObject.setId(Long.valueOf(100003));
    // non null
    cacheObject.setName("Junit_test_datatag3");
    cacheObject.setDescription("test description");
    // non null
    cacheObject.setMode(DataTagConstants.MODE_TEST);
    // non null
    cacheObject.setDataType("String");
    // cacheObject.setTopic("tim.testdatatag.XADDRESS");
    // null allowed
    cacheObject.setLogged(false);
    cacheObject.setUnit("test unit");
    cacheObject.setDipAddress("testDIPaddress");
    cacheObject.setJapcAddress("testJAPCaddress");
    cacheObject.setValue("DOWN");
    cacheObject.setValueDescription("test value description");
    // null allowed
    cacheObject.setSimulated(false);
    // need test equipment inserted
    cacheObject.setEquipmentId(Long.valueOf(100));
    cacheObject.setMinValue(new Float(23.3));
    cacheObject.setMaxValue(new Float(12.2));
    cacheObject.setAddress(new DataTagAddress());
    cacheObject.setDataTagQuality(createValidQuality());
    cacheObject.setCacheTimestamp(new Timestamp(System.currentTimeMillis()));
    cacheObject.setDaqTimestamp(new Timestamp(System.currentTimeMillis()));
    cacheObject.setSourceTimestamp(new Timestamp(System.currentTimeMillis()));
    cacheObject.getAlarmIds().add(1L);
    cacheObject.getAlarmIds().add(3L);
    return cacheObject;
}
Also used : DataTagAddress(cern.c2mon.shared.common.datatag.DataTagAddress) DataTagCacheObject(cern.c2mon.server.common.datatag.DataTagCacheObject) Timestamp(java.sql.Timestamp)

Example 2 with DataTagCacheObject

use of cern.c2mon.server.common.datatag.DataTagCacheObject in project c2mon by c2mon.

the class CacheObjectCreation method createTestDataTag2.

/**
 * Constructs second DataTag.
 * @return the DataTag.
 */
public static DataTagCacheObject createTestDataTag2() {
    DataTagCacheObject cacheObject = new DataTagCacheObject();
    // must be non null in DB
    cacheObject.setId(Long.valueOf(100001));
    // non null
    cacheObject.setName("Junit_test_datatag2");
    cacheObject.setDescription("test description");
    // non null
    cacheObject.setMode(DataTagConstants.MODE_TEST);
    // non null
    cacheObject.setDataType("Boolean");
    // null allowed
    cacheObject.setLogged(false);
    cacheObject.setUnit("test unit m/sec");
    cacheObject.setDipAddress("testDIPaddress");
    cacheObject.setJapcAddress("testJAPCaddress");
    cacheObject.setValue(Boolean.TRUE);
    cacheObject.setValueDescription("test value description");
    // null allowed
    cacheObject.setSimulated(false);
    // need test equipment inserted - using JAPC currently
    cacheObject.setEquipmentId(Long.valueOf(100));
    cacheObject.setMinValue(new Float(23.3));
    cacheObject.setMaxValue(new Float(12.2));
    cacheObject.setAddress(new DataTagAddress());
    cacheObject.setDataTagQuality(createValidQuality());
    cacheObject.setCacheTimestamp(new Timestamp(System.currentTimeMillis()));
    cacheObject.setDaqTimestamp(new Timestamp(System.currentTimeMillis()));
    cacheObject.setSourceTimestamp(new Timestamp(System.currentTimeMillis()));
    cacheObject.setRuleIdsString("130");
    return cacheObject;
}
Also used : DataTagAddress(cern.c2mon.shared.common.datatag.DataTagAddress) DataTagCacheObject(cern.c2mon.server.common.datatag.DataTagCacheObject) Timestamp(java.sql.Timestamp)

Example 3 with DataTagCacheObject

use of cern.c2mon.server.common.datatag.DataTagCacheObject in project c2mon by c2mon.

the class CacheObjectCreation method createTestDataTag.

/**
 * Need to first insert test equipment using EquipmentMapper
 * @return the DataTag
 */
public static DataTagCacheObject createTestDataTag() {
    // construct fake DataTagCacheObject, setting all fields
    DataTagCacheObject cacheObject = new DataTagCacheObject();
    // must be non null in DB
    cacheObject.setId(Long.valueOf(100000));
    // non null
    cacheObject.setName("Junit_test_datatag1");
    cacheObject.setDescription("test description");
    // non null
    cacheObject.setMode(DataTagConstants.MODE_TEST);
    // non null
    cacheObject.setDataType("Boolean");
    // cacheObject.setTopic("tim.testdatatag.XADDRESS");
    // null allowed
    cacheObject.setLogged(false);
    cacheObject.setUnit("test unit m/sec");
    cacheObject.setDipAddress("testDIPaddress");
    cacheObject.setJapcAddress("testJAPCaddress");
    cacheObject.setValue(Boolean.TRUE);
    cacheObject.setValueDescription("test value description");
    // null allowed
    cacheObject.setSimulated(false);
    // need test equipment inserted
    cacheObject.setEquipmentId(Long.valueOf(100));
    cacheObject.setMinValue(new Float(23.3));
    cacheObject.setMaxValue(new Float(12.2));
    cacheObject.setAddress(new DataTagAddress());
    cacheObject.setDataTagQuality(createValidQuality());
    cacheObject.setCacheTimestamp(new Timestamp(System.currentTimeMillis()));
    cacheObject.setDaqTimestamp(new Timestamp(System.currentTimeMillis()));
    cacheObject.setSourceTimestamp(new Timestamp(System.currentTimeMillis()));
    cacheObject.setRuleIdsString("130");
    return cacheObject;
}
Also used : DataTagAddress(cern.c2mon.shared.common.datatag.DataTagAddress) DataTagCacheObject(cern.c2mon.server.common.datatag.DataTagCacheObject) Timestamp(java.sql.Timestamp)

Example 4 with DataTagCacheObject

use of cern.c2mon.server.common.datatag.DataTagCacheObject in project c2mon by c2mon.

the class EntityUtils method createDataTag.

public static DataTag createDataTag() {
    DataTagCacheObject tag = new DataTagCacheObject(1L, "cpu.loadavg", Long.class.getName(), DataTagConstants.MODE_OPERATIONAL);
    tag.setProcessId(50L);
    tag.setEquipmentId(150L);
    tag.setDescription("Average CPU usage");
    tag.setAddress(new DataTagAddress());
    tag.setMaxValue(0);
    tag.setMinValue(4.0);
    tag.setSourceTimestamp(new Timestamp(System.currentTimeMillis()));
    tag.setDaqTimestamp(new Timestamp(System.currentTimeMillis()));
    tag.setCacheTimestamp(new Timestamp(System.currentTimeMillis()));
    tag.setDataTagQuality(new DataTagQualityImpl());
    tag.setLogged(true);
    Metadata metadata = new Metadata();
    metadata.addMetadata("building", "1");
    metadata.addMetadata("array", Collections.singletonList("test"));
    metadata.addMetadata("responsiblePerson", "Fred");
    tag.setMetadata(metadata);
    return tag;
}
Also used : DataTagAddress(cern.c2mon.shared.common.datatag.DataTagAddress) Metadata(cern.c2mon.server.common.metadata.Metadata) DataTagCacheObject(cern.c2mon.server.common.datatag.DataTagCacheObject) DataTagQualityImpl(cern.c2mon.shared.common.datatag.DataTagQualityImpl) Timestamp(java.sql.Timestamp)

Example 5 with DataTagCacheObject

use of cern.c2mon.server.common.datatag.DataTagCacheObject in project c2mon by c2mon.

the class TagRecordConverterTest method createTestCacheTag.

private DataTagCacheObject createTestCacheTag(Object value, Class<?> dataType) {
    DataTagCacheObject tag = new DataTagCacheObject(10L);
    tag.setName("testName");
    tag.setDataType(dataType.getName());
    tag.setAddress(new DataTagAddress());
    tag.setEquipmentId(11L);
    tag.setProcessId(1L);
    tag.setDescription("Description");
    tag.setValueDescription("valueDescription");
    tag.setMode((short) 1);
    tag.setJapcAddress("japcAdress");
    tag.setDipAddress("dipAdress");
    tag.setDaqTimestamp(new Timestamp(1234567890));
    tag.setSourceTimestamp(new Timestamp(1234567890));
    tag.setCacheTimestamp(new Timestamp(1234567890));
    tag.getDataTagQuality().addInvalidStatus(TagQualityStatus.INACCESSIBLE, "desc1");
    tag.getDataTagQuality().addInvalidStatus(TagQualityStatus.UNINITIALISED, "desc1");
    tag.getDataTagQuality().addInvalidStatus(TagQualityStatus.VALUE_OUT_OF_BOUNDS, "desc1");
    tag.setValue(value);
    return tag;
}
Also used : DataTagAddress(cern.c2mon.shared.common.datatag.DataTagAddress) DataTagCacheObject(cern.c2mon.server.common.datatag.DataTagCacheObject) Timestamp(java.sql.Timestamp)

Aggregations

DataTagCacheObject (cern.c2mon.server.common.datatag.DataTagCacheObject)70 Test (org.junit.Test)34 Timestamp (java.sql.Timestamp)27 ConfigurationReport (cern.c2mon.shared.client.configuration.ConfigurationReport)10 DataTagAddress (cern.c2mon.shared.common.datatag.DataTagAddress)10 DataTagQualityImpl (cern.c2mon.shared.common.datatag.DataTagQualityImpl)10 AlarmCacheObject (cern.c2mon.server.common.alarm.AlarmCacheObject)9 ConfigurationChangeEventReport (cern.c2mon.shared.daq.config.ConfigurationChangeEventReport)9 DataTag (cern.c2mon.server.common.datatag.DataTag)8 Configuration (cern.c2mon.shared.client.configuration.api.Configuration)7 ContextConfiguration (org.springframework.test.context.ContextConfiguration)7 List (java.util.List)6 Metadata (cern.c2mon.server.common.metadata.Metadata)5 Properties (java.util.Properties)5 Before (org.junit.Before)5 ProcessChange (cern.c2mon.server.configuration.impl.ProcessChange)4 DataTagUpdate (cern.c2mon.shared.daq.config.DataTagUpdate)4 OscillationProperties (cern.c2mon.server.cache.alarm.config.OscillationProperties)3 Alarm (cern.c2mon.server.common.alarm.Alarm)3 DataTagQuality (cern.c2mon.shared.common.datatag.DataTagQuality)3