|
Lines 11-19
Link Here
|
| 11 |
|
11 |
|
| 12 |
package org.eclipse.mylar.bugzilla.tests; |
12 |
package org.eclipse.mylar.bugzilla.tests; |
| 13 |
|
13 |
|
|
|
14 |
import java.io.File; |
| 15 |
import java.io.FileReader; |
| 16 |
import java.io.Reader; |
| 17 |
|
| 14 |
import junit.framework.TestCase; |
18 |
import junit.framework.TestCase; |
| 15 |
|
19 |
|
|
|
20 |
import org.eclipse.core.runtime.Path; |
| 21 |
import org.eclipse.core.runtime.Platform; |
| 16 |
import org.eclipse.mylar.bugzilla.core.NewBugModel; |
22 |
import org.eclipse.mylar.bugzilla.core.NewBugModel; |
|
|
23 |
import org.eclipse.mylar.bugzilla.core.internal.NewBugParser; |
| 17 |
import org.eclipse.mylar.bugzilla.ui.wizard.AbstractWizardDataPage; |
24 |
import org.eclipse.mylar.bugzilla.ui.wizard.AbstractWizardDataPage; |
| 18 |
import org.eclipse.ui.PlatformUI; |
25 |
import org.eclipse.ui.PlatformUI; |
| 19 |
|
26 |
|
|
Lines 22-37
Link Here
|
| 22 |
*/ |
29 |
*/ |
| 23 |
public class NewBugWizardTest extends TestCase { |
30 |
public class NewBugWizardTest extends TestCase { |
| 24 |
|
31 |
|
| 25 |
public void testPlatformOptions() { |
32 |
public void testPlatformOptions() throws Exception { |
|
|
33 |
|
| 34 |
File f = FileTool.getFileInPlugin(BugzillaTestPlugin.getDefault(), new Path("TestPages/cdt-page.html")); |
| 35 |
|
| 36 |
Reader in = new FileReader(f); |
| 37 |
|
| 26 |
NewBugModel model = new NewBugModel(); |
38 |
NewBugModel model = new NewBugModel(); |
| 27 |
AbstractWizardDataPage page = new TestWizardDataPage(); |
39 |
AbstractWizardDataPage page = new TestWizardDataPage(); |
|
|
40 |
|
| 41 |
new NewBugParser(in).parseBugAttributes(model, true); // ** TRUE vs FALSE ** |
| 42 |
|
| 28 |
page.setPlatformOptions(model); |
43 |
page.setPlatformOptions(model); |
| 29 |
|
44 |
|
| 30 |
// TODO: uncomment and make it pass |
45 |
String os = Platform.getOS(); |
| 31 |
// String os = Platform.getOS(); |
46 |
if ( os.equals("win32") ) |
| 32 |
// String platform = Platform.getOSArch(); |
47 |
assertEquals("Windows All", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue()); |
| 33 |
// assertEquals(os, model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS)); |
48 |
else if ( os.equals("solaris") ) |
| 34 |
// assertEquals(platform, model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM)); |
49 |
assertEquals("Solaris", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue()); |
|
|
50 |
else if ( os.equals("qnx") ) |
| 51 |
assertEquals("QNX-Photon", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue()); |
| 52 |
else if ( os.equals("macosx") ) |
| 53 |
assertEquals("MacOS X", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue()); |
| 54 |
else if ( os.equals("linux")) |
| 55 |
assertEquals("Linux", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue()); |
| 56 |
else if ( os.equals("hpux")) |
| 57 |
assertEquals("HP-UX", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue()); |
| 58 |
else if ( os.equals("aix" )) |
| 59 |
assertEquals("AIX", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_OS).getValue()); |
| 60 |
|
| 61 |
|
| 62 |
String platform = Platform.getOSArch(); |
| 63 |
|
| 64 |
if ( platform.equals("x86")) |
| 65 |
assertEquals("PC", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue()); |
| 66 |
else if ( platform.equals("x86_64")) |
| 67 |
assertEquals("PC", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue()); |
| 68 |
else if ( platform.equals("ia64")) |
| 69 |
assertEquals("PC", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue()); |
| 70 |
else if ( platform.equals("ia64_32")) |
| 71 |
assertEquals("PC", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue()); |
| 72 |
else if ( platform.equals("sparc")) |
| 73 |
assertEquals("Sun", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue()); |
| 74 |
else if ( platform.equals("ppc")) |
| 75 |
assertEquals("Power", model.getAttribute(AbstractWizardDataPage.ATTRIBUTE_PLATFORM).getValue()); |
| 76 |
|
| 35 |
} |
77 |
} |
| 36 |
|
78 |
|
| 37 |
static class TestWizardDataPage extends AbstractWizardDataPage { |
79 |
static class TestWizardDataPage extends AbstractWizardDataPage { |
|
Lines 40-44
Link Here
|
| 40 |
super("", "", "", PlatformUI.getWorkbench()); |
82 |
super("", "", "", PlatformUI.getWorkbench()); |
| 41 |
} |
83 |
} |
| 42 |
} |
84 |
} |
|
|
85 |
|
| 43 |
|
86 |
|
| 44 |
} |
87 |
} |