本文整理汇总了Java中javax.jms.JMSProducer.setProperty方法的典型用法代码示例。如果您正苦于以下问题:Java JMSProducer.setProperty方法的具体用法?Java JMSProducer.setProperty怎么用?Java JMSProducer.setProperty使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类javax.jms.JMSProducer
的用法示例。
在下文中一共展示了JMSProducer.setProperty方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testStringPropertyConversions
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@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));
}
示例2: testGetPropertyNames
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@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"));
}
示例3: testClearProperties
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@Test
public void testClearProperties() {
JMSProducer producer = context.createProducer();
producer.setProperty("Property_1", "1");
producer.setProperty("Property_2", "2");
producer.setProperty("Property_3", "3");
assertEquals(3, producer.getPropertyNames().size());
producer.clearProperties();
assertEquals(0, producer.getPropertyNames().size());
}
示例4: testSetLongPropetryWithBadPropetyName
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@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) {}
}
示例5: testSetObjectPropetryWithInvalidObject
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@Test
public void testSetObjectPropetryWithInvalidObject() {
JMSProducer producer = context.createProducer();
try {
producer.setProperty(GOOD_PROPERTY_NAME, UUID.randomUUID());
fail("Should not accept invalid property name");
} catch (MessageFormatRuntimeException mfre) {}
}
示例6: testSetPropertyConversions
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@Test
public void testSetPropertyConversions() {
JMSProducer producer = context.createProducer();
producer.setProperty(STRING_PROPERTY_NAME, STRING_PROPERTY_VALUE);
producer.setProperty(BYTE_PROPERTY_NAME, Byte.valueOf(BYTE_PROPERTY_VALUE));
producer.setProperty(BOOLEAN_PROPERTY_NAME, Boolean.valueOf(BOOLEAN_PROPERTY_VALUE));
producer.setProperty(SHORT_PROPERTY_NAME, Short.valueOf(SHORT_PROPERTY_VALUE));
producer.setProperty(INTEGER_PROPERTY_NAME, Integer.valueOf(INTEGER_PROPERTY_VALUE));
producer.setProperty(LONG_PROPERTY_NAME, Long.valueOf(LONG_PROPERTY_VALUE));
producer.setProperty(FLOAT_PROPERTY_NAME, Float.valueOf(FLOAT_PROPERTY_VALUE));
producer.setProperty(DOUBLE_PROPERTY_NAME, Double.valueOf(DOUBLE_PROPERTY_VALUE));
try {
producer.setProperty(STRING_PROPERTY_NAME, UUID.randomUUID());
fail("Should not be able to set non-primitive type");
} catch (MessageFormatRuntimeException mfe) {
}
assertNull(producer.getObjectProperty("Unknown"));
assertEquals(STRING_PROPERTY_VALUE, producer.getStringProperty(STRING_PROPERTY_NAME));
assertEquals(BYTE_PROPERTY_VALUE, producer.getByteProperty(BYTE_PROPERTY_NAME));
assertEquals(BOOLEAN_PROPERTY_VALUE, producer.getBooleanProperty(BOOLEAN_PROPERTY_NAME));
assertEquals(SHORT_PROPERTY_VALUE, producer.getShortProperty(SHORT_PROPERTY_NAME));
assertEquals(INTEGER_PROPERTY_VALUE, producer.getIntProperty(INTEGER_PROPERTY_NAME));
assertEquals(LONG_PROPERTY_VALUE, producer.getLongProperty(LONG_PROPERTY_NAME));
assertEquals(FLOAT_PROPERTY_VALUE, producer.getFloatProperty(FLOAT_PROPERTY_NAME), 0.0);
assertEquals(DOUBLE_PROPERTY_VALUE, producer.getDoubleProperty(DOUBLE_PROPERTY_NAME), 0.0);
assertEquals(STRING_PROPERTY_VALUE, producer.getObjectProperty(STRING_PROPERTY_NAME));
assertEquals(BYTE_PROPERTY_VALUE, producer.getObjectProperty(BYTE_PROPERTY_NAME));
assertEquals(BOOLEAN_PROPERTY_VALUE, producer.getObjectProperty(BOOLEAN_PROPERTY_NAME));
assertEquals(SHORT_PROPERTY_VALUE, producer.getObjectProperty(SHORT_PROPERTY_NAME));
assertEquals(INTEGER_PROPERTY_VALUE, producer.getObjectProperty(INTEGER_PROPERTY_NAME));
assertEquals(LONG_PROPERTY_VALUE, producer.getObjectProperty(LONG_PROPERTY_NAME));
assertEquals(FLOAT_PROPERTY_VALUE, producer.getObjectProperty(FLOAT_PROPERTY_NAME));
assertEquals(DOUBLE_PROPERTY_VALUE, producer.getObjectProperty(DOUBLE_PROPERTY_NAME));
}
示例7: testSetStringPropetryWithBadPropetyName
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@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) {}
}
示例8: testSetBytePropetryWithBadPropetyName
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@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) {}
}
示例9: testSetBooleanPropetryWithBadPropetyName
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@Test
public void testSetBooleanPropetryWithBadPropetyName() {
JMSProducer producer = context.createProducer();
try {
producer.setProperty(BAD_PROPERTY_NAME, true);
fail("Should not accept invalid property name");
} catch (IllegalArgumentException iae) {}
}
示例10: testSetObjectPropetryWithBadPropetyName
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@Test
public void testSetObjectPropetryWithBadPropetyName() {
JMSProducer producer = context.createProducer();
try {
producer.setProperty(BAD_PROPERTY_NAME, UUID.randomUUID());
fail("Should not accept invalid property name");
} catch (IllegalArgumentException iae) {}
}
示例11: testSetFloatPropetryWithBadPropetyName
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@Test
public void testSetFloatPropetryWithBadPropetyName() {
JMSProducer producer = context.createProducer();
try {
producer.setProperty(BAD_PROPERTY_NAME, 100.0f);
fail("Should not accept invalid property name");
} catch (IllegalArgumentException iae) {}
}
示例12: testSetShortPropetryWithBadPropetyName
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@Test
public void testSetShortPropetryWithBadPropetyName() {
JMSProducer producer = context.createProducer();
try {
producer.setProperty(BAD_PROPERTY_NAME, (short) 100);
fail("Should not accept invalid property name");
} catch (IllegalArgumentException iae) {}
}
示例13: testSetIntPropetryWithBadPropetyName
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@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) {}
}
示例14: testGetStringPropetry
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@Test
public void testGetStringPropetry() {
JMSProducer producer = context.createProducer();
producer.setProperty(STRING_PROPERTY_NAME, STRING_PROPERTY_VALUE);
assertEquals(STRING_PROPERTY_VALUE, producer.getStringProperty(STRING_PROPERTY_NAME));
}
示例15: testGetBytePropetry
import javax.jms.JMSProducer; //导入方法依赖的package包/类
@Test
public void testGetBytePropetry() {
JMSProducer producer = context.createProducer();
producer.setProperty(BYTE_PROPERTY_NAME, BYTE_PROPERTY_VALUE);
assertEquals(BYTE_PROPERTY_VALUE, producer.getByteProperty(BYTE_PROPERTY_NAME));
}