Skip to content
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
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
<parent>
<groupId>org.eclipse.daanse</groupId>
<artifactId>org.eclipse.daanse.pom.parent</artifactId>
<version>0.0.3</version>
<version>0.0.4</version>
</parent>

<artifactId>org.eclipse.daanse.tooling</artifactId>
Expand All @@ -33,6 +33,6 @@
<description></description>

<modules>
<!-- <module>testcontainers</module>-->
<module>testcontainers</module>
</modules>
</project>
52 changes: 52 additions & 0 deletions testcontainers/core/bnd.bnd
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
#*******************************************************************************
# Copyright (c) 2004 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# SmartCity Jena - initial
# Stefan Bischof (bipolis.org) - initial
#*******************************************************************************

-metainf-services: auto

Export-Package: \
!org.testcontainers.shaded*,\
com.github.dockerjava.api*,\
org.testcontainers*

-includeresource: \
@testcontainers-1.21.3.jar,\
@duct-tape-1.0.8.jar,\
@docker-java-api-3.4.2.jar,\
@docker-java-transport-3.4.2.jar,\
@docker-java-transport-zerodep-3.4.2.jar

DynamicImport-Package: *

-privatepackage: \
org.rnorth.ducttape*,\
com.fasterxml.jackson.annotation*,\
org.junit.rules*,\
org.junit.runners*,\
org.hamcrest*,\
org.apache.commons.compress,\
com.github.dockerjava.zerodep*

Import-Package: \
!android.os.*,\
!com.github.dockerjava*,\
!com.google.appengine.*,\
!com.google.apphosting.*,\
!com.google.cloud.*,\
!io.r2dbc.*,\
!javax.annotation.*, \
!org.conscrypt, \
!org.testcontainers.r2dbc.*, \
!org.junit*,\
!sun.nio.ch*,\
*
33 changes: 33 additions & 0 deletions testcontainers/core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
<?xml version="1.0"?>
<!--
/*********************************************************************
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.daanse</groupId>
<artifactId>org.eclipse.daanse.tooling.testcontainers</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.daanse.tooling.testcontainers.core</artifactId>


<dependencies>
<dependency>
<groupId>org.testcontainers</groupId>
<artifactId>testcontainers</artifactId>
<version>1.21.3</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*
* Contributors:
* SmartCity Jena - initial
* Stefan Bischof (bipolis.org) - initial
*/
package org.eclipse.daanse.tooling.testcontainers.core;

import static org.junit.jupiter.api.Assertions.assertTrue;

import java.net.URI;
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;

import org.junit.jupiter.api.Disabled;
import org.testcontainers.DockerClientFactory;
import org.testcontainers.containers.GenericContainer;

public class NginxRundAndConnectTest {

@Disabled
@org.junit.jupiter.api.Test
void startandConnectPortNginX() throws Exception {

DockerClientFactory.lazyClient().pingCmd();

try (GenericContainer<?> nginx = new GenericContainer("nginx:alpine-slim").withExposedPorts(80)

) {
// Starte den Container
nginx.start();

// get external port mapped
Integer mappedPort = nginx.getMappedPort(80);
String url = "http://localhost:" + mappedPort;
System.out.println("Container Port: " + mappedPort);

// Create a HTTP-Client
HttpClient client = HttpClient.newHttpClient();

// BuildHTTP GET-Request
HttpRequest request = HttpRequest.newBuilder().uri(URI.create(url)).build();

// Send Request
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());

// Check Statuscode is 200 OK
assertTrue(response.statusCode() == 200, "Expected 200 OK, but got: " + response.statusCode());

// Answer
System.out.println("Response body: " + response.body());

nginx.stop();

System.out.println(1113);
} finally {
}
}
}
56 changes: 56 additions & 0 deletions testcontainers/core/test.bndrun
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
#*******************************************************************************
# Copyright (c) 2004 Contributors to the Eclipse Foundation
#
# This program and the accompanying materials are made
# available under the terms of the Eclipse Public License 2.0
# which is available at https://www.eclipse.org/legal/epl-2.0/
#
# SPDX-License-Identifier: EPL-2.0
#
# Contributors:
# SmartCity Jena - initial
# Stefan Bischof (bipolis.org) - initial
#*******************************************************************************

-runpath: \
ch.qos.logback.classic,\
ch.qos.logback.core,\
slf4j.api

-runstartlevel: \
order=sortbynameversion,\
begin=-1

-runtrace: true

-tester: biz.aQute.tester.junit-platform

-runsystemcapabilities: ${native_capability}

-runproperties: \
org.slf4j.simpleLogger.defaultLogLevel=debug

-runfw: org.apache.felix.framework

-runee: JavaSE-21

-runrequires: \
bnd.identity;id='${project.artifactId}-tests',\
bnd.identity;id=junit-jupiter-engine,\
bnd.identity;id=junit-platform-launcher,\
bnd.identity;id='org.apache.aries.spifly.dynamic.framework.extension'

# -runbundles is calculated by the bnd-resolver-maven-plugin

-runbundles: \
com.sun.jna;version='[5.13.0,5.13.1)',\
junit-jupiter-api;version='[5.10.2,5.10.3)',\
junit-jupiter-engine;version='[5.10.2,5.10.3)',\
junit-platform-commons;version='[1.10.2,1.10.3)',\
junit-platform-engine;version='[1.10.2,1.10.3)',\
junit-platform-launcher;version='[1.10.2,1.10.3)',\
org.apache.aries.spifly.dynamic.framework.extension;version='[1.3.7,1.3.8)',\
org.apache.commons.commons-compress;version='[1.24.0,1.24.1)',\
org.eclipse.daanse.tooling.testcontainers.core;version='[0.0.1,0.0.2)',\
org.eclipse.daanse.tooling.testcontainers.core-tests;version='[0.0.1,0.0.2)',\
org.opentest4j;version='[1.3.0,1.3.1)'
27 changes: 27 additions & 0 deletions testcontainers/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0"?>
<!--
/*********************************************************************
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
**********************************************************************/
-->
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.eclipse.daanse</groupId>
<artifactId>org.eclipse.daanse.tooling</artifactId>
<version>0.0.1-SNAPSHOT</version>
</parent>
<artifactId>org.eclipse.daanse.tooling.testcontainers</artifactId>
<packaging>pom</packaging>
<modules>
<module>core</module>
</modules>
</project>
Loading