Author: akazakov
Date: 2010-10-25 09:27:36 -0400 (Mon, 25 Oct 2010)
New Revision: 26030
Added:
trunk/seam/plugins/org.jboss.tools.seam.core/templates/testng/
trunk/seam/plugins/org.jboss.tools.seam.core/templates/testng/testng.launch
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetFilterSetFactory.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
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/SeamConversationWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizard.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java
Log:
https://jira.jboss.org/browse/JBIDE-7359 Added testng launch creation to Seam wizards.
Modified:
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetFilterSetFactory.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetFilterSetFactory.java 2010-10-25
13:20:33 UTC (rev 26029)
+++
trunk/seam/plugins/org.jboss.tools.seam.core/src/org/jboss/tools/seam/internal/core/project/facet/SeamFacetFilterSetFactory.java 2010-10-25
13:27:36 UTC (rev 26030)
@@ -61,6 +61,7 @@
FILTERS_TEMPLATE.addFilter("listName","${component.name}List");
//$NON-NLS-1$ //$NON-NLS-2$
FILTERS_TEMPLATE.addFilter("homeName","${component.name}Home");
//$NON-NLS-1$ //$NON-NLS-2$
FILTERS_TEMPLATE.addFilter("query","${query.text}"); //$NON-NLS-1$
//$NON-NLS-2$
+ FILTERS_TEMPLATE.addFilter("seamTestProject","${seam.test.project}");
//$NON-NLS-1$ //$NON-NLS-2$
HIBERNATE_DIALECT_TEMPLATE = new FilterSet();
HIBERNATE_DIALECT_TEMPLATE.addFilter("hibernate.dialect","${hibernate.dialect}");
//$NON-NLS-1$ //$NON-NLS-2$
Added: trunk/seam/plugins/org.jboss.tools.seam.core/templates/testng/testng.launch
===================================================================
--- trunk/seam/plugins/org.jboss.tools.seam.core/templates/testng/testng.launch
(rev 0)
+++ trunk/seam/plugins/org.jboss.tools.seam.core/templates/testng/testng.launch 2010-10-25
13:27:36 UTC (rev 26030)
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="UTF-8"
standalone="no"?>
+<launchConfiguration type="org.testng.eclipse.launchconfig">
+<stringAttribute key="org.eclipse.jdt.launching.JRE_CONTAINER"
value="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE"
value="org.testng.remote.RemoteTestNG"/>
+<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR"
value="@seamTestProject@"/>
+<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS"
value="-Dsun.lang.ClassLoader.allowArraySyntax=true"/>
+<mapAttribute key="org.testng.eclipse.ALL_CLASS_METHODS">
+<mapEntry key="@testPackage@.@interfaceName(a)Test" value=""/>
+</mapAttribute>
+<listAttribute key="org.testng.eclipse.CLASS_TEST_LIST">
+<listEntry value="@testPackage@.@interfaceName(a)Test"/>
+</listAttribute>
+<listAttribute key="org.testng.eclipse.GROUP_LIST"/>
+<listAttribute key="org.testng.eclipse.GROUP_LIST_CLASS"/>
+<stringAttribute key="org.testng.eclipse.LOG_LEVEL"
value="2"/>
+<listAttribute key="org.testng.eclipse.METHOD_TEST_LIST"/>
+<listAttribute key="org.testng.eclipse.PACKAGE_TEST_LIST"/>
+<mapAttribute key="org.testng.eclipse.PARAMETERS"/>
+<intAttribute key="org.testng.eclipse.TYPE" value="1"/>
+</launchConfiguration>
\ No newline at end of file
Property changes on:
trunk/seam/plugins/org.jboss.tools.seam.core/templates/testng/testng.launch
___________________________________________________________________
Name: svn:mime-type
+ text/plain
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2010-10-25
13:20:33 UTC (rev 26029)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamActionWizard.java 2010-10-25
13:27:36 UTC (rev 26030)
@@ -10,19 +10,25 @@
******************************************************************************/
package org.jboss.tools.seam.ui.wizard;
+import java.io.File;
+import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import org.eclipse.core.commands.operations.IUndoableOperation;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.internal.core.LaunchManager;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.ui.INewWizard;
import org.eclipse.ui.PlatformUI;
import org.jboss.tools.common.ui.widget.editor.INamedElement;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
+import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
import org.jboss.tools.seam.ui.ISeamHelpContextIds;
+import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.jboss.tools.seam.ui.SeamUIMessages;
/**
@@ -137,5 +143,14 @@
protected String getSessionBeanPackageName(IEclipsePreferences seamFacetPrefs,
Map<String, INamedElement> wizardParams) {
return wizardParams.get(ISeamParameter.SEAM_PACKAGE_NAME).getValue().toString();
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.wizard.SeamBaseOperation#shouldCreateTestLaunch()
+ */
+ @Override
+ protected boolean shouldCreateTestLaunch() {
+ return true;
+ }
};
}
\ No newline at end of file
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-10-25
13:20:33 UTC (rev 26029)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamBaseOperation.java 2010-10-25
13:27:36 UTC (rev 26030)
@@ -34,6 +34,9 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.internal.core.LaunchManager;
import org.eclipse.swt.widgets.Display;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.ide.IDE;
@@ -47,6 +50,7 @@
import org.jboss.tools.seam.core.project.facet.SeamRuntimeManager;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.internal.core.project.facet.SeamFacetFilterSetFactory;
+import
org.jboss.tools.seam.internal.core.project.facet.SeamFacetInstallDataModelProvider;
import org.jboss.tools.seam.ui.SeamGuiPlugin;
import org.osgi.service.prefs.BackingStoreException;
@@ -56,6 +60,8 @@
*/
public abstract class SeamBaseOperation extends AbstractOperation {
+ public static final String TESTNG_LAUNCH_CONFIG_TYPE_ID =
"org.testng.eclipse.launchconfig";
+
/**
* @param label
*/
@@ -98,12 +104,14 @@
IStatus result = Status.OK_STATUS;
this.info = info;
+ launchFile = null;
+
final SeamProjectsSet seamPrjSet = new SeamProjectsSet(getProject(info));
try {
Map<String, Object> vars = loadParameters(info, seamPrjSet);
- List<FileMapping> fileMapping = getFileMappings(vars);
+ List<FileMapping> fileMapping =
shouldCreateTestLaunch()?getFileMappingsWithTestLaunch(vars):getFileMappings(vars);
List<String[]> fileMappingCopy = applyVariables(fileMapping,vars);
FilterSetCollection filters = getFilterSetCollection(vars);
final File[] file = new File[fileMappingCopy.size()];
@@ -116,6 +124,13 @@
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);
+ }
+ launchFile.delete();
+ }
} catch (BackingStoreException e) {
result = new Status(IStatus.ERROR,SeamGuiPlugin.PLUGIN_ID,e.getMessage(),e);
} catch (IOException e) {
@@ -190,6 +205,7 @@
putResourceLocationProperty(vars, ISeamParameter.TEST_CASES_PACKAGE_NAME, testFolder);
putPackageLocationProperty(vars, ISeamParameter.ENTITY_BEAN_PACKAGE_PATH,
entityFolder);
putResourceLocationProperty(vars, ISeamParameter.ENTITY_BEAN_PACKAGE_NAME,
entityFolder);
+
return vars;
}
@@ -290,6 +306,55 @@
*/
public abstract List<FileMapping> getFileMappings(Map<String, Object>
vars);
+ protected abstract boolean shouldCreateTestLaunch();
+
+ private File launchFile = null;
+
+ private String launchTemplatePath;
+
+ protected List<FileMapping> getFileMappingsWithTestLaunch(Map<String,
Object> vars) {
+ List<FileMapping> mapping = new ArrayList<FileMapping>();
+ mapping.addAll(getFileMappings(vars));
+
+ launchFile = null;
+// 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
+// ----------------->
+// ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+// if(manager.getLaunchConfigurationType(SeamBaseOperation.TESTNG_LAUNCH_CONFIG_TYPE_ID)==null)
{
+// // TestNG plug-in is not install. Don't verify attributes of the launch.
+// return mapping;
+// }
+// <-----------------
+
+// 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 launchName =
DebugPlugin.getDefault().getLaunchManager().generateLaunchConfigurationName(namePrefix);
+ try {
+ launchFile = new File(SeamCorePlugin.getDefault().getStateLocation().toFile(),
".testNGlaunches/" + launchName);
+ if(launchFile.exists()) {
+ launchFile.delete();
+ }
+ if(launchTemplatePath==null) {
+ launchTemplatePath = new File(SeamFacetInstallDataModelProvider.getTemplatesFolder(),
"/testng/testng.launch").getAbsolutePath(); //$NON-NLS-1$
+ }
+ mapping.add(new FileMapping(
+ launchTemplatePath,
+ launchFile.getAbsolutePath(),
+ FileMapping.TYPE.EAR,
+ true));
+ mapping.add(new FileMapping(
+ launchTemplatePath,
+ launchFile.getAbsolutePath(),
+ FileMapping.TYPE.WAR,
+ true));
+ } catch (IOException e) {
+ SeamGuiPlugin.getDefault().logError(e);
+ }
+
+ return mapping;
+ }
+
/**
*
* @param vars
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2010-10-25
13:20:33 UTC (rev 26029)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamConversationWizard.java 2010-10-25
13:27:36 UTC (rev 26030)
@@ -107,6 +107,15 @@
/*
* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.wizard.SeamBaseOperation#shouldCreateTestLaunch()
+ */
+ @Override
+ protected boolean shouldCreateTestLaunch() {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
* @see
org.jboss.tools.seam.ui.wizard.SeamBaseOperation#getSessionBeanPackageName(org.eclipse.core.runtime.preferences.IEclipsePreferences,
java.util.Map)
*/
@Override
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2010-10-25
13:20:33 UTC (rev 26029)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamEntityWizard.java 2010-10-25
13:27:36 UTC (rev 26030)
@@ -142,6 +142,15 @@
/*
* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.wizard.SeamBaseOperation#shouldCreateTestLaunch()
+ */
+ @Override
+ protected boolean shouldCreateTestLaunch() {
+ return false;
+ }
+
+ /*
+ * (non-Javadoc)
* @see
org.jboss.tools.seam.ui.wizard.SeamBaseOperation#getEntityBeanPackageName(org.eclipse.core.runtime.preferences.IEclipsePreferences,
java.util.Map)
*/
@Override
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java 2010-10-25
13:20:33 UTC (rev 26029)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamFormWizard.java 2010-10-25
13:27:36 UTC (rev 26030)
@@ -126,6 +126,15 @@
/*
* (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.wizard.SeamBaseOperation#shouldCreateTestLaunch()
+ */
+ @Override
+ protected boolean shouldCreateTestLaunch() {
+ return true;
+ }
+
+ /*
+ * (non-Javadoc)
* @see
org.jboss.tools.seam.ui.wizard.SeamBaseOperation#getSessionBeanPackageName(org.eclipse.core.runtime.preferences.IEclipsePreferences,
java.util.Map)
*/
@Override
Modified:
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizard.java
===================================================================
---
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizard.java 2010-10-25
13:20:33 UTC (rev 26029)
+++
trunk/seam/plugins/org.jboss.tools.seam.ui/src/org/jboss/tools/seam/ui/wizard/SeamGenerateEntitiesWizard.java 2010-10-25
13:27:36 UTC (rev 26030)
@@ -359,6 +359,15 @@
// Return empty list;
return new ArrayList<FileMapping>();
}
+
+ /*
+ * (non-Javadoc)
+ * @see org.jboss.tools.seam.ui.wizard.SeamBaseOperation#shouldCreateTestLaunch()
+ */
+ @Override
+ protected boolean shouldCreateTestLaunch() {
+ return false;
+ }
};
static SeamRuntime getRuntime(IProject project) {
Modified: trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF 2010-10-25 13:20:33
UTC (rev 26029)
+++ trunk/seam/tests/org.jboss.tools.seam.ui.test/META-INF/MANIFEST.MF 2010-10-25 13:27:36
UTC (rev 26030)
@@ -31,7 +31,8 @@
org.jboss.tools.common.ui,
org.jboss.tools.common.el.ui,
org.jboss.tools.jsf.text.ext,
- org.eclipse.datatools.enablement.hsqldb
+ org.eclipse.datatools.enablement.hsqldb,
+ org.eclipse.debug.core
Export-Package: org.jboss.tools.seam.ui.test,
org.jboss.tools.seam.ui.test.ca,
org.jboss.tools.seam.ui.test.hyperlink,
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java 2010-10-25
13:20:33 UTC (rev 26029)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/AbstractSeamNewOperationTest.java 2010-10-25
13:27:36 UTC (rev 26030)
@@ -10,9 +10,17 @@
******************************************************************************/
package org.jboss.tools.seam.ui.test.wizard;
+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;
+import java.util.List;
import java.util.Map;
import java.util.Set;
@@ -32,6 +40,10 @@
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
import org.eclipse.core.runtime.preferences.IScopeContext;
+import org.eclipse.debug.core.DebugPlugin;
+import org.eclipse.debug.core.ILaunchConfiguration;
+import org.eclipse.debug.core.ILaunchManager;
+import org.eclipse.debug.internal.core.LaunchManager;
import org.eclipse.ui.IWorkbench;
import org.eclipse.ui.PlatformUI;
import org.eclipse.ui.actions.WorkspaceModifyOperation;
@@ -39,6 +51,8 @@
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;
@@ -46,12 +60,13 @@
import org.jboss.tools.seam.core.test.project.facet.AbstractSeamFacetTest;
import org.jboss.tools.seam.internal.core.project.facet.ISeamFacetDataModelProperties;
import org.jboss.tools.seam.ui.wizard.ISeamParameter;
-import org.jboss.tools.seam.ui.wizard.SeamWizardFactory;
-import org.jboss.tools.seam.ui.wizard.SeamWizardUtils;
import org.jboss.tools.seam.ui.wizard.SeamActionWizard.SeamActionCreateOperation;
+import org.jboss.tools.seam.ui.wizard.SeamBaseOperation;
import
org.jboss.tools.seam.ui.wizard.SeamConversationWizard.SeamConversationCreateOperation;
import org.jboss.tools.seam.ui.wizard.SeamEntityWizard.SeamEntityCreateOperation;
import org.jboss.tools.seam.ui.wizard.SeamFormWizard.SeamFormCreateOperation;
+import org.jboss.tools.seam.ui.wizard.SeamWizardFactory;
+import org.jboss.tools.seam.ui.wizard.SeamWizardUtils;
import org.jboss.tools.test.util.JUnitUtils;
import org.jboss.tools.test.util.JobUtils;
import org.osgi.service.prefs.BackingStoreException;
@@ -82,16 +97,15 @@
protected AbstractSeamNewOperationTest(String name) {
super(name);
- // TODO Auto-generated constructor stub
}
-
+
+ @Override
protected void setUp() throws Exception {
suspendAllValidation = ValidationFramework.getDefault().isSuspended();
ValidationFramework.getDefault().suspendAllValidation(true);
JobUtils.waitForIdle();
}
-
@Override
protected void tearDown() throws Exception {
// TODO Auto-generated method stub
@@ -110,6 +124,74 @@
abstract void assertNewConversationFilesAreCreatedSuccessfully(AdaptableRegistry data);
abstract void assertNewEntityFilesAreCreatedSuccessfully(AdaptableRegistry data);
+ protected ILaunchConfiguration getLaunchConfiguration(File file) {
+ ILaunchConfiguration[] configs = null;
+ try {
+ configs = DebugPlugin.getDefault().getLaunchManager().getLaunchConfigurations();
+ } catch (CoreException e) {
+ e.printStackTrace();
+ return null;
+ }
+ for (ILaunchConfiguration config : configs) {
+ if(config.getName().equals(file.getName().substring(0,
file.getName().lastIndexOf('.')))) {
+ return config;
+ }
+ }
+ 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$
+ 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());
+
+ ILaunchManager manager = DebugPlugin.getDefault().getLaunchManager();
+ if(manager.getLaunchConfigurationType(SeamBaseOperation.TESTNG_LAUNCH_CONFIG_TYPE_ID)==null)
{
+ // TestNG plug-in is not install. Don't verify attributes of the launch. Just
verify it doesn't have any @...@ variables.
+ FileReader fr = null;
+ try {
+ fr = new FileReader(launchFile);
+ int ch;
+// StringBuffer sb = new StringBuffer();
+ while((ch = fr.read())!=-1) {
+ assertFalse("Some template varibales were not initialized.",
ch=='@');
+// sb.append((char)ch);
+ }
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } catch (IOException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ } finally {
+ if(fr!=null) {
+ try {
+ fr.close();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ }
+ }
+ return;
+ }
+
+ ILaunchConfiguration config = getLaunchConfiguration(launchFile);
+ assertNotNull("Can't find launch configuration for " +
launchFile.toString() + " file.", config);
+ try {
+ String projectName =
config.getAttribute("org.eclipse.jdt.launching.PROJECT_ATTR", "");
+ assertEquals("Test project name is not correct in " + launchFile.toString(),
testProjectName, projectName);
+ List<String> classNames =
config.getAttribute("org.testng.eclipse.CLASS_TEST_LIST", new
ArrayList<String>());
+ assertEquals("Wrong number of test classes in " + launchFile.toString(), 1,
classNames.size());
+ String className = classNames.get(0);
+ assertEquals("Wrong test calss name in " + launchFile.toString(), className,
seamLocalInterfaceName + "Test");
+ } catch (CoreException e) {
+ e.printStackTrace();
+ fail(e.getMessage());
+ }
+ }
+
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/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java 2010-10-25
13:20:33 UTC (rev 26029)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12EARNewOperationTest.java 2010-10-25
13:27:36 UTC (rev 26030)
@@ -193,6 +193,8 @@
assertResourceIsCreatedAndHasNoProblems(seamPageNameXhtml,
seamProjectWebContentFolder.toString() + "/" +
seamPageName + ".xhtml");
+
+ assertLaunchCreated(seamPrjSet.getTestProject().getName(), seamLocalInterfaceName);
}
@Override
@@ -321,4 +323,4 @@
protected String getSeamRTName() {
return AbstractSeamNewOperationTest.SEAM_1_2_0;
}
-}
+}
\ No newline at end of file
Modified:
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java
===================================================================
---
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java 2010-10-25
13:20:33 UTC (rev 26029)
+++
trunk/seam/tests/org.jboss.tools.seam.ui.test/src/org/jboss/tools/seam/ui/test/wizard/Seam12WARNewOperationTest.java 2010-10-25
13:27:36 UTC (rev 26030)
@@ -8,7 +8,6 @@
* Contributors:
* Red Hat, Inc. - initial API and implementation
******************************************************************************/
-
package org.jboss.tools.seam.ui.test.wizard;
import java.io.File;
@@ -37,7 +36,6 @@
private ISeamProject seamWarProject = null;
private ISeamProject seamTestProject = null;
-
public Seam12WARNewOperationTest(String name) {
super(name);
}
@@ -75,13 +73,12 @@
seamTestProject = loadSeamProject(testProject);
}
}
-
-
+
protected void tearDown() throws Exception {
WorkbenchUtils.closeAllEditors();
-
+
super.tearDown();
-
+
warProject = null;
testProject = null;
seamWarProject = null;
@@ -109,7 +106,6 @@
return AbstractSeamNewOperationTest.SEAM_1_2_0;
}
-
@Override
void assertNewActionFilesAreCreatedSuccessfully(AdaptableRegistry data) {
IEclipsePreferences seamFacetPrefs = SeamCorePlugin.getSeamPreferences(warProject);
@@ -148,7 +144,8 @@
assertResourceIsCreatedAndHasNoProblems(seamPageNameXhtml,
seamProjectWebContentFolder.toString() + "/" +
seamPageName + ".xhtml");
-
+
+ assertLaunchCreated(seamPrjSet.getTestProject().getName(), seamLocalInterfaceName);
/*
"${" + ISeamParameter.SEAM_PROJECT_SRC_ACTION + "}/
${" + ISeamFacetDataModelProperties.SESSION_BEAN_PACKAGE_PATH + "}/
@@ -265,4 +262,4 @@
void assertNewFormFilesAreCreatedSuccessfully(AdaptableRegistry data) {
assertNewActionFilesAreCreatedSuccessfully(data);
}
-}
+}
\ No newline at end of file