This is an automated email from the ASF dual-hosted git repository.
buhhunyx 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 6a5ecb6 itests: reuse Karaf version
6a5ecb6 is described below
commit 6a5ecb6d063037c7f8786b67294d32e5b28895bc
Author: amarkevich <[email protected]>
AuthorDate: Fri May 17 11:59:53 2019 +0300
itests: reuse Karaf version
---
.../apache/cxf/osgi/itests/CXFOSGiTestSupport.java | 13 +++---
.../sts/itests/BasicSTSIntegrationTest.java | 14 +++----
.../cxf/systest/sts/itests/unit/STSUnitTest.java | 46 ++++++++++++----------
.../cxf/xkms/itests/BasicIntegrationTest.java | 12 ++----
4 files changed, 41 insertions(+), 44 deletions(-)
diff --git
a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
index 32cdcc0..4857a14 100644
---
a/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
+++
b/osgi/itests/src/test/java/org/apache/cxf/osgi/itests/CXFOSGiTestSupport.java
@@ -69,14 +69,15 @@ public class CXFOSGiTestSupport {
* @return
*/
protected Option cxfBaseConfig() {
+ final String karafVersion = getKarafVersion();
final MavenUrlReference karafUrl =
maven().groupId("org.apache.karaf").artifactId("apache-karaf-minimal")
- .version(getKarafVersion()).type("tar.gz");
+ .version(karafVersion).type("tar.gz");
cxfUrl =
maven().groupId("org.apache.cxf.karaf").artifactId("apache-cxf").versionAsInProject()
.type("xml").classifier("features");
amqUrl = maven().groupId("org.apache.activemq")
.artifactId("activemq-karaf").type("xml").classifier("features").versionAsInProject();
springLegacyUrl =
maven().groupId("org.apache.karaf.features").artifactId("spring-legacy")
- .version(getKarafVersion()).type("xml").classifier("features");
+ .version(karafVersion).type("xml").classifier("features");
String localRepo = System.getProperty("localRepository");
Object urp = System.getProperty("cxf.useRandomFirstPort");
final File loggingCfg;
@@ -88,7 +89,7 @@ public class CXFOSGiTestSupport {
if (JavaVersionUtil.getMajorVersion() >= 9) {
return composite(karafDistributionConfiguration()
.frameworkUrl(karafUrl)
- .karafVersion(getKarafVersion())
+ .karafVersion(karafVersion)
.name("Apache Karaf")
.useDeployFolder(false)
.unpackDirectory(new File("target/paxexam/")),
@@ -107,10 +108,10 @@ public class CXFOSGiTestSupport {
+
"org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
new VMOption("--patch-module"),
new
VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
- + System.getProperty("karaf.version", "4.2.2") +
".jar"),
+ + karafVersion + ".jar"),
new VMOption("--patch-module"),
new
VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
- + System.getProperty("karaf.version", "4.2.2") +
".jar"),
+ + karafVersion + ".jar"),
new VMOption("--add-opens"),
new
VMOption("java.base/java.security=ALL-UNNAMED"),
new VMOption("--add-opens"),
@@ -133,7 +134,7 @@ public class CXFOSGiTestSupport {
} else {
return composite(karafDistributionConfiguration()
.frameworkUrl(karafUrl)
- .karafVersion(getKarafVersion())
+ .karafVersion(karafVersion)
.name("Apache Karaf")
.useDeployFolder(false)
.unpackDirectory(new File("target/paxexam/")),
diff --git
a/services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/BasicSTSIntegrationTest.java
b/services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/BasicSTSIntegrationTest.java
index cf841c8..f6e5856 100644
---
a/services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/BasicSTSIntegrationTest.java
+++
b/services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/BasicSTSIntegrationTest.java
@@ -46,8 +46,8 @@ public class BasicSTSIntegrationTest {
public Option[] getConfig() {
String port = TestUtil.getPortNumber(BasicSTSIntegrationTest.class);
System.setProperty("BasicSTSIntegrationTest.PORT", port);
-
- String karafVersion = System.getProperty("karaf.version", "4.0.8");
+
+ String karafVersion = System.getProperty("karaf.version", "4.2.5");
String localRepository = System.getProperty("localRepository");
MavenArtifactUrlReference karafUrl = maven() //
@@ -84,13 +84,9 @@ public class BasicSTSIntegrationTest {
new VMOption("--add-exports=java.base/"
+ "org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
new VMOption("--patch-module"),
- new
VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
- + System.getProperty("karaf.version", "4.2.2")
- + ".jar"),
+ new
VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" +
karafVersion + ".jar"),
new VMOption("--patch-module"),
- new
VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
- + System.getProperty("karaf.version", "4.2.2")
- + ".jar"),
+ new
VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" +
karafVersion + ".jar"),
new VMOption("--add-opens"),
new VMOption("java.base/java.security=ALL-UNNAMED"),
new VMOption("--add-opens"), new
VMOption("java.base/java.net=ALL-UNNAMED"),
@@ -133,7 +129,7 @@ public class BasicSTSIntegrationTest {
}
}
- protected Option copy(String path) {
+ protected static Option copy(String path) {
return replaceConfigurationFile(path, new File("src/test/resources/" +
path));
}
diff --git
a/services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/unit/STSUnitTest.java
b/services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/unit/STSUnitTest.java
index af6d6f5..37bc6d6 100644
---
a/services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/unit/STSUnitTest.java
+++
b/services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/unit/STSUnitTest.java
@@ -18,6 +18,7 @@
*/
package org.apache.cxf.systest.sts.itests.unit;
+import java.io.InputStream;
import java.net.URISyntaxException;
import java.net.URL;
import java.util.HashMap;
@@ -41,11 +42,14 @@ import org.apache.wss4j.dom.handler.RequestData;
import org.apache.wss4j.dom.processor.Processor;
import org.apache.wss4j.dom.processor.SAMLTokenProcessor;
-import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.junit.PaxExam;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
/**
* Some tests to retrieve a SAML token directly from the STS.
*/
@@ -57,18 +61,6 @@ public class STSUnitTest extends BasicSTSIntegrationTest {
private static final String BEARER_KEYTYPE =
"http://docs.oasis-open.org/ws-sx/ws-trust/200512/Bearer";
- void waitForWSDL(String loc) throws Exception {
- URL url = new URL(loc + "?wsdl");
- for (int x = 0; x < 10; x++) {
- try {
- url.openStream().close();
- return;
- } catch (Throwable t) {
- Thread.sleep(100);
- }
- }
- }
-
@Test
public void testBearerSAML2Token() throws URISyntaxException, Exception {
Bus bus = BusFactory.getDefaultBus();
@@ -78,33 +70,45 @@ public class STSUnitTest extends BasicSTSIntegrationTest {
//sts could take a second or two to fully startup, make sure we can
get the wsdl
waitForWSDL(stsEndpoint);
-
+
// Get a token
SecurityToken token =
requestSecurityToken(SAML2_TOKEN_TYPE, BEARER_KEYTYPE, bus,
stsEndpoint);
- Assert.assertEquals(SAML2_TOKEN_TYPE, token.getTokenType());
- Assert.assertNotNull(token.getToken());
+ assertEquals(SAML2_TOKEN_TYPE, token.getTokenType());
+ assertNotNull(token.getToken());
// Process the token
List<WSSecurityEngineResult> results = processToken(token);
- Assert.assertTrue(results != null && results.size() == 1);
+ assertTrue(results != null && results.size() == 1);
SamlAssertionWrapper assertion =
(SamlAssertionWrapper)results.get(0).get(WSSecurityEngineResult.TAG_SAML_ASSERTION);
- Assert.assertNotNull(assertion);
- Assert.assertTrue(assertion.getSaml1() == null && assertion.getSaml2()
!= null);
- Assert.assertTrue(assertion.isSigned());
+ assertNotNull(assertion);
+ assertTrue(assertion.getSaml1() == null && assertion.getSaml2() !=
null);
+ assertTrue(assertion.isSigned());
List<String> methods = assertion.getConfirmationMethods();
String confirmMethod = null;
if (methods != null && !methods.isEmpty()) {
confirmMethod = methods.get(0);
}
- Assert.assertTrue(confirmMethod.contains("bearer"));
+ assertTrue(confirmMethod.contains("bearer"));
bus.shutdown(true);
}
+ private static void waitForWSDL(String loc) throws Exception {
+ final URL url = new URL(loc + "?wsdl");
+ for (int x = 0; x < 10; x++) {
+ try (InputStream is = url.openStream()) {
+ return;
+ } catch (Exception e) {
+ Thread.sleep(100L);
+ }
+ }
+ System.out.println("WARN: wsdl still unavailable!");
+ }
+
private SecurityToken requestSecurityToken(
String tokenType,
String keyType,
diff --git
a/services/xkms/xkms-itests/src/test/java/org/apache/cxf/xkms/itests/BasicIntegrationTest.java
b/services/xkms/xkms-itests/src/test/java/org/apache/cxf/xkms/itests/BasicIntegrationTest.java
index d3b78c5..4fc5144 100644
---
a/services/xkms/xkms-itests/src/test/java/org/apache/cxf/xkms/itests/BasicIntegrationTest.java
+++
b/services/xkms/xkms-itests/src/test/java/org/apache/cxf/xkms/itests/BasicIntegrationTest.java
@@ -65,7 +65,7 @@ public class BasicIntegrationTest {
System.setProperty("BasicIntegrationTest.PORT", port);
String xkmsEndpoint = "http://localhost:" + port + "/cxf/XKMS";
- String karafVersion = System.getProperty("karaf.version", "4.2.2");
+ String karafVersion = System.getProperty("karaf.version", "4.2.5");
String localRepository = System.getProperty("localRepository");
MavenArtifactUrlReference karafUrl = maven() //
.groupId("org.apache.karaf") //
@@ -117,13 +117,9 @@ public class BasicIntegrationTest {
new VMOption("--add-exports=java.base/"
+ "org.apache.karaf.specs.locator=java.xml,ALL-UNNAMED"),
new VMOption("--patch-module"),
- new
VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-"
- + System.getProperty("karaf.version", "4.2.2")
- + ".jar"),
+ new
VMOption("java.base=lib/endorsed/org.apache.karaf.specs.locator-" +
karafVersion + ".jar"),
new VMOption("--patch-module"),
- new
VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-"
- + System.getProperty("karaf.version", "4.2.2")
- + ".jar"),
+ new
VMOption("java.xml=lib/endorsed/org.apache.karaf.specs.java.xml-" +
karafVersion + ".jar"),
new VMOption("--add-opens"),
new VMOption("java.base/java.security=ALL-UNNAMED"),
new VMOption("--add-opens"), new
VMOption("java.base/java.net=ALL-UNNAMED"),
@@ -176,7 +172,7 @@ public class BasicIntegrationTest {
}
}
- protected Option copy(String path) {
+ protected static Option copy(String path) {
return replaceConfigurationFile(path, new File("src/test/resources/" +
path));
}