public MessageMatcher<?> build() { if (type == null) { return new SimpDestinationMessageMatcher(pattern, pathMatcher); } else if (SimpMessageType.MESSAGE == type) { return SimpDestinationMessageMatcher.createMessageMatcher(pattern, pathMatcher); } else if (SimpMessageType.SUBSCRIBE == type) { return SimpDestinationMessageMatcher.createSubscribeMatcher(pattern, pathMatcher); } throw new IllegalStateException(type + " is not supported since it does not have a destination"); } }
@Test public void matchesTrueSubscribeType() throws Exception { matcher = SimpDestinationMessageMatcher.createSubscribeMatcher("/match", pathMatcher); messageBuilder.setHeader(SimpMessageHeaderAccessor.DESTINATION_HEADER, "/match"); messageBuilder.setHeader(SimpMessageHeaderAccessor.MESSAGE_TYPE_HEADER, SimpMessageType.SUBSCRIBE); assertThat(matcher.matches(messageBuilder.build())).isTrue(); }
public MessageMatcher<?> build() { if (type == null) { return new SimpDestinationMessageMatcher(pattern, pathMatcher); } else if (SimpMessageType.MESSAGE == type) { return SimpDestinationMessageMatcher.createMessageMatcher(pattern, pathMatcher); } else if (SimpMessageType.SUBSCRIBE == type) { return SimpDestinationMessageMatcher.createSubscribeMatcher(pattern, pathMatcher); } throw new IllegalStateException(type + " is not supported since it does not have a destination"); } }
public MessageMatcher<?> build() { if (type == null) { return new SimpDestinationMessageMatcher(pattern, pathMatcher); } else if (SimpMessageType.MESSAGE == type) { return SimpDestinationMessageMatcher.createMessageMatcher(pattern, pathMatcher); } else if (SimpMessageType.SUBSCRIBE == type) { return SimpDestinationMessageMatcher.createSubscribeMatcher(pattern, pathMatcher); } throw new IllegalStateException(type + " is not supported since it does not have a destination"); } }