test_class.declarator: settings = new AMLSettings()
test_class.modifier: private static final
test_class.original_string: private static final AMLSettings settings = new AMLSettings();
test_class.type: AMLSettings
test_class.var_name: settings
test_class.declarator: actionRequirements = Mockito.mock(ActionRequirements.class)
test_class.modifier: private static final
test_class.original_string: private static final ActionRequirements actionRequirements = Mockito.mock(ActionRequirements.class);
test_class.type: ActionRequirements
test_class.var_name: actionRequirements
test_class.declarator: actionInfo = Mockito.mock(ActionInfo.class)
test_class.modifier: private static final
test_class.original_string: private static final ActionInfo actionInfo = Mockito.mock(ActionInfo.class);
test_class.type: ActionInfo
test_class.var_name: actionInfo
test_class.declarator: actionManager = Mockito.mock(ActionManager.class)
test_class.modifier: private static final
test_class.original_string: private static final ActionManager actionManager = Mockito.mock(ActionManager.class);
test_class.type: ActionManager
test_class.var_name: actionManager
test_class.file: BackEnd/Core/sailfish-core/src/test/java/com/exactpro/sf/aml/AMLBlockProcessorTest.java
test_class.identifier: AMLBlockProcessorTest
test_class.superclass: extends AbstractTest
test_case.body: @Test
      public void negativeTest() throws Exception {
          settings.setTestCasesRange("");
  
          File matrixFile = new File(BASE_DIR, "src/test/resources/aml/block-processor-negative-test.csv");
  
          try(AdvancedMatrixReader matrixReader = new AdvancedMatrixReader(matrixFile)) {
              AMLMatrix matrix = AMLReader.read(matrixReader);
              ListMultimap<AMLBlockType, AMLTestCase> blocks = AMLConverter.convert(matrix, settings, actionManager, new AlertCollector());
  
              AMLBlockProcessor.process(blocks, settings, actionManager, Collections.emptyMap());
              Assert.fail("No errors were detected");
          } catch(AMLException e) {
              Collection<Alert> errors = e.getAlertCollector().getAlerts();
  
              Assert.assertEquals(9, errors.size());
  
              Alert error = new Alert(11, "tc1", "#reference", "Duplicate reference at line: 6", AlertType.ERROR);
              Assert.assertTrue(error.toString(), errors.remove(error));
              error = new Alert(-1, null, null, "Duplicated reference found in lines: 7, 3: 's1'", AlertType.ERROR);
              Assert.assertTrue(error.toString(), errors.remove(error));
              error = new Alert(-1, null, null, "Duplicated reference found in lines: 12, 3: 's1'", AlertType.ERROR);
              Assert.assertTrue(error.toString(), errors.remove(error));
              error = new Alert(19, "", null, "Recursion detected: b2 -> b1 -> b2", AlertType.ERROR);
              Assert.assertTrue(error.toString(), errors.remove(error));
              error = new Alert(23, "", null, "Recursion detected: b1 -> b2 -> b1", AlertType.ERROR);
              Assert.assertTrue(error.toString(), errors.remove(error));
              error = new Alert(27, "", "#template", "Reference to unknown block: unknown", AlertType.ERROR);
              Assert.assertTrue(error.toString(), errors.remove(error));
              error = new Alert(13, "", "#template", "Reference to unknown block: unknown", AlertType.ERROR);
              Assert.assertTrue(error.toString(), errors.remove(error));
              error = new Alert(31, "", "#dependencies", "Dependency on unknown action: unknown", AlertType.ERROR);
              Assert.assertTrue(error.toString(), errors.remove(error));
              error = new Alert(32, "ref", "#dependencies", "Action cannot depend on itself", AlertType.ERROR);
              Assert.assertTrue(error.toString(), errors.remove(error));
  
              Assert.assertEquals(0, errors.size());
          }
      }
