Skip to content

Commit 7db7dfd

Browse files
committed
updated POM to use JDK 21
1 parent 5ec2e86 commit 7db7dfd

File tree

6 files changed

+106
-20
lines changed

6 files changed

+106
-20
lines changed

javav2/example_code/migrationhub/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,13 @@
4040
<type>pom</type>
4141
<scope>import</scope>
4242
</dependency>
43+
<dependency>
44+
<groupId>org.apache.logging.log4j</groupId>
45+
<artifactId>log4j-bom</artifactId>
46+
<version>2.23.1</version>
47+
<type>pom</type>
48+
<scope>import</scope>
49+
</dependency>
4350
</dependencies>
4451
</dependencyManagement>
4552
<dependencies>
@@ -70,5 +77,22 @@
7077
<groupId>software.amazon.awssdk</groupId>
7178
<artifactId>ssooidc</artifactId>
7279
</dependency>
80+
<dependency>
81+
<groupId>org.apache.logging.log4j</groupId>
82+
<artifactId>log4j-core</artifactId>
83+
</dependency>
84+
<dependency>
85+
<groupId>org.slf4j</groupId>
86+
<artifactId>slf4j-api</artifactId>
87+
<version>2.0.13</version>
88+
</dependency>
89+
<dependency>
90+
<groupId>org.apache.logging.log4j</groupId>
91+
<artifactId>log4j-slf4j2-impl</artifactId>
92+
</dependency>
93+
<dependency>
94+
<groupId>org.apache.logging.log4j</groupId>
95+
<artifactId>log4j-1.2-api</artifactId>
96+
</dependency>
7397
</dependencies>
7498
</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/migrationhub/src/test/java/MigrationHubTest.java

