Skip to content

Commit 2c8a765

Browse files
authored
Merge pull request #31271 from Azquelt/test-kafka-client-4
Run MP Reactive Messaging Kafka tests with Kafka client 4.0.0
2 parents 0fb3b66 + f557484 commit 2c8a765

File tree

19 files changed

+192
-109
lines changed

19 files changed

+192
-109
lines changed

dev/com.ibm.websphere.org.eclipse.microprofile/build.gradle

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
/*******************************************************************************
2-
* Copyright (c) 2020, 2024 IBM Corporation and others.
2+
* Copyright (c) 2020, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
66
* http://www.eclipse.org/legal/epl-2.0/
77
*
88
* SPDX-License-Identifier: EPL-2.0
9-
*
10-
* Contributors:
11-
* IBM Corporation - initial API and implementation
129
*******************************************************************************/
1310
configurations {
1411
config11 {
@@ -43,6 +40,10 @@ configurations {
4340
canBeConsumed = true
4441
canBeResolved = false
4542
}
43+
reactivemessaging10 {
44+
canBeConsumed = true
45+
canBeResolved = false
46+
}
4647
}
4748

4849
artifacts {
@@ -54,4 +55,5 @@ artifacts {
5455
ft11(file('build/libs/com.ibm.websphere.org.eclipse.microprofile.faulttolerance.1.1.jar'))
5556
openapi10(file('build/libs/com.ibm.websphere.org.eclipse.microprofile.openapi.1.0.jar'))
5657
reactivestreams10(file('build/libs/com.ibm.websphere.org.eclipse.microprofile.reactive.streams.operators.1.0.jar'))
58+
reactivemessaging10(file('build/libs/com.ibm.websphere.org.eclipse.microprofile.reactive.messaging.1.0.jar'))
5759
}
Lines changed: 3 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,10 @@
11
apply from: '../wlp-gradle/subprojects/maven-central-mirror.gradle'
2-
3-
configurations {
4-
kafkaClient {
5-
transitive = false
6-
}
7-
requiredLibs.extendsFrom kafkaClient {
8-
transitive = false
9-
}
10-
}
2+
apply from: '../io.openliberty.microprofile.reactive.messaging.internal_fat.common/include-kafka-client.gradle'
113

124
dependencies {
13-
kafkaClient 'org.apache.kafka:kafka-clients:3.5.1'
14-
kafkaClient 'org.lz4:lz4-java:1.8.0'
15-
kafkaClient 'com.github.luben:zstd-jni:1.5.5-1'
16-
kafkaClient 'org.xerial.snappy:snappy-java:1.1.10.1'
17-
kafkaClient project(':com.ibm.ws.org.slf4j.api')
18-
kafkaClient project(':com.ibm.ws.org.slf4j.jdk14')
19-
requiredLibs 'org.testng:testng:7.5.1'
20-
requiredLibs 'org.reactivestreams:reactive-streams-tck:1.0.3'
21-
requiredLibs project(':com.ibm.websphere.org.reactivestreams.reactive-streams.1.0')
22-
requiredLibs project(':com.ibm.ws.microprofile.reactive.messaging.kafka')
23-
requiredLibs project(':com.ibm.ws.microprofile.reactive.messaging.kafka.adapter')
24-
requiredLibs project(':com.ibm.ws.microprofile.reactive.messaging.kafka.adapter.impl')
25-
requiredLibs project(':com.ibm.ws.io.smallrye.reactive.streams-operators')
26-
requiredLibs project(':com.ibm.ws.crypto.passwordutil');
27-
requiredLibs project(':com.ibm.ws.kernel.service');
28-
requiredLibs project(path: ':com.ibm.websphere.org.eclipse.microprofile', configuration: 'reactivestreams10');
295
requiredLibs project(path: ':io.openliberty.microprofile.reactive.messaging.internal_fat.common', configuration: 'original');
6+
requiredLibs project(':com.ibm.ws.crypto.passwordutil');
307
}
318

32-
task addKafkaClientLibs (type: Copy) {
33-
into new File(autoFvtDir, 'lib/LibertyFATTestFiles/libs')
34-
from configurations.kafkaClient
35-
shouldRunAfter autoFVT
36-
}
37-
38-
zipAutoFVT.dependsOn addKafkaClientLibs
399
addRequiredLibraries.dependsOn copyTestContainers
40-
addRequiredLibraries.dependsOn addJakartaTransformer
10+
addRequiredLibraries.dependsOn addJakartaTransformer

dev/com.ibm.ws.microprofile.reactive.messaging.kafka.secure_fat/publish/servers/CheckpointSimpleRxMessagingServer/server.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright (c) 2019 IBM Corporation and others.
2+
Copyright (c) 2019, 2025 IBM Corporation and others.
33
All rights reserved. This program and the accompanying materials
44
are made available under the terms of the Eclipse Public License 2.0
55
which accompanies this distribution, and is available at
@@ -19,6 +19,7 @@
1919
<feature>osgiconsole-1.0</feature>
2020
<feature>localConnector-1.0</feature>
2121
<feature>mpReactiveMessaging-1.0</feature>
22+
<feature>mpConfig-1.3</feature>
2223
<feature>servlet-4.0</feature>
2324
<feature>jsonb-1.0</feature>
2425
<feature>concurrent-1.0</feature>

dev/com.ibm.ws.microprofile.reactive.messaging.kafka.secure_fat/publish/servers/ContextRxMessagingServer/server.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright (c) 2023 IBM Corporation and others.
2+
Copyright (c) 2023, 2025 IBM Corporation and others.
33
All rights reserved. This program and the accompanying materials
44
are made available under the terms of the Eclipse Public License 2.0
55
which accompanies this distribution, and is available at
@@ -20,6 +20,7 @@
2020
<feature>osgiconsole-1.0</feature>
2121
<feature>localConnector-1.0</feature>
2222
<feature>mpReactiveMessaging-1.0</feature>
23+
<feature>mpConfig-1.3</feature>
2324
<feature>servlet-4.0</feature>
2425
<feature>jndi-1.0</feature>
2526
</featureManager>

dev/com.ibm.ws.microprofile.reactive.messaging.kafka.secure_fat/publish/servers/CustomContextRxMessagingServer/server.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright (c) 2023 IBM Corporation and others.
2+
Copyright (c) 2023, 2025 IBM Corporation and others.
33
All rights reserved. This program and the accompanying materials
44
are made available under the terms of the Eclipse Public License 2.0
55
which accompanies this distribution, and is available at
@@ -20,6 +20,7 @@
2020
<feature>osgiconsole-1.0</feature>
2121
<feature>localConnector-1.0</feature>
2222
<feature>mpReactiveMessaging-1.0</feature>
23+
<feature>mpConfig-1.3</feature>
2324
<feature>servlet-4.0</feature>
2425
<feature>jndi-1.0</feature>
2526
<feature>concurrent-1.0</feature>

dev/com.ibm.ws.microprofile.reactive.messaging.kafka.secure_fat/publish/servers/SimpleRxMessagingServer/server.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright (c) 2019 IBM Corporation and others.
2+
Copyright (c) 2019, 2025 IBM Corporation and others.
33
All rights reserved. This program and the accompanying materials
44
are made available under the terms of the Eclipse Public License 2.0
55
which accompanies this distribution, and is available at
@@ -20,5 +20,6 @@
2020
<feature>localConnector-1.0</feature>
2121
<feature>mpReactiveMessaging-1.0</feature>
2222
<feature>servlet-4.0</feature>
23+
<feature>mpConfig-1.3</feature>
2324
</featureManager>
2425
</server>
Lines changed: 14 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,30 @@
11
apply from: '../wlp-gradle/subprojects/maven-central-mirror.gradle'
2+
apply from: '../io.openliberty.microprofile.reactive.messaging.internal_fat.common/include-kafka-client.gradle'
23

3-
configurations {
4-
kafkaClient {
4+
dependencies {
5+
// Our implementation of reactive streams publishers and consumers
6+
// Needed here to run the RS TCK
7+
requiredLibs (project(':com.ibm.ws.microprofile.reactive.messaging.kafka')) {
58
transitive = false
69
}
7-
requiredLibs.extendsFrom kafkaClient {
10+
requiredLibs (project(':com.ibm.ws.microprofile.reactive.messaging.kafka.adapter')) {
11+
transitive = false
12+
}
13+
requiredLibs (project(':com.ibm.ws.microprofile.reactive.messaging.kafka.adapter.impl')) {
14+
transitive = false
15+
}
16+
requiredLibs (project(':io.openliberty.microprofile.reactive.messaging.internal')) {
817
transitive = false
918
}
10-
}
1119

12-
dependencies {
13-
kafkaClient 'org.apache.kafka:kafka-clients:3.5.1'
14-
kafkaClient 'org.lz4:lz4-java:1.8.0'
15-
kafkaClient 'com.github.luben:zstd-jni:1.5.5-1'
16-
kafkaClient 'org.xerial.snappy:snappy-java:1.1.10.1'
17-
kafkaClient project(':com.ibm.ws.org.slf4j.api')
18-
kafkaClient project(':com.ibm.ws.org.slf4j.jdk14')
1920
requiredLibs 'org.testng:testng:7.5.1'
2021
requiredLibs 'org.reactivestreams:reactive-streams-tck:1.0.3'
2122
requiredLibs project(':com.ibm.websphere.org.reactivestreams.reactive-streams.1.0')
22-
requiredLibs project(':com.ibm.ws.microprofile.reactive.messaging.kafka')
23-
requiredLibs project(':com.ibm.ws.microprofile.reactive.messaging.kafka.adapter')
24-
requiredLibs project(':com.ibm.ws.microprofile.reactive.messaging.kafka.adapter.impl')
2523
requiredLibs project(':com.ibm.ws.io.smallrye.reactive.streams-operators')
26-
requiredLibs project(':com.ibm.ws.crypto.passwordutil');
27-
requiredLibs project(':com.ibm.ws.kernel.service');
2824
requiredLibs project(path: ':com.ibm.websphere.org.eclipse.microprofile', configuration: 'reactivestreams10');
25+
requiredLibs project(path: ':com.ibm.websphere.org.eclipse.microprofile', configuration: 'reactivemessaging10');
2926
requiredLibs project(path: ':io.openliberty.microprofile.reactive.messaging.internal_fat.common', configuration: 'original');
3027
}
3128

32-
task addKafkaClientLibs (type: Copy) {
33-
into new File(autoFvtDir, 'lib/LibertyFATTestFiles/libs')
34-
from configurations.kafkaClient
35-
shouldRunAfter autoFVT
36-
}
37-
38-
zipAutoFVT.dependsOn addKafkaClientLibs
3929
addRequiredLibraries.dependsOn copyTestContainers
40-
addRequiredLibraries.dependsOn addJakartaTransformer
30+
addRequiredLibraries.dependsOn addJakartaTransformer

dev/com.ibm.ws.microprofile.reactive.messaging_fat/fat/src/com/ibm/ws/microprofile/reactive/messaging/fat/kafka/tck/KafkaPublisherVerification.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,11 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019, 2023 IBM Corporation and others.
2+
* Copyright (c) 2019, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
66
* http://www.eclipse.org/legal/epl-2.0/
77
*
88
* SPDX-License-Identifier: EPL-2.0
9-
*
10-
* Contributors:
11-
* IBM Corporation - initial API and implementation
129
*******************************************************************************/
1310
package com.ibm.ws.microprofile.reactive.messaging.fat.kafka.tck;
1411

@@ -21,11 +18,12 @@
2118
import org.apache.kafka.clients.consumer.ConsumerConfig;
2219
import org.apache.kafka.common.serialization.StringDeserializer;
2320
import org.eclipse.microprofile.reactive.messaging.Message;
24-
import org.junit.BeforeClass;
2521
import org.reactivestreams.Publisher;
2622
import org.reactivestreams.tck.PublisherVerification;
2723
import org.reactivestreams.tck.TestEnvironment;
24+
import org.testng.annotations.AfterClass;
2825
import org.testng.annotations.AfterMethod;
26+
import org.testng.annotations.BeforeClass;
2927
import org.testng.annotations.BeforeMethod;
3028

3129
import com.ibm.ws.microprofile.reactive.messaging.fat.kafka.framework.KafkaTestClient;
@@ -64,6 +62,7 @@ public static void setupClass() {
6462
asyncProvider = new MockAsyncProvider();
6563
}
6664

65+
@AfterClass
6766
public static void cleanupClass() {
6867
if (asyncProvider != null) {
6968
asyncProvider.close();

dev/com.ibm.ws.microprofile.reactive.messaging_fat/fat/src/com/ibm/ws/microprofile/reactive/messaging/fat/kafka/tck/ReactiveStreamsTckTest.java

Lines changed: 50 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,24 @@
11
/*******************************************************************************
2-
* Copyright (c) 2019 IBM Corporation and others.
2+
* Copyright (c) 2019, 2025 IBM Corporation and others.
33
* All rights reserved. This program and the accompanying materials
44
* are made available under the terms of the Eclipse Public License 2.0
55
* which accompanies this distribution, and is available at
66
* http://www.eclipse.org/legal/epl-2.0/
77
*
88
* SPDX-License-Identifier: EPL-2.0
9-
*
10-
* Contributors:
11-
* IBM Corporation - initial API and implementation
129
*******************************************************************************/
1310
package com.ibm.ws.microprofile.reactive.messaging.fat.kafka.tck;
1411

12+
import java.io.IOException;
13+
import java.nio.file.Files;
14+
import java.nio.file.Path;
15+
import java.nio.file.Paths;
16+
import java.util.ArrayList;
1517
import java.util.Arrays;
1618
import java.util.Collections;
1719
import java.util.List;
20+
import java.util.stream.Collectors;
21+
import java.util.stream.Stream;
1822

1923
import org.eclipse.microprofile.reactive.streams.operators.core.ReactiveStreamsEngineResolver;
2024
import org.eclipse.microprofile.reactive.streams.operators.core.ReactiveStreamsFactoryImpl;
@@ -68,25 +72,26 @@ public void runTck() {
6872
KafkaSubscriberVerification.class);
6973

7074
TestNG testNg = new TestNG(false);
71-
testNg.setXmlSuites(Collections.singletonList(createSuiteForTestClasses(testClasses)));
75+
testNg.setXmlSuites(Collections.singletonList(createSuiteForTestClasses("ReactiveStreamsTckTest", testClasses)));
7276
testNg.addListener(junitReporter);
7377
testNg.addListener(loggingReporter);
7478
testNg.setOutputDirectory("results/junit");
7579
testNg.run();
80+
moveSuiteResultFiles("results/junit", "ReactiveStreamsTckTest");
7681
}
7782

7883
/**
7984
* Creates a test suite to run the given classes
8085
* <p>
81-
* The suite is structured so that the JUnit result files that it outputs matches what the FAT framework expects
86+
* Results will be output in a subdirectory and must be moved into the location expected by the FAT framework
8287
*
88+
* @param suiteName the name of the test suite
8389
* @param testClasses the TestNG test classes
8490
* @return the TestNG suite
8591
*/
86-
private XmlSuite createSuiteForTestClasses(List<Class<?>> testClasses) {
92+
private XmlSuite createSuiteForTestClasses(String suiteName, List<Class<?>> testClasses) {
8793
XmlSuite suite = new XmlSuite();
88-
// Ignore below, a new testng requires suit names
89-
suite.setName("ReactiveStreamsTckTest"); // No suite name so that result files are not put in a subdirectory
94+
suite.setName(suiteName);
9095

9196
for (Class<?> testClass : testClasses) {
9297
XmlTest test = new XmlTest(suite);
@@ -97,4 +102,40 @@ private XmlSuite createSuiteForTestClasses(List<Class<?>> testClasses) {
97102
return suite;
98103
}
99104

105+
/**
106+
* Moves test result files from where TestNG makes them to where the FAT framework expects them
107+
*
108+
* @param resultsDirectory the results directory
109+
* @param suiteName the name of the suite
110+
*/
111+
private void moveSuiteResultFiles(String resultsDirectory, String suiteName) {
112+
List<Exception> errors = new ArrayList<>();
113+
Path resultsDir = Paths.get(resultsDirectory);
114+
Path suiteDir = Paths.get(resultsDirectory, suiteName);
115+
116+
List<Path> filesToMove;
117+
try (Stream<Path> stream = Files.list(suiteDir)) {
118+
filesToMove = stream.filter(p -> p.getFileName().toString().endsWith(".xml"))
119+
.collect(Collectors.toList());
120+
} catch (IOException e) {
121+
errors.add(e);
122+
filesToMove = Collections.emptyList();
123+
}
124+
125+
for (Path src : filesToMove) {
126+
try {
127+
Path dest = resultsDir.resolve(src.getFileName());
128+
Files.move(src, dest);
129+
} catch (IOException e) {
130+
errors.add(new Exception("Failure moving " + src, e));
131+
}
132+
}
133+
134+
if (!errors.isEmpty()) {
135+
RuntimeException ex = new RuntimeException("Failures occurred moving TestNG results files");
136+
errors.stream().forEach(ex::addSuppressed);
137+
throw ex;
138+
}
139+
}
140+
100141
}

dev/com.ibm.ws.microprofile.reactive.messaging_fat/publish/servers/ConcurrentRxMessagingServer/server.xml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<!--
2-
Copyright (c) 2023 IBM Corporation and others.
2+
Copyright (c) 2023, 2025 IBM Corporation and others.
33
All rights reserved. This program and the accompanying materials
44
are made available under the terms of the Eclipse Public License 2.0
55
which accompanies this distribution, and is available at
@@ -20,6 +20,7 @@
2020
<feature>osgiconsole-1.0</feature>
2121
<feature>localConnector-1.0</feature>
2222
<feature>mpReactiveMessaging-1.0</feature>
23+
<feature>mpConfig-1.3</feature>
2324
<feature>servlet-4.0</feature>
2425
<feature>concurrent-1.0</feature>
2526
</featureManager>

0 commit comments

Comments
 (0)