test_case.class_method_signature: AMLBlockProcessorTest.negativeTest()
test_case.full_signature: @Test public void negativeTest()
test_case.identifier: negativeTest
test_case.invocations: setTestCasesRange read convert process emptyMap fail getAlerts getAlertCollector assertEquals size assertTrue toString remove assertTrue toString remove assertTrue toString remove assertTrue toString remove assertTrue toString remove assertTrue toString remove assertTrue toString remove assertTrue toString remove assertTrue toString remove assertEquals size
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void negativeTest()
focal_class.file: BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/aml/AMLBlockProcessor.java
focal_class.identifier: AMLBlockProcessor
focal_class.class_method_signature: AMLBlockProcessor.process(ListMultimap<AMLBlockType, AMLTestCase> allBlocks, AMLSettings settings, IActionManager actionManager, Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.full_signature: public static ListMultimap<AMLBlockType, AMLTestCase> process(ListMultimap<AMLBlockType, AMLTestCase> allBlocks, AMLSettings settings, IActionManager actionManager, Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.identifier: process
focal_class.modifiers: public static
focal_class.parameters: (ListMultimap<AMLBlockType, AMLTestCase> allBlocks, AMLSettings settings, IActionManager actionManager, Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.return: ListMultimap<AMLBlockType, AMLTestCase>
focal_class.signature: ListMultimap<AMLBlockType, AMLTestCase> process(ListMultimap<AMLBlockType, AMLTestCase> allBlocks, AMLSettings settings, IActionManager actionManager, Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.class_method_signature: AMLBlockProcessor.checkBlockReferences(List<AMLTestCase> blocks, AlertCollector alertCollector)
focal_class.full_signature: private static void checkBlockReferences(List<AMLTestCase> blocks, AlertCollector alertCollector)
focal_class.identifier: checkBlockReferences
focal_class.modifiers: private static
focal_class.parameters: (List<AMLTestCase> blocks, AlertCollector alertCollector)
focal_class.return: void
focal_class.signature: void checkBlockReferences(List<AMLTestCase> blocks, AlertCollector alertCollector)
focal_class.class_method_signature: AMLBlockProcessor.retainExecutableTestCases(List<AMLTestCase> testCases, AMLSettings settings)
focal_class.full_signature: private static void retainExecutableTestCases(List<AMLTestCase> testCases, AMLSettings settings)
focal_class.identifier: retainExecutableTestCases
focal_class.modifiers: private static
focal_class.parameters: (List<AMLTestCase> testCases, AMLSettings settings)
focal_class.return: void
focal_class.signature: void retainExecutableTestCases(List<AMLTestCase> testCases, AMLSettings settings)
focal_class.class_method_signature: AMLBlockProcessor.setLastOutcomes(List<AMLTestCase> testCases)
focal_class.full_signature: private static void setLastOutcomes(List<AMLTestCase> testCases)
focal_class.identifier: setLastOutcomes
focal_class.modifiers: private static
focal_class.parameters: (List<AMLTestCase> testCases)
focal_class.return: void
focal_class.signature: void setLastOutcomes(List<AMLTestCase> testCases)
focal_class.class_method_signature: AMLBlockProcessor.insertGlobalBlocks(List<AMLTestCase> testCases, List<AMLTestCase> globalBlocks, AlertCollector alertCollector)
focal_class.full_signature: private static void insertGlobalBlocks(List<AMLTestCase> testCases, List<AMLTestCase> globalBlocks, AlertCollector alertCollector)
focal_class.identifier: insertGlobalBlocks
focal_class.modifiers: private static
focal_class.parameters: (List<AMLTestCase> testCases, List<AMLTestCase> globalBlocks, AlertCollector alertCollector)
focal_class.return: void
focal_class.signature: void insertGlobalBlocks(List<AMLTestCase> testCases, List<AMLTestCase> globalBlocks, AlertCollector alertCollector)
focal_class.class_method_signature: AMLBlockProcessor.insertFirstAndLastBlocks(List<AMLTestCase> testCases, List<AMLTestCase> firstBlocks, List<AMLTestCase> lastBlocks)
focal_class.full_signature: private static void insertFirstAndLastBlocks(List<AMLTestCase> testCases, List<AMLTestCase> firstBlocks, List<AMLTestCase> lastBlocks)
focal_class.identifier: insertFirstAndLastBlocks
focal_class.modifiers: private static
focal_class.parameters: (List<AMLTestCase> testCases, List<AMLTestCase> firstBlocks, List<AMLTestCase> lastBlocks)
focal_class.return: void
focal_class.signature: void insertFirstAndLastBlocks(List<AMLTestCase> testCases, List<AMLTestCase> firstBlocks, List<AMLTestCase> lastBlocks)
focal_class.class_method_signature: AMLBlockProcessor.insertIncludeBlocks(List<AMLTestCase> blocks, List<AMLTestCase> includeBlocks, Set<String> invalidBlockReferences, AlertCollector alertCollector, IActionManager actionManager,
              Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.full_signature: private static void insertIncludeBlocks(List<AMLTestCase> blocks, List<AMLTestCase> includeBlocks, Set<String> invalidBlockReferences, AlertCollector alertCollector, IActionManager actionManager,
              Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.identifier: insertIncludeBlocks
focal_class.modifiers: private static
focal_class.parameters: (List<AMLTestCase> blocks, List<AMLTestCase> includeBlocks, Set<String> invalidBlockReferences, AlertCollector alertCollector, IActionManager actionManager,
              Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.return: void
focal_class.signature: void insertIncludeBlocks(List<AMLTestCase> blocks, List<AMLTestCase> includeBlocks, Set<String> invalidBlockReferences, AlertCollector alertCollector, IActionManager actionManager,
              Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.class_method_signature: AMLBlockProcessor.insertIncludeBlocks(AMLTestCase block, List<AMLTestCase> blocks, Set<String> invalidBlockReferences, AlertCollector alertCollector, IActionManager actionManager,
              Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.full_signature: private static void insertIncludeBlocks(AMLTestCase block, List<AMLTestCase> blocks, Set<String> invalidBlockReferences, AlertCollector alertCollector, IActionManager actionManager,
              Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.identifier: insertIncludeBlocks
focal_class.modifiers: private static
focal_class.parameters: (AMLTestCase block, List<AMLTestCase> blocks, Set<String> invalidBlockReferences, AlertCollector alertCollector, IActionManager actionManager,
              Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.return: void
focal_class.signature: void insertIncludeBlocks(AMLTestCase block, List<AMLTestCase> blocks, Set<String> invalidBlockReferences, AlertCollector alertCollector, IActionManager actionManager,
              Map<String, SortedMap<Long, String>> definedServiceNames)
focal_class.class_method_signature: AMLBlockProcessor.getRecursiveBlockReferences(List<AMLTestCase> blocks, AlertCollector alertCollector)
focal_class.full_signature: private static Set<String> getRecursiveBlockReferences(List<AMLTestCase> blocks, AlertCollector alertCollector)
focal_class.identifier: getRecursiveBlockReferences
focal_class.modifiers: private static
focal_class.parameters: (List<AMLTestCase> blocks, AlertCollector alertCollector)
focal_class.return: Set<String>
focal_class.signature: Set<String> getRecursiveBlockReferences(List<AMLTestCase> blocks, AlertCollector alertCollector)
focal_class.class_method_signature: AMLBlockProcessor.checkBlock(AMLTestCase block, List<AMLTestCase> blocks, Stack<String> refStack, Stack<AMLAction> actionStack, Set<String> recursiveBlocks, AlertCollector alertCollector)
focal_class.full_signature: private static void checkBlock(AMLTestCase block, List<AMLTestCase> blocks, Stack<String> refStack, Stack<AMLAction> actionStack, Set<String> recursiveBlocks, AlertCollector alertCollector)
focal_class.identifier: checkBlock
focal_class.modifiers: private static
focal_class.parameters: (AMLTestCase block, List<AMLTestCase> blocks, Stack<String> refStack, Stack<AMLAction> actionStack, Set<String> recursiveBlocks, AlertCollector alertCollector)
focal_class.return: void
focal_class.signature: void checkBlock(AMLTestCase block, List<AMLTestCase> blocks, Stack<String> refStack, Stack<AMLAction> actionStack, Set<String> recursiveBlocks, AlertCollector alertCollector)
focal_class.class_method_signature: AMLBlockProcessor.getBlockByReference(String reference, List<AMLTestCase> blocks)
focal_class.full_signature: private static AMLTestCase getBlockByReference(String reference, List<AMLTestCase> blocks)
focal_class.identifier: getBlockByReference
focal_class.modifiers: private static
focal_class.parameters: (String reference, List<AMLTestCase> blocks)
focal_class.return: AMLTestCase
focal_class.signature: AMLTestCase getBlockByReference(String reference, List<AMLTestCase> blocks)
focal_class.class_method_signature: AMLBlockProcessor.copyStaticActions(List<AMLTestCase> testCases, boolean aml2, AlertCollector alertCollector)
focal_class.full_signature: private static void copyStaticActions(List<AMLTestCase> testCases, boolean aml2, AlertCollector alertCollector)
focal_class.identifier: copyStaticActions
focal_class.modifiers: private static
focal_class.parameters: (List<AMLTestCase> testCases, boolean aml2, AlertCollector alertCollector)
focal_class.return: void
focal_class.signature: void copyStaticActions(List<AMLTestCase> testCases, boolean aml2, AlertCollector alertCollector)
focal_class.class_method_signature: AMLBlockProcessor.addError(AlertCollector alertCollector, AMLTestCase block, Column column, String message, Object... args)
focal_class.full_signature: private static void addError(AlertCollector alertCollector, AMLTestCase block, Column column, String message, Object... args)
focal_class.identifier: addError
focal_class.modifiers: private static
focal_class.parameters: (AlertCollector alertCollector, AMLTestCase block, Column column, String message, Object... args)
focal_class.return: void
focal_class.signature: void addError(AlertCollector alertCollector, AMLTestCase block, Column column, String message, Object... args)
focal_method.body: public static ListMultimap<AMLBlockType, AMLTestCase> process(ListMultimap<AMLBlockType, AMLTestCase> allBlocks, AMLSettings settings, IActionManager actionManager, Map<String, SortedMap<Long, String>> definedServiceNames)
              throws AMLException {
          AlertCollector alertCollector = new AlertCollector();
  
          List<AMLTestCase> testCases = allBlocks.get(AMLBlockType.TestCase);
          List<AMLTestCase> blocks = allBlocks.get(AMLBlockType.Block);
          List<AMLTestCase> beforeTCBlocks = allBlocks.get(AMLBlockType.BeforeTCBlock);
          List<AMLTestCase> afterTCBlocks = allBlocks.get(AMLBlockType.AfterTCBlock);
          List<AMLTestCase> firstBlocks = allBlocks.get(AMLBlockType.FirstBlock);
          List<AMLTestCase> lastBlocks = allBlocks.get(AMLBlockType.LastBlock);
          List<AMLTestCase> globalBlocks = allBlocks.get(AMLBlockType.GlobalBlock);
  
          retainExecutableTestCases(testCases, settings);
  
          if(testCases.isEmpty()) {
              alertCollector.add(new Alert("Nothing to execute"));
          }
  
          checkBlockReferences(testCases, alertCollector);
          checkBlockReferences(blocks, alertCollector);
          checkBlockReferences(beforeTCBlocks, alertCollector);
          checkBlockReferences(afterTCBlocks, alertCollector);
  
          insertGlobalBlocks(testCases, globalBlocks, alertCollector);
          insertFirstAndLastBlocks(testCases, firstBlocks, lastBlocks);
  
          Set<String> invalidBlockReferences = getRecursiveBlockReferences(blocks, alertCollector);
  
          insertIncludeBlocks(testCases, blocks, invalidBlockReferences, alertCollector, actionManager, definedServiceNames);
          insertIncludeBlocks(beforeTCBlocks, blocks, invalidBlockReferences, alertCollector, actionManager, definedServiceNames);
          insertIncludeBlocks(afterTCBlocks, blocks, invalidBlockReferences, alertCollector, actionManager, definedServiceNames);
  
          copyStaticActions(testCases, AMLLangConst.AML2.matches(settings.getLanguageURI()), alertCollector);
          setLastOutcomes(testCases);
  
          ListMultimap<AMLBlockType, AMLTestCase> processedBlocks = ArrayListMultimap.create();
  
          processedBlocks.putAll(AMLBlockType.TestCase, testCases);
          processedBlocks.putAll(AMLBlockType.BeforeTCBlock, beforeTCBlocks);
          processedBlocks.putAll(AMLBlockType.AfterTCBlock, afterTCBlocks);
  
          for(AMLTestCase testCase : allBlocks.values()) {
              for(AMLAction action : testCase.getActions()) {
                  List<String> dependencies = action.getDependencies();
  
                  if(dependencies.isEmpty()) {
                      continue;
                  }
  
                  for(String dependency : dependencies) {
                      AMLAction dependencyAction = testCase.findActionByRef(dependency);
  
                      if(dependencyAction == null) {
                          String reference = ObjectUtils.defaultIfNull(action.getReference(), action.getReferenceToFilter());
                          alertCollector.add(new Alert(action.getLine(), reference, Column.Dependencies.getName(), "Dependency on unknown action: " + dependency));
                      }
  
                      if(dependencyAction == action) {
                          alertCollector.add(new Alert(action.getLine(), dependency, Column.Dependencies.getName(), "Action cannot depend on itself"));
                      }
                  }
              }
          }
  
          if(alertCollector.getCount(AlertType.ERROR) > 0) {
              throw new AMLException("Failed to process blocks", alertCollector);
          }
  
          return processedBlocks;
      }
focal_method.class_method_signature: AMLBlockProcessor.process(ListMultimap<AMLBlockType, AMLTestCase> allBlocks, AMLSettings settings, IActionManager actionManager, Map<String, SortedMap<Long, String>> definedServiceNames)
focal_method.full_signature: public static ListMultimap<AMLBlockType, AMLTestCase> process(ListMultimap<AMLBlockType, AMLTestCase> allBlocks, AMLSettings settings, IActionManager actionManager, Map<String, SortedMap<Long, String>> definedServiceNames)
focal_method.identifier: process
focal_method.invocations: get get get get get get get retainExecutableTestCases isEmpty add checkBlockReferences checkBlockReferences checkBlockReferences checkBlockReferences insertGlobalBlocks insertFirstAndLastBlocks getRecursiveBlockReferences insertIncludeBlocks insertIncludeBlocks insertIncludeBlocks copyStaticActions matches getLanguageURI setLastOutcomes create putAll putAll putAll values getActions getDependencies isEmpty findActionByRef defaultIfNull getReference getReferenceToFilter add getLine getName add getLine getName getCount
focal_method.modifiers: public static
focal_method.parameters: (ListMultimap<AMLBlockType, AMLTestCase> allBlocks, AMLSettings settings, IActionManager actionManager, Map<String, SortedMap<Long, String>> definedServiceNames)
focal_method.return: ListMultimap<AMLBlockType, AMLTestCase>
focal_method.signature: ListMultimap<AMLBlockType, AMLTestCase> process(ListMultimap<AMLBlockType, AMLTestCase> allBlocks, AMLSettings settings, IActionManager actionManager, Map<String, SortedMap<Long, String>> definedServiceNames)