亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频

? 歡迎來到蟲蟲下載站! | ?? 資源下載 ?? 資源專輯 ?? 關于我們
? 蟲蟲下載站

?? testgroupmanagement.java

?? jetspeed源代碼
?? JAVA
字號:
/*
 * Copyright 2000-2001,2004 The Apache Software Foundation.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.apache.jetspeed.services.security;

import java.util.Iterator;
import java.util.HashMap;

// Junit imports
import junit.framework.Test;
import junit.framework.TestSuite;

import org.apache.turbine.services.TurbineServices;
import org.apache.turbine.util.TurbineConfig;
import org.apache.turbine.util.StringUtils;

// Jetspeed imports
import org.apache.jetspeed.test.JetspeedTestCase;
import org.apache.jetspeed.om.security.Group;
import org.apache.jetspeed.om.security.JetspeedGroupFactory;

/**
 * Unit test for GroupManagement interface
 * 
 * @author <a href="mailto:david@bluesunrise.com">David Sean Taylor</a>
 * @version $Id: TestGroupManagement.java,v 1.1 2004/04/07 22:02:43 jford Exp $
 */

public class TestGroupManagement extends JetspeedTestCase {    
    
    /**
     * Defines the testcase name for JUnit.
     *
     * @param name the testcase's name.
     */
    public TestGroupManagement( String name ) {
        super( name );
    }
    
    /**
     * Start the tests.
     *
     * @param args the arguments. Not used
     */
    public static void main(String args[]) 
    {
        junit.awtui.TestRunner.main( new String[] { TestGroupManagement.class.getName() } );
    }
 
    public void setup() 
    {
        //System.out.println("Setup: Testing Turbine Group Management");         
    }

    /**
     * Creates the test suite.
     *
     * @return a test suite (<code>TestSuite</code>) that includes all methods
     *         starting with "test"
     */
    public static Test suite() 
    {
        // All methods starting with "test" will be executed in the test suite.
        return new TestSuite( TestGroupManagement.class );
    }

    /**
     * Tests getGroups method
     * @throws Exception
     */

    public void testGetGroups() throws Exception 
    {
        GroupManagement service = getService();
        Group group = null;
        HashMap map = new HashMap();

        try
        {
            Iterator groups = service.getGroups();
            while (groups.hasNext())
            {
                group = (Group)groups.next();
                map.put(group.getName(), group);
            }
            assertTrue(map.get("apache") != null);
            assertTrue(map.get("Jetspeed") != null);
            assertTrue(map.get("bogusGroup") == null);
        }
        catch (Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }

        System.out.println("Completed getGroups Test OK ");

    }

    /**
     * Tests getGroups method
     * @throws Exception
     */

    public void testGetGroupsForUser() throws Exception 
    {
        GroupManagement service = getService();
        Group group = null;
        HashMap map = new HashMap();

        try
        {
            Iterator groups = service.getGroups("turbine");
            while (groups.hasNext())
            {
                group = (Group)groups.next();
                map.put(group.getName(), group);
                System.out.println("[turbine] group = " + group.getName());
            }
            assertTrue(map.get("Jetspeed") != null);
            assertTrue(map.get("apache") == null);

            map.clear();
            groups = service.getGroups("admin");            
            while (groups.hasNext())
            {
                group = (Group)groups.next();
                map.put(group.getName(), group);
                System.out.println("[admin] group = " + group.getName());
            }
            assertTrue(map.get("Jetspeed") != null);

        }
        catch (Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }

        System.out.println("Completed getGroups Test OK ");

    }

    /**
     * Tests addGroup method 
     * @throws Exception
     */

    public void testAddGroup() throws Exception 
    {
        GroupManagement service = getService();
        Group group = null;

        try
        {
            group = JetspeedGroupFactory.getInstance();
            group.setName("bogus");
            service.addGroup(group);
            System.out.println("new group id = " + group.getId());
            assertTrue(group.getId() != null);
        }
        catch(Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }
        try
        {
            group = JetspeedGroupFactory.getInstance();
            group.setName("bogus");
            service.addGroup(group);
            fail("Should've thrown a dup key exception on group");
        }
        catch(Exception e)
        {
            assertTrue(e instanceof GroupException);           
        }

        System.out.println("Completed addGroup Test OK ");

    }

    /**
     * Tests getRemoveGroup method 
     * @throws Exception
     */

    public void testRemoveGroup() throws Exception 
    {
        GroupManagement service = getService();
        Group group = null;

        try
        {
            service.removeGroup("bogus");
        }
        catch(Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }
        try
        {
            service.removeGroup("catchmeifyoucan");
            fail("Should've thrown a not found exception on group");
        }
        catch(Exception e)
        {
            assertTrue(e instanceof GroupException);
        }

        System.out.println("Completed addGroup Test OK ");

    }

    /**
     * Tests getGroup method
     * @throws Exception
     */

