Search in sources :

Example 36 with SoapProvisioning

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

the class BlobDeduperUtil method run.

private void run() throws Exception {
    CliUtil.toolSetup();
    SoapProvisioning prov = SoapProvisioning.getAdminInstance();
    prov.soapZimbraAdminAuthenticate();
    DedupeBlobsRequest request = new DedupeBlobsRequest(action);
    for (short volumeId : volumeIds) {
        request.addVolume(new IntIdAttr(volumeId));
    }
    Element respElem = prov.invoke(JaxbUtil.jaxbToElement(request));
    DedupeBlobsResponse response = JaxbUtil.elementToJaxb(respElem);
    if (action == DedupeBlobsRequest.DedupAction.start) {
        System.out.println("Dedupe scheduled. Run \"zmdedupe status\" to check the status.");
    } else {
        System.out.println("Status = " + response.getStatus().name());
        System.out.println("Total links created = " + response.getTotalCount());
        System.out.println("Total size saved = " + response.getTotalSize());
        VolumeIdAndProgress[] volumeBlobsProgress = response.getVolumeBlobsProgress();
        if (volumeBlobsProgress != null && volumeBlobsProgress.length > 0) {
            System.out.printf("%32s : %10s - %s\n", "Groups populated in volume blobs", "volumeId", "groups/total_groups");
            for (VolumeIdAndProgress idAndProgress : volumeBlobsProgress) {
                System.out.printf("%32s   %10s - %s\n", "", idAndProgress.getVolumeId(), idAndProgress.getProgress());
            }
        }
        VolumeIdAndProgress[] blobDigestsProgress = response.getBlobDigestsProgress();
        if (blobDigestsProgress != null && blobDigestsProgress.length > 0) {
            System.out.printf("%32s : %10s - %s\n", "Digests Processed", "volumeId", "digests/total_digests");
            for (VolumeIdAndProgress idAndProgress : blobDigestsProgress) {
                System.out.printf("%32s   %10s - %s\n", "", idAndProgress.getVolumeId(), idAndProgress.getProgress());
            }
        }
    }
}
Also used : DedupeBlobsRequest(com.zimbra.soap.admin.message.DedupeBlobsRequest) IntIdAttr(com.zimbra.soap.admin.type.IntIdAttr) DedupeBlobsResponse(com.zimbra.soap.admin.message.DedupeBlobsResponse) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) VolumeIdAndProgress(com.zimbra.soap.admin.type.VolumeIdAndProgress) Element(com.zimbra.common.soap.Element)

Example 37 with SoapProvisioning

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

the class BlobConsistencyUtil method run.

private void run() throws Exception {
    if (unexpectedBlobList != null) {
        unexpectedBlobWriter = new PrintWriter(new FileOutputStream(unexpectedBlobList), true);
    }
    if (usedBlobList != null) {
        usedBlobWriter = new PrintWriter(new FileOutputStream(usedBlobList), true);
    }
    CliUtil.toolSetup();
    SoapProvisioning prov = SoapProvisioning.getAdminInstance();
    prov.soapZimbraAdminAuthenticate();
    if (mailboxIds == null) {
        mailboxIds = getAllMailboxIds(prov);
    }
    try {
        DbPool.startup();
        for (int mboxId : mailboxIds) {
            System.out.println("Checking mailbox " + mboxId + ".");
            checkMailbox(mboxId, prov);
        }
    } finally {
        DbPool.shutdown();
    }
    if (unexpectedBlobWriter != null) {
        unexpectedBlobWriter.close();
    }
    if (usedBlobWriter != null) {
        usedBlobWriter.close();
    }
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) FileOutputStream(java.io.FileOutputStream) PrintWriter(java.io.PrintWriter)

Example 38 with SoapProvisioning

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

the class TestProvisioning method setUp.

public void setUp() throws Exception {
    mProv = Provisioning.getInstance();
    assertTrue(mProv instanceof LdapProv);
    mLdapProv = (LdapProv) mProv;
    mCustomProvTester = new CustomProvTester(mProv);
    mSoapProv = new SoapProvisioning();
    mSoapProv.soapSetURI(TestUtil.getAdminSoapUrl());
    mSoapProv.soapZimbraAdminAuthenticate();
    TEST_ID = TestProvisioningUtil.genTestId();
    PRE_AUTH_KEY = PreAuthKey.generateRandomPreAuthKey();
    PASSWORD = "test123";
    SPECIAL_CHARS_ALLOWED_IN_DOMAIN = "/";
    SPECIAL_CHARS_ALLOWED_IN_USER_PART = "/";
    COS_NAME = "cos-" + TEST_ID;
    // DOMAIN_NAME = "domain-" + TEST_ID + ".ldap-test-domain";
    // DOMAIN_NAME_SPECIAL_CHARS = "domain-" + SPECIAL_CHARS_ALLOWED_IN_DOMAIN + "-" + TEST_ID + ".ldap-test-domain";
    DOMAIN_NAME = TestProvisioningUtil.baseDomainName("domain", TEST_ID);
    // DOMAIN_NAME_SPECIAL_CHARS = TestProvisioningUtil.baseDomainName("domain-" + SPECIAL_CHARS_ALLOWED_IN_DOMAIN, TEST_ID);
    // TODO: javamail now is more strict on domain names!!
    DOMAIN_NAME_SPECIAL_CHARS = TestProvisioningUtil.baseDomainName("domain-special", TEST_ID);
    OTHER_DOMAIN_NAME = "other-" + DOMAIN_NAME;
    SERVER_NAME = "server-" + TEST_ID;
    ZIMLET_NAME = "zimlet-" + TEST_ID;
    NEW_NAME = "newname";
    NEW_EMAIL = NEW_NAME + "-" + TEST_ID + "@" + DOMAIN_NAME;
    NEW_EMAIL_IN_OTHER_DOMAIN = NEW_NAME + "-" + TEST_ID + "@" + OTHER_DOMAIN_NAME;
    DEFAULT_LDAP_ADMIN_USER = LC.zimbra_ldap_user.value();
    ADMIN_USER = "admin";
    ADMIN_EMAIL = ADMIN_USER + "@" + DOMAIN_NAME;
    ACCT_USER = "acct-1";
    ACCT_EMAIL = ACCT_USER + "@" + DOMAIN_NAME;
    ACCT_USER_SPECIAL_CHARS = "acct-special-chars-" + SPECIAL_CHARS_ALLOWED_IN_USER_PART;
    ACCT_EMAIL_SPECIAL_CHARS = ACCT_USER_SPECIAL_CHARS + "@" + DOMAIN_NAME_SPECIAL_CHARS;
    ACCT_ALIAS_USER = "alias-of-" + ACCT_USER;
    ACCT_ALIAS_EMAIL = ACCT_ALIAS_USER + "@" + DOMAIN_NAME;
    ACCT_ALIAS_AFTER_ACCOUNT_RENAME_TO_OTHER_DMAIN_EMAIL = ACCT_ALIAS_USER + "@" + OTHER_DOMAIN_NAME;
    ACCT_ALIAS_IN_OTHER_DOMAIN_USER = ACCT_ALIAS_USER + "-in-other-domain";
    ACCT_ALIAS_IN_OTHER_DOMAIN_EMAIL = ACCT_ALIAS_IN_OTHER_DOMAIN_USER + "@" + OTHER_DOMAIN_NAME;
    ACCT_ALIAS_IN_OTHER_DOMAIN_AFTER_ACCOUNT_RENAME_TO_ORIG_DOMAIN_EMAIL = ACCT_ALIAS_IN_OTHER_DOMAIN_USER + "@" + DOMAIN_NAME;
    ACCT_FULL_NAME = "Phoebe Shao";
    ACCT_NAMING_ATTR = LC.get("ldap_dit_naming_rdn_attr_user");
    if (StringUtil.isNullOrEmpty(ACCT_NAMING_ATTR))
        ACCT_NAMING_ATTR = "uid";
    ACCT_NAMING_ATTR_VALUE = namingAttrValue(ACCT_USER);
    ACCT_BASE_DN = "ou=grp1,ou=mail,o=Comcast";
    CR_USER = "cr-1";
    CR_EMAIL = CR_USER + "@" + DOMAIN_NAME;
    CR_ALIAS_USER = "alias-of-" + CR_USER;
    CR_ALIAS_EMAIL = CR_ALIAS_USER + "@" + DOMAIN_NAME;
    DL_USER = "dl-1";
    DL_EMAIL = DL_USER + "@" + DOMAIN_NAME;
    DL_USER_SPECIAL_CHARS = "dl-special-chars-" + SPECIAL_CHARS_ALLOWED_IN_USER_PART;
    DL_EMAIL_SPECIAL_CHARS = DL_USER_SPECIAL_CHARS + "@" + DOMAIN_NAME_SPECIAL_CHARS;
    DL_ALIAS_USER = "alias-of" + DL_USER;
    DL_ALIAS_EMAIL = DL_ALIAS_USER + "@" + DOMAIN_NAME;
    DL_NESTED_USER = "dl-nested";
    DL_NESTED_EMAIL = DL_NESTED_USER + "@" + DOMAIN_NAME;
    DL_NESTED_ALIAS_USER = "alias-of-" + DL_NESTED_USER;
    DL_NESTED_ALIAS_EMAIL = DL_NESTED_ALIAS_USER + "@" + DOMAIN_NAME;
    DATA_SOURCE_NAME = "datasource-1";
    IDENTITY_NAME = "identity-1";
    SIGNATURE_NAME = "signature-1";
    SIGNATURE_VALUE = "this is my signature";
    SIGNATURE_VALUE_MODIFIED = "this is my signature MODIFIED";
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) LdapProv(com.zimbra.cs.account.ldap.LdapProv)

