Search in sources :

Example 1 with RandomDn

use of org.xipki.ca.client.shell.loadtest.LoadTestEntry.RandomDn in project xipki by xipki.

the class CaLoadTestEnrollCmd method execute0.

@Override
protected Object execute0() throws Exception {
    if (numThreads < 1) {
        throw new IllegalCmdParamException("invalid number of threads " + numThreads);
    }
    if ("EC".equalsIgnoreCase(keyType) && StringUtil.isBlank(curveName)) {
        throw new IllegalCmdParamException("curveName is not specified");
    }
    String description = StringUtil.concatObjectsCap(200, "subjectTemplate: ", subjectTemplate, "\nprofile: ", certprofile, "\nkeyType: ", keyType, "\nmaxRequests: ", maxRequests, "\nunit: ", num, " certificate", (num > 1 ? "s" : ""));
    RandomDn randomDn = null;
    if (randomDnStr != null) {
        randomDn = RandomDn.getInstance(randomDnStr);
        if (randomDn == null) {
            throw new IllegalCmdParamException("invalid randomDN " + randomDnStr);
        }
    }
    KeyEntry keyEntry;
    if ("EC".equalsIgnoreCase(keyType)) {
        keyEntry = new ECKeyEntry(curveName);
    } else if ("RSA".equalsIgnoreCase(keyType)) {
        keyEntry = new RSAKeyEntry(keysize.intValue());
    } else if ("DSA".equalsIgnoreCase(keyType)) {
        keyEntry = new DSAKeyEntry(keysize.intValue());
    } else {
        throw new IllegalCmdParamException("invalid keyType " + keyType);
    }
    LoadTestEntry loadtestEntry = new LoadTestEntry(certprofile, keyEntry, subjectTemplate, randomDn);
    CaLoadTestEnroll loadTest = new CaLoadTestEnroll(caClient, loadtestEntry, maxRequests, num, description);
    loadTest.setDuration(duration);
    loadTest.setThreads(numThreads);
    loadTest.test();
    return null;
}
Also used : DSAKeyEntry(org.xipki.ca.client.shell.loadtest.KeyEntry.DSAKeyEntry) IllegalCmdParamException(org.xipki.console.karaf.IllegalCmdParamException) RandomDn(org.xipki.ca.client.shell.loadtest.LoadTestEntry.RandomDn) RSAKeyEntry(org.xipki.ca.client.shell.loadtest.KeyEntry.RSAKeyEntry) ECKeyEntry(org.xipki.ca.client.shell.loadtest.KeyEntry.ECKeyEntry) RSAKeyEntry(org.xipki.ca.client.shell.loadtest.KeyEntry.RSAKeyEntry) DSAKeyEntry(org.xipki.ca.client.shell.loadtest.KeyEntry.DSAKeyEntry) ECKeyEntry(org.xipki.ca.client.shell.loadtest.KeyEntry.ECKeyEntry)

Aggregations

DSAKeyEntry (org.xipki.ca.client.shell.loadtest.KeyEntry.DSAKeyEntry)1 ECKeyEntry (org.xipki.ca.client.shell.loadtest.KeyEntry.ECKeyEntry)1 RSAKeyEntry (org.xipki.ca.client.shell.loadtest.KeyEntry.RSAKeyEntry)1 RandomDn (org.xipki.ca.client.shell.loadtest.LoadTestEntry.RandomDn)1 IllegalCmdParamException (org.xipki.console.karaf.IllegalCmdParamException)1