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;
}
Aggregations