@@ -58,7 +58,7 @@ void getAsyncHeaders(Class<?> classWithOperationBindingProcessor) throws Excepti
5858 .as (headers .getProperties () + " does not contain key 'headerResolved'" )
5959 .isTrue ();
6060 SchemaObject headerResolved = (SchemaObject ) headers .getProperties ().get ("headerResolved" );
61- assertThat (headerResolved .getType ()).containsExactly ("string " );
61+ assertThat (headerResolved .getType ()).containsExactly ("integer " );
6262 assertThat (headerResolved .getExamples ().get (0 )).isEqualTo ("valueResolved" );
6363 assertThat (headerResolved .getDescription ()).isEqualTo ("descriptionResolved" );
6464 assertThat (headerResolved .getFormat ()).isEqualTo ("int32Resolved" );
@@ -101,6 +101,23 @@ void getAsyncHeadersWithoutSchemaName() throws Exception {
101101 assertThat (headers .getTitle ()).isNotNull ();
102102 }
103103
104+ @ Test
105+ void getAsyncHeadersWithMergedValue () throws Exception {
106+ // given
107+ Method m = ClassWithHeaders .class .getDeclaredMethod ("withMergedValue" , String .class );
108+ AsyncOperation operation = m .getAnnotation (AsyncListener .class ).operation ();
109+
110+ // when
111+ SchemaObject headers = AsyncAnnotationUtil .getAsyncHeaders (operation , stringValueResolver );
112+
113+ // then
114+ SchemaObject headerProperty = (SchemaObject ) headers .getProperties ().get ("headerResolved" );
115+ assertThat (headerProperty .getEnumValues ())
116+ .containsExactlyInAnyOrder ("valueResolved" , "value2Resolved" , "value3Resolved" );
117+ assertThat (headerProperty .getExamples ())
118+ .containsExactlyInAnyOrder ("valueResolved" , "value2Resolved" , "value3Resolved" );
119+ }
120+
104121 @ Test
105122 void getAsyncHeadersWithoutValue () throws Exception {
106123 // given
@@ -131,7 +148,7 @@ void getAsyncHeadersWithFormat() throws Exception {
131148 }
132149
133150 @ Test
134- void getAsyncHeadersWithEmptyFormat () throws Exception {
151+ void processAsyncHeadersWithEmptyFormat () throws Exception {
135152 // given
136153 Method m = ClassWithHeaders .class .getDeclaredMethod ("withoutFormat" , String .class );
137154 AsyncOperation operation = m .getAnnotation (AsyncListener .class ).operation ();
@@ -145,7 +162,7 @@ void getAsyncHeadersWithEmptyFormat() throws Exception {
145162 }
146163
147164 @ Test
148- void getAsyncHeadersWithType () throws Exception {
165+ void processAsyncHeadersWithType () throws Exception {
149166 // given
150167 Method m = ClassWithHeaders .class .getDeclaredMethod ("withType" , String .class );
151168 AsyncOperation operation = m .getAnnotation (AsyncListener .class ).operation ();
@@ -159,7 +176,7 @@ void getAsyncHeadersWithType() throws Exception {
159176 }
160177
161178 @ Test
162- void getAsyncHeadersWithoutType () throws Exception {
179+ void processAsyncHeadersWithoutType () throws Exception {
163180 // given
164181 Method m = ClassWithHeaders .class .getDeclaredMethod ("withoutType" , String .class );
165182 AsyncOperation operation = m .getAnnotation (AsyncListener .class ).operation ();
@@ -303,7 +320,7 @@ void processMessageFromAnnotationWithAsyncMessage(Class<?> classWithOperationBin
303320 }
304321
305322 @ Test
306- void getServers () throws Exception {
323+ void processServers () throws Exception {
307324 Method m = ClassWithOperationBindingProcessor .class .getDeclaredMethod ("methodWithAnnotation" , String .class );
308325 AsyncOperation operation = m .getAnnotation (AsyncListener .class ).operation ();
309326
@@ -371,6 +388,7 @@ private static class ClassWithOperationBindingProcessor {
371388 name = "header" ,
372389 value = "value" ,
373390 description = "description" ,
391+ type = SchemaType .INTEGER ,
374392 format = "int32" ),
375393 @ AsyncOperation .Headers .Header (
376394 name = "headerWithoutValue" ,
@@ -384,15 +402,6 @@ private void methodWithAnnotation(String payload) {}
384402 @ AsyncOperation (
385403 channelName = "${test.property.test-channel}" ,
386404 description = "${test.property.description}" ,
387- headers =
388- @ AsyncOperation .Headers (
389- schemaName = "TestSchema" ,
390- values = {
391- @ AsyncOperation .Headers .Header (
392- name = "header" ,
393- value = "value" ,
394- description = "description" )
395- }),
396405 message =
397406 @ AsyncMessage (
398407 description = "Message description" ,
@@ -419,6 +428,7 @@ private static class ClassWithAbstractOperationBindingProcessor {
419428 name = "header" ,
420429 value = "value" ,
421430 description = "description" ,
431+ type = SchemaType .INTEGER ,
422432 format = "int32" ),
423433 @ AsyncOperation .Headers .Header (
424434 name = "headerWithoutValue" ,
@@ -432,15 +442,6 @@ private void methodWithAnnotation(String payload) {}
432442 @ AsyncOperation (
433443 channelName = "${test.property.test-channel}" ,
434444 description = "${test.property.description}" ,
435- headers =
436- @ AsyncOperation .Headers (
437- schemaName = "TestSchema" ,
438- values = {
439- @ AsyncOperation .Headers .Header (
440- name = "header" ,
441- value = "value" ,
442- description = "description" )
443- }),
444445 message =
445446 @ AsyncMessage (
446447 description = "Message description" ,
@@ -454,7 +455,6 @@ private void methodWithAsyncMessageAnnotation(String payload) {}
454455
455456 private static class ClassWithHeaders {
456457 @ AsyncListener (operation = @ AsyncOperation (channelName = "${test.property.test-channel}" ))
457- @ TestOperationBindingProcessor .TestOperationBinding ()
458458 private void emptyHeaders (String payload ) {}
459459
460460 @ AsyncListener (
@@ -466,17 +466,32 @@ private void emptyHeaders(String payload) {}
466466 values = {
467467 @ AsyncOperation .Headers .Header (name = "header" , value = "value" )
468468 })))
469- @ TestOperationBindingProcessor .TestOperationBinding ()
470469 private void withoutSchemaName (String payload ) {}
471470
471+ @ AsyncListener (
472+ operation =
473+ @ AsyncOperation (
474+ channelName = "${test.property.test-channel}" ,
475+ headers =
476+ @ AsyncOperation .Headers (
477+ values = {
478+ @ AsyncOperation .Headers .Header (name = "header" , value = "value" ),
479+ @ AsyncOperation .Headers .Header (
480+ name = "header" ,
481+ value = {"value2" , "value3" }),
482+ @ AsyncOperation .Headers .Header (
483+ name = "unrelated-header" ,
484+ value = "otherValue" )
485+ })))
486+ private void withMergedValue (String payload ) {}
487+
472488 @ AsyncListener (
473489 operation =
474490 @ AsyncOperation (
475491 channelName = "${test.property.test-channel}" ,
476492 headers =
477493 @ AsyncOperation .Headers (
478494 values = {@ AsyncOperation .Headers .Header (name = "header" )})))
479- @ TestOperationBindingProcessor .TestOperationBinding ()
480495 private void withoutValue (String payload ) {}
481496
482497 @ AsyncListener (
@@ -488,7 +503,6 @@ private void withoutValue(String payload) {}
488503 values = {
489504 @ AsyncOperation .Headers .Header (name = "header" , format = "int32" )
490505 })))
491- @ TestOperationBindingProcessor .TestOperationBinding ()
492506 private void withFormat (String payload ) {}
493507
494508 @ AsyncListener (
@@ -498,7 +512,6 @@ private void withFormat(String payload) {}
498512 headers =
499513 @ AsyncOperation .Headers (
500514 values = {@ AsyncOperation .Headers .Header (name = "header" )})))
501- @ TestOperationBindingProcessor .TestOperationBinding ()
502515 private void withoutFormat (String payload ) {}
503516
504517 @ AsyncListener (
@@ -512,7 +525,6 @@ private void withoutFormat(String payload) {}
512525 name = "header" ,
513526 type = SchemaType .INTEGER )
514527 })))
515- @ TestOperationBindingProcessor .TestOperationBinding ()
516528 private void withType (String payload ) {}
517529
518530 @ AsyncListener (
@@ -522,7 +534,6 @@ private void withType(String payload) {}
522534 headers =
523535 @ AsyncOperation .Headers (
524536 values = {@ AsyncOperation .Headers .Header (name = "header" )})))
525- @ TestOperationBindingProcessor .TestOperationBinding ()
526537 private void withoutType (String payload ) {}
527538
528539 @ AsyncListener (
@@ -537,7 +548,6 @@ private void withoutType(String payload) {}
537548 value = "value" ,
538549 description = "non unique header" )
539550 })))
540- @ TestOperationBindingProcessor .TestOperationBinding ()
541551 private void differentHeadersWithoutSchemaName (String payload ) {}
542552 }
543553
0 commit comments