Skip to content

Commit fe2a79f

Browse files
committed
extract dockerjava in extra module and use in testcontainer
Signed-off-by: Stefan Bischof <[email protected]>
1 parent 0fc4ea4 commit fe2a79f

File tree

10 files changed

+256
-10
lines changed

10 files changed

+256
-10
lines changed

.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,3 +37,6 @@ insert_final_newline = unset
3737
trim_trailing_whitespace = unset
3838
indent_style = unset
3939
indent_size = unset
40+
41+
[.flattened-pom.xml]
42+
insert_final_newline = false

dockerjava/bnd.bnd

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
#*******************************************************************************
2+
# Copyright (c) 2004 Contributors to the Eclipse Foundation
3+
#
4+
# This program and the accompanying materials are made
5+
# available under the terms of the Eclipse Public License 2.0
6+
# which is available at https://www.eclipse.org/legal/epl-2.0/
7+
#
8+
# SPDX-License-Identifier: EPL-2.0
9+
#
10+
# Contributors:
11+
# SmartCity Jena - initial
12+
# Stefan Bischof (bipolis.org) - initial
13+
#*******************************************************************************
14+
15+
Export-Package: \
16+
com.github.dockerjava.api*,\
17+
com.github.dockerjava.core*,\
18+
com.github.dockerjava.transport*,\
19+
com.github.dockerjava.zerodep*,\
20+
com.github.dockerjava.httpclient5
21+
22+
-includeresource: \
23+
@docker-java-api-3.5.3.jar, \
24+
@docker-java-transport-zerodep-3.5.3.jar, \
25+
@docker-java-transport-3.5.3.jar
26+
27+
28+
-privatepackage: \
29+
com.fasterxml.jackson.databind*,\
30+
com.fasterxml.jackson.core*,\
31+
com.fasterxml.jackson.annotation*,\
32+
org.apache.commons.io*,\
33+
org.apache.commons.lang3*,\
34+
com.google.common.collect*,\
35+
com.google.common*
36+
37+
Import-Package: \
38+
org.slf4j*,\
39+
com.sun*,\
40+
javax.net*

dockerjava/pom.xml

Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/*********************************************************************
4+
* Copyright (c) 2025 Contributors to the Eclipse Foundation.
5+
*
6+
* This program and the accompanying materials are made
7+
* available under the terms of the Eclipse Public License 2.0
8+
* which is available at https://www.eclipse.org/legal/epl-2.0/
9+
*
10+
* SPDX-License-Identifier: EPL-2.0
11+
**********************************************************************/
12+
-->
13+
<project xmlns="http://maven.apache.org/POM/4.0.0"
14+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
15+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
16+
<modelVersion>4.0.0</modelVersion>
17+
<parent>
18+
<groupId>org.eclipse.daanse</groupId>
19+
<artifactId>org.eclipse.daanse.tooling</artifactId>
20+
<version>0.0.1-SNAPSHOT</version>
21+
</parent>
22+
<artifactId>org.eclipse.daanse.tooling.dockerjava</artifactId>
23+
<version>0.0.1-SNAPSHOT</version>
24+
25+
<name>Eclipse Daanse Docker Java</name>
26+
<description>Repackaged version of docker-java as a connector to Docker for
27+
Eclipse Daanse</description>
28+
29+
<properties>
30+
<docker-java.version>3.5.3</docker-java.version>
31+
</properties>
32+
33+
<dependencies>
34+
<dependency>
35+
<groupId>net.java.dev.jna</groupId>
36+
<artifactId>jna</artifactId>
37+
<version>5.11.0</version>
38+
<scope>runtime</scope>
39+
</dependency>
40+
41+
<dependency>
42+
<groupId>com.github.docker-java</groupId>
43+
<artifactId>docker-java</artifactId>
44+
<version>${docker-java.version}</version>
45+
<exclusions>
46+
<exclusion>
47+
<groupId>*</groupId>
48+
<artifactId>*</artifactId>
49+
</exclusion>
50+
</exclusions>
51+
</dependency>
52+
<dependency>
53+
<groupId>com.github.docker-java</groupId>
54+
<artifactId>docker-java-core</artifactId>
55+
<version>${docker-java.version}</version>
56+
<!-- <exclusions>
57+
<exclusion>
58+
<groupId>*</groupId>
59+
<artifactId>*</artifactId>
60+
</exclusion>
61+
</exclusions>-->
62+
</dependency>
63+
<dependency>
64+
<groupId>com.github.docker-java</groupId>
65+
<artifactId>docker-java-api</artifactId>
66+
<version>${docker-java.version}</version>
67+
<exclusions>
68+
<exclusion>
69+
<groupId>*</groupId>
70+
<artifactId>*</artifactId>
71+
</exclusion>
72+
</exclusions>
73+
</dependency>
74+
<dependency>
75+
<groupId>com.github.docker-java</groupId>
76+
<artifactId>docker-java-transport</artifactId>
77+
<version>${docker-java.version}</version>
78+
</dependency>
79+
<dependency>
80+
<groupId>com.github.docker-java</groupId>
81+
<artifactId>docker-java-transport-zerodep</artifactId>
82+
<version>${docker-java.version}</version>
83+
<exclusions>
84+
<exclusion>
85+
<groupId>*</groupId>
86+
<artifactId>*</artifactId>
87+
</exclusion>
88+
</exclusions>
89+
</dependency>
90+
</dependencies>
91+
92+
</project>
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/*
2+
* Copyright (c) 2024 Contributors to the Eclipse Foundation.
3+
*
4+
* This program and the accompanying materials are made
5+
* available under the terms of the Eclipse Public License 2.0
6+
* which is available at https://www.eclipse.org/legal/epl-2.0/
7+
*
8+
* SPDX-License-Identifier: EPL-2.0
9+
*
10+
* Contributors:
11+
* SmartCity Jena - initial
12+
* Stefan Bischof (bipolis.org) - initial
13+
*/
14+
package org.eclipse.daanse.tooling.dockerjava;
15+
16+
import java.time.Duration;
17+
18+
import com.github.dockerjava.api.DockerClient;
19+
import com.github.dockerjava.api.model.Info;
20+
import com.github.dockerjava.core.DefaultDockerClientConfig;
21+
import com.github.dockerjava.core.DockerClientConfig;
22+
import com.github.dockerjava.core.DockerClientImpl;
23+
import com.github.dockerjava.transport.DockerHttpClient;
24+
import com.github.dockerjava.zerodep.ZerodepDockerHttpClient;
25+
26+
public class Test {
27+
28+
@org.junit.jupiter.api.Test
29+
void testName() throws Exception {
30+
31+
DockerClientConfig config = DefaultDockerClientConfig.createDefaultConfigBuilder().build();
32+
DockerHttpClient client = new ZerodepDockerHttpClient.Builder().dockerHost(config.getDockerHost())
33+
.sslConfig(config.getSSLConfig()).maxConnections(100).connectionTimeout(Duration.ofSeconds(30))
34+
.responseTimeout(Duration.ofSeconds(45)).build();
35+
36+
DockerClient dc = DockerClientImpl.getInstance(config, client);
37+
dc.pingCmd().exec();
38+
39+
Info i = dc.infoCmd().exec();
40+
System.out.println(i);
41+
System.out.println(i);
42+
}
43+
}