    public void testGetGroup() throws Exception 
    {
        GroupManagement service = getService();

        try
        {
            Group group = service.getGroup("Jetspeed");
            System.out.println("*** group nm = " + group.getName());
            System.out.println("*** group id = " + group.getId());
            assertTrue(group.getName().equals("Jetspeed"));
        }
        catch (Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }

        System.out.println("Completed getGroup Test OK ");

    }

    /**
     * Tests saveGroup method 
     * @throws Exception
     */

    public void testSaveGroup() throws Exception 
    {
        GroupManagement service = getService();

        try
        {
            Group group = service.getGroup("apache");
            service.saveGroup(group);
        }
        catch(Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }

        System.out.println("Completed saveGroup Test OK ");

    }

    /**
     * Tests joinGroup method 
     * @throws Exception
     */
    public void testJoinGroup() throws Exception 
    {
        GroupManagement service = getService();
        Group group = null;

        try
        {
            service.joinGroup("turbine", "apache");
        }
        catch(Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }
        try
        {
            service.joinGroup("baduser", "apache");
            fail("Should've thrown a bad user exception on join");
        }
        catch(Exception e)
        {
            assertTrue(e instanceof GroupException);           
        }

        System.out.println("Completed joinGroup Test OK ");

    }

    /**
     * Tests unjoinGroup method 
     * @throws Exception
     */
    public void testUnjoinGroup() throws Exception 
    {
        GroupManagement service = getService();
        Group group = null;

        try
        {
            service.unjoinGroup("turbine", "apache");
        }
        catch(Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }
        try
        {
            service.unjoinGroup("baduser", "apache");
            fail("Should've thrown a bad user exception on unjoin");
        }
        catch(Exception e)
        {
            assertTrue(e instanceof GroupException);           
        }

        System.out.println("Completed unjoinGroup Test OK ");

    }

    /**
     * Tests inGroup method 
     * @throws Exception
     */
    public void testInGroup() throws Exception 
    {
        GroupManagement service = getService();
        Group group = null;

        try
        {
            boolean in = service.inGroup("admin", "Jetspeed");
            assertTrue(true == in);
        }
        catch(Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }
        try
        {
            boolean in = service.inGroup("turbine", "apache");
            assertTrue(false == in);
        }
        catch(Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }

        System.out.println("Completed inGroup Test OK ");

    }

  /*
    Configuration object to run Turbine outside a servlet container
    ( uses turbine.properties )
    */
    private static TurbineConfig config = null;
    
    /**
    Sets up TurbineConfig using the system property:
    <pre>turbine.properties</pre>
    */
    static
    {
        try
        {
            config = new TurbineConfig( "webapp", "/WEB-INF/conf/TurbineResources.properties");
            config.init();
        }
        catch (Exception e)
        {
            fail(StringUtils.stackTrace(e));
        }
    }

    private static GroupManagement getService()
    {
        return (GroupManagement)TurbineServices
                .getInstance()
                .getService(GroupManagement.SERVICE_NAME);
    }

}






?? 快捷鍵說明

