X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-PAP-REST%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2FrestAuth%2FAuthenticationServiceTest.java;fp=ONAP-PAP-REST%2Fsrc%2Ftest%2Fjava%2Forg%2Fonap%2Fpolicy%2Fpap%2Fxacml%2FrestAuth%2FAuthenticationServiceTest.java;h=cbe9ff2501548d1f6b573dd9364a6f9d1e9b6637;hb=4068da123ee33b532b4b52f15545c76a978f977e;hp=180c13f694b5b66f1a781c12138852042c04e469;hpb=f0fec2a861ea0a92b27b40882ea38f9422cde0c6;p=policy%2Fengine.git diff --git a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/restAuth/AuthenticationServiceTest.java b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/restAuth/AuthenticationServiceTest.java index 180c13f69..cbe9ff250 100644 --- a/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/restAuth/AuthenticationServiceTest.java +++ b/ONAP-PAP-REST/src/test/java/org/onap/policy/pap/xacml/restAuth/AuthenticationServiceTest.java @@ -26,27 +26,27 @@ import org.junit.Test; import org.onap.policy.pap.xacml.restAuth.AuthenticationService; public class AuthenticationServiceTest { - private final String testCred = "testpap:alpha123"; - private final String testCredEncoded = new String(Base64.getEncoder().encode(testCred.getBytes())); - private final String basicCred = "Basic " + testCredEncoded; - - @Test - public void testAuth() throws UnsupportedEncodingException { - String systemKey = "xacml.properties"; + private final String testCred = "testpap:alpha123"; + private final String testCredEncoded = new String(Base64.getEncoder().encode(testCred.getBytes())); + private final String basicCred = "Basic " + testCredEncoded; - // Set the system property temporarily - String oldProperty = System.getProperty(systemKey); - System.setProperty(systemKey, "xacml.pap.properties"); - - AuthenticationService service = new AuthenticationService(); - assertEquals(service.authenticate(basicCred), true); - - // Restore the original system property - if (oldProperty != null) { - System.setProperty(systemKey, oldProperty); - } - else { - System.clearProperty(systemKey); - } - } + @Test + public void testAuth() throws UnsupportedEncodingException { + String systemKey = "xacml.properties"; + + // Set the system property temporarily + String oldProperty = System.getProperty(systemKey); + System.setProperty(systemKey, "xacml.pap.properties"); + + AuthenticationService service = new AuthenticationService(); + assertEquals(service.authenticate(basicCred), true); + + // Restore the original system property + if (oldProperty != null) { + System.setProperty(systemKey, oldProperty); + } + else { + System.clearProperty(systemKey); + } + } }