Skip to content

Commit

Permalink
solution to fix integ tests
Browse files Browse the repository at this point in the history
Signed-off-by: Riya Saxena <[email protected]>
  • Loading branch information
riysaxen-amzn committed Mar 11, 2024
1 parent bcaa4e3 commit 3813217
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,6 @@ class RestGetFindingsAction : BaseRestHandler() {
val size = request.paramAsInt("size", 20)
val startIndex = request.paramAsInt("startIndex", 0)
val searchString = request.param("searchString", "")
val severity: String? = request.param("severity", "ALL")
val detectionType: String? = request.param("detectionType", "rules")

val table = Table(
sortOrder,
Expand All @@ -59,9 +57,7 @@ class RestGetFindingsAction : BaseRestHandler() {

val getFindingsSearchRequest = GetFindingsRequest(
findingID,
table,
severity,
detectionType
table
)
return RestChannelConsumer {
channel ->
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,8 +82,6 @@ class TransportGetFindingsSearchAction @Inject constructor(
val getFindingsRequest = request as? GetFindingsRequest
?: recreateObject(request) { GetFindingsRequest(it) }
val tableProp = getFindingsRequest.table
val severity = getFindingsRequest.severity
val detectionType = getFindingsRequest.detectionType
val searchString = tableProp.searchString

val sortBuilder = SortBuilders
Expand Down Expand Up @@ -125,7 +123,8 @@ class TransportGetFindingsSearchAction @Inject constructor(
queryBuilder.filter(timeRangeQuery)
}

if (!detectionType.isNullOrBlank()) {
if (!getFindingsRequest.detectionType.isNullOrBlank()) {
val detectionType = getFindingsRequest.detectionType
val nestedQueryBuilder = QueryBuilders.nestedQuery(
"queries",
when {
Expand Down Expand Up @@ -161,7 +160,8 @@ class TransportGetFindingsSearchAction @Inject constructor(
.minimumShouldMatch(1)
}

if (!severity.isNullOrBlank()) {
if (!getFindingsRequest.severity.isNullOrBlank()) {
val severity = getFindingsRequest.severity
queryBuilder
.must(
QueryBuilders.nestedQuery(
Expand Down

0 comments on commit 3813217

Please sign in to comment.