Package org.olat.group.context

Examples of org.olat.group.context.BGContext


    String bgWithWaitingListDesc = "some short description for Group with WaitingList";
    Boolean enableWaitinglist = new Boolean(true);
    Boolean enableAutoCloseRanks = new Boolean(true);
   
     BGContextManager bgcm = BGContextManagerImpl.getInstance();
    BGContext groupContext = bgcm.createAndPersistBGContext("c1name", "c1desc", BusinessGroup.TYPE_LEARNINGROUP, null, true);
    System.out.println("testAddToWaitingListAndFireEvent: groupContext=" + groupContext);
    bgWithWaitingList = bgManager.createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, id1, bgWithWaitingListName, bgWithWaitingListDesc, null, null, enableWaitinglist, enableAutoCloseRanks, groupContext);
    bgWithWaitingList.setMaxParticipants(new Integer(2));
    // create mock objects
View Full Code Here


  }

  /** BGContextManagerImpl:createAndPersistBGContext * */
  public void testCreateAndPersistBGContext() {
    BGContextManager bgcm = BGContextManagerImpl.getInstance();
    BGContext c1 = bgcm.createAndPersistBGContext("c1name", "c1desc", BusinessGroup.TYPE_LEARNINGROUP, null, true);
    assertNotNull(c1);
    BGContext c2 = bgcm.createAndPersistBGContext("c2name", "c2desc", BusinessGroup.TYPE_LEARNINGROUP, id1, false);
    assertNotNull(c2);
    try {
      bgcm.createAndPersistBGContext("name", "desc", null, id2, false);
      fail("context groupType can not be null");
    } catch (AssertException e) {
View Full Code Here

  }

  /** BGContextManagerImpl:deleteBGContext() * */
  public void testDeleteBGContext() {
    BGContextManager bgcm = BGContextManagerImpl.getInstance();
    BGContext c1 = bgcm.createAndPersistBGContext("c1name", "c1desc", BusinessGroup.TYPE_LEARNINGROUP, null, true);
    BGContext c2 = bgcm.createAndPersistBGContext("c2name", "c2desc", BusinessGroup.TYPE_RIGHTGROUP, id1, false);

    DBFactory.getInstance().closeSession(); // simulate user clicks
    BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
   
    BusinessGroup g1 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, null, "g1", null, new Integer(0),
View Full Code Here

  }

  /** BGContextManagerImpl:copyBGContext() * */
  public void testCopyBGContext() {
    BGContextManager bgcm = BGContextManagerImpl.getInstance();
    BGContext c1 = bgcm.createAndPersistBGContext("c1name", "c1desc", BusinessGroup.TYPE_LEARNINGROUP, null, true);
    BGContext c2 = bgcm.createAndPersistBGContext("c2name", "c2desc", BusinessGroup.TYPE_RIGHTGROUP, id1, false);

    DBFactory.getInstance().closeSession(); // simulate user clicks
    BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
    BusinessGroup g1 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, null, "g1", null, new Integer(0),
        new Integer(10), false, false, c1);
    BusinessGroup g2 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, null, "g2", null, new Integer(0),
        new Integer(10), false, false, c1);
    BusinessGroup g3 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_RIGHTGROUP, null, "g3", null, new Integer(0),
        new Integer(10), false, false, c2);

    DBFactory.getInstance().closeSession(); // simulate user clicks
    Manager secm = ManagerFactory.getManager();
    secm.addIdentityToSecurityGroup(id1, g1.getPartipiciantGroup());
    secm.addIdentityToSecurityGroup(id1, g1.getOwnerGroup());
    secm.addIdentityToSecurityGroup(id2, g1.getPartipiciantGroup());
    secm.addIdentityToSecurityGroup(id3, g1.getOwnerGroup());
    secm.addIdentityToSecurityGroup(id1, g3.getPartipiciantGroup());
    secm.addIdentityToSecurityGroup(id2, g3.getPartipiciantGroup());

    DBFactory.getInstance().closeSession(); // simulate user clicks
    BGRightManagerImpl rm = BGRightManagerImpl.getInstance();
    rm.addBGRight(CourseRights.RIGHT_ARCHIVING, g3);
    rm.addBGRight(CourseRights.RIGHT_COURSEEDITOR, g3);

    DBFactory.getInstance().closeSession(); // simulate user clicks
    BGAreaManager am = BGAreaManagerImpl.getInstance();
    BGArea a1 = am.createAndPersistBGAreaIfNotExists("a1-copy", "desca1", c1);
    BGArea a2 = am.createAndPersistBGAreaIfNotExists("a2-copy", null, c1);
    am.addBGToBGArea(g1, a1);
    am.addBGToBGArea(g2, a1);
    am.addBGToBGArea(g1, a2);
    DBFactory.getInstance().closeSession(); // simulate user clicks

    BGContext c1copy = bgcm.copyAndAddBGContextToResource(c1.getName(), course1, c1);
    DBFactory.getInstance().closeSession(); // simulate user clicks
    try {
      bgcm.copyAndAddBGContextToResource(c2.getName(), course1, c2);
      fail("expecting exeption");
    } catch (AssertException e) {
View Full Code Here

  }

  /** BGContextManagerImpl:deleteBGContext() * */
  public void testBGRights() {
    BGContextManager bgcm = BGContextManagerImpl.getInstance();
    BGContext c1 = bgcm.createAndPersistBGContext("c1name", "c1desc", BusinessGroup.TYPE_RIGHTGROUP, null, true);
    BGContext c2 = bgcm.createAndPersistBGContext("c2name", "c2desc", BusinessGroup.TYPE_RIGHTGROUP, id1, false);

    BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
    BusinessGroup g1 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_RIGHTGROUP, null, "g1", null, null, null, false, false, c1);
    BusinessGroup g2 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_RIGHTGROUP, null, "g2", null, null, null, false, false, c1);
    BusinessGroup g3 = bgm.createAndPersistBusinessGroup(BusinessGroup.TYPE_RIGHTGROUP, null, "g3", null, null, null, false, false, c2);
