Skip to content

Commit

Permalink
Refactored API access
Browse files Browse the repository at this point in the history
  • Loading branch information
Mike Reiche committed Nov 3, 2021
1 parent 7e7cb16 commit 297a974
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 19 deletions.
3 changes: 1 addition & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ plugins {
id "io.codearte.nexus-staging" version "0.30.0"
}

apply plugin: 'java'
apply plugin: 'maven'
apply plugin: 'java-library'
apply plugin: 'maven-publish'
apply plugin: 'signing'
apply plugin: 'io.codearte.nexus-staging'
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'azure-devops-connector'

//includeBuild("../testerra")
Original file line number Diff line number Diff line change
Expand Up @@ -145,12 +145,18 @@ private synchronized void syncTestresult(MethodEndEvent event, Outcome outcome)
// result.setPriority(this.getPriorityByFailureCorridor(event.getMethodContext().failureCorridorValue));

if (outcome.equals(Outcome.FAILED)) {
ErrorContext errorContext = event.getMethodContext().getErrorContext();
final String errorMessage = StringUtils.isNotEmpty(errorContext.getDescription()) ? errorContext.getDescription() : errorContext.getThrowable().getMessage();
result.setErrorMessage(errorMessage);
result.setFailureType(this.getFailureType(event).toString());
final String stackTrace = ExceptionUtils.getStackTrace(event.getMethodContext().getErrorContext().getThrowable());
result.setStackTrace(stackTrace);
event.getMethodContext()
.readErrors()
.filter(ErrorContext::isNotOptional)
.findFirst()
.ifPresent(errorContext -> {
Throwable throwable = errorContext.getThrowable();
final String errorMessage = throwable.getMessage();
result.setErrorMessage(errorMessage);
result.setFailureType(this.getFailureType(event).toString());
final String stackTrace = ExceptionUtils.getStackTrace(throwable);
result.setStackTrace(stackTrace);
});
}

List<Result> resultList = new ArrayList<>();
Expand Down Expand Up @@ -209,16 +215,13 @@ private AzureTest getAnnotation(MethodEndEvent event) {
}
}

private int getPriorityByFailureCorridor(FailureCorridor.Value value) {
switch (value) {
case HIGH:
return 1;
case MID:
return 2;
case LOW:
return 3;
default:
return 1;
private int getPriorityByFailureCorridor(Class failureCorridorClass) {
if (failureCorridorClass == FailureCorridor.Mid.class) {
return 2;
} else if (failureCorridorClass == FailureCorridor.Low.class) {
return 3;
} else {
return 1;
}
}

Expand Down

0 comments on commit 297a974

Please sign in to comment.