Skip to content

Commit f58eebf

Browse files
authored
Merge branch 'main' into dependabot/maven/org.mockito-mockito-core-5.21.0
2 parents 3d91170 + cf06565 commit f58eebf

File tree

9 files changed

+117
-17
lines changed

9 files changed

+117
-17
lines changed

.github/workflows/dependencies.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
name: Merge updates to dependencies
2+
on:
3+
pull_request:
4+
jobs:
5+
dependabot:
6+
name: "@dependabot"
7+
if: github.event.pull_request.user.login == 'dependabot[bot]'
8+
runs-on: ubuntu-latest
9+
permissions:
10+
contents: write
11+
pull-requests: write
12+
steps:
13+
- name: Collect metadata
14+
id: metadata
15+
uses: dependabot/fetch-metadata@08eff52bf64351f401fb50d4972fa95b9f2c2d1b # v2.4.0
16+
with:
17+
github-token: "${{ secrets.GITHUB_TOKEN }}"
18+
- name: Approve
19+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
20+
run: gh pr review --approve "$PR_URL"
21+
env:
22+
PR_URL: ${{github.event.pull_request.html_url}}
23+
GH_TOKEN: ${{secrets.GITHUB_TOKEN}}
24+
- name: Automerge
25+
if: steps.metadata.outputs.update-type == 'version-update:semver-patch' || steps.metadata.outputs.update-type == 'version-update:semver-minor'
26+
run: gh pr merge --auto --squash "$PR_URL"
27+
env:
28+
PR_URL: ${{ github.event.pull_request.html_url }}
29+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/gradle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
gradle:
1010
runs-on: ubuntu-latest
1111
strategy:
12+
fail-fast: false
1213
matrix:
1314
java-version:
1415
- 17

.github/workflows/mvn.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ jobs:
99
mvn:
1010
runs-on: ubuntu-latest
1111
strategy:
12+
fail-fast: false
1213
matrix:
1314
java-version:
1415
- 17

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
.idea/
88
.env
99
artifacts/
10+
bin/
1011
src/main/webapp/WEB-INF/classes/
1112
src/main/webapp/WEB-INF/lib/
1213
*.iml

README.md

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Bolt for Java Custom Step Template
22

