summaryrefslogtreecommitdiff
path: root/java/client/src/test
diff options
context:
space:
mode:
Diffstat (limited to 'java/client/src/test')
-rw-r--r--java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java27
1 files changed, 27 insertions, 0 deletions
diff --git a/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java b/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java
index 2989970dcd..5f0fa9550f 100644
--- a/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java
+++ b/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java
@@ -21,6 +21,10 @@
package org.apache.qpid.jndi;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.FileWriter;
import java.util.Properties;
import javax.jms.Destination;
@@ -51,7 +55,30 @@ public class PropertiesFileInitialContextFactoryTest extends TestCase
ctx = new InitialContext(properties);
}
+ public void testContextFromProviderURL() throws Exception
+ {
+ Properties properties = new Properties();
+ properties.load(this.getClass().getResourceAsStream("hello.properties"));
+ File f = new File(System.getProperty("java.io.tmpdir") + FILE_NAME);
+ FileOutputStream fos = new FileOutputStream(f);
+ properties.store(fos, null);
+
+ System.setProperty("java.naming.factory.initial", "org.apache.qpid.jndi.PropertiesFileInitialContextFactory");
+ System.setProperty("java.naming.provider.url", "file://" + f.getCanonicalPath());
+
+ InitialContext context = new InitialContext();
+ assertNotNull("Lookup from URI based context should not be null", context.lookup("topicExchange"));
+ context.close();
+
+ System.setProperty("java.naming.provider.url", f.getCanonicalPath());
+ context = new InitialContext();
+ assertNotNull("Lookup from fileName should not be null", context.lookup("qpidConnectionfactory"));
+
+ context.close();
+ f.delete();
+
+ }
public void testQueueNamesWithTrailingSpaces() throws Exception
{
Queue queue = (Queue)ctx.lookup("QueueNameWithSpace");