test_class.declarator: consistencyChecker
test_class.modifier: private
test_class.original_string: private ConsistencyChecker consistencyChecker;
test_class.type: ConsistencyChecker
test_class.var_name: consistencyChecker
test_class.file: org.eclipse.winery.repository/src/test/java/org/eclipse/winery/repository/backend/consistencycheck/ConsistencyCheckerTest.java
test_class.identifier: ConsistencyCheckerTest
test_class.superclass: extends TestWithGitBackedRepository
test_case.body: @Test
      public void nodeTypeImplementationNamespaceHasNoErrors() throws Exception {
          NodeTypeImplementationId id = new NodeTypeImplementationId("http://winery.opentosca.org/test/nodetypeimplementations/fruits", "baobab_impl", false);
          ConsistencyErrorCollector errorLogger = new ConsistencyErrorCollector();
          consistencyChecker.checkNamespaceUri(id);
          assertEquals(Collections.emptyMap(), errorLogger.getErrorList());
      }
test_case.class_method_signature: ConsistencyCheckerTest.nodeTypeImplementationNamespaceHasNoErrors()
test_case.full_signature: @Test public void nodeTypeImplementationNamespaceHasNoErrors()
test_case.identifier: nodeTypeImplementationNamespaceHasNoErrors
test_case.invocations: checkNamespaceUri assertEquals emptyMap getErrorList
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void nodeTypeImplementationNamespaceHasNoErrors()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(ConsistencyChecker.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(ConsistencyChecker.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: ARTEFACT_BE = "artefact"
focal_class.modifier: private static final
focal_class.original_string: private static final String ARTEFACT_BE = "artefact";
focal_class.type: String
focal_class.var_name: ARTEFACT_BE
focal_class.declarator: configuration
focal_class.modifier: private final
focal_class.original_string: private final ConsistencyCheckerConfiguration configuration;
focal_class.type: ConsistencyCheckerConfiguration
focal_class.var_name: configuration
focal_class.declarator: progressListener
focal_class.modifier: private
focal_class.original_string: private ConsistencyCheckerProgressListener progressListener;
focal_class.type: ConsistencyCheckerProgressListener
focal_class.var_name: progressListener
focal_class.declarator: allDefinitionsChildIds
focal_class.modifier: private final
focal_class.original_string: private final List<DefinitionsChildId> allDefinitionsChildIds;
focal_class.type: List<DefinitionsChildId>
focal_class.var_name: allDefinitionsChildIds
focal_class.declarator: errorCollector = new ConsistencyErrorCollector()
focal_class.modifier: private final
focal_class.original_string: private final ConsistencyErrorCollector errorCollector = new ConsistencyErrorCollector();
focal_class.type: ConsistencyErrorCollector
focal_class.var_name: errorCollector
focal_class.file: org.eclipse.winery.repository/src/main/java/org/eclipse/winery/repository/backend/consistencycheck/ConsistencyChecker.java
focal_class.identifier: ConsistencyChecker
focal_class.class_method_signature: ConsistencyChecker.ConsistencyChecker(@NonNull ConsistencyCheckerConfiguration configuration)
focal_class.full_signature: public  ConsistencyChecker(@NonNull ConsistencyCheckerConfiguration configuration)
focal_class.identifier: ConsistencyChecker
focal_class.modifiers: public
focal_class.parameters: (@NonNull ConsistencyCheckerConfiguration configuration)
focal_class.signature:  ConsistencyChecker(@NonNull ConsistencyCheckerConfiguration configuration)
focal_class.class_method_signature: ConsistencyChecker.ConsistencyChecker(@NonNull ConsistencyCheckerConfiguration configuration,
                                @NonNull ConsistencyCheckerProgressListener consistencyCheckerProgressListener)
focal_class.full_signature: public  ConsistencyChecker(@NonNull ConsistencyCheckerConfiguration configuration,
                                @NonNull ConsistencyCheckerProgressListener consistencyCheckerProgressListener)
focal_class.identifier: ConsistencyChecker
focal_class.modifiers: public
focal_class.parameters: (@NonNull ConsistencyCheckerConfiguration configuration,
                                @NonNull ConsistencyCheckerProgressListener consistencyCheckerProgressListener)
focal_class.signature:  ConsistencyChecker(@NonNull ConsistencyCheckerConfiguration configuration,
                                @NonNull ConsistencyCheckerProgressListener consistencyCheckerProgressListener)
focal_class.class_method_signature: ConsistencyChecker.setConsistencyCheckerProgressListener(ConsistencyCheckerProgressListener consistencyCheckerProgressListener)
focal_class.full_signature: public void setConsistencyCheckerProgressListener(ConsistencyCheckerProgressListener consistencyCheckerProgressListener)
focal_class.identifier: setConsistencyCheckerProgressListener
focal_class.modifiers: public
focal_class.parameters: (ConsistencyCheckerProgressListener consistencyCheckerProgressListener)
focal_class.return: void
focal_class.signature: void setConsistencyCheckerProgressListener(ConsistencyCheckerProgressListener consistencyCheckerProgressListener)
focal_class.class_method_signature: ConsistencyChecker.numberOfDefinitionsToCheck()
focal_class.full_signature: public int numberOfDefinitionsToCheck()
focal_class.identifier: numberOfDefinitionsToCheck
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int numberOfDefinitionsToCheck()
focal_class.class_method_signature: ConsistencyChecker.checkCorruption()
focal_class.full_signature: public void checkCorruption()
focal_class.identifier: checkCorruption
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void checkCorruption()
focal_class.class_method_signature: ConsistencyChecker.checkDocumentation(DefinitionsChildId id)
focal_class.full_signature: private void checkDocumentation(DefinitionsChildId id)
focal_class.identifier: checkDocumentation
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id)
focal_class.return: void
focal_class.signature: void checkDocumentation(DefinitionsChildId id)
focal_class.class_method_signature: ConsistencyChecker.checkFileExistenceAndSize(DefinitionsChildId id, String filename)
focal_class.full_signature: private void checkFileExistenceAndSize(DefinitionsChildId id, String filename)
focal_class.identifier: checkFileExistenceAndSize
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id, String filename)
focal_class.return: void
focal_class.signature: void checkFileExistenceAndSize(DefinitionsChildId id, String filename)
focal_class.class_method_signature: ConsistencyChecker.checkPlainConformance(DefinitionsChildId id, Path tempCsar)
focal_class.full_signature: private void checkPlainConformance(DefinitionsChildId id, Path tempCsar)
focal_class.identifier: checkPlainConformance
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id, Path tempCsar)
focal_class.return: void
focal_class.signature: void checkPlainConformance(DefinitionsChildId id, Path tempCsar)
focal_class.class_method_signature: ConsistencyChecker.checkServiceTemplate(ServiceTemplateId id)
focal_class.full_signature: private void checkServiceTemplate(ServiceTemplateId id)
focal_class.identifier: checkServiceTemplate
focal_class.modifiers: private
focal_class.parameters: (ServiceTemplateId id)
focal_class.return: void
focal_class.signature: void checkServiceTemplate(ServiceTemplateId id)
focal_class.class_method_signature: ConsistencyChecker.checkReferencedQNames(DefinitionsChildId id)
focal_class.full_signature: private void checkReferencedQNames(DefinitionsChildId id)
focal_class.identifier: checkReferencedQNames
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id)
focal_class.return: void
focal_class.signature: void checkReferencedQNames(DefinitionsChildId id)
focal_class.class_method_signature: ConsistencyChecker.checkXmlSchemaValidation(DefinitionsChildId id)
focal_class.full_signature: private void checkXmlSchemaValidation(DefinitionsChildId id)
focal_class.identifier: checkXmlSchemaValidation
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id)
focal_class.return: void
focal_class.signature: void checkXmlSchemaValidation(DefinitionsChildId id)
focal_class.class_method_signature: ConsistencyChecker.validate(RepositoryFileReference xmlSchemaFileReference, @Nullable Object any, DefinitionsChildId id)
focal_class.full_signature: private void validate(RepositoryFileReference xmlSchemaFileReference, @Nullable Object any, DefinitionsChildId id)
focal_class.identifier: validate
focal_class.modifiers: private
focal_class.parameters: (RepositoryFileReference xmlSchemaFileReference, @Nullable Object any, DefinitionsChildId id)
focal_class.return: void
focal_class.signature: void validate(RepositoryFileReference xmlSchemaFileReference, @Nullable Object any, DefinitionsChildId id)
focal_class.class_method_signature: ConsistencyChecker.checkPropertiesValidation(DefinitionsChildId id)
focal_class.full_signature: private void checkPropertiesValidation(DefinitionsChildId id)
focal_class.identifier: checkPropertiesValidation
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id)
focal_class.return: void
focal_class.signature: void checkPropertiesValidation(DefinitionsChildId id)
focal_class.class_method_signature: ConsistencyChecker.checkId(DefinitionsChildId id)
focal_class.full_signature: private void checkId(DefinitionsChildId id)
focal_class.identifier: checkId
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id)
focal_class.return: void
focal_class.signature: void checkId(DefinitionsChildId id)
focal_class.class_method_signature: ConsistencyChecker.checkNcname(DefinitionsChildId id, String ncname)
focal_class.full_signature: private void checkNcname(DefinitionsChildId id, String ncname)
focal_class.identifier: checkNcname
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id, String ncname)
focal_class.return: void
focal_class.signature: void checkNcname(DefinitionsChildId id, String ncname)
focal_class.class_method_signature: ConsistencyChecker.checkNamespaceUri(@NonNull DefinitionsChildId id)
focal_class.full_signature: public void checkNamespaceUri(@NonNull DefinitionsChildId id)
focal_class.identifier: checkNamespaceUri
focal_class.modifiers: public
focal_class.parameters: (@NonNull DefinitionsChildId id)
focal_class.return: void
focal_class.signature: void checkNamespaceUri(@NonNull DefinitionsChildId id)
focal_class.class_method_signature: ConsistencyChecker.checkCsar(DefinitionsChildId id, Path tempCsar)
focal_class.full_signature: private void checkCsar(DefinitionsChildId id, Path tempCsar)
focal_class.identifier: checkCsar
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id, Path tempCsar)
focal_class.return: void
focal_class.signature: void checkCsar(DefinitionsChildId id, Path tempCsar)
focal_class.class_method_signature: ConsistencyChecker.checkAllDefinitions()
focal_class.full_signature: private void checkAllDefinitions()
focal_class.identifier: checkAllDefinitions
focal_class.modifiers: private
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void checkAllDefinitions()
focal_class.class_method_signature: ConsistencyChecker.printAndAddError(DefinitionsChildId id, String error)
focal_class.full_signature: private void printAndAddError(DefinitionsChildId id, String error)
focal_class.identifier: printAndAddError
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id, String error)
focal_class.return: void
focal_class.signature: void printAndAddError(DefinitionsChildId id, String error)
focal_class.class_method_signature: ConsistencyChecker.printAndAddWarning(DefinitionsChildId id, String error)
focal_class.full_signature: private void printAndAddWarning(DefinitionsChildId id, String error)
focal_class.identifier: printAndAddWarning
focal_class.modifiers: private
focal_class.parameters: (DefinitionsChildId id, String error)
focal_class.return: void
focal_class.signature: void printAndAddWarning(DefinitionsChildId id, String error)
focal_class.class_method_signature: ConsistencyChecker.printError(String error)
focal_class.full_signature: private void printError(String error)
focal_class.identifier: printError
focal_class.modifiers: private
focal_class.parameters: (String error)
focal_class.return: void
focal_class.signature: void printError(String error)
focal_class.class_method_signature: ConsistencyChecker.getErrorCollector()
focal_class.full_signature: public ConsistencyErrorCollector getErrorCollector()
focal_class.identifier: getErrorCollector
focal_class.modifiers: public
focal_class.parameters: ()
focal_class.return: ConsistencyErrorCollector
focal_class.signature: ConsistencyErrorCollector getErrorCollector()
focal_method.body: public void checkNamespaceUri(@NonNull DefinitionsChildId id) {
          Objects.requireNonNull(id);
  
          String uriStr = id.getNamespace().getDecoded();
          if (!uriStr.trim().equals(uriStr)) {
              printAndAddError(id, "Namespace starts or ends with white spaces");
          }
          URI uri;
          try {
              uri = new URI(uriStr);
          } catch (URISyntaxException e) {
              LOGGER.debug("Invalid URI", e);
              printAndAddError(id, "Invalid URI: " + e.getMessage());
              return;
          }
          if (!uri.isAbsolute()) {
              printAndAddError(id, "URI is relative");
          }
          if ((uriStr.startsWith("http://www.opentosca.org/") && (!uriStr.toLowerCase().equals(uriStr)))) {
              // URI is not lowercase
              // There are some special URIs, which are OK
              String[] splitUri = uriStr.split("/");
              String lastElement = splitUri[splitUri.length - 1];
              String uriStrWithoutLastElement = uriStr.substring(0, (uriStr.length() - lastElement.length()));
              if (!(id.getXmlId().toString().startsWith(lastElement)) || (!uriStrWithoutLastElement.toLowerCase().equals(uriStrWithoutLastElement))) {
                  printAndAddError(id, "opentosca URI is not lowercase");
              }
          }
          if (uriStr.endsWith("/")) {
              printAndAddError(id, "URI ends with a slash");
          }
          if (uriStr.contains(ARTEFACT_BE)) {
              printAndAddError(id, "artifact is spelled with i in American English, not artefact as in British English");
          }
          // We could just check OpenTOSCA namespace rule examples. However, this would be too strict
          // Here, the idea is to check whether a string of another (!) id class appers in the namespace
          // If this is the case, the namespace is not consistent
          // For instance, a node type residing in the namespace: http://servicetemplates.example.org should not exist.
          boolean namespaceUriContainsDifferentType = DefinitionsChildId.ALL_TOSCA_COMPONENT_ID_CLASSES.stream()
              .filter(definitionsChildIdClass -> !definitionsChildIdClass.isAssignableFrom(id.getClass()))
              // we have the issue that nodetypeimplementation also contains nodetype
              // we do the quick hack and check for plural s and /
              .flatMap(definitionsChildIdClass -> {
                  final String lowerCaseIdClass = Util.getTypeForComponentId(definitionsChildIdClass).toLowerCase();
                  return Stream.of(lowerCaseIdClass + "s", lowerCaseIdClass + "/");
              })
              .anyMatch(definitionsChildName -> uriStr.contains(definitionsChildName));
          if (namespaceUriContainsDifferentType) {
              if ((id instanceof ServiceTemplateId) && (id.getNamespace().getDecoded().contains("compliance"))) {
                  // special case, becaue TComplianceRule models a service template, but Compliance Rules are treated as Service Template during modeling
                  // example: class org.eclipse.winery.common.ids.definitions.ServiceTemplateId / {http://www.compliance.opentosca.org/compliancerules}Satisfied_Compliance_Rule_Example_w1
              } else {
                  printAndAddError(id, "Namespace URI contains tosca definitions name from other type. E.g., Namespace is ...servicetemplates..., but the type is an artifact template");
              }
          }
      }
focal_method.class_method_signature: ConsistencyChecker.checkNamespaceUri(@NonNull DefinitionsChildId id)
focal_method.full_signature: public void checkNamespaceUri(@NonNull DefinitionsChildId id)
focal_method.identifier: checkNamespaceUri
focal_method.invocations: requireNonNull getDecoded getNamespace equals trim printAndAddError debug printAndAddError getMessage isAbsolute printAndAddError startsWith equals toLowerCase split substring length length startsWith toString getXmlId equals toLowerCase printAndAddError endsWith printAndAddError contains printAndAddError anyMatch flatMap filter stream isAssignableFrom getClass toLowerCase getTypeForComponentId of contains contains getDecoded getNamespace printAndAddError
focal_method.modifiers: public
focal_method.parameters: (@NonNull DefinitionsChildId id)
focal_method.return: void
focal_method.signature: void checkNamespaceUri(@NonNull DefinitionsChildId id)