Пример #1
0
        public void TestSimpleUpdate()
        {
            // Create an initial store for sync
            var client =
                BrightstarService.GetClient("type=embedded;storesDirectory=c:\\brightstar\\coreA");

            client.CreateStore("TestStore2");
            var result = client.ExecuteTransaction("TestStore2", null, null,
                                                   "<http://brightstardb.com/foo> <http://brightstardb.com/isa> <http://brightstardb.com/bar>.");

            Assert.IsTrue(result.JobCompletedOk, "Setup transaction failed on TestStore2");

            _coreA.Start(10001);
            _coreB.Start(10002);
            _clusterManager.Start();

            WaitForState(_coreB, CoreState.RunningSlave, 5000);
            Assert.IsTrue(Directory.Exists("c:\\brightstar\\coreB\\TestStore2"));

            var       results    = _coreB.ProcessQuery("TestStore2", "SELECT * WHERE { <http://brightstardb.com/foo> ?s ?p }");
            XDocument resultsDoc = XDocument.Parse(results);

            Assert.AreEqual(1, resultsDoc.SparqlResultRows().Count());

            _coreA.ProcessTransaction(
                new ClusterUpdateTransaction
            {
                StoreId = "TestStore2",
                Inserts =
                    "<http://brightstardb.com/foo> <http://brightstardb.com/property> <http://brightstardb.com/value> ."
            });

            Thread.Sleep(500);
            results = _coreB.ProcessQuery("TestStore2", "SELECT * WHERE {<http://brightstardb.com/foo> ?s ?p }");
            XDocument newResultsDoc = XDocument.Parse(results);

            Assert.AreEqual(2, newResultsDoc.SparqlResultRows().Count());
        }