Examples of VMRunnerConfiguration


Examples of org.eclipse.jdt.launching.VMRunnerConfiguration

    ExecutionArguments execArgs = new ExecutionArguments(vmArgs, pgmArgs);
    Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
    String[] classpath = getClasspath(configuration);

    // Create VM config
    VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName, classpath);
    runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
    runConfig.setVMArguments(execArgs.getVMArgumentsArray());
    runConfig.setWorkingDirectory(workingDirName);
    runConfig.setEnvironment(envp);
    runConfig.setVMSpecificAttributesMap(vmAttributesMap);

    // Bootpath
    String[] bootpath = getBootpath(configuration);
    if (bootpath != null && bootpath.length > 0)
      runConfig.setBootClassPath(bootpath);

    setDefaultSourceLocator(launch, configuration);
   
    if (ILaunchManager.PROFILE_MODE.equals(mode)) {
      try {
View Full Code Here

Examples of org.eclipse.jdt.launching.VMRunnerConfiguration

        }
        webAppClasspath = sb.toString();
      }

      // Create VM configuration
      VMRunnerConfiguration runConfig = new VMRunnerConfiguration(mainTypeName,
          classpath);
      runConfig.setProgramArguments(execArgs.getProgramArgumentsArray());
      runConfig.setEnvironment(envp);

      List<String> runtimeVmArgs = getJettyArgs(configuration);
      runtimeVmArgs.add("-Drjrclasspath=" + webAppClasspath);
      runtimeVmArgs.addAll(Arrays.asList(execArgs.getVMArgumentsArray()));

      runConfig.setVMArguments(runtimeVmArgs.toArray(new String[runtimeVmArgs
          .size()]));
      runConfig.setWorkingDirectory(workingDirName);
      runConfig.setVMSpecificAttributesMap(vmAttributesMap);

      // Boot path
      runConfig.setBootClassPath(getBootpath(configuration));

      // check for cancellation
      if (monitor.isCanceled()) {
        return;
      }
View Full Code Here

Examples of org.eclipse.jdt.launching.VMRunnerConfiguration

    if (runner == null) {
      abort("VM not found", null, IJavaLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST);
    }
   
    //int port= SocketUtil.findFreePort();
    VMRunnerConfiguration runConfig = launchTypes(configuration, mode);
    setDefaultSourceLocator(launch, configuration);
   
    runner.run(runConfig, launch, monitor);
  }
View Full Code Here

Examples of org.eclipse.jdt.launching.VMRunnerConfiguration

    String[] envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);
   
    // copy jar files which are required to execute JavaScript
    JavaScriptLaunchUtil.copyLibraries();
   
    VMRunnerConfiguration runConfig = new VMRunnerConfiguration(
        JavaScriptLaunchConstants.JAVASCRIPT_EXECUTOR,
        JavaScriptLaunchUtil.getClassPathAsStringArray());
   
    List<String> args = new ArrayList<String>();
   
    String script = configuration.getAttribute(
        JavaScriptLaunchConstants.ATTR_JAVASCRIPT_FILE, "");
    args.add(fixArgument(script));
   
    List includes = configuration.getAttribute(
        JavaScriptLaunchConstants.ATTR_JAVASCRIPT_INCLUDES, Collections.EMPTY_LIST);
    IWorkspaceRoot wsroot = ResourcesPlugin.getWorkspace().getRoot();
   
    for(int i=0;i<includes.size();i++){
      String include = (String)includes.get(i);
      if(include.startsWith(JavaScriptLibraryTable.PREFIX)){
        IResource resource = wsroot.findMember(include.substring(JavaScriptLibraryTable.PREFIX.length()));
        if(resource!=null && resource instanceof IFile && resource.exists()){
          args.add(fixArgument(((IFile)resource).getLocation().toString()));
        }
      } else {
        args.add(fixArgument(include));
      }
    }
   
    runConfig.setVMArguments(execArgs.getVMArgumentsArray());
    runConfig.setProgramArguments(args.toArray(new String[args.size()]));
    runConfig.setWorkingDirectory(workingDirName);
    runConfig.setEnvironment(envp);
   
    Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
    runConfig.setVMSpecificAttributesMap(vmAttributesMap);
   
    String[] bootpath = getBootpath(configuration);
    runConfig.setBootClassPath(bootpath);
   
    return runConfig;
  }
