qpid-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r..@apache.org
Subject svn commit: r447994 [17/46] - in /incubator/qpid/trunk/qpid: ./ cpp/ cpp/bin/ cpp/broker/ cpp/broker/inc/ cpp/broker/src/ cpp/broker/test/ cpp/client/ cpp/client/inc/ cpp/client/src/ cpp/client/test/ cpp/common/ cpp/common/concurrent/ cpp/common/concur...
Date Tue, 19 Sep 2006 22:07:25 GMT
Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/QueuePerfTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/QueuePerfTest.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/QueuePerfTest.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/QueuePerfTest.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,255 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.queue;
+
+import org.apache.qpid.server.util.AveragedRun;
+import org.apache.qpid.server.util.TimedRun;
+import org.apache.qpid.server.util.RunStats;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Queue;
+import java.util.concurrent.ConcurrentLinkedQueue;
+
+public class QueuePerfTest extends TimedRun
+{
+    private final Factory _factory;
+    private final int _queueCount;
+    private final int _messages;
+    private final String _msg = "";
+    private List<Queue<String>> _queues;
+
+    QueuePerfTest(Factory factory, int queueCount, int messages)
+    {
+        super(factory + ", " + queueCount + ", " + messages);
+        _factory = factory;
+        _queueCount = queueCount;
+        _messages = messages;
+    }
+
+    protected void setup() throws Exception
+    {
+        //init
+        int count = Integer.getInteger("prepopulate", 0);
+//        System.err.println("Prepopulating with " + count + " items");
+        _queues = new ArrayList<Queue<String>>(_queueCount);
+        for (int i = 0; i < _queueCount; i++)
+        {
+            Queue<String> q = _factory.create();
+            for(int j = 0; j < count; ++j)
+            {
+                q.add("Item"+ j);
+            }
+            _queues.add(q);
+        }
+        System.gc();
+    }
+
+    protected void teardown() throws Exception
+    {
+        System.gc();
+    }
+
+    protected void run() throws Exception
+    {
+        //dispatch
+        for (int i = 0; i < _messages; i++)
+        {
+            for (Queue<String> q : _queues)
+            {
+                q.offer(_msg);
+                q.poll();
+            }
+        }
+    }
+
+    static interface Factory
+    {
+        Queue<String> create();
+    }
+
+    static Factory CONCURRENT = new Factory()
+    {
+        public Queue<String> create()
+        {
+            return new ConcurrentLinkedQueue<String>();
+        }
+
+        public String toString()
+        {
+            return "ConcurrentLinkedQueue";
+        }
+
+    };
+
+    static Factory SYNCHRONIZED = new Factory()
+    {
+        public Queue<String> create()
+        {
+            return new SynchronizedQueue<String>(new LinkedList<String>());
+        }
+
+
+        public String toString()
+        {
+            return "Synchronized LinkedList";
+        }
+    };
+
+    static Factory PLAIN = new Factory()
+    {
+        public Queue<String> create()
+        {
+            return new LinkedList<String>();
+        }
+
+        public String toString()
+        {
+            return "Plain LinkedList";
+        }
+    };
+
+    static class SynchronizedQueue<E> implements Queue<E>
+    {
+        private final Queue<E> queue;
+
+        SynchronizedQueue(Queue<E> queue)
+        {
+            this.queue = queue;
+        }
+
+        public synchronized E element()
+        {
+            return queue.element();
+        }
+
+        public synchronized boolean offer(E o)
+        {
+            return queue.offer(o);
+        }
+
+        public synchronized E peek()
+        {
+            return queue.peek();
+        }
+
+        public synchronized E poll()
+        {
+            return queue.poll();
+        }
+
+        public synchronized E remove()
+        {
+            return queue.remove();
+        }
+
+        public synchronized int size()
+        {
+            return queue.size();
+        }
+
+        public synchronized boolean isEmpty()
+        {
+            return queue.isEmpty();
+        }
+
+        public synchronized boolean contains(Object o)
+        {
+            return queue.contains(o);
+        }
+
+        public synchronized Iterator<E> iterator()
+        {
+            return queue.iterator();
+        }
+
+        public synchronized Object[] toArray()
+        {
+            return queue.toArray();
+        }
+
+        public synchronized <T>T[] toArray(T[] a)
+        {
+            return queue.toArray(a);
+        }
+
+        public synchronized boolean add(E o)
+        {
+            return queue.add(o);
+        }
+
+        public synchronized boolean remove(Object o)
+        {
+            return queue.remove(o);
+        }
+
+        public synchronized boolean containsAll(Collection<?> c)
+        {
+            return queue.containsAll(c);
+        }
+
+        public synchronized boolean addAll(Collection<? extends E> c)
+        {
+            return queue.addAll(c);
+        }
+
+        public synchronized boolean removeAll(Collection<?> c)
+        {
+            return queue.removeAll(c);
+        }
+
+        public synchronized boolean retainAll(Collection<?> c)
+        {
+            return queue.retainAll(c);
+        }
+
+        public synchronized void clear()
+        {
+            queue.clear();
+        }
+    }
+
+    static void run(String label, AveragedRun test) throws Exception
+    {
+        RunStats stats = test.call();
+        System.out.println((label == null ? "" : label + ", ") + test
+                + ", " + stats.getAverage() + ", " + stats.getMax() + ", " + stats.getMin());
+    }
+
+    public static void main(String[] argv) throws Exception
+    {
+        Factory[] factories = new Factory[]{PLAIN, SYNCHRONIZED, CONCURRENT};
+        int iterations = 5;
+        String label = argv.length > 0 ? argv[0]: null;
+        System.out.println((label == null ? "" : "Label, ") + "Queue Type, No. of Queues, No. of Operations, Avg Time, Min Time, Max Time");
+        //vary number of queues:
+
+        for(Factory f : factories)
+        {
+            run(label, new AveragedRun(new QueuePerfTest(f, 100, 10000), iterations));
+            run(label, new AveragedRun(new QueuePerfTest(f, 1000, 10000), iterations));
+            run(label, new AveragedRun(new QueuePerfTest(f, 10000, 10000), iterations));
+            run(label, new AveragedRun(new QueuePerfTest(f, 1000, 1000), iterations));
+            run(label, new AveragedRun(new QueuePerfTest(f, 1000, 100000), iterations));
+        }
+    }
+
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/QueuePerfTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SendPerfTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SendPerfTest.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SendPerfTest.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SendPerfTest.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,171 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.queue;
+
+import org.apache.qpid.AMQException;
+import org.apache.qpid.codec.AMQCodecFactory;
+import org.apache.qpid.framing.BasicPublishBody;
+import org.apache.qpid.framing.ContentBody;
+import org.apache.qpid.framing.ContentHeaderBody;
+import org.apache.qpid.framing.FieldTable;
+import org.apache.qpid.server.AMQChannel;
+import org.apache.qpid.server.exchange.AbstractExchange;
+import org.apache.qpid.server.exchange.Exchange;
+import org.apache.qpid.server.handler.OnCurrentThreadExecutor;
+import org.apache.qpid.server.protocol.AMQMinaProtocolSession;
+import org.apache.qpid.server.protocol.AMQProtocolSession;
+import org.apache.qpid.server.protocol.MockIoSession;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.registry.IApplicationRegistry;
+import org.apache.qpid.server.store.MessageStore;
+import org.apache.qpid.server.store.SkeletonMessageStore;
+import org.apache.qpid.server.util.AveragedRun;
+import org.apache.qpid.server.util.NullApplicationRegistry;
+import org.apache.qpid.server.util.TimedRun;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class SendPerfTest extends TimedRun
+{
+    private int _messages = 1000;
+    private int _clients = 10;
+    private List<AMQQueue> _queues;
+
+    public SendPerfTest(int clients, int messages)
+    {
+        super("SendPerfTest, msgs=" + messages + ", clients=" + clients);
+        _messages = messages;
+        _clients = clients;
+    }
+
+    protected void setup() throws Exception
+    {
+        _queues = initQueues(_clients);
+        System.gc();
+    }
+
+    protected void teardown() throws Exception
+    {
+        System.gc();
+    }
+
+    protected void run() throws Exception
+    {
+        deliver(_messages, _queues);
+    }
+
+    //have a dummy AMQProtocolSession that does nothing on the writeFrame()
+    //set up x number of queues
+    //create necessary bits and pieces to deliver a message
+    //deliver y messages to each queue
+
+    public static void main(String[] argv) throws Exception
+    {
+        ApplicationRegistry.initialise(new NullApplicationRegistry());
+        int clients = Integer.parseInt(argv[0]);
+        int messages = Integer.parseInt(argv[1]);
+        int iterations = Integer.parseInt(argv[2]);
+        AveragedRun test = new AveragedRun(new SendPerfTest(clients, messages), iterations);
+        test.run();
+    }
+
+    /**
+     * Delivers messages to a number of queues.
+     * @param count the number of messages to deliver
+     * @param queues the list of queues
+     * @throws NoConsumersException
+     */
+    static void deliver(int count, List<AMQQueue> queues) throws AMQException
+    {
+        BasicPublishBody publish = new BasicPublishBody();
+        publish.exchange = new NullExchange().getName();
+        ContentHeaderBody header = new ContentHeaderBody();
+        List<ContentBody> body = new ArrayList<ContentBody>();
+        MessageStore messageStore = new SkeletonMessageStore();
+        body.add(new ContentBody());
+        for (int i = 0; i < count; i++)
+        {
+            for (AMQQueue q : queues)
+            {
+                q.deliver(new AMQMessage(messageStore, i, publish, header, body));
+            }
+        }
+    }
+
+    static List<AMQQueue> initQueues(int number) throws AMQException
+    {
+        Exchange exchange = new NullExchange();
+        List<AMQQueue> queues = new ArrayList<AMQQueue>(number);
+        for (int i = 0; i < number; i++)
+        {
+            AMQQueue q = createQueue("Queue" + (i + 1));
+            q.bind("routingKey", exchange);
+            try
+            {
+                q.registerProtocolSession(createSession(), 1, "1", false);
+            }
+            catch (Exception e)
+            {
+                throw new AMQException("Error creating protocol session: " + e, e);
+            }
+            queues.add(q);
+        }
+        return queues;
+    }
+
+    static AMQQueue createQueue(String name) throws AMQException
+    {
+        return new AMQQueue(name, false, null, false, ApplicationRegistry.getInstance().getQueueRegistry(),
+                new OnCurrentThreadExecutor());
+    }
+
+    static AMQProtocolSession createSession() throws Exception
+    {
+        IApplicationRegistry reg = ApplicationRegistry.getInstance();
+        AMQCodecFactory codecFactory = new AMQCodecFactory(true);
+        AMQMinaProtocolSession result = new AMQMinaProtocolSession(new MockIoSession(), reg.getQueueRegistry(), reg.getExchangeRegistry(), codecFactory);
+        result.addChannel(new AMQChannel(1, null, null));
+        return result;
+    }
+
+    static class NullExchange extends AbstractExchange
+    {
+        public String getName()
+        {
+            return "NullExchange";
+        }
+
+        protected ExchangeMBean createMBean()
+        {
+            return null;
+        }
+
+        public void registerQueue(String routingKey, AMQQueue queue, FieldTable args) throws AMQException
+        {
+        }
+
+        public void deregisterQueue(String routingKey, AMQQueue queue) throws AMQException
+        {
+        }
+
+        public void route(AMQMessage payload) throws AMQException
+        {
+        }
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SendPerfTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SubscriptionManagerTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SubscriptionManagerTest.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SubscriptionManagerTest.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SubscriptionManagerTest.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,105 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.queue;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+import org.junit.Test;
+import junit.framework.JUnit4TestAdapter;
+
+public class SubscriptionManagerTest
+{
+    private final SubscriptionSet mgr = new SubscriptionSet();
+
+    @Test
+    public void basicSubscriptionManagement()
+    {
+        assertTrue(mgr.isEmpty());
+        assertFalse(mgr.hasActiveSubscribers());
+        TestSubscription s1 = new TestSubscription("S1");
+        mgr.addSubscriber(s1);
+        assertFalse(mgr.isEmpty());
+        assertTrue(mgr.hasActiveSubscribers());
+
+        TestSubscription s2 = new TestSubscription("S2");
+        mgr.addSubscriber(s2);
+
+        s2.setSuspended(true);
+        assertFalse(mgr.isEmpty());
+        assertTrue(mgr.hasActiveSubscribers());
+        assertTrue(s2.isSuspended());
+        assertFalse(s1.isSuspended());
+
+        s1.setSuspended(true);
+        assertFalse(mgr.hasActiveSubscribers());
+
+        mgr.removeSubscriber(new TestSubscription("S1"));
+        assertFalse(mgr.isEmpty());
+        mgr.removeSubscriber(new TestSubscription("S2"));
+        assertTrue(mgr.isEmpty());
+    }
+
+    @Test
+    public void roundRobin()
+    {
+        TestSubscription a = new TestSubscription("A");
+        TestSubscription b = new TestSubscription("B");
+        TestSubscription c = new TestSubscription("C");
+        TestSubscription d = new TestSubscription("D");
+        mgr.addSubscriber(a);
+        mgr.addSubscriber(b);
+        mgr.addSubscriber(c);
+        mgr.addSubscriber(d);
+
+        for (int i = 0; i < 3; i++)
+        {
+            assertEquals(a, mgr.nextSubscriber(null));
+            assertEquals(b, mgr.nextSubscriber(null));
+            assertEquals(c, mgr.nextSubscriber(null));
+            assertEquals(d, mgr.nextSubscriber(null));
+        }
+
+        c.setSuspended(true);
+
+        for (int i = 0; i < 3; i++)
+        {
+            assertEquals(a, mgr.nextSubscriber(null));
+            assertEquals(b, mgr.nextSubscriber(null));
+            assertEquals(d, mgr.nextSubscriber(null));
+        }
+
+        mgr.removeSubscriber(a);
+        d.setSuspended(true);
+        c.setSuspended(false);
+        Subscription e = new TestSubscription("D");
+        mgr.addSubscriber(e);
+
+        for (int i = 0; i < 3; i++)
+        {
+            assertEquals(b, mgr.nextSubscriber(null));
+            assertEquals(c, mgr.nextSubscriber(null));
+            assertEquals(e, mgr.nextSubscriber(null));
+        }
+    }
+
+    public static junit.framework.Test suite()
+    {
+        return new JUnit4TestAdapter(SubscriptionManagerTest.class);
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SubscriptionManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SubscriptionSetTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SubscriptionSetTest.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SubscriptionSetTest.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SubscriptionSetTest.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,149 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.queue;
+
+import junit.framework.JUnit4TestAdapter;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import org.junit.Test;
+
+public class SubscriptionSetTest
+{
+    /**
+     * A SubscriptionSet that counts the number of items scanned.
+     */
+    static class TestSubscriptionSet extends SubscriptionSet
+    {
+        private int scanned = 0;
+
+        void resetScanned()
+        {
+            scanned = 0;
+        }
+
+        protected void subscriberScanned()
+        {
+            ++scanned;
+        }
+
+        int getScanned()
+        {
+            return scanned;
+        }
+    }
+
+    final TestSubscription sub1 = new TestSubscription("1");
+    final TestSubscription sub2 = new TestSubscription("2");
+    final TestSubscription sub3 = new TestSubscription("3");
+
+    final TestSubscription suspendedSub1 = new TestSubscription("sus1", true);
+    final TestSubscription suspendedSub2 = new TestSubscription("sus2", true);
+    final TestSubscription suspendedSub3 = new TestSubscription("sus3", true);
+
+    @Test
+    public void nextMessage()
+    {
+        SubscriptionSet ss = new SubscriptionSet();
+        assertNull(ss.nextSubscriber(null));
+        assertEquals(0, ss.getCurrentSubscriber());
+
+        ss.addSubscriber(sub1);
+        assertEquals(sub1, ss.nextSubscriber(null));
+        assertEquals(1, ss.getCurrentSubscriber());
+        assertEquals(sub1, ss.nextSubscriber(null));
+        assertEquals(1, ss.getCurrentSubscriber());
+
+        ss.addSubscriber(sub2);
+        ss.addSubscriber(sub3);
+
+        assertEquals(sub2, ss.nextSubscriber(null));
+        assertEquals(2, ss.getCurrentSubscriber());
+
+        assertEquals(sub3, ss.nextSubscriber(null));
+        assertEquals(3, ss.getCurrentSubscriber());
+    }
+
+    @Test
+    public void nextMessageWhenAllSuspended()
+    {
+        SubscriptionSet ss = createAllSuspendedSubscriptionSet();
+        assertNull(ss.nextSubscriber(null));
+        assertEquals(3, ss.getCurrentSubscriber());
+
+        assertNull(ss.nextSubscriber(null));
+        assertEquals(3, ss.getCurrentSubscriber());
+    }
+
+    private TestSubscriptionSet createAllSuspendedSubscriptionSet()
+    {
+        TestSubscriptionSet ss = new TestSubscriptionSet();
+        ss.addSubscriber(suspendedSub1);
+        ss.addSubscriber(suspendedSub2);
+        ss.addSubscriber(suspendedSub3);
+        return ss;
+    }
+
+    @Test
+    public void nextMessageAfterRemove()
+    {
+        SubscriptionSet ss = new SubscriptionSet();
+        ss.addSubscriber(suspendedSub1);
+        ss.addSubscriber(suspendedSub2);
+        ss.addSubscriber(sub3);
+        assertEquals(sub3, ss.nextSubscriber(null));
+        assertEquals(3, ss.getCurrentSubscriber());
+
+        assertEquals(suspendedSub1, ss.removeSubscriber(suspendedSub1));
+
+        assertEquals(sub3, ss.nextSubscriber(null)); // Current implementation handles OutOfBoundsException here.
+        assertEquals(2, ss.getCurrentSubscriber());
+    }
+
+    @Test
+    public void nextMessageOverScanning()
+    {
+        TestSubscriptionSet ss = new TestSubscriptionSet();
+        TestSubscription sub = new TestSubscription("test");
+        ss.addSubscriber(suspendedSub1);
+        ss.addSubscriber(sub);
+        ss.addSubscriber(suspendedSub3);
+        assertEquals(sub, ss.nextSubscriber(null));
+        assertEquals(2, ss.getCurrentSubscriber());
+        assertEquals(2, ss.getScanned());
+
+        ss.resetScanned();
+        sub.setSuspended(true);
+        assertNull(ss.nextSubscriber(null));
+        assertEquals(3, ss.getCurrentSubscriber());
+         // Current implementation overscans by one item here.
+        assertEquals(ss.size() + 1, ss.getScanned());
+    }
+
+    @Test
+    public void nextMessageOverscanWorstCase() {
+        TestSubscriptionSet ss = createAllSuspendedSubscriptionSet();
+        ss.nextSubscriber(null);
+        // Scans the subscriptions twice.
+        assertEquals(ss.size() * 2, ss.getScanned());
+    }
+
+    public static junit.framework.Test suite()
+    {
+        return new JUnit4TestAdapter(SubscriptionSetTest.class);
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/SubscriptionSetTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/TestSubscription.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/TestSubscription.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/TestSubscription.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/TestSubscription.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,84 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.queue;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class TestSubscription implements Subscription
+{
+    private final List<AMQMessage> messages;
+    private final Object key;
+    private boolean isSuspended;
+
+    public TestSubscription(Object key)
+    {
+        this(key, new ArrayList<AMQMessage>());
+    }
+
+    public TestSubscription(final Object key, final boolean isSuspended)
+    {
+        this(key);
+        setSuspended(isSuspended);
+    }
+
+    TestSubscription(Object key, List<AMQMessage> messages)
+    {
+        this.key = key;
+        this.messages = messages;
+    }
+
+    List<AMQMessage> getMessages()
+    {
+        return messages;
+    }
+
+    public void send(AMQMessage msg, AMQQueue queue)
+    {
+        messages.add(msg);
+    }
+
+    public void setSuspended(boolean suspended)
+    {
+        isSuspended = suspended;
+    }
+
+    public boolean isSuspended()
+    {
+        return isSuspended;
+    }
+
+    public void queueDeleted(AMQQueue queue)
+    {
+    }
+
+    public int hashCode()
+    {
+        return key.hashCode();
+    }
+
+    public boolean equals(Object o)
+    {
+        return o instanceof TestSubscription && ((TestSubscription) o).key.equals(key);
+    }
+
+    public String toString()
+    {
+        return key.toString();
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/TestSubscription.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/UnitTests.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/UnitTests.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/UnitTests.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/UnitTests.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,38 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.queue;
+
+import junit.framework.JUnit4TestAdapter;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+        AckTest.class,
+        DeliveryManagerTest.class,
+        SubscriptionManagerTest.class,
+        SubscriptionSetTest.class,
+        ConcurrencyTest.class}
+)
+public class UnitTests
+{
+    public static junit.framework.Test suite()
+    {
+        return new JUnit4TestAdapter(UnitTests.class);
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/queue/UnitTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/SkeletonMessageStore.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/SkeletonMessageStore.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/SkeletonMessageStore.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/SkeletonMessageStore.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,99 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.store;
+
+import org.apache.qpid.server.queue.AMQMessage;
+import org.apache.qpid.server.queue.AMQQueue;
+import org.apache.qpid.server.queue.QueueRegistry;
+import org.apache.qpid.AMQException;
+import org.apache.commons.configuration.Configuration;
+
+import java.util.List;
+import java.util.concurrent.atomic.AtomicLong;
+
+/**
+ * A message store that does nothing. Designed to be used in tests that do not want to use any message store
+ * functionality.
+ */
+public class SkeletonMessageStore implements MessageStore
+{
+    private final AtomicLong _messageId = new AtomicLong(1);
+
+    public void configure(String base, Configuration config) throws Exception
+    {
+    }
+
+    public void configure(QueueRegistry queueRegistry, String base, Configuration config) throws Exception
+    {
+    }
+
+    public void close() throws Exception
+    {
+    }
+
+    public void put(AMQMessage msg)
+    {
+    }
+
+    public void removeMessage(long messageId)
+    {
+    }
+
+    public void createQueue(AMQQueue queue) throws AMQException
+    {
+    }
+
+    public void removeQueue(String name) throws AMQException
+    {
+    }
+
+    public void enqueueMessage(String name, long messageId) throws AMQException
+    {
+    }
+
+    public void dequeueMessage(String name, long messageId) throws AMQException
+    {
+    }
+
+    public void beginTran() throws AMQException
+    {
+    }
+
+    public boolean inTran()
+    {
+        return false;
+    }
+    
+    public void commitTran() throws AMQException
+    {
+    }
+
+    public void abortTran() throws AMQException
+    {
+    }
+
+    public List<AMQQueue> createQueues() throws AMQException
+    {
+        return null;
+    }
+
+    public long getNewMessageId()
+    {
+        return _messageId.getAndIncrement();
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/SkeletonMessageStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/TestReferenceCounting.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/TestReferenceCounting.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/TestReferenceCounting.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/TestReferenceCounting.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,68 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.store;
+
+import junit.framework.JUnit4TestAdapter;
+import org.junit.Test;
+import org.junit.Assert;
+import org.junit.Before;
+import org.apache.qpid.server.queue.AMQMessage;
+import org.apache.qpid.AMQException;
+
+/**
+ * Tests that reference counting works correctly with AMQMessage and the message store
+ */
+public class TestReferenceCounting
+{
+    private TestableMemoryMessageStore _store;
+
+    @Before
+    public void createCommonObjects()
+    {
+        _store = new TestableMemoryMessageStore();
+    }
+
+    /**
+     * Check that when the reference count is decremented the message removes itself from the store
+     */
+    @Test
+    public void testMessageGetsRemoved() throws AMQException
+    {
+        AMQMessage message = new AMQMessage(_store, null);
+        _store.put(message);
+        Assert.assertTrue(_store.getMessageMap().size() == 1);
+        message.decrementReference();
+        Assert.assertTrue(_store.getMessageMap().size() == 0);
+    }
+
+    @Test
+    public void testMessageRemains() throws AMQException
+    {
+        AMQMessage message = new AMQMessage(_store, null);
+        _store.put(message);
+        Assert.assertTrue(_store.getMessageMap().size() == 1);
+        message.incrementReference();
+        message.decrementReference();
+        Assert.assertTrue(_store.getMessageMap().size() == 1);
+    }
+
+    public static junit.framework.Test suite()
+    {
+        return new JUnit4TestAdapter(TestReferenceCounting.class);
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/TestReferenceCounting.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/TestableMemoryMessageStore.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/TestableMemoryMessageStore.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/TestableMemoryMessageStore.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/TestableMemoryMessageStore.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,39 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.store;
+
+import org.apache.qpid.server.queue.AMQMessage;
+
+import java.util.concurrent.ConcurrentMap;
+import java.util.concurrent.ConcurrentHashMap;
+
+/**
+ * Adds some extra methods to the memory message store for testing purposes.
+ */
+public class TestableMemoryMessageStore extends MemoryMessageStore
+{
+    public TestableMemoryMessageStore()
+    {
+        _messageMap = new ConcurrentHashMap<Long, AMQMessage>();
+    }
+
+    public ConcurrentMap<Long, AMQMessage> getMessageMap()
+    {
+        return _messageMap;
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/TestableMemoryMessageStore.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/UnitTests.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/UnitTests.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/UnitTests.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/UnitTests.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,34 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.store;
+
+import junit.framework.JUnit4TestAdapter;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({
+        TestReferenceCounting.class
+})
+public class UnitTests
+{
+    public static junit.framework.Test suite()
+    {
+        return new JUnit4TestAdapter(UnitTests.class);
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/store/UnitTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/AveragedRun.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/AveragedRun.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/AveragedRun.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/AveragedRun.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,63 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+import org.apache.qpid.server.util.TimedRun;
+
+import java.util.concurrent.Callable;
+import java.util.Collection;
+
+public class AveragedRun implements Callable<RunStats>
+{
+    private final RunStats stats = new RunStats();
+    private final TimedRun test;
+    private final int iterations;
+
+    public AveragedRun(TimedRun test, int iterations)
+    {
+        this.test = test;
+        this.iterations = iterations;
+    }
+
+    public RunStats call() throws Exception
+    {
+        for (int i = 0; i < iterations; i++)
+        {
+            stats.record(test.call());
+        }
+        return stats;
+    }
+
+    public void run() throws Exception
+    {
+        System.out.println(test + ": " + call());
+    }
+
+    public String toString()
+    {
+        return test.toString();
+    }
+
+    static void run(Collection<AveragedRun> tests) throws Exception
+    {
+        for(AveragedRun test : tests)
+        {
+            test.run();
+        }
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/AveragedRun.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/ConcurrentTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/ConcurrentTest.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/ConcurrentTest.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/ConcurrentTest.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,76 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+public class ConcurrentTest extends TimedRun
+{
+    private final TimedRun _test;
+    private final Thread[] _threads;
+
+    public ConcurrentTest(TimedRun test, int threads)
+    {
+        super(test.toString());
+        _test = test;
+        _threads = new Thread[threads];
+    }
+
+    protected void setup() throws Exception
+    {
+        _test.setup();
+        for(int i = 0; i < _threads.length; i++)
+        {
+            _threads[i] = new Thread(new Runner());
+        }
+    }
+
+    protected void teardown() throws Exception
+    {
+        _test.teardown();
+    }
+
+    protected void run() throws Exception
+    {
+        for(Thread t : _threads)
+        {
+            t.start();
+        }
+        for(Thread t : _threads)
+        {
+            t.join();
+        }
+    }
+
+    private class Runner implements Runnable
+    {
+        private Exception error;
+
+        public void run()
+        {
+            try
+            {
+                _test.run();
+            }
+            catch(Exception e)
+            {
+                error = e;
+                e.printStackTrace();
+            }
+        }
+    }
+
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/ConcurrentTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/LoggingProxyTest.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/LoggingProxyTest.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/LoggingProxyTest.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/LoggingProxyTest.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,89 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+import junit.framework.JUnit4TestAdapter;
+import org.junit.Assert;
+import static org.junit.Assert.assertEquals;
+import org.junit.Test;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.List;
+
+public class LoggingProxyTest
+{
+    static interface IFoo {
+        void foo();
+        void foo(int i, Collection c);
+        String bar();
+        String bar(String s, List l);
+    }
+
+    static class Foo implements IFoo {
+        public void foo()
+        {
+        }
+
+        public void foo(int i, Collection c)
+        {
+        }
+
+        public String bar()
+        {
+            return null;
+        }
+
+        public String bar(String s, List l)
+        {
+            return "ha";
+        }
+    }
+
+    @Test
+    public void simple() {
+        LoggingProxy proxy = new LoggingProxy(new Foo(), 20);
+        IFoo foo = (IFoo)proxy.getProxy(IFoo.class);
+        foo.foo();
+        assertEquals(2, proxy.getBufferSize());
+        Assert.assertTrue(proxy.getBuffer().get(0).toString().matches(".*: foo\\(\\) entered$"));
+        Assert.assertTrue(proxy.getBuffer().get(1).toString().matches(".*: foo\\(\\) returned$"));
+
+        foo.foo(3, Arrays.asList(0, 1, 2));
+        assertEquals(4, proxy.getBufferSize());
+        Assert.assertTrue(proxy.getBuffer().get(2).toString().matches(".*: foo\\(\\[3, \\[0, 1, 2\\]\\]\\) entered$"));
+        Assert.assertTrue(proxy.getBuffer().get(3).toString().matches(".*: foo\\(\\) returned$"));
+
+        foo.bar();
+        assertEquals(6, proxy.getBufferSize());
+        Assert.assertTrue(proxy.getBuffer().get(4).toString().matches(".*: bar\\(\\) entered$"));
+        Assert.assertTrue(proxy.getBuffer().get(5).toString().matches(".*: bar\\(\\) returned null$"));
+
+        foo.bar("hello", Arrays.asList(1, 2, 3));
+        assertEquals(8, proxy.getBufferSize());
+        Assert.assertTrue(proxy.getBuffer().get(6).toString().matches(".*: bar\\(\\[hello, \\[1, 2, 3\\]\\]\\) entered$"));
+        Assert.assertTrue(proxy.getBuffer().get(7).toString().matches(".*: bar\\(\\) returned ha$"));
+
+        proxy.dump();
+    }
+
+    public static junit.framework.Test suite()
+    {
+        return new JUnit4TestAdapter(LoggingProxyTest.class);
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/LoggingProxyTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/NullApplicationRegistry.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/NullApplicationRegistry.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/NullApplicationRegistry.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/NullApplicationRegistry.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,103 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+import org.apache.qpid.server.exchange.DefaultExchangeFactory;
+import org.apache.qpid.server.exchange.DefaultExchangeRegistry;
+import org.apache.qpid.server.exchange.ExchangeFactory;
+import org.apache.qpid.server.exchange.ExchangeRegistry;
+import org.apache.qpid.server.management.ManagedObjectRegistry;
+import org.apache.qpid.server.management.NoopManagedObjectRegistry;
+import org.apache.qpid.server.queue.DefaultQueueRegistry;
+import org.apache.qpid.server.queue.QueueRegistry;
+import org.apache.qpid.server.registry.ApplicationRegistry;
+import org.apache.qpid.server.security.auth.AuthenticationManager;
+import org.apache.qpid.server.store.MessageStore;
+import org.apache.qpid.server.store.TestableMemoryMessageStore;
+import org.apache.commons.configuration.Configuration;
+import org.apache.commons.configuration.MapConfiguration;
+
+import java.util.HashMap;
+
+public class NullApplicationRegistry extends ApplicationRegistry
+{
+    private QueueRegistry _queueRegistry;
+
+    private ExchangeRegistry _exchangeRegistry;
+
+    private ExchangeFactory _exchangeFactory;
+
+    private ManagedObjectRegistry _managedObjectRegistry;
+
+    private AuthenticationManager _authenticationManager;
+
+    private MessageStore _messageStore;
+
+    public NullApplicationRegistry()
+    {
+        super(new MapConfiguration(new HashMap()));
+    }
+
+    public void initialise() throws Exception
+    {
+        _managedObjectRegistry = new NoopManagedObjectRegistry();
+        _queueRegistry = new DefaultQueueRegistry();
+        _exchangeFactory = new DefaultExchangeFactory();
+        _exchangeRegistry = new DefaultExchangeRegistry(_exchangeFactory);
+        _authenticationManager = new NullAuthenticationManager();
+        _messageStore = new TestableMemoryMessageStore();
+
+        _configuration.addProperty("heartbeat.delay", 10 * 60); // 10 minutes
+    }
+
+    public Configuration getConfiguration()
+    {
+        return _configuration;
+    }
+
+    public QueueRegistry getQueueRegistry()
+    {
+        return _queueRegistry;
+    }
+
+    public ExchangeRegistry getExchangeRegistry()
+    {
+        return _exchangeRegistry;
+    }
+
+    public ExchangeFactory getExchangeFactory()
+    {
+        return _exchangeFactory;
+    }
+
+    public ManagedObjectRegistry getManagedObjectRegistry()
+    {
+        return _managedObjectRegistry;
+    }
+
+    public AuthenticationManager getAuthenticationManager()
+    {
+        return _authenticationManager;
+    }
+
+    public MessageStore getMessageStore()
+    {
+        return _messageStore;
+    }
+}
+

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/NullApplicationRegistry.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/NullAuthenticationManager.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/NullAuthenticationManager.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/NullAuthenticationManager.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/NullAuthenticationManager.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,82 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+import org.apache.qpid.server.security.auth.AuthenticationManager;
+import org.apache.qpid.server.security.auth.AuthenticationResult;
+
+import javax.security.sasl.SaslException;
+import javax.security.sasl.SaslServer;
+
+public class NullAuthenticationManager implements AuthenticationManager
+{
+    public String getMechanisms()
+    {
+        return "PLAIN";
+    }
+
+    public SaslServer createSaslServer(String mechanism, String localFQDN) throws SaslException
+    {
+        return new SaslServer()
+        {
+            public String getMechanismName()
+            {
+                return "PLAIN";
+            }
+
+            public byte[] evaluateResponse(byte[] response) throws SaslException
+            {
+                return new byte[0];
+            }
+
+            public boolean isComplete()
+            {
+                return true;
+            }
+
+            public String getAuthorizationID()
+            {
+                return "guest";
+            }
+
+            public byte[] unwrap(byte[] incoming, int offset, int len) throws SaslException
+            {
+                return new byte[0];
+            }
+
+            public byte[] wrap(byte[] outgoing, int offset, int len) throws SaslException
+            {
+                return new byte[0];
+            }
+
+            public Object getNegotiatedProperty(String propName)
+            {
+                return null;
+            }
+
+            public void dispose() throws SaslException
+            {
+            }
+        };
+    }
+
+    public AuthenticationResult authenticate(SaslServer server, byte[] response)
+    {
+        return new AuthenticationResult(AuthenticationResult.AuthenticationStatus.SUCCESS);        
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/NullAuthenticationManager.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/RunStats.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/RunStats.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/RunStats.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/RunStats.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,54 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+public class RunStats
+{
+    private long min = Long.MAX_VALUE;
+    private long max;
+    private long total;
+    private int count;
+
+    public void record(long time)
+    {
+        max = Math.max(time, max);
+        min = Math.min(time, min);
+        total += time;
+        count++;
+    }
+
+    public long getMin()
+    {
+        return min;
+    }
+
+    public long getMax()
+    {
+        return max;
+    }
+
+    public long getAverage()
+    {
+       return total / count;
+    }
+
+    public String toString()
+    {
+        return "avg=" + getAverage() + ", min=" + min + ", max=" + max;
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/RunStats.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/TimedRun.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/TimedRun.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/TimedRun.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/TimedRun.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,49 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+import java.util.concurrent.Callable;
+
+public abstract class TimedRun implements Callable<Long>
+{
+    private final String description;
+
+    public TimedRun(String description)
+    {
+        this.description = description;
+    }
+
+    public Long call() throws Exception
+    {
+        setup();
+        long start = System.currentTimeMillis();
+        run();
+        long stop = System.currentTimeMillis();
+        teardown();
+        return stop - start;
+    }
+
+    public String toString()
+    {
+        return description;
+    }
+
+    protected void setup() throws Exception{}
+    protected void teardown() throws Exception{}
+    protected abstract void run() throws Exception;
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/TimedRun.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/UnitTests.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/UnitTests.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/UnitTests.java (added)
+++ incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/UnitTests.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,32 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.util;
+
+import junit.framework.JUnit4TestAdapter;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite;
+
+@RunWith(Suite.class)
+@Suite.SuiteClasses({LoggingProxyTest.class})
+public class UnitTests
+{
+    public static junit.framework.Test suite()
+    {
+        return new JUnit4TestAdapter(UnitTests.class);
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/broker/test/src/org/apache/qpid/server/util/UnitTests.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/build-old.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/build-old.xml?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/build-old.xml (added)
+++ incubator/qpid/trunk/qpid/java/build-old.xml Tue Sep 19 15:06:50 2006
@@ -0,0 +1,37 @@
+<!--
+ -
+ - Copyright (c) 2006 The Apache Software Foundation
+ -
+ - Licensed 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.
+ -
+ -->
+<project name="AMQ Java" default="build">
+
+  <macrodef name="iterate">
+    <attribute name="target"/>
+    <sequential>
+      <subant target="@{target}">
+        <filelist dir="." files="common,broker,client"/>
+      </subant>
+    </sequential>
+  </macrodef>
+
+  <target name="build">
+    <iterate target=""/>
+  </target>
+
+  <target name="clean">
+    <iterate target="clean"/>
+  </target>
+
+</project>

Propchange: incubator/qpid/trunk/qpid/java/build-old.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/build.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/build.xml?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/build.xml (added)
+++ incubator/qpid/trunk/qpid/java/build.xml Tue Sep 19 15:06:50 2006
@@ -0,0 +1,101 @@
+<!--
+ -
+ - Copyright (c) 2006 The Apache Software Foundation
+ -
+ - Licensed 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.
+ -
+ -->
+<project name="AMQ Java" default="build">
+
+  <import file="common.xml"/>
+
+  <property file="build.properties"/>
+  <property name="modules.extra" value=""/>
+  <property name="modules.client" value="common,client"/>
+  <property name="modules"
+            value="${modules.client},broker,broker/test,client/test,management/core,management/cli,cluster,${modules.extra}"/>
+
+  <macrodef name="iterate">
+    <attribute name="target"/>
+    <attribute name="modules" default="${modules}"/>
+    <element name="elements" implicit="true" optional="true"/>
+    <sequential>
+      <subant target="@{target}" antfile="build-module.xml">
+        <filelist dir="." files="@{modules}"/>
+        <elements/>
+      </subant>
+    </sequential>
+  </macrodef>
+
+  <target name="build" description="compile java source code for each module">
+    <iterate target="build"/>
+  </target>
+
+  <target name="test" description="execute unit tests">
+    <iterate target="test"/>
+  </target>
+
+  <target name="doc" description="produce javadoc for each module">
+    <iterate target="doc"/>
+  </target>
+
+  <target name="jar"
+          description="create java class file archives for each module">
+    <iterate target="jar"/>
+  </target>
+
+  <target name="dist"
+          description="copy each module's files into a single distribution tree">
+    <iterate target="dist"/>
+    <iterate target="dist-lib" modules="${modules.client}">
+      <property name="dist.dir" value="${dist.client.dir}"/>
+    </iterate>
+  </target>
+
+  <target name="clean" description="remove all build artifacts">
+    <iterate target="clean"/>
+    <delete dir="${build.dir}"/>
+  </target>
+
+  <property name="client.includes" value="*/client/**"/>
+
+  <target name="zip" depends="dist"
+          description="produce a zip archive of the distribution tree">
+    <zip basedir="${dist.root}" destfile="${build.zip}"/>
+    <zip basedir="${dist.root}" destfile="${client.zip}"
+         includes="${client.includes}"/>
+  </target>
+
+  <target name="tar" depends="dist"
+          description="produce a tar archive of the distribution tree">
+    <tar basedir="${dist.root}" destfile="${build.tar}"/>
+    <tar basedir="${dist.root}" destfile="${client.tar}"
+         includes="${client.includes}"/>
+  </target>
+
+  <target name="gzip" depends="tar"
+          description="produce a gzipped tarball of the distribution tree">
+    <gzip src="${build.tar}" destfile="${build.tgz}"/>
+    <gzip src="${client.tar}" destfile="${client.tgz}"/>
+  </target>
+
+  <target name="bzip2" depends="tar"
+          description="produze a bzipped tarball of the distribution tree">
+    <bzip2 src="${build.tar}" destfile="${build.bz2}"/>
+    <bzip2 src="${client.tar}" destfile="${client.bz2}"/>
+  </target>
+
+  <target name="archive" depends="zip,gzip,bzip2"
+          description="produce all archive formats of the distribution tree"/>
+
+</project>

Propchange: incubator/qpid/trunk/qpid/java/build.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/client/build-module.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/build-module.xml?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/build-module.xml (added)
+++ incubator/qpid/trunk/qpid/java/client/build-module.xml Tue Sep 19 15:06:50 2006
@@ -0,0 +1,21 @@
+<!--
+ -
+ - Copyright (c) 2006 The Apache Software Foundation
+ -
+ - Licensed 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.
+ -
+ -->
+<project name="AMQ Client" default="build">
+  <property name="module.depends" value="common"/>
+  <import file="../module.xml"/>
+</project>

Propchange: incubator/qpid/trunk/qpid/java/client/build-module.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/client/build-old.xml
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/build-old.xml?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/build-old.xml (added)
+++ incubator/qpid/trunk/qpid/java/client/build-old.xml Tue Sep 19 15:06:50 2006
@@ -0,0 +1,287 @@
+<?xml version="1.0"?>
+<!--
+ -
+ - Copyright (c) 2006 The Apache Software Foundation
+ -
+ - Licensed 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.
+ -
+ -->
+
+<!-- AMQP Java build file -->
+
+<project name="qpid-client" default="jar" basedir=".">
+    <property name="lib" value="${basedir}/lib"/>
+    <property name="common.dir" value="${basedir}/../common"/>
+    <property name="common.lib" value="${basedir}/../common/lib"/>
+    <property name="client.dir" value="${basedir}"/>
+    <property name="common.src" value="${common.dir}/src"/>
+    <property name="common.resources" value="${common.dir}/resources"/>
+    <property name="common.classes" value="${common.dir}/classes"/>
+    <property name="client.src" value="${client.dir}/src"/>
+    <property name="client.lib" value="${client.dir}/lib"/>
+    <property name="client.tests" value="${client.dir}/test"/>
+    <property name="client.classes" value="${client.dir}/classes"/>
+    <property name="client.testclasses" value="${client.dir}/testclasses"/>
+    <property name="generated.java.src" value="${common.dir}/generated/java"/>
+    <property name="broker.classes" value="${basedir}/../broker/classes"/>
+    <property name="broker.testclasses" value="${basedir}/../broker/testclasses"/>
+    <property name="dist" value="${basedir}/dist"/>
+
+    <!-- Setup details -->
+    <target name="init">
+        <tstamp>
+            <format property="release" pattern="-dMMMyy" locale="en" timezone="GMT"/>
+        </tstamp>
+
+        <mkdir dir="${common.classes}"/>
+        <mkdir dir="${client.classes}"/>
+        <mkdir dir="${client.testclasses}"/>
+    </target>
+
+    <path id="amqp.classpath">
+        <fileset dir="${basedir}/lib">
+            <include name="**/*.jar"/>
+        </fileset>
+        <fileset dir="${common.dir}/lib">
+            <include name="**/*.jar"/>
+        </fileset>
+        <pathelement path="${common.classes}"/>
+        <pathelement path="${client.classes}"/>
+        <pathelement path="${client.testclasses}/"/>
+        <pathelement path="${broker.classes}/"/>
+        <pathelement path="${broker.testclasses}/"/>
+    </path>
+
+    <path id="client.test.classpath">
+        <path refid="amqp.classpath"/>
+        <fileset dir="${basedir}/test/lib">
+            <include name="**/*.jar"/>
+        </fileset>
+    </path>
+
+    <!-- Remove all built files -->
+    <target name="clean" depends="init">
+        <delete dir="${common.classes}"/>
+        <delete dir="${client.classes}"/>
+        <delete dir="${client.testclasses}"/>
+    </target>
+
+    <!-- Compile Java -->
+    <target name="compile" depends="init, generate">
+        <javac destdir="${common.classes}" target="1.5" source="1.5" debug="on">
+            <classpath refid="amqp.classpath"/>
+            <src path="${common.src}"/>
+            <src path="${generated.java.src}"/>
+        </javac>
+
+        <javac destdir="${client.classes}" target="1.5" source="1.5" debug="on">
+            <classpath refid="amqp.classpath"/>
+            <src path="${client.src}"/>
+        </javac>
+
+        <copy todir="${common.classes}">
+            <!-- copy any non java src files into the build tree, e.g. log4j.properties -->
+            <fileset dir="${common.src}">
+                <exclude name="**/*.java"/>
+                <exclude name="**/package.html"/>
+            </fileset>
+            <fileset dir="${common.resources}">
+                <exclude name="**/*.java"/>
+                <exclude name="**/package.html"/>
+            </fileset>
+        </copy>
+
+        <copy todir="${client.classes}">
+            <!-- copy any non java src files into the build tree, e.g. log4j.properties -->
+            <fileset dir="${client.src}">
+                <exclude name="**/*.java"/>
+                <exclude name="**/package.html"/>
+            </fileset>
+        </copy>
+    </target>
+
+    <target name="compiletests" depends="compile">
+        <javac destdir="${client.testclasses}" target="1.5" source="1.5" classpathref="client.test.classpath" debug="on">
+            <src path="${client.tests}"/>
+        </javac>
+
+        <copy todir="${client.testclasses}">
+            <!-- copy any non java src files into the build tree, e.g. log4j.properties -->
+            <fileset dir="${client.tests}">
+                <exclude name="**/*.java"/>
+                <exclude name="**/package.html"/>
+            </fileset>
+        </copy>
+    </target>
+
+    <!-- Generate framing source code from protocol specification -->
+    <target name="generate" description="Generates framing source code from protocol specification">
+         <ant dir="../common" target="generate"/>
+    </target>
+
+    <!-- Build jar archive -->
+    <target name="jar" depends="compiletests">
+        <mkdir dir="${dist}"/>
+        <jar basedir="${common.classes}" jarfile="${dist}/amqp-common.jar"/>
+        <jar basedir="${client.classes}" jarfile="${dist}/amqp-jms.jar"/>
+        <jar basedir="${client.testclasses}" jarfile="${dist}/amqp-tests.jar"/>
+    </target>
+
+    <target name="dist" depends="compile">
+        <mkdir dir="${dist}"/>
+        <jar basedir="${common.classes}" jarfile="${dist}/amqp-common.jar"/>
+        <jar basedir="${client.classes}" jarfile="${dist}/amqp-jms.jar"/>
+    </target>
+
+    <target name="javadoc" depends="compile, compiletests">
+        <mkdir dir="${dist}/docs/api"/>
+        <javadoc sourcepath="${client.src}" destdir="${dist}/docs/api"
+                 packagenames="org.apache.qpid.*" classpathref="amqp.classpath" author="true"
+                 version="true" windowTitle="AMQP Client API" doctitle="AMQP Client API"
+                 footer="See &lt;a href=&quot;http://www.amqp.org&quot;&gt;www.amqp.org&lt;/a&gt; for more information."
+                 use="true" verbose="false"/>
+    </target>
+
+    <target name="ServiceProvidingClient" depends="compiletests">
+        <java fork="yes" classname="org.apache.qpid.requestreply1.ServiceProvidingClient">
+              <classpath refid="amqp.classpath"/>
+              <jvmarg value="-server"/>
+              <sysproperty key="amqj.logging.level" value="INFO"/>
+              <sysproperty key="amqj.server.shared_read_write_pool" value="true"/>
+              <arg value="localhost:5672"/>
+              <arg value="guest"/>
+              <arg value="guest"/>
+              <arg value="/vpath"/>
+              <arg value="serviceQ1"/>
+        </java>
+    </target>
+
+     <target name="ServiceRequestingClient" depends="compiletests">
+        <java fork="yes" classname="org.apache.qpid.requestreply1.ServiceRequestingClient">
+              <classpath refid="amqp.classpath"/>
+              <jvmarg value="-server"/>
+              <sysproperty key="amqj.logging.level" value="INFO"/>
+              <sysproperty key="amqj.server.shared_read_write_pool" value="true"/>
+              <arg value="localhost:5672"/>
+              <arg value="guest"/>
+              <arg value="guest"/>
+              <arg value="/vpath"/>
+              <arg value="serviceQ1"/>
+              <arg value="5000"/>
+              <arg value="512"/>
+        </java>
+    </target>
+
+    <target name="HeadersListener" depends="compiletests">
+        <java fork="yes" classname="org.apache.qpid.headers.Listener">
+              <classpath refid="amqp.classpath"/>
+              <jvmarg value="-server"/>
+              <sysproperty key="amqj.logging.level" value="INFO"/>
+              <sysproperty key="amqj.server.shared_read_write_pool" value="true"/>
+        </java>
+    </target>
+
+    <target name="HeadersPublisher" depends="compiletests">
+        <java fork="yes" classname="org.apache.qpid.headers.Publisher">
+              <classpath refid="amqp.classpath"/>
+              <jvmarg value="-server"/>
+              <sysproperty key="amqj.logging.level" value="INFO"/>
+              <sysproperty key="amqj.server.shared_read_write_pool" value="true"/>
+              <arg value="5000"/>
+              <arg value="1"/>
+        </java>
+    </target>
+
+    <target name="profile" depends="compile" description="Profile Project">
+        <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
+        <nbprofiledirect>
+          <classpath refid="amqp.classpath"/>
+        </nbprofiledirect>
+        <java fork="true" classname="org.apache.qpid.requestreply1.VmRequestReply"
+              dir="${profiler.session.working.dir}"
+              jvm="${profiler.info.jvm}">
+          <jvmarg line="${profiler.info.jvmargs}"/>
+          <env key="Path" path="${profiler.info.agentpath}:${env.Path}"/>
+          <classpath refid="amqp.classpath"/>
+          <jvmarg value="${profiler.info.jvmargs.agent}"/>
+          <jvmarg line="${profiler.info.jvmargs}"/>
+          <jvmarg value="-server"/>
+          <jvmarg value="-Damqj.logging.level=INFO"/>
+          <sysproperty key="amqj.shared_read_write_pool" value="true"/>
+          <arg value="localhost:5672"/>
+          <arg value="guest"/>
+          <arg value="guest"/>
+          <arg value="/vpath"/>
+          <arg value="serviceQ1"/>
+          <arg value="5000"/>
+          <arg value="512"/>
+        </java>
+    </target>
+
+    <target name="profile-single" depends="compile" description="Profile File">
+        <fail unless="netbeans.home">This target can only run inside the NetBeans IDE.</fail>
+        <nbprofile classname="${profile.class}">
+            <classpath refid="amqp.classpath"/>
+        </nbprofile>
+    </target>
+
+    <target name="release" depends="jar" description="Create a release package">
+            <!-- create a jar file that will contain classpath entries for all required jars -->
+            <jar jarfile="${dist}/amqj.jar">
+                <manifest>
+                    <attribute name="Class-Path" value="lib/jms.jar lib/slf4j-simple.jar lib/log4j-1.2.13.jar lib/mina-core-0.9.5-SNAPSHOT.jar lib/mina-filter-ssl-0.9.5-SNAPSHOT.jar lib/commons-cli-1.0.jar lib/commons-configuration-1.2.jar lib/commons-collections-3.1.jar lib/commons-logging-api.jar lib/commons-logging.jar lib/commons-lang-2.1.jar lib/junit-4.0.jar lib/amqp-tests.jar lib/amqp-common.jar lib/amqp-jms.jar"/>
+                </manifest>
+            </jar>
+            <!-- create a zip for releasing -->
+            <zip destfile="${dist}/client.zip">
+                <zipfileset dir="bin" includes="*.sh,*.bat" filemode="755"/>
+                <zipfileset file="${dist}/amqj.jar" />
+                <zipfileset prefix="lib" file="${client.lib}/jms/jms.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/slf4j/slf4j-simple.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/logging-log4j/log4j-1.2.13.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/mina/mina-core-0.9.5-SNAPSHOT.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/mina/mina-filter-ssl-0.9.5-SNAPSHOT.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/commons-cli/commons-cli-1.0.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/commons-configuration/commons-configuration-1.2.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/commons-collections/commons-collections-3.1.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/commons-logging/commons-logging-api.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/commons-logging/commons-logging.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/commons-lang/commons-lang-2.1.jar"/>
+                <zipfileset prefix="lib" file="${common.lib}/junit/junit-4.0.jar"/>
+                <zipfileset prefix="lib" file="${dist}/amqp-tests.jar"/>
+                <zipfileset prefix="lib" file="${dist}/amqp-common.jar"/>
+                <zipfileset prefix="lib" file="${dist}/amqp-jms.jar"/>
+            </zip>
+
+            <tar destfile="${dist}/client.tar.gz" compression="gzip">
+                <tarfileset dir="bin" includes="*.sh,*.bat" mode="755"/>
+                <tarfileset file="${dist}/amqj.jar"/>
+                <tarfileset prefix="lib" file="${client.lib}/jms/jms.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/slf4j/slf4j-simple.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/logging-log4j/log4j-1.2.13.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/mina/mina-core-0.9.5-SNAPSHOT.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/mina/mina-filter-ssl-0.9.5-SNAPSHOT.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/commons-cli/commons-cli-1.0.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/commons-configuration/commons-configuration-1.2.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/commons-collections/commons-collections-3.1.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/commons-logging/commons-logging-api.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/commons-logging/commons-logging.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/commons-lang/commons-lang-2.1.jar"/>
+                <tarfileset prefix="lib" file="${common.lib}/junit/junit-4.0.jar"/>
+                <tarfileset prefix="lib" file="${dist}/amqp-tests.jar"/>
+                <tarfileset prefix="lib" file="${dist}/amqp-common.jar"/>
+                <tarfileset prefix="lib" file="${dist}/amqp-jms.jar"/>
+            </tar>
+        </target>
+
+</project>

Propchange: incubator/qpid/trunk/qpid/java/client/build-old.xml
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/client/dist/readme.txt
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/dist/readme.txt?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/dist/readme.txt (added)
+++ incubator/qpid/trunk/qpid/java/client/dist/readme.txt Tue Sep 19 15:06:50 2006
@@ -0,0 +1,2 @@
+This directory is deliberately empty.
+AMQP JAR files will be built here during the build process.

Propchange: incubator/qpid/trunk/qpid/java/client/dist/readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/client/lib/jms/jms.jar
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/lib/jms/jms.jar?view=auto&rev=447994
==============================================================================
Binary file - no diff available.

Propchange: incubator/qpid/trunk/qpid/java/client/lib/jms/jms.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: incubator/qpid/trunk/qpid/java/client/readme.txt
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/readme.txt?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/readme.txt (added)
+++ incubator/qpid/trunk/qpid/java/client/readme.txt Tue Sep 19 15:06:50 2006
@@ -0,0 +1,31 @@
+AMQP JMS API
+
+To build this you will need ant. The build.xml file requires that the amq.home
+property be set to point to the location of the root directory under which the
+base2 and amqp moduels reside (these contain protocol definitions used in 
+the code generation).
+
+You can avoid setting it if you have the following structure:
+
+    root/ 
+        base/
+        base2/
+        foreign/
+        gsl/
+        amqp/
+        blaze/
+                java/
+                    client
+                       build.xml
+                       Readme.txt [this file]
+                    common   
+
+
+Otherwise you can either pass it in on the command line or add it to a file 
+named build.properties in the same directory as this Readme.txt file. 
+
+E.g.:
+
+ant -Damq.home=c:\AMQP\
+
+ 

Propchange: incubator/qpid/trunk/qpid/java/client/readme.txt
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/client/src/log4j.properties
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/log4j.properties?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/log4j.properties (added)
+++ incubator/qpid/trunk/qpid/java/client/src/log4j.properties Tue Sep 19 15:06:50 2006
@@ -0,0 +1,10 @@
+log4j.rootLogger=${root.logging.level}
+
+
+log4j.logger.org.apache.qpid=${amqj.logging.level}, console
+log4j.additivity.org.apache.qpid=false
+
+log4j.appender.console=org.apache.log4j.ConsoleAppender
+log4j.appender.console.Threshold=info
+log4j.appender.console.layout=org.apache.log4j.PatternLayout
+log4j.appender.console.layout.ConversionPattern=%t %d %p [%c{4}] %m%n

Propchange: incubator/qpid/trunk/qpid/java/client/src/log4j.properties
------------------------------------------------------------------------------
    svn:eol-style = native

Added: incubator/qpid/trunk/qpid/java/client/src/org/apache/qpid/client/AMQAuthenticationException.java
URL: http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/src/org/apache/qpid/client/AMQAuthenticationException.java?view=auto&rev=447994
==============================================================================
--- incubator/qpid/trunk/qpid/java/client/src/org/apache/qpid/client/AMQAuthenticationException.java (added)
+++ incubator/qpid/trunk/qpid/java/client/src/org/apache/qpid/client/AMQAuthenticationException.java Tue Sep 19 15:06:50 2006
@@ -0,0 +1,29 @@
+/*
+ *
+ * Copyright (c) 2006 The Apache Software Foundation
+ *
+ * Licensed 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.client;
+
+import org.apache.qpid.AMQException;
+import org.apache.qpid.protocol.AMQConstant;
+
+public class AMQAuthenticationException extends AMQException
+{
+    public AMQAuthenticationException(int error, String msg)
+    {
+        super(error,msg);
+    }
+}

Propchange: incubator/qpid/trunk/qpid/java/client/src/org/apache/qpid/client/AMQAuthenticationException.java
------------------------------------------------------------------------------
    svn:eol-style = native



Mime
View raw message