dockerjava/test.bndrun

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
#*******************************************************************************
2+
# Copyright (c) 2004 Contributors to the Eclipse Foundation
3+
#
4+
# This program and the accompanying materials are made
5+
# available under the terms of the Eclipse Public License 2.0
6+
# which is available at https://www.eclipse.org/legal/epl-2.0/
7+
#
8+
# SPDX-License-Identifier: EPL-2.0
9+
#
10+
# Contributors:
11+
# SmartCity Jena - initial
12+
# Stefan Bischof (bipolis.org) - initial
13+
#*******************************************************************************
14+
15+
16+
-runstartlevel: \
17+
order=sortbynameversion,\
18+
begin=-1
19+
20+
-runtrace: true
21+
22+
-tester: biz.aQute.tester.junit-platform
23+
24+
25+
26+
27+
-runsystemcapabilities: ${native_capability}
28+
29+
-runproperties: \
30+
org.slf4j.simpleLogger.defaultLogLevel=debug
31+
32+
-runfw: org.apache.felix.framework
33+
34+
-runee: JavaSE-21
35+
36+
-runrequires: \
37+
bnd.identity;id='${project.artifactId}-tests',\
38+
bnd.identity;id=junit-jupiter-engine,\
39+
bnd.identity;id=junit-platform-launcher
40+
41+
# -runbundles is calculated by the bnd-resolver-maven-plugin
42+
43+
-runbundles: \
44+
ch.qos.logback.classic;version='[1.5.6,1.5.7)',\
45+
ch.qos.logback.core;version='[1.5.6,1.5.7)',\
46+
com.sun.jna;version='[5.11.0,5.11.1)',\
47+
junit-jupiter-api;version='[5.10.2,5.10.3)',\
48+
junit-jupiter-engine;version='[5.10.2,5.10.3)',\
49+
junit-platform-commons;version='[1.10.2,1.10.3)',\
50+
junit-platform-engine;version='[1.10.2,1.10.3)',\
51+
junit-platform-launcher;version='[1.10.2,1.10.3)',\
52+
org.apache.aries.spifly.dynamic.framework.extension;version='[1.3.7,1.3.8)',\
53+
org.eclipse.daanse.tooling.dockerjava;version='[0.0.1,0.0.2)',\
54+
org.eclipse.daanse.tooling.dockerjava-tests;version='[0.0.1,0.0.2)',\
55+
org.opentest4j;version='[1.3.0,1.3.1)',\
56+
slf4j.api;version='[2.0.12,2.0.13)'

