test_class.file: BackEnd/Core/sailfish-core/src/test/java/com/exactpro/sf/aml/AMLBlockUtilityTest.java
test_class.identifier: AMLBlockUtilityTest
test_case.body: @Test
      public void detectLanguageWithUnknownActionTest() {
          IActionManager actionManager = Mockito.mock(IActionManager.class);
          AMLBlock block = new AMLBlock().addElement(new AMLElement().setValue(Column.Action, "zzz"));
  
          try {
              AMLBlockUtility.detectLanguage(Collections.singletonList(block), Collections.<SailfishURI>emptySet(), AutoLanguageFactory.URI, actionManager);
              Assert.fail("No exception was thrown");
          } catch(AMLException e) {
              AlertCollector alertCollector = e.getAlertCollector();
              Assert.assertEquals("Failed to detect language", e.getMessage());
              Assert.assertEquals(1, alertCollector.getCount(AlertType.ERROR));
              Assert.assertEquals(0, alertCollector.getCount(AlertType.WARNING));
              Assert.assertEquals(new Alert(0, null, Column.Action.getName(), "Unknown action: zzz"), alertCollector.getAlerts(AlertType.ERROR).iterator().next());
          }
      }
test_case.class_method_signature: AMLBlockUtilityTest.detectLanguageWithUnknownActionTest()
test_case.full_signature: @Test public void detectLanguageWithUnknownActionTest()
test_case.identifier: detectLanguageWithUnknownActionTest
test_case.invocations: mock addElement setValue detectLanguage singletonList emptySet fail getAlertCollector assertEquals getMessage assertEquals getCount assertEquals getCount assertEquals getName next iterator getAlerts
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void detectLanguageWithUnknownActionTest()
focal_class.file: BackEnd/Core/sailfish-core/src/main/java/com/exactpro/sf/aml/AMLBlockUtility.java
focal_class.identifier: AMLBlockUtility
focal_class.class_method_signature: AMLBlockUtility.flatten(Iterable<AMLElement> elements)
focal_class.full_signature: public static List<AMLElement> flatten(Iterable<AMLElement> elements)
focal_class.identifier: flatten
focal_class.modifiers: public static
focal_class.parameters: (Iterable<AMLElement> elements)
focal_class.return: List<AMLElement>
focal_class.signature: List<AMLElement> flatten(Iterable<AMLElement> elements)
focal_class.class_method_signature: AMLBlockUtility.flatten(Iterable<AMLElement> elements, boolean onlyExecutable)
focal_class.full_signature: public static List<AMLElement> flatten(Iterable<AMLElement> elements, boolean onlyExecutable)
focal_class.identifier: flatten
focal_class.modifiers: public static
focal_class.parameters: (Iterable<AMLElement> elements, boolean onlyExecutable)
focal_class.return: List<AMLElement>
focal_class.signature: List<AMLElement> flatten(Iterable<AMLElement> elements, boolean onlyExecutable)
focal_class.class_method_signature: AMLBlockUtility.detectLanguage(List<AMLBlock> blocks, Set<SailfishURI> languageURIs, SailfishURI selectedLanguageURI, IActionManager actionManager)
focal_class.full_signature: public static SailfishURI detectLanguage(List<AMLBlock> blocks, Set<SailfishURI> languageURIs, SailfishURI selectedLanguageURI, IActionManager actionManager)
focal_class.identifier: detectLanguage
focal_class.modifiers: public static
focal_class.parameters: (List<AMLBlock> blocks, Set<SailfishURI> languageURIs, SailfishURI selectedLanguageURI, IActionManager actionManager)
focal_class.return: SailfishURI
focal_class.signature: SailfishURI detectLanguage(List<AMLBlock> blocks, Set<SailfishURI> languageURIs, SailfishURI selectedLanguageURI, IActionManager actionManager)
focal_class.class_method_signature: AMLBlockUtility.resolveActionURIs(List<AMLBlock> blocks, IActionManager actionManager, IConnectionManager connectionManager, String environmentName)
focal_class.full_signature: public static void resolveActionURIs(List<AMLBlock> blocks, IActionManager actionManager, IConnectionManager connectionManager, String environmentName)
focal_class.identifier: resolveActionURIs
focal_class.modifiers: public static
focal_class.parameters: (List<AMLBlock> blocks, IActionManager actionManager, IConnectionManager connectionManager, String environmentName)
focal_class.return: void
focal_class.signature: void resolveActionURIs(List<AMLBlock> blocks, IActionManager actionManager, IConnectionManager connectionManager, String environmentName)
focal_class.class_method_signature: AMLBlockUtility.resolveDefinedServiceNames(List<AMLBlock> blocks, String environmentName, IConnectionManager serviceManager)
focal_class.full_signature: public static Map<String, SortedMap<Long, String>> resolveDefinedServiceNames(List<AMLBlock> blocks, String environmentName, IConnectionManager serviceManager)
focal_class.identifier: resolveDefinedServiceNames
focal_class.modifiers: public static
focal_class.parameters: (List<AMLBlock> blocks, String environmentName, IConnectionManager serviceManager)
focal_class.return: Map<String, SortedMap<Long, String>>
focal_class.signature: Map<String, SortedMap<Long, String>> resolveDefinedServiceNames(List<AMLBlock> blocks, String environmentName, IConnectionManager serviceManager)
focal_class.class_method_signature: AMLBlockUtility.hash(AMLBlock block, AMLMatrixWrapper wrapper, Map<String, String> staticVariables, Map<AMLBlock, Integer> cache, Set<String> references)
focal_class.full_signature: public static int hash(AMLBlock block, AMLMatrixWrapper wrapper, Map<String, String> staticVariables, Map<AMLBlock, Integer> cache, Set<String> references)
focal_class.identifier: hash
focal_class.modifiers: public static
focal_class.parameters: (AMLBlock block, AMLMatrixWrapper wrapper, Map<String, String> staticVariables, Map<AMLBlock, Integer> cache, Set<String> references)
focal_class.return: int
focal_class.signature: int hash(AMLBlock block, AMLMatrixWrapper wrapper, Map<String, String> staticVariables, Map<AMLBlock, Integer> cache, Set<String> references)
focal_class.class_method_signature: AMLBlockUtility.hash(AMLElement element, AMLMatrixWrapper wrapper, Map<String, String> staticVariables,
              Map<AMLBlock, Integer> cache, Set<String> references)
