use of alma.acs.container.ContainerServices in project ACS by ACS-Community.
the class MessageTest method testACSJMSMessage.
/**
* Test some of the implemented methods of ACSJMSMessage
*
* @throws Exception
*/
public void testACSJMSMessage() throws Exception {
ContainerServices cs = getContainerServices();
assertNotNull("ContainerServices is null!", cs);
ACSJMSMessage msg = new ACSJMSMessage(cs);
assertNotNull("Error building ACSJMSMessage", msg);
ACSJMSMessageEntity entity = msg.getEntity();
assertNotNull("Enitity is null!", entity);
// Insert some props
Boolean boolPropVal = new Boolean(false);
Integer intPropVal = new Integer(1234);
String strPropVal = new String("String prperty value");
String boolPropName = "boolPropName";
String intPropName = "intPropName";
String strPropName = "strPropName";
msg.setObjectProperty(intPropName, intPropVal);
msg.setObjectProperty(strPropName, strPropVal);
msg.setObjectProperty(boolPropName, boolPropVal);
// Check if the properties are in the message
assertTrue("Boolean property not found!", msg.propertyExists(boolPropName));
assertTrue("Integer property not found!", msg.propertyExists(intPropName));
assertTrue("String property not found!", msg.propertyExists(strPropName));
// Check if a wrong property is in the message
assertFalse("This property should not be found!", msg.propertyExists("NotExistingProp"));
// Check the values of the properties
assertEquals("Wrong value of Integer property", intPropVal, (Integer) msg.getIntProperty(intPropName));
assertEquals("Wrong value of String property", strPropVal, msg.getStringProperty(strPropName));
assertEquals("Wrong value of Boolean property", boolPropVal, (Boolean) msg.getBooleanProperty(boolPropName));
// Clean the property and try to find a property
msg.clearProperties();
assertFalse("This Integer property should not be here", msg.propertyExists(intPropName));
assertFalse("This String property should not be here", msg.propertyExists(strPropName));
assertFalse("This Boolean property should not be here", msg.propertyExists(boolPropName));
}
use of alma.acs.container.ContainerServices in project ACS by ACS-Community.
the class SendTest method setUp.
public void setUp() throws Exception {
super.setUp();
nMsgReceived = 0;
try {
final ContainerServices contSvcs = getContainerServices();
assertNotNull("Error getting the ContainerServices", contSvcs);
// Check if the CERN AS is in use
assertFalse("Using ACS implementation instead of CERN", ACSAlarmSystemInterfaceFactory.usingACSAlarmSystem());
m_logger.info("alarm system initialized.");
m_consumer = getContainerServices().createNotificationChannelSubscriber(m_channelName, ACS_NC_DOMAIN_ALARMSYSTEM.value, ACSJMSMessageEntity.class);
m_consumer.addSubscription(this);
m_consumer.startReceivingEvents();
m_logger.info("NC consumer installed on channel " + m_channelName);
} catch (Exception ex) {
super.tearDown();
throw ex;
}
}
Aggregations