Skip to content

Commit 7974690

Browse files
committed
Java 21
1 parent 1db4f7b commit 7974690

File tree

9 files changed

+50
-20
lines changed

9 files changed

+50
-20
lines changed

.github/workflows/deploy-java-cf.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ jobs:
2828
cache: npm
2929
- uses: actions/setup-java@v5
3030
with:
31-
distribution: sapmachine
31+
distribution: temurin
3232
java-version: 21
3333
cache: maven
3434
- run: npm ci
@@ -48,7 +48,7 @@ jobs:
4848
BROKER_SERVICE_ID: ${{ secrets.BROKER_SERVICE_ID }}
4949
BROKER_SERVICE_PLAN_ID: ${{ secrets.BROKER_SERVICE_PLAN_ID }}
5050
- name: Unit Test
51-
run: mvn test -B
51+
run: npm test
5252
working-directory: ./afcjdk
5353
- name: Install CF actions
5454
run: npm i @actions/core && npm i @actions/exec && npm i @actions/tool-cache

.github/workflows/deploy-java-kyma.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
cache: npm
3030
- uses: actions/setup-java@v5
3131
with:
32-
distribution: sapmachine
32+
distribution: temurin
3333
java-version: 21
3434
cache: maven
3535
- run: npm ci
@@ -54,7 +54,7 @@ jobs:
5454
BROKER_SERVICE_ID: ${{ secrets.BROKER_SERVICE_KYMA_ID }}
5555
BROKER_SERVICE_PLAN_ID: ${{ secrets.BROKER_SERVICE_KYMA_PLAN_ID }}
5656
- name: Unit Test
57-
run: mvn test -B
57+
run: npm test
5858
working-directory: ./afcjdk
5959
- name: Setup Kyma
6060
uses: ./.github/actions/kyma-setup

.github/workflows/main-ci.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,10 @@ jobs:
9292
with:
9393
node-version: 24
9494
cache: npm
95+
- uses: actions/setup-java@v5
96+
with:
97+
distribution: temurin
98+
java-version: 21
99+
cache: maven
95100
- run: npm ci
96101
- run: npm run test:bin

.github/workflows/main-pr.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,5 +92,10 @@ jobs:
9292
with:
9393
node-version: 24
9494
cache: npm
95+
- uses: actions/setup-java@v5
96+
with:
97+
distribution: temurin
98+
java-version: 21
99+
cache: maven
95100
- run: npm ci
96101
- run: npm run test:bin

java/project/srv/src/test/java/com/github/capjscommunity/sapafcsdk/scheduling/outbox/SchedulingProviderOutboxCancelTest.java

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,21 +14,27 @@
1414
import java.util.List;
1515
import java.util.Locale;
1616
import java.util.Map;
17-
import java.util.concurrent.TimeUnit;
1817
import org.json.JSONArray;
1918
import org.json.JSONObject;
2019
import org.junit.jupiter.api.Test;
2120
import org.springframework.beans.factory.annotation.Autowired;
2221
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
2322
import org.springframework.boot.test.context.SpringBootTest;
2423
import org.springframework.security.test.context.support.WithMockUser;
24+
import org.springframework.test.context.DynamicPropertyRegistry;
25+
import org.springframework.test.context.DynamicPropertySource;
2526
import org.springframework.test.web.servlet.MockMvc;
2627
import org.springframework.test.web.servlet.MvcResult;
2728

2829
@AutoConfigureMockMvc
2930
@SpringBootTest
3031
public class SchedulingProviderOutboxCancelTest {
3132

33+
@DynamicPropertySource
34+
static void overrideProps(DynamicPropertyRegistry registry) {
35+
registry.add("cds.persistence.schema", () -> "OUTBOX_PROVIDER_CANCEL");
36+
}
37+
3238
@Autowired
3339
private MockMvc mockMvc;
3440

@@ -67,7 +73,7 @@ public void cancelJobOutboxed() throws Exception {
6773
JSONObject json = new JSONObject(response);
6874
ID = json.getString("ID");
6975

70-
setup.awaitCompleted(5, TimeUnit.SECONDS);
76+
setup.awaitCompleted();
7177

7278
mockMvc
7379
.perform(get("/api/job-scheduling/v1/Job/" + ID))
@@ -84,14 +90,14 @@ public void cancelJobOutboxed() throws Exception {
8490
.andExpect(status().isOk())
8591
.andExpect(jsonPath("$.status").value("cancelRequested"));
8692

87-
List<JSONObject> messageEvents = setup.awaitCompleted(5, TimeUnit.SECONDS);
93+
List<JSONObject> messageEvents = setup.awaitCompleted();
8894

8995
mockMvc
9096
.perform(get("/api/job-scheduling/v1/Job/" + ID))
9197
.andExpect(status().isOk())
9298
.andExpect(jsonPath("$.status").value("canceled"));
9399

94-
JSONObject processingEvent = messageEvents.get(0);
100+
JSONObject processingEvent = messageEvents.getFirst();
95101
assertEquals("sapafcsdk.scheduling.ProcessingService", processingEvent.get("event"));
96102
assertEquals("cancelJob", processingEvent.getJSONObject("message").get("event"));
97103
assertEquals(ID, processingEvent.getJSONObject("message").getJSONObject("params").get("ID"));

java/project/srv/src/test/java/com/github/capjscommunity/sapafcsdk/scheduling/outbox/SchedulingProviderOutboxCreateTest.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,21 +13,27 @@
1313
import com.sap.cds.services.runtime.CdsRuntime;
1414
import java.util.List;
1515
import java.util.Map;
16-
import java.util.concurrent.TimeUnit;
1716
import org.json.JSONArray;
1817
import org.json.JSONObject;
1918
import org.junit.jupiter.api.Test;
2019
import org.springframework.beans.factory.annotation.Autowired;
2120
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
2221
import org.springframework.boot.test.context.SpringBootTest;
2322
import org.springframework.security.test.context.support.WithMockUser;
23+
import org.springframework.test.context.DynamicPropertyRegistry;
24+
import org.springframework.test.context.DynamicPropertySource;
2425
import org.springframework.test.web.servlet.MockMvc;
2526
import org.springframework.test.web.servlet.MvcResult;
2627

2728
@AutoConfigureMockMvc
2829
@SpringBootTest
2930
public class SchedulingProviderOutboxCreateTest {
3031

32+
@DynamicPropertySource
33+
static void overrideProps(DynamicPropertyRegistry registry) {
34+
registry.add("cds.persistence.schema", () -> "OUTBOX_PROVIDER_CREATE");
35+
}
36+
3137
@Autowired
3238
private MockMvc mockMvc;
3339

@@ -77,9 +83,9 @@ public void createJobOutboxed() throws Exception {
7783
.andExpect(status().isOk())
7884
.andExpect(jsonPath("$.status").value(JobStatusCode.REQUESTED));
7985

80-
List<JSONObject> messageEvents = setup.awaitCompleted(5, TimeUnit.SECONDS);
86+
List<JSONObject> messageEvents = setup.awaitCompleted();
8187

82-
JSONObject processingEvent = messageEvents.get(0);
88+
JSONObject processingEvent = messageEvents.getFirst();
8389
assertEquals("sapafcsdk.scheduling.ProcessingService", processingEvent.get("event"));
8490
assertEquals("processJob", processingEvent.getJSONObject("message").get("event"));
8591
assertEquals(ID, processingEvent.getJSONObject("message").getJSONObject("params").get("ID"));

java/project/srv/src/test/java/com/github/capjscommunity/sapafcsdk/scheduling/outbox/SchedulingWebsocketOutboxTest.java

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,19 +13,25 @@
1313
import com.sap.cds.services.persistence.PersistenceService;
1414
import com.sap.cds.services.runtime.CdsRuntime;
1515
import java.util.Collections;
16-
import java.util.concurrent.TimeUnit;
1716
import org.json.JSONObject;
1817
import org.junit.jupiter.api.Test;
1918
import org.springframework.beans.factory.annotation.Autowired;
2019
import org.springframework.beans.factory.annotation.Qualifier;
2120
import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc;
2221
import org.springframework.boot.test.context.SpringBootTest;
2322
import org.springframework.security.test.context.support.WithMockUser;
23+
import org.springframework.test.context.DynamicPropertyRegistry;
24+
import org.springframework.test.context.DynamicPropertySource;
2425

2526
@AutoConfigureMockMvc
2627
@SpringBootTest
2728
public class SchedulingWebsocketOutboxTest {
2829

30+
@DynamicPropertySource
31+
static void overrideProps(DynamicPropertyRegistry registry) {
32+
registry.add("cds.persistence.schema", () -> "OUTBOX_WEBSOCKET");
33+
}
34+
2935
@Autowired
3036
private CdsRuntime cdsRuntime;
3137

@@ -51,7 +57,7 @@ public void jobStatusChanged() throws Exception {
5157
jobStatusChanged.setData(jobStatusChangedData);
5258
websocketServiceOutboxed.emit(jobStatusChanged);
5359

54-
JSONObject websocketEvent = setup.awaitCompleted(5, TimeUnit.SECONDS).get(0);
60+
JSONObject websocketEvent = setup.awaitCompleted().getFirst();
5561

5662
assertEquals("sapafcsdk.scheduling.WebsocketService", websocketEvent.get("event"));
5763
assertEquals("jobStatusChanged", websocketEvent.getJSONObject("message").get("event"));

java/project/srv/src/test/java/com/github/capjscommunity/sapafcsdk/test/OutboxTestSetup.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@ public class OutboxTestSetup implements AutoCloseable {
2525
public final CountDownLatch messageCreated = new CountDownLatch(1);
2626
public final CountDownLatch messageDeleted = new CountDownLatch(1);
2727

28+
public final long Timeout = 10;
29+
2830
public OutboxTestSetup(String serviceName, CdsRuntime cdsRuntime, PersistenceService persistenceService) {
2931
this.persistenceService = persistenceService;
3032
this.persistenceService.run(Delete.from(MESSAGES));
@@ -38,7 +40,7 @@ public OutboxTestSetup(String serviceName, CdsRuntime cdsRuntime, PersistenceSer
3840
if (!active) {
3941
return;
4042
}
41-
String message = ((CdsCreateEventContextImpl) context).getCqn().entries().get(0).get("msg").toString();
43+
String message = ((CdsCreateEventContextImpl) context).getCqn().entries().getFirst().get("msg").toString();
4244
messageEvents.add(new JSONObject(message));
4345
messageCreated.countDown();
4446
});
@@ -60,11 +62,11 @@ public void afterClose(boolean completed) {
6062
});
6163
}
6264

63-
public List<JSONObject> awaitCompleted(long timeout, TimeUnit unit) throws InterruptedException {
64-
if (!messageCreated.await(timeout, unit)) {
65+
public List<JSONObject> awaitCompleted() throws InterruptedException {
66+
if (!messageCreated.await(Timeout, TimeUnit.SECONDS)) {
6567
throw new AssertionError("Timed out waiting for outbox CREATE");
6668
}
67-
if (!messageDeleted.await(timeout, unit)) {
69+
if (!messageDeleted.await(Timeout, TimeUnit.SECONDS)) {
6870
throw new AssertionError("Timed out waiting for outbox DELETE");
6971
}
7072
return messageEvents;

package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)