Author: ropalka
Date: 2012-02-17 06:36:22 -0500 (Fri, 17 Feb 2012)
New Revision: 15678
Modified:
shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws1841/JBWS1841TestCase.java
Log:
[JBWS-3435] split jndi properties
Modified: shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java
===================================================================
--- shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java 2012-02-17
11:34:20 UTC (rev 15677)
+++ shared-testsuite/trunk/src/main/java/org/jboss/wsf/test/JBossWSTest.java 2012-02-17
11:36:22 UTC (rev 15678)
@@ -23,6 +23,7 @@
import java.io.File;
import java.io.IOException;
+import java.io.InputStream;
import java.io.OutputStream;
import java.net.MalformedURLException;
import java.net.URL;
@@ -33,6 +34,9 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Map;
+import java.util.Map.Entry;
+import java.util.Properties;
+import java.util.Set;
import java.util.StringTokenizer;
import javax.management.MBeanServerConnection;
@@ -277,25 +281,56 @@
return new File(parent, filename);
}
- /** Get the client's env context for a given name.
+ private static Hashtable<String, String> getEnvironment(final String
resourceName) throws IOException {
+ final Hashtable<String, String> env = new Hashtable<String,
String>();
+ final InputStream is =
JBossWSTest.class.getClassLoader().getResourceAsStream(resourceName);
+ if (is != null) {
+ final Properties props = new Properties();
+ props.load(is);
+ Entry<Object, Object> entry;
+ final Iterator<Entry<Object, Object>> entries =
props.entrySet().iterator();
+ while (entries.hasNext()) {
+ entry = entries.next();
+ env.put((String)entry.getKey(), (String)entry.getValue());
+ }
+ }
+ return env;
+ }
+
+ /** Get the appclient remote env context
*/
- @SuppressWarnings({ "unchecked", "rawtypes" })
- protected static InitialContext getInitialContext(String clientName) throws
NamingException
+ protected static InitialContext getAppclientInitialContext() throws NamingException,
IOException
{
- InitialContext iniCtx = new InitialContext();
- Hashtable env = iniCtx.getEnvironment();
- env.put(Context.URL_PKG_PREFIXES, "org.jboss.naming.client");
- env.put("j2ee.clientName", clientName);
- return new InitialContext(env);
+// InitialContext iniCtx = new InitialContext();
+// Hashtable env = iniCtx.getEnvironment();
+// env.put(Context.PROVIDER_URL, "remote://" +
JBossWSTestHelper.getServerHost() + ":4448");
+// return new InitialContext(env);
+ final Hashtable<String, String> env =
getEnvironment("appclient.jndi.properties");
+ return new InitialContext(env);
}
- /** Get the client's env context
+ /** Get the server remote env context
*/
- protected static InitialContext getInitialContext() throws NamingException
+ protected static InitialContext getServerInitialContext() throws NamingException,
IOException
{
- return getInitialContext("jbossws-client");
+ final Hashtable<String, String> env =
getEnvironment("server.jndi.properties");
+ return new InitialContext(env);
}
+ // TODO: remove
+ @Deprecated
+ protected static InitialContext getInitialContext(String s) throws NamingException,
IOException
+ {
+ return getServerInitialContext();
+ }
+
+ // TODO: remove
+ @Deprecated
+ protected static InitialContext getInitialContext() throws NamingException,
IOException
+ {
+ return getServerInitialContext();
+ }
+
public static void assertEquals(Element expElement, Element wasElement, boolean
ignoreWhitespace)
{
normalizeWhitespace(expElement, ignoreWhitespace);
Modified:
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws1841/JBWS1841TestCase.java
===================================================================
---
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws1841/JBWS1841TestCase.java 2012-02-17
11:34:20 UTC (rev 15677)
+++
shared-testsuite/trunk/testsuite/src/test/java/org/jboss/test/ws/jaxws/jbws1841/JBWS1841TestCase.java 2012-02-17
11:36:22 UTC (rev 15678)
@@ -57,7 +57,7 @@
QName serviceName = new
QName("http://www.openuri.org/2004/04/HelloWorld",
"EndpointService");
port = Service.create(wsdlURL, serviceName).getPort(EndpointInterface.class);
- InitialContext ctx = new InitialContext();
+ InitialContext ctx = getInitialContext();
remote = (StatelessRemote)ctx.lookup(getRemoteEjbJndiName());
}
}