Skip to content

Commit 6944655

Browse files
committed
added cmd interface for tools and updated mvn build
1 parent 0931ee0 commit 6944655

File tree

3 files changed

+88
-1
lines changed

3 files changed

+88
-1
lines changed

pom.xml

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,54 @@
77
<groupId>net.b07z.sepia.server.core</groupId>
88
<artifactId>sepia-core-tools</artifactId>
99
<version>2.0.0</version>
10+
<packaging>jar</packaging>
1011

1112
<properties>
1213
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
1314
<maven.compiler.source>1.8</maven.compiler.source>
1415
<maven.compiler.target>1.8</maven.compiler.target>
1516
</properties>
17+
18+
<build>
19+
<plugins>
20+
<plugin>
21+
<groupId>org.apache.maven.plugins</groupId>
22+
<artifactId>maven-dependency-plugin</artifactId>
23+
<version>3.1.0</version>
24+
<executions>
25+
<execution>
26+
<id>copy-dependencies</id>
27+
<phase>prepare-package</phase>
28+
<goals>
29+
<goal>copy-dependencies</goal>
30+
</goals>
31+
<configuration>
32+
<outputDirectory>
33+
${project.build.directory}/libs
34+
</outputDirectory>
35+
</configuration>
36+
</execution>
37+
</executions>
38+
</plugin>
39+
<plugin>
40+
<groupId>org.apache.maven.plugins</groupId>
41+
<artifactId>maven-jar-plugin</artifactId>
42+
<version>3.1.0</version>
43+
<configuration>
44+
<archive>
45+
<manifest>
46+
<addClasspath>true</addClasspath>
47+
<classpathPrefix>libs/</classpathPrefix>
48+
<mainClass>
49+
net.b07z.sepia.server.core.tools.ToolsRunner
50+
</mainClass>
51+
</manifest>
52+
</archive>
53+
<finalName>tools-v${project.version}</finalName>
54+
</configuration>
55+
</plugin>
56+
</plugins>
57+
</build>
1658

1759
<dependencies>
1860
<dependency>
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
package net.b07z.sepia.server.core.tools;
2+
3+
import java.util.Arrays;
4+
5+
/**
6+
* Command-line interface to run different tools.
7+
*
8+
* @author Florian Quirin
9+
*
10+
*/
11+
public class ToolsRunner {
12+
13+
/**
14+
* Run tools.
15+
* @param args
16+
*/
17+
public static void main(String[] args) {
18+
//Help
19+
if (args[0].equals("-h") || args[0].equals("-help") || args[0].equals("help")){
20+
help();
21+
return;
22+
23+
//Tools to run:
24+
}else if (args[0].equals("connection-check")){
25+
String[] toolArgs = Arrays.copyOfRange(args, 1, args.length);
26+
ConnectionCheck.main(toolArgs);
27+
return;
28+
}
29+
}
30+
31+
/**
32+
* Command-line interface help.
33+
*/
34+
private static void help(){
35+
System.out.println("\nUsage:");
36+
System.out.println("[tool] [arguments]");
37+
System.out.println("\nTools:");
38+
System.out.println("connection-check - args: -h");
39+
System.out.println("");
40+
}
41+
42+
}

src/test/java/microservices/TestMicroservices.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ public void testDbStationResults() throws IOException {
2828
System.out.println("NOTE: JUnit-microservices: skipped dBStationResults testing due to missing test-data!");
2929
}
3030

31-
if (dbApiKey != null){
31+
if (dbApiKey != null && !dbApiKey.isEmpty()){
3232
DbStationResults.setApiKey(dbApiKey);
3333

3434
String langCode = Language.DE.toValue();
@@ -46,6 +46,9 @@ public void testDbStationResults() throws IOException {
4646
assertThat(dbStationFirst.getId(), is("008011160"));
4747
assertThat(dbStationClosest.toString(), is("Berlin Ostbahnhof"));
4848
assertThat(dbStationClosest.getId(), is("008010255"));
49+
50+
}else{
51+
System.out.println("NOTE: JUnit-microservices: skipped dBStationResults testing due to missing API-key!");
4952
}
5053
}
5154

0 commit comments

Comments
 (0)