Inheritance: IDisposable
Exemplo n.º 1
0
        public static void DropTestDatabase()
        {
            var retry = 2;
            do
            {
                try
                {
                    if (_server.DatabaseExist(GlobalTestDatabaseName, GlobalTestDatabaseStorageType))
                    {
                        _server.DropDatabase(GlobalTestDatabaseName, GlobalTestDatabaseStorageType);
                    }
                    break;
                }
                catch
                {
                    _server.Dispose();
                    _server = new OServer(_hostname, _port, _rootUserName, _rootUserParssword);
                }
                Thread.Sleep(100);
            }
            while (--retry > 0);

            if (_server.DatabaseExist(GlobalTestDatabaseName, GlobalTestDatabaseStorageType))
                Assert.True(false, "Cannot drop test database.");
        }
Exemplo n.º 2
0
        static TestConnection()
        {
            _server = new OServer(_hostname, _port, _rootUserName, _rootUserParssword);

            GlobalTestDatabaseName = "globalTestDatabaseForNetDriver001";
            GlobalTestDatabaseType = ODatabaseType.Graph;
            GlobalTestDatabaseAlias = "globalTestDatabaseForNetDriver001Alias";
        }
Exemplo n.º 3
0
        static void CreateDatabaseTestManualy()
        {
            using (var server = new OServer("127.0.0.1", 2424, "root", "root"))
            {
                var created = false;
                try
                {
                    created = server.CreateDatabase("TestManualy", ODatabaseType.Document, OStorageType.PLocal);

                    if (!created)
                        throw new Exception("Database not created");

                    var exists = server.DatabaseExist("TestManualy", OStorageType.PLocal);

                    if (!exists)
                        throw new Exception("Database not exists");

                    System.Console.WriteLine("Database created - get server configuration");

                    var config = server.ConfigList();
                    foreach (var item in config)
                    {
                        System.Console.WriteLine("{0} : {1}",
                            item.Key, item.Value);
                    }

                    System.Console.WriteLine("try connect to the database and query");

                    OClient.CreateDatabasePool(
                            "localhost",
                            2424,
                            "TestManualy",
                            ODatabaseType.Graph,
                            "root",
                            "root",
                            10,
                            "AppConnection"
                        );
                    using (var database = new ODatabase("AppConnection"))
                    {
                        var documents = database.Query("select from OUser");
                        foreach (var item in documents)
                        {
                            System.Console.WriteLine("Name: {0} Status: {1}",
                                item.GetField<string>("name"), item.GetField<string>("status"));
                        }
                    }
                    OClient.DropDatabasePool("AppConnection");
                }
                finally
                {
                    if (created)
                        server.DropDatabase("TestManualy", OStorageType.PLocal);
                }
            }
        }
        public TestConnectionProxy(int port)
        {
            this.port = port;
            _server = new OServer(_hostname, port, _rootUserName, _rootUserParssword);

            GlobalTestDatabaseName = "globalTestDatabaseForNetDriver001";
            GlobalTestDatabaseType = ODatabaseType.Graph;
            GlobalTestDatabaseAlias = "globalTestDatabaseForNetDriver001AliasProxy";
            GlobalTestDatabaseStorageType = TestConnection.GlobalTestDatabaseStorageType;
        }
 public void DropTestDatabase()
 {
     var retry = 2;
     do
     {
         try
         {
             if (_server.DatabaseExist(GlobalTestDatabaseName, GlobalTestDatabaseStorageType))
             {
                 _server.DropDatabase(GlobalTestDatabaseName, GlobalTestDatabaseStorageType);
             }
             break;
         }
         catch
         {
             _server.Dispose();
             _server = new OServer(_hostname, port, _rootUserName, _rootUserParssword);
         }
     }
     while (--retry > 0);
 }