Skip to content

Commit 24f65a9

Browse files
committed
updated POM to use JDK 21
1 parent d82fd97 commit 24f65a9

File tree

13 files changed

+226
-60
lines changed

13 files changed

+226
-60
lines changed

javav2/example_code/ecs/pom.xml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,13 @@
2121
<type>pom</type>
2222
<scope>import</scope>
2323
</dependency>
24+
<dependency>
25+
<groupId>org.apache.logging.log4j</groupId>
26+
<artifactId>log4j-bom</artifactId>
27+
<version>2.23.1</version>
28+
<type>pom</type>
29+
<scope>import</scope>
30+
</dependency>
2431
</dependencies>
2532
</dependencyManagement>
2633
<dependencies>
@@ -39,11 +46,6 @@
3946
<artifactId>gson</artifactId>
4047
<version>2.10.1</version>
4148
</dependency>
42-
<dependency>
43-
<groupId>org.slf4j</groupId>
44-
<artifactId>slf4j-log4j12</artifactId>
45-
<version>2.0.5</version>
46-
</dependency>
4749
<dependency>
4850
<groupId>software.amazon.awssdk</groupId>
4951
<artifactId>ecs</artifactId>
@@ -56,6 +58,23 @@
5658
<groupId>software.amazon.awssdk</groupId>
5759
<artifactId>ssooidc</artifactId>
5860
</dependency>
61+
<dependency>
62+
<groupId>org.apache.logging.log4j</groupId>
63+
<artifactId>log4j-core</artifactId>
64+
</dependency>
65+
<dependency>
66+
<groupId>org.slf4j</groupId>
67+
<artifactId>slf4j-api</artifactId>
68+
<version>2.0.13</version>
69+
</dependency>
70+
<dependency>
71+
<groupId>org.apache.logging.log4j</groupId>
72+
<artifactId>log4j-slf4j2-impl</artifactId>
73+
</dependency>
74+
<dependency>
75+
<groupId>org.apache.logging.log4j</groupId>
76+
<artifactId>log4j-1.2-api</artifactId>
77+
</dependency>
5978
</dependencies>
6079
<build>
6180
<plugins>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Configuration status="WARN">
2+
<Appenders>
3+
<Console name="ConsoleAppender" target="SYSTEM_OUT">
4+
<PatternLayout pattern="%msg%n"/>
5+
</Console>
6+
<Console name="AlignedConsoleAppender" target="SYSTEM_OUT">
7+
<PatternLayout pattern="%m%n"/>
8+
</Console>
9+
</Appenders>
10+
<Loggers>
11+
<!-- Root logger configuration -->
12+
<Root level="info">
13+
<!-- Specify which appenders to use -->
14+
<AppenderRef ref="ConsoleAppender" />
15+
</Root>
16+
</Loggers>
17+
</Configuration>

javav2/example_code/ecs/src/test/java/EcsTest.java

