diff options
author | 2023-03-02 12:06:07 +0530 | |
---|---|---|
committer | 2023-03-10 10:46:55 +0530 | |
commit | 6b8e4f12fc66a64fa5c5498d06891f1f5f1189ac (patch) | |
tree | 6414988944a78393509923a5ace70d66db0b29bd /sdnr/wt/oauth-provider/provider-jar/src/test | |
parent | d944abfab1a53a462868ae805ab5372935f854ef (diff) |
Upgrade parents to 2.5.4-SNAPSHOT
Code changes as a result of changes induced by ODL Chlorine SR1
Issue-ID: CCSDK-3856
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Change-Id: Ic08786f050e58bdb8371c8f8c25fb0db9f258cd4
Signed-off-by: Ravi Pendurty <ravi.pendurty@highstreet-technologies.com>
Diffstat (limited to 'sdnr/wt/oauth-provider/provider-jar/src/test')
2 files changed, 35 insertions, 6 deletions
diff --git a/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/TestRealm.java b/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/TestRealm.java index 07efbcec3..c1d3fd1ea 100644 --- a/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/TestRealm.java +++ b/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/TestRealm.java @@ -31,6 +31,8 @@ import java.io.IOException; import java.util.Arrays; import java.util.HashSet; import java.util.List; +import java.util.function.Supplier; + import org.apache.shiro.authc.AuthenticationException; import org.apache.shiro.authc.AuthenticationInfo; import org.apache.shiro.authc.AuthenticationToken; @@ -45,20 +47,48 @@ import org.onap.ccsdk.features.sdnr.wt.oauthprovider.data.Config; import org.onap.ccsdk.features.sdnr.wt.oauthprovider.data.UserTokenPayload; import org.onap.ccsdk.features.sdnr.wt.oauthprovider.providers.AuthService; import org.onap.ccsdk.features.sdnr.wt.oauthprovider.providers.TokenCreator; +import org.opendaylight.aaa.api.Authentication; +import org.opendaylight.aaa.api.AuthenticationService; +import org.opendaylight.aaa.api.TokenStore; import org.opendaylight.aaa.api.shiro.principal.ODLPrincipal; -import org.opendaylight.aaa.shiro.web.env.ThreadLocals; +import org.opendaylight.aaa.shiro.realm.TokenAuthRealm; import org.opendaylight.aaa.tokenauthrealm.auth.AuthenticationManager; import org.opendaylight.aaa.tokenauthrealm.auth.TokenAuthenticators; +import org.opendaylight.mdsal.binding.api.DataBroker; public class TestRealm { private static OAuth2RealmToTest realm; private static TokenCreator tokenCreator; + private static final AuthenticationManager authManager = new AuthenticationManager(); + private static final TokenAuthenticators tokenAuth = new TokenAuthenticators(); + + private static final TokenStore tokenStore = new TokenStore(){ + + @Override + public void put(String token, Authentication auth) { + + } + + @Override + public Authentication get(String token) { + return null; + } + + @Override + public boolean delete(String token) { + return false; + } + + @Override + public long tokenExpiration() { + return 0; + } + }; @BeforeClass public static void init() throws IllegalArgumentException, Exception { - ThreadLocals.AUTH_SETVICE_TL.set(new AuthenticationManager()); - ThreadLocals.TOKEN_AUTHENICATORS_TL.set(new TokenAuthenticators()); + TokenAuthRealm.prepareForLoad(authManager,tokenAuth,tokenStore); try { Config config = Config.getInstance(TestConfig.TEST_CONFIG_FILENAME); tokenCreator = TokenCreator.getInstance(config); diff --git a/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/helper/OdlJsonMapper.java b/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/helper/OdlJsonMapper.java index 7213f80f5..b0cc0253b 100644 --- a/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/helper/OdlJsonMapper.java +++ b/sdnr/wt/oauth-provider/provider-jar/src/test/java/org/onap/ccsdk/features/sdnr/wt/oauthprovider/test/helper/OdlJsonMapper.java @@ -29,7 +29,6 @@ import com.fasterxml.jackson.databind.PropertyNamingStrategy; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.mapperextensions.YangToolsBuilderAnnotationIntrospector; import org.onap.ccsdk.features.sdnr.wt.yang.mapper.mapperextensions.YangToolsModule; import org.opendaylight.yang.gen.v1.urn.opendaylight.params.xml.ns.yang.aaa.rev161214.http.permission.Permissions; -import org.opendaylight.yangtools.concepts.Builder; public class OdlJsonMapper extends ObjectMapper { @@ -48,7 +47,7 @@ public class OdlJsonMapper extends ObjectMapper { this.registerModule(new YangToolsModule()); } - public static class PermissionsBuilder implements Builder<Permissions> { + public static class PermissionsBuilder { private Permissions _value; public PermissionsBuilder() { @@ -58,7 +57,7 @@ public class OdlJsonMapper extends ObjectMapper { this._value = value; } - @Override + public Permissions build() { return this._value; } |