本文整理汇总了C#中BrightstarDB.Server.StoreWorker类的典型用法代码示例。如果您正苦于以下问题:C# StoreWorker类的具体用法?C# StoreWorker怎么用?C# StoreWorker使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
StoreWorker类属于BrightstarDB.Server命名空间,在下文中一共展示了StoreWorker类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: TestTransactionWithPreconditionFails
public void TestTransactionWithPreconditionFails()
{
// create a store
var sid = CreateStore();
// initialise and start the store worker
var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);
storeWorker.Start();
// execute transactions
const string preconds = @"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/core/version> ""1""^^<http://www.w3.org/2000/01/rdf-schema#integer>";
// execute transactions
const string data = @"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
var jobId = storeWorker.ProcessTransaction(preconds, "", data, Constants.DefaultGraphUri, "nt");
JobExecutionStatus jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.TransactionError)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
Assert.AreEqual(jobStatus.JobStatus, JobStatus.TransactionError);
}
开发者ID:phatcher,项目名称:BrightstarDB,代码行数:25,代码来源:StoreWorkerTests.cs
示例2: TestExportJob
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);
}
}
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:26,代码来源:StoreWorkerTests.cs
示例3: ExportJob
public ExportJob(Guid jobId, StoreWorker storeWorker, string outputFileName, string graphUri)
{
_jobId = jobId;
_storeWorker = storeWorker;
_outputFileName = outputFileName;
_graphUri = graphUri;
}
开发者ID:Garwin4j,项目名称:BrightstarDB,代码行数:7,代码来源:ExportJob.cs
示例4: UpdateTransaction
public UpdateTransaction(Guid jobId, StoreWorker storeWorker, string preconditionData, string deletePatterns, string insertData, string defaultGraphUri) : base(jobId, storeWorker)
{
_defaultGraphUri = defaultGraphUri ?? Constants.DefaultGraphUri;
_deletePatterns = deletePatterns ?? "";
_insertData = insertData ?? "";
_preconditions = preconditionData ?? "";
}
开发者ID:rharrisxtheta,项目名称:BrightstarDB,代码行数:7,代码来源:UpdateTransaction.cs
示例5: ImportJob
public ImportJob(Guid jobId, string label, StoreWorker storeWorker, string contentFileName, RdfFormat importFormat, string graphUri)
: base(jobId, label, storeWorker)
{
_contentFileName = contentFileName;
_importFormat = importFormat;
_graphUri = graphUri;
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:7,代码来源:ImportJob.cs
示例6: GuardedUpdateTransaction
public GuardedUpdateTransaction(Guid jobId, string label, StoreWorker storeWorker, string existsPreconditions, string notExistsPreconditions, string deletePatterns, string insertData, string defaultGraphUri) :
base(jobId, label, storeWorker)
{
_defaultGraphUri = defaultGraphUri ?? Constants.DefaultGraphUri;
DeletePatterns = deletePatterns ?? String.Empty;
InsertData = insertData ?? String.Empty;
ExistsPreconditions = existsPreconditions ?? String.Empty;
NotExistsPreconditions = notExistsPreconditions ?? String.Empty;
}
开发者ID:GTuritto,项目名称:BrightstarDB,代码行数:9,代码来源:GuardedUpdateTransaction.cs
示例7: ExportJob
public ExportJob(Guid jobId, string label, StoreWorker storeWorker, string outputFileName, string graphUri, RdfFormat exportFormat)
{
_jobId = jobId;
_label = label;
_storeWorker = storeWorker;
_outputFileName = outputFileName;
_graphUri = graphUri;
_exportFormat = exportFormat;
}
开发者ID:kowalot,项目名称:BrightstarDB,代码行数:9,代码来源:ExportJob.cs
示例8: TestTransaction
public void TestTransaction()
{
// create a store
var sid = CreateStore();
// initialise and start the store worker
var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);
storeWorker.Start();
// execute transactions
const string data = @"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
var jobId = storeWorker.ProcessTransaction("", "", "", data, Constants.DefaultGraphUri, "nt");
JobExecutionStatus status = storeWorker.GetJobStatus(jobId.ToString());
while (status.JobStatus != JobStatus.CompletedOk)
{
Thread.Sleep(1000);
status = storeWorker.GetJobStatus(jobId.ToString());
}
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:20,代码来源:StoreWorkerTests.cs
示例9: TestTouchingTransactionHeadersEnablesLogging
public void TestTouchingTransactionHeadersEnablesLogging()
{
// create a store with logging disabled
var sid = CreateStore(withTransactionLog: false);
var txnHeadersFile = Path.Combine(Configuration.StoreLocation, sid, "transactionheaders.bs");
var txnLogFile = Path.Combine(Configuration.StoreLocation, sid, "transactions.bs");
// initialise and start the store worker
var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);
storeWorker.Start();
// Should be no transaction files because we created the store with logging disabled
Assert.IsFalse(File.Exists(txnHeadersFile));
Assert.IsFalse(File.Exists(txnLogFile));
// But now "touch" the header file to create it
File.Create(txnHeadersFile).Close();
// execute a transaction that logs data
const string data = @"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
var jobId = storeWorker.ProcessTransaction("", "", "", data, Constants.DefaultGraphUri, "nt");
AssertJobCompletedOk(storeWorker, jobId);
// Transaction files should now both be there
Assert.IsTrue(File.Exists(txnHeadersFile));
Assert.IsTrue(File.Exists(txnLogFile));
// There should also be some content in both files
using (var txnStream = File.OpenRead(txnHeadersFile))
{
Assert.Greater(txnStream.Length, 0L);
}
using (var txnStream = File.OpenRead(txnLogFile))
{
Assert.Greater(txnStream.Length, 0L);
}
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:37,代码来源:StoreWorkerTests.cs
示例10: TestTransactionLogCreatedWhenLoggingEnabled
public void TestTransactionLogCreatedWhenLoggingEnabled()
{
// create a store
var sid = CreateStore(withTransactionLog: true);
var txnHeadersFile = Path.Combine(Configuration.StoreLocation, sid, "transactionheaders.bs");
var txnLogFile = Path.Combine(Configuration.StoreLocation, sid, "transactions.bs");
// Creating the store should create the files
Assert.IsTrue(File.Exists(txnHeadersFile), "Expected transactionheaders.bs file to be created when store is initially created");
Assert.IsTrue(File.Exists(txnLogFile), "Expected transactions.bs file to be created when store is initially created");
// initialise and start the store worker
var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);
storeWorker.Start();
// execute transactions
const string data = @"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
var jobId = storeWorker.ProcessTransaction("", "", "", data, Constants.DefaultGraphUri, "nt");
JobExecutionStatus jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
// Transaction files should still be there
Assert.IsTrue(File.Exists(txnHeadersFile));
Assert.IsTrue(File.Exists(txnLogFile));
// There should also be some content in both files
using (var txnStream = File.OpenRead(txnHeadersFile))
{
Assert.Greater(txnStream.Length, 0L);
}
using (var txnStream = File.OpenRead(txnLogFile))
{
Assert.Greater(txnStream.Length, 0L);
}
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:41,代码来源:StoreWorkerTests.cs
示例11: TestNoTransactionLogWhenLoggingDisabled
public void TestNoTransactionLogWhenLoggingDisabled()
{
// create a store
var sid = CreateStore(withTransactionLog:false);
// initialise and start the store worker
var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);
storeWorker.Start();
Assert.IsFalse(File.Exists(Path.Combine(Configuration.StoreLocation, sid, "transactionheaders.bs")));
Assert.IsFalse(File.Exists(Path.Combine(Configuration.StoreLocation, sid, "transactions.bs")));
// execute transactions
const string data = @"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
var jobId = storeWorker.ProcessTransaction("", "", "", data, Constants.DefaultGraphUri, "nt");
var jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
Assert.IsFalse(File.Exists(Path.Combine(Configuration.StoreLocation, sid, "transactionheaders.bs")));
Assert.IsFalse(File.Exists(Path.Combine(Configuration.StoreLocation, sid, "transactions.bs")));
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:27,代码来源:StoreWorkerTests.cs
示例12: ImportJob
public ImportJob(Guid jobId, StoreWorker storeWorker) : base(jobId, storeWorker)
{
}
开发者ID:rharrisxtheta,项目名称:BrightstarDB,代码行数:3,代码来源:ImportJob.cs
示例13: TestQueryCaching
public void TestQueryCaching()
{
Configuration.EnableQueryCache = true;
// create a store
var sid = CreateStore();
// initialise and start the store worker
var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);
storeWorker.Start();
// execute transactions
const string data = @"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
var jobId = storeWorker.ProcessTransaction("", "", "", data, Constants.DefaultGraphUri, "nt");
JobExecutionStatus jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk && jobStatus.JobStatus != JobStatus.TransactionError)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
Assert.AreEqual(JobStatus.CompletedOk, jobStatus.JobStatus, "Import failed: {0} : {1}", jobStatus.Information, jobStatus.ExceptionDetail);
var sw = new Stopwatch();
sw.Start();
var queryResult = storeWorker.Query("select * where { ?a ?b ?c }", SparqlResultsFormat.Xml, new[] { Constants.DefaultGraphUri });
sw.Stop();
Console.WriteLine("initial query took : " + sw.ElapsedMilliseconds);
var initTime = sw.ElapsedMilliseconds;
sw = new Stopwatch();
sw.Start();
var cachedResult = storeWorker.Query("select * where { ?a ?b ?c }", SparqlResultsFormat.Xml, new[] { Constants.DefaultGraphUri });
sw.Stop();
Console.WriteLine("warm query took : " + sw.ElapsedMilliseconds);
Thread.Sleep(1000);
sw = new Stopwatch();
sw.Start();
cachedResult = storeWorker.Query("select * where { ?a ?b ?c }", SparqlResultsFormat.Xml, new[] { Constants.DefaultGraphUri });
sw.Stop();
Console.WriteLine("cached query took : " + sw.ElapsedMilliseconds);
var cachedTime = sw.ElapsedMilliseconds;
Assert.AreEqual(queryResult, cachedResult);
if (cachedTime >= initTime)
{
Assert.Inconclusive(
"Expected time to read from cache ({0}ms) to be less than time to execute query ({1}ms).",
cachedTime, initTime);
}
Configuration.EnableQueryCache = false;
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:55,代码来源:StoreWorkerTests.cs
示例14: TestTransactionWithPrecondition
public void TestTransactionWithPrecondition()
{
// create a store
var sid = CreateStore();
// initialise and start the store worker
var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);
storeWorker.Start();
// execute transactions
var data =
@"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np> .\n
<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/core/version> ""1""^^<http://www.w3.org/2000/01/rdf-schema#integer> .";
var jobId = storeWorker.ProcessTransaction("", "", "", data, Constants.DefaultGraphUri, "nt");
JobExecutionStatus jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk && jobStatus.JobStatus != JobStatus.TransactionError)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
Assert.IsTrue(jobStatus.JobStatus == JobStatus.CompletedOk, "Initial insert failed: {0} : {1}", jobStatus.Information, jobStatus.ExceptionDetail);
// now test precondition
const string preconds = @"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/core/version> ""1""^^<http://www.w3.org/2000/01/rdf-schema#integer>";
data =
@"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
jobId = storeWorker.ProcessTransaction(preconds,"", "", data, Constants.DefaultGraphUri, "nt");
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk && jobStatus.JobStatus != JobStatus.TransactionError)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
Assert.IsTrue(jobStatus.JobStatus == JobStatus.CompletedOk, "Transaction execution failed: {0} : {1}", jobStatus.Information, jobStatus.ExceptionDetail);
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:37,代码来源:StoreWorkerTests.cs
示例15: TestConsolidateStore
public void TestConsolidateStore()
{
// create a store
var sid = CreateStore();
// initialise and start the store worker
var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);
storeWorker.Start();
// execute transactions
var data =
@"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
var jobId = storeWorker.ProcessTransaction("","", "", data, Constants.DefaultGraphUri, "nt");
JobExecutionStatus jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
jobId = Guid.NewGuid();
storeWorker.QueueJob(new ConsolidateJob(jobId, null, storeWorker));
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk && jobStatus.JobStatus != JobStatus.TransactionError)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
Assert.AreEqual(JobStatus.CompletedOk, jobStatus.JobStatus);
// open store and find all triples
var results = storeWorker.Query("select * where { ?a ?b ?c }", SparqlResultsFormat.Xml, new[] { Constants.DefaultGraphUri });
var doc = XDocument.Parse(results);
XNamespace sparqlNs = "http://www.w3.org/2005/sparql-results#";
Assert.AreEqual(1, doc.Descendants(sparqlNs + "result").Count());
data =
@"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
jobId = storeWorker.ProcessTransaction("", "", data, "", Constants.DefaultGraphUri, "nt");
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
Assert.AreEqual(JobStatus.CompletedOk, jobStatus.JobStatus);
// consolidate again
jobId = Guid.NewGuid();
storeWorker.QueueJob(new ConsolidateJob(jobId, null, storeWorker));
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk && jobStatus.JobStatus != JobStatus.TransactionError)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
Assert.AreEqual(JobStatus.CompletedOk, jobStatus.JobStatus);
results = storeWorker.Query("select * where { ?a ?b ?c }", SparqlResultsFormat.Xml, new[] { Constants.DefaultGraphUri });
doc = XDocument.Parse(results);
Assert.AreEqual(0, doc.Descendants(sparqlNs + "result").Count());
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:67,代码来源:StoreWorkerTests.cs
示例16: UpdateTransaction
public UpdateTransaction(Guid jobId, string label, StoreWorker storeWorker) : base(jobId, label, storeWorker) {}
开发者ID:kowalot,项目名称:BrightstarDB,代码行数:1,代码来源:UpdateTransaction.cs
示例17: TestGetErrorMessage
public void TestGetErrorMessage()
{
// create a store
var sid = CreateStore();
// initialise and start the store worker
var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);
storeWorker.Start();
// execute transactions
const string data = @"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies";
var jobId = storeWorker.ProcessTransaction("", "", "", data, Constants.DefaultGraphUri, "nt");
JobExecutionStatus jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.TransactionError)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
Assert.IsTrue(jobStatus.Information.Contains("Job Error"), "Unexpected job message: '{0}'", jobStatus.Information);
Assert.IsTrue(jobStatus.ExceptionDetail.Message.Contains("Syntax error in triples to add."), "Unexpected job message: '{0}'", jobStatus.ExceptionDetail.Message);
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:24,代码来源:StoreWorkerTests.cs
示例18: TestStatsJob
public void TestStatsJob()
{
var sid = "StatsJob_" + DateTime.Now.Ticks;
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/alice", "http://xmlns.org/foaf/0.1/name", "Alice", true,
RdfDatatypes.String, 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.UpdateStatistics();
var status = storeWorker.GetJobStatus(jobId.ToString());
while (status.JobStatus != JobStatus.CompletedOk && status.JobStatus != JobStatus.TransactionError)
{
Thread.Sleep(1000);
status = storeWorker.GetJobStatus(jobId.ToString());
}
Assert.AreEqual(JobStatus.CompletedOk, status.JobStatus, "Expected UpdateStatsJob to complete OK");
var latestStats = storeWorker.StoreStatistics.GetStatistics().FirstOrDefault();
Assert.IsNotNull(latestStats);
Assert.AreEqual(3, latestStats.TripleCount);
Assert.AreEqual(2, latestStats.PredicateTripleCounts.Count);
Assert.IsTrue(latestStats.PredicateTripleCounts.ContainsKey("http://xmlns.org/foaf/0.1/knows"));
Assert.AreEqual(2, latestStats.PredicateTripleCounts["http://xmlns.org/foaf/0.1/knows"]);
Assert.IsTrue(latestStats.PredicateTripleCounts.ContainsKey("http://xmlns.org/foaf/0.1/name"));
Assert.AreEqual(1, latestStats.PredicateTripleCounts["http://xmlns.org/foaf/0.1/name"]);
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:33,代码来源:StoreWorkerTests.cs
示例19: TestImportPerformance25M
public void TestImportPerformance25M()
{
const string fileName = "bsbm_25m.nt";
if (!File.Exists(BrightstarDB.Configuration.StoreLocation + "\\import\\" + fileName))
{
Assert.Inconclusive("Cannot locate required test file at {0}. Test will not run.",
BrightstarDB.Configuration.StoreLocation + "\\import\\"+fileName);
return;
}
var storeId = Guid.NewGuid().ToString();
_storeManager.CreateStore(BrightstarDB.Configuration.StoreLocation + "\\" + storeId);
var timer = new Stopwatch();
var storeWorker = new StoreWorker(BrightstarDB.Configuration.StoreLocation, storeId);
storeWorker.Start();
timer.Start();
var jobId = storeWorker.Import(fileName, Constants.DefaultGraphUri).ToString();
JobExecutionStatus jobStatus = storeWorker.GetJobStatus(jobId);
while (jobStatus.JobStatus == JobStatus.Pending || jobStatus.JobStatus == JobStatus.Started)
{
Thread.Sleep(100);
jobStatus = storeWorker.GetJobStatus(jobId);
}
timer.Stop();
Console.WriteLine("Time to import test file '" + fileName + "': " + timer.ElapsedMilliseconds);
}
开发者ID:phatcher,项目名称:BrightstarDB,代码行数:25,代码来源:ScalingTests.cs
示例20: TestReadTransactionList
public void TestReadTransactionList()
{
// create a store
var sid = CreateStore();
// initialise and start the store worker
var storeWorker = new StoreWorker(Configuration.StoreLocation, sid);
storeWorker.Start();
// execute transactions
var data =
@"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
var jobId = storeWorker.ProcessTransaction("","", "", data, Constants.DefaultGraphUri, "nt");
JobExecutionStatus jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
var transactionLog = storeWorker.TransactionLog;
var transactionList = transactionLog.GetTransactionList();
var i = 0;
while (transactionList.MoveNext())
{
i++;
}
Assert.AreEqual(1, i);
data = @"<http://www.networkedplanet.com/people/gra> <http://www.networkedplanet.com/types/worksfor> <http://www.networkedplanet.com/companies/np>";
jobId = storeWorker.ProcessTransaction("", "", "", data, Constants.DefaultGraphUri, "nt");
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
while (jobStatus.JobStatus != JobStatus.CompletedOk)
{
Thread.Sleep(1000);
jobStatus = storeWorker.GetJobStatus(jobId.ToString());
}
transactionList.Reset();
i = 0;
while (transactionList.MoveNext())
{
i++;
}
Assert.AreEqual(2, i);
}
开发者ID:jaensen,项目名称:BrightstarDB,代码行数:53,代码来源:StoreWorkerTests.cs
注:本文中的BrightstarDB.Server.StoreWorker类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论