Search in sources :

Example 1 with CreateParticipantCommand

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

the class TestInstance method createCommands.

public List<CommandForClient> createCommands() {
    List<CommandForClient> commands = _testConfig.createCommands();
    List<CommandForClient> newCommands = new ArrayList<CommandForClient>(commands.size());
    double ratePerProducer = calculateRatePerProducer(_producerRate, commands);
    for (CommandForClient commandForClient : commands) {
        String clientName = commandForClient.getClientName();
        Command command = commandForClient.getCommand();
        _iterationValue.applyToCommand(command);
        if (command instanceof CreateProducerCommand) {
            CreateProducerCommand producerCommand = (CreateProducerCommand) command;
            producerCommand.setRate(ratePerProducer);
        }
        if (command instanceof CreateParticipantCommand) {
            CreateParticipantCommand participantCommand = (CreateParticipantCommand) command;
            if ((participantCommand.getNumberOfMessages() <= 0 && participantCommand.getMaximumDuration() <= 0)) {
                throw new DistributedTestException("Test '" + getName() + "' must specify a positive integer value for numberOfMessages or maximumDuration");
            }
        }
        newCommands.add(new CommandForClient(clientName, command));
    }
    return newCommands;
}
Also used : DistributedTestException(org.apache.qpid.disttest.DistributedTestException) CreateParticipantCommand(org.apache.qpid.disttest.message.CreateParticipantCommand) CreateProducerCommand(org.apache.qpid.disttest.message.CreateProducerCommand) Command(org.apache.qpid.disttest.message.Command) CreateProducerCommand(org.apache.qpid.disttest.message.CreateProducerCommand) ArrayList(java.util.ArrayList) CommandForClient(org.apache.qpid.disttest.controller.CommandForClient) CreateParticipantCommand(org.apache.qpid.disttest.message.CreateParticipantCommand)

Aggregations

ArrayList (java.util.ArrayList)1 DistributedTestException (org.apache.qpid.disttest.DistributedTestException)1 CommandForClient (org.apache.qpid.disttest.controller.CommandForClient)1 Command (org.apache.qpid.disttest.message.Command)1 CreateParticipantCommand (org.apache.qpid.disttest.message.CreateParticipantCommand)1 CreateProducerCommand (org.apache.qpid.disttest.message.CreateProducerCommand)1