Пример #1
0
        private void TestInit(string appConfig)
        {
            Config.SetConfig((RouterConfig + appConfig).Replace('&', '#'));
            router = new LeafRouter();
            router.Start();

            client = new GeoTrackerClient(router, null);

            var serverSettings = GeoTrackerServerSettings.LoadConfig("LillTek.GeoTracker.Server");

            serverSettings.IPGeocodeEnabled = false;

            server = new GeoTrackerNode();
            server.Start(router, serverSettings, null, null);
        }
Пример #2
0
        private void TestInit(bool enable, bool copyDatabase)
        {
            const string cfg =
                @"
MsgRouter.AppName               = Test
MsgRouter.AppDescription        = Test Description
MsgRouter.DiscoveryMode         = MULTICAST
MsgRouter.RouterEP				= physical://DETACHED/$(LillTek.DC.DefHubName)/$(Guid)
MsgRouter.CloudEP               = $(LillTek.DC.CloudEP)
MsgRouter.CloudAdapter          = ANY
MsgRouter.UdpEP					= ANY:0
MsgRouter.TcpEP					= ANY:0
MsgRouter.TcpBacklog			= 100
MsgRouter.TcpDelay				= off
MsgRouter.BkInterval			= 1s
MsgRouter.MaxIdle				= 5m
MsgRouter.EnableP2P             = yes
MsgRouter.AdvertiseTime			= 1m
MsgRouter.DefMsgTTL				= 5
MsgRouter.SharedKey             = PLAINTEXT
MsgRouter.SessionCacheTime      = 2m
MsgRouter.SessionRetries        = 3
MsgRouter.SessionTimeout        = 10s
";

            Config.SetConfig(cfg);
            router = new LeafRouter();
            router.Start();
            Thread.Sleep(1000);

            client = new GeoTrackerClient(router, null);

            var serverSettings = new GeoTrackerServerSettings()
            {
                IPGeocodeEnabled       = enable,
                IPGeocodeSourceTimeout = TimeSpan.FromMinutes(2),
            };

            if (copyDatabase)
            {
                Helper.DeleteFile(IPGeocoder.DataPath);
                File.Copy(exteralDataPath, IPGeocoder.DataPath);
            }

            server = new GeoTrackerNode();
            server.Start(router, serverSettings, null, null);
            Thread.Sleep(2000);
        }
Пример #3
0
        private void TestCleanup()
        {
            client = null;

            if (server != null)
            {
                server.Stop();
                server = null;
            }

            if (router != null)
            {
                router.Stop();
                router = null;
            }
        }
Пример #4
0
        private void TestCleanup()
        {
            client = null;

            foreach (var instance in clusterInstances)
            {
                instance.Stop();
            }

            clusterInstances = null;

            if (router != null)
            {
                router.Stop();
                router = null;
            }

            //NetTrace.Stop();
        }
Пример #5
0
        private void TestCleanup()
        {
            client = null;

            if (server != null)
            {
                server.Stop();
                server = null;
            }

            if (router != null)
            {
                router.Stop();
                router = null;
            }

            Helper.DeleteFile(IPGeocoder.DataPath);
            Helper.DeleteFile(IPGeocoder.DownloadPath);
            Helper.DeleteFile(IPGeocoder.DecryptedPath);
        }
Пример #6
0
        private void TestInit()
        {
            const string cfg =
                @"
MsgRouter.AppName               = Test
MsgRouter.AppDescription        = Test Description
MsgRouter.DiscoveryMode         = MULTICAST
MsgRouter.RouterEP				= physical://DETACHED/$(LillTek.DC.DefHubName)/$(Guid)
MsgRouter.CloudEP               = $(LillTek.DC.CloudEP)
MsgRouter.CloudAdapter          = ANY
MsgRouter.UdpEP					= ANY:0
MsgRouter.TcpEP					= ANY:0
MsgRouter.TcpBacklog			= 100
MsgRouter.TcpDelay				= off
MsgRouter.BkInterval			= 1s
MsgRouter.MaxIdle				= 5m
MsgRouter.EnableP2P             = yes
MsgRouter.AdvertiseTime			= 1m
MsgRouter.DefMsgTTL				= 5
MsgRouter.SharedKey             = PLAINTEXT
MsgRouter.SessionCacheTime      = 2m
MsgRouter.SessionRetries        = 3
MsgRouter.SessionTimeout        = 10s
";

            Config.SetConfig(cfg);
            router = new LeafRouter();
            router.Start();

            client = new GeoTrackerClient(router, null);

            var serverSettings = new GeoTrackerServerSettings();

            serverSettings.IPGeocodeEnabled = false;

            server = new GeoTrackerNode();
            server.Start(router, serverSettings, null, null);
        }
Пример #7
0
        private void TestInit()
        {
            const string cfg =
                @"
Diagnostics.TraceEnable[-] = 0:LillTek.Messaging
--Diagnostics.TraceEnable[-] = 1:LillTek.GeoTracker

MsgRouter.AppName               = Test
MsgRouter.AppDescription        = Test Description
MsgRouter.DiscoveryMode         = MULTICAST
MsgRouter.RouterEP				= physical://DETACHED/$(LillTek.DC.DefHubName)/$(Guid)
MsgRouter.CloudEP               = $(LillTek.DC.CloudEP)
MsgRouter.CloudAdapter          = ANY
MsgRouter.UdpEP					= ANY:0
MsgRouter.TcpEP					= ANY:0
MsgRouter.TcpBacklog			= 100
MsgRouter.TcpDelay				= off
MsgRouter.BkInterval			= 1s
MsgRouter.MaxIdle				= 5m
MsgRouter.EnableP2P             = yes
MsgRouter.AdvertiseTime			= 1s
MsgRouter.DefMsgTTL				= 5
MsgRouter.SharedKey             = PLAINTEXT
MsgRouter.SessionCacheTime      = 2m
MsgRouter.SessionRetries        = 3
MsgRouter.SessionTimeout        = 10s
";

            Config.SetConfig(cfg);
            //NetTrace.Start();

            router = new LeafRouter();
            router.Start();
            Thread.Sleep(1000);

            client = new GeoTrackerClient(router, null);

            var serverSettings = new GeoTrackerServerSettings();

            serverSettings.IPGeocodeEnabled = false;

            // Crank up the cluster instances on separate threads.

            var threads = new List <Thread>();
            var fail    = false;

            clusterInstances = new ClusterInstance[InstanceCount];

            for (int i = 0; i < InstanceCount; i++)
            {
                clusterInstances[i] = new ClusterInstance();
            }

            for (int i = 0; i < InstanceCount; i++)
            {
                threads.Add(
                    Helper.StartThread(null, i,
                                       index =>
                {
                    try
                    {
                        clusterInstances[(int)index].Start();
                    }
                    catch (Exception e)
                    {
                        SysLog.LogException(e);
                        fail = true;
                    }
                }));
            }

            foreach (var thread in threads)
            {
                thread.Join();
            }

            if (fail)
            {
                Assert.Fail("Instance Creation Failure");
            }

            Thread.Sleep(5000);     // Wait for routes to be replicated
        }