View Full Code Here

Examples of org.eclipse.jdt.launching.VMRunnerConfiguration

                            .computeDefaultRuntimeClassPath(testProject
                                    .getJavaProject());
                } catch (Throwable e) {
                }
                if (classPath != null) {
                    VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(
                            "hi.Hi", classPath);
                    File wdir = File.createTempFile("xxx", "yyy");
                    wdir.delete();
                    wdir.mkdir();
                    wdir.deleteOnExit();
                   
                    vmConfig.setWorkingDirectory(wdir.getAbsolutePath());
                    ILaunch launch = new Launch(null, ILaunchManager.RUN_MODE,
                            null);
                    vmRunner.run(vmConfig, launch, null);
                    IProcess[] processes = launch.getProcesses();
                    assertEquals(1, processes.length);
View Full Code Here

Examples of org.eclipse.jdt.launching.VMRunnerConfiguration

  public void launch(ILaunchConfiguration config, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {

    IVMInstall vm = verifyVMInstall(config);
    IVMRunner runner = vm.getVMRunner(mode);
    String[] classpath = getClasspath(config);
    VMRunnerConfiguration runConfig = new VMRunnerConfiguration(CucumberFeatureLaunchConstants.CUCUMBER_API_CLI_MAIN, classpath);

    File workingDir = verifyWorkingDirectory(config);
    String workingDirName = null;
    if (workingDir != null) {
      workingDirName = workingDir.getAbsolutePath();
    }

    String[] bootpath = getBootpath(config);
    runConfig.setBootClassPath(bootpath);
   
    String featurePath = "" ;
    String gluePath = "";
    boolean isMonochrome = false;
    boolean isPretty = false;
    boolean isProgress= false;
    boolean isJunit= false;
    boolean isJson= false;
    boolean isHtml= false;
    boolean isRerun= false;
    boolean isUsage= false;
   
    featurePath = config.getAttribute(CucumberFeatureLaunchConstants.ATTR_FEATURE_PATH, featurePath);
    gluePath  = config.getAttribute(CucumberFeatureLaunchConstants.ATTR_GLUE_PATH, gluePath);
    isMonochrome = config.getAttribute(CucumberFeatureLaunchConstants.ATTR_IS_MONOCHROME, isMonochrome);
    isPretty = config.getAttribute(CucumberFeatureLaunchConstants.ATTR_IS_PRETTY,isPretty );
    isProgress = config.getAttribute(CucumberFeatureLaunchConstants.ATTR_IS_PROGRESS, isProgress);
    isJunit = config.getAttribute(CucumberFeatureLaunchConstants.ATTR_IS_JUNIT,isJunit );
    isJson = config.getAttribute(CucumberFeatureLaunchConstants.ATTR_IS_JSON,isJson );
    isHtml = config.getAttribute(CucumberFeatureLaunchConstants.ATTR_IS_HTML, isHtml);
    isRerun = config.getAttribute(CucumberFeatureLaunchConstants.ATTR_IS_RERUN, isRerun);
    isUsage = config.getAttribute(CucumberFeatureLaunchConstants.ATTR_IS_USAGE,isUsage );
   
    System.out.println("Launching ....................... " + featurePath);
    System.out.println("Glueing ....................... " + gluePath);
    System.out.println("is monochrome.................." + isMonochrome);
    System.out.println("is pretty.................." + isPretty);
    System.out.println("is progress.................." + isProgress);
    System.out.println("is html.................." + isHtml);
    System.out.println("is json.................." + isJson);
    System.out.println("is junit.................." + isJunit);
    System.out.println("is usage.................." + isUsage);
    System.out.println("is rerun.................." + isRerun);
   
   
    String glue = "--glue";
    String formatter = "--format";
    Collection<String> args = new ArrayList<String>();
    //String[] args = new String[6];
    args.add(featurePath);
    args.add(glue);
    args.add(gluePath);
   
    if (isPretty) {
      args.add(formatter);
      args.add("pretty")
    }
   
    if (isJson) {
      args.add(formatter);
      args.add("json")
    }
   
    if (isJunit) {
      args.add(formatter);
      args.add("junit:STDOUT")
    }
   
    if (isProgress) {
      args.add(formatter);
      args.add("progress")
    }
   
    if (isRerun) {
      args.add(formatter);
      args.add("rerun")
    }
   
    if (isHtml) {
      args.add(formatter);
      args.add("html:target")
    }
   
    if (isUsage) {
      args.add(formatter);
      args.add("usage")
    }
   
    if (isMonochrome) args.add("--monochrome");
    runConfig.setProgramArguments(args.toArray(new String[0]));

    runner.run(runConfig, launch, monitor);

  }
View Full Code Here

Examples of org.eclipse.jdt.launching.VMRunnerConfiguration

      String[] classpath = new String[jarFiles.length];
      for(int i=0;i<jarFiles.length;i++){
        classpath[i] = jarFiles[i].getAbsolutePath();
      }
     
      VMRunnerConfiguration vmConfig = new VMRunnerConfiguration(
          "org.apache.cayenne.modeler.Main", classpath);
      vmConfig.setProgramArguments(new String[]{file.makeAbsolute().toString()});
     
      Launch launch = new Launch(null, ILaunchManager.RUN_MODE, null);
      IVMRunner vmRunner = JavaRuntime.getDefaultVMInstall().getVMRunner(
          ILaunchManager.RUN_MODE);
     
View Full Code Here

Examples of org.eclipse.jdt.launching.VMRunnerConfiguration

          new String[] { install.getId() }), null,
          IJavaLaunchConfigurationConstants.ERR_VM_RUNNER_DOES_NOT_EXIST);
    }

    int port = SocketUtil.findFreePort();
    VMRunnerConfiguration runConfig = launchTypes(configuration, launch, javaProject, port, mode);
    setDefaultSourceLocator(launch, configuration);

    launch.setAttribute(TestNGLaunchConfigurationConstants.PORT, Integer.toString(port));
    launch.setAttribute(IJavaLaunchConfigurationConstants.ATTR_PROJECT_NAME, javaProject
        .getElementName());
    launch.setAttribute(TestNGLaunchConfigurationConstants.TESTNG_RUN_NAME_ATTR,
        getRunNameAttr(configuration));

    StringBuilder sb = new StringBuilder();
    for (String arg : runConfig.getProgramArguments()) {
      sb.append(arg).append(" ");
    }
    TestNGPlugin.log("[TestNGLaunchConfigurationDelegate] " + debugConfig(runConfig));
    runner.run(runConfig, launch, monitor);
  }
