From e3a7e86adde2e5cad821cc194cc3b2f01efe37d0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jo=C3=A3o=20Daniel?= Date: Sun, 8 May 2022 06:28:52 -0300 Subject: [PATCH] add api composition to response payload --- .../pattern_detector/api/PatternsInSystemPayload.kt | 3 ++- .../com/sortinghat/pattern_detector/api/PatternsPresent.kt | 4 +++- .../pattern_detector/domain/model/patterns/Detections.kt | 3 ++- .../pattern_detector/domain/services/detectionWorkflow.kt | 6 ++++-- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/src/main/kotlin/com/sortinghat/pattern_detector/api/PatternsInSystemPayload.kt b/src/main/kotlin/com/sortinghat/pattern_detector/api/PatternsInSystemPayload.kt index 4997609..adee2e3 100644 --- a/src/main/kotlin/com/sortinghat/pattern_detector/api/PatternsInSystemPayload.kt +++ b/src/main/kotlin/com/sortinghat/pattern_detector/api/PatternsInSystemPayload.kt @@ -14,7 +14,8 @@ data class PatternsInSystemPayload( system, patterns = PatternsPresent( detections.databasePerServices, - detections.singleServicePerHosts + detections.singleServicePerHosts, + detections.apiCompostions ) ) } diff --git a/src/main/kotlin/com/sortinghat/pattern_detector/api/PatternsPresent.kt b/src/main/kotlin/com/sortinghat/pattern_detector/api/PatternsPresent.kt index fa395ea..cfb1972 100644 --- a/src/main/kotlin/com/sortinghat/pattern_detector/api/PatternsPresent.kt +++ b/src/main/kotlin/com/sortinghat/pattern_detector/api/PatternsPresent.kt @@ -1,5 +1,6 @@ package com.sortinghat.pattern_detector.api +import com.sortinghat.pattern_detector.domain.model.patterns.APIComposition import com.sortinghat.pattern_detector.domain.model.patterns.DatabasePerService import com.sortinghat.pattern_detector.domain.model.patterns.SingleServicePerHost import kotlinx.serialization.Serializable @@ -7,5 +8,6 @@ import kotlinx.serialization.Serializable @Serializable data class PatternsPresent( val databasePerService: Set, - val singleServicePerHost: Set + val singleServicePerHost: Set, + val apiCompositions: Set ) diff --git a/src/main/kotlin/com/sortinghat/pattern_detector/domain/model/patterns/Detections.kt b/src/main/kotlin/com/sortinghat/pattern_detector/domain/model/patterns/Detections.kt index fa8ceae..eaaf50b 100644 --- a/src/main/kotlin/com/sortinghat/pattern_detector/domain/model/patterns/Detections.kt +++ b/src/main/kotlin/com/sortinghat/pattern_detector/domain/model/patterns/Detections.kt @@ -2,5 +2,6 @@ package com.sortinghat.pattern_detector.domain.model.patterns data class Detections( val databasePerServices: Set, - val singleServicePerHosts: Set + val singleServicePerHosts: Set, + val apiCompostions: Set ) diff --git a/src/main/kotlin/com/sortinghat/pattern_detector/domain/services/detectionWorkflow.kt b/src/main/kotlin/com/sortinghat/pattern_detector/domain/services/detectionWorkflow.kt index 0220a23..2aef152 100644 --- a/src/main/kotlin/com/sortinghat/pattern_detector/domain/services/detectionWorkflow.kt +++ b/src/main/kotlin/com/sortinghat/pattern_detector/domain/services/detectionWorkflow.kt @@ -10,7 +10,8 @@ fun detectionWorkflow(systemSlug: String, serviceRepository: ServiceRepository): val visitors = mapOf( "metrics" to MetricCollector(), "dbps" to DatabasePerServiceDetector(), - "ssph" to SingleServicePerHostDetector() + "ssph" to SingleServicePerHostDetector(), + "apic" to APICompositionDetector() ) visitors.values.forEach { visitor -> @@ -19,6 +20,7 @@ fun detectionWorkflow(systemSlug: String, serviceRepository: ServiceRepository): return Detections( databasePerServices = (visitors["dbps"] as DatabasePerServiceDetector).getResults(), - singleServicePerHosts = (visitors["ssph"] as SingleServicePerHostDetector).getResults() + singleServicePerHosts = (visitors["ssph"] as SingleServicePerHostDetector).getResults(), + apiCompostions = (visitors["apic"] as APICompositionDetector).getResults() ) } \ No newline at end of file