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

commit 2d60e6189b93471372de66a63e4e0ed580d059a9
Author: Alexey Markevich <[email protected]>
AuthorDate: Mon Jun 10 12:57:15 2019 +0300

    cxf-rt-rs-security-oauth2: add test for OAuthClientUtils
---
 .../oauth2/client/OAuthClientUtilsTest.java        | 24 +++++++++++++++++++++-
 1 file changed, 23 insertions(+), 1 deletion(-)

diff --git 
a/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtilsTest.java
 
b/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtilsTest.java
index a50c057..c0622bb 100644
--- 
a/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtilsTest.java
+++ 
b/rt/rs/security/oauth-parent/oauth2/src/test/java/org/apache/cxf/rs/security/oauth2/client/OAuthClientUtilsTest.java
@@ -19,6 +19,8 @@
 package org.apache.cxf.rs.security.oauth2.client;
 
 import java.io.ByteArrayInputStream;
+import java.util.HashMap;
+import java.util.Map;
 
 import javax.ws.rs.core.Form;
 import javax.ws.rs.core.MediaType;
@@ -75,4 +77,24 @@ public class OAuthClientUtilsTest {
             verify(accessTokenService);
         }
     }
-}
\ No newline at end of file
+
+    @Test
+    public void fromMapToClientToken() {
+        final Map<String, String> map = new HashMap<>();
+        final String accessToken = "SlAV32hkKG";
+        map.put(OAuthConstants.ACCESS_TOKEN, accessToken);
+        final String tokenType = "Bearer";
+        map.put(OAuthConstants.ACCESS_TOKEN_TYPE, tokenType);
+        final String refreshToken = "8xLOxBtZp8";
+        map.put(OAuthConstants.REFRESH_TOKEN, refreshToken);
+        final String expiresIn = "3600";
+        map.put(OAuthConstants.ACCESS_TOKEN_EXPIRES_IN, expiresIn);
+
+        final ClientAccessToken token = 
OAuthClientUtils.fromMapToClientToken(map);
+        assertEquals(accessToken, token.getTokenKey());
+        assertEquals(tokenType, token.getTokenType());
+        assertEquals(refreshToken, token.getRefreshToken());
+        assertEquals(Long.parseLong(expiresIn), token.getExpiresIn());
+    }
+
+}

Reply via email to