Search in sources :

Example 6 with ACSFaultState

use of alma.alarmsystem.source.ACSFaultState in project ACS by ACS-Community.

the class ProxyTest method testAlarmsCollection.

/**
	 * Test the push of a collection of alarms
	 * 
	 * @throws Exception
	 */
public void testAlarmsCollection() throws Exception {
    String FF1 = "TestFamily - 1";
    String FM1 = "TestMember - 1";
    int FC1 = 0;
    ACSFaultState fs1 = ACSAlarmSystemInterfaceFactory.createFaultState(FF1, FM1, FC1);
    assertNotNull("Error creating a FS", fs1);
    fs1.setDescriptor("Description of Al1");
    String FF2 = "TestFamily - 2";
    String FM2 = "TestMember - 2";
    int FC2 = 1;
    ACSFaultState fs2 = ACSAlarmSystemInterfaceFactory.createFaultState(FF2, FM2, FC2);
    assertNotNull("Error creating a FS", fs2);
    fs2.setDescriptor("Description of Al2");
    String FF3 = "TestFamily - 3";
    String FM3 = "TestMember - 3";
    int FC3 = 2;
    ACSFaultState fs3 = ACSAlarmSystemInterfaceFactory.createFaultState(FF3, FM3, FC3);
    assertNotNull("Error creating a FS", fs3);
    fs3.setDescriptor("Description of Al3");
    Collection alarms = new Vector();
    alarms.add(fs1);
    alarms.add(fs2);
    alarms.add(fs3);
    assertEquals("Wrong collection size", alarms.size(), 3);
    ACSAlarmSystemInterface source = ACSAlarmSystemInterfaceFactory.createSource();
    assertNotNull("Error creating the Alarm source", source);
    source.pushActiveList(alarms);
}
Also used : ACSFaultState(alma.alarmsystem.source.ACSFaultState) ACSAlarmSystemInterface(alma.alarmsystem.source.ACSAlarmSystemInterface) Collection(java.util.Collection) Vector(java.util.Vector)

Example 7 with ACSFaultState

use of alma.alarmsystem.source.ACSFaultState in project ACS by ACS-Community.

the class ProxyTest method testPushAlarm.

/**
	 * Test the push of an alarm
	 * 
	 * @throws Exception
	 */
public void testPushAlarm() throws Exception {
    String FF = "TestFamily";
    String FM = "TestMember";
    int FC = 1;
    String descriptor = "Alarm for test";
    ACSFaultState fs = ACSAlarmSystemInterfaceFactory.createFaultState(FF, FM, FC);
    assertNotNull("Error creating the FaultState", fs);
    fs.setDescriptor(descriptor);
    ACSAlarmSystemInterface source = ACSAlarmSystemInterfaceFactory.createSource();
    assertNotNull("Error creating the Alarm Source", source);
    source.push(fs);
}
Also used : ACSFaultState(alma.alarmsystem.source.ACSFaultState) ACSAlarmSystemInterface(alma.alarmsystem.source.ACSAlarmSystemInterface)

Example 8 with ACSFaultState

use of alma.alarmsystem.source.ACSFaultState in project ACS by ACS-Community.

the class TestCategoryActiveChildren method send_alarm.

/**
	 * Push an alarm
	 * 
	 * @param active If true the alarm is active
	 */
private void send_alarm(String family, String member, int code, boolean active) throws Exception {
    ACSAlarmSystemInterface alarmSource;
    alarmSource = ACSAlarmSystemInterfaceFactory.createSource(member);
    ACSFaultState fs = ACSAlarmSystemInterfaceFactory.createFaultState(family, member, code);
    if (active) {
        fs.setDescriptor(FaultState.ACTIVE);
    } else {
        fs.setDescriptor(FaultState.TERMINATE);
    }
    fs.setUserTimestamp(new Timestamp(System.currentTimeMillis()));
    alarmSource.push(fs);
}
Also used : ACSFaultState(alma.alarmsystem.source.ACSFaultState) ACSAlarmSystemInterface(alma.alarmsystem.source.ACSAlarmSystemInterface) Timestamp(java.sql.Timestamp)

Example 9 with ACSFaultState

use of alma.alarmsystem.source.ACSFaultState in project ACS by ACS-Community.

the class UserPropsTest method send_alarm.

/**
	 * Push an alarm
	 * 
	 * @param active If true the alarm is active
	 */
private void send_alarm(String family, String member, int code, boolean active, Properties props) throws Exception {
    ACSAlarmSystemInterface alarmSource;
    alarmSource = ACSAlarmSystemInterfaceFactory.createSource(member);
    ACSFaultState fs = ACSAlarmSystemInterfaceFactory.createFaultState(family, member, code);
    if (active) {
        fs.setDescriptor(FaultState.ACTIVE);
    } else {
        fs.setDescriptor(FaultState.TERMINATE);
    }
    fs.setUserTimestamp(new Timestamp(System.currentTimeMillis()));
    if (props != null && props.size() > 0) {
        fs.setUserProperties((Properties) props.clone());
    }
    alarmSource.push(fs);
}
Also used : ACSFaultState(alma.alarmsystem.source.ACSFaultState) ACSAlarmSystemInterface(alma.alarmsystem.source.ACSAlarmSystemInterface) Timestamp(java.sql.Timestamp)

Example 10 with ACSFaultState

use of alma.alarmsystem.source.ACSFaultState in project ACS by ACS-Community.

the class AlarmSender method send_alarm.

/**
	 * Push an alarm
	 * 
	 * @param active If true the alarm is active
	 */
private void send_alarm(String family, String member, int code, boolean active) throws Exception {
    ACSFaultState fs = ACSAlarmSystemInterfaceFactory.createFaultState(family, member, code);
    if (active) {
        fs.setDescriptor(FaultState.ACTIVE);
    } else {
        fs.setDescriptor(FaultState.TERMINATE);
    }
    fs.setUserTimestamp(new Timestamp(System.currentTimeMillis()));
    alarmSource.push(fs);
}
Also used : ACSFaultState(alma.alarmsystem.source.ACSFaultState) Timestamp(java.sql.Timestamp)

Aggregations

ACSFaultState (alma.alarmsystem.source.ACSFaultState)19 Timestamp (java.sql.Timestamp)11 ACSAlarmSystemInterface (alma.alarmsystem.source.ACSAlarmSystemInterface)10 Properties (java.util.Properties)2 FaultStateImpl (cern.laser.source.alarmsysteminterface.impl.FaultStateImpl)1 Collection (java.util.Collection)1 Vector (java.util.Vector)1