This is an automated email from the ASF dual-hosted git repository.
reta pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf.git
The following commit(s) were added to refs/heads/master by this push:
new 372b8eb CXF-8393: Umbrella issue to address fixing flaky tests (#760)
372b8eb is described below
commit 372b8eb5f28e9ea118c29d030fbd07613fb55b48
Author: Andriy Redko <[email protected]>
AuthorDate: Wed Mar 24 19:15:58 2021 -0400
CXF-8393: Umbrella issue to address fixing flaky tests (#760)
---
parent/pom.xml | 5 +++
systests/microprofile/client/async/pom.xml | 6 ++++
.../cxf/microprofile/AnnotationTransformer.java | 33 ++++++++++++++++++
.../org/apache/cxf/microprofile/RetryAnalyzer.java | 39 ++++++++++++++++++++++
systests/microprofile/client/weld/testng.xml | 3 ++
5 files changed, 86 insertions(+)
diff --git a/parent/pom.xml b/parent/pom.xml
index 51c70a2..5497e71 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -1118,6 +1118,11 @@
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-servlets</artifactId>
+ <version>${cxf.jetty.version}</version>
+ </dependency>
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-util</artifactId>
<version>${cxf.jetty.version}</version>
</dependency>
diff --git a/systests/microprofile/client/async/pom.xml
b/systests/microprofile/client/async/pom.xml
index 461db8c..e6c9a3a 100644
--- a/systests/microprofile/client/async/pom.xml
+++ b/systests/microprofile/client/async/pom.xml
@@ -117,6 +117,12 @@
<artifactId>microprofile-rest-client-tck</artifactId>
<version>${cxf.microprofile.rest.client.version}</version>
<scope>test</scope>
+ <exclusions>
+ <exclusion>
+ <groupId>org.testng</groupId>
+ <artifactId>testng</artifactId>
+ </exclusion>
+ </exclusions>
</dependency>
<dependency>
<groupId>com.github.tomakehurst</groupId>
diff --git
a/systests/microprofile/client/weld/src/test/java/org/apache/cxf/microprofile/AnnotationTransformer.java
b/systests/microprofile/client/weld/src/test/java/org/apache/cxf/microprofile/AnnotationTransformer.java
new file mode 100644
index 0000000..d00c18f
--- /dev/null
+++
b/systests/microprofile/client/weld/src/test/java/org/apache/cxf/microprofile/AnnotationTransformer.java
@@ -0,0 +1,33 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.microprofile;
+
+import java.lang.reflect.Constructor;
+import java.lang.reflect.Method;
+
+import org.testng.IAnnotationTransformer;
+import org.testng.annotations.ITestAnnotation;
+
+public class AnnotationTransformer implements IAnnotationTransformer {
+ @Override
+ public void transform(ITestAnnotation annotation, Class test, Constructor
constructor, Method method) {
+ annotation.setRetryAnalyzer(RetryAnalyzer.class);
+ }
+}
diff --git
a/systests/microprofile/client/weld/src/test/java/org/apache/cxf/microprofile/RetryAnalyzer.java
b/systests/microprofile/client/weld/src/test/java/org/apache/cxf/microprofile/RetryAnalyzer.java
new file mode 100644
index 0000000..2fa1fc5
--- /dev/null
+++
b/systests/microprofile/client/weld/src/test/java/org/apache/cxf/microprofile/RetryAnalyzer.java
@@ -0,0 +1,39 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.cxf.microprofile;
+
+import org.testng.IRetryAnalyzer;
+import org.testng.ITestResult;
+import org.testng.Reporter;
+
+public class RetryAnalyzer implements IRetryAnalyzer {
+ private static final int RETRIES = 3;
+ private int counter;
+
+ @Override
+ public boolean retry(ITestResult result) {
+ if (++counter < RETRIES) {
+ Reporter.log("Retrying test case '" + result.getName() + "',
attempt " + counter);
+ return true;
+ } else {
+ return false;
+ }
+ }
+}
\ No newline at end of file
diff --git a/systests/microprofile/client/weld/testng.xml
b/systests/microprofile/client/weld/testng.xml
index e4c67d9..5fbb897 100644
--- a/systests/microprofile/client/weld/testng.xml
+++ b/systests/microprofile/client/weld/testng.xml
@@ -1,6 +1,9 @@
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd" >
<suite name="MPRestClientTCK1.3">
+ <listeners>
+ <listener
class-name="org.apache.cxf.microprofile.AnnotationTransformer"/>
+ </listeners>
<test name="All TCK Tests">
<packages>
<package name="org.eclipse.microprofile.rest.client.tck" />