caps.setBooleanCapability(Capabilities.CAP_ALLOW_ARCHIVE_EDISCOVERY,True) mc.getCustomerManager().saveCustomerCapabilities(caps) caps = mc.getCustomerManager().getCustomerCapabilities(int(custId)) print custId,'ediscovery is',caps.getBooleanCapability(Capabilities.CAP_ALLOW_ARCHIVE_EDISCOVERY) uName = '*****@*****.**' token = getAuthToken(mc, custId, uName) token2 = getAuthToken(mc, custId, '*****@*****.**') token3 = getAuthToken(mc, custId, '*****@*****.**') # get application server using SOR() sor = SOR() hosts = sor.getApplicationServers() if hosts is None: print 'Did not find expected host for Application Server ',hosts sys.exit(1) ApplicationServerHost = hosts.pop() BaseURL = 'https://'+ApplicationServerHost+'/wfe/client/' mainTest(token,token2,token3,BaseURL,mc,custId) # # turn off ediscovery for customer # caps = mc.getCustomerManager().getCustomerCapabilities(int(custId)) # caps.setBooleanCapability(Capabilities.CAP_ALLOW_ARCHIVE_EDISCOVERY,False)
def runTests(): ok_count = 0 failed_count = 0 try: mc = ManagementContainer.getInstance() custList = mc.getCustomerManager().findCustomers([SearchConstraint(ICustomerManager.PROP_NAME, SearchConstraintOperator.CONSTRAINT_EQUALS, CUSTOMER_NAME)]) cust = custList[0] custId = cust.getCustID() # get application server using SOR() # # NOTE THAT YOU MUST INITIALIZE SOR(x) where x is the DOMAIN of the ems machine e.g. 'qa.messageone.com' if it is not an openstack backend # sor = SOR() hosts = sor.getApplicationServers() if hosts is None or len(hosts) == 0: print 'Did not find expected host for Application Server ',hosts sys.exit(1) applicationServerHost = hosts.pop() baseURL = 'https://'+applicationServerHost+'/wfe/client/' token = getAuthToken(mc, custId, 'pallen' + '@' + CUSTOMER_DOMAIN) # need to find a user that owns emails, and a folder in that association print time.asctime(),'test without folder' t0 = time.clock() status, headers, content = searchCall(baseURL, token, '0 1 2 3 4 5 6 7 8 9 ', sort='0x0037:0', queryXML = '<SubRestriction></SubRestriction>',lang = None, folder = None) t1 = time.clock() print time.asctime(),'elapsed time =', (t1-t0), 'Sec' print time.asctime(),len(content) #print content print time.asctime(),'test with folder' t0 = time.clock() status, headers, content = searchCall(baseURL, token, '0 1 2 3 4 5 6 7 8 9 ', sort='0x0037:0', queryXML = '<SubRestriction></SubRestriction>',lang = None, folder = 'allen-p/all_documents/') t1 = time.clock() print time.asctime(),'elapsed time =', (t1-t0), 'Sec' print time.asctime(),len(content) #print content print time.asctime(),'test without folder' t0 = time.clock() status, headers, content = searchCall(baseURL, token, '0 1 2 3 4 5 6 7 8 9 ', sort='0x0037:0', queryXML = '<SubRestriction></SubRestriction>',lang = None, folder = None) t1 = time.clock() print time.asctime(),'elapsed time =', (t1-t0), 'Sec' print time.asctime(),len(content) #print content print time.asctime(),'test with folder' t0 = time.clock() status, headers, content = searchCall(baseURL, token, '0 1 2 3 4 5 6 7 8 9 ', sort='0x0037:0', queryXML = '<SubRestriction></SubRestriction>',lang = None, folder = 'allen-p/all_documents/') t1 = time.clock() print time.asctime(),'elapsed time =', (t1-t0), 'Sec' print time.asctime(),len(content) print time.asctime(),'test without folder' t0 = time.clock() status, headers, content = searchCall(baseURL, token, '0 1 2 3 4 5 6 7 8 9 ', sort='0x0037:0', queryXML = '<SubRestriction></SubRestriction>',lang = None, folder = None) t1 = time.clock() print time.asctime(),'elapsed time =', (t1-t0), 'Sec' print time.asctime(),len(content) print time.asctime(),ok_count,'succeeded' print time.asctime(),failed_count,'failures' sys.exit(failed_count) except Exception, e: print time.asctime(),'error during test execution:', e sys.exit(1)