Repository: qpid-broker-j
Updated Branches:
  refs/heads/master 7ce54800d -> cec889db6


http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/systests/src/test/java/org/apache/qpid/server/logging/ConsumerLoggingTest.java
----------------------------------------------------------------------
diff --git 
a/systests/src/test/java/org/apache/qpid/server/logging/ConsumerLoggingTest.java
 
b/systests/src/test/java/org/apache/qpid/server/logging/ConsumerLoggingTest.java
deleted file mode 100644
index ca7eca6..0000000
--- 
a/systests/src/test/java/org/apache/qpid/server/logging/ConsumerLoggingTest.java
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.server.logging;
-
-import java.io.IOException;
-import java.util.List;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Message;
-import javax.jms.MessageConsumer;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.jms.Topic;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import org.apache.qpid.server.model.Consumer;
-
-/**
- * Subscription
- *
- * The Subscription test suite validates that the follow log messages as 
specified in the Functional Specification.
- *
- * This suite of tests validate that the Subscription messages occur correctly 
and according to the following format:
- *
- * SUB-1001 : Create : [Durable] [Arguments : <key=value>]
- * SUB-1002 : Close
- * SUB-1003 : State : <state>
- */
-public class ConsumerLoggingTest extends AbstractTestLogging
-{
-    private static final Logger LOGGER = 
LoggerFactory.getLogger(ConsumerLoggingTest.class);
-
-    static final String SUB_PREFIX = "SUB-";
-
-    private Connection _connection;
-    private Session _session;
-    private Queue _queue;
-    private Topic _topic;
-
-    @Override
-    public void setUp() throws Exception
-    {
-        setSystemProperty(Consumer.SUSPEND_NOTIFICATION_PERIOD, "100");
-        super.setUp();
-
-        _connection = getConnection();
-
-        _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-        final String queueName = getTestQueueName() + "Queue";
-        final String topicName = getTestQueueName() + "Topic";
-        _queue = createTestQueue(_session, queueName);
-        _topic = createTopic(_connection, topicName);
-
-        //Remove broker startup logging messages
-        _monitor.markDiscardPoint();
-    }
-
-    /**
-     * Description:
-     * When a Subscription is created it will be logged. This test validates 
that Subscribing to a transient queue is correctly logged.
-     * Input:
-     *
-     * 1. Running Broker
-     * 2. Create a new Subscription to a transient queue/topic.
-     * Output:          6
-     *
-     * <date> SUB-1001 : Create
-     *
-     * Validation Steps:
-     * 3. The SUB ID is correct
-     *
-     * @throws java.io.IOException    - if there is a problem getting the 
matches
-     * @throws javax.jms.JMSException - if there is a problem creating the 
consumer
-     */
-    public void testSubscriptionCreate() throws JMSException, IOException
-    {
-        _session.createConsumer(_queue);
-
-        //Validate
-
-        //Ensure that we wait for the SUB log message
-        waitAndFindMatches("SUB-1001");
-
-        List<String> results = findMatches(SUB_PREFIX);
-
-        assertEquals("Result set larger than expected.", 1, results.size());
-
-        String log = getLogMessage(results, 0);
-
-        validateMessageID("SUB-1001", log);
-
-        assertEquals("Log Message not as expected", "Create", 
getMessageString(fromMessage(log)));
-    }
-
-    /**
-     * Description:
-     * The creation of a Durable Subscription, such as a JMS 
DurableTopicSubscriber will result in an extra Durable tag being included in 
the Create log message
-     * Input:
-     *
-     * 1. Running Broker
-     * 2. Creation of a JMS DurableTopicSubiber
-     * Output:
-     *
-     * <date> SUB-1001 : Create : Durable
-     *
-     * Validation Steps:
-     * 3. The SUB ID is correct
-     * 4. The Durable tag is present in the message
-     * NOTE: A Subscription is not Durable, the queue it consumes from is.
-     *
-     * @throws java.io.IOException    - if there is a problem getting the 
matches
-     * @throws javax.jms.JMSException - if there is a problem creating the 
consumer
-     */
-    public void testSubscriptionCreateDurable() throws JMSException, 
IOException
-    {
-        _session.createDurableSubscriber(_topic, getName());
-
-        //Validate
-        //Ensure that we wait for the SUB log message
-        waitAndFindMatches("SUB-1001");
-
-        List<String> results = findMatches(SUB_PREFIX);
-
-        assertEquals("Result set not as expected.", 1, results.size());
-
-        String log = getLogMessage(results, 0);
-
-        validateMessageID("SUB-1001", log);
-
-        String message = getMessageString(fromMessage(log));
-        assertTrue("Durable not on log message:" + message, 
message.contains("Durable"));
-    }
-
-    /**
-     * Description:
-     * The creation of a Subscriber with a JMS Selector will result in the 
Argument field being populated. These argument key/value pairs are then shown 
in the log message.
-     * Input:
-     *
-     * 1. Running Broker
-     * 2. Subscriber created with a JMS Selector.
-     * Output:
-     *
-     * <date> SUB-1001 : Create : Arguments : <key=value>
-     *
-     * Validation Steps:
-     * 3. The SUB ID is correct
-     * 4. Argument tag is present in the message
-     *
-     * @throws java.io.IOException    - if there is a problem getting the 
matches
-     * @throws javax.jms.JMSException - if there is a problem creating the 
consumer
-     */
-    public void testSubscriptionCreateWithArguments() throws JMSException, 
IOException
-    {
-        final String SELECTOR = "Selector='True'";
-        _session.createConsumer(_queue, SELECTOR);
-
-        //Validate
-
-        //Ensure that we wait for the SUB log message
-        waitAndFindMatches("SUB-1001");
-
-        List<String> results = findMatches(SUB_PREFIX);
-
-        assertEquals("Result set larger than expected.", 1, results.size());
-
-        String log = getLogMessage(results, 0);
-
-        validateMessageID("SUB-1001", log);
-
-        String message = getMessageString(fromMessage(log));
-        assertTrue("Selector not on log message:" + message, 
message.contains(SELECTOR));
-    }
-
-    /**
-     * Description:
-     * The final combination of SUB-1001 Create messages involves the creation 
of a Durable Subscription that also contains a set of Arguments, such as those 
provided via a JMS Selector.
-     * Input:
-     *
-     * 1. Running Broker
-     * 2. Java Client creates a Durable Subscription with Selector
-     * Output:
-     *
-     * <date> SUB-1001 : Create : Durable Arguments : <key=value>
-     *
-     * Validation Steps:
-     * 3. The SUB ID is correct
-     * 4. The tag Durable is present in the message
-     * 5. The Arguments are present in the message
-     *
-     * @throws java.io.IOException    - if there is a problem getting the 
matches
-     * @throws javax.jms.JMSException - if there is a problem creating the 
consumer
-     */
-    public void testSubscriptionCreateDurableWithArguments() throws 
JMSException, IOException
-    {
-        final String SELECTOR = "Selector='True'";
-        _session.createDurableSubscriber(_topic, getName(), SELECTOR, false);
-
-        //Validate
-
-        //Ensure that we wait for the SUB log message
-        waitAndFindMatches("SUB-1001");
-
-        List<String> results = findMatches(SUB_PREFIX);
-
-        assertEquals("Result set larger than expected.", 1, results.size());
-
-        String log = getLogMessage(results, 0);
-
-        validateMessageID("SUB-1001", log);
-
-        String message = getMessageString(fromMessage(log));
-        assertTrue("Durable not on log message:" + message, 
message.contains("Durable"));
-        assertTrue("Selector not on log message:" + message, 
message.contains(SELECTOR));
-    }
-
-    /**
-     * Description:
-     * When a Subscription is closed it will log this so that it can be 
correlated with the Create.
-     * Input:
-     *
-     * 1. Running Broker
-     * 2. Client with a subscription.
-     * 3. The subscription is then closed.
-     * Output:
-     *
-     * <date> SUB-1002 : Close
-     *
-     * Validation Steps:
-     * 1. The SUB ID is correct
-     * 2. There must be a SUB-1001 Create message preceding this message
-     * 3. This must be the last message from the given Subscription
-     *
-     * @throws java.io.IOException    - if there is a problem getting the 
matches
-     * @throws javax.jms.JMSException - if there is a problem creating the 
consumer
-     */
-    public void testSubscriptionClose() throws JMSException, IOException
-    {
-        _session.createConsumer(_queue).close();
-
-        //Validate
-        //Ensure that we wait for the SUB log message
-        waitAndFindMatches("SUB-1002");
-
-        List<String> results = findMatches(SUB_PREFIX);
-
-        //3
-        assertEquals("Result set larger than expected.", 2, results.size());
-
-        // 2
-        String log = getLogMessage(results, 0);
-        validateMessageID("SUB-1001", log);
-        // 1
-        log = getLogMessage(results, 1);
-        validateMessageID("SUB-1002", log);
-
-        String message = getMessageString(fromMessage(log));
-        assertEquals("Log message is not close", "Close", message);
-
-    }
-
-    /**
-     * Description:
-     * When a Subscription fills its prefetch it will become suspended. This
-     * will be logged as a SUB-1003 message.
-     * Input:
-     *
-     * 1. Running broker
-     * 2. Message Producer to put more data on the queue than the client's 
prefetch
-     * 3. Client that ensures that its prefetch becomes full
-     * Output:
-     *
-     * <date> SUB-1003 : State : <state>
-     *
-     * Validation Steps:
-     * 1. The SUB ID is correct
-     * 2. The state is correct
-     *
-     * @throws java.io.IOException    - if there is a problem getting the 
matches
-     * @throws javax.jms.JMSException - if there is a problem creating the 
consumer
-     */
-    public void testSubscriptionSuspend() throws Exception, IOException
-    {
-        //Close session with large prefetch
-        _connection.close();
-        int PREFETCH = 15;
-        _connection = getConnectionWithPrefetch(PREFETCH);
-        _session = _connection.createSession(true, Session.SESSION_TRANSACTED);
-
-
-        MessageConsumer consumer = _session.createConsumer(_queue);
-
-        _connection.start();
-
-        //Start the dispatcher & Unflow the channel.
-        consumer.receiveNoWait();
-
-        //Fill the prefetch and two extra so that our receive bellow allows the
-        // subscription to become active
-        // Previously we set this to 17 so that it would return to a suspended
-        // state. However, testing has shown that the state change can occur
-        // sufficiently quickly that logging does not occur consistently enough
-        // for testing.
-        int SEND_COUNT = 16;
-        sendMessage(_session, _queue, SEND_COUNT);
-        _session.commit();
-
-        Thread.sleep(2500l);
-
-        LOGGER.debug("Looking for SUB-1003s");
-        List<String> results = waitAndFindMatches("SUB-1003");
-
-        assertTrue("Expected at least two suspension messages, but got " + 
results.size(), results.size() >= 2);
-
-        // consume all messages to hopefully resume the consumer
-        Message msg;
-        for (int i = 0; i < SEND_COUNT; ++i)
-        {
-            msg = consumer.receive(1000);
-            assertNotNull("Message not retrieved", msg);
-        }
-        _session.commit();
-
-        int count = waitAndFindMatches("SUB-1003").size();
-        Thread.sleep(2000l);
-        assertEquals("More suspension messages were received unexpectedly", 
count, waitAndFindMatches("SUB-1003").size());
-
-        _connection.close();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/systests/src/test/java/org/apache/qpid/server/logging/DurableQueueLoggingTest.java
----------------------------------------------------------------------
diff --git 
a/systests/src/test/java/org/apache/qpid/server/logging/DurableQueueLoggingTest.java
 
b/systests/src/test/java/org/apache/qpid/server/logging/DurableQueueLoggingTest.java
deleted file mode 100644
index aaad678..0000000
--- 
a/systests/src/test/java/org/apache/qpid/server/logging/DurableQueueLoggingTest.java
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.server.logging;
-
-import org.apache.qpid.QpidException;
-import org.apache.qpid.client.AMQSession;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.naming.NamingException;
-import java.io.IOException;
-import java.util.HashMap;
-import java.util.List;
-import java.util.Map;
-
-/**
- * The Queue test suite validates that the follow log messages as specified in
- * the Functional Specification.
- *
- * This suite of tests validate that the Queue messages occur correctly and
- * according to the following format:
- *
- * QUE-1001 : Create : [AutoDelete] [Durable|Transient] [Priority:<levels>] 
[Owner:<name>]
- */
-public class DurableQueueLoggingTest extends AbstractTestLogging
-{
-    protected String DURABLE = "Durable";
-    protected String TRANSIENT = "Transient";
-    protected boolean _durable;
-
-    protected Connection _connection;
-    protected Session _session;
-    private static final String QUEUE_PREFIX = "QUE-";
-    private static int PRIORITIES = 6;
-
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        //Ensure we only have logs from our test
-        _monitor.markDiscardPoint();
-
-        _connection = getConnection();
-        _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-        _durable = true;
-    }
-
-    /**
-     * Description:
-     * When a simple transient queue is created then a QUE-1001 create message
-     * is expected to be logged.
-     * Input:
-     * 1. Running broker
-     * 2. Persistent Queue is created from a client
-     * Output:
-     *
-     * <date> QUE-1001 : Create : Owner: '<name>' Durable
-     *
-     * Validation Steps:
-     * 3. The QUE ID is correct
-     * 4. The Durable tag is present in the message
-     * 5. The Owner is as expected
-     *
-     * @throws javax.jms.JMSException
-     * @throws javax.naming.NamingException
-     * @throws java.io.IOException
-     */
-    public void testQueueCreateDurableExclusive() throws NamingException, 
JMSException, IOException
-    {
-        String queueName= getTestQueueName();
-        // To force a queue Creation Event we need to create a consumer.
-        Queue queue = (Queue) _session.createQueue("direct://amq.direct/" + 
queueName + "/" + queueName + "?durable='" + _durable + "'&exclusive='true'");
-
-        _session.createConsumer(queue);
-
-        List<String> results = waitForMesssage();
-
-        String clientID = _connection.getClientID();
-        assertNotNull("clientID should not be null", clientID);
-
-        // in 0-8/9/9-1 an exclusive queue will be deleted when the connection 
is closed, so auto-delete is true.
-        // in 0-10 an exclusive queue outlasts the creating connection and so 
is not auto-delete
-        // the queue only has owner as the client-id in 0-8/9/91 where 
exclusivity is taken to mean exclusive to the
-        // client-id in perpetuity. For 0-10 exclusive means exclusive to a 
session.
-        validateQueueProperties(results, false, !(isBroker010() || _durable), 
(_durable && !isBroker010()) ? clientID : null);
-    }
-
-    /**
-     * Description:
-     * When a simple transient queue is created then a QUE-1001 create message
-     * is expected to be logged.
-     * Input:
-     * 1. Running broker
-     * 2. Persistent Queue is created from a client
-     * Output:
-     *
-     * <date> QUE-1001 : Create : Owner: '<name>' Durable
-     *
-     * Validation Steps:
-     * 3. The QUE ID is correct
-     * 4. The Durable tag is present in the message
-     * 5. The Owner is as expected
-     *
-     * @throws javax.jms.JMSException
-     * @throws javax.naming.NamingException
-     * @throws java.io.IOException
-     */
-    public void testQueueCreateDurable() throws NamingException, JMSException, 
IOException
-    {
-        String queueName = getTestQueueName();
-
-        // To force a queue Creation Event we need to create a consumer.
-        Queue queue = (Queue) _session.createQueue("direct://amq.direct/" + 
queueName + "/" + queueName + "?durable='" + _durable + "'");
-
-        _session.createConsumer(queue);
-
-        List<String> results = waitForMesssage();
-
-        validateQueueProperties(results, false, false, null);
-    }
-
-    /**
-     * Description:
-     * When a simple transient queue is created then a QUE-1001 create message
-     * is expected to be logged.
-     * Input:
-     * 1. Running broker
-     * 2. AutoDelete Persistent Queue is created from a client
-     * Output:
-     *
-     * <date> QUE-1001 : Create : Owner: '<name>' AutoDelete Durable
-     *
-     * Validation Steps:
-     * 3. The QUE ID is correct
-     * 4. The Durable tag is present in the message
-     * 5. The Owner is as expected
-     * 6. The AutoDelete tag is present in the message
-     *
-     * @throws javax.jms.JMSException
-     * @throws javax.naming.NamingException
-     * @throws java.io.IOException
-     */
-    public void testQueueCreatePersistentAutoDelete() throws NamingException, 
JMSException, IOException
-    {
-        String queueName = getTestQueueName();
-        // To force a queue Creation Event we need to create a consumer.
-        Queue queue = (Queue) 
_session.createQueue("direct://amq.direct/"+queueName+"/"+queueName+"?durable='"+_durable+"'&autodelete='true'");
-
-        _session.createConsumer(queue);
-
-        List<String> results = waitForMesssage();
-
-        validateQueueProperties(results, false, true, null);
-    }
-
-    /**
-     * Description:
-     * When a simple transient queue is created then a QUE-1001 create message
-     * is expected to be logged.
-     * Input:
-     * 1. Running broker
-     * 2. Persistent Queue is created from a client
-     * Output:
-     *
-     * <date> QUE-1001 : Create : Owner: '<name>' Durable Priority:<levels>
-     *
-     * Validation Steps:
-     * 3. The QUE ID is correct
-     * 4. The Durable tag is present in the message
-     * 5. The Owner is as expected
-     * 6. The Priority level is correctly set
-     *
-     * @throws javax.jms.JMSException
-     * @throws javax.naming.NamingException
-     * @throws java.io.IOException
-     */
-    public void testCreateQueuePersistentPriority() throws NamingException, 
JMSException, IOException, QpidException
-    {
-        // To Create a Priority queue we need to use AMQSession specific code
-        final Map<String, Object> arguments = new HashMap<String, Object>();
-        arguments.put("x-qpid-priorities", PRIORITIES);
-        // Need to create a queue that does not exist so use test name
-        final String queueName = getTestQueueName();
-        ((AMQSession) _session).createQueue(queueName, false, _durable, false, 
arguments);
-
-        Queue queue = (Queue) 
_session.createQueue("direct://amq.direct/"+queueName+"/"+queueName+"?durable='"+_durable+"'&autodelete='false'");
-
-
-        //Need to create a Consumer to ensure that the log has had time to 
write
-        // as the above Create is Asynchronous
-        _session.createConsumer(queue);
-
-        List<String> results = waitForMesssage();
-
-        // Only 1 Queue message should hav been logged
-        assertEquals("Result set size not as expected", 1, results.size());
-
-        validateQueueProperties(results, true, false, null);
-    }
-
-    /**
-     * Description:
-     * When a simple transient queue is created then a QUE-1001 create message
-     * is expected to be logged.
-     * Input:
-     * 1. Running broker
-     * 2. AutoDelete Persistent Queue is created from a client
-     * Output:
-     *
-     * <date> QUE-1001 : Create : Owner: '<name>' Durable Priority:<levels>
-     *
-     * Validation Steps:
-     * 3. The QUE ID is correct
-     * 4. The Durable tag is present in the message
-     * 5. The Owner is as expected
-     * 6. The AutoDelete tag is present in the message
-     * 7. The Priority level is correctly set
-     *
-     * @throws javax.jms.JMSException
-     * @throws javax.naming.NamingException
-     * @throws java.io.IOException
-     */
-    public void testCreateQueuePersistentAutoDeletePriority() throws 
NamingException, JMSException, IOException,
-                                                                     
QpidException
-    {
-        // To Create a Priority queue we need to use AMQSession specific code
-        final Map<String, Object> arguments = new HashMap<String, Object>();
-        arguments.put("x-qpid-priorities", PRIORITIES);
-        // Need to create a queue that does not exist so use test name
-        final String queueName = getTestQueueName() + "-autoDeletePriority";
-        ((AMQSession) _session).createQueue(queueName, true, _durable, false, 
arguments);
-
-        Queue queue = (Queue) 
_session.createQueue("direct://amq.direct/"+queueName+"/"+queueName+"?durable='"+_durable+"'&autodelete='true'");
-
-
-        //Need to create a Consumer to ensure that the log has had time to 
write
-        // as the above Create is Asynchronous
-        _session.createConsumer(queue);
-
-        List<String> results = waitForMesssage();
-
-        validateQueueProperties(results, true, true, null);
-    }
-
-    private List<String> waitForMesssage() throws IOException
-    {
-        // Validation
-        // Ensure we have received the QUE log msg.
-        waitForMessage("QUE-1001");
-
-        List<String> results = findMatches(QUEUE_PREFIX);
-
-        // Only 1 Queue message should hav been logged
-        assertEquals("Result set size not as expected", 1, results.size());
-
-        return results;
-    }
-
-    public void validateQueueProperties(List<String> results, boolean 
hasPriority, boolean hasAutodelete, String clientID)
-    {
-        String log = getLogMessage(results, 0);
-
-        // Message Should be a QUE-1001
-        validateMessageID("QUE-1001", log);
-
-        // Queue is Durable
-        assertEquals(DURABLE + " keyword not correct in log entry",
-                _durable, fromMessage(log).contains(DURABLE));
-
-        assertEquals(TRANSIENT + " keyword not correct in log entry.",
-                !_durable, fromMessage(log).contains(TRANSIENT));
-
-        // Queue is Priority
-        assertEquals("Unexpected priority status:" + fromMessage(log), 
hasPriority,
-                fromMessage(log).contains("Priority: " + PRIORITIES));
-
-        // Queue is AutoDelete
-        assertEquals("Unexpected AutoDelete status:" + fromMessage(log), 
hasAutodelete,
-                fromMessage(log).contains("AutoDelete"));
-
-        if(clientID != null)
-        {
-            assertTrue("Queue does not have correct owner value:" + 
fromMessage(log),
-                    fromMessage(log).contains("Owner: " + clientID));
-        }
-        else
-        {
-            assertFalse("Queue should not contain Owner tag:" + 
fromMessage(log),
-                    fromMessage(log).contains("Owner"));
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/systests/src/test/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java
----------------------------------------------------------------------
diff --git 
a/systests/src/test/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java
 
b/systests/src/test/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java
deleted file mode 100644
index c8b29a5..0000000
--- 
a/systests/src/test/java/org/apache/qpid/server/logging/ExchangeLoggingTest.java
+++ /dev/null
@@ -1,247 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.server.logging;
-
-import java.io.IOException;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.MessageProducer;
-import javax.jms.Session;
-import javax.jms.TextMessage;
-import javax.jms.Topic;
-
-/**
- * Exchange
- *
- * The Exchange test suite validates that the follow log messages as specified 
in the Functional Specification.
- *
- * This suite of tests validate that the Exchange messages occur correctly and 
according to the following format:
- *
- * EXH-1001 : Create : [Durable] Type:<value> Name:<value>
- * EXH-1002 : Deleted
- */
-public class ExchangeLoggingTest extends AbstractTestLogging
-{
-
-    static final String EXH_PREFIX = "EXH-";
-
-    private Connection _connection;
-    private Session _session;
-    private Topic _topic;
-    private String _name;
-    private String _type;
-    private String _topicName;
-
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-
-        _connection = getConnection();
-
-        _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-        _type = "direct";
-        _name = getTestQueueName()+ "-exchange";
-
-        _topicName = isBroker10() ? _name + "/queue" : "ADDR: " + _name + 
"/queue" ;
-        _topic = _session.createTopic(_topicName);
-
-    }
-
-    /**
-     * Description:
-     * When a durable exchange is created an EXH-1001 message is logged with 
the Durable tag. This will be the first message from this exchange.
-     * Input:
-     *
-     * 1. Running broker
-     * 2. Client requests a durable exchange be created.
-     * Output:
-     *
-     * <date> EXH-1001 : Create : Durable Type:<value> Name:<value>
-     *
-     * Validation Steps:
-     * 3. The EXH ID is correct
-     * 4. The Durable tag is present in the message
-     */
-
-    public void testExchangeCreateDurable() throws JMSException, IOException
-    {
-
-        //Ignore broker startup messages
-        _monitor.markDiscardPoint();
-
-        createExchangeUsingAmqpManagement(_name, _type, true);
-
-        // Ensure we have received the EXH log msg.
-        waitForMessage("EXH-1001");
-
-        List<String> results = findMatches(EXH_PREFIX);
-
-        assertTrue("No Results found for Exchange.", results.size()==1);
-
-        validateExchangeCreate(results, true, true);
-    }
-
-    private void createExchangeUsingAmqpManagement(final String name, final 
String type, final boolean durable)
-            throws JMSException
-    {
-        final Map<String, Object> attributes = new LinkedHashMap();
-        attributes.put("object-path", name);
-        attributes.put("qpid-type", type);
-        attributes.put("durable", durable);
-
-        createEntityUsingAmqpManagement(name, _session, 
"org.apache.qpid.Exchange", attributes);
-    }
-
-    /**
-     * Description:
-     * When an exchange is created an EXH-1001 message is logged. This will be 
the first message from this exchange.
-     * Input:
-     *
-     * 1. Running broker
-     * 2. Client requests an exchange be created.
-     * Output:
-     *
-     * <date> EXH-1001 : Create : Type:<value> Name:<value>
-     *
-     * Validation Steps:
-     * 3. The EXH ID is correct
-     */
-    public void testExchangeCreate() throws JMSException, IOException
-    {
-        //Ignore broker startup messages
-        _monitor.markDiscardPoint();
-
-        createExchangeUsingAmqpManagement(_name, _type, false);
-        // Ensure we have received the EXH log msg.
-        waitForMessage("EXH-1001");
-
-        List<String> results = findMatches(EXH_PREFIX);
-
-        assertEquals("Result set larger than expected.", 1, results.size());
-
-        validateExchangeCreate(results, false, true);
-    }
-
-    private void validateExchangeCreate(List<String> results, boolean durable, 
boolean checkNameAndType)
-    {
-        String log = getLogMessage(results, 0);
-        String message = getMessageString(fromMessage(log));
-        
-        validateMessageID("EXH-1001", log);
-        
-        assertTrue("Log Message does not start with create:" + message,
-                   message.startsWith("Create"));
-
-        assertEquals("Unexpected Durable state:" + message, durable,
-                message.contains("Durable"));
-        
-        if(checkNameAndType)
-        {
-            assertTrue("Log Message does not contain Type:" + message,
-                    message.contains("Type: " + _type));
-            assertTrue("Log Message does not contain Name:" + message,
-                    message.contains("Name: " + _name));
-        }
-    }
-
-    /**
-     * Description:
-     * An Exchange can be deleted through an AMQP ExchangeDelete method. When 
this is successful an EXH-1002 Delete message will be logged. This will be the 
last message from this exchange.
-     * Input:
-     *
-     * 1. Running broker
-     * 2. A new Exchange has been created
-     * 3. Client requests that the new exchange be deleted.
-     * Output:
-     *
-     * <date> EXH-1002 : Deleted
-     *
-     * Validation Steps:
-     * 4. The EXH ID is correct
-     * 5. There is a corresponding EXH-1001 Create message logged.
-     */
-    public void testExchangeDelete() throws Exception, IOException
-    {
-        //Ignore broker startup messages
-        _monitor.markDiscardPoint();
-
-        createExchangeUsingAmqpManagement(_name, _type, false);
-        deleteEntityUsingAmqpManagement(_name, _session, 
"org.apache.qpid.Exchange");
-
-        //Wait and ensure we get our last EXH-1002 msg
-        waitForMessage("EXH-1002");
-
-        List<String> results = findMatches(EXH_PREFIX);
-
-        assertEquals("Result set larger than expected.", 2, results.size());
-
-        validateExchangeCreate(results, false, false);
-
-        String log = getLogMessage(results, 1);
-        validateMessageID("EXH-1002", log);
-
-        String message = getMessageString(fromMessage(log));
-        assertEquals("Log Message not as expected", "Deleted", message);
-
-    }
-
-    public void testDiscardedMessage() throws Exception
-    {
-        //Ignore broker startup messages
-        _monitor.markDiscardPoint();
-        createExchangeUsingAmqpManagement(_name, _type, false);
-
-        if (!(isBroker010() || isBroker10()))
-        {
-            // Default 0-8..-0-9-1 behaviour is for messages to be rejected 
(returned to client).
-            setTestClientSystemProperty("qpid.default_mandatory", "false");
-        }
-
-        _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-
-        // Do not create consumer so queue is not created and message will be 
discarded.
-        final MessageProducer producer = _session.createProducer(_topic);
-
-        // Sending message
-        final TextMessage msg = _session.createTextMessage("msg");
-        producer.send(msg);
-
-        final String expectedMessageBody = "Discarded Message : Name: \"" + 
_name + "\" Routing Key: \"queue\"";
-
-        // Ensure we have received the EXH log msg.
-        waitForMessage("EXH-1003");
-
-        List<String> results = findMatches(EXH_PREFIX);
-        assertEquals("Result set larger than expected.", 2, results.size());
-
-        final String log = getLogMessage(results, 1);
-        validateMessageID("EXH-1003", log);
-
-        final String message = getMessageString(fromMessage(log));
-        assertEquals("Log Message not as expected", expectedMessageBody, 
message);
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/systests/src/test/java/org/apache/qpid/server/logging/QueueLoggingTest.java
----------------------------------------------------------------------
diff --git 
a/systests/src/test/java/org/apache/qpid/server/logging/QueueLoggingTest.java 
b/systests/src/test/java/org/apache/qpid/server/logging/QueueLoggingTest.java
deleted file mode 100644
index 1a9238d..0000000
--- 
a/systests/src/test/java/org/apache/qpid/server/logging/QueueLoggingTest.java
+++ /dev/null
@@ -1,179 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.server.logging;
-
-import org.apache.qpid.QpidException;
-import org.apache.qpid.client.AMQSession;
-import org.apache.qpid.client.failover.FailoverException;
-import org.apache.qpid.server.logging.subjects.AbstractTestLogSubject;
-
-import javax.jms.Connection;
-import javax.jms.JMSException;
-import javax.jms.Queue;
-import javax.jms.Session;
-import javax.naming.NamingException;
-import java.io.IOException;
-import java.util.List;
-
-/**
- * The Queue test suite validates that the follow log messages as specified in
- * the Functional Specification.
- *
- * This suite of tests validate that the Queue messages occur correctly and
- * according to the following format:
- *
- * QUE-1002 : Deleted
- */
-public class QueueLoggingTest extends AbstractTestLogging
-{
-    protected Connection _connection;
-    protected Session _session;
-    private static final String QUEUE_PREFIX = "QUE-";
-
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        //Remove broker startup logging messages
-        _monitor.markDiscardPoint();
-        
-        _connection = getConnection();
-        _session = _connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
-    }
-
-    /**
-     *  Description:
-     *  An explict QueueDelete request must result in a QUE-1002 Deleted 
message
-     *  being logged. This can be done via an explict AMQP QueueDelete method.
-     * Input:
-     *
-     *  1. Running Broker
-     *  2. Queue created on the broker with no subscribers
-     *  3. Client requests the queue be deleted via a QueueDelete
-     *  Output:
-     *
-     *  <date> QUE-1002 : Deleted
-     *
-     *  Validation Steps:
-     *
-     *  4. The QUE ID is correct
-     *
-     * @throws java.io.IOException
-     * @throws javax.jms.JMSException
-     * @throws javax.naming.NamingException
-     */
-    public void testQueueDelete() throws NamingException, JMSException, 
IOException, FailoverException, QpidException
-    {
-        // To force a queue Creation Event we need to create a consumer.
-        Queue queue = _session.createQueue(getTestQueueName());
-
-        _session.createConsumer(queue);
-
-        // Delete Queue
-        ((AMQSession)_session).sendQueueDelete(queue.getQueueName());
-
-        //Perform a synchronous action to ensure that the above log will be on 
disk
-        _session.close();
-
-        // Validation
-        //Ensure that we wait for the QUE log message
-        waitAndFindMatches("QUE-1002");
-
-        List<String> results = findMatches(QUEUE_PREFIX);
-
-        // Only 1 Queue message should hav been logged
-        assertEquals("Result set size not as expected", 2, results.size());
-
-        String log = getLogMessage(results, 0);
-
-        // Message Should be a QUE-1001
-        validateMessageID("QUE-1001", log);        
-
-        String createdQueueName = AbstractTestLogSubject.getSlice("qu",  
fromSubject(log));
-
-        log = getLogMessage(results, 1);
-        // Message Should be a QUE-1002
-        validateMessageID("QUE-1002", log);
-
-        final String actual = getMessageString(fromMessage(log));
-        assertTrue("Log message does not contain expected message. actual : " 
+ actual,
-                   actual.contains("Deleted"));
-
-        assertEquals("Queue Delete not for created queue:", createdQueueName,
-                     AbstractTestLogSubject.getSlice("qu", fromSubject(log)));
-    }
-
-
-    /**
-     * Description:
-     *  Closing a JMS connection should delete a temporary queue that it 
created
-     * Input:
-     *
-     *  1. Running Broker
-     *  2. Client creates a temporary queue then disconnects
-     *  Output:
-     *
-     *  <date> QUE-1002 : Deleted
-     *
-     *  Validation Steps:
-     *
-     *  3. The QUE ID is correct
-     *
-     * @throws java.io.IOException
-     * @throws javax.jms.JMSException
-     * @throws javax.naming.NamingException
-     */
-    public void testQueueAutoDelete() throws NamingException, JMSException, 
IOException
-    {
-        _session.createTemporaryQueue();
-
-        _connection.close();
-
-        // Validation
-        //Ensure that we wait for the QUE log message
-        waitAndFindMatches("QUE-1002");
-
-        List<String> results = findMatches(QUEUE_PREFIX);
-
-        // Only 1 Queue message should hav been logged
-        assertEquals("Result set size not as expected", 2, results.size());
-
-        String log = getLogMessage(results, 0);
-
-        // Message Should be a QUE-1001
-        validateMessageID("QUE-1001", log);
-
-        String createdQueueName = AbstractTestLogSubject.getSlice("qu", 
fromSubject(log));
-
-        log = getLogMessage(results, 1);
-        // Message Should be a QUE-1002
-        validateMessageID("QUE-1002", log);
-
-        final String actual = getMessageString(fromMessage(log));
-        assertTrue("Log message does not contain expected message. actual : " 
+ actual,
-                   actual.contains("Deleted"));
-
-        assertEquals("Queue Delete not for created queue:", createdQueueName,
-                     AbstractTestLogSubject.getSlice("qu", fromSubject(log)));
-
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/systests/src/test/java/org/apache/qpid/server/logging/TransientQueueLoggingTest.java
----------------------------------------------------------------------
diff --git 
a/systests/src/test/java/org/apache/qpid/server/logging/TransientQueueLoggingTest.java
 
b/systests/src/test/java/org/apache/qpid/server/logging/TransientQueueLoggingTest.java
deleted file mode 100644
index 0771c37..0000000
--- 
a/systests/src/test/java/org/apache/qpid/server/logging/TransientQueueLoggingTest.java
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.server.logging;
-
-public class TransientQueueLoggingTest extends DurableQueueLoggingTest
-{
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        _durable = false;
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/systests/src/test/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java
----------------------------------------------------------------------
diff --git 
a/systests/src/test/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java
 
b/systests/src/test/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java
deleted file mode 100644
index e081962..0000000
--- 
a/systests/src/test/java/org/apache/qpid/server/logging/VirtualHostLoggingTest.java
+++ /dev/null
@@ -1,129 +0,0 @@
-/*
- *  Licensed to the Apache Software Foundation (ASF) under one
- *  or more contributor license agreements.  See the NOTICE file
- *  distributed with this work for additional information
- *  regarding copyright ownership.  The ASF licenses this file
- *  to you under the Apache License, Version 2.0 (the
- *  "License"); you may not use this file except in compliance
- *  with the License.  You may obtain a copy of the License at
- *
- *    http://www.apache.org/licenses/LICENSE-2.0
- *
- *  Unless required by applicable law or agreed to in writing,
- *  software distributed under the License is distributed on an
- *  "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- *  KIND, either express or implied.  See the License for the
- *  specific language governing permissions and limitations
- *  under the License.
- *
- *
- */
-
-package org.apache.qpid.server.logging;
-
-import java.util.Arrays;
-import java.util.List;
-
-import junit.framework.AssertionFailedError;
-
-/**
- * Virtualhost Test Cases
- * The virtualhost test suite validates that the follow log messages as 
specified in the Functional Specification.
- * <p/>
- * This suite of tests validate that the management console messages occur 
correctly and according to the following format:
- * <p/>
- * VHT-1001 : Created : <name>
- * VHT-1002 : Work directory : <path>
- * VHT-1003 : Closed
- */
-public class VirtualHostLoggingTest extends AbstractTestLogging
-{
-    private static final String VHT_PREFIX = "VHT-";
-
-    /**
-     * Description:
-     * Testing can be performed using the default configuration. The goal is 
to validate that for each virtualhost defined in the configuration file a 
VHT-1001 Created message is provided.
-     * Input:
-     * The default configuration file
-     * Output:
-     * <p/>
-     * <date> VHT-1001 : Created : <name>
-     * Validation Steps:
-     * <p/>
-     * The VHT ID is correct
-     * A VHT-1001 is printed for each virtualhost defined in the configuration 
file.
-     * This must be the first message for the specified virtualhost.
-     *
-     * @throws Exception caused by broker startup
-     */
-    public void testVirtualhostCreation() throws Exception
-    {
-        //Wait for the correct VHT message to arrive.                          
       
-        waitForMessage(VHT_PREFIX + "1001");
-        
-        //Validate each vhost logs a creation
-        List<String> results = findMatches(VHT_PREFIX + "1001");
-        
-        try
-        {
-            List<String> vhosts = Arrays.asList("test");
-
-            assertEquals("Each vhost did not create a store.", vhosts.size(), 
results.size());
-
-            for (int index = 0; index < results.size(); index++)
-            {
-                // Retrieve the vhostname from the log entry message 'Created 
: <vhostname>'
-                String result = getLogMessage(results, index);
-                String vhostName = 
getMessageString(fromMessage(result)).split(" ")[2];
-
-                assertTrue("Virtualhost named in log not found in config 
file:" + vhostName + ":" + vhosts, vhosts.contains(vhostName));
-            }
-        }
-        catch (AssertionFailedError afe)
-        {
-            dumpLogs(results, _monitor);
-
-            throw afe;
-        }
-    }
-
-    /**
-     * Description:
-     * Testing can be performed using the default configuration. During broker 
shutdown a VHT-1002 Closed message will be printed for each of the configured 
virtualhosts. For every virtualhost that was started a close must be logged. 
After the close message has been printed no further logging will be performed 
by this virtualhost.
-     * Input:
-     * The default configuration file
-     * Output:
-     * <p/>
-     * <date> VHT-1002 : Closed
-     * Validation Steps:
-     * <p/>
-     * The VHT ID is correct
-     * This is the last VHT message for the given virtualhost.
-     *
-     * @throws Exception caused by broker startup
-     */
-    public void testVirtualhostClosure() throws Exception
-    {
-        if (isJavaBroker() && isInternalBroker())
-        {
-            stopDefaultBroker();
-
-            // Wait for the correct VHT message to arrive.
-            waitForMessage(VHT_PREFIX + "1002");
-
-            // Validate each vhost logs a closure
-            List<String> results = findMatches(VHT_PREFIX + "1002");
-
-            try
-            {
-                assertEquals("Each vhost did not close their store.", 1, 
results.size());
-            }
-            catch (AssertionFailedError afe)
-            {
-                dumpLogs(results, _monitor);
-                throw afe;
-            }
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/systests/src/test/java/org/apache/qpid/util/LogMonitor.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/util/LogMonitor.java 
b/systests/src/test/java/org/apache/qpid/util/LogMonitor.java
deleted file mode 100644
index 2203694..0000000
--- a/systests/src/test/java/org/apache/qpid/util/LogMonitor.java
+++ /dev/null
@@ -1,310 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import java.io.BufferedReader;
-import java.io.File;
-import java.io.FileNotFoundException;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.LineNumberReader;
-import java.util.HashMap;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-
-/**
- * Utility to simplify the monitoring of the output of a log file
- */
-public class LogMonitor
-{
-    private static final Logger LOGGER = 
LoggerFactory.getLogger(LogMonitor.class);
-
-    // The file that the log statements will be written to.
-    private final File _logfile;
-
-    private int _linesToSkip = 0;
-
-    /**
-     * Create a new LogMonitor on the specified file if the file does not exist
-     * or the value is null then a new Log4j appender will be added and
-     * monitoring set up on that appender.
-     *
-     * NOTE: for the appender to receive any value the RootLogger will need to
-     * have the level correctly configured.ng
-     *
-     * @param file the file to monitor
-     */
-    public LogMonitor(File file)
-    {
-        if (file != null)
-        {
-            if (file.exists())
-            {
-                _logfile = file;
-            }
-            else
-            {
-                throw new IllegalArgumentException("File to be monitored does 
not exist.");
-            }
-        }
-        else
-        {
-            throw new IllegalArgumentException("File to be monitored is not 
specified.");
-        }
-
-        LOGGER.info("Created LogMonitor. Monitoring file: " + 
_logfile.getAbsolutePath());
-    }
-
-    /**
-     * Checks the log file for a given message to appear and returns all
-     * instances of that appearance.
-     *
-     * @param message the message to wait for in the log
-     * @param wait    the time in ms to wait for the message to occur
-     * @return true if the message was found
-     *
-     * @throws java.io.FileNotFoundException if the Log file can no longer be 
found
-     * @throws IOException                   thrown when reading the log file
-     */
-    public List<String> waitAndFindMatches(String message, long wait)
-            throws FileNotFoundException, IOException
-    {
-        if (waitForMessage(message, wait))
-        {
-            return findMatches(message);
-        }
-        else
-        {
-            return new LinkedList<String>();
-        }
-    }
-
-    /**
-     * Checks the log for instances of the search string. If the caller
-     * has previously called {@link #markDiscardPoint()}, lines up until the 
discard
-     * point are not considered.
-     *
-     * The pattern parameter can take any valid argument used in 
String.contains()
-     *
-     * {@see String.contains(CharSequences)}
-     *
-     * @param pattern the search string
-     *
-     * @return a list of matching lines from the log
-     *
-     * @throws IOException if there is a problem with the file
-     */
-    public List<String> findMatches(String pattern) throws IOException
-    {
-
-        List<String> results = new LinkedList<String>();
-
-        LineNumberReader reader = new LineNumberReader(new 
FileReader(_logfile));
-        try
-        {
-            while (reader.ready())
-            {
-                String line = reader.readLine();
-                if (reader.getLineNumber()  > _linesToSkip && 
line.contains(pattern))
-                {
-                    results.add(line);
-                }
-            }
-        }
-        finally
-        {
-            reader.close();
-        }
-
-        return results;
-    }
-
-    public Map<String, List<String>> findMatches(String... pattern) throws 
IOException
-    {
-
-        Map<String, List<String>> results= new HashMap<String, List<String>>();
-        for (String p : pattern)
-        {
-            results.put(p, new LinkedList<String>());
-        }
-        LineNumberReader reader = new LineNumberReader(new 
FileReader(_logfile));
-        try
-        {
-            while (reader.ready())
-            {
-                String line = reader.readLine();
-                if (reader.getLineNumber()  > _linesToSkip)
-                {
-                    for (String p : pattern)
-                    {
-                        if (line.contains(p))
-                        {
-                            results.get(p).add(line);
-                        }
-                    }
-                }
-            }
-        }
-        finally
-        {
-            reader.close();
-        }
-
-        return results;
-    }
-    /**
-     * Checks the log file for a given message to appear.  If the caller
-     * has previously called {@link #markDiscardPoint()}, lines up until the 
discard
-     * point are not considered.
-     *
-     * @param message the message to wait for in the log
-     * @param wait    the time in ms to wait for the message to occur
-     * @return true if the message was found
-     *
-     * @throws java.io.FileNotFoundException if the Log file can no longer be 
found
-     * @throws IOException                   thrown when reading the log file
-     */
-    public boolean waitForMessage(String message, long wait)
-            throws FileNotFoundException, IOException
-    {
-        // Loop through alerts until we're done or wait ms seconds have passed,
-        // just in case the logfile takes a while to flush.
-        LineNumberReader reader = null;
-        try
-        {
-            reader = new LineNumberReader(new FileReader(_logfile));
-
-            boolean found = false;
-            long endtime = System.currentTimeMillis() + wait;
-            while (!found && System.currentTimeMillis() < endtime)
-            {
-                boolean ready = true;
-                while (ready = reader.ready())
-                {
-                    String line = reader.readLine();
-
-                    if (reader.getLineNumber() > _linesToSkip)
-                    {
-                        if (line.contains(message))
-                        {
-                            found = true;
-                            break;
-                        }
-                    }
-                }
-                if (!ready)
-                {
-                    try
-                    {
-                        Thread.sleep(50);
-                    }
-                    catch (InterruptedException ie)
-                    {
-                        Thread.currentThread().interrupt();
-                    }
-                }
-            }
-            return found;
-
-        }
-        finally
-        {
-            if (reader != null)
-            {
-                reader.close();
-            }
-        }
-    }
-    
-    /**
-     * Read the log file in to memory as a String
-     *
-     * @return the current contents of the log file
-     *
-     * @throws java.io.FileNotFoundException if the Log file can no longer be 
found
-     * @throws IOException                   thrown when reading the log file
-     */
-    public String readFile() throws FileNotFoundException, IOException
-    {
-        return FileUtils.readFileAsString(_logfile);
-    }
-
-    /**
-     * Return a File reference to the monitored file
-     *
-     * @return the file being monitored
-     */
-    public File getMonitoredFile()
-    {
-        return _logfile;
-    }
-
-    /**
-     * Marks the discard point in the log file.
-     *
-     * @throws java.io.FileNotFoundException if the Log file can no longer be 
found
-     * @throws IOException                   thrown if there is a problem with 
the log file
-     */
-    public void markDiscardPoint() throws FileNotFoundException, IOException
-    {
-        _linesToSkip = countLinesInFile();
-    }
-
-    private int countLinesInFile() throws IOException
-    {
-        int lineCount = 0;
-        BufferedReader br = null;
-        try
-        {
-            br = new BufferedReader(new FileReader(_logfile));
-            while(br.readLine() != null)
-            {
-                lineCount++;
-            }
-
-            return lineCount;
-        }
-        finally
-        {
-            if (br != null)
-            {
-                br.close();
-            }
-        }
-    }
-
-    /**
-     * Stop monitoring this file.
-     *
-     * This is required to be called incase we added a new logger.
-     *
-     * If we don't call close then the new logger will continue to get log 
entries
-     * after our desired test has finished.
-     */
-    public void close()
-    {
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/systests/src/test/java/org/apache/qpid/util/LogMonitorTest.java
----------------------------------------------------------------------
diff --git a/systests/src/test/java/org/apache/qpid/util/LogMonitorTest.java 
b/systests/src/test/java/org/apache/qpid/util/LogMonitorTest.java
deleted file mode 100644
index 0b8b922..0000000
--- a/systests/src/test/java/org/apache/qpid/util/LogMonitorTest.java
+++ /dev/null
@@ -1,227 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- *
- */
-package org.apache.qpid.util;
-
-import org.apache.qpid.test.utils.QpidTestCase;
-import org.apache.qpid.test.utils.TestFileUtils;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.List;
-
-public class LogMonitorTest extends QpidTestCase
-{
-
-    private LogMonitor _monitor;
-    private File _testFile;
-
-    @Override
-    public void setUp() throws Exception
-    {
-        super.setUp();
-        _testFile = TestFileUtils.createTempFile(this);
-        _monitor = new LogMonitor(_testFile);
-        _monitor.getMonitoredFile().deleteOnExit(); // Make sure we clean up
-    }
-
-    @Override
-    protected void tearDown() throws Exception
-    {
-        super.tearDown();
-        _testFile.delete();
-    }
-
-    public void testMonitorNormalFile() throws IOException
-    {
-        assertEquals(_testFile, _monitor.getMonitoredFile());
-    }
-
-    public void testMonitorNullFileThrows()
-    {
-        try
-        {
-            new LogMonitor(null);
-            fail("It should not be possible to monitor null.");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // pass
-        }
-    }
-
-    public void testMonitorNonExistentFileThrows() throws IOException
-    {
-        assertTrue("Unable to delete file for our test", _testFile.delete());
-        assertFalse("Unable to test as our test file exists.", 
_testFile.exists());
-
-        try
-        {
-            new LogMonitor(_testFile);
-            fail("It should not be possible to monitor non existing file.");
-        }
-        catch (IllegalArgumentException e)
-        {
-            // pass
-        }
-    }
-
-    public void testFindMatches_Match() throws IOException
-    {
-        String message = getName() + ": Test Message";
-        appendTestMessage(message);
-        validateLogContainsMessage(_monitor, message);
-    }
-
-    public void testFindMatches_NoMatch() throws IOException
-    {
-        String message = getName() + ": Test Message";
-        String notLogged = "This text was not logged";
-        appendTestMessage(message);
-        validateLogDoesNotContainMessage(_monitor, notLogged);
-    }
-
-    public void testWaitForMessage_Timeout() throws IOException
-    {
-        String message = getName() + ": Test Message";
-
-        long TIME_OUT = 2000;
-
-        logMessageWithDelay(message, TIME_OUT);
-
-        // Verify that we can time out waiting for a message
-        assertFalse("Message was logged ",
-                    _monitor.waitForMessage(message, 100));
-
-        // Verify that the message did eventually get logged.
-        assertTrue("Message was never logged.",
-                    _monitor.waitForMessage(message, TIME_OUT * 2));
-    }
-
-    public void testDiscardPoint() throws IOException
-    {
-        String firstMessage = getName() + ": Test Message1";
-        appendTestMessage(firstMessage);
-
-        validateLogContainsMessage(_monitor, firstMessage);
-
-        _monitor.markDiscardPoint();
-
-        validateLogDoesNotContainMessage(_monitor, firstMessage);
-
-        String secondMessage = getName() + ": Test Message2";
-        appendTestMessage(secondMessage);
-        validateLogContainsMessage(_monitor, secondMessage);
-    }
-
-    public void testRead() throws IOException
-    {
-        String message = getName() + ": Test Message";
-        appendTestMessage(message);
-        String fileContents = _monitor.readFile();
-
-        assertTrue("Logged message not found when reading file.",
-                   fileContents.contains(message));
-    }
-
-    /****************** Helpers ******************/
-
-    /**
-     * Validate that the LogMonitor does not match the given string in the log
-     *
-     * @param log     The LogMonitor to check
-     * @param message The message to check for
-     *
-     * @throws IOException if a problems occurs
-     */
-    protected void validateLogDoesNotContainMessage(LogMonitor log, String 
message)
-            throws IOException
-    {
-        List<String> results = log.findMatches(message);
-
-        assertNotNull("Null results returned.", results);
-
-        assertEquals("Incorrect result set size", 0, results.size());
-    }
-
-    /**                                                                        
                                                                         
-     * Validate that the LogMonitor can match the given string in the log
-     *
-     * @param log     The LogMonitor to check
-     * @param message The message to check for
-     *
-     * @throws IOException if a problems occurs
-     */
-    protected void validateLogContainsMessage(LogMonitor log, String message)
-            throws IOException
-    {
-        List<String> results = log.findMatches(message);
-
-        assertNotNull("Null results returned.", results);
-
-        assertEquals("Incorrect result set size", 1, results.size());
-
-        assertTrue("Logged Message'" + message + "' not present in results:"
-                + results.get(0), results.get(0).contains(message));
-    }
-
-    /**
-     * Create a new thread to log the given message after the set delay
-     *
-     * @param message the messasge to log
-     * @param delay   the delay (ms) to wait before logging
-     */
-    private void logMessageWithDelay(final String message, final long delay)
-    {
-        new Thread(new Runnable()
-        {
-
-            @Override
-            public void run()
-            {
-                try
-                {
-                    Thread.sleep(delay);
-                }
-                catch (InterruptedException e)
-                {
-                    //ignore
-                }
-
-                appendTestMessage(message);
-            }
-        }).start();
-    }
-
-
-    private void appendTestMessage(String msg)
-    {
-        try (OutputStream outputStream = new FileOutputStream(_testFile, true))
-        {
-            outputStream.write(String.format("%s%n", msg).getBytes());
-        }
-        catch (IOException e)
-        {
-            fail("Cannot write to test file '" + _testFile.getAbsolutePath() + 
"'");
-        }
-    }
-}

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/test-profiles/Java010Excludes
----------------------------------------------------------------------
diff --git a/test-profiles/Java010Excludes b/test-profiles/Java010Excludes
index e72790c..aff6fb5 100755
--- a/test-profiles/Java010Excludes
+++ b/test-profiles/Java010Excludes
@@ -17,10 +17,6 @@
 // under the License.
 //
 
-// 0-10 and 0-9 connections dont generate the exact same logging due to 
protocol differences
-org.apache.qpid.server.logging.ChannelLoggingTest#testChannelStartsFlowStopped
-org.apache.qpid.server.logging.ChannelLoggingTest#testChannelStartConsumerFlowStarted
-
 // QPID-3432: These tests test the behaviour of 0-8..-0-9-1 specific system 
property (amqj.default_syncwrite_timeout)
 org.apache.qpid.test.client.timeouts.SyncWaitTimeoutDelayTest#*
 org.apache.qpid.test.client.timeouts.SyncWaitDelayTest#*

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/test-profiles/Java10Excludes
----------------------------------------------------------------------
diff --git a/test-profiles/Java10Excludes b/test-profiles/Java10Excludes
index 3265d94..72d3d31 100644
--- a/test-profiles/Java10Excludes
+++ b/test-profiles/Java10Excludes
@@ -17,23 +17,9 @@
 // under the License.
 //
 
-// The binding logging tests focus on the behaviour of the old client with 
regard to creating (and binding) queues on
-// the creation of consumers.
-org.apache.qpid.server.logging.BindingLoggingTest#*
-
-// These tests are 0-8/9/9-1 specific and are also excluded in the 0-10 profile
-org.apache.qpid.server.logging.ChannelLoggingTest#testChannelStartsFlowStopped
-org.apache.qpid.server.logging.ChannelLoggingTest#testChannelStartConsumerFlowStarted
-// This test is testing AMQP 0-x specific behaviour
-org.apache.qpid.server.logging.ChannelLoggingTest#testChannelClosedOnExclusiveQueueDeclaredOnDifferentSession
-
 // Tests the interaction between the Broker's supported protocols and what the 
0-x client agrees to
 org.apache.qpid.server.SupportedProtocolVersionsTest#*
 
-// Durable topic subscriptions will be reimplemented with the shared topic 
subscriptions (QPID-7569)
-org.apache.qpid.server.logging.ConsumerLoggingTest#testSubscriptionCreateDurable
-org.apache.qpid.server.logging.ConsumerLoggingTest#testSubscriptionCreateDurableWithArguments
-
 // These tests assume names of queues backing durable subscriptions
 
org.apache.qpid.server.store.berkeleydb.BDBUpgradeTest#testConsumptionOfUpgradedMessages
 
org.apache.qpid.server.store.berkeleydb.BDBUpgradeTest#testDurableSubscriptionWithoutSelector
@@ -42,9 +28,4 @@ 
org.apache.qpid.server.store.berkeleydb.BDBUpgradeTest#testSelectorDurability
 // this test makes assumptions about the way the client uses sessions.
 org.apache.qpid.systest.rest.SessionRestTest#*
 
-// Tests verify the 0-x client's ability to create queues and that the server 
logs creation/deletion faithfully
-org.apache.qpid.server.logging.DurableQueueLoggingTest#*
-org.apache.qpid.server.logging.QueueLoggingTest#*
-org.apache.qpid.server.logging.TransientQueueLoggingTest#*
-
 

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/test-profiles/JavaPersistentExcludes
----------------------------------------------------------------------
diff --git a/test-profiles/JavaPersistentExcludes 
b/test-profiles/JavaPersistentExcludes
index 240f6dc..969b927 100644
--- a/test-profiles/JavaPersistentExcludes
+++ b/test-profiles/JavaPersistentExcludes
@@ -17,5 +17,3 @@
 // under the License.
 //
 
-//These tests require the MemoryMessageStore
-org.apache.qpid.server.logging.MemoryMessageStoreLoggingTest#*

http://git-wip-us.apache.org/repos/asf/qpid-broker-j/blob/b21a8f56/test-profiles/JavaPre010Excludes
----------------------------------------------------------------------
diff --git a/test-profiles/JavaPre010Excludes b/test-profiles/JavaPre010Excludes
index 7d3925e..61616c6 100644
--- a/test-profiles/JavaPre010Excludes
+++ b/test-profiles/JavaPre010Excludes
@@ -23,7 +23,6 @@
 
 // Those tests are written against the 0.10 path
 org.apache.qpid.client.SynchReceiveTest#testReceiveNoWait
-org.apache.qpid.server.logging.ChannelLoggingTest#testChannelClosedOnExclusiveQueueDeclaredOnDifferentSession
 
 # Exclude the JMS 2.0 test suite
 org.apache.qpid.systests.jms_2_0.*


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@qpid.apache.org
For additional commands, e-mail: commits-h...@qpid.apache.org

Reply via email to