import static org.junit.Assert.assertTrue;

import java.sql.Connection;
import java.sql.SQLException;
import java.util.Properties;

import org.junit.Test;

public class TestClientInfo {
    @Test
    public void testGetClientInfoProperties() {
        Connection conn = null;
        try {
            System.out.println("Connecting to database...");
            conn = Utils.getUserConnection();
            Properties clientInfo = conn.getClientInfo();
            assertTrue("this is not set clientInfo Properties", clientInfo.equals(new Properties()));
            System.out.println(clientInfo);
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }

    @Test
    public void testSetAndGetClientInfoProperties() {
        Connection conn = null;
        try {
            System.out.println("Connecting to database...");
            conn = Utils.getUserConnection();
            Properties prop = new Properties();
            prop.setProperty("user1", "user1");
            prop.setProperty("user2", "user2");
            conn.setClientInfo(prop);
            Properties prop1 = conn.getClientInfo();
            assertTrue("this is set and get  ClientInfoProperties", prop1.equals(prop));
            System.out.println(prop1.equals(prop));
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    @Test
    public void testSetAndGetClientInfoByName() {
        Connection conn = null;
        try {
            System.out.println("Connecting to database...");
            conn = Utils.getUserConnection();
            conn.setClientInfo("user1", "user1");
            String user1 = conn.getClientInfo("user1");
            System.out.println(user1);
            assertTrue("this is set clientInfo by Name ", user1.equals("user1"));
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
    @Test
    public void testSetAndGetClientInfoByName1() {
        Connection conn = null;
        try {
            System.out.println("Connecting to database...");
            conn = Utils.getUserConnection();
            Properties prop = new Properties();
            prop.setProperty("user2", "user2");
            conn.setClientInfo(prop);
            conn.setClientInfo("user1", "user1");
            String user1 = conn.getClientInfo("user1");
            String user2 = conn.getClientInfo("user2");
            String user3 = conn.getClientInfo("user3");
            System.out.println(user1);
            System.out.println(user2);
            System.out.println(user3);
           // assertTrue("this is get clientInfo by Name", user1.equals("user1"));
           // assertTrue("this is get clientInfo by Name", user2.equals("user2"));
            assertTrue("this is get clientInfo by Name", user3==(null));
        } catch (SQLException e) {
            e.printStackTrace();
        }
    }
}

@@ -1,12 +1,878 @@
+/*%0A/* @@@ START COPYRIGHT @@@%0A/*%0A/*%0ALicensed to the Apache Software Foundation (ASF) under one%0A/*%0Aor more contributor license agreements.  See the NOTICE file%0A/*%0Adistributed with this work for additional information%0A/*%0Aregarding copyright ownership.  The ASF licenses this file%0A/*%0Ato you under the Apache License, Version 2.0 (the%0A/*%0A%22License%22); you may not use this file except in compliance%0A/*%0Awith the License.  You may obtain a copy of the License at%0A/*%0A/*%0A  http://www.apache.org/licenses/LICENSE-2.0%0A/*%0A/*%0AUnless required by applicable law or agreed to in writing,%0A/*%0Asoftware distributed under the License is distributed on an%0A/*%0A%22AS IS%22 BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY%0A/*%0AKIND, either express or implied.  See the License for the%0A/*%0Aspecific language governing permissions and limitations%0A/*%0Aunder the License.%0A/*%0A/* @@@ END COPYRIGHT @@@%0A/*/%0A
 import stati

add copyright