Ejemplo n.º 1
0
        static void Main(string[] args)
        {
#if DotNetStandard
            Console.WriteLine("WARN : Linux .NET Core not support name EventWaitHandle");
#else
            bool            createdProcessWait;
            EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.TestCase.CacheServerPerformance", out createdProcessWait);
            if (createdProcessWait)
            {
                using (processWait)
                {
#endif
            Console.WriteLine(@"http://www.AutoCSer.com/CacheServer/Index.html
");
            DirectoryInfo messageQueueDirectory = new DirectoryInfo("MessageQueue");
            if (messageQueueDirectory.Exists)
            {
                foreach (DirectoryInfo directory in messageQueueDirectory.GetDirectories())
                {
                    directory.Delete(true);
                }
            }
            CacheServer.MasterServerConfig fileConfig = new CacheServer.MasterServerConfig {
                FileName = "PerformanceTest", IsIgnoreFileEndError = true
            };
            deleteFile(fileConfig.FileName + ".amc");
            deleteFile(fileConfig.FileName + ".amcs");

            AutoCSer.Net.TcpInternalServer.ServerAttribute serverAttribute = AutoCSer.Metadata.TypeAttribute.GetAttribute <AutoCSer.Net.TcpInternalServer.ServerAttribute>(typeof(AutoCSer.CacheServer.MasterServer), false);
            serverAttribute.VerifyString = "!2#4%6&8QwErTyAsDfZx";
            AutoCSer.Net.TcpInternalServer.ServerAttribute fileServerAttribute = AutoCSer.MemberCopy.Copyer <AutoCSer.Net.TcpInternalServer.ServerAttribute> .MemberwiseClone(serverAttribute);

            fileServerAttribute.Port -= 1;
            using (AutoCSer.CacheServer.MasterServer.TcpInternalServer server = new AutoCSer.CacheServer.MasterServer.TcpInternalServer(serverAttribute))
                using (AutoCSer.CacheServer.MasterServer.TcpInternalServer fileServer = new AutoCSer.CacheServer.MasterServer.TcpInternalServer(fileServerAttribute, null, new AutoCSer.CacheServer.MasterServer(fileConfig)))
                {
                    if (server.IsListen && fileServer.IsListen)
                    {
                        if (!startProcess("CacheClientPerformance", "AutoCSer.TestCase.CacheClientPerformance"))
                        {
                            Console.WriteLine("未找到缓存服务性能测试服务 客户端程序");
                        }
                        Console.WriteLine("Press quit to exit.");
                        while (Console.ReadLine() != "quit")
                        {
                            ;
                        }
                    }
                    else
                    {
                        Console.WriteLine("缓存服务性能测试服务 启动失败");
                        Console.ReadKey();
                    }
                }
#if !DotNetStandard
        }
    }
#endif
        }
Ejemplo n.º 2
0
        static unsafe void Main(string[] args)
        {
#if DotNetStandard
            Console.WriteLine("WARN : Linux .NET Core not support name EventWaitHandle");
#else
            bool            createdProcessWait;
            EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.TestCase.CacheServerPerformance", out createdProcessWait);
            if (createdProcessWait)
            {
                using (processWait)
                {
#endif
            Console.WriteLine(@"http://www.AutoCSer.com/CacheServer/Index.html
");
            checkFileSize("test.amc");
            checkFileSize("test.amcs");

            using (AutoCSer.CacheServer.MasterServer.TcpInternalServer server = new AutoCSer.CacheServer.MasterServer.TcpInternalServer())
            {
                if (server.IsListen)
                {
                    using (AutoCSer.CacheServer.Client client = new AutoCSer.CacheServer.Client())
                    {
                        Console.WriteLine(MesssageQueueConsumer.TestCase(client));
                        Console.WriteLine(MesssageQueueConsumers.TestCase(client));
                        Console.WriteLine(MesssageDistributor.TestCase(client));

                        Console.WriteLine(ValueArray.TestCase(client));
                        Console.WriteLine(ValueDictionary.TestCase(client));
                        Console.WriteLine(ValueSearchTreeDictionary.TestCase(client));
                        Console.WriteLine(Heap.TestCase(client));
                        Console.WriteLine(HashSet.TestCase(client));
                        Console.WriteLine(Link.TestCase(client));
                        Console.WriteLine(Bitmap.TestCase(client));

                        Console.WriteLine(Array.TestCase(client));
                        Console.WriteLine(Dictionary.TestCase(client));
                        Console.WriteLine(SearchTreeDictionary.TestCase(client));
                        Console.WriteLine("Over");
                        Console.ReadKey();
                    }
                }
                else
                {
                    Console.WriteLine("缓存服务启动失败");
                    Console.ReadKey();
                }
            }
#if !DotNetStandard
        }
    }
#endif
        }
Ejemplo n.º 3
0
        static void Main(string[] args)
        {
#if DotNetStandard
            Console.WriteLine("WARN : Linux .NET Core not support name EventWaitHandle");
#else
            bool            createdProcessWait;
            EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.TestCase", out createdProcessWait);
            if (createdProcessWait)
            {
                using (processWait)
                {
#endif
            Console.WriteLine(@"http://www.AutoCSer.com/
");

            Type errorType = typeof(Program);
#if !NoAutoCSer
            checkFileSize("blockFile" + AutoCSer.DiskBlock.File.ExtensionName);
            //checkFileSize("test.ard");
            checkFileSize("test.amc");
            checkFileSize("test.amcs");

            using (AutoCSer.CacheServer.MasterServer.TcpInternalServer cacheMasterServer = new AutoCSer.CacheServer.MasterServer.TcpInternalServer())
                using (AutoCSer.CacheServer.SlaveServer.TcpInternalServer cacheSlaveServer = new AutoCSer.CacheServer.SlaveServer.TcpInternalServer())
                    using (AutoCSer.DiskBlock.Server.TcpInternalServer fileBlockServer = AutoCSer.DiskBlock.Server.Create(new AutoCSer.DiskBlock.File(new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, "blockFile" + AutoCSer.DiskBlock.File.ExtensionName)).FullName, 0)))
                        using (AutoCSer.TestCase.TcpStaticServer.JsonServer jsonServer = new AutoCSer.TestCase.TcpStaticServer.JsonServer())
                            using (AutoCSer.TestCase.TcpStaticServer.MemberServer memberServer = new AutoCSer.TestCase.TcpStaticServer.MemberServer())
                                using (AutoCSer.TestCase.TcpStaticServer.SessionServer sessionServer = new AutoCSer.TestCase.TcpStaticServer.SessionServer())
                                    using (AutoCSer.TestCase.TcpStaticSimpleServer.SimpleJsonServer jsonSimpleServer = new AutoCSer.TestCase.TcpStaticSimpleServer.SimpleJsonServer())
                                        using (AutoCSer.TestCase.TcpStaticSimpleServer.SimpleMemberServer memberSimpleServer = new AutoCSer.TestCase.TcpStaticSimpleServer.SimpleMemberServer())
                                            using (AutoCSer.TestCase.TcpStaticSimpleServer.SimpleSessionServer sessionSimpleServer = new AutoCSer.TestCase.TcpStaticSimpleServer.SimpleSessionServer())
                                            {
                                                if (
                                                    cacheMasterServer.IsListen && cacheSlaveServer.IsListen &&
                                                    fileBlockServer.IsListen && jsonServer.IsListen && memberServer.IsListen && sessionServer.IsListen &&
                                                    jsonSimpleServer.IsListen && memberSimpleServer.IsListen && sessionSimpleServer.IsListen
                                                    )
                                                {
#endif
            do
            {
                if (!Json.TestCase())
                {
                    errorType = typeof(Json); break;
                }
                if (!Xml.TestCase())
                {
                    errorType = typeof(Xml); break;
                }
                if (!BinarySerialize.TestCase())
                {
                    errorType = typeof(BinarySerialize); break;
                }
                if (!SimpleSerialize.TestCase())
                {
                    errorType = typeof(SimpleSerialize); break;
                }
#if !NOJIT
                if (!TcpInternalServer.Emit.Server.TestCase())
                {
                    errorType = typeof(TcpInternalServer.Emit.Server); break;
                }
                if (!TcpOpenServer.Emit.Server.TestCase())
                {
                    errorType = typeof(TcpOpenServer.Emit.Server); break;
                }
                if (!TcpInternalSimpleServer.Emit.Server.TestCase())
                {
                    errorType = typeof(TcpInternalSimpleServer.Emit.Server); break;
                }
                if (!TcpOpenSimpleServer.Emit.Server.TestCase())
                {
                    errorType = typeof(TcpOpenSimpleServer.Emit.Server); break;
                }
#endif
#if !NoAutoCSer
                if (!TcpInternalServer.Session.TestCase())
                {
                    errorType = typeof(TcpInternalServer.Session); break;
                }
                if (!TcpInternalServer.Member.TestCase())
                {
                    errorType = typeof(TcpInternalServer.Member); break;
                }
                if (!TcpInternalServer.Json.TestCase())
                {
                    errorType = typeof(TcpInternalServer.Json); break;
                }
                if (!TcpStaticServer.Session.TestClient())
                {
                    errorType = typeof(TcpStaticServer.Session); break;
                }
                if (!TcpStaticServer.Member.TestClient())
                {
                    errorType = typeof(TcpStaticServer.Member); break;
                }
                if (!TcpStaticServer.Json.TestClient())
                {
                    errorType = typeof(TcpStaticServer.Json); break;
                }
                if (!TcpOpenServer.Session.TestCase())
                {
                    errorType = typeof(TcpOpenServer.Session); break;
                }
                if (!TcpOpenServer.Member.TestCase())
                {
                    errorType = typeof(TcpOpenServer.Member); break;
                }
                if (!TcpOpenServer.Json.TestCase())
                {
                    errorType = typeof(TcpOpenServer.Json); break;
                }

                if (!TcpInternalSimpleServer.Session.TestCase())
                {
                    errorType = typeof(TcpInternalSimpleServer.Session); break;
                }
                if (!TcpInternalSimpleServer.Member.TestCase())
                {
                    errorType = typeof(TcpInternalSimpleServer.Member); break;
                }
                if (!TcpInternalSimpleServer.Json.TestCase())
                {
                    errorType = typeof(TcpInternalSimpleServer.Json); break;
                }
                if (!TcpStaticSimpleServer.Session.TestClient())
                {
                    errorType = typeof(TcpStaticSimpleServer.Session); break;
                }
                if (!TcpStaticSimpleServer.Member.TestClient())
                {
                    errorType = typeof(TcpStaticSimpleServer.Member); break;
                }
                if (!TcpStaticSimpleServer.Json.TestClient())
                {
                    errorType = typeof(TcpStaticSimpleServer.Json); break;
                }
                if (!TcpOpenSimpleServer.Session.TestCase())
                {
                    errorType = typeof(TcpOpenSimpleServer.Session); break;
                }
                if (!TcpOpenSimpleServer.Member.TestCase())
                {
                    errorType = typeof(TcpOpenSimpleServer.Member); break;
                }
                if (!TcpOpenSimpleServer.Json.TestCase())
                {
                    errorType = typeof(TcpOpenSimpleServer.Json); break;
                }

                if (!CacheServer.Cache.TestCase())
                {
                    errorType = typeof(CacheServer.Cache); break;
                }
                if (!DiskBlock.File.TestCase())
                {
                    errorType = typeof(DiskBlock.File); break;
                }
#endif
                Console.Write('.');
                if (testCount++ == 1)
                {
                    AutoCSer.Threading.ThreadPool.TinyBackground.Start(check);
                }
            }while (true);
#if !NoAutoCSer
        }
    }
#endif
            testCount = 0;
            Console.WriteLine(errorType.FullName + " ERROR");
            Console.ReadKey();
#if !DotNetStandard
        }
    }
#endif
        }
Ejemplo n.º 4
0
        static void Main(string[] args)
        {
#if DotNetStandard
            Console.WriteLine("WARN : Linux .NET Core not support name EventWaitHandle");
#else
            bool            createdProcessWait;
            EventWaitHandle processWait = new EventWaitHandle(false, EventResetMode.ManualReset, "AutoCSer.TestCase.CacheServerPerformance", out createdProcessWait);
            if (createdProcessWait)
            {
                using (processWait)
                {
#endif
            Console.WriteLine(@"http://www.AutoCSer.com/CacheServer/Index.html
");
            DirectoryInfo messageQueueDirectory = new DirectoryInfo("MessageQueue");
            if (messageQueueDirectory.Exists)
            {
                foreach (DirectoryInfo directory in messageQueueDirectory.GetDirectories())
                {
                    directory.Delete(true);
                }
            }
            CacheServer.MasterServerConfig fileConfig = new CacheServer.MasterServerConfig {
                FileName = "PerformanceTest", IsIgnoreFileEndError = true
            };
            deleteFile(fileConfig.FileName + ".amc");
            deleteFile(fileConfig.FileName + ".amcs");

            AutoCSer.Net.TcpInternalServer.ServerAttribute serverAttribute = AutoCSer.Metadata.TypeAttribute.GetAttribute <AutoCSer.Net.TcpInternalServer.ServerAttribute>(typeof(AutoCSer.CacheServer.MasterServer), false);
            serverAttribute.VerifyString = "!2#4%6&8QwErTyAsDfZx";
            AutoCSer.Net.TcpInternalServer.ServerAttribute fileServerAttribute = AutoCSer.MemberCopy.Copyer <AutoCSer.Net.TcpInternalServer.ServerAttribute> .MemberwiseClone(serverAttribute);

            fileServerAttribute.Port -= 1;
            using (AutoCSer.CacheServer.MasterServer.TcpInternalServer server = new AutoCSer.CacheServer.MasterServer.TcpInternalServer(serverAttribute))
                using (AutoCSer.CacheServer.MasterServer.TcpInternalServer fileServer = new AutoCSer.CacheServer.MasterServer.TcpInternalServer(fileServerAttribute, null, new AutoCSer.CacheServer.MasterServer(fileConfig)))
                {
                    if (server.IsListen && fileServer.IsListen)
                    {
#if DotNetStandard
#if DEBUG
                        FileInfo clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"..\..\..\..\CacheClientPerformance\bin\Debug\netcoreapp2.0\AutoCSer.TestCase.CacheClientPerformance.dll".pathSeparator()));
#else
                        FileInfo clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"..\..\..\..\CacheClientPerformance\bin\Release\netcoreapp2.0\AutoCSer.TestCase.CacheClientPerformance.dll".pathSeparator()));
#endif
                        if (!clientFile.Exists)
                        {
                            clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"AutoCSer.TestCase.CacheClientPerformance.dll"));
                        }
                        if (clientFile.Exists)
                        {
                            ProcessStartInfo process = new ProcessStartInfo("dotnet", clientFile.FullName);
                            process.UseShellExecute = true;
                            Process.Start(process);
                        }
#else
#if DEBUG
                        FileInfo clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"..\..\..\CacheClientPerformance\bin\Debug\AutoCSer.TestCase.CacheClientPerformance.exe".pathSeparator()));
#else
                        FileInfo clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"..\..\..\CacheClientPerformance\bin\Release\AutoCSer.TestCase.CacheClientPerformance.exe".pathSeparator()));
#endif
                        if (!clientFile.Exists)
                        {
                            clientFile = new FileInfo(Path.Combine(AutoCSer.PubPath.ApplicationPath, @"AutoCSer.TestCase.CacheClientPerformance.exe"));
                        }
                        if (clientFile.Exists)
                        {
                            Process.Start(clientFile.FullName);
                        }
#endif
                        else
                        {
                            Console.WriteLine("未找到缓存服务性能测试服务 客户端程序");
                        }
                        Console.WriteLine("Press quit to exit.");
                        while (Console.ReadLine() != "quit")
                        {
                            ;
                        }
                    }
                    else
                    {
                        Console.WriteLine("缓存服务性能测试服务 启动失败");
                        Console.ReadKey();
                    }
                }
#if !DotNetStandard
        }
    }
#endif
        }