public void Test1() { Logger.Console.Verbose = VerboseLevel.All; var netStream = new NetworkStreamSimulator(); var dbcfg = new HistorianServerDatabaseConfig("DB", @"C:\Archive", true); var server = new HistorianServer(dbcfg); var auth = new SecureStreamServer<SocketUserPermissions>(); auth.SetDefaultUser(true, new SocketUserPermissions() { CanRead = true, CanWrite = true, IsAdmin = true }); var netServer = new SnapStreamingServer(auth, netStream.ServerStream, server.Host); ThreadPool.QueueUserWorkItem(ProcessClient, netServer); var client = new SnapStreamingClient(netStream.ClientStream, new SecureStreamClientDefault(), true); var db = client.GetDatabase("DB"); client.Dispose(); server.Dispose(); }
public void TestWriteServer() { HistorianKey key = new HistorianKey(); HistorianValue value = new HistorianValue(); Logger.Console.Verbose = VerboseLevel.All; Logger.FileWriter.SetPath(@"C:\Temp\", VerboseLevel.All); var netStream = new NetworkStreamSimulator(); var dbcfg = new HistorianServerDatabaseConfig("DB", @"C:\Temp\Scada", true); var server = new HistorianServer(dbcfg); var auth = new SecureStreamServer<SocketUserPermissions>(); auth.SetDefaultUser(true, new SocketUserPermissions() { CanRead = true, CanWrite = true, IsAdmin = true }); var netServer = new SnapStreamingServer(auth, netStream.ServerStream, server.Host); ThreadPool.QueueUserWorkItem(ProcessClient, netServer); var client = new SnapStreamingClient(netStream.ClientStream, new SecureStreamClientDefault(), false); var db = client.GetDatabase<HistorianKey, HistorianValue>("DB"); for (uint x = 0; x < 1000; x++) { key.Timestamp = x; db.Write(key, value); break; } client.Dispose(); server.Dispose(); }