Author: thomas.diesler(a)jboss.com
Date: 2007-02-01 06:24:40 -0500 (Thu, 01 Feb 2007)
New Revision: 2235
Modified:
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/JBossWSTestSetup.java
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/samples/wsbpel/JbpmBpelTestSetup.java
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wsdlpublish/TestEndpointImpl.java
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wsdlpublish/WsdlPublishTestCase.java
Log:
Conditionally deploy bpel.sar
Fix wsdl-publish test case
Modified:
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/JBossWSTestSetup.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/JBossWSTestSetup.java 2007-02-01
11:02:29 UTC (rev 2234)
+++
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/JBossWSTestSetup.java 2007-02-01
11:24:40 UTC (rev 2235)
@@ -28,6 +28,7 @@
import java.util.StringTokenizer;
import junit.extensions.TestSetup;
+import junit.framework.Test;
import junit.framework.TestSuite;
/**
@@ -39,16 +40,16 @@
public class JBossWSTestSetup extends TestSetup
{
private JBossWSTestHelper delegate = new JBossWSTestHelper();
- private String[] archives;
+ private String[] archives = new String[0];
public static JBossWSTestSetup newTestSetup(Class testClass, String archiveList)
{
return new JBossWSTestSetup(testClass, archiveList);
}
- public static JBossWSTestSetup newTestSetup(TestSuite testSuite, String archiveList)
+ public static JBossWSTestSetup newTestSetup(Test test, String archiveList)
{
- return new JBossWSTestSetup(testSuite, archiveList);
+ return new JBossWSTestSetup(test, archiveList);
}
protected JBossWSTestSetup(Class testClass, String archiveList)
@@ -57,19 +58,22 @@
getArchiveArray(archiveList);
}
- protected JBossWSTestSetup(TestSuite testSuite, String archiveList)
+ protected JBossWSTestSetup(Test test, String archiveList)
{
- super(testSuite);
+ super(test);
getArchiveArray(archiveList);
}
private void getArchiveArray(String archiveList)
{
- StringTokenizer st = new StringTokenizer(archiveList, ", ");
- archives = new String[st.countTokens()];
+ if (archiveList != null)
+ {
+ StringTokenizer st = new StringTokenizer(archiveList, ", ");
+ archives = new String[st.countTokens()];
- for (int i = 0; i < archives.length; i++)
- archives[i] = st.nextToken();
+ for (int i = 0; i < archives.length; i++)
+ archives[i] = st.nextToken();
+ }
}
protected void setUp() throws Exception
Modified:
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/samples/wsbpel/JbpmBpelTestSetup.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/samples/wsbpel/JbpmBpelTestSetup.java 2007-02-01
11:02:29 UTC (rev 2234)
+++
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/samples/wsbpel/JbpmBpelTestSetup.java 2007-02-01
11:24:40 UTC (rev 2235)
@@ -21,33 +21,45 @@
import java.net.URL;
import java.net.URLEncoder;
-import junit.extensions.TestSetup;
+import javax.management.ObjectName;
+
import junit.framework.Test;
import org.jboss.logging.Logger;
import org.jboss.test.ws.JBossWSTestHelper;
+import org.jboss.test.ws.JBossWSTestSetup;
+import org.jboss.ws.core.utils.ObjectNameFactory;
/**
* A test setup that deploys process archives.
*
* @author <a href="mailto:alex.guizar@jboss.com">Alejandro
Guizar</a>
+ * @author Thomas.Diesler(a)jboss.com
* @version $Revision$
*/
-public class JbpmBpelTestSetup extends TestSetup
+public class JbpmBpelTestSetup extends JBossWSTestSetup
{
+ private final ObjectName oname =
ObjectNameFactory.create("jboss.jbpm:name=JbpmBpel,service=JbpmService");
private final String[] processFiles;
+ private boolean undeployOnTearDown;
private static final Logger log = Logger.getLogger(JbpmBpelTestSetup.class);
public JbpmBpelTestSetup(Test test, String[] processFiles)
{
- super(test);
+ super(test, null);
this.processFiles = processFiles;
}
protected void setUp() throws Exception
{
- new JBossWSTestHelper().deploy("jbpm-bpel.sar");
+ // Deploy jbpm-bpel.sar if it is not deployed already
+ JBossWSTestHelper helper = new JBossWSTestHelper();
+ if (JBossWSTestHelper.getServer().isRegistered(oname) == false)
+ {
+ helper.deploy("jbpm-bpel.sar");
+ undeployOnTearDown = true;
+ }
for (int i = 0; i < processFiles.length; i++)
{
@@ -58,17 +70,17 @@
if (!processFile.exists())
throw new FileNotFoundException(processFileName);
- deploy(processFile);
+ deployProcess(processFile);
}
}
- @Override
protected void tearDown() throws Exception
{
- new JBossWSTestHelper().undeploy("jbpm-bpel.sar");
+ if (undeployOnTearDown)
+ new JBossWSTestHelper().undeploy("jbpm-bpel.sar");
}
- public static void deploy(File processFile) throws Exception
+ public static void deployProcess(File processFile) throws Exception
{
// format file component
String file = getJbpmBpelDeployContext() + "?processfile=" +
URLEncoder.encode(processFile.toURI().toString(), "UTF-8");
Modified:
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wsdlpublish/TestEndpointImpl.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wsdlpublish/TestEndpointImpl.java 2007-02-01
11:02:29 UTC (rev 2234)
+++
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wsdlpublish/TestEndpointImpl.java 2007-02-01
11:24:40 UTC (rev 2235)
@@ -24,10 +24,10 @@
import java.io.File;
import java.net.URL;
+import javax.xml.namespace.QName;
+
import org.jboss.logging.Logger;
import org.jboss.ws.WSException;
-import org.jboss.ws.core.server.ServerConfig;
-import org.jboss.ws.core.server.ServerConfigFactory;
import org.jboss.ws.metadata.wsdl.WSDLDefinitions;
import org.jboss.ws.tools.wsdl.WSDLDefinitionsFactory;
@@ -35,28 +35,24 @@
{
private Logger log = Logger.getLogger(TestEndpointImpl.class);
- public String echoSimple(String inStr)
+ public String echoSimple(String wsdlPath)
{
- // Get the server data dir
- ServerConfigFactory factory = ServerConfigFactory.getInstance();
- ServerConfig serverConfig = factory.getServerConfig();
- File dataDir = serverConfig.getServerDataDir();
+ log.info("echoSimple: " + wsdlPath);
// Parse the wsdl from the expected publish location
// Append the portType name to the return string
+ QName portType = null;
try
{
- URL wsdlURL = new File(dataDir.getAbsolutePath() +
"/wsdl/some-wsdl-location/foo/bar/TestService.wsdl").toURL();
+ URL wsdlURL = new File(wsdlPath).toURL();
WSDLDefinitions wsdl = WSDLDefinitionsFactory.newInstance().parse(wsdlURL);
- inStr += ":" + wsdl.getInterfaces()[0].getName();
+ portType = wsdl.getInterfaces()[0].getQName();
}
catch (Exception ex)
{
WSException.rethrow(ex);
}
- log.info("echoSimple: " + inStr);
-
- return inStr;
+ return portType.toString();
}
}
Modified:
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wsdlpublish/WsdlPublishTestCase.java
===================================================================
---
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wsdlpublish/WsdlPublishTestCase.java 2007-02-01
11:02:29 UTC (rev 2234)
+++
branches/jbossws-1.2.0/jbossws-tests/src/main/java/org/jboss/test/ws/jaxrpc/wsdlpublish/WsdlPublishTestCase.java 2007-02-01
11:24:40 UTC (rev 2235)
@@ -55,7 +55,7 @@
TestEndpoint port = (TestEndpoint)service.getPort(TestEndpoint.class);
- String resStr = port.echoSimple("Hello");
- assertEquals("Hello:TestEndpoint", resStr);
+ String resStr = port.echoSimple(new
File("wsdl-publish/some-wsdl-location/foo/bar/TestService.wsdl").getAbsolutePath());
+ assertEquals("{http://org.jboss.test.ws/wsdlpublish}TestEndpoint",
resStr);
}
}
Show replies by date