Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
9eee6ef
WEBITOOLS-33: hide the call stack in the Api Call Exception
leon2Meudon92 Mar 24, 2021
fc139d0
WEBITOOLS-33: grab the API default message instead of whole json
leon2Meudon92 Mar 24, 2021
70d5c7b
Merge branch 'develop' into WEBITOOLS-33_hide_stack_trace_in_the_log_LFO
leon2Meudon92 Mar 29, 2021
b0b8c59
WEBITOOLS-33: use verbose parameter to throw exception
leon2Meudon92 Mar 29, 2021
68bdc04
WEBI-9883: use verbose parameter to throw exception
leon2Meudon92 Mar 30, 2021
b219efe
WEBI-9883: use verbose parameter to throw exception in cli
leon2Meudon92 Mar 30, 2021
9041a23
WEBI-9883: use verbose parameter to throw exception in plugin
leon2Meudon92 Mar 30, 2021
89b2ccd
Merge branch 'develop' into WEBITOOLS-33_hide_stack_trace_in_the_log_LFO
leon2Meudon92 Mar 30, 2021
4a6c572
Merge branch 'develop' into WEBITOOLS-33_hide_stack_trace_in_the_log_LFO
leon2Meudon92 May 31, 2021
9910923
WEBITOOLS-33 stack trace hidden with debug options
leon2Meudon92 May 31, 2021
f7373e3
Merge branch 'develop' into WEBITOOLS-33_hide_stack_trace_in_the_log_LFO
leon2Meudon92 May 31, 2021
2049114
WEBITOOLS-33 stack trace management with verbose option
leon2Meudon92 May 31, 2021
be422a1
WEBITOOLS-33: updates due to code review
leon2Meudon92 Jun 16, 2021
6f14725
WEBITOOLS-33: update local develop
leon2Meudon92 Jun 16, 2021
52a3f10
Merge branch 'develop' into WEBITOOLS-33_hide_stack_trace_in_the_log_LFO
leon2Meudon92 Jun 16, 2021
4431c97
WEBITOOLS-33: updates for resolving conflicts
leon2Meudon92 Jun 16, 2021
8c228b8
WEBITOOLS-33: updates for resolving conflicts
leon2Meudon92 Jun 17, 2021
a6f426b
Merge branch 'develop' into WEBITOOLS-33_hide_stack_trace_in_the_log_LFO
leon2Meudon92 Jun 17, 2021
1a6e4c5
Merge branch 'develop' into WEBITOOLS-33_hide_stack_trace_in_the_log_LFO
leon2Meudon92 Jun 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -290,6 +290,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
applicationService = injector.getInstance(ApplicationService.class);
}

apiService.setVerbose(getDescriptor().configuration.isVerbose());
String apiServerUrl = getAipConsoleUrl();
String apiKey = Secret.toString(getApiKey());
String username = getDescriptor().getAipConsoleUsername();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,8 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
jobsService = injector.getInstance(JobsService.class);
applicationService = injector.getInstance(ApplicationService.class);
}

apiService.setVerbose(getDescriptor().configuration.isVerbose());

String apiServerUrl = getAipConsoleUrl();
String apiKey = Secret.toString(getApiKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
Guice.createInjector(new AipConsoleModule()).injectMembers(this);
}

if (apiService != null) {
apiService.setVerbose(getDescriptor().configuration.isVerbose());
}
String apiServerUrl = getAipConsoleUrl();
String apiKey = Secret.toString(getApiKey());
String username = getDescriptor().getAipConsoleUsername();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,8 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
jobsService = injector.getInstance(JobsService.class);
applicationService = injector.getInstance(ApplicationService.class);
}

apiService.setVerbose(getDescriptor().configuration.isVerbose());

String apiServerUrl = getAipConsoleUrl();
String apiKey = Secret.toString(getApiKey());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public void perform(@Nonnull Run<?, ?> run, @Nonnull FilePath workspace, @Nonnul
applicationService = injector.getInstance(ApplicationService.class);
}

apiService.setVerbose(getDescriptor().configuration.isVerbose());
String apiServerUrl = getAipConsoleUrl();
String apiKey = Secret.toString(getApiKey());
String username = getDescriptor().getAipConsoleUsername();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
setAsCurrent=Utiliser cette version pour l'analyse
setAsCurrent.descr=La version ajout�e sera d�finie comme la version d'analyse
setAsCurrent.descr=La version ajoutée sera définie comme la version d'analyse
aipConsoleUrl=URL d''AIP Console
aipConsoleUrl.descr=L''URL d''accès à AIP Console
apiKey=Clé d'API
apiKey.descr=La clé d'API permettant l''accès à AIP Console
aipConsoleUrl.descr=L''URL d''accès à AIP Console
apiKey=Clé d'API
apiKey.descr=La clé d'API permettant l''accès à AIP Console

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
import java.nio.file.Files;
import java.util.Date;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

