java.lang.Object
edu.university.ecs.lab.detection.architecture.models.AbstractAR
edu.university.ecs.lab.detection.architecture.models.AR21
All Implemented Interfaces:
JsonSerializable

public class AR21 extends AbstractAR
Architectural Rule 21 Class: Wrongcuts Service
  • Field Details

  • Constructor Details

    • AR21

      public AR21()
  • Method Details

    • getName

      public String getName()
      Description copied from class: AbstractAR
      Get the name of the Architectural Rule
      Specified by:
      getName in class AbstractAR
      Returns:
      string name of the Architectural Rule
    • getDescription

      public String getDescription()
      Description copied from class: AbstractAR
      Get the description of the Architectural Rule
      Specified by:
      getDescription in class AbstractAR
      Returns:
      string description of the Architectural Rule
    • getWeight

      public double getWeight()
      Description copied from class: AbstractAR
      Get the weight of the Architectural Rule
      Specified by:
      getWeight in class AbstractAR
      Returns:
      double weight of the Architectural Rule
    • getType

      public String getType()
      Description copied from class: AbstractAR
      Get the new commitID
      Specified by:
      getType in class AbstractAR
      Returns:
      string new commitID
    • getMetaData

      public com.google.gson.JsonObject getMetaData()
      Description copied from class: AbstractAR
      Get the meta data of the Architectural Rule
      Specified by:
      getMetaData in class AbstractAR
      Returns:
      JSON object meta data of the Architectural Rule
    • scan

      public static List<AR21> scan(MicroserviceSystem oldSystem, MicroserviceSystem newSystem)
      Scan and compare old microservice system and new microservice system to identify wrongly interconnected services
      Parameters:
      oldSystem - old commit of microservice system
      newSystem - new commit of microservice system
      Returns:
      list of wrongly interconnected service clusters
    • detectWrongCuts

      public static List<Set<String>> detectWrongCuts(ServiceDependencyGraph graph)
      Detects all clusters of wrongly interconnected services in the given network graph.
      Parameters:
      graph - The network graph representing microservices and their dependencies.
      Returns:
      A list of sets, each containing services that are wrongly interconnected (forming a cluster).
    • dfs

      private static void dfs(Microservice currentNode, Map<Microservice,Set<Microservice>> adjacencyList, Set<Microservice> visited, Set<String> cluster)
      Performs Depth-First Search (DFS) to traverse and collect all nodes in the current cluster of wrong cuts.
      Parameters:
      currentNode - The current node being visited.
      adjacencyList - The adjacency list representing the network graph.
      visited - Set of visited nodes to avoid revisiting.
      cluster - Set to collect all nodes belonging to the current cluster of wrong cuts.