|
1 # |
|
2 # Copyright (c) 2009 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 import unittest |
|
18 import os, shutil |
|
19 import sys |
|
20 import logging |
|
21 |
|
22 from cone.public import exceptions,plugin,api,container |
|
23 from cone.storage import filestorage |
|
24 from legacyruleplugin import ruleml |
|
25 |
|
26 # Hardcoded value of testdata folder that must be under the current working dir |
|
27 ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) |
|
28 testdata = os.path.join(ROOT_PATH,'rule') |
|
29 |
|
30 class TestRuleEmptyPlugin(unittest.TestCase): |
|
31 def setUp(self): |
|
32 pass |
|
33 |
|
34 def tearDown(self): |
|
35 pass |
|
36 |
|
37 |
|
38 def test_rule_with_empty_value1(self): |
|
39 return |
|
40 project = api.Project(api.Storage.open(os.path.join(ROOT_PATH,'ruleproject/rules'), "a" )) |
|
41 config = project.get_configuration('root.confml') |
|
42 implcontainer = plugin.get_impl_set(config) |
|
43 implcontainer.generate() |
|
44 lastconfig = config.get_last_configuration() |
|
45 self.assertEquals(lastconfig.get_path(),ruleml.RuleImpl.AUTOCONFIGURATION_CONFML) |
|
46 self.assertEquals(lastconfig.get_data('imakerapi.outputLocation').get_ref(),'outputLocation') |
|
47 self.assertEquals(lastconfig.get_data('imakerapi.outputLocation').get_value(),'2') |
|
48 self.assertEquals(lastconfig.get_data('imakerapi.outputLocationY').get_value(),'hello') |
|
49 self.assertEquals(lastconfig.get_data('operations.minus').get_value(),'18') |
|
50 self.assertEquals(lastconfig.get_data('operations.minus1').get_value(),'35') |
|
51 self.assertEquals(lastconfig.get_data('operations.minus4').get_value(),'5') |
|
52 project.close() |
|
53 |
|
54 |
|
55 def test_rule_with_empty_value2(self): |
|
56 return |
|
57 project = api.Project(api.Storage.open(os.path.join(ROOT_PATH,'rule/config_project/platforms/customsw'), "a" )) |
|
58 config = project.get_configuration('root.confml') |
|
59 implcontainer = plugin.get_impl_set(config) |
|
60 implcontainer.generate() |
|
61 lastconfig = config.get_last_configuration() |
|
62 self.assertEquals(lastconfig.get_data('operations.minus').get_value(),'18') |
|
63 self.assertEquals(lastconfig.get_data('operations.minus1').get_value(),'35') |
|
64 self.assertEquals(lastconfig.get_data('operations.minus4').get_value(),'5') |
|
65 self.assertEquals(lastconfig.get_data('operations.minus6').get_value(),'19') |
|
66 self.assertEquals(lastconfig.get_data('operations.string1').get_value(),'HelloWorld') |
|
67 project.close() |
|
68 |
|
69 |
|
70 if __name__ == '__main__': |
|
71 unittest.main() |