View Full Code Here

  /** BGContextManagerImpl:getGroupsOfBGContext and countGroupsOfBGContext* */
  public void testGroupsOfBGContext() {
    BGContextManager bgcm = BGContextManagerImpl.getInstance();
    BusinessGroupManager bgm = BusinessGroupManagerImpl.getInstance();
    BGContext c1 = bgcm.createAndPersistBGContext("c1name", "c1desc", BusinessGroup.TYPE_LEARNINGROUP, null, true);
    BGContext c2 = bgcm.createAndPersistBGContext("c2name", "c2desc", BusinessGroup.TYPE_LEARNINGROUP, id1, false);

    DBFactory.getInstance().closeSession(); // simulate user clicks
    assertTrue(bgcm.getGroupsOfBGContext(c1).size() == 0);
    assertTrue(bgcm.countGroupsOfBGContext(c1) == 0);

View Full Code Here

  }

  /** BGContext2ResourceManager tests */
  public void testFindContextMethods() {
    BGContextManager cm = BGContextManagerImpl.getInstance();
    BGContext c1 = cm.createAndAddBGContextToResource("c1name", course1, BusinessGroup.TYPE_LEARNINGROUP, null, true);
    cm.createAndAddBGContextToResource("c2name", course1, BusinessGroup.TYPE_LEARNINGROUP, id1, false);
    cm.createAndAddBGContextToResource("c3name", course1, BusinessGroup.TYPE_RIGHTGROUP, id2, false);

    DBFactory.getInstance().closeSession(); // simulate user clicks
    assertTrue(cm.findBGContextsForResource(course1, true, true).size() == 3);
View Full Code Here

    assertTrue(cm.findBGContextsForResource(course1, BusinessGroup.TYPE_RIGHTGROUP, true, true).size() == 0);
  }
 
  public void testRemoveBGFromArea() {
    BGContextManager cm = BGContextManagerImpl.getInstance();
    BGContext bgContext = cm.createAndAddBGContextToResource("c2name", course1, BusinessGroup.TYPE_LEARNINGROUP, null, true);
    assertEquals( 1,cm.findBGContextsForResource(course1, true, true).size() );
    cm.removeBGContextFromResource(bgContext, course1);
    assertEquals( 0,cm.findBGContextsForResource(course1, true, true).size() );
  }
View Full Code Here

  public void testCheckIfNamesExistsInContext() throws Exception {
    suiteIsAborted = true;

    BusinessGroupManagerImpl bgManager = (BusinessGroupManagerImpl)BusinessGroupManagerImpl.getInstance();
    BGContextManager bgContextManager = BGContextManagerImpl.getInstance();
    BGContext ctxA = bgContextManager.createAndPersistBGContext("DefaultA", "Empty", BusinessGroup.TYPE_LEARNINGROUP, id1, true);
    BGContext ctxB = bgContextManager.createAndPersistBGContext("DefaultB", "Empty", BusinessGroup.TYPE_LEARNINGROUP, id1, true);

    String[] namesInCtxA = new String[] { "A-GroupOne", "A-GroupTwo", "A-GroupThree", "A-GroupFour", "A-GroupFive", "A-GroupSix" };
    String[] namesInCtxB = new String[] { "B-GroupAAA", "B-GroupBBB", "B-GroupCCC", "B-GroupDDD", "B-GroupEEE", "B-GroupFFF" };
    BusinessGroup[] ctxAgroups = new BusinessGroup[namesInCtxA.length];
    BusinessGroup[] ctxBgroups = new BusinessGroup[namesInCtxB.length];
View Full Code Here

    doTestDeleteBusinessGroup(false);
  }

  private void doTestDeleteBusinessGroup(boolean withWaitingList) {
    BGContextManager bgcm = BGContextManagerImpl.getInstance();
    BGContext groupContext = bgcm.createAndPersistBGContext("c1delete", "c1delete", BusinessGroup.TYPE_LEARNINGROUP, null, true);

    BusinessGroup deleteTestGroup = BusinessGroupManagerImpl.getInstance().createAndPersistBusinessGroup(BusinessGroup.TYPE_LEARNINGROUP, id1, "deleteTestGroup-1",
        "deleteTestGroup-1", null, null, withWaitingList, true, groupContext);
   
    Long ownerGroupKey = deleteTestGroup.getOwnerGroup().getKey();
View Full Code Here

TOP

Related Classes of org.olat.group.context.BGContext

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.