Search in sources :

Example 66 with SoapProvisioning

use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.

the class TestLog method testAllCategories.

/**
     * Confirms that account loggers are added for all categories when the
     * category name is set to "all" (bug 29715).
     */
public void testAllCategories() throws Exception {
    SoapProvisioning prov = TestUtil.newSoapProvisioning();
    Account account = TestUtil.getAccount("user1");
    assertEquals(0, prov.getAccountLoggers(account, null).size());
    List<AccountLogger> loggers = prov.addAccountLogger(account, "all", "debug", null);
    assertTrue(loggers.size() > 1);
    // Make sure the zimbra.soap category was affected.
    assertLoggerExists(loggers, account, "zimbra.soap", Level.debug);
    loggers = prov.getAccountLoggers(account, null);
    assertLoggerExists(loggers, account, "zimbra.soap", Level.debug);
}
Also used : Account(com.zimbra.cs.account.Account) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) AccountLogger(com.zimbra.common.util.AccountLogger)

Example 67 with SoapProvisioning

use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.

the class TestZimbraHttpConnectionManager method runSoapProv.

private static void runSoapProv(String msg) {
    System.out.println(msg);
    SoapProvisioning sp = new SoapProvisioning();
    String uri = LC.zimbra_admin_service_scheme.value() + LC.zimbra_zmprov_default_soap_server.value() + ":" + LC.zimbra_admin_service_port.intValue() + AdminConstants.ADMIN_SERVICE_URI;
    sp.soapSetURI(uri);
    try {
        sp.getDomainInfo(Key.DomainBy.name, "phoebe.mac");
    } catch (ServiceException e) {
        e.printStackTrace();
    }
}
Also used : ServiceException(com.zimbra.common.service.ServiceException) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Example 68 with SoapProvisioning

use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.

the class TestUtil method deleteAccount.

/**
     * Deletes the account for the given username. Consider using {@link deleteAccountIfExists} as alternative
     * to reduce logging where the account may not exist.
     */
public static void deleteAccount(String username) throws ServiceException {
    Provisioning prov = Provisioning.getInstance();
    // so that both the account and mailbox are deleted.
    if (!(prov instanceof SoapProvisioning)) {
        prov = newSoapProvisioning();
    }
    SoapProvisioning soapProv = (SoapProvisioning) prov;
    GetAccountRequest gaReq = new GetAccountRequest(AccountSelector.fromName(username), false, Lists.newArrayList(Provisioning.A_zimbraId));
    try {
        GetAccountResponse resp = soapProv.invokeJaxb(gaReq);
        if (resp != null) {
            String id = null;
            for (Attr attr : resp.getAccount().getAttrList()) {
                if (Provisioning.A_zimbraId.equals(attr.getKey())) {
                    id = attr.getValue();
                    break;
                }
            }
            if (null == id) {
                ZimbraLog.test.error("GetAccountResponse for '%s' did not contain the zimbraId", username);
            }
            prov.deleteAccount(id);
        }
    } catch (SoapFaultException sfe) {
        if (!sfe.getMessage().contains("no such account")) {
            ZimbraLog.test.error("GetAccountResponse for '%s' hit unexpected problem", username, sfe);
        }
    }
}
Also used : GetAccountResponse(com.zimbra.soap.admin.message.GetAccountResponse) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) GetAccountRequest(com.zimbra.soap.admin.message.GetAccountRequest) Provisioning(com.zimbra.cs.account.Provisioning) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) QueueAttr(com.zimbra.cs.rmgmt.RemoteMailQueue.QueueAttr) Attr(com.zimbra.soap.admin.type.Attr) SoapFaultException(com.zimbra.common.soap.SoapFaultException)

Example 69 with SoapProvisioning

use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.

the class TestUtil method newDelegatedSoapProvisioning.

public static SoapProvisioning newDelegatedSoapProvisioning(String login, String password) throws ServiceException {
    SoapProvisioning sp = new SoapProvisioning();
    sp.soapSetURI("https://localhost:7071" + AdminConstants.ADMIN_SERVICE_URI);
    sp.soapAdminAuthenticate(login, password);
    return sp;
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Example 70 with SoapProvisioning

use of com.zimbra.cs.account.soap.SoapProvisioning in project zm-mailbox by Zimbra.

the class ProvUtil method doGetAllServers.

private void doGetAllServers(String[] args) throws ServiceException {
    boolean verbose = false;
    boolean applyDefault = true;
    String service = null;
    int i = 1;
    while (i < args.length) {
        String arg = args[i];
        if (arg.equals("-v")) {
            verbose = true;
        } else if (arg.equals("-e")) {
            applyDefault = false;
        } else {
            if (service == null) {
                service = arg;
            } else {
                console.println("invalid arg: " + arg + ", already specified service: " + service);
                usage();
                return;
            }
        }
        i++;
    }
    if (!applyDefault && !verbose) {
        console.println(ERR_INVALID_ARG_EV);
        usage();
        return;
    }
    List<Server> servers;
    if (prov instanceof SoapProvisioning) {
        SoapProvisioning soapProv = (SoapProvisioning) prov;
        servers = soapProv.getAllServers(service, applyDefault);
    } else {
        servers = prov.getAllServers(service);
    }
    for (Server server : servers) {
        if (verbose) {
            dumpServer(server, applyDefault, null);
        } else {
            console.println(server.getName());
        }
    }
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning)

Aggregations

SoapProvisioning (com.zimbra.cs.account.soap.SoapProvisioning)78 Test (org.junit.Test)18 SoapFaultException (com.zimbra.common.soap.SoapFaultException)14 Account (com.zimbra.cs.account.Account)13 Attr (com.zimbra.soap.admin.type.Attr)10 ServiceException (com.zimbra.common.service.ServiceException)9 CreateDistributionListRequest (com.zimbra.soap.admin.message.CreateDistributionListRequest)6 CreateDistributionListResponse (com.zimbra.soap.admin.message.CreateDistributionListResponse)6 AccountLogger (com.zimbra.common.util.AccountLogger)5 Server (com.zimbra.cs.account.Server)5 CreateCalendarResourceRequest (com.zimbra.soap.admin.message.CreateCalendarResourceRequest)4 CreateCalendarResourceResponse (com.zimbra.soap.admin.message.CreateCalendarResourceResponse)4 DeleteCalendarResourceRequest (com.zimbra.soap.admin.message.DeleteCalendarResourceRequest)4 List (java.util.List)4 SoapHttpTransport (com.zimbra.common.soap.SoapHttpTransport)3 AccountServiceException (com.zimbra.cs.account.AccountServiceException)3 Provisioning (com.zimbra.cs.account.Provisioning)3 CacheEntry (com.zimbra.cs.account.Provisioning.CacheEntry)3 DeleteAccountRequest (com.zimbra.soap.admin.message.DeleteAccountRequest)3 DeleteAccountResponse (com.zimbra.soap.admin.message.DeleteAccountResponse)3