@Override protected void hyperlinkActivated(HyperlinkEvent e) { final Module moduleByName = ModuleManager.getInstance(myProject).findModuleByName(e.getDescription()); if (moduleByName != null) { myConfiguration.getConfigurationModule().setModule(moduleByName); try { final Executor executor = myConsoleProperties.isDebug() ? DefaultDebugExecutor.getDebugExecutorInstance() : DefaultRunExecutor.getRunExecutorInstance(); final ProgramRunner runner = RunnerRegistry.getInstance().getRunner(executor.getId(), myConfiguration); assert runner != null; runner.execute( executor, new ExecutionEnvironment( myConfiguration, myProject, getRunnerSettings(), getConfigurationSettings(), null)); final Balloon balloon = myToolWindowManager.getToolWindowBalloon(myTestRunDebugId); if (balloon != null) { balloon.hide(); } } catch (ExecutionException e1) { LOG.error(e1); } } }
public void run(@NotNull ProgressIndicator indicator) { try { mySocket = myServerSocket.accept(); DumbService.getInstance(myProject) .repeatUntilPassesInSmartMode( new Runnable() { @Override public void run() { myClasses.clear(); myJunit4[0] = ConfigurationUtil.findAllTestClasses(myClassFilter, myClasses); } }); myFoundTests = !myClasses.isEmpty(); } catch (IOException e) { LOG.info(e); } catch (Throwable e) { LOG.error(e); } }
protected void initialize() throws ExecutionException { super.initialize(); final JUnitConfiguration.Data data = myConfiguration.getPersistentData(); getClassFilter(data); // check if junit found configureClasspath(); try { myTempFile = FileUtil.createTempFile("idea_junit", ".tmp"); myTempFile.deleteOnExit(); myJavaParameters.getProgramParametersList().add("@" + myTempFile.getAbsolutePath()); } catch (IOException e) { LOG.error(e); } try { myServerSocket = new ServerSocket(0, 0, InetAddress.getByName("127.0.0.1")); myJavaParameters.getProgramParametersList().add("-socket" + myServerSocket.getLocalPort()); } catch (IOException e) { LOG.error(e); } }
protected void finish() { DataOutputStream os = null; try { if (mySocket == null || mySocket.isClosed()) return; os = new DataOutputStream(mySocket.getOutputStream()); os.writeBoolean(true); } catch (Throwable e) { LOG.info(e); } finally { try { if (os != null) os.close(); } catch (Throwable e) { LOG.info(e); } try { if (!myServerSocket.isClosed()) { myServerSocket.close(); } } catch (Throwable e) { LOG.info(e); } } }