@Test public void testStart() throws JMSException, EtiqetException { SolXAConnectionFactory connectionFactory = mock(SolXAConnectionFactory.class); Connection connection = mock(Connection.class); Session session = mock(Session.class); when(connection.createSession(anyBoolean(), anyInt())).thenReturn(session); when(connectionFactory.createConnection()).thenReturn(connection); transport.setConnectionFactory(connectionFactory); assertNull(transport.getConnection()); assertFalse(transport.isLoggedOn()); assertNull(transport.getSession()); transport.start(); assertEquals(connectionFactory, transport.getConnectionFactory()); assertEquals(connection, transport.getConnection()); assertTrue(transport.isLoggedOn()); assertEquals(session, transport.getSession()); verify(connectionFactory, times(1)).createConnection(); verify(connection, times(1)).start(); verify(connection, times(1)).createSession(eq(true), eq(Session.AUTO_ACKNOWLEDGE)); verifyNoMoreInteractions(connectionFactory, connection); }
@Override public void start() throws EtiqetException { try { connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); } catch (JMSException e) { throw new EtiqetException("Couldn't create Solace connection", e); } }
SolaceTransport implements Transport { @Override public void start() throws EtiqetException { try { connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); } catch (JMSException e) { throw new EtiqetException("Couldn't create Solace connection", e); } } }
SolaceTransport implements Transport { @Override public void start() throws EtiqetException { try { connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); } catch (JMSException e) { throw new EtiqetException("Couldn't create Solace connection", e); } }  }
SolaceTransport implements Transport { @Override public void start() throws EtiqetException { try { connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); } catch (JMSException e) { throw new EtiqetException("Couldn't create Solace connection", e); } }  @Override void init(String configPath); @Override void start(); @Override void stop(); @Override void send(Cdr msg); @Override void send(Cdr msg, String topicName); @Override boolean isLoggedOn(); @Override String getDefaultSessionId(); @Override void setTransportDelegate(TransportDelegate<String, Cdr> transDel); @Override @SuppressWarnings("unchecked") void setCodec(Codec c); @Override Codec getCodec(); @Override void setDelegate(ClientDelegate delegate); @Override ClientDelegate getDelegate(); }
SolaceTransport implements Transport { @Override public void start() throws EtiqetException { try { connection = connectionFactory.createConnection(); connection.start(); session = connection.createSession(true, Session.AUTO_ACKNOWLEDGE); } catch (JMSException e) { throw new EtiqetException("Couldn't create Solace connection", e); } }  @Override void init(String configPath); @Override void start(); @Override void stop(); @Override void send(Cdr msg); @Override void send(Cdr msg, String topicName); @Override boolean isLoggedOn(); @Override String getDefaultSessionId(); @Override void setTransportDelegate(TransportDelegate<String, Cdr> transDel); @Override @SuppressWarnings("unchecked") void setCodec(Codec c); @Override Codec getCodec(); @Override void setDelegate(ClientDelegate delegate); @Override ClientDelegate getDelegate();  }