Package org.apache.qpid.client

Examples of org.apache.qpid.client.AMQConnectionFactory


    /**
     * Create a BDBStoreUpgradeTestPreparer instance
     */
    public BDBStoreUpgradeTestPreparer () throws URLSyntaxException
    {
        _connFac = new AMQConnectionFactory(CONN_URL);
    }
View Full Code Here


        result.setSuccessful(false);
        result.setResponseMessage("Binding URL cannot be empty.");
        result.setResponseCode("0xDEAD");
      }else{
        try{
          ConnectionFactory connectionFactory = new AMQConnectionFactory(connectionUrl);
          AMQBindingURL burl = new AMQBindingURL(bindingUrl);
         
          Destination destinationProducer = new AMQAnyDestination(burl);
          JmsTemplate sender = new JmsTemplate();
          sender.setConnectionFactory(connectionFactory);
View Full Code Here

     */
    protected ConnectionFactory createFactory(String url)
    {
        try
        {
            return new AMQConnectionFactory(url);
        }
        catch (URLSyntaxException urlse)
        {
            _logger.warn("Unable to createFactories:" + urlse);
        }
View Full Code Here

    public static final String URL = "amqp://guest:guest@clientID/test?brokerlist='tcp://localhost:5672'";
    public static final String URL_STAR_PWD = "amqp://guest:********@clientID/test?brokerlist='tcp://localhost:5672'";

    public void testConnectionURLString()
    {
        AMQConnectionFactory factory = new AMQConnectionFactory();

        assertNull("ConnectionURL should have no value at start",
                   factory.getConnectionURL());

        try
        {
            factory.setConnectionURLString(URL);
        }
        catch (URLSyntaxException e)
        {
            fail(e.getMessage());
        }

        //URL will be returned with the password field swapped for '********'
        assertEquals("Connection URL not correctly set", URL_STAR_PWD, factory.getConnectionURLString());

        // Further test that the processed ConnectionURL is as expected after
        // the set call
        ConnectionURL connectionurl = factory.getConnectionURL();

        assertNull("Failover is set.", connectionurl.getFailoverMethod());
        assertEquals("guest", connectionurl.getUsername());
        assertEquals("guest", connectionurl.getPassword());
        assertEquals("clientID", connectionurl.getClientName());
View Full Code Here

        return getConnection("guest", "guest");
    }

    public Connection getConnection(ConnectionURL url) throws JMSException
    {
        Connection connection = new AMQConnectionFactory(url).createConnection("guest", "guest");

        _connections.add(connection);

        return connection;
    }
View Full Code Here

     */
    protected ConnectionFactory createFactory(String url)
    {
        try
        {
            return new AMQConnectionFactory(url);
        }
        catch (URLSyntaxException urlse)
        {
            _logger.warn("Unable to createFactories:" + urlse);
        }
View Full Code Here

    /**
     * Create a BDBStoreUpgradeTestPreparer instance
     */
    public BDBStoreUpgradeTestPreparer () throws URLSyntaxException
    {
        _connFac = new AMQConnectionFactory(CONN_URL);
    }
View Full Code Here

      final Integer port = (overridePort != null ? overridePort : _raProperties.getPort()) ;

      final String overridePath = overrideProperties.getPath() ;
      final String path = (overridePath != null ? overridePath : _raProperties.getPath()) ;

      final AMQConnectionFactory cf ;

      if (url != null)
      {
         cf = new AMQConnectionFactory(url) ;

         if (clientID != null)
         {
            cf.getConnectionURL().setClientName(clientID) ;
         }
      }
      else
      {
         // create a URL to force the connection details
         if ((host == null) || (port == null) || (path == null))
         {
            throw new QpidRAException("Configuration requires host/port/path if connectionURL is not specified") ;
         }
         final String username = (defaultUsername != null ? defaultUsername : "") ;
         final String password = (defaultPassword != null ? defaultPassword : "") ;
         final String client = (clientID != null ? clientID : "") ;

         final String newurl = AMQConnectionURL.AMQ_PROTOCOL + "://" + username +":" + password + "@" + client + "/" + path + '?' + AMQConnectionURL.OPTIONS_BROKERLIST + "='tcp://" + host + ':' + port + '\'' ;
         if (_log.isDebugEnabled())
         {
            _log.debug("Initialising connectionURL to " + newurl) ;
         }

         cf = new AMQConnectionFactory(newurl) ;
      }

      return cf ;
   }
View Full Code Here

    @Override
    public Reference getReference() throws NamingException
    {
        try
        {
            _delegate = new AMQConnectionFactory(getConnectionURL());
            /*
            QpidResourceAdapter ra = new QpidResourceAdapter();
            QpidRAManagedConnectionFactory mcf = new QpidRAManagedConnectionFactory();
            mcf.setResourceAdapter(ra);
            mcf.setConnectionURL(getConnectionURL());
View Full Code Here

    public static final String URL = "amqp://guest:guest@clientID/test?brokerlist='tcp://localhost:5672'";
    public static final String URL_STAR_PWD = "amqp://guest:********@clientID/test?brokerlist='tcp://localhost:5672'";

    public void testConnectionURLStringMasksPassword() throws Exception
    {
        AMQConnectionFactory factory = new AMQConnectionFactory(URL);

        //URL will be returned with the password field swapped for '********'
        assertEquals("Connection URL not correctly set", URL_STAR_PWD, factory.getConnectionURLString());

        // Further test that the processed ConnectionURL is as expected after
        // the set call
        ConnectionURL connectionurl = factory.getConnectionURL();

        assertNull("Failover is set.", connectionurl.getFailoverMethod());
        assertEquals("guest", connectionurl.getUsername());
        assertEquals("guest", connectionurl.getPassword());
        assertEquals("clientID", connectionurl.getClientName());
View Full Code Here

TOP

Related Classes of org.apache.qpid.client.AMQConnectionFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.