[292934] Investigate and remove the ModuleCoreValidator and its supporting classes
diff --git a/tests/org.eclipse.jst.j2ee.tests/TestData/GenralArtifactTest/TEST0_7.zip b/tests/org.eclipse.jst.j2ee.tests/TestData/GenralArtifactTest/TEST0_7.zip deleted file mode 100644 index 6935b98..0000000 --- a/tests/org.eclipse.jst.j2ee.tests/TestData/GenralArtifactTest/TEST0_7.zip +++ /dev/null Binary files differ
diff --git a/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/jst/j2ee/flexible/project/apitests/artifactedit/Test0_7Workspace.java b/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/jst/j2ee/flexible/project/apitests/artifactedit/Test0_7Workspace.java deleted file mode 100644 index a8bb530..0000000 --- a/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/jst/j2ee/flexible/project/apitests/artifactedit/Test0_7Workspace.java +++ /dev/null
@@ -1,77 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2003, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.flexible.project.apitests.artifactedit; - - -import java.io.IOException; -import java.net.URL; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.etools.common.test.apitools.ProjectUnzipUtil; -import org.eclipse.wtp.j2ee.headless.tests.plugin.HeadlessTestsPlugin; - - - -public class Test0_7Workspace { - - - public static IPath workspaceLocation = ResourcesPlugin.getWorkspace().getRoot().getLocation(); - public static String ARTIFACT_EDIT_FVT_RESOURCE_PATH_NAME = "/ArtifactEditFunctionTestResource.txt"; - public static IPath ARTIFACT_EDIT_FVT_RESOURCE_PATH = workspaceLocation.append(ARTIFACT_EDIT_FVT_RESOURCE_PATH_NAME); - - private static Path zipFilePath = new Path("/TestData/GenralArtifactTest/TEST0_7.zip"); - private static String[] projectNames = new String[]{".JETEmitters", "MyEar", "MyEarClient", "MyEarConnector", "MyEarEJB","TestWeb","TestWebEAR","Util1"}; - private boolean isValidWorkspace; - - - - - public static final String META_INF = "META-INF"; //$NON-NLS-1$ - public static final String WEB_INF = "WEB-INF"; //$NON-NLS-1$ - - public static IProject getTargetProject(String projectName) { - return ResourcesPlugin.getWorkspace().getRoot().getProject(projectName); - } - - public static boolean createProjects() { - IPath localZipPath = getLocalPath(); - ProjectUnzipUtil util = new ProjectUnzipUtil(localZipPath, projectNames); - return util.createProjects(); - } - - private static IPath getLocalPath() { - URL url = HeadlessTestsPlugin.getDefault().find(zipFilePath); - try { - url = Platform.asLocalURL(url); - } catch (IOException e) { - e.printStackTrace(); - } - return new Path(url.getPath()); - } - - public static boolean init() { - // revisit - IProject project = getTargetProject("MyEar"); - if (project.exists()) - return true; - else - return createProjects(); - - } - - public boolean isValidWorkspace() { - return isValidWorkspace; - } -}
diff --git a/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/jst/j2ee/flexible/project/fvtests/ProjectMigrationTest.java b/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/jst/j2ee/flexible/project/fvtests/ProjectMigrationTest.java deleted file mode 100644 index 914f0eb..0000000 --- a/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/jst/j2ee/flexible/project/fvtests/ProjectMigrationTest.java +++ /dev/null
@@ -1,104 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.flexible.project.fvtests; -import junit.framework.Test; -import junit.framework.TestCase; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.IProgressMonitor; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.jem.util.emf.workbench.ProjectUtilities; -import org.eclipse.jst.j2ee.flexible.project.tests.Migrate07EJBTest; -import org.eclipse.jst.j2ee.project.facet.IJavaProjectMigrationDataModelProperties; -import org.eclipse.jst.j2ee.project.facet.JavaProjectMigrationDataModelProvider; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.tests.SimpleTestSuite; - -public class ProjectMigrationTest extends TestCase { - - public static String DEFAULT_PROJECT_NAME = "TestJavaProj"; - - public ProjectMigrationTest(String name) { - super(name); - } - - public ProjectMigrationTest() { - super(); - } - - public static Test suite() { - //return new SimpleTestSuite(ProjectMigrationTest.class); - return new SimpleTestSuite(Migrate07EJBTest.class); - } - - - public void testProjectMigration() throws Exception { - runAll(); - } - - private void createJavaProject(IProgressMonitor monitor) throws CoreException { - - IProject project = ProjectUtilities.getProject(DEFAULT_PROJECT_NAME); - - if( project.exists()){ - project.delete( true, true, null ); - } - -// IDataModel model = DataModelFactory.createDataModel(new TestJavaProjectCreationDataModelProvider()); -// model.setProperty(ITestJavaProjectCreationProperties.PROJECT_NAME, DEFAULT_PROJECT_NAME); -// -// String[] srcFolder = new String[2]; -// srcFolder[0] = new String("Src1"); -// srcFolder[1] = new String("Src2"); -// -// model.setProperty(ITestJavaProjectCreationProperties.SOURCE_FOLDERS, srcFolder); -// try { -// model.getDefaultOperation().execute(monitor, null); -// } catch (ExecutionException e) { -// e.printStackTrace(); -// } - - } - - private IPath getOutputPath(IProject project) { - String outputLocation = "bin"; - return project.getFullPath().append(outputLocation); - } - - - public void runAll(){ - try { - IProgressMonitor monitor = new NullProgressMonitor(); - createJavaProject(monitor); - migrateProject(DEFAULT_PROJECT_NAME); - - } - catch (Exception e) { - e.printStackTrace(); - } - } - - private void migrateProject(String projectName){ - IDataModel model = DataModelFactory.createDataModel(new JavaProjectMigrationDataModelProvider()); - model.setProperty( IJavaProjectMigrationDataModelProperties.PROJECT_NAME, projectName); - - try { - model.getDefaultOperation().execute( null, null ); - } - catch (Exception e) { - e.printStackTrace(); - } - } - -}
diff --git a/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/jst/j2ee/flexible/project/tests/Migrate07EJBTest.java b/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/jst/j2ee/flexible/project/tests/Migrate07EJBTest.java deleted file mode 100644 index 7ccaad8..0000000 --- a/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/jst/j2ee/flexible/project/tests/Migrate07EJBTest.java +++ /dev/null
@@ -1,116 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2005, 2006 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are made available under the terms of the Eclipse Public License v1.0 - * which accompanies this distribution, and is available at - * http://www.eclipse.org/legal/epl-v10.html - * - * Contributors: - * IBM Corporation - initial API and implementation - *******************************************************************************/ -package org.eclipse.jst.j2ee.flexible.project.tests; - -import junit.framework.TestCase; - -import org.eclipse.core.resources.IProject; -import org.eclipse.core.resources.IncrementalProjectBuilder; -import org.eclipse.core.resources.ResourcesPlugin; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.jobs.IJobManager; -import org.eclipse.core.runtime.jobs.ISchedulingRule; -import org.eclipse.jst.j2ee.ejb.EJBJar; -import org.eclipse.jst.j2ee.ejb.componentcore.util.EJBArtifactEdit; -import org.eclipse.jst.j2ee.flexible.project.apitests.artifactedit.Test0_7Workspace; -import org.eclipse.jst.j2ee.internal.project.J2EEProjectUtilities; -import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.componentcore.internal.ModuleMigratorManager; - -public class Migrate07EJBTest extends TestCase { - - private IProject ejbProject,webProject; - public Migrate07EJBTest() { - super(); - - if (Test0_7Workspace.init()) { - ejbProject = Test0_7Workspace.getTargetProject("MyEarEJB"); - webProject = Test0_7Workspace.getTargetProject("TestWeb"); - } else { - fail(); - - } - } - - private void pass() { - assertTrue(true); - } - public String getFacetFromProject(IProject aProject) { - return J2EEProjectUtilities.getJ2EEProjectType(aProject); - } - - public void testMigrate() { - EJBArtifactEdit ejbedit = null; - WebArtifactEdit webEdit = null; - - - //Run full build - try { - ResourcesPlugin.getWorkspace().build(IncrementalProjectBuilder.FULL_BUILD, null); - } catch (CoreException e) { - } - migrateProjects(); - - ISchedulingRule rule= ResourcesPlugin.getWorkspace().getRuleFactory().buildRule(); - IJobManager manager= Platform.getJobManager(); - try { - manager.beginRule(rule, null); - - try { - ejbedit = EJBArtifactEdit.getEJBArtifactEditForRead(ejbProject); - if (ejbedit != null) { - EJBJar ejb = ejbedit.getEJBJar(); - assertTrue(ejb != null); - } - webEdit = WebArtifactEdit.getWebArtifactEditForRead(webProject); - if (webEdit != null) { - WebApp web = webEdit.getWebApp(); - assertTrue(web != null); - } - } finally { - if (ejbedit != null) { - ejbedit.dispose(); - } - if (webEdit != null) { - webEdit.dispose(); - } - } - - } finally { - manager.endRule(rule); - } - } - - private void migrateProjects() { - - ModuleMigratorManager manager = ModuleMigratorManager.getManager(ejbProject); - if (!manager.isMigrating() && !ResourcesPlugin.getWorkspace().isTreeLocked()) - try { - manager.migrateOldMetaData(ejbProject,true); - } catch (CoreException e) { - e.printStackTrace(); - } - - manager = ModuleMigratorManager.getManager(webProject); - if (!manager.isMigrating() && !ResourcesPlugin.getWorkspace().isTreeLocked()) - try { - manager.migrateOldMetaData(webProject,true); - } catch (CoreException e) { - e.printStackTrace(); - } - - - } - - -}
diff --git a/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/wtp/j2ee/headless/tests/plugin/AllPluginTests.java b/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/wtp/j2ee/headless/tests/plugin/AllPluginTests.java index abb97ef..01e903c 100644 --- a/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/wtp/j2ee/headless/tests/plugin/AllPluginTests.java +++ b/tests/org.eclipse.jst.j2ee.tests/j2ee-tests/org/eclipse/wtp/j2ee/headless/tests/plugin/AllPluginTests.java
@@ -22,7 +22,6 @@ import org.eclipse.core.runtime.Path; import org.eclipse.jst.common.annotations.tests.AnnotationProviderTest; import org.eclipse.jst.j2ee.defect.tests.DefectVerificationTestsSuite; -import org.eclipse.jst.j2ee.flexible.project.fvtests.ProjectMigrationTest; import org.eclipse.jst.jee.model.mergers.tests.MergersTestSuite; import org.eclipse.jst.jee.model.tests.AllAnnotationModelTests; import org.eclipse.jst.jee.model.tests.JEE5ModelTest; @@ -63,7 +62,6 @@ addTest(JEE6ModelTest.suite()); // model provider addTest(ModelProviderTest.suite()); - addTest(ProjectMigrationTest.suite()); addTest(AnnotationProviderTest.suite()); addTest(org.eclipse.jst.j2ee.dependency.tests.AllTests.suite()); addTest(org.eclipse.jst.j2ee.classpath.tests.AllTests.suite());