You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stanbol.apache.org by rw...@apache.org on 2013/10/30 13:53:41 UTC

svn commit: r1537068 - in /stanbol/trunk/integration-tests/src/test: java/org/apache/stanbol/entityhub/it/EntityhubTest.java java/org/apache/stanbol/entityhub/it/ldpath/DbpediaLDPathTest.java resources/apache-project-doap-files.zip

Author: rwesten
Date: Wed Oct 30 12:53:41 2013
New Revision: 1537068

URL: http://svn.apache.org/r1537068
Log:
STANBOL-1127: fixed several issues with the integration-tests: fixed rdf files with syntax errors in the apache-project-doap-files.zip; fixed some regex expressions used in assertions for expected content; fixed some requests to use the application/x-www-form-urlencoded Content-Type; NOTE: there are still three failing integration tests for the entityhub because of an error related to serializing JSON-LD

Modified:
    stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java
    stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/ldpath/DbpediaLDPathTest.java
    stanbol/trunk/integration-tests/src/test/resources/apache-project-doap-files.zip

Modified: stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java?rev=1537068&r1=1537067&r2=1537068&view=diff
==============================================================================
--- stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java (original)
+++ stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/EntityhubTest.java Wed Oct 30 12:53:41 2013
@@ -255,7 +255,8 @@ public final class EntityhubTest extends
             //assert that the entity was created (or already existed)
             //some projects seams to have more than a single doap file
             int status = re.getResponse().getStatusLine().getStatusCode();
-            Assert.assertTrue(status == 200 || status == 304);
+            Assert.assertTrue("Unable to add '"+entry.getName()+"'! Status:" 
+                    + re.getResponse().getStatusLine(), status == 200 || status == 304);
         }
         
         testFindNameQuery();

Modified: stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/ldpath/DbpediaLDPathTest.java
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/ldpath/DbpediaLDPathTest.java?rev=1537068&r1=1537067&r2=1537068&view=diff
==============================================================================
--- stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/ldpath/DbpediaLDPathTest.java (original)
+++ stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/entityhub/it/ldpath/DbpediaLDPathTest.java Wed Oct 30 12:53:41 2013
@@ -49,6 +49,7 @@ public class DbpediaLDPathTest extends E
     public void testNoContext() throws IOException {
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "ldpath","name = rdfs:label[@en] :: xsd:string;")
         )
@@ -58,6 +59,7 @@ public class DbpediaLDPathTest extends E
     public void testEmptyContext() throws IOException {
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "ldpath","name = rdfs:label[@en] :: xsd:string;",
                 "context","")
@@ -65,6 +67,7 @@ public class DbpediaLDPathTest extends E
         .assertStatus(Status.BAD_REQUEST.getStatusCode());
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "ldpath","name = rdfs:label[@en] :: xsd:string;",
                 "context",null)
@@ -75,6 +78,7 @@ public class DbpediaLDPathTest extends E
     public void testNoLDPath() throws IOException {
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "context","http://dbpedia.org/resource/Paris")
         )
@@ -84,6 +88,7 @@ public class DbpediaLDPathTest extends E
     public void testEmptyLDPath() throws IOException {
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "context","http://dbpedia.org/resource/Paris",
                 "ldpath",null)
@@ -91,6 +96,7 @@ public class DbpediaLDPathTest extends E
         .assertStatus(Status.BAD_REQUEST.getStatusCode());
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "context","http://dbpedia.org/resource/Paris",
                 "ldpath","")
