Author: ogrisel
Date: Wed Jan  5 14:22:59 2011
New Revision: 1055467

URL: http://svn.apache.org/viewvc?rev=1055467&view=rev
Log:
disable geonames.org based tests from maven + make them display warning in 
eclipse is overloaded servers

Modified:
    incubator/stanbol/trunk/fise/engines/geonames/pom.xml
    
incubator/stanbol/trunk/fise/engines/geonames/src/test/java/eu/iksproject/fise/engines/geonames/impl/TestLocationEnhancementEngine.java
    incubator/stanbol/trunk/fise/ext/org.geonames/pom.xml
    
incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/WebService.java
    
incubator/stanbol/trunk/fise/ext/org.geonames/src/test/java/eu/iksproject/fise/ext/org/geonames/TestScore.java

Modified: incubator/stanbol/trunk/fise/engines/geonames/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/geonames/pom.xml?rev=1055467&r1=1055466&r2=1055467&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/engines/geonames/pom.xml (original)
+++ incubator/stanbol/trunk/fise/engines/geonames/pom.xml Wed Jan  5 14:22:59 
2011
@@ -43,29 +43,38 @@
                <url>http://wiki.iks-project.eu/index.php/FISEcodeAndDocs</url>
        </scm>
 
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <extensions>true</extensions>
-                               <configuration>
-                                       <instructions>
-                                               <Export-Package>
-                                                       
eu.iksproject.fise.engines.geonames;version=${pom.version},
-                               </Export-Package>
-                                               <Private-Package>
-                                                       
eu.iksproject.fise.engines.geonames.impl.*,
-                               </Private-Package>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-scr-plugin</artifactId>
-                       </plugin>
-               </plugins>
-       </build>
+    <build>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>maven-bundle-plugin</artifactId>
+          <extensions>true</extensions>
+          <configuration>
+            <instructions>
+              <Export-Package>
+                eu.iksproject.fise.engines.geonames;version=${pom.version},
+              </Export-Package>
+              <Private-Package>
+                eu.iksproject.fise.engines.geonames.impl.*,
+              </Private-Package>
+            </instructions>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>maven-scr-plugin</artifactId>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+            <excludes>
+              <exclude>**/TestLocationEnhancementEngine*.java</exclude>
+            </excludes>
+          </configuration>
+        </plugin>
+      </plugins>
+    </build>
 
        <dependencies>
                <dependency>

Modified: 
incubator/stanbol/trunk/fise/engines/geonames/src/test/java/eu/iksproject/fise/engines/geonames/impl/TestLocationEnhancementEngine.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/engines/geonames/src/test/java/eu/iksproject/fise/engines/geonames/impl/TestLocationEnhancementEngine.java?rev=1055467&r1=1055466&r2=1055467&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/fise/engines/geonames/src/test/java/eu/iksproject/fise/engines/geonames/impl/TestLocationEnhancementEngine.java
 (original)
+++ 
incubator/stanbol/trunk/fise/engines/geonames/src/test/java/eu/iksproject/fise/engines/geonames/impl/TestLocationEnhancementEngine.java
 Wed Jan  5 14:22:59 2011
@@ -139,6 +139,11 @@ public class TestLocationEnhancementEngi
             } else if(e.getCause() instanceof SocketTimeoutException){
                 log.warn("Seams like the geonames.org webservice is currently 
unavailable -> skipping this test",e.getCause());
                 return;
+            } else if (e.getMessage().contains("overloaded with requests")) {
+                log.warn(
+                        "Seams like the geonames.org webservice is currently 
unavailable -> skipping this test",
+                        e.getCause());
+                return;
             }
         }
         // ... and test the results

Modified: incubator/stanbol/trunk/fise/ext/org.geonames/pom.xml
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/pom.xml?rev=1055467&r1=1055466&r2=1055467&view=diff
==============================================================================
--- incubator/stanbol/trunk/fise/ext/org.geonames/pom.xml (original)
+++ incubator/stanbol/trunk/fise/ext/org.geonames/pom.xml Wed Jan  5 14:22:59 
2011
@@ -46,28 +46,37 @@
                <url>http://wiki.iks-project.eu/index.php/FISEcodeAndDocs</url>
        </scm>
 
-       <build>
-               <plugins>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-bundle-plugin</artifactId>
-                               <extensions>true</extensions>
-                               <configuration>
-                                       <instructions>
-                                               <Export-Package>
-                                                       
org.geonames;version=${pom.version},
-                                                       
org.geonames.wikipedia;version=${pom.version},
-                                                       
org.geonames.utils;version=${pom.version},
-                                   </Export-Package>
-                                       </instructions>
-                               </configuration>
-                       </plugin>
-                       <plugin>
-                               <groupId>org.apache.felix</groupId>
-                               <artifactId>maven-scr-plugin</artifactId>
-                       </plugin>
-               </plugins>
-       </build>
+    <build>
+      <plugins>
+        <plugin>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>maven-bundle-plugin</artifactId>
+          <extensions>true</extensions>
+          <configuration>
+            <instructions>
+              <Export-Package>
+                org.geonames;version=${pom.version},
+                org.geonames.wikipedia;version=${pom.version},
+                org.geonames.utils;version=${pom.version},
+              </Export-Package>
+            </instructions>
+          </configuration>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.felix</groupId>
+          <artifactId>maven-scr-plugin</artifactId>
+        </plugin>
+        <plugin>
+          <groupId>org.apache.maven.plugins</groupId>
+          <artifactId>maven-surefire-plugin</artifactId>
+          <configuration>
+            <excludes>
+              <exclude>**/TestScore.java</exclude>
+            </excludes>
+          </configuration>
+        </plugin>
+      </plugins>
+    </build>
 
        <dependencies>
                <!--  jdom bundle form springsource -->

Modified: 
incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/WebService.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/WebService.java?rev=1055467&r1=1055466&r2=1055467&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/WebService.java
 (original)
+++ 
incubator/stanbol/trunk/fise/ext/org.geonames/src/main/java/org/geonames/WebService.java
 Wed Jan  5 14:22:59 2011
@@ -1080,7 +1080,7 @@ public class WebService {
     private static void checkException(Element root) throws Exception {
         Element message = root.getChild("status");
         if (message != null) {
-            throw new Exception(message.getAttributeValue("message"));
+            throw new IOException(message.getAttributeValue("message"));
         }
     }
 

Modified: 
incubator/stanbol/trunk/fise/ext/org.geonames/src/test/java/eu/iksproject/fise/ext/org/geonames/TestScore.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/fise/ext/org.geonames/src/test/java/eu/iksproject/fise/ext/org/geonames/TestScore.java?rev=1055467&r1=1055466&r2=1055467&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/fise/ext/org.geonames/src/test/java/eu/iksproject/fise/ext/org/geonames/TestScore.java
 (original)
+++ 
incubator/stanbol/trunk/fise/ext/org.geonames/src/test/java/eu/iksproject/fise/ext/org/geonames/TestScore.java
 Wed Jan  5 14:22:59 2011
@@ -18,10 +18,10 @@ import static org.junit.Assert.assertNot
 import static org.junit.Assert.assertTrue;
 
 /**
- * This test only correct values for score (set/getScore).
- * An extension to the web service client for geonames.org implemented to
- * be able to write fise:confidence values for fise:EntityAnnotations.
- *
+ * This test only correct values for score (set/getScore). An extension to the
+ * web service client for geonames.org implemented to be able to write
+ * fise:confidence values for fise:EntityAnnotations.
+ * 
  * @author Rupert Westenthaler
  */
 public class TestScore {
@@ -44,11 +44,13 @@ public class TestScore {
                 assertTrue(toponym.getScore() >= Double.valueOf(0));
                 assertTrue(toponym.getScore()<= Double.valueOf(100));
             }
-        } catch(IOException e){
+        } catch(IOException e) {
             if (e instanceof UnknownHostException) {
                 log.warn("Unable to test LocationEnhancemetEngine when 
offline! -> skipping this test",e.getCause());
             } else if (e instanceof SocketTimeoutException){
                 log.warn("Seams like the geonames.org webservice is currently 
unavailable -> skipping this test",e.getCause());
+            } else if (e.getMessage().contains("overloaded with requests")) {
+                log.warn("Seams like the geonames.org webservice is currently 
unavailable -> skipping this test", e.getCause());
             } else {
                 throw e;
             }
@@ -64,16 +66,26 @@ public class TestScore {
         try {
             ToponymSearchResult searchResult = 
WebService.search(searchCriteria);
             int testGeonamesId = 
searchResult.getToponyms().iterator().next().getGeoNameId();
-            for (Toponym hierarchy : WebService.hierarchy(testGeonamesId, 
null, Style.FULL)){
-                //this service does not provide an score, so test if 1.0 is 
returned
+            for (Toponym hierarchy : WebService.hierarchy(testGeonamesId, null,
+                    Style.FULL)) {
+                // this service does not provide an score, so test if 1.0 is
+                // returned
                 assertNotNull(hierarchy.getScore());
                 assertEquals(hierarchy.getScore(), Double.valueOf(1.0));
             }
-        } catch(IOException e){
+        } catch (IOException e) {
             if (e instanceof UnknownHostException) {
-                log.warn("Unable to test LocationEnhancemetEngine when 
offline! -> skipping this test",e.getCause());
-            } else if (e instanceof SocketTimeoutException){
-                log.warn("Seams like the geonames.org webservice is currently 
unavailable -> skipping this test",e.getCause());
+                log.warn(
+                        "Unable to test LocationEnhancemetEngine when offline! 
-> skipping this test",
+                        e.getCause());
+            } else if (e instanceof SocketTimeoutException) {
+                log.warn(
+                        "Seams like the geonames.org webservice is currently 
unavailable -> skipping this test",
+                        e.getCause());
+            } else if (e.getMessage().contains("overloaded with requests")) {
+                log.warn(
+                        "Seams like the geonames.org webservice is currently 
unavailable -> skipping this test",
+                        e.getCause());
             } else {
                 throw e;
             }


Reply via email to