-
Notifications
You must be signed in to change notification settings - Fork 226
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(e2e): dataplane selector control api
- Loading branch information
Showing
1 changed file
with
74 additions
and
0 deletions.
There are no files selected for viewing
74 changes: 74 additions & 0 deletions
74
...tests/src/test/java/org/eclipse/edc/test/e2e/DataplaneSelectorControlApiEndToEndTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
package org.eclipse.edc.test.e2e; | ||
|
||
import io.restassured.http.ContentType; | ||
import jakarta.json.JsonArray; | ||
import org.eclipse.edc.junit.annotations.EndToEndTest; | ||
import org.eclipse.edc.junit.extensions.EmbeddedRuntime; | ||
import org.eclipse.edc.junit.extensions.RuntimeExtension; | ||
import org.eclipse.edc.junit.extensions.RuntimePerMethodExtension; | ||
import org.eclipse.edc.spi.protocol.ProtocolWebhook; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import java.util.Map; | ||
|
||
import static io.restassured.RestAssured.given; | ||
import static org.assertj.core.api.Assertions.assertThat; | ||
import static org.eclipse.edc.util.io.Ports.getFreePort; | ||
import static org.mockito.Mockito.mock; | ||
|
||
@EndToEndTest | ||
public class DataplaneSelectorControlApiEndToEndTest { | ||
|
||
private final int controlPlaneControlPort = getFreePort(); | ||
|
||
@RegisterExtension | ||
private final RuntimeExtension controlPlane = new RuntimePerMethodExtension(new EmbeddedRuntime( | ||
"control-plane", | ||
Map.of( | ||
"web.http.control.port", String.valueOf(controlPlaneControlPort), | ||
"web.http.control.path", "/control" | ||
), | ||
":core:control-plane:control-plane-core", | ||
":core:data-plane-selector:data-plane-selector-core", | ||
":extensions:control-plane:transfer:transfer-data-plane-signaling", | ||
":extensions:common:iam:iam-mock", | ||
":extensions:common:http", | ||
":extensions:common:api:control-api-configuration", | ||
":extensions:data-plane-selector:data-plane-selector-control-api" | ||
)).registerServiceMock(ProtocolWebhook.class, mock()); | ||
|
||
@RegisterExtension | ||
private final RuntimeExtension dataPlane = new RuntimePerMethodExtension(new EmbeddedRuntime( | ||
"data-plane", | ||
Map.of( | ||
"web.http.port", String.valueOf(getFreePort()), | ||
"web.http.path", "/api", | ||
"web.http.control.port", String.valueOf(getFreePort()), | ||
"web.http.control.path", "/control", | ||
"edc.dpf.selector.url", String.format("http://localhost:%d/control/v1/dataplanes", controlPlaneControlPort) | ||
), | ||
":core:data-plane:data-plane-core", | ||
":extensions:data-plane:data-plane-http", | ||
":extensions:data-plane:data-plane-signaling:data-plane-signaling-api", | ||
":extensions:common:api:control-api-configuration", | ||
":extensions:control-plane:api:control-plane-api-client", | ||
":extensions:data-plane:data-plane-self-registration", | ||
":extensions:data-plane-selector:data-plane-selector-client", | ||
":extensions:common:http" | ||
)); | ||
|
||
@Test | ||
void shouldReturnSelfRegisteredDataplane() { | ||
var result = given() | ||
.baseUri("http://localhost:" + controlPlaneControlPort + "/control") | ||
.when() | ||
.get("/v1/dataplanes") | ||
.then() | ||
.statusCode(200) | ||
.contentType(ContentType.JSON) | ||
.extract().body().as(JsonArray.class); | ||
|
||
assertThat(result).hasSize(1); | ||
} | ||
} |