Author: enridaga
Date: Sun Nov 27 16:36:26 2011
New Revision: 1206763

URL: http://svn.apache.org/viewvc?rev=1206763&view=rev
Log:
* Added tests for CHECK task and inconsistency
* Removed some tests bound to HermiT (which should not be included in a release)

STANBOL-379

Added:
    
incubator/stanbol/trunk/reasoners/services-tests/src/test/resources/inconsistent-types.rdf
Modified:
    
incubator/stanbol/trunk/reasoners/services-tests/src/test/java/org/apache/stanbol/reasoners/it/offline/ReasonersOfflineTest.java
    
incubator/stanbol/trunk/reasoners/services-tests/src/test/java/org/apache/stanbol/reasoners/it/online/ReasonersOnlineTest.java

Modified: 
incubator/stanbol/trunk/reasoners/services-tests/src/test/java/org/apache/stanbol/reasoners/it/offline/ReasonersOfflineTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/services-tests/src/test/java/org/apache/stanbol/reasoners/it/offline/ReasonersOfflineTest.java?rev=1206763&r1=1206762&r2=1206763&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/reasoners/services-tests/src/test/java/org/apache/stanbol/reasoners/it/offline/ReasonersOfflineTest.java
 (original)
+++ 
incubator/stanbol/trunk/reasoners/services-tests/src/test/java/org/apache/stanbol/reasoners/it/offline/ReasonersOfflineTest.java
 Sun Nov 27 16:36:26 2011
@@ -50,7 +50,8 @@ import org.slf4j.LoggerFactory;
  * 
  */
 public class ReasonersOfflineTest extends ReasonersTestBase {
-    protected static String fileName = null;
+       protected static String fileName = null;
+       protected static String inconsistentFileName = null;
     protected String fileParam = "file";
     protected static File file = null;
     protected MultipartEntity multiPart = null;
@@ -61,6 +62,9 @@ public class ReasonersOfflineTest extend
     public static void prepare() throws URISyntaxException {
         fileName = 
ReasonersOfflineTest.class.getResource(System.getProperty("file.separator") + 
"foaf.rdf")
                 .toString();
+        inconsistentFileName = 
ReasonersOfflineTest.class.getResource(System.getProperty("file.separator") + 
"inconsistent-types.rdf")
+                .toString(); 
+        // This is shared among all tests
         file = new File(URI.create(fileName));
         assertTrue(file.exists());
         assertTrue(file.canRead());
@@ -148,8 +152,7 @@ public class ReasonersOfflineTest extend
             buildMultipartRequest("/reasoners/rdfs/enrich", 
multiPart).withHeader("Accept", "text/n3"))
                 .assertStatus(200)
                 .assertContentType("text/n3")
-                
.assertContentContains("<http://www.w3.org/2000/01/rdf-schema#ContainerMembershipProperty>",
-                    "()", 
"<http://www.w3.org/1999/02/22-rdf-syntax-ns#predicate>");
+                .assertContentContains("<http://xmlns.com/foaf/0.1/>");
 
     }
      
@@ -167,6 +170,30 @@ public class ReasonersOfflineTest extend
 
     }
     
+    @Test
+    public void testPostMultipartConsistency200() throws Exception{
+               String[] services = {"/owl","/owlmini"};
+       // Consistent
+       for(String s : services){
+               executor.execute(buildMultipartRequest("/reasoners" + s + 
"/check", multiPart)).assertStatus(200);
+       }
+    }
+    
+    @Test
+    public void testPostMultipartConsistency409() throws Exception{
+       
+        FileBody bin = new FileBody(new 
File(URI.create(inconsistentFileName)));
+        MultipartEntity incMultiPart = new MultipartEntity();
+        incMultiPart.addPart(fileParam, bin);
+
+       String[] services = {"/owl","/owlmini"};
+   
+       // Not consistent
+       for(String s : services){
+               executor.execute(buildMultipartRequest("/reasoners" + s + 
"/check", incMultiPart)).assertStatus(409);
+       }
+    }
+    
     /**
      * We test here all acceptable return types
      */

Modified: 
incubator/stanbol/trunk/reasoners/services-tests/src/test/java/org/apache/stanbol/reasoners/it/online/ReasonersOnlineTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/services-tests/src/test/java/org/apache/stanbol/reasoners/it/online/ReasonersOnlineTest.java?rev=1206763&r1=1206762&r2=1206763&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/reasoners/services-tests/src/test/java/org/apache/stanbol/reasoners/it/online/ReasonersOnlineTest.java
 (original)
+++ 
incubator/stanbol/trunk/reasoners/services-tests/src/test/java/org/apache/stanbol/reasoners/it/online/ReasonersOnlineTest.java
 Sun Nov 27 16:36:26 2011
