Author: rob.stryker(a)jboss.com
Date: 2008-01-30 21:09:20 -0500 (Wed, 30 Jan 2008)
New Revision: 6044
Added:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/classpath/test/ProjectRuntimeTest.java
Removed:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/classpath/test/JBIDE1657Test.java
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/model/RuntimeServerModelTest.java
Log:
In progress / transition. lots of changes. more to follow
Deleted:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/classpath/test/JBIDE1657Test.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/classpath/test/JBIDE1657Test.java 2008-01-31
02:06:39 UTC (rev 6043)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/classpath/test/JBIDE1657Test.java 2008-01-31
02:09:20 UTC (rev 6044)
@@ -1,94 +0,0 @@
-package org.jboss.ide.eclipse.as.classpath.test;
-
-import java.util.ArrayList;
-import java.util.Arrays;
-
-import junit.framework.TestCase;
-
-import org.eclipse.core.resources.IProject;
-import org.eclipse.core.resources.IResource;
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.core.runtime.NullProgressMonitor;
-import org.eclipse.jdt.core.IClasspathEntry;
-import org.eclipse.jdt.core.IJavaProject;
-import org.eclipse.jdt.core.JavaCore;
-import org.eclipse.jdt.core.JavaModelException;
-import org.eclipse.wst.server.core.IRuntime;
-import org.jboss.ide.eclipse.as.test.ASTest;
-import org.jboss.ide.eclipse.as.test.util.ProjectRuntimeUtil;
-import org.jboss.tools.common.test.util.TestProjectProvider;
-
-public class JBIDE1657Test extends TestCase {
- private TestProjectProvider provider;
- private IProject project;
-
- protected void setUp() throws Exception {
- provider = new TestProjectProvider("org.jboss.ide.eclipse.as.test", null,
"basicwebproject", true);
- project = provider.getProject();
- project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
- }
-
- protected void tearDown() throws Exception {
- provider.dispose();
- }
-
- public void testJBIDE1657() {
- try {
- IJavaProject jp = JavaCore.create(project);
- verifyInitialClasspathEntries(jp);
-
- // lets try a runtime
- IRuntime createdRuntime = ProjectRuntimeUtil.createRuntime("runtime1",
ASTest.JBOSS_RUNTIME_42, ASTest.JBOSS_AS_HOME);
- ProjectRuntimeUtil.setTargetRuntime(createdRuntime, project);
- verifyPostRuntimeCPE(jp);
-
- ProjectRuntimeUtil.clearRuntime(project);
- verifyInitialClasspathEntries(jp);
-
- } catch( JavaModelException jme ) {
- jme.printStackTrace();
- fail(jme.getMessage());
- } catch( CoreException ce ) {
- ce.printStackTrace();
- fail(ce.getMessage());
- }
- }
-
- protected void verifyPostRuntimeCPE(IJavaProject jp) throws CoreException {
- IClasspathEntry[] entries = jp.getRawClasspath();
- assertEquals(3, entries.length);
- String[] acceptable = new String[] {
"org.eclipse.jst.server.core.container",
- "basicwebproject", "org.eclipse.jst.j2ee.internal.web.container"
};
- verifyClasspathEntries(entries, acceptable);
- }
-
- protected void verifyInitialClasspathEntries(IJavaProject jp) throws CoreException {
- IClasspathEntry[] entries = jp.getRawClasspath();
- assertEquals(2, entries.length);
-
- // TODO: Currently fails because the JRE is not bound. This must be changed.
- //IClasspathEntry[] resolved = jp.getResolvedClasspath(false);
-
- String[] acceptable = new String[] {
"org.eclipse.jst.j2ee.internal.web.container",
- "basicwebproject"};
- verifyClasspathEntries(entries, acceptable);
- }
-
- protected void verifyClasspathEntries(IClasspathEntry[] entries, String[]
acceptablePrefixes) {
- ArrayList list = new ArrayList(Arrays.asList(acceptablePrefixes));
- for( int i = 0; i < entries.length; i++ ) {
- if( list.contains(entries[i].getPath().segment(0)))
- list.remove(entries[i].getPath().segment(0));
- else
- fail("classpath contains unexpected entry: " + entries[i].getPath());
- }
-
- if( list.size() > 0 ) {
- String tmp = "Expected enties not found: ";
- for( int i = 0; i < list.size(); i++ ) {
- tmp += list.get(i) + ", ";
- }
- fail(tmp.substring(0, tmp.length() - 2));
- }
- }
-}
Copied:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/classpath/test/ProjectRuntimeTest.java
(from rev 6042,
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/classpath/test/JBIDE1657Test.java)
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/classpath/test/ProjectRuntimeTest.java
(rev 0)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/classpath/test/ProjectRuntimeTest.java 2008-01-31
02:09:20 UTC (rev 6044)
@@ -0,0 +1,91 @@
+package org.jboss.ide.eclipse.as.classpath.test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+
+import junit.framework.TestCase;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IResource;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.jdt.core.IClasspathEntry;
+import org.eclipse.jdt.core.IJavaProject;
+import org.eclipse.jdt.core.JavaCore;
+import org.eclipse.jdt.core.JavaModelException;
+import org.eclipse.wst.server.core.IRuntime;
+import org.jboss.ide.eclipse.as.test.ASTest;
+import org.jboss.ide.eclipse.as.test.util.ProjectRuntimeUtil;
+import org.jboss.tools.common.test.util.TestProjectProvider;
+
+public class ProjectRuntimeTest extends TestCase {
+ private TestProjectProvider provider;
+ private IProject project;
+
+ protected void setUp() throws Exception {
+ provider = new TestProjectProvider("org.jboss.ide.eclipse.as.test", null,
"basicwebproject", true);
+ project = provider.getProject();
+ project.refreshLocal(IResource.DEPTH_INFINITE, new NullProgressMonitor());
+ }
+
+ protected void tearDown() throws Exception {
+ provider.dispose();
+ }
+
+ public void testProjectRuntime() {
+ try {
+ IJavaProject jp = JavaCore.create(project);
+ verifyInitialClasspathEntries(jp);
+
+ // lets try a runtime
+ IRuntime createdRuntime = ProjectRuntimeUtil.createRuntime("runtime1",
ASTest.JBOSS_RUNTIME_42, ASTest.JBOSS_AS_HOME);
+ ProjectRuntimeUtil.setTargetRuntime(createdRuntime, project);
+ verifyPostRuntimeCPE(jp);
+
+ ProjectRuntimeUtil.clearRuntime(project);
+ verifyInitialClasspathEntries(jp);
+
+ } catch( JavaModelException jme ) {
+ jme.printStackTrace();
+ fail(jme.getMessage());
+ } catch( CoreException ce ) {
+ ce.printStackTrace();
+ fail(ce.getMessage());
+ }
+ }
+
+ protected void verifyPostRuntimeCPE(IJavaProject jp) throws CoreException {
+ IClasspathEntry[] entries = jp.getRawClasspath();
+ assertEquals(3, entries.length);
+ String[] acceptable = new String[] {
"org.eclipse.jst.server.core.container",
+ "basicwebproject", "org.eclipse.jst.j2ee.internal.web.container"
};
+ verifyClasspathEntries(entries, acceptable);
+ }
+
+ protected void verifyInitialClasspathEntries(IJavaProject jp) throws CoreException {
+ IClasspathEntry[] entries = jp.getRawClasspath();
+ assertEquals(2, entries.length);
+
+ String[] acceptable = new String[] {
"org.eclipse.jst.j2ee.internal.web.container",
+ "basicwebproject"};
+ verifyClasspathEntries(entries, acceptable);
+ }
+
+ protected void verifyClasspathEntries(IClasspathEntry[] entries, String[]
acceptablePrefixes) {
+ ArrayList list = new ArrayList(Arrays.asList(acceptablePrefixes));
+ for( int i = 0; i < entries.length; i++ ) {
+ if( list.contains(entries[i].getPath().segment(0)))
+ list.remove(entries[i].getPath().segment(0));
+ else
+ fail("classpath contains unexpected entry: " + entries[i].getPath());
+ }
+
+ if( list.size() > 0 ) {
+ String tmp = "Expected enties not found: ";
+ for( int i = 0; i < list.size(); i++ ) {
+ tmp += list.get(i) + ", ";
+ }
+ fail(tmp.substring(0, tmp.length() - 2));
+ }
+ }
+}
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java 2008-01-31
02:06:39 UTC (rev 6043)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java 2008-01-31
02:09:20 UTC (rev 6044)
@@ -1,6 +1,6 @@
package org.jboss.ide.eclipse.as.test;
-import org.jboss.ide.eclipse.as.classpath.test.JBIDE1657Test;
+import org.jboss.ide.eclipse.as.classpath.test.ProjectRuntimeTest;
import org.jboss.ide.eclipse.as.classpath.test.JEEClasspathContainerTest;
import org.jboss.ide.eclipse.as.test.model.RuntimeServerModelTest;
@@ -13,7 +13,7 @@
suite.addTestSuite(RuntimeServerModelTest.class);
suite.addTestSuite(JEEClasspathContainerTest.class);
- suite.addTestSuite(JBIDE1657Test.class);
+ suite.addTestSuite(ProjectRuntimeTest.class);
return suite;
}
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/model/RuntimeServerModelTest.java
===================================================================
---
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/model/RuntimeServerModelTest.java 2008-01-31
02:06:39 UTC (rev 6043)
+++
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/model/RuntimeServerModelTest.java 2008-01-31
02:09:20 UTC (rev 6044)
@@ -12,7 +12,7 @@
import org.jboss.ide.eclipse.as.test.ASTest;
public class RuntimeServerModelTest extends TestCase {
-
+
//
https://bugs.eclipse.org/bugs/show_bug.cgi?id=201340
// skipped since reported issue and always failing
public void skip_testDoubleCreateEclipseBug201340() throws CoreException {