My favorites | Sign in
Project Home Downloads Wiki Issues Source
Search
for
DeveloperGuide  
Setup Instructions for Development
Featured
Updated Jul 23, 2010 by lhori...@gmail.com

Developer setup instructions are the same as described in the InstallGuide. Take special note of the instructions below if you wish to run the unit tests, or build. For a quick description of SubEtha's architecture, see this blog entry written by Scott Ferguson (of Caucho).

Eclipse Setup

The core developers use Eclipse as their IDE (some would say for lack of something better).

SVN Checkout

In order to setup Eclipse, you should first make sure to install the Subclipse plugin. Once you have installed that plugin. Select File->Import->Checkout projects from SVN. Select "Create a new repository location". Enter the URL for SubEtha's repository: http://subetha.googlecode.com/svn/trunk

Resin User Library

SubEtha trunk does not actually include the Resin appserver jars - this would be cumbersome. SubEtha uses an Eclipse User Library, called something like "Resin 4.0.8" (the # changes version to version). When you first open the SubEtha project in Eclipse you will get errors because you haven't defined this User Library yourself yet. You should be able to do this in the Preferences->Java->Build Path->User Libraries section. Note that the naming of the user library must be exactly the same as what is (currently) configured in the project.

Add all the jars in ${resin.home}/lib.

Building

The next step is to build SubEtha. From the Java perspective, select Window->Show View->Ant. Right click in the Ant view and Add buildfiles. Then look for the top level SubEtha build file and add it. Once that is done, you can double click the 'deploy' target which will build SubEtha and install it in the right deployment directory location.

Startup

When SubEtha runs for the first time, it creates a site administrator account named root@localhost, with the password password. You can login with these credentials initially.

Directory Layout

The subdirectories correspond to various components:

  • src - The main source tree for the application. Sub-sections are broken up as described below.
  • src/.../i/... - Public interface (API) layer which gets packaged into subetha-client.jar. These interfaces can be called remotely via hessian.

  • src/.../common/... - Common utility classes, shared by all components.
  • src/.../core/... - The core business logic, implemented as a set of EJBs and "web beans".
  • src/.../plugin/... - Implementation of all the plugins distributed with SubEtha. Note that the plugin interfaces are part of core and built into the core api jar.
  • src/.../entity/... - The data model. Contains JPA/Hibernate entity beans and all queries.
  • rtest - All junit regression testing code and instructions. JUnit tests are remote hessian clients to the core ejb interface.
  • loadtest - A simple load tester to create a bunch of emails for a test list.
  • web - The front end web application, packaged as a war. Contains JSPs and all other content, acts as a client to the core layer.

Testing

There are a number of tests that can run against subetha to verify the installation and to help with developement. All of these tests require that you run subetha while testing; we suggest not using it during tests as some site wide changes are made during the tests.

Running Regression Tests

How to run the JUnit regression tests from ant:

  • Make sure the code you want to test is deployed. ant deploy will build the latest and deploy it.
  • SubEtha must be running its SMTP service on port 2500.
  • Make sure port 2525 and 2526 are free; the unit tests start mock SMTP servers on these ports.
  • Start Resin. The unit tests are run against the live container.
  • Run ant junit. All your regression tests will run.
  • If you want to run just one set of tests, edit the junit.special.tests property in your build.properties or better yet user.properties. Then run the ant junit-special target.
  • If you want to run the special unit test(s) in the debugger, run the ant junit-debug target. The JVM will pause and wait until you attach with Eclipse.

  • You don't actually need ant to run the tests - just run them from Eclipse by creating a new Run Profile. Makes debugging easy too.

Running Load Tests

You can run a test to put a little stress on your server. It will send a continuous stream of messages, and then count the number of recipients whom receive them. It is a not a scientific load test, but shows that the system can handle many concurrent requests.

  1. Start Resin (w deployment) See the InstallGuide if you need help.
  2. Create a list to test with. The name of the list and other information is in loadtest/build.xml. Here is what is in the standard build file.
  3. 	<property name="from" value="root@localhost"/>
    	<property name="to" value="load@localhost"/>
    	<property name="attachmentFilePath" value="/tmp/attachment.dat"/>
  4. Run the test. ant genload

Interactive Testing

It is easy to interactively test SubEtha by injecting email from your mail client directly into an instance of SubEtha. The way to do it is to setup a mail account in your client with a From: address of a subscriber on the list, the To: address is an existing list email. Make sure the outgoing mail server is the SubEtha server and that it is running on port 2500.

It is also very easy to connect to port 2500 and just talk to the mail server! In rtest/testsmtpconv.txt you will find a simple text file containing the client conversation which can be easy pasted into an open (telnet) connection.

	telnet localhost 2500
	<paste contents of file>

Sign in to add a comment
Powered by Google Project Hosting