Java 类javax.jms.ConnectionMetaData 实例源码

项目:activemq-artemis    文件:JMSXPropertyTest.java   
/**
 * 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);
   }
}
项目:activemq-artemis    文件:ConnectionTest.java   
@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();
}
项目:activemq-artemis    文件:ManifestTest.java   
@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"));
}
项目:mq-visualizer    文件:JmsProviderInfoViewModel.java   
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);
    }
}
项目:qpid-jms    文件:JmsConnectionTest.java   
@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);
}
项目:pooled-jms    文件:JmsPoolJMSContext.java   
@Override
public ConnectionMetaData getMetaData() {
    try {
        return connection.getMetaData();
    } catch (JMSException jmse) {
        throw JMSExceptionSupport.createRuntimeException(jmse);
    }
}
项目:pooled-jms    文件:MockJMSContext.java   
@Override
public ConnectionMetaData getMetaData() {
    try {
        return connection.getMetaData();
    } catch (JMSException jmse) {
        throw JMSExceptionSupport.createRuntimeException(jmse);
    }
}
项目:org.ops4j.pax.transx    文件:JMSContextImpl.java   
@Override
public ConnectionMetaData getMetaData() {
    try {
        return connection.getMetaData();
    } catch (JMSException jmse) {
        throw Utils.convertToRuntimeException(jmse);
    }
}
项目:org.ops4j.pax.transx    文件:ConnectionImpl.java   
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);
    }
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JmsHealthIndicatorTests.java   
@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();
}
项目:https-github.com-g0t4-jenkins2-course-spring-boot    文件:JmsHealthIndicatorTests.java   
@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();
}
项目:spring-boot-concourse    文件:JmsHealthIndicatorTests.java   
@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();
}
项目:spring-boot-concourse    文件:JmsHealthIndicatorTests.java   
@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();
}
项目:contestparser    文件:JmsHealthIndicatorTests.java   
@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();
}
项目:contestparser    文件:JmsHealthIndicatorTests.java   
@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();
}
项目:activemq-artemis    文件:JMSXPropertyTest.java   
/**
 * 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;
}
项目:activemq-artemis    文件:ActiveMQRASessionFactoryImpl.java   
/**
 * 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();
}
项目:activemq-artemis    文件:ActiveMQRAManagedConnectionFactory.java   
/**
 * Get the connection metadata
 *
 * @return The metadata
 */
public ConnectionMetaData getMetaData() {
   if (ActiveMQRAManagedConnectionFactory.trace) {
      ActiveMQRALogger.LOGGER.trace("getMetadata()");
   }

   return new ActiveMQRAConnectionMetaData();
}
项目:activemq-artemis    文件:ActiveMQJMSContext.java   
@Override
public ConnectionMetaData getMetaData() {
   try {
      return connection.getMetaData();
   } catch (JMSException e) {
      throw JmsExceptionUtils.convertToRuntimeException(e);
   }
}
项目:activemq-artemis    文件:ActiveMQConnection.java   
@Override
public ConnectionMetaData getMetaData() throws JMSException {
   checkClosed();

   if (metaData == null) {
      metaData = new ActiveMQConnectionMetaData(thisVersion);
   }

   return metaData;
}
项目:javaee-samples    文件:JMSContextMock.java   
@Override
public ConnectionMetaData getMetaData() {
    try {
        return connection.getMetaData();
    } catch (JMSException e) {
        throw new JMSRuntimeException(e.getLocalizedMessage(), e.getErrorCode(), e);
    }
}
项目:qpid-jms    文件:JmsContext.java   
@Override
public ConnectionMetaData getMetaData() {
    try {
        return connection.getMetaData();
    } catch (JMSException jmse) {
        throw JmsExceptionSupport.createRuntimeException(jmse);
    }
}
项目:tomee    文件:JMSContextImpl.java   
@Override
public ConnectionMetaData getMetaData() {
    try {
        return connection().getMetaData();
    } catch (final JMSException e) {
        throw toRuntimeException(e);
    }
}
项目:org.ops4j.pax.jms    文件:ITestBase.java   
@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());
}
项目:pooled-jms    文件:JmsPoolConnection.java   
@Override
public ConnectionMetaData getMetaData() throws JMSException {
    return getConnection().getMetaData();
}
项目:pooled-jms    文件:MockJMSConnection.java   
@Override
public ConnectionMetaData getMetaData() throws JMSException {
    return MockJMSConnectionMetaData.INSTANCE;
}
项目:testee.fi    文件:TestEEfiConnection.java   
@Override
public ConnectionMetaData getMetaData() throws JMSException {
    return null;
}
项目:spring-cloud-ribbon-extensions    文件:PreservesMessagePropertiesConnectionAdapter.java   
/**
 * {@inheritDoc}
 */
@Override
public ConnectionMetaData getMetaData() throws JMSException {
    return delegate.getMetaData();
}
项目:ats-framework    文件:ManagedConnection.java   
@Override
public ConnectionMetaData getMetaData() throws JMSException {

    return connection.getMetaData();
}
项目:oscm    文件:ConnectionStub.java   
public ConnectionMetaData getMetaData() throws JMSException {
    throw new UnsupportedOperationException();
}
项目:oscm    文件:TestJMSConnection.java   
public ConnectionMetaData getMetaData() throws JMSException {
    throw new UnsupportedOperationException();
}
项目:lemon    文件:ProxyConnection.java   
public ConnectionMetaData getMetaData() throws JMSException {
    return null;
}
项目:org.ops4j.pax.transx    文件:ManagedConnectionImpl.java   
ConnectionMetaData getConnectionMetaData() throws JMSException {
    return connection.getMetaData();
}
项目:spring4-understanding    文件:TestConnection.java   
@Override
public ConnectionMetaData getMetaData() throws JMSException {
    return null;
}
项目:pubsub    文件:PubSubConnection.java   
@Override
public ConnectionMetaData getMetaData() throws JMSException {
  return null;
}
项目:development    文件:ConnectionStub.java   
public ConnectionMetaData getMetaData() throws JMSException {
    throw new UnsupportedOperationException();
}
项目:development    文件:TestJMSConnection.java   
public ConnectionMetaData getMetaData() throws JMSException {
    throw new UnsupportedOperationException();
}
项目:netarchivesuite-svngit-migration    文件:JMSConnectionMockupMQ.java   
public ConnectionMetaData getMetaData() throws JMSException {
    throw new NotImplementedException("Not implemented");
}
项目:class-guard    文件:TestConnection.java   
@Override
public ConnectionMetaData getMetaData() throws JMSException {
    return null;
}