Skip to content

Commit 46b8a80

Browse files
committed
test: fix Java 11 test compilation and diagnostics
Enable required annotation processors, silence Java 11 compiler warnings, and improve CCM cleanup logging so integration failures are easier to diagnose.
1 parent a60b537 commit 46b8a80

8 files changed

Lines changed: 106 additions & 5 deletions

File tree

examples/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@
151151
<source>11</source>
152152
<target>11</target>
153153
<annotationProcessorPaths>
154+
<path>
155+
<groupId>com.google.errorprone</groupId>
156+
<artifactId>error_prone_core</artifactId>
157+
<version>2.31.0</version>
158+
</path>
154159
<path>
155160
<groupId>com.scylladb</groupId>
156161
<artifactId>java-driver-mapper-processor</artifactId>

examples/src/main/java/com/datastax/oss/driver/examples/paging/ForwardPagingRestUi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ private static void populateSchema(CqlSession session) {
119119
int videoid = i * 100 + j;
120120
session.execute(
121121
prepare.bind(
122-
i, "user " + i, Instant.ofEpochMilli(j * 100000), videoid, "video " + videoid));
122+
i, "user " + i, Instant.ofEpochMilli(j * 100000L), videoid, "video " + videoid));
123123
}
124124
}
125125
}

examples/src/main/java/com/datastax/oss/driver/examples/paging/RandomPagingRestUi.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ private static void populateSchema(CqlSession session) {
129129
int videoid = i * 100 + j;
130130
session.execute(
131131
prepare.bind(
132-
i, "user " + i, Instant.ofEpochMilli(j * 100000), videoid, "video " + videoid));
132+
i, "user " + i, Instant.ofEpochMilli(j * 100000L), videoid, "video " + videoid));
133133
}
134134
}
135135
}

integration-tests/pom.xml

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,6 +231,42 @@
231231
</dependencies>
232232
<build>
233233
<plugins>
234+
<plugin>
235+
<artifactId>maven-compiler-plugin</artifactId>
236+
<configuration>
237+
<compilerArgs combine.children="append">
238+
<compilerArg>-processor</compilerArg>
239+
<compilerArg>com.datastax.oss.driver.internal.mapper.processor.MapperProcessor,com.datastax.oss.driver.internal.gremlin.PatchedGremlinDslProcessor</compilerArg>
240+
</compilerArgs>
241+
<annotationProcessorPaths>
242+
<path>
243+
<groupId>com.google.errorprone</groupId>
244+
<artifactId>error_prone_core</artifactId>
245+
<version>2.31.0</version>
246+
</path>
247+
<path>
248+
<groupId>com.scylladb</groupId>
249+
<artifactId>java-driver-test-infra</artifactId>
250+
<version>${project.version}</version>
251+
</path>
252+
<path>
253+
<groupId>com.scylladb</groupId>
254+
<artifactId>java-driver-mapper-processor</artifactId>
255+
<version>${project.version}</version>
256+
</path>
257+
<path>
258+
<groupId>com.scylladb</groupId>
259+
<artifactId>java-driver-mapper-runtime</artifactId>
260+
<version>${project.version}</version>
261+
</path>
262+
<path>
263+
<groupId>org.apache.tinkerpop</groupId>
264+
<artifactId>gremlin-core</artifactId>
265+
<version>${tinkerpop.version}</version>
266+
</path>
267+
</annotationProcessorPaths>
268+
</configuration>
269+
</plugin>
234270
<plugin>
235271
<groupId>org.apache.maven.plugins</groupId>
236272
<artifactId>maven-failsafe-plugin</artifactId>

metrics/micrometer/src/main/java/com/datastax/oss/driver/internal/metrics/micrometer/MicrometerMetricUpdater.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,22 +55,22 @@ protected MicrometerMetricUpdater(
5555
@Override
5656
public void incrementCounter(MetricT metric, @Nullable String profileName, long amount) {
5757
if (isEnabled(metric, profileName)) {
58-
getOrCreateCounterFor(metric).increment(amount);
58+
getOrCreateCounterFor(metric).increment((double) amount);
5959
}
6060
}
6161

6262
@Override
6363
public void updateHistogram(MetricT metric, @Nullable String profileName, long value) {
6464
if (isEnabled(metric, profileName)) {
65-
getOrCreateDistributionSummaryFor(metric).record(value);
65+
getOrCreateDistributionSummaryFor(metric).record((double) value);
6666
}
6767
}
6868

6969
@Override
7070
public void markMeter(MetricT metric, @Nullable String profileName, long amount) {
7171
if (isEnabled(metric, profileName)) {
7272
// There is no meter type in Micrometer, so use a counter
73-
getOrCreateCounterFor(metric).increment(amount);
73+
getOrCreateCounterFor(metric).increment((double) amount);
7474
}
7575
}
7676

osgi-tests/pom.xml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,23 @@
162162
</dependencies>
163163
<build>
164164
<plugins>
165+
<plugin>
166+
<artifactId>maven-compiler-plugin</artifactId>
167+
<configuration>
168+
<annotationProcessorPaths combine.children="append">
169+
<path>
170+
<groupId>com.scylladb</groupId>
171+
<artifactId>java-driver-mapper-processor</artifactId>
172+
<version>${project.version}</version>
173+
</path>
174+
<path>
175+
<groupId>com.scylladb</groupId>
176+
<artifactId>java-driver-mapper-runtime</artifactId>
177+
<version>${project.version}</version>
178+
</path>
179+
</annotationProcessorPaths>
180+
</configuration>
181+
</plugin>
165182
<plugin>
166183
<groupId>org.apache.servicemix.tooling</groupId>
167184
<artifactId>depends-maven-plugin</artifactId>

test-infra/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,11 @@
4848
<groupId>com.scylladb</groupId>
4949
<artifactId>java-driver-core</artifactId>
5050
</dependency>
51+
<dependency>
52+
<groupId>org.apache.tinkerpop</groupId>
53+
<artifactId>gremlin-core</artifactId>
54+
<scope>provided</scope>
55+
</dependency>
5156
<dependency>
5257
<groupId>com.github.spotbugs</groupId>
5358
<artifactId>spotbugs-annotations</artifactId>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
package com.datastax.oss.driver.internal.gremlin;
19+
20+
import java.util.Collections;
21+
import java.util.Set;
22+
import javax.annotation.processing.SupportedAnnotationTypes;
23+
import javax.lang.model.SourceVersion;
24+
import org.apache.tinkerpop.gremlin.process.traversal.dsl.GremlinDslProcessor;
25+
26+
@SupportedAnnotationTypes("org.apache.tinkerpop.gremlin.process.traversal.dsl.GremlinDsl")
27+
public class PatchedGremlinDslProcessor extends GremlinDslProcessor {
28+
29+
@Override
30+
public Set<String> getSupportedAnnotationTypes() {
31+
return Collections.singleton("org.apache.tinkerpop.gremlin.process.traversal.dsl.GremlinDsl");
32+
}
33+
34+
@Override
35+
public SourceVersion getSupportedSourceVersion() {
36+
return SourceVersion.latestSupported();
37+
}
38+
}

0 commit comments

Comments
 (0)