Skip to content

Commit 5b1901f

Browse files
committed
separate the test code into separate modules to not run into dependency issues with the native modules
1 parent 9d3c21d commit 5b1901f

File tree

15 files changed

+99
-22
lines changed

15 files changed

+99
-22
lines changed

core-test/pom.xml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>tel.schich</groupId>
8+
<artifactId>javacan</artifactId>
9+
<version>3.0.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>javacan-core-test</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>${project.groupId}</groupId>
17+
<artifactId>javacan-core</artifactId>
18+
<version>${project.version}</version>
19+
</dependency>
20+
<dependency>
21+
<groupId>${project.groupId}</groupId>
22+
<artifactId>javacan-core</artifactId>
23+
<version>${project.version}</version>
24+
<classifier>${javacan.architecture}</classifier>
25+
</dependency>
26+
<dependency>
27+
<groupId>ch.qos.logback</groupId>
28+
<artifactId>logback-classic</artifactId>
29+
<scope>test</scope>
30+
</dependency>
31+
</dependencies>
32+
</project>

core/src/test/java/tel/schich/javacan/test/CanTestHelper.java renamed to core-test/src/main/java/tel/schich/javacan/test/CanTestHelper.java

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
*/
2323
package tel.schich.javacan.test;
2424

25-
import org.junit.jupiter.api.function.Executable;
2625
import tel.schich.javacan.CanFrame;
2726
import tel.schich.javacan.JavaCAN;
2827
import tel.schich.javacan.NetworkDevice;
@@ -79,14 +78,18 @@ public static void sendFrameViaUtils(NetworkDevice device, CanFrame frame) throw
7978
}
8079
}
8180

82-
public static void runDelayed(Duration d, Executable r) {
81+
public static void runDelayed(Duration d, IORunnable r) {
8382
new Thread(() -> {
8483
try {
8584
Thread.sleep(d.toMillis());
86-
r.execute();
85+
r.run();
8786
} catch (Throwable e) {
8887
e.printStackTrace(System.err);
8988
}
9089
}).start();
9190
}
91+
92+
public interface IORunnable {
93+
void run() throws Exception;
94+
}
9295
}

core/pom.xml

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,22 +45,6 @@
4545
<groupId>org.codehaus.mojo</groupId>
4646
<artifactId>exec-maven-plugin</artifactId>
4747
</plugin>
48-
<plugin>
49-
<groupId>org.apache.maven.plugins</groupId>
50-
<artifactId>maven-jar-plugin</artifactId>
51-
<executions>
52-
<execution>
53-
<goals>
54-
<goal>test-jar</goal>
55-
</goals>
56-
<configuration>
57-
<excludes>
58-
<excludes>logback-test.xml</excludes>
59-
</excludes>
60-
</configuration>
61-
</execution>
62-
</executions>
63-
</plugin>
6448
</plugins>
6549
</build>
6650
</project>

epoll-test/pom.xml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4+
<modelVersion>4.0.0</modelVersion>
5+
6+
<parent>
7+
<groupId>tel.schich</groupId>
8+
<artifactId>javacan</artifactId>
9+
<version>3.0.0-SNAPSHOT</version>
10+
</parent>
11+
12+
<artifactId>javacan-epoll-test</artifactId>
13+
14+
<dependencies>
15+
<dependency>
16+
<groupId>${project.parent.groupId}</groupId>
17+
<artifactId>javacan-core</artifactId>
18+
<version>${project.parent.version}</version>
19+
</dependency>
20+
<dependency>
21+
<groupId>${project.groupId}</groupId>
22+
<artifactId>javacan-core</artifactId>
23+
<version>${project.version}</version>
24+
<classifier>${javacan.architecture}</classifier>
25+
</dependency>
26+
<dependency>
27+
<groupId>${project.parent.groupId}</groupId>
28+
<artifactId>javacan-epoll</artifactId>
29+
<version>${project.parent.version}</version>
30+
</dependency>
31+
<dependency>
32+
<groupId>${project.parent.groupId}</groupId>
33+
<artifactId>javacan-epoll</artifactId>
34+
<version>${project.parent.version}</version>
35+
<classifier>${javacan.architecture}</classifier>
36+
</dependency>
37+
38+
<dependency>
39+
<groupId>${project.parent.groupId}</groupId>
40+
<artifactId>javacan-core-test</artifactId>
41+
<version>${project.parent.version}</version>
42+
<scope>test</scope>
43+
</dependency>
44+
<dependency>
45+
<groupId>ch.qos.logback</groupId>
46+
<artifactId>logback-classic</artifactId>
47+
<scope>test</scope>
48+
</dependency>
49+
</dependencies>
50+
</project>

0 commit comments

Comments
 (0)