Skip to content

Commit b5bcbc5

Browse files
committed
Add requirements for publishing new package
1 parent a6d60ec commit b5bcbc5

File tree

7 files changed

+128
-0
lines changed

7 files changed

+128
-0
lines changed

.brazil.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
"s3-transfer-manager": { "packageName": "AwsJavaSdk-S3-TransferManager" },
3333
"s3-event-notifications": { "packageName": "AwsJavaSdk-S3-EventNotifications" },
3434
"sdk-core": { "packageName": "AwsJavaSdk-Core" },
35+
"thread-context": { "packageName": "AwsJavaSdk-ThreadContext" },
3536
"url-connection-client": { "packageName": "AwsJavaSdk-HttpClient-UrlConnectionClient" },
3637
"utils": { "packageName": "AwsJavaSdk-Core-Utils" },
3738
"imds": { "packageName": "AwsJavaSdk-Imds" },

aws-sdk-java/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -813,6 +813,11 @@ Amazon AutoScaling, etc).</description>
813813
<artifactId>swf</artifactId>
814814
<version>${awsjavasdk.version}</version>
815815
</dependency>
816+
<dependency>
817+
<groupId>software.amazon.awssdk</groupId>
818+
<artifactId>thread-context</artifactId>
819+
<version>${awsjavasdk.version}</version>
820+
</dependency>
816821
<dependency>
817822
<groupId>software.amazon.awssdk</groupId>
818823
<artifactId>textract</artifactId>

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -659,6 +659,7 @@
659659
<includeModule>protocols</includeModule>
660660
<includeModule>regions</includeModule>
661661
<includeModule>sdk-core</includeModule>
662+
<includeModule>thread-context</includeModule>
662663
<includeModule>http-client-spi</includeModule>
663664
<includeModule>apache-client</includeModule>
664665
<includeModule>netty-nio-client</includeModule>

test/architecture-tests/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@
6161
<groupId>software.amazon.awssdk</groupId>
6262
<version>${awsjavasdk.version}</version>
6363
</dependency>
64+
<dependency>
65+
<artifactId>thread-context</artifactId>
66+
<groupId>software.amazon.awssdk</groupId>
67+
<version>${awsjavasdk.version}</version>
68+
</dependency>
6469
<dependency>
6570
<artifactId>s3</artifactId>
6671
<groupId>software.amazon.awssdk</groupId>

test/tests-coverage-reporting/pom.xml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -242,6 +242,11 @@
242242
<groupId>software.amazon.awssdk</groupId>
243243
<version>${awsjavasdk.version}</version>
244244
</dependency>
245+
<dependency>
246+
<artifactId>thread-context</artifactId>
247+
<groupId>software.amazon.awssdk</groupId>
248+
<version>${awsjavasdk.version}</version>
249+
</dependency>
245250

246251
<!-- Need to explicitly add service modules to aggregate the tests coverage
247252
and a few services that we know with more tests should be sufficient

thread-context/pom.xml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,4 +30,45 @@
3030
</description>
3131
<url>https://aws.amazon.com/sdkforjava</url>
3232

33+
<dependencyManagement>
34+
<dependencies>
35+
<dependency>
36+
<groupId>software.amazon.awssdk</groupId>
37+
<artifactId>bom-internal</artifactId>
38+
<version>${project.version}</version>
39+
<type>pom</type>
40+
<scope>import</scope>
41+
</dependency>
42+
</dependencies>
43+
</dependencyManagement>
44+
45+
<dependencies>
46+
<dependency>
47+
<groupId>org.junit.jupiter</groupId>
48+
<artifactId>junit-jupiter</artifactId>
49+
<scope>test</scope>
50+
</dependency>
51+
<dependency>
52+
<groupId>org.assertj</groupId>
53+
<artifactId>assertj-core</artifactId>
54+
<scope>test</scope>
55+
</dependency>
56+
</dependencies>
57+
58+
<build>
59+
<plugins>
60+
<plugin>
61+
<groupId>org.apache.maven.plugins</groupId>
62+
<artifactId>maven-jar-plugin</artifactId>
63+
<configuration>
64+
<archive>
65+
<manifestEntries>
66+
<Automatic-Module-Name>software.amazon.awssdk.threadcontext</Automatic-Module-Name>
67+
</manifestEntries>
68+
</archive>
69+
</configuration>
70+
</plugin>
71+
</plugins>
72+
</build>
73+
3374
</project>
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
/*
2+
* Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License").
5+
* You may not use this file except in compliance with the License.
6+
* A copy of the License is located at
7+
*
8+
* http://aws.amazon.com/apache2.0
9+
*
10+
* or in the "license" file accompanying this file. This file is distributed
11+
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either
12+
* express or implied. See the License for the specific language governing
13+
* permissions and limitations under the License.
14+
*/
15+
16+
package software.amazon.awssdk.threadcontext;
17+
18+
import org.junit.jupiter.api.AfterEach;
19+
import org.junit.jupiter.api.Test;
20+
21+
import static org.assertj.core.api.Assertions.assertThat;
22+
23+
class ThreadStorageTest {
24+
25+
@AfterEach
26+
void cleanup() {
27+
ThreadStorage.clear();
28+
}
29+
30+
@Test
31+
void putAndGet_shouldStoreAndRetrieveValue() {
32+
ThreadStorage.put("test-key", "test-value");
33+
34+
assertThat(ThreadStorage.get("test-key")).isEqualTo("test-value");
35+
}
36+
37+
@Test
38+
void get_withNonExistentKey_shouldReturnNull() {
39+
assertThat(ThreadStorage.get("non-existent")).isNull();
40+
}
41+
42+
@Test
43+
void put_withValidKeyValue_shouldStoreValue() {
44+
ThreadStorage.put("test-key", "test-value");
45+
46+
String removed = ThreadStorage.remove("test-key");
47+
48+
assertThat(removed).isEqualTo("test-value");
49+
assertThat(ThreadStorage.get("test-key")).isNull();
50+
}
51+
52+
@Test
53+
void remove_withExistingKey_shouldRemoveAndReturnValue() {
54+
ThreadStorage.put("test-key", "test-value");
55+
ThreadStorage.put("test-key", null);
56+
57+
assertThat(ThreadStorage.get("test-key")).isNull();
58+
}
59+
60+
@Test
61+
void clear_withMultipleValues_shouldRemoveAllValues() {
62+
ThreadStorage.put("key1", "value1");
63+
ThreadStorage.put("key2", "value2");
64+
65+
ThreadStorage.clear();
66+
67+
assertThat(ThreadStorage.get("key1")).isNull();
68+
assertThat(ThreadStorage.get("key2")).isNull();
69+
}
70+
}

0 commit comments

Comments
 (0)