|
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 package com.nokia.s60tools.imaker.internal.iqrf.tests; |
|
18 |
|
19 import java.util.List; |
|
20 |
|
21 import junit.framework.TestCase; |
|
22 |
|
23 import com.nokia.s60tools.imaker.internal.iqrf.Configuration; |
|
24 import com.nokia.s60tools.imaker.internal.iqrf.IQRFFactory; |
|
25 import com.nokia.s60tools.imaker.internal.iqrf.Setting; |
|
26 import com.nokia.s60tools.imaker.internal.iqrf.Target; |
|
27 |
|
28 public class ConfigurationTest extends TestCase { |
|
29 protected Configuration fixture = null; |
|
30 |
|
31 protected void setFixture(Configuration fixture) { |
|
32 this.fixture = fixture; |
|
33 } |
|
34 |
|
35 private Configuration getFixture() { |
|
36 return fixture; |
|
37 } |
|
38 |
|
39 public void setUp() throws Exception { |
|
40 setFixture(IQRFFactory.eINSTANCE.createConfiguration()); |
|
41 } |
|
42 |
|
43 public void tearDown() throws Exception { |
|
44 setFixture(null); |
|
45 } |
|
46 |
|
47 public void testAddSetting__Setting() { |
|
48 // Ensure that you remove @generated or mark it @generated NOT |
|
49 Setting s1 = IQRFFactory.eINSTANCE.createSetting(); |
|
50 Setting s2 = IQRFFactory.eINSTANCE.createSetting(); |
|
51 Configuration ct = getFixture(); |
|
52 ct.addSetting(s1); |
|
53 ct.addSetting(s2); |
|
54 List settings = (List)ct.getSettings(); |
|
55 assertTrue(settings.contains(s1)); |
|
56 assertTrue(settings.contains(s2)); |
|
57 assertEquals(settings.get(0),s1); |
|
58 } |
|
59 |
|
60 public void testAddTargetRef__Target() { |
|
61 // Ensure that you remove @generated or mark it @generated NOT |
|
62 Target t1 = IQRFFactory.eINSTANCE.createTarget(); |
|
63 Target t2 = IQRFFactory.eINSTANCE.createTarget(); |
|
64 Configuration ct = getFixture(); |
|
65 ct.addTargetRef(t1); |
|
66 ct.addTargetRef(t2); |
|
67 List targets = (List)ct.getTargetrefs(); |
|
68 assertTrue(targets.contains(t1)); |
|
69 assertTrue(targets.contains(t2)); |
|
70 assertEquals(targets.get(0),t1); |
|
71 } |
|
72 |
|
73 public void testName() { |
|
74 String name = "configurationName"; |
|
75 Configuration ct = getFixture(); |
|
76 ct.setName(name); |
|
77 assertEquals(ct.getName(),name); |
|
78 } |
|
79 |
|
80 public void testFilePath() { |
|
81 String fp = "c:\\temp\\f1.xml"; |
|
82 Configuration ct = getFixture(); |
|
83 ct.setFilePath(fp); |
|
84 assertEquals(ct.getFilePath(),fp); |
|
85 } |
|
86 } //ConfigurationTest |