Search in sources :

Example 31 with Source

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Source in project qpid-broker-j by apache.

the class Session_1_0Test method createAttach.

private Attach createAttach(final boolean durable, final String linkName, final String address, final Symbol destinationTypeCapability, final boolean isGlobal, final boolean isShared) {
    Attach attach = new Attach();
    Source source = new Source();
    List<Symbol> capabilities = new ArrayList<>();
    if (isGlobal) {
        capabilities.add(Symbol.getSymbol("global"));
    }
    if (isShared) {
        capabilities.add(Symbol.getSymbol("shared"));
    }
    capabilities.add(destinationTypeCapability);
    source.setCapabilities(capabilities.toArray(new Symbol[capabilities.size()]));
    if (durable) {
        source.setDurable(TerminusDurability.CONFIGURATION);
        source.setExpiryPolicy(TerminusExpiryPolicy.NEVER);
    } else {
        source.setDurable(TerminusDurability.NONE);
        source.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
    }
    attach.setSource(source);
    Target target = new Target();
    attach.setTarget(target);
    attach.setHandle(new UnsignedInteger(_handle++));
    attach.setIncompleteUnsettled(false);
    attach.setName(linkName);
    attach.setRole(Role.RECEIVER);
    source.setAddress(address);
    return attach;
}
Also used : Target(org.apache.qpid.server.protocol.v1_0.type.messaging.Target) Attach(org.apache.qpid.server.protocol.v1_0.type.transport.Attach) Symbol(org.apache.qpid.server.protocol.v1_0.type.Symbol) ArrayList(java.util.ArrayList) UnsignedInteger(org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger) Source(org.apache.qpid.server.protocol.v1_0.type.messaging.Source)

Example 32 with Source

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Source in project qpid-broker-j by apache.

the class LinkStoreTestCase method setUp.

@Override
public void setUp() throws Exception {
    super.setUp();
    _linkStore = createLinkStore();
    _source = new Source();
    _target = new Target();
    _source.setAddress(ADDRESS);
    _source.setCapabilities(new Symbol[] { Symbol.getSymbol(CAPABILITY) });
    _source.setDefaultOutcome(new Rejected());
    _source.setDistributionMode(StdDistMode.COPY);
    _source.setDurable(TerminusDurability.UNSETTLED_STATE);
    _source.setDynamic(Boolean.TRUE);
    _source.setExpiryPolicy(TerminusExpiryPolicy.CONNECTION_CLOSE);
    _source.setFilter(Collections.singletonMap(Symbol.valueOf("foo"), NoLocalFilter.INSTANCE));
    _source.setOutcomes(new Accepted().getSymbol());
    _source.setDynamicNodeProperties(Collections.singletonMap(Symbol.valueOf("dynamicProperty"), "dynamicPropertyValue"));
    _source.setTimeout(new UnsignedInteger(1));
    _target.setTimeout(new UnsignedInteger(2));
    _target.setDynamicNodeProperties(Collections.singletonMap(Symbol.valueOf("targetDynamicProperty"), "targetDynamicPropertyValue"));
    _target.setDynamic(Boolean.TRUE);
    _target.setExpiryPolicy(TerminusExpiryPolicy.LINK_DETACH);
    _target.setAddress("bar");
    _target.setCapabilities(new Symbol[] { Symbol.getSymbol(CAPABILITY) });
    _target.setDurable(TerminusDurability.CONFIGURATION);
}
Also used : Target(org.apache.qpid.server.protocol.v1_0.type.messaging.Target) Rejected(org.apache.qpid.server.protocol.v1_0.type.messaging.Rejected) UnsignedInteger(org.apache.qpid.server.protocol.v1_0.type.UnsignedInteger) Source(org.apache.qpid.server.protocol.v1_0.type.messaging.Source) Accepted(org.apache.qpid.server.protocol.v1_0.type.messaging.Accepted)

Example 33 with Source

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Source in project qpid-broker-j by apache.

the class MessageConverter_1_0_to_v0_10Test method testAmqpValueWithListContainingUnsupportedType.

