Strabon

changeset 970:3e4a1c50c079

Commented some tests. To be moved in testsuite.
author Panayiotis Smeros <psmeros@di.uoa.gr>
date Tue Apr 02 21:08:38 2013 +0300 (2013-04-02)
parents cd8b50e4ac90
children b628e51f9580
files endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestLimit.java endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestStrabonEndpoint.java
line diff
     1.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestLimit.java	Tue Apr 02 20:50:48 2013 +0300
     1.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestLimit.java	Tue Apr 02 21:08:38 2013 +0300
     1.3 @@ -1,109 +1,109 @@
     1.4 -/**
     1.5 - * This Source Code Form is subject to the terms of the Mozilla Public
     1.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this
     1.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     1.8 - * 
     1.9 - * Copyright (C) 2012, Pyravlos Team
    1.10 - * 
    1.11 - * http://www.strabon.di.uoa.gr/
    1.12 - */
    1.13 -package eu.earthobservatory.org.StrabonEndpoint.client;
    1.14 -
    1.15 -
    1.16 -import static org.junit.Assert.assertTrue;
    1.17 -
    1.18 -import java.io.IOException;
    1.19 -import org.junit.Before;
    1.20 -import org.junit.Test;
    1.21 -import org.openrdf.query.resultio.stSPARQLQueryResultFormat;
    1.22 -
    1.23 -/**
    1.24 - * @author Stella Giannakopoulou <sgian@di.uoa.gr>
    1.25 - *
    1.26 - */
    1.27 -public class TestLimit {
    1.28 -
    1.29 -	private StrabonEndpoint endpoint; 
    1.30 -	private String [] testQueries;
    1.31 -	private stSPARQLQueryResultFormat format;			
    1.32 -	
    1.33 -	@Before
    1.34 -	public void init() {
    1.35 -		
    1.36 -		// initialize endpoint		
    1.37 -		endpoint = new StrabonEndpoint("localhost", 8080, "strabon-endpoint");		
    1.38 -		testQueries = new String[6];
    1.39 -		
    1.40 -		 // set queries
    1.41 -		 testQueries[0] = "SELECT *\n" +
    1.42 -				"WHERE\n"+							
    1.43 -				"{\n"+
    1.44 -				"	?x ?y ?z\n" +
    1.45 -				"}\n" +
    1.46 -				"limit 3";	
    1.47 -		 
    1.48 -		 testQueries[1] = "SELECT *\n" +
    1.49 -					"WHERE\n"+							
    1.50 -					"{\n"+
    1.51 -					"	?x ?limit 5\n" +
    1.52 -					"}\n" +
    1.53 -					"limit 3";
    1.54 -		 
    1.55 -		 testQueries[2] = "SELECT *\n" +
    1.56 -					"WHERE\n"+							
    1.57 -					"{\n"+
    1.58 -					"	?x ?limit 5\n" +
    1.59 -					"}\n" +
    1.60 -					"limit 3\n" +
    1.61 -					"offset 4";
    1.62 -		 
    1.63 -		 testQueries[3] = "SELECT *\n" +
    1.64 -					"WHERE\n"+							
    1.65 -					"{\n"+
    1.66 -					"	?x ?y ?z\n" +
    1.67 -					"}\n" +
    1.68 -					"limit 3000";
    1.69 -		 
    1.70 -		 testQueries[4] = "SELECT *\n" +
    1.71 -					"WHERE\n"+							
    1.72 -					"{\n"+
    1.73 -					"	?x ?y ?z\n" +
    1.74 -					"}\n" +
    1.75 -					"offset 5" +
    1.76 -					"limit 3000";
    1.77 -		 
    1.78 -		 testQueries[5] = "SELECT *\n" +
    1.79 -					"WHERE\n"+							
    1.80 -					"{\n"+
    1.81 -					"	?x ?z 5\n" +
    1.82 -					"}\n" +
    1.83 -					"limit3000\n" +
    1.84 -					"offset 2";
    1.85 -		
    1.86 -		// format does not matter for the test
    1.87 -		format = stSPARQLQueryResultFormat.HTML;								
    1.88 -	}
    1.89 -	
    1.90 -	/**
    1.91 -	 * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}.
    1.92 -	 */
    1.93 -	@Test
    1.94 -	public void testQuery() {				
    1.95 -				 
    1.96 -		for (String query : testQueries) {			
    1.97 -			try {
    1.98 -				EndpointResult response = endpoint.query(query, format);
    1.99 -				
   1.100 -				if (response.getStatusCode() != 200) {
   1.101 -					System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText());
   1.102 -					
   1.103 -				}
   1.104 -				
   1.105 -				assertTrue(response.getStatusCode() == 200);
   1.106 -
   1.107 -			} catch (IOException e) {
   1.108 -				e.printStackTrace();
   1.109 -			}					
   1.110 -		}
   1.111 -	}	
   1.112 -}
   1.113 +///**
   1.114 +// * This Source Code Form is subject to the terms of the Mozilla Public
   1.115 +// * License, v. 2.0. If a copy of the MPL was not distributed with this
   1.116 +// * file, You can obtain one at http://mozilla.org/MPL/2.0/.
   1.117 +// * 
   1.118 +// * Copyright (C) 2012, Pyravlos Team
   1.119 +// * 
   1.120 +// * http://www.strabon.di.uoa.gr/
   1.121 +// */
   1.122 +//package eu.earthobservatory.org.StrabonEndpoint.client;
   1.123 +//
   1.124 +//
   1.125 +//import static org.junit.Assert.assertTrue;
   1.126 +//
   1.127 +//import java.io.IOException;
   1.128 +//import org.junit.Before;
   1.129 +//import org.junit.Test;
   1.130 +//import org.openrdf.query.resultio.stSPARQLQueryResultFormat;
   1.131 +//
   1.132 +///**
   1.133 +// * @author Stella Giannakopoulou <sgian@di.uoa.gr>
   1.134 +// *
   1.135 +// */
   1.136 +//public class TestLimit {
   1.137 +//
   1.138 +//	private StrabonEndpoint endpoint; 
   1.139 +//	private String [] testQueries;
   1.140 +//	private stSPARQLQueryResultFormat format;			
   1.141 +//	
   1.142 +//	@Before
   1.143 +//	public void init() {
   1.144 +//		
   1.145 +//		// initialize endpoint		
   1.146 +//		endpoint = new StrabonEndpoint("localhost", 8080, "strabon-endpoint");		
   1.147 +//		testQueries = new String[6];
   1.148 +//		
   1.149 +//		 // set queries
   1.150 +//		 testQueries[0] = "SELECT *\n" +
   1.151 +//				"WHERE\n"+							
   1.152 +//				"{\n"+
   1.153 +//				"	?x ?y ?z\n" +
   1.154 +//				"}\n" +
   1.155 +//				"limit 3";	
   1.156 +//		 
   1.157 +//		 testQueries[1] = "SELECT *\n" +
   1.158 +//					"WHERE\n"+							
   1.159 +//					"{\n"+
   1.160 +//					"	?x ?limit 5\n" +
   1.161 +//					"}\n" +
   1.162 +//					"limit 3";
   1.163 +//		 
   1.164 +//		 testQueries[2] = "SELECT *\n" +
   1.165 +//					"WHERE\n"+							
   1.166 +//					"{\n"+
   1.167 +//					"	?x ?limit 5\n" +
   1.168 +//					"}\n" +
   1.169 +//					"limit 3\n" +
   1.170 +//					"offset 4";
   1.171 +//		 
   1.172 +//		 testQueries[3] = "SELECT *\n" +
   1.173 +//					"WHERE\n"+							
   1.174 +//					"{\n"+
   1.175 +//					"	?x ?y ?z\n" +
   1.176 +//					"}\n" +
   1.177 +//					"limit 3000";
   1.178 +//		 
   1.179 +//		 testQueries[4] = "SELECT *\n" +
   1.180 +//					"WHERE\n"+							
   1.181 +//					"{\n"+
   1.182 +//					"	?x ?y ?z\n" +
   1.183 +//					"}\n" +
   1.184 +//					"offset 5" +
   1.185 +//					"limit 3000";
   1.186 +//		 
   1.187 +//		 testQueries[5] = "SELECT *\n" +
   1.188 +//					"WHERE\n"+							
   1.189 +//					"{\n"+
   1.190 +//					"	?x ?z 5\n" +
   1.191 +//					"}\n" +
   1.192 +//					"limit3000\n" +
   1.193 +//					"offset 2";
   1.194 +//		
   1.195 +//		// format does not matter for the test
   1.196 +//		format = stSPARQLQueryResultFormat.HTML;								
   1.197 +//	}
   1.198 +//	
   1.199 +//	/**
   1.200 +//	 * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}.
   1.201 +//	 */
   1.202 +//	@Test
   1.203 +//	public void testQuery() {				
   1.204 +//				 
   1.205 +//		for (String query : testQueries) {			
   1.206 +//			try {
   1.207 +//				EndpointResult response = endpoint.query(query, format);
   1.208 +//				
   1.209 +//				if (response.getStatusCode() != 200) {
   1.210 +//					System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText());
   1.211 +//					
   1.212 +//				}
   1.213 +//				
   1.214 +//				assertTrue(response.getStatusCode() == 200);
   1.215 +//
   1.216 +//			} catch (IOException e) {
   1.217 +//				e.printStackTrace();
   1.218 +//			}					
   1.219 +//		}
   1.220 +//	}	
   1.221 +//}
     2.1 --- a/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestStrabonEndpoint.java	Tue Apr 02 20:50:48 2013 +0300
     2.2 +++ b/endpoint-client/src/test/java/eu/earthobservatory/org/StrabonEndpoint/client/TestStrabonEndpoint.java	Tue Apr 02 21:08:38 2013 +0300
     2.3 @@ -1,85 +1,85 @@
     2.4 -/**
     2.5 - * This Source Code Form is subject to the terms of the Mozilla Public
     2.6 - * License, v. 2.0. If a copy of the MPL was not distributed with this
     2.7 - * file, You can obtain one at http://mozilla.org/MPL/2.0/.
     2.8 - * 
     2.9 - * Copyright (C) 2012, Pyravlos Team
    2.10 - * 
    2.11 - * http://www.strabon.di.uoa.gr/
    2.12 - */
    2.13 -package eu.earthobservatory.org.StrabonEndpoint.client;
    2.14 -
    2.15 -import static org.junit.Assert.assertTrue;
    2.16 -
    2.17 -import java.io.IOException;
    2.18 -import java.util.Vector;
    2.19 -
    2.20 -import org.junit.Before;
    2.21 -import org.junit.Test;
    2.22 -import org.openrdf.query.resultio.TupleQueryResultFormat;
    2.23 -import org.openrdf.query.resultio.stSPARQLQueryResultFormat;
    2.24 -
    2.25 -/**
    2.26 - * @author Charalampos Nikolaou <charnik@di.uoa.gr>
    2.27 - *
    2.28 - */
    2.29 -public class TestStrabonEndpoint {
    2.30 -
    2.31 -	private StrabonEndpoint endpoint; 
    2.32 -	private String query;
    2.33 -	private Vector<stSPARQLQueryResultFormat> formats = new Vector<stSPARQLQueryResultFormat>();
    2.34 -	
    2.35 -	@Before
    2.36 -	public void init() {
    2.37 -		// initialize endpoint
    2.38 -		endpoint = new StrabonEndpoint("test.strabon.di.uoa.gr", 80, "DLR");
    2.39 -		
    2.40 -		// set query
    2.41 -		query = "PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>\n" +
    2.42 -				"SELECT ?s ?g WHERE {\n" +
    2.43 -				"	?s teleios:hasGeometry ?g\n" +
    2.44 -				"}" +
    2.45 -				"\nLIMIT 1";
    2.46 -		
    2.47 -		// initialized formats
    2.48 -		for (TupleQueryResultFormat format : stSPARQLQueryResultFormat.values()) {
    2.49 -				if (format instanceof stSPARQLQueryResultFormat) {
    2.50 -					formats.add((stSPARQLQueryResultFormat) format);
    2.51 -				}
    2.52 -		}
    2.53 -				
    2.54 -	}
    2.55 -	
    2.56 -	/**
    2.57 -	 * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}.
    2.58 -	 */
    2.59 -	@Test
    2.60 -	public void testQuery() {
    2.61 -		for (stSPARQLQueryResultFormat format : formats) {
    2.62 -			try {
    2.63 -				EndpointResult response = endpoint.query(query, format);
    2.64 -				
    2.65 -				if (response.getStatusCode() != 200) {
    2.66 -					System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText());
    2.67 -					
    2.68 -				}
    2.69 -				
    2.70 -				assertTrue(response.getStatusCode() == 200);
    2.71 -
    2.72 -			} catch (IOException e) {
    2.73 -				e.printStackTrace();
    2.74 -			}
    2.75 -			
    2.76 -		}
    2.77 -	}
    2.78 -	
    2.79 -	/**
    2.80 -	 * Test method for testing that method {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}.
    2.81 -	 * returns an IOException when it should do so.
    2.82 -	 */
    2.83 -	@Test(expected= IOException.class)
    2.84 -	public void testIOException() throws Exception {
    2.85 -		StrabonEndpoint ep = new StrabonEndpoint("blabla.dgr", 80, "bla");
    2.86 -		ep.query(query, formats.get(0));
    2.87 -	}
    2.88 -}
    2.89 +///**
    2.90 +// * This Source Code Form is subject to the terms of the Mozilla Public
    2.91 +// * License, v. 2.0. If a copy of the MPL was not distributed with this
    2.92 +// * file, You can obtain one at http://mozilla.org/MPL/2.0/.
    2.93 +// * 
    2.94 +// * Copyright (C) 2012, Pyravlos Team
    2.95 +// * 
    2.96 +// * http://www.strabon.di.uoa.gr/
    2.97 +// */
    2.98 +//package eu.earthobservatory.org.StrabonEndpoint.client;
    2.99 +//
   2.100 +//import static org.junit.Assert.assertTrue;
   2.101 +//
   2.102 +//import java.io.IOException;
   2.103 +//import java.util.Vector;
   2.104 +//
   2.105 +//import org.junit.Before;
   2.106 +//import org.junit.Test;
   2.107 +//import org.openrdf.query.resultio.TupleQueryResultFormat;
   2.108 +//import org.openrdf.query.resultio.stSPARQLQueryResultFormat;
   2.109 +//
   2.110 +///**
   2.111 +// * @author Charalampos Nikolaou <charnik@di.uoa.gr>
   2.112 +// *
   2.113 +// */
   2.114 +//public class TestStrabonEndpoint {
   2.115 +//
   2.116 +//	private StrabonEndpoint endpoint; 
   2.117 +//	private String query;
   2.118 +//	private Vector<stSPARQLQueryResultFormat> formats = new Vector<stSPARQLQueryResultFormat>();
   2.119 +//	
   2.120 +//	@Before
   2.121 +//	public void init() {
   2.122 +//		// initialize endpoint
   2.123 +//		endpoint = new StrabonEndpoint("test.strabon.di.uoa.gr", 80, "DLR");
   2.124 +//		
   2.125 +//		// set query
   2.126 +//		query = "PREFIX teleios:<http://teleios.di.uoa.gr/ontologies/noaOntology.owl#>\n" +
   2.127 +//				"SELECT ?s ?g WHERE {\n" +
   2.128 +//				"	?s teleios:hasGeometry ?g\n" +
   2.129 +//				"}" +
   2.130 +//				"\nLIMIT 1";
   2.131 +//		
   2.132 +//		// initialized formats
   2.133 +//		for (TupleQueryResultFormat format : stSPARQLQueryResultFormat.values()) {
   2.134 +//				if (format instanceof stSPARQLQueryResultFormat) {
   2.135 +//					formats.add((stSPARQLQueryResultFormat) format);
   2.136 +//				}
   2.137 +//		}
   2.138 +//				
   2.139 +//	}
   2.140 +//	
   2.141 +//	/**
   2.142 +//	 * Test method for {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}.
   2.143 +//	 */
   2.144 +//	@Test
   2.145 +//	public void testQuery() {
   2.146 +//		for (stSPARQLQueryResultFormat format : formats) {
   2.147 +//			try {
   2.148 +//				EndpointResult response = endpoint.query(query, format);
   2.149 +//				
   2.150 +//				if (response.getStatusCode() != 200) {
   2.151 +//					System.err.println("Status code ("+response.getStatusCode()+"):" + response.getStatusText());
   2.152 +//					
   2.153 +//				}
   2.154 +//				
   2.155 +//				assertTrue(response.getStatusCode() == 200);
   2.156 +//
   2.157 +//			} catch (IOException e) {
   2.158 +//				e.printStackTrace();
   2.159 +//			}
   2.160 +//			
   2.161 +//		}
   2.162 +//	}
   2.163 +//	
   2.164 +//	/**
   2.165 +//	 * Test method for testing that method {@link eu.earthobservatory.org.StrabonEndpoint.client.StrabonEndpoint#query(java.lang.String, org.openrdf.query.resultio.stSPARQLQueryResultFormat)}.
   2.166 +//	 * returns an IOException when it should do so.
   2.167 +//	 */
   2.168 +//	@Test(expected= IOException.class)
   2.169 +//	public void testIOException() throws Exception {
   2.170 +//		StrabonEndpoint ep = new StrabonEndpoint("blabla.dgr", 80, "bla");
   2.171 +//		ep.query(query, formats.get(0));
   2.172 +//	}
   2.173 +//}