Java Code Examples for javax.jms.JMSProducer#setProperty()
The following examples show how to use
javax.jms.JMSProducer#setProperty() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: OutgoingConnectionNoJTATest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testSimpleSendNoXAJMSContext() throws Exception { Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE); try (ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(); ClientConsumer consVerify = session.createConsumer(MDBQUEUE); JMSContext jmsctx = qraConnectionFactory.createContext(); ) { session.start(); // These next 4 lines could be written in a single line however it makes difficult for debugging JMSProducer producer = jmsctx.createProducer(); producer.setProperty("strvalue", "hello"); TextMessage msgsend = jmsctx.createTextMessage("hello"); producer.send(q, msgsend); ClientMessage msg = consVerify.receive(1000); assertNotNull(msg); assertEquals("hello", msg.getStringProperty("strvalue")); } }
Example 2
Source File: OutgoingConnectionJTATest.java From activemq-artemis with Apache License 2.0 | 6 votes |
@Test public void testSimpleSendNoXAJMSContext() throws Exception { Queue q = ActiveMQJMSClient.createQueue(MDBQUEUE); try (ClientSessionFactory sf = locator.createSessionFactory(); ClientSession session = sf.createSession(); ClientConsumer consVerify = session.createConsumer(MDBQUEUE); JMSContext jmsctx = qraConnectionFactory.createContext(); ) { session.start(); // These next 4 lines could be written in a single line however it makes difficult for debugging JMSProducer producer = jmsctx.createProducer(); producer.setProperty("strvalue", "hello"); TextMessage msgsend = jmsctx.createTextMessage("hello"); producer.send(q, msgsend); ClientMessage msg = consVerify.receive(1000); assertNotNull(msg); assertEquals("hello", msg.getStringProperty("strvalue")); } }
Example 3
Source File: JmsProducerTest.java From qpid-jms with Apache License 2.0 | 6 votes |
@Test public void testStringPropertyConversions() { JMSProducer producer = context.createProducer(); producer.setProperty(STRING_PROPERTY_NAME, STRING_PROPERTY_VALUE); producer.setProperty(BYTE_PROPERTY_NAME, BYTE_PROPERTY_VALUE); producer.setProperty(BOOLEAN_PROPERTY_NAME, BOOLEAN_PROPERTY_VALUE); producer.setProperty(SHORT_PROPERTY_NAME, SHORT_PROPERTY_VALUE); producer.setProperty(INTEGER_PROPERTY_NAME, INTEGER_PROPERTY_VALUE); producer.setProperty(LONG_PROPERTY_NAME, LONG_PROPERTY_VALUE); producer.setProperty(FLOAT_PROPERTY_NAME, FLOAT_PROPERTY_VALUE); producer.setProperty(DOUBLE_PROPERTY_NAME, DOUBLE_PROPERTY_VALUE); assertEquals(String.valueOf(STRING_PROPERTY_VALUE), producer.getStringProperty(STRING_PROPERTY_NAME)); assertEquals(String.valueOf(BYTE_PROPERTY_VALUE), producer.getStringProperty(BYTE_PROPERTY_NAME)); assertEquals(String.valueOf(BOOLEAN_PROPERTY_VALUE), producer.getStringProperty(BOOLEAN_PROPERTY_NAME)); assertEquals(String.valueOf(SHORT_PROPERTY_VALUE), producer.getStringProperty(SHORT_PROPERTY_NAME)); assertEquals(String.valueOf(INTEGER_PROPERTY_VALUE), producer.getStringProperty(INTEGER_PROPERTY_NAME)); assertEquals(String.valueOf(LONG_PROPERTY_VALUE), producer.getStringProperty(LONG_PROPERTY_NAME)); assertEquals(String.valueOf(FLOAT_PROPERTY_VALUE), producer.getStringProperty(FLOAT_PROPERTY_NAME)); assertEquals(String.valueOf(DOUBLE_PROPERTY_VALUE), producer.getStringProperty(DOUBLE_PROPERTY_NAME)); }
Example 4
Source File: JmsProducerTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test public void testSetIntPropetryWithBadPropetyName() { JMSProducer producer = context.createProducer(); try { producer.setProperty(BAD_PROPERTY_NAME, 100); fail("Should not accept invalid property name"); } catch (IllegalArgumentException iae) {} }
Example 5
Source File: JmsProducerTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test public void testGetPropertyNames() { JMSProducer producer = context.createProducer(); producer.setProperty("Property_1", "1"); producer.setProperty("Property_2", "2"); producer.setProperty("Property_3", "3"); assertEquals(3, producer.getPropertyNames().size()); assertTrue(producer.getPropertyNames().contains("Property_1")); assertTrue(producer.getPropertyNames().contains("Property_2")); assertTrue(producer.getPropertyNames().contains("Property_3")); }
Example 6
Source File: JmsProducerTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test public void testSetStringPropetryWithBadPropetyName() { JMSProducer producer = context.createProducer(); try { producer.setProperty(BAD_PROPERTY_NAME, "X"); fail("Should not accept invalid property name"); } catch (IllegalArgumentException iae) {} }
Example 7
Source File: JmsProducerTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test public void testSetLongPropetryWithBadPropetyName() { JMSProducer producer = context.createProducer(); try { producer.setProperty(BAD_PROPERTY_NAME, 100l); fail("Should not accept invalid property name"); } catch (IllegalArgumentException iae) {} }
Example 8
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test public void testSetFloatPropertyWithBadPropertyName() { JMSProducer producer = context.createProducer(); try { producer.setProperty(BAD_PROPERTY_NAME, 100.0f); fail("Should not accept invalid property name"); } catch (IllegalArgumentException iae) {} }
Example 9
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test public void testSetDoublePropertyWithBadPropertyName() { JMSProducer producer = context.createProducer(); try { producer.setProperty(BAD_PROPERTY_NAME, 100.0); fail("Should not accept invalid property name"); } catch (IllegalArgumentException iae) {} }
Example 10
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test public void testSetObjectPropertyWithBadPropertyName() { JMSProducer producer = context.createProducer(); try { producer.setProperty(BAD_PROPERTY_NAME, UUID.randomUUID()); fail("Should not accept invalid property name"); } catch (IllegalArgumentException iae) {} }
Example 11
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test public void testGetPropertyNames() { JMSProducer producer = context.createProducer(); producer.setProperty("Property_1", "1"); producer.setProperty("Property_2", "2"); producer.setProperty("Property_3", "3"); assertEquals(3, producer.getPropertyNames().size()); assertTrue(producer.getPropertyNames().contains("Property_1")); assertTrue(producer.getPropertyNames().contains("Property_2")); assertTrue(producer.getPropertyNames().contains("Property_3")); }
Example 12
Source File: JmsProducerTest.java From qpid-jms with Apache License 2.0 | 5 votes |
@Test public void testSetBytePropetryWithBadPropetyName() { JMSProducer producer = context.createProducer(); try { producer.setProperty(BAD_PROPERTY_NAME, (byte) 1); fail("Should not accept invalid property name"); } catch (IllegalArgumentException iae) {} }
Example 13
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 5 votes |
@Test public void testSetStringPropertyWithBadPropertyName() { JMSProducer producer = context.createProducer(); try { producer.setProperty(BAD_PROPERTY_NAME, "X"); fail("Should not accept invalid property name"); } catch (IllegalArgumentException iae) {} }
Example 14
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 4 votes |
@Test public void testGetFloatProperty() { JMSProducer producer = context.createProducer(); producer.setProperty(FLOAT_PROPERTY_NAME, FLOAT_PROPERTY_VALUE); assertEquals(FLOAT_PROPERTY_VALUE, producer.getFloatProperty(FLOAT_PROPERTY_NAME), 0.0f); }
Example 15
Source File: JmsProducerTest.java From qpid-jms with Apache License 2.0 | 4 votes |
@Test public void testGetDoublePropetry() { JMSProducer producer = context.createProducer(); producer.setProperty(DOUBLE_PROPERTY_NAME, DOUBLE_PROPERTY_VALUE); assertEquals(DOUBLE_PROPERTY_VALUE, producer.getDoubleProperty(DOUBLE_PROPERTY_NAME), 0.0); }
Example 16
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 4 votes |
@Test public void testGetLongProperty() { JMSProducer producer = context.createProducer(); producer.setProperty(LONG_PROPERTY_NAME, LONG_PROPERTY_VALUE); assertEquals(LONG_PROPERTY_VALUE, producer.getLongProperty(LONG_PROPERTY_NAME)); }
Example 17
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 4 votes |
@Test public void testGetIntegerProperty() { JMSProducer producer = context.createProducer(); producer.setProperty(INTEGER_PROPERTY_NAME, INTEGER_PROPERTY_VALUE); assertEquals(INTEGER_PROPERTY_VALUE, producer.getIntProperty(INTEGER_PROPERTY_NAME)); }
Example 18
Source File: JmsProducerTest.java From qpid-jms with Apache License 2.0 | 4 votes |
@Test public void testGetFloatPropetry() { JMSProducer producer = context.createProducer(); producer.setProperty(FLOAT_PROPERTY_NAME, FLOAT_PROPERTY_VALUE); assertEquals(FLOAT_PROPERTY_VALUE, producer.getFloatProperty(FLOAT_PROPERTY_NAME), 0.0f); }
Example 19
Source File: JmsPoolJMSProducerTest.java From pooled-jms with Apache License 2.0 | 4 votes |
@Test public void testGetBooleanProperty() { JMSProducer producer = context.createProducer(); producer.setProperty(BOOLEAN_PROPERTY_NAME, BOOLEAN_PROPERTY_VALUE); assertEquals(BOOLEAN_PROPERTY_VALUE, producer.getBooleanProperty(BOOLEAN_PROPERTY_NAME)); }
Example 20
Source File: JmsProducerTest.java From qpid-jms with Apache License 2.0 | 4 votes |
@Test public void testGetBooleanPropetry() { JMSProducer producer = context.createProducer(); producer.setProperty(BOOLEAN_PROPERTY_NAME, BOOLEAN_PROPERTY_VALUE); assertEquals(BOOLEAN_PROPERTY_VALUE, producer.getBooleanProperty(BOOLEAN_PROPERTY_NAME)); }