diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/channels/AsyncAnnotationChannelsScanner.java b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/channels/AsyncAnnotationChannelsScanner.java index 616333eb6..5b4ed29ae 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/channels/AsyncAnnotationChannelsScanner.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/channels/AsyncAnnotationChannelsScanner.java @@ -37,13 +37,13 @@ public AsyncAnnotationChannelsScanner( ComponentsService componentsService, AsyncApiDocketService asyncApiDocketService, PayloadClassExtractor payloadClassExtractor, - PayloadAsyncOperationService payloadService, + PayloadAsyncOperationService payloadAsyncOperationService, List operationBindingProcessors, List messageBindingProcessors) { super( asyncAnnotationProvider, payloadClassExtractor, - payloadService, + payloadAsyncOperationService, componentsService, operationBindingProcessors, messageBindingProcessors); diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScanner.java b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScanner.java index eafd23995..7b967daf4 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScanner.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScanner.java @@ -28,19 +28,19 @@ public class SpringAnnotationMethodLevelChannelsScanner implements SpringAnnotationChannelsScannerDelegator { private final Class methodAnnotationClass; - private final PayloadMethodService payloadService; + private final PayloadMethodService payloadMethodService; private final HeaderClassExtractor headerClassExtractor; public SpringAnnotationMethodLevelChannelsScanner( Class methodAnnotationClass, BindingFactory bindingFactory, AsyncHeadersBuilder asyncHeadersBuilder, - PayloadMethodService payloadService, + PayloadMethodService payloadMethodService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { super(bindingFactory, asyncHeadersBuilder, componentsService); this.methodAnnotationClass = methodAnnotationClass; - this.payloadService = payloadService; + this.payloadMethodService = payloadMethodService; this.headerClassExtractor = headerClassExtractor; } @@ -62,7 +62,7 @@ private Map.Entry mapMethodToChannel(Method method) { MethodAnnotation annotation = AnnotationScannerUtil.findAnnotationOrThrow(methodAnnotationClass, method); - NamedSchemaObject payloadSchema = payloadService.extractSchema(method); + NamedSchemaObject payloadSchema = payloadMethodService.extractSchema(method); SchemaObject headerSchema = headerClassExtractor.extractHeader(method, payloadSchema); ChannelObject channelItem = buildChannelItem(annotation, payloadSchema, headerSchema); diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/AsyncAnnotationScanner.java b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/AsyncAnnotationScanner.java index b83434553..dd48febb2 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/AsyncAnnotationScanner.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/AsyncAnnotationScanner.java @@ -44,7 +44,7 @@ public abstract class AsyncAnnotationScanner implements Em protected final AsyncAnnotationProvider asyncAnnotationProvider; protected final PayloadClassExtractor payloadClassExtractor; - protected final PayloadAsyncOperationService payloadService; + protected final PayloadAsyncOperationService payloadAsyncOperationService; protected final ComponentsService componentsService; protected final List operationBindingProcessors; protected final List messageBindingProcessors; @@ -92,7 +92,7 @@ protected Operation buildOperation(AsyncOperation asyncOperation, Method method, } protected MessageObject buildMessage(AsyncOperation operationData, Method method) { - NamedSchemaObject payloadSchema = payloadService.extractSchema(operationData, method); + NamedSchemaObject payloadSchema = payloadAsyncOperationService.extractSchema(operationData, method); SchemaObject headerSchema = AsyncAnnotationUtil.getAsyncHeaders(operationData, resolver); String headerSchemaName = this.componentsService.registerSchema(headerSchema); diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/ClassLevelAnnotationScanner.java b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/ClassLevelAnnotationScanner.java index b5eb6811d..10c02698d 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/ClassLevelAnnotationScanner.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/common/ClassLevelAnnotationScanner.java @@ -40,7 +40,7 @@ public abstract class ClassLevelAnnotationScanner< protected final Class methodAnnotationClass; protected final BindingFactory bindingFactory; protected final AsyncHeadersBuilder asyncHeadersBuilder; - protected final PayloadMethodService payloadService; + protected final PayloadMethodService payloadMethodService; protected final HeaderClassExtractor headerClassExtractor; protected final ComponentsService componentsService; @@ -71,7 +71,7 @@ protected Map buildMessages( SpringAnnotationClassLevelOperationsScanner.MessageType messageType) { Set messages = methods.stream() .map((Method method) -> { - NamedSchemaObject payloadSchema = payloadService.extractSchema(method); + NamedSchemaObject payloadSchema = payloadMethodService.extractSchema(method); SchemaObject headerSchema = headerClassExtractor.extractHeader(method, payloadSchema); return buildMessage(classAnnotation, payloadSchema, headerSchema); }) diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScanner.java b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScanner.java index 655d8964e..5fc3262e8 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScanner.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/AsyncAnnotationOperationsScanner.java @@ -29,13 +29,13 @@ public AsyncAnnotationOperationsScanner( ClassScanner classScanner, ComponentsService componentsService, PayloadClassExtractor payloadClassExtractor, - PayloadAsyncOperationService payloadService, + PayloadAsyncOperationService payloadAsyncOperationService, List operationBindingProcessors, List messageBindingProcessors) { super( asyncAnnotationProvider, payloadClassExtractor, - payloadService, + payloadAsyncOperationService, componentsService, operationBindingProcessors, messageBindingProcessors); diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScanner.java b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScanner.java index 07ca873e5..0e068a266 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScanner.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScanner.java @@ -33,7 +33,7 @@ public SpringAnnotationClassLevelOperationsScanner( Class methodAnnotationClass, BindingFactory bindingFactory, AsyncHeadersBuilder asyncHeadersBuilder, - PayloadMethodService payloadService, + PayloadMethodService payloadMethodService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { super( @@ -41,7 +41,7 @@ public SpringAnnotationClassLevelOperationsScanner( methodAnnotationClass, bindingFactory, asyncHeadersBuilder, - payloadService, + payloadMethodService, headerClassExtractor, componentsService); } diff --git a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationMethodLevelOperationsScanner.java b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationMethodLevelOperationsScanner.java index 81a66adf9..912d9827c 100644 --- a/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationMethodLevelOperationsScanner.java +++ b/springwolf-core/src/main/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationMethodLevelOperationsScanner.java @@ -31,19 +31,19 @@ public class SpringAnnotationMethodLevelOperationsScanner implements SpringAnnotationOperationsScannerDelegator { private final Class methodAnnotationClass; - private final PayloadMethodParameterService payloadService; + private final PayloadMethodParameterService payloadMethodParameterService; private final HeaderClassExtractor headerClassExtractor; public SpringAnnotationMethodLevelOperationsScanner( Class methodAnnotationClass, BindingFactory bindingFactory, AsyncHeadersBuilder asyncHeadersBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { super(bindingFactory, asyncHeadersBuilder, componentsService); this.methodAnnotationClass = methodAnnotationClass; - this.payloadService = payloadService; + this.payloadMethodParameterService = payloadMethodParameterService; this.headerClassExtractor = headerClassExtractor; } @@ -67,7 +67,7 @@ private Map.Entry mapMethodToOperation(Method method) { String channelName = bindingFactory.getChannelName(annotation); String operationId = channelName + "_" + OperationAction.RECEIVE + "_" + method.getName(); - NamedSchemaObject payloadSchema = payloadService.extractSchema(method); + NamedSchemaObject payloadSchema = payloadMethodParameterService.extractSchema(method); SchemaObject headerSchema = headerClassExtractor.extractHeader(method, payloadSchema); Operation operation = buildOperation(annotation, payloadSchema, headerSchema); diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationClassLevelChannelsScannerIntegrationTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationClassLevelChannelsScannerIntegrationTest.java index 560617742..8e47a3fe1 100644 --- a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationClassLevelChannelsScannerIntegrationTest.java +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationClassLevelChannelsScannerIntegrationTest.java @@ -74,7 +74,7 @@ class SpringAnnotationClassLevelChannelsScannerIntegrationTest { BindingFactory bindingFactory; @Autowired - PayloadMethodService payloadService; + PayloadMethodService payloadMethodService; @Autowired HeaderClassExtractor headerClassExtractor; @@ -91,7 +91,7 @@ void setUp() { TestMethodListener.class, this.bindingFactory, new AsyncHeadersNotDocumented(), - payloadService, + payloadMethodService, headerClassExtractor, componentsService); } diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationClassLevelChannelsScannerTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationClassLevelChannelsScannerTest.java index 78dab90a2..e263c9d9f 100644 --- a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationClassLevelChannelsScannerTest.java +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationClassLevelChannelsScannerTest.java @@ -40,7 +40,7 @@ class SpringAnnotationClassLevelChannelsScannerTest { - private final PayloadMethodService payloadService = mock(); + private final PayloadMethodService payloadMethodService = mock(); private final HeaderClassExtractor headerClassExtractor = mock(HeaderClassExtractor.class); private final BindingFactory bindingFactory = mock(BindingFactory.class); private final ComponentsService componentsService = mock(ComponentsService.class); @@ -50,7 +50,7 @@ class SpringAnnotationClassLevelChannelsScannerTest { TestMethodListener.class, bindingFactory, new AsyncHeadersNotDocumented(), - payloadService, + payloadMethodService, headerClassExtractor, componentsService); @@ -71,7 +71,7 @@ void setUp() { doReturn(defaultChannelBinding).when(bindingFactory).buildChannelBinding(any()); doReturn(defaultMessageBinding).when(bindingFactory).buildMessageBinding(any(), any()); - when(payloadService.extractSchema(any())) + when(payloadMethodService.extractSchema(any())) .thenReturn(new NamedSchemaObject(String.class.getName(), new SchemaObject())); doAnswer(invocation -> AsyncHeadersNotDocumented.NOT_DOCUMENTED.getTitle()) .when(componentsService) diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScannerIntegrationTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScannerIntegrationTest.java index feabd64e7..fafa1b8dc 100644 --- a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScannerIntegrationTest.java +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScannerIntegrationTest.java @@ -75,7 +75,7 @@ class SpringAnnotationMethodLevelChannelsScannerIntegrationTest { BindingFactory bindingFactory; @Autowired - PayloadMethodService payloadService; + PayloadMethodService payloadMethodService; @Autowired HeaderClassExtractor headerClassExtractor; @@ -91,7 +91,7 @@ void setUp() { TestChannelListener.class, this.bindingFactory, new AsyncHeadersNotDocumented(), - payloadService, + payloadMethodService, headerClassExtractor, componentsService); } diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScannerTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScannerTest.java index 0d721647b..438cd5c3c 100644 --- a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScannerTest.java +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/channels/annotations/SpringAnnotationMethodLevelChannelsScannerTest.java @@ -41,7 +41,7 @@ class SpringAnnotationMethodLevelChannelsScannerTest { - private final PayloadMethodService payloadService = mock(); + private final PayloadMethodService payloadMethodService = mock(); private final HeaderClassExtractor headerClassExtractor = mock(HeaderClassExtractor.class); private final BindingFactory bindingFactory = mock(BindingFactory.class); private final ComponentsService componentsService = mock(ComponentsService.class); @@ -49,7 +49,7 @@ class SpringAnnotationMethodLevelChannelsScannerTest { TestListener.class, bindingFactory, new AsyncHeadersNotDocumented(), - payloadService, + payloadMethodService, headerClassExtractor, componentsService); @@ -70,7 +70,7 @@ void setUp() throws NoSuchMethodException { doReturn(defaultChannelBinding).when(bindingFactory).buildChannelBinding(any()); doReturn(defaultMessageBinding).when(bindingFactory).buildMessageBinding(any(), any()); - when(payloadService.extractSchema(any())) + when(payloadMethodService.extractSchema(any())) .thenReturn(new NamedSchemaObject(String.class.getName(), new SchemaObject())); doAnswer(invocation -> AsyncHeadersNotDocumented.NOT_DOCUMENTED.getTitle()) .when(componentsService) @@ -78,11 +78,11 @@ void setUp() throws NoSuchMethodException { var stringMethod = ClassWithMultipleTestListenerAnnotation.class.getDeclaredMethod("methodWithAnnotation", String.class); - when(payloadService.extractSchema(stringMethod)) + when(payloadMethodService.extractSchema(stringMethod)) .thenReturn(new NamedSchemaObject(String.class.getName(), new SchemaObject())); var simpleFooMethod = ClassWithMultipleTestListenerAnnotation.class.getDeclaredMethod( "anotherMethodWithAnnotation", SimpleFoo.class); - when(payloadService.extractSchema(simpleFooMethod)) + when(payloadMethodService.extractSchema(simpleFooMethod)) .thenReturn(new NamedSchemaObject(SimpleFoo.class.getName(), new SchemaObject())); } diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadAsyncOperationServiceTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadAsyncOperationServiceTest.java index 8281fc80a..dd9e7fadf 100644 --- a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadAsyncOperationServiceTest.java +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadAsyncOperationServiceTest.java @@ -8,6 +8,7 @@ import io.github.springwolf.core.asyncapi.scanners.common.payload.internal.PayloadClassExtractor; import io.github.springwolf.core.asyncapi.scanners.common.payload.internal.PayloadService; import io.github.springwolf.core.configuration.properties.SpringwolfConfigProperties; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.lang.reflect.Method; @@ -25,9 +26,15 @@ class PayloadAsyncOperationServiceTest { private PayloadClassExtractor payloadClassExtractor = mock(PayloadClassExtractor.class); private ComponentsService componentsService = mock(ComponentsService.class); private SpringwolfConfigProperties properties = mock(SpringwolfConfigProperties.class); - private PayloadService payloadService = new PayloadService(componentsService, properties); - private PayloadAsyncOperationService payloadAsyncOperationService = - new PayloadAsyncOperationService(payloadClassExtractor, payloadService); + + private PayloadService payloadService; + private PayloadAsyncOperationService payloadAsyncOperationService; + + @BeforeEach + void setUp() { + payloadService = new PayloadService(componentsService, properties); + payloadAsyncOperationService = new PayloadAsyncOperationService(payloadClassExtractor, payloadService); + } @Test public void shouldUsePayloadFromAsyncOperationAnnotation() { diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadMethodParameterServiceTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadMethodParameterServiceTest.java index dc3fcf5fb..048663e44 100644 --- a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadMethodParameterServiceTest.java +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadMethodParameterServiceTest.java @@ -6,6 +6,7 @@ import io.github.springwolf.core.asyncapi.scanners.common.payload.internal.PayloadClassExtractor; import io.github.springwolf.core.asyncapi.scanners.common.payload.internal.PayloadService; import io.github.springwolf.core.configuration.properties.SpringwolfConfigProperties; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.lang.reflect.Method; @@ -21,9 +22,15 @@ class PayloadMethodParameterServiceTest { private ComponentsService componentsService = mock(ComponentsService.class); private SpringwolfConfigProperties.ConfigDocket docket = mock(SpringwolfConfigProperties.ConfigDocket.class); private SpringwolfConfigProperties properties = mock(SpringwolfConfigProperties.class); - private PayloadService payloadService = new PayloadService(componentsService, properties); - private PayloadMethodParameterService payloadMethodParameterService = - new PayloadMethodParameterService(payloadClassExtractor, payloadService); + + private PayloadService payloadService; + private PayloadMethodParameterService payloadMethodParameterService; + + @BeforeEach + void setUp() { + payloadService = new PayloadService(componentsService, properties); + payloadMethodParameterService = new PayloadMethodParameterService(payloadClassExtractor, payloadService); + } @Test public void shouldExtractPayloadFromMethod() { diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadMethodReturnServiceTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadMethodReturnServiceTest.java index 9c10a5ade..b0cd07790 100644 --- a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadMethodReturnServiceTest.java +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/common/payload/PayloadMethodReturnServiceTest.java @@ -5,6 +5,7 @@ import io.github.springwolf.core.asyncapi.components.ComponentsService; import io.github.springwolf.core.asyncapi.scanners.common.payload.internal.PayloadService; import io.github.springwolf.core.configuration.properties.SpringwolfConfigProperties; +import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.Test; import java.lang.reflect.Method; @@ -19,8 +20,15 @@ class PayloadMethodReturnServiceTest { private ComponentsService componentsService = mock(ComponentsService.class); private SpringwolfConfigProperties.ConfigDocket docket = mock(SpringwolfConfigProperties.ConfigDocket.class); private SpringwolfConfigProperties properties = mock(SpringwolfConfigProperties.class); - private PayloadService payloadService = new PayloadService(componentsService, properties); - private PayloadMethodReturnService payloadMethodReturnService = new PayloadMethodReturnService(payloadService); + + private PayloadService payloadService; + private PayloadMethodReturnService payloadMethodReturnService; + + @BeforeEach + void setUp() { + payloadService = new PayloadService(componentsService, properties); + payloadMethodReturnService = new PayloadMethodReturnService(payloadService); + } @Test public void shouldExtractPayloadFromMethod() { diff --git a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScannerTest.java b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScannerTest.java index add0833e8..7b698655c 100644 --- a/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScannerTest.java +++ b/springwolf-core/src/test/java/io/github/springwolf/core/asyncapi/scanners/operations/annotations/SpringAnnotationClassLevelOperationsScannerTest.java @@ -42,7 +42,7 @@ class SpringAnnotationClassLevelOperationsScannerTest { - private final PayloadMethodService payloadService = mock(); + private final PayloadMethodService payloadMethodService = mock(); private final HeaderClassExtractor headerClassExtractor = mock(HeaderClassExtractor.class); private final BindingFactory bindingFactory = mock(BindingFactory.class); private final ComponentsService componentsService = mock(ComponentsService.class); @@ -52,7 +52,7 @@ class SpringAnnotationClassLevelOperationsScannerTest { TestMethodListener.class, bindingFactory, new AsyncHeadersNotDocumented(), - payloadService, + payloadMethodService, headerClassExtractor, componentsService); @@ -73,7 +73,7 @@ void setUp() { doReturn(defaultChannelBinding).when(bindingFactory).buildChannelBinding(any()); doReturn(defaultMessageBinding).when(bindingFactory).buildMessageBinding(any(), any()); - when(payloadService.extractSchema(any())) + when(payloadMethodService.extractSchema(any())) .thenReturn(new NamedSchemaObject(String.class.getName(), new SchemaObject())); doAnswer(invocation -> AsyncHeadersNotDocumented.NOT_DOCUMENTED.getTitle()) .when(componentsService) diff --git a/springwolf-examples/springwolf-cloud-stream-example/src/test/resources/asyncapi.json b/springwolf-examples/springwolf-cloud-stream-example/src/test/resources/asyncapi.json index 9abe7e9c5..9f47702e1 100644 --- a/springwolf-examples/springwolf-cloud-stream-example/src/test/resources/asyncapi.json +++ b/springwolf-examples/springwolf-cloud-stream-example/src/test/resources/asyncapi.json @@ -73,6 +73,7 @@ "components": { "schemas": { "AnotherPayloadDto": { + "title": "AnotherPayloadDto", "type": "object", "properties": { "example": { @@ -102,6 +103,7 @@ ] }, "ExamplePayloadDto": { + "title": "ExamplePayloadDto", "type": "object", "properties": { "someEnum": { @@ -146,6 +148,7 @@ ] }, "GooglePubSubPayloadDto": { + "title": "GooglePubSubPayloadDto", "type": "object", "properties": { "someLong": { diff --git a/springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpScannerConfiguration.java b/springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpScannerConfiguration.java index f9521a862..cec070b6d 100644 --- a/springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpScannerConfiguration.java +++ b/springwolf-plugins/springwolf-amqp-plugin/src/main/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpScannerConfiguration.java @@ -62,7 +62,7 @@ public SpringAnnotationChannelsScanner simpleRabbitClassLevelListenerAnnotationC SpringwolfClassScanner classScanner, AmqpBindingFactory amqpBindingBuilder, AsyncHeadersForAmqpBuilder asyncHeadersForAmqpBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationClassLevelChannelsScanner strategy = @@ -71,7 +71,7 @@ public SpringAnnotationChannelsScanner simpleRabbitClassLevelListenerAnnotationC RabbitHandler.class, amqpBindingBuilder, asyncHeadersForAmqpBuilder, - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); @@ -88,7 +88,7 @@ public SpringAnnotationOperationsScanner simpleRabbitClassLevelListenerAnnotatio SpringwolfClassScanner classScanner, AmqpBindingFactory amqpBindingBuilder, AsyncHeadersForAmqpBuilder asyncHeadersForAmqpBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationClassLevelOperationsScanner strategy = @@ -97,7 +97,7 @@ public SpringAnnotationOperationsScanner simpleRabbitClassLevelListenerAnnotatio RabbitHandler.class, amqpBindingBuilder, asyncHeadersForAmqpBuilder, - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); @@ -114,7 +114,7 @@ public SpringAnnotationChannelsScanner simpleRabbitMethodLevelListenerAnnotation SpringwolfClassScanner classScanner, AmqpBindingFactory amqpBindingBuilder, AsyncHeadersForAmqpBuilder asyncHeadersForAmqpBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationMethodLevelChannelsScanner strategy = @@ -122,7 +122,7 @@ public SpringAnnotationChannelsScanner simpleRabbitMethodLevelListenerAnnotation RabbitListener.class, amqpBindingBuilder, asyncHeadersForAmqpBuilder, - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); @@ -139,7 +139,7 @@ public SpringAnnotationOperationsScanner simpleRabbitMethodLevelListenerAnnotati SpringwolfClassScanner classScanner, AmqpBindingFactory amqpBindingBuilder, AsyncHeadersForAmqpBuilder asyncHeadersForAmqpBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationMethodLevelOperationsScanner strategy = @@ -147,7 +147,7 @@ public SpringAnnotationOperationsScanner simpleRabbitMethodLevelListenerAnnotati RabbitListener.class, amqpBindingBuilder, asyncHeadersForAmqpBuilder, - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); diff --git a/springwolf-plugins/springwolf-amqp-plugin/src/test/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpProducerConfigurationIntegrationTest.java b/springwolf-plugins/springwolf-amqp-plugin/src/test/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpProducerConfigurationIntegrationTest.java index bac131538..1f99dc1bf 100644 --- a/springwolf-plugins/springwolf-amqp-plugin/src/test/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpProducerConfigurationIntegrationTest.java +++ b/springwolf-plugins/springwolf-amqp-plugin/src/test/java/io/github/springwolf/plugins/amqp/configuration/SpringwolfAmqpProducerConfigurationIntegrationTest.java @@ -53,6 +53,7 @@ public class SpringwolfAmqpProducerConfigurationIntegrationTest { @MockBean(ComponentsService.class), @MockBean(PayloadAsyncOperationService.class), @MockBean(PayloadMethodParameterService.class), + @MockBean(HeaderClassExtractor.class), @MockBean(AsyncApiDocketService.class) }) @Nested @@ -95,6 +96,7 @@ void springwolfAmqpProducerShouldBePresentInSpringContext() { @MockBean(ComponentsService.class), @MockBean(PayloadAsyncOperationService.class), @MockBean(PayloadMethodParameterService.class), + @MockBean(HeaderClassExtractor.class), }) @Nested class AmqpProducerWillNotBeCreatedIfDisabledTest { diff --git a/springwolf-plugins/springwolf-jms-plugin/src/main/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsScannerConfiguration.java b/springwolf-plugins/springwolf-jms-plugin/src/main/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsScannerConfiguration.java index 090a49079..98bc77c55 100644 --- a/springwolf-plugins/springwolf-jms-plugin/src/main/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsScannerConfiguration.java +++ b/springwolf-plugins/springwolf-jms-plugin/src/main/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsScannerConfiguration.java @@ -38,7 +38,7 @@ public JmsBindingFactory jmsBindingBuilder() { public SpringAnnotationChannelsScanner simpleJmsMethodLevelListenerAnnotationChannelsScanner( SpringwolfClassScanner classScanner, JmsBindingFactory jmsBindingBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationMethodLevelChannelsScanner strategy = @@ -46,7 +46,7 @@ public SpringAnnotationChannelsScanner simpleJmsMethodLevelListenerAnnotationCha JmsListener.class, jmsBindingBuilder, new AsyncHeadersNotDocumented(), - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); @@ -59,7 +59,7 @@ public SpringAnnotationChannelsScanner simpleJmsMethodLevelListenerAnnotationCha public SpringAnnotationOperationsScanner simpleJmsMethodLevelListenerAnnotationOperationsScanner( SpringwolfClassScanner classScanner, JmsBindingFactory jmsBindingBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationMethodLevelOperationsScanner strategy = @@ -67,7 +67,7 @@ public SpringAnnotationOperationsScanner simpleJmsMethodLevelListenerAnnotationO JmsListener.class, jmsBindingBuilder, new AsyncHeadersNotDocumented(), - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); diff --git a/springwolf-plugins/springwolf-jms-plugin/src/test/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsProducerConfigurationIntegrationTest.java b/springwolf-plugins/springwolf-jms-plugin/src/test/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsProducerConfigurationIntegrationTest.java index 9932ee09a..50f97875c 100644 --- a/springwolf-plugins/springwolf-jms-plugin/src/test/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsProducerConfigurationIntegrationTest.java +++ b/springwolf-plugins/springwolf-jms-plugin/src/test/java/io/github/springwolf/plugins/jms/configuration/SpringwolfJmsProducerConfigurationIntegrationTest.java @@ -47,6 +47,7 @@ public class SpringwolfJmsProducerConfigurationIntegrationTest { @MockBean(SpringwolfClassScanner.class), @MockBean(ComponentsService.class), @MockBean(PayloadMethodParameterService.class), + @MockBean(HeaderClassExtractor.class), @MockBean(JmsTemplate.class) }) @Nested @@ -86,6 +87,7 @@ void springwolfJmsProducerShouldBePresentInSpringContext() { @MockBean(SpringwolfClassScanner.class), @MockBean(ComponentsService.class), @MockBean(PayloadMethodParameterService.class), + @MockBean(HeaderClassExtractor.class), @MockBean(JmsTemplate.class) }) @Nested diff --git a/springwolf-plugins/springwolf-kafka-plugin/src/main/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaScannerConfiguration.java b/springwolf-plugins/springwolf-kafka-plugin/src/main/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaScannerConfiguration.java index d2a245a98..a23f65d6c 100644 --- a/springwolf-plugins/springwolf-kafka-plugin/src/main/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaScannerConfiguration.java +++ b/springwolf-plugins/springwolf-kafka-plugin/src/main/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaScannerConfiguration.java @@ -57,7 +57,7 @@ public SpringAnnotationChannelsScanner simpleKafkaClassLevelListenerAnnotationCh SpringwolfClassScanner classScanner, KafkaBindingFactory kafkaBindingBuilder, AsyncHeadersForKafkaBuilder asyncHeadersForKafkaBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationClassLevelChannelsScanner strategy = @@ -66,7 +66,7 @@ public SpringAnnotationChannelsScanner simpleKafkaClassLevelListenerAnnotationCh KafkaHandler.class, kafkaBindingBuilder, asyncHeadersForKafkaBuilder, - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); @@ -83,7 +83,7 @@ public SpringAnnotationOperationsScanner simpleKafkaClassLevelListenerAnnotation SpringwolfClassScanner classScanner, KafkaBindingFactory kafkaBindingBuilder, AsyncHeadersForKafkaBuilder asyncHeadersForKafkaBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationClassLevelOperationsScanner strategy = @@ -92,7 +92,7 @@ public SpringAnnotationOperationsScanner simpleKafkaClassLevelListenerAnnotation KafkaHandler.class, kafkaBindingBuilder, asyncHeadersForKafkaBuilder, - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); @@ -109,7 +109,7 @@ public SpringAnnotationChannelsScanner simpleKafkaMethodLevelListenerAnnotationC SpringwolfClassScanner classScanner, KafkaBindingFactory kafkaBindingBuilder, AsyncHeadersForKafkaBuilder asyncHeadersForKafkaBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationMethodLevelChannelsScanner strategy = @@ -117,7 +117,7 @@ public SpringAnnotationChannelsScanner simpleKafkaMethodLevelListenerAnnotationC KafkaListener.class, kafkaBindingBuilder, asyncHeadersForKafkaBuilder, - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); @@ -134,7 +134,7 @@ public SpringAnnotationOperationsScanner simpleKafkaMethodLevelListenerAnnotatio SpringwolfClassScanner classScanner, KafkaBindingFactory kafkaBindingBuilder, AsyncHeadersForKafkaBuilder asyncHeadersForKafkaBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationMethodLevelOperationsScanner strategy = @@ -142,7 +142,7 @@ public SpringAnnotationOperationsScanner simpleKafkaMethodLevelListenerAnnotatio KafkaListener.class, kafkaBindingBuilder, asyncHeadersForKafkaBuilder, - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); diff --git a/springwolf-plugins/springwolf-kafka-plugin/src/test/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaProducerConfigurationIntegrationTest.java b/springwolf-plugins/springwolf-kafka-plugin/src/test/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaProducerConfigurationIntegrationTest.java index 99354bdbf..de93e8b2b 100644 --- a/springwolf-plugins/springwolf-kafka-plugin/src/test/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaProducerConfigurationIntegrationTest.java +++ b/springwolf-plugins/springwolf-kafka-plugin/src/test/java/io/github/springwolf/plugins/kafka/configuration/SpringwolfKafkaProducerConfigurationIntegrationTest.java @@ -88,7 +88,8 @@ void springwolfKafkaTemplateShouldBePresentInSpringContext() { @MockBean(SpringwolfClassScanner.class), @MockBean(ComponentsService.class), @MockBean(PayloadAsyncOperationService.class), - @MockBean(PayloadMethodParameterService.class) + @MockBean(PayloadMethodParameterService.class), + @MockBean(HeaderClassExtractor.class), }) class KafkaProducerWillNotBeCreatedIfDisabledTest { @Autowired diff --git a/springwolf-plugins/springwolf-sqs-plugin/src/main/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsScannerConfiguration.java b/springwolf-plugins/springwolf-sqs-plugin/src/main/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsScannerConfiguration.java index f9cbb08be..5a7da00ec 100644 --- a/springwolf-plugins/springwolf-sqs-plugin/src/main/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsScannerConfiguration.java +++ b/springwolf-plugins/springwolf-sqs-plugin/src/main/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsScannerConfiguration.java @@ -38,7 +38,7 @@ public SqsBindingFactory sqsBindingBuilder() { public SpringAnnotationChannelsScanner simpleSqsMethodLevelListenerAnnotationChannelsScanner( SpringwolfClassScanner classScanner, SqsBindingFactory sqsBindingBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationMethodLevelChannelsScanner strategy = @@ -46,7 +46,7 @@ public SpringAnnotationChannelsScanner simpleSqsMethodLevelListenerAnnotationCha SqsListener.class, sqsBindingBuilder, new AsyncHeadersNotDocumented(), - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); @@ -59,7 +59,7 @@ public SpringAnnotationChannelsScanner simpleSqsMethodLevelListenerAnnotationCha public SpringAnnotationOperationsScanner simpleSqsMethodLevelListenerAnnotationOperationsScanner( SpringwolfClassScanner classScanner, SqsBindingFactory sqsBindingBuilder, - PayloadMethodParameterService payloadService, + PayloadMethodParameterService payloadMethodParameterService, HeaderClassExtractor headerClassExtractor, ComponentsService componentsService) { SpringAnnotationMethodLevelOperationsScanner strategy = @@ -67,7 +67,7 @@ public SpringAnnotationOperationsScanner simpleSqsMethodLevelListenerAnnotationO SqsListener.class, sqsBindingBuilder, new AsyncHeadersNotDocumented(), - payloadService, + payloadMethodParameterService, headerClassExtractor, componentsService); diff --git a/springwolf-plugins/springwolf-sqs-plugin/src/test/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsProducerConfigurationIntegrationTest.java b/springwolf-plugins/springwolf-sqs-plugin/src/test/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsProducerConfigurationIntegrationTest.java index 0498d9b79..f755bb512 100644 --- a/springwolf-plugins/springwolf-sqs-plugin/src/test/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsProducerConfigurationIntegrationTest.java +++ b/springwolf-plugins/springwolf-sqs-plugin/src/test/java/io/github/springwolf/plugins/sqs/configuration/SpringwolfSqsProducerConfigurationIntegrationTest.java @@ -48,6 +48,7 @@ public class SpringwolfSqsProducerConfigurationIntegrationTest { @MockBean(SpringwolfClassScanner.class), @MockBean(ComponentsService.class), @MockBean(PayloadMethodParameterService.class), + @MockBean(HeaderClassExtractor.class), @MockBean(SqsTemplate.class) }) @Nested @@ -87,6 +88,7 @@ void springwolfSqsProducerShouldBePresentInSpringContext() { @MockBean(SpringwolfClassScanner.class), @MockBean(ComponentsService.class), @MockBean(PayloadMethodParameterService.class), + @MockBean(HeaderClassExtractor.class), @MockBean(SqsTemplate.class) }) @Nested