コード例 #1
0
        public void TestExportJob()
        {
            var sid = Guid.NewGuid().ToString();

            using (var store = _storeManager.CreateStore(Configuration.StoreLocation + "\\" + sid))
            {
                store.InsertTriple("http://www.example.org/alice", "http://xmlns.org/foaf/0.1/knows",
                                   "http://www.example.org/bob", false, null, null, Constants.DefaultGraphUri);
                store.InsertTriple("http://www.example.org/bob", "http://xmlns.org/foaf/0.1/knows",
                                   "http://www.example.org/alice", false, null, null, Constants.DefaultGraphUri);
                store.Commit(Guid.NewGuid());
            }

            var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);

            storeWorker.Start();
            var jobId = storeWorker.Export(sid + "_export.nt", null, RdfFormat.NQuads);
            JobExecutionStatus status = storeWorker.GetJobStatus(jobId.ToString());

            while (status.JobStatus != JobStatus.CompletedOk)
            {
                Thread.Sleep(1000);
                status = storeWorker.GetJobStatus(jobId.ToString());
                if (status.JobStatus == JobStatus.TransactionError)
                {
                    Assert.Fail("Export job failed with a transaction error. Message={0}. Exception Detail={1}", status.Information, status.ExceptionDetail);
                }
            }
        }