Skip to content

Commit

Permalink
Move jira-issue-lottery.config-file-repo value from application.prope…
Browse files Browse the repository at this point in the history
…rties to .env file and set a default for testing.
  • Loading branch information
xjusko committed Feb 29, 2024
1 parent 5640dab commit d11e28d
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 9 deletions.
13 changes: 8 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,17 +53,20 @@ Fork this repository to your GitHub account.
+ Integer, mandatory, no default.



2. Commit and push the changes to your forked repository.

### Configure Application Properties
1. Change the value of `jira-issue-lottery.config-file-repo` in the `application.properties` file to point to a public repository with a valid config file according to first step in [Configuration section](#configure-jira-lottery) such as `https://github.com/jboss-set/jira-issue-lottery`.

### Create .env File
1. Create a `.env` file in the main directory of your app.
2. Create a Jira Personal Access Token ([Guide on how to create the token](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html))
3. Add the following variable to the `.env` file:
2. Add the value of `%DEV_JIRA_ISSUE_LOTTERY_CONFIG_FILE_REPO` in the `.env` file to point to a public repository with a valid config file according to first step in [Configuration section](#configure-jira-lottery) such as `https://github.com/jboss-set/jira-issue-lottery`.
```env
%DEV_JIRA_ISSUE_LOTTERY_CONFIG_FILE_REPO=<YOUR REPOSITORY URL>
> **NOTE** This will override the default value of specified in `application.properties` file. If you override the value for all modes (dev, test, prod, when you don't prepend a mode, such as `%dev`), then one of the tests will fail, as it expects the original value.
3. Create a Jira Personal Access Token ([Guide on how to create the token](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html))
4. Add the following variable to the `.env` file:
```env
jira-issue-lottery.access-token=<YOUR TOKEN>
JIRA_ISSUE_LOTTERY_ACCESS_TOKEN=<YOUR TOKEN>
QUARKUS_MAILER_FROM=<email address>
QUARKUS_MAILER_USERNAME=<email address>
QUARKUS_MAILER_PASSWORD=<email password>
Expand Down
2 changes: 1 addition & 1 deletion src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
camel.component.jira.jira-url=https://issues.redhat.com/
%test.jira-issue-lottery.access-token=ignored
jira-issue-lottery.config-file-repo=https://github.com/The-Huginn/jira-issue-lottery
jira-issue-lottery.max-results=1000
jira-issue-lottery.config-file-repo=https://github.com/jboss-set/jira-issue-lottery
quarkus.kubernetes.deployment-kind=cron-job
# Cron expression to run the job every Monday see https://kubernetes.io/docs/concepts/workloads/controllers/cron-jobs/#writing-a-cronjob-spec
quarkus.kubernetes.cron-job.schedule=0 0 * * 1
Expand Down
8 changes: 5 additions & 3 deletions src/test/java/org/jboss/set/draw/LotteryDrawingTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,11 @@ public void testAppendingRepositoryForUnsubcription() throws Exception {

List<Mail> sent = mailbox.getMailsSentTo(email);
assertEquals(1, sent.size());
// Check directly for this URL as we know it is valid one. Using templates might result in a corrupted URL overall
assertTrue(sent.get(0).getText()
.contains("https://github.com/The-Huginn/jira-issue-lottery/blob/main/.github/jira-issue-lottery.yml"));
String emailText = sent.get(0).getText();

//Checks only if email message is correctly formatted. The URL is only for test purpose and may be invalid.
String expectedUrl = "https://github.com/jboss-set/jira-issue-lottery/blob/main/.github/jira-issue-lottery.yml";
assertTrue(emailText.contains(expectedUrl));
}

@Test
Expand Down

0 comments on commit d11e28d

Please sign in to comment.