@Before public void setUp() { // Set up connection to the broker try { Map<String, Object> connectionParams = new HashMap<String, Object>(); connectionParams.put( org.hornetq.integration.transports.netty.TransportConstants.HOST_PROP_NAME, "localhost"); connectionParams.put( org.hornetq.integration.transports.netty.TransportConstants.PORT_PROP_NAME, 5445); TransportConfiguration transport = new TransportConfiguration(NettyConnectorFactory.class.getName(), connectionParams); hornetQConnectionFactory = new HornetQConnectionFactory(false, transport); connection = hornetQConnectionFactory.createConnection(); connection.start(); session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE); } catch (Exception e) { e.printStackTrace(); } }
@Override public void resetCounters() { super.resetCounters(); for (String key : selectorCounts.keySet()) { selectorCounts.put(key, new AtomicInteger(0)); } }
@Test public void shouldSetHeaderOnlyMapPropertyAnnotation() throws Exception { String xml = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n" + "<testMethodHeaderOnly>\n" // + " <arg0>foo</arg0>\n" // + "</testMethodHeaderOnly>\n"; when(message.getText()).thenReturn(xml); when(message.getPropertyNames()).thenReturn(new StringTokenizer("arg1[A] arg1[B] arg1[C]")); when(message.getStringProperty("arg1[A]")).thenReturn("one"); when(message.getStringProperty("arg1[B]")).thenReturn("two"); when(message.getStringProperty("arg1[C]")).thenReturn("three"); XmlMessageDecoder<TestInterfaceHeaderOnlyMap> decoder = XmlMessageDecoder.of(TestInterfaceHeaderOnlyMap.class, implMap); decoder.onMessage(message); Map<String, String> map = new HashMap<String, String>(); map.put("A", "one"); map.put("B", "two"); map.put("C", "three"); verify(implMap).testMethodHeaderOnly("foo", map); }
public void addMessageProperty(String value) { if (!this.selectors.contains(value)) { selectors.add(value); selectorCounts.put(value, new AtomicInteger(0)); } }