[190496] Java EE JUnit improvements.
diff --git a/tests/org.eclipse.jst.j2ee.tests/savestrategy-tests/org/eclipse/wtp/headless/tests/savestrategy/WebImportOperationTest.java b/tests/org.eclipse.jst.j2ee.tests/savestrategy-tests/org/eclipse/wtp/headless/tests/savestrategy/WebImportOperationTest.java deleted file mode 100644 index b0e56a2..0000000 --- a/tests/org.eclipse.jst.j2ee.tests/savestrategy-tests/org/eclipse/wtp/headless/tests/savestrategy/WebImportOperationTest.java +++ /dev/null
@@ -1,123 +0,0 @@ -/* - * Created on Jan 6, 2004 - * - * To change the template for this generated file go to - * Window - Preferences - Java - Code Generation - Code and Comments - */ -package org.eclipse.wtp.headless.tests.savestrategy; - -import java.io.File; -import java.net.URL; -import java.util.Iterator; -import java.util.List; - -import junit.framework.Assert; -import junit.framework.Test; -import junit.framework.TestSuite; - -import org.eclipse.core.runtime.Path; -import org.eclipse.jst.j2ee.dependency.tests.util.ProjectUtil; -import org.eclipse.jst.j2ee.internal.web.archive.operations.WebComponentImportDataModelProvider; -import org.eclipse.jst.j2ee.web.componentcore.util.WebArtifactEdit; -import org.eclipse.jst.j2ee.webapplication.WebApp; -import org.eclipse.wst.common.frameworks.datamodel.DataModelFactory; -import org.eclipse.wst.common.frameworks.datamodel.IDataModel; -import org.eclipse.wst.common.tests.ProjectUtility; -import org.eclipse.wtp.j2ee.headless.tests.plugin.HeadlessTestsPlugin; - -public class WebImportOperationTest extends ModuleImportOperationTestCase { - - public final String WEB_TESTS_PATH; - - public WebImportOperationTest(String name) { - super(name); - String relativeImportTestsPath = "TestData" + File.separator + getDirectory() + File.separator; - URL fullImportTestsPath = HeadlessTestsPlugin.getDefault().find(new Path(relativeImportTestsPath)); - WEB_TESTS_PATH = fullImportTestsPath.getPath(); - } - - public static Test suite() { - return new TestSuite(WebImportOperationTest.class); - } - - protected String getDirectory() { - return "WARImportTests"; - } - - protected List getImportableArchiveFileNames() { - return ProjectUtility.getWarsInDirectory(HeadlessTestsPlugin.getDefault(), WEB_TESTS_PATH); - } - - protected IDataModel getModelInstance() { - return DataModelFactory.createDataModel(new WebComponentImportDataModelProvider()); - } - public void testWebLibDupClasspath() throws Exception { - // Test for defect: 105225 - List projects = getImportableArchiveFileNames(); - String warPath = null; - for (Iterator iter = projects.iterator(); iter.hasNext();) { - String path = (String) iter.next(); - if (path.indexOf("WebContainerClientApp.war") != -1){ - warPath = path; - break; - } - } - String projectName = warPath.substring(warPath.lastIndexOf(File.separator) + 1, warPath.length() - 4); - testImport(projectName,warPath); - - } - - public void test192752() throws Exception { - String warPath = null; - String projectName = null; - WebArtifactEdit webArtifactEditForRead = null; - - warPath = getWarFile("InvalidWebXML1.war"); - projectName = warPath.substring(warPath.lastIndexOf(File.separator) + 1, warPath.length() - 4); - testImport(projectName,warPath); - webArtifactEditForRead = WebArtifactEdit.getWebArtifactEditForRead(ProjectUtil.getProject(projectName)); - checkIfModelIsParsed(webArtifactEditForRead.getWebApp()); - - warPath = getWarFile("InvalidWebXML2.war"); - projectName = warPath.substring(warPath.lastIndexOf(File.separator) + 1, warPath.length() - 4); - testImport(projectName,warPath); - webArtifactEditForRead = WebArtifactEdit.getWebArtifactEditForRead(ProjectUtil.getProject(projectName)); - checkIfModelIsParsed(webArtifactEditForRead.getWebApp()); - - warPath = getWarFile("InvalidWebXML14_1.war"); - projectName = warPath.substring(warPath.lastIndexOf(File.separator) + 1, warPath.length() - 4); - testImport(projectName,warPath); - webArtifactEditForRead = WebArtifactEdit.getWebArtifactEditForRead(ProjectUtil.getProject(projectName)); - checkIfModelIsParsed(webArtifactEditForRead.getWebApp()); - - warPath = getWarFile("InvalidWebXML14_2.war"); - projectName = warPath.substring(warPath.lastIndexOf(File.separator) + 1, warPath.length() - 4); - testImport(projectName,warPath); - webArtifactEditForRead = WebArtifactEdit.getWebArtifactEditForRead(ProjectUtil.getProject(projectName)); - checkIfModelIsParsed(webArtifactEditForRead.getWebApp()); - -} - - private String getWarFile(String fileName) { - // Test for defect: 192752 - List projects = getImportableArchiveFileNames(); - String warPath = null; - for (Iterator iter = projects.iterator(); iter.hasNext();) { - String path = (String) iter.next(); - if (path.indexOf(fileName) != -1){ - warPath = path; - break; - } - } - return warPath; - } - - private void checkIfModelIsParsed(WebApp deploymentDescriptor1) { - // tests to ensure model is usable to a degree - Assert.assertNotNull(deploymentDescriptor1); - Assert.assertNotNull(deploymentDescriptor1.getConstraints()); - Assert.assertFalse(deploymentDescriptor1.getConstraints().isEmpty()); - Assert.assertNotNull(deploymentDescriptor1.getSecurityRoles()); - Assert.assertFalse(deploymentDescriptor1.getSecurityRoles().isEmpty()); - } -}