ace-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From j...@apache.org
Subject svn commit: r1361223 - /ace/sandbox/marrs/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java
Date Fri, 13 Jul 2012 13:57:30 GMT
Author: jawi
Date: Fri Jul 13 13:57:30 2012
New Revision: 1361223

URL: http://svn.apache.org/viewvc?rev=1361223&view=rev
Log:
Made test even more robust.

Modified:
    ace/sandbox/marrs/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java

Modified: ace/sandbox/marrs/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java
URL: http://svn.apache.org/viewvc/ace/sandbox/marrs/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java?rev=1361223&r1=1361222&r2=1361223&view=diff
==============================================================================
--- ace/sandbox/marrs/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java
(original)
+++ ace/sandbox/marrs/org.apache.ace.client.repository.itest/src/org/apache/ace/it/repositoryadmin/TemplateProcessorTest.java
Fri Jul 13 13:57:30 2012
@@ -50,7 +50,6 @@ import org.apache.ace.client.repository.
 import org.apache.ace.client.repository.stateful.StatefulTargetObject;
 import org.apache.ace.test.constants.TestConstants;
 import org.apache.felix.dm.Component;
-import org.osgi.framework.InvalidSyntaxException;
 
 /**
  * Test cases for the template processing functionality.
@@ -333,7 +332,7 @@ public class TemplateProcessorTest exten
                 m_distribution2targetRepository.create(lo, gwo);
                 return null;
             }
-        }, false, TOPIC_ADDED, TOPIC_STATUS_CHANGED);
+        }, false, TOPIC_ADDED);
 
         StatefulTargetObject sgo = findStatefulTarget(targetId);
         assertNotNull("Failed to find our target in the repository?!", sgo);
@@ -388,12 +387,16 @@ public class TemplateProcessorTest exten
      * The following code is borrowed from RepositoryTest.java, and is used to instantiate
and
      * use repository servlets.
      */
-    private StatefulTargetObject findStatefulTarget(String targetID) throws InvalidSyntaxException
{
-        for (StatefulTargetObject sgo : m_statefulTargetRepository.get()) {
-            if (sgo.getID().equals(targetID)) {
-                return sgo;
-            }
-        }
+    private StatefulTargetObject findStatefulTarget(String targetID) throws Exception {
+    	int count = 10;
+    	while (count-- > 0) {
+	        for (StatefulTargetObject sgo : m_statefulTargetRepository.get()) {
+	            if (sgo.getID().equals(targetID)) {
+	                return sgo;
+	            }
+	        }
+	        Thread.sleep(100);
+    	}
         return null;
     }
 



Mime
View raw message