Search in sources :

Example 1 with CreateConsumerCommand

use of org.apache.qpid.disttest.message.CreateConsumerCommand in project qpid-broker-j by apache.

the class ConsumerConfig method createCommand.

public CreateConsumerCommand createCommand(String sessionName) {
    CreateConsumerCommand createConsumerCommand = new CreateConsumerCommand();
    setParticipantProperties(createConsumerCommand);
    createConsumerCommand.setSessionName(sessionName);
    createConsumerCommand.setDurableSubscription(_isDurableSubscription);
    createConsumerCommand.setBrowsingSubscription(_isBrowsingSubscription);
    createConsumerCommand.setSelector(_selector);
    createConsumerCommand.setNoLocal(_noLocal);
    createConsumerCommand.setSynchronous(_synchronous);
    createConsumerCommand.setEvaluateLatency(_evaluateLatency);
    return createConsumerCommand;
}
Also used : CreateConsumerCommand(org.apache.qpid.disttest.message.CreateConsumerCommand)

Example 2 with CreateConsumerCommand

use of org.apache.qpid.disttest.message.CreateConsumerCommand in project qpid-broker-j by apache.

the class ClientCommandVisitorTest method testCreateConsumer.

@Test
public void testCreateConsumer() throws Exception {
    final CreateConsumerCommand command = new CreateConsumerCommand();
    _visitor.visit(command);
    verify(_delegate).createConsumer(command);
}
Also used : CreateConsumerCommand(org.apache.qpid.disttest.message.CreateConsumerCommand) Test(org.junit.Test)

Example 3 with CreateConsumerCommand

use of org.apache.qpid.disttest.message.CreateConsumerCommand in project qpid-broker-j by apache.

the class ConsumerConfigTest method testCreateConsumerCommand.

@Test
public void testCreateConsumerCommand() {
    boolean isTopic = true;
    boolean isDurableSubscription = true;
    boolean isBrowsingSubscription = true;
    boolean noLocal = true;
    long numberOfMessages = 100;
    String consumerName = "consumerName";
    String sessionName = "sessionName";
    String destinationName = "destinationName";
    String selector = "selector";
    int batchSize = 10;
    ;
    long maximumDuration = 50;
    boolean isSynchronousNonDefault = false;
    ConsumerConfig consumerConfig = new ConsumerConfig(consumerName, destinationName, numberOfMessages, batchSize, maximumDuration, isTopic, isDurableSubscription, isBrowsingSubscription, selector, noLocal, isSynchronousNonDefault);
    CreateConsumerCommand createConsumerCommand = consumerConfig.createCommand(sessionName);
    assertEquals(sessionName, createConsumerCommand.getSessionName());
    assertEquals(consumerName, createConsumerCommand.getParticipantName());
    assertEquals(destinationName, createConsumerCommand.getDestinationName());
    assertEquals(numberOfMessages, createConsumerCommand.getNumberOfMessages());
    assertEquals((long) batchSize, (long) createConsumerCommand.getBatchSize());
    assertEquals(maximumDuration, createConsumerCommand.getMaximumDuration());
    assertEquals(isTopic, createConsumerCommand.isTopic());
    assertEquals(isDurableSubscription, createConsumerCommand.isDurableSubscription());
    assertEquals(isBrowsingSubscription, createConsumerCommand.isBrowsingSubscription());
    assertEquals(selector, createConsumerCommand.getSelector());
    assertEquals(noLocal, createConsumerCommand.isNoLocal());
    assertEquals(isSynchronousNonDefault, createConsumerCommand.isSynchronous());
}
Also used : CreateConsumerCommand(org.apache.qpid.disttest.message.CreateConsumerCommand) Test(org.junit.Test)

Example 4 with CreateConsumerCommand

use of org.apache.qpid.disttest.message.CreateConsumerCommand in project qpid-broker-j by apache.

the class ParticipantResultFactoryTest method testCreateForConsumer.

@Test
public void testCreateForConsumer() {
    CreateConsumerCommand command = new CreateConsumerCommand();
    setCommonCommandFields(command);
    boolean topic = true;
    command.setTopic(topic);
    boolean durable = true;
    command.setDurableSubscription(durable);
    boolean browsingSubscription = false;
    command.setBrowsingSubscription(browsingSubscription);
    String selector = "selector";
    boolean isSelector = true;
    command.setSelector(selector);
    boolean noLocal = false;
    command.setNoLocal(noLocal);
    boolean synchronousConsumer = true;
    command.setSynchronous(synchronousConsumer);
    int totalNumberOfConsumers = 1;
    int totalNumberOfProducers = 0;
    int acknowledgeMode = 2;
    ConsumerParticipantResult result = _participantResultFactory.createForConsumer(PARTICIPANT_NAME, REGISTERED_CLIENT_NAME, command, acknowledgeMode, NUMBER_OF_MESSAGES_PROCESSED, PAYLOAD_SIZE, TOTAL_PAYLOAD_PROCESSED, START, END, Collections.<Long>emptyList(), PROVIDER_VERSION, PROTOCOL_VERSION);
    assertCommonResultProperties(result);
    assertEquals(topic, result.isTopic());
    assertEquals(durable, result.isDurableSubscription());
    assertEquals(browsingSubscription, result.isBrowsingSubscription());
    assertEquals(isSelector, result.isSelector());
    assertEquals(noLocal, result.isNoLocal());
    assertEquals(synchronousConsumer, result.isSynchronousConsumer());
    assertEquals((long) totalNumberOfConsumers, (long) result.getTotalNumberOfConsumers());
    assertEquals((long) totalNumberOfProducers, (long) result.getTotalNumberOfProducers());
}
Also used : CreateConsumerCommand(org.apache.qpid.disttest.message.CreateConsumerCommand) ConsumerParticipantResult(org.apache.qpid.disttest.message.ConsumerParticipantResult) Test(org.junit.Test)

Aggregations

CreateConsumerCommand (org.apache.qpid.disttest.message.CreateConsumerCommand)4 Test (org.junit.Test)3 ConsumerParticipantResult (org.apache.qpid.disttest.message.ConsumerParticipantResult)1