Lines changed: 15 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
import com.example.migrationhub.*;
55
import com.google.gson.Gson;
6+
import org.slf4j.Logger;
7+
import org.slf4j.LoggerFactory;
68
import software.amazon.awssdk.auth.credentials.EnvironmentVariableCredentialsProvider;
79
import software.amazon.awssdk.services.migrationhub.MigrationHubClient;
810
import org.junit.jupiter.api.*;
@@ -19,6 +21,7 @@
1921
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
2022
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
2123
public class MigrationHubTest {
24+
private static final Logger logger = LoggerFactory.getLogger(MigrationHubTest.class);
2225
private static MigrationHubClient migrationClient;
2326
private static String appId = "";
2427
private static String migrationtask = "";
@@ -42,49 +45,49 @@ public static void setUp() {
4245
@Test
4346
@Tag("IntegrationTest")
4447
@Order(1)
45-
public void ImportMigrationTask() {
48+
public void testImportMigrationTask() {
4649
assertDoesNotThrow(() -> ImportMigrationTask.importMigrTask(migrationClient, migrationtask, progress));
47-
System.out.println("Test 1 passed");
50+
logger.info("Test 1 passed");
4851
}
4952

5053
@Test
5154
@Tag("IntegrationTest")
5255
@Order(2)
53-
public void DescribeAppState() {
56+
public void testDescribeAppState() {
5457
assertDoesNotThrow(() -> DescribeAppState.describeApplicationState(migrationClient, appId));
55-
System.out.println("Test 2 passed");
58+
logger.info("Test 2 passed");
5659
}
5760

5861
@Test
5962
@Tag("IntegrationTest")
6063
@Order(3)
61-
public void DescribeMigrationTask() {
64+
public void testDescribeMigrationTask() {
6265
assertDoesNotThrow(() -> DescribeMigrationTask.describeMigTask(migrationClient, migrationtask, progress));
63-
System.out.println("Test 3 passed");
66+
logger.info("Test 3 passed");
6467
}
6568

6669
@Test
6770
@Tag("IntegrationTest")
6871
@Order(4)
69-
public void ListApplications() {
72+
public void testListApplications() {
7073
assertDoesNotThrow(() -> ListApplications.listApps(migrationClient));
71-
System.out.println("Test 4 passed");
74+
logger.info("Test 4 passed");
7275
}
7376

7477
@Test
7578
@Tag("IntegrationTest")
7679
@Order(5)
77-
public void ListMigrationTasks() {
80+
public void testListMigrationTasks() {
7881
assertDoesNotThrow(() -> ListMigrationTasks.listMigrTasks(migrationClient));
79-
System.out.println("Test 5 passed");
82+
logger.info("Test 5 passed");
8083
}
8184

8285
@Test
8386
@Tag("IntegrationTest")
8487
@Order(6)
85-
public void DeleteProgressStream() {
88+
public void testDeleteProgressStream() {
8689
assertDoesNotThrow(() -> DeleteProgressStream.deleteStream(migrationClient, progress));
87-
System.out.println("Test 6 passed");
90+
logger.info("Test 6 passed");
8891
}
8992

9093
private static String getSecretValues() {

javav2/example_code/mq/pom.xml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,13 @@
2424
<type>pom</type>
2525
<scope>import</scope>
2626
</dependency>
27+
<dependency>
28+
<groupId>org.apache.logging.log4j</groupId>
29+
<artifactId>log4j-bom</artifactId>
30+
<version>2.23.1</version>
31+
<type>pom</type>
32+
<scope>import</scope>
33+
</dependency>
2734
</dependencies>
2835
</dependencyManagement>
2936
<dependencies>
@@ -45,6 +52,23 @@
4552
<groupId>software.amazon.awssdk</groupId>
4653
<artifactId>ssooidc</artifactId>
4754
</dependency>
55+
<dependency>
56+
<groupId>org.apache.logging.log4j</groupId>
57+
<artifactId>log4j-core</artifactId>
58+
</dependency>
59+
<dependency>
60+
<groupId>org.slf4j</groupId>
61+
<artifactId>slf4j-api</artifactId>
62+
<version>2.0.13</version>
63+
</dependency>
64+
<dependency>
65+
<groupId>org.apache.logging.log4j</groupId>
66+
<artifactId>log4j-slf4j2-impl</artifactId>
67+
</dependency>
68+
<dependency>
69+
<groupId>org.apache.logging.log4j</groupId>
70+
<artifactId>log4j-1.2-api</artifactId>
71+
</dependency>
4872
</dependencies>
4973
<build>
5074
<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/mq/src/test/java/AmazonMQTest.java

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

44
import com.example.mq.*;
5+
import org.slf4j.Logger;
6+
import org.slf4j.LoggerFactory;
57
import software.amazon.awssdk.regions.Region;
68
import software.amazon.awssdk.services.mq.MqClient;
79
import software.amazon.awssdk.services.mq.model.Configuration;
@@ -17,7 +19,7 @@
1719
@TestInstance(TestInstance.Lifecycle.PER_METHOD)
1820
@TestMethodOrder(MethodOrderer.OrderAnnotation.class)
1921
public class AmazonMQTest {
20-
22+
private static final Logger logger = LoggerFactory.getLogger(AmazonMQTest.class);
2123
private static MqClient mqClient;
2224
private static Region region;
2325
private static String engineType = "";
@@ -28,7 +30,6 @@ public class AmazonMQTest {
2830

2931
@BeforeAll
3032
public static void setUp() throws IOException {
31-
3233
region = Region.US_WEST_2;
3334
mqClient = MqClient.builder()
3435
.region(region)
@@ -64,7 +65,7 @@ public static void setUp() throws IOException {
6465
public void CreateBroker() {
6566
brokerId = CreateBroker.createBroker(mqClient, engineType, brokerName);
6667
assertTrue(!brokerId.isEmpty());
67-
System.out.println("Test 1 passed");
68+
logger.info("Test 1 passed");
6869
}
6970

7071
@Test
@@ -73,7 +74,7 @@ public void CreateBroker() {
7374
public void CreateConfiguration() {
7475
String result = CreateConfiguration.createNewConfigutation(mqClient, configurationName);
7576
assertTrue(!result.isEmpty());
76-
System.out.println("Test 2 passed");
77+
logger.info("Test 2 passed");
7778
}
7879

7980
@Test
@@ -82,7 +83,7 @@ public void CreateConfiguration() {
8283
public void DescribeBroker() {
8384
String result = DescribeBroker.describeBroker(mqClient, brokerName);
8485
assertTrue(!result.isEmpty());
85-
System.out.println("Test 3 passed");
86+
logger.info("Test 3 passed");
8687
}
8788

8889
@Test
@@ -91,7 +92,7 @@ public void DescribeBroker() {
9192
public void ListBrokers() {
9293
List<BrokerSummary> result = ListBrokers.listBrokers(mqClient);
9394
assertTrue(result instanceof List<?>);
94-
System.out.println("Test 4 passed");
95+
logger.info("Test 4 passed");
9596
}
9697

9798
@Test
@@ -100,14 +101,14 @@ public void ListBrokers() {
100101
public void ListConfigurations() {
101102
List<Configuration> result = ListConfigurations.listConfigurations(mqClient);
102103
assertTrue(result instanceof List<?>);
103-
System.out.println("Test 5 passed");
104+
logger.info("Test 5 passed");
104105
}
105106

106107
@Test
107108
@Tag("IntegrationTest")
108109
@Order(6)
109110
public void testDeleteBroker() {
110111
assertDoesNotThrow(() -> DeleteBroker.deleteBroker(mqClient, brokerId));
111-
System.out.println("Test 6 passed");
112+
logger.info("Test 6 passed");
112113
}
113114
}

0 commit comments

Comments
 (0)