/*
 * Copyright (c) 2007-2014, Kaazing Corporation. All rights reserved.
 */
package org.kaazing.qpid.amqp_1_0.jms;

import javax.jms.Connection;
import javax.jms.ConnectionFactory;

import org.apache.qpid.amqp_1_0.jms.impl.ConnectionFactoryImpl;
import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.kaazing.robot.junit.annotation.Robotic;
import org.kaazing.robot.junit.rules.RobotRule;

public class ConnectionIT {

    @Rule
    public RobotRule robot = new RobotRule().setScriptRoot("org/kaazing/robot/scripts/amqp_1_0/jms/connection");

    @Robotic(script = "start.then.close")
    @Test(timeout = 1000)
    public void shouldConnect() throws Exception {
        ConnectionFactory factory = new ConnectionFactoryImpl("localhost", 5672, null, null, "clientID");
        Connection connection = factory.createConnection();
        connection.start();
        connection.close();
        robot.join();
    }

    @Ignore("check if QPID JMS supports this yet")
    @Robotic(script = "start.with.credentials")
    @Test(timeout = 1000)
    public void shouldConnectWithCredentials() throws Exception {
        ConnectionFactory factory = new ConnectionFactoryImpl("localhost", 5672, null, null, "clientID");
        Connection connection = factory.createConnection("username", "password");
        connection.start();
        robot.join();
    }

}

@@ -587,21 +587,22 @@
 ript = %22
-start
+create
 .then.cl
@@ -656,22 +656,379 @@
  shouldC
-onnect
+reateThenClose() throws Exception %7B%0A        ConnectionFactory factory = new ConnectionFactoryImpl(%22localhost%22, 5672, null, null, %22clientID%22);%0A        Connection connection = factory.createConnection();%0A        connection.close();%0A        robot.join();%0A    %7D%0A%0A    @Robotic(script = %22start.then.close%22)%0A    @Test(timeout = 1000)%0A    public void shouldStartThenClose
 () throw
@@ -1388,16 +1388,27 @@
 dentials
+.then.close
 %22)%0A    @
@@ -1450,22 +1450,20 @@
 d should
-Connec
+Star
 tWithCre
@@ -1470,16 +1470,25 @@
 dentials
+ThenClose
 () throw

Add test for connection without start before close.