Package com.googlecode.memwords.domain

Examples of com.googlecode.memwords.domain.UserInformation


    /**
     * Performs the change
     */
    private void doChange() {
        UserInformation userInformation = getContext().getUserInformation();
        Preferences preferences = userInformation.getPreferences();
        TimeZone timeZone = TimeZone.getTimeZone(this.timeZoneId);
        Preferences newPreferences = preferences.withTimeZone(timeZone);
        accountService.changePreferences(userInformation.getUserId(), newPreferences);
        getContext().setUserInformation(
            userInformation.withPreferences(newPreferences));
        getContext().getMessages().add(new ScopedLocalizableMessage(ChangePreferredTimeZoneActionBean.class,
                                                                    "preferredTimeZoneChanged"));
    }
View Full Code Here


        expect(mockCryptoEngine.decrypt(aryEq(account.getEncryptedSecretKey()), same(wrappingKey), aryEq(iv))).andReturn(encryptionKey);
        expect(mockCryptoEngine.bytesToSecretKey(encryptionKey)).andReturn(secretKey);

        replay(mockCryptoEngine);

        UserInformation loginUserInformation = impl.login(userId, masterPassword);
        assertSame(secretKey, loginUserInformation.getEncryptionKey());

        assertNotNull(implWithRealCryptoEngine.login(userId, masterPassword));
        assertNull(implWithRealCryptoEngine.login("userId2", masterPassword));
        assertNull(implWithRealCryptoEngine.login(userId, "masterPassword2"));
    }
View Full Code Here

    }

    @Test
    public void testChangePreferences() {
        String userId = "userId";
        UserInformation userInfoBeforeChange = implWithRealCryptoEngine.createAccount(userId, "masterPassword");
        assertNull(userInfoBeforeChange.getPreferences().getLocale());
        assertEquals(TimeZone.getTimeZone(MwConstants.GMT), userInfoBeforeChange.getPreferences().getTimeZone());
        assertFalse(userInfoBeforeChange.getPreferences().isPasswordsUnmasked());
        Locale newLocale = new Locale("fr", "FR");
        TimeZone newTimeZone = TimeZone.getTimeZone("Europe/Paris");
        implWithRealCryptoEngine.changePreferences(userId,
                                                   new Preferences(newLocale,
                                                                   newTimeZone,
                                                                   true,
                                                                   new PasswordGenerationPreferences(4, false, true, false, true)));
        UserInformation userInfoAfterChange =
            implWithRealCryptoEngine.login(userId, "masterPassword");
        assertEquals(newLocale, userInfoAfterChange.getPreferences().getLocale());
        assertEquals(newTimeZone, userInfoAfterChange.getPreferences().getTimeZone());
        assertTrue(userInfoAfterChange.getPreferences().isPasswordsUnmasked());
        assertEquals(4, userInfoAfterChange.getPreferences().getPasswordGenerationPreferences().getLength());
        assertFalse(userInfoAfterChange.getPreferences().getPasswordGenerationPreferences().isLowerCaseLettersIncluded());
        assertTrue(userInfoAfterChange.getPreferences().getPasswordGenerationPreferences().isUpperCaseLettersIncluded());
        assertFalse(userInfoAfterChange.getPreferences().getPasswordGenerationPreferences().isDigitsIncluded());
        assertTrue(userInfoAfterChange.getPreferences().getPasswordGenerationPreferences().isSpecialCharactersIncluded());
    }
View Full Code Here

    }

    @Test
    public void testDestroyAccount() {
        String userId = "userId";
        UserInformation userInfo = implWithRealCryptoEngine.createAccount(userId, "masterPassword");

        CardService cardService = new CardServiceImpl(em, new CryptoEngineImpl(), null, null);
        Card card =
            cardService.createCard(userId,
                                   new CardDetails("id",
                                                   "name",
                                                   "login",
                                                   "password",
                                                   null,
                                                   null,
                                                   null),
                                   userInfo.getEncryptionKey());

        implWithRealCryptoEngine.destroyAccount(userId);
        Account account = impl.getAccount(userId);
        assertNull(account);
        card = em.find(Card.class, card.getId());
View Full Code Here

TOP

Related Classes of com.googlecode.memwords.domain.UserInformation

Copyright © 2018 www.massapicom. 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.