Package org.apache.harmony.auth.module

Examples of org.apache.harmony.auth.module.KeyStoreLoginModule.initialize()


        } catch (LoginException e) {
            fail("Abort failed");
        }
        Subject subject = new Subject();
        subject.setReadOnly();
        ksm.initialize(subject, null, null, options);
        try {
            assertFalse("Should return false if login failed or no login", ksm
                    .abort());
        } catch (Exception e) {
            fail("Not any exception here");
View Full Code Here


            fail("Not any exception here");
        }
        options.remove("keyStorePasswordURL");
        options.put("keyStorePasswordURL", KEYSTORE_FAULTPASSWORD_URL);
        subject = new Subject();
        ksm.initialize(subject, null, null, options);
        try {
            ksm.login();
            fail("login should fail");
        } catch (LoginException e) {
            assertFalse("Should return false because of login failure", ksm
View Full Code Here

                    .abort());
        }
        options.remove("keyStorePasswordURL");
        options.put("keyStorePasswordURL", KEYSTORE_PASSWORD_URL);
        subject = new Subject();
        ksm.initialize(subject, null, null, options);
        ksm.login();
        assertTrue("Should return true if login was successful", ksm
                .abort());
    }
View Full Code Here

    }

    public void test_commit() {
        KeyStoreLoginModule module = new KeyStoreLoginModule();
        Subject subject = new Subject();
        module.initialize(subject, null, null, options);
        try {
            assertTrue("Login should be successful", module.login());
            module.commit();
        } catch (LoginException e) {
            e.printStackTrace();
View Full Code Here

        Set<Object> subjects2 = subject.getPublicCredentials();
        assertFalse("Should get at least one public credential", subjects2
                .isEmpty());
        subject = new Subject();
        subject.setReadOnly();
        module.initialize(subject, null, null, options);
        try {
            assertFalse("Commit shouldn't be successful", module.commit());
            fail("Should throw LoginException here because of trying to clear read-only subject");
        } catch (LoginException e) {
            // expected LoginException here
View Full Code Here

    }

    public void test_initialize() {
        KeyStoreLoginModule module = new KeyStoreLoginModule();
        try {
            module.initialize(null, null, null, null);
            fail("Should throw NullPointerException here.");
        } catch (NullPointerException e) {
            // expected NullPointerException
        }
    }
View Full Code Here

    }

    public void test_login() {
        KeyStoreLoginModule module = new KeyStoreLoginModule();
        HashMap<String, String> emptyOptions = new HashMap<String, String>();
        module.initialize(null, null, null, emptyOptions);
        try {
            module.login();
            fail("Should throw LoginException here.");
        } catch (LoginException e) {
            // expected LoginException
View Full Code Here

        } catch (LoginException e) {
            // expected LoginException
        }

        Subject subject = new Subject();
        module.initialize(subject, null, null, options);
        try {
            assertTrue("Login should be successful", module.login());
        } catch (LoginException e) {
            fail("Login shouldn't fail");
        }
View Full Code Here

            assertTrue("Login should be successful", module.login());
        } catch (LoginException e) {
            fail("Login shouldn't fail");
        }
        options.put("keyStorePasswordURL", KEYSTORE_FAULTPASSWORD_URL);
        module.initialize(subject, null, null, options);
        try {
            assertFalse("Login shouldn't be successful", module.login());
            fail("Login should fail");
        } catch (LoginException e) {
            // expected Loginexception here
View Full Code Here

    }

    public void test_logout() {
        KeyStoreLoginModule module = new KeyStoreLoginModule();
        Subject subject = new Subject();
        module.initialize(subject, null, null, options);
        try {
            assertTrue("Login should be successful", module.login());
            module.commit();
        } catch (LoginException e) {
            fail("Login shouldn't fail");
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.