Skip to content

Commit

Permalink
fix: adapt after rebase
Browse files Browse the repository at this point in the history
Signed-off-by: Chris Laprun <[email protected]>
  • Loading branch information
metacosm committed Nov 20, 2024
1 parent 5be77e1 commit 9dd9e19
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,19 +3,20 @@
import java.util.Optional;
import java.util.concurrent.ConcurrentHashMap;

import io.fabric8.kubernetes.api.model.HasMetadata;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.processing.Controller;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import io.fabric8.kubernetes.api.model.HasMetadata;
import io.javaoperatorsdk.operator.api.reconciler.Context;
import io.javaoperatorsdk.operator.processing.Controller;
import io.javaoperatorsdk.operator.processing.dependent.workflow.WorkflowCleanupResult;
import io.javaoperatorsdk.operator.processing.dependent.workflow.WorkflowReconcileResult;

@SuppressWarnings("rawtypes")
public class DefaultManagedWorkflowAndDependentResourceContext<P extends HasMetadata>
implements ManagedWorkflowAndDependentResourceContext {
private static final Logger log = LoggerFactory.getLogger(DefaultManagedWorkflowAndDependentResourceContext.class);
private static final Logger log =
LoggerFactory.getLogger(DefaultManagedWorkflowAndDependentResourceContext.class);
public static final Object RECONCILE_RESULT_KEY = new Object();
public static final Object CLEANUP_RESULT_KEY = new Object();
private final ConcurrentHashMap attributes = new ConcurrentHashMap();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,21 +1,16 @@
package io.javaoperatorsdk.operator.api.reconciler.dependent.managed;

import java.util.List;
import java.util.Map;
import java.util.Optional;

import org.junit.jupiter.api.Test;

import io.javaoperatorsdk.operator.processing.dependent.workflow.WorkflowReconcileResult;

import static io.javaoperatorsdk.operator.api.reconciler.dependent.managed.DefaultManagedDependentResourceContext.RECONCILE_RESULT_KEY;
import static org.assertj.core.api.Assertions.assertThat;
import static org.assertj.core.api.Assertions.assertThatThrownBy;

class DefaultManagedDependentResourceContextTest {

private final ManagedDependentResourceContext context =
new DefaultManagedDependentResourceContext();
private final ManagedWorkflowAndDependentResourceContext context =
new DefaultManagedWorkflowAndDependentResourceContext<>(null, null, null);

@Test
void getWhenEmpty() {
Expand Down Expand Up @@ -50,7 +45,7 @@ void putNewValueReturnsPriorValue() {
void putNewValueLogsWarningIfTypesDiffer() {
// to check that we properly log things without setting up a complex fixture
final String[] messages = new String[1];
var context = new DefaultManagedDependentResourceContext() {
var context = new DefaultManagedWorkflowAndDependentResourceContext<>(null, null, null) {
@Override
void logWarning(String message) {
messages[0] = message;
Expand Down Expand Up @@ -93,13 +88,4 @@ void getMandatoryWhenEmpty() {
.hasMessage(
"Mandatory attribute (key: key, type: java.lang.String) is missing or not of the expected type");
}

@Test
void getWorkflowReconcileResult() {
WorkflowReconcileResult result =
new WorkflowReconcileResult(List.of(), List.of(), Map.of(), Map.of());
context.put(RECONCILE_RESULT_KEY, result);
Optional<WorkflowReconcileResult> actual = context.getWorkflowReconcileResult();
assertThat(actual).containsSame(result);
}
}

0 comments on commit 9dd9e19

Please sign in to comment.