Strabon
changeset 155:1c755c037ade
Complete SimpleTests
author | George Garbis <ggarbis@di.uoa.gr> |
---|---|
date | Thu May 17 19:44:48 2012 +0300 (2012-05-17) |
parents | aaba72872423 |
children | af51dd4c3c37 |
files | runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SimpleTests.java runtime/src/test/java/eu/earthobservatory/runtime/monetdb/SimpleTests.java runtime/src/test/java/eu/earthobservatory/runtime/postgis/SimpleTests.java runtime/src/test/resources/databases.properties |
line diff
1.1 --- a/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java Thu May 17 18:04:12 2012 +0300 1.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/GeneralTests.java Thu May 17 19:44:48 2012 +0300 1.3 @@ -50,11 +50,11 @@ 1.4 conn.close(); 1.5 } 1.6 protected static void loadTestData() 1.7 - throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault 1.8 - { 1.9 - URL src = SimpleTests.class.getResource("/simple-tests.ntriples"); 1.10 - strabon.storeInRepo(src, "NTRIPLES"); 1.11 - } 1.12 + throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault 1.13 + { 1.14 + URL src = SimpleTests.class.getResource("/simple-tests.ntriples"); 1.15 + strabon.storeInRepo(src, "NTRIPLES"); 1.16 + } 1.17 1.18 1.19
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 2.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/generaldb/SimpleTests.java Thu May 17 19:44:48 2012 +0300 2.3 @@ -0,0 +1,134 @@ 2.4 +package eu.earthobservatory.runtime.generaldb; 2.5 + 2.6 +import static org.junit.Assert.assertEquals; 2.7 +import static org.junit.Assert.assertTrue; 2.8 + 2.9 +import java.io.IOException; 2.10 +import java.net.URL; 2.11 +import java.util.ArrayList; 2.12 + 2.13 +import org.junit.Test; 2.14 +import org.openrdf.model.vocabulary.RDF; 2.15 +import org.openrdf.model.vocabulary.XMLSchema; 2.16 +import org.openrdf.query.MalformedQueryException; 2.17 +import org.openrdf.query.QueryEvaluationException; 2.18 +import org.openrdf.query.TupleQueryResultHandlerException; 2.19 +import org.openrdf.repository.RepositoryException; 2.20 +import org.openrdf.rio.RDFHandlerException; 2.21 +import org.openrdf.rio.RDFParseException; 2.22 + 2.23 +import eu.earthobservatory.runtime.generaldb.Strabon; 2.24 + 2.25 +/** 2.26 + * A set of simple tests on SPARQL query functionality 2.27 + * 2.28 + * @author George Garbis 2.29 + */ 2.30 + 2.31 +public class SimpleTests { 2.32 + 2.33 + protected static Strabon strabon; 2.34 + 2.35 + protected static java.sql.Connection conn = null; 2.36 + protected static String databaseName = null; 2.37 + 2.38 + protected static String jdbcDriver = null; 2.39 + protected static String serverName = null; 2.40 + protected static String username = null; 2.41 + protected static String password = null; 2.42 + protected static Integer port = null; 2.43 + 2.44 + protected static final String 2.45 + STRDF_NS = "http://strdf.di.uoa.gr/ontology#", 2.46 + EX_NS = "http://example.org/", 2.47 + NOA_NS = "http://teleios.di.uoa.gr/ontologies/noaOntology.owl#"; 2.48 + 2.49 + 2.50 + protected static final String prefixes = 2.51 + "PREFIX rdf: <"+RDF.NAMESPACE+"> \n" + 2.52 + "PREFIX strdf: <"+STRDF_NS+"> \n" + 2.53 + "PREFIX xsd: <"+XMLSchema.NAMESPACE+"> \n" + 2.54 + "PREFIX ex: <"+EX_NS+"> \n" + 2.55 + "PREFIX noa: <"+NOA_NS+"> \n"; 2.56 + 2.57 + protected static void loadTestData() 2.58 + throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault 2.59 + { 2.60 + URL src = SimpleTests.class.getResource("/simple-tests.ntriples"); 2.61 + strabon.storeInRepo(src, "NTRIPLES"); 2.62 + } 2.63 + 2.64 + @Test 2.65 + public void testSimpleFilter() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, QueryEvaluationException 2.66 + { 2.67 + 2.68 + String query = 2.69 + prefixes+ 2.70 + "SELECT ?id "+ 2.71 + "WHERE { "+ 2.72 + "?s ex:id ?id . "+ 2.73 + "?s ex:value ?value . "+ 2.74 + "FILTER( ?id<2 ) . " + 2.75 + "}"; 2.76 + 2.77 + @SuppressWarnings("unchecked") 2.78 + ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection()); 2.79 + 2.80 + assertEquals(1, bindings.size()); 2.81 + assertTrue(-1<bindings.indexOf("[id=\"1\"^^<http://www.w3.org/2001/XMLSchema#int>]")); 2.82 + } 2.83 + 2.84 + @Test 2.85 + public void testMatchLiteralWithWKTType() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, QueryEvaluationException 2.86 + { 2.87 + String query = 2.88 + prefixes+ 2.89 + "SELECT ?s2 "+ 2.90 + "WHERE { "+ 2.91 + " ?s2 noa:hasGeometry \"POINT(1 0)\"^^strdf:WKT . "+ 2.92 + "}"; 2.93 + 2.94 + @SuppressWarnings("unchecked") 2.95 + ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection()); 2.96 + 2.97 + assertEquals(1, bindings.size()); 2.98 + assertTrue(-1<bindings.indexOf("[s2=http://example.org/item1]")); 2.99 + } 2.100 + 2.101 + @Test 2.102 + public void testComplexFilter() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, QueryEvaluationException 2.103 + { 2.104 + 2.105 + String query = 2.106 + prefixes+ 2.107 + "SELECT ?s ?id "+ 2.108 + "WHERE { "+ 2.109 + "?s ex:id ?id . "+ 2.110 + "FILTER( ?id>20 || ?id<2 ) . " + 2.111 + "}"; 2.112 + 2.113 + @SuppressWarnings("unchecked") 2.114 + ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection()); 2.115 + 2.116 + assertEquals(1, bindings.size()); 2.117 + assertTrue(-1<bindings.indexOf("[id=\"1\"^^<http://www.w3.org/2001/XMLSchema#int>;s=http://example.org/item1]")); 2.118 + } 2.119 + 2.120 + @Test 2.121 + public void testNotExistingPredicate() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, QueryEvaluationException 2.122 + { 2.123 + 2.124 + String query = 2.125 + prefixes+ 2.126 + "SELECT ?s ?o "+ 2.127 + "WHERE { "+ 2.128 + "?s ex:notExisting ?o . "+ 2.129 + "}"; 2.130 + 2.131 + @SuppressWarnings("unchecked") 2.132 + ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection()); 2.133 + 2.134 + assertEquals(0, bindings.size()); 2.135 + } 2.136 + 2.137 +}
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 3.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/monetdb/SimpleTests.java Thu May 17 19:44:48 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 SimpleTests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 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 = SimpleTests.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 --- a/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SimpleTests.java Thu May 17 18:04:12 2012 +0300 4.2 +++ b/runtime/src/test/java/eu/earthobservatory/runtime/postgis/SimpleTests.java Thu May 17 19:44:48 2012 +0300 4.3 @@ -1,27 +1,15 @@ 4.4 package eu.earthobservatory.runtime.postgis; 4.5 4.6 -import static org.junit.Assert.assertEquals; 4.7 -import static org.junit.Assert.assertTrue; 4.8 - 4.9 import java.io.IOException; 4.10 -import java.net.URL; 4.11 -import java.sql.Date; 4.12 +import java.io.InputStream; 4.13 import java.sql.DriverManager; 4.14 import java.sql.ResultSet; 4.15 import java.sql.SQLException; 4.16 import java.sql.Statement; 4.17 -import java.util.ArrayList; 4.18 +import java.util.Properties; 4.19 4.20 -import org.junit.After; 4.21 import org.junit.AfterClass; 4.22 -import org.junit.Before; 4.23 import org.junit.BeforeClass; 4.24 -import org.junit.Test; 4.25 -import org.openrdf.model.vocabulary.RDF; 4.26 -import org.openrdf.model.vocabulary.XMLSchema; 4.27 -import org.openrdf.query.MalformedQueryException; 4.28 -import org.openrdf.query.QueryEvaluationException; 4.29 -import org.openrdf.query.TupleQueryResultHandlerException; 4.30 import org.openrdf.repository.RepositoryException; 4.31 import org.openrdf.rio.RDFHandlerException; 4.32 import org.openrdf.rio.RDFParseException; 4.33 @@ -34,52 +22,42 @@ 4.34 * @author George Garbis 4.35 */ 4.36 4.37 -public class SimpleTests { 4.38 - 4.39 - private static Strabon strabon; 4.40 - 4.41 - private static String jdbcDriver= "org.postgresql.Driver"; 4.42 - private static String serverName = "localhost"; 4.43 - private static String username = "postgres"; 4.44 - private static String password = "postgres"; 4.45 - private static Integer port = 5432; 4.46 - private static java.sql.Connection conn = null; 4.47 - private static String databaseName = null; 4.48 - 4.49 - protected static final String 4.50 - STRDF_NS = "http://strdf.di.uoa.gr/ontology#", 4.51 - EX_NS = "http://example.org/", 4.52 - NOA_NS = "http://teleios.di.uoa.gr/ontologies/noaOntology.owl#"; 4.53 - 4.54 - 4.55 - protected static final String prefixes = 4.56 - "PREFIX rdf: <"+RDF.NAMESPACE+"> \n" + 4.57 - "PREFIX strdf: <"+STRDF_NS+"> \n" + 4.58 - "PREFIX xsd: <"+XMLSchema.NAMESPACE+"> \n" + 4.59 - "PREFIX ex: <"+EX_NS+"> \n" + 4.60 - "PREFIX noa: <"+NOA_NS+"> \n"; 4.61 +public class SimpleTests extends eu.earthobservatory.runtime.generaldb.SimpleTests { 4.62 4.63 @BeforeClass 4.64 public static void beforeClass() throws SQLException, ClassNotFoundException, RDFParseException, RepositoryException, RDFHandlerException, IOException, InvalidDatasetFormatFault 4.65 { 4.66 - // Create database 4.67 - Date date = new Date(0); 4.68 - databaseName = "strabon-test-"+date.getTime(); 4.69 - Class.forName(jdbcDriver); 4.70 - String url = "jdbc:postgresql://"+serverName+":"+port+"/template1"; 4.71 + // Read properties 4.72 + Properties properties = new Properties(); 4.73 + InputStream propertiesStream = SimpleTests.class.getResourceAsStream("/databases.properties"); 4.74 + properties.load(propertiesStream); 4.75 + 4.76 + serverName = properties.getProperty("postgis.serverName"); 4.77 + databaseName = properties.getProperty("postgis.databaseName"); 4.78 + port = Integer.parseInt(properties.getProperty("postgis.port")); 4.79 + username = properties.getProperty("postgis.username"); 4.80 + password = properties.getProperty("postgis.password"); 4.81 + 4.82 + // Connect to database 4.83 + Class.forName("org.postgresql.Driver"); 4.84 + String url = "jdbc:postgresql://"+serverName+":"+port+"/"+databaseName; 4.85 conn = DriverManager.getConnection(url, username, password); 4.86 + 4.87 +// // Clean database 4.88 Statement stmt = conn.createStatement(); 4.89 - String sql = "CREATE DATABASE \""+databaseName+"\" WITH TEMPLATE = template_postgis"; 4.90 - stmt.executeUpdate(sql); 4.91 - stmt.close(); 4.92 - conn.close(); 4.93 + ResultSet results = stmt.executeQuery("SELECT table_name FROM information_schema.tables WHERE " + 4.94 + "table_schema='public' AND table_name <> 'spatial_ref_sys' " + 4.95 + "AND table_name <> 'geometry_columns' AND " + 4.96 + "table_name <> 'geography_columns' AND table_name <> 'locked'"); 4.97 + while (results.next()) { 4.98 + String table_name = results.getString("table_name"); 4.99 + Statement stmt2 = conn.createStatement(); 4.100 + stmt2.executeUpdate("DROP TABLE \""+table_name+"\""); 4.101 + stmt2.close(); 4.102 + } 4.103 + stmt.close(); 4.104 4.105 - // Connect to database 4.106 - url = "jdbc:postgresql://"+serverName+":"+port+"/"+databaseName; 4.107 - System.out.println("open database"); 4.108 - conn = DriverManager.getConnection(url, username, password); 4.109 - 4.110 - strabon = new Strabon(databaseName,"postgres","postgres", 5432, "localhost", true); 4.111 + strabon = new Strabon(databaseName, username, password, port, serverName, true); 4.112 4.113 loadTestData(); 4.114 } 4.115 @@ -88,13 +66,6 @@ 4.116 public static void afterClass() throws SQLException 4.117 { 4.118 strabon.close(); 4.119 - 4.120 - conn.close(); 4.121 - String url = "jdbc:postgresql://"+serverName+":"+port+"/template1"; 4.122 - conn = DriverManager.getConnection(url, username, password); 4.123 - Statement stmt = conn.createStatement(); 4.124 - stmt.executeUpdate("DROP DATABASE \""+databaseName+"\""); 4.125 - conn.close(); 4.126 } 4.127 4.128 // /** 4.129 @@ -129,224 +100,4 @@ 4.130 // 4.131 // stmt.close(); 4.132 // } 4.133 - 4.134 - @Test 4.135 - public void testSimpleFilter() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, QueryEvaluationException 4.136 - { 4.137 - 4.138 - String query = 4.139 - prefixes+ 4.140 - "SELECT ?id "+ 4.141 - "WHERE { "+ 4.142 - "?s ex:id ?id . "+ 4.143 - "?s ex:value ?value . "+ 4.144 - "FILTER( ?id<2 ) . " + 4.145 - "}"; 4.146 - 4.147 - @SuppressWarnings("unchecked") 4.148 - ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection()); 4.149 - 4.150 - assertEquals(1, bindings.size()); 4.151 - assertTrue(-1<bindings.indexOf("[id=\"1\"^^<http://www.w3.org/2001/XMLSchema#int>]")); 4.152 - } 4.153 - 4.154 - @Test 4.155 - public void testMatchLiteralWithWKTType() throws MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, IOException, QueryEvaluationException 4.156 - { 4.157 - String query = 4.158 - prefixes+ 4.159 - "SELECT ?s2 "+ 4.160 - "WHERE { "+ 4.161 - " ?s2 noa:hasGeometry \"POINT(1 0)\"^^strdf:WKT . "+ 4.162 - "}"; 4.163 - 4.164 - ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection()); 4.165 - 4.166 - assertEquals(1, bindings.size()); 4.167 - assertTrue(-1<bindings.indexOf("[s2=http://example.org/item1]")); 4.168 - } 4.169 - 4.170 -// @Test 4.171 -// public void testGroupConcatDistinct() { 4.172 -// StringBuilder query = new StringBuilder(); 4.173 -// query.append(getNamespaceDeclarations()); 4.174 -// query.append("SELECT (GROUP_CONCAT(DISTINCT ?l) AS ?concat)"); 4.175 -// query.append("WHERE { ex:groupconcat-test ?p ?l . }"); 4.176 -// 4.177 -// TupleQuery tq = null; 4.178 -// try { 4.179 -// tq = conn.prepareTupleQuery(QueryLanguage.SPARQL, query.toString()); 4.180 -// } 4.181 -// catch (RepositoryException e) { 4.182 -// e.printStackTrace(); 4.183 -// fail(e.getMessage()); 4.184 -// } 4.185 -// 4.186 -// catch (MalformedQueryException e) { 4.187 -// e.printStackTrace(); 4.188 -// fail(e.getMessage()); 4.189 -// } 4.190 -// 4.191 -// try { 4.192 -// TupleQueryResult result = tq.evaluate(); 4.193 -// assertNotNull(result); 4.194 -// 4.195 -// while (result.hasNext()) { 4.196 -// BindingSet bs = result.next(); 4.197 -// assertNotNull(bs); 4.198 -// 4.199 -// Value concat = bs.getValue("concat"); 4.200 -// 4.201 -// assertTrue(concat instanceof Literal); 4.202 -// 4.203 -// String lexValue = ((Literal)concat).getLabel(); 4.204 -// 4.205 -// int occ = countCharOccurrences(lexValue, 'a'); 4.206 -// assertEquals(1, occ); 4.207 -// occ = countCharOccurrences(lexValue, 'b'); 4.208 -// assertEquals(1, occ); 4.209 -// occ = countCharOccurrences(lexValue, 'c'); 4.210 -// assertEquals(1, occ); 4.211 -// occ = countCharOccurrences(lexValue, 'd'); 4.212 -// assertEquals(1, occ); 4.213 -// } 4.214 -// result.close(); 4.215 -// } 4.216 -// catch (QueryEvaluationException e) { 4.217 -// e.printStackTrace(); 4.218 -// fail(e.getMessage()); 4.219 -// } 4.220 -// 4.221 -// } 4.222 -// 4.223 -// @Test 4.224 -// public void testPropertyPathInTree() { 4.225 -// StringBuilder query = new StringBuilder(); 4.226 -// query.append(getNamespaceDeclarations()); 4.227 -// query.append(" SELECT ?node ?name "); 4.228 -// query.append(" FROM ex:tree-graph "); 4.229 -// query.append(" WHERE { ?node ex:hasParent+ ex:b . ?node ex:name ?name . }"); 4.230 -// 4.231 -// TupleQuery tq = null; 4.232 -// try { 4.233 -// tq = conn.prepareTupleQuery(QueryLanguage.SPARQL, query.toString()); 4.234 -// } 4.235 -// catch (RepositoryException e) { 4.236 -// e.printStackTrace(); 4.237 -// fail(e.getMessage()); 4.238 -// } 4.239 -// catch (MalformedQueryException e) { 4.240 -// e.printStackTrace(); 4.241 -// fail(e.getMessage()); 4.242 -// } 4.243 -// 4.244 -// try { 4.245 -// TupleQueryResult result = tq.evaluate(); 4.246 -// assertNotNull(result); 4.247 -// 4.248 -// while (result.hasNext()) { 4.249 -// BindingSet bs = result.next(); 4.250 -// assertNotNull(bs); 4.251 -// 4.252 -// System.out.println(bs); 4.253 -// 4.254 -// } 4.255 -// result.close(); 4.256 -// } 4.257 -// catch (QueryEvaluationException e) { 4.258 -// e.printStackTrace(); 4.259 -// fail(e.getMessage()); 4.260 -// } 4.261 -// 4.262 -// } 4.263 -// 4.264 -// @Test 4.265 -// public void testGroupConcatNonDistinct() { 4.266 -// StringBuilder query = new StringBuilder(); 4.267 -// query.append(getNamespaceDeclarations()); 4.268 -// query.append("SELECT (GROUP_CONCAT(?l) AS ?concat)"); 4.269 -// query.append("WHERE { ex:groupconcat-test ?p ?l . }"); 4.270 -// 4.271 -// TupleQuery tq = null; 4.272 -// try { 4.273 -// tq = conn.prepareTupleQuery(QueryLanguage.SPARQL, query.toString()); 4.274 -// } 4.275 -// catch (RepositoryException e) { 4.276 -// e.printStackTrace(); 4.277 -// fail(e.getMessage()); 4.278 -// } 4.279 -// 4.280 -// catch (MalformedQueryException e) { 4.281 -// e.printStackTrace(); 4.282 -// fail(e.getMessage()); 4.283 -// } 4.284 -// 4.285 -// try { 4.286 -// TupleQueryResult result = tq.evaluate(); 4.287 -// assertNotNull(result); 4.288 -// 4.289 -// while (result.hasNext()) { 4.290 -// BindingSet bs = result.next(); 4.291 -// assertNotNull(bs); 4.292 -// 4.293 -// Value concat = bs.getValue("concat"); 4.294 -// 4.295 -// assertTrue(concat instanceof Literal); 4.296 -// 4.297 -// String lexValue = ((Literal)concat).getLabel(); 4.298 -// 4.299 -// int occ = countCharOccurrences(lexValue, 'a'); 4.300 -// assertEquals(1, occ); 4.301 -// occ = countCharOccurrences(lexValue, 'b'); 4.302 -// assertEquals(2, occ); 4.303 -// occ = countCharOccurrences(lexValue, 'c'); 4.304 -// assertEquals(2, occ); 4.305 -// occ = countCharOccurrences(lexValue, 'd'); 4.306 -// assertEquals(1, occ); 4.307 -// } 4.308 -// result.close(); 4.309 -// } 4.310 -// catch (QueryEvaluationException e) { 4.311 -// e.printStackTrace(); 4.312 -// fail(e.getMessage()); 4.313 -// } 4.314 -// 4.315 -// } 4.316 -// 4.317 -// private int countCharOccurrences(String string, char ch) { 4.318 -// int count = 0; 4.319 -// for (int i = 0; i < string.length(); i++) { 4.320 -// if (string.charAt(i) == ch) { 4.321 -// count++; 4.322 -// } 4.323 -// } 4.324 -// return count; 4.325 -// } 4.326 -// 4.327 -// /** 4.328 -// * Get a set of useful namespace prefix declarations. 4.329 -// * 4.330 -// * @return namespace prefix declarations for rdf, rdfs, dc, foaf and ex. 4.331 -// */ 4.332 -// protected String getNamespaceDeclarations() { 4.333 -// StringBuilder declarations = new StringBuilder(); 4.334 -// declarations.append("PREFIX rdf: <" + RDF.NAMESPACE + "> \n"); 4.335 -// declarations.append("PREFIX rdfs: <" + RDFS.NAMESPACE + "> \n"); 4.336 -// declarations.append("PREFIX dc: <" + DC.NAMESPACE + "> \n"); 4.337 -// declarations.append("PREFIX foaf: <" + FOAF.NAMESPACE + "> \n"); 4.338 -// declarations.append("PREFIX ex: <" + EX_NS + "> \n"); 4.339 -// declarations.append("\n"); 4.340 -// 4.341 -// return declarations.toString(); 4.342 -// } 4.343 -// 4.344 -// protected abstract Repository newRepository() 4.345 -// throws Exception; 4.346 - 4.347 - protected static void loadTestData() 4.348 - throws RDFParseException, RepositoryException, IOException, RDFHandlerException, InvalidDatasetFormatFault 4.349 - { 4.350 - URL src = SimpleTests.class.getResource("/simple-tests.ntriples"); 4.351 - strabon.storeInRepo(src, "NTRIPLES"); 4.352 - } 4.353 }
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 5.2 +++ b/runtime/src/test/resources/databases.properties Thu May 17 19:44:48 2012 +0300 5.3 @@ -0,0 +1,13 @@ 5.4 +# PostGIS 5.5 +postgis.databaseName = strabon-test 5.6 +postgis.serverName = localhost 5.7 +postgis.username = postgres 5.8 +postgis.password = postgres 5.9 +postgis.port = 5432 5.10 + 5.11 +! MonetDB 5.12 +monetdb.databaseName = strabon-test 5.13 +monetdb.serverName = localhost 5.14 +monetdb.username = monetdb 5.15 +monetdb.password = monetdb 5.16 +monetdb.port = 50000