[jbosstools-commits] JBoss Tools SVN: r30838 - in trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test: command and 1 other directory.
jbosstools-commits at lists.jboss.org
jbosstools-commits at lists.jboss.org
Tue Apr 26 03:15:46 EDT 2011
Author: Grid.Qian
Date: 2011-04-26 03:15:45 -0400 (Tue, 26 Apr 2011)
New Revision: 30838
Modified:
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/JBossWSCreationCoreTestSuite.java
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/AbstractJBossWSGenerationTest.java
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSJavaFirstCommandTest.java
trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSTopDownCommandTest.java
Log:
JBIDE-8729: fix the junit test failed
Modified: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/JBossWSCreationCoreTestSuite.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/JBossWSCreationCoreTestSuite.java 2011-04-26 01:44:31 UTC (rev 30837)
+++ trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/JBossWSCreationCoreTestSuite.java 2011-04-26 07:15:45 UTC (rev 30838)
@@ -31,6 +31,7 @@
suite.addTestSuite(JBossWSClientCommandTest.class);
suite.addTestSuite(JBossWSMergeWebXMLCommandTest.class);
suite.addTestSuite(JBossWSClientSampleCreationCommandTest.class);
+
return suite;
}
}
\ No newline at end of file
Modified: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/AbstractJBossWSGenerationTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/AbstractJBossWSGenerationTest.java 2011-04-26 01:44:31 UTC (rev 30837)
+++ trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/AbstractJBossWSGenerationTest.java 2011-04-26 07:15:45 UTC (rev 30838)
@@ -9,6 +9,7 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.NullProgressMonitor;
import org.eclipse.core.runtime.Path;
import org.eclipse.wst.common.frameworks.datamodel.IDataModel;
import org.eclipse.wst.common.project.facet.core.IFacetedProject;
@@ -19,6 +20,7 @@
import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.server.core.IServerWorkingCopy;
import org.eclipse.wst.server.core.ServerUtil;
+import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.test.ASTest;
import org.jboss.ide.eclipse.as.test.util.ServerRuntimeUtils;
@@ -55,7 +57,7 @@
}
public void createWSServer() throws Exception {
- currentServer = createServer(IJBossToolingConstants.AS_42, IJBossToolingConstants.SERVER_AS_42, ASTest.JBOSS_AS_42_HOME, DEFAULT_CONFIG,JREUtils.createJRE());
+ currentServer = createServer(IJBossToolingConstants.AS_42, IJBossToolingConstants.SERVER_AS_42, ASTest.JBOSS_AS_42_HOME, DEFAULT_CONFIG,JREUtils.createJRE());
}
public IProject createProject(String prjName) throws CoreException {
@@ -94,8 +96,13 @@
public IStatus publishWebProject(IProject project) throws CoreException {
IModule mod = ServerUtil.getModule(project);
- currentServer = ServerRuntimeUtils.addModule(currentServer, mod);
- IStatus status = ServerRuntimeUtils.publish(currentServer);
+ JBossServer ds = (JBossServer)currentServer.loadAdapter(JBossServer.class, new NullProgressMonitor());
+ IServerWorkingCopy copy = currentServer.createWorkingCopy();
+ copy.modifyModules(new IModule[]{mod}, new IModule[0], new NullProgressMonitor());
+ currentServer = copy.save(true, new NullProgressMonitor());
+ ds = (JBossServer)currentServer.loadAdapter(JBossServer.class, new NullProgressMonitor());
+ ds.setDeployLocationType("server");
+ IStatus status = ServerRuntimeUtils.publish(IServer.PUBLISH_INCREMENTAL,currentServer);
return status;
}
@@ -104,7 +111,6 @@
}
public void tearDown() throws Exception{
- undeployWebProject();
cleanResouces();
JBossWSRuntime runtime = JBossWSRuntimeManager.getInstance().findRuntimeByName(RuntimeName);
JBossWSRuntimeManager.getInstance().removeRuntime(runtime);
@@ -143,10 +149,10 @@
protected void undeployWebProject() throws CoreException {
IModule[] modules = ServerUtil.getModules(currentServer.getServerType()
.getRuntimeType().getModuleTypes());
- IServerWorkingCopy serverWC = currentServer.createWorkingCopy();
+ JBossServer ds = (JBossServer)currentServer.loadAdapter(JBossServer.class, new NullProgressMonitor());
+ IServerWorkingCopy serverWC = ds.getServerWorkingCopy();
serverWC.modifyModules(null, modules, null);
- serverWC.save(true, null).publish(0, null);
- currentServer.publish(IServer.PUBLISH_FULL, null);
+ serverWC.save(true, null).publish(IServer.PUBLISH_FULL, null);
}
private final void addResourceToCleanup(final IResource resource) {
Modified: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSJavaFirstCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSJavaFirstCommandTest.java 2011-04-26 01:44:31 UTC (rev 30837)
+++ trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSJavaFirstCommandTest.java 2011-04-26 07:15:45 UTC (rev 30838)
@@ -11,9 +11,6 @@
package org.jboss.tools.ws.creation.core.test.command;
import java.io.IOException;
-import java.net.HttpURLConnection;
-import java.net.URL;
-import java.net.URLConnection;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IProject;
@@ -30,7 +27,6 @@
import org.eclipse.ui.console.IConsole;
import org.eclipse.ui.console.IConsoleManager;
import org.eclipse.ui.console.TextConsole;
-import org.eclipse.wst.server.core.IServer;
import org.eclipse.wst.ws.internal.wsrt.IWebService;
import org.eclipse.wst.ws.internal.wsrt.WebServiceInfo;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
@@ -76,15 +72,10 @@
fproject.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
fproject.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
- startup(currentServer);
publishWebProject(fproject.getProject());
- JobUtils.delay(60000);
- String webServiceUrl = "http://localhost:8080/JavaFirstTestProject/HelloWorld?wsdl";
- URL url = new URL(webServiceUrl);
- URLConnection conn = url.openConnection();
- assertEquals("unable to start JBoss server", IServer.STATE_STARTED,currentServer.getServerState());
- conn.connect();
- assertFalse("The url connection's status is "+ ((HttpURLConnection) conn).getResponseMessage(), "Ok".equals(((HttpURLConnection) conn).getResponseMessage()));
+ JobUtils.delay(20000);
+ startup(currentServer);
+ JobUtils.delay(20000);
model.setWebProjectName("ClientTest");
RemoveClientJarsCommand cmd = new RemoveClientJarsCommand(model);
@@ -105,6 +96,7 @@
wc.launch(ILaunchManager.RUN_MODE, null);
IConsoleManager consolemanager = JBossWSCreationCoreTestUtils.getConsoleManager();
checkText(consolemanager.getConsoles());
+ undeployWebProject();
}
public void doInitialCommand() throws CoreException, ExecutionException {
@@ -156,4 +148,10 @@
public static boolean isContainString(IConsole console, String str) {
return ((TextConsole) console).getDocument().get().contains(str);
}
+
+
+ public void tearDown() throws Exception{
+ undeployWebProject();
+ super.tearDown();
+ }
}
Modified: trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSTopDownCommandTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSTopDownCommandTest.java 2011-04-26 01:44:31 UTC (rev 30837)
+++ trunk/ws/tests/org.jboss.tools.ws.creation.core.test/src/org/jboss/tools/ws/creation/core/test/command/JBossWSTopDownCommandTest.java 2011-04-26 07:15:45 UTC (rev 30838)
@@ -34,6 +34,8 @@
import org.eclipse.wst.ws.internal.wsrt.WebServiceInfo;
import org.eclipse.wst.ws.internal.wsrt.WebServiceScenario;
import org.jboss.tools.test.util.JobUtils;
+import org.jboss.tools.ws.core.classpath.JBossWSRuntime;
+import org.jboss.tools.ws.core.classpath.JBossWSRuntimeManager;
import org.jboss.tools.ws.creation.core.commands.ImplementationClassCreationCommand;
import org.jboss.tools.ws.creation.core.commands.InitialCommand;
import org.jboss.tools.ws.creation.core.commands.MergeWebXMLCommand;
@@ -63,9 +65,12 @@
fproject.getProject().refreshLocal(IResource.DEPTH_INFINITE, null);
fproject.getProject().build(IncrementalProjectBuilder.FULL_BUILD, null);
+
+ publishWebProject(fproject.getProject());
+ JobUtils.delay(10000);
startup(currentServer);
- publishWebProject(fproject.getProject());
- JobUtils.delay(15000);
+ JobUtils.delay(10000);
+
assertTrue(currentServer.getModules().length > 0);
String webServiceUrl = "http://127.0.0.1:8080/JBossWSTestProject/Greeter?wsdl";
URL url = new URL(webServiceUrl);
@@ -150,4 +155,9 @@
assertEquals("Greeter", mapping.getServlet().getServletName());
}
}
+
+ public void tearDown() throws Exception{
+ undeployWebProject();
+ super.tearDown();
+ }
}
More information about the jbosstools-commits
mailing list