@@ -95,26 +95,7 @@ public class ReasonersOnlineTest extends
             "http://xmlns.com/foaf/0.1/gender";,
             "http://purl.org/dc/elements/1.1/title";);
     }
-    
-    /**
-     * OWL2 + CLASSIFY + text/html
-     * 
-     * @throws Exception
-     */
-    @Test
-    public void testServiceOnlineOwl2ClassifyFoafHtml() throws Exception {
-        super.executor.execute(
-                
this.builder.buildGetRequest("/reasoners/owl2/classify","url",FOAF)
-                .withHeader("Accept", "text/html")
-        )
-        .assertStatus(200)
-        .assertContentType("text/html")
-         .assertContentRegexp(
-             "&lt;http://purl.org/dc/terms/Agent&gt;";,
-             "&lt;http://xmlns.com/foaf/0.1/Agent&gt;";,
-             "owl:Thing"
-                 );
-    }
+
 
     /**
      * RDFS + ENRICH + text/n3
@@ -176,21 +157,4 @@ public class ReasonersOnlineTest extends
             " a "
             );
     }
-    
-    /**
-     * OWL2 + ENRICH + application/turtle
-     * @throws Exception
-     */
-    @Test
-    public void testServiceOnlineOwl2EnrichFoafTurtle() throws Exception {
-        super.executor.execute(
-                
this.builder.buildGetRequest("/reasoners/owl2/enrich","url",FOAF)
-                .withHeader("Accept", "application/turtle")
-        )
-        .assertStatus(200)
-        .assertContentType("application/turtle")
-        .assertContentRegexp(
-            "rdfs:subClassOf\\s+<http://purl.org/dc/terms/Agent>",
-            "owl:disjointWith\\s+<http://xmlns.com/foaf/0.1/Project>");
-    }
 }

Added: 
incubator/stanbol/trunk/reasoners/services-tests/src/test/resources/inconsistent-types.rdf
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/reasoners/services-tests/src/test/resources/inconsistent-types.rdf?rev=1206763&view=auto
==============================================================================
--- 
incubator/stanbol/trunk/reasoners/services-tests/src/test/resources/inconsistent-types.rdf
 (added)
+++ 
incubator/stanbol/trunk/reasoners/services-tests/src/test/resources/inconsistent-types.rdf
 Sun Nov 27 16:36:26 2011
@@ -0,0 +1,41 @@
+<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#";
+       xmlns:rdfs="http://www.w3.org/2000/01/rdf-schema#"; 
xmlns:owl="http://www.w3.org/2002/07/owl#";
+       xmlns:ex="http://www.example.org/reasoners/"; 
xmlns:dc="http://purl.org/dc/elements/1.1/";
+       xmlns:skos="http://www.w3.org/2004/02/skos/core#"; 
xmlns="http://www.example.org/reasoners/";>
+
+       <!-- This file is an OWL ontology -->
+       <owl:Ontology rdf:about="">
+               <!-- We want to make an example of an inconsistent ontology -->
+               <rdfs:comment>This is an example of an inconsistent type 
statement
+               </rdfs:comment>
+               <rdfs:comment>Persons and organizations are disjoint sets, so 
instances
+                       of Person cannot be instances of 
Organization.</rdfs:comment>
+                       <rdfs:comment>This example works with:
+                       * /owl (the Jena OWL reasoner)
+                       * /owlmini (the Jena OWLMini reasoner)
+                       * /owl2 (the Hermit Reasoning Service)
+                       </rdfs:comment>
+               <skos:note>Consider that such statement is perfectly legal at 
the
+                       RDF(S) level.</skos:note>
+       </owl:Ontology>
+
+       <!-- enridaga is a person -->
+       <ex:Person rdf:about="http://www.example.org/reasoners/enridaga"; />
+
+       <!-- Persons and Organizations are disjoint -->
+       <owl:Class rdf:about="http://www.example.org/reasoners/Person"; />
+       <owl:Class rdf:about="http://www.example.org/reasoners/Organization";>
+               <owl:disjointWith 
rdf:resource="http://www.example.org/reasoners/Person"; />
+       </owl:Class>
+
+       <!-- A Public Limited Company is a kind of Company, which is a kind of 
Organization -->
+       <owl:Class 
rdf:about="http://www.example.org/reasoners/PublicLimitedCompany";>
+               <rdfs:subClassOf 
rdf:resource="http://www.example.org/reasoners/Company"; />
+       </owl:Class>
+       <owl:Class rdf:about="http://www.example.org/reasoners/Company";>
+               <rdfs:subClassOf 
rdf:resource="http://www.example.org/reasoners/Organization"; />
+       </owl:Class>
+
+       <!-- enridaga cannot be a Public Limited Company -->
+       <ex:PublicLimitedCompany 
rdf:about="http://www.example.org/reasoners/enridaga"; />
+</rdf:RDF>
\ No newline at end of file


Reply via email to