diff --git a/functional-test/src/test/java/org/zanata/util/CleanDocumentStorageRule.java b/functional-test/src/test/java/org/zanata/util/CleanDocumentStorageRule.java index 754eefae98..527ead8d64 100644 --- a/functional-test/src/test/java/org/zanata/util/CleanDocumentStorageRule.java +++ b/functional-test/src/test/java/org/zanata/util/CleanDocumentStorageRule.java @@ -47,30 +47,39 @@ public static String getDocumentStoragePath() { org.jboss.naming.remote.client.InitialContextFactory.class .getName()); long portOffset = Integer.parseInt( - PropertiesHolder.getProperty("cargo.port.offset", "0")); - String port = System.getenv("JBOSS_REMOTING_PORT"); - int portNum = port != null ? parseInt(port) : 4547; - long rmiPort = portOffset + portNum; + PropertiesHolder.getProperty("cargo.port.offset", "0")); + String rmiPort = System.getenv("JBOSS_REMOTING_PORT"); + int rmiPortNum = rmiPort != null ? parseInt(rmiPort) : 4547; + long realRmiPort = portOffset + rmiPortNum; - env.put(Context.PROVIDER_URL, "remote://localhost:" + rmiPort); + String remoteUrl = "remote://localhost:" + realRmiPort; + env.put(Context.PROVIDER_URL, remoteUrl); InitialContext remoteContext = null; try { remoteContext = new InitialContext(env); storagePath = - (String) remoteContext - .lookup("zanata/files/document-storage-directory"); + (String) remoteContext + .lookup("zanata/files/document-storage-directory"); } catch (NamingException e) { + // wildfly uses 'http-remoting:' not 'remote:' + String httpPort = System.getenv("JBOSS_HTTP_PORT"); + int httpPortNum = httpPort != null ? parseInt(httpPort) : 8180; + + long realHttpPort = httpPortNum + portOffset; + String httpRemotingUrl = "http-remoting://localhost:" + realHttpPort; + log.warn("Unable to access {}: {}; trying {}", remoteUrl, + e.toString(), httpRemotingUrl); try { - // wildfly uses 'http-remoting:' not 'remote:' - rmiPort = 8080+portOffset; - env.put(Context.PROVIDER_URL, "http-remoting://localhost:" + rmiPort); + env.put(Context.PROVIDER_URL, httpRemotingUrl); remoteContext = new InitialContext(env); storagePath = (String) remoteContext .lookup("zanata/files/document-storage-directory"); } catch (NamingException e1) { // fall back option: + log.warn("Unable to access {}: {}", httpRemotingUrl, + e.toString()); URL testClassRoot = Thread.currentThread().getContextClassLoader() .getResource("setup.properties"); diff --git a/functional-test/src/test/resources/conf/standalone_wildfly.xml b/functional-test/src/test/resources/conf/standalone_wildfly.xml index 7c858aeaf2..abc5daf4dc 100644 --- a/functional-test/src/test/resources/conf/standalone_wildfly.xml +++ b/functional-test/src/test/resources/conf/standalone_wildfly.xml @@ -287,7 +287,7 @@ - + - - - - - - - - - + + + + + + + + + - +