Lines changed: 18 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,9 @@
66
import org.junit.jupiter.api.*;
77
import static org.junit.jupiter.api.Assertions.assertDoesNotThrow;
88
import static org.junit.jupiter.api.Assertions.assertFalse;
9+
10+
import org.slf4j.Logger;
11+
import org.slf4j.LoggerFactory;
912
import software.amazon.awssdk.regions.Region;
1013
import software.amazon.awssdk.services.ecs.EcsClient;
1114
import software.amazon.awssdk.services.secretsmanager.SecretsManagerClient;
@@ -20,6 +23,7 @@
2023
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
2124
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
2225
public class EcsTest {
26+
private static final Logger logger = LoggerFactory.getLogger(EcsTest.class);
2327
private static EcsClient ecsClient;
2428
private static String clusterName = "";
2529
private static String clusterARN = "";
@@ -53,61 +57,61 @@ public static void setUp() throws IOException {
5357
@Test
5458
@Tag("IntegrationTest")
5559
@Order(1)
56-
public void CreateCluster() {
60+
public void testCreateCluster() {
5761
clusterARN = CreateCluster.createGivenCluster(ecsClient, clusterName);
5862
assertFalse(clusterARN.isEmpty());
59-
System.out.println("Test 1 passed");
63+
logger.info("Test 1 passed");
6064
}
6165

6266
@Test
6367
@Tag("IntegrationTest")
6468
@Order(2)
65-
public void ListClusters() {
69+
public void testListClusters() {
6670
assertDoesNotThrow(() -> ListClusters.listAllClusters(ecsClient));
67-
System.out.println("Test 2 passed");
71+
logger.info("Test 2 passed");
6872
}
6973

7074
@Test
7175
@Tag("IntegrationTest")
7276
@Order(3)
73-
public void DescribeClusters() {
77+
public void testDescribeClusters() {
7478
assertDoesNotThrow(() -> DescribeClusters.descCluster(ecsClient, clusterARN));
75-
System.out.println("Test 3 passed");
79+
logger.info("Test 3 passed");
7680
}
7781

7882
@Test
7983
@Tag("IntegrationTest")
8084
@Order(4)
81-
public void ListTaskDefinitions() {
85+
public void testListTaskDefinitions() {
8286
assertDoesNotThrow(() -> ListTaskDefinitions.getAllTasks(ecsClient, clusterARN, taskId));
83-
System.out.println("Test 4 passed");
87+
logger.info("Test 4 passed");
8488
}
8589

8690
@Test
8791
@Tag("IntegrationTest")
8892
@Order(5)
89-
public void CreateService() {
93+
public void testCreateService() {
9094
serviceArn = CreateService.createNewService(ecsClient, clusterName, serviceName, securityGroups, subnet,
9195
taskDefinition);
9296
assertFalse(serviceArn.isEmpty());
93-
System.out.println("Test 5 passed");
97+
logger.info("Test 5 passed");
9498
}
9599

96100
@Test
97101
@Tag("IntegrationTest")
98102
@Order(6)
99-
public void UpdateService() throws InterruptedException {
103+
public void testUpdateService() throws InterruptedException {
100104
Thread.sleep(20000);
101105
assertDoesNotThrow(() -> UpdateService.updateSpecificService(ecsClient, clusterName, serviceArn));
102-
System.out.println("Test 6 passed");
106+
logger.info("Test 6 passed");
103107
}
104108

105109
@Test
106110
@Tag("IntegrationTest")
107111
@Order(7)
108-
public void DeleteService() {
112+
public void testDeleteService() {
109113
assertDoesNotThrow(() -> DeleteService.deleteSpecificService(ecsClient, clusterName, serviceArn));
110-
System.out.println("Test 7 passed");
114+
logger.info("Test 7 passed");
111115
}
112116

113117
private static String getSecretValues() {

javav2/example_code/elasticbeanstalk/pom.xml

Lines changed: 25 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@
3636
<dependency>
3737
<groupId>software.amazon.awssdk</groupId>
3838
<artifactId>bom</artifactId>
39-
<version>2.29.45</version>
39+
<version>2.31.8</version>
40+
<type>pom</type>
41+
<scope>import</scope>
42+
</dependency>
43+
<dependency>
44+
<groupId>org.apache.logging.log4j</groupId>
45+
<artifactId>log4j-bom</artifactId>
46+
<version>2.23.1</version>
4047
<type>pom</type>
4148
<scope>import</scope>
4249
</dependency>
@@ -62,11 +69,6 @@
6269
<artifactId>gson</artifactId>
6370
<version>2.10.1</version>
6471
</dependency>
65-
<dependency>
66-
<groupId>org.slf4j</groupId>
67-
<artifactId>slf4j-log4j12</artifactId>
68-
<version>2.0.5</version>
69-
</dependency>
7072
<dependency>
7173
<groupId>software.amazon.awssdk</groupId>
7274
<artifactId>textract</artifactId>
@@ -79,5 +81,22 @@
7981
<groupId>software.amazon.awssdk</groupId>
8082
<artifactId>ssooidc</artifactId>
8183
</dependency>
84+
<dependency>
85+
<groupId>org.apache.logging.log4j</groupId>
86+
<artifactId>log4j-core</artifactId>
87+
</dependency>
88+
<dependency>
89+
<groupId>org.slf4j</groupId>
90+
<artifactId>slf4j-api</artifactId>
91+
<version>2.0.13</version>
92+
</dependency>
93+
<dependency>
94+
<groupId>org.apache.logging.log4j</groupId>
95+
<artifactId>log4j-slf4j2-impl</artifactId>
96+
</dependency>
97+
<dependency>
98+
<groupId>org.apache.logging.log4j</groupId>
99+
<artifactId>log4j-1.2-api</artifactId>
100+
</dependency>
82101
</dependencies>
83102
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Configuration status="WARN">
2+
<Appenders>
3+
<Console name="ConsoleAppender" target="SYSTEM_OUT">
4+
<PatternLayout pattern="%msg%n"/>
5+
</Console>
6+
<Console name="AlignedConsoleAppender" target="SYSTEM_OUT">
7+
<PatternLayout pattern="%m%n"/>
8+
</Console>
9+
</Appenders>
10+
<Loggers>
11+
<!-- Root logger configuration -->
12+
<Root level="info">
13+
<!-- Specify which appenders to use -->
14+
<AppenderRef ref="ConsoleAppender" />
15+
</Root>
16+
</Loggers>
17+
</Configuration>

javav2/example_code/elasticbeanstalk/src/test/java/ElasticBeanstalkTest.java

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
// SPDX-License-Identifier: Apache-2.0
33

44
import com.aws.example.*;
5+
import org.slf4j.Logger;
6+
import org.slf4j.LoggerFactory;
57
import software.amazon.awssdk.auth.credentials.EnvironmentVariableCredentialsProvider;
68
import software.amazon.awssdk.services.elasticbeanstalk.ElasticBeanstalkClient;
79
import org.junit.jupiter.api.*;
@@ -12,6 +14,7 @@
1214
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
1315
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
1416
public class ElasticBeanstalkTest {
17+
private static final Logger logger = LoggerFactory.getLogger(ElasticBeanstalkTest.class);
1518
private static ElasticBeanstalkClient beanstalkClient;
1619
private static final String appName = "apptest";
1720

@@ -26,46 +29,46 @@ public static void setUp() {
2629
@Test
2730
@Tag("IntegrationTest")
2831
@Order(1)
29-
public void CreateApp() {
32+
public void testCreateApp() {
3033
String appArn = CreateApplication.createApp(beanstalkClient, appName);
3134
assertFalse(appArn.isEmpty());
32-
System.out.println("Test 1 passed");
35+
logger.info("Test 1 passed");
3336
}
3437

3538
@Test
3639
@Tag("IntegrationTest")
3740
@Order(2)
38-
public void CreateEnvironment() {
41+
public void testCreateEnvironment() {
3942
String envName = "environmenttest";
4043
String environmentArn = CreateEnvironment.createEBEnvironment(beanstalkClient, envName, appName);
4144
assertFalse(environmentArn.isEmpty());
42-
System.out.println("Test 2 passed");
45+
logger.info("Test 2 passed");
4346
}
4447

4548
@Test
4649
@Tag("IntegrationTest")
4750
@Order(3)
48-
public void DescribeApplications() {
51+
public void testDescribeApplications() {
4952
DescribeApplications.describeApps(beanstalkClient);
5053
assertTrue(true);
51-
System.out.println("Test 3 passed");
54+
logger.info("Test 3 passed");
5255
}
5356

5457
@Test
5558
@Tag("IntegrationTest")
5659
@Order(4)
57-
public void DescribeEnvironment() {
60+
public void testDescribeEnvironment() {
5861
assertDoesNotThrow(() -> DescribeEnvironment.describeEnv(beanstalkClient, appName));
59-
System.out.println("Test 4 passed");
62+
logger.info("Test 4 passed");
6063
}
6164

6265
@Test
6366
@Tag("IntegrationTest")
6467
@Order(5)
65-
public void DeleteApplication() throws InterruptedException {
68+
public void testDeleteApplication() throws InterruptedException {
6669
System.out.println("*** Wait for 5 MIN so the app can be deleted");
6770
TimeUnit.MINUTES.sleep(5);
6871
assertDoesNotThrow(() -> DeleteApplication.deleteApp(beanstalkClient, appName));
69-
System.out.println("Test 5 passed");
72+
logger.info("Test 5 passed");
7073
}
7174
}

javav2/example_code/emr/pom.xml

Lines changed: 24 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,13 @@
3939
<type>pom</type>
4040
<scope>import</scope>
4141
</dependency>
42+
<dependency>
43+
<groupId>org.apache.logging.log4j</groupId>
44+
<artifactId>log4j-bom</artifactId>
45+
<version>2.23.1</version>
46+
<type>pom</type>
47+
<scope>import</scope>
48+
</dependency>
4249
</dependencies>
4350
</dependencyManagement>
4451
<dependencies>
@@ -57,11 +64,6 @@
5764
<artifactId>gson</artifactId>
5865
<version>2.10.1</version>
5966
</dependency>
60-
<dependency>
61-
<groupId>org.slf4j</groupId>
62-
<artifactId>slf4j-log4j12</artifactId>
63-
<version>2.0.5</version>
64-
</dependency>
6567
<dependency>
6668
<groupId>software.amazon.awssdk</groupId>
6769
<artifactId>emr</artifactId>
@@ -74,5 +76,22 @@
7476
<groupId>software.amazon.awssdk</groupId>
7577
<artifactId>ssooidc</artifactId>
7678
</dependency>
79+
<dependency>
80+
<groupId>org.apache.logging.log4j</groupId>
81+
<artifactId>log4j-core</artifactId>
82+
</dependency>
83+
<dependency>
84+
<groupId>org.slf4j</groupId>
85+
<artifactId>slf4j-api</artifactId>
86+
<version>2.0.13</version>
87+
</dependency>
88+
<dependency>
89+
<groupId>org.apache.logging.log4j</groupId>
90+
<artifactId>log4j-slf4j2-impl</artifactId>
91+
</dependency>
92+
<dependency>
93+
<groupId>org.apache.logging.log4j</groupId>
94+
<artifactId>log4j-1.2-api</artifactId>
95+
</dependency>
7796
</dependencies>
7897
</project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Configuration status="WARN">
2+
<Appenders>
3+
<Console name="ConsoleAppender" target="SYSTEM_OUT">
4+
<PatternLayout pattern="%msg%n"/>
5+
</Console>
6+
<Console name="AlignedConsoleAppender" target="SYSTEM_OUT">
7+
<PatternLayout pattern="%m%n"/>
8+
</Console>
9+
</Appenders>
10+
<Loggers>
11+
<!-- Root logger configuration -->
12+
<Root level="info">
13+
<!-- Specify which appenders to use -->
14+
<AppenderRef ref="ConsoleAppender" />
15+
</Root>
16+
</Loggers>
17+
</Configuration>

0 commit comments

Comments
 (0)