summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindConnectionFactory.java43
-rw-r--r--java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindQueue.java39
-rw-r--r--java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindTopic.java40
3 files changed, 111 insertions, 11 deletions
diff --git a/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindConnectionFactory.java b/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindConnectionFactory.java
index 739a436701..d0b9f99408 100644
--- a/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindConnectionFactory.java
+++ b/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindConnectionFactory.java
@@ -25,12 +25,16 @@ import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.jms.ConnectionFactory;
import java.util.Hashtable;
+import java.io.File;
+import java.io.IOException;
+import java.net.MalformedURLException;
public class JNDIBindConnectionFactory
{
public static final String CONNECTION_FACTORY_BINDING = "amq/ConnectionFactory";
- public static final String PROVIDER_URL = "file:/temp/IBMPerfTestsJNDI";
+ public static final String DEFAULT_PROVIDER_FILE_PATH = System.getProperty("java.io.tmpdir") + "IBMPerfTestsJNDI";
+ public static final String PROVIDER_URL = "file:/" + DEFAULT_PROVIDER_FILE_PATH;
public static final String FSCONTEXT_FACTORY = "com.sun.jndi.fscontext.RefFSContextFactory";
public static void main(String[] args)
@@ -60,11 +64,40 @@ public class JNDIBindConnectionFactory
}
else
{
- System.out.println("Using default values: Usage:java JNDIBindConnectionFactory [<Provider URL> [<Connection Factory Binding>] [<JNDI Context Factory>]]");
+ System.out.println("Using default values: Usage:java JNDIBindConnectionFactory [<Provider URL> [<Connection Factory Binding>] [<JNDI Context Factory>]]");
}
System.out.println("File System Context Factory\n" +
- "Connection Factory Binding:" + connectionFactoryBinding + "\n" +
- "JNDI Provider URL:" + provider);
+ "Connection Factory Binding:" + connectionFactoryBinding + "\n" +
+ "JNDI Provider URL:" + provider);
+
+ if (provider.startsWith("file"))
+ {
+ File file = new File(provider.substring(provider.indexOf(":/") + 2));
+ try
+ {
+ System.out.println("File:" + file.toURL());
+ }
+ catch (MalformedURLException e)
+ {
+ System.out.println(e);
+ }
+ if (file.exists() && !file.isDirectory())
+ {
+ System.out.println("Couldn't make directory file already exists");
+ System.exit(1);
+ }
+ else
+ {
+ if (!file.exists())
+ {
+ if (!file.mkdirs())
+ {
+ System.out.println("Couldn't make directory");
+ System.exit(1);
+ }
+ }
+ }
+ }
new JNDIBindConnectionFactory(provider, connectionFactoryBinding, contextFactory);
@@ -83,7 +116,7 @@ public class JNDIBindConnectionFactory
// Create the initial context
Context ctx = new InitialContext(env);
- // Create the object to be bound
+// Create the object to be bound
ConnectionFactory factory = null;
try
diff --git a/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindQueue.java b/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindQueue.java
index b9ad86b936..3b3d7850d8 100644
--- a/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindQueue.java
+++ b/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindQueue.java
@@ -28,12 +28,15 @@ import javax.naming.InitialContext;
import javax.naming.NamingException;
import javax.jms.*;
import java.util.Hashtable;
+import java.io.File;
+import java.net.MalformedURLException;
public class JNDIBindQueue
{
public static final String CONNECTION_FACTORY_BINDING = "amq/ConnectionFactory";
- public static final String PROVIDER_URL = "file:/temp/IBMPerfTestsJNDI";
+ public static final String DEFAULT_PROVIDER_FILE_PATH = System.getProperty("java.io.tmpdir") + "IBMPerfTestsJNDI";
+ public static final String PROVIDER_URL = "file:/" + DEFAULT_PROVIDER_FILE_PATH;
public static final String FSCONTEXT_FACTORY = "com.sun.jndi.fscontext.RefFSContextFactory";
Connection _connection = null;
@@ -163,8 +166,38 @@ public class JNDIBindQueue
}
System.out.println("File System Context Factory\n" +
- "Binding Queue:'" + queueName + "' to '" + binding + "'\n" +
- "JNDI Provider URL:" + provider);
+ "Binding Queue:'" + queueName + "' to '" + binding + "'\n" +
+ "JNDI Provider URL:" + provider);
+
+ if (provider.startsWith("file"))
+ {
+ File file = new File(provider.substring(provider.indexOf(":/") + 2));
+ try
+ {
+ System.out.println("File:" + file.toURL());
+ }
+ catch (MalformedURLException e)
+ {
+ System.out.println(e);
+ }
+ if (file.exists() && !file.isDirectory())
+ {
+ System.out.println("Couldn't make directory file already exists");
+ System.exit(1);
+ }
+ else
+ {
+ if (!file.exists())
+ {
+ if (!file.mkdirs())
+ {
+ System.out.println("Couldn't make directory");
+ System.exit(1);
+ }
+ }
+ }
+ }
+
new JNDIBindQueue(binding, queueName, provider, contextFactory);
diff --git a/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindTopic.java b/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindTopic.java
index ee0be798ce..437f3791c9 100644
--- a/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindTopic.java
+++ b/java/client/test/src/org/apache/qpid/IBMPerfTest/JNDIBindTopic.java
@@ -27,12 +27,16 @@ import javax.naming.Context;
import javax.naming.InitialContext;
import javax.naming.NamingException;
import java.util.Hashtable;
+import java.io.File;
+import java.net.MalformedURLException;
public class JNDIBindTopic
{
public static final String CONNECTION_FACTORY_BINDING = "amq/ConnectionFactory";
- public static final String PROVIDER_URL = "file:/temp/IBMPerfTestsJNDI";
+ public static final String DEFAULT_PROVIDER_FILE_PATH = System.getProperty("java.io.tmpdir") + "IBMPerfTestsJNDI";
+ public static final String PROVIDER_URL = "file:/" + DEFAULT_PROVIDER_FILE_PATH;
+
public static final String FSCONTEXT_FACTORY = "com.sun.jndi.fscontext.RefFSContextFactory";
Connection _connection = null;
@@ -162,8 +166,38 @@ public class JNDIBindTopic
}
System.out.println("File System Context Factory\n" +
- "Binding Topic:'" + queueName + "' to '" + binding + "'\n" +
- "JNDI Provider URL:" + provider);
+ "Binding Topic:'" + queueName + "' to '" + binding + "'\n" +
+ "JNDI Provider URL:" + provider);
+
+
+ if (provider.startsWith("file"))
+ {
+ File file = new File(provider.substring(provider.indexOf(":/") + 2));
+ try
+ {
+ System.out.println("File:" + file.toURL());
+ }
+ catch (MalformedURLException e)
+ {
+ System.out.println(e);
+ }
+ if (file.exists() && !file.isDirectory())
+ {
+ System.out.println("Couldn't make directory file already exists");
+ System.exit(1);
+ }
+ else
+ {
+ if (!file.exists())
+ {
+ if (!file.mkdirs())
+ {
+ System.out.println("Couldn't make directory");
+ System.exit(1);
+ }
+ }
+ }
+ }
new JNDIBindTopic(binding, queueName, provider, contextFactory);