Skip to content

Commit

Permalink
refactor: removing HttpRequestLoggerUtil.java
Browse files Browse the repository at this point in the history
  • Loading branch information
hamidonos committed Nov 6, 2023
1 parent 030c5ab commit 8225f89
Show file tree
Hide file tree
Showing 5 changed files with 35 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
import static org.eclipse.edc.samples.common.PrerequisitesCommon.getConsumer;
import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider;
import static org.eclipse.edc.samples.common.PrerequisitesCommon.runPrerequisites;
import static org.eclipse.edc.samples.util.HttpRequestLoggerUtil.getHttpRequestLoggerContainer;
import static org.eclipse.edc.samples.util.TransferUtil.checkTransferStatus;
import static org.eclipse.edc.samples.util.TransferUtil.startTransfer;
import static org.hamcrest.Matchers.emptyString;
Expand All @@ -59,7 +58,7 @@ public class Transfer02consumerPullTest {
static EdcRuntimeExtension consumer = getConsumer();

@Container
public static HttpRequestLoggerContainer httpRequestLoggerContainer = getHttpRequestLoggerContainer(LOG_CONSUMER);
public static HttpRequestLoggerContainer httpRequestLoggerContainer = new HttpRequestLoggerContainer(LOG_CONSUMER);

@BeforeAll
static void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
import static org.eclipse.edc.samples.common.PrerequisitesCommon.getConsumer;
import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider;
import static org.eclipse.edc.samples.common.PrerequisitesCommon.runPrerequisites;
import static org.eclipse.edc.samples.util.HttpRequestLoggerUtil.getHttpRequestLoggerContainer;
import static org.eclipse.edc.samples.util.TransferUtil.checkTransferStatus;
import static org.eclipse.edc.samples.util.TransferUtil.startTransfer;

Expand All @@ -50,7 +49,7 @@ public class Transfer03providerPushTest {
static EdcRuntimeExtension consumer = getConsumer();

@Container
public static HttpRequestLoggerContainer httpRequestLoggerContainer = getHttpRequestLoggerContainer(LOG_CONSUMER);
public static HttpRequestLoggerContainer httpRequestLoggerContainer = new HttpRequestLoggerContainer(LOG_CONSUMER);

@BeforeAll
static void setUp() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,6 @@
import static org.eclipse.edc.samples.common.PrerequisitesCommon.getConsumer;
import static org.eclipse.edc.samples.common.PrerequisitesCommon.getProvider;
import static org.eclipse.edc.samples.common.PrerequisitesCommon.runPrerequisites;
import static org.eclipse.edc.samples.util.HttpRequestLoggerUtil.getHttpRequestLoggerContainer;
import static org.eclipse.edc.samples.util.TransferUtil.checkTransferStatus;
import static org.eclipse.edc.samples.util.TransferUtil.startTransfer;

Expand All @@ -49,7 +48,7 @@ public class Transfer04eventConsumerTest {
static EdcRuntimeExtension consumer = getConsumer(CONSUMER_WITH_LISTENER_MODULE_PATH);

@Container
static HttpRequestLoggerContainer httpRequestLoggerContainer = getHttpRequestLoggerContainer();
static HttpRequestLoggerContainer httpRequestLoggerContainer = new HttpRequestLoggerContainer();

@BeforeAll
static void setUp() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,41 @@
/*
* Copyright (c) 2022 Microsoft Corporation
*
* This program and the accompanying materials are made available under the
* terms of the Apache License, Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-License-Identifier: Apache-2.0
*
* Contributors:
* Mercedes-Benz Tech Innovation GmbH - initial implementation
*
*/

package org.eclipse.edc.samples.util;

import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.output.ToStringConsumer;
import org.testcontainers.images.builder.ImageFromDockerfile;

import java.util.List;

import static org.eclipse.edc.samples.common.FileTransferCommon.getFileFromRelativePath;

public class HttpRequestLoggerContainer extends GenericContainer<HttpRequestLoggerContainer> {

public HttpRequestLoggerContainer(ImageFromDockerfile dockerImage) {
super(dockerImage);
private static final String HTTP_REQUEST_LOGGER_DOCKERFILE_PATH = "util/http-request-logger/Dockerfile";
private static final ImageFromDockerfile IMAGE_FROM_DOCKERFILE = new ImageFromDockerfile()
.withDockerfile(getFileFromRelativePath(HTTP_REQUEST_LOGGER_DOCKERFILE_PATH).toPath());
private static final String PORT_BINDING = "4000:4000";

public HttpRequestLoggerContainer() {
super(IMAGE_FROM_DOCKERFILE);
this.setPortBindings(List.of(PORT_BINDING));
}

public HttpRequestLoggerContainer(ToStringConsumer toStringConsumer) {
this();
this.setLogConsumers(List.of(toStringConsumer));
}
}

This file was deleted.

0 comments on commit 8225f89

Please sign in to comment.