|
From: Markus B. <mba...@us...> - 2005-10-04 22:33:06
|
Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18660/src/org/rubypeople/rdt/testunit Modified Files: Tag: SRB_0-6-1 TestunitPlugin.java Log Message: fixed problems with finding free ports. Now the procedure is equal for starting from shortcut and from the run configuration dialog. The port is added as attribute to the launch. Index: TestunitPlugin.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/TestunitPlugin.java,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** TestunitPlugin.java 12 Mar 2005 15:29:58 -0000 1.7 --- TestunitPlugin.java 4 Oct 2005 22:32:55 -0000 1.7.2.1 *************** *** 30,34 **** import org.rubypeople.rdt.core.IType; import org.rubypeople.rdt.core.RubyCore; - import org.rubypeople.rdt.testunit.launcher.SocketUtil; import org.rubypeople.rdt.testunit.launcher.TestUnitLaunchConfigurationDelegate; import org.rubypeople.rdt.testunit.views.TestUnitView; --- 30,33 ---- *************** *** 40,44 **** public static final String PLUGIN_ID = "org.rubypeople.rdt.testunit"; //$NON-NLS-1$ ! //The shared instance. private static TestunitPlugin plugin; --- 39,43 ---- public static final String PLUGIN_ID = "org.rubypeople.rdt.testunit"; //$NON-NLS-1$ ! public static final String TESTUNIT_PORT_ATTR = "org.rubypeople.rdt.testunit.port"; //$NON-NLS-1$ //The shared instance. private static TestunitPlugin plugin; *************** *** 246,282 **** ILaunchConfiguration config = launch.getLaunchConfiguration(); IType launchedType= null; - int port = -1; if (config != null) { ! try { ! // test whether the launch defines the TestUnit port attribute ! port = config.getAttribute(TestUnitLaunchConfigurationDelegate.PORT_ATTR, -1); ! String typeStr= launch.getAttribute(TestUnitLaunchConfigurationDelegate.TESTTYPE_ATTR); ! //String fileName= launch.getAttribute(TestUnitLaunchConfigurationDelegate.LAUNCH_CONTAINER_ATTR); ! ! if (typeStr != null) { ! // FIXME Get the handle on the test type from the model somehow! ! // IFile script = RubyCore.find(fileName); ! // if (element instanceof IRubyType) ! // launchedType= (IRubyType) element; ! } ! } catch (CoreException e) { ! e.printStackTrace(); } - } - if(port == -1) { - log("Failed to get a port from the launch! Trying to generate a new one."); - port = SocketUtil.findFreePort(); - } - fTrackedLaunches.remove(launch); - if (port == -1) { - log("Failed to generate a port!"); - return; } final IType finalType= launchedType; ! final int finalPort = port; getDisplay().asyncExec(new Runnable() { - public void run() { connectTestRunner(launch, finalType, finalPort); --- 245,266 ---- ILaunchConfiguration config = launch.getLaunchConfiguration(); IType launchedType= null; if (config != null) { ! ! String typeStr = launch.getAttribute(TestUnitLaunchConfigurationDelegate.TESTTYPE_ATTR); ! // String fileName= launch.getAttribute(TestUnitLaunchConfigurationDelegate.LAUNCH_CONTAINER_ATTR); ! ! if (typeStr != null) { ! // FIXME Get the handle on the test type from the model somehow! ! // IFile script = RubyCore.find(fileName); ! // if (element instanceof IRubyType) ! // launchedType= (IRubyType) element; } } + fTrackedLaunches.remove(launch); final IType finalType= launchedType; ! final int finalPort = Integer.parseInt(launch.getAttribute(TESTUNIT_PORT_ATTR)) ; getDisplay().asyncExec(new Runnable() { public void run() { connectTestRunner(launch, finalType, finalPort); |