@@ -101,6 +107,7 @@ public class DbpediaLDPathTest extends E
     public void testIllegalLDPath() throws IOException {
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "context","http://dbpedia.org/resource/Paris",
                 //missing semicolon
@@ -109,6 +116,7 @@ public class DbpediaLDPathTest extends E
         .assertStatus(Status.BAD_REQUEST.getStatusCode());
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "context","http://dbpedia.org/resource/Paris",
                 //unknown namespace prefix
@@ -117,6 +125,7 @@ public class DbpediaLDPathTest extends E
         .assertStatus(Status.BAD_REQUEST.getStatusCode());
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "context","http://dbpedia.org/resource/Paris",
                 //unknown dataType prefix
@@ -128,6 +137,7 @@ public class DbpediaLDPathTest extends E
     public void testMultipleContext() throws IOException {
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "context","http://dbpedia.org/resource/Paris",
                 "context","http://dbpedia.org/resource/London",
@@ -144,6 +154,7 @@ public class DbpediaLDPathTest extends E
     public void testUnknownContext() throws IOException {
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "context","http://dbpedia.org/resource/ThisEntityDoesNotExist_ForSure_49283",
                 "ldpath","name = rdfs:label[@en] :: xsd:string;")
@@ -155,6 +166,7 @@ public class DbpediaLDPathTest extends E
     public void testLDPath() throws IOException {
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withFormContent(
                 "context","http://dbpedia.org/resource/Paris",
                 "ldpath","@prefix dct : <http://purl.org/dc/terms/subject/> ;" +
@@ -189,6 +201,7 @@ public class DbpediaLDPathTest extends E
         //parse some illegal LDPath
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/ldpath")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withHeader("Accept", "text/turtle")
             .withFormContent(
                 "name","Vienna",
@@ -204,6 +217,7 @@ public class DbpediaLDPathTest extends E
         //select the German label on a query for the english one
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/find")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withHeader("Accept", "text/turtle")
             .withFormContent(
                 "name","Vienna",
@@ -215,14 +229,15 @@ public class DbpediaLDPathTest extends E
          .assertContentType("text/turtle")
          .assertContentContains(
              "<http://stanbol.apache.org/ontology/entityhub/query#score>",
-             "<http://dbpedia.org/resource/Vienna>",
-             "<name_de> \"Wien\"@de .");
+             "<http://dbpedia.org/resource/Vienna>")
+          .assertContentRegexp("<name_de>\\s+\"Wien\"@de");
     }
     @Test
     public void testFindLDPathOnMultipleResults() throws IOException {
         //select multiple end check that LD-Path is executed on all results
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/find")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withHeader("Accept", "text/turtle")
             .withFormContent(
                 "name","York",
@@ -247,6 +262,7 @@ public class DbpediaLDPathTest extends E
         //same category
         executor.execute(
             builder.buildPostRequest("/entityhub/site/dbpedia/find")
+            .withHeader("Content-Type", "application/x-www-form-urlencoded")
             .withHeader("Accept", "text/turtle")
             .withFormContent(
                 "name","Webspinnen",
@@ -261,7 +277,7 @@ public class DbpediaLDPathTest extends E
          .assertContentType("text/turtle")
          .assertContentRegexp(
              "<http://stanbol.apache.org/ontology/entityhub/query#score>",
-             "<name>  \"Spider\"@en ;",
+             "<name>\\s+\"Spider\"@en ;",
              "<category>.*<http://dbpedia.org/resource/Category:Arachnids>",
              "<category>.*<http://dbpedia.org/resource/Category:Spiders>",
              "<others>.*<http://dbpedia.org/resource/Opiliones>",
@@ -366,13 +382,13 @@ public class DbpediaLDPathTest extends E
             "<http://dbpedia.org/resource/Koblenz>",
             "<http://dbpedia.org/resource/Cologne>",
             //now some values based on the LDPath
-            "<name>  \"Koblenz\"@en",
-            "<lat>   \"50.359722\"",
-            "<long>  \"7.597778\"",
+            "<name>\\s+\"Koblenz\"@en",
+            "<lat>\\s+\"50.359722\"",
+            "<long>\\s+\"7.597778\"",
             "<type>.*<http://www.w3.org/2002/07/owl#Thing>",
             "<type>.*<http://www.opengis.net/gml/_Feature>",
             "<type>.*<http://dbpedia.org/ontology/Town>",
-            "<population> 314926");
+            "<population>\\s+314926");
     }
     
     

Modified: stanbol/trunk/integration-tests/src/test/resources/apache-project-doap-files.zip
URL: http://svn.apache.org/viewvc/stanbol/trunk/integration-tests/src/test/resources/apache-project-doap-files.zip?rev=1537068&r1=1537067&r2=1537068&view=diff
==============================================================================
Binary files - no diff available.