/** * Test that the JMSX property <code>JMSXGroupID</code> is supported. */ @Test public void testSupportsJMSXGroupID() { try { boolean found = false; ConnectionMetaData metaData = senderConnection.getMetaData(); Enumeration enumeration = metaData.getJMSXPropertyNames(); while (enumeration.hasMoreElements()) { String jmsxPropertyName = (String) enumeration.nextElement(); if (jmsxPropertyName.equals("JMSXGroupID")) { found = true; } } Assert.assertTrue("JMSXGroupID property is not supported", found); } catch (JMSException e) { fail(e); } }
@Test public void testGetMetadata() throws Exception { Connection connection = createConnection(); ConnectionMetaData metaData = connection.getMetaData(); // TODO - need to check whether these are same as current version metaData.getJMSMajorVersion(); metaData.getJMSMinorVersion(); metaData.getJMSProviderName(); metaData.getJMSVersion(); metaData.getJMSXPropertyNames(); metaData.getProviderMajorVersion(); metaData.getProviderMinorVersion(); metaData.getProviderVersion(); connection.close(); }
@Test public void testManifestEntries() throws Exception { Properties props = System.getProperties(); String userDir = props.getProperty("build.lib"); UnitTestLogger.LOGGER.trace("userDir is " + userDir); // The jar must be there File file = new File("build/jars", "activemq-core.jar"); Assert.assertTrue(file.exists()); // Open the jar and load MANIFEST.MF JarFile jar = new JarFile(file); Manifest manifest = jar.getManifest(); ActiveMQServer server = ActiveMQServers.newActiveMQServer(createBasicConfig()); ConnectionMetaData meta = new ActiveMQConnectionMetaData(server.getVersion()); // Compare the value from ConnectionMetaData and MANIFEST.MF Attributes attrs = manifest.getMainAttributes(); Assert.assertEquals(meta.getProviderVersion(), attrs.getValue("ActiveMQ-Version")); }
public JmsProviderInfoViewModel(ConnectionMetaData connectionMetaData) { try { jmsVersion = new SimpleStringProperty(connectionMetaData.getJMSVersion()); jmsProviderName = new SimpleStringProperty(connectionMetaData.getJMSProviderName()); jmsProviderVersion = new SimpleStringProperty(connectionMetaData.getProviderVersion()); jmsxPropertyNames = FXCollections.observableList(new LinkedList<>()); Enumeration enumeration = connectionMetaData.getJMSXPropertyNames(); while (enumeration.hasMoreElements()) { jmsxPropertyNames.add((String) enumeration.nextElement()); } } catch (JMSException e) { throw new RuntimeException(e); } }
@Test(timeout=30000) public void testConnectionMetaData() throws Exception { connection = new JmsConnection(connectionInfo, provider); ConnectionMetaData metaData = connection.getMetaData(); assertNotNull(metaData); assertEquals(2, metaData.getJMSMajorVersion()); assertEquals(0, metaData.getJMSMinorVersion()); assertEquals("2.0", metaData.getJMSVersion()); assertNotNull(metaData.getJMSXPropertyNames()); assertNotNull(metaData.getProviderVersion()); assertNotNull(metaData.getJMSProviderName()); int major = metaData.getProviderMajorVersion(); int minor = metaData.getProviderMinorVersion(); assertTrue("Expected non-zero provider major(" + major + ") / minor(" + minor +") version.", (major + minor) != 0); }
@Override public ConnectionMetaData getMetaData() { try { return connection.getMetaData(); } catch (JMSException jmse) { throw JMSExceptionSupport.createRuntimeException(jmse); } }
@Override public ConnectionMetaData getMetaData() { try { return connection.getMetaData(); } catch (JMSException jmse) { throw Utils.convertToRuntimeException(jmse); } }
public ConnectionMetaData getMetaData() throws JMSException { ConnectionRequestInfoImpl cri = new ConnectionRequestInfoImpl(false, Session.AUTO_ACKNOWLEDGE, userName, password, clientID); try (SessionImpl session = (SessionImpl) cm.allocateConnection(mcf, cri)) { session.setConnection(this); return session.getManagedConnection().getConnectionMetaData(); } catch (ResourceException e) { throw (JMSException) new JMSException("Unable to retrieve metadata").initCause(e); } }
@Test public void jmsBrokerIsUp() throws JMSException { ConnectionMetaData connectionMetaData = mock(ConnectionMetaData.class); given(connectionMetaData.getJMSProviderName()).willReturn("JMS test provider"); Connection connection = mock(Connection.class); given(connection.getMetaData()).willReturn(connectionMetaData); ConnectionFactory connectionFactory = mock(ConnectionFactory.class); given(connectionFactory.createConnection()).willReturn(connection); JmsHealthIndicator indicator = new JmsHealthIndicator(connectionFactory); Health health = indicator.health(); assertThat(health.getStatus()).isEqualTo(Status.UP); assertThat(health.getDetails().get("provider")).isEqualTo("JMS test provider"); verify(connection, times(1)).close(); }
@Test public void jmsBrokerCouldNotRetrieveProviderMetadata() throws JMSException { ConnectionMetaData connectionMetaData = mock(ConnectionMetaData.class); given(connectionMetaData.getJMSProviderName()) .willThrow(new JMSException("test", "123")); Connection connection = mock(Connection.class); given(connection.getMetaData()).willReturn(connectionMetaData); ConnectionFactory connectionFactory = mock(ConnectionFactory.class); given(connectionFactory.createConnection()).willReturn(connection); JmsHealthIndicator indicator = new JmsHealthIndicator(connectionFactory); Health health = indicator.health(); assertThat(health.getStatus()).isEqualTo(Status.DOWN); assertThat(health.getDetails().get("provider")).isNull(); verify(connection, times(1)).close(); }
@Test public void jmsBrokerIsUp() throws JMSException { ConnectionMetaData connectionMetaData = mock(ConnectionMetaData.class); given(connectionMetaData.getJMSProviderName()).willReturn("JMS test provider"); Connection connection = mock(Connection.class); given(connection.getMetaData()).willReturn(connectionMetaData); ConnectionFactory connectionFactory = mock(ConnectionFactory.class); given(connectionFactory.createConnection()).willReturn(connection); JmsHealthIndicator indicator = new JmsHealthIndicator(connectionFactory); Health health = indicator.health(); assertEquals(Status.UP, health.getStatus()); assertEquals("JMS test provider", health.getDetails().get("provider")); verify(connection, times(1)).close(); }
@Test public void jmsBrokerCouldNotRetrieveProviderMetadata() throws JMSException { ConnectionMetaData connectionMetaData = mock(ConnectionMetaData.class); given(connectionMetaData.getJMSProviderName()) .willThrow(new JMSException("test", "123")); Connection connection = mock(Connection.class); given(connection.getMetaData()).willReturn(connectionMetaData); ConnectionFactory connectionFactory = mock(ConnectionFactory.class); given(connectionFactory.createConnection()).willReturn(connection); JmsHealthIndicator indicator = new JmsHealthIndicator(connectionFactory); Health health = indicator.health(); assertEquals(Status.DOWN, health.getStatus()); assertEquals(null, health.getDetails().get("provider")); verify(connection, times(1)).close(); }
/** * checks if the JMSX property <code>JMSXDeliveryCount</code> is supported. */ private boolean supportsJMSXDeliveryCount() throws Exception { ConnectionMetaData metaData = senderConnection.getMetaData(); Enumeration enumeration = metaData.getJMSXPropertyNames(); while (enumeration.hasMoreElements()) { String jmsxPropertyName = (String) enumeration.nextElement(); if (jmsxPropertyName.equals("JMSXDeliveryCount")) { return true; } } return false; }
/** * Get the connection metadata * * @return The connection metadata * @throws JMSException Thrown if an error occurs */ @Override public ConnectionMetaData getMetaData() throws JMSException { if (ActiveMQRASessionFactoryImpl.trace) { ActiveMQRALogger.LOGGER.trace("getMetaData()"); } checkClosed(); return mcf.getMetaData(); }
/** * Get the connection metadata * * @return The metadata */ public ConnectionMetaData getMetaData() { if (ActiveMQRAManagedConnectionFactory.trace) { ActiveMQRALogger.LOGGER.trace("getMetadata()"); } return new ActiveMQRAConnectionMetaData(); }
@Override public ConnectionMetaData getMetaData() { try { return connection.getMetaData(); } catch (JMSException e) { throw JmsExceptionUtils.convertToRuntimeException(e); } }
@Override public ConnectionMetaData getMetaData() throws JMSException { checkClosed(); if (metaData == null) { metaData = new ActiveMQConnectionMetaData(thisVersion); } return metaData; }
@Override public ConnectionMetaData getMetaData() { try { return connection.getMetaData(); } catch (JMSException e) { throw new JMSRuntimeException(e.getLocalizedMessage(), e.getErrorCode(), e); } }
@Override public ConnectionMetaData getMetaData() { try { return connection.getMetaData(); } catch (JMSException jmse) { throw JmsExceptionSupport.createRuntimeException(jmse); } }
@Override public ConnectionMetaData getMetaData() { try { return connection().getMetaData(); } catch (final JMSException e) { throw toRuntimeException(e); } }
@Before public void showMetaInfo() throws JMSException { ConnectionMetaData metaData = connection.getMetaData(); LOG.debug("Provider: {}", metaData.getJMSProviderName()); LOG.debug("JMS Version: {}", metaData.getJMSVersion()); LOG.debug("Client ID: {}", connection.getClientID()); LOG.debug("ExceptionListener: {}", connection.getExceptionListener()); }
@Override public ConnectionMetaData getMetaData() throws JMSException { return getConnection().getMetaData(); }
@Override public ConnectionMetaData getMetaData() throws JMSException { return MockJMSConnectionMetaData.INSTANCE; }
@Override public ConnectionMetaData getMetaData() throws JMSException { return null; }
/** * {@inheritDoc} */ @Override public ConnectionMetaData getMetaData() throws JMSException { return delegate.getMetaData(); }
@Override public ConnectionMetaData getMetaData() throws JMSException { return connection.getMetaData(); }
public ConnectionMetaData getMetaData() throws JMSException { throw new UnsupportedOperationException(); }
public ConnectionMetaData getMetaData() throws JMSException { return null; }
ConnectionMetaData getConnectionMetaData() throws JMSException { return connection.getMetaData(); }
public ConnectionMetaData getMetaData() throws JMSException { throw new NotImplementedException("Not implemented"); }