Menu

Export project throws exception

Help
Alex Sigal
2014-07-07
2014-07-07
  • Alex Sigal

    Alex Sigal - 2014-07-07

    There is a port 1 year old about it https://sourceforge.net/p/jsystemtest/discussion/397999/thread/797059b8/ and bug was opened

    Is there any solution how to export project (command line, gui, something?)?
    thanks

     
    • Guy Levi

      Guy Levi - 2014-07-07

      you can do it from the code and it will work the problem occurred only on
      the gui.

      public class ExportRunner extends BasicTest {
      String outDir = "c:\export_runner\";
      String srcDir = "projectPath\src";
      String classDir = "projectPath\target\classes";
      String runnerDir = "projectPath\target\runner";
      String jdkDir = null;
      String resourcesDir = "projectPath\src\main\resources";
      String zipFile = "runner.zip";
      String antTaskFile =
      "projectPath\src\main\resources\antTasks\buildTasks.xml";

      @Override
      public void setupTest() throws Exception {
      // TODO Auto-generated method stub
      }
      @Test
      public void exportRunner() throws Exception {
      export(true,true,true,true,true,false,false, outDir, srcDir, classDir,
      runnerDir, jdkDir, resourcesDir,zipFile);
      }
      @Override
      public void cleanTest() throws Exception {
      // TODO Auto-generated method stub
      }
      /
      * Used to build regression distribution. Following are the script
      * parameters:

      * 1. export.src - if set will run the export of the tests sources.

      * 2. export.classes - export tests classes.

      * 3. export.so - export system objects.

      * 4. export.runner - export the runner.

      * 5. out.dir - the out dir used to build the delevery.

      * 6. src.dir - the tests sources directory.

      * 7. class.dir - the classes directory.

      * 8. so.lib - the system objects directory.

      * 9. zip.file - the target zip file.

      * 10. runner.dir - the runner dir.
      * @param exportSut if True will export Sut folder
      * @param exportScenarios if True will export Scenarios folder

      /
      public void export(boolean exportSrc, boolean exportSut, boolean
      exportScenarios,boolean exportClasses,boolean exportRunner,
      boolean exportJdk, boolean exportLog, String outDir, String srcDir,String
      classDir,String runnerDir, String jdkDir, String resourcesDir, String
      zipFile)
      throws Exception {
      Properties p = new Properties();
      p.setProperty("export.src", "true");
      p.setProperty("src.dir", srcDir);
      // Exclude Sut\Scenarios from both source and classes
      StringBuffer excludeDirectory = new StringBuffer();;
      if (exportSrc) {
      p.setProperty("export.tests", "true");
      p.setProperty("src.dir", srcDir);
      // Checking if resources folder exists, only if true the
      // export_resources method will be executed
      if (new File(resourcesDir).exists()){
      p.setProperty("export.resources", "true");
      p.setProperty("resources.dir", resourcesDir);
      }
      }else{
      String[] dirs = FileUtils.listDirs(classDir);
      for (String dir : dirs){
      if (!dir.equals("sut") && !dir.equals("scenarios")){
      excludeDirectory.append(" ");
      excludeDirectory.append(dir);
      excludeDirectory.append("\");
      }
      }
      }
      if (exportSut){
      p.setProperty("export.suts", "true");
      }
      if (exportScenarios){
      p.setProperty("export.scenarios", "true");
      }
      if (!exportSut){
      excludeDirectory.append(" sut\");
      }
      if (!exportScenarios){
      excludeDirectory.append(" scenarios\");
      }
      p.setProperty("exclude.directories",excludeDirectory.toString());

      if (exportClasses) {
      p.setProperty("export.classes", "true");
      p.setProperty("classes.dir", classDir);
      p.setProperty("export.lib", "true");
      p.setProperty("lib.dir", classDir+"/../"+"lib");//lib and classes are in
      the same directory.
      }
      if (exportRunner) {
      p.setProperty("export.runner", "true");
      p.setProperty("runner.dir", runnerDir);
      }
      if (exportJdk) {
      p.setProperty("export.jdk", "true");
      p.setProperty("jdk.dir", jdkDir);
      }
      if (exportLog) {
      p.setProperty("runner.dir", runnerDir);
      p.setProperty("export.log", "true");
      }
      p.setProperty("basedir", System.getProperty("user.dir"));
      p.setProperty("out.dir", System.getProperty("user.dir") + File.separator +
      "tmp");
      if (!zipFile.endsWith(".zip")){
      zipFile += ".zip";
      }
      p.setProperty("zip.file", zipFile);
      InputStream buildFileInputStream = new FileInputStream(new
      File(antTaskFile));
      Command cmd = AntExecutor.executeAnt(new
      File(CommonResources.getRunnerDir() +
      "\target\runner\thirdparty\ant"),buildFileInputStream , p, "export");
      log.fine(cmd.getStd().toString());
      }

      }

      On Mon, Jul 7, 2014 at 11:09 AM, Alex Sigal alexsigal@users.sf.net wrote:

      There is a port 1 year old about it
      https://sourceforge.net/p/jsystemtest/discussion/397999/thread/797059b8/
      and bug was opened

      Is there any solution how to export project (command line, gui,
      something?)?
      thanks


      Export project throws exception
      https://sourceforge.net/p/jsystemtest/discussion/397999/thread/ca6786e4/?limit=25#342c


      Sent from sourceforge.net because you indicated interest in
      https://sourceforge.net/p/jsystemtest/discussion/397999/

      To unsubscribe from further messages, please visit
      https://sourceforge.net/auth/subscriptions/

       

Log in to post a comment.