Package org.apache.qpid.disttest

Examples of org.apache.qpid.disttest.DistributedTestException


        {
            command = new RegisterClientCommand(_clientName, _instructionQueue.getQueueName());
        }
        catch (final JMSException e)
        {
            throw new DistributedTestException(e);
        }
        sendCommand(command);
    }
View Full Code Here


            _controlQueueProducer.send(message);
            LOGGER.debug("Sent message for " + command.getType() + ". message id: " + message.getJMSMessageID());
        }
        catch (final JMSException jmse)
        {
            throw new DistributedTestException("Unable to send command: " + command, jmse);
        }
    }
View Full Code Here

            final Connection newConnection = connectionFactory.createConnection();
            addConnection(command.getConnectionName(), newConnection);
        }
        catch (final NamingException ne)
        {
            throw new DistributedTestException("Unable to lookup factoryName: " + command.getConnectionFactoryName(),
                            ne);
        }
        catch (final JMSException jmse)
        {
            throw new DistributedTestException("Unable to create connection: " + command.getConnectionName()
                            + " (using factory name: " + command.getConnectionFactoryName() + ")", jmse);
        }
    }
View Full Code Here

        try
        {
            final Connection connection = _testConnections.get(command.getConnectionName());
            if (connection == null)
            {
                throw new DistributedTestException("No test connection found called: " + command.getConnectionName(),
                                command);
            }
            final boolean transacted = command.getAcknowledgeMode() == Session.SESSION_TRANSACTED;

            final Session newSession = connection.createSession(transacted, command.getAcknowledgeMode());
            LOGGER.debug("Created session " + command.getSessionName() + " with transacted = " + newSession.getTransacted() + " and acknowledgeMode = " + newSession.getAcknowledgeMode());

            addSession(command.getSessionName(), newSession);
        }
        catch (final JMSException jmse)
        {
            throw new DistributedTestException("Unable to create new session: " + command, jmse);
        }
    }
View Full Code Here

        try
        {
            final Session session = _testSessions.get(command.getSessionName());
            if (session == null)
            {
                throw new DistributedTestException("No test session found called: " + command.getSessionName(), command);
            }

            synchronized(session)
            {
                final Destination destination = session.createQueue(command.getDestinationName());

                final MessageProducer jmsProducer = session.createProducer(destination);

                if (command.getPriority() != -1)
                {
                    jmsProducer.setPriority(command.getPriority());
                }
                if (command.getTimeToLive() > 0)
                {
                    jmsProducer.setTimeToLive(command.getTimeToLive());
                }

                if (command.getDeliveryMode() == DeliveryMode.NON_PERSISTENT
                        || command.getDeliveryMode() == DeliveryMode.PERSISTENT)
                {
                    jmsProducer.setDeliveryMode(command.getDeliveryMode());
                }

                addProducer(command.getParticipantName(), jmsProducer);
            }
        }
        catch (final JMSException jmse)
        {
            throw new DistributedTestException("Unable to create new producer: " + command, jmse);
        }
    }
View Full Code Here

        try
        {
            final Session session = _testSessions.get(command.getSessionName());
            if (session == null)
            {
                throw new DistributedTestException("No test session found called: " + command.getSessionName(), command);
            }

            synchronized(session)
            {
                Destination destination;
                MessageConsumer jmsConsumer;
                if(command.isTopic())
                {
                    Topic topic = session.createTopic(command.getDestinationName());
                    if(command.isDurableSubscription())
                    {
                        String subscription = "subscription-" + command.getParticipantName() + System.currentTimeMillis();
                        jmsConsumer = session.createDurableSubscriber(topic, subscription);

                        _testSubscriptions.put(subscription, session);
                        LOGGER.debug("created durable suscription " + subscription + " to topic " + topic);
                    }
                    else
                    {
                        jmsConsumer = session.createConsumer(topic, command.getSelector());
                    }

                    destination = topic;
                }
                else
                {
                    destination = session.createQueue(command.getDestinationName());
                    jmsConsumer = session.createConsumer(destination, command.getSelector());
                }

                _testConsumers.put(command.getParticipantName(), jmsConsumer);
            }
        }
        catch (final JMSException jmse)
        {
            throw new DistributedTestException("Unable to create new consumer: " + command, jmse);
        }
    }
View Full Code Here

            }

        }
        catch (final JMSException jmse)
        {
            throw new DistributedTestException("Unable to destroy cleanly", jmse);
        }
    }
View Full Code Here

                {
                    connection.start();
                }
                catch (final JMSException e)
                {
                    throw new DistributedTestException("Failed to start connection '" + entry.getKey() + "' :"
                                    + e.getLocalizedMessage());
                }
            }
        }
    }
View Full Code Here

                message.acknowledge();
            }
        }
        catch (final JMSException jmse)
        {
            throw new DistributedTestException("Unable to commit or acknowledge message on session: " +
                            sessionName, jmse);
        }
    }
View Full Code Here

            final Session session = _testSessions.get(sessionName);
            return session.getAcknowledgeMode();
        }
        catch (final JMSException jmse)
        {
            throw new DistributedTestException("Unable to determine acknowledgement mode for session: " +
                            sessionName, jmse);
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.qpid.disttest.DistributedTestException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.