View Full Code Here

Examples of org.eclipse.jdt.launching.VMRunnerConfiguration

        .append(TestNGLaunchConfigurationConstants.VM_ENABLEASSERTION_OPTION); // $NON-NLS-1$
    addDebugProperties(vmArgs);
    ExecutionArguments execArgs = new ExecutionArguments(vmArgs.toString(), ""); //$NON-NLS-1$
    String[] envp = DebugPlugin.getDefault().getLaunchManager().getEnvironment(configuration);

    VMRunnerConfiguration runConfig = createVMRunner(configuration, launch, jproject, port, mode);
    runConfig.setVMArguments(execArgs.getVMArgumentsArray());
    runConfig.setWorkingDirectory(workingDirName);
    runConfig.setEnvironment(envp);

    Map vmAttributesMap = getVMSpecificAttributesMap(configuration);
    runConfig.setVMSpecificAttributesMap(vmAttributesMap);

    String[] bootpath = getBootpath(configuration);
    runConfig.setBootClassPath(bootpath);

    return runConfig;
  }
View Full Code Here

Examples of org.eclipse.jdt.launching.VMRunnerConfiguration

      ILaunch launch, final IJavaProject jproject, final int port, final String runMode)
      throws CoreException {

    String[] classPath = getClasspath(configuration);
    String progArgs = getProgramArguments(configuration);
    VMRunnerConfiguration vmConfig =
        new VMRunnerConfiguration(getMainTypeName(configuration), classPath);

    // insert the program arguments
    Vector<String> argv = new Vector<String>(10);
    ExecutionArguments execArgs = new ExecutionArguments("", progArgs); //$NON-NLS-1$
    String[] pa = execArgs.getProgramArgumentsArray();
    for (String element : pa) {
      argv.add(element);
    }

    // Use -serPort (serialized protocol) or -port (string protocol) based on
    // a system property
    if (LaunchUtil.useStringProtocol(configuration)) {
      p("Using the string protocol");
      argv.add(CommandLineArgs.PORT);
    } else {
      p("Using the serialized protocol");
      argv.add(RemoteArgs.PORT);
    }
    argv.add(Integer.toString(port));

    IProject project = jproject.getProject();

//    if (!isJDK15(javaVersion)) {
//      List<File> sourceDirs = JDTUtil.getSourceDirFileList(jproject);
//      if (null != sourceDirs) {
//        argv.add(TestNGCommandLineArgs.SRC_COMMAND_OPT);
//        argv.add(Utils.toSinglePath(sourceDirs, ";")); //$NON-NLS-1$
//      }
//    }

   
    PreferenceStoreUtil storage = TestNGPlugin.getPluginPreferenceStore();
    argv.add(CommandLineArgs.OUTPUT_DIRECTORY);
    argv.add(storage.getOutputAbsolutePath(jproject).toOSString());

   
//    String reporters = storage.getReporters(project.getName(), false);
//    if (null != reporters && !"".equals(reporters)) {
//      argv.add(TestNGCommandLineArgs.LISTENER_COMMAND_OPT);
//      argv.add(reporters.replace(' ', ';'));
//    }
   
    String preDefinedListeners = configuration.getAttribute(TestNGLaunchConfigurationConstants.PRE_DEFINED_LISTENERS,"");
   
    if (!preDefinedListeners.trim().equals("")){
      if (!argv.contains(CommandLineArgs.LISTENER)) {
        argv.add(CommandLineArgs.LISTENER);
        argv.add(preDefinedListeners);
      } else {
        String listeners = argv.get(argv.size() - 1);
        listeners += (";" + preDefinedListeners);
        argv.set(argv.size() - 1, listeners);
      }
    }

   
    List<ITestNGListener> contributors = ListenerContributorUtil.findReporterContributors();
    contributors.addAll(ListenerContributorUtil.findTestContributors());
    StringBuffer reportersContributors = new StringBuffer();
    boolean isFirst = true;
    for (ITestNGListener contributor : contributors) {
      if (isFirst) {
        reportersContributors.append(contributor.getClass().getName());
      } else {
        reportersContributors.append(";" + contributor.getClass().getName());
      }
      isFirst = false;
    }
    if (!reportersContributors.toString().trim().equals("")) {
      if (!argv.contains(CommandLineArgs.LISTENER)) {
        argv.add(CommandLineArgs.LISTENER);
        argv.add(reportersContributors.toString().trim());
      } else {
        String listeners = argv.get(argv.size() - 1);
        listeners += (";" + reportersContributors.toString().trim());
        argv.set(argv.size() - 1, listeners);
      }
    }

    boolean disabledReporters = storage.hasDisabledListeners(project.getName(), false);
    if (disabledReporters) {
      argv.add(CommandLineArgs.USE_DEFAULT_LISTENERS);
      argv.add("false");
    }

    List<LaunchSuite> launchSuiteList =
        ConfigurationHelper.getLaunchSuites(jproject, configuration);
    List<String> suiteList = new ArrayList<String>();
    List<String> tempSuites = new ArrayList<String>();

    // Regular mode: generate a new random suite path
    File suiteDir = TestNGPlugin.isDebug() ? new File(RemoteTestNG.DEBUG_SUITE_DIRECTORY)
        : TestNGPlugin.getPluginPreferenceStore().getTemporaryDirectory();
    for (LaunchSuite launchSuite : launchSuiteList) {
      File suiteFile = launchSuite.save(suiteDir);

      suiteList.add(suiteFile.getAbsolutePath());

      if (launchSuite.isTemporary()) {
        suiteFile.deleteOnExit();
        tempSuites.add(suiteFile.getAbsolutePath());
      }
    }

    if (null != suiteList) {
      for (String suite : suiteList) {
        argv.add(suite);
      }

      launch.setAttribute(TestNGLaunchConfigurationConstants.TEMP_SUITE_LIST,
          StringUtils.listToString(tempSuites));
    }

    vmConfig.setProgramArguments(argv.toArray(new String[argv.size()]));

    return vmConfig;
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.