org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler Java Examples
The following examples show how to use
org.springframework.messaging.simp.annotation.support.SimpAnnotationMethodMessageHandler.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MessageBrokerBeanDefinitionParserTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void customArgumentAndReturnValueTypes() { loadBeanDefinitions("websocket-config-broker-custom-argument-and-return-value-types.xml"); SimpAnnotationMethodMessageHandler handler = this.appContext.getBean(SimpAnnotationMethodMessageHandler.class); List<HandlerMethodArgumentResolver> customResolvers = handler.getCustomArgumentResolvers(); assertEquals(2, customResolvers.size()); assertTrue(handler.getArgumentResolvers().contains(customResolvers.get(0))); assertTrue(handler.getArgumentResolvers().contains(customResolvers.get(1))); List<HandlerMethodReturnValueHandler> customHandlers = handler.getCustomReturnValueHandlers(); assertEquals(2, customHandlers.size()); assertTrue(handler.getReturnValueHandlers().contains(customHandlers.get(0))); assertTrue(handler.getReturnValueHandlers().contains(customHandlers.get(1))); }
Example #2
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void customPathMatcher() { ApplicationContext context = loadConfig(CustomConfig.class); SimpleBrokerMessageHandler broker = context.getBean(SimpleBrokerMessageHandler.class); DefaultSubscriptionRegistry registry = (DefaultSubscriptionRegistry) broker.getSubscriptionRegistry(); assertEquals("a.a", registry.getPathMatcher().combine("a", "a")); PathMatcher pathMatcher = context.getBean(SimpAnnotationMethodMessageHandler.class).getPathMatcher(); assertEquals("a.a", pathMatcher.combine("a", "a")); DefaultUserDestinationResolver resolver = context.getBean(DefaultUserDestinationResolver.class); assertNotNull(resolver); assertEquals(false, resolver.isRemoveLeadingSlash()); }
Example #3
Source File: AbstractMessageBrokerConfiguration.java From spring-analysis-note with MIT License | 6 votes |
@Bean public SimpAnnotationMethodMessageHandler simpAnnotationMethodMessageHandler() { SimpAnnotationMethodMessageHandler handler = createAnnotationMethodMessageHandler(); handler.setDestinationPrefixes(getBrokerRegistry().getApplicationDestinationPrefixes()); handler.setMessageConverter(brokerMessageConverter()); handler.setValidator(simpValidator()); List<HandlerMethodArgumentResolver> argumentResolvers = new ArrayList<>(); addArgumentResolvers(argumentResolvers); handler.setCustomArgumentResolvers(argumentResolvers); List<HandlerMethodReturnValueHandler> returnValueHandlers = new ArrayList<>(); addReturnValueHandlers(returnValueHandlers); handler.setCustomReturnValueHandlers(returnValueHandlers); PathMatcher pathMatcher = getBrokerRegistry().getPathMatcher(); if (pathMatcher != null) { handler.setPathMatcher(pathMatcher); } return handler; }
Example #4
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void brokerChannelUsedByAnnotatedMethod() { ApplicationContext context = loadConfig(SimpleBrokerConfig.class); TestChannel channel = context.getBean("brokerChannel", TestChannel.class); SimpAnnotationMethodMessageHandler messageHandler = context.getBean(SimpAnnotationMethodMessageHandler.class); StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.SEND); headers.setSessionId("sess1"); headers.setSessionAttributes(new ConcurrentHashMap<>()); headers.setDestination("/foo"); Message<?> message = MessageBuilder.createMessage(new byte[0], headers.getMessageHeaders()); messageHandler.handleMessage(message); message = channel.messages.get(0); headers = StompHeaderAccessor.wrap(message); assertEquals(SimpMessageType.MESSAGE, headers.getMessageType()); assertEquals("/bar", headers.getDestination()); assertEquals("bar", new String((byte[]) message.getPayload())); }
Example #5
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void clientOutboundChannelUsedByAnnotatedMethod() { ApplicationContext context = loadConfig(SimpleBrokerConfig.class); TestChannel channel = context.getBean("clientOutboundChannel", TestChannel.class); SimpAnnotationMethodMessageHandler messageHandler = context.getBean(SimpAnnotationMethodMessageHandler.class); StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.SUBSCRIBE); headers.setSessionId("sess1"); headers.setSessionAttributes(new ConcurrentHashMap<>()); headers.setSubscriptionId("subs1"); headers.setDestination("/foo"); Message<?> message = MessageBuilder.withPayload(new byte[0]).setHeaders(headers).build(); messageHandler.handleMessage(message); message = channel.messages.get(0); headers = StompHeaderAccessor.wrap(message); assertEquals(SimpMessageType.MESSAGE, headers.getMessageType()); assertEquals("/foo", headers.getDestination()); assertEquals("bar", new String((byte[]) message.getPayload())); }
Example #6
Source File: MessageBrokerBeanDefinitionParserTests.java From java-technology-stack with MIT License | 6 votes |
@Test public void customArgumentAndReturnValueTypes() { loadBeanDefinitions("websocket-config-broker-custom-argument-and-return-value-types.xml"); SimpAnnotationMethodMessageHandler handler = this.appContext.getBean(SimpAnnotationMethodMessageHandler.class); List<HandlerMethodArgumentResolver> customResolvers = handler.getCustomArgumentResolvers(); assertEquals(2, customResolvers.size()); assertTrue(handler.getArgumentResolvers().contains(customResolvers.get(0))); assertTrue(handler.getArgumentResolvers().contains(customResolvers.get(1))); List<HandlerMethodReturnValueHandler> customHandlers = handler.getCustomReturnValueHandlers(); assertEquals(2, customHandlers.size()); assertTrue(handler.getReturnValueHandlers().contains(customHandlers.get(0))); assertTrue(handler.getReturnValueHandlers().contains(customHandlers.get(1))); }
Example #7
Source File: AbstractMessageBrokerConfiguration.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Bean public SimpAnnotationMethodMessageHandler simpAnnotationMethodMessageHandler() { SimpAnnotationMethodMessageHandler handler = createAnnotationMethodMessageHandler(); handler.setDestinationPrefixes(getBrokerRegistry().getApplicationDestinationPrefixes()); handler.setMessageConverter(brokerMessageConverter()); handler.setValidator(simpValidator()); List<HandlerMethodArgumentResolver> argumentResolvers = new ArrayList<HandlerMethodArgumentResolver>(); addArgumentResolvers(argumentResolvers); handler.setCustomArgumentResolvers(argumentResolvers); List<HandlerMethodReturnValueHandler> returnValueHandlers = new ArrayList<HandlerMethodReturnValueHandler>(); addReturnValueHandlers(returnValueHandlers); handler.setCustomReturnValueHandlers(returnValueHandlers); PathMatcher pathMatcher = this.getBrokerRegistry().getPathMatcher(); if (pathMatcher != null) { handler.setPathMatcher(pathMatcher); } return handler; }
Example #8
Source File: AbstractMessageBrokerConfiguration.java From java-technology-stack with MIT License | 6 votes |
@Bean public SimpAnnotationMethodMessageHandler simpAnnotationMethodMessageHandler() { SimpAnnotationMethodMessageHandler handler = createAnnotationMethodMessageHandler(); handler.setDestinationPrefixes(getBrokerRegistry().getApplicationDestinationPrefixes()); handler.setMessageConverter(brokerMessageConverter()); handler.setValidator(simpValidator()); List<HandlerMethodArgumentResolver> argumentResolvers = new ArrayList<>(); addArgumentResolvers(argumentResolvers); handler.setCustomArgumentResolvers(argumentResolvers); List<HandlerMethodReturnValueHandler> returnValueHandlers = new ArrayList<>(); addReturnValueHandlers(returnValueHandlers); handler.setCustomReturnValueHandlers(returnValueHandlers); PathMatcher pathMatcher = getBrokerRegistry().getPathMatcher(); if (pathMatcher != null) { handler.setPathMatcher(pathMatcher); } return handler; }
Example #9
Source File: MessageBrokerBeanDefinitionParserTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void customArgumentAndReturnValueTypes() { loadBeanDefinitions("websocket-config-broker-custom-argument-and-return-value-types.xml"); SimpAnnotationMethodMessageHandler handler = this.appContext.getBean(SimpAnnotationMethodMessageHandler.class); List<HandlerMethodArgumentResolver> customResolvers = handler.getCustomArgumentResolvers(); assertEquals(2, customResolvers.size()); assertTrue(handler.getArgumentResolvers().contains(customResolvers.get(0))); assertTrue(handler.getArgumentResolvers().contains(customResolvers.get(1))); List<HandlerMethodReturnValueHandler> customHandlers = handler.getCustomReturnValueHandlers(); assertEquals(2, customHandlers.size()); assertTrue(handler.getReturnValueHandlers().contains(customHandlers.get(0))); assertTrue(handler.getReturnValueHandlers().contains(customHandlers.get(1))); }
Example #10
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void clientOutboundChannelUsedByAnnotatedMethod() { TestChannel channel = this.simpleBrokerContext.getBean("clientOutboundChannel", TestChannel.class); SimpAnnotationMethodMessageHandler messageHandler = this.simpleBrokerContext.getBean(SimpAnnotationMethodMessageHandler.class); StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.SUBSCRIBE); headers.setSessionId("sess1"); headers.setSessionAttributes(new ConcurrentHashMap<>()); headers.setSubscriptionId("subs1"); headers.setDestination("/foo"); Message<?> message = MessageBuilder.withPayload(new byte[0]).setHeaders(headers).build(); messageHandler.handleMessage(message); message = channel.messages.get(0); headers = StompHeaderAccessor.wrap(message); assertEquals(SimpMessageType.MESSAGE, headers.getMessageType()); assertEquals("/foo", headers.getDestination()); assertEquals("bar", new String((byte[]) message.getPayload())); }
Example #11
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void brokerChannelUsedByAnnotatedMethod() { TestChannel channel = this.simpleBrokerContext.getBean("brokerChannel", TestChannel.class); SimpAnnotationMethodMessageHandler messageHandler = this.simpleBrokerContext.getBean(SimpAnnotationMethodMessageHandler.class); StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.SEND); headers.setSessionId("sess1"); headers.setSessionAttributes(new ConcurrentHashMap<>()); headers.setDestination("/foo"); Message<?> message = MessageBuilder.createMessage(new byte[0], headers.getMessageHeaders()); messageHandler.handleMessage(message); message = channel.messages.get(0); headers = StompHeaderAccessor.wrap(message); assertEquals(SimpMessageType.MESSAGE, headers.getMessageType()); assertEquals("/bar", headers.getDestination()); assertEquals("bar", new String((byte[]) message.getPayload())); }
Example #12
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void customPathMatcher() { ApplicationContext context = loadConfig(CustomConfig.class); SimpleBrokerMessageHandler broker = context.getBean(SimpleBrokerMessageHandler.class); DefaultSubscriptionRegistry registry = (DefaultSubscriptionRegistry) broker.getSubscriptionRegistry(); assertEquals("a.a", registry.getPathMatcher().combine("a", "a")); PathMatcher pathMatcher = context.getBean(SimpAnnotationMethodMessageHandler.class).getPathMatcher(); assertEquals("a.a", pathMatcher.combine("a", "a")); DefaultUserDestinationResolver resolver = context.getBean(DefaultUserDestinationResolver.class); assertNotNull(resolver); assertEquals(false, resolver.isRemoveLeadingSlash()); }
Example #13
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void brokerChannelUsedByAnnotatedMethod() { ApplicationContext context = loadConfig(SimpleBrokerConfig.class); TestChannel channel = context.getBean("brokerChannel", TestChannel.class); SimpAnnotationMethodMessageHandler messageHandler = context.getBean(SimpAnnotationMethodMessageHandler.class); StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.SEND); headers.setSessionId("sess1"); headers.setSessionAttributes(new ConcurrentHashMap<>()); headers.setDestination("/foo"); Message<?> message = MessageBuilder.createMessage(new byte[0], headers.getMessageHeaders()); messageHandler.handleMessage(message); message = channel.messages.get(0); headers = StompHeaderAccessor.wrap(message); assertEquals(SimpMessageType.MESSAGE, headers.getMessageType()); assertEquals("/bar", headers.getDestination()); assertEquals("bar", new String((byte[]) message.getPayload())); }
Example #14
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void clientOutboundChannelUsedByAnnotatedMethod() { ApplicationContext context = loadConfig(SimpleBrokerConfig.class); TestChannel channel = context.getBean("clientOutboundChannel", TestChannel.class); SimpAnnotationMethodMessageHandler messageHandler = context.getBean(SimpAnnotationMethodMessageHandler.class); StompHeaderAccessor headers = StompHeaderAccessor.create(StompCommand.SUBSCRIBE); headers.setSessionId("sess1"); headers.setSessionAttributes(new ConcurrentHashMap<>()); headers.setSubscriptionId("subs1"); headers.setDestination("/foo"); Message<?> message = MessageBuilder.withPayload(new byte[0]).setHeaders(headers).build(); messageHandler.handleMessage(message); message = channel.messages.get(0); headers = StompHeaderAccessor.wrap(message); assertEquals(SimpMessageType.MESSAGE, headers.getMessageType()); assertEquals("/foo", headers.getDestination()); assertEquals("bar", new String((byte[]) message.getPayload())); }
Example #15
Source File: MessageBrokerBeanDefinitionParserTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void customChannels() { loadBeanDefinitions("websocket-config-broker-customchannels.xml"); List<Class<? extends MessageHandler>> subscriberTypes = Arrays.<Class<? extends MessageHandler>>asList(SimpAnnotationMethodMessageHandler.class, UserDestinationMessageHandler.class, SimpleBrokerMessageHandler.class); testChannel("clientInboundChannel", subscriberTypes, 3); testExecutor("clientInboundChannel", 100, 200, 600); subscriberTypes = Collections.singletonList(SubProtocolWebSocketHandler.class); testChannel("clientOutboundChannel", subscriberTypes, 3); testExecutor("clientOutboundChannel", 101, 201, 601); subscriberTypes = Arrays.<Class<? extends MessageHandler>>asList(SimpleBrokerMessageHandler.class, UserDestinationMessageHandler.class); testChannel("brokerChannel", subscriberTypes, 1); testExecutor("brokerChannel", 102, 202, 602); }
Example #16
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void clientInboundChannelWithBrokerRelay() { TestChannel channel = this.brokerRelayContext.getBean("clientInboundChannel", TestChannel.class); Set<MessageHandler> handlers = channel.getSubscribers(); assertEquals(3, handlers.size()); assertTrue(handlers.contains(brokerRelayContext.getBean(SimpAnnotationMethodMessageHandler.class))); assertTrue(handlers.contains(brokerRelayContext.getBean(UserDestinationMessageHandler.class))); assertTrue(handlers.contains(brokerRelayContext.getBean(StompBrokerRelayMessageHandler.class))); }
Example #17
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void customArgumentAndReturnValueTypes() throws Exception { SimpAnnotationMethodMessageHandler handler = this.customContext.getBean(SimpAnnotationMethodMessageHandler.class); List<HandlerMethodArgumentResolver> customResolvers = handler.getCustomArgumentResolvers(); assertEquals(1, customResolvers.size()); assertTrue(handler.getArgumentResolvers().contains(customResolvers.get(0))); List<HandlerMethodReturnValueHandler> customHandlers = handler.getCustomReturnValueHandlers(); assertEquals(1, customHandlers.size()); assertTrue(handler.getReturnValueHandlers().contains(customHandlers.get(0))); }
Example #18
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void clientInboundChannel() { TestChannel channel = this.simpleBrokerContext.getBean("clientInboundChannel", TestChannel.class); Set<MessageHandler> handlers = channel.getSubscribers(); assertEquals(3, handlers.size()); assertTrue(handlers.contains(simpleBrokerContext.getBean(SimpAnnotationMethodMessageHandler.class))); assertTrue(handlers.contains(simpleBrokerContext.getBean(UserDestinationMessageHandler.class))); assertTrue(handlers.contains(simpleBrokerContext.getBean(SimpleBrokerMessageHandler.class))); }
Example #19
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void simpValidatorInjected() { SimpAnnotationMethodMessageHandler messageHandler = this.simpleBrokerContext.getBean(SimpAnnotationMethodMessageHandler.class); assertThat(messageHandler.getValidator(), Matchers.notNullValue(Validator.class)); }
Example #20
Source File: MessageBrokerConfigurationTests.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Test public void customPathMatcher() { SimpleBrokerMessageHandler broker = this.customContext.getBean(SimpleBrokerMessageHandler.class); DefaultSubscriptionRegistry registry = (DefaultSubscriptionRegistry) broker.getSubscriptionRegistry(); assertEquals("a.a", registry.getPathMatcher().combine("a", "a")); SimpAnnotationMethodMessageHandler handler = this.customContext.getBean(SimpAnnotationMethodMessageHandler.class); assertEquals("a.a", handler.getPathMatcher().combine("a", "a")); }
Example #21
Source File: MessageBrokerBeanDefinitionParserTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void customChannels() { loadBeanDefinitions("websocket-config-broker-customchannels.xml"); SimpAnnotationMethodMessageHandler annotationMethodMessageHandler = this.appContext.getBean(SimpAnnotationMethodMessageHandler.class); Validator validator = annotationMethodMessageHandler.getValidator(); assertNotNull(validator); assertSame(this.appContext.getBean("myValidator"), validator); assertThat(validator, Matchers.instanceOf(TestValidator.class)); List<Class<? extends MessageHandler>> subscriberTypes = Arrays.asList(SimpAnnotationMethodMessageHandler.class, UserDestinationMessageHandler.class, SimpleBrokerMessageHandler.class); testChannel("clientInboundChannel", subscriberTypes, 3); testExecutor("clientInboundChannel", 100, 200, 600); subscriberTypes = Collections.singletonList(SubProtocolWebSocketHandler.class); testChannel("clientOutboundChannel", subscriberTypes, 3); testExecutor("clientOutboundChannel", 101, 201, 601); subscriberTypes = Arrays.asList(SimpleBrokerMessageHandler.class, UserDestinationMessageHandler.class); testChannel("brokerChannel", subscriberTypes, 1); testExecutor("brokerChannel", 102, 202, 602); }
Example #22
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void customArgumentAndReturnValueTypes() { ApplicationContext context = loadConfig(CustomConfig.class); SimpAnnotationMethodMessageHandler handler = context.getBean(SimpAnnotationMethodMessageHandler.class); List<HandlerMethodArgumentResolver> customResolvers = handler.getCustomArgumentResolvers(); assertEquals(1, customResolvers.size()); assertTrue(handler.getArgumentResolvers().contains(customResolvers.get(0))); List<HandlerMethodReturnValueHandler> customHandlers = handler.getCustomReturnValueHandlers(); assertEquals(1, customHandlers.size()); assertTrue(handler.getReturnValueHandlers().contains(customHandlers.get(0))); }
Example #23
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void clientInboundChannel() { ApplicationContext context = loadConfig(SimpleBrokerConfig.class); TestChannel channel = context.getBean("clientInboundChannel", TestChannel.class); Set<MessageHandler> handlers = channel.getSubscribers(); assertEquals(3, handlers.size()); assertTrue(handlers.contains(context.getBean(SimpAnnotationMethodMessageHandler.class))); assertTrue(handlers.contains(context.getBean(UserDestinationMessageHandler.class))); assertTrue(handlers.contains(context.getBean(SimpleBrokerMessageHandler.class))); }
Example #24
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void simpValidatorInjected() { ApplicationContext context = loadConfig(SimpleBrokerConfig.class); SimpAnnotationMethodMessageHandler messageHandler = context.getBean(SimpAnnotationMethodMessageHandler.class); assertThat(messageHandler.getValidator(), Matchers.notNullValue(Validator.class)); }
Example #25
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void clientInboundChannelWithBrokerRelay() { ApplicationContext context = loadConfig(BrokerRelayConfig.class); TestChannel channel = context.getBean("clientInboundChannel", TestChannel.class); Set<MessageHandler> handlers = channel.getSubscribers(); assertEquals(3, handlers.size()); assertTrue(handlers.contains(context.getBean(SimpAnnotationMethodMessageHandler.class))); assertTrue(handlers.contains(context.getBean(UserDestinationMessageHandler.class))); assertTrue(handlers.contains(context.getBean(StompBrokerRelayMessageHandler.class))); }
Example #26
Source File: MessageBrokerConfigurationTests.java From java-technology-stack with MIT License | 5 votes |
@Test public void clientInboundChannel() { ApplicationContext context = loadConfig(SimpleBrokerConfig.class); TestChannel channel = context.getBean("clientInboundChannel", TestChannel.class); Set<MessageHandler> handlers = channel.getSubscribers(); assertEquals(3, handlers.size()); assertTrue(handlers.contains(context.getBean(SimpAnnotationMethodMessageHandler.class))); assertTrue(handlers.contains(context.getBean(UserDestinationMessageHandler.class))); assertTrue(handlers.contains(context.getBean(SimpleBrokerMessageHandler.class))); }
Example #27
Source File: MessageBrokerBeanDefinitionParserTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void customChannels() { loadBeanDefinitions("websocket-config-broker-customchannels.xml"); SimpAnnotationMethodMessageHandler annotationMethodMessageHandler = this.appContext.getBean(SimpAnnotationMethodMessageHandler.class); Validator validator = annotationMethodMessageHandler.getValidator(); assertNotNull(validator); assertSame(this.appContext.getBean("myValidator"), validator); assertThat(validator, Matchers.instanceOf(TestValidator.class)); List<Class<? extends MessageHandler>> subscriberTypes = Arrays.asList(SimpAnnotationMethodMessageHandler.class, UserDestinationMessageHandler.class, SimpleBrokerMessageHandler.class); testChannel("clientInboundChannel", subscriberTypes, 3); testExecutor("clientInboundChannel", 100, 200, 600); subscriberTypes = Collections.singletonList(SubProtocolWebSocketHandler.class); testChannel("clientOutboundChannel", subscriberTypes, 3); testExecutor("clientOutboundChannel", 101, 201, 601); subscriberTypes = Arrays.asList(SimpleBrokerMessageHandler.class, UserDestinationMessageHandler.class); testChannel("brokerChannel", subscriberTypes, 1); testExecutor("brokerChannel", 102, 202, 602); }
Example #28
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void clientInboundChannelWithBrokerRelay() { ApplicationContext context = loadConfig(BrokerRelayConfig.class); TestChannel channel = context.getBean("clientInboundChannel", TestChannel.class); Set<MessageHandler> handlers = channel.getSubscribers(); assertEquals(3, handlers.size()); assertTrue(handlers.contains(context.getBean(SimpAnnotationMethodMessageHandler.class))); assertTrue(handlers.contains(context.getBean(UserDestinationMessageHandler.class))); assertTrue(handlers.contains(context.getBean(StompBrokerRelayMessageHandler.class))); }
Example #29
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void customArgumentAndReturnValueTypes() { ApplicationContext context = loadConfig(CustomConfig.class); SimpAnnotationMethodMessageHandler handler = context.getBean(SimpAnnotationMethodMessageHandler.class); List<HandlerMethodArgumentResolver> customResolvers = handler.getCustomArgumentResolvers(); assertEquals(1, customResolvers.size()); assertTrue(handler.getArgumentResolvers().contains(customResolvers.get(0))); List<HandlerMethodReturnValueHandler> customHandlers = handler.getCustomReturnValueHandlers(); assertEquals(1, customHandlers.size()); assertTrue(handler.getReturnValueHandlers().contains(customHandlers.get(0))); }
Example #30
Source File: MessageBrokerConfigurationTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void simpValidatorInjected() { ApplicationContext context = loadConfig(SimpleBrokerConfig.class); SimpAnnotationMethodMessageHandler messageHandler = context.getBean(SimpAnnotationMethodMessageHandler.class); assertThat(messageHandler.getValidator(), Matchers.notNullValue(Validator.class)); }