Expand All @@ -44,17 +43,13 @@
@Slf4j
@Getter
@Setter
public class AddVersionCommand implements Callable<Integer> {
private final RestApiService restApiService;
public class AddVersionCommand extends BaseCollableCommand {
private final JobsService jobsService;
private final UploadService uploadService;
private final ApplicationService applicationService;

@CommandLine.Mixin
private SharedOptions sharedOptions;

public AddVersionCommand(RestApiService restApiService, JobsService jobsService, UploadService uploadService, ApplicationService applicationService) {
this.restApiService = restApiService;
super(restApiService);
this.jobsService = jobsService;
this.uploadService = uploadService;
this.applicationService = applicationService;
Expand Down Expand Up @@ -150,7 +145,7 @@ public AddVersionCommand(RestApiService restApiService, JobsService jobsService,
private List<String> unmatchedOptions;

@Override
public Integer call() {
public Integer doCall() {
ApiInfoDto apiInfo = null;
try {
if (sharedOptions.getTimeout() != Constants.DEFAULT_HTTP_TIMEOUT) {
Expand All @@ -164,7 +159,6 @@ public Integer call() {
return Constants.RETURN_LOGIN_ERROR;
}

log.info("AddVersion version command has triggered with log output = '{}'", sharedOptions.isVerbose());
log.info("[Debug options] Show Sql is '{}'", showSql);
log.info("[Debug options] AMT Profiling is '{}'", amtProfiling);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.Comparator;
import java.util.Date;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

Expand All @@ -46,13 +45,10 @@
@Slf4j
@Getter
@Setter
public class AnalyzeCommand implements Callable<Integer> {
public class AnalyzeCommand extends BaseCollableCommand {
private static final DateFormat RELEASE_DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
private final RestApiService restApiService;
private final JobsService jobsService;
private final ApplicationService applicationService;
@CommandLine.Mixin
private SharedOptions sharedOptions;

@CommandLine.Option(names = {"-n", "--app-name"},
paramLabel = "APPLICATION_NAME",
Expand Down Expand Up @@ -88,13 +84,13 @@ public class AnalyzeCommand implements Callable<Integer> {
private boolean amtProfiling;

public AnalyzeCommand(RestApiService restApiService, JobsService jobsService, ApplicationService applicationService) {
this.restApiService = restApiService;
super(restApiService);
this.jobsService = jobsService;
this.applicationService = applicationService;
}

@Override
public Integer call() throws Exception {
public Integer doCall() throws Exception {
if (StringUtils.isBlank(applicationName)) {
log.error("No application name provided. Exiting.");
return Constants.RETURN_APPLICATION_INFO_MISSING;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.castsoftware.aip.console.tools.commands;

import com.castsoftware.aip.console.tools.core.services.RestApiService;
import lombok.extern.slf4j.Slf4j;
import picocli.CommandLine;

import java.util.concurrent.Callable;

@Slf4j
public abstract class BaseCollableCommand implements Callable<Integer> {
protected final RestApiService restApiService;

@CommandLine.Mixin
protected SharedOptions sharedOptions;

protected BaseCollableCommand(RestApiService restApiService) {
this.restApiService = restApiService;
}

protected abstract Integer doCall() throws Exception;

public SharedOptions getSharedOptions() {
return sharedOptions;
}

@Override
public Integer call() throws Exception {
log.info("AddVersion version command has triggered with log verbose mode = '{}'", sharedOptions.isVerbose());
restApiService.setVerbose(sharedOptions.isVerbose());
return doCall();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,15 @@
import com.castsoftware.aip.console.tools.core.services.JobsService;
import com.castsoftware.aip.console.tools.core.services.RestApiService;
import com.castsoftware.aip.console.tools.core.utils.Constants;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import picocli.CommandLine;

import java.util.Arrays;
import java.util.List;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;

@Component
Expand All @@ -33,18 +29,13 @@
@Slf4j
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class CreateApplicationCommand implements Callable<Integer> {
public class CreateApplicationCommand extends BaseCollableCommand {
private final JobsService jobsService;

@Autowired
private JobsService jobsService;

@Autowired
private RestApiService restApiService;

@CommandLine.Mixin
private SharedOptions sharedOptions;
public CreateApplicationCommand(RestApiService restApiService, JobsService jobsService) {
super(restApiService);
this.jobsService = jobsService;
}

/**
* options for the upload and job startup
Expand All @@ -70,7 +61,7 @@ public class CreateApplicationCommand implements Callable<Integer> {
private List<String> unmatchedOptions;

@Override
public Integer call() {
public Integer doCall() {
try {
if (sharedOptions.getTimeout() != Constants.DEFAULT_HTTP_TIMEOUT) {
restApiService.setTimeout(sharedOptions.getTimeout(), TimeUnit.SECONDS);
Expand All @@ -82,8 +73,6 @@ public Integer call() {
return Constants.RETURN_LOGIN_ERROR;
}

log.info("Create application command has triggered with log output = '{}'", sharedOptions.isVerbose());

try {
String nodeGuid = null;
if (StringUtils.isNotBlank(nodeName)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
import java.io.File;
import java.nio.file.Files;
import java.util.Date;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

Expand All @@ -43,15 +42,11 @@
@Slf4j
@Getter
@Setter
public class DeliverVersionCommand implements Callable<Integer> {
private final RestApiService restApiService;
public class DeliverVersionCommand extends BaseCollableCommand {
private final JobsService jobsService;
private final UploadService uploadService;
private final ApplicationService applicationService;

@CommandLine.Mixin
private SharedOptions sharedOptions;

@CommandLine.Option(names = {"-n", "--app-name"},
paramLabel = "APPLICATION_NAME",
description = "The Name of the application to rescan",
Expand Down Expand Up @@ -136,14 +131,14 @@ public class DeliverVersionCommand implements Callable<Integer> {
private String domainName;

public DeliverVersionCommand(RestApiService restApiService, JobsService jobsService, UploadService uploadService, ApplicationService applicationService) {
this.restApiService = restApiService;
super(restApiService);
this.jobsService = jobsService;
this.uploadService = uploadService;
this.applicationService = applicationService;
}

@Override
public Integer call() throws Exception {
public Integer doCall() {
// Same as a part of the AddVersion command
// Upload a local file or register a remote path
// And then starts a job up to "Delivery"
Expand All @@ -163,9 +158,7 @@ public Integer call() throws Exception {
} catch (ApiCallException e) {
return Constants.RETURN_LOGIN_ERROR;
}

log.info("Deliver version command has triggered with log output = '{}'", sharedOptions.isVerbose());


String applicationGuid;
Thread shutdownHook = null;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@
import java.util.Date;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.Callable;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;

Expand All @@ -46,13 +45,10 @@
@Slf4j
@Getter
@Setter
public class SnapshotCommand implements Callable<Integer> {
public class SnapshotCommand extends BaseCollableCommand {
private static final DateFormat RELEASE_DATE_FORMATTER = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss.SSS'Z'");
private final RestApiService restApiService;
private final JobsService jobsService;
private final ApplicationService applicationService;
@CommandLine.Mixin
private SharedOptions sharedOptions;

@CommandLine.Option(names = {"-n", "--app-name"},
paramLabel = "APPLICATION_NAME",
Expand All @@ -75,14 +71,13 @@ public class SnapshotCommand implements Callable<Integer> {
private boolean processImaging = false;

public SnapshotCommand(RestApiService restApiService, JobsService jobsService, ApplicationService applicationService) {
this.restApiService = restApiService;
super(restApiService);
this.jobsService = jobsService;
this.applicationService = applicationService;
}


@Override
public Integer call() throws Exception {
public Integer doCall() {
// Runs snapshot + upload
if (StringUtils.isBlank(applicationName)) {
log.error("No application name provided. Exiting.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,5 +143,4 @@ public void testAddVersionCommand() throws ApplicationServiceException {
assertThat(spec, is(notNullValue()));
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -81,12 +81,14 @@ protected void resetSharedOptions(SharedOptions command) {
if (unExpectedParameters != null) {
unExpectedParameters.clear();
}
command.setApiKey(null);
command.setApiKeyEnvVariable(null);
command.setServerRootUrl(null);
command.setUsername(null);
if (command.getUnmatchedOptions() != null) {
command.getUnmatchedOptions().clear();
if (command != null) {
command.setApiKey(null);
command.setApiKeyEnvVariable(null);
command.setServerRootUrl(null);
command.setUsername(null);
if (command.getUnmatchedOptions() != null) {
command.getUnmatchedOptions().clear();
}
}
}

Expand Down
Loading