Skip to content

Commit

Permalink
Merge pull request #7 from quarkusio/cdi-workaround
Browse files Browse the repository at this point in the history
Install an ugly CDI workaround
  • Loading branch information
gsmet authored Nov 23, 2023
2 parents bab9e09 + 16ed039 commit 8661348
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 2 deletions.
11 changes: 11 additions & 0 deletions src/main/java/io/quarkus/bot/release/ReleaseAction.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@
import io.quarkus.arc.InstanceHandle;
import io.quarkus.bot.release.error.StatusUpdateException;
import io.quarkus.bot.release.error.StepExecutionException;
import io.quarkus.bot.release.step.ApproveCoreRelease;
import io.quarkus.bot.release.step.CoreReleasePrepare;
import io.quarkus.bot.release.step.Prerequisites;
import io.quarkus.bot.release.step.Step;
import io.quarkus.bot.release.step.StepHandler;
import io.quarkus.bot.release.step.StepStatus;
Expand All @@ -40,6 +43,14 @@ public class ReleaseAction {
@Inject
Processes processes;

// ugly workaround...
@Inject
Prerequisites prerequisites;
@Inject
ApproveCoreRelease approveCoreRelease;
@Inject
CoreReleasePrepare coreReleasePrepare;

@Action
void startRelease(Context context, Commands commands, @Issue.Opened GHEventPayload.Issue issuePayload) throws Exception {
GHIssue issue = issuePayload.getIssue();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@

import java.io.IOException;

import jakarta.inject.Singleton;

import org.kohsuke.github.GHIssue;
import org.kohsuke.github.GHIssueComment;

import io.quarkus.bot.release.ReleaseInformation;
import io.quarkus.bot.release.ReleaseStatus;
import io.quarkus.bot.release.util.Command;

@Singleton
public class ApproveCoreRelease implements StepHandler {

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,13 @@

import java.io.IOException;

import jakarta.inject.Singleton;

import org.kohsuke.github.GHIssue;

import io.quarkus.bot.release.ReleaseInformation;

@Singleton
public class CoreReleasePrepare implements StepHandler {

@Override
Expand Down
4 changes: 2 additions & 2 deletions src/main/java/io/quarkus/bot/release/step/Prerequisites.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,16 @@
import java.util.ArrayList;
import java.util.List;

import jakarta.enterprise.context.Dependent;
import jakarta.inject.Inject;
import jakarta.inject.Singleton;

import org.kohsuke.github.GHIssue;

import io.quarkus.bot.release.ReleaseInformation;
import io.quarkus.bot.release.util.Issues;
import io.quarkus.bot.release.util.Processes;

@Dependent
@Singleton
public class Prerequisites implements StepHandler {

@Inject
Expand Down
2 changes: 2 additions & 0 deletions src/test/java/io/quarkus/bot/release/IssuesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@

import org.junit.jupiter.api.Test;

import io.quarkus.arc.Arc;
import io.quarkus.bot.release.step.Prerequisites;
import io.quarkus.bot.release.step.Step;
import io.quarkus.bot.release.step.StepStatus;
import io.quarkus.bot.release.util.Issues;
Expand Down
18 changes: 18 additions & 0 deletions src/test/java/io/quarkus/bot/release/StepInjectionTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
package io.quarkus.bot.release;

import static org.assertj.core.api.Assertions.assertThat;

import org.junit.jupiter.api.Test;

import io.quarkus.arc.Arc;
import io.quarkus.bot.release.step.Prerequisites;
import io.quarkus.test.junit.QuarkusTest;

@QuarkusTest
public class StepInjectionTest {

@Test
void testStepInjection() {
assertThat(Arc.container().instance(Prerequisites.class).get()).isNotNull();
}
}

0 comments on commit 8661348

Please sign in to comment.