Author: rwesten
Date: Mon Jul 23 07:01:40 2012
New Revision: 1364523

URL: http://svn.apache.org/viewvc?rev=1364523&view=rev
Log:
minor improvements (closing InputStream used to read test data, clearing up 
cached information after the test completes ...)

Modified:
    
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTest.java

Modified: 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTest.java
URL: 
http://svn.apache.org/viewvc/incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTest.java?rev=1364523&r1=1364522&r2=1364523&view=diff
==============================================================================
--- 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTest.java
 (original)
+++ 
incubator/stanbol/trunk/integration-tests/src/test/java/org/apache/stanbol/enhancer/it/MultiThreadedTest.java
 Mon Jul 23 07:01:40 2012
@@ -76,6 +76,8 @@ import org.apache.stanbol.enhancer.servi
 import 
org.apache.stanbol.enhancer.servicesapi.helper.execution.ExecutionMetadata;
 import org.apache.stanbol.enhancer.servicesapi.rdf.Properties;
 import org.apache.stanbol.entityhub.servicesapi.defaults.NamespaceEnum;
+import org.junit.After;
+import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.Before;
 import org.junit.BeforeClass;
@@ -229,6 +231,20 @@ public class MultiThreadedTest extends E
             new 
Object[]{tracker.getNumCompleted(),tracker.getFailed().size(),numThreads});
         tracker.printStatistics();
         Assert.assertTrue(tracker.getFailed()+"/"+numThreads+" failed", 
tracker.getFailed().isEmpty());
+        tracker = null;
+    }
+    
+    @After
+    public final void close(){
+        httpParams = null;
+        pooledHttpClient = null;
+        connectionManager.shutdown();
+        connectionManager = null;
+    }
+    
+    @AfterClass
+    public static final void cleanup(){
+        testDataIterator = null;
     }
     
     /* -------------------------------------------------------------
@@ -347,6 +363,7 @@ public class MultiThreadedTest extends E
                 + "correctly detected you can use the System property '"
                 + PROPERTY_TEST_DATA_TYPE + "' to manually parse the 
Media-Type!");
         }
+        IOUtils.closeQuietly(is);
         return new Iterator<String>() {
             Iterator<Triple> it = null;
             String next = null;
@@ -518,6 +535,7 @@ public class MultiThreadedTest extends E
 
         void succeed(Request request, UriRef contentItemUri, TripleCollection 
results,Long rtt) {
             ExecutionMetadata em = ExecutionMetadata.parseFrom(results, 
(UriRef)contentItemUri);
+            results.clear(); //we no longer need the results
             if(em != null){
                 synchronized (statistics) {
                     statistics.addResult(em,rtt);


Reply via email to