復制代碼 Ctrl + C
搜索代碼 Ctrl + F
全屏模式 F11
切換主題 Ctrl + Shift + D
顯示快捷鍵 ?
增大字號 Ctrl + =
減小字號 Ctrl + -
亚洲欧美第一页_禁久久精品乱码_粉嫩av一区二区三区免费野_久草精品视频
成人福利电影精品一区二区在线观看| 亚洲高清中文字幕| 欧美三级资源在线| 紧缚捆绑精品一区二区| 亚洲四区在线观看| 26uuu久久天堂性欧美| 在线影视一区二区三区| 国产麻豆视频精品| 美日韩一区二区| 亚洲小说春色综合另类电影| 中文字幕欧美区| 精品国产1区二区| 欧美日韩成人在线| 一本大道久久精品懂色aⅴ| 久久99久久精品欧美| 亚洲综合男人的天堂| 亚洲日本电影在线| 国产精品三级视频| 久久久久久久久久久电影| 3d成人h动漫网站入口| 91免费精品国自产拍在线不卡| 国产主播一区二区三区| 蜜桃视频一区二区三区| 午夜av区久久| 亚洲国产视频在线| 亚洲免费av在线| 国产精品剧情在线亚洲| 国产视频一区二区三区在线观看| 日韩一级免费观看| 欧美一区二区国产| 日韩一区二区在线观看| 69久久夜色精品国产69蝌蚪网| 欧美综合在线视频| 欧美色手机在线观看| 欧美在线观看视频一区二区| 在线看日本不卡| 欧洲一区在线观看| 欧美色综合网站| 欧美色综合天天久久综合精品| 91老师片黄在线观看| thepron国产精品| 97精品久久久午夜一区二区三区| 99精品国产一区二区三区不卡| jlzzjlzz欧美大全| eeuss鲁一区二区三区| 不卡免费追剧大全电视剧网站| 成人国产精品免费观看| jvid福利写真一区二区三区| 色呦呦国产精品| 欧美视频在线观看一区二区| 欧美日韩在线三区| 欧美一级午夜免费电影| 精品不卡在线视频| 欧美激情中文字幕| 亚洲欧美另类小说| 午夜国产精品一区| 韩国av一区二区三区| 岛国av在线一区| 一本色道久久综合亚洲91| 欧美图区在线视频| 日韩一区二区三区在线| 精品电影一区二区| 欧美国产丝袜视频| 亚洲一区电影777| 秋霞午夜鲁丝一区二区老狼| 国产一区啦啦啦在线观看| 成人午夜看片网址| 欧美亚洲综合在线| 日韩欧美高清dvd碟片| 国产精品天美传媒| 亚洲一区av在线| 蜜桃av一区二区在线观看| 丰满少妇在线播放bd日韩电影| av在线不卡网| 欧美一区二区三区免费在线看| 久久久久国产精品麻豆 | 中文字幕av一区二区三区免费看 | 一区二区三区四区蜜桃| 日韩电影免费一区| 成人av在线播放网址| 欧美日韩电影在线播放| 国产日韩三级在线| 亚洲午夜免费电影| 国产精品456| 欧美三级视频在线播放| 久久精品一区二区三区av| 亚洲欧洲日韩av| 麻豆国产欧美一区二区三区| 99久久综合色| 欧美一区二区精品在线| 国产精品嫩草影院av蜜臀| 日韩在线一二三区| 99久久国产综合色|国产精品| 欧美在线观看一区| 国产精品久久久久9999吃药| 青青草国产精品97视觉盛宴| 日本高清不卡视频| 久久精品视频在线免费观看| 婷婷久久综合九色综合绿巨人| 成人午夜激情影院| 日韩欧美中文字幕精品| 亚洲欧美日韩国产成人精品影院| 国产一区二区三区在线观看免费视频 | 国产在线视频一区二区| 欧美人xxxx| 樱桃视频在线观看一区| 国产成人精品影视| 欧美一区二区三区的| 亚洲男人的天堂在线观看| 国产精品1区2区3区在线观看| 这里只有精品视频在线观看| 亚洲欧美日韩久久| 成人av资源网站| 国产丝袜欧美中文另类| 美女久久久精品| 欧美精品xxxxbbbb| 亚洲成av人片一区二区梦乃 | 欧美顶级少妇做爰| 亚洲国产美女搞黄色| 91丨国产丨九色丨pron| 国产精品色眯眯| 国产精品888| 久久久久久久久久久电影| 久久er99精品| 欧美成人video| 久久se精品一区二区| 欧美一区二区三区在线观看视频 | 国产精品欧美久久久久一区二区| 久久99蜜桃精品| 欧美精品一区二区精品网| 麻豆精品久久久| 日韩三级视频在线观看| 久久99久久久欧美国产| 久久一留热品黄| 国产精品亚洲午夜一区二区三区| 欧美tickling挠脚心丨vk| 国内精品免费**视频| 久久综合九色欧美综合狠狠 | 国产精品一二三区在线| 久久久久国产精品厨房| 高清免费成人av| 欧美国产日韩在线观看| 波多野结衣一区二区三区 | 亚洲男同性视频| 国产成人午夜视频| 欧美激情一区二区在线| 99热99精品| 亚洲成人1区2区| 日韩欧美一二三四区| 国产一区二区三区四区五区美女 | 欧美国产精品劲爆| 99久久久国产精品| 一区二区欧美精品| 8x8x8国产精品| 麻豆视频观看网址久久| xnxx国产精品| 成人久久18免费网站麻豆| 一区二区三区资源| 欧美乱妇一区二区三区不卡视频| 青青草原综合久久大伊人精品优势| 精品免费日韩av| 成人的网站免费观看| 一区二区三区鲁丝不卡| 日韩一级片网站| 粉嫩在线一区二区三区视频| 亚洲精品水蜜桃| 日韩一区二区在线看| 成人在线视频一区二区| 亚洲一区在线观看视频| 欧美精品一区视频| 99久久免费精品高清特色大片| 午夜精品福利在线| 久久久一区二区三区| 日本高清不卡视频| 国产主播一区二区三区| 亚洲乱码国产乱码精品精可以看| 91精品国产综合久久福利软件| 大尺度一区二区| 亚洲gay无套男同| 国产亚洲一本大道中文在线| 色婷婷一区二区三区四区| 麻豆成人av在线| 一区二区三区欧美亚洲| 欧美大片免费久久精品三p| 久久综合国产精品| 色呦呦国产精品| 国产精品小仙女| 亚洲精品国产一区二区三区四区在线 | 日韩一区二区三区电影在线观看 | 日韩欧美你懂的| 99久久精品国产导航| 日本亚洲视频在线| 中文字幕一区二区三区精华液| 日韩一区二区三区视频在线观看| 久久综合久久综合亚洲| 精品视频1区2区| 不卡视频在线看| 国产中文字幕精品| 日韩国产在线观看一区| 亚洲色图欧美激情|