Skip to content

Commit 3855127

Browse files
authored
[DE-445] JPMS compatibility (#477)
* removed unneeded methods from ConfigPropertiesProvider * [DE-445] fixed FileConfigPropertiesProvider with JPMS * [DE-445] JPMS module names
1 parent be57b9f commit 3855127

File tree

12 files changed

+34
-25
lines changed

12 files changed

+34
-25
lines changed

driver/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
<maven.deploy.skip>false</maven.deploy.skip>
1919
<SslTest>false</SslTest>
2020
<sonar.test.exclusions>src/test/**/*</sonar.test.exclusions>
21+
<moduleName>com.arangodb.driver</moduleName>
2122
</properties>
2223

2324
<profiles>

driver/src/main/java/com/arangodb/config/ConfigPropertiesProvider.java

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,4 @@ public interface ConfigPropertiesProvider {
99
*/
1010
String getProperty(String key);
1111

12-
default String getProperty(ConfigPropertyKey key) {
13-
return getProperty(key.getValue());
14-
}
15-
16-
default String getProperty(String key, String defaultValue) {
17-
String p = getProperty(key);
18-
return p != null ? p : defaultValue;
19-
}
20-
21-
default String getProperty(ConfigPropertyKey key, String defaultValue) {
22-
String p = getProperty(key);
23-
return p != null ? p : defaultValue;
24-
}
2512
}

driver/src/main/java/com/arangodb/internal/InternalArangoDBBuilder.java

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public abstract class InternalArangoDBBuilder {
6060
protected Integer responseQueueTimeSamples = ArangoDefaults.DEFAULT_RESPONSE_QUEUE_TIME_SAMPLES;
6161

6262
private static void loadHosts(final ConfigPropertiesProvider properties, final Collection<HostDescription> hosts) {
63-
final String hostsProp = properties.getProperty(ConfigPropertyKey.HOSTS);
63+
final String hostsProp = properties.getProperty(ConfigPropertyKey.HOSTS.getValue());
6464
if (hostsProp != null) {
6565
final String[] hostsSplit = hostsProp.split(",");
6666
for (final String host : hostsSplit) {
@@ -138,8 +138,10 @@ private static LoadBalancingStrategy loadLoadBalancingStrategy(
138138
}
139139

140140
protected static String getProperty(ConfigPropertiesProvider props, ConfigPropertyKey key, Object currentValue) {
141-
String defaultValue = currentValue == null ? null : currentValue.toString();
142-
return props.getProperty(key, defaultValue);
141+
String p = props.getProperty(key.getValue());
142+
if (p != null) return p;
143+
if (currentValue != null) return currentValue.toString();
144+
return null;
143145
}
144146

145147
protected static ArangoSerdeProvider serdeProvider() {

driver/src/main/java/com/arangodb/internal/config/FileConfigPropertiesProvider.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
*/
1313
public class FileConfigPropertiesProvider implements ConfigPropertiesProvider {
1414
private static final String DEFAULT_PREFIX = "arangodb";
15-
private static final String DEFAULT_PROPERTY_FILE = "/arangodb.properties";
15+
private static final String DEFAULT_PROPERTY_FILE = "arangodb.properties";
1616
private final Properties properties;
1717
private final String prefix;
1818

@@ -35,7 +35,7 @@ private String initPrefix(String p) {
3535

3636
private Properties initProperties(String fileName) {
3737
Properties p = new Properties();
38-
try (InputStream is = FileConfigPropertiesProvider.class.getResourceAsStream(fileName)) {
38+
try (InputStream is = getClass().getClassLoader().getResourceAsStream(fileName)) {
3939
p.load(is);
4040
} catch (Exception e) {
4141
throw new ArangoDBException("Got exception while reading properties file " + fileName, e);

jackson-serde/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
<properties>
1717
<maven.deploy.skip>false</maven.deploy.skip>
18+
<moduleName>com.arangodb.serde.jackson</moduleName>
1819
</properties>
1920

2021
<dependencies>

jsonb-serde/pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
<properties>
1717
<!-- FIXME: requires JDK 11 -->
1818
<maven.deploy.skip>true</maven.deploy.skip>
19+
<moduleName>com.arangodb.serde.jsonb</moduleName>
1920
</properties>
2021

2122
<dependencies>

pom.xml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,17 @@
263263
</execution>
264264
</executions>
265265
</plugin>
266+
<plugin>
267+
<groupId>org.apache.maven.plugins</groupId>
268+
<artifactId>maven-jar-plugin</artifactId>
269+
<configuration>
270+
<archive>
271+
<manifestEntries>
272+
<Automatic-Module-Name>${moduleName}</Automatic-Module-Name>
273+
</manifestEntries>
274+
</archive>
275+
</configuration>
276+
</plugin>
266277
<plugin>
267278
<groupId>org.apache.maven.plugins</groupId>
268279
<artifactId>maven-enforcer-plugin</artifactId>

resilience-tests/pom.xml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,6 @@
1111

1212
<artifactId>resilience-tests</artifactId>
1313

14-
<properties>
15-
<maven.compiler.target>17</maven.compiler.target>
16-
<maven.compiler.source>17</maven.compiler.source>
17-
</properties>
18-
1914
<dependencies>
2015
<dependency>
2116
<groupId>org.mock-server</groupId>

resilience-tests/src/test/java/resilience/ActiveFailoverTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.junit.jupiter.api.Tag;
1313

1414
import java.io.IOException;
15+
import java.util.Arrays;
1516
import java.util.List;
1617

1718
@Tag("activeFailover")
@@ -20,7 +21,7 @@ public abstract class ActiveFailoverTest {
2021
protected static final String HOST = "127.0.0.1";
2122
protected static final String PASSWORD = "test";
2223
protected static final MemoryAppender logs = new MemoryAppender(Level.WARN);
23-
private static final List<Endpoint> endpoints = List.of(
24+
private static final List<Endpoint> endpoints = Arrays.asList(
2425
new Endpoint("activeFailover1", HOST, 18529, "172.28.0.1:8529"),
2526
new Endpoint("activeFailover2", HOST, 18539, "172.28.0.1:8539"),
2627
new Endpoint("activeFailover3", HOST, 18549, "172.28.0.1:8549")

resilience-tests/src/test/java/resilience/ClusterTest.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
import org.junit.jupiter.api.Tag;
1313

1414
import java.io.IOException;
15+
import java.util.Arrays;
1516
import java.util.List;
1617

1718
@Tag("cluster")
@@ -20,7 +21,7 @@ public abstract class ClusterTest {
2021
protected static final String HOST = "127.0.0.1";
2122
protected static final String PASSWORD = "test";
2223
protected static final MemoryAppender logs = new MemoryAppender(Level.WARN);
23-
private static final List<Endpoint> endpoints = List.of(
24+
private static final List<Endpoint> endpoints = Arrays.asList(
2425
new Endpoint("cluster1", HOST, 18529, "172.28.0.1:8529"),
2526
new Endpoint("cluster2", HOST, 18539, "172.28.0.1:8539"),
2627
new Endpoint("cluster3", HOST, 18549, "172.28.0.1:8549")

0 commit comments

Comments
 (0)