My favorites | Sign in
Project Home
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions

Issue 29 attachment: TestNGEclipse.patch (15.7 KB)

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
Index: C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/launch/TestNGLaunchConfigurationDelegate.java
===================================================================
--- C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/launch/TestNGLaunchConfigurationDelegate.java (revision 105)
+++ C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/launch/TestNGLaunchConfigurationDelegate.java (working copy)
@@ -32,12 +32,12 @@
import org.testng.TestNG;
import org.testng.TestNGCommandLineArgs;
import org.testng.eclipse.TestNGPlugin;
+import org.testng.eclipse.TestNGPluginConstants;
import org.testng.eclipse.ui.util.ConfigurationHelper;
import org.testng.eclipse.ui.util.Utils;
import org.testng.eclipse.util.JDTUtil;
import org.testng.eclipse.util.PreferenceStoreUtil;
import org.testng.eclipse.util.ResourceUtil;
-import org.testng.remote.RemoteTestNG;
import org.testng.xml.LaunchSuite;


@@ -134,7 +134,10 @@
String javaVersion = ConfigurationHelper.getComplianceLevel(jproject, configuration);
String[] classPath = createClassPath(configuration, javaVersion);
String progArgs = getProgramArguments(configuration);
- VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(RemoteTestNG.class.getName(), //$NON-NLS-1$
+ PreferenceStoreUtil storage= TestNGPlugin.getPluginPreferenceStore();
+ IProject project = jproject.getProject();
+
+ VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(storage.getMainRunner(project.getName(), true), //$NON-NLS-1$
classPath);

// insert the program arguments
@@ -148,7 +151,6 @@
argv.add(TestNGCommandLineArgs.PORT_COMMAND_OPT);
argv.add(Integer.toString(port));

- IProject project = jproject.getProject();

if(!isJDK15(javaVersion)) {
List sourceDirs = JDTUtil.getSourceDirFileList(jproject);
@@ -158,7 +160,7 @@
}
}

- PreferenceStoreUtil storage= TestNGPlugin.getPluginPreferenceStore();
+
argv.add(TestNGCommandLineArgs.OUTDIR_COMMAND_OPT);
argv.add(storage.getOutputAbsolutePath(jproject).toOSString());

Index: C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/properties/TestNGPropertyPage.java
===================================================================
--- C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/properties/TestNGPropertyPage.java (revision 105)
+++ C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/properties/TestNGPropertyPage.java (working copy)
@@ -14,6 +14,7 @@
import org.eclipse.jdt.internal.ui.wizards.TypedViewerFilter;
import org.eclipse.jdt.internal.ui.wizards.buildpaths.FolderSelectionDialog;
import org.eclipse.jface.preference.PreferencePage;
+import org.eclipse.jface.preference.StringFieldEditor;
import org.eclipse.jface.viewers.ILabelProvider;
import org.eclipse.jface.viewers.ITreeContentProvider;
import org.eclipse.jface.viewers.Viewer;
@@ -37,6 +38,7 @@
import org.eclipse.ui.model.WorkbenchLabelProvider;
import org.eclipse.ui.views.navigator.ResourceSorter;
import org.testng.eclipse.TestNGPlugin;
+import org.testng.eclipse.TestNGPluginConstants;
import org.testng.eclipse.util.JDTUtil;
import org.testng.eclipse.util.PreferenceStoreUtil;
import org.testng.eclipse.util.SWTUtil;
@@ -46,6 +48,7 @@
private static final String PATH_TITLE = "Path:";
private Text m_outdirPath;
private Text m_reportersText;
+ private StringFieldEditor m_classloader;
private Button m_disabledListenersCheckbox;
private IProject m_workingProject;
private Button m_projectJar;
@@ -55,7 +58,7 @@
setDescription("General TestNG settings:");
super.createControl(parent);
}
-
+
/**
* @see PreferencePage#createContents(Composite)
*/
@@ -132,6 +135,8 @@
listenersDetailsLabel.setText("Set the additional listeners/reporters (separated by space or ;) to be used when running the TestNG tests.");
listenersDetailsLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 3, 1));

+
+
Composite jarsComposite= new Composite(composite, SWT.BORDER);
jarsComposite.setLayout(new GridLayout(3, false));
jarsComposite.setLayoutData(new GridData(SWT.FILL, SWT.TOP, true, false, 3, 1));
@@ -150,11 +155,40 @@
projectJarLabel.setFont(new Font(projectJarLabel.getDisplay(), fd));
projectJarLabel.setLayoutData(new GridData(SWT.FILL, SWT.NONE, true, false, 3, 1));

+ // Add the Class Loader Editor
+ createClassLoaderEditor(composite);
+
loadDefaults();

return composite;
}

