danny 2003/01/06 06:07:44
Added: tests/src/java/org/apache/james/testing DeliveryTests.java
SimpleTests.java
Log:
added DeliveryTests to test handling of specific cases and test suite SimpleTests to
run this and any other similar simple tests
Revision Changes Path
1.1
jakarta-james/tests/src/java/org/apache/james/testing/DeliveryTests.java
Index: DeliveryTests.java
===================================================================
/**
* DeliveryTests.java
*
* Copyright (C) 06-Jan-2003 The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*
* Danny Angus
*/
package org.apache.james.testing;
import java.io.IOException;
import java.net.SocketException;
import org.apache.commons.net.smtp.SMTPClient;
import junit.framework.TestCase;
/**
* @author <A href="mailto:[EMAIL PROTECTED]">Danny Angus</a>
*
* $Id: DeliveryTests.java,v 1.1 2003/01/06 14:07:44 danny Exp $
*/
public class DeliveryTests extends TestCase {
/**
* Constructor for DeliveryTests.
* @param arg0
*/
public DeliveryTests(String arg0) {
super(arg0);
}
public void testSpam() {
String spamMail="Subject: spam test\nFrom: postmaster@localhost\nTo:
noone@localhost\n\nTHIS IS A TEST";
SMTPClient client = new SMTPClient();
try {
client.connect("127.0.0.1", 25);
client.sendSimpleMessage("postmaster@localhost",
"noone@localhost", spamMail);
client.disconnect();
} catch (SocketException e) {
assert(false);
} catch (IOException e) {
assert(false);
}
assert(true);
}
public void testOutgoing(){
String outgoingMail="Subject: outgoing test\nFrom: postmaster@localhost\nTo:
[EMAIL PROTECTED]\n\nTHIS IS A TEST";
SMTPClient client = new SMTPClient();
try {
client.connect("127.0.0.1", 25);
client.sendSimpleMessage("postmaster@localhost",
"[EMAIL PROTECTED]", outgoingMail);
client.disconnect();
} catch (SocketException e) {
assert(false);
} catch (IOException e) {
assert(false);
}
assert(true);
}
}
1.1
jakarta-james/tests/src/java/org/apache/james/testing/SimpleTests.java
Index: SimpleTests.java
===================================================================
/**
* AllTests.java
*
* Copyright (C) 06-Jan-2003 The Apache Software Foundation. All rights reserved.
*
* This software is published under the terms of the Apache Software License
* version 1.1, a copy of which has been included with this distribution in
* the LICENSE file.
*
* Danny Angus
*/
package org.apache.james.testing;
import junit.framework.Test;
import junit.framework.TestSuite;
/**
* @author <A href="mailto:[EMAIL PROTECTED]">Danny Angus</a>
*
* $Id: SimpleTests.java,v 1.1 2003/01/06 14:07:44 danny Exp $
*/
public class SimpleTests {
public static void main(String[] args) {
junit.textui.TestRunner.run(SimpleTests.class);
}
public static Test suite() {
TestSuite suite = new TestSuite("Test for org.apache.james.testing");
//$JUnit-BEGIN$
suite.addTest(new TestSuite(DeliveryTests.class));
//$JUnit-END$
return suite;
}
}
--
To unsubscribe, e-mail: <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>