Author: akazakov
Date: 2010-11-26 10:06:54 -0500 (Fri, 26 Nov 2010)
New Revision: 26977
Modified:
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
Log:
https://jira.jboss.org/browse/JBIDE-7359 Fixed
Modified:
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java 2010-11-26
14:07:35 UTC (rev 26976)
+++
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java 2010-11-26
15:06:54 UTC (rev 26977)
@@ -12,11 +12,9 @@
import java.io.File;
import java.io.FileNotFoundException;
-import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
-import java.text.StringCharacterIterator;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
@@ -51,8 +49,6 @@
import org.eclipse.wst.common.project.facet.core.IProjectFacetVersion;
import org.eclipse.wst.common.project.facet.core.ProjectFacetsManager;
import org.eclipse.wst.validation.ValidationFramework;
-import org.jboss.tools.common.EclipseUtil;
-import org.jboss.tools.common.model.util.EclipseResourceUtil;
import org.jboss.tools.common.ui.widget.editor.IFieldEditor;
import org.jboss.tools.seam.core.ISeamProject;
import org.jboss.tools.seam.core.SeamCorePlugin;
@@ -140,9 +136,7 @@
return null;
}
- protected void assertLaunchCreated(String testProjectName, String
seamLocalInterfaceName) {
-// String namePrefix = seamLocalInterfaceName +"Test-JDK16.launch";
//$NON-NLS-1$
- String namePrefix = seamLocalInterfaceName +"Test, ....launch";
//$NON-NLS-1$
+ protected void assertLaunchCreated(String testProjectName, String
seamLocalInterfaceName, String namePrefix) {
String launchName =
DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(namePrefix);
File launchFile = new
File(LaunchManager.LOCAL_LAUNCH_CONFIGURATION_CONTAINER_PATH.toFile(), launchName);
assertTrue("TestNG launch file doesn't exest.", launchFile.exists());
@@ -192,6 +186,13 @@
}
}
+ protected void assertLaunchesCreated(String testProjectName, String
seamLocalInterfaceName) {
+ for (String prefix : SeamBaseOperation.TEST_NAME_PREFIXES) {
+ String namePrefix = seamLocalInterfaceName + prefix;
+ assertLaunchCreated(testProjectName, seamLocalInterfaceName, namePrefix);
+ }
+ }
+
protected void assertResourceIsCreatedAndHasNoProblems(IResource resource, String path)
{
assertNotNull("Resource isn't created: " + path, resource);
assertTrue("Resource isn't created: " + path, resource.exists());
Modified:
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java 2010-11-26
14:07:35 UTC (rev 26976)
+++
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java 2010-11-26
15:06:54 UTC (rev 26977)
@@ -194,7 +194,7 @@
seamProjectWebContentFolder.toString() + "/" +
seamPageName + ".xhtml");
- assertLaunchCreated(seamPrjSet.getTestProject().getName(), seamLocalInterfaceName);
+ assertLaunchesCreated(seamPrjSet.getTestProject().getName(), seamLocalInterfaceName);
}
@Override
Modified:
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java 2010-11-26
14:07:35 UTC (rev 26976)
+++
trunk/seam/plugins/org.jboss.tools.seam.base.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java 2010-11-26
15:06:54 UTC (rev 26977)
@@ -145,7 +145,7 @@
seamProjectWebContentFolder.toString() + "/" +
seamPageName + ".xhtml");
- assertLaunchCreated(seamPrjSet.getTestProject().getName(), seamLocalInterfaceName);
+ assertLaunchesCreated(seamPrjSet.getTestProject().getName(), seamLocalInterfaceName);
/*
"${" + ISeamParameter.SEAM_PROJECT_SRC_ACTION + "}/
${" + ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_PATH + "}/
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2010-11-26
14:07:35 UTC (rev 26976)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2010-11-26
15:06:54 UTC (rev 26977)
@@ -15,8 +15,10 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.HashSet;
import java.util.List;
import java.util.Map;
+import java.util.Set;
import org.apache.tools.ant.types.FilterSetCollection;
import org.apache.tools.ant.util.FileUtils;
@@ -104,7 +106,7 @@
IStatus result = Status.OK_STATUS;
this.info = info;
- launchFile = null;
+ launchFiles = null;
final SeamProjectsSet seamPrjSet = new SeamProjectsSet(getProject(info));
@@ -124,12 +126,16 @@
if(shouldTouchServer(seamPrjSet)) {
WebUtils.changeTimeStamp(seamPrjSet.getWarProject());
}
- if(launchFile!=null && launchFile.exists()) {
- ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
- if(manager instanceof LaunchManager) {
- ((LaunchManager)manager).importConfigurations(new File[]{launchFile}, monitor);
+ if(launchFiles!=null) {
+ for (File launchFile : launchFiles) {
+ if(launchFile.exists()) {
+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+ if(manager instanceof LaunchManager) {
+ ((LaunchManager)manager).importConfigurations(new File[]{launchFile}, monitor);
+ }
+ launchFile.delete();
+ }
}
- launchFile.delete();
}
} catch (BackingStoreException e) {
result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
@@ -308,15 +314,17 @@
protected abstract boolean shouldCreateTestLaunch();
- private File launchFile = null;
+ private Set<File> launchFiles;
private String launchTemplatePath;
+ public static final String[] TEST_NAME_PREFIXES = {"Test, ....launch",
"Test.launch"};
+
protected List<FileMapping> getFileMappingsWithTestLaunch(Map<String,
Object> vars) {
List<FileMapping> mapping = new ArrayList<FileMapping>();
mapping.addAll(getFileMappings(vars));
- launchFile = null;
+ launchFiles = new HashSet<File>();
// Uncomment following code if we shouldn't create TestNG launch in case TestNG
plug-in is not installed.
// See
https://jira.jboss.org/browse/JBIDE-7359
// ----------------->
@@ -327,11 +335,21 @@
// }
// <-----------------
-// String namePrefix = vars.get(ISeamParameter.SEAM_LOCAL_INTERFACE_NAME)
+"Test-JDK16.launch"; //$NON-NLS-1$
- String namePrefix = vars.get(ISeamParameter.SEAM_LOCAL_INTERFACE_NAME) +"Test,
....launch"; //$NON-NLS-1$
+// String namePrefix = vars.get(ISeamParameter.SEAM_LOCAL_INTERFACE_NAME) +
"Test-JDK16.launch"; //$NON-NLS-1$
+ // Different versions of TestNG plugins use different default names for launches. So we
have to create two launches with different names.
+ for (String prefix : TEST_NAME_PREFIXES) {
+ String namePrefix = vars.get(ISeamParameter.SEAM_LOCAL_INTERFACE_NAME) + prefix;
//$NON-NLS-1$
+ addTestLaunchToFileMapping(mapping, namePrefix);
+ }
+
+ return mapping;
+ }
+
+ protected List<FileMapping> addTestLaunchToFileMapping(List<FileMapping>
mapping, String namePrefix) {
String launchName =
DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(namePrefix);
try {
- launchFile = new File(SeamCorePlugin.getDefault().getStateLocation().toFile(),
".testNGlaunches/" + launchName);
+ File launchFile = new File(SeamCorePlugin.getDefault().getStateLocation().toFile(),
".testNGlaunches/" + launchName);
+ launchFiles.add(launchFile);
if(launchFile.exists()) {
launchFile.delete();
}