Search in sources :

Example 6 with DataTagAddress

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;
}
Also used : DataTagAddress(cern.c2mon.shared.common.datatag.DataTagAddress) ControlTagCacheObject(cern.c2mon.server.common.control.ControlTagCacheObject) Timestamp(java.sql.Timestamp)

Example 7 with DataTagAddress

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;
}
Also used : DataTagAddress(cern.c2mon.shared.common.datatag.DataTagAddress) DataTagCacheObject(cern.c2mon.server.common.datatag.DataTagCacheObject) Timestamp(java.sql.Timestamp)

Example 8 with DataTagAddress

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;
}
Also used : DataTagAddress(cern.c2mon.shared.common.datatag.DataTagAddress) ControlTagCacheObject(cern.c2mon.server.common.control.ControlTagCacheObject) Timestamp(java.sql.Timestamp)

Example 9 with DataTagAddress

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;
}
Also used : DataTagAddress(cern.c2mon.shared.common.datatag.DataTagAddress) DataTagCacheObject(cern.c2mon.server.common.datatag.DataTagCacheObject) Timestamp(java.sql.Timestamp)

Example 10 with DataTagAddress

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();
}
Also used : DataTagAddress(cern.c2mon.shared.common.datatag.DataTagAddress) DataTag(cern.c2mon.shared.client.configuration.api.tag.DataTag)

Aggregations

DataTagAddress (cern.c2mon.shared.common.datatag.DataTagAddress)46 Timestamp (java.sql.Timestamp)13 Test (org.junit.Test)12 Configuration (cern.c2mon.shared.client.configuration.api.Configuration)11 DataTagCacheObject (cern.c2mon.server.common.datatag.DataTagCacheObject)10 DataTag (cern.c2mon.shared.client.configuration.api.tag.DataTag)10 ContextConfiguration (org.springframework.test.context.ContextConfiguration)8 SourceDataTag (cern.c2mon.shared.common.datatag.SourceDataTag)7 Properties (java.util.Properties)7 ConfigurationDataTagUtil.buildCreateAllFieldsDataTag (cern.c2mon.server.configuration.parser.util.ConfigurationDataTagUtil.buildCreateAllFieldsDataTag)5 ConfigurationDataTagUtil.buildCreateBasicDataTag (cern.c2mon.server.configuration.parser.util.ConfigurationDataTagUtil.buildCreateBasicDataTag)5 ControlTagCacheObject (cern.c2mon.server.common.control.ControlTagCacheObject)4 ConfigurationReport (cern.c2mon.shared.client.configuration.ConfigurationReport)4 Metadata (cern.c2mon.shared.client.metadata.Metadata)4 ConfigurationChangeEventReport (cern.c2mon.shared.daq.config.ConfigurationChangeEventReport)4 HashMap (java.util.HashMap)4 Metadata (cern.c2mon.server.common.metadata.Metadata)3 ConfigurationElement (cern.c2mon.shared.client.configuration.ConfigurationElement)3 SubEquipment (cern.c2mon.shared.client.configuration.api.equipment.SubEquipment)3 Tag (cern.c2mon.shared.client.configuration.api.tag.Tag)3