|
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 sys, os, unittest |
|
18 import __init__ |
|
19 |
|
20 ROOT_PATH = os.path.dirname(os.path.abspath(__file__)) |
|
21 |
|
22 from testautomation.base_testcase import BaseTestCase |
|
23 from cone.public import exceptions, plugin, api, container |
|
24 |
|
25 def abspath(path): |
|
26 return os.path.normpath(os.path.join(ROOT_PATH, path)) |
|
27 |
|
28 class TestGenconfmlGeneration(BaseTestCase): |
|
29 |
|
30 def test_generate_gcfml_layer1(self): self._run_gen_test(1) |
|
31 def test_generate_gcfml_layer2(self): self._run_gen_test(2) |
|
32 # Related to the ignored file, see ticket #160: Sequence items with extension policy prefix are reversed |
|
33 def test_generate_gcfml_layer3(self): self._run_gen_test(3, ignores=['feature2.txt']) |
|
34 def test_generate_gcfml_layer4(self): self._run_gen_test(4) |
|
35 |
|
36 def _run_gen_test(self, layer, ignores=[]): |
|
37 project_dir = abspath('project') |
|
38 config = 'root%s.confml' % layer |
|
39 output_dir = abspath('temp/gen_output%s' % layer) |
|
40 expected_dir = abspath('expected/root%s' % layer) |
|
41 |
|
42 self.remove_if_exists(output_dir) |
|
43 |
|
44 prj = api.Project(api.Storage.open(project_dir)) |
|
45 config = prj.get_configuration(config) |
|
46 impls = plugin.get_impl_set(config, 'gcfml$') |
|
47 impls.output = output_dir |
|
48 impls.generate() |
|
49 |
|
50 self.assert_dir_contents_equal(output_dir, expected_dir, ['.svn'] + ignores) |