Search in sources :

Example 1 with ACSFaultState

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

the class StressTest method send.

/**
	 * publish a FaultState
	 * 
	 * @param mfs The fault state to publish
	 */
private void send(MiniFaultState mfs) 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);
    alarmSource.push(fs);
}
Also used : ACSFaultState(alma.alarmsystem.source.ACSFaultState)

Example 2 with ACSFaultState

use of alma.alarmsystem.source.ACSFaultState 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 3 with ACSFaultState

use of alma.alarmsystem.source.ACSFaultState 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 4 with ACSFaultState

use of alma.alarmsystem.source.ACSFaultState 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 5 with ACSFaultState

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

the class FactoryTest method testFaultStateCreation.

/**
	 * Test the creation of a FaultState
	 * 
	 * @throws Exception
	 */
public void testFaultStateCreation() throws Exception {
    TestUtil.setupAlarmBranch(curDir, "ACS");
    instantiateComponentClient();
    ACSFaultState fs = ACSAlarmSystemInterfaceFactory.createFaultState("Family", "Member", 0);
    assertNotNull("Error creating a FS", fs);
}
Also used : ACSFaultState(alma.alarmsystem.source.ACSFaultState)

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