clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From enrid...@apache.org
Subject [1/5] CLEREZZA-810 Packages renamed
Date Sun, 16 Mar 2014 18:51:35 GMT
Repository: clerezza
Updated Branches:
  refs/heads/master f5f5112dd -> e34187e0d


http://git-wip-us.apache.org/repos/asf/clerezza/blob/25694741/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/VirtuosoMGraphTest.java
----------------------------------------------------------------------
diff --git a/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/VirtuosoMGraphTest.java
b/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/VirtuosoMGraphTest.java
deleted file mode 100644
index c899d3b..0000000
--- a/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/VirtuosoMGraphTest.java
+++ /dev/null
@@ -1,525 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package rdf.virtuoso.storage;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.sql.SQLException;
-import java.sql.Statement;
-import java.util.Iterator;
-
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.Language;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.TypedLiteral;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
-import org.apache.clerezza.rdf.core.impl.TypedLiteralImpl;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Ignore;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import rdf.virtuoso.storage.access.DataAccess;
-import virtuoso.jdbc4.VirtuosoException;
-
-public class VirtuosoMGraphTest {
-	static VirtuosoMGraph mgraph = null;
-	static DataAccess da = null;
-	static final String TEST_GRAPH_NAME = "VirtuosoMGraphTest";
-
-	static Logger log = LoggerFactory.getLogger(VirtuosoMGraphTest.class);
-	
-	@BeforeClass
-	public static void assume(){
-		org.junit.Assume.assumeTrue(!TestUtils.SKIP);
-	}
-	
-	/**
-	 * Clean before any test
-	 * 
-	 * @throws ClassNotFoundException
-	 * @throws SQLException
-	 */
-	@Before
-	public void before() throws ClassNotFoundException, SQLException {
-		
-		da = TestUtils.getProvider().createDataAccess();
-		mgraph = new VirtuosoMGraph(TEST_GRAPH_NAME, da);
-		mgraph.clear();
-		log.debug("Clearing graph <{}>", TEST_GRAPH_NAME);
-	}
-
-	final UriRef enridaga = new UriRef("enridaga");
-	final UriRef alexdma = new UriRef("alexdma");
-	final UriRef anuzzolese = new UriRef("anuzzolese");
-	final UriRef predicate = new UriRef("http://property/name");
-	final PlainLiteral object = new PlainLiteralImpl("Enrico Daga", new Language("it"));
-	final TypedLiteral objectTyped = new TypedLiteralImpl("Enrico Daga", new UriRef("http://www.w3.org/2001/XMLSchema#string"));
-	final TypedLiteral objectXml = new TypedLiteralImpl("<div>Enrico Daga</div>"
, 
-			new UriRef("http://www.w3.org/1999/02/22-rdf-syntax-ns#XMLLiteral"));
-	final UriRef knows = new UriRef(TestUtils.FOAF_NS + "knows");
-
-	@Test
-	public void testAddSingle() {
-		log.info("testAddSingle()");
-		Triple triple = new Triple() {
-
-			@Override
-			public NonLiteral getSubject() {
-				return enridaga;
-			}
-
-			@Override
-			public UriRef getPredicate() {
-				return predicate;
-			}
-
-			@Override
-			public Resource getObject() {
-				return object;
-			}
-		};
-		boolean success = mgraph.add(triple);
-		assertTrue(success);
-		assertTrue(mgraph.size() == 1);
-		assertTrue(mgraph.filter(enridaga, predicate, object).hasNext());
-		assertTrue(mgraph.filter(enridaga, predicate, object).next().equals(triple));
-	}
-	
-	@Test
-	public void testAddSingleTypedLiteral() {
-		log.info("testAddSingleTypedLiteral()");
-		Triple triple = new Triple() {
-
-			@Override
-			public NonLiteral getSubject() {
-				return enridaga;
-			}
-
-			@Override
-			public UriRef getPredicate() {
-				return predicate;
-			}
-
-			@Override
-			public Resource getObject() {
-				return objectTyped;
-			}
-		};
-		boolean success = mgraph.add(triple);
-		assertTrue(success);
-		assertTrue(mgraph.size() == 1);
-		assertTrue(mgraph.filter(enridaga, predicate, objectTyped).hasNext());
-		assertTrue(mgraph.filter(enridaga, predicate, objectTyped).next().equals(triple));
-	}
-
-	@Ignore
-	@Test
-	public void testAddSingleXMLLiteral() {
-		log.info("testAddSingleXMLLiteral()");
-		Triple triple = new Triple() {
-
-			@Override
-			public NonLiteral getSubject() {
-				return enridaga;
-			}
-
-			@Override
-			public UriRef getPredicate() {
-				return predicate;
-			}
-
-			@Override
-			public Resource getObject() {
-				return objectXml;
-			}
-		};
-		boolean success = mgraph.add(triple);
-		assertTrue(success);
-		assertTrue(mgraph.size() == 1);
-		Triple rt = mgraph.filter(enridaga, predicate, null).next();
-		log.info(" > s: {} ", rt.getSubject());
-		log.info(" > p: {} ", rt.getPredicate());
-		log.info(" > o: {} ", rt.getObject());
-		log.info(" > tl?: {} ", rt.getObject() instanceof TypedLiteral);
-		assertTrue(mgraph.filter(enridaga, predicate, objectXml).hasNext());
-		assertTrue(mgraph.filter(enridaga, predicate, objectXml).next().equals(triple));
-	}
-
-
-	@Test
-	public void testFilter() {
-		log.info("testFilter(); Test filter(s,p,o)");
-		// We use testAdd to prepare this
-		testAddSingle();
-		
-		Iterator<Triple> its = mgraph.filter(null, null, null);
-		while (its.hasNext()) {
-			Triple t = its.next();
-			log.info("Found --- triple: {}", t);
-			log.info("Found --- s: {} {}", t.getSubject(), t.getSubject().getClass());
-			log.info("Found --- p: {} {}", t.getPredicate(), t.getPredicate().getClass());
-			log.info("Found --- o: {} {}", t.getObject(), t.getObject().getClass());
-			assertEquals(t.getSubject(), enridaga);
-			assertEquals(t.getPredicate(), predicate);
-			assertEquals(t.getObject(), object);
-		}
-
-		Iterator<Triple> it = mgraph.filter(enridaga, predicate, object);
-		boolean found = false;
-		while (it.hasNext()) {
-			found = true;
-			Triple t = it.next();
-			log.debug("Found matching triple: {}", t);
-			assertEquals(t.getSubject(), enridaga);
-			assertEquals(t.getPredicate(), predicate);
-			assertEquals(t.getObject(), object);
-		}
-		assertTrue(found);
-	}
-
-	@Test
-	public void testFilterSubject() {
-		log.info("testFilterSubject(); Test filter(s,null,null)");
-		// We use testAdd to prepare this
-		testAddSingle();
-		Iterator<Triple> it = mgraph.filter(enridaga, null, null);
-		boolean found = false;
-		while (it.hasNext()) {
-			found = true;
-			Triple t = it.next();
-			if (log.isDebugEnabled()) {
-				log.debug("Found matching triple: {}", t);
-				TestUtils.stamp(t);
-			}
-			assertEquals(t.getSubject(), enridaga);
-		}
-		assertTrue(found);
-	}
-
-
-	@Test
-	public void testFilterSubjectBnode() throws VirtuosoException, SQLException, ClassNotFoundException
{
-		log.info("testFilterSubjectBnode(); Test filter(s,null,null)");
-		final BNode bn = new BNode();
-		// We use testAdd to prepare this
-		Triple triple = new Triple() {
-
-			@Override
-			public NonLiteral getSubject() {
-				return bn;
-			}
-
-			@Override
-			public UriRef getPredicate() {
-				return predicate;
-			}
-
-			@Override
-			public Resource getObject() {
-				return new BNode();
-			}
-		};
-
-		boolean success = mgraph.add(triple);
-		assertTrue(success);
-		Iterator<Triple> it = mgraph.filter(bn, predicate, null);
-		boolean found = false;
-		Triple t = null; // we will use it to make a further query
-		while (it.hasNext()) {
-			found = true;
-			 t = it.next();
-			if (log.isDebugEnabled()) {
-				log.debug("Found matching triple: {}", t);
-				TestUtils.stamp(t);
-			}
-			assertEquals(t.getPredicate(), predicate);
-		}
-		assertTrue(found);
-		
-		assertNotNull(t);
-		
-		log.info("{}",t.getSubject());
-		it = mgraph.filter(t.getSubject(), predicate, t.getObject());
-		found = false;
-		while (it.hasNext()) {
-			found = true;
-			 t = it.next();
-			if (log.isDebugEnabled()) {
-				log.debug("Found matching triple: {}", t);
-				TestUtils.stamp(t);
-			}
-			assertEquals(t.getPredicate(), predicate);
-		}
-		assertTrue(found);
-	}
-
-	@Test
-	public void testFilterPredicate() {
-		log.info("testFilterPredicate(); Test filter(null,p,null)");
-		// We use testAdd to prepare this
-		testAddSingle();
-		Iterator<Triple> it = mgraph.filter(null, predicate, null);
-		boolean found = false;
-		while (it.hasNext()) {
-			found = true;
-			Triple t = it.next();
-			if (log.isDebugEnabled()) {
-				log.debug("Found matching triple: {}", t);
-				TestUtils.stamp(t);
-			}
-			assertEquals(t.getPredicate(), predicate);
-		}
-		assertTrue(found);
-	}
-
-	@Test
-	public void testFilterObject() {
-		log.info("testFilterObject(); Test filter(null,null,o)");
-		// We use testAdd to prepare this
-		testAddSingle();
-		Iterator<Triple> it = mgraph.filter(null, null, object);
-		boolean found = false;
-		while (it.hasNext()) {
-			found = true;
-			Triple t = it.next();
-			if (log.isDebugEnabled()) {
-				log.debug("Found matching triple: {}", t);
-				TestUtils.stamp(t);
-			}
-			assertEquals(t.getObject(), object);
-		}
-		assertTrue(found);
-	}
-
-	@Test
-	public void testFilterObjectTyped() {
-		log.info("testFilterObjectTyped(); Test filter(null,null,o)");
-		// We use testAdd to prepare this
-		testAddSingleTypedLiteral();
-		Iterator<Triple> it = mgraph.filter(null, null, objectTyped);
-		boolean found = false;
-		while (it.hasNext()) {
-			found = true;
-			Triple t = it.next();
-			if (log.isDebugEnabled()) {
-				log.debug("Found matching triple: {}", t);
-				TestUtils.stamp(t);
-			}
-			assertEquals(t.getObject(), objectTyped);
-		}
-		assertTrue(found);
-	}
-
-	@Ignore
-	@Test
-	public void testFilterObjectXml() {
-		log.info("testFilterObjectXml(); Test filter(null,null,o)");
-		// We use testAdd to prepare this
-		testAddSingleXMLLiteral();
-		Iterator<Triple> it = mgraph.filter(null, null, objectXml);
-		boolean found = false;
-		while (it.hasNext()) {
-			found = true;
-			Triple t = it.next();
-			if (log.isDebugEnabled()) {
-				log.debug("Found matching triple: {}", t);
-				TestUtils.stamp(t);
-			}
-			assertEquals(t.getObject(), objectXml);
-		}
-		assertTrue(found);
-	}
-
-	@Test
-	public void testSize() {
-		log.info("testSize()");
-		// We use testAdd to prepare this
-		testAddSingle();
-		// Should be 1 at this time
-		log.debug("How many triples are in graph <{}>? {}", TEST_GRAPH_NAME,
-				mgraph.size());
-		assertTrue(mgraph.size() > 0);
-	}
-
-	@Test
-	public void testIncreaseSize() {
-		log.info("testIncreaseSize()");
-		int beforeSize = mgraph.size();
-		Triple t = new Triple() {
-
-			@Override
-			public NonLiteral getSubject() {
-				return enridaga;
-			}
-
-			@Override
-			public UriRef getPredicate() {
-				return knows;
-			}
-
-			@Override
-			public Resource getObject() {
-				return alexdma;
-			}
-		};
-		assertTrue(mgraph.add(t));
-		int afterSize = mgraph.size();
-		assertEquals(beforeSize + 1, afterSize);
-	}
-
-	@Test
-	public void testAddRemoveSize() {
-		log.info("testAddRemoveSize()");
-		int beforeSize = mgraph.size();
-		Triple t = new Triple() {
-
-			@Override
-			public NonLiteral getSubject() {
-				return enridaga;
-			}
-
-			@Override
-			public UriRef getPredicate() {
-				return knows;
-			}
-
-			@Override
-			public Resource getObject() {
-				return alexdma;
-			}
-		};
-		assertTrue(mgraph.add(t));
-		assertTrue(mgraph.remove(t));
-		int afterSize = mgraph.size();
-		assertEquals(beforeSize, afterSize);
-	}
-
-	@Test
-	public void testGetGraphReadOnly() {
-		log.info("testGetGraphReadOnly()");
-		Graph g = mgraph.getGraph();
-		Triple t = new Triple() {
-
-			@Override
-			public NonLiteral getSubject() {
-				return enridaga;
-			}
-
-			@Override
-			public UriRef getPredicate() {
-				return knows;
-			}
-
-			@Override
-			public Resource getObject() {
-				return anuzzolese;
-			}
-		};
-		// This should not be allowed
-		boolean success;
-		try {
-			success = g.add(t);
-		} catch (UnsupportedOperationException e) {
-			success = false;
-		}
-		assertFalse(success);
-	}
-
-	@Test
-	public void testContains() {
-		log.info("testContains()");
-		Triple t = new Triple() {
-
-			@Override
-			public NonLiteral getSubject() {
-				return enridaga;
-			}
-
-			@Override
-			public UriRef getPredicate() {
-				return knows;
-			}
-
-			@Override
-			public Resource getObject() {
-				return anuzzolese;
-			}
-		};
-		boolean addWorks = mgraph.add(t);
-		assertTrue(addWorks);
-
-		// This second triple is equivalent
-		Triple t2 = new Triple() {
-
-			@Override
-			public NonLiteral getSubject() {
-				return enridaga;
-			}
-
-			@Override
-			public UriRef getPredicate() {
-				return knows;
-			}
-
-			@Override
-			public Resource getObject() {
-				return anuzzolese;
-			}
-		};
-		Iterator<Triple> it = mgraph.filter(t2.getSubject(), t2.getPredicate(),
-				t2.getObject());
-		while (it.hasNext()) {
-			if (log.isDebugEnabled()) {
-				log.debug("Found matching triple");
-				TestUtils.stamp(it.next());
-			}else{
-				it.next();
-			}
-		}
-		assertTrue(mgraph.contains(t2));
-		// Also the related read-only graph
-		assertTrue(mgraph.getGraph().contains(t2));
-	}
-
-	@After
-	public void clear() throws VirtuosoException, ClassNotFoundException,
-			SQLException {
-		log.info("Clearing graph <{}> of size {}", TEST_GRAPH_NAME,
-				mgraph.size());
-		log.debug("Removing graph <{}>", TEST_GRAPH_NAME);
-		da.close();
-		da = null;
-		mgraph = null;
-		Statement st = TestUtils.getConnection().createStatement();
-		st.execute("SPARQL CLEAR GRAPH <" + TEST_GRAPH_NAME + ">");
-		st.close();
-	}
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/25694741/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/DataAccessTest.java
----------------------------------------------------------------------
diff --git a/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/DataAccessTest.java
b/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/DataAccessTest.java
deleted file mode 100644
index 76ec921..0000000
--- a/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/DataAccessTest.java
+++ /dev/null
@@ -1,110 +0,0 @@
-package rdf.virtuoso.storage.access;
-
-import java.sql.SQLException;
-
-import org.apache.clerezza.rdf.core.BNode;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import rdf.virtuoso.storage.TestUtils;
-
-public class DataAccessTest {
-
-	private static DataAccess da = null;
-
-	static Logger log = LoggerFactory.getLogger(DataAccessTest.class);
-	
-	@BeforeClass
-	public static void assume(){
-		org.junit.Assume.assumeTrue(!TestUtils.SKIP);
-	}
-	
-	@Before
-	public void before() throws ClassNotFoundException, SQLException {
-		da = TestUtils.getProvider().createDataAccess();
-		da.clearGraph( "urn:x-test:DataAccessTest" );
-	}
-
-	@After
-	public void after() {
-		da.clearGraph( "urn:x-test:DataAccessTest" );
-		da.close();
-		da = null;
-	}
-
-	private void testTriple(Triple t){
-		String g = "urn:x-test:DataAccessTest";
-		da.insertQuad(g, t);
-		
-		Assert.assertTrue(da.filter(g, null, null, null).hasNext());
-
-		Assert.assertTrue(da.filter(g, t.getSubject(), null, null).hasNext());
-		Assert.assertTrue(da.filter(g, null, t.getPredicate(), null).hasNext());
-		Assert.assertTrue(da.filter(g, null, null, t.getObject()).hasNext());
-		
-		Assert.assertTrue(da.filter(g, null, t.getPredicate(), t.getObject()).hasNext());
-		Assert.assertTrue(da.filter(g, t.getSubject(), null, t.getObject()).hasNext());
-		Assert.assertTrue(da.filter(g, t.getSubject(), t.getPredicate(), null).hasNext());
-		Assert.assertTrue(da.filter(g, t.getSubject(), null, t.getObject()).hasNext());
-
-		Assert.assertTrue(da.filter(g, t.getSubject(), t.getPredicate(), t.getObject()).hasNext());
-
-		Assert.assertTrue(da.size(g) == 1);
-		
-		da.deleteQuad(g, t);
-		
-		Assert.assertTrue(da.size(g) == 0);
-	}
-
-	@Test
-	public void test_Uri_Uri_Uri(){
-		Triple t = new TripleImpl(new UriRef("urn:subject"), new UriRef("urn:predicate"), new UriRef("urn:object"));
-		testTriple(t);
-	}
-
-	@Test
-	public void test_Uri_Uri_PlainLiteral(){
-		Triple t = new TripleImpl(new UriRef("urn:subject"), new UriRef("urn:predicate"), new PlainLiteralImpl("Lorem
Ipsum"));
-		testTriple(t);
-	}
-	
-	@Test
-	public void test_Uri_Uri_BNode(){
-		Triple t = new TripleImpl(new UriRef("urn:subject"), new UriRef("urn:predicate"), new BNode());
-		testTriple(t);
-	}
-	
-	@Test
-	public void testRenew(){
-		int i = 100;
-		while(i>0){
-			test_Uri_Uri_Uri();
-			test_Uri_Uri_PlainLiteral();
-			i--;
-		}
-		da.renew();
-		i = 100;
-		while(i>0){
-			test_Uri_Uri_Uri();
-			test_Uri_Uri_PlainLiteral();
-			i--;
-		}
-		da.renew();
-		i = 100;
-		while(i>0){
-			test_Uri_Uri_Uri();
-			test_Uri_Uri_PlainLiteral();
-			i--;
-		}
-	}
-
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/25694741/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/VirtuosoWeightedProviderTest.java
----------------------------------------------------------------------
diff --git a/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/VirtuosoWeightedProviderTest.java
b/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/VirtuosoWeightedProviderTest.java
deleted file mode 100644
index 319232b..0000000
--- a/clerezza-virtuoso/rdf.virtuoso.storage/src/test/java/rdf/virtuoso/storage/access/VirtuosoWeightedProviderTest.java
+++ /dev/null
@@ -1,309 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *   http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package rdf.virtuoso.storage.access;
-
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertTrue;
-
-import java.sql.SQLException;
-import java.util.Iterator;
-import java.util.Set;
-
-import org.apache.clerezza.rdf.core.Graph;
-import org.apache.clerezza.rdf.core.MGraph;
-import org.apache.clerezza.rdf.core.NonLiteral;
-import org.apache.clerezza.rdf.core.PlainLiteral;
-import org.apache.clerezza.rdf.core.Resource;
-import org.apache.clerezza.rdf.core.Triple;
-import org.apache.clerezza.rdf.core.UriRef;
-import org.apache.clerezza.rdf.core.access.NoSuchEntityException;
-import org.apache.clerezza.rdf.core.impl.PlainLiteralImpl;
-import org.apache.clerezza.rdf.core.impl.SimpleMGraph;
-import org.apache.clerezza.rdf.core.impl.TripleImpl;
-import org.junit.After;
-import org.junit.Assert;
-import org.junit.Before;
-import org.junit.BeforeClass;
-import org.junit.Test;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import rdf.virtuoso.storage.TestUtils;
-import virtuoso.jdbc4.VirtuosoException;
-
-/**
- * 
- * Tests the VirtuosoWeightedProvider
- * 
- * @author enridaga
- * 
- */
-public class VirtuosoWeightedProviderTest {
-	static final Logger log = LoggerFactory
-			.getLogger(VirtuosoWeightedProviderTest.class);
-
-	private static final String TEST_GRAPH_URI = "VirtuosoWeightedProviderTest";
-
-	private static VirtuosoWeightedProvider wp = null;
-
-	@BeforeClass
-	public static void before() throws ClassNotFoundException, SQLException {
-		org.junit.Assume.assumeTrue(!TestUtils.SKIP);
-		
-		log.info("Preparing VirtuosoWeightedProvider for test");
-		wp = TestUtils.getProvider();
-	}
-
-	@Test
-	public void weight() {
-		log.info("Test setting the weight");
-		int w = 200;
-		wp.setWeight(w);
-		assertTrue(wp.getWeight() == w);
-	}
-
-	@Test
-	public void listGraphs() {
-		log.info("Test listGraphs()");
-		Set<UriRef> gs = wp.listGraphs();
-		Iterator<UriRef> it = gs.iterator();
-		log.debug("Graphs:");
-		while (it.hasNext()) {
-			UriRef r = it.next();
-			// Must not be null
-			assertNotNull(r);
-			// Must not be empty string
-			assertFalse(r.getUnicodeString().equals(""));
-			log.debug(" > {}", r.getUnicodeString());
-		}
-	}
-
-	@Test
-	public void listGraphsIsUnmodifiable() {
-		log.info("Test listGraphsIsUnmodifiable()");
-		Set<UriRef> gs = wp.listGraphs();
-		boolean exception = false;
-		try {
-			gs.add(new UriRef("example"));
-		} catch (UnsupportedOperationException e) {
-			log.debug(
-					"Great, we had an {} exception while modifying an immutable set!",
-					e.getClass());
-			exception = true;
-		}
-		assertTrue(exception);
-	}
-
-	@Test
-	public void listMGraphs() {
-		log.info("Test listMGraphs()");
-		Set<UriRef> mg = wp.listMGraphs();
-		log.debug("Graphs:");
-		for (UriRef r : mg) {
-			// Must not be null
-			assertNotNull(r);
-			// Must not be empty string
-			assertFalse(r.getUnicodeString().equals(""));
-			log.debug("MGraph iri: {}", r.getUnicodeString());
-		}
-	}
-
-	final UriRef enridaga = new UriRef("enridaga");
-	final UriRef alexdma = new UriRef("alexdma");
-	final UriRef anuzzolese = new UriRef("anuzzolese");
-	final UriRef predicate = new UriRef("http://property/name");
-	final PlainLiteral object = new PlainLiteralImpl("Enrico Daga");
-	final UriRef knows = new UriRef(TestUtils.FOAF_NS + "knows");
-
-	@Test
-	public void createMGraph() {
-		log.info("createMGraph()");
-		try {
-			MGraph mgraph = wp.createMGraph(new UriRef(TEST_GRAPH_URI));
-			assertNotNull(mgraph);
-			if (log.isDebugEnabled()) {
-				log.debug("Created mgraph, adding a triple");
-				log.debug("MGraph size is {}", mgraph.size());
-			}
-			mgraph.add(new Triple() {
-
-				@Override
-				public NonLiteral getSubject() {
-					return enridaga;
-				}
-
-				@Override
-				public UriRef getPredicate() {
-					return knows;
-				}
-
-				@Override
-				public Resource getObject() {
-					return anuzzolese;
-				}
-			});
-			log.debug("MGraph size is {}", mgraph.size());
-			assertTrue(mgraph.size() == 1);
-		} catch (RuntimeException re) {
-			log.error("ERROR! ", re);
-			assertFalse(true);
-		}
-	}
-
-	@Test
-	public void createGraph() throws VirtuosoException, ClassNotFoundException,
-			SQLException {
-		MGraph smg = new SimpleMGraph();
-		Triple t = new Triple() {
-
-			@Override
-			public NonLiteral getSubject() {
-				return enridaga;
-			}
-
-			@Override
-			public UriRef getPredicate() {
-				return knows;
-			}
-
-			@Override
-			public Resource getObject() {
-				return anuzzolese;
-			}
-		};
-		smg.add(t);
-		UriRef name = new UriRef(TEST_GRAPH_URI);
-		Graph g = wp.createGraph(name, smg);
-		// Graph must contain the triple
-		assertTrue(g.contains(t));
-		// Graph size must be 1
-		assertTrue(g.size() == 1);
-		// Graph retrieved by id must contain the triple
-		assertTrue(wp.getGraph(name).contains(t));
-		// Graph retrieved by id must be equal to g
-		assertTrue(wp.getGraph(name).equals(g));
-	}
-
-	@Test
-	public void testEquals() {
-		log.info("testEquals()");
-		UriRef name = new UriRef(TEST_GRAPH_URI);
-		MGraph g = wp.createMGraph(name);
-		// Equals
-		log.debug("Should be equal: {}", g.equals(wp.getMGraph(name)));
-		assertTrue(g.equals(wp.getMGraph(name)));
-		log.debug("{}  <->  {}", g.getClass(), g.getGraph().getClass());
-		log.debug("Should not be equal: {}", g.equals(g.getGraph()));
-		// Not equals
-		assertFalse(g.equals(g.getGraph()));
-	}
-
-	@Before
-	@After
-	public void clear() throws VirtuosoException, ClassNotFoundException,
-			SQLException {
-		log.info("clear()");
-		log.debug("Removing test graphs <{}>", TEST_GRAPH_URI);
-		try {
-			wp.deleteTripleCollection(new UriRef(TEST_GRAPH_URI));
-		} catch (NoSuchEntityException nsee) {
-			// Nothing to do
-		}
-		try {
-			wp.deleteTripleCollection(new UriRef("urn:my-empty-graph"));
-		} catch (NoSuchEntityException nsee) {
-			// Nothing to do
-		}
-		try {
-			wp.deleteTripleCollection(new UriRef("urn:my-non-empty-graph"));
-		} catch (NoSuchEntityException nsee) {
-			// Nothing to do
-		}
-	}
-	
-	@Test
-	public void testCreateEmptyMGraph(){
-		log.info("testCreateEmptyMGraph()");
-//		try {
-			UriRef ur = new UriRef("urn:my-empty-graph");
-			Assert.assertFalse(wp.listGraphs().contains(ur));
-			Assert.assertFalse(wp.listMGraphs().contains(ur));
-			wp.createMGraph(ur);
-			Assert.assertTrue(wp.canRead(ur));
-			Assert.assertTrue(wp.canModify(ur));
-			Assert.assertTrue(wp.listGraphs().contains(ur));
-			Assert.assertTrue(wp.listMGraphs().contains(ur));
-			wp.deleteTripleCollection(ur);
-			Assert.assertFalse(wp.listGraphs().contains(ur));
-			Assert.assertFalse(wp.listMGraphs().contains(ur));
-//		} catch (NoSuchEntityException nsee) {
-//			// Nothing to do
-//		}
-	}
-	
-	@Test
-	public void testEmptyAndNonEmptyGraphs(){
-		log.info("testEmptyAndNonEmptyGraphs()");
-		
-		UriRef ur = new UriRef("urn:my-empty-graph");
-		UriRef nur = new UriRef("urn:my-non-empty-graph");
-		
-		Assert.assertFalse(wp.listGraphs().contains(ur));
-		Assert.assertFalse(wp.listMGraphs().contains(ur));
-		wp.createMGraph(ur);
-		Assert.assertTrue(wp.canRead(ur));
-		Assert.assertTrue(wp.canModify(ur));
-		wp.createMGraph(nur);
-		Assert.assertTrue(wp.canRead(nur));
-		Assert.assertTrue(wp.canModify(nur));
-		Assert.assertTrue(wp.listGraphs().contains(nur));
-		Assert.assertTrue(wp.listMGraphs().contains(nur));
-		
-		// Add a triple to the non-empty graph
-		Triple t = new TripleImpl(new UriRef("urn:test:subject"), new UriRef("urn:test:predicate"),

-				new PlainLiteralImpl("A literal"));
-		wp.getMGraph(nur).add(t);
-		// Show inserted triple
-		Iterator<Triple> ti = wp.getMGraph(nur).iterator();
-		while(ti.hasNext()){
-			log.info(" > {}", ti.next());
-		}
-		Assert.assertTrue(wp.getMGraph(nur).contains(t));
-		Assert.assertTrue(wp.getMGraph(ur).isEmpty());
-		// We delete the empty graph
-		wp.deleteTripleCollection(ur);
-		Assert.assertFalse(wp.listGraphs().contains(ur));
-		Assert.assertFalse(wp.listMGraphs().contains(ur));
-		// But the other is still there
-		Assert.assertTrue(wp.listGraphs().contains(nur));
-		Assert.assertTrue(wp.listMGraphs().contains(nur));
-		// And it still contains its triple
-		Assert.assertTrue(wp.getMGraph(nur).contains(t));
-		// We delete the triple
-		wp.getMGraph(nur).remove(t);
-		Assert.assertFalse(wp.getMGraph(nur).contains(t));
-		Assert.assertTrue(wp.getMGraph(nur).isEmpty());
-		// We delete the non empty graph
-		wp.deleteTripleCollection(nur);
-		Assert.assertFalse(wp.listGraphs().contains(nur));
-		Assert.assertFalse(wp.listMGraphs().contains(nur));
-
-	}
-}

http://git-wip-us.apache.org/repos/asf/clerezza/blob/25694741/clerezza-virtuoso/rdf.virtuoso.storage/src/test/resources/log4j.properties
----------------------------------------------------------------------
diff --git a/clerezza-virtuoso/rdf.virtuoso.storage/src/test/resources/log4j.properties b/clerezza-virtuoso/rdf.virtuoso.storage/src/test/resources/log4j.properties
index 0ce5668..ad89d4d 100644
--- a/clerezza-virtuoso/rdf.virtuoso.storage/src/test/resources/log4j.properties
+++ b/clerezza-virtuoso/rdf.virtuoso.storage/src/test/resources/log4j.properties
@@ -3,3 +3,4 @@ log4j.appender.S = org.apache.log4j.ConsoleAppender
 log4j.appender.S.layout = org.apache.log4j.PatternLayout
 log4j.appender.S.layout.ConversionPattern = %d{yyyy-MM-dd HH:mm:ss} %c{1} [%p] %m%n
 
+log4j.logger.rdf.virtuoso.storage=DEBUG


Mime
View raw message