0
|
1 |
/*
|
|
2 |
* Copyright (c) 2008 Nokia Corporation and/or its subsidiary(-ies).
|
|
3 |
* All rights reserved.
|
|
4 |
* This component and the accompanying materials are made available
|
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
|
6 |
* which accompanies this distribution, and is available
|
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
|
8 |
*
|
|
9 |
* Initial Contributors:
|
|
10 |
* Nokia Corporation - initial contribution.
|
|
11 |
*
|
|
12 |
* Contributors:
|
|
13 |
*
|
|
14 |
* Description:
|
|
15 |
*
|
|
16 |
*/
|
|
17 |
|
|
18 |
|
|
19 |
package com.nokia.s60tools.imaker.internal.tests;
|
|
20 |
|
|
21 |
import junit.framework.TestCase;
|
|
22 |
|
|
23 |
import com.nokia.s60tools.imaker.UIConfiguration;
|
|
24 |
import com.nokia.s60tools.imaker.UIVariable;
|
|
25 |
import com.nokia.s60tools.imaker.internal.iqrf.Configuration;
|
|
26 |
import com.nokia.s60tools.imaker.internal.iqrf.ConfigurationElement;
|
|
27 |
import com.nokia.s60tools.imaker.internal.iqrf.IQRFFactory;
|
|
28 |
import com.nokia.s60tools.imaker.internal.iqrf.Interface;
|
|
29 |
import com.nokia.s60tools.imaker.internal.iqrf.Result;
|
|
30 |
import com.nokia.s60tools.imaker.internal.iqrf.Setting;
|
|
31 |
import com.nokia.s60tools.imaker.internal.iqrf.Target;
|
|
32 |
|
|
33 |
public class UIConfigurationTest extends TestCase{
|
|
34 |
private Configuration conf = null;
|
|
35 |
private UIConfiguration uiConfig = null;
|
|
36 |
|
|
37 |
public void setUp() throws Exception {
|
|
38 |
Target target1 = IQRFFactory.eINSTANCE.createTarget();
|
|
39 |
target1.setName("Target 1");
|
|
40 |
target1.setDescription("This is a target");
|
|
41 |
Target target2 = IQRFFactory.eINSTANCE.createTarget();
|
|
42 |
target2.setName("Target 2");
|
|
43 |
target2.setDescription("This is another target");
|
|
44 |
Result result = IQRFFactory.eINSTANCE.createResult();
|
|
45 |
Interface intf = IQRFFactory.eINSTANCE.createInterface();
|
|
46 |
intf.setName("A new interface");
|
|
47 |
ConfigurationElement element1 = IQRFFactory.eINSTANCE.createConfigurationElement();
|
|
48 |
element1.setName(com.nokia.s60tools.imaker.internal.wrapper.IMakerWrapperPreferences.PRODUCT_NAME);
|
|
49 |
element1.setDescription("Product name");
|
|
50 |
element1.setValues("char[255]");
|
|
51 |
ConfigurationElement element2 = IQRFFactory.eINSTANCE.createConfigurationElement();
|
|
52 |
element2.setName(com.nokia.s60tools.imaker.internal.wrapper.IMakerWrapperPreferences.COREPLATFORM_NAME);
|
|
53 |
element2.setDescription("Core Platform Name");
|
|
54 |
element2.setValues("char[255]");
|
|
55 |
ConfigurationElement element3 = IQRFFactory.eINSTANCE.createConfigurationElement();
|
|
56 |
element3.setName("HWID");
|
|
57 |
element3.setDescription("Hardware Id");
|
|
58 |
element3.setValues("char[255]");
|
|
59 |
intf.addConfigurationElement(element1);
|
|
60 |
intf.addConfigurationElement(element2);
|
|
61 |
intf.addConfigurationElement(element3);
|
|
62 |
conf = IQRFFactory.eINSTANCE.createConfiguration();
|
|
63 |
conf.setName("MAKEFILE.MK");
|
|
64 |
conf.setFilePath("c:\\temp\\something");
|
|
65 |
conf.addTargetRef(target1);
|
|
66 |
conf.addTargetRef(target2);
|
|
67 |
Setting setting1 = IQRFFactory.eINSTANCE.createSetting();
|
|
68 |
setting1.setName("Product Name");
|
|
69 |
setting1.setValue("devlon51");
|
|
70 |
setting1.setConfigurationElement(element1);
|
|
71 |
Setting setting2 = IQRFFactory.eINSTANCE.createSetting();
|
|
72 |
setting2.setName("core platform name");
|
|
73 |
setting2.setValue("ncp51");
|
|
74 |
setting2.setConfigurationElement(element2);
|
|
75 |
Setting setting3 = IQRFFactory.eINSTANCE.createSetting();
|
|
76 |
setting3.setName("hwid");
|
|
77 |
setting3.setValue("HWID_5101 HWID_5102");
|
|
78 |
setting3.setConfigurationElement(element3);
|
|
79 |
conf.addSetting(setting1);
|
|
80 |
conf.addSetting(setting2);
|
|
81 |
conf.addSetting(setting3);
|
|
82 |
result.addConfiguration(conf);
|
|
83 |
result.addInterface(intf);
|
|
84 |
result.addTarget(target1);
|
|
85 |
result.addTarget(target2);
|
|
86 |
|
|
87 |
uiConfig = new UIConfiguration(conf);
|
|
88 |
|
|
89 |
}
|
|
90 |
|
|
91 |
public void testUIConfigurationProductName() {
|
|
92 |
assertEquals("devlon51", uiConfig.getProductName());
|
|
93 |
}
|
|
94 |
|
|
95 |
public void testUIConfigurationMakeFileName() {
|
|
96 |
assertEquals("MAKEFILE.MK", uiConfig.getMakeFileName());
|
|
97 |
}
|
|
98 |
|
|
99 |
public void testUIConfigurationMakeFilePath() {
|
|
100 |
assertEquals("c:\\temp\\something", uiConfig.getFilePath());
|
|
101 |
}
|
|
102 |
|
|
103 |
public void testUIConfigurationDefaultHWID() {
|
|
104 |
assertEquals("HWID_5101", uiConfig.getDefaultHWID());
|
|
105 |
}
|
|
106 |
|
|
107 |
public void testUIConfigurationTargets() {
|
|
108 |
assertTrue(uiConfig.getAllTargets() != null);
|
|
109 |
assertEquals(2,uiConfig.getAllTargets().size());
|
|
110 |
}
|
|
111 |
|
|
112 |
public void testUIConfigurationVariables() {
|
|
113 |
assertEquals(3,uiConfig.getVariables().size());
|
|
114 |
UIVariable variable = (UIVariable)uiConfig.getVariables().get(0);
|
|
115 |
assertEquals("Product Name",variable.getName());
|
|
116 |
assertEquals("char[255]",variable.getValueFormat());
|
|
117 |
}
|
|
118 |
|
|
119 |
public void testUIConfigurationHWID() {
|
|
120 |
assertTrue(uiConfig.getHWIDs() != null);
|
|
121 |
assertEquals(2,uiConfig.getHWIDs().size());
|
|
122 |
}
|
|
123 |
|
|
124 |
public void testUIConfigurationPlatformName() {
|
|
125 |
assertEquals("ncp51", uiConfig.getPlatformName());
|
|
126 |
}
|
|
127 |
}
|