3838 */
3939class OnEnabledLoggingExportConditionTests {
4040
41+ private static final String GLOBAL_PROPERTY_NAME = "management.logging.export.enabled" ;
42+
43+ private static final String OTLP_PROPERTY_NAME = "management.otlp.logging.export.enabled" ;
44+
4145 @ Test
4246 void shouldMatchIfNoPropertyIsSet () {
4347 OnEnabledLoggingExportCondition condition = new OnEnabledLoggingExportCondition ();
@@ -49,8 +53,8 @@ void shouldMatchIfNoPropertyIsSet() {
4953 @ Test
5054 void shouldNotMatchIfGlobalPropertyIsFalse () {
5155 OnEnabledLoggingExportCondition condition = new OnEnabledLoggingExportCondition ();
52- ConditionOutcome outcome = condition . getMatchOutcome (
53- mockConditionContext (Map .of ("management.logging.export.enabled" , "false" )), mockMetadata ("" ));
56+ ConditionOutcome outcome = condition
57+ . getMatchOutcome ( mockConditionContext (Map .of (GLOBAL_PROPERTY_NAME , "false" )), mockMetadata ("" ));
5458 assertThat (outcome .isMatch ()).isFalse ();
5559 assertThat (outcome .getMessage ())
5660 .isEqualTo ("@ConditionalOnEnabledLoggingExport management.logging.export.enabled is false" );
@@ -59,8 +63,8 @@ void shouldNotMatchIfGlobalPropertyIsFalse() {
5963 @ Test
6064 void shouldMatchIfGlobalPropertyIsTrue () {
6165 OnEnabledLoggingExportCondition condition = new OnEnabledLoggingExportCondition ();
62- ConditionOutcome outcome = condition .getMatchOutcome (
63- mockConditionContext ( Map . of ( "management.logging.export.enabled" , "true" )), mockMetadata ("" ));
66+ ConditionOutcome outcome = condition .getMatchOutcome (mockConditionContext ( Map . of ( GLOBAL_PROPERTY_NAME , "true" )),
67+ mockMetadata ("" ));
6468 assertThat (outcome .isMatch ()).isTrue ();
6569 assertThat (outcome .getMessage ())
6670 .isEqualTo ("@ConditionalOnEnabledLoggingExport management.logging.export.enabled is true" );
@@ -69,8 +73,8 @@ void shouldMatchIfGlobalPropertyIsTrue() {
6973 @ Test
7074 void shouldNotMatchIfExporterPropertyIsFalse () {
7175 OnEnabledLoggingExportCondition condition = new OnEnabledLoggingExportCondition ();
72- ConditionOutcome outcome = condition .getMatchOutcome (
73- mockConditionContext ( Map . of ( "management.otlp.logging.export.enabled" , "false" )), mockMetadata ("otlp" ));
76+ ConditionOutcome outcome = condition .getMatchOutcome (mockConditionContext ( Map . of ( OTLP_PROPERTY_NAME , "false" )),
77+ mockMetadata ("otlp" ));
7478 assertThat (outcome .isMatch ()).isFalse ();
7579 assertThat (outcome .getMessage ())
7680 .isEqualTo ("@ConditionalOnEnabledLoggingExport management.otlp.logging.export.enabled is false" );
@@ -79,8 +83,8 @@ void shouldNotMatchIfExporterPropertyIsFalse() {
7983 @ Test
8084 void shouldMatchIfExporterPropertyIsTrue () {
8185 OnEnabledLoggingExportCondition condition = new OnEnabledLoggingExportCondition ();
82- ConditionOutcome outcome = condition .getMatchOutcome (
83- mockConditionContext ( Map . of ( "management.otlp.logging.export.enabled" , "true" )), mockMetadata ("otlp" ));
86+ ConditionOutcome outcome = condition .getMatchOutcome (mockConditionContext ( Map . of ( OTLP_PROPERTY_NAME , "true" )),
87+ mockMetadata ("otlp" ));
8488 assertThat (outcome .isMatch ()).isTrue ();
8589 assertThat (outcome .getMessage ())
8690 .isEqualTo ("@ConditionalOnEnabledLoggingExport management.otlp.logging.export.enabled is true" );
@@ -89,8 +93,8 @@ void shouldMatchIfExporterPropertyIsTrue() {
8993 @ Test
9094 void exporterPropertyShouldOverrideGlobalPropertyIfTrue () {
9195 OnEnabledLoggingExportCondition condition = new OnEnabledLoggingExportCondition ();
92- ConditionOutcome outcome = condition .getMatchOutcome (mockConditionContext (
93- Map .of ("management.logging.export.enabled" , "false" , "management.otlp.logging.export.enabled" , "true" )),
96+ ConditionOutcome outcome = condition .getMatchOutcome (
97+ mockConditionContext ( Map .of (GLOBAL_PROPERTY_NAME , "false" , OTLP_PROPERTY_NAME , "true" )),
9498 mockMetadata ("otlp" ));
9599 assertThat (outcome .isMatch ()).isTrue ();
96100 assertThat (outcome .getMessage ())
@@ -100,8 +104,8 @@ void exporterPropertyShouldOverrideGlobalPropertyIfTrue() {
100104 @ Test
101105 void exporterPropertyShouldOverrideGlobalPropertyIfFalse () {
102106 OnEnabledLoggingExportCondition condition = new OnEnabledLoggingExportCondition ();
103- ConditionOutcome outcome = condition .getMatchOutcome (mockConditionContext (
104- Map .of ("management.logging.export.enabled" , "true" , "management.otlp.logging.export.enabled" , "false" )),
107+ ConditionOutcome outcome = condition .getMatchOutcome (
108+ mockConditionContext ( Map .of (GLOBAL_PROPERTY_NAME , "true" , OTLP_PROPERTY_NAME , "false" )),
105109 mockMetadata ("otlp" ));
106110 assertThat (outcome .isMatch ()).isFalse ();
107111 assertThat (outcome .getMessage ())
0 commit comments