Exemplo n.º 1
0
def extraScopeTest(mc, custid):
    global ok_count
    global failed_count

    rgm = None
    rg = None
    
    try:
        rgm = mc.getReviewerGroupManager()
        mailboxScope = InternalUserSets.getAllUsersSet(custid)
        mc.getUserManager().saveUserSet(mailboxScope)
        reviewers = InternalUserSets.getAllUsersSet(custid)
        mc.getUserManager().saveUserSet(reviewers)

        rg = rgm.getReviewerGroup(custid, "dummyGroup99")
        if None != rg :
            print 'removing pre-existing reviewergroup'
            rgm.deleteReviewerGroup(custid,rg.getGroupID())
        rg = rgm.createReviewerGroup(custid, "dummyGroup99", reviewers, mailboxScope, "mailfrom:irfan")
        if None != rg :
            print 'created rg='+rg.toString()
            rg1 = rgm.getReviewerGroup(custid, "dummyGroup99")
	    if "mailfrom:irfan" != rg1.getExtraScope() :
                print 'FAIL - extrascope not correctly set for rg'
        else :
            print 'failed to create reviewerGroup'
        test(2,mc,custid,'','','','','','any',None,rg) 
        test(1,mc,custid,'','','','','','any',True,rg)
        test(1,mc,custid,'','','','','','any',False,rg)
        test(2,mc,custid,'','','','','','en',None,rg)
        test(1,mc,custid,'','','','','','en',True,rg)
        test(1,mc,custid,'','','','','','en',False,rg)
        test(2,mc,custid,'','','','','','ja',None,rg)
        test(1,mc,custid,'','','','','','ja',True,rg)
        test(1,mc,custid,'','','','','','ja',False,rg)

    finally:
        if None != rgm :
            if None != rg :
                print 'removing reviewergroup'
                rgm.deleteReviewerGroup(custid,rg.getGroupID())
            else :
               print 'no reviewer group to clean up'
        else : 
            print ' no reviewer group manager available'
Exemplo n.º 2
0
def setupExportCustomer(numMessages, islandId, cloudDomain, stage1Mta):

    print time.asctime(), 'Start setting '
    userMsgs = [0] * len(users)
    mc = ManagementContainer.getInstance()
    custId = setupCustomer(mc, str(islandId),domain=domainName, name=custname, isCloud=True,userAccounts=users, recvDate="now")

    print time.asctime(), 'customerID', custId

    propagateMtaConfig()

    custList = mc.getCustomerManager().findCustomers([SearchConstraint(ICustomerManager.PROP_NAME, SearchConstraintOperator.CONSTRAINT_EQUALS, custname)])

    cust = custList[0]

    office365Guid = cust.getGuids(CloudService.OFFICE365)[0].getGuid()

    # stage cloud messages
    for i in range(numMessages):
        if (i % 5) == 0:
            sendJournalMessage(office365Guid, users[0], ["invaliduser"], None, None, domainName, cloudDomain, stage1Mta)
            userMsgs[0] += 1
        elif (i % 4) == 0:
            sendJournalMessage(office365Guid, "invaliduser", [users[1]], None, None, domainName, cloudDomain, stage1Mta)
            userMsgs[1] += 1
        elif (i % 3) == 0:
            sendJournalMessage(office365Guid, "invaliduser", None, [users[2]], None, domainName, cloudDomain, stage1Mta)
            userMsgs[2] += 1
        elif (i % 2) == 0:
            sendJournalMessage(office365Guid, "invaliduser", None, None, [users[3]], domainName, cloudDomain, stage1Mta)
            userMsgs[3] += 1
        else :
            sendJournalMessage(office365Guid, users[0], [users[1]], [users[2]], [users[3]], domainName, cloudDomain, stage1Mta)
            for j in range(len(users)):
                userMsgs[j] += 1

        sleep(1)

    # create reviewer group
    print time.asctime(), 'creating reviewer group...'
    allUsers = InternalUserSets.getAllUsersSet(cust.getCustID())
    mc.getUserManager().saveUserSet(allUsers)

    reviewer = mc.getUserManager().findUserForEmail(users[0] + '@' + domainName)
    reviewerSet = SavedUserSet(cust.getCustID())
    reviewerSet.addUsers(Collections.singletonList(SearchConstraint(IUserManager.PROP_USERID, SearchConstraintOperator.CONSTRAINT_EQUALS, reviewer.getUserID())))
    mc.getUserManager().saveUserSet(reviewerSet)
    mc.getReviewerGroupManager().createReviewerGroup(cust.getCustID(), REVIEWER_GROUP_NAME, reviewerSet, allUsers, None)

    sys.exit(0)
Exemplo n.º 3
0
def mainTest(authToken,altToken,altToken2,url,mc,custId):
    global ok_count
    global failed_count



    # this test needs to run BEFORE users are enabled for foldersync
    TestHWMNoUser(url, authToken).runMe()

    # enable all users for foldersync
    fsm = mc.getFolderSyncManager()
    mailboxScope = InternalUserSets.getAllUsersSet(custId)
    mc.getUserManager().saveUserSet(mailboxScope)
    fsm.saveUserSetEnabledForSync(custId, mailboxScope)

    # this test must run AFTER users are enabled for foldersync, but BEFORE any foldersync data is injected
    TestHWMNoData(url, authToken).runMe()
    # this test sets up some HWM data and then retrieves it via a service call
    TestHWMGoodData(url, altToken, mc,fsm).runMe()

    TestSorting(url, authToken).runMe()

    TestCaching(url, authToken).runMe()

    TestJiraEmsDev11292(url,authToken).runMe()

    TestJiraEmsDev11295(url,authToken).runMe()

    TestJiraEmsDev11262(url,authToken).runMe()

    TestSentDirectly(url,altToken).runMe()

    TestSearchBody(url,altToken2).runMe()

    TestSearchSubject(url,authToken).runMe()

    TestSender(url,authToken).runMe()

    TestFolderHeader(url,authToken).runMe()
Exemplo n.º 4
0
def setupTest(islandId):
    try:
        print time.asctime(), 'setting up test customer'
        mc = ManagementContainer.getInstance()
        island = mc.getIslandManager().getIsland(int(islandId))
        if not island.isEdiscoveryEnabled():
           raise Exception('island for test must support eDiscovery.')

        print time.asctime(), 'setting up test customer'
        custId = setupCustomer(mc, islandId,corpus='/tmp/perfCorpus', domain=CUSTOMER_DOMAIN, name=CUSTOMER_NAME, enableFolderSync=True, corpusFolders=True, recvDate='now')

        # enable all users for foldersync
        fsm = mc.getFolderSyncManager()
        mailboxScope = InternalUserSets.getAllUsersSet(custId)
        mc.getUserManager().saveUserSet(mailboxScope)
        fsm.saveUserSetEnabledForSync(custId, mailboxScope)

        # don't know how many or how long...
        print time.asctime(), 'setup started... please wait for ingestion if you need a static set of messages imported'
        sys.exit(0)

    except Exception, e:
        print 'error during setup:', e
        sys.exit(1)