You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@aries.apache.org by cs...@apache.org on 2018/09/27 08:29:17 UTC
[aries-rsa] branch master updated: ARIES-1835 - Use Awaitility to
make TestFastbinRoundTrip stable
This is an automated email from the ASF dual-hosted git repository.
cschneider pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/aries-rsa.git
The following commit(s) were added to refs/heads/master by this push:
new 0f4007e ARIES-1835 - Use Awaitility to make TestFastbinRoundTrip stable
0f4007e is described below
commit 0f4007eec7ebb4ec5c3e59ff67f9d7bc2d40080a
Author: Christian Schneider <cs...@adobe.com>
AuthorDate: Thu Sep 27 10:29:01 2018 +0200
ARIES-1835 - Use Awaitility to make TestFastbinRoundTrip stable
---
.../org/apache/aries/rsa/itests/felix/RsaTestBase.java | 18 ++++++++++++++++--
.../rsa/itests/felix/fastbin/TestFastbinRoundTrip.java | 10 ++++++++--
2 files changed, 24 insertions(+), 4 deletions(-)
diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java
index e2e56f0..c70aa0a 100644
--- a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java
+++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/RsaTestBase.java
@@ -19,8 +19,8 @@
package org.apache.aries.rsa.itests.felix;
+import static org.ops4j.pax.exam.CoreOptions.bundle;
import static org.ops4j.pax.exam.CoreOptions.composite;
-import static org.ops4j.pax.exam.CoreOptions.junitBundles;
import static org.ops4j.pax.exam.CoreOptions.mavenBundle;
import static org.ops4j.pax.exam.CoreOptions.systemProperty;
import static org.ops4j.pax.exam.CoreOptions.vmOption;
@@ -112,12 +112,26 @@ public class RsaTestBase {
);
}
+ /**
+ * We create our own junit option to also provide hamcrest and Awaitility support
+ */
+ protected static Option junit() {
+ return composite(systemProperty("pax.exam.invoker").value("junit"),
+ bundle("link:classpath:META-INF/links/org.ops4j.pax.tipi.junit.link"),
+ bundle("link:classpath:META-INF/links/org.ops4j.pax.exam.invoker.junit.link"),
+ mavenBundle().groupId("org.apache.servicemix.bundles")
+ .artifactId("org.apache.servicemix.bundles.hamcrest").version("1.3_1"),
+ mavenBundle().groupId("org.awaitility").artifactId("awaitility").version("3.1.0"));
+ }
+
protected static Option rsaCore() {
- return composite(junitBundles(),
+ return composite(junit(),
localRepo(),
systemProperty("pax.exam.osgi.unresolved.fail").value("true"),
systemProperty("org.ops4j.pax.logging.DefaultServiceLog.level").value("INFO"),
systemProperty("aries.rsa.hostname").value("localhost"),
+ mvn("org.apache.servicemix.bundles", "org.apache.servicemix.bundles.hamcrest"),
+ mvn("org.awaitility", "awaitility"),
mvn("org.apache.felix", "org.apache.felix.eventadmin"),
mvn("org.apache.felix", "org.apache.felix.configadmin"),
mvn("org.apache.felix", "org.apache.felix.scr"),
diff --git a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/fastbin/TestFastbinRoundTrip.java b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/fastbin/TestFastbinRoundTrip.java
index 1790951..36d86ca 100644
--- a/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/fastbin/TestFastbinRoundTrip.java
+++ b/itests/felix/src/test/java/org/apache/aries/rsa/itests/felix/fastbin/TestFastbinRoundTrip.java
@@ -18,9 +18,11 @@ package org.apache.aries.rsa.itests.felix.fastbin;
* under the License.
*/
-import static org.junit.Assert.assertEquals;
+import static org.awaitility.Awaitility.await;
+import static org.hamcrest.Matchers.equalTo;
import java.io.IOException;
+import java.util.concurrent.Callable;
import javax.inject.Inject;
@@ -75,7 +77,11 @@ public class TestFastbinRoundTrip extends RsaTestBase {
@Test
public void testCall() throws Exception {
- assertEquals("test", echoService.echo("test"));
+ await().ignoreExceptions().until(new Callable<String>() {
+ public String call() throws Exception {
+ return echoService.echo("test");
+ }
+ }, equalTo("test"));
}
}