use of cern.c2mon.shared.common.datatag.DataTagAddress in project c2mon by c2mon.
the class CacheObjectCreation method createTestControlTag.
/**
* Constructs a test ControlTag.
* @return the ControlTag
*/
public static ControlTagCacheObject createTestControlTag() {
ControlTagCacheObject cacheObject = new ControlTagCacheObject(Long.valueOf(1001), "Junit_test_tag", "Float", DataTagConstants.MODE_TEST);
// must be non null in DB
cacheObject.setId(Long.valueOf(1001));
// non null
cacheObject.setName("Junit_test_tag");
cacheObject.setDescription("test description");
// non null
cacheObject.setMode(DataTagConstants.MODE_TEST);
// non null
cacheObject.setDataType("Float");
// null allowed
cacheObject.setLogged(false);
cacheObject.setUnit("test unit m/sec");
cacheObject.setDipAddress("testDIPaddress");
cacheObject.setJapcAddress("testJAPCaddress");
cacheObject.setValue(new Float(1000));
cacheObject.setValueDescription("test value description");
// null allowed
cacheObject.setSimulated(false);
// need test equipment inserted
cacheObject.setEquipmentId(Long.valueOf(150));
cacheObject.setMinValue(new Float(100));
cacheObject.setMaxValue(new Float(2000));
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()));
// same as setting to null
cacheObject.setRuleIdsString("");
return cacheObject;
}
use of cern.c2mon.shared.common.datatag.DataTagAddress 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.shared.common.datatag.DataTagAddress in project c2mon by c2mon.
the class CacheObjectCreation method createTestSubEquipmentAlive.
/**
* Creates a test AliveTimer for a SubEquipment.
* @return the ControlTag
*/
public static ControlTagCacheObject createTestSubEquipmentAlive() {
ControlTagCacheObject cacheObject = new ControlTagCacheObject(Long.valueOf(5000300), "Test subequipment alive tag", "Long", DataTagConstants.MODE_TEST);
// cacheObject.setId(Long.valueOf(5000300)); //must be non null in DB
// cacheObject.setName("Test subequipment alive tag"); //non null
cacheObject.setDescription("test alive description");
// cacheObject.setMode(DataTagConstants.MODE_TEST); //non null
// cacheObject.setDataType("Long"); // non null
// cacheObject.setTopic("tim.testdatatag.XADDRESS");
// null allowed
cacheObject.setLogged(false);
cacheObject.setUnit("seconds since 1970");
cacheObject.setDipAddress("testDIPaddress");
cacheObject.setJapcAddress("testJAPCaddress");
cacheObject.setValue(Long.valueOf(System.currentTimeMillis()));
cacheObject.setValueDescription("test value description");
// null allowed
cacheObject.setSimulated(false);
// cacheObject.setEquipmentId(Long.valueOf(300000)); //null for alive tags!
cacheObject.setMinValue(Long.MIN_VALUE);
cacheObject.setMaxValue(Long.MAX_VALUE);
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()));
return cacheObject;
}
use of cern.c2mon.shared.common.datatag.DataTagAddress 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.shared.common.datatag.DataTagAddress in project c2mon by c2mon.
the class TagConfigStrategy method toTagConfiguration.
protected DataTag toTagConfiguration(HardwareAddress hwAddress) throws DynConfigException {
DataTagAddress address = new DataTagAddress(hwAddress);
queryObj.applyQueryPropertiesTo(address);
DataTag.CreateBuilder builder = DataTag.create(queryObj.get(TAG_NAME).get(0), queryObj.get(DATA_TYPE, Class.class).get(0), address).description(StringUtils.join(queryObj.get(TAG_DESCRIPTION), ", "));
queryObj.applyQueryPropertiesTo(builder);
return builder.build();
}
Aggregations