Example 39 with SoapProvisioning

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

the class SetHeaderFilter method getResponseHeaders.

private KeyValue[] getResponseHeaders(String serverName) {
    KeyValue[] headers = RESPONSE_HEADERS.get(serverName);
    if (headers == null) {
        headers = NO_HEADERS;
        try {
            SoapProvisioning provisioning = new SoapProvisioning();
            String soapUri = LC.zimbra_admin_service_scheme.value() + LC.zimbra_zmprov_default_soap_server.value() + ':' + LC.zimbra_admin_service_port.intValue() + AdminConstants.ADMIN_SERVICE_URI;
            provisioning.soapSetURI(soapUri);
            provisioning.soapZimbraAdminAuthenticate();
            Entry info = provisioning.getDomainInfo(Key.DomainBy.virtualHostname, serverName);
            if (info == null) {
                info = provisioning.getConfig();
            }
            if (info != null) {
                String[] values = info.getMultiAttr(ZAttrProvisioning.A_zimbraResponseHeader, true);
                headers = new KeyValue[values.length];
                for (int i = 0; i < values.length; i++) {
                    String value = values[i];
                    Matcher matcher = RE_HEADER.matcher(value);
                    if (matcher.matches()) {
                        headers[i] = new KeyValue(matcher.group(1), matcher.group(2));
                    } else {
                        headers[i] = new KeyValue(value);
                    }
                }
            }
        } catch (Exception e) {
            getLogger().error("Unable to get domain config", e);
        }
        RESPONSE_HEADERS.putIfAbsent(serverName, headers);
    }
    return headers;
}
Also used : Entry(com.zimbra.cs.account.Entry) SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) Matcher(java.util.regex.Matcher) ServletException(javax.servlet.ServletException) IOException(java.io.IOException)

Example 40 with SoapProvisioning

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

the class ZMailboxUtil method adminAuth.

private void adminAuth(ZAuthToken zat, String uri) throws ServiceException {
    SoapTransport.DebugListener listener = mDebug ? this : null;
    mProv = new SoapProvisioning();
    mProv.soapSetURI(ZMailbox.resolveUrl(uri, true));
    if (listener != null) {
        mProv.soapSetTransportDebugListener(listener);
    }
    mProv.soapAdminAuthenticate(zat);
}
Also used : SoapProvisioning(com.zimbra.cs.account.soap.SoapProvisioning) DebugListener(com.zimbra.common.soap.SoapTransport.DebugListener) SoapTransport(com.zimbra.common.soap.SoapTransport)

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