configurationengine/source/plugins/symbian/ConeCRMLPlugin/CRMLPlugin/tests/unittest_crml_validation.py
changeset 3 e7e0ae78773e
equal deleted inserted replaced
2:87cfa131b535 3:e7e0ae78773e
       
     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 os
       
    18 
       
    19 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
       
    20 
       
    21 from testautomation.base_testcase import BaseTestCase
       
    22 from cone.public import api
       
    23 import cone.validation.implmlvalidation
       
    24 
       
    25 class TestCrmlValidation(BaseTestCase):
       
    26     
       
    27     def _run_test(self, filename):
       
    28         filepath = 'Layer1/implml/' + filename
       
    29         project_dir = os.path.join(ROOT_PATH, 'validation_project')
       
    30         config      = 'root.confml'
       
    31         
       
    32         prj = api.Project(api.Storage.open(project_dir))
       
    33         config = prj.get_configuration(config)
       
    34         problems = cone.validation.implmlvalidation.validate_impls(config, filter=filepath + '$')
       
    35         
       
    36         self.assert_problem_list_equals_expected(
       
    37             actual = problems,
       
    38             expected_file = os.path.join(ROOT_PATH, 'validation_expected', filename + '.txt'),
       
    39             outdir = os.path.join(ROOT_PATH, 'temp/validation', filename))
       
    40     
       
    41     def test_validate_invalid_refs(self):
       
    42         self._run_test('00000002_invalid_refs.crml')
       
    43     
       
    44     def test_validate_duplicate_uids(self):
       
    45         self._run_test('00000003_duplicate_uids.crml')