|
| 1 | +/* |
| 2 | + * Copyright (c) 2024 Bayerische Motoren Werke Aktiengesellschaft (BMW AG) |
| 3 | + * |
| 4 | + * This program and the accompanying materials are made available under the |
| 5 | + * terms of the Apache License, Version 2.0 which is available at |
| 6 | + * https://www.apache.org/licenses/LICENSE-2.0 |
| 7 | + * |
| 8 | + * SPDX-License-Identifier: Apache-2.0 |
| 9 | + * |
| 10 | + * Contributors: |
| 11 | + * Bayerische Motoren Werke Aktiengesellschaft (BMW AG) - initial API and implementation |
| 12 | + * |
| 13 | + */ |
| 14 | + |
| 15 | +package org.eclipse.edc.test.bom; |
| 16 | + |
| 17 | + |
| 18 | +import org.eclipse.edc.junit.annotations.EndToEndTest; |
| 19 | +import org.eclipse.edc.junit.extensions.EmbeddedRuntime; |
| 20 | +import org.eclipse.edc.junit.extensions.RuntimeExtension; |
| 21 | +import org.eclipse.edc.junit.extensions.RuntimePerMethodExtension; |
| 22 | +import org.junit.jupiter.api.Nested; |
| 23 | +import org.junit.jupiter.api.Test; |
| 24 | +import org.junit.jupiter.api.extension.RegisterExtension; |
| 25 | + |
| 26 | +import java.util.Map; |
| 27 | + |
| 28 | +import static io.restassured.RestAssured.given; |
| 29 | +import static org.awaitility.Awaitility.await; |
| 30 | +import static org.hamcrest.Matchers.equalTo; |
| 31 | + |
| 32 | + |
| 33 | +public class BomSmokeTests { |
| 34 | + abstract static class SmokeTest { |
| 35 | + public static final String DEFAULT_PORT = "8080"; |
| 36 | + public static final String DEFAULT_PATH = "/api"; |
| 37 | + |
| 38 | + @Test |
| 39 | + void assertRuntimeReady() { |
| 40 | + await().untilAsserted(() -> given() |
| 41 | + .baseUri("http://localhost:" + DEFAULT_PORT + DEFAULT_PATH + "/check/startup") |
| 42 | + .get() |
| 43 | + .then() |
| 44 | + .statusCode(200) |
| 45 | + .log().ifValidationFails() |
| 46 | + .body("isSystemHealthy", equalTo(true))); |
| 47 | + |
| 48 | + } |
| 49 | + } |
| 50 | + |
| 51 | + @Nested |
| 52 | + @EndToEndTest |
| 53 | + class FederatedCatalogDcp extends SmokeTest { |
| 54 | + |
| 55 | + @RegisterExtension |
| 56 | + protected RuntimeExtension runtime = |
| 57 | + new RuntimePerMethodExtension(new EmbeddedRuntime("fc-dcp-bom", |
| 58 | + Map.of( |
| 59 | + "edc.iam.sts.oauth.token.url", "https://sts.com/token", |
| 60 | + "edc.iam.sts.oauth.client.id", "test-clientid", |
| 61 | + "edc.iam.sts.oauth.client.secret.alias", "test-alias", |
| 62 | + "web.http.port", "8080", |
| 63 | + "web.http.path", "/api", |
| 64 | + "web.http.catalog.port", "8081", |
| 65 | + "web.http.catalog.path", "/api/catalog", |
| 66 | + "edc.catalog.cache.execution.period.seconds", "5", |
| 67 | + "edc.catalog.cache.execution.delay.seconds", "0"), |
| 68 | + ":dist:bom:federatedcatalog-dcp-bom" |
| 69 | + )); |
| 70 | + } |
| 71 | + |
| 72 | +} |
0 commit comments