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;
}
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;
}
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;
}
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;
}
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;
}
Aggregations