Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(tests): create the mock server in @BeforeEach #524

Merged
merged 1 commit into from
Jun 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@
import org.eclipse.edc.connector.transfer.spi.event.TransferProcessStarted;
import org.eclipse.tractusx.edc.helpers.ReceivedEvent;
import org.eclipse.tractusx.edc.lifecycle.Participant;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -57,11 +59,16 @@ public abstract class AbstractNegotiateEdrTest {
protected static final Participant SOKRATES = new Participant(SOKRATES_NAME, SOKRATES_BPN, sokratesConfiguration());
protected static final Participant PLATO = new Participant(PLATO_NAME, PLATO_BPN, platoConfiguration());

MockWebServer server = new MockWebServer();
MockWebServer server;

ObjectMapper mapper = new ObjectMapper();


@BeforeEach
void setup() {
server = new MockWebServer();
}

@Test
@DisplayName("Verify that the callbacks are invoked when negotiating an EDR")
void negotiateEdr_shouldInvokeCallbacks() throws IOException {
Expand Down Expand Up @@ -141,5 +148,9 @@ ReceivedEvent waitForEvent(ReceivedEvent event) {
}
}

@AfterEach
void teardown() throws IOException {
server.shutdown();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.eclipse.edc.spi.types.domain.edr.EndpointDataReference;
import org.eclipse.tractusx.edc.lifecycle.Participant;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

import java.io.IOException;
Expand Down Expand Up @@ -52,7 +53,12 @@ public abstract class AbstractHttpConsumerPullWithProxyTest {

private static final Duration ASYNC_TIMEOUT = ofSeconds(45);
private static final Duration ASYNC_POLL_INTERVAL = ofSeconds(1);
MockWebServer server = new MockWebServer();
MockWebServer server;

@BeforeEach
void setup() throws IOException {
server = new MockWebServer();
}

@Test
void transferData_privateBackend() throws IOException, InterruptedException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,14 @@ public class SsiHttpConsumerPullWithProxyInMemoryTest extends AbstractHttpConsum
PLATO_BPN,
platoSsiConfiguration()
);

private MockWebServer oauthServer;
private MockWebServer miwPlatoServer;
private MockWebServer miwSokratesServer;

@BeforeEach
void setup() throws IOException {
super.setup();
miwSokratesServer = new MockWebServer();
miwPlatoServer = new MockWebServer();
oauthServer = new MockWebServer();
Expand Down