Strabon

changeset 1021:bc46378b62b3

removed luna endpoints from tests in strabon-endpoint-client (replaced them with endpoints of linkedopendata and dbpedia)
author Kallirroi Dogani <kallirroi@di.uoa.gr>
date Thu Apr 11 10:47:31 2013 +0300 (2013-04-11)
parents 0e7f541cad34
children b536de0c36b7 e34e39809c55
files endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestLimit.java endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithParliament.java endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithVirtuoso.java endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSpatialEndpoint.java
line diff
     1.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestLimit.java	Tue Apr 09 02:27:21 2013 +0300
     1.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestLimit.java	Thu Apr 11 10:47:31 2013 +0300
     1.3 @@ -23,7 +23,7 @@
     1.4  // */
     1.5  //public class TestLimit {
     1.6  //
     1.7 -//	private StrabonEndpoint endpoint; 
     1.8 +//	private SPARQLEndpoint endpoint; 
     1.9  //	private String [] testQueries;
    1.10  //	private stSPARQLQueryResultFormat format;			
    1.11  //	
    1.12 @@ -31,7 +31,7 @@
    1.13  //	public void init() {
    1.14  //		
    1.15  //		// initialize endpoint		
    1.16 -//		endpoint = new StrabonEndpoint("localhost", 8080, "strabon-endpoint");		
    1.17 +//		endpoint = new SPARQLEndpoint("localhost", 8080, "strabon-endpoint/Query");		
    1.18  //		testQueries = new String[6];
    1.19  //		
    1.20  //		 // set queries
     2.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithParliament.java	Tue Apr 09 02:27:21 2013 +0300
     2.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithParliament.java	Thu Apr 11 10:47:31 2013 +0300
     2.3 @@ -1,75 +1,75 @@
     2.4 -/* This Source Code Form is subject to the terms of the Mozilla Public
     2.5 - * License, v. 2.0. If a copy of the MPL was not distributed with this
     2.6 - * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     2.7 - * 
     2.8 - * Copyright (C) 2013, Pyravlos Team
     2.9 - * 
    2.10 - * http://www.strabon.di.uoa.gr/
    2.11 - */
    2.12 -package eu.earthobservatory.org.StrabonEndpoint.client;
    2.13 -
    2.14 -import static org.junit.Assert.assertTrue;
    2.15 -
    2.16 -import java.io.IOException;
    2.17 -
    2.18 -import org.junit.Before;
    2.19 -import org.junit.Test;
    2.20 -import org.openrdf.query.resultio.stSPARQLQueryResultFormat;
    2.21 -
    2.22 -/**
    2.23 - * @author Kallirroi Dogani <kallirroi@di.uoa.gr>
    2.24 - *
    2.25 - */
    2.26 -
    2.27 -public class TestSPARQLEndpointWithParliament {
    2.28 -
    2.29 -	private SPARQLEndpoint endpoint; 
    2.30 -	private String query;
    2.31 -	
    2.32 -	@Before
    2.33 -	public void init() {
    2.34 -		// initialize endpoint
    2.35 -		endpoint = new SPARQLEndpoint("luna.di.uoa.gr", 8080, "parliament/sparql");
    2.36 -		
    2.37 -		// set query
    2.38 -		query = "PREFIX ex: <http://example.org/> \n" +
    2.39 -				"SELECT ?k ?g WHERE {\n" +
    2.40 -				" ex:pol1 ?k ?g\n" +
    2.41 -				"}" +
    2.42 -				"\nLIMIT 1";
    2.43 -				
    2.44 -	}
    2.45 -	
    2.46 -	/**
    2.47 -	 * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}.
    2.48 -	 */
    2.49 -	@Test
    2.50 -	public void testQuery() {
    2.51 -			try {
    2.52 -				EndpointResult response = endpoint.query(query, stSPARQLQueryResultFormat.XML);
    2.53 -				
    2.54 -				System.out.println(response.getResponse());
    2.55 -				
    2.56 -				if (response.getStatusCode() != 200) {
    2.57 -					System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText());
    2.58 -					
    2.59 -				}
    2.60 -				
    2.61 -				assertTrue(response.getStatusCode() == 200);
    2.62 -				
    2.63 -			} catch (IOException e) {
    2.64 -				e.printStackTrace();
    2.65 -			}
    2.66 -			
    2.67 -	}
    2.68 -	
    2.69 -	/**
    2.70 -	 * Test method for testing that method {@link eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}.
    2.71 -	 * returns an IOException when it should do so.
    2.72 -	 */
    2.73 -	@Test(expected= IOException.class)
    2.74 -	public void testIOException() throws Exception {
    2.75 -		SPARQLEndpoint ep = new SPARQLEndpoint("blabla.dgr", 80, "bla");
    2.76 -		ep.query(query, stSPARQLQueryResultFormat.XML);
    2.77 -	}
    2.78 -}
    2.79 +///* This Source Code Form is subject to the terms of the Mozilla Public
    2.80 +// * License, v. 2.0. If a copy of the MPL was not distributed with this
    2.81 +// * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    2.82 +// * 
    2.83 +// * Copyright (C) 2013, Pyravlos Team
    2.84 +// * 
    2.85 +// * http://www.strabon.di.uoa.gr/
    2.86 +// */
    2.87 +//package eu.earthobservatory.org.StrabonEndpoint.client;
    2.88 +//
    2.89 +//import static org.junit.Assert.assertTrue;
    2.90 +//
    2.91 +//import java.io.IOException;
    2.92 +//
    2.93 +//import org.junit.Before;
    2.94 +//import org.junit.Test;
    2.95 +//import org.openrdf.query.resultio.stSPARQLQueryResultFormat;
    2.96 +//
    2.97 +///**
    2.98 +// * @author Kallirroi Dogani <kallirroi@di.uoa.gr>
    2.99 +// *
   2.100 +// */
   2.101 +//
   2.102 +//public class TestSPARQLEndpointWithParliament {
   2.103 +//
   2.104 +//	private SPARQLEndpoint endpoint; 
   2.105 +//	private String query;
   2.106 +//	
   2.107 +//	@Before
   2.108 +//	public void init() {
   2.109 +//		// initialize endpoint
   2.110 +//		endpoint = new SPARQLEndpoint("luna.di.uoa.gr", 8080, "parliament/sparql");
   2.111 +//		
   2.112 +//		// set query
   2.113 +//		query = "PREFIX ex: <http://example.org/> \n" +
   2.114 +//				"SELECT ?k ?g WHERE {\n" +
   2.115 +//				" ex:pol1 ?k ?g\n" +
   2.116 +//				"}" +
   2.117 +//				"\nLIMIT 1";
   2.118 +//				
   2.119 +//	}
   2.120 +//	
   2.121 +//	/**
   2.122 +//	 * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}.
   2.123 +//	 */
   2.124 +//	@Test
   2.125 +//	public void testQuery() {
   2.126 +//			try {
   2.127 +//				EndpointResult response = endpoint.query(query, stSPARQLQueryResultFormat.XML);
   2.128 +//				
   2.129 +//				System.out.println(response.getResponse());
   2.130 +//				
   2.131 +//				if (response.getStatusCode() != 200) {
   2.132 +//					System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText());
   2.133 +//					
   2.134 +//				}
   2.135 +//				
   2.136 +//				assertTrue(response.getStatusCode() == 200);
   2.137 +//				
   2.138 +//			} catch (IOException e) {
   2.139 +//				e.printStackTrace();
   2.140 +//			}
   2.141 +//			
   2.142 +//	}
   2.143 +//	
   2.144 +//	/**
   2.145 +//	 * Test method for testing that method {@link eu.earthobservatory.org.StrabonEndpoint.client.SPARQLEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}.
   2.146 +//	 * returns an IOException when it should do so.
   2.147 +//	 */
   2.148 +//	@Test(expected= IOException.class)
   2.149 +//	public void testIOException() throws Exception {
   2.150 +//		SPARQLEndpoint ep = new SPARQLEndpoint("blabla.dgr", 80, "bla");
   2.151 +//		ep.query(query, stSPARQLQueryResultFormat.XML);
   2.152 +//	}
   2.153 +//}
     3.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithVirtuoso.java	Tue Apr 09 02:27:21 2013 +0300
     3.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSPARQLEndpointWithVirtuoso.java	Thu Apr 11 10:47:31 2013 +0300
     3.3 @@ -35,14 +35,14 @@
     3.4  	@Before
     3.5  	public void init() {
     3.6  		// initialize endpoint
     3.7 -		endpoint = new SPARQLEndpoint("luna.di.uoa.gr", 8890, "sparql");
     3.8 +		endpoint = new SPARQLEndpoint("dbpedia.org", 8890, "sparql");
     3.9  		
    3.10  		// set query
    3.11 -		query = "PREFIX ex: <http://example.org/> \n" +
    3.12 -				"SELECT ?k ?g WHERE {\n" +
    3.13 -				" ex:pol1 ?k ?g\n" +
    3.14 +		query = "PREFIX rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> \n" +
    3.15 +				"SELECT ?x ?y WHERE {\n" +
    3.16 +				" ?x rdf:type ?y\n" +
    3.17  				"}" +
    3.18 -				"\nLIMIT 1";
    3.19 +				"\nLIMIT 10";
    3.20  		
    3.21  		// initialized formats
    3.22  		for (TupleQueryResultFormat format : stSPARQLQueryResultFormat.values()) {
    3.23 @@ -61,7 +61,7 @@
    3.24  			try {
    3.25  				EndpointResult response = endpoint.query(query, stSPARQLQueryResultFormat.XML);
    3.26  				
    3.27 -				System.out.println(response.getResponse());
    3.28 +				//System.out.println(response.getResponse());
    3.29  				
    3.30  				if (response.getStatusCode() != 200) {
    3.31  					System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText());
     4.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSpatialEndpoint.java	Tue Apr 09 02:27:21 2013 +0300
     4.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestSpatialEndpoint.java	Thu Apr 11 10:47:31 2013 +0300
     4.3 @@ -32,14 +32,15 @@
     4.4  	@Before
     4.5  	public void init() {
     4.6  		// initialize endpoint
     4.7 -		endpoint = new SpatialEndpoint("luna.di.uoa.gr", 8890, "sparql");
     4.8 +		endpoint = new SpatialEndpoint("geo.linkedopendata.gr", 9090, "corine-endpoint/Query");
     4.9  		
    4.10  		// set query
    4.11 -		query = "PREFIX ex: <http://example.org/> \n" +
    4.12 -				"SELECT ?k ?g WHERE {\n" +
    4.13 -				" ?k ex:geometry ?g\n" +
    4.14 -				"}" +
    4.15 -				"\nLIMIT 2";
    4.16 +		query = "PREFIX corine: <http://geo.linkedopendata.gr/corine/ontology#> \n"+
    4.17 +				"SELECT ?geometry \n" +
    4.18 +				 "WHERE {\n " + 
    4.19 +				 "  ?area corine:hasLandUse corine:burntAreas . \n" +
    4.20 +				 "  ?area corine:hasGeometry ?geometry .  } \n" +
    4.21 +				 "LIMIT 2" ;              
    4.22  	}
    4.23  	
    4.24  	/**
    4.25 @@ -53,8 +54,8 @@
    4.26  				
    4.27  					response = endpoint.queryForKML(query); 
    4.28  					
    4.29 -					System.out.println("KML format:");
    4.30 -					System.out.println(response.getResponse());
    4.31 +					//System.out.println("KML format:");
    4.32 +					//System.out.println(response.getResponse());
    4.33  					
    4.34  					if (response.getStatusCode() != 200) {
    4.35  						System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText());