Skip to content

Commit 3b28fea

Browse files
author
Marco De Salvo
committed
Added guard on removal of reserved namespaces + Fine tuning of .WithDelay(N) tests
1 parent 28cc395 commit 3b28fea

17 files changed

+150
-131
lines changed

RDFSharp.Test/Model/RDFGraphTest.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -685,7 +685,7 @@ public void ShouldSelectAllTriples()
685685
Assert.IsNotNull(select);
686686
Assert.HasCount(3, select);
687687
}
688-
688+
689689
[TestMethod]
690690
public void ShouldSelectTriplesBySubjectAccessor()
691691
{
@@ -929,7 +929,7 @@ public void ShouldSelectTriplesByComplexAccessor2()
929929
Assert.IsNotNull(select);
930930
Assert.AreEqual(2, select.TriplesCount);
931931
}
932-
932+
933933
[TestMethod]
934934
public void ShouldSelectTriplesByComplexAccessor3()
935935
{

RDFSharp.Test/Model/Registers/RDFNamespaceRegisterTest.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,24 @@ public void ShouldNotRemoveUnexistingNamespaces()
133133
Assert.AreEqual(nsCountAfter, nsCountBefore);
134134
}
135135

136+
[TestMethod]
137+
public void ShouldNotRemoveReservedNamespacesByPrefix()
138+
{
139+
int nsCountBefore = RDFNamespaceRegister.NamespacesCount;
140+
RDFNamespaceRegister.RemoveByPrefix(RDFVocabulary.RDF.PREFIX);
141+
int nsCountAfter = RDFNamespaceRegister.NamespacesCount;
142+
Assert.AreEqual(nsCountAfter, nsCountBefore);
143+
}
144+
145+
[TestMethod]
146+
public void ShouldNotRemoveReservedNamespacesByNamespace()
147+
{
148+
int nsCountBefore = RDFNamespaceRegister.NamespacesCount;
149+
RDFNamespaceRegister.RemoveByUri(RDFVocabulary.RDF.BASE_URI);
150+
int nsCountAfter = RDFNamespaceRegister.NamespacesCount;
151+
Assert.AreEqual(nsCountAfter, nsCountBefore);
152+
}
153+
136154
[TestMethod]
137155
public void ShouldGetNamespaceByPrefix()
138156
{

RDFSharp.Test/Query/Mirella/Algebra/Operations/RDFClearOperationTest.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -495,8 +495,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds()
495495
.WithPath("/RDFClearOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"))
496496
.RespondWith(
497497
Response.Create()
498-
.WithStatusCode(HttpStatusCode.OK)
499-
.WithDelay(100));
498+
.WithStatusCode(HttpStatusCode.OK));
500499

501500
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFClearOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"));
502501

@@ -516,8 +515,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentType()
516515
.WithBody(new RegexMatcher("update=.*")))
517516
.RespondWith(
518517
Response.Create()
519-
.WithStatusCode(HttpStatusCode.OK)
520-
.WithDelay(100));
518+
.WithStatusCode(HttpStatusCode.OK));
521519

522520
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFClearOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentType"));
523521

@@ -537,8 +535,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams()
537535
.WithBody(new RegexMatcher("using-named-graph-uri=ex%3actx2&using-graph-uri=ex%3actx1&update=.*")))
538536
.RespondWith(
539537
Response.Create()
540-
.WithStatusCode(HttpStatusCode.OK)
541-
.WithDelay(100));
538+
.WithStatusCode(HttpStatusCode.OK));
542539

543540
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFClearOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams"));
544541
endpoint.AddDefaultGraphUri("ex:ctx1");
@@ -560,13 +557,13 @@ public void ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTim
560557
.RespondWith(
561558
Response.Create()
562559
.WithStatusCode(HttpStatusCode.OK)
563-
.WithDelay(400));
560+
.WithDelay(200));
564561

565562
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFClearOperationTest/ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTimeoutBehavior"));
566563

567564
RDFClearOperation operation = new RDFClearOperation(new Uri("ex:ctx"));
568565

569-
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(250)));
566+
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(100)));
570567
}
571568

572569
[TestMethod]

RDFSharp.Test/Query/Mirella/Algebra/Operations/RDFDeleteDataOperationTest.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -357,8 +357,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds()
357357
.WithPath("/RDFDeleteDataOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"))
358358
.RespondWith(
359359
Response.Create()
360-
.WithStatusCode(HttpStatusCode.OK)
361-
.WithDelay(100));
360+
.WithStatusCode(HttpStatusCode.OK));
362361

363362
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteDataOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"));
364363

@@ -379,8 +378,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentType()
379378
.WithBody(new RegexMatcher("update=.*")))
380379
.RespondWith(
381380
Response.Create()
382-
.WithStatusCode(HttpStatusCode.OK)
383-
.WithDelay(100));
381+
.WithStatusCode(HttpStatusCode.OK));
384382

385383
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteDataOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentType"));
386384

