• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java DescribedType类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.apache.qpid.proton.amqp.DescribedType的典型用法代码示例。如果您正苦于以下问题:Java DescribedType类的具体用法?Java DescribedType怎么用?Java DescribedType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



DescribedType类属于org.apache.qpid.proton.amqp包,在下文中一共展示了DescribedType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: equals

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Override
public boolean equals(Object o)
{
    if (this == o)
    {
        return true;
    }
    if (o == null || ! (o instanceof DescribedType))
    {
        return false;
    }

    DescribedType that = (DescribedType) o;

    if (_described != null ? !_described.equals(that.getDescribed()) : that.getDescribed() != null)
    {
        return false;
    }
    if (_descriptor != null ? !_descriptor.equals(that.getDescriptor()) : that.getDescriptor() != null)
    {
        return false;
    }

    return true;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:26,代码来源:DescribedTypeImpl.java


示例2: doTestDecodeUnknownDescribedTypeSeries

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
private void doTestDecodeUnknownDescribedTypeSeries(int size) throws IOException {
    for (int i = 0; i < size; ++i) {
        encoder.writeObject(NoLocalType.NO_LOCAL);
    }

    buffer.clear();

    for (int i = 0; i < size; ++i) {
        final Object result = decoder.readObject();

        assertNotNull(result);
        assertTrue(result instanceof DescribedType);

        DescribedType resultTye = (DescribedType) result;
        assertEquals(NoLocalType.NO_LOCAL.getDescriptor(), resultTye.getDescriptor());
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:18,代码来源:UnknownDescribedTypeCodecTest.java


示例3: findFilter

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
/**
 * Search for a particular filter using a set of known indentification values
 * in the Map of filters.
 *
 * @param filters   The filters map that should be searched.
 * @param filterIds The aliases for the target filter to be located.
 * @return the filter if found in the mapping or null if not found.
 */
public static Map.Entry<Symbol, DescribedType> findFilter(Map<Symbol, Object> filters, Object[] filterIds) {

   if (filterIds == null || filterIds.length == 0) {
      throw new IllegalArgumentException("Invalid empty Filter Ids array passed: ");
   }

   if (filters == null || filters.isEmpty()) {
      return null;
   }

   for (Map.Entry<Symbol, Object> filter : filters.entrySet()) {
      if (filter.getValue() instanceof DescribedType) {
         DescribedType describedType = ((DescribedType) filter.getValue());
         Object descriptor = describedType.getDescriptor();

         for (Object filterId : filterIds) {
            if (descriptor.equals(filterId)) {
               return new AbstractMap.SimpleImmutableEntry<>(filter.getKey(), describedType);
            }
         }
      }
   }

   return null;
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:34,代码来源:AmqpSupport.java


示例4: receiveFrame

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
void receiveFrame(int type, int channel, DescribedType describedType, Binary payload)
{
    Handler handler = getFirstHandler();
    if(handler == null)
    {
        Object actualDescriptor = describedType.getDescriptor();
        Object mappedDescriptor = FrameDescriptorMapping.lookupMapping(actualDescriptor);

        throw new IllegalStateException("No handler! Received frame, descriptor=" + actualDescriptor + "/" + mappedDescriptor);
    }

    if(handler instanceof FrameHandler)
    {
        ((FrameHandler)handler).frame(type, channel, describedType, payload, this);
        removeFirstHandler();
    }
    else
    {
        throw new IllegalStateException("Received frame but the next handler is a " + handler);
    }
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:22,代码来源:TestAmqpPeer.java


示例5: expectLinkFlowRespondWithTransfer

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
public void expectLinkFlowRespondWithTransfer(final HeaderDescribedType headerDescribedType,
                                              final MessageAnnotationsDescribedType messageAnnotationsDescribedType,
                                              final PropertiesDescribedType propertiesDescribedType,
                                              ApplicationPropertiesDescribedType appPropertiesDescribedType,
                                              final DescribedType content,
                                              final int count,
                                              final boolean drain,
                                              final boolean sendDrainFlowResponse,
                                              Matcher<UnsignedInteger> creditMatcher,
                                              final Integer nextIncomingId,
                                              boolean addMessageNumberProperty)
{
    expectLinkFlowRespondWithTransfer(headerDescribedType, messageAnnotationsDescribedType, propertiesDescribedType,
                                      appPropertiesDescribedType, content, count, drain, sendDrainFlowResponse,
                                      creditMatcher, nextIncomingId, false, addMessageNumberProperty);
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:17,代码来源:TestAmqpPeer.java


示例6: verify

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
/**
 * @param receivedBinary
 *      The received Binary value that should be validated.
 *
 * @return the number of bytes consumed from the provided Binary
 *
 * @throws RuntimeException if the provided Binary does not match expectation in some way
 */
public int verify(Binary receivedBinary) throws RuntimeException
{
    int length = receivedBinary.getLength();
    Data data = Data.Factory.create();
    long decoded = data.decode(receivedBinary.asByteBuffer());
    if(decoded > Integer.MAX_VALUE)
    {
        throw new IllegalStateException("Decoded more bytes than Binary supports holding");
    }

    if(decoded < length && !_expectTrailingBytes)
    {
        throw new IllegalArgumentException("Expected to consume all bytes, but trailing bytes remain: Got "
                                    + length + ", consumed "+ decoded);
    }

    DescribedType decodedDescribedType = data.getDescribedType();
    verifyReceivedDescribedType(decodedDescribedType);

    //Need to cast to int, but verified earlier that it is < Integer.MAX_VALUE
    return (int) decoded;
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:31,代码来源:AbstractMessageSectionMatcher.java


示例7: configureSource

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
protected void configureSource(Source source) {
    Map<Symbol, DescribedType> filters = new HashMap<Symbol, DescribedType>();

    if (info.getSubscriptionName() != null && !info.getSubscriptionName().isEmpty()) {
        source.setExpiryPolicy(TerminusExpiryPolicy.NEVER);
        source.setDurable(TerminusDurability.UNSETTLED_STATE);
        source.setDistributionMode(COPY);
    } else {
        source.setDurable(TerminusDurability.NONE);
        source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
    }

    if (info.isNoLocal()) {
        filters.put(JMS_NO_LOCAL_SYMBOL, AmqpJmsNoLocalType.NO_LOCAL);
    }

    if (info.getSelector() != null && !info.getSelector().trim().equals("")) {
        filters.put(JMS_SELECTOR_SYMBOL, new AmqpJmsSelectorType(info.getSelector()));
    }

    if (!filters.isEmpty()) {
        source.setFilter(filters);
    }
}
 
开发者ID:fusesource,项目名称:hawtjms,代码行数:25,代码来源:AmqpConsumer.java


示例8: equals

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Override
public boolean equals(Object obj)
{

    return obj instanceof DescribedType
           && _descriptor == null ? ((DescribedType) obj).getDescriptor() == null
                                 : _descriptor.equals(((DescribedType) obj).getDescriptor())
           && _described == null ?  ((DescribedType) obj).getDescribed() == null
                                 : _described.equals(((DescribedType) obj).getDescribed());

}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:12,代码来源:DecoderImpl.java


示例9: writeDescribedType

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
public void writeDescribedType(final DescribedType d)
{
    if(d == null)
    {
        writeNull();
    }
    else
    {
        _buffer.put(DESCRIBED_TYPE_OP);
        writeObject(d.getDescriptor());
        writeObject(d.getDescribed());
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:14,代码来源:EncoderImpl.java


示例10: writeObject

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
public void writeObject(final Object o)
{
    if (o == null)
    {
        getBuffer().put(EncodingCodes.NULL);
        return;
    }

    AMQPType type = _typeRegistry.get(o.getClass());

    if(type == null)
    {
        if(o.getClass().isArray())
        {
            writeArrayType(o);
        }
        else if(o instanceof List)
        {
            writeList((List)o);
        }
        else if(o instanceof Map)
        {
            writeMap((Map)o);
        }
        else if(o instanceof DescribedType)
        {
            writeDescribedType((DescribedType)o);
        }
        else
        {
            throw new IllegalArgumentException(
                "Do not know how to write Objects of class " + o.getClass().getName());
        }
    }
    else
    {
        type.write(o);
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:40,代码来源:EncoderImpl.java


示例11: getValue

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Override
public DescribedType getValue()
{
    final Object descriptor = _first == null ? null : _first.getValue();
    Element second = _first == null ? null : _first.next();
    final Object described = second == null ? null : second.getValue();
    return new DescribedTypeImpl(descriptor,described);
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:9,代码来源:DescribedTypeElement.java


示例12: getEncoding

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
public TypeEncoding<DescribedType> getEncoding(final DescribedType val)
{
    TypeEncoding underlyingEncoding = _encoder.getType(val.getDescribed()).getEncoding(val.getDescribed());
    TypeEncoding encoding = _encodings.get(underlyingEncoding);
    if(encoding == null)
    {
        encoding = new DynamicDescribedTypeEncoding(underlyingEncoding);
        _encodings.put(underlyingEncoding, encoding);
    }

    return encoding;
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:13,代码来源:DynamicDescribedType.java


示例13: testDecodeUnknownDescribedType

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Test
public void testDecodeUnknownDescribedType() throws Exception {
    encoder.writeObject(NoLocalType.NO_LOCAL);

    buffer.clear();

    Object result = decoder.readObject();
    assertTrue(result instanceof DescribedType);
    DescribedType resultTye = (DescribedType) result;
    assertEquals(NoLocalType.NO_LOCAL.getDescriptor(), resultTye.getDescriptor());
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:12,代码来源:UnknownDescribedTypeCodecTest.java


示例14: testDescribedArray

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Test
public void testDescribedArray() throws IOException
{
    Decoder d = createDecoder(getBytes("described_array"));
    DescribedType a[] = (DescribedType[]) (d.readArray());
    for (int i = 0; i < 10; ++i)
    {
        assertEquals(Symbol.valueOf("int-array"), a[i].getDescriptor());
        assertEquals(i, a[i].getDescribed());
    }
}
 
开发者ID:apache,项目名称:qpid-proton-j,代码行数:12,代码来源:InteropTest.java


示例15: configureSource

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
protected void configureSource(Source source) {
   Map<Symbol, DescribedType> filters = new HashMap<>();
   Symbol[] outcomes = new Symbol[] {Accepted.DESCRIPTOR_SYMBOL, Rejected.DESCRIPTOR_SYMBOL, Released.DESCRIPTOR_SYMBOL, Modified.DESCRIPTOR_SYMBOL};

   if (getSubscriptionName() != null && !getSubscriptionName().isEmpty()) {
      source.setExpiryPolicy(TerminusExpiryPolicy.NEVER);
      source.setDurable(TerminusDurability.UNSETTLED_STATE);
      source.setDistributionMode(COPY);
   } else {
      source.setDurable(TerminusDurability.NONE);
      source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
   }

   source.setOutcomes(outcomes);

   Modified modified = new Modified();
   modified.setDeliveryFailed(true);
   modified.setUndeliverableHere(false);

   source.setDefaultOutcome(modified);

   if (isNoLocal()) {
      filters.put(NO_LOCAL_NAME, AmqpNoLocalFilter.NO_LOCAL);
   }

   if (getSelector() != null && !getSelector().trim().equals("")) {
      filters.put(JMS_SELECTOR_NAME, new AmqpJmsSelectorFilter(getSelector()));
   }

   if (!filters.isEmpty()) {
      source.setFilter(filters);
   }
}
 
开发者ID:apache,项目名称:activemq-artemis,代码行数:34,代码来源:AmqpReceiver.java


示例16: testReceiveMessageWithReceiveZeroTimeout

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Test(timeout = 20000)
public void testReceiveMessageWithReceiveZeroTimeout() throws Exception {
    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        JMSContext context = testFixture.createJMSContext(testPeer);

        testPeer.expectBegin();

        Queue queue = context.createQueue("myQueue");

        DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);

        testPeer.expectReceiverAttach();
        testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, amqpValueNullContent);
        testPeer.expectDispositionThatIsAcceptedAndSettled();

        JMSConsumer messageConsumer = context.createConsumer(queue);
        Message receivedMessage = messageConsumer.receive(0);

        assertNotNull("A message should have been recieved", receivedMessage);

        testPeer.expectEnd();
        testPeer.expectClose();
        context.close();

        testPeer.waitForAllHandlersToComplete(2000);
    }
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:28,代码来源:JMSConsumerIntegrationTest.java


示例17: testReceiveBodyTextMessage

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Test(timeout = 20000)
public void testReceiveBodyTextMessage() throws Exception {
    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        JMSContext context = testFixture.createJMSContext(testPeer);

        testPeer.expectBegin();

        final String content = "Message-Content";
        Queue queue = context.createQueue("myQueue");

        DescribedType amqpValueContent = new AmqpValueDescribedType(content);

        testPeer.expectReceiverAttach();
        testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, amqpValueContent);
        testPeer.expectDispositionThatIsAcceptedAndSettled();
        testPeer.expectEnd();
        testPeer.expectClose();

        JMSConsumer messageConsumer = context.createConsumer(queue);
        String received = messageConsumer.receiveBody(String.class, 3000);

        assertNotNull(received);
        assertEquals(content, received);

        context.close();

        testPeer.waitForAllHandlersToComplete(3000);
    }
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:30,代码来源:JMSConsumerIntegrationTest.java


示例18: testReceiveBodyBytesMessage

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Test(timeout = 20000)
public void testReceiveBodyBytesMessage() throws Exception {
    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        JMSContext context = testFixture.createJMSContext(testPeer);

        testPeer.expectBegin();

        Queue queue = context.createQueue("myQueue");

        PropertiesDescribedType properties = new PropertiesDescribedType();
        properties.setContentType(Symbol.valueOf(AmqpMessageSupport.OCTET_STREAM_CONTENT_TYPE));

        MessageAnnotationsDescribedType msgAnnotations = null;
        msgAnnotations = new MessageAnnotationsDescribedType();
        msgAnnotations.setSymbolKeyedAnnotation(AmqpMessageSupport.JMS_MSG_TYPE, AmqpMessageSupport.JMS_BYTES_MESSAGE);

        final byte[] expectedContent = "expectedContent".getBytes();
        DescribedType dataContent = new DataDescribedType(new Binary(expectedContent));

        testPeer.expectReceiverAttach();
        testPeer.expectLinkFlowRespondWithTransfer(null, msgAnnotations, properties, null, dataContent);
        testPeer.expectDispositionThatIsAcceptedAndSettled();

        JMSConsumer messageConsumer = context.createConsumer(queue);
        byte[] received = messageConsumer.receiveBody(byte[].class, 3000);
        testPeer.waitForAllHandlersToComplete(3000);

        assertNotNull(received);
        assertTrue(Arrays.equals(expectedContent, received));

        testPeer.expectEnd();
        testPeer.expectClose();

        context.close();

        testPeer.waitForAllHandlersToComplete(3000);
    }
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:39,代码来源:JMSConsumerIntegrationTest.java


示例19: doTestReceiveBodyFailsDoesNotAcceptMessage

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
public void doTestReceiveBodyFailsDoesNotAcceptMessage(int sessionMode) throws Exception {
    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        JMSContext context = testFixture.createJMSContext(testPeer);

        testPeer.expectBegin();

        final String content = "Message-Content";
        Queue queue = context.createQueue("myQueue");

        DescribedType amqpValueContent = new AmqpValueDescribedType(content);

        testPeer.expectReceiverAttach();
        testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, amqpValueContent);
        testPeer.expectEnd();
        testPeer.expectClose();

        JMSConsumer messageConsumer = context.createConsumer(queue);
        try {
            messageConsumer.receiveBody(Boolean.class, 3000);
            fail("Should not read as Boolean type");
        } catch (MessageFormatRuntimeException mfre) {
        }

        context.close();

        testPeer.waitForAllHandlersToComplete(3000);
    }
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:29,代码来源:JMSConsumerIntegrationTest.java


示例20: testReceiveMessageAndGetBody

import org.apache.qpid.proton.amqp.DescribedType; //导入依赖的package包/类
@Test(timeout = 20000)
public void testReceiveMessageAndGetBody() throws Exception {
    try (TestAmqpPeer testPeer = new TestAmqpPeer();) {
        Connection connection = testFixture.establishConnecton(testPeer);
        connection.start();

        testPeer.expectBegin();

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        Queue queue = session.createQueue("myQueue");

        DescribedType amqpValueNullContent = new AmqpValueDescribedType(null);

        testPeer.expectReceiverAttach();
        testPeer.expectLinkFlowRespondWithTransfer(null, null, null, null, amqpValueNullContent);
        testPeer.expectDispositionThatIsAcceptedAndSettled();
        testPeer.expectClose();

        MessageConsumer messageConsumer = session.createConsumer(queue);
        Message receivedMessage = messageConsumer.receive(3000);

        assertTrue(receivedMessage.isBodyAssignableTo(Object.class));
        assertTrue(receivedMessage.isBodyAssignableTo(String.class));
        assertTrue(receivedMessage.isBodyAssignableTo(byte[].class));
        assertTrue(receivedMessage.isBodyAssignableTo(Serializable.class));
        assertTrue(receivedMessage.isBodyAssignableTo(Map.class));

        assertNull(receivedMessage.getBody(Object.class));
        assertNull(receivedMessage.getBody(String.class));
        assertNull(receivedMessage.getBody(byte[].class));
        assertNull(receivedMessage.getBody(Serializable.class));
        assertNull(receivedMessage.getBody(Map.class));

        connection.close();

        testPeer.waitForAllHandlersToComplete(3000);
    }
}
 
开发者ID:apache,项目名称:qpid-jms,代码行数:39,代码来源:MessageIntegrationTest.java



注:本文中的org.apache.qpid.proton.amqp.DescribedType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java JTicketsFinder类代码示例发布时间:2022-05-23
下一篇:
Java RollingUpgradeStatus类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap