You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cxf.apache.org by co...@apache.org on 2020/10/06 06:57:20 UTC
[cxf-fediz] branch master updated: FEDIZ-252 - Adding tests
This is an automated email from the ASF dual-hosted git repository.
coheigea pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cxf-fediz.git
The following commit(s) were added to refs/heads/master by this push:
new 2db1ba2 FEDIZ-252 - Adding tests
2db1ba2 is described below
commit 2db1ba237a14440fc3247e8dcb93b9d82a948c4f
Author: Colm O hEigeartaigh <co...@apache.org>
AuthorDate: Tue Oct 6 07:56:55 2020 +0100
FEDIZ-252 - Adding tests
---
.../cxf/fediz/core/config/CallbackHandlerTest.java | 35 +++++++++++++++-------
1 file changed, 25 insertions(+), 10 deletions(-)
diff --git a/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/CallbackHandlerTest.java b/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/CallbackHandlerTest.java
index fbc66dd..92b58bd 100644
--- a/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/CallbackHandlerTest.java
+++ b/plugins/core/src/test/java/org/apache/cxf/fediz/core/config/CallbackHandlerTest.java
@@ -174,13 +174,13 @@ public class CallbackHandlerTest {
tokenRequest.setType(ArgumentType.STRING);
tokenRequest.setValue(TestCallbackHandler.TEST_WREQ);
((FederationProtocolType)protocol).setRequest(tokenRequest);
-
- CallbackType signInQueryType = new CallbackType();
- signInQueryType.setType(ArgumentType.STRING);
- signInQueryType.setValue(TEST_SIGNIN_QUERY);
- ((FederationProtocolType)protocol).setSignInQuery(signInQueryType);
}
+ CallbackType signInQueryType = new CallbackType();
+ signInQueryType.setType(ArgumentType.STRING);
+ signInQueryType.setValue(TEST_SIGNIN_QUERY);
+ protocol.setSignInQuery(signInQueryType);
+
return config;
}
@@ -215,17 +215,17 @@ public class CallbackHandlerTest {
tokenRequest.setValue(CALLBACKHANDLER_CLASS);
((FederationProtocolType)protocol).setRequest(tokenRequest);
- CallbackType signInQueryType = new CallbackType();
- signInQueryType.setType(ArgumentType.CLASS);
- signInQueryType.setValue(CALLBACKHANDLER_CLASS);
- ((FederationProtocolType)protocol).setSignInQuery(signInQueryType);
-
CallbackType replyType = new CallbackType();
replyType.setType(ArgumentType.CLASS);
replyType.setValue(CALLBACKHANDLER_CLASS);
((FederationProtocolType)protocol).setReply(replyType);
}
+ CallbackType signInQueryType = new CallbackType();
+ signInQueryType.setType(ArgumentType.CLASS);
+ signInQueryType.setValue(CALLBACKHANDLER_CLASS);
+ protocol.setSignInQuery(signInQueryType);
+
return config;
}
@@ -328,6 +328,16 @@ public class CallbackHandlerTest {
issuerCB.handle(new Callback[] {callbackIDP});
String issuerURL = callbackIDP.getIssuerUrl().toString();
Assert.assertEquals(TestCallbackHandler.TEST_IDP, issuerURL);
+
+ Object signInQueryObj = protocol.getSignInQuery();
+ Assert.assertTrue(signInQueryObj instanceof CallbackHandler);
+ CallbackHandler siqCB = (CallbackHandler)signInQueryObj;
+ SignInQueryCallback callbackSIQ = new SignInQueryCallback(null);
+ siqCB.handle(new Callback[] {callbackSIQ});
+ Map<String, String> signinQueryMap = callbackSIQ.getSignInQueryParamMap();
+ Assert.assertEquals(2, signinQueryMap.size());
+ Assert.assertEquals("myid", signinQueryMap.get("pubid"));
+ Assert.assertEquals("<=>", signinQueryMap.get("testenc"));
}
@org.junit.Test
@@ -392,6 +402,11 @@ public class CallbackHandlerTest {
Assert.assertTrue(issuerObj instanceof String);
String issuerURL = (String)issuerObj;
Assert.assertEquals(TestCallbackHandler.TEST_IDP, issuerURL);
+
+ Object signInQueryObj = protocol.getSignInQuery();
+ Assert.assertTrue(signInQueryObj instanceof String);
+ String signInQuery = (String)signInQueryObj;
+ Assert.assertEquals(TestCallbackHandler.TEST_SIGNIN_QUERY, signInQuery);
}