You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ace.apache.org by br...@apache.org on 2013/08/28 14:28:02 UTC

svn commit: r1518177 [4/4] - in /ace/trunk: org.apache.ace.agent.itest/ org.apache.ace.agent.itest/conf/ org.apache.ace.agent.itest/src/org/apache/ace/agent/itest/ org.apache.ace.agent.launcher/ org.apache.ace.agent.launcher/src/org/apache/ace/agent/la...

Modified: ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/BaseAgentTest.java
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/BaseAgentTest.java?rev=1518177&r1=1518176&r2=1518177&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/BaseAgentTest.java (original)
+++ ace/trunk/org.apache.ace.agent/test/org/apache/ace/agent/testutil/BaseAgentTest.java Wed Aug 28 12:28:00 2013
@@ -29,6 +29,7 @@ import java.util.Stack;
 
 import org.apache.ace.agent.AgentContext;
 import org.apache.ace.agent.AgentContextAware;
+import org.apache.ace.agent.impl.AgentContextImpl;
 
 /**
  * Simple base class.
@@ -37,6 +38,21 @@ public abstract class BaseAgentTest {
 
     private Set<Object> m_mocks = new HashSet<Object>();
 
+    protected AgentContextImpl mockAgentContext() throws Exception {
+        return mockAgentContext("" + System.currentTimeMillis());
+    }
+
+    protected AgentContextImpl mockAgentContext(String subDir) throws Exception {
+        File contextDir = new File(getWorkDir(), subDir);
+        contextDir.mkdirs();
+        cleanDir(contextDir);
+        AgentContextImpl context = new AgentContextImpl(contextDir);
+        for (Class<?> handlerClass : AgentContextImpl.KNOWN_HANDLERS) {
+            context.setHandler(handlerClass, addTestMock(handlerClass));
+        }
+        return context;
+    }
+
     protected <T extends Object> T addTestMock(Class<T> clazz) {
         T mock = createNiceMock(clazz);
         m_mocks.add(mock);
@@ -62,13 +78,15 @@ public abstract class BaseAgentTest {
     }
 
     protected void startHandler(Object handler, AgentContext agentContext) throws Exception {
-        if (handler instanceof AgentContextAware)
+        if (handler instanceof AgentContextAware) {
             ((AgentContextAware) handler).start(agentContext);
+        }
     }
 
     protected void stopHandler(Object handler) throws Exception {
-        if (handler instanceof AgentContextAware)
+        if (handler instanceof AgentContextAware) {
             ((AgentContextAware) handler).stop();
+        }
     }
 
     protected void cleanDir(File dir) {

Modified: ace/trunk/org.apache.ace.builder/.classpath
URL: http://svn.apache.org/viewvc/ace/trunk/org.apache.ace.builder/.classpath?rev=1518177&r1=1518176&r2=1518177&view=diff
==============================================================================
--- ace/trunk/org.apache.ace.builder/.classpath (original)
+++ ace/trunk/org.apache.ace.builder/.classpath Wed Aug 28 12:28:00 2013
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <classpath>
 	<classpathentry kind="src" path="src"/>
-	<classpathentry kind="src" path="test"/>
+	<classpathentry kind="src" output="bin_test" path="test"/>
 	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
 	<classpathentry kind="con" path="aQute.bnd.classpath.container"/>
 	<classpathentry kind="con" path="org.testng.TESTNG_CONTAINER"/>