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

Add new DepsoitStatus.RETRY #115

Merged
merged 1 commit into from
Jan 24, 2025
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
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,13 @@ public enum DepositStatus {
*/
REJECTED("rejected"),
/**
* A failure occurred performing the deposit; it may be re-tried later.
* A failure occurred performing the deposit; it will not be retried.
*/
FAILED("failed");
FAILED("failed"),
/**
* A failure occurred performing the deposit that qualifies for retry.
*/
RETRY("retry");

private static final Map<String, DepositStatus> map = new HashMap<>(values().length, 1);

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
/*
* Copyright 2025 Johns Hopkins University
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.eclipse.pass.object.model;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertThrows;

import java.util.stream.Stream;

import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.Arguments;
import org.junit.jupiter.params.provider.MethodSource;

/**
* @author Russ Poetker ([email protected])
*/
class DepositStatusTest {
private static Stream<Arguments> provideStatuses() {
return Stream.of(
Arguments.of("accepted", DepositStatus.ACCEPTED),
Arguments.of("rejected", DepositStatus.REJECTED),
Arguments.of("failed", DepositStatus.FAILED),
Arguments.of("submitted", DepositStatus.SUBMITTED),
Arguments.of("retry", DepositStatus.RETRY)
);
}

@ParameterizedTest
@MethodSource("provideStatuses")
void testStatus(String depositStatus, DepositStatus expectedDepositStatus) {
DepositStatus actualDepositStatus = DepositStatus.of(depositStatus);
assertEquals(expectedDepositStatus, actualDepositStatus);
}

@Test
void testNullStatus() {
assertThrows(IllegalArgumentException.class, () -> {
DepositStatus.of(null);
});
}
}
1 change: 1 addition & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@
<!-- These come from spring boot starter test -->
<ignoredUsedUndeclaredDependency>org.mockito::</ignoredUsedUndeclaredDependency>
<ignoredUsedUndeclaredDependency>org.junit.jupiter:junit-jupiter-api:</ignoredUsedUndeclaredDependency>
<ignoredUsedUndeclaredDependency>org.junit.jupiter:junit-jupiter-params:</ignoredUsedUndeclaredDependency>
<ignoredUsedUndeclaredDependency>org.assertj:assertj-core:</ignoredUsedUndeclaredDependency>
<ignoredUsedUndeclaredDependency>com.vaadin.external.google:android-json:</ignoredUsedUndeclaredDependency>
<ignoredUsedUndeclaredDependency>jakarta.persistence:jakarta.persistence-api::</ignoredUsedUndeclaredDependency>
Expand Down
Loading