X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=src%2Ftest%2Fjava%2Forg%2Fonap%2Faai%2Fbabel%2FMicroServiceAuthTest.java;h=e6f5aa6b6aecf5da48b05292fc6e329985afd3cb;hb=ee07ee287cab944dfc7371b3eeb230d1ba7e736e;hp=99eb4e91bfd63b0ec21a764c2bf20c0d26c0cf3a;hpb=4229965d8a112a9311505224e2bae254d25710dc;p=aai%2Fbabel.git diff --git a/src/test/java/org/onap/aai/babel/MicroServiceAuthTest.java b/src/test/java/org/onap/aai/babel/MicroServiceAuthTest.java index 99eb4e9..e6f5aa6 100644 --- a/src/test/java/org/onap/aai/babel/MicroServiceAuthTest.java +++ b/src/test/java/org/onap/aai/babel/MicroServiceAuthTest.java @@ -20,7 +20,6 @@ */ package org.onap.aai.babel; -import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.CoreMatchers.is; import static org.junit.Assert.assertThat; @@ -80,9 +79,9 @@ public class MicroServiceAuthTest { @Test public void createLocalAuthFile() throws AAIAuthException, IOException, JSONException { JSONObject roles = createRoleObject("role", createUserObject("user"), createFunctionObject("func")); - AAIMicroServiceAuth auth = createAuthService(roles); - assertThat(auth.authorize("nosuchuser", "method:func"), is(false)); - assertThat(auth.authorize("user", "method:func"), is(true)); + createAuthService(roles); + assertThat(AAIMicroServiceAuthCore.authorize("nosuchuser", "method:func"), is(false)); + assertThat(AAIMicroServiceAuthCore.authorize("user", "method:func"), is(true)); } /** @@ -112,9 +111,9 @@ public class MicroServiceAuthTest { @Test public void testAuthUser() throws AAIAuthException { - AAIMicroServiceAuth auth = createStandardAuth(); - assertThat(auth.authenticate(VALID_ADMIN_USER, "GET:actions"), is(equalTo("OK"))); - assertThat(auth.authenticate(VALID_ADMIN_USER, "WRONG:action"), is(equalTo("AAI_9101"))); + createStandardAuth(); + assertThat(AAIMicroServiceAuthCore.authorize(VALID_ADMIN_USER, "GET:actions"), is(true)); + assertThat(AAIMicroServiceAuthCore.authorize(VALID_ADMIN_USER, "WRONG:action"), is(false)); } @@ -158,10 +157,10 @@ public class MicroServiceAuthTest { * @throws AAIAuthException */ private void assertAdminUserAuthorisation(AAIMicroServiceAuth auth, String adminUser) throws AAIAuthException { - assertThat(auth.authorize(adminUser, "GET:actions"), is(true)); - assertThat(auth.authorize(adminUser, "POST:actions"), is(true)); - assertThat(auth.authorize(adminUser, "PUT:actions"), is(true)); - assertThat(auth.authorize(adminUser, "DELETE:actions"), is(true)); + assertThat(AAIMicroServiceAuthCore.authorize(adminUser, "GET:actions"), is(true)); + assertThat(AAIMicroServiceAuthCore.authorize(adminUser, "POST:actions"), is(true)); + assertThat(AAIMicroServiceAuthCore.authorize(adminUser, "PUT:actions"), is(true)); + assertThat(AAIMicroServiceAuthCore.authorize(adminUser, "DELETE:actions"), is(true)); } private JSONArray createFunctionObject(String functionName) throws JSONException {