[wsas-java-dev] svn commit r1084 - in
branches/wsas/java/standalone-tomcat/java: .
modules/admin/test-resources/repository/conf
modules/core/src/org/wso2/wsas/transport
modules/core/test-resources modules/integration/conf
modules/samples/CommodityQuote/conf
modules/samples/Trader/conf modules/servlet-edition/conf
modules/standalone-edition modules/standalone-edition/conf
modules/standalone-edition/src/org/wso2/wsas
modules/standalone-edition/test-resources
modules/standalone-edition/test/org/wso2/wsas
svn at wso2.org
svn at wso2.org
Wed Feb 28 21:15:53 PST 2007
Author: saminda
Date: Wed Feb 28 21:15:17 2007
New Revision: 1084
Added:
branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test-resources/wso2wsas.properties
Modified:
branches/wsas/java/standalone-tomcat/java/modules/admin/test-resources/repository/conf/axis2.xml
branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/transport/MainServlet.java
branches/wsas/java/standalone-tomcat/java/modules/core/test-resources/axis2.xml
branches/wsas/java/standalone-tomcat/java/modules/integration/conf/axis2.xml
branches/wsas/java/standalone-tomcat/java/modules/samples/CommodityQuote/conf/axis2.xml
branches/wsas/java/standalone-tomcat/java/modules/samples/Trader/conf/axis2.xml
branches/wsas/java/standalone-tomcat/java/modules/servlet-edition/conf/axis2.xml
branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/conf/axis2.xml
branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/pom.xml
branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/src/org/wso2/wsas/TomcatRepositoryListener.java
branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/src/org/wso2/wsas/TomcatServer.java
branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test-resources/axis2.xml
branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/AbstractTestCase.java
branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/TestConstants.java
branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/TomcatServerTest.java
branches/wsas/java/standalone-tomcat/java/pom.xml
Log:
Initial setup for testcases and cleaning up the code
Modified: branches/wsas/java/standalone-tomcat/java/modules/admin/test-resources/repository/conf/axis2.xml
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/admin/test-resources/repository/conf/axis2.xml (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/admin/test-resources/repository/conf/axis2.xml Wed Feb 28 21:15:17 2007
@@ -80,10 +80,6 @@
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="text/xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="application/echo+xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
</messageFormatters>
<!-- ================================================= -->
Modified: branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/transport/MainServlet.java
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/transport/MainServlet.java (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/core/src/org/wso2/wsas/transport/MainServlet.java Wed Feb 28 21:15:17 2007
@@ -99,10 +99,14 @@
// WSO2 WSAS Home
wso2wsasHome = props.getProperty(ServerPropertyKeys.WSO2WSAS_HOME);
if (wso2wsasHome == null) {
- log.fatal(ServerPropertyKeys.WSO2WSAS_HOME +
- " property not set in wso2wsas.properties file");
- log.info("WSO2 WSAS startup failed.");
- return;
+ // Try to get this from System property
+ wso2wsasHome = System.getProperty(ServerConstants.WSO2WSAS_HOME);
+ if (wso2wsasHome == null) {
+ log.fatal(ServerPropertyKeys.WSO2WSAS_HOME +
+ " property not set in wso2wsas.properties file");
+ log.info("WSO2 WSAS startup failed.");
+ return;
+ }
}
System.setProperty(ServerConstants.AXIS2_HOME, wso2wsasHome);
System.setProperty(ServerConstants.WSO2WSAS_HOME, wso2wsasHome);
@@ -186,7 +190,8 @@
configCtx.setProperty(ServerConstants.WSO2WSAS_INSTANCE, this);
AdminUIServletFilter adminUIServletFilter =
- ((AdminUIServletFilter) servletContext.getAttribute(AdminUIServletFilter.class.getName()));
+ ((AdminUIServletFilter) servletContext
+ .getAttribute(AdminUIServletFilter.class.getName()));
adminUIServletFilter.init((Map) configCtx.getProperty(ServerConstants.GENERATED_PAGES),
configCtx.getContextRoot());
@@ -286,7 +291,7 @@
new Thread(st).start();
}
- public Thread getShutdownHook(){
+ public Thread getShutdownHook() {
return shutdownHook;
}
@@ -295,13 +300,13 @@
}
private void startServerController() {
- if(serverController != null){
+ if (serverController != null) {
return;
}
serverController = new ServerController(this);
String cmdListenerPortStr =
serverConfig.getFirstProperty(ServerConfiguration.COMMAND_LISTENER_PORT);
- if(cmdListenerPortStr == null) {
+ if (cmdListenerPortStr == null) {
return;
}
int cmdListenerPort = Integer.parseInt(cmdListenerPortStr);
Modified: branches/wsas/java/standalone-tomcat/java/modules/core/test-resources/axis2.xml
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/core/test-resources/axis2.xml (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/core/test-resources/axis2.xml Wed Feb 28 21:15:17 2007
@@ -64,10 +64,6 @@
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="text/xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="application/echo+xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
</messageFormatters>
<!-- ================================================= -->
Modified: branches/wsas/java/standalone-tomcat/java/modules/integration/conf/axis2.xml
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/integration/conf/axis2.xml (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/integration/conf/axis2.xml Wed Feb 28 21:15:17 2007
@@ -19,10 +19,6 @@
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="text/xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="application/echo+xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
</messageFormatters>
<!-- ================================================= -->
Modified: branches/wsas/java/standalone-tomcat/java/modules/samples/CommodityQuote/conf/axis2.xml
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/samples/CommodityQuote/conf/axis2.xml (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/samples/CommodityQuote/conf/axis2.xml Wed Feb 28 21:15:17 2007
@@ -22,10 +22,6 @@
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="text/xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="application/echo+xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
</messageFormatters>
<!-- ================================================= -->
Modified: branches/wsas/java/standalone-tomcat/java/modules/samples/Trader/conf/axis2.xml
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/samples/Trader/conf/axis2.xml (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/samples/Trader/conf/axis2.xml Wed Feb 28 21:15:17 2007
@@ -22,10 +22,6 @@
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="text/xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="application/echo+xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
</messageFormatters>
<!-- ================================================= -->
Modified: branches/wsas/java/standalone-tomcat/java/modules/servlet-edition/conf/axis2.xml
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/servlet-edition/conf/axis2.xml (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/servlet-edition/conf/axis2.xml Wed Feb 28 21:15:17 2007
@@ -71,10 +71,6 @@
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="text/xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="application/echo+xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
</messageFormatters>
<!-- ================================================= -->
Modified: branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/conf/axis2.xml
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/conf/axis2.xml (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/conf/axis2.xml Wed Feb 28 21:15:17 2007
@@ -83,10 +83,6 @@
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="text/xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="application/echo+xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
</messageFormatters>
<!-- ================================================= -->
Modified: branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/pom.xml
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/pom.xml (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/pom.xml Wed Feb 28 21:15:17 2007
@@ -67,14 +67,72 @@
<version>1.1</version>
<executions>
<execution>
- <id>process_repo</id>
- <phase>generate-test-resources</phase>
+ <id>populate_repo</id>
+ <phase>process-test-resources</phase>
<configuration>
<tasks>
- <!-- 1. Generate keystore for wsas-->
- <delete file="conf/wso2wsas.jks"/>
+ <!-- 1. Processing Hibernate config and hbm xmls to test cases. Should find a
+ better way to do this.
+ -->
+ <mkdir dir="target/test-classes"/>
+ <copy todir="target/test-classes">
+ <fileset dir="../core/conf/hibernate"/>
+ </copy>
+ <move file="target/test-classes/test-hibernate.cfg.xml"
+ tofile="target/test-classes/wso2wsas.hibernate.cfg.xml"/>
+ <copy file="test-resources/wso2wsas.properties"
+ tofile="target/test-classes/wso2wsas.properties"/>
+
+ <!--2. Building the lightweight Tomcat environment -->
+ <!--
+ target
+ -+ tomcat_test
+ -+ docs
+ <nothing>
+ -+ conf
+ server.xml
+ wso2wsas.jks
+ axis2.xml
+ -+ tomcat
+ -+ conf
+ context.xml
+ tomcat-user.xml
+ web.xml
+ -+ webapp
+ -+ ROOT
+ web.xml
+ -+ repsitory
+ -->
+ <property name="tomcat_test" value="target/tomcat_test"/>
+ <property name="tomcat_conf" value="${tomcat_test}/tomcat/conf"/>
+ <property name="tomcat_repository"
+ value="${tomcat_test}/repository"/>
+ <property name="tomcat_docs" value="${tomcat_test}/docs"/>
+ <property name="standalone_conf" value="${tomcat_test}/conf"/>
+ <property name="tomcat_root"
+ value="${tomcat_test}/tomcat/webapps/ROOT/WEB-INF"/>
+
+ <mkdir dir="${tomcat_conf}"/>
+ <mkdir dir="${standalone_conf}"/>
+ <mkdir dir="${tomcat_root}"/>
+ <mkdir dir="${tomcat_repository}"/>
+ <mkdir dir="${tomcat_docs}"/>
+
+ <copy todir="${tomcat_conf}">
+ <fileset dir="conf/tomcat">
+ <include name="*.xml"/>
+ </fileset>
+ </copy>
+ <copy file="../core/conf/web.xml" tofile="${tomcat_root}/web.xml"/>
+ <copy file="conf/server.xml"
+ tofile="${standalone_conf}/server.xml"/>
+ <copy file="test-resources/axis2.xml"
+ tofile="${standalone_conf}/axis2.xml"/>
+
+ <!-- 3. jks and repository-->
+
<genkey alias="wso2wsas" storepass="wso2wsas" keyalg="RSA"
- keystore="conf/wso2wsas.jks"
+ keystore="${standalone_conf}/wso2wsas.jks"
validity="99999">
<dname>
<param name="CN" value="WSO2WSAS"/>
@@ -85,33 +143,14 @@
</genkey>
<!-- 2. Copying the repo -->
- <copy todir="target/repository">
+ <copy todir="${tomcat_repository}">
<fileset dir="../core/target/repository">
- <include name="*/**"/>
+ <include name="**/*.mar"/>
+ <include name="**/*.aar"/>
</fileset>
</copy>
- </tasks>
- </configuration>
- <goals>
- <goal>run</goal>
- </goals>
- </execution>
- <execution>
- <id>populate_repo</id>
- <phase>process-test-resources</phase>
- <configuration>
- <tasks>
- <!-- 1. Processing Hibernate config and hbm xmls to test cases. Should find a
- better way to do this.
- -->
- <mkdir dir="target/test-classes"/>
- <copy todir="target/test-classes">
- <fileset dir="../core/conf/hibernate"/>
- </copy>
- <move file="target/test-classes/test-hibernate.cfg.xml"
- tofile="target/test-classes/wso2wsas.hibernate.cfg.xml"/>
</tasks>
</configuration>
<goals>
Modified: branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/src/org/wso2/wsas/TomcatRepositoryListener.java
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/src/org/wso2/wsas/TomcatRepositoryListener.java (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/src/org/wso2/wsas/TomcatRepositoryListener.java Wed Feb 28 21:15:17 2007
@@ -15,23 +15,22 @@
*/
package org.wso2.wsas;
-import org.apache.catalina.startup.Embedded;
-import org.apache.catalina.Host;
import org.apache.catalina.Context;
-import org.apache.catalina.loader.ResourceEntry;
+import org.apache.catalina.Host;
+import org.apache.catalina.startup.Embedded;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.wso2.utils.ArchiveManipulator;
import org.wso2.utils.FileManipulator;
-import java.util.*;
import java.io.File;
import java.io.IOException;
+import java.util.*;
/**
*
*/
-public class TomcatRepositoryListener implements Runnable{
+public class TomcatRepositoryListener implements Runnable {
private static Log log = LogFactory.getLog(TomcatRepositoryListener.class);
@@ -80,10 +79,9 @@
long timestamp = ((WebContext) repoMap.get(filename)).getTimestamp();
if (timestamp < file.lastModified()) {
if (filename.endsWith(".war")) {
- String dirName = filename.substring(0,
- filename.indexOf(".war"));
- fileMan.deleteDir(new File(repo.getAbsolutePath() + File.separator +
- dirName));
+ String dirName = filename.substring(0, filename.indexOf(".war"));
+ fileMan.deleteDir(
+ new File(repo.getAbsolutePath() + File.separator + dirName));
try {
arcMan.extract(repo.getAbsolutePath() + File.separator + filename,
repo.getAbsolutePath() + File.separator + dirName);
@@ -99,16 +97,19 @@
if (file.isDirectory()) {
Context context;
if (filename.equals("ROOT")) {
- context = embedded.createContext("/",
- "./" + filename);
+ /**
+ * TODO this has to be a absolute path
+ */
+ context = embedded.createContext("/", file.getAbsolutePath());
host.addChild(context);
} else {
- context = embedded.createContext("/" + filename,
- "./" + filename);
+ context =
+ embedded.createContext("/" + filename, file.getAbsolutePath());
host.addChild(context);
}
log.info("Deployed Web application: " + filename);
+
repoMap.put(filename, new WebContext(file.lastModified(), context));
} else if (filename.endsWith(".war")) { // Handle WAR
try {
Modified: branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/src/org/wso2/wsas/TomcatServer.java
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/src/org/wso2/wsas/TomcatServer.java (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/src/org/wso2/wsas/TomcatServer.java Wed Feb 28 21:15:17 2007
@@ -41,7 +41,9 @@
Engine engine;
String wso2wsasHome = System.getProperty(ServerConstants.WSO2WSAS_HOME);
+
String catalinaHome = new File(wso2wsasHome).getAbsolutePath() + File.separator + "tomcat";
+
embedded.setCatalinaHome(catalinaHome);
String webappsDir = catalinaHome + File.separator + "webapps";
String docsDir = wso2wsasHome + File.separator + "docs";
@@ -60,7 +62,12 @@
Host defaultHost = embedded.createHost(NetworkUtils.getLocalHostname(), webappsDir);
engine.addChild(defaultHost);
- Context docsContext = embedded.createContext("/docs", docsDir);
+ /**
+ * TODO doc base need to absolute. Otherwise it will create a massive mess in 5.5.15
+ * TODO This has been fixed in 5.5.17 and prior.
+ */
+
+ Context docsContext = embedded.createContext("/docs", new File(docsDir).getAbsolutePath());
defaultHost.addChild(docsContext);
defaultHost.setDeployOnStartup(true);
@@ -72,9 +79,10 @@
// Start the embedded server
try {
- new Thread(new TomcatRepositoryListener(embedded,
- defaultHost,
- webappsDir)).start();
+ TomcatRepositoryListener tomcatRepositoryListener =
+ new TomcatRepositoryListener(embedded, defaultHost,
+ new File(webappsDir).getAbsolutePath());
+ new Thread(tomcatRepositoryListener).start();
} catch (Exception e) {
log.error("Cannot start Tomcat repository listener", e);
}
Modified: branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test-resources/axis2.xml
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test-resources/axis2.xml (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test-resources/axis2.xml Wed Feb 28 21:15:17 2007
@@ -64,10 +64,6 @@
class="org.apache.axis2.transport.http.XFormURLEncodedFormatter"/>
<messageFormatter contentType="application/xml"
class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="text/xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
- <messageFormatter contentType="application/echo+xml"
- class="org.apache.axis2.transport.http.ApplicationXMLFormatter"/>
</messageFormatters>
<!-- ================================================= -->
Added: branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test-resources/wso2wsas.properties
==============================================================================
--- (empty file)
+++ branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test-resources/wso2wsas.properties Wed Feb 28 21:15:17 2007
@@ -0,0 +1 @@
+server.info.impl=org.wso2.wsas.EmbeddedTomcatServerInfo
\ No newline at end of file
Modified: branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/AbstractTestCase.java
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/AbstractTestCase.java (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/AbstractTestCase.java Wed Feb 28 21:15:17 2007
@@ -15,28 +15,55 @@
*/
package org.wso2.wsas;
-import org.wso2.wsas.util.ServerUtils;
import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
import org.apache.axiom.om.OMFactory;
import org.apache.axiom.om.OMNamespace;
+import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.context.ConfigurationContext;
import org.custommonkey.xmlunit.XMLTestCase;
+import org.wso2.utils.ServerConfiguration;
+import org.wso2.wsas.util.ServerUtils;
+
+import javax.xml.namespace.QName;
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
public class AbstractTestCase extends XMLTestCase {
protected ServerUtils serverUtils;
+ protected Thread serverThread;
+ /**
+ * Defaut settings for testing framewrok
+ *
+ * @throws Exception
+ */
protected void setUp() throws Exception {
System.setProperty(ServerConstants.DERBY_HOME, "conf");
System.setProperty(ServerConstants.WSO2WSAS_ADMIN_PASSWORD, "abc");
System.setProperty(org.apache.axis2.Constants.AXIS2_CONF,
- "target/repository/axis2.xml");
+ "target/tomcat_test/conf/axis2.xml");
+ System.setProperty(ServerConstants.WSO2WSAS_HOME, "target/tomcat_test");
+ ServerConfiguration.configurationXMLLocation = "target/tomcat_test/conf/server.xml";
serverUtils = new ServerUtils();
+ /*serverThread = new Thread() {
+ public void run() {*/
serverUtils.startServer();
+ /*}
+ };
+ serverThread.start();
+ serverThread.join();*/
}
+ /**
+ * TODO Fix this
+ *
+ * @param serverConfigLocation
+ */
protected void setUp(String serverConfigLocation) {
System.setProperty(ServerConstants.DERBY_HOME, "conf");
System.setProperty(org.apache.axis2.Constants.AXIS2_CONF,
@@ -65,4 +92,47 @@
return method;
}
+ protected static OMElement getTestPayload() {
+ OMFactory fac = OMAbstractFactory.getOMFactory();
+ QName requtestQName =
+ new QName("http://version.services.wsas.wso2.org/xsd", "getVersionRequest");
+
+ OMNamespace ns =
+ fac.createOMNamespace(requtestQName.getNamespaceURI(), "ns");
+ return fac.createOMElement(requtestQName.getLocalPart(), ns);
+
+ }
+
+ public void testConnect(EndpointReference epr) throws Exception {
+
+ URL url;
+ try {
+ url = new URL(epr.getAddress());
+ } catch (MalformedURLException e) {
+ throw new Exception(e);
+ }
+
+ while (true) {
+ try {
+ HttpURLConnection httpCon;
+ httpCon = (HttpURLConnection) url.openConnection();
+ httpCon.setDoOutput(true);
+ httpCon.setDoInput(true);
+ httpCon.setUseCaches(false);
+ httpCon.setRequestMethod("GET");
+ HttpURLConnection.setFollowRedirects(true);
+
+ httpCon.connect();
+ break;
+ } catch (IOException e) {
+ try {
+ Thread.sleep(2000);
+ } catch (InterruptedException e1) {
+ break;
+ }
+ }
+ }
+
+ }
+
}
Modified: branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/TestConstants.java
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/TestConstants.java (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/TestConstants.java Wed Feb 28 21:15:17 2007
@@ -19,8 +19,8 @@
public final class TestConstants {
public static final int TESTING_PORT = 9762;
- public static final String TESTING_REPO = "target/repository";
-
+ public static final String TESTING_REPO = "target/tomcat_test/repository";
+
public static final QName ECHO_SERVICE_NAME = new QName("Echo");
public static final QName ECHO_OPERATION = new QName("echoOMElement");
}
Modified: branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/TomcatServerTest.java
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/TomcatServerTest.java (original)
+++ branches/wsas/java/standalone-tomcat/java/modules/standalone-edition/test/org/wso2/wsas/TomcatServerTest.java Wed Feb 28 21:15:17 2007
@@ -15,67 +15,44 @@
*/
package org.wso2.wsas;
-import org.wso2.wsas.util.ServerUtils;
-import org.wso2.utils.NetworkUtils;
-import org.wso2.utils.ServerConfiguration;
-import junit.framework.TestCase;
-import org.apache.axiom.om.OMAbstractFactory;
import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axiom.om.OMNamespace;
import org.apache.axis2.Constants;
import org.apache.axis2.addressing.EndpointReference;
import org.apache.axis2.client.Options;
import org.apache.axis2.client.ServiceClient;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.context.ConfigurationContextFactory;
+import org.wso2.utils.NetworkUtils;
import javax.xml.namespace.QName;
-public class TomcatServerTest extends TestCase {
+public class TomcatServerTest extends AbstractTestCase {
protected QName operationName = new QName("getVersion");
- protected ServerUtils serverUtils;
- protected Thread serverThread;
protected void setUp() throws Exception {
- ServerConfiguration.configurationXMLLocation = "conf/server.xml";
- System.setProperty(ServerConstants.WSO2WSAS_ADMIN_PASSWORD, "abc");
- System.setProperty("axis2.xml", "target/repository/axis2.xml");
- System.setProperty(ServerConstants.DERBY_HOME, "conf");
- serverUtils = new ServerUtils();
- serverThread = new Thread() {
- public void run() {
- serverUtils.startServer();
-// serverUtils.deployServiceUsingInOutMsgReceiver();
-
- /* try {
- Thread.sleep(5000);
- } catch (InterruptedException e) {
- e.printStackTrace();
- }*/
- System.err.println("##### Server started successfully");
- }
- };
+ super.setUp();
}
public void testEchoXMLSync() throws Exception {
- Thread clientThread = new Thread() {
- public void run() {
+ /*Thread clientThread = new Thread() {
+ public void run() {*/
try {
- System.err.println("##### Starting client");
+ System.getProperties().remove(org.apache.axis2.Constants.AXIS2_CONF);
ConfigurationContext configContext =
ConfigurationContextFactory.
- createConfigurationContextFromFileSystem(TestConstants.TESTING_REPO,
- null);
+ createConfigurationContextFromFileSystem(
+ TestConstants.TESTING_REPO, null);
ServiceClient sender = new ServiceClient(configContext, null);
EndpointReference targetEPR =
new EndpointReference("http://" + NetworkUtils.getLocalHostname() + ":"
- + TestConstants.TESTING_PORT
+ + (TestConstants.TESTING_PORT)
+ "/soap/version/getVersion");
+ testConnect(targetEPR);
+
Options options = new Options();
options.setTo(targetEPR);
options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
@@ -85,33 +62,17 @@
OMElement result = sender.sendReceive(getTestPayload());
String versionText = result.getFirstElement().getText();
- int i = versionText.indexOf("Hello I am WSO2 WSAS version service. My version is ");
+ int i = versionText
+ .indexOf("Hello I am WSO2 WSAS version service. My version is ");
assertTrue(i != -1);
- System.err.println("##### Test passed");
} catch (Exception e) {
e.printStackTrace();
fail("Exception occurred during startup " + e);
}
- }
+ /*}
};
- serverThread.start();
- serverThread.join();
clientThread.start();
- clientThread.join();
+ clientThread.join();*/
}
- protected void tearDown() throws Exception {
- serverUtils.shutdown();
- }
-
- public static OMElement getTestPayload() {
- OMFactory fac = OMAbstractFactory.getOMFactory();
- QName requtestQName = new QName("http://version.services.wsas.wso2.org/xsd",
- "getVersionRequest");
-
- OMNamespace ns =
- fac.createOMNamespace(requtestQName.getNamespaceURI(), "ns");
- return fac.createOMElement(requtestQName.getLocalPart(), ns);
-
- }
}
Modified: branches/wsas/java/standalone-tomcat/java/pom.xml
==============================================================================
--- branches/wsas/java/standalone-tomcat/java/pom.xml (original)
+++ branches/wsas/java/standalone-tomcat/java/pom.xml Wed Feb 28 21:15:17 2007
@@ -758,6 +758,13 @@
<version>${geronimo.spec.jms.version}</version>
</dependency>
+ <!-- adding slf4j for hibernate -->
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-log4j12</artifactId>
+ <version>${slf4j.version}</version>
+ </dependency>
+
</dependencies>
<profiles>
@@ -1082,6 +1089,8 @@
<tomcat.version>5.5.15</tomcat.version>
+ <slf4j.version>1.0.1</slf4j.version>
+
</properties>
More information about the Wsas-java-dev
mailing list