You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ode.apache.org by mi...@apache.org on 2008/10/18 02:19:19 UTC
svn commit: r705812 -
/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/RampartTest.java
Author: midon
Date: Fri Oct 17 17:19:19 2008
New Revision: 705812
URL: http://svn.apache.org/viewvc?rev=705812&view=rev
Log:
leverage the TestNG parameters
Modified:
ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/RampartTest.java
Modified: ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/RampartTest.java
URL: http://svn.apache.org/viewvc/ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/RampartTest.java?rev=705812&r1=705811&r2=705812&view=diff
==============================================================================
--- ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/RampartTest.java (original)
+++ ode/branches/APACHE_ODE_1.X/axis2-war/src/test/java/org/apache/ode/axis2/RampartTest.java Fri Oct 17 17:19:19 2008
@@ -20,11 +20,20 @@
package org.apache.ode.axis2;
import org.apache.axis2.transport.http.SimpleHTTPServer;
+import org.testng.annotations.Test;
+import org.testng.annotations.Factory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import static org.testng.AssertJUnit.assertTrue;
import java.net.URL;
import java.io.File;
import java.io.FilenameFilter;
import java.io.FileFilter;
+import java.util.Arrays;
/**
*
@@ -32,31 +41,40 @@
*/
public class RampartTest extends Axis2TestBase {
- protected void setUp() throws Exception {
- startServer("TestRampart", "webapp/WEB-INF/conf/axis2.xml");
- }
-
- public void testPolicySamples() throws Exception {
- File[] policies = new File(server.getBundleDir("TestRampart")).listFiles(new FileFilter() {
+ @DataProvider(name = "bundles")
+ public Object[][] testPolicySamples() throws Exception {
+ File[] policies = new File(getClass().getClassLoader().getResource("TestRampart").getFile()).listFiles(new FileFilter() {
public boolean accept(File pathname) {
return pathname.isDirectory() && pathname.getName().matches("process-policy-sample\\d*");
}
});
+ Object[][] bundles = new Object[policies.length][];
for (int i = 0; i < policies.length; i++) {
- String prevPackage = i>0?policies[i-1].getName():null;
- String nextPackage = policies[i].getName();
- // make sure everything is clean to avoid side effects
- if (prevPackage!=null && server.isDeployed(prevPackage)) server.undeployProcess("TestRampart/"+prevPackage);
- if (server.isDeployed(nextPackage)) server.undeployProcess("TestRampart/"+nextPackage);
-
- executeTest("TestRampart/"+nextPackage);
+ bundles[i] = new Object[]{"TestRampart/" + policies[i].getName()};
}
+// bundles = new Object[][]{new Object[]{"TestRampart/process-policy-sample05"}};
+ return bundles;
+ }
+
+
+ @BeforeClass
+ protected void setUp() throws Exception {
+ // mind the annotatio above also
+ startServer("TestRampart", "webapp/WEB-INF/conf/axis2.xml");
+ }
+
+ @AfterClass
+ protected void tearDown() throws Exception {
+ // simply change the annotation, see above
+ super.tearDown();
}
- public void executeTest(String bundleName) throws Exception {
+ @Test(dataProvider = "bundles")
+ public void executeProcess(String bundleName) throws Exception {
+ if (server.isDeployed(bundleName)) server.undeployProcess(bundleName);
server.deployProcess(bundleName);
try {
- String response = server.sendRequestFile("http://localhost:8080/processes/helloWorld",
+ String response = server.sendRequestFile("http://localhost:8888/processes/helloWorld",
bundleName, "testRequest.soap");
System.out.println(response);
assertTrue(response.contains("helloResponse") && response.contains("Hello World"));