diff options
| author | Weston M. Price <wprice@apache.org> | 2012-05-13 10:27:23 +0000 |
|---|---|---|
| committer | Weston M. Price <wprice@apache.org> | 2012-05-13 10:27:23 +0000 |
| commit | 850bd17e9cfc9196478bddf9668238db8432811f (patch) | |
| tree | 4186e1b9164277e29069de49bacb9ff44645911e /qpid/java/client/src/test | |
| parent | 30c12a0d7fb3855ff7d4b2fb8c5245f8b63a0ab8 (diff) | |
| download | qpid-python-850bd17e9cfc9196478bddf9668238db8432811f.tar.gz | |
QPID-3994: add support for optionally retrieving FindBugs using Ivy
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk@1337829 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'qpid/java/client/src/test')
| -rw-r--r-- | qpid/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/qpid/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java b/qpid/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java index 2989970dcd..5f0fa9550f 100644 --- a/qpid/java/client/src/test/java/org/apache/qpid/jndi/PropertiesFileInitialContextFactoryTest.java +++ b/qpid/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"); |
