Skip to main content
summaryrefslogtreecommitdiffstats
blob: 5fb813d493e0d9e08cd681c7bb429203a682c7f9 (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
/*******************************************************************************
 * Copyright (c) 2013 Frank Becker and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse @Test
	public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     Frank Becker - initial API and implementation
 *******************************************************************************/

package org.eclipse.mylyn.bugzilla.tests.core;

import junit.framework.TestCase;

import org.apache.commons.io.IOUtils;
import org.eclipse.mylyn.bugzilla.tests.support.BugzillaFixture;
import org.eclipse.mylyn.commons.sdk.util.CommonTestUtil;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttribute;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaAttributeMapper;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaCorePlugin;
import org.eclipse.mylyn.internal.bugzilla.core.BugzillaRepositoryConnector;
import org.eclipse.mylyn.tasks.core.TaskRepository;
import org.eclipse.mylyn.tasks.core.data.TaskAttribute;
import org.eclipse.mylyn.tasks.core.data.TaskData;

/**
 * @author Steffen Pingel
 */
public class BugzillaAttributeTest extends TestCase {

	public void testTaskDataSchema() throws Exception {
		BugzillaRepositoryConnector connector = BugzillaFixture.current().connector();
		TaskRepository repository = new TaskRepository(BugzillaCorePlugin.CONNECTOR_KIND, "http://repository");
		BugzillaAttributeMapper mapper = new BugzillaAttributeMapper(repository, connector);
		TaskData taskData = new TaskData(mapper, repository.getConnectorKind(), repository.getRepositoryUrl(), "");
		BugzillaAttribute[] attributes = BugzillaAttribute.values();
		for (BugzillaAttribute attribute : attributes) {
			TaskAttribute taskDataAttribute = taskData.getRoot().createAttribute(attribute.getKey());
			taskDataAttribute.getMetaData().setReadOnly(attribute.isReadOnly());
			taskDataAttribute.getMetaData().setKind(attribute.getKind());
			taskDataAttribute.getMetaData().setType(attribute.getType());
		}
		assertEquals(IOUtils.toString(CommonTestUtil.getResource(this, "testdata/schema/taskdata.txt")),
				taskData.getRoot().toString());
	}

}

Back to the top