Unify 'observation-enabled' property defaults

Change spring.pulsar.listener.observation-enabled and
spring.pulsar.template.observations-enabled to false

See gh-39276
This commit is contained in:
Wzy19930507 2024-01-23 11:23:07 +08:00 committed by Moritz Halbritter
parent 50cae75cb7
commit f5c9d34a5d
4 changed files with 10 additions and 10 deletions

View File

@ -761,7 +761,7 @@ public class PulsarProperties {
* Whether to record observations for when the Observations API is available and
* the client supports it.
*/
private boolean observationEnabled = true;
private boolean observationEnabled;
public SchemaType getSchemaType() {
return this.schemaType;
@ -856,7 +856,7 @@ public class PulsarProperties {
/**
* Whether to record observations for when the Observations API is available.
*/
private boolean observationsEnabled = true;
private boolean observationsEnabled;
public boolean isObservationsEnabled() {
return this.observationsEnabled;

View File

@ -304,7 +304,7 @@ class PulsarAutoConfigurationTests {
@Test
void whenNoPropertiesEnablesObservation() {
this.contextRunner.run((context) -> assertThat(context).getBean(PulsarTemplate.class)
.hasFieldOrPropertyWithValue("observationEnabled", true));
.hasFieldOrPropertyWithValue("observationEnabled", false));
}
@Test
@ -451,7 +451,7 @@ class PulsarAutoConfigurationTests {
void whenNoPropertiesEnablesObservation() {
this.contextRunner
.run((context) -> assertThat(context).getBean(ConcurrentPulsarListenerContainerFactory.class)
.hasFieldOrPropertyWithValue("containerProperties.observationEnabled", true));
.hasFieldOrPropertyWithValue("containerProperties.observationEnabled", false));
}
@Test

View File

@ -219,12 +219,12 @@ class PulsarPropertiesMapperTests {
PulsarProperties properties = new PulsarProperties();
properties.getConsumer().getSubscription().setType(SubscriptionType.Shared);
properties.getListener().setSchemaType(SchemaType.AVRO);
properties.getListener().setObservationEnabled(false);
properties.getListener().setObservationEnabled(true);
PulsarContainerProperties containerProperties = new PulsarContainerProperties("my-topic-pattern");
new PulsarPropertiesMapper(properties).customizeContainerProperties(containerProperties);
assertThat(containerProperties.getSubscriptionType()).isEqualTo(SubscriptionType.Shared);
assertThat(containerProperties.getSchemaType()).isEqualTo(SchemaType.AVRO);
assertThat(containerProperties.isObservationEnabled()).isFalse();
assertThat(containerProperties.isObservationEnabled()).isTrue();
}
@Test

View File

@ -354,10 +354,10 @@ class PulsarPropertiesTests {
void bind() {
Map<String, String> map = new HashMap<>();
map.put("spring.pulsar.listener.schema-type", "avro");
map.put("spring.pulsar.listener.observation-enabled", "false");
map.put("spring.pulsar.listener.observation-enabled", "true");
PulsarProperties.Listener properties = bindPropeties(map).getListener();
assertThat(properties.getSchemaType()).isEqualTo(SchemaType.AVRO);
assertThat(properties.isObservationEnabled()).isFalse();
assertThat(properties.isObservationEnabled()).isTrue();
}
}
@ -389,9 +389,9 @@ class PulsarPropertiesTests {
@Test
void bind() {
Map<String, String> map = new HashMap<>();
map.put("spring.pulsar.template.observations-enabled", "false");
map.put("spring.pulsar.template.observations-enabled", "true");
PulsarProperties.Template properties = bindPropeties(map).getTemplate();
assertThat(properties.isObservationsEnabled()).isFalse();
assertThat(properties.isObservationsEnabled()).isTrue();
}
}