Skip to main content
summaryrefslogtreecommitdiffstats
blob: ae2115472d5ef376deb24ff015b4a78fda496334 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/*******************************************************************************
 * Copyright (c) 2006 - 2006 Mylar eclipse.org project and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Mylar project committers - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylar.trac.tests.support;

import org.eclipse.mylar.trac.tests.Constants;
import org.eclipse.mylar.trac.tests.support.XmlRpcServer.Ticket;

/**
 * Initializes Trac repositories to a defined state. This is done once per test
 * run, since cleaning and initializing the repository for each test method
 * would take too long.
 * 
 * @author Steffen Pingel
 */
public class TestFixture {

	public static XmlRpcServer.TestData data1;

	public static XmlRpcServer.TestData init010() throws Exception {
		if (data1 == null) {
			XmlRpcServer server = new XmlRpcServer(Constants.TEST_REPOSITORY1_URL,
					Constants.TEST_REPOSITORY1_ADMIN_USERNAME, Constants.TEST_REPOSITORY1_ADMIN_PASSWORD);

			server.ticketVersion(null).deleteAll();
			server.ticketVersion("v1").create(86400, "description1");
			server.ticketVersion("v2").create(86400 * 2, "description2");

			server.ticket().deleteAll();

			server.ticketMilestone("m1").deleteAndCreate();
			Ticket ticket = server.ticket().create("summary1", "description1");
			ticket.update("comment", "milestone", "m1");

			server.ticketMilestone("m2").deleteAndCreate();
			ticket = server.ticket().create("summary2", "description2");
			ticket.update("comment", "milestone", "m2");
			ticket = server.ticket().create("summary3", "description3");
			ticket.update("comment", "milestone", "m2");

			ticket = server.ticket().create("summary4", "description4");

			data1 = server.getData();
		}
		return data1;
	}

	public static void cleanup010() throws Exception {
		if (data1 != null) {
			data1.cleanup();
			data1 = null;
		}
	}

}

Back to the top