当前位置: 首页>>代码示例>>Java>>正文


Java JMSProducer.setProperty方法代码示例

本文整理汇总了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));
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:22,代码来源:JmsPoolJMSProducerTest.java

示例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"));
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:15,代码来源:JmsPoolJMSProducerTest.java

示例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());
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:15,代码来源:JmsPoolJMSProducerTest.java

示例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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolJMSProducerTest.java

示例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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolJMSProducerTest.java

示例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));
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:40,代码来源:JmsPoolJMSProducerTest.java

示例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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolJMSProducerTest.java

示例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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolJMSProducerTest.java

示例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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolJMSProducerTest.java

示例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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolJMSProducerTest.java

示例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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolJMSProducerTest.java

示例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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolJMSProducerTest.java

示例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) {}
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:10,代码来源:JmsPoolJMSProducerTest.java

示例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));
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:7,代码来源:JmsPoolJMSProducerTest.java

示例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));
}
 
开发者ID:messaginghub,项目名称:pooled-jms,代码行数:7,代码来源:JmsPoolJMSProducerTest.java


注:本文中的javax.jms.JMSProducer.setProperty方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。