Search in sources :

Example 1 with ACSAlarmSystemInterface

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

the class AlarmCategoryClientTest 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 2 with ACSAlarmSystemInterface

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

the class SendTest method testSend.

// Send one message to check if the message received 
// from the NC is coherent
public void testSend() throws Exception {
    m_logger.info("testSend() will send a single alarm message.");
    int faultCode = 0;
    String descriptor = ACSFaultState.ACTIVE;
    ACSAlarmSystemInterface alarmSource;
    try {
        alarmSource = ACSAlarmSystemInterfaceFactory.createSource();
        assertNotNull("Error instantiating the source", alarmSource);
        ACSFaultState fs = ACSAlarmSystemInterfaceFactory.createFaultState(faultFamily + "0", faultMember + "0", faultCode);
        assertNotNull("Error instantiating the FS", fs);
        fs.setDescriptor(descriptor);
        fs.setUserTimestamp(new Timestamp(System.currentTimeMillis()));
        Properties props = new Properties();
        props.setProperty(ACSFaultState.ASI_PREFIX_PROPERTY, "prefix");
        props.setProperty(ACSFaultState.ASI_SUFFIX_PROPERTY, "suffix");
        fs.setUserProperties(props);
        m_logger.info("alarm message is prepared and will be sent now. Then test will wait for 10 seconds.");
        alarmSource.push(fs);
        try {
            Thread.sleep(10000);
        } catch (Exception e) {
        }
    } catch (Exception e) {
        m_logger.log(Level.INFO, "Exception caught while pushing the alarm", e);
        throw e;
    } finally {
        assertNull(receiverError);
    }
}
Also used : ACSFaultState(alma.alarmsystem.source.ACSFaultState) ACSAlarmSystemInterface(alma.alarmsystem.source.ACSAlarmSystemInterface) Properties(java.util.Properties) Timestamp(java.sql.Timestamp)

Example 3 with ACSAlarmSystemInterface

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

the class SourceStressTest method send.

/**
	 * Send a fault state to the NC.
	 * It uses the global source or build a new one depending on the
	 * parameter
	 * 
	 * @param mfs The fault state to publish
	 * @param sameSource If true the same source is used to send the alarm
	 *                   if true a new source is built and the fault state is
	 *                           sent using this new source
	 */
private void send(MiniFaultState mfs, boolean sameSource) throws Exception {
    assertNotNull(mfs);
    ACSFaultState fs = ACSAlarmSystemInterfaceFactory.createFaultState(mfs.FF, mfs.FM, mfs.FC);
    assertNotNull("Error instantiating the FS", fs);
    fs.setDescriptor(mfs.description);
    fs.setUserTimestamp(mfs.timestamp);
    if (sameSource) {
        alarmSource.push(fs);
    } else {
        ACSAlarmSystemInterface newSource = ACSAlarmSystemInterfaceFactory.createSource();
        assertNotNull(newSource);
        newSource.push(fs);
    }
}
Also used : ACSFaultState(alma.alarmsystem.source.ACSFaultState) ACSAlarmSystemInterface(alma.alarmsystem.source.ACSAlarmSystemInterface)

Example 4 with ACSAlarmSystemInterface

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

the class FactoryTest method testAlarmSourceCreation.

/**
	 * Test the creation of a source (proxy)
	 * 
	 * @throws Exception
	 */
public void testAlarmSourceCreation() throws Exception {
    TestUtil.setupAlarmBranch(curDir, "ACS");
    instantiateComponentClient();
    ACSAlarmSystemInterface proxy = ACSAlarmSystemInterfaceFactory.createSource("SourceName");
    assertNotNull("Error creating an alarm source", proxy);
}
Also used : ACSAlarmSystemInterface(alma.alarmsystem.source.ACSAlarmSystemInterface)

Example 5 with ACSAlarmSystemInterface

use of alma.alarmsystem.source.ACSAlarmSystemInterface 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)

Aggregations

ACSAlarmSystemInterface (alma.alarmsystem.source.ACSAlarmSystemInterface)12 ACSFaultState (alma.alarmsystem.source.ACSFaultState)10 Timestamp (java.sql.Timestamp)6 Properties (java.util.Properties)2 AlarmSystemInterfaceProxy (cern.laser.source.alarmsysteminterface.impl.AlarmSystemInterfaceProxy)1 Collection (java.util.Collection)1 Vector (java.util.Vector)1