public void TestConfigList() { OServer server = TestConnection.GetServer(); Dictionary <string, string> config = server.ConfigList(); Assert.IsTrue(config.Count > 0); }
public void TestConfigList() { var connection = new TestConnection(); OServer server = connection.Server; Dictionary <string, string> config = server.ConfigList(); Assert.IsTrue(config.Count > 0); }
static void CreateDatabaseTestManualy() { var serverConnInfo = Configuration.GetSection("ConnectionStrings:DefaultConnection").GetChildren().ToDictionary(x => x.Key); using (var server = new OServer(serverConnInfo["Server"].Value, int.Parse(serverConnInfo["Port"].Value), serverConnInfo["Username"].Value, serverConnInfo["Password"].Value)) { var created = false; try { var exists = server.DatabaseExist("TestManualy", OStorageType.PLocal); if (exists) { server.DropDatabase("TestManualy", OStorageType.PLocal); } created = server.CreateDatabase("TestManualy", ODatabaseType.Document, OStorageType.PLocal); if (!created) { throw new Exception("Database not created"); } 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( serverConnInfo["Server"].Value, int.Parse(serverConnInfo["Port"].Value), "TestManualy", ODatabaseType.Graph, serverConnInfo["Username"].Value, serverConnInfo["Password"].Value, 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); } } } }
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); } } } }