pom.xml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,11 @@
3030

3131
<name>Eclipse Daanse Tooling Aggregator</name>
3232

33-
<description></description>
33+
<description>Eclipse Daanse tooling modules including Docker Java connector
34+
and Testcontainers integration</description>
3435

3536
<modules>
37+
<module>dockerjava</module>
3638
<module>testcontainers</module>
3739
</modules>
3840
</project>

testcontainers/core/bnd.bnd

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,11 @@
1616

1717
Export-Package: \
1818
!org.testcontainers.shaded*,\
19-
com.github.dockerjava.api*,\
2019
org.testcontainers*
2120

2221
-includeresource: \
2322
@testcontainers-1.21.3.jar,\
24-
@duct-tape-1.0.8.jar,\
25-
@docker-java-api-3.4.2.jar,\
26-
@docker-java-transport-3.4.2.jar,\
27-
@docker-java-transport-zerodep-3.4.2.jar
23+
@duct-tape-1.0.8.jar
2824

2925
DynamicImport-Package: *
3026

@@ -34,12 +30,10 @@ DynamicImport-Package: *
3430
org.junit.rules*,\
3531
org.junit.runners*,\
3632
org.hamcrest*,\
37-
org.apache.commons.compress,\
38-
com.github.dockerjava.zerodep*
33+
org.apache.commons.compress
3934

4035
Import-Package: \
4136
!android.os.*,\
42-
!com.github.dockerjava*,\
4337
!com.google.appengine.*,\
4438
!com.google.apphosting.*,\
4539
!com.google.cloud.*,\
@@ -49,4 +43,5 @@ Import-Package: \
4943
!org.testcontainers.r2dbc.*, \
5044
!org.junit*,\
5145
!sun.nio.ch*,\
46+
com.github.dockerjava*,\
5247
*

testcontainers/core/pom.xml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,18 @@
2121
</parent>
2222
<artifactId>org.eclipse.daanse.tooling.testcontainers.core</artifactId>
2323

24+
<name>Eclipse Daanse Testcontainers Core</name>
25+
<description>Core Testcontainers module providing Docker container testing
26+
capabilities</description>
2427

2528
<dependencies>
29+
30+
<dependency>
31+
<groupId>org.eclipse.daanse</groupId>
32+
<artifactId>org.eclipse.daanse.tooling.dockerjava</artifactId>
33+
<version>0.0.1-SNAPSHOT</version>
34+
<scope>compile</scope>
35+
</dependency>
2636
<dependency>
2737
<groupId>org.testcontainers</groupId>
2838
<artifactId>testcontainers</artifactId>

testcontainers/core/test.bndrun

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,15 @@
4343
# -runbundles is calculated by the bnd-resolver-maven-plugin
4444

4545
-runbundles: \
46-
com.sun.jna;version='[5.13.0,5.13.1)',\
46+
com.sun.jna;version='[5.11.0,5.11.1)',\
4747
junit-jupiter-api;version='[5.10.2,5.10.3)',\
4848
junit-jupiter-engine;version='[5.10.2,5.10.3)',\
4949
junit-platform-commons;version='[1.10.2,1.10.3)',\
5050
junit-platform-engine;version='[1.10.2,1.10.3)',\
5151
junit-platform-launcher;version='[1.10.2,1.10.3)',\
5252
org.apache.aries.spifly.dynamic.framework.extension;version='[1.3.7,1.3.8)',\
5353
org.apache.commons.commons-compress;version='[1.24.0,1.24.1)',\
54+
org.eclipse.daanse.tooling.dockerjava;version='[0.0.1,0.0.2)',\
5455
org.eclipse.daanse.tooling.testcontainers.core;version='[0.0.1,0.0.2)',\
5556
org.eclipse.daanse.tooling.testcontainers.core-tests;version='[0.0.1,0.0.2)',\
5657
org.opentest4j;version='[1.3.0,1.3.1)'

testcontainers/pom.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@
2121
</parent>
2222
<artifactId>org.eclipse.daanse.tooling.testcontainers</artifactId>
2323
<packaging>pom</packaging>
24+
25+
<name>Eclipse Daanse Testcontainers</name>
26+
<description>Testcontainers integration modules for Eclipse Daanse</description>
27+
2428
<modules>
2529
<module>core</module>
2630
</modules>

0 commit comments

Comments
 (0)