Package org.sonatype.security.mock.realms

Examples of org.sonatype.security.mock.realms.MockRealmB


  public void testCacheClearing()
      throws Exception
  {
    SecuritySystem securitySystem = this.lookup(SecuritySystem.class);

    MockRealmB mockRealmB = (MockRealmB) this.lookup(Realm.class, "MockRealmB");

    // cache should be empty to start
    Assert.assertTrue(mockRealmB.getAuthorizationCache().keys().isEmpty());

    Assert.assertTrue(securitySystem.isPermitted(new SimplePrincipalCollection("jcool", mockRealmB.getName()),
        "test:heHasIt"));

    // now something will be in the cache, just make sure
    Assert.assertFalse(mockRealmB.getAuthorizationCache().keys().isEmpty());

    // now if we update a user the cache should be cleared
    User user = securitySystem.getUser("bburton", "MockUserManagerB"); // different user, doesn't matter, in the
    // future we should get a little more fine
    // grained
    securitySystem.updateUser(user);

    // empty again
    Assert.assertTrue(mockRealmB.getAuthorizationCache().keys().isEmpty());

  }
View Full Code Here

TOP

Related Classes of org.sonatype.security.mock.realms.MockRealmB

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.