use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.
the class TestUtil method deleteDistributionList.
/**
* Deletes the specified DL.
*/
public static void deleteDistributionList(String listName) throws ServiceException {
Provisioning prov = Provisioning.getInstance();
// so that both the account and mailbox are deleted.
if (!(prov instanceof SoapProvisioning)) {
prov = newSoapProvisioning();
}
DistributionList dl = prov.get(DistributionListBy.name, getAddress(listName));
if (dl != null) {
prov.deleteDistributionList(dl.getId());
}
}
use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.
the class TestUtil method setLCValue.
protected static void setLCValue(KnownKey key, String newValue) throws DocumentException, ConfigException, IOException, ServiceException {
LocalConfig lc = new LocalConfig(null);
if (newValue == null) {
lc.remove(key.key());
} else {
lc.set(key.key(), newValue);
}
lc.save();
SoapProvisioning prov = TestUtil.newSoapProvisioning();
ReloadLocalConfigRequest req = new ReloadLocalConfigRequest();
ReloadLocalConfigResponse resp = prov.invokeJaxb(req);
assertNotNull("ReloadLocalConfigResponse", resp);
}
use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.
the class DistributionListDocumentHandler method flushAccountCache.
private static void flushAccountCache(Provisioning prov, String[] members) {
// List<CacheEntry> localAccts = Lists.newArrayList();
Map<String, List<CacheEntry>> /* server name */
remoteAccts = Maps.newHashMap();
for (String member : members) {
try {
Account acct = prov.get(AccountBy.name, member);
if (acct != null) {
if (prov.onLocalServer(acct)) {
// localAccts.add(new CacheEntry(CacheEntryBy.id, acct.getId()));
} else {
Server server = acct.getServer();
String serverName = server.getName();
List<CacheEntry> acctsOnServer = remoteAccts.get(serverName);
if (acctsOnServer == null) {
acctsOnServer = Lists.newArrayList();
remoteAccts.put(serverName, acctsOnServer);
}
acctsOnServer.add(new CacheEntry(CacheEntryBy.id, acct.getId()));
}
}
// else, not internal account, skip
} catch (ServiceException e) {
// log and continue
ZimbraLog.account.warn("unable to flush account cache", e);
}
}
/*
* No need to flush cache on local server, account membership for static/dynamic
* groups are handled in LdapProvisioning
*
// flush accounts from cache on local server
try {
prov.flushCache(CacheEntryType.account, localAccts.toArray(new CacheEntry[localAccts.size()]));
} catch (ServiceException e) {
// log and continue
ZimbraLog.account.warn("unable to flush account cache on local server", e);
}
*/
// flush accounts from cache on remote servers
// if the remote server does not run admin server, too bad - accounts on that
// server will have to wait till cache expire to get updated membership
SoapProvisioning soapProv = new SoapProvisioning();
String adminUrl = null;
for (Map.Entry<String, List<CacheEntry>> acctsOnServer : remoteAccts.entrySet()) {
String serverName = acctsOnServer.getKey();
List<CacheEntry> accts = acctsOnServer.getValue();
try {
Server server = prov.get(ServerBy.name, serverName);
adminUrl = URLUtil.getAdminURL(server, AdminConstants.ADMIN_SERVICE_URI, true);
soapProv.soapSetURI(adminUrl);
soapProv.soapZimbraAdminAuthenticate();
soapProv.flushCache(CacheEntryType.account, accts.toArray(new CacheEntry[accts.size()]));
} catch (ServiceException e) {
ZimbraLog.account.warn("unable to flush account cache on remote server: " + serverName, e);
}
}
}
use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.
the class SoapProvTestUtil method getSoapProvisioning.
static SoapProvisioning getSoapProvisioning(String userName, String password) throws ServiceException {
SoapProvisioning sp = new SoapProvisioning();
sp.soapSetHttpTransportDebugListener(new SoapDebugListener());
sp.soapSetURI("https://localhost:7071" + AdminConstants.ADMIN_SERVICE_URI);
sp.soapAdminAuthenticate(userName, password);
return sp;
}
use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.
the class Cleanup method deleteAll.
static void deleteAll(String... domainNames) throws Exception {
if (InMemoryLdapServer.isOn()) {
return;
}
com.zimbra.qa.unittest.prov.ldap.Cleanup.deleteAll(domainNames);
SoapProvisioning prov = SoapProvisioning.getAdminInstance();
prov.flushCache(CacheEntryType.account.name() + "," + CacheEntryType.group.name() + "," + CacheEntryType.config.name() + "," + CacheEntryType.globalgrant.name() + "," + CacheEntryType.cos.name() + "," + CacheEntryType.domain.name() + "," + CacheEntryType.mime.name() + "," + CacheEntryType.server.name() + "," + CacheEntryType.alwaysOnCluster.name() + "," + CacheEntryType.zimlet.name(), null, true);
}
Aggregations