You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-dev@jakarta.apache.org by vm...@apache.org on 2004/02/21 17:39:31 UTC
cvs commit: jakarta-cactus/scratchpad/cactus2/samples/servlet project.xml
vmassol 2004/02/21 08:39:31
Modified: scratchpad/cactus2/framework project.xml
scratchpad/cactus2/framework/conf aspectwerkz.xml
scratchpad/cactus2/samples/servlet/conf aspectwerkz.xml
scratchpad/cactus2/samples/servlet project.xml
Added: scratchpad/cactus2/framework/src/main/org/apache/cactus/framework/internal/orchestrator
Orchestrator.java
scratchpad/cactus2/framework/src/main/org/apache/cactus/framework/internal/orchestrator/handlers
GetResultHandler.java SetResultHandler.java
GetTestHandler.java SetTestHandler.java
scratchpad/cactus2/framework/src/main/org/apache/cactus/framework/aspect
OrchestratorAspect.java
Removed: scratchpad/cactus2/framework/src/test/org/apache/cactus/framework
ListenerTest.java
scratchpad/cactus2/framework/src/main/org/apache/cactus/framework
Listener.java
Log:
Let's call the test listener the Orchestrator (it orchestrates the execution of the tests) and let's use Jetty as the server implementation. Size should not be important as I'm sure Jetty can be stripped to a few KB (the full jar is 500K). It has the advantage that we will be communicating between client and server sides using the well-known HTTP protocol.
Revision Changes Path
1.1 jakarta-cactus/scratchpad/cactus2/framework/src/main/org/apache/cactus/framework/internal/orchestrator/Orchestrator.java
Index: Orchestrator.java
===================================================================
/*
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus.framework.internal.orchestrator;
import org.apache.cactus.framework.internal.orchestrator.handlers.GetResultHandler;
import org.apache.cactus.framework.internal.orchestrator.handlers.GetTestHandler;
import org.apache.cactus.framework.internal.orchestrator.handlers.SetResultHandler;
import org.apache.cactus.framework.internal.orchestrator.handlers.SetTestHandler;
import org.mortbay.http.HttpContext;
import org.mortbay.http.HttpServer;
import org.mortbay.http.SocketListener;
public class Orchestrator
{
private int port = 7777;
/**
* Has the test listener socket been set up?
*/
private boolean isInitialized = false;
public synchronized void initialize() throws Throwable
{
if (!this.isInitialized)
{
// Setup HTTP server and attach to it handlers to manage
// the executing test and to manage retrieval of test results
HttpServer server = new HttpServer();
SocketListener listener = new SocketListener();
listener.setPort(this.port);
server.addListener(listener);
HttpContext getTestContext = new HttpContext();
getTestContext.setContextPath("/gettest");
getTestContext.addHandler(new GetTestHandler());
server.addContext(getTestContext);
HttpContext setTestContext = new HttpContext();
setTestContext.setContextPath("/settest");
setTestContext.addHandler(new SetTestHandler());
server.addContext(setTestContext);
HttpContext getResultContext = new HttpContext();
getResultContext.setContextPath("/getresult");
getResultContext.addHandler(new GetResultHandler());
server.addContext(getResultContext);
HttpContext setResultContext = new HttpContext();
setResultContext.setContextPath("/setresult");
setResultContext.addHandler(new SetResultHandler());
server.addContext(setResultContext);
server.start();
this.isInitialized = true;
}
}
}
1.2 +7 -0 jakarta-cactus/scratchpad/cactus2/framework/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/scratchpad/cactus2/framework/project.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.xml 13 Feb 2004 14:12:49 -0000 1.1
+++ project.xml 21 Feb 2004 16:39:30 -0000 1.2
@@ -13,4 +13,11 @@
<connection>scm:cvs:pserver:anoncvs@cvs.apache.org:/home/cvspublic:jakarta-cactus2/framework/</connection>
<url>http://cvs.apache.org/viewcvs/jakarta-cactus2/framework</url>
</repository>
+ <dependencies>
+ <dependency>
+ <groupId>jetty</groupId>
+ <artifactId>org.mortbay.jetty</artifactId>
+ <version>4.2.17</version>
+ </dependency>
+ </dependencies>
</project>
1.1 jakarta-cactus/scratchpad/cactus2/framework/src/main/org/apache/cactus/framework/internal/orchestrator/handlers/GetResultHandler.java
Index: GetResultHandler.java
===================================================================
/*
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus.framework.internal.orchestrator.handlers;
import java.io.IOException;
import org.mortbay.http.HttpException;
import org.mortbay.http.HttpRequest;
import org.mortbay.http.HttpResponse;
import org.mortbay.http.handler.AbstractHttpHandler;
public class GetResultHandler extends AbstractHttpHandler
{
public void handle(String pathInContext, String pathParams,
HttpRequest request, HttpResponse response)
throws HttpException, IOException
{
}
}
1.1 jakarta-cactus/scratchpad/cactus2/framework/src/main/org/apache/cactus/framework/internal/orchestrator/handlers/SetResultHandler.java
Index: SetResultHandler.java
===================================================================
/*
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus.framework.internal.orchestrator.handlers;
import java.io.IOException;
import org.mortbay.http.HttpException;
import org.mortbay.http.HttpRequest;
import org.mortbay.http.HttpResponse;
import org.mortbay.http.handler.AbstractHttpHandler;
public class SetResultHandler extends AbstractHttpHandler
{
public void handle(String pathInContext, String pathParams,
HttpRequest request, HttpResponse response)
throws HttpException, IOException
{
}
}
1.1 jakarta-cactus/scratchpad/cactus2/framework/src/main/org/apache/cactus/framework/internal/orchestrator/handlers/GetTestHandler.java
Index: GetTestHandler.java
===================================================================
/*
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus.framework.internal.orchestrator.handlers;
import java.io.IOException;
import org.mortbay.http.HttpException;
import org.mortbay.http.HttpRequest;
import org.mortbay.http.HttpResponse;
import org.mortbay.http.handler.AbstractHttpHandler;
public class GetTestHandler extends AbstractHttpHandler
{
public void handle(String pathInContext, String pathParams,
HttpRequest request, HttpResponse response)
throws HttpException, IOException
{
}
}
1.1 jakarta-cactus/scratchpad/cactus2/framework/src/main/org/apache/cactus/framework/internal/orchestrator/handlers/SetTestHandler.java
Index: SetTestHandler.java
===================================================================
/*
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus.framework.internal.orchestrator.handlers;
import java.io.IOException;
import org.mortbay.http.HttpException;
import org.mortbay.http.HttpRequest;
import org.mortbay.http.HttpResponse;
import org.mortbay.http.handler.AbstractHttpHandler;
public class SetTestHandler extends AbstractHttpHandler
{
public void handle(String pathInContext, String pathParams,
HttpRequest request, HttpResponse response)
throws HttpException, IOException
{
}
}
1.1 jakarta-cactus/scratchpad/cactus2/framework/src/main/org/apache/cactus/framework/aspect/OrchestratorAspect.java
Index: OrchestratorAspect.java
===================================================================
/*
* ========================================================================
*
* Copyright 2004 The Apache Software Foundation.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*
* ========================================================================
*/
package org.apache.cactus.framework.aspect;
import org.apache.cactus.framework.internal.orchestrator.Orchestrator;
import org.codehaus.aspectwerkz.attribdef.Pointcut;
import org.codehaus.aspectwerkz.attribdef.aspect.Aspect;
import org.codehaus.aspectwerkz.joinpoint.JoinPoint;
/**
* Intercepts client side JUnit tests and sets up the test listener socket
* if not set.
*/
public class OrchestratorAspect extends Aspect
{
/**
* @Execution * *..TestCase+.test*()
*/
private Pointcut interceptClientTest;
private Orchestrator orchestrator = new Orchestrator();
/**
* @Around interceptClientTest
*/
public Object setupOrchestrator(JoinPoint joinPoint) throws Throwable
{
this.orchestrator.initialize();
return joinPoint.proceed();
}
}
1.3 +1 -1 jakarta-cactus/scratchpad/cactus2/framework/conf/aspectwerkz.xml
Index: aspectwerkz.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/scratchpad/cactus2/framework/conf/aspectwerkz.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- aspectwerkz.xml 15 Feb 2004 11:18:58 -0000 1.2
+++ aspectwerkz.xml 21 Feb 2004 16:39:30 -0000 1.3
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE aspectwerkz PUBLIC "-//AspectWerkz//DTD//EN" "http://aspectwerkz.codehaus.org/dtd/aspectwerkz.dtd">
-<aspectwerkz>
<system id="cactus">
<package name="org.apache.cactus.framework.aspect">
<use-aspect class="ListenerAspect"/>
</package>
</system>
</aspectwerkz>
+<aspectwerkz>
<system id="cactus">
<package name="org.apache.cactus.framework.aspect">
<use-aspect class="OrchestratorAspect"/>
</package>
</system>
</aspectwerkz>
1.3 +1 -1 jakarta-cactus/scratchpad/cactus2/samples/servlet/conf/aspectwerkz.xml
Index: aspectwerkz.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/scratchpad/cactus2/samples/servlet/conf/aspectwerkz.xml,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -r1.2 -r1.3
--- aspectwerkz.xml 15 Feb 2004 11:18:58 -0000 1.2
+++ aspectwerkz.xml 21 Feb 2004 16:39:30 -0000 1.3
@@ -1,3 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE aspectwerkz PUBLIC "-//AspectWerkz//DTD//EN" "http://aspectwerkz.codehaus.org/dtd/aspectwerkz.dtd">
-<aspectwerkz>
<system id="cactus">
<package name="org.apache.cactus.sample.servlet">
<use-aspect class="TestSampleServletAspectWerkz$GetRequestParametersTestAdvice"/>
</package>
<package name="org.apache.cactus.framework.aspect">
<use-aspect class="ListenerAspect"/>
</package>
</system>
</aspectwerkz>
+<aspectwerkz>
<system id="cactus">
<package name="org.apache.cactus.sample.servlet">
<use-aspect class="TestSampleServletAspectWerkz$GetRequestParametersTestAdvice"/>
</package>
<package name="org.apache.cactus.framework.aspect">
<use-aspect class="OrchestratorAspect"/>
</package>
</system>
</aspectwerkz>
1.2 +5 -0 jakarta-cactus/scratchpad/cactus2/samples/servlet/project.xml
Index: project.xml
===================================================================
RCS file: /home/cvs/jakarta-cactus/scratchpad/cactus2/samples/servlet/project.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- project.xml 13 Feb 2004 14:12:49 -0000 1.1
+++ project.xml 21 Feb 2004 16:39:30 -0000 1.2
@@ -28,6 +28,11 @@
<version>2.3</version>
</dependency>
<dependency>
+ <groupId>jetty</groupId>
+ <artifactId>org.mortbay.jetty</artifactId>
+ <version>4.2.17</version>
+ </dependency>
+ <dependency>
<groupId>httpunit</groupId>
<artifactId>httpunit</artifactId>
<version>1.5.4</version>
---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-dev-help@jakarta.apache.org