Author: ritchiem
Date: Fri Oct 13 06:02:54 2006
New Revision: 463671

URL: http://svn.apache.org/viewvc?view=rev&rev=463671
Log:
Added Sun FSContext to client-test lib
Updated referenceabletest files to use the temporary directory reported by the 
System.properties.

Added:
    incubator/qpid/trunk/qpid/java/client/test/lib/fscontext-1_2-beta3/
    
incubator/qpid/trunk/qpid/java/client/test/lib/fscontext-1_2-beta3/fscontext.jar
   (with props)
    
incubator/qpid/trunk/qpid/java/client/test/lib/fscontext-1_2-beta3/providerutil.jar
   (with props)
Modified:
    
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceable/Bind.java
    
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceable/Unbind.java
    
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Bind.java
    
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/JNDIReferenceableTest.java
    
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Lookup.java
    
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Unbind.java

Added: 
incubator/qpid/trunk/qpid/java/client/test/lib/fscontext-1_2-beta3/fscontext.jar
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/lib/fscontext-1_2-beta3/fscontext.jar?view=auto&rev=463671
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/qpid/trunk/qpid/java/client/test/lib/fscontext-1_2-beta3/fscontext.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Added: 
incubator/qpid/trunk/qpid/java/client/test/lib/fscontext-1_2-beta3/providerutil.jar
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/lib/fscontext-1_2-beta3/providerutil.jar?view=auto&rev=463671
==============================================================================
Binary file - no diff available.

Propchange: 
incubator/qpid/trunk/qpid/java/client/test/lib/fscontext-1_2-beta3/providerutil.jar
------------------------------------------------------------------------------
    svn:mime-type = application/octet-stream

Modified: 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceable/Bind.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceable/Bind.java?view=diff&rev=463671&r1=463670&r2=463671
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceable/Bind.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceable/Bind.java
 Fri Oct 13 06:02:54 2006
@@ -33,7 +33,7 @@
  * Binds a reference from a JNDI source.
  * Given a properties file with the JNDI information and a binding string.
  */
-class Bind
+public class Bind
 {
     private static final String USAGE="USAGE: java bind <JNDI Properties file> 
-cf <url> <binding> | -c <url> <binding> [-t <topic Name> <binding>] [-q <queue 
Name> <binding>]";
     public Bind(String propertiesFile, String bindingURL, Referenceable 
reference) throws NameAlreadyBoundException, NoInitialContextException

Modified: 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceable/Unbind.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceable/Unbind.java?view=diff&rev=463671&r1=463670&r2=463671
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceable/Unbind.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceable/Unbind.java
 Fri Oct 13 06:02:54 2006
@@ -28,11 +28,11 @@
  * Unbinds a reference from a JNDI source.
  * Given a properties file with the JNDI information and a binding string.
  */
-class UnBind
+public class Unbind
 {
     private static final String USAGE = "USAGE: java unbind <JNDI Properties 
file> -b <binding>";
 
-    public UnBind(String propertiesFile, String bindingValue) throws 
NamingException
+    public Unbind(String propertiesFile, String bindingValue) throws 
NamingException
     {
         // Set up the environment for creating the initial context
         String qpid_home = System.getProperty("QPID_HOME");
@@ -143,7 +143,7 @@
                     System.out.print("UnBinding:" + binding);
                     try
                     {
-                        new UnBind(args[0], binding);
+                        new Unbind(args[0], binding);
                         System.out.println(" ..Successful");
                     }
                     catch (NamingException nabe)

Modified: 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Bind.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Bind.java?view=diff&rev=463671&r1=463670&r2=463671
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Bind.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Bind.java
 Fri Oct 13 06:02:54 2006
@@ -18,15 +18,22 @@
 package org.apache.qpid.jndi.referenceabletest;
 
 import org.apache.qpid.client.AMQConnection;
-import org.apache.qpid.client.AMQTopic;
 import org.apache.qpid.client.AMQConnectionFactory;
-import org.apache.qpid.AMQException;
+import org.apache.qpid.client.AMQTopic;
 import org.apache.qpid.url.URLSyntaxException;
 import org.junit.Assert;
 
-import javax.jms.*;
-import javax.naming.*;
-
+import javax.jms.Connection;
+import javax.jms.ConnectionFactory;
+import javax.jms.JMSException;
+import javax.jms.Session;
+import javax.jms.Topic;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameAlreadyBoundException;
+import javax.naming.NamingException;
+import javax.naming.NoInitialContextException;
+import java.io.File;
 import java.util.Hashtable;
 
 /**
@@ -41,11 +48,12 @@
  */
 class Bind
 {
+    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;
 
     String _connectionFactoryString = "";
 
-    String _connectionString = "amqp://guest:[EMAIL 
PROTECTED]/testpath?brokerlist='tcp://localhost:5672'";
-
+    String _connectionString = "amqp://guest:[EMAIL 
PROTECTED]/testpath?brokerlist='vm://:1'";
     Topic _topic = null;
 
     boolean _bound = false;
@@ -54,13 +62,35 @@
     {
         this(false);
     }
+
     public Bind(boolean output) throws NameAlreadyBoundException, 
NoInitialContextException
     {
         // 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, "file:/temp/qpid-jndi-test");
+        env.put(Context.PROVIDER_URL, PROVIDER_URL);
+
+
+        File file = new 
File(PROVIDER_URL.substring(PROVIDER_URL.indexOf("://") + 3));
+
+        if (file.exists() && !file.isDirectory())
+        {
+            System.out.println("Couldn't make directory file already exists");
+            return;
+        }
+        else
+        {
+            if (!file.exists())
+            {
+                if (!file.mkdirs())
+                {
+                    System.out.println("Couldn't make directory");
+                    return;
+                }
+            }
+        }
+
 
         try
         {
@@ -93,7 +123,6 @@
                 Session session = connection.createSession(false, 
Session.AUTO_ACKNOWLEDGE);
 
                 _topic = session.createTopic("Fruity");
-
             }
             catch (JMSException jmse)
             {
@@ -129,15 +158,14 @@
             System.out.println("Operation failed: " + e);
             if (e instanceof NameAlreadyBoundException)
             {
-                throw (NameAlreadyBoundException) e;
+                throw(NameAlreadyBoundException) e;
             }
 
             if (e instanceof NoInitialContextException)
             {
-                throw (NoInitialContextException) e;
+                throw(NoInitialContextException) e;
             }
         }
-
     }
 
     public String connectionFactoryValue()

Modified: 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/JNDIReferenceableTest.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/JNDIReferenceableTest.java?view=diff&rev=463671&r1=463670&r2=463671
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/JNDIReferenceableTest.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/JNDIReferenceableTest.java
 Fri Oct 13 06:02:54 2006
@@ -45,12 +45,9 @@
         Bind b = null;
         try
         {
-
-
             try
             {
                 b = new Bind();
-
             }
             catch (NameAlreadyBoundException e)
             {
@@ -69,7 +66,6 @@
                 {
                     Assert.fail("Unable to clear bound objects for test.");
                 }
-
             }
         }
         catch (NoInitialContextException e)
@@ -99,10 +95,8 @@
 
     }
 
-    public static junit.framework.Test suite
-            ()
+    public static junit.framework.Test suite()
     {
         return new JUnit4TestAdapter(JNDIReferenceableTest.class);
     }
-
 }

