示例#1
0
文件: FaultTest.java 项目: ncdc/qpid
 public void tearDown() throws Exception {
   if (!isBroker08()) {
     _xaqueueConnection.close();
     _queueConnection.close();
   }
   super.tearDown();
 }
示例#2
0
文件: FaultTest.java 项目: ncdc/qpid
 /** Initialize standard actors */
 public void init() throws Exception {
   if (!isBroker08()) {
     _queue = (Queue) getInitialContext().lookup(QUEUENAME);
     _queueFactory = getConnectionFactory();
     _xaqueueConnection = _queueFactory.createXAQueueConnection("guest", "guest");
     XAQueueSession session = _xaqueueConnection.createXAQueueSession();
     _queueConnection = _queueFactory.createQueueConnection("guest", "guest");
     _nonXASession = _queueConnection.createQueueSession(true, Session.AUTO_ACKNOWLEDGE);
     init(session, _queue);
   }
 }
示例#3
0
  public static XAQueueConnection getXAQueueConnection(Properties props)
      throws IOException, NamingException, JMSException {
    String cnnFactoryName = props.getProperty(JNDI_XAQUEUE_CONECTION_NAME_PROPERTY);
    if (cnnFactoryName == null) {
      throw new IOException(
          "You must set the property "
              + JNDI_XAQUEUE_CONECTION_NAME_PROPERTY
              + "in the JNDI property file");
    }
    Context ctx = new InitialContext(props);
    XAQueueConnectionFactory qcf = (XAQueueConnectionFactory) lookupObject(ctx, cnnFactoryName);
    XAQueueConnection cnn;
    String username = (String) props.get("username");

    if (username != null) {
      String password = (String) props.get("password");
      cnn = qcf.createXAQueueConnection(username, password);
    } else {
      cnn = qcf.createXAQueueConnection();
    }
    cnn.start();
    return cnn;
  }