[1/4] cxf git commit: Improve testing of STS intermediary caching

2017-05-24 Thread coheigea
Repository: cxf
Updated Branches:
  refs/heads/3.0.x-fixes 310e52e97 -> f285e3808


Improve testing of STS intermediary caching

# Conflicts:
#   
services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java
#   
services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java


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

Branch: refs/heads/3.0.x-fixes
Commit: 8ae9c20a32b0e654fa52bca6e5646e32302e71a6
Parents: 310e52e
Author: Colm O hEigeartaigh 
Authored: Wed May 24 17:52:06 2017 +0100
Committer: Colm O hEigeartaigh 
Committed: Wed May 24 18:06:50 2017 +0100

--
 .../DoubleItPortTypeImpl.java   | 70 
 .../IntermediaryCachingPortTypeImpl.java|  6 +-
 .../IntermediaryTransformationCachingTest.java  | 62 ++---
 .../cxf-intermediary-caching.xml|  4 --
 .../intermediary_transformation/cxf-service.xml |  3 +-
 5 files changed, 113 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/8ae9c20a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
--
diff --git 
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
 
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
new file mode 100644
index 000..42c02f5
--- /dev/null
+++ 
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
@@ -0,0 +1,70 @@
+/**
+ * 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.systest.sts.intermediary_transformation;
+
+import java.security.Principal;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.feature.Features;
+import org.example.contract.doubleit.DoubleItPortType;
+import org.junit.Assert;
+
+@WebService(targetNamespace = "http://www.example.org/contract/DoubleIt;,
+serviceName = "DoubleItService",
+endpointInterface = 
"org.example.contract.doubleit.DoubleItPortType")
+@Features(features = "org.apache.cxf.feature.LoggingFeature")
+/**
+ * A PortType implementation that only allows a user call it twice. This is to 
test the caching logic
+ * of the intermediary.
+ */
+public class DoubleItPortTypeImpl implements DoubleItPortType {
+
+@Resource
+WebServiceContext wsContext;
+
+private Map userCount = new ConcurrentHashMap<>();
+
+public int doubleIt(int numberToDouble) {
+Principal pr = wsContext.getUserPrincipal();
+
+Assert.assertNotNull("Principal must not be null", pr);
+Assert.assertNotNull("Principal.getName() must not return null", 
pr.getName());
+
+// Test caching logic here
+updateCache(pr.getName());
+
+return numberToDouble * 2;
+}
+
+private void updateCache(String user) {
+if (userCount.containsKey(user)) {
+if (userCount.get(user) > 2) {
+throw new RuntimeException("Only two iterations allowed");
+}
+userCount.put(user, userCount.get(user) + 1);
+} else {
+userCount.put(user, 1);
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/8ae9c20a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java

[2/2] cxf git commit: Improve testing of STS intermediary caching

2017-05-24 Thread coheigea
Improve testing of STS intermediary caching

# Conflicts:
#   
services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java
#   
services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryTransformationCachingTest.java


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

Branch: refs/heads/3.1.x-fixes
Commit: b87d708115d8b3ee47020939ddbf7f7d37860aae
Parents: 6c70b02
Author: Colm O hEigeartaigh 
Authored: Wed May 24 17:52:06 2017 +0100
Committer: Colm O hEigeartaigh 
Committed: Wed May 24 17:53:31 2017 +0100

--
 .../DoubleItPortTypeImpl.java   | 70 
 .../IntermediaryCachingPortTypeImpl.java|  6 +-
 .../IntermediaryTransformationCachingTest.java  | 62 ++---
 .../cxf-intermediary-caching.xml|  4 --
 .../intermediary_transformation/cxf-service.xml |  3 +-
 5 files changed, 113 insertions(+), 32 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/b87d7081/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
--
diff --git 
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
 
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
new file mode 100644
index 000..42c02f5
--- /dev/null
+++ 
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
@@ -0,0 +1,70 @@
+/**
+ * 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.systest.sts.intermediary_transformation;
+
+import java.security.Principal;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.feature.Features;
+import org.example.contract.doubleit.DoubleItPortType;
+import org.junit.Assert;
+
+@WebService(targetNamespace = "http://www.example.org/contract/DoubleIt;,
+serviceName = "DoubleItService",
+endpointInterface = 
"org.example.contract.doubleit.DoubleItPortType")
+@Features(features = "org.apache.cxf.feature.LoggingFeature")
+/**
+ * A PortType implementation that only allows a user call it twice. This is to 
test the caching logic
+ * of the intermediary.
+ */
+public class DoubleItPortTypeImpl implements DoubleItPortType {
+
+@Resource
+WebServiceContext wsContext;
+
+private Map userCount = new ConcurrentHashMap<>();
+
+public int doubleIt(int numberToDouble) {
+Principal pr = wsContext.getUserPrincipal();
+
+Assert.assertNotNull("Principal must not be null", pr);
+Assert.assertNotNull("Principal.getName() must not return null", 
pr.getName());
+
+// Test caching logic here
+updateCache(pr.getName());
+
+return numberToDouble * 2;
+}
+
+private void updateCache(String user) {
+if (userCount.containsKey(user)) {
+if (userCount.get(user) > 2) {
+throw new RuntimeException("Only two iterations allowed");
+}
+userCount.put(user, userCount.get(user) + 1);
+} else {
+userCount.put(user, 1);
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/b87d7081/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java
--
diff --git 

cxf git commit: Improve testing of STS intermediary caching

2017-05-24 Thread coheigea
Repository: cxf
Updated Branches:
  refs/heads/master c255034b2 -> 07093d2f5


Improve testing of STS intermediary caching


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

Branch: refs/heads/master
Commit: 07093d2f50f8e37b10b45f5e24e4b1e71dec352e
Parents: c255034
Author: Colm O hEigeartaigh 
Authored: Wed May 24 17:52:06 2017 +0100
Committer: Colm O hEigeartaigh 
Committed: Wed May 24 17:52:06 2017 +0100

--
 .../DoubleItPortTypeImpl.java   | 70 
 .../IntermediaryCachingPortTypeImpl.java|  4 +-
 .../IntermediaryTransformationCachingTest.java  | 49 +-
 .../cxf-intermediary-caching.xml|  4 --
 .../intermediary_transformation/cxf-service.xml |  3 +-
 5 files changed, 106 insertions(+), 24 deletions(-)
--


http://git-wip-us.apache.org/repos/asf/cxf/blob/07093d2f/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
--
diff --git 
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
 
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
new file mode 100644
index 000..42c02f5
--- /dev/null
+++ 
b/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/DoubleItPortTypeImpl.java
@@ -0,0 +1,70 @@
+/**
+ * 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.systest.sts.intermediary_transformation;
+
+import java.security.Principal;
+import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+
+import javax.annotation.Resource;
+import javax.jws.WebService;
+import javax.xml.ws.WebServiceContext;
+
+import org.apache.cxf.feature.Features;
+import org.example.contract.doubleit.DoubleItPortType;
+import org.junit.Assert;
+
+@WebService(targetNamespace = "http://www.example.org/contract/DoubleIt;,
+serviceName = "DoubleItService",
+endpointInterface = 
"org.example.contract.doubleit.DoubleItPortType")
+@Features(features = "org.apache.cxf.feature.LoggingFeature")
+/**
+ * A PortType implementation that only allows a user call it twice. This is to 
test the caching logic
+ * of the intermediary.
+ */
+public class DoubleItPortTypeImpl implements DoubleItPortType {
+
+@Resource
+WebServiceContext wsContext;
+
+private Map userCount = new ConcurrentHashMap<>();
+
+public int doubleIt(int numberToDouble) {
+Principal pr = wsContext.getUserPrincipal();
+
+Assert.assertNotNull("Principal must not be null", pr);
+Assert.assertNotNull("Principal.getName() must not return null", 
pr.getName());
+
+// Test caching logic here
+updateCache(pr.getName());
+
+return numberToDouble * 2;
+}
+
+private void updateCache(String user) {
+if (userCount.containsKey(user)) {
+if (userCount.get(user) > 2) {
+throw new RuntimeException("Only two iterations allowed");
+}
+userCount.put(user, userCount.get(user) + 1);
+} else {
+userCount.put(user, 1);
+}
+}
+}

http://git-wip-us.apache.org/repos/asf/cxf/blob/07093d2f/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java
--
diff --git 
a/services/sts/systests/basic/src/test/java/org/apache/cxf/systest/sts/intermediary_transformation/IntermediaryCachingPortTypeImpl.java