Skip to content

Commit

Permalink
The PropertiesMerger implementation not handling property CustomEndpo…
Browse files Browse the repository at this point in the history
…intAddress (#43706)
  • Loading branch information
moarychan authored Jan 8, 2025
1 parent 178bd1c commit f1f5e29
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 0 deletions.
5 changes: 5 additions & 0 deletions sdk/spring/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ This section includes changes in `spring-cloud-azure-autoconfigure` module.
#### Bugs Fixed
- Fix bug: Registered the empty value for ineligible definition, it causes NPE when sending message via bean `StreamBridge`. [#43366](https://github.com/Azure/azure-sdk-for-java/issues/43366).

### Spring Messaging Azure Service Bus
This section includes changes in the `spring-messaging-azure-servicebus` module.

#### Bugs Fixed
- Fix bug: The `PropertiesMerger` implementation not handling property `CustomEndpointAddress`. [#43555](https://github.com/Azure/azure-sdk-for-java/issues/43555).

## 5.19.0 (2024-12-17)
- This release is compatible with Spring Boot 3.4.0, 3.3.0-3.3.6, 3.2.0-3.2.12, 3.1.0-3.1.12, 3.0.0-3.0.13. (Note: 3.4.x (x>0), 3.3.y (y>6) and 3.2.z (z>12) should be supported, but they aren't tested with this release.)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ public static void copyProcessorPropertiesIfNotNull(ProcessorProperties source,
propertyMapper.from(source.getEntityType()).to(target::setEntityType);
propertyMapper.from(source.getMaxConcurrentSessions()).to(target::setMaxConcurrentSessions);
propertyMapper.from(source.getMaxConcurrentCalls()).to(target::setMaxConcurrentCalls);
propertyMapper.from(source.getCustomEndpointAddress()).to(target::setCustomEndpointAddress);

propertyMapper.from(source.getSessionEnabled()).to(target::setSessionEnabled);
propertyMapper.from(source.getAutoComplete()).to(target::setAutoComplete);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public ProcessorProperties merge(ProcessorProperties child, NamespaceProperties
propertyMapper.from(parent.getConnectionString()).to(properties::setConnectionString);
propertyMapper.from(parent.getEntityName()).to(properties::setEntityName);
propertyMapper.from(parent.getEntityType()).to(properties::setEntityType);
propertyMapper.from(parent.getCustomEndpointAddress()).to(properties::setCustomEndpointAddress);

// If a same property appears in both two objects, the value from the child will take precedence.
ProcessorPropertiesMerger.copyProcessorPropertiesIfNotNull(child, properties);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,12 +38,14 @@ public ProducerProperties merge(ProducerProperties child, NamespaceProperties pa
propertyMapper.from(parent.getConnectionString()).to(properties::setConnectionString);
propertyMapper.from(parent.getEntityName()).to(properties::setEntityName);
propertyMapper.from(parent.getEntityType()).to(properties::setEntityType);
propertyMapper.from(parent.getCustomEndpointAddress()).to(properties::setCustomEndpointAddress);

propertyMapper.from(child.getDomainName()).to(properties::setDomainName);
propertyMapper.from(child.getNamespace()).to(properties::setNamespace);
propertyMapper.from(child.getConnectionString()).to(properties::setConnectionString);
propertyMapper.from(child.getEntityName()).to(properties::setEntityName);
propertyMapper.from(child.getEntityType()).to(properties::setEntityType);
propertyMapper.from(child.getCustomEndpointAddress()).to(properties::setCustomEndpointAddress);

return properties;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,13 @@ public class ProcessorPropertiesParentMergerTests {
void childNotProvidedShouldUseParent() {
ProcessorProperties child = new ProcessorProperties();

String customEndpoint = "https://test.address.com:443";
NamespaceProperties parent = new NamespaceProperties();
parent.setConnectionString("parent-connection-str");
parent.getProxy().setHostname("parent-hostname");
parent.getProfile().setCloudType(AZURE_US_GOVERNMENT);
parent.setDomainName("parent-domain");
parent.setCustomEndpointAddress(customEndpoint);
parent.getClient().setTransportType(AmqpTransportType.AMQP_WEB_SOCKETS);

ProcessorProperties result = merger.merge(child, parent);
Expand All @@ -35,6 +37,7 @@ void childNotProvidedShouldUseParent() {
Assertions.assertEquals(AzureEnvironment.AZURE_US_GOVERNMENT.getActiveDirectoryEndpoint(),
result.getProfile().getEnvironment().getActiveDirectoryEndpoint());
Assertions.assertEquals("parent-domain", result.getDomainName());
Assertions.assertEquals(customEndpoint, result.getCustomEndpointAddress());
Assertions.assertEquals(AmqpTransportType.AMQP_WEB_SOCKETS, result.getClient().getTransportType());
}

Expand All @@ -47,13 +50,15 @@ void childProvidedShouldUseChild() {
child.setMaxConcurrentCalls(2);
child.getProfile().setCloudType(AZURE_CHINA);
child.setDomainName("child-domain");
child.setCustomEndpointAddress("https://child.address.com:443");
child.getClient().setTransportType(AmqpTransportType.AMQP);

NamespaceProperties parent = new NamespaceProperties();
parent.setConnectionString("parent-connection-str");
parent.getProxy().setHostname("parent-hostname");
parent.getProfile().setCloudType(AZURE_US_GOVERNMENT);
parent.setDomainName("parent-domain");
parent.setCustomEndpointAddress("https://parent.address.com:443");
parent.getClient().setTransportType(AmqpTransportType.AMQP_WEB_SOCKETS);

ProcessorProperties result = merger.merge(child, parent);
Expand All @@ -63,6 +68,7 @@ void childProvidedShouldUseChild() {
Assertions.assertEquals(3, result.getPrefetchCount());
Assertions.assertEquals(2, result.getMaxConcurrentCalls());
Assertions.assertEquals("child-domain", result.getDomainName());
Assertions.assertEquals("https://child.address.com:443", result.getCustomEndpointAddress());
Assertions.assertEquals(AZURE_CHINA, result.getProfile().getCloudType());
Assertions.assertEquals(AzureEnvironment.AZURE_CHINA.getActiveDirectoryEndpoint(),
result.getProfile().getEnvironment().getActiveDirectoryEndpoint());
Expand Down

0 comments on commit f1f5e29

Please sign in to comment.