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