Strabon

changeset 974:f658d2b036d9

Checked if the results of the query are the right.
author Panayiotis Smeros <psmeros@di.uoa.gr>
date Wed Apr 03 20:35:45 2013 +0300 (2013-04-03)
parents fd5c334c7fa8
children 11e81ae216cb
files testsuite/src/test/java/eu/earthobservatory/runtime/postgis/TestStore.java
line diff
     1.1 --- a/testsuite/src/test/java/eu/earthobservatory/runtime/postgis/TestStore.java	Wed Apr 03 20:19:14 2013 +0300
     1.2 +++ b/testsuite/src/test/java/eu/earthobservatory/runtime/postgis/TestStore.java	Wed Apr 03 20:35:45 2013 +0300
     1.3 @@ -9,6 +9,7 @@
     1.4   */
     1.5  package eu.earthobservatory.runtime.postgis;
     1.6  
     1.7 +import static org.junit.Assert.assertTrue;
     1.8  import java.io.*;
     1.9  import java.sql.SQLException;
    1.10  import java.util.ArrayList;
    1.11 @@ -43,25 +44,25 @@
    1.12  	@Test
    1.13  	public void test() throws IOException, MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException
    1.14  	{
    1.15 -		BufferedReader reader = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream(queryFile)));
    1.16 +		BufferedReader queryReader = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream(queryFile)));
    1.17 +		BufferedReader resultsReader = new BufferedReader(new InputStreamReader(this.getClass().getResourceAsStream(resultsFile)));
    1.18  		String query="";
    1.19  		
    1.20 -		while (reader.ready()) 
    1.21 +		while (queryReader.ready()) 
    1.22  		{
    1.23 -			query+=reader.readLine()+"\n";
    1.24 +			query+=queryReader.readLine()+"\n";
    1.25  		}
    1.26  
    1.27  		ArrayList<String> bindings = (ArrayList<String>) strabon.query(query,strabon.getSailRepoConnection());
    1.28 -		ArrayList<String> queryResults = new ArrayList<String>();
    1.29  		
    1.30  		Iterator<String> iterator = bindings.iterator();
    1.31 -		while(iterator.hasNext())
    1.32 +		while(iterator.hasNext() && resultsReader.ready())
    1.33  		{
    1.34  			String binding = iterator.next();
    1.35 -			System.out.println(binding);
    1.36 +			//System.out.println(binding);
    1.37  			binding=binding.replaceAll("[[A-Z][a-z][0-9]]*=", "?=");
    1.38 -			queryResults.add(binding);
    1.39 -			System.out.println(binding);
    1.40 +			assertTrue(resultsReader.readLine().equals(binding));
    1.41 +			//System.out.println(binding);
    1.42  		}
    1.43  
    1.44  	}