@@ -401,8 +399,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams()
401399
.WithBody(new RegexMatcher("using-named-graph-uri=ex%3actx2&using-graph-uri=ex%3actx1&update=.*")))
402400
.RespondWith(
403401
Response.Create()
404-
.WithStatusCode(HttpStatusCode.OK)
405-
.WithDelay(100));
402+
.WithStatusCode(HttpStatusCode.OK));
406403

407404
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteDataOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams"));
408405
endpoint.AddDefaultGraphUri("ex:ctx1");
@@ -425,14 +422,14 @@ public void ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTim
425422
.RespondWith(
426423
Response.Create()
427424
.WithStatusCode(HttpStatusCode.OK)
428-
.WithDelay(400));
425+
.WithDelay(200));
429426

430427
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteDataOperationTest/ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTimeoutBehavior"));
431428

432429
RDFDeleteDataOperation operation = new RDFDeleteDataOperation();
433430
operation.AddDeleteTemplate(new RDFPattern(new RDFContext("ex:ctx"),new RDFResource("ex:subj"),new RDFResource("ex:pred"),new RDFResource("ex:obj")));
434431

435-
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(250)));
432+
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(100)));
436433
}
437434

438435
[TestMethod]

RDFSharp.Test/Query/Mirella/Algebra/Operations/RDFDeleteInsertWhereOperationTest.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -735,8 +735,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds()
735735
.WithPath("/RDFDeleteInsertWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"))
736736
.RespondWith(
737737
Response.Create()
738-
.WithStatusCode(HttpStatusCode.OK)
739-
.WithDelay(100));
738+
.WithStatusCode(HttpStatusCode.OK));
740739

741740
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteInsertWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"));
742741

@@ -758,8 +757,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentType()
758757
.WithBody(new RegexMatcher("update=.*")))
759758
.RespondWith(
760759
Response.Create()
761-
.WithStatusCode(HttpStatusCode.OK)
762-
.WithDelay(100));
760+
.WithStatusCode(HttpStatusCode.OK));
763761

764762
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteInsertWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentType"));
765763

@@ -781,8 +779,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams()
781779
.WithBody(new RegexMatcher("using-named-graph-uri=ex%3actx2&using-graph-uri=ex%3actx1&update=.*")))
782780
.RespondWith(
783781
Response.Create()
784-
.WithStatusCode(HttpStatusCode.OK)
785-
.WithDelay(100));
782+
.WithStatusCode(HttpStatusCode.OK));
786783

787784
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteInsertWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams"));
788785
endpoint.AddDefaultGraphUri("ex:ctx1");
@@ -806,15 +803,15 @@ public void ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTim
806803
.RespondWith(
807804
Response.Create()
808805
.WithStatusCode(HttpStatusCode.OK)
809-
.WithDelay(400));
806+
.WithDelay(200));
810807

811808
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteInsertWhereOperationTest/ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTimeoutBehavior"));
812809

813810
RDFDeleteInsertWhereOperation operation = new RDFDeleteInsertWhereOperation();
814811
operation.AddDeleteTemplate(new RDFPattern(new RDFContext("ex:ctx1"),new RDFResource("ex:subj"),new RDFResource("ex:pred"),new RDFResource("ex:obj")));
815812
operation.AddInsertTemplate(new RDFPattern(new RDFContext("ex:ctx2"),new RDFResource("ex:subj"),new RDFResource("ex:pred"),new RDFResource("ex:obj")));
816813

817-
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(250)));
814+
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(100)));
818815
}
819816

820817
[TestMethod]

RDFSharp.Test/Query/Mirella/Algebra/Operations/RDFDeleteWhereOperationTest.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -673,8 +673,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds()
673673
.WithPath("/RDFDeleteWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"))
674674
.RespondWith(
675675
Response.Create()
676-
.WithStatusCode(HttpStatusCode.OK)
677-
.WithDelay(100));
676+
.WithStatusCode(HttpStatusCode.OK));
678677

679678
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"));
680679

@@ -695,8 +694,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentType()
695694
.WithBody(new RegexMatcher("update=.*")))
696695
.RespondWith(
697696
Response.Create()
698-
.WithStatusCode(HttpStatusCode.OK)
699-
.WithDelay(100));
697+
.WithStatusCode(HttpStatusCode.OK));
700698

701699
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentType"));
702700

@@ -717,8 +715,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams()
717715
.WithBody(new RegexMatcher("using-named-graph-uri=ex%3actx2&using-graph-uri=ex%3actx1&update=.*")))
718716
.RespondWith(
719717
Response.Create()
720-
.WithStatusCode(HttpStatusCode.OK)
721-
.WithDelay(100));
718+
.WithStatusCode(HttpStatusCode.OK));
722719

723720
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams"));
724721
endpoint.AddDefaultGraphUri("ex:ctx1");
@@ -741,14 +738,14 @@ public void ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTim
741738
.RespondWith(
742739
Response.Create()
743740
.WithStatusCode(HttpStatusCode.OK)
744-
.WithDelay(400));
741+
.WithDelay(200));
745742

746743
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFDeleteWhereOperationTest/ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTimeoutBehavior"));
747744

