Add some checks to prevent #13 happen.
2 * StarOffice News Server
3 * see AUTHORS for the list of contributors
5 * This program is free software: you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation, either version 3 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
21 import test.command.HelloQuitTest;
22 import test.command.ArticleTest;
23 import java.util.LinkedList;
24 import java.util.List;
25 import test.command.CapabilitiesTest;
26 import test.command.GroupTest;
27 import test.command.ListGroupTests;
28 import test.command.ListTest;
29 import test.command.NewGroupsTest;
30 import test.command.NextTest;
31 import test.command.OverTest;
32 import test.command.PostTest;
35 * Run this class to perform a full test.
36 * @author Christian Lins
39 public final class TestBench
42 public static void main(String[] args)
44 System.out.println("TestBench for NNTP (RFC3799) based servers ");
47 System.out.println("Usage: TestBench <host>[:port]");
51 String[] hostport = args[0].split(":");
52 String host = hostport[0];
54 if(hostport.length == 2)
56 port = Integer.parseInt(hostport[1]);
59 List<AbstractTest> tests = new LinkedList<AbstractTest>();
61 // Add tests to perform
62 tests.add(new HelloQuitTest());
63 tests.add(new PostTest()); // Post before Article
64 tests.add(new ArticleTest());
65 tests.add(new CapabilitiesTest());
66 tests.add(new GroupTest());
67 tests.add(new ListGroupTests());
68 tests.add(new ListTest());
69 tests.add(new NewGroupsTest());
70 tests.add(new NextTest());
71 tests.add(new OverTest());
74 for(AbstractTest test : tests)
78 test.connect(host, port);
79 int result = test.runTest();
80 System.out.print(test.getClass().getName() + " finished with exit code " + result + "\t => ");
83 System.out.println("SUCCESS");
87 System.out.println("FAILURE");
92 System.out.println("Test " + test.getClass().getName() + " failed: " + ex.getLocalizedMessage());