Skip to content

Commit

Permalink
Added 2 physical tests
Browse files Browse the repository at this point in the history
  • Loading branch information
mdesalvo committed Jan 3, 2024
1 parent 56227ab commit abffd19
Showing 1 changed file with 25 additions and 6 deletions.
31 changes: 25 additions & 6 deletions RDFSharp.Test/Query/Mirella/Algebra/Queries/RDFSelectQueryTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1118,30 +1118,49 @@ public void ShouldApplySelectQueryToSPARQLEndpointAndHaveResultsWithBasicAuthori
Assert.IsTrue(result.SelectResults.Rows[0]["?S"].Equals("ex:flower"));
}

/*
[TestMethod]
[TestProperty("Warning", "This is a physical test! It tries to contact http://statistics.gov.scot/sparql service, which may be unavailable! We are not going to mock tests like this.")]
public void ShouldApplySelectQueryToRealSPARQLEndpointAndHaveResults()
{
RDFSelectQuery query = new RDFSelectQuery()
.AddPrefix(RDFNamespaceRegister.GetByPrefix(RDFVocabulary.RDFS.PREFIX))
.AddPatternGroup(new RDFPatternGroup()
.AddPattern(new RDFPattern(new RDFVariable("?S"), new RDFVariable("?P"), new RDFVariable("?O"))))
.AddModifier(new RDFLimitModifier(5));
.AddModifier(new RDFLimitModifier(2));
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri("http://statistics.gov.scot/sparql"));

RDFSelectQueryResult result = query.ApplyToSPARQLEndpoint(endpoint, new RDFSPARQLEndpointQueryOptions() {
QueryMethod = RDFQueryEnums.RDFSPARQLEndpointQueryMethods.Get });

Assert.IsNotNull(result);
Assert.IsNotNull(result.SelectResults);
Assert.IsTrue(result.SelectResultsCount == 5);
Assert.IsTrue(result.SelectResultsCount == 2);
Assert.IsTrue(result.SelectResults.Columns.Count == 3);
Assert.IsTrue(result.SelectResults.Columns[0].ColumnName.Equals("?S"));
Assert.IsTrue(result.SelectResults.Columns[1].ColumnName.Equals("?P"));
Assert.IsTrue(result.SelectResults.Columns[2].ColumnName.Equals("?O"));
}

[TestMethod]
[TestProperty("Warning", "This is a physical test! It tries to contact http://statistics.gov.scot/sparql service, which may be unavailable! We are not going to mock tests like this.")]
public void ShouldApplySelectQueryToRealSPARQLEndpointAndHaveResultsViaPost()
{
RDFSelectQuery query = new RDFSelectQuery()
.AddPatternGroup(new RDFPatternGroup()
.AddPattern(new RDFPattern(new RDFVariable("?S"), new RDFVariable("?P"), new RDFVariable("?O"))))
.AddModifier(new RDFLimitModifier(2));
RDFSPARQLEndpoint endpoint = new RDFSPARQLEndpoint(new Uri("http://statistics.gov.scot/sparql"));

RDFSelectQueryResult result = query.ApplyToSPARQLEndpoint(endpoint, new RDFSPARQLEndpointQueryOptions() {
QueryMethod = RDFQueryEnums.RDFSPARQLEndpointQueryMethods.Post });

Assert.IsNotNull(result);
Assert.IsNotNull(result.SelectResults);
Assert.IsTrue(result.SelectResultsCount == 2);
Assert.IsTrue(result.SelectResults.Columns.Count == 3);
Assert.IsTrue(result.SelectResults.Columns[0].ColumnName.Equals("?S"));
Assert.IsTrue(result.SelectResults.Columns[1].ColumnName.Equals("?P"));
Assert.IsTrue(result.SelectResults.Columns[2].ColumnName.Equals("?O"));
Assert.IsTrue(result.SelectResults.Rows.Count == 5);
}
*/

[TestMethod]
public void ShouldApplySelectQueryToSPARQLEndpointAndHaveResultsWithBearerAuthorizationHeader()
Expand Down

0 comments on commit abffd19

Please sign in to comment.