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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
|
/*******************************************************************************
* Copyright (c) 2004 - 2006 University Of British Columbia 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:
* University Of British Columbia - initial API and implementation
*******************************************************************************/
package org.eclipse.mylar.bugzilla.tests;
import java.io.File;
import java.io.FileReader;
import java.io.Reader;
import junit.framework.TestCase;
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.mylar.internal.bugzilla.core.NewBugModel;
import org.eclipse.mylar.internal.bugzilla.core.internal.NewBugParser;
import org.eclipse.mylar.internal.bugzilla.ui.wizard.AbstractWizardDataPage;
import org.eclipse.ui.PlatformUI;
/**
* @author Mik Kersten
* @author Ian Bull
*/
public class NewBugWizardTest extends TestCase {
public void testPlatformOptions() throws Exception {
File f = FileTool.getFileInPlugin(BugzillaTestPlugin.getDefault(), new Path("testdata/pages/cdt-page.html"));
Reader in = new FileReader(f);
NewBugModel model = new NewBugModel();
AbstractWizardDataPage page = new TestWizardDataPage();
new NewBugParser(in).parseBugAttributes(model, true); // ** TRUE vs
// FALSE **
page.setPlatformOptions(model);
String os = Platform.getOS();
if (os.equals("win32"))
assertEquals("Windows All", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue());
else if (os.equals("solaris"))
assertEquals("Solaris", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue());
else if (os.equals("qnx"))
assertEquals("QNX-Photon", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue());
else if (os.equals("macosx"))
assertEquals("MacOS X", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue());
else if (os.equals("linux"))
assertEquals("Linux", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue());
else if (os.equals("hpux"))
assertEquals("HP-UX", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue());
else if (os.equals("aix"))
assertEquals("AIX", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue());
String platform = Platform.getOSArch();
if (platform.equals("x86"))
assertEquals("PC", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue());
else if (platform.equals("x86_64"))
assertEquals("PC", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue());
else if (platform.equals("ia64"))
assertEquals("PC", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue());
else if (platform.equals("ia64_32"))
assertEquals("PC", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue());
else if (platform.equals("sparc"))
assertEquals("Sun", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue());
else if (platform.equals("ppc"))
assertEquals("Power", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue());
}
static class TestWizardDataPage extends AbstractWizardDataPage {
public TestWizardDataPage() {
super("", "", "", PlatformUI.getWorkbench());
}
}
}
|