Modified: 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Lookup.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Lookup.java?view=diff&rev=463671&r1=463670&r2=463671
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Lookup.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Lookup.java
 Fri Oct 13 06:02:54 2006
@@ -17,11 +17,14 @@
  */
 package org.apache.qpid.jndi.referenceabletest;
 
-import org.apache.qpid.client.AMQTopic;
 import org.apache.qpid.client.AMQConnection;
 import org.apache.qpid.client.AMQConnectionFactory;
+import org.apache.qpid.client.AMQTopic;
 
-import javax.naming.*;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import java.io.File;
 import java.util.Hashtable;
 
 
@@ -37,6 +40,9 @@
  */
 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;
+
     AMQTopic _topic = null;
     AMQConnection _connection = null;
     AMQConnectionFactory _connectionFactory = null;
@@ -47,7 +53,26 @@
         Hashtable env = new Hashtable(11);
         env.put(Context.INITIAL_CONTEXT_FACTORY,
                 "com.sun.jndi.fscontext.RefFSContextFactory");
-        env.put(Context.PROVIDER_URL, "file:/temp/qpid-jndi-test");
+        env.put(Context.PROVIDER_URL, PROVIDER_URL);
+
+        File file = new 
File(PROVIDER_URL.substring(PROVIDER_URL.indexOf("://") + 3));
+
+        if (file.exists() && !file.isDirectory())
+        {
+            System.out.println("Couldn't make directory file already exists");
+            return;
+        }
+        else
+        {
+            if (!file.exists())
+            {
+                if (!file.mkdirs())
+                {
+                    System.out.println("Couldn't make directory");
+                    return;
+                }
+            }
+        }
 
         try
         {
@@ -70,10 +95,9 @@
         }
     }
 
-
     public String connectionFactoryValue()
     {
-        return ((AMQConnection) _connectionFactory.getConnectionURL()).toURL();
+        return _connectionFactory.getConnectionURL().toString();
     }
 
     public String connectionValue()
@@ -85,7 +109,6 @@
     {
         return _topic.toURL();
     }
-
 
     public static void main(String[] args)
     {

Modified: 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Unbind.java
URL: 
http://svn.apache.org/viewvc/incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Unbind.java?view=diff&rev=463671&r1=463670&r2=463671
==============================================================================
--- 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Unbind.java
 (original)
+++ 
incubator/qpid/trunk/qpid/java/client/test/src/org/apache/qpid/jndi/referenceabletest/Unbind.java
 Fri Oct 13 06:02:54 2006
@@ -17,7 +17,10 @@
  */
 package org.apache.qpid.jndi.referenceabletest;
 
-import javax.naming.*;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NameNotFoundException;
+import javax.naming.NamingException;
 import java.io.File;
 import java.util.Hashtable;
 
@@ -33,7 +36,8 @@
  */
 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;
 
     boolean _unbound = false;
 
@@ -49,7 +53,26 @@
         Hashtable env = new Hashtable(11);
         env.put(Context.INITIAL_CONTEXT_FACTORY,
                 "com.sun.jndi.fscontext.RefFSContextFactory");
-        env.put(Context.PROVIDER_URL, "file:/temp/qpid-jndi-test");
+        env.put(Context.PROVIDER_URL, PROVIDER_URL);
+
+        File file = new 
File(PROVIDER_URL.substring(PROVIDER_URL.indexOf("://") + 3));
+
+        if (file.exists() && !file.isDirectory())
+        {
+            System.out.println("Couldn't make directory file already exists");
+            return;
+        }
+        else
+        {
+            if (!file.exists())
+            {
+                if (!file.mkdirs())
+                {
+                    System.out.println("Couldn't make directory");
+                    return;
+                }
+            }
+        }
 
         try
         {


Reply via email to