Update of /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22510/src/org/rubypeople/rdt/testunit/launcher Modified Files: TestUnitLaunchShortcut.java TestUnitRunnerConfiguration.java TestUnitLaunchConfigurationDelegate.java Log Message: merged from SRB_0-6-1_3 Index: TestUnitRunnerConfiguration.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitRunnerConfiguration.java,v retrieving revision 1.15 retrieving revision 1.16 diff -C2 -d -r1.15 -r1.16 *** TestUnitRunnerConfiguration.java 1 Oct 2005 23:10:52 -0000 1.15 --- TestUnitRunnerConfiguration.java 4 Oct 2005 22:53:19 -0000 1.16 *************** *** 13,17 **** public class TestUnitRunnerConfiguration extends InterpreterRunnerConfiguration { ! public TestUnitRunnerConfiguration(ILaunchConfiguration aConfiguration) { super(aConfiguration); --- 13,18 ---- public class TestUnitRunnerConfiguration extends InterpreterRunnerConfiguration { ! private int port = -1 ; ! public TestUnitRunnerConfiguration(ILaunchConfiguration aConfiguration) { super(aConfiguration); *************** *** 48,51 **** --- 49,61 ---- } + public int getPort() { + // the port is needed render the command line for the ruby interpreter call + // and in TestUnitPlugin::launchChanged in order to start the server on + // the java side + if (port == -1) { + port = SocketUtil.findFreePort(); + } + return port ; + } /* * (non-Javadoc) *************** *** 53,58 **** * @see org.rubypeople.rdt.internal.launching.InterpreterRunnerConfiguration#getProgramArguments() */ ! public String getProgramArguments() { ! int port = 6789; String fileName = ""; String testClass = ""; --- 63,67 ---- * @see org.rubypeople.rdt.internal.launching.InterpreterRunnerConfiguration#getProgramArguments() */ ! public String getProgramArguments() { String fileName = ""; String testClass = ""; *************** *** 63,68 **** try { // Pull out the port and other unit testing variables ! // and convert them into command line args ! port = configuration.getAttribute(TestUnitLaunchConfigurationDelegate.PORT_ATTR, 6789); fileName = configuration.getAttribute(TestUnitLaunchConfigurationDelegate.LAUNCH_CONTAINER_ATTR, ""); testClass = configuration.getAttribute(TestUnitLaunchConfigurationDelegate.TESTTYPE_ATTR, ""); --- 72,76 ---- try { // Pull out the port and other unit testing variables ! // and convert them into command line args fileName = configuration.getAttribute(TestUnitLaunchConfigurationDelegate.LAUNCH_CONTAINER_ATTR, ""); testClass = configuration.getAttribute(TestUnitLaunchConfigurationDelegate.TESTTYPE_ATTR, ""); *************** *** 70,76 **** } catch (CoreException e) { TestunitPlugin.log(e); } ! return fileName + " " + port + " " + keepAlive + " " + testClass + " " + testMethod; } --- 78,85 ---- } catch (CoreException e) { TestunitPlugin.log(e); + throw new RuntimeException("Could not get necessary attributes from the launch configuration.") ; } ! return fileName + " " + this.getPort() + " " + keepAlive + " " + testClass + " " + testMethod; } Index: TestUnitLaunchConfigurationDelegate.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchConfigurationDelegate.java,v retrieving revision 1.2 retrieving revision 1.3 diff -C2 -d -r1.2 -r1.3 *** TestUnitLaunchConfigurationDelegate.java 2 Mar 2005 01:35:45 -0000 1.2 --- TestUnitLaunchConfigurationDelegate.java 4 Oct 2005 22:53:19 -0000 1.3 *************** *** 1,4 **** --- 1,5 ---- package org.rubypeople.rdt.testunit.launcher; + import org.eclipse.debug.core.ILaunch; import org.eclipse.debug.core.ILaunchConfiguration; import org.rubypeople.rdt.internal.launching.InterpreterRunnerConfiguration; *************** *** 7,12 **** public class TestUnitLaunchConfigurationDelegate extends RubyApplicationLaunchConfigurationDelegate { - - public static final String PORT_ATTR = TestunitPlugin.PLUGIN_ID + ".PORT"; //$NON-NLS-1$ /** * The single test type, or "" iff running a launch container. --- 8,11 ---- *************** *** 28,33 **** } ! protected InterpreterRunnerConfiguration wrapConfiguration(ILaunchConfiguration configuration) { ! return new TestUnitRunnerConfiguration(configuration) ; } --- 27,35 ---- } ! protected InterpreterRunnerConfiguration wrapConfigurationAndHandleLaunch(ILaunchConfiguration configuration, ILaunch launch) { ! ! TestUnitRunnerConfiguration testRunnerConfiguration = new TestUnitRunnerConfiguration(configuration) ; ! launch.setAttribute(TestunitPlugin.TESTUNIT_PORT_ATTR, Integer.toString(testRunnerConfiguration.getPort())) ; ! return testRunnerConfiguration ; } Index: TestUnitLaunchShortcut.java =================================================================== RCS file: /cvsroot/rubyeclipse/org.rubypeople.rdt.testunit/src/org/rubypeople/rdt/testunit/launcher/TestUnitLaunchShortcut.java,v retrieving revision 1.12 retrieving revision 1.13 diff -C2 -d -r1.12 -r1.13 *** TestUnitLaunchShortcut.java 18 Sep 2005 15:18:02 -0000 1.12 --- TestUnitLaunchShortcut.java 4 Oct 2005 22:53:19 -0000 1.13 *************** *** 139,143 **** wc.setAttribute(RubyLaunchConfigurationAttribute.PROJECT_NAME, rubyFile.getProject().getName()); - int port = SocketUtil.findFreePort(); // FIXME Probably shouldn't write this out. It's now ignored at runtime wc.setAttribute(RubyLaunchConfigurationAttribute.FILE_NAME, TestUnitRunnerConfiguration.getTestRunnerPath()); --- 139,142 ---- *************** *** 147,152 **** wc.setAttribute(TestUnitLaunchConfigurationDelegate.TESTNAME_ATTR, testName); wc.setAttribute(TestUnitLaunchConfigurationDelegate.TESTTYPE_ATTR, ""); - // FIXME shouldn't this be determined at RUN time, not LAUNCH creation time? - wc.setAttribute(TestUnitLaunchConfigurationDelegate.PORT_ATTR, port); wc.setAttribute(ILaunchConfiguration.ATTR_SOURCE_LOCATOR_ID, "org.rubypeople.rdt.debug.ui.rubySourceLocator"); config = wc.doSave(); --- 146,149 ---- |