01: // Copyright (C) 2003,2004,2005 by Object Mentor, Inc. All rights reserved.
02: // Released under the terms of the GNU General Public License version 2 or later.
03: package fitnesse.testutil;
04:
05: import fitnesse.*;
06: import fitnesse.util.FileUtil;
07: import fitnesse.responders.ResponderFactory;
08: import fitnesse.wiki.*;
09:
10: public class FitNesseUtil {
11: private static FitNesse instance = null;
12: public static final int port = 1999;
13: public static FitNesseContext context;
14: public static final String URL = "http://localhost:" + port + "/";
15:
16: public static void startFitnesse(WikiPage root) throws Exception {
17: context = new FitNesseContext();
18: context.root = root;
19: context.port = port;
20: context.rootPath = "TestDir";
21: context.rootPageName = root.getName();
22: context.rootPagePath = context.rootPath + "/"
23: + context.rootPageName;
24: context.responderFactory = new ResponderFactory(
25: context.rootPagePath);
26: instance = new FitNesse(context);
27: instance.start();
28: }
29:
30: public static void stopFitnesse() throws Exception {
31: instance.stop();
32: FileUtil.deleteFileSystemDirectory("TestDir");
33: }
34:
35: public static void bindVirtualLinkToPage(WikiPage host,
36: WikiPage proxy) throws Exception {
37: VirtualCouplingPage coupling = new VirtualCouplingPage(host,
38: proxy);
39: ((VirtualCouplingExtension) host
40: .getExtension(VirtualCouplingExtension.NAME))
41: .setVirtualCoupling(coupling);
42: }
43: }
|