Skip to content

Commit

Permalink
add api composition to response payload
Browse files Browse the repository at this point in the history
  • Loading branch information
jooaodanieel committed May 8, 2022
1 parent 591093c commit e3a7e86
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ data class PatternsInSystemPayload(
system,
patterns = PatternsPresent(
detections.databasePerServices,
detections.singleServicePerHosts
detections.singleServicePerHosts,
detections.apiCompostions
)
)
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
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

@Serializable
data class PatternsPresent(
val databasePerService: Set<DatabasePerService>,
val singleServicePerHost: Set<SingleServicePerHost>
val singleServicePerHost: Set<SingleServicePerHost>,
val apiCompositions: Set<APIComposition>
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,6 @@ package com.sortinghat.pattern_detector.domain.model.patterns

data class Detections(
val databasePerServices: Set<DatabasePerService>,
val singleServicePerHosts: Set<SingleServicePerHost>
val singleServicePerHosts: Set<SingleServicePerHost>,
val apiCompostions: Set<APIComposition>
)
Original file line number Diff line number Diff line change
Expand Up @@ -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 ->
Expand All @@ -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()
)
}

0 comments on commit e3a7e86

Please sign in to comment.