33
This is a Bolt for Java template app used to build custom steps for use in
4-
[Workflow Builder](https://api.slack.com/start#workflow-builder).
4+
[Workflow Builder](https://docs.slack.dev/workflows/workflow-builder/).
55

66
## Setup
77

@@ -22,9 +22,9 @@ tooling, and resources created to help developers build and grow.
2222

2323
1. Open [https://api.slack.com/apps/new](https://api.slack.com/apps/new) and choose "From an app manifest"
2424
2. Choose the workspace you want to install the application to
25-
3. Copy the contents of [manifest.json](./manifest.json) into the text box that says `*Paste your manifest code here*` (within the JSON tab) and click *Next*
26-
4. Review the configuration and click *Create*
27-
5. Click *Install to Workspace* and *Allow* on the screen that follows. You'll then be redirected to the App Configuration dashboard.
25+
3. Copy the contents of [manifest.json](./manifest.json) into the text box that says `*Paste your manifest code here*` (within the JSON tab) and click _Next_
26+
4. Review the configuration and click _Create_
27+
5. Click _Install to Workspace_ and _Allow_ on the screen that follows. You'll then be redirected to the App Configuration dashboard.
2828

2929
#### Environment Variables
3030

@@ -43,16 +43,17 @@ export SLACK_APP_TOKEN=<your-app-token>
4343

4444
```zsh
4545
# Clone this project onto your machine
46-
git clone https://github.com/WilliamBergamin/bolt-java-custom-step-template.git
46+
git clone https://github.com/slack-samples/bolt-java-custom-step-template.git
4747

4848
# Change into this project directory
49-
cd bolt-java-template
49+
cd bolt-java-custom-step-template
5050
```
5151

5252
#### Maven: Run
5353

5454
Ensure [maven](https://maven.apache.org/index.html) is installed on your local environment.
55-
* We recommend using [brew to install Maven on macOS](https://formulae.brew.sh/formula/maven)
55+
56+
- We recommend using [brew to install Maven on macOS](https://formulae.brew.sh/formula/maven)
5657

5758
```zsh
5859
# Install the dependencies and compile
@@ -68,14 +69,15 @@ mvn clean test
6869
mvn clean compile exec:java -Dexec.mainClass="Main"
6970
```
7071

71-
**NOTE**: If you chose to use Maven as your build tool you can remove the `builde.gradle` file from this project.
72+
**NOTE**: If you chose to use Maven as your build tool you can remove the `build.gradle` file from this project.
7273

73-
------
74+
---
7475

7576
#### Gradle: Run
7677

7778
Ensure [gradle](https://gradle.org/) is installed on your local environment.
78-
* We recommend using [brew to install Gradle on macOS](https://formulae.brew.sh/formula/gradle)
79+
80+
- We recommend using [brew to install Gradle on macOS](https://formulae.brew.sh/formula/gradle)
7981

8082
```zsh
8183
# Run tests
@@ -93,7 +95,7 @@ gradle run
9395
## Using Steps in Workflow Builder
9496

9597
With your server running, the `Sample step` is now ready for use in
96-
[Workflow Builder](https://api.slack.com/start#workflow-builder)! Add it as a
98+
[Workflow Builder](https://docs.slack.dev/workflows/workflow-builder/)! Add it as a
9799
custom step in a new or existing workflow, then run the workflow while your app
98100
is running.
99101

build.gradle

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,16 @@ plugins {
44
}
55

66
java {
7-
sourceCompatibility = JavaVersion.VERSION_11
8-
targetCompatibility = JavaVersion.VERSION_11
7+
sourceCompatibility = JavaVersion.VERSION_17
8+
targetCompatibility = JavaVersion.VERSION_17
99
}
1010

1111
repositories {
1212
mavenCentral()
1313
}
1414

1515
dependencies {
16-
implementation("ch.qos.logback:logback-classic:1.5.21")
16+
implementation("ch.qos.logback:logback-classic:1.5.22")
1717
// ***** SOCKET MODE DEPENDENCIES ***** -->
1818
implementation("com.slack.api:bolt:1.46.0")
1919
implementation("com.slack.api:bolt-socket-mode:1.46.0")
@@ -24,7 +24,7 @@ dependencies {
2424
// ***** TEST DEPENDENCIES *****
2525
testImplementation('org.junit.jupiter:junit-jupiter-api:6.0.1')
2626
testRuntimeOnly('org.junit.jupiter:junit-jupiter-engine:6.0.1')
27-
testImplementation('org.mockito:mockito-core:5.20.0')
27+
testImplementation('org.mockito:mockito-core:5.21.0')
2828
}
2929

3030
application {
@@ -43,7 +43,7 @@ spotless {
4343
format 'misc', {
4444
target '*.gradle', '.gitignore'
4545
trimTrailingWhitespace()
46-
indentWithTabs(4)
46+
leadingSpacesToTabs(4)
4747
endWithNewline()
4848
}
4949
java {

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
<dependency>
6767
<groupId>ch.qos.logback</groupId>
6868
<artifactId>logback-classic</artifactId>
69-
<version>1.5.21</version>
69+
<version>1.5.22</version>
7070
</dependency>
7171
<!-- ***** SOCKET MODE DEPENDENCIES ***** -->
7272
<dependency>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package listeners.actions;
2+
3+
import static org.junit.jupiter.api.Assertions.assertNotNull;
4+
import static org.mockito.Mockito.*;
5+
6+
import com.slack.api.bolt.App;
7+
import com.slack.api.bolt.context.builtin.ActionContext;
8+
import com.slack.api.bolt.request.builtin.BlockActionRequest;
9+
import com.slack.api.methods.SlackApiException;
10+
import java.io.IOException;
11+
import org.junit.jupiter.api.Test;
12+
13+
public class CustomStepButtonActionListenerTest {
14+
15+
@Test
16+
public void testApply() throws IOException, SlackApiException {
17+
// Given
18+
var app = new App();
19+
var reqMock = mock(BlockActionRequest.class);
20+
var ctxMock = mock(ActionContext.class);
21+
22+
when(ctxMock.ack()).thenReturn(mock(com.slack.api.bolt.response.Response.class));
23+
24+
// When
25+
var customStepButtonActionListener = new CustomStepButtonActionListener(app);
26+
var res = customStepButtonActionListener.apply(reqMock, ctxMock);
27+
28+
// Then
29+
verify(ctxMock).ack();
30+
assertNotNull(res);
31+
}
32+
}
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
package listeners.functions;
2+
3+
import static org.junit.jupiter.api.Assertions.assertEquals;
4+
import static org.mockito.Mockito.*;
5+
6+
import com.slack.api.app_backend.events.payload.EventsApiPayload;
7+
import com.slack.api.bolt.App;
8+
import com.slack.api.bolt.context.builtin.EventContext;
9+
import com.slack.api.bolt.response.Response;
10+
import com.slack.api.model.event.FunctionExecutedEvent;
11+
import org.junit.jupiter.api.Test;
12+
13+
public class SampleStepListenerTest {
14+
15+
@Test
16+
public void testApply() {
17+
// Given
18+
var plMock = (EventsApiPayload<FunctionExecutedEvent>) mock(EventsApiPayload.class);
19+
var ctxMock = mock(EventContext.class);
20+
21+
var responseMock = mock(Response.class);
22+
when(responseMock.getStatusCode()).thenReturn(200);
23+
when(ctxMock.ack()).thenReturn(responseMock);
24+
25+
// When
26+
var app = new App();
27+
var sampleStepListener = new SampleStepListener(app);
28+
var res = sampleStepListener.apply(plMock, ctxMock);
29+
30+
// Then
31+
verify(ctxMock).ack();
32+
assertEquals(res.getStatusCode(), 200);
33+
}
34+
}

0 commit comments

Comments
 (0)