+ private void createClassLoaderEditor(Composite parent) {
+ Composite composite= new Composite(parent, SWT.BORDER);
+ GridData gridData= new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan= 3;
+ composite.setLayoutData(gridData);
+ GridLayout layout= new GridLayout();
+ layout.marginWidth= 0;
+ layout.numColumns= 1;
+ composite.setLayout(layout);
+ m_classloader= new StringFieldEditor(TestNGPluginConstants.MAIN_RUNNER, "Main Runner for a remote TestNG must call RemoteTestNG or be a subclass of RemoteTestNG", StringFieldEditor.UNLIMITED, composite) { //$NON-NLS-1$
+ public int getNumberOfControls() {
+ return 1;
+ }
+ };
+ Label label= m_classloader.getLabelControl(composite);
+ label.setLayoutData(new GridData(SWT.WRAP | GridData.FILL_HORIZONTAL));
+ Text text= m_classloader.getTextControl(composite);
+ gridData= new GridData(GridData.FILL_HORIZONTAL);
+ text.setLayoutData(gridData);
+// LayoutUtil.setHorizontalGrabbing(m_reporters.getTextControl(composite));
+
+ label= new Label(composite, SWT.WRAP);
+ label.setText("RemoteTestNG provides the ability to report back to eclipse.\n "
+ + "Put the complete package name of the class you want to use to replace RemoteTestNG.\n");
+ }
+

public void dispose() {
m_projectJar.dispose();
@@ -174,6 +208,7 @@
m_reportersText.setText(storage.getReporters(m_workingProject.getName(), true));
m_disabledListenersCheckbox.setSelection(storage.hasDisabledListeners(m_workingProject.getName(), true));
m_projectJar.setSelection(storage.getUseProjectJar(m_workingProject.getName()));
+ m_classloader.setStringValue(storage.getMainRunner(m_workingProject.getName(), true));
}

protected void performDefaults() {
@@ -187,6 +222,7 @@
storage.storeReporters(m_workingProject.getName(), m_reportersText.getText());
storage.storeDisabledListeners(m_workingProject.getName(), m_disabledListenersCheckbox.getSelection());
storage.storeUseProjectJar(m_workingProject.getName(), m_projectJar.getSelection());
+ storage.storeMainRunner(m_workingProject.getName(), m_classloader.getStringValue());

if(super.performOk()) {
setMessage("Project preferences are saved", INFORMATION);
Index: C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/ui/preferences/PreferenceInitializer.java
===================================================================
--- C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/ui/preferences/PreferenceInitializer.java (revision 105)
+++ C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/ui/preferences/PreferenceInitializer.java (working copy)
@@ -18,6 +18,7 @@
public void initializeDefaultPreferences() {
IPreferenceStore store = TestNGPlugin.getDefault().getPreferenceStore();
store.setDefault(TestNGPluginConstants.S_OUTDIR, "/test-output");
+ store.setDefault(TestNGPluginConstants.MAIN_RUNNER, TestNGPluginConstants.MAIN_RUNNER);
}

}
Index: C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/ui/preferences/PreferencePage.java
===================================================================
--- C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/ui/preferences/PreferencePage.java (revision 105)
+++ C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/ui/preferences/PreferencePage.java (working copy)
@@ -46,6 +46,7 @@
private BooleanFieldEditor2 m_absolutePath;
private StringFieldEditor m_reporters;
private BooleanFieldEditor2 m_disabledDefaultListeners;
+ private StringFieldEditor m_classloader;

public PreferencePage() {
super(GRID);
@@ -84,13 +85,42 @@
parentComposite);

createReportersFieldEditor(parentComposite);
-
+ createClassLoaderEditor(parentComposite);
addField(m_outputdir);
addField(m_absolutePath);
addField(m_disabledDefaultListeners);
addField(m_reporters);
+ addField(m_classloader);
+
}

