configurationengine/source/cone/validation/tests/unittest_implmlvalidation.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 import __init__
       
    19 
       
    20 ROOT_PATH = os.path.dirname(os.path.abspath(__file__))
       
    21 TESTDATA_DIR = os.path.join(ROOT_PATH, 'testdata')
       
    22 TEMP_DIR = os.path.join(ROOT_PATH, 'temp')
       
    23 
       
    24 from testautomation.base_testcase import BaseTestCase
       
    25 from cone.public import api
       
    26 import cone.validation.implmlvalidation
       
    27 
       
    28 class TestImplmlValidation(BaseTestCase):
       
    29     
       
    30     def _run_test(self, filename):
       
    31         filepath = 'Layer1/implml/' + filename
       
    32         project_dir = os.path.join(ROOT_PATH, 'testdata/model/implml/project')
       
    33         config      = 'root.confml'
       
    34         
       
    35         prj = api.Project(api.Storage.open(project_dir))
       
    36         config = prj.get_configuration(config)
       
    37         problems = cone.validation.implmlvalidation.validate_impls(config, filter=filepath + '$')
       
    38         
       
    39         self.assert_problem_list_equals_expected(
       
    40             actual = problems,
       
    41             expected_file = os.path.join(ROOT_PATH, 'testdata/model/implml/expected', filename + '.txt'),
       
    42             outdir = os.path.join(ROOT_PATH, 'temp/implml_model', filename))
       
    43     
       
    44     def test_validate_duplicate_tempvar_refs(self):
       
    45         self._run_test('duplicate_tempvar_ref.implml')
       
    46