Strabon
changeset 160:8863c960e1f0
added monetdb tests and updated the rest
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/printNTriples Fri May 18 15:17:02 2012 +0300 1.3 @@ -0,0 +1,13 @@ 1.4 +#! /bin/bash 1.5 + 1.6 +input=$1 1.7 + 1.8 +if [ "$input" == "" ]; then 1.9 + echo "give database name" 1.10 + exit -1 1.11 +fi 1.12 + 1.13 +fgrep '[s=' $input \ 1.14 +| sed 's/\[s=\(.*\);o=\(.*\);p=\(.*\)\]/\1 \3 \2;/g' \ 1.15 +| sed 's/\(http:\/\/[^ >]*\)\([ ;]\)/<\1>\2/g' \ 1.16 +| sed 's/;/./g'
2.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SpatialTests.java Fri May 18 13:08:57 2012 +0300 2.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SpatialTests.java Fri May 18 15:17:02 2012 +0300 2.3 @@ -19,6 +19,14 @@ 2.4 2.5 public class SpatialTests { 2.6 public static Strabon strabon; 2.7 + 2.8 + protected static String jdbcDriver= "org.postgresql.Driver"; 2.9 + protected static String serverName = "localhost"; 2.10 + protected static String username = "postgres"; 2.11 + protected static String password = "postgres"; 2.12 + protected static Integer port = 5432; 2.13 + protected static java.sql.Connection conn = null; 2.14 + protected static String databaseName = null; 2.15 2.16 public String STRDF_NS = "http://strdf.di.uoa.gr/ontology#", 2.17 EX_NS = "http://example.org/",
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/AggregateTests.java Fri May 18 15:17:02 2012 +0300 3.3 @@ -0,0 +1,100 @@ 3.4 +package eu.earthobservatory.runtime.monetdb; 3.5 + 3.6 +import java.io.IOException; 3.7 +import java.io.InputStream; 3.8 +import java.sql.DriverManager; 3.9 +import java.sql.ResultSet; 3.10 +import java.sql.SQLException; 3.11 +import java.sql.Statement; 3.12 +import java.util.Properties; 3.13 + 3.14 +import org.junit.AfterClass; 3.15 +import org.junit.BeforeClass; 3.16 +import org.openrdf.repository.RepositoryException; 3.17 +import org.openrdf.rio.RDFHandlerException; 3.18 +import org.openrdf.rio.RDFParseException; 3.19 + 3.20 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault; 3.21 + 3.22 +/** 3.23 + * A set of simple tests on SPARQL query functionality 3.24 + * 3.25 + * @author George Garbis 3.26 + */ 3.27 + 3.28 +public class AggregateTests extends eu.earthobservatory.runtime.generaldb.AggregateTests { 3.29 + 3.30 + @BeforeClass 3.31 + public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 3.32 + { 3.33 + // Read properties 3.34 + Properties properties = new Properties(); 3.35 + InputStream propertiesStream = TemplateTests.class.getResourceAsStream("/databases.properties"); 3.36 + properties.load(propertiesStream); 3.37 + 3.38 + serverName = properties.getProperty("monetdb.serverName"); 3.39 + databaseName = properties.getProperty("monetdb.databaseName"); 3.40 + port = Integer.parseInt(properties.getProperty("monetdb.port")); 3.41 + username = properties.getProperty("monetdb.username"); 3.42 + password = properties.getProperty("monetdb.password"); 3.43 + 3.44 + // Connect to database 3.45 + Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); 3.46 + String url = "jdbc:monetdb://"+serverName+":"+port+"/"+databaseName; 3.47 + conn = DriverManager.getConnection(url, username, password); 3.48 + 3.49 +// // Clean database 3.50 + Statement stmt = conn.createStatement(); 3.51 + ResultSet results = stmt.executeQuery("SELECT name FROM tables WHERE system=false AND name <> 'locked'"); 3.52 + while (results.next()) { 3.53 + String table_name = results.getString("name"); 3.54 + Statement stmt2 = conn.createStatement(); 3.55 + stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 3.56 + stmt2.close(); 3.57 + } 3.58 + stmt.close(); 3.59 + 3.60 + strabon = new Strabon(databaseName, username, password, port, serverName, true); 3.61 + 3.62 + loadTestData(); 3.63 + } 3.64 + 3.65 + @AfterClass 3.66 + public static void afterClass() throws SQLException 3.67 + { 3.68 + strabon.close(); 3.69 + } 3.70 + 3.71 +// /** 3.72 +// * @throws java.lang.Exception 3.73 +// */ 3.74 +// @Before 3.75 +// public void before() 3.76 +// throws Exception 3.77 +// { 3.78 +// 3.79 +// } 3.80 +// 3.81 +// /** 3.82 +// * @throws java.lang.Exception 3.83 +// */ 3.84 +// @After 3.85 +// public void after() 3.86 +// throws Exception 3.87 +// { 3.88 +// // Clean database 3.89 +// Statement stmt = conn.createStatement(); 3.90 +// ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " + 3.91 +// "table_schema='public' and table_name <> 'spatial_ref_sys' " + 3.92 +// "and table_name <> 'geometry_columns' and " + 3.93 +// "table_name <> 'geography_columns' and table_name <> 'locked'"); 3.94 +// while (results.next()) { 3.95 +// String table_name = results.getString("table_name"); 3.96 +// Statement stmt2 = conn.createStatement(); 3.97 +// stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 3.98 +// stmt2.close(); 3.99 +// } 3.100 +// 3.101 +// stmt.close(); 3.102 +// } 3.103 +}
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 4.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/GeneralTests.java Fri May 18 15:17:02 2012 +0300 4.3 @@ -0,0 +1,71 @@ 4.4 +package eu.earthobservatory.runtime.monetdb; 4.5 + 4.6 +import java.io.IOException; 4.7 +import java.io.InputStream; 4.8 +import java.sql.DriverManager; 4.9 +import java.sql.ResultSet; 4.10 +import java.sql.SQLException; 4.11 +import java.sql.Statement; 4.12 +import java.util.Properties; 4.13 + 4.14 +import org.junit.AfterClass; 4.15 +import org.junit.BeforeClass; 4.16 +import org.openrdf.repository.RepositoryException; 4.17 +import org.openrdf.rio.RDFHandlerException; 4.18 +import org.openrdf.rio.RDFParseException; 4.19 + 4.20 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault; 4.21 + 4.22 +/** 4.23 + * A set of simple tests on SPARQL query functionality 4.24 + * 4.25 + * @author George Garbis 4.26 + */ 4.27 + 4.28 +public class GeneralTests extends eu.earthobservatory.runtime.generaldb.GeneralTests { 4.29 + 4.30 + @BeforeClass 4.31 + public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 4.32 + { 4.33 + TemplateTests.beforeClass(); 4.34 + } 4.35 + 4.36 + @AfterClass 4.37 + public static void afterClass() throws SQLException 4.38 + { 4.39 + TemplateTests.afterClass(); 4.40 + } 4.41 + 4.42 +// /** 4.43 +// * @throws java.lang.Exception 4.44 +// */ 4.45 +// @Before 4.46 +// public void before() 4.47 +// throws Exception 4.48 +// { 4.49 +// 4.50 +// } 4.51 +// 4.52 +// /** 4.53 +// * @throws java.lang.Exception 4.54 +// */ 4.55 +// @After 4.56 +// public void after() 4.57 +// throws Exception 4.58 +// { 4.59 +// // Clean database 4.60 +// Statement stmt = conn.createStatement(); 4.61 +// ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " + 4.62 +// "table_schema='public' and table_name <> 'spatial_ref_sys' " + 4.63 +// "and table_name <> 'geometry_columns' and " + 4.64 +// "table_name <> 'geography_columns' and table_name <> 'locked'"); 4.65 +// while (results.next()) { 4.66 +// String table_name = results.getString("table_name"); 4.67 +// Statement stmt2 = conn.createStatement(); 4.68 +// stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 4.69 +// stmt2.close(); 4.70 +// } 4.71 +// 4.72 +// stmt.close(); 4.73 +// } 4.74 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/HavingTests.java Fri May 18 15:17:02 2012 +0300 5.3 @@ -0,0 +1,71 @@ 5.4 +package eu.earthobservatory.runtime.monetdb; 5.5 + 5.6 +import java.io.IOException; 5.7 +import java.io.InputStream; 5.8 +import java.sql.DriverManager; 5.9 +import java.sql.ResultSet; 5.10 +import java.sql.SQLException; 5.11 +import java.sql.Statement; 5.12 +import java.util.Properties; 5.13 + 5.14 +import org.junit.AfterClass; 5.15 +import org.junit.BeforeClass; 5.16 +import org.openrdf.repository.RepositoryException; 5.17 +import org.openrdf.rio.RDFHandlerException; 5.18 +import org.openrdf.rio.RDFParseException; 5.19 + 5.20 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault; 5.21 + 5.22 +/** 5.23 + * A set of simple tests on SPARQL query functionality 5.24 + * 5.25 + * @author George Garbis 5.26 + */ 5.27 + 5.28 +public class HavingTests extends eu.earthobservatory.runtime.generaldb.HavingTests { 5.29 + 5.30 + @BeforeClass 5.31 + public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 5.32 + { 5.33 + TemplateTests.beforeClass(); 5.34 + } 5.35 + 5.36 + @AfterClass 5.37 + public static void afterClass() throws SQLException 5.38 + { 5.39 + TemplateTests.afterClass(); 5.40 + } 5.41 + 5.42 +// /** 5.43 +// * @throws java.lang.Exception 5.44 +// */ 5.45 +// @Before 5.46 +// public void before() 5.47 +// throws Exception 5.48 +// { 5.49 +// 5.50 +// } 5.51 +// 5.52 +// /** 5.53 +// * @throws java.lang.Exception 5.54 +// */ 5.55 +// @After 5.56 +// public void after() 5.57 +// throws Exception 5.58 +// { 5.59 +// // Clean database 5.60 +// Statement stmt = conn.createStatement(); 5.61 +// ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " + 5.62 +// "table_schema='public' and table_name <> 'spatial_ref_sys' " + 5.63 +// "and table_name <> 'geometry_columns' and " + 5.64 +// "table_name <> 'geography_columns' and table_name <> 'locked'"); 5.65 +// while (results.next()) { 5.66 +// String table_name = results.getString("table_name"); 5.67 +// Statement stmt2 = conn.createStatement(); 5.68 +// stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 5.69 +// stmt2.close(); 5.70 +// } 5.71 +// 5.72 +// stmt.close(); 5.73 +// } 5.74 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 6.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/JoinTests.java Fri May 18 15:17:02 2012 +0300 6.3 @@ -0,0 +1,100 @@ 6.4 +package eu.earthobservatory.runtime.monetdb; 6.5 + 6.6 +import java.io.IOException; 6.7 +import java.io.InputStream; 6.8 +import java.sql.DriverManager; 6.9 +import java.sql.ResultSet; 6.10 +import java.sql.SQLException; 6.11 +import java.sql.Statement; 6.12 +import java.util.Properties; 6.13 + 6.14 +import org.junit.AfterClass; 6.15 +import org.junit.BeforeClass; 6.16 +import org.openrdf.repository.RepositoryException; 6.17 +import org.openrdf.rio.RDFHandlerException; 6.18 +import org.openrdf.rio.RDFParseException; 6.19 + 6.20 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault; 6.21 + 6.22 +/** 6.23 + * A set of simple tests on SPARQL query functionality 6.24 + * 6.25 + * @author George Garbis 6.26 + */ 6.27 + 6.28 +public class JoinTests extends eu.earthobservatory.runtime.generaldb.JoinTests { 6.29 + 6.30 + @BeforeClass 6.31 + public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 6.32 + { 6.33 + // Read properties 6.34 + Properties properties = new Properties(); 6.35 + InputStream propertiesStream = TemplateTests.class.getResourceAsStream("/databases.properties"); 6.36 + properties.load(propertiesStream); 6.37 + 6.38 + serverName = properties.getProperty("monetdb.serverName"); 6.39 + databaseName = properties.getProperty("monetdb.databaseName"); 6.40 + port = Integer.parseInt(properties.getProperty("monetdb.port")); 6.41 + username = properties.getProperty("monetdb.username"); 6.42 + password = properties.getProperty("monetdb.password"); 6.43 + 6.44 + // Connect to database 6.45 + Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); 6.46 + String url = "jdbc:monetdb://"+serverName+":"+port+"/"+databaseName; 6.47 + conn = DriverManager.getConnection(url, username, password); 6.48 + 6.49 +// // Clean database 6.50 + Statement stmt = conn.createStatement(); 6.51 + ResultSet results = stmt.executeQuery("SELECT name FROM tables WHERE system=false AND name <> 'locked'"); 6.52 + while (results.next()) { 6.53 + String table_name = results.getString("name"); 6.54 + Statement stmt2 = conn.createStatement(); 6.55 + stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 6.56 + stmt2.close(); 6.57 + } 6.58 + stmt.close(); 6.59 + 6.60 + strabon = new Strabon(databaseName, username, password, port, serverName, true); 6.61 + 6.62 + loadTestData(); 6.63 + } 6.64 + 6.65 + @AfterClass 6.66 + public static void afterClass() throws SQLException 6.67 + { 6.68 + strabon.close(); 6.69 + } 6.70 + 6.71 +// /** 6.72 +// * @throws java.lang.Exception 6.73 +// */ 6.74 +// @Before 6.75 +// public void before() 6.76 +// throws Exception 6.77 +// { 6.78 +// 6.79 +// } 6.80 +// 6.81 +// /** 6.82 +// * @throws java.lang.Exception 6.83 +// */ 6.84 +// @After 6.85 +// public void after() 6.86 +// throws Exception 6.87 +// { 6.88 +// // Clean database 6.89 +// Statement stmt = conn.createStatement(); 6.90 +// ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " + 6.91 +// "table_schema='public' and table_name <> 'spatial_ref_sys' " + 6.92 +// "and table_name <> 'geometry_columns' and " + 6.93 +// "table_name <> 'geography_columns' and table_name <> 'locked'"); 6.94 +// while (results.next()) { 6.95 +// String table_name = results.getString("table_name"); 6.96 +// Statement stmt2 = conn.createStatement(); 6.97 +// stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 6.98 +// stmt2.close(); 6.99 +// } 6.100 +// 6.101 +// stmt.close(); 6.102 +// } 6.103 +}
7.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 7.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/MeaningfulAggregateTests.java Fri May 18 15:17:02 2012 +0300 7.3 @@ -0,0 +1,71 @@ 7.4 +package eu.earthobservatory.runtime.monetdb; 7.5 + 7.6 +import java.io.IOException; 7.7 +import java.io.InputStream; 7.8 +import java.sql.DriverManager; 7.9 +import java.sql.ResultSet; 7.10 +import java.sql.SQLException; 7.11 +import java.sql.Statement; 7.12 +import java.util.Properties; 7.13 + 7.14 +import org.junit.AfterClass; 7.15 +import org.junit.BeforeClass; 7.16 +import org.openrdf.repository.RepositoryException; 7.17 +import org.openrdf.rio.RDFHandlerException; 7.18 +import org.openrdf.rio.RDFParseException; 7.19 + 7.20 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault; 7.21 + 7.22 +/** 7.23 + * A set of simple tests on SPARQL query functionality 7.24 + * 7.25 + * @author George Garbis 7.26 + */ 7.27 + 7.28 +public class MeaningfulAggregateTests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 7.29 + 7.30 + @BeforeClass 7.31 + public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 7.32 + { 7.33 + TemplateTests.beforeClass(); 7.34 + } 7.35 + 7.36 + @AfterClass 7.37 + public static void afterClass() throws SQLException 7.38 + { 7.39 + TemplateTests.afterClass(); 7.40 + } 7.41 + 7.42 +// /** 7.43 +// * @throws java.lang.Exception 7.44 +// */ 7.45 +// @Before 7.46 +// public void before() 7.47 +// throws Exception 7.48 +// { 7.49 +// 7.50 +// } 7.51 +// 7.52 +// /** 7.53 +// * @throws java.lang.Exception 7.54 +// */ 7.55 +// @After 7.56 +// public void after() 7.57 +// throws Exception 7.58 +// { 7.59 +// // Clean database 7.60 +// Statement stmt = conn.createStatement(); 7.61 +// ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " + 7.62 +// "table_schema='public' and table_name <> 'spatial_ref_sys' " + 7.63 +// "and table_name <> 'geometry_columns' and " + 7.64 +// "table_name <> 'geography_columns' and table_name <> 'locked'"); 7.65 +// while (results.next()) { 7.66 +// String table_name = results.getString("table_name"); 7.67 +// Statement stmt2 = conn.createStatement(); 7.68 +// stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 7.69 +// stmt2.close(); 7.70 +// } 7.71 +// 7.72 +// stmt.close(); 7.73 +// } 7.74 +}
8.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 8.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/SpatialTests.java Fri May 18 15:17:02 2012 +0300 8.3 @@ -0,0 +1,71 @@ 8.4 +package eu.earthobservatory.runtime.monetdb; 8.5 + 8.6 +import java.io.IOException; 8.7 +import java.io.InputStream; 8.8 +import java.sql.DriverManager; 8.9 +import java.sql.ResultSet; 8.10 +import java.sql.SQLException; 8.11 +import java.sql.Statement; 8.12 +import java.util.Properties; 8.13 + 8.14 +import org.junit.AfterClass; 8.15 +import org.junit.BeforeClass; 8.16 +import org.openrdf.repository.RepositoryException; 8.17 +import org.openrdf.rio.RDFHandlerException; 8.18 +import org.openrdf.rio.RDFParseException; 8.19 + 8.20 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault; 8.21 + 8.22 +/** 8.23 + * A set of simple tests on SPARQL query functionality 8.24 + * 8.25 + * @author George Garbis 8.26 + */ 8.27 + 8.28 +public class SpatialTests extends eu.earthobservatory.runtime.generaldb.SpatialTests { 8.29 + 8.30 + @BeforeClass 8.31 + public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 8.32 + { 8.33 + TemplateTests.beforeClass(); 8.34 + } 8.35 + 8.36 + @AfterClass 8.37 + public static void afterClass() throws SQLException 8.38 + { 8.39 + TemplateTests.afterClass(); 8.40 + } 8.41 + 8.42 +// /** 8.43 +// * @throws java.lang.Exception 8.44 +// */ 8.45 +// @Before 8.46 +// public void before() 8.47 +// throws Exception 8.48 +// { 8.49 +// 8.50 +// } 8.51 +// 8.52 +// /** 8.53 +// * @throws java.lang.Exception 8.54 +// */ 8.55 +// @After 8.56 +// public void after() 8.57 +// throws Exception 8.58 +// { 8.59 +// // Clean database 8.60 +// Statement stmt = conn.createStatement(); 8.61 +// ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " + 8.62 +// "table_schema='public' and table_name <> 'spatial_ref_sys' " + 8.63 +// "and table_name <> 'geometry_columns' and " + 8.64 +// "table_name <> 'geography_columns' and table_name <> 'locked'"); 8.65 +// while (results.next()) { 8.66 +// String table_name = results.getString("table_name"); 8.67 +// Statement stmt2 = conn.createStatement(); 8.68 +// stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 8.69 +// stmt2.close(); 8.70 +// } 8.71 +// 8.72 +// stmt.close(); 8.73 +// } 8.74 +}
9.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 9.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/TemplateTests.java Fri May 18 15:17:02 2012 +0300 9.3 @@ -0,0 +1,100 @@ 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 +import org.openrdf.repository.RepositoryException; 9.17 +import org.openrdf.rio.RDFHandlerException; 9.18 +import org.openrdf.rio.RDFParseException; 9.19 + 9.20 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault; 9.21 + 9.22 +/** 9.23 + * A set of simple tests on SPARQL query functionality 9.24 + * 9.25 + * @author George Garbis 9.26 + */ 9.27 + 9.28 +public class TemplateTests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 9.29 + 9.30 + @BeforeClass 9.31 + public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 9.32 + { 9.33 + // Read properties 9.34 + Properties properties = new Properties(); 9.35 + InputStream propertiesStream = TemplateTests.class.getResourceAsStream("/databases.properties"); 9.36 + properties.load(propertiesStream); 9.37 + 9.38 + serverName = properties.getProperty("monetdb.serverName"); 9.39 + databaseName = properties.getProperty("monetdb.databaseName"); 9.40 + port = Integer.parseInt(properties.getProperty("monetdb.port")); 9.41 + username = properties.getProperty("monetdb.username"); 9.42 + password = properties.getProperty("monetdb.password"); 9.43 + 9.44 + // Connect to database 9.45 + Class.forName("nl.cwi.monetdb.jdbc.MonetDriver"); 9.46 + String url = "jdbc:monetdb://"+serverName+":"+port+"/"+databaseName; 9.47 + conn = DriverManager.getConnection(url, username, password); 9.48 + 9.49 +// // Clean database 9.50 + Statement stmt = conn.createStatement(); 9.51 + ResultSet results = stmt.executeQuery("SELECT name FROM tables WHERE system=false AND name <> 'locked'"); 9.52 + while (results.next()) { 9.53 + String table_name = results.getString("name"); 9.54 + Statement stmt2 = conn.createStatement(); 9.55 + stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 9.56 + stmt2.close(); 9.57 + } 9.58 + stmt.close(); 9.59 + 9.60 + strabon = new Strabon(databaseName, username, password, port, serverName, true); 9.61 + 9.62 + loadTestData(); 9.63 + } 9.64 + 9.65 + @AfterClass 9.66 + public static void afterClass() throws SQLException 9.67 + { 9.68 + strabon.close(); 9.69 + } 9.70 + 9.71 +// /** 9.72 +// * @throws java.lang.Exception 9.73 +// */ 9.74 +// @Before 9.75 +// public void before() 9.76 +// throws Exception 9.77 +// { 9.78 +// 9.79 +// } 9.80 +// 9.81 +// /** 9.82 +// * @throws java.lang.Exception 9.83 +// */ 9.84 +// @After 9.85 +// public void after() 9.86 +// throws Exception 9.87 +// { 9.88 +// // Clean database 9.89 +// Statement stmt = conn.createStatement(); 9.90 +// ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " + 9.91 +// "table_schema='public' and table_name <> 'spatial_ref_sys' " + 9.92 +// "and table_name <> 'geometry_columns' and " + 9.93 +// "table_name <> 'geography_columns' and table_name <> 'locked'"); 9.94 +// while (results.next()) { 9.95 +// String table_name = results.getString("table_name"); 9.96 +// Statement stmt2 = conn.createStatement(); 9.97 +// stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 9.98 +// stmt2.close(); 9.99 +// } 9.100 +// 9.101 +// stmt.close(); 9.102 +// } 9.103 +}
10.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 10.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/TransformTests.java Fri May 18 15:17:02 2012 +0300 10.3 @@ -0,0 +1,71 @@ 10.4 +package eu.earthobservatory.runtime.monetdb; 10.5 + 10.6 +import java.io.IOException; 10.7 +import java.io.InputStream; 10.8 +import java.sql.DriverManager; 10.9 +import java.sql.ResultSet; 10.10 +import java.sql.SQLException; 10.11 +import java.sql.Statement; 10.12 +import java.util.Properties; 10.13 + 10.14 +import org.junit.AfterClass; 10.15 +import org.junit.BeforeClass; 10.16 +import org.openrdf.repository.RepositoryException; 10.17 +import org.openrdf.rio.RDFHandlerException; 10.18 +import org.openrdf.rio.RDFParseException; 10.19 + 10.20 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault; 10.21 + 10.22 +/** 10.23 + * A set of simple tests on SPARQL query functionality 10.24 + * 10.25 + * @author George Garbis 10.26 + */ 10.27 + 10.28 +public class TransformTests extends eu.earthobservatory.runtime.generaldb.TransformTests { 10.29 + 10.30 + @BeforeClass 10.31 + public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 10.32 + { 10.33 + TemplateTests.beforeClass(); 10.34 + } 10.35 + 10.36 + @AfterClass 10.37 + public static void afterClass() throws SQLException 10.38 + { 10.39 + TemplateTests.afterClass(); 10.40 + } 10.41 + 10.42 +// /** 10.43 +// * @throws java.lang.Exception 10.44 +// */ 10.45 +// @Before 10.46 +// public void before() 10.47 +// throws Exception 10.48 +// { 10.49 +// 10.50 +// } 10.51 +// 10.52 +// /** 10.53 +// * @throws java.lang.Exception 10.54 +// */ 10.55 +// @After 10.56 +// public void after() 10.57 +// throws Exception 10.58 +// { 10.59 +// // Clean database 10.60 +// Statement stmt = conn.createStatement(); 10.61 +// ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " + 10.62 +// "table_schema='public' and table_name <> 'spatial_ref_sys' " + 10.63 +// "and table_name <> 'geometry_columns' and " + 10.64 +// "table_name <> 'geography_columns' and table_name <> 'locked'"); 10.65 +// while (results.next()) { 10.66 +// String table_name = results.getString("table_name"); 10.67 +// Statement stmt2 = conn.createStatement(); 10.68 +// stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 10.69 +// stmt2.close(); 10.70 +// } 10.71 +// 10.72 +// stmt.close(); 10.73 +// } 10.74 +}
11.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/AggregateTests.java Fri May 18 13:08:57 2012 +0300 11.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/AggregateTests.java Fri May 18 15:17:02 2012 +0300 11.3 @@ -22,7 +22,7 @@ 11.4 * @author George Garbis 11.5 */ 11.6 11.7 -public class AggregateTests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 11.8 +public class AggregateTests extends eu.earthobservatory.runtime.generaldb.AggregateTests { 11.9 11.10 @BeforeClass 11.11 public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
12.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java Fri May 18 13:08:57 2012 +0300 12.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/GeneralTests.java Fri May 18 15:17:02 2012 +0300 12.3 @@ -22,7 +22,7 @@ 12.4 * @author George Garbis 12.5 */ 12.6 12.7 -public class GeneralTests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 12.8 +public class GeneralTests extends eu.earthobservatory.runtime.generaldb.GeneralTests { 12.9 12.10 @BeforeClass 12.11 public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
13.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/HavingTests.java Fri May 18 13:08:57 2012 +0300 13.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/HavingTests.java Fri May 18 15:17:02 2012 +0300 13.3 @@ -22,7 +22,7 @@ 13.4 * @author George Garbis 13.5 */ 13.6 13.7 -public class HavingTests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 13.8 +public class HavingTests extends eu.earthobservatory.runtime.generaldb.HavingTests { 13.9 13.10 @BeforeClass 13.11 public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
14.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/JoinTests.java Fri May 18 13:08:57 2012 +0300 14.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/JoinTests.java Fri May 18 15:17:02 2012 +0300 14.3 @@ -22,7 +22,7 @@ 14.4 * @author George Garbis 14.5 */ 14.6 14.7 -public class JoinTests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 14.8 +public class JoinTests extends eu.earthobservatory.runtime.generaldb.JoinTests { 14.9 14.10 @BeforeClass 14.11 public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
15.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/MeaningfulAggregateTests.java Fri May 18 13:08:57 2012 +0300 15.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/MeaningfulAggregateTests.java Fri May 18 15:17:02 2012 +0300 15.3 @@ -22,7 +22,7 @@ 15.4 * @author George Garbis 15.5 */ 15.6 15.7 -public class MeaningfulAggregateTests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 15.8 +public class MeaningfulAggregateTests extends eu.earthobservatory.runtime.generaldb.MeaningfulAggregateTests { 15.9 15.10 15.11 @BeforeClass
16.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SPARQL11Tests.java Fri May 18 13:08:57 2012 +0300 16.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SPARQL11Tests.java Fri May 18 15:17:02 2012 +0300 16.3 @@ -22,7 +22,7 @@ 16.4 * @author George Garbis 16.5 */ 16.6 16.7 -public class SPARQL11Tests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 16.8 +public class SPARQL11Tests extends eu.earthobservatory.runtime.generaldb.SPARQL11Tests { 16.9 16.10 @BeforeClass 16.11 public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault
17.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SpatialTests.java Fri May 18 13:08:57 2012 +0300 17.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SpatialTests.java Fri May 18 15:17:02 2012 +0300 17.3 @@ -1,113 +1,71 @@ 17.4 package eu.earthobservatory.runtime.postgis; 17.5 17.6 -import static org.junit.Assert.assertEquals; 17.7 -import static org.junit.Assert.assertTrue; 17.8 +import java.io.IOException; 17.9 +import java.io.InputStream; 17.10 +import java.sql.DriverManager; 17.11 +import java.sql.ResultSet; 17.12 +import java.sql.SQLException; 17.13 +import java.sql.Statement; 17.14 +import java.util.Properties; 17.15 17.16 -import java.io.IOException; 17.17 -import java.sql.SQLException; 17.18 -import java.util.ArrayList; 17.19 +import org.junit.AfterClass; 17.20 +import org.junit.BeforeClass; 17.21 +import org.openrdf.repository.RepositoryException; 17.22 +import org.openrdf.rio.RDFHandlerException; 17.23 +import org.openrdf.rio.RDFParseException; 17.24 17.25 -import org.junit.BeforeClass; 17.26 -import org.junit.Test; 17.27 -import org.openrdf.query.MalformedQueryException; 17.28 -import org.openrdf.query.QueryEvaluationException; 17.29 -import org.openrdf.query.TupleQueryResultHandlerException; 17.30 +import eu.earthobservatory.runtime.generaldb.InvalidDatasetFormatFault; 17.31 17.32 -import eu.earthobservatory.runtime.postgis.Strabon; 17.33 +/** 17.34 + * A set of simple tests on SPARQL query functionality 17.35 + * 17.36 + * @author George Garbis 17.37 + */ 17.38 17.39 public class SpatialTests extends eu.earthobservatory.runtime.generaldb.SpatialTests { 17.40 - 17.41 + 17.42 @BeforeClass 17.43 - public static void initialize() throws SQLException, ClassNotFoundException 17.44 + public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 17.45 { 17.46 - strabon = new Strabon("spatial-tests-srid","strabon","p1r3as", 5432, "strabon.di.uoa.gr", true); 17.47 + TemplateTests.beforeClass(); 17.48 } 17.49 17.50 - @Test 17.51 - public void testStrdfLeft() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException 17.52 - { // TODO left not implemented in monetdb 17.53 - String query = 17.54 - prefixes+ 17.55 - "SELECT DISTINCT ?id1 \n"+ 17.56 - "WHERE { \n" + 17.57 - " ?s1 ex:id ?id1 . \n"+ 17.58 - " ?s2 ex:id ?id2 . \n"+ 17.59 - " FILTER( str(?id1) != str(?id2) ) . \n"+ 17.60 - " FILTER( str(?id2) = \"Z\"^^xsd:string ) . \n"+ 17.61 - " ?s2 ex:geometry ?g2 . \n" + 17.62 - " ?s1 ex:geometry ?g1 . \n"+ 17.63 - " FILTER( strdf:left(?g1, ?g2 )) . \n"+ 17.64 - "}"; 17.65 - 17.66 - ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection()); 17.67 - 17.68 - assertEquals(1, bindings.size()); 17.69 - assertTrue(-1<bindings.indexOf("[id1=\"A\"^^<http://www.w3.org/2001/XMLSchema#string>]")); 17.70 + @AfterClass 17.71 + public static void afterClass() throws SQLException 17.72 + { 17.73 + TemplateTests.afterClass(); 17.74 } 17.75 17.76 - @Test 17.77 - public void testStrdfRight() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException 17.78 - { // TODO right not implemented in monetdb 17.79 - String query = 17.80 - prefixes+ 17.81 - "SELECT DISTINCT ?id1 \n"+ 17.82 - "WHERE { \n" + 17.83 - " ?s1 ex:id ?id1 . \n"+ 17.84 - " ?s2 ex:id ?id2 . \n"+ 17.85 - " FILTER( str(?id1) != str(?id2) ) . \n"+ 17.86 - " FILTER( str(?id2) = \"Z\"^^xsd:string ) . \n"+ 17.87 - " ?s2 ex:geometry ?g2 . \n" + 17.88 - " ?s1 ex:geometry ?g1 . \n"+ 17.89 - " FILTER( strdf:right(?g1, ?g2 )) . \n"+ 17.90 - "}"; 17.91 - 17.92 - ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection()); 17.93 - 17.94 - assertEquals(1, bindings.size()); 17.95 - assertTrue(-1<bindings.indexOf("[id1=\"D\"^^<http://www.w3.org/2001/XMLSchema#string>]")); 17.96 - } 17.97 - 17.98 - @Test 17.99 - public void testStrdfAbove() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException 17.100 - { // TODO above not implemented in monetdb 17.101 - String query = 17.102 - prefixes+ 17.103 - "SELECT DISTINCT ?id1 \n"+ 17.104 - "WHERE { \n" + 17.105 - " ?s1 ex:id ?id1 . \n"+ 17.106 - " ?s2 ex:id ?id2 . \n"+ 17.107 - " FILTER( str(?id1) != str(?id2) ) . \n"+ 17.108 - " FILTER( str(?id2) = \"Z\"^^xsd:string ) . \n"+ 17.109 - " ?s2 ex:geometry ?g2 . \n" + 17.110 - " ?s1 ex:geometry ?g1 . \n"+ 17.111 - " FILTER( strdf:above(?g1, ?g2 )) . \n"+ 17.112 - "}"; 17.113 - 17.114 - ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection()); 17.115 - 17.116 - assertEquals(1, bindings.size()); 17.117 - assertTrue(-1<bindings.indexOf("[id1=\"H\"^^<http://www.w3.org/2001/XMLSchema#string>]")); 17.118 - } 17.119 - 17.120 - @Test 17.121 - public void testStrdfBelow() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException 17.122 - { // TODO below not implemented in monetdb 17.123 - String query = 17.124 - prefixes+ 17.125 - "SELECT DISTINCT ?id1 \n"+ 17.126 - "WHERE { \n" + 17.127 - " ?s1 ex:id ?id1 . \n"+ 17.128 - " ?s2 ex:id ?id2 . \n"+ 17.129 - " FILTER( str(?id1) != str(?id2) ) . \n"+ 17.130 - " FILTER( str(?id2) = \"Z\"^^xsd:string ) . \n"+ 17.131 - " ?s2 ex:geometry ?g2 . \n" + 17.132 - " ?s1 ex:geometry ?g1 . \n"+ 17.133 - " FILTER( strdf:below(?g1, ?g2 )) . \n"+ 17.134 - "}"; 17.135 - 17.136 - ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection()); 17.137 - 17.138 - assertEquals(1, bindings.size()); 17.139 - assertTrue(-1<bindings.indexOf("[id1=\"C\"^^<http://www.w3.org/2001/XMLSchema#string>]")); 17.140 - } 17.141 +// /** 17.142 +// * @throws java.lang.Exception 17.143 +// */ 17.144 +// @Before 17.145 +// public void before() 17.146 +// throws Exception 17.147 +// { 17.148 +// 17.149 +// } 17.150 +// 17.151 +// /** 17.152 +// * @throws java.lang.Exception 17.153 +// */ 17.154 +// @After 17.155 +// public void after() 17.156 +// throws Exception 17.157 +// { 17.158 +// // Clean database 17.159 +// Statement stmt = conn.createStatement(); 17.160 +// ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " + 17.161 +// "table_schema='public' and table_name <> 'spatial_ref_sys' " + 17.162 +// "and table_name <> 'geometry_columns' and " + 17.163 +// "table_name <> 'geography_columns' and table_name <> 'locked'"); 17.164 +// while (results.next()) { 17.165 +// String table_name = results.getString("table_name"); 17.166 +// Statement stmt2 = conn.createStatement(); 17.167 +// stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 17.168 +// stmt2.close(); 17.169 +// } 17.170 +// 17.171 +// stmt.close(); 17.172 +// } 17.173 }
18.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/TransformTests.java Fri May 18 13:08:57 2012 +0300 18.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/TransformTests.java Fri May 18 15:17:02 2012 +0300 18.3 @@ -22,7 +22,7 @@ 18.4 * @author George Garbis 18.5 */ 18.6 18.7 -public class TransformTests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 18.8 +public class TransformTests extends eu.earthobservatory.runtime.generaldb.TransformTests { 18.9 18.10 @BeforeClass 18.11 public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault