コード例 #1
0
        public void GeoTracker_SingleInstance_SubmitFix_Single()
        {
            // Submit a single location fix and verify.

            try
            {
                TestInit();

                client.SubmitEntityFix("jeff", null, new GeoFix()
                {
                    Latitude = 10, Longitude = 20
                });

                Assert.AreEqual(1, server.FixCache.EntityCount);

                var fix = server.FixCache.GetCurrentEntityFix("jeff");

                Assert.IsNotNull(fix);
                Assert.AreEqual(10.0, fix.Latitude);
                Assert.AreEqual(20.0, fix.Longitude);
            }
            finally
            {
                TestCleanup();
            }
        }
コード例 #2
0
        public void Archivers_AppLogArchiver_Single()
        {
            // Submit a single location fix to a GeoTrackerNode configured with an AppLog archiver
            // and then verify that the fix was persisted to the archive.

            const string appConfig =
                @"
&section LillTek.GeoTracker.Server

    GeoFixArchiver = LillTek.GeoTracker.Server.AppLogGeoFixArchiver:LillTek.GeoTracker.Server.dll

    // Archiver implementation specific arguments (such as a database connection string)
    // formatted as name=value pairs separated by semicolons.

    GeoFixArchiverArgs = {{

        LogName = GeoFix
    }}

&endsection
";

            try
            {
                Helper.DeleteFile(AppLogFolder, true);
                TestInit(appConfig);

                client.SubmitEntityFix("jeff", "group", new GeoFix()
                {
                    Latitude = 10, Longitude = 20
                });
                server.Stop();

                AppLogReader logReader = AppLogReader.Open("GeoFix");
                AppLogRecord record;

                try
                {
                    record = logReader.ReadDelete();

                    Assert.IsNotNull(record);
                    Assert.AreEqual(AppLogGeoFixArchiver.SchemaName, record.SchemaName);
                    Assert.AreEqual(AppLogGeoFixArchiver.SchemaVersion, record.SchemaVersion);
                    Assert.AreEqual("jeff", record["entityID"]);
                    Assert.AreEqual("group", record["groupID"]);
                    Assert.AreEqual("10", record["Latitude"]);
                    Assert.AreEqual("20", record["Longitude"]);
                }
                finally
                {
                    logReader.Close();
                }
            }
            finally
            {
                TestCleanup();
                Helper.DeleteFile(AppLogFolder, true);
            }
        }
コード例 #3
0
        public void GeoTracker_Cluster_SubmitFix_Single()
        {
            // Submit a single location fix and verify that one of the instances has it.

            try
            {
                TestInit();

                client.SubmitEntityFix("jeff", null, new GeoFix()
                {
                    Latitude = 10, Longitude = 20
                });

                int cFound = 0;

                foreach (var instance in clusterInstances)
                {
                    cFound += instance.Node.FixCache.EntityCount;

                    var fix = instance.Node.FixCache.GetCurrentEntityFix("jeff");

                    if (fix == null)
                    {
                        continue;
                    }

                    Assert.AreEqual(10.0, fix.Latitude);
                    Assert.AreEqual(20.0, fix.Longitude);
                }

                Assert.AreEqual(1, cFound);
            }
            finally
            {
                TestCleanup();
            }
        }