Skip to content
This repository was archived by the owner on Jul 18, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,14 @@

<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.2</version>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.0.2</version>
</dependency>
</dependencies>

</project>
13 changes: 10 additions & 3 deletions impl.sparql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,15 @@
<version>0.2</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-runner</artifactId>
<version>1.0.2</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -120,4 +127,4 @@
<scope>test</scope>
</dependency>
</dependencies>
</project>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
*/
package org.apache.clerezza.commons.rdf.impl.sparql;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.hp.hpl.jena.query.DatasetAccessor;
import com.hp.hpl.jena.query.DatasetAccessorFactory;
import java.io.IOException;
Expand All @@ -30,21 +34,24 @@
import org.apache.clerezza.commons.rdf.IRI;
import org.apache.clerezza.commons.rdf.RDFTerm;
import org.apache.clerezza.commons.rdf.Triple;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;

/**
*
* @author reto
*/
@RunWith(JUnitPlatform.class)
public class BNodeCircleTest {

final static int serverPort = findFreePort();
static EmbeddedFusekiServer server;

@BeforeClass
@BeforeAll
public static void prepare() throws IOException {
final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
Expand All @@ -58,15 +65,15 @@ public static void prepare() throws IOException {
accessor.putModel(m);
}

@AfterClass
@AfterAll
public static void cleanup() {
server.stop();
}

@Test
public void graphSize() {
final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
Assert.assertEquals("Graph not of the exepected size", 2, graph.size());
assertEquals(2, graph.size(), "Graph not of the exepected size");
}


Expand All @@ -75,14 +82,14 @@ public void graphSize() {
public void nullFilter() {
final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
final Iterator<Triple> iter = graph.filter(null, null, null);
Assert.assertTrue(iter.hasNext());
assertTrue(iter.hasNext());
final Triple triple1 = iter.next();
final BlankNodeOrIRI subject = triple1.getSubject();
final RDFTerm object = triple1.getObject();
Assert.assertTrue(subject instanceof BlankNode);
Assert.assertTrue(object instanceof BlankNode);
Assert.assertNotEquals(subject, object);
Assert.assertTrue(iter.hasNext());
assertTrue(subject instanceof BlankNode);
assertTrue(object instanceof BlankNode);
assertNotEquals(subject, object);
assertTrue(iter.hasNext());
}

@Test
Expand All @@ -92,14 +99,14 @@ public void foafKnowsFilter() {
final IRI foafKnows = new IRI("http://xmlns.com/foaf/0.1/knows");

final Iterator<Triple> iter = graph.filter(null, foafKnows, null);
Assert.assertTrue(iter.hasNext());
assertTrue(iter.hasNext());
final Triple triple1 = iter.next();
final BlankNodeOrIRI subject = triple1.getSubject();
final RDFTerm object = triple1.getObject();
Assert.assertTrue(subject instanceof BlankNode);
Assert.assertTrue(object instanceof BlankNode);
Assert.assertNotEquals(subject, object);
Assert.assertTrue(iter.hasNext());
assertTrue(subject instanceof BlankNode);
assertTrue(object instanceof BlankNode);
assertNotEquals(subject, object);
assertTrue(iter.hasNext());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@
*/
package org.apache.clerezza.commons.rdf.impl.sparql;

import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;

import com.hp.hpl.jena.query.DatasetAccessor;
import com.hp.hpl.jena.query.DatasetAccessorFactory;
import java.io.IOException;
Expand All @@ -30,10 +34,12 @@
import org.apache.clerezza.commons.rdf.IRI;
import org.apache.clerezza.commons.rdf.RDFTerm;
import org.apache.clerezza.commons.rdf.Triple;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;

/**
*
Expand All @@ -44,7 +50,7 @@ public class BNodeTest {
final static int serverPort = findFreePort();
static EmbeddedFusekiServer server;

@BeforeClass
@BeforeAll
public static void prepare() throws IOException {
final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
Expand All @@ -58,15 +64,15 @@ public static void prepare() throws IOException {
accessor.putModel(m);
}

@AfterClass
@AfterAll
public static void cleanup() {
server.stop();
}

@Test
public void graphSize() {
final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
Assert.assertEquals("Graph not of the expected size", 3, graph.size());
assertEquals(3, graph.size(), "Graph not of the expected size");
}

/* Filtering with a Bode that cannot be in graph
Expand All @@ -77,7 +83,7 @@ public void filterAlienBNode() {

final BlankNode blankNode = new BlankNode();
final Iterator<Triple> iter = graph.filter(blankNode, null, null);
Assert.assertFalse(iter.hasNext());
assertFalse(iter.hasNext());
}

@Test
Expand All @@ -90,22 +96,22 @@ public void bNodeIdentity() {
final IRI rdfType = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");

final Iterator<Triple> iter = graph.filter(null, foafName, null);
Assert.assertTrue(iter.hasNext());
assertTrue(iter.hasNext());
final BlankNodeOrIRI namedThing = iter.next().getSubject();
Assert.assertTrue(namedThing instanceof BlankNode);
assertTrue(namedThing instanceof BlankNode);

final Iterator<Triple> iter2 = graph.filter(null, rdfType, foafPerson);
Assert.assertTrue(iter2.hasNext());
assertTrue(iter2.hasNext());
final BlankNodeOrIRI person = iter2.next().getSubject();
Assert.assertTrue(person instanceof BlankNode);
Assert.assertEquals(namedThing, person);
assertTrue(person instanceof BlankNode);
assertEquals(namedThing, person);

final Iterator<Triple> iter3 = graph.filter(null, foafKnows, null);
Assert.assertTrue(iter3.hasNext());
assertTrue(iter3.hasNext());
final RDFTerm knownThing = iter3.next().getObject();
Assert.assertTrue(knownThing instanceof BlankNode);
Assert.assertEquals(knownThing, person);
Assert.assertEquals(namedThing, knownThing);
assertTrue(knownThing instanceof BlankNode);
assertEquals(knownThing, person);
assertEquals(namedThing, knownThing);
}

@Test
Expand All @@ -117,12 +123,12 @@ public void filter1() {
final IRI rdfType = new IRI("http://www.w3.org/1999/02/22-rdf-syntax-ns#type");

final Iterator<Triple> iter = graph.filter(null, foafName, null);
Assert.assertTrue(iter.hasNext());
assertTrue(iter.hasNext());
final BlankNodeOrIRI person = iter.next().getSubject();
Assert.assertTrue(person instanceof BlankNode);
assertTrue(person instanceof BlankNode);

final Iterator<Triple> iter2 = graph.filter(person, rdfType, null);
Assert.assertTrue(iter2.hasNext());
assertTrue(iter2.hasNext());
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.apache.clerezza.commons.rdf.impl.sparql;

import static org.junit.jupiter.api.Assertions.assertEquals;

import com.hp.hpl.jena.query.DatasetAccessor;
import com.hp.hpl.jena.query.DatasetAccessorFactory;
import java.io.IOException;
Expand All @@ -35,21 +37,24 @@
import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
import org.apache.clerezza.rdf.core.serializedform.Serializer;
import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;

/**
*
* @author reto
*/
@RunWith(JUnitPlatform.class)
public class Dadmin2Test {

final static int serverPort = findFreePort();
static EmbeddedFusekiServer server;

@BeforeClass
@BeforeAll
public static void prepare() throws IOException {
final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
Expand All @@ -63,15 +68,15 @@ public static void prepare() throws IOException {
accessor.putModel(m);
}

@AfterClass
@AfterAll
public static void cleanup() {
server.stop();
}

@Test
public void graphSize() {
final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
Assert.assertEquals("Graph not of the exepected size", 12, graph.size());
assertEquals(12, graph.size(), "Graph not of the exepected size");
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
*/
package org.apache.clerezza.commons.rdf.impl.sparql;

import static org.junit.jupiter.api.Assertions.assertEquals;

import com.hp.hpl.jena.query.DatasetAccessor;
import com.hp.hpl.jena.query.DatasetAccessorFactory;
import java.io.IOException;
Expand All @@ -35,21 +37,24 @@
import org.apache.clerezza.commons.rdf.impl.utils.PlainLiteralImpl;
import org.apache.clerezza.rdf.core.serializedform.Serializer;
import org.apache.clerezza.rdf.core.serializedform.SupportedFormat;
import org.junit.AfterClass;
import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Test;

import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.junit.platform.runner.JUnitPlatform;
import org.junit.runner.RunWith;

/**
*
* @author reto
*/
@RunWith(JUnitPlatform.class)
public class DadminTest {

final static int serverPort = findFreePort();
static EmbeddedFusekiServer server;

@BeforeClass
@BeforeAll
public static void prepare() throws IOException {
final String serviceURI = "http://localhost:" + serverPort + "/ds/data";
final DatasetAccessor accessor = DatasetAccessorFactory.createHTTP(serviceURI);
Expand All @@ -63,15 +68,15 @@ public static void prepare() throws IOException {
accessor.putModel(m);
}

@AfterClass
@AfterAll
public static void cleanup() {
server.stop();
}

@Test
public void graphSize() {
final Graph graph = new SparqlGraph("http://localhost:" + serverPort + "/ds/query");
Assert.assertEquals("Graph not of the exepected size", 1, graph.size());
assertEquals(1, graph.size(), "Graph not of the exepected size");
}

@Test
Expand Down
Loading