Search in sources :

Example 1 with ACSJMSMessageEntity

use of com.cosylab.acs.jms.ACSJMSMessageEntity in project ACS by ACS-Community.

the class MessageTest method testEntity.

public void testEntity() throws Exception {
    ContainerServices cs = getContainerServices();
    assertNotNull("ContainerServices is null!", cs);
    ACSJMSMessageEntity entity = new ACSJMSMessageEntity();
    String entityTxt = "Text for the entity";
    Integer priority = 100;
    entity.priority = priority;
    entity.text = entityTxt;
    ACSJMSMessage msg = new ACSJMSMessage(entity, cs);
    assertNotNull("Error building ACSJMSMessage", msg);
    ACSJMSMessageEntity entityReturned = msg.getEntity();
    assertNotNull("Enitity is null!", entityReturned);
    assertEquals("Wrong text in the returned entity", entityTxt, entityReturned.text);
    assertEquals("Wrong priority in the returned entity", priority, (Integer) entityReturned.priority);
}
Also used : ACSJMSMessageEntity(com.cosylab.acs.jms.ACSJMSMessageEntity) ACSJMSMessage(com.cosylab.acs.jms.ACSJMSMessage) ContainerServices(alma.acs.container.ContainerServices)

Example 2 with ACSJMSMessageEntity

use of com.cosylab.acs.jms.ACSJMSMessageEntity 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));
}
Also used : ACSJMSMessageEntity(com.cosylab.acs.jms.ACSJMSMessageEntity) ACSJMSMessage(com.cosylab.acs.jms.ACSJMSMessage) ContainerServices(alma.acs.container.ContainerServices)

Aggregations

ContainerServices (alma.acs.container.ContainerServices)2 ACSJMSMessage (com.cosylab.acs.jms.ACSJMSMessage)2 ACSJMSMessageEntity (com.cosylab.acs.jms.ACSJMSMessageEntity)2