You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by dk...@apache.org on 2017/03/15 18:43:43 UTC

[1/4] cxf git commit: Update jetty session handling to support 9.4 (don't update to 9.4 due to atmosphere)

Repository: cxf
Updated Branches:
  refs/heads/3.1.x-fixes fdb31a753 -> addf51d4c


Update jetty session handling to support 9.4 (don't update to 9.4 due to atmosphere)

# Conflicts:
#	parent/pom.xml
#	rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/549a10c7
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/549a10c7
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/549a10c7

Branch: refs/heads/3.1.x-fixes
Commit: 549a10c78ec602ce19ae965aee504a1d91fd3f93
Parents: fdb31a7
Author: Daniel Kulp <dk...@apache.org>
Authored: Wed Mar 8 13:32:36 2017 -0500
Committer: Daniel Kulp <dk...@apache.org>
Committed: Wed Mar 15 14:03:04 2017 -0400

----------------------------------------------------------------------
 parent/pom.xml                                  |  5 ++-
 .../http_jetty/JettyHTTPServerEngine.java       | 38 +++++++++++++-------
 2 files changed, 30 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/549a10c7/parent/pom.xml
----------------------------------------------------------------------
diff --git a/parent/pom.xml b/parent/pom.xml
index 692e15c..7ef8437 100644
--- a/parent/pom.xml
+++ b/parent/pom.xml
@@ -121,8 +121,11 @@
         <cxf.jettison.version>1.3.8</cxf.jettison.version>
         <cxf.jetty8.version>8.1.19.v20160209</cxf.jetty8.version>
         <cxf.jetty9.version>9.2.21.v20170120</cxf.jetty9.version>
+        <!-- Jetty 9.3.15+ and 9.4.x break atmosphere, don't upgrade until new version of
+             atmosphere is available -->
+        <!--cxf.jetty9.version>9.3.16.v20170120</cxf.jetty9.version-->
         <cxf.jetty.version>${cxf.jetty9.version}</cxf.jetty.version>
-        <cxf.jetty.osgi.version>[8.1,9.4)</cxf.jetty.osgi.version>
+        <cxf.jetty.osgi.version>[8.1,9.5)</cxf.jetty.osgi.version>
         <cxf.jibx.version>1.2.6</cxf.jibx.version>
         <cxf.junit.version>4.12</cxf.junit.version>
         <cxf.hamcrest.version>1.3</cxf.hamcrest.version>

http://git-wip-us.apache.org/repos/asf/cxf/blob/549a10c7/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
----------------------------------------------------------------------
diff --git a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
index 3fa8607..4afcaf5 100644
--- a/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
+++ b/rt/transports/http-jetty/src/main/java/org/apache/cxf/transport/http_jetty/JettyHTTPServerEngine.java
@@ -22,6 +22,7 @@ package org.apache.cxf.transport.http_jetty;
 import java.io.Closeable;
 import java.io.IOException;
 import java.io.Writer;
+import java.lang.reflect.Method;
 import java.net.URL;
 import java.security.GeneralSecurityException;
 import java.util.ArrayList;
@@ -44,6 +45,7 @@ import org.apache.cxf.common.classloader.ClassLoaderUtils;
 import org.apache.cxf.common.i18n.Message;
 import org.apache.cxf.common.logging.LogUtils;
 import org.apache.cxf.common.util.PropertyUtils;
+import org.apache.cxf.common.util.ReflectionUtil;
 import org.apache.cxf.common.util.StringUtils;
 import org.apache.cxf.common.util.SystemPropertyAction;
 import org.apache.cxf.configuration.jsse.SSLUtils;
@@ -59,14 +61,11 @@ import org.eclipse.jetty.server.Handler;
 import org.eclipse.jetty.server.Request;
 import org.eclipse.jetty.server.Response;
 import org.eclipse.jetty.server.Server;
-import org.eclipse.jetty.server.SessionManager;
 import org.eclipse.jetty.server.handler.ContextHandler;
 import org.eclipse.jetty.server.handler.ContextHandlerCollection;
 import org.eclipse.jetty.server.handler.DefaultHandler;
 import org.eclipse.jetty.server.handler.ErrorHandler;
 import org.eclipse.jetty.server.handler.HandlerCollection;
-import org.eclipse.jetty.server.session.HashSessionIdManager;
-import org.eclipse.jetty.server.session.HashSessionManager;
 import org.eclipse.jetty.server.session.SessionHandler;
 import org.eclipse.jetty.util.component.Container;
 import org.eclipse.jetty.util.ssl.SslContextFactory;
@@ -112,7 +111,7 @@ public class JettyHTTPServerEngine implements ServerEngine {
     private List<Handler> handlers;
     private ContextHandlerCollection contexts;
     private Container.Listener mBeanContainer;
-    private SessionManager sessionManager;
+    private SessionHandler sessionHandler;
     private ThreadPool threadPool;
     
     
@@ -496,19 +495,34 @@ public class JettyHTTPServerEngine implements ServerEngine {
         // bind the jetty http handler with the context handler
         if (isSessionSupport) {         
             // If we have sessions, we need two handlers.
-            if (sessionManager == null) {
-                sessionManager = new HashSessionManager();
-                HashSessionIdManager idManager = new HashSessionIdManager();
-                sessionManager.setSessionIdManager(idManager);
+            SessionHandler sh = null;
+            if (Server.getVersion().startsWith("9.2") 
+                || Server.getVersion().startsWith("9.3")) {
+                if (sessionHandler == null) {
+                    sessionHandler = new SessionHandler();
+                }
+                sh = new SessionHandler();
+                try {
+                    Method get = ReflectionUtil.getDeclaredMethod(SessionHandler.class, "getSessionManager");
+                    Method set = ReflectionUtil.getDeclaredMethod(SessionHandler.class, 
+                                                                  "setSessionManager", 
+                                                                  get.getReturnType());
+                    ReflectionUtil.setAccessible(set)
+                        .invoke(sh, ReflectionUtil.setAccessible(get).invoke(sessionHandler));
+                } catch (Throwable t) {
+                    //ignore, just use the new session manager
+                }
+            } else {
+                //9.4+ stores the session id handling and cache and everything on the server, just need the handler
+                sh = new SessionHandler();
             }
-            SessionHandler sessionHandler = new SessionHandler(sessionManager);
             if (securityHandler != null) {
                 //use the securityHander which already wrap the jetty http handler
-                sessionHandler.setHandler(securityHandler);
+                sh.setHandler(securityHandler);
             } else {
-                sessionHandler.setHandler(handler);
+                sh.setHandler(handler);
             }
-            context.setHandler(sessionHandler);
+            context.setHandler(sh);
         } else {
             // otherwise, just the one.
             if (securityHandler != null) {


[4/4] cxf git commit: Recording .gitmergeinfo Changes

Posted by dk...@apache.org.
Recording .gitmergeinfo Changes


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/addf51d4
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/addf51d4
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/addf51d4

Branch: refs/heads/3.1.x-fixes
Commit: addf51d4c6edbbf457d25a1c555f9b2eedf235f1
Parents: 76e415b
Author: Daniel Kulp <dk...@apache.org>
Authored: Wed Mar 15 14:06:35 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Wed Mar 15 14:07:19 2017 -0400

----------------------------------------------------------------------
 .gitmergeinfo | 23 +++++++++++++++++++++++
 1 file changed, 23 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/addf51d4/.gitmergeinfo
----------------------------------------------------------------------
diff --git a/.gitmergeinfo b/.gitmergeinfo
index 706986c..529e081 100644
--- a/.gitmergeinfo
+++ b/.gitmergeinfo
@@ -13,6 +13,7 @@ B 052582d56a99d96773dffcc8d83e96c26030e7c3
 B 057b2a6d5d85285446ff762bd3451a0e3e945d7a
 B 06bfa1334e86ebcf8e19974708d4aa165296edb9
 B 08e8316aa5c575d6117d20c4054405e1ea0e2887
+B 09893c1747d823b3456a28fc49468ed91e456f2d
 B 09a3b58100c04cacf755509a0160ba01bbce769a
 B 0af65a4ab3ef2c31b9e88d34ddfbb05c79f0f50c
 B 0d4cd0bbcaa6a4f80552d6b38f2a5e721ab20de9
@@ -89,6 +90,7 @@ B 4a30203a08ea11f96b52b454220ed5ce9419e3be
 B 4a72362668b14f92f1a0252b723436fc86b681bf
 B 4b37844e9c15812d1855d0babded79880d2cd6fb
 B 4bf780105271e91451446a2d96032249486b32de
+B 4bfd87f8d3d07161606428463934cc4a95ea5ce9
 B 4dd4e1cf0d517021fd65ffe219a9be6c9f75c84a
 B 4ddf74b1acd8f65b685c8e11b809a06807799f84
 B 4ea19d64741fbb5fddf7b7e09fab3b33f72f88c7
@@ -101,11 +103,13 @@ B 53a46205871434d8c47ed45822e078e5ad6d2c60
 B 540a1255be34c047c094f53461925d46c3ed058b
 B 54910695917fb63a11982a8dc96a3b4d088963c5
 B 54b71171e89bb1be7d169ac91bb626c9c1ca293b
+B 54e7c58d5449d5f91879674598fe1b1ee339a272
 B 56dab42caaf27e3bedf08cbb419d3644aeccb7af
 B 573405dd523139bb935339b89c28f849676da727
 B 57cb5447341949836b7d8cc8f00ca3ced68622f1
 B 584df3ae111595da1b44ccd9db9567c2172bbb2e
 B 58b379bdf8cce2434f6033e2d7adab944afff05b
+B 5914df9550b9ed2d84afb5b6d2f36ad71ec8f675
 B 59436eadca147ba937a24a4f4fc6ced93cc0bc7f
 B 59b8615053ddcad353fbebcd9a5b1109ae0897a1
 B 59b972618b40c5dbaca2772673ded17c5273e7d2
@@ -160,6 +164,7 @@ B 8a4e85b24d6d5b438ceb28257c53773d46b5816d
 B 8b86ab84acd8e5d11b9a2f3a960f1c40ba7d4bdb
 B 8b92fe57dd9a661dab382da7d556b1972f513a93
 B 8cea7c879658e83d7a4f54f6d4e8dfa0e449c67d
+B 8e769d46b1a1bcc27da0740f23020a2776aff6e5
 B 8e7d8e18e820dcaef748c2cab6091f884fe647a4
 B 8f98be8e72d4dbe18347a7efab91f4b008d8385f
 B 90a74fc75af41898ee50359c13f298eb483a3d01
@@ -192,6 +197,7 @@ B a93cbfd994c34000f27911c5aab6638b60d61ff7
 B a998152a243dabee50aa49f28d76037666adecd9
 B aa5cb3f487fce03a0c069ae4bd33fae82be1e8b3
 B ab05d4ee361670d3c251712f5819a0f0b7e114d6
+B abfd5936fee6562b1b5c49d7522f0975390bcfed
 B adcfa17d94da4b27deb8ba952d0bd4dcfcf6972b
 B ae83629e6291538e72d300fb35d7f6df7cf064a1
 B aed1b1d45ea12b1b1a7f083f756c27ed914ad9b7
@@ -211,7 +217,9 @@ B bceee342b32f3704ca75176d06067f90c6d3fbdc
 B bd24e7efd7f8f4258e8fde99eb63e007378048f0
 B bd8aff6652eef048513571b96c703f4333f24dfb
 B bd95151baf5368295db6bf9798d106d89f2f8a60
+B be6190da7b0a05c505c99668270c993cd94a0eb2
 B befeb0484cb195cbcd6163f65c54a94ba26d8335
+B bfa7a22c95af1f7c33f218d0cf5b10f17fce308c
 B bff51a63aa05df40f92c80bb940fb43af78653f2
 B c0e79369faa3acbca703f9ae93d63da1bd216e5c
 B c194254d62b2d89a58fbd77c287b4bb106caa61d
@@ -255,6 +263,7 @@ B de61a48bf953950e16d67038247903b747c4e7ae
 B de675431040a434c2bd1ef66667472fb4a49a9ab
 B dfc84b0fac84e001069800b32f01529d50339cdb
 B e14d803ff84be7c59dd7c2321f1090231967d45c
+B e18b4fb7d5f4f585eea1a2637c5158cd6e0c61af
 B e1c60863ac10b56d423613c7d3d2f45c7ce18e14
 B e1d950605941ef77bd4a3e9e4ad47eb63ac8f221
 B e2efd0386e210d162c7646f4a4f2aa15e9752924
@@ -268,6 +277,7 @@ B e7895d6a7cb071fdea57f6d2607dabe2d22db47f
 B e7e75c58c283d0178c6929cf298a68f41f6a8459
 B e824784db1bda81c68aaa407f471588acea38865
 B e856de5370025ec6f897ef214e7f898fd8cb6756
+B e90f3dd6422fa059ebea4c92763c73c8685e185e
 B e9b997e808857cda15f428aed8a78ea8d1856db7
 B e9e1fbe33658421590ec149b0f82c12d2fed2c53
 B ea458d27bdbd30b0b3ef785d18e45ddf2a75b74a
@@ -289,7 +299,9 @@ B f2db225034f82e93617aa8aece8bf059b8758626
 B f2f8b95ad823b38aa68e7a2071eac0b5b637b2aa
 B f2fe6260e87fc71e43075730bee99cf564d2711a
 B f3bb66deb0757478a33e0c3609428e7450cf3edb
+B f51d7557791a6d3ae0bcf7f81ceda30a2c0029d3
 B f66dea949bdc3f136084115aca4e514bad426380
+B f6ce97d4d38446c8336f6f713d0306d52edf6086
 B f94e1dd9b2a8d27ec5a27bfb7c026e3ae2350e39
 B f98785bd8490c4717353f1a9688cae3e7a823ec2
 B fb11380da6e5c157ffd311c2925eb533d134c8cb
@@ -330,6 +342,7 @@ M 2b1607831ccf97909122eae9247116d9a075c7cf
 M 2e8219cf3d047abc3a7e2611bf284aadbc20b7d6
 M 2f8a1f7645c30cb40d4f080ce4b4099964028751
 M 2f981e098ea265ab504496fbf9ce4564c894bc19
+M 3088952a6e3385ee628cf8c91340908ed3a67aa3
 M 315a6dc119f7bf0ad1f8f8ee74093327852dc365
 M 34fd320f91d933233aeb364120456f4fa0f220ac
 M 366a556210a1a7b047c4b4dd8da4fc74af6bd301
@@ -340,6 +353,7 @@ M 3be9aac26a003ef43995054da875ffd5fa5a2eb4
 M 3e30d8892a723adcf04268efd7d407e164607065
 M 437c7daa3345c8482deab4a4da9b164e68fd417a
 M 45d54d558625236b84752b0d7976f0cf85518c16
+M 4719a033d54fd9fcd173be273e6c320d8353b631
 M 47691ae5c2c6528d95795a51e98e02b54a033c88
 M 4799fef822a96f5d1b2827d5cc42ab886fd4e673
 M 4837a6cb5ea319f6bf87aaf3bf49c1e4e99e45a7
@@ -360,10 +374,13 @@ M 6becb31c62ef0845a5078f4ec2124fe7bc264e58
 M 6d7985f39b83d28b0ca3e485be8de8f986d6f6c1
 M 7304dfbd8f3044d8d46981abf2058c6cb732d219
 M 746914a5084f5db8d0c0f052802c7ef2217b9b6b
+M 74b8db2dcc5fc60a513d9e73e258aeba99727a39
 M 7690a1fd087aff24ad8e8e1ab2e0722e24bf3d81
 M 7ace8c84cff4696e365800fbba12cc789e97971f
 M 7c3a8b02a62db3bcc5c3a1895e9f30bc4fa3821a
+M 7dbb31aed4bfa28bd170d6170d76ba4d7f43e7de
 M 7e952df66b6ede5c8084aa3387f82224ef04e1ea
+M 7fa67da1925e0a526730e6f83415a0826c72b1d4
 M 804a957eb4225a1eaf65399881cdcd8552c00f52
 M 80ca2370616c28b036c54c95af84ca62f1725a30
 M 8118c5a301f22dea16c9d235ad378584a0ae2466
@@ -374,6 +391,7 @@ M 8583a24ac541dc373503d7a6c59cd90890acdae3
 M 86667619dc61c8a84672fc5a583b4517f48176c5
 M 896f1abec915897967905762d6e850cfb6bac3bc
 M 8aebfa30047f32e3a6b4feb7ffdd89208ec4f435
+M 8c6401b76ca76010e7e169656fd2f5fae6f3245a
 M 8dadf3defb43d13169943b191204be93da63c88b
 M 8e131133c8566a124605cb06e0b6db98fddb5972
 M 8e650cfe3efd63a06c25b7e912d9d4db61598eb1
@@ -384,6 +402,7 @@ M 8fc9d782901adddf874fe7c2f9500836a0585707
 M 910f37767518832cce843c2a093ee833b7c48916
 M 91bb2a18f4653f997e455c5089e7a009310591c6
 M 939a75d9d3dbfbe37ead5ca41e5e53727dc40b40
+M 94060fc026b3b7214337c9fcfce71c06f0fb4444
 M 955fd4b7fee79642934a828b7758ce14f783364a
 M 9a9e0a8a37608195c4ef6fbf386728d13d025d2d
 M 9b2bda583c09861c693122ab631c4bffa2187ddd
@@ -396,6 +415,7 @@ M a1710bdd783afcd667d9e72ccb031480d3806850
 M a2cbe758286d00b5c5d9c5fbe6be4cc9d7ecf225
 M a644c5d06c0bae321e2c669efa0cecf3abdd944d
 M a89ca98653b95bcd2ab5cadbe9a419a4cec4893a
+M a93f0d9ad891865cc635a961cb890c2031177e5b
 M a9fe8470ce9522f08c298e58f76636c48d57b7a4
 M abcc137cb9b27e0da0b4270a18ac2a32df1e9990
 M ad18f5aef28eb82d613b3f4226b2ddae19b6415f
@@ -416,7 +436,10 @@ M c7d50ca238184789412737ea0f0db4b5b5503326
 M c87613b800a5b2de25d861c3c74a0fb7dcf60862
 M c9875c223627a17f7d8128632b25bdf6bf148918
 M cbd4e7fa6b3e15d39f12d39a448ee3742d5d3efe
+M cd782fef123d2147a6f5cb04fb6cdfe8cf0ac81a
+M cf806d5cba74e47c6e5ba3231df4228cbaad3e90
 M cf8ac102e728b8745da265ec969f7b5160829fdb
+M d0821bce5faa119c882a9000dbe03a124df5b033
 M d187ef6f3906d867a8c30a991d9074d170bca487
 M d46818bd3043d211774de9bc531849f54bb2989f
 M db1e5146e6312a4be35b0ca2644a691cb1d41a0f


[2/4] cxf git commit: [CXF-6778] Also cache and compare session to avoid stale Destination

Posted by dk...@apache.org.
[CXF-6778] Also cache and compare session to avoid stale Destination

# Conflicts:
#	rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/171feb80
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/171feb80
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/171feb80

Branch: refs/heads/3.1.x-fixes
Commit: 171feb8042756c2946435448fbf13605470958d3
Parents: 549a10c
Author: Christian Schneider <ch...@die-schneider.net>
Authored: Tue Mar 14 12:10:58 2017 +0100
Committer: Daniel Kulp <dk...@apache.org>
Committed: Wed Mar 15 14:04:52 2017 -0400

----------------------------------------------------------------------
 .../cxf/transport/jms/JMSConfiguration.java     | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/171feb80/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
----------------------------------------------------------------------
diff --git a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
index 6269da6..9fe0427 100644
--- a/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
+++ b/rt/transports/jms/src/main/java/org/apache/cxf/transport/jms/JMSConfiguration.java
@@ -76,6 +76,12 @@ public class JMSConfiguration {
      */
     private String replyToDestination;
     private volatile Destination replyToDestinationDest;
+    
+    /**
+     * Session that was used to cache the replyToDestinationDest
+     */
+    private volatile Session replyDestinationSession;
+    
     private String messageType = JMSConstants.TEXT_MESSAGE_TYPE;
     private boolean pubSubDomain;
     private boolean replyPubSubDomain;
@@ -95,8 +101,6 @@ public class JMSConfiguration {
     private String targetService;
     private String requestURI;
 
-
-
     public void ensureProperlyConfigured() {
         ConnectionFactory cf = getConnectionFactory();
         if (cf == null) {
@@ -441,19 +445,17 @@ public class JMSConfiguration {
     }
 
     public Destination getReplyDestination(Session session) throws JMSException {
-        Destination result = replyDestinationDest;
-        if (result == null) {
+        if (this.replyDestinationDest == null || this.replyDestinationSession == null) {
             synchronized (this) {
-                result = replyDestinationDest;
-                if (result == null) {
-                    result = replyDestination == null 
+                if (this.replyDestinationDest == null || this.replyDestinationSession == null) {
+                    this.replyDestinationDest = replyDestination == null
                         ? session.createTemporaryQueue()
                         : destinationResolver.resolveDestinationName(session, replyDestination, replyPubSubDomain);
-                    replyDestinationDest = result;
+                    this.replyDestinationSession = session;
                 }
             }
         }
-        return result;
+        return this.replyDestinationDest;
     }
 
     public Destination getTargetDestination(Session session) throws JMSException {


[3/4] cxf git commit: Use a random port for the sts tests

Posted by dk...@apache.org.
Use a random port for the sts tests

# Conflicts:
#	services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/BasicSTSIntegrationTest.java
#	services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/unit/STSUnitTest.java


Project: http://git-wip-us.apache.org/repos/asf/cxf/repo
Commit: http://git-wip-us.apache.org/repos/asf/cxf/commit/76e415b0
Tree: http://git-wip-us.apache.org/repos/asf/cxf/tree/76e415b0
Diff: http://git-wip-us.apache.org/repos/asf/cxf/diff/76e415b0

Branch: refs/heads/3.1.x-fixes
Commit: 76e415b00a35a66b2254114b102b4259886f10cf
Parents: 171feb8
Author: Daniel Kulp <dk...@apache.org>
Authored: Wed Mar 15 11:55:44 2017 -0400
Committer: Daniel Kulp <dk...@apache.org>
Committed: Wed Mar 15 14:06:03 2017 -0400

----------------------------------------------------------------------
 services/sts/systests/sts-itests/pom.xml        |  6 +++++
 .../sts/itests/BasicSTSIntegrationTest.java     | 12 +++++-----
 .../systest/sts/itests/unit/STSUnitTest.java    | 23 ++++++++++++++++++--
 3 files changed, 34 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cxf/blob/76e415b0/services/sts/systests/sts-itests/pom.xml
----------------------------------------------------------------------
diff --git a/services/sts/systests/sts-itests/pom.xml b/services/sts/systests/sts-itests/pom.xml
index 037d5cb..e16ad5e 100644
--- a/services/sts/systests/sts-itests/pom.xml
+++ b/services/sts/systests/sts-itests/pom.xml
@@ -97,6 +97,12 @@
             <groupId>org.slf4j</groupId>
             <artifactId>slf4j-jdk14</artifactId>
         </dependency>
+        <dependency>
+            <groupId>org.apache.cxf</groupId>
+            <artifactId>cxf-testutils</artifactId>
+            <version>${project.version}</version>
+            <scope>test</scope>
+        </dependency>
     </dependencies>
     <build>
         <plugins>

http://git-wip-us.apache.org/repos/asf/cxf/blob/76e415b0/services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/BasicSTSIntegrationTest.java
----------------------------------------------------------------------
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 f9f0768..8330f58 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
@@ -20,6 +20,7 @@ package org.apache.cxf.systest.sts.itests;
 
 import java.io.File;
 
+import org.apache.cxf.testutil.common.TestUtil;
 import org.ops4j.pax.exam.Configuration;
 import org.ops4j.pax.exam.Option;
 import org.ops4j.pax.exam.options.MavenArtifactUrlReference;
@@ -38,12 +39,12 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.replaceCo
 @ExamReactorStrategy(PerClass.class)
 public class BasicSTSIntegrationTest {
 
-    protected static final String HTTP_PORT = "9191";
-    protected static final String STS_ENDPOINT = "http://localhost:" + HTTP_PORT + "/cxf/X509";
-
     @Configuration
     public Option[] getConfig() {
         String karafVersion = System.getProperty("karaf.version", "3.0.4");
+        String port = TestUtil.getPortNumber(BasicSTSIntegrationTest.class);
+        System.setProperty("BasicSTSIntegrationTest.PORT", port);
+        
         String localRepository = System.getProperty("localRepository");
         
         MavenArtifactUrlReference karafUrl = maven() //
@@ -61,17 +62,18 @@ public class BasicSTSIntegrationTest {
             karafDistributionConfiguration().frameworkUrl(karafUrl).karafVersion(karafVersion)
                 .unpackDirectory(new File("target/paxexam/unpack/")).useDeployFolder(false),
             systemProperty("java.awt.headless").value("true"),
+            systemProperty("BasicSTSIntegrationTest.PORT").value(port),
 
             copy("clientKeystore.properties"),
             copy("clientstore.jks"),
             copy("etc/org.ops4j.pax.logging.cfg"),
-            editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", HTTP_PORT),
+            editConfigurationFilePut("etc/org.ops4j.pax.web.cfg", "org.osgi.service.http.port", port),
             when(localRepository != null)
                 .useOptions(editConfigurationFilePut("etc/org.ops4j.pax.url.mvn.cfg",
                             "org.ops4j.pax.url.mvn.localRepository",
                             localRepository)),
             features(stsFeatures, "cxf-sts-service"),
-            configureConsole().ignoreLocalConsole(),
+            configureConsole().ignoreLocalConsole().ignoreRemoteShell(),
         };
     }
 

http://git-wip-us.apache.org/repos/asf/cxf/blob/76e415b0/services/sts/systests/sts-itests/src/test/java/org/apache/cxf/systest/sts/itests/unit/STSUnitTest.java
----------------------------------------------------------------------
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 7fdb04f..24a400a 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
@@ -19,6 +19,7 @@
 package org.apache.cxf.systest.sts.itests.unit;
 
 import java.net.URISyntaxException;
+import java.net.URL;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
@@ -54,14 +55,32 @@ public class STSUnitTest extends BasicSTSIntegrationTest {
         "http://docs.oasis-open.org/wss/oasis-wss-saml-token-profile-1.1#SAMLV2.0";
     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();
+        String stsEndpoint = "http://localhost:" 
+            + System.getProperty("BasicSTSIntegrationTest.PORT")
+            + "/cxf/X509";
 
+        //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, STS_ENDPOINT);
+        SecurityToken token =
+            requestSecurityToken(SAML2_TOKEN_TYPE, BEARER_KEYTYPE, bus, stsEndpoint);
         Assert.assertTrue(SAML2_TOKEN_TYPE.equals(token.getTokenType()));
         Assert.assertTrue(token.getToken() != null);