+ private void createClassLoaderEditor(Composite parent) {
+ Composite composite= new Composite(parent, SWT.BORDER);
+ GridData gridData= new GridData(GridData.FILL_HORIZONTAL);
+ gridData.horizontalSpan= 3;
+ composite.setLayoutData(gridData);
+ GridLayout layout= new GridLayout();
+ layout.marginWidth= 0;
+ layout.numColumns= 1;
+ composite.setLayout(layout);
+
+ m_classloader= new StringFieldEditor(TestNGPluginConstants.MAIN_RUNNER, "Main Runner for a remote TestNG must call RemoteTestNG or be a subclass of RemoteTestNG", StringFieldEditor.UNLIMITED, composite) { //$NON-NLS-1$
+ public int getNumberOfControls() {
+ return 1;
+ }
+ };
+ Label label= m_classloader.getLabelControl(composite);
+ label.setLayoutData(new GridData(SWT.WRAP | GridData.FILL_HORIZONTAL));
+ Text text= m_classloader.getTextControl(composite);
+ gridData= new GridData(GridData.FILL_HORIZONTAL);
+ text.setLayoutData(gridData);
+// LayoutUtil.setHorizontalGrabbing(m_reporters.getTextControl(composite));
+
+ label= new Label(composite, SWT.WRAP);
+ label.setText("RemoteTestNG provides the ability to report back to eclipse.\n "
+ + "Put the complete package name of the class you want to use to replace RemoteTestNG.\n");
+ }
+
private void createReportersFieldEditor(Composite parent) {
Composite composite= new Composite(parent, SWT.BORDER);
GridData gridData= new GridData(GridData.FILL_HORIZONTAL);
@@ -124,6 +154,7 @@
storage.setValue(TestNGPluginConstants.S_ABSOLUTEPATH, m_absolutePath.getBooleanValue());
storage.setValue(TestNGPluginConstants.S_DISABLEDLISTENERS, m_disabledDefaultListeners.getBooleanValue());
storage.setValue(TestNGPluginConstants.S_REPORTERS, m_reporters.getStringValue());
+ storage.setValue(TestNGPluginConstants.MAIN_RUNNER, m_classloader.getStringValue());
setMessage("Preferences saved", INFORMATION);

return super.performOk();
Index: C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java
===================================================================
--- C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java (revision 105)
+++ C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/ui/util/ConfigurationHelper.java (working copy)
@@ -24,7 +24,6 @@
import org.testng.eclipse.ui.RunInfo;
import org.testng.eclipse.util.JDTUtil;
import org.testng.eclipse.util.SuiteGenerator;
-import org.testng.remote.RemoteTestNG;

/**
* Helper methods to store and retrieve values from a launch configuration.
@@ -235,7 +234,7 @@
ILaunchConfigurationType configurationType = launchManager.getLaunchConfigurationType(TestNGLaunchConfigurationConstants.ID_TESTNG_APPLICATION);
wConf = configurationType.newInstance(null /*project*/, confName); // launchManager.generateUniqueLaunchConfigurationNameFrom(confName));
wConf.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
- RemoteTestNG.class.getName());
+ TestNGPluginConstants.MAIN_RUNNER);
wConf.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
project.getName());
}
@@ -255,7 +254,7 @@
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
projectName);
config.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
- RemoteTestNG.class.getName());
+ TestNGPluginConstants.MAIN_RUNNER);
config.setAttribute(TestNGLaunchConfigurationConstants.TESTNG_COMPLIANCE_LEVEL_ATTR,
JDTUtil.getProjectVMVersion(javaProject));
config.setAttribute(TestNGLaunchConfigurationConstants.TYPE, TestNGLaunchConfigurationConstants.CLASS);
@@ -544,7 +543,7 @@
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME,
launchInfo.m_projectName);
configuration.setAttribute(IJavaLaunchConfigurationConstants.ATTR_MAIN_TYPE_NAME,
- RemoteTestNG.class.getName());
+ TestNGPluginConstants.MAIN_RUNNER);
configuration.setAttribute(TestNGLaunchConfigurationConstants.CLASS_TEST_LIST,
classNamesList);
configuration.setAttribute(TestNGLaunchConfigurationConstants.PACKAGE_TEST_LIST,
Index: C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/util/PreferenceStoreUtil.java
===================================================================
--- C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/util/PreferenceStoreUtil.java (revision 105)
+++ C:/Documents and Settings/pulsid/workspaceConway/testng-eclipse-darren/src/main/org/testng/eclipse/util/PreferenceStoreUtil.java (working copy)
@@ -38,6 +38,10 @@
m_storage.setValue(projectName + TestNGPluginConstants.S_USEPROJECTJAR, selection);
}

+ public void storeMainRunner(String projectName, String mainRunner) {
+ m_storage.setValue(projectName + TestNGPluginConstants.MAIN_RUNNER, mainRunner);
+ }
+
public IPath getOutputDirectoryPath(IJavaProject project) {
final String projectName= project.getElementName();
final String outdir= getOutputDir(projectName, false);
@@ -89,7 +93,30 @@
return m_storage.getString(TestNGPluginConstants.S_REPORTERS);
}
}
-
+
+ public String getMainRunner(String projectName, boolean projectOnly) {
+ if (projectOnly) {
+ if (m_storage.contains(projectName
+ + TestNGPluginConstants.MAIN_RUNNER)) {
+ return m_storage.getString(projectName
+ + TestNGPluginConstants.MAIN_RUNNER);
+ } else {
+ if (m_storage.contains(TestNGPluginConstants.MAIN_RUNNER)) {
+ return m_storage
+ .getString(TestNGPluginConstants.MAIN_RUNNER);
+ } else {
+ return TestNGPluginConstants.MAIN_RUNNER;
+ }
+ }
+ } else {
+ if (m_storage.contains(TestNGPluginConstants.MAIN_RUNNER)) {
+ return m_storage.getString(TestNGPluginConstants.MAIN_RUNNER);
+ } else {
+ return TestNGPluginConstants.MAIN_RUNNER;
+ }
+ }
+ }
+
public boolean hasDisabledListeners(String projectName, boolean projectOnly) {
if(projectOnly || m_storage.contains(projectName + TestNGPluginConstants.S_DISABLEDLISTENERS)) {
return m_storage.getBoolean(projectName + TestNGPluginConstants.S_DISABLEDLISTENERS);

Powered by Google Project Hosting