748745
RDFDeleteWhereOperation operation = new RDFDeleteWhereOperation();
749746
operation.AddDeleteTemplate(new RDFPattern(new RDFContext("ex:ctx"),new RDFResource("ex:subj"),new RDFResource("ex:pred"),new RDFResource("ex:obj")));
750747

751-
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(250)));
748+
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(100)));
752749
}
753750

754751
[TestMethod]

RDFSharp.Test/Query/Mirella/Algebra/Operations/RDFInsertDataOperationTest.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -348,8 +348,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds()
348348
.WithPath("/RDFInsertDataOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"))
349349
.RespondWith(
350350
Response.Create()
351-
.WithStatusCode(HttpStatusCode.OK)
352-
.WithDelay(100));
351+
.WithStatusCode(HttpStatusCode.OK));
353352

354353
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFInsertDataOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"));
355354

@@ -370,8 +369,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentType()
370369
.WithBody(new RegexMatcher("update=.*")))
371370
.RespondWith(
372371
Response.Create()
373-
.WithStatusCode(HttpStatusCode.OK)
374-
.WithDelay(250));
372+
.WithStatusCode(HttpStatusCode.OK));
375373

376374
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFInsertDataOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentType"));
377375

@@ -392,8 +390,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams()
392390
.WithBody(new RegexMatcher("using-named-graph-uri=ex%3actx2&using-graph-uri=ex%3actx1&update=.*")))
393391
.RespondWith(
394392
Response.Create()
395-
.WithStatusCode(HttpStatusCode.OK)
396-
.WithDelay(250));
393+
.WithStatusCode(HttpStatusCode.OK));
397394

398395
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFInsertDataOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams"));
399396
endpoint.AddDefaultGraphUri("ex:ctx1");
@@ -416,14 +413,14 @@ public void ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTim
416413
.RespondWith(
417414
Response.Create()
418415
.WithStatusCode(HttpStatusCode.OK)
419-
.WithDelay(400));
416+
.WithDelay(200));
420417

421418
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFInsertDataOperationTest/ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTimeoutBehavior"));
422419

423420
RDFInsertDataOperation operation = new RDFInsertDataOperation();
424421
operation.AddInsertTemplate(new RDFPattern(new RDFContext("ex:ctx"),new RDFResource("ex:subj"),new RDFResource("ex:pred"),new RDFResource("ex:obj")));
425422

426-
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(250)));
423+
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(100)));
427424
}
428425

429426
[TestMethod]

RDFSharp.Test/Query/Mirella/Algebra/Operations/RDFInsertWhereOperationTest.cs

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1088,8 +1088,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds()
10881088
.WithPath("/RDFInsertWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"))
10891089
.RespondWith(
10901090
Response.Create()
1091-
.WithStatusCode(HttpStatusCode.OK)
1092-
.WithDelay(100));
1091+
.WithStatusCode(HttpStatusCode.OK));
10931092

10941093
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFInsertWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithTimeoutMilliseconds"));
10951094

@@ -1110,8 +1109,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentType()
11101109
.WithBody(new RegexMatcher("update=.*")))
11111110
.RespondWith(
11121111
Response.Create()
1113-
.WithStatusCode(HttpStatusCode.OK)
1114-
.WithDelay(100));
1112+
.WithStatusCode(HttpStatusCode.OK));
11151113

11161114
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFInsertWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentType"));
11171115

@@ -1132,8 +1130,7 @@ public void ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams()
11321130
.WithBody(new RegexMatcher("using-named-graph-uri=ex%3actx2&using-graph-uri=ex%3actx1&update=.*")))
11331131
.RespondWith(
11341132
Response.Create()
1135-
.WithStatusCode(HttpStatusCode.OK)
1136-
.WithDelay(100));
1133+
.WithStatusCode(HttpStatusCode.OK));
11371134

11381135
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFInsertWhereOperationTest/ShouldApplyToSPARQLUpdateEndpointWithRequestContentTypeAndParams"));
11391136
endpoint.AddDefaultGraphUri("ex:ctx1");
@@ -1156,14 +1153,14 @@ public void ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTim
11561153
.RespondWith(
11571154
Response.Create()
11581155
.WithStatusCode(HttpStatusCode.OK)
1159-
.WithDelay(400));
1156+
.WithDelay(200));
11601157

11611158
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri(server.Url + "/RDFInsertWhereOperationTest/ShouldThrowExceptionWhenApplyingToSPARQLUpdateEndpointAccordingToTimeoutBehavior"));
11621159

11631160
RDFInsertWhereOperation operation = new RDFInsertWhereOperation();
11641161
operation.AddInsertTemplate(new RDFPattern(new RDFContext("ex:ctx"),new RDFResource("ex:subj"),new RDFResource("ex:pred"),new RDFResource("ex:obj")));
11651162

1166-
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(250)));
1163+
Assert.ThrowsExactly<RDFQueryException>(() => operation.ApplyToSPARQLUpdateEndpoint(endpoint, new RDFSPARQLEndpointOperationOptions(100)));
11671164
}
11681165

11691166
[TestMethod]

0 commit comments

Comments
 (0)