Exemple #1
0
 public ProcessHandler createProcess(List<ITestNodeWrapper> tests) throws ExecutionException {
   if (tests == null) {
     throw new ExecutionException("Tests to run are null.");
   }
   Tuples._2<List<ITestNodeWrapper>, Tuples._3<String, List<String>, List<String>>> testsToRun =
       Junit_Command.getTestsToRunWithParameters(tests);
   if (ListSequence.fromList(testsToRun._0()).isEmpty()) {
     throw new ExecutionException("Could not find tests to run.");
   }
   return new Java_Command()
       .setVirtualMachineParameter_String(
           IterableUtils.join(ListSequence.fromList(testsToRun._1()._1()), " ")
               + (((myVirtualMachineParameter_String != null
                       && myVirtualMachineParameter_String.length() > 0)
                   ? " " + myVirtualMachineParameter_String
                   : "")))
       .setClassPath_ListString(
           ListSequence.fromList(testsToRun._1()._2())
               .union(ListSequence.fromList(Junit_Command.getClasspath(testsToRun._0())))
               .toListSequence())
       .setJrePath_String(myJrePath_String)
       .setWorkingDirectory_File(myWorkingDirectory_File)
       .setProgramParameter_String(Junit_Command.getProgramParameters(testsToRun._0()))
       .setDebuggerSettings_String(myDebuggerSettings_String)
       .createProcess(testsToRun._1()._0());
 }
Exemple #2
0
 public ListCommandPart(List<? extends Object> list, @Nullable String separator) {
   if ((separator == null || separator.length() == 0)) {
     addCommands(getCommands(list));
   } else {
     addCommands(IterableUtils.join(Sequence.fromIterable(getCommands(list)), separator));
   }
 }
Exemple #3
0
 @MPSLaunch
 public void test_extensionPointExpression() throws Exception {
   String string =
       IterableUtils.join(
           Sequence.fromIterable(
                   ExtensionPoint.<String>generify(
                           new ExtensionPoint(
                               "jetbrains.mps.lang.extension.tests.multiExtensionPoint",
                               String.class))
                       .getObjects())
               .sort(
                   new ISelector<String, String>() {
                     public String select(String it) {
                       return it;
                     }
                   },
                   false),
           ", ");
   Assert.assertEquals("salam, dunya", string);
 }
Exemple #4
0
 private static String getProgramParameters(final List<ITestNodeWrapper> tests) {
   final Wrappers._T<List<String>> testsCommandLine = new Wrappers._T<List<String>>();
   ModelAccess.instance()
       .runReadAction(
           new Runnable() {
             public void run() {
               testsCommandLine.value =
                   ListSequence.fromList(
                       new ArrayList<String>(ListSequence.fromList(tests).count()));
               for (ITestNodeWrapper test : ListSequence.fromList(tests)) {
                 List<String> parametersPart =
                     ListSequence.fromListAndArray(
                         new ArrayList<String>(),
                         (test.isTestCase() ? "-c" : "-m"),
                         test.getFqName());
                 ListSequence.fromList(testsCommandLine.value)
                     .addSequence(ListSequence.fromList(parametersPart));
               }
             }
           });
   return IterableUtils.join(ListSequence.fromList(testsCommandLine.value), " ");
 }
 private String getBSName(SNode string) throws ArtifactsRelativePathHelper.RelativePathException {
   if (ListSequence.fromList(SLinkOperations.getTargets(string, "parts", true))
       .any(
           new IWhereFilter<SNode>() {
             public boolean accept(SNode it) {
               return !(SNodeOperations.isInstanceOf(
                   it, "jetbrains.mps.build.structure.BuildTextStringPart"));
             }
           })) {
     throw new ArtifactsRelativePathHelper.RelativePathException("macros are not allowed");
   }
   return IterableUtils.join(
       ListSequence.fromList(SLinkOperations.getTargets(string, "parts", true))
           .select(
               new ISelector<SNode, String>() {
                 public String select(SNode it) {
                   return SPropertyOperations.getString(
                       SNodeOperations.cast(
                           it, "jetbrains.mps.build.structure.BuildTextStringPart"),
                       "text");
                 }
               }),
       " ");
 }