Skip to content
This repository has been archived by the owner on Feb 22, 2020. It is now read-only.

Commit

Permalink
Merge pull request #44 from eclipse/issues/GH-1113-shacl-api
Browse files Browse the repository at this point in the history
eclipse-rdf4j/rdf4j#1113 fixed test for sail constructor refactor
  • Loading branch information
Jeen Broekstra authored Jan 20, 2019
2 parents 8d32dcb + 47a84ea commit 4b68eb9
Showing 1 changed file with 18 additions and 22 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*******************************************************************************
* Copyright (c) 2018 Eclipse RDF4J contributors, Aduna, and others.
* Copyright (c) 2018 Eclipse RDF4J contributors.
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Distribution License v1.0
* which accompanies this distribution, and is available at
Expand All @@ -8,6 +8,7 @@
package org.eclipse.rdf4j.shacl.manifest;

import org.eclipse.rdf4j.model.Model;
import org.eclipse.rdf4j.model.vocabulary.RDF4J;
import org.eclipse.rdf4j.repository.Repository;
import org.eclipse.rdf4j.repository.RepositoryConnection;
import org.eclipse.rdf4j.repository.RepositoryException;
Expand Down Expand Up @@ -71,44 +72,39 @@ public AbstractSHACLTest(String testURI, String label, Model shapesGraph, Model
*---------*/

@Override
public void setUp()
throws Exception
{
public void setUp() throws Exception {
dataRep = createRepository(shapesGraph);
}

protected Repository createRepository(Model shapesGraph)
throws Exception
{
Repository repo = new SailRepository(newSail(shapesGraph));
protected Repository createRepository(Model shapesGraph) throws Exception {
Repository repo = new SailRepository(newSail());
repo.initialize();
RepositoryConnection con = repo.getConnection();
try {
con.clear();
con.clearNamespaces();
}
finally {
con.close();

try (RepositoryConnection conn = repo.getConnection()) {
conn.clear();
conn.clearNamespaces();
conn.add(shapesGraph, RDF4J.SHACL_SHAPE_GRAPH);
}
return repo;
}

protected abstract Sail newSail(Model shapesGraph);
/**
* Creates a new un-initialized Sail stack
*
* @return a new un-initialized Sail stack
*/
protected abstract Sail newSail();

@Override
public void tearDown()
throws Exception
{
public void tearDown() throws Exception {
if (dataRep != null) {
dataRep.shutDown();
dataRep = null;
}
}

@Override
public void runTest()
throws Exception
{
public void runTest() throws Exception {
try {
upload(dataRep, dataGraph);
assertTrue(conforms);
Expand Down

0 comments on commit 4b68eb9

Please sign in to comment.