public void testAmqpValueWithListContainingUnsupportedType() throws Exception {
    final List<Object> originalList = Collections.singletonList(new Source());
    final AmqpValue amqpValue = new AmqpValue(originalList);
    Message_1_0 sourceMessage = createTestMessage(amqpValue.createEncodingRetainingSection());
    try {
        _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
        fail("expected exception not thrown.");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Source(org.apache.qpid.server.protocol.v1_0.type.messaging.Source) AmqpValue(org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue)

Example 34 with Source

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Source in project qpid-broker-j by apache.

the class MessageConverter_1_0_to_v0_8Test method testAmqpSequenceWithUnsupportedType.

public void testAmqpSequenceWithUnsupportedType() throws Exception {
    final List<Object> originalList = Collections.singletonList(new Source());
    final AmqpSequence amqpSequence = new AmqpSequence(originalList);
    Message_1_0 sourceMessage = createTestMessage(amqpSequence.createEncodingRetainingSection());
    try {
        _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
        fail("expected exception not thrown.");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) AmqpSequence(org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpSequence) Source(org.apache.qpid.server.protocol.v1_0.type.messaging.Source)

Example 35 with Source

use of org.apache.qpid.server.protocol.v1_0.type.messaging.Source in project qpid-broker-j by apache.

the class MessageConverter_1_0_to_v0_8Test method testAmqpValueWithListContainingUnsupportedType.

public void testAmqpValueWithListContainingUnsupportedType() throws Exception {
    final List<Object> originalList = Collections.singletonList(new Source());
    final AmqpValue amqpValue = new AmqpValue(originalList);
    Message_1_0 sourceMessage = createTestMessage(amqpValue.createEncodingRetainingSection());
    try {
        _converter.convert(sourceMessage, mock(NamedAddressSpace.class));
        fail("expected exception not thrown.");
    } catch (MessageConversionException e) {
    // pass
    }
}
Also used : MessageConversionException(org.apache.qpid.server.protocol.converter.MessageConversionException) NamedAddressSpace(org.apache.qpid.server.model.NamedAddressSpace) Message_1_0(org.apache.qpid.server.protocol.v1_0.Message_1_0) Source(org.apache.qpid.server.protocol.v1_0.type.messaging.Source) AmqpValue(org.apache.qpid.server.protocol.v1_0.type.messaging.AmqpValue)

Aggregations

Source (org.apache.qpid.server.protocol.v1_0.type.messaging.Source)32 BaseSource (org.apache.qpid.server.protocol.v1_0.type.BaseSource)16 Attach (org.apache.qpid.server.protocol.v1_0.type.transport.Attach)15 SpecificationTest (org.apache.qpid.tests.protocol.SpecificationTest)14 Test (org.junit.Test)14 Error (org.apache.qpid.server.protocol.v1_0.type.transport.Error)13 FrameTransport (org.apache.qpid.tests.protocol.v1_0.FrameTransport)13 Interaction (org.apache.qpid.tests.protocol.v1_0.Interaction)11 Target (org.apache.qpid.server.protocol.v1_0.type.messaging.Target)10 TransactionError (org.apache.qpid.server.protocol.v1_0.type.transaction.TransactionError)10 AmqpError (org.apache.qpid.server.protocol.v1_0.type.transport.AmqpError)10 MessageSource (org.apache.qpid.server.message.MessageSource)9 LinkKey (org.apache.qpid.server.protocol.v1_0.LinkKey)8 Begin (org.apache.qpid.server.protocol.v1_0.type.transport.Begin)8 StoreException (org.apache.qpid.server.store.StoreException)8 Symbol (org.apache.qpid.server.protocol.v1_0.type.Symbol)7 Flow (org.apache.qpid.server.protocol.v1_0.type.transport.Flow)7 NamedAddressSpace (org.apache.qpid.server.model.NamedAddressSpace)6 AmqpErrorException (org.apache.qpid.server.protocol.v1_0.type.AmqpErrorException)6 Binary (org.apache.qpid.server.protocol.v1_0.type.Binary)6