Skip to content

Commit 4d090b6

Browse files
committed
fix: harden serializer fallback
1 parent de05119 commit 4d090b6

6 files changed

Lines changed: 42 additions & 10 deletions

File tree

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ labels: kind/bug
66
assignees: ''
77
---
88

9-
- [ ] I have searched the [issues](https://github.com/reactivegroup/capa-aws/issues) of this repository and believe that this is not a duplicate.
9+
- [ ] I have searched the [issues](https://github.com/capa-cloud/capa-java-aws/issues) of this repository and believe that this is not a duplicate.
1010

1111
### Environment
1212

@@ -38,4 +38,4 @@ assignees: ''
3838
<!-- RELEASE NOTE: **FIX** Bug in runtime. -->
3939
<!-- RELEASE NOTE: **UPDATE** Runtime dependency. -->
4040

41-
RELEASE NOTE:
41+
RELEASE NOTE:

AGENTS.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Repository Guidelines
2+
3+
- GitHub: `capa-cloud/capa-java-aws`
4+
- Category: Java AWS adapter/runtime project.
5+
- Public documentation: `https://capa.rxcloud.group/`
6+
7+
Keep cloud credentials out of source. Validate adapter changes with local tests or mocked AWS clients before documenting them as ready.

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,6 +312,6 @@ This project is licensed under the Apache License 2.0 - see the [LICENSE](LICENS
312312

313313
<p align="center">
314314
<a href="https://github.com/capa-cloud">Capa Cloud</a> ·
315-
<a href="https://capa-cloud.github.io/capa.io/">Documentation</a> ·
315+
<a href="https://capa.rxcloud.group/">Documentation</a> ·
316316
<a href="https://aws.amazon.com/">AWS</a>
317317
</p>

capa-spi-aws-mesh/src/main/java/group/rxcloud/capa/spi/aws/mesh/http/serializer/AwsCapaSerializerProvider.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ public interface AwsCapaSerializerProvider {
3737
static CapaObjectSerializer getSerializerOrDefault(CapaObjectSerializer originSerializer) {
3838
final String serializerName = AwsCapaRpcProperties.SerializerProperties.Settings.getRpcAwsAppMeshSerializer();
3939
Map<String, CapaObjectSerializer> serializerFactory = AwsCapaSerializerFactory.SERIALIZER_FACTORY;
40-
return serializerFactory.getOrDefault(serializerName, originSerializer);
40+
CapaObjectSerializer configuredSerializer = serializerFactory.get(serializerName);
41+
if (configuredSerializer != null) {
42+
return configuredSerializer;
43+
}
44+
return originSerializer != null ? originSerializer : serializerFactory.get("default");
4145
}
4246

4347
/**

capa-spi-aws-mesh/src/test/java/group/rxcloud/capa/spi/aws/mesh/http/serializer/AwsCapaSerializerProviderTest.java

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,35 @@
1717
package group.rxcloud.capa.spi.aws.mesh.http.serializer;
1818

1919
import group.rxcloud.capa.infrastructure.serializer.CapaObjectSerializer;
20+
import group.rxcloud.capa.infrastructure.serializer.DefaultObjectSerializer;
21+
import group.rxcloud.capa.spi.aws.mesh.AwsCapaRpcProperties;
22+
import org.junit.jupiter.api.AfterEach;
2023
import org.junit.jupiter.api.Assertions;
2124
import org.junit.jupiter.api.Test;
2225

2326
public class AwsCapaSerializerProviderTest {
2427

28+
@AfterEach
29+
public void resetSerializerSetting() {
30+
AwsCapaRpcProperties.SerializerProperties.Settings.setRpcAwsAppMeshSerializer("default");
31+
}
32+
2533
@Test
26-
public void testGetSerializerOrDefault_Success() {
34+
public void testGetSerializerOrDefault_UsesDefaultWhenConfiguredSerializerIsUnavailable() {
35+
AwsCapaRpcProperties.SerializerProperties.Settings.setRpcAwsAppMeshSerializer("unavailable");
36+
2737
CapaObjectSerializer serializerOrDefault = AwsCapaSerializerProvider.getSerializerOrDefault(null);
38+
2839
Assertions.assertEquals("application/json", serializerOrDefault.getContentType());
2940
}
41+
42+
@Test
43+
public void testGetSerializerOrDefault_UsesProvidedSerializer() {
44+
AwsCapaRpcProperties.SerializerProperties.Settings.setRpcAwsAppMeshSerializer("custom");
45+
CapaObjectSerializer serializer = new DefaultObjectSerializer();
46+
47+
CapaObjectSerializer serializerOrDefault = AwsCapaSerializerProvider.getSerializerOrDefault(serializer);
48+
49+
Assertions.assertSame(serializer, serializerOrDefault);
50+
}
3051
}

pom.xml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
<version>1.11.13.5.RELEASE</version>
2727
<name>capa-aws-parent</name>
2828
<description>AWS for Capa.</description>
29-
<url>https://github.com/reactivegroup</url>
29+
<url>https://github.com/capa-cloud/capa-java-aws</url>
3030

3131
<licenses>
3232
<license>
@@ -47,9 +47,9 @@
4747
</developers>
4848

4949
<scm>
50-
<connection>scm:git:git@github.com:reactivegroup/capa-aws.git</connection>
51-
<developerConnection>scm:git:git@github.com:reactivegroup/capa-aws.git</developerConnection>
52-
<url>git@github.com:reactivegroup/capa-aws.git</url>
50+
<connection>scm:git:https://github.com/capa-cloud/capa-java-aws.git</connection>
51+
<developerConnection>scm:git:git@github.com:capa-cloud/capa-java-aws.git</developerConnection>
52+
<url>https://github.com/capa-cloud/capa-java-aws</url>
5353
</scm>
5454

5555
<distributionManagement>
@@ -661,4 +661,4 @@
661661
</plugins>
662662
</build>
663663

664-
</project>
664+
</project>

0 commit comments

Comments
 (0)