Author: alessio.soldano(a)jboss.com
Date: 2012-06-17 10:49:11 -0400 (Sun, 17 Jun 2012)
New Revision: 427
Modified:
core/trunk/core/src/main/java/org/jboss/wise/core/test/WiseTest.java
core/trunk/integration-testsuite/common/src/test/resources/integration-test-log4j.xml
core/trunk/integration-testsuite/cxf/src/test/resources/integration-test-log4j.xml
core/trunk/integration-testsuite/pom.xml
core/trunk/pom.xml
Log:
[WISE-174] Initial changes for AS7.1.x support
Modified: core/trunk/core/src/main/java/org/jboss/wise/core/test/WiseTest.java
===================================================================
--- core/trunk/core/src/main/java/org/jboss/wise/core/test/WiseTest.java 2012-06-17
11:19:52 UTC (rev 426)
+++ core/trunk/core/src/main/java/org/jboss/wise/core/test/WiseTest.java 2012-06-17
14:49:11 UTC (rev 427)
@@ -23,31 +23,48 @@
package org.jboss.wise.core.test;
import java.io.File;
+import java.net.Inet6Address;
+import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URL;
-import javax.management.ObjectName;
-import org.apache.log4j.Logger;
+import java.net.UnknownHostException;
+import org.jboss.wsf.spi.SPIProvider;
+import org.jboss.wsf.spi.SPIProviderResolver;
+import org.jboss.wsf.spi.deployer.Deployer;
+
/**
* Wise test base class. Subclass can use the methods in this class to
- * deploy and undeploy a web service war in JBossAS
+ * deploy and undeploy a web service war in JBossAS
+ *
* @author ema(a)redhat.com
+ * @author alessio.soldano(a)jboss.com
*
*/
public class WiseTest {
- private static final Logger logger = Logger.getLogger(WiseTest.class);
- private static final String MAIN_DEPLOYER =
"jboss.system:service=MainDeployer";
- private static final String WS_SERVER_CONFIG =
"jboss.ws:service=ServerConfig";
private static final String TEST_WS_ARCHIVE_DIR = "test-ws-archive";
+ private static final String SYSPROP_JBOSS_BIND_ADDRESS =
"jboss.bind.address";
+ private static final String SYSPROP_JBOSS_HTTP_PORT = "jboss.http.port";
+ private static Deployer DEPLOYER;
+ private static synchronized Deployer getDeployer()
+ {
+ //lazy loading of deployer
+ if (DEPLOYER == null)
+ {
+ SPIProvider spiProvider = SPIProviderResolver.getInstance().getProvider();
+ DEPLOYER = spiProvider.getSPI(Deployer.class);
+ }
+ return DEPLOYER;
+ }
+
/**
* Deploy the webservice war in JBoss server
* @param url url for webservice war
* @throws Exception if the deployment is failed
*/
public void deployWS(URL url) throws Exception {
- throw new Exception("TODO");
-// JBossWSTestHelper.getServer().invoke(new ObjectName(MAIN_DEPLOYER),
"deploy", new Object[] { url }, new String[] { "java.net.URL" });
+ getDeployer().deploy(url);
}
/**Undeploy a webservice
@@ -55,8 +72,7 @@
* @throws Exception if undeployment is failed
*/
public void undeployWS(URL url) throws Exception {
- throw new Exception("TODO");
-// JBossWSTestHelper.getServer().invoke(new ObjectName(MAIN_DEPLOYER),
"undeploy", new Object[] { url }, new String[] { "java.net.URL" });
+ getDeployer().undeploy(url);
}
/**Get the URL path for a given webservice archive. It will find this war file under
${baseDir}/build/test-ws-archive
@@ -69,7 +85,7 @@
File file = new File(dirURL.getFile(), ".." + File.separator +
TEST_WS_ARCHIVE_DIR + File.separator + archiveName);
if (file.exists()) {
try {
- warUrl = file.getAbsoluteFile().toURL();
+ warUrl = file.getAbsoluteFile().toURI().toURL();
} catch (MalformedURLException e) {
return null;
}
@@ -78,28 +94,37 @@
}
- /**Get the jboss webservice server side hostname and port
+ /**
+ * Get the jboss webservice server side hostname and port
+ *
* @return
http://server-hostname:port
*/
public String getServerHostAndPort() {
- Logger.getLogger(this.getClass()).warn("TODO!! implement
getServerHostAndPort()");
- //return "http://" + JBossWSTestHelper.getServerHost() + ":"
+ getServerPort();
- return null;
+ final String host = System.getProperty(SYSPROP_JBOSS_BIND_ADDRESS,
"localhost");
+ final String port = System.getProperty(SYSPROP_JBOSS_HTTP_PORT, "8080");
+ final StringBuilder sb = new StringBuilder("http://");
+ sb.append(toIPv6URLFormat(host)).append(":").append(port);
+ return sb.toString();
}
-
- /**Get the web service server port
- * @return webservice server configured port
- */
- public String getServerPort() {
- Logger.getLogger(this.getClass()).warn("TODO!! implement getServerPort()");
- try {
-// return JBossWSTestHelper.getServer().getAttribute(new
ObjectName(WS_SERVER_CONFIG), "WebServicePort").toString();
- return "8080";
- } catch (Exception e) {
- logger.warn("WARNING: Failed to get server port; using default
8080");
- return "8080";
- }
+
+ private static String toIPv6URLFormat(final String host) {
+ try {
+ if (host.startsWith(":")) {
+ throw new IllegalArgumentException("JBossWS test suite requires IPv6 addresses to
be wrapped with [] brackets. Expected format is: [" + host + "]");
+ }
+ if (host.startsWith("[")) {
+ if (System.getProperty("java.net.preferIPv4Stack") == null) {
+ throw new IllegalStateException("always provide java.net.preferIPv4Stack JVM
property when using IPv6 address format");
+ }
+ if (System.getProperty("java.net.preferIPv6Addresses") == null) {
+ throw new IllegalStateException("always provide java.net.preferIPv6Addresses
JVM property when using IPv6 address format");
+ }
+ }
+ final boolean isIPv6Address = InetAddress.getByName(host) instanceof Inet6Address;
+ final boolean isIPv6Formatted = isIPv6Address &&
host.startsWith("[");
+ return isIPv6Address && !isIPv6Formatted ? "[" + host +
"]" : host;
+ } catch (final UnknownHostException e) {
+ throw new RuntimeException(e);
+ }
}
-
-
}
Modified:
core/trunk/integration-testsuite/common/src/test/resources/integration-test-log4j.xml
===================================================================
---
core/trunk/integration-testsuite/common/src/test/resources/integration-test-log4j.xml 2012-06-17
11:19:52 UTC (rev 426)
+++
core/trunk/integration-testsuite/common/src/test/resources/integration-test-log4j.xml 2012-06-17
14:49:11 UTC (rev 427)
@@ -5,7 +5,7 @@
debug="false">
<appender name="FILE" class="org.apache.log4j.FileAppender">
- <errorHandler
class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <errorHandler
class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
<param name="File" value="target/integration-test.log"/>
<param name="Append" value="false"/>
Modified:
core/trunk/integration-testsuite/cxf/src/test/resources/integration-test-log4j.xml
===================================================================
---
core/trunk/integration-testsuite/cxf/src/test/resources/integration-test-log4j.xml 2012-06-17
11:19:52 UTC (rev 426)
+++
core/trunk/integration-testsuite/cxf/src/test/resources/integration-test-log4j.xml 2012-06-17
14:49:11 UTC (rev 427)
@@ -5,7 +5,7 @@
debug="false">
<appender name="FILE" class="org.apache.log4j.FileAppender">
- <errorHandler
class="org.jboss.logging.util.OnlyOnceErrorHandler"/>
+ <errorHandler
class="org.apache.log4j.helpers.OnlyOnceErrorHandler"/>
<param name="File" value="target/integration-test.log"/>
<param name="Append" value="false"/>
Modified: core/trunk/integration-testsuite/pom.xml
===================================================================
--- core/trunk/integration-testsuite/pom.xml 2012-06-17 11:19:52 UTC (rev 426)
+++ core/trunk/integration-testsuite/pom.xml 2012-06-17 14:49:11 UTC (rev 427)
@@ -133,90 +133,22 @@
</dependencies>
</profile>
<profile>
- <id>jboss5</id>
+ <id>jboss711</id>
<activation>
- <property>
- <name>!jboss6</name>
- </property>
+ <property>
+ <name>!no-jboss711.stack</name>
+ </property>
</activation>
<dependencies>
<dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-server</artifactId>
- <version>5.1.0.GA</version>
+ <groupId>org.jboss.as</groupId>
+ <artifactId>jboss-as-webservices-tests-integration</artifactId>
+ <version>7.1.1.Final</version>
<scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>sun-jaxb</groupId>
- <artifactId>jaxb-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.jpa</groupId>
- <artifactId>jboss-jpa-deployers</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.metadata</groupId>
- <artifactId>jboss-metadata</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-ejb-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.ws.native</groupId>
- <artifactId>jbossws-native-saaj</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.ws.native</groupId>
- <artifactId>jbossws-native-jaxws</artifactId>
- </exclusion>
- </exclusions>
</dependency>
</dependencies>
</profile>
<profile>
- <id>jboss6</id>
- <activation>
- <property>
- <name>jboss6</name>
- </property>
- </activation>
- <dependencies>
- <dependency>
- <groupId>org.jboss.jbossas</groupId>
- <artifactId>jboss-as-server</artifactId>
- <version>6.0.0.20101110-CR1</version>
- <scope>test</scope>
- <exclusions>
- <exclusion>
- <groupId>sun-jaxb</groupId>
- <artifactId>jaxb-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.jpa</groupId>
- <artifactId>jboss-jpa-deployers</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.metadata</groupId>
- <artifactId>jboss-metadata</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.javaee</groupId>
- <artifactId>jboss-ejb-api</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.ws.native</groupId>
- <artifactId>jbossws-native-saaj</artifactId>
- </exclusion>
- <exclusion>
- <groupId>org.jboss.ws.native</groupId>
- <artifactId>jbossws-native-jaxws</artifactId>
- </exclusion>
- </exclusions>
- </dependency>
- </dependencies>
- </profile>
- <profile>
<id>use.endorsed.dir</id>
<activation>
<property>
Modified: core/trunk/pom.xml
===================================================================
--- core/trunk/pom.xml 2012-06-17 11:19:52 UTC (rev 426)
+++ core/trunk/pom.xml 2012-06-17 14:49:11 UTC (rev 427)
@@ -124,15 +124,10 @@
<groupId>org.jboss</groupId>
<artifactId>jboss-common-core</artifactId>
<version>2.2.17.GA</version>
+ <scope>provided</scope>
</dependency>
<dependency>
- <groupId>org.jboss.logging</groupId>
- <artifactId>jboss-logging</artifactId>
- <version>3.1.0.GA</version>
- </dependency>
-
- <dependency>
<groupId>org.jboss.ws</groupId>
<artifactId>jbossws-common</artifactId>
<version>2.0.2.GA</version>