focal_class.full_signature: public static int hash(AMLElement element, AMLMatrixWrapper wrapper, Map<String, String> staticVariables,
              Map<AMLBlock, Integer> cache, Set<String> references)
focal_class.identifier: hash
focal_class.modifiers: public static
focal_class.parameters: (AMLElement element, AMLMatrixWrapper wrapper, Map<String, String> staticVariables,
              Map<AMLBlock, Integer> cache, Set<String> references)
focal_class.return: int
focal_class.signature: int hash(AMLElement element, AMLMatrixWrapper wrapper, Map<String, String> staticVariables,
              Map<AMLBlock, Integer> cache, Set<String> references)
focal_method.body: public static SailfishURI detectLanguage(List<AMLBlock> blocks, Set<SailfishURI> languageURIs, SailfishURI selectedLanguageURI, IActionManager actionManager) throws AMLException {
          if(AutoLanguageFactory.URI.matches(selectedLanguageURI)) {
              AMLLanguageDetectorVisitor visitor = new AMLLanguageDetectorVisitor(actionManager, languageURIs);
  
              for(AMLBlock block : blocks) {
                  block.accept(visitor);
              }
  
              AlertCollector alertCollector = visitor.getAlertCollector();
  
              if(alertCollector.getCount(AlertType.ERROR) > 0) {
                  throw new AMLException("Failed to detect language", alertCollector);
              }
  
              Set<SailfishURI> compatibleLanguages = visitor.getCompatibleLanguageURIs();
  
              if(compatibleLanguages.isEmpty()) {
                  throw new AMLException("Failed to detect language");
              } else {
                  return compatibleLanguages.iterator().next();
              }
          }
  
          return selectedLanguageURI;
      }
focal_method.class_method_signature: AMLBlockUtility.detectLanguage(List<AMLBlock> blocks, Set<SailfishURI> languageURIs, SailfishURI selectedLanguageURI, IActionManager actionManager)
focal_method.full_signature: public static SailfishURI detectLanguage(List<AMLBlock> blocks, Set<SailfishURI> languageURIs, SailfishURI selectedLanguageURI, IActionManager actionManager)
focal_method.identifier: detectLanguage
focal_method.invocations: matches accept getAlertCollector getCount getCompatibleLanguageURIs isEmpty next iterator
focal_method.modifiers: public static
focal_method.parameters: (List<AMLBlock> blocks, Set<SailfishURI> languageURIs, SailfishURI selectedLanguageURI, IActionManager actionManager)
focal_method.return: SailfishURI
focal_method.signature: SailfishURI detectLanguage(List<AMLBlock> blocks, Set<SailfishURI> languageURIs, SailfishURI selectedLanguageURI, IActionManager actionManager)