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

Adjust notification status to be an enum #32

Merged
merged 1 commit into from
Feb 4, 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 @@ -12,11 +12,12 @@

import org.eclipse.microprofile.config.inject.ConfigProperty;
import org.jboss.pnc.api.dto.Request;
import org.jboss.pnc.api.konfluxbuilddriver.dto.PipelineNotification;
import org.jboss.pnc.api.konfluxbuilddriver.dto.PipelineStatus;

import com.fasterxml.jackson.databind.ObjectMapper;

import io.quarkus.logging.Log;
import org.jboss.pnc.api.konfluxbuilddriver.dto.PipelineNotification;
import picocli.CommandLine;

@CommandLine.Command(name = "notify")
Expand All @@ -25,8 +26,8 @@ public class NotifyCommand implements Runnable {
@CommandLine.Option(names = "--build-id", required = true)
String buildId;

@CommandLine.Option(names = "--status", required = true)
String status;
@CommandLine.Option(names = "--status", description = "Valid values: ${COMPLETION-CANDIDATES}", required = true)
PipelineStatus status;

@CommandLine.Option(names = "--context", required = true)
String context;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

import org.jboss.pnc.api.constants.HttpHeaders;
import org.jboss.pnc.api.dto.Request;
import org.jboss.pnc.api.konfluxbuilddriver.dto.PipelineStatus;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;

Expand Down Expand Up @@ -41,7 +42,7 @@ public void clearLogs() {
@Test
public void testNoNotify() {
NotifyCommand notifyCommand = new NotifyCommand();
notifyCommand.status = "Succeeded";
notifyCommand.status = PipelineStatus.Succeeded;
notifyCommand.buildId = "1234";
notifyCommand.run();
List<LogRecord> logRecords = LogCollectingTestResource.current().getRecords();
Expand All @@ -63,7 +64,7 @@ public void testNotify() throws IOException, URISyntaxException {
.build();

NotifyCommand notifyCommand = new NotifyCommand();
notifyCommand.status = "Succeeded";
notifyCommand.status = PipelineStatus.Succeeded;
notifyCommand.buildId = "1234";
notifyCommand.objectMapper = new ObjectMapper();
notifyCommand.context = notifyCommand.objectMapper.writeValueAsString(request);
Expand Down
Loading