Skip to content

Commit

Permalink
Merged main branch on 2023-09-20
Browse files Browse the repository at this point in the history
  • Loading branch information
Update branch committed Sep 20, 2023
2 parents 2357e2d + 577267b commit de34d21
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,14 @@ public void iCheckIfQualityInvestigationHasProperValues(DataTable dataTable) {
.pollInterval(1, TimeUnit.SECONDS)
.ignoreExceptions()
.until(() -> {
QualityNotificationResponse result = restProvider.getNotification(getNotificationIdBasedOnEnv(), INVESTIGATION);
NotificationValidator.assertHasFields(result, normalize(dataTable.asMap()));
return true;
try {
QualityNotificationResponse result = restProvider.getNotification(getNotificationIdBasedOnEnv(), INVESTIGATION);
NotificationValidator.assertHasFields(result, normalize(dataTable.asMap()));
return true;
} catch (AssertionError assertionError) {
assertionError.printStackTrace();
return false;
}
}
);
}
Expand Down Expand Up @@ -215,7 +220,6 @@ private Long getNotificationIdBasedOnEnv() {
}



@And("I request assets with {string}")
public void iRequestAssetsWith(String ownerFilter) {
requestedAssets = restProvider.getAssets(ownerFilter);
Expand Down Expand Up @@ -308,9 +312,14 @@ public void iCheckIfQualityAlertHasProperValues(DataTable dataTable) {
.pollInterval(1, TimeUnit.SECONDS)
.ignoreExceptions()
.until(() -> {
QualityNotificationResponse result = restProvider.getNotification(getNotificationIdBasedOnEnv(), ALERT);
NotificationValidator.assertHasFields(result, normalize(dataTable.asMap()));
return true;
try {
QualityNotificationResponse result = restProvider.getNotification(getNotificationIdBasedOnEnv(), ALERT);
NotificationValidator.assertHasFields(result, normalize(dataTable.asMap()));
return true;
} catch (AssertionError assertionError) {
assertionError.printStackTrace();
return false;
}
}
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,28 +31,24 @@
import io.restassured.specification.RequestSpecification;
import lombok.Getter;
import org.apache.http.HttpStatus;
import org.awaitility.Duration;
import org.eclipse.tractusx.traceability.test.tooling.EnvVariablesResolver;
import org.eclipse.tractusx.traceability.test.tooling.NotificationTypeEnum;
import org.eclipse.tractusx.traceability.test.tooling.TraceXEnvironmentEnum;
import org.eclipse.tractusx.traceability.test.tooling.rest.request.StartQualityNotificationRequest;
import org.eclipse.tractusx.traceability.test.tooling.rest.request.UpdateQualityNotificationRequest;
import org.eclipse.tractusx.traceability.test.tooling.rest.request.UpdateQualityNotificationStatusRequest;
import org.eclipse.tractusx.traceability.test.tooling.rest.response.QualityNotificationResponse;
import org.hamcrest.Matchers;
import qualitynotification.base.response.QualityNotificationIdResponse;

import java.time.Instant;
import java.util.List;
import java.util.concurrent.TimeUnit;

import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_IGNORED_PROPERTIES;
import static com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES;
import static com.fasterxml.jackson.databind.DeserializationFeature.READ_ENUMS_USING_TO_STRING;
import static com.fasterxml.jackson.databind.DeserializationFeature.READ_UNKNOWN_ENUM_VALUES_USING_DEFAULT_VALUE;
import static com.fasterxml.jackson.databind.SerializationFeature.WRITE_DATES_AS_TIMESTAMPS;
import static io.restassured.RestAssured.given;
import static org.awaitility.Awaitility.await;
import static org.eclipse.tractusx.traceability.test.tooling.TraceXEnvironmentEnum.TRACE_X_A;
import static org.eclipse.tractusx.traceability.test.tooling.TraceXEnvironmentEnum.TRACE_X_B;

Expand Down Expand Up @@ -189,23 +185,18 @@ public List<QualityNotificationResponse> getReceivedNotifications(NotificationTy
}

public QualityNotificationResponse getNotification(Long investigationId, NotificationTypeEnum notificationType) {
return await()
.atMost(Duration.TWO_MINUTES)
.pollInterval(1, TimeUnit.SECONDS)
.until(() -> given().spec(getRequestSpecification())
.contentType(ContentType.JSON)
.when()
.get("/api/" + notificationType.label + "/" + investigationId)
.then()
.statusCode(HttpStatus.SC_OK)
.log()
.body()
.extract()
.body().as(QualityNotificationResponse.class), Matchers.notNullValue()
);
return given().spec(getRequestSpecification())
.contentType(ContentType.JSON)
.when()
.get("/api/" + notificationType.label + "/" + investigationId)
.then()
.statusCode(HttpStatus.SC_OK)
.log()
.body()
.extract()
.body().as(QualityNotificationResponse.class);
}


private RequestSpecification getRequestSpecification() {
final String accessToken = authentication.obtainAccessToken();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@ Feature: ⭐ [BE][QUALITY_ALERTS] Create (POST) quality alerts (Rest API)
Then I check, if quality alert has proper values
| "status" | "DECLINED" |
And I check, if quality alert has proper values
| "description" | "declined in TRACEFOSS-1545" |
| "declineReason" | "declined in TRACEFOSS-1545" |

#Check if *ACCEPTANCE* of quality alerts is processed correctly which contains following checks:
#* correct ACCEPTANCE on receiver side
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ Feature: ⭐ [BE][QUALITY_ALERTS] Enable Quality Alerts
Then I check, if quality alert has proper values
| "status" | "DECLINED" |
And I check, if quality alert has proper values
| "description" | "declined in TRACEFOSS-1545" |
| "declineReason" | "declined in TRACEFOSS-1545" |

#Check if *ACCEPTANCE* of quality alerts is processed correctly which contains following checks:
#* correct ACCEPTANCE on receiver side
Expand Down

0 comments on commit de34d21

Please sign in to comment.