Skip to content

Commit

Permalink
Merge pull request #102 from jenkinsci/update_error_strings
Browse files Browse the repository at this point in the history
update error strings
  • Loading branch information
weisun10 authored Feb 22, 2024
2 parents 82edec2 + 7a23fde commit 6d9be03
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ Both steps are also exposed in the pipeline job as `lrcRunTest` and `lrcGenTrend
- **Username** and **Password**
- If you use [API Access keys](https://admhelp.microfocus.com/lrc/en/Latest/Content/Storm/Admin-APIAccess.htm), select the **Use OAuth token** checkbox, then input the **Client ID** and **Client Secret**.
- **URL**, default: "https://loadrunner-cloud.saas.microfocus.com"
- **Tenant Id**, for example: 123456789
- **Tenant ID**, for example: 123456789
- **Proxy** settings (optional). If you need to use a proxy to access LoadRunner Cloud, select **Connect LoadRunner Cloud via proxy** checkbox, then configure the following fields.
- Proxy Host - The proxy server host name.
- Proxy Port - The proxy server port number.
Expand Down
26 changes: 13 additions & 13 deletions src/main/java/com/microfocus/lrc/jenkins/TestRunBuilder.java
Original file line number Diff line number Diff line change
Expand Up @@ -138,11 +138,11 @@ private String getTestIdAtRunTime(final Run<?, ?> run, final Launcher launcher)

private boolean validateJobParameters() {
if (!isPositiveInteger(this.projectId)) {
this.loggerProxy.error("invalid parameter. projectId: " + this.projectId);
this.loggerProxy.error("Invalid parameter. projectId: " + this.projectId);
return false;
}
if (!isPositiveInteger(this.testId)) {
this.loggerProxy.error("invalid parameter. testId: " + this.testId);
this.loggerProxy.error("Invalid parameter. testId: " + this.testId);
return false;
}

Expand All @@ -152,35 +152,35 @@ private boolean validateJobParameters() {
private boolean validateSystemParameters(final DescriptorImpl descriptor) {
if (Boolean.TRUE.equals(descriptor.getUseOAuth())) {
if (Utils.isEmpty(descriptor.getClientId())) {
this.loggerProxy.error("invalid parameter: clientId");
this.loggerProxy.error("Invalid parameter: clientId");
return false;
}

Secret clientSecret = descriptor.getClientSecret();
if (clientSecret == null || Utils.isEmpty(clientSecret.getPlainText())) {
this.loggerProxy.error("invalid parameter: clientSecret");
this.loggerProxy.error("Invalid parameter: clientSecret");
return false;
}
} else {
if (Utils.isEmpty(descriptor.getUsername())) {
this.loggerProxy.error("invalid parameter: username");
this.loggerProxy.error("Invalid parameter: username");
return false;
}

Secret pswd = descriptor.getPassword();
if (pswd == null || Utils.isEmpty(pswd.getPlainText())) {
this.loggerProxy.error("invalid parameter: password");
this.loggerProxy.error("Invalid parameter: password");
return false;
}
}

if (!Utils.isValidLRCTenant(descriptor.getTenantId())) {
this.loggerProxy.error("invalid parameter: tenant");
this.loggerProxy.error("Invalid parameter: tenant");
return false;
}

if (Utils.isEmpty(descriptor.getUrl()) || !Utils.isValidLRCUrl(descriptor.getUrl())) {
this.loggerProxy.error("invalid parameter: url");
this.loggerProxy.error("Invalid parameter: url");
return false;
}

Expand Down Expand Up @@ -680,11 +680,11 @@ public FormValidation doCheckProxyPort(
@POST
public FormValidation doCheckProjectID(@QueryParameter final String value) {
if (value == null || value.trim().length() == 0) {
return FormValidation.error("Please input a ProjectID");
return FormValidation.error("Please input a Project ID");
}

if (!value.matches("^\\d+$")) {
return FormValidation.error("Invalid ProjectID");
return FormValidation.error("Invalid Project ID");
}
return FormValidation.ok();
}
Expand Down Expand Up @@ -811,11 +811,11 @@ public FormValidation doTestConnection(
Jenkins.get().checkPermission(Jenkins.ADMINISTER);

if (!Utils.isValidLRCUrl(url)) {
return FormValidation.error("invalid parameter: url");
return FormValidation.error("Invalid parameter: URL");
}

if (!Utils.isValidLRCTenant(tenantId)) {
return FormValidation.error("invalid parameter: tenant");
return FormValidation.error("Invalid parameter: Tenant ID");
}

boolean useOAuthFlag = Boolean.parseBoolean(useOAuth);
Expand Down Expand Up @@ -854,7 +854,7 @@ public FormValidation doTestConnection(
c.validateTenant();
return FormValidation.ok("Test connection succeeded!");
} catch (Exception e) {
return FormValidation.error("Test connection failed, error: " + e.getMessage());
return FormValidation.error("Test connection failed. Error: " + e.getMessage());
}
}
}
Expand Down

0 comments on commit 6d9be03

Please sign in to comment.