summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Ritchie <ritchiem@apache.org>2006-11-08 13:46:51 +0000
committerMartin Ritchie <ritchiem@apache.org>2006-11-08 13:46:51 +0000
commit370983a44f2623d1b180a1edcf8f92457de7df10 (patch)
tree1cc190a3c86ea498111a43f7576cc4256f0d44fd
parent73932ba45dd6f75280adf76d62ac2d0d2ba87d56 (diff)
downloadqpid-python-370983a44f2623d1b180a1edcf8f92457de7df10.tar.gz
Fixed last few issues with the unit tests.
git-svn-id: https://svn.apache.org/repos/asf/incubator/qpid/trunk/qpid/java@472492 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--client/test/src/org/apache/qpid/test/unit/client/connection/ConnectionTest.java3
-rw-r--r--client/test/src/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java3
-rw-r--r--client/test/src/org/apache/qpid/test/unit/client/message/ObjectMessageTest.java12
-rw-r--r--client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Bind.java46
-rw-r--r--client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java4
-rw-r--r--client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Lookup.java35
-rw-r--r--client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Unbind.java19
-rw-r--r--client/test/src/org/apache/qpid/test/unit/transacted/TransactedTest.java5
8 files changed, 109 insertions, 18 deletions
diff --git a/client/test/src/org/apache/qpid/test/unit/client/connection/ConnectionTest.java b/client/test/src/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
index 72630d0c8f..5d56ac91e6 100644
--- a/client/test/src/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
+++ b/client/test/src/org/apache/qpid/test/unit/client/connection/ConnectionTest.java
@@ -74,7 +74,8 @@ public class ConnectionTest
}
}
- @Test @Ignore //fixme The inVM broker currently has no authentication .. need a way to add it
+ @Ignore("The inVM broker currently has no authentication .. Needs added QPID-")
+ @Test
public void passwordFailureConnection() throws Exception
{
try
diff --git a/client/test/src/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java b/client/test/src/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
index b3c6661c61..e4b87fa15d 100644
--- a/client/test/src/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
+++ b/client/test/src/org/apache/qpid/test/unit/client/connectionurl/ConnectionURLTest.java
@@ -324,7 +324,8 @@ public class ConnectionURLTest
Assert.assertTrue(connectionurl.getBrokerCount() == 1);
}
- @Test @Ignore //FIXME Connection now parses but result is wrong
+ @Ignore("Connection now parses but result is wrong QPID-")
+ @Test
public void wrongOptionSeperatorInBroker()
{
String url = "amqp://user:@/test?brokerlist='tcp://localhost:5672+option='value''";
diff --git a/client/test/src/org/apache/qpid/test/unit/client/message/ObjectMessageTest.java b/client/test/src/org/apache/qpid/test/unit/client/message/ObjectMessageTest.java
index cd9299122d..ce5d9f8105 100644
--- a/client/test/src/org/apache/qpid/test/unit/client/message/ObjectMessageTest.java
+++ b/client/test/src/org/apache/qpid/test/unit/client/message/ObjectMessageTest.java
@@ -23,6 +23,8 @@ import org.apache.qpid.client.AMQDestination;
import org.apache.qpid.client.AMQSession;
import org.apache.qpid.client.vmbroker.AMQVMBrokerCreationException;
import org.apache.qpid.client.transport.TransportConnection;
+import org.apache.qpid.AMQException;
+import org.apache.qpid.url.URLSyntaxException;
import org.junit.Before;
import org.junit.Test;
import org.junit.Assert;
@@ -69,6 +71,12 @@ public class ObjectMessageTest implements MessageListener
TransportConnection.killVMBroker(1);
}
+
+ public ObjectMessageTest() throws Exception
+ {
+ this(new AMQConnection("vm://:1", "guest", "guest", randomize("Client"), "/test_path"));
+ }
+
ObjectMessageTest(String broker) throws Exception
{
this(new AMQConnection(broker, "guest", "guest", randomize("Client"), "/test_path"));
@@ -290,4 +298,8 @@ public class ObjectMessageTest implements MessageListener
return in + System.currentTimeMillis();
}
+ public static junit.framework.Test suite()
+ {
+ return new JUnit4TestAdapter(ObjectMessageTest.class);
+ }
}
diff --git a/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Bind.java b/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Bind.java
index 9587ee14ce..899099f706 100644
--- a/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Bind.java
+++ b/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Bind.java
@@ -49,7 +49,7 @@ import java.util.Hashtable;
class Bind
{
public static final String DEFAULT_PROVIDER_FILE_PATH = System.getProperty("java.io.tmpdir") + "/JNDITest" + System.currentTimeMillis();
- public static final String PROVIDER_URL = "file://" + DEFAULT_PROVIDER_FILE_PATH;
+ public String PROVIDER_URL = "file://" + DEFAULT_PROVIDER_FILE_PATH;
String _connectionFactoryString = "";
@@ -60,15 +60,24 @@ class Bind
public Bind() throws NameAlreadyBoundException, NoInitialContextException
{
- this(false);
+ this(false, DEFAULT_PROVIDER_FILE_PATH);
}
public Bind(boolean output) throws NameAlreadyBoundException, NoInitialContextException
{
+ this(output, DEFAULT_PROVIDER_FILE_PATH);
+ }
+
+ public Bind(boolean output, String providerURL) throws NameAlreadyBoundException, NoInitialContextException
+ {
+ PROVIDER_URL = providerURL;
+
// Set up the environment for creating the initial context
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
+
+
env.put(Context.PROVIDER_URL, PROVIDER_URL);
@@ -184,17 +193,39 @@ class Bind
public String connectionFactoryValue()
{
- return _connectionFactoryString;
+ if (_connectionFactoryString != null)
+ {
+ return _connectionFactoryString;
+ }
+ else
+ {
+ return "";
+ }
}
public String connectionValue()
{
- return _connectionString;
+ if (_connectionString != null)
+ {
+ return _connectionString;
+ }
+ else
+ {
+ return "";
+ }
}
public String topicValue()
{
- return ((AMQTopic) _topic).toURL();
+ if (_topic != null)
+ {
+ return ((AMQTopic) _topic).toURL();
+ }
+ else
+ {
+ return "";
+ }
+
}
public boolean bound()
@@ -202,6 +233,11 @@ class Bind
return _bound;
}
+ public String getProviderURL()
+ {
+ return PROVIDER_URL;
+ }
+
public static void main(String[] args) throws NameAlreadyBoundException, NoInitialContextException
{
new Bind(true);
diff --git a/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java b/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java
index aadc154563..0341077192 100644
--- a/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java
+++ b/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/JNDIReferenceableTest.java
@@ -100,8 +100,8 @@ public class JNDIReferenceableTest
}
Assert.assertTrue(b.bound());
-
- Lookup l = new Lookup();
+
+ Lookup l = new Lookup(b.getProviderURL());
Assert.assertTrue(l.connectionFactoryValue().equals(b.connectionFactoryValue()));
diff --git a/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Lookup.java b/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Lookup.java
index e2aed5d413..5000094a14 100644
--- a/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Lookup.java
+++ b/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Lookup.java
@@ -42,19 +42,29 @@ import java.util.Hashtable;
class Lookup
{
public static final String DEFAULT_PROVIDER_FILE_PATH = System.getProperty("java.io.tmpdir") + "/JNDITest";
- public static final String PROVIDER_URL = "file://" + DEFAULT_PROVIDER_FILE_PATH;
+ public String PROVIDER_URL = "file://" + DEFAULT_PROVIDER_FILE_PATH;
AMQTopic _topic = null;
AMQConnection _connection = null;
AMQConnectionFactory _connectionFactory = null;
private String _connectionURL;
+
public Lookup()
{
+ this(DEFAULT_PROVIDER_FILE_PATH);
+ }
+
+ public Lookup(String providerURL)
+ {
+
+ PROVIDER_URL = providerURL;
+
// Set up the environment for creating the initial context
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
"com.sun.jndi.fscontext.RefFSContextFactory");
+
env.put(Context.PROVIDER_URL, PROVIDER_URL);
File file = new File(PROVIDER_URL.substring(PROVIDER_URL.indexOf("://") + 3));
@@ -115,17 +125,34 @@ class Lookup
public String connectionFactoryValue()
{
- return _connectionFactory.getConnectionURL().toString();
+ if (_connectionFactory != null)
+ {
+ return _connectionFactory.getConnectionURL().toString();
+ }
+ return "";
}
public String connectionValue()
{
- return _connectionURL;
+ if (_connectionURL != null)
+ {
+ return _connectionURL;
+ }
+ return "";
}
public String topicValue()
{
- return _topic.toURL();
+ if (_topic != null)
+ {
+ return _topic.toURL();
+ }
+ return "";
+ }
+
+ public String getProviderURL()
+ {
+ return PROVIDER_URL;
}
public static void main(String[] args)
diff --git a/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Unbind.java b/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Unbind.java
index 34a1454d8a..a7caec0891 100644
--- a/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Unbind.java
+++ b/client/test/src/org/apache/qpid/test/unit/jndi/referenceabletest/Unbind.java
@@ -38,18 +38,29 @@ import java.util.Hashtable;
*/
class Unbind
{
- public static final String DEFAULT_PROVIDER_FILE_PATH = System.getProperty("java.io.tmpdir") + "/JNDITest";
- public static final String PROVIDER_URL = "file://" + DEFAULT_PROVIDER_FILE_PATH;
+ public static final String DEFAULT_PROVIDER_FILE_PATH = System.getProperty("java.io.tmpdir") + "/JNDITest" + System.currentTimeMillis();
+ public String PROVIDER_URL = "file://" + DEFAULT_PROVIDER_FILE_PATH;
boolean _unbound = false;
public Unbind()
{
- this(false);
+ this(false, DEFAULT_PROVIDER_FILE_PATH);
}
- public Unbind(boolean output)
+ public Unbind(Boolean output)
{
+ this(output, DEFAULT_PROVIDER_FILE_PATH);
+ }
+
+ public Unbind(String provider)
+ {
+ this(false, provider);
+ }
+
+ public Unbind(boolean output, String providerURL)
+ {
+ PROVIDER_URL = providerURL;
// Set up the environment for creating the initial context
Hashtable env = new Hashtable(11);
env.put(Context.INITIAL_CONTEXT_FACTORY,
diff --git a/client/test/src/org/apache/qpid/test/unit/transacted/TransactedTest.java b/client/test/src/org/apache/qpid/test/unit/transacted/TransactedTest.java
index 2040276469..10be387b4e 100644
--- a/client/test/src/org/apache/qpid/test/unit/transacted/TransactedTest.java
+++ b/client/test/src/org/apache/qpid/test/unit/transacted/TransactedTest.java
@@ -48,7 +48,7 @@ public class TransactedTest
private Session prepSession;
private MessageProducer prepProducer1;
- private AMQConnection testCon;
+ private AMQConnection testCon;
private Session testSession;
private MessageConsumer testConsumer1;
private MessageConsumer testConsumer2;
@@ -82,6 +82,9 @@ public class TransactedTest
con = new AMQConnection("vm://:1", "guest", "guest", "TransactedTest", "/test");
session = con.createSession(true, 0);
consumer1 = session.createConsumer(queue1);
+ //Dummy just to create the queue.
+ MessageConsumer consumer2 = session.createConsumer(queue2);
+ consumer2.close();
producer2 = session.createProducer(queue2);
con.start();