Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

adding boutiques support in api + correcting api tests #490

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 0 additions & 12 deletions vip-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -111,18 +111,6 @@ knowledge of the CeCILL-B license and that you accept its terms.
<version>${keycloak.version}</version>
</dependency>

<!-- Json mapping library -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-jsr310</artifactId>
<version>${jackson.version}</version>
</dependency>

<!-- Validation implementation -->
<dependency>
<groupId>org.hibernate</groupId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,15 +108,10 @@ public void addCorsMappings(CorsRegistry registry) {
}

/*
to verify that the proxy ist still valid each day
to verify that the proxy is still valid each day
*/
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(vipConfigurer);
}

@Bean
public ObjectMapper objectMapper() {
return Jackson2ObjectMapperBuilder.json().build();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.env.Environment;
import org.springframework.security.authentication.BadCredentialsException;
import org.springframework.stereotype.Service;

@Service
Expand Down Expand Up @@ -60,6 +61,9 @@ private User signin(String username, String password) throws ApiException {
logger.info("Credentials OK for " + username);
return user;
} catch (BusinessException e) {
if (e.getMessage().startsWith("Authentication failed")) {
throw new ApiException(ApiException.ApiError.BAD_CREDENTIALS);
}
throw new ApiException("Authentication Error", e);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ public String initExecution(Execution execution)
}
String resultsLocation = execution.getResultsLocation();
if (resultsLocation != null) {
inputMap.put(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME,
resultsLocation);
inputMap.put(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME, resultsLocation);
}

checkInputExecNameIsValid(execution.getName());
Expand Down Expand Up @@ -326,39 +325,35 @@ private String initExecution(String pipelineId,
// Check that all pipeline inputs are present
Pipeline p = pipelineBusiness.getPipelineWithResultsDirectory(pipelineId);
for (PipelineParameter pp : p.getParameters()) {
// always true on vip
if (pp.isReturnedValue()) {
continue;
}
// pp is an input
if (!(inputValues.get(pp.getName()) == null)) {
// ok if input is present
if ( inputValues.get(pp.getName()) != null) {
continue;
}
// pp is an empty input
// then ok if input has a default value (and we set it)
// beware : with gwendia, optional always have an defaultValue (either defined or No_Value_Provided)
if (pp.getDefaultValue() != null) {
inputValues.put(pp.getName(), pp.getDefaultValue().toString());
continue;
}
// pp is an empty input with no default value
// then ok if it is optional
// beware, with gwendia it should not be possible to enter this case (see previous condition)
if (pp.isOptional()) {
inputValues.put("no", pp.getDefaultValue().toString());//that's how optional values are handled in VIP
continue;
}
// pp is an empty input with no default value and it is not optional
logger.error("Error initialising {}, missing {} parameter",
pipelineId, pp.getName());
throw new ApiException("Parameter " + pp.getName() + " is empty while it is not optional and it has no default value.");
// error : pp is an empty input with no default value and it is not optional
logger.error("Error initialising {}, missing {} parameter", pipelineId, pp.getName());
throw new ApiException(ApiException.ApiError.INPUT_FIELD_MISSING, pp.getName());
}

boolean hasInputResultsDirectory =
inputValues.containsKey(
CoreConstants.RESULTS_DIRECTORY_PARAM_NAME);

boolean hasPipelineResultsDirectory =
p.getParameters().stream().anyMatch(
param ->
boolean inputsContainsResultsDirectoryInput = inputValues.containsKey(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME);
boolean pipelineHasResultsDirectoryInput = p.getParameters().stream().anyMatch(param ->
param.getName().equals(CoreConstants.RESULTS_DIRECTORY_PARAM_NAME));

if (hasInputResultsDirectory && !hasPipelineResultsDirectory) {
if (inputsContainsResultsDirectoryInput && ! pipelineHasResultsDirectoryInput) {
logger.error("Missing results-directory for {}", pipelineId);
throw new ApiException(
"Input has parameter results-directory but it is not defined in pipeline.");
Expand Down
Loading
Loading