Examples of WikiPrincipal


Examples of org.apache.wiki.auth.WikiPrincipal

        assertTrue( m_group.isMember( u1 ) );
    }

    public void testAdd2()
    {
        Principal u1 = new WikiPrincipal( "Alice" );
        Principal u2 = new WikiPrincipal( "Bob" );

        assertTrue( "adding alice", m_group.add( u1 ) );

        assertTrue( "adding bob", m_group.add( u2 ) );
View Full Code Here

Examples of org.apache.wiki.auth.WikiPrincipal

    /**
     * Check that different objects match as well.
     */
    public void testAdd3()
    {
        Principal u1 = new WikiPrincipal( "Alice" );
        Principal u2 = new WikiPrincipal( "Bob" );
        Principal u3 = new WikiPrincipal( "Bob" );

        assertTrue( "adding alice", m_group.add( u1 ) );
        assertTrue( "adding bob", m_group.add( u2 ) );

        assertTrue( "Alice", m_group.isMember( u1 ) );
View Full Code Here

Examples of org.apache.wiki.auth.WikiPrincipal

        assertTrue( "Bob", m_group.isMember( u3 ) );
    }

    public void testRemove()
    {
        Principal u1 = new WikiPrincipal( "Alice" );
        Principal u2 = new WikiPrincipal( "Bob" );
        Principal u3 = new WikiPrincipal( "Bob" );

        m_group.add( u1 );
        m_group.add( u2 );

        m_group.remove( u3 );
View Full Code Here

Examples of org.apache.wiki.auth.WikiPrincipal

        assertFalse( "Bob 2", m_group.isMember( u3 ) );
    }

    public void testEquals1()
    {
        Principal u1 = new WikiPrincipal( "Alice" );
        Principal u2 = new WikiPrincipal( "Bob" );

        m_group.add( u1 );
        m_group.add( u2 );

        Group group2 = new Group( "TestGroup", m_wiki );
        Principal u3 = new WikiPrincipal( "Alice" );
        Principal u4 = new WikiPrincipal( "Bob" );

        group2.add( u3 );
        group2.add( u4 );

        assertTrue( m_group.equals( group2 ) );
View Full Code Here

Examples of org.apache.wiki.auth.WikiPrincipal

        assertTrue( m_group.equals( group2 ) );
    }

    public void testEquals2()
    {
        Principal u1 = new WikiPrincipal( "Alice" );
        Principal u2 = new WikiPrincipal( "Bob" );

        m_group.add( u1 );
        m_group.add( u2 );

        Group group2 = new Group( "Group2", m_wiki );
        Principal u3 = new WikiPrincipal( "Alice" );
        Principal u4 = new WikiPrincipal( "Charlie" );

        group2.add( u3 );
        group2.add( u4 );

        assertFalse( m_group.equals( group2 ) );
View Full Code Here

Examples of org.apache.wiki.auth.WikiPrincipal

    }

    public void testEquals3()
    {
        Group group1 = new Group( "Blib", m_wiki );
        Principal u1 = new WikiPrincipal( "Alice" );
        Principal u2 = new WikiPrincipal( "Bob" );
        group1.add( u1 );
        group1.add( u2 );

        Group group2 = new Group( "Blib", m_wiki );
        Principal u3 = new WikiPrincipal( "Alice" );
        Principal u4 = new WikiPrincipal( "Bob" );
        group2.add( u3 );
        group2.add( u4 );

        assertTrue( group1.equals( group2 ) );
    }
View Full Code Here

Examples of org.apache.wiki.auth.WikiPrincipal

    }

    public void testEquals4()
    {
        Group group1 = new Group( "BlibBlab", m_wiki );
        Principal u1 = new WikiPrincipal( "Alice" );
        Principal u2 = new WikiPrincipal( "Bob" );
        group1.add( u1 );
        group1.add( u2 );

        Group group2 = new Group( "Blib", m_wiki );
        Principal u3 = new WikiPrincipal( "Alice" );
        Principal u4 = new WikiPrincipal( "Bob" );
        group2.add( u3 );
        group2.add( u4 );

        assertFalse( m_group.equals( group2 ) );
    }
View Full Code Here

Examples of org.apache.wiki.auth.WikiPrincipal

        int oldUserCount = m_db.groups().length;

        // Create a new group with random name
        String name = "TestGroup" + String.valueOf( System.currentTimeMillis() );
        Group group = new Group( name, m_wiki );
        Principal al = new WikiPrincipal( "Al" );
        Principal bob = new WikiPrincipal( "Bob" );
        group.add( al );
        group.add( bob );
        m_db.save(group, new WikiPrincipal( "Tester") );

        // Make sure the profile saved successfully
        group = backendGroup( name );
        assertEquals( name, group.getName() );
        assertEquals( oldUserCount+1, m_db.groups().length );
View Full Code Here

Examples of org.apache.wiki.auth.WikiPrincipal

    public void testSave() throws Exception
    {
        // Create a new group with random name
        String name = "TestGroup" + String.valueOf( System.currentTimeMillis() );
        Group group = new Group( name, m_wiki );
        Principal al = new WikiPrincipal( "Al" );
        Principal bob = new WikiPrincipal( "Bob" );
        Principal cookie = new WikiPrincipal( "Cookie" );
        group.add( al );
        group.add( bob );
        group.add( cookie );
        m_db.save(group, new WikiPrincipal( "Tester" ) );

        // Make sure the profile saved successfully
        group = backendGroup( name );
        assertEquals( name, group.getName() );
        assertEquals( 3, group.members().length );
        assertTrue( group.isMember( new WikiPrincipal( "Al" ) ) );
        assertTrue( group.isMember( new WikiPrincipal( "Bob" ) ) );
        assertTrue( group.isMember( new WikiPrincipal( "Cookie" ) ) );

        // The back-end should have timestamped the create/modify fields
        assertNotNull( group.getCreator() );
        assertEquals( "Tester", group.getCreator() );
        assertNotNull( group.getCreated() );
View Full Code Here

Examples of org.apache.wiki.auth.WikiPrincipal

    public void testResave() throws Exception
    {
        // Create a new group with random name & 3 members
        String name = "TestGroup" + String.valueOf( System.currentTimeMillis() );
        Group group = new Group( name, m_wiki );
        Principal al = new WikiPrincipal( "Al" );
        Principal bob = new WikiPrincipal( "Bob" );
        Principal cookie = new WikiPrincipal( "Cookie" );
        group.add( al );
        group.add( bob );
        group.add( cookie );
        m_db.save(group, new WikiPrincipal( "Tester" ) );

        // Make sure the profile saved successfully
        group = backendGroup( name );
        assertEquals( name, group.getName() );

        // Modify the members by adding the group; re-add Al while we're at it
        Principal dave = new WikiPrincipal( "Dave" );
        group.add( al );
        group.add( dave );
        m_db.save(group, new WikiPrincipal( "SecondTester" ) );

        // We should see 4 members and new timestamp info
        Principal[] members = group.members();
        assertEquals( 4, members.length );
        assertNotNull( group.getCreator() );
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.