Exemplo n.º 1
0
        public void ConnectTest()
        {
            Sequoiadb sdb2 = new Sequoiadb(config.conf.Coord.Address);

            System.Console.WriteLine(config.conf.Coord.Address.ToString());
            // check whether it is in the cluster environment or not
            if (!Constants.isClusterEnv(sdb))
            {
                System.Console.WriteLine("ConnectWithAuth is for cluster environment only.");
                return;
            }
            sdb.CreateUser("testusr", "testpwd");
            sdb2.Connect("testusr", "testpwd");
            Assert.IsNotNull(sdb.Connection);
            sdb2.RemoveUser("testusr", "testpwd");
            sdb2.Disconnect();
            Assert.IsNull(sdb2.Connection);
            try
            {
                sdb2.Connect("testusr", "testpwd");
            }
            catch (BaseException e)
            {
                Assert.IsTrue(e.ErrorType == "SDB_AUTH_AUTHORITY_FORBIDDEN");
            }
        }