Strabon

changeset 171:e9332065a3dd

who dunnit
author Manos Karpathiotakis <mk@di.uoa.gr>
date Mon May 21 18:08:55 2012 +0300 (2012-05-21)
parents bab8044ab6d3 ffd4c17e4ab9
children a69499da7b01
files
line diff
     1.1 --- a/.hgignore	Mon May 21 18:08:17 2012 +0300
     1.2 +++ b/.hgignore	Mon May 21 18:08:55 2012 +0300
     1.3 @@ -5,3 +5,5 @@
     1.4  pom.xml~
     1.5  ~$
     1.6  .extract$
     1.7 +runtime/src/test/java/eu/earthobservatory/runtime/generaldb/TempClass.java
     1.8 +runtime/src/test/resources/ntriples/aggregate-tests.ntriples
     2.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/AggregateTests.java	Mon May 21 18:08:17 2012 +0300
     2.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/AggregateTests.java	Mon May 21 18:08:55 2012 +0300
     2.3 @@ -2,11 +2,7 @@
     2.4  
     2.5  import java.io.IOException;
     2.6  import java.net.URL;
     2.7 -import java.sql.DriverManager;
     2.8 -import java.sql.SQLException;
     2.9 -import java.sql.Statement;
    2.10  
    2.11 -import org.junit.AfterClass;
    2.12  import org.junit.Test;
    2.13  import org.openrdf.query.MalformedQueryException;
    2.14  import org.openrdf.query.QueryEvaluationException;
    2.15 @@ -15,7 +11,6 @@
    2.16  import org.openrdf.rio.RDFHandlerException;
    2.17  import org.openrdf.rio.RDFParseException;
    2.18  
    2.19 -import eu.earthobservatory.runtime.generaldb.Strabon;
    2.20  import eu.earthobservatory.runtime.postgis.SimpleTests;
    2.21  
    2.22  public class AggregateTests {
    2.23 @@ -30,18 +25,7 @@
    2.24  	protected static java.sql.Connection conn = null;
    2.25  	protected static String databaseName = null; 
    2.26  
    2.27 -//	@BeforeClass
    2.28 -//	public abstract static void initialize() throws SQLException, ClassNotFoundException
    2.29 -//	{
    2.30 -//		strabon = new Strabon("cco2","postgres","p1r3as", 5432, "localhost", true);
    2.31 -//	}
    2.32 -	
    2.33 -	protected static void loadTestData()
    2.34 -			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    2.35 -		{
    2.36 -			URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    2.37 -			strabon.storeInRepo(src, "NTRIPLES");
    2.38 -		}
    2.39 +
    2.40  
    2.41  
    2.42  
    2.43 @@ -53,7 +37,7 @@
    2.44  
    2.45  	String queryGroupBy1 = 
    2.46  		prefixes+
    2.47 -		"SELECT (?placegeo AS ?xxx)  (AVG(?placegeo) AS ?av)  (strdf:union(?placegeo) AS ?united) "+
    2.48 +		"SELECT (?placegeo AS ?xxx) (AVG(?placegeo) AS ?av)  (strdf:union(?placegeo) AS ?united) "+
    2.49  		"WHERE {  "+
    2.50  		"?place  "+
    2.51  		"rdfs:label ?placename ; "+ 	
    2.52 @@ -95,7 +79,7 @@
    2.53  
    2.54  	String queryOrder1 =
    2.55  		prefixes+
    2.56 -		"SELECT ?placegeo ?place (strdf:union(?placegeo,?placegeo) AS ?koko) (strdf:union(?placegeo,?placegeo) AS ?kiki) "+ 
    2.57 +		"SELECT ?placegeo ?place (strdf:union(?placegeo) AS ?koko) (strdf:union(?placegeo,?placegeo) AS ?kiki) "+ 
    2.58  		"WHERE { "+ 
    2.59  		"?place "+ 
    2.60  		"rdfs:label ?placename ; "+ 	
    2.61 @@ -124,7 +108,6 @@
    2.62  	public void testQueryGroupBy1() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException
    2.63  	{
    2.64  		strabon.query(queryGroupBy1,strabon.getSailRepoConnection());
    2.65 -
    2.66  	}
    2.67  
    2.68  	@Test
     3.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java	Mon May 21 18:08:17 2012 +0300
     3.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java	Mon May 21 18:08:55 2012 +0300
     3.3 @@ -38,12 +38,7 @@
     3.4  	//	}
     3.5  
     3.6  
     3.7 -	protected static void loadTestData()
     3.8 -		throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
     3.9 -	{
    3.10 -		URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    3.11 -		strabon.storeInRepo(src, "NTRIPLES");
    3.12 -	}
    3.13 +
    3.14  	
    3.15  	
    3.16  
     4.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/HavingTests.java	Mon May 21 18:08:17 2012 +0300
     4.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/HavingTests.java	Mon May 21 18:08:55 2012 +0300
     4.3 @@ -122,11 +122,5 @@
     4.4  
     4.5  	}
     4.6  	
     4.7 -	protected static void loadTestData()
     4.8 -			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
     4.9 -		{
    4.10 -			URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    4.11 -			strabon.storeInRepo(src, "NTRIPLES");
    4.12 -		}
    4.13  
    4.14  }
     5.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/JoinTests.java	Mon May 21 18:08:17 2012 +0300
     5.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/JoinTests.java	Mon May 21 18:08:55 2012 +0300
     5.3 @@ -39,13 +39,6 @@
     5.4  //	}
     5.5  
     5.6  
     5.7 -	protected static void loadTestData()
     5.8 -			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
     5.9 -		{
    5.10 -			URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    5.11 -			strabon.storeInRepo(src, "NTRIPLES");
    5.12 -		}
    5.13 -
    5.14  
    5.15  	String query5a = 
    5.16  		"PREFIX strdf:<http://strdf.di.uoa.gr/ontology#> "+
     6.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/MeaningfulAggregateTests.java	Mon May 21 18:08:17 2012 +0300
     6.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/MeaningfulAggregateTests.java	Mon May 21 18:08:55 2012 +0300
     6.3 @@ -36,13 +36,6 @@
     6.4  //		strabon = new Strabon("cco2","postgres","p1r3as", 5432, "localhost", true);
     6.5  //	}
     6.6  
     6.7 -
     6.8 -	protected static void loadTestData()
     6.9 -			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    6.10 -		{
    6.11 -			URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    6.12 -			strabon.storeInRepo(src, "NTRIPLES");
    6.13 -		}
    6.14  	
    6.15  
    6.16  	String prefixes =
     7.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/NOATests.java	Mon May 21 18:08:17 2012 +0300
     7.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/NOATests.java	Mon May 21 18:08:55 2012 +0300
     7.3 @@ -32,14 +32,6 @@
     7.4  	
     7.5  
     7.6  
     7.7 -	
     7.8 -	protected static void loadTestData()
     7.9 -			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    7.10 -		{
    7.11 -			URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    7.12 -			strabon.storeInRepo(src, "NTRIPLES");
    7.13 -		}
    7.14 -
    7.15  	String prefixes = 
    7.16  		"PREFIX imAn: <http://teleios.di.uoa.gr/ontologies/imageAnnotationOntology.owl#> "+
    7.17  		"PREFIX noa: <http://teleios.di.uoa.gr/ontologies/noaOntology.owl#> "+
     8.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SimpleTests.java	Mon May 21 18:08:17 2012 +0300
     8.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SimpleTests.java	Mon May 21 18:08:55 2012 +0300
     8.3 @@ -4,7 +4,6 @@
     8.4  import static org.junit.Assert.assertTrue;
     8.5  
     8.6  import java.io.IOException;
     8.7 -import java.net.URL;
     8.8  import java.util.ArrayList;
     8.9  
    8.10  import org.junit.Test;
    8.11 @@ -13,11 +12,8 @@
    8.12  import org.openrdf.query.MalformedQueryException;
    8.13  import org.openrdf.query.QueryEvaluationException;
    8.14  import org.openrdf.query.TupleQueryResultHandlerException;
    8.15 -import org.openrdf.repository.RepositoryException;
    8.16 -import org.openrdf.rio.RDFHandlerException;
    8.17 -import org.openrdf.rio.RDFParseException;
    8.18  
    8.19 -import eu.earthobservatory.runtime.generaldb.Strabon;
    8.20 +import eu.earthobservatory.runtime.monetdb.TemplateTests;
    8.21  
    8.22  /**
    8.23   * A set of simple tests on SPARQL query functionality 
    8.24 @@ -50,13 +46,6 @@
    8.25  		"PREFIX xsd: <"+XMLSchema.NAMESPACE+"> \n" +
    8.26  		"PREFIX ex: <"+EX_NS+"> \n" +
    8.27  		"PREFIX noa: <"+NOA_NS+"> \n";
    8.28 -		
    8.29 -	protected static void loadTestData()
    8.30 -		throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
    8.31 -	{
    8.32 -		URL src = SimpleTests.class.getResource("/simple-tests.ntriples");
    8.33 -		strabon.storeInRepo(src, "NTRIPLES");
    8.34 -	}
    8.35  	
    8.36  	@Test
    8.37  	public void testSimpleFilter() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, QueryEvaluationException
     9.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/AggregateTests.java	Mon May 21 18:08:17 2012 +0300
     9.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/AggregateTests.java	Mon May 21 18:08:55 2012 +0300
     9.3 @@ -1,12 +1,7 @@
     9.4  package eu.earthobservatory.runtime.monetdb;
     9.5  
     9.6  import java.io.IOException;
     9.7 -import java.io.InputStream;
     9.8 -import java.sql.DriverManager;
     9.9 -import java.sql.ResultSet;
    9.10  import java.sql.SQLException;
    9.11 -import java.sql.Statement;
    9.12 -import java.util.Properties;
    9.13  
    9.14  import org.junit.AfterClass;
    9.15  import org.junit.BeforeClass;
    9.16 @@ -25,76 +20,17 @@
    9.17  public class AggregateTests extends eu.earthobservatory.runtime.generaldb.AggregateTests {
    9.18  
    9.19  	@BeforeClass
    9.20 -	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
    9.21 +	public static void beforeClass(String inputfile) throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
    9.22  	{
    9.23 -		// Read properties
    9.24 -		Properties properties = new Properties();
    9.25 -		InputStream propertiesStream =  TemplateTests.class.getResourceAsStream("/databases.properties");
    9.26 -		properties.load(propertiesStream);
    9.27 +		 strabon = TemplateTests.beforeClass("/aggregate-tests-srid.nt");
    9.28  
    9.29 -		serverName = properties.getProperty("monetdb.serverName");
    9.30 -		databaseName = properties.getProperty("monetdb.databaseName");
    9.31 -		port = Integer.parseInt(properties.getProperty("monetdb.port"));
    9.32 -		username = properties.getProperty("monetdb.username");
    9.33 -		password = properties.getProperty("monetdb.password");
    9.34 -				
    9.35 -		// Connect to database
    9.36 -		Class.forName("nl.cwi.monetdb.jdbc.MonetDriver");
    9.37 -		String url = "jdbc:monetdb://"+serverName+":"+port+"/"+databaseName;
    9.38 -		conn = DriverManager.getConnection(url, username, password);
    9.39 -				
    9.40 -//		// Clean database
    9.41 -		Statement stmt = conn.createStatement();
    9.42 -		ResultSet results = stmt.executeQuery("SELECT name FROM tables WHERE system=false AND name <> 'locked'");
    9.43 -		while (results.next()) {
    9.44 -			String table_name = results.getString("name");
    9.45 -			Statement stmt2 = conn.createStatement();
    9.46 -			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
    9.47 -			stmt2.close();
    9.48 -		}
    9.49 -		stmt.close();
    9.50 -		
    9.51 -		strabon = new Strabon(databaseName, username, password, port, serverName, true);
    9.52 -		
    9.53 -		loadTestData();
    9.54  	}
    9.55  	
    9.56  	@AfterClass
    9.57  	public static void afterClass() throws SQLException
    9.58  	{
    9.59 -		strabon.close();
    9.60 +		TemplateTests.afterClass(strabon);
    9.61  	}
    9.62  	
    9.63 -//	/**
    9.64 -//	 * @throws java.lang.Exception
    9.65 -//	 */
    9.66 -//	@Before
    9.67 -//	public void before()
    9.68 -//		throws Exception
    9.69 -//	{
    9.70 -//		
    9.71 -//	}
    9.72 -//
    9.73 -//	/**
    9.74 -//	 * @throws java.lang.Exception
    9.75 -//	 */
    9.76 -//	@After
    9.77 -//	public void after()
    9.78 -//		throws Exception
    9.79 -//	{
    9.80 -//		// Clean database
    9.81 -//		Statement stmt = conn.createStatement();
    9.82 -//		ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " +
    9.83 -//						"table_schema='public' and table_name <> 'spatial_ref_sys' " +
    9.84 -//						"and table_name <> 'geometry_columns' and " +
    9.85 -//						"table_name <> 'geography_columns' and table_name <> 'locked'");
    9.86 -//		while (results.next()) {
    9.87 -//			String table_name = results.getString("table_name");
    9.88 -//			Statement stmt2 = conn.createStatement();
    9.89 -//			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
    9.90 -//			stmt2.close();
    9.91 -//		}
    9.92 -//			
    9.93 -//		stmt.close();
    9.94 -//	}
    9.95 +
    9.96  }
    10.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/GeneralTests.java	Mon May 21 18:08:17 2012 +0300
    10.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/GeneralTests.java	Mon May 21 18:08:55 2012 +0300
    10.3 @@ -27,13 +27,13 @@
    10.4  	@BeforeClass
    10.5  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
    10.6  	{
    10.7 -	 TemplateTests.beforeClass();
    10.8 +		strabon = TemplateTests.beforeClass("/more-tests.nt");
    10.9  	}
   10.10  	
   10.11  	@AfterClass
   10.12  	public static void afterClass() throws SQLException
   10.13  	{
   10.14 -		TemplateTests.afterClass();
   10.15 +		TemplateTests.afterClass(strabon);
   10.16  	}
   10.17  	
   10.18  //	/**
    11.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/HavingTests.java	Mon May 21 18:08:17 2012 +0300
    11.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/HavingTests.java	Mon May 21 18:08:55 2012 +0300
    11.3 @@ -16,24 +16,18 @@
    11.4  
    11.5  import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
    11.6  
    11.7 -/**
    11.8 - * A set of simple tests on SPARQL query functionality 
    11.9 - * 
   11.10 - * @author George Garbis
   11.11 - */
   11.12 -
   11.13  public class HavingTests extends eu.earthobservatory.runtime.generaldb.HavingTests {
   11.14  	
   11.15  	@BeforeClass
   11.16  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   11.17  	{
   11.18 -	 TemplateTests.beforeClass();
   11.19 +		strabon = TemplateTests.beforeClass("/having-tests-srid.nt");
   11.20  	}
   11.21  	
   11.22  	@AfterClass
   11.23  	public static void afterClass() throws SQLException
   11.24  	{
   11.25 -		TemplateTests.afterClass();
   11.26 +		TemplateTests.afterClass(strabon);
   11.27  	}
   11.28  	
   11.29  //	/**
    12.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/JoinTests.java	Mon May 21 18:08:17 2012 +0300
    12.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/JoinTests.java	Mon May 21 18:08:55 2012 +0300
    12.3 @@ -16,85 +16,19 @@
    12.4  
    12.5  import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
    12.6  
    12.7 -/**
    12.8 - * A set of simple tests on SPARQL query functionality 
    12.9 - * 
   12.10 - * @author George Garbis
   12.11 - */
   12.12  
   12.13  public class JoinTests extends eu.earthobservatory.runtime.generaldb.JoinTests {
   12.14  
   12.15  	@BeforeClass
   12.16 -	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   12.17 +	public static void beforeClass(String inputfile) throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   12.18  	{
   12.19 -		// Read properties
   12.20 -		Properties properties = new Properties();
   12.21 -		InputStream propertiesStream =  TemplateTests.class.getResourceAsStream("/databases.properties");
   12.22 -		properties.load(propertiesStream);
   12.23 -
   12.24 -		serverName = properties.getProperty("monetdb.serverName");
   12.25 -		databaseName = properties.getProperty("monetdb.databaseName");
   12.26 -		port = Integer.parseInt(properties.getProperty("monetdb.port"));
   12.27 -		username = properties.getProperty("monetdb.username");
   12.28 -		password = properties.getProperty("monetdb.password");
   12.29 -				
   12.30 -		// Connect to database
   12.31 -		Class.forName("nl.cwi.monetdb.jdbc.MonetDriver");
   12.32 -		String url = "jdbc:monetdb://"+serverName+":"+port+"/"+databaseName;
   12.33 -		conn = DriverManager.getConnection(url, username, password);
   12.34 -				
   12.35 -//		// Clean database
   12.36 -		Statement stmt = conn.createStatement();
   12.37 -		ResultSet results = stmt.executeQuery("SELECT name FROM tables WHERE system=false AND name <> 'locked'");
   12.38 -		while (results.next()) {
   12.39 -			String table_name = results.getString("name");
   12.40 -			Statement stmt2 = conn.createStatement();
   12.41 -			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
   12.42 -			stmt2.close();
   12.43 -		}
   12.44 -		stmt.close();
   12.45 -		
   12.46 -		strabon = new Strabon(databaseName, username, password, port, serverName, true);
   12.47 -		
   12.48 -		loadTestData();
   12.49 +		strabon = TemplateTests.beforeClass("/join-tests-srid");
   12.50  	}
   12.51  	
   12.52  	@AfterClass
   12.53  	public static void afterClass() throws SQLException
   12.54  	{
   12.55 -		strabon.close();
   12.56 +		TemplateTests.afterClass(strabon);
   12.57  	}
   12.58 -	
   12.59 -//	/**
   12.60 -//	 * @throws java.lang.Exception
   12.61 -//	 */
   12.62 -//	@Before
   12.63 -//	public void before()
   12.64 -//		throws Exception
   12.65 -//	{
   12.66 -//		
   12.67 -//	}
   12.68 -//
   12.69 -//	/**
   12.70 -//	 * @throws java.lang.Exception
   12.71 -//	 */
   12.72 -//	@After
   12.73 -//	public void after()
   12.74 -//		throws Exception
   12.75 -//	{
   12.76 -//		// Clean database
   12.77 -//		Statement stmt = conn.createStatement();
   12.78 -//		ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " +
   12.79 -//						"table_schema='public' and table_name <> 'spatial_ref_sys' " +
   12.80 -//						"and table_name <> 'geometry_columns' and " +
   12.81 -//						"table_name <> 'geography_columns' and table_name <> 'locked'");
   12.82 -//		while (results.next()) {
   12.83 -//			String table_name = results.getString("table_name");
   12.84 -//			Statement stmt2 = conn.createStatement();
   12.85 -//			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
   12.86 -//			stmt2.close();
   12.87 -//		}
   12.88 -//			
   12.89 -//		stmt.close();
   12.90 -//	}
   12.91 +
   12.92  }
    13.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/MeaningfulAggregateTests.java	Mon May 21 18:08:17 2012 +0300
    13.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/MeaningfulAggregateTests.java	Mon May 21 18:08:55 2012 +0300
    13.3 @@ -16,56 +16,19 @@
    13.4  
    13.5  import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
    13.6  
    13.7 -/**
    13.8 - * A set of simple tests on SPARQL query functionality 
    13.9 - * 
   13.10 - * @author George Garbis
   13.11 - */
   13.12 -
   13.13  public class MeaningfulAggregateTests extends eu.earthobservatory.runtime.generaldb.SimpleTests {
   13.14  	
   13.15  	@BeforeClass
   13.16  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   13.17  	{
   13.18 -	 TemplateTests.beforeClass();
   13.19 +		strabon = TemplateTests.beforeClass("/more-tests.nt");
   13.20  	}
   13.21  	
   13.22  	@AfterClass
   13.23  	public static void afterClass() throws SQLException
   13.24  	{
   13.25 -		TemplateTests.afterClass();
   13.26 +		TemplateTests.afterClass(strabon);
   13.27  	}
   13.28  	
   13.29 -//	/**
   13.30 -//	 * @throws java.lang.Exception
   13.31 -//	 */
   13.32 -//	@Before
   13.33 -//	public void before()
   13.34 -//		throws Exception
   13.35 -//	{
   13.36 -//		
   13.37 -//	}
   13.38 -//
   13.39 -//	/**
   13.40 -//	 * @throws java.lang.Exception
   13.41 -//	 */
   13.42 -//	@After
   13.43 -//	public void after()
   13.44 -//		throws Exception
   13.45 -//	{
   13.46 -//		// Clean database
   13.47 -//		Statement stmt = conn.createStatement();
   13.48 -//		ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " +
   13.49 -//						"table_schema='public' and table_name <> 'spatial_ref_sys' " +
   13.50 -//						"and table_name <> 'geometry_columns' and " +
   13.51 -//						"table_name <> 'geography_columns' and table_name <> 'locked'");
   13.52 -//		while (results.next()) {
   13.53 -//			String table_name = results.getString("table_name");
   13.54 -//			Statement stmt2 = conn.createStatement();
   13.55 -//			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
   13.56 -//			stmt2.close();
   13.57 -//		}
   13.58 -//			
   13.59 -//		stmt.close();
   13.60 -//	}
   13.61 +
   13.62  }
    14.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/SimpleTests.java	Mon May 21 18:08:17 2012 +0300
    14.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/SimpleTests.java	Mon May 21 18:08:55 2012 +0300
    14.3 @@ -15,6 +15,7 @@
    14.4  import org.openrdf.rio.RDFParseException;
    14.5  
    14.6  import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
    14.7 +import eu.earthobservatory.runtime.generaldb.TransformTests;
    14.8  
    14.9  /**
   14.10   * A set of simple tests on SPARQL query functionality 
   14.11 @@ -27,42 +28,13 @@
   14.12  	@BeforeClass
   14.13  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   14.14  	{
   14.15 -		// Read properties
   14.16 -		Properties properties = new Properties();
   14.17 -		InputStream propertiesStream =  SimpleTests.class.getResourceAsStream("/databases.properties");
   14.18 -		properties.load(propertiesStream);
   14.19 -
   14.20 -		serverName = properties.getProperty("monetdb.serverName");
   14.21 -		databaseName = properties.getProperty("monetdb.databaseName");
   14.22 -		port = Integer.parseInt(properties.getProperty("monetdb.port"));
   14.23 -		username = properties.getProperty("monetdb.username");
   14.24 -		password = properties.getProperty("monetdb.password");
   14.25 -				
   14.26 -		// Connect to database
   14.27 -		Class.forName("nl.cwi.monetdb.jdbc.MonetDriver");
   14.28 -		String url = "jdbc:monetdb://"+serverName+":"+port+"/"+databaseName;
   14.29 -		conn = DriverManager.getConnection(url, username, password);
   14.30 -				
   14.31 -//		// Clean database
   14.32 -		Statement stmt = conn.createStatement();
   14.33 -		ResultSet results = stmt.executeQuery("SELECT name FROM tables WHERE system=false AND name <> 'locked'");
   14.34 -		while (results.next()) {
   14.35 -			String table_name = results.getString("name");
   14.36 -			Statement stmt2 = conn.createStatement();
   14.37 -			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
   14.38 -			stmt2.close();
   14.39 -		}
   14.40 -		stmt.close();
   14.41 -		
   14.42 -		strabon = new Strabon(databaseName, username, password, port, serverName, true);
   14.43 -		
   14.44 -		loadTestData();
   14.45 +		strabon = TemplateTests.beforeClass("/simple-tests.ntriples");
   14.46  	}
   14.47  	
   14.48  	@AfterClass
   14.49  	public static void afterClass() throws SQLException
   14.50  	{
   14.51 -		strabon.close();
   14.52 +		TemplateTests.afterClass(strabon);
   14.53  	}
   14.54  	
   14.55  //	/**
    15.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/SpatialTests.java	Mon May 21 18:08:17 2012 +0300
    15.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/SpatialTests.java	Mon May 21 18:08:55 2012 +0300
    15.3 @@ -27,13 +27,13 @@
    15.4  	@BeforeClass
    15.5  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
    15.6  	{
    15.7 -	 TemplateTests.beforeClass();
    15.8 +		strabon = TemplateTests.beforeClass("/spatial-tests-srid.nt");
    15.9  	}
   15.10  	
   15.11  	@AfterClass
   15.12  	public static void afterClass() throws SQLException
   15.13  	{
   15.14 -		TemplateTests.afterClass();
   15.15 +		TemplateTests.afterClass(strabon);
   15.16  	}
   15.17  	
   15.18  //	/**
    16.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/TemplateTests.java	Mon May 21 18:08:17 2012 +0300
    16.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/TemplateTests.java	Mon May 21 18:08:55 2012 +0300
    16.3 @@ -2,6 +2,7 @@
    16.4  
    16.5  import java.io.IOException;
    16.6  import java.io.InputStream;
    16.7 +import java.net.URL;
    16.8  import java.sql.DriverManager;
    16.9  import java.sql.ResultSet;
   16.10  import java.sql.SQLException;
   16.11 @@ -15,6 +16,8 @@
   16.12  import org.openrdf.rio.RDFParseException;
   16.13  
   16.14  import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
   16.15 +import eu.earthobservatory.runtime.generaldb.SimpleTests;
   16.16 +import eu.earthobservatory.runtime.generaldb.Strabon;
   16.17  
   16.18  /**
   16.19   * A set of simple tests on SPARQL query functionality 
   16.20 @@ -25,7 +28,7 @@
   16.21  public class TemplateTests extends eu.earthobservatory.runtime.generaldb.SimpleTests {
   16.22  
   16.23  	@BeforeClass
   16.24 -	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   16.25 +	public static Strabon beforeClass(String inputfile) throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   16.26  	{
   16.27  		// Read properties
   16.28  		Properties properties = new Properties();
   16.29 @@ -54,17 +57,26 @@
   16.30  		}
   16.31  		stmt.close();
   16.32  		
   16.33 -		strabon = new Strabon(databaseName, username, password, port, serverName, true);
   16.34 +		Strabon strabon = new eu.earthobservatory.runtime.monetdb.Strabon(databaseName, username, password, port, serverName, true);
   16.35  		
   16.36 -		loadTestData();
   16.37 +		TemplateTests.loadTestData(inputfile, strabon);
   16.38 +		
   16.39 +		return strabon;
   16.40  	}
   16.41  	
   16.42  	@AfterClass
   16.43 -	public static void afterClass() throws SQLException
   16.44 +	public static void afterClass(Strabon strabon) throws SQLException
   16.45  	{
   16.46  		strabon.close();
   16.47  	}
   16.48  	
   16.49 +	protected static void loadTestData(String inputfile, Strabon strabon)
   16.50 +			throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
   16.51 +		{
   16.52 +			URL src = SimpleTests.class.getResource(inputfile);
   16.53 +			strabon.storeInRepo(src, "NTRIPLES");
   16.54 +		}
   16.55 +	
   16.56  //	/**
   16.57  //	 * @throws java.lang.Exception
   16.58  //	 */
   16.59 @@ -98,3 +110,24 @@
   16.60  //		stmt.close();
   16.61  //	}
   16.62  }
   16.63 +//	 */
   16.64 +//	@After
   16.65 +//	public void after()
   16.66 +//		throws Exception
   16.67 +//	{
   16.68 +//		// Clean database
   16.69 +//		Statement stmt = conn.createStatement();
   16.70 +//		ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " +
   16.71 +//						"table_schema='public' and table_name <> 'spatial_ref_sys' " +
   16.72 +//						"and table_name <> 'geometry_columns' and " +
   16.73 +//						"table_name <> 'geography_columns' and table_name <> 'locked'");
   16.74 +//		while (results.next()) {
   16.75 +//			String table_name = results.getString("table_name");
   16.76 +//			Statement stmt2 = conn.createStatement();
   16.77 +//			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
   16.78 +//			stmt2.close();
   16.79 +//		}
   16.80 +//			
   16.81 +//		stmt.close();
   16.82 +//	}
   16.83 +
    17.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/TransformTests.java	Mon May 21 18:08:17 2012 +0300
    17.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/TransformTests.java	Mon May 21 18:08:55 2012 +0300
    17.3 @@ -27,45 +27,13 @@
    17.4  	@BeforeClass
    17.5  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
    17.6  	{
    17.7 -	 TemplateTests.beforeClass();
    17.8 +		strabon = TemplateTests.beforeClass("/transform-tests.nt");
    17.9  	}
   17.10  	
   17.11  	@AfterClass
   17.12  	public static void afterClass() throws SQLException
   17.13  	{
   17.14 -		TemplateTests.afterClass();
   17.15 +		TemplateTests.afterClass(strabon);
   17.16  	}
   17.17  	
   17.18 -//	/**
   17.19 -//	 * @throws java.lang.Exception
   17.20 -//	 */
   17.21 -//	@Before
   17.22 -//	public void before()
   17.23 -//		throws Exception
   17.24 -//	{
   17.25 -//		
   17.26 -//	}
   17.27 -//
   17.28 -//	/**
   17.29 -//	 * @throws java.lang.Exception
   17.30 -//	 */
   17.31 -//	@After
   17.32 -//	public void after()
   17.33 -//		throws Exception
   17.34 -//	{
   17.35 -//		// Clean database
   17.36 -//		Statement stmt = conn.createStatement();
   17.37 -//		ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " +
   17.38 -//						"table_schema='public' and table_name <> 'spatial_ref_sys' " +
   17.39 -//						"and table_name <> 'geometry_columns' and " +
   17.40 -//						"table_name <> 'geography_columns' and table_name <> 'locked'");
   17.41 -//		while (results.next()) {
   17.42 -//			String table_name = results.getString("table_name");
   17.43 -//			Statement stmt2 = conn.createStatement();
   17.44 -//			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
   17.45 -//			stmt2.close();
   17.46 -//		}
   17.47 -//			
   17.48 -//		stmt.close();
   17.49 -//	}
   17.50  }
    18.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/AggregateTests.java	Mon May 21 18:08:17 2012 +0300
    18.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/AggregateTests.java	Mon May 21 18:08:55 2012 +0300
    18.3 @@ -1,12 +1,8 @@
    18.4  package eu.earthobservatory.runtime.postgis;
    18.5  
    18.6  import java.io.IOException;
    18.7 -import java.io.InputStream;
    18.8 -import java.sql.DriverManager;
    18.9 -import java.sql.ResultSet;
   18.10 +import java.net.URL;
   18.11  import java.sql.SQLException;
   18.12 -import java.sql.Statement;
   18.13 -import java.util.Properties;
   18.14  
   18.15  import org.junit.AfterClass;
   18.16  import org.junit.BeforeClass;
   18.17 @@ -16,56 +12,19 @@
   18.18  
   18.19  import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
   18.20  
   18.21 -/**
   18.22 - * A set of simple tests on SPARQL query functionality 
   18.23 - * 
   18.24 - * @author George Garbis
   18.25 - */
   18.26  
   18.27  public class AggregateTests extends eu.earthobservatory.runtime.generaldb.AggregateTests {
   18.28  	
   18.29  	@BeforeClass
   18.30  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   18.31  	{
   18.32 -	 TemplateTests.beforeClass();
   18.33 +		strabon = TemplateTests.beforeClass("/aggregate-tests-srid.nt");
   18.34  	}
   18.35  	
   18.36  	@AfterClass
   18.37  	public static void afterClass() throws SQLException
   18.38  	{
   18.39 -		TemplateTests.afterClass();
   18.40 +		TemplateTests.afterClass(strabon);
   18.41  	}
   18.42  	
   18.43 -//	/**
   18.44 -//	 * @throws java.lang.Exception
   18.45 -//	 */
   18.46 -//	@Before
   18.47 -//	public void before()
   18.48 -//		throws Exception
   18.49 -//	{
   18.50 -//		
   18.51 -//	}
   18.52 -//
   18.53 -//	/**
   18.54 -//	 * @throws java.lang.Exception
   18.55 -//	 */
   18.56 -//	@After
   18.57 -//	public void after()
   18.58 -//		throws Exception
   18.59 -//	{
   18.60 -//		// Clean database
   18.61 -//		Statement stmt = conn.createStatement();
   18.62 -//		ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " +
   18.63 -//						"table_schema='public' and table_name <> 'spatial_ref_sys' " +
   18.64 -//						"and table_name <> 'geometry_columns' and " +
   18.65 -//						"table_name <> 'geography_columns' and table_name <> 'locked'");
   18.66 -//		while (results.next()) {
   18.67 -//			String table_name = results.getString("table_name");
   18.68 -//			Statement stmt2 = conn.createStatement();
   18.69 -//			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
   18.70 -//			stmt2.close();
   18.71 -//		}
   18.72 -//			
   18.73 -//		stmt.close();
   18.74 -//	}
   18.75  }
    19.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java	Mon May 21 18:08:17 2012 +0300
    19.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java	Mon May 21 18:08:55 2012 +0300
    19.3 @@ -2,6 +2,7 @@
    19.4  
    19.5  import java.io.IOException;
    19.6  import java.io.InputStream;
    19.7 +import java.net.URL;
    19.8  import java.sql.DriverManager;
    19.9  import java.sql.ResultSet;
   19.10  import java.sql.SQLException;
   19.11 @@ -27,15 +28,17 @@
   19.12  	@BeforeClass
   19.13  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   19.14  	{
   19.15 -	 TemplateTests.beforeClass();
   19.16 +		strabon = TemplateTests.beforeClass("/more-tests.nt");
   19.17  	}
   19.18  	
   19.19  	@AfterClass
   19.20  	public static void afterClass() throws SQLException
   19.21  	{
   19.22 -		TemplateTests.afterClass();
   19.23 +		TemplateTests.afterClass(strabon);
   19.24  	}
   19.25  	
   19.26 +
   19.27 +	
   19.28  //	/**
   19.29  //	 * @throws java.lang.Exception
   19.30  //	 */
    20.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/HavingTests.java	Mon May 21 18:08:17 2012 +0300
    20.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/HavingTests.java	Mon May 21 18:08:55 2012 +0300
    20.3 @@ -16,56 +16,19 @@
    20.4  
    20.5  import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
    20.6  
    20.7 -/**
    20.8 - * A set of simple tests on SPARQL query functionality 
    20.9 - * 
   20.10 - * @author George Garbis
   20.11 - */
   20.12  
   20.13  public class HavingTests extends eu.earthobservatory.runtime.generaldb.HavingTests {
   20.14  	
   20.15  	@BeforeClass
   20.16  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   20.17  	{
   20.18 -	 TemplateTests.beforeClass();
   20.19 +		strabon = TemplateTests.beforeClass("/having-tests-srid.nt");
   20.20  	}
   20.21  	
   20.22  	@AfterClass
   20.23  	public static void afterClass() throws SQLException
   20.24  	{
   20.25 -		TemplateTests.afterClass();
   20.26 +		TemplateTests.afterClass(strabon);
   20.27  	}
   20.28 -	
   20.29 -//	/**
   20.30 -//	 * @throws java.lang.Exception
   20.31 -//	 */
   20.32 -//	@Before
   20.33 -//	public void before()
   20.34 -//		throws Exception
   20.35 -//	{
   20.36 -//		
   20.37 -//	}
   20.38 -//
   20.39 -//	/**
   20.40 -//	 * @throws java.lang.Exception
   20.41 -//	 */
   20.42 -//	@After
   20.43 -//	public void after()
   20.44 -//		throws Exception
   20.45 -//	{
   20.46 -//		// Clean database
   20.47 -//		Statement stmt = conn.createStatement();
   20.48 -//		ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " +
   20.49 -//						"table_schema='public' and table_name <> 'spatial_ref_sys' " +
   20.50 -//						"and table_name <> 'geometry_columns' and " +
   20.51 -//						"table_name <> 'geography_columns' and table_name <> 'locked'");
   20.52 -//		while (results.next()) {
   20.53 -//			String table_name = results.getString("table_name");
   20.54 -//			Statement stmt2 = conn.createStatement();
   20.55 -//			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
   20.56 -//			stmt2.close();
   20.57 -//		}
   20.58 -//			
   20.59 -//		stmt.close();
   20.60 -//	}
   20.61 +
   20.62  }
    21.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/JoinTests.java	Mon May 21 18:08:17 2012 +0300
    21.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/JoinTests.java	Mon May 21 18:08:55 2012 +0300
    21.3 @@ -2,6 +2,7 @@
    21.4  
    21.5  import java.io.IOException;
    21.6  import java.io.InputStream;
    21.7 +import java.net.URL;
    21.8  import java.sql.DriverManager;
    21.9  import java.sql.ResultSet;
   21.10  import java.sql.SQLException;
   21.11 @@ -16,56 +17,18 @@
   21.12  
   21.13  import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
   21.14  
   21.15 -/**
   21.16 - * A set of simple tests on SPARQL query functionality 
   21.17 - * 
   21.18 - * @author George Garbis
   21.19 - */
   21.20 -
   21.21  public class JoinTests extends eu.earthobservatory.runtime.generaldb.JoinTests {
   21.22  	
   21.23  	@BeforeClass
   21.24  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   21.25  	{
   21.26 -	 TemplateTests.beforeClass();
   21.27 +		strabon = TemplateTests.beforeClass("/join-tests-srid.nt");
   21.28  	}
   21.29  	
   21.30  	@AfterClass
   21.31  	public static void afterClass() throws SQLException
   21.32  	{
   21.33 -		TemplateTests.afterClass();
   21.34 +		TemplateTests.afterClass(strabon);
   21.35  	}
   21.36  	
   21.37 -//	/**
   21.38 -//	 * @throws java.lang.Exception
   21.39 -//	 */
   21.40 -//	@Before
   21.41 -//	public void before()
   21.42 -//		throws Exception
   21.43 -//	{
   21.44 -//		
   21.45 -//	}
   21.46 -//
   21.47 -//	/**
   21.48 -//	 * @throws java.lang.Exception
   21.49 -//	 */
   21.50 -//	@After
   21.51 -//	public void after()
   21.52 -//		throws Exception
   21.53 -//	{
   21.54 -//		// Clean database
   21.55 -//		Statement stmt = conn.createStatement();
   21.56 -//		ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " +
   21.57 -//						"table_schema='public' and table_name <> 'spatial_ref_sys' " +
   21.58 -//						"and table_name <> 'geometry_columns' and " +
   21.59 -//						"table_name <> 'geography_columns' and table_name <> 'locked'");
   21.60 -//		while (results.next()) {
   21.61 -//			String table_name = results.getString("table_name");
   21.62 -//			Statement stmt2 = conn.createStatement();
   21.63 -//			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
   21.64 -//			stmt2.close();
   21.65 -//		}
   21.66 -//			
   21.67 -//		stmt.close();
   21.68 -//	}
   21.69  }
    22.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/MeaningfulAggregateTests.java	Mon May 21 18:08:17 2012 +0300
    22.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/MeaningfulAggregateTests.java	Mon May 21 18:08:55 2012 +0300
    22.3 @@ -2,6 +2,7 @@
    22.4  
    22.5  import java.io.IOException;
    22.6  import java.io.InputStream;
    22.7 +import java.net.URL;
    22.8  import java.sql.DriverManager;
    22.9  import java.sql.ResultSet;
   22.10  import java.sql.SQLException;
   22.11 @@ -16,11 +17,6 @@
   22.12  
   22.13  import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
   22.14  
   22.15 -/**
   22.16 - * A set of simple tests on SPARQL query functionality 
   22.17 - * 
   22.18 - * @author George Garbis
   22.19 - */
   22.20  
   22.21  public class MeaningfulAggregateTests extends eu.earthobservatory.runtime.generaldb.MeaningfulAggregateTests {
   22.22  	
   22.23 @@ -28,13 +24,15 @@
   22.24  	@BeforeClass
   22.25  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   22.26  	{
   22.27 -		TemplateTests.beforeClass();
   22.28 +		strabon = TemplateTests.beforeClass("/grouo-tests-srid.nt");
   22.29  	}
   22.30  	
   22.31  	@AfterClass
   22.32  	public static void afterClass() throws SQLException
   22.33  	{
   22.34 -		TemplateTests.afterClass();
   22.35 +		TemplateTests.afterClass(strabon);
   22.36  	}
   22.37 +
   22.38 +
   22.39  	
   22.40  }
   22.41 \ No newline at end of file
    23.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SPARQL11Tests.java	Mon May 21 18:08:17 2012 +0300
    23.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SPARQL11Tests.java	Mon May 21 18:08:55 2012 +0300
    23.3 @@ -2,6 +2,7 @@
    23.4  
    23.5  import java.io.IOException;
    23.6  import java.io.InputStream;
    23.7 +import java.net.URL;
    23.8  import java.sql.DriverManager;
    23.9  import java.sql.ResultSet;
   23.10  import java.sql.SQLException;
   23.11 @@ -27,15 +28,17 @@
   23.12  	@BeforeClass
   23.13  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   23.14  	{
   23.15 -	 TemplateTests.beforeClass();
   23.16 +		strabon = TemplateTests.beforeClass("/sparql11-tests.nt");
   23.17  	}
   23.18  	
   23.19  	@AfterClass
   23.20  	public static void afterClass() throws SQLException
   23.21  	{
   23.22 -		TemplateTests.afterClass();
   23.23 +		TemplateTests.afterClass(strabon);
   23.24  	}
   23.25  	
   23.26 +	
   23.27 +	
   23.28  //	/**
   23.29  //	 * @throws java.lang.Exception
   23.30  //	 */
    24.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SimpleTests.java	Mon May 21 18:08:17 2012 +0300
    24.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SimpleTests.java	Mon May 21 18:08:55 2012 +0300
    24.3 @@ -1,12 +1,7 @@
    24.4  package eu.earthobservatory.runtime.postgis;
    24.5  
    24.6  import java.io.IOException;
    24.7 -import java.io.InputStream;
    24.8 -import java.sql.DriverManager;
    24.9 -import java.sql.ResultSet;
   24.10  import java.sql.SQLException;
   24.11 -import java.sql.Statement;
   24.12 -import java.util.Properties;
   24.13  
   24.14  import org.junit.AfterClass;
   24.15  import org.junit.BeforeClass;
   24.16 @@ -27,45 +22,13 @@
   24.17  	@BeforeClass
   24.18  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   24.19  	{
   24.20 -		// Read properties
   24.21 -		Properties properties = new Properties();
   24.22 -		InputStream propertiesStream =  SimpleTests.class.getResourceAsStream("/databases.properties");
   24.23 -		properties.load(propertiesStream);
   24.24 -
   24.25 -		serverName = properties.getProperty("postgis.serverName");
   24.26 -		databaseName = properties.getProperty("postgis.databaseName");
   24.27 -		port = Integer.parseInt(properties.getProperty("postgis.port"));
   24.28 -		username = properties.getProperty("postgis.username");
   24.29 -		password = properties.getProperty("postgis.password");
   24.30 -				
   24.31 -		// Connect to database
   24.32 -		Class.forName("org.postgresql.Driver");
   24.33 -		String url = "jdbc:postgresql://"+serverName+":"+port+"/"+databaseName;
   24.34 -		conn = DriverManager.getConnection(url, username, password);
   24.35 -				
   24.36 -//		// Clean database
   24.37 -		Statement stmt = conn.createStatement();
   24.38 -		ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " +
   24.39 -						"table_schema='public' AND table_name <> 'spatial_ref_sys' " +
   24.40 -						"AND table_name <> 'geometry_columns' AND " +
   24.41 -						"table_name <> 'geography_columns' AND table_name <> 'locked'");
   24.42 -		while (results.next()) {
   24.43 -			String table_name = results.getString("table_name");
   24.44 -			Statement stmt2 = conn.createStatement();
   24.45 -			stmt2.executeUpdate("DROP TABLE \""+table_name+"\"");
   24.46 -			stmt2.close();
   24.47 -		}
   24.48 -		stmt.close();
   24.49 -		
   24.50 -	    strabon = new Strabon(databaseName, username, password, port, serverName, true);
   24.51 -		
   24.52 -		loadTestData();
   24.53 +		strabon = TemplateTests.beforeClass("/simple-tests.ntriples");
   24.54  	}
   24.55  	
   24.56  	@AfterClass
   24.57  	public static void afterClass() throws SQLException
   24.58  	{
   24.59 -		strabon.close();
   24.60 +		TemplateTests.afterClass(strabon);
   24.61  	}
   24.62  	
   24.63  //	/**
    25.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SpatialTests.java	Mon May 21 18:08:17 2012 +0300
    25.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SpatialTests.java	Mon May 21 18:08:55 2012 +0300
    25.3 @@ -27,13 +27,13 @@
    25.4  	@BeforeClass
    25.5  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
    25.6  	{
    25.7 -	 TemplateTests.beforeClass();
    25.8 +		strabon = TemplateTests.beforeClass("./spatial-tests-srid.nt");
    25.9  	}
   25.10  	
   25.11  	@AfterClass
   25.12  	public static void afterClass() throws SQLException
   25.13  	{
   25.14 -		TemplateTests.afterClass();
   25.15 +		TemplateTests.afterClass(strabon);
   25.16  	}
   25.17  	
   25.18  //	/**
    26.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/TemplateTests.java	Mon May 21 18:08:17 2012 +0300
    26.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/TemplateTests.java	Mon May 21 18:08:55 2012 +0300
    26.3 @@ -2,6 +2,7 @@
    26.4  
    26.5  import java.io.IOException;
    26.6  import java.io.InputStream;
    26.7 +import java.net.URL;
    26.8  import java.sql.DriverManager;
    26.9  import java.sql.ResultSet;
   26.10  import java.sql.SQLException;
   26.11 @@ -15,6 +16,8 @@
   26.12  import org.openrdf.rio.RDFParseException;
   26.13  
   26.14  import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault;
   26.15 +import eu.earthobservatory.runtime.generaldb.SimpleTests;
   26.16 +import eu.earthobservatory.runtime.generaldb.Strabon;
   26.17  
   26.18  /**
   26.19   * A set of simple tests on SPARQL query functionality 
   26.20 @@ -22,10 +25,20 @@
   26.21   * @author George Garbis
   26.22   */
   26.23  
   26.24 -public class TemplateTests extends eu.earthobservatory.runtime.generaldb.SimpleTests {
   26.25 +public class TemplateTests {
   26.26 +	
   26.27 +	public static java.sql.Connection conn = null;
   26.28 +	public static String databaseName = null; 
   26.29 +
   26.30 +	public static String jdbcDriver = null;
   26.31 +	public static String serverName = null;
   26.32 +	public static String username = null;
   26.33 +	public static String password = null;
   26.34 +	public static Integer port = null;
   26.35  	
   26.36  	@BeforeClass
   26.37 -	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   26.38 +	public static Strabon beforeClass(String inputFile)
   26.39 +		throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
   26.40  	{
   26.41  		// Read properties
   26.42  		Properties properties = new Properties();
   26.43 @@ -57,17 +70,26 @@
   26.44  		}
   26.45  		stmt.close();
   26.46  		
   26.47 -	    strabon = new Strabon(databaseName, username, password, port, serverName, true);
   26.48 +	    Strabon strabon = new eu.earthobservatory.runtime.postgis.Strabon(databaseName, username, password, port, serverName, true);
   26.49  		
   26.50 -		loadTestData();
   26.51 +		loadTestData(inputFile, strabon);
   26.52 +		
   26.53 +		return strabon;
   26.54  	}
   26.55  	
   26.56  	@AfterClass
   26.57 -	public static void afterClass() throws SQLException
   26.58 +	public static void afterClass(Strabon strabon) throws SQLException
   26.59  	{
   26.60  		strabon.close();
   26.61  	}
   26.62  	
   26.63 +	protected static void loadTestData(String inputfile, Strabon strabon)
   26.64 +		throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault
   26.65 +	{
   26.66 +		URL src = SimpleTests.class.getResource(inputfile);
   26.67 +		strabon.storeInRepo(src, "NTRIPLES");
   26.68 +	}
   26.69 +	
   26.70  //	/**
   26.71  //	 * @throws java.lang.Exception
   26.72  //	 */
    27.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/TransformTests.java	Mon May 21 18:08:17 2012 +0300
    27.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/TransformTests.java	Mon May 21 18:08:55 2012 +0300
    27.3 @@ -27,13 +27,13 @@
    27.4  	@BeforeClass
    27.5  	public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
    27.6  	{
    27.7 -	 TemplateTests.beforeClass();
    27.8 +		strabon = TemplateTests.beforeClass("/transform-tests.nt");
    27.9  	}
   27.10  	
   27.11  	@AfterClass
   27.12  	public static void afterClass() throws SQLException
   27.13  	{
   27.14 -		TemplateTests.afterClass();
   27.15 +		TemplateTests.afterClass(strabon);
   27.16  	}
   27.17  	
   27.18  //	/**