Package com.google.code.vimsztool.server

Source Code of com.google.code.vimsztool.server.SzjdeClassRunnerCommand

package com.google.code.vimsztool.server;

import java.io.File;
import java.net.URL;
import java.util.List;
import java.util.UUID;

import com.google.code.vimsztool.compiler.CompilerContext;
import com.google.code.vimsztool.util.SystemJob;

public class SzjdeClassRunnerCommand extends SzjdeCommand {
  boolean runAsUnitTest;
 
  public SzjdeClassRunnerCommand(boolean runAsUnitTest) {
    this.runAsUnitTest = runAsUnitTest;
  }

  public String execute() {
    String classPathXml = params.get(SzjdeConstants.PARAM_CLASSPATHXML);
    String sourceFile = params.get(SzjdeConstants.PARAM_SOURCEFILE);
    CompilerContext cc = getCompilerContext(classPathXml);
    List<URL> urls = cc.getClassPathUrls();
    StringBuilder cmd = new StringBuilder("java::-cp::");
    for (URL url : urls) {
      cmd.append(url.getPath()).append(File.pathSeparator);
    }

    cmd.append(" ::");
    if (runAsUnitTest) {
      cmd.append("org.junit.runner.JUnitCore::");
    }
    String className = cc.buildClassName(sourceFile);
    cmd.append(className);
    String uuid=UUID.randomUUID().toString();
    String vimServerName = params.get(SzjdeConstants.PARAM_VIM_SERVER);
    String bufname = params.get(SzjdeConstants.PARAM_BUF_NAME);
    String origCmdLine = "Run " + className;
    SystemJob job = new SystemJob(cmd.toString(),
        vimServerName,"false",uuid,bufname,cc.getProjectRoot(),origCmdLine);
    job.start();
    return "";
   
  }

}
TOP

Related Classes of com.google.code.vimsztool.server.SzjdeClassRunnerCommand

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.