Strabon

changeset 1429:6c9d1293752a

added dependency of Strabon to testsuite and strabon-endpoint-client (in main pom.xml)
author Babis Nikolaou <charnik@di.uoa.gr>
date Fri Sep 26 16:05:57 2014 +0300 (2014-09-26)
parents c3c98bd8540d
children b3b5eb3ca804
files endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SPARQLEndpoint.java pom.xml testsuite/pom.xml testsuite/src/test/java/eu/earthobservatory/testsuite/utils/Utils.java
line diff
     1.1 --- a/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SPARQLEndpoint.java	Thu Sep 25 20:02:41 2014 +0300
     1.2 +++ b/endpoint-client/src/main/java/eu/earthobservatory/org/StrabonEndpoint/client/SPARQLEndpoint.java	Fri Sep 26 16:05:57 2014 +0300
     1.3 @@ -154,9 +154,8 @@
     1.4  	 * @return <code>true</code> if store was successful, <code>false</code> otherwise
     1.5  	 * @throws IOException 
     1.6  	 */
     1.7 -	
     1.8  	public boolean store(String data, RDFFormat format, URL namedGraph) throws IOException {
     1.9 -assert(format != null);
    1.10 +		assert(format != null);
    1.11  		
    1.12  		// create a post method to execute
    1.13  		HttpPost method = new HttpPost(getConnectionURL());
     2.1 --- a/pom.xml	Thu Sep 25 20:02:41 2014 +0300
     2.2 +++ b/pom.xml	Fri Sep 26 16:05:57 2014 +0300
     2.3 @@ -249,12 +249,24 @@
     2.4  				<artifactId>strabon-endpoint</artifactId>
     2.5  				<version>${eu.earthobservatory.version}</version>
     2.6  			</dependency>
     2.7 +			
     2.8 +			<dependency>
     2.9 +				<groupId>org.openrdf.sesame</groupId>
    2.10 +				<artifactId>strabon-endpoint-client</artifactId>
    2.11 +				<version>${eu.earthobservatory.version}</version>
    2.12 +			</dependency>
    2.13  
    2.14  			<dependency>
    2.15  				<groupId>eu.earthobservatory</groupId>
    2.16  				<artifactId>strabon-vocabulary</artifactId>
    2.17  				<version>${eu.earthobservatory.version}</version>
    2.18  			</dependency>
    2.19 +			
    2.20 +			<dependency>
    2.21 +				<groupId>eu.earthobservatory</groupId>
    2.22 +				<artifactId>strabon-testsuite</artifactId>
    2.23 +				<version>${eu.earthobservatory.version}</version>
    2.24 +			</dependency>
    2.25  
    2.26  			<dependency>
    2.27  				<groupId>org.openrdf.sesame</groupId>
     3.1 --- a/testsuite/pom.xml	Thu Sep 25 20:02:41 2014 +0300
     3.2 +++ b/testsuite/pom.xml	Fri Sep 26 16:05:57 2014 +0300
     3.3 @@ -19,7 +19,7 @@
     3.4  			<groupId>eu.earthobservatory</groupId>
     3.5  			<artifactId>strabon-runtime</artifactId>
     3.6  		</dependency>
     3.7 -
     3.8 + 
     3.9  		<!-- Testing: JUnit -->
    3.10  		<dependency>
    3.11  			<groupId>junit</groupId>
     4.1 --- a/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/Utils.java	Thu Sep 25 20:02:41 2014 +0300
     4.2 +++ b/testsuite/src/test/java/eu/earthobservatory/testsuite/utils/Utils.java	Fri Sep 26 16:05:57 2014 +0300
     4.3 @@ -143,21 +143,28 @@
     4.4  	}
     4.5  	
     4.6  	
     4.7 -	public static void testQuery(String queryFile, String resultsFile,boolean orderOn) throws IOException, MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, URISyntaxException, QueryResultParseException, UnsupportedQueryResultFormatException
     4.8 +	public static void testQuery(String queryFile, String resultsFile, boolean orderOn) throws IOException, MalformedQueryException, QueryEvaluationException, TupleQueryResultHandlerException, URISyntaxException, QueryResultParseException, UnsupportedQueryResultFormatException
     4.9  	{
    4.10  		ByteArrayOutputStream resultsStream = new ByteArrayOutputStream();
    4.11  		String query = FileUtils.readFileToString(new File(Utils.class.getResource(prefixesFile).toURI()))+"\n"+FileUtils.readFileToString(new File(Utils.class.getResource(queryFile).toURI()));
    4.12  		
    4.13  		//Pose the query
    4.14  		strabon.query(query, Format.XML, strabon.getSailRepoConnection(), resultsStream);
    4.15 -
    4.16 +		
    4.17  		//Check if the results of the query are the expected
    4.18 -		TupleQueryResult expectedResults = QueryResultIO.parse(Utils.class.getResourceAsStream(resultsFile), TupleQueryResultFormat.SPARQL);
    4.19 -		TupleQueryResult actualResults = QueryResultIO.parse((new ByteArrayInputStream(resultsStream.toByteArray())), TupleQueryResultFormat.SPARQL);
    4.20 -
    4.21 +		compareResults(queryFile, orderOn, 
    4.22 +					   QueryResultIO.parse(Utils.class.getResourceAsStream(resultsFile), TupleQueryResultFormat.SPARQL),
    4.23 +					   QueryResultIO.parse((new ByteArrayInputStream(resultsStream.toByteArray())), TupleQueryResultFormat.SPARQL));
    4.24 +	}
    4.25 +	
    4.26 +	protected static void compareResults(String queryFile, boolean orderOn, 
    4.27 +															 TupleQueryResult expectedResults, 
    4.28 +															 TupleQueryResult actualResults) throws QueryEvaluationException {
    4.29 +		
    4.30  		List<String> eBindingNames = expectedResults.getBindingNames();
    4.31  		List<String> aBindingNames = actualResults.getBindingNames();
    4.32 -		assertTrue("Results are not the expected. QueryFile: "+queryFile, aBindingNames.containsAll(aBindingNames) && eBindingNames.containsAll(aBindingNames));		
    4.33 +		
    4.34 +		assertTrue("Results are not the expected. QueryFile: " + queryFile, aBindingNames.containsAll(aBindingNames) && eBindingNames.containsAll(aBindingNames));		
    4.35  		
    4.36  		//Sort each binding's values
    4.37  		List<String> eBindingList = new ArrayList<String>();