buildframework/helium/sf/python/pythoncore/lib/pythoncoretests/test_ccm_results.py
author wbernard
Fri, 13 Aug 2010 14:59:05 +0300
changeset 628 7c4a911dc066
parent 588 c7c26511138f
child 645 b8d81fa19e7d
permissions -rw-r--r--
helium_11.0.0-e00f171ca185
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     1
#============================================================================ 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     2
#Name        : test_ccm_results.py 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     3
#Part of     : Helium 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     4
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     5
#Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     6
#All rights reserved.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     7
#This component and the accompanying materials are made available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     8
#under the terms of the License "Eclipse Public License v1.0"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
     9
#which accompanies this distribution, and is available
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    10
#at the URL "http://www.eclipse.org/legal/epl-v10.html".
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    11
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    12
#Initial Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    13
#Nokia Corporation - initial contribution.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    14
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    15
#Contributors:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    16
#
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    17
#Description:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    18
#===============================================================================
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    19
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    20
""" Test cases for ccm python toolkit.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    21
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    22
"""
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    23
import unittest
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    24
import ccm
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    25
import os
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    26
import logging
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    27
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    28
# pylint: disable=R0201
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    29
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    30
_logger = logging.getLogger('test.ccm_results')
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    31
logging.basicConfig(level=logging.INFO)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    32
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    33
class CounterHandler(logging.Handler):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    34
    """ This class provides a logging handler to count errors, warnings and infos """    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    35
    def __init__(self, level=logging.NOTSET):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    36
        logging.Handler.__init__(self, level)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    37
        self.warnings = 0
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    38
        self.errors = 0
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    39
        self.infos = 0
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    40
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    41
    def emit(self, record):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    42
        """ Handle the count the errors. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    43
        if record.levelno == logging.INFO:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    44
            self.infos += 1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    45
        elif record.levelno == logging.WARNING:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    46
            self.warnings += 1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    47
        elif record.levelno == logging.ERROR:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    48
            self.errors += 1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    49
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    50
class MockResultSession(ccm.AbstractSession):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    51
    """ Fake session used to test Result"""
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    52
    def __init__(self, behave=None, database="fakedb"):
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    53
        ccm.AbstractSession.__init__(self, None, None, None, None)
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    54
        if behave == None:
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
    55
            behave = {}
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    56
        self._behave = behave
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    57
        self._database = database
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    58
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    59
    def database(self):
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    60
        """database"""
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    61
        return self._database
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    62
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    63
    def execute(self, cmdline, result=None):
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    64
        """execute"""
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    65
        if result == None:
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
    66
            result = ccm.Result(self)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    67
        if self._behave.has_key(cmdline):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    68
            result.statuserrors = 0  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    69
            result.output = self._behave[cmdline]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    70
        else:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    71
            result.status = -1  
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    72
        return result
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    73
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    74
    
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    75
class ResultTest(unittest.TestCase):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    76
    """ Testing Results parsers. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    77
    def test_Result(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    78
        """ Test result. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    79
        result = ccm.Result(None)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    80
        result.output = u"Nokia"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    81
        assert result.output == u"Nokia"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    82
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    83
    def test_Result_unicode_character(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    84
        """ Test result with unicode character. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    85
        result = ccm.Result(None)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    86
        result.output = u"Nokia\xc2"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    87
        print result.output.encode('ascii', 'replace')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    88
        assert result.output == u"Nokia?"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    89
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    90
    def test_Result_str(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    91
        """ Test result from str. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    92
        result = ccm.Result(None)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    93
        result.output = "Nokia"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    94
        assert result.output == "Nokia"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    95
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    96
    def test_Result_str_not_ascii(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    97
        """ Test result from str with not ascii. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    98
        result = ccm.Result(None)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
    99
        result.output = "Noki\xe4"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   100
        print result.output
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   101
        assert result.output == "Noki"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   102
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   103
   
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   104
    def test_ObjectListResult(self):
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   105
        """test object list result"""
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   106
        behave = { 'test_ObjectListResult': """mc-mc_0638:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   107
mc-mc_4031_0642:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   108
mc-mc_4031_0646:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   109
mc-mc_4031_0650:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   110
mc-mc_4031_0702:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   111
mc-mc_4031_0704:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   112
mc-mc_4031_0706:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   113
mc-mc_4031_0706_v2:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   114
mc-mc_4032_0708:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   115
mc-mc_4032_0710:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   116
mc-mc_4032_0712:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   117
mc-mc_4032_0714:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   118
mc-mc_4032_0716:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   119
mc-mc_4032_0718:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   120
mc-mc_4032_0720:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   121
mc-mc_4032_0722:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   122
mc-mc_4032_0724:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   123
mc-mc_4032_0726.lum.09:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   124
mc-mc_4032_0726:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   125
mc-mc_4032_0728:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   126
mc-mc_4032_0730:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   127
mc-mc_4032_0732:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   128
mc-mc_4032_0734:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   129
mc-mc_4032_0736:project:vc1s60p1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   130
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   131
"""}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   132
        session = MockResultSession(behave)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   133
        result = session.execute('test_ObjectListResult', ccm.ObjectListResult(session))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   134
        assert len(result.output) == 24, "output doesn't contains the right number of result project."
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   135
        for obj in result.output:
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   136
            assert obj.type == 'project'
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   137
            assert obj.name == 'mc'
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   138
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   139
    def test_WorkAreaInfoResult(self):
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   140
        """ test work area info result"""
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   141
        behave = { 'test_WorkAreaInfoResult': """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   142
Project                                            Maintain Copies Relative Time Translate Modify Path
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   143
-------------------------------------------------------------------
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   144
mc_5132_build-fa1f5132#loc_0734:project:jk1f5132#1 TRUE     TRUE   TRUE     TRUE TRUE      FALSE  'E:\\WBERNARD\\ccm_wa\\fa1f5132\\mc-fa1f5132#loc_0734\\mc\\mc_build'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   145
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   146
"""}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   147
        session = MockResultSession(behave)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   148
        result = session.execute('test_WorkAreaInfoResult', ccm.WorkAreaInfoResult(session))
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   149
        print result.output
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   150
        print result.output['path']
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   151
        assert str(result.output['project']) == "mc_5132_build-fa1f5132#loc_0734:project:jk1f5132#1", "wrong project name."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   152
        assert result.output['maintain'] == True, "maintain value is wrong."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   153
        assert result.output['copies'] == True, "copies value is wrong."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   154
        assert result.output['relative'] == True, "relative value is wrong."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   155
        assert result.output['time'] == True, "time value is wrong."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   156
        assert result.output['translate'] == True, "translate value is wrong."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   157
        assert result.output['modify'] == False, "modify value is wrong."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   158
        assert result.output['path'] == "E:\\WBERNARD\\ccm_wa\\fa1f5132\\mc-fa1f5132#loc_0734\\mc\\mc_build", "path value is wrong."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   159
            
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   160
    def test_FinduseResult(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   161
        """ Test the parsing of the FinduseResult class. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   162
        behave = { 'test_FinduseResult': """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   163
Ibusal_internal-fa1f5132#wbernard16:project:jk1imeng#1 working wbernard project Ibusal_internal jk1imeng#1 fa1f5132#2561
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   164
        IBUSAL_RapidoYawe\Ibusal_internal-fa1f5132#wbernard16@IBUSAL_RapidoYawe-fa1f5132#wbernard16:project:jk1imeng#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   165
        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   166
"""}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   167
        session = MockResultSession(behave)
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   168
        obj = session.create("Ibusal_internal-fa1f5132#wbernard16:project:jk1imeng#1")
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   169
        result = session.execute('test_FinduseResult', ccm.FinduseResult(obj))
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   170
        print result.output
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   171
        assert len(result.output) == 1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   172
        assert result.output[0]['project'].objectname == "IBUSAL_RapidoYawe-fa1f5132#wbernard16:project:jk1imeng#1"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   173
        assert result.output[0]['path'] == "IBUSAL_RapidoYawe"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   174
          
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   175
          
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   176
    def test_read_ccmwaid_info(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   177
        """ Testing read_ccmwaid_info, open a _ccmwaid.inf file and check the extracted data. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   178
        data = ccm.read_ccmwaid_info(os.path.join(os.environ['TEST_DATA'], 'data', 'test_ccmwaid.inf'))
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   179
        _logger.debug(data)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   180
        assert data['database'] == "jk1f5132"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   181
        assert data['objectname'] == "sa1spp#1/project/S60/jk1f5132#wbernard"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   182
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   183
    def test_update_result(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   184
        """ Validating UpdateResult."""        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   185
        behave = {'test_update' :"""Starting update process...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   186
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   187
Updating project 'Cartman-wbernard5:project:tr1test1#1' from object version 'Cartman-wbernard5:project:tr1test1#1'...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   188
Refreshing baseline and tasks for project grouping 'My cartman/060530_v2 Collaborative Development Projects'.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   189
Replacing tasks in folder tr1test1#2008
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   190
  Contents of folder tr1test1#2008 have not changed.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   191
Replacing tasks in folder tr1test1#2009
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   192
  Contents of folder tr1test1#2009 have not changed.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   193
Added the following tasks to project grouping 'My cartman/060530_v2 Collaborative Development Projects':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   194
    Task tr1test1#3426: Update Cartman subprojects
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   195
    Task tr1test1#3429: Create Kyle subprojects
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   196
    Task tr1test1#3430: Add Kyle02 subpr hierarchy
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   197
    Task tr1test1#3431: Add a file to cartman_sub_sub02
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   198
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   199
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   200
Updating project 'Cartman_sub01-wbernard3:project:tr1test1#1', reselecting root object version...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   201
Update for 'Cartman-wbernard5:project:tr1test1#1' complete with 0 out of 3 objects replaced.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   202
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   203
Updating project 'Cartman_sub_sub01-wbernard3:project:tr1test1#1', reselecting root object version...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   204
Update for 'Cartman_sub01-wbernard3:project:tr1test1#1' complete with 0 out of 2 objects replaced.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   205
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   206
Updating project 'Cartman_sub02-wbernard3:project:tr1test1#1', reselecting root object version...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   207
Update for 'Cartman_sub_sub01-wbernard3:project:tr1test1#1' complete with 0 out of 1 objects replaced.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   208
    'Cartman_sub02-2:dir:tr1test1#1' replaces 'Cartman_sub02-1:dir:tr1test1#1' under 'Cartman_sub02-wbernard3:project:tr1test1#1'.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   209
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   210
Updating project 'Cartman_sub_sub02-wbernard6:project:tr1test1#1', reselecting root object version...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   211
Update for 'Cartman_sub02-wbernard3:project:tr1test1#1' complete with 2 out of 2 objects replaced.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   212
    Subproject 'Cartman_sub_sub02-wbernard6:project:tr1test1#1' is now bound under 'Cartman_sub02-2:dir:tr1test1#1'.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   213
    'Cartman_sub_sub02-2:dir:tr1test1#1' replaces 'Cartman_sub_sub02-1:dir:tr1test1#1' under 'Cartman_sub_sub02-wbernard6:project:tr1test1#1'.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   214
Update for 'Cartman_sub_sub02-wbernard6:project:tr1test1#1' complete with 2 out of 2 objects replaced.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   215
    'xzx.iby-1:epocrom:tr1test1#1' is now bound under 'Cartman_sub_sub02-2:dir:tr1test1#1'.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   216
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   217
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   218
Update Summary:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   219
 Cartman_sub_sub02:dir:tr1test1#1 in project Cartman_sub_sub02-wbernard2:project:tr1test1#1 had no candidates
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   220
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   221
Update complete.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   222
"""}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   223
        session = MockResultSession(behave)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   224
        result = session.execute('test_update', ccm.UpdateResult(session))
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   225
        #_logger.debug(result.output)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   226
        assert len(result.output['tasks']) == 4, "Number of tasks doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   227
        assert len(result.output['modifications']) == 4, "Number of modifications doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   228
        assert len(result.output['errors']) == 1, "Number of errors doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   229
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   230
    def test_update_result_serious_failure(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   231
        """ Validating UpdateResult with serious failure."""        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   232
        behave = {'test_update' :"""Starting update process...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   233
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   234
Updating project 'MinibuildDomain-wbernard3:project:tr1test1#1' from object version 'MinibuildDomain-wbernard3:project:tr1test1#1'...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   235
Refreshing baseline and tasks for project grouping 'My MinibuildDomain/next Insulated Development Projects'.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   236
Replacing tasks in folder tr1test1#2068
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   237
  Contents of folder tr1test1#2068 have not changed.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   238
Setting path for work area of 'helloworldcons-wbernard2' to 'c:\users\ccm65\ccm_wa\tr1test1\MinibuildDomain'...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   239
Warning: 'c:\users\ccm65\ccm_wa\tr1test1\MinibuildDomain\helloworldcons' already used as work area for project 'helloworldcons-wbernard'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   240
Warning: Unable to update path for work area of 'helloworldcons-wbernard2'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   241
Warning: Unable to update membership of project 'MinibuildDomain-wbernard3'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   242
Work area delete of 'helloworldcons-wbernard2:project:tr1test1#1' failed
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   243
Warning: Unable to update membership of project MinibuildDomain-wbernard3 with MinibuildDomain-2:dir:tr1test1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   244
Rebind of MinibuildDomain-1:dir:tr1test1#1 failed
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   245
Warning: Update for project 'MinibuildDomain-wbernard3:project:tr1test1#1' failed.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   246
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   247
Update Summary
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   248
2 failures to use the selected object version
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   249
    Failed to remove selected object helloworldcons-wbernard2:project:tr1test1#1 under directory MinibuildDomain-1:dir:tr1test1#1 from project MinibuildDomain-wbernard3 : work area delete failed
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   250
    Failed to use selected object MinibuildDomain-2:dir:tr1test1#1 under directory MinibuildDomain-wbernard3:project:tr1test1#1 in project MinibuildDomain-wbernard3
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   251
Serious: 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   252
Update failed.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   253
"""}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   254
        session = MockResultSession(behave)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   255
        result = session.execute('test_update', ccm.UpdateResult(session))
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   256
        #_logger.debug(result.output)
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   257
        #_logger.debug(result.output.keys())
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   258
        #_logger.debug(len(result.output['tasks']))
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   259
        #_logger.debug(len(result.output['modifications']))
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   260
        #_logger.debug(len(result.output['errors']))
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   261
        #_logger.debug(len(result.output['warnings']))
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   262
        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   263
        assert (len(result.output['tasks']) == 0), "Number of tasks doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   264
        assert (len(result.output['modifications']) == 0), "Number of modifications doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   265
        assert (len(result.output['errors']) == 1), "Number of errors doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   266
        assert (len(result.output['warnings']) == 5), "Number of warnings doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   267
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   268
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   269
    def test_UpdateTemplateInformation_result(self):
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   270
        """ Validating UpdateTemplateInformation."""
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   271
        behave = {'test_update' : """Baseline Selection Mode: Latest Baseline Projects
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   272
Prep Allowed:            No
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   273
Versions Matching:       *abs.50*
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   274
Release Purposes:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   275
Use by Default:          Yes
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   276
Modifiable in Database:  tr1s60
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   277
In Use For Release:      Yes
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   278
Folder Templates and Folders:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   279
    Template assigned or completed tasks for %owner for release %release
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   280
    Template all completed tasks for release %release
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   281
    Folder   tr1s60#4844: All completed Xuikon/Xuikon_rel_X tasks
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   282
    Folder   tr1s60#4930: All tasks for release AppBaseDo_50        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   283
        """}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   284
        session = MockResultSession(behave)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   285
        result = session.execute('test_update', ccm.UpdateTemplateInformation(session))
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   286
        #_logger.debug(result.output)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   287
        assert result.output['baseline_selection_mode'] == "Latest Baseline Projects", "BSM doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   288
        assert result.output['prep_allowed'] == False, "Prep allowed doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   289
        assert result.output['version_matching'] == "*abs.50*", "Version matching doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   290
        assert result.output['release_purpose'] == "", "Release purpose doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   291
        assert result.output['modifiable_in_database'] == "tr1s60", "Modifiable in Database doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   292
        assert result.output['in_use_for_release'] == True, "In Use For Release doesn't match."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   293
    
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   294
    def test_ConflictsResult_result(self):
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   295
        """ Validating ConflictsResult."""
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   296
        behave = {'test_update' : """
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   297
Project: Cartman-Release_v4
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   298
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   299
         No conflicts detected.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   300
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   301
Project: Cartman_sub03-next
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   302
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   303
         No conflicts detected.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   304
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   305
Project: Cartman_sub01-Release_v2
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   306
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   307
         No conflicts detected.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   308
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   309
Project: Cartman_sub02-Release_v4
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   310
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   311
         No conflicts detected.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   312
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   313
Project: Cartman_sub_sub01-Release_v2
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   314
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   315
         No conflicts detected.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   316
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   317
Project: Cartman_sub_sub02-Release_v4
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   318
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   319
         No conflicts detected.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   320
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   321
Project: Cartman_sub_sub_sub02-Release_v4
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   322
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   323
tr1test1#5224   Explicitly specified but not included
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   324
tr1test1#5226   Explicitly specified but not included
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   325
        """}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   326
        session = MockResultSession(behave)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   327
        result = session.execute('test_update', ccm.ConflictsResult(session))
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   328
        #_logger.debug(result.output)
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   329
        # pylint: disable=E1103
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   330
        assert len(result.output.keys()) == 7, "Should detect 7 projects."
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   331
        subproj = session.create("Cartman_sub_sub_sub02-Release_v4:project:%s#1" % session.database())
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   332
        assert len(result.output[subproj]) == 2, "%s should contain 2 conflicts" % subproj.objectname
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   333
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   334
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   335
    def test_DataMapperListResult_result(self):
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   336
        """ Validating DataMapperListResult."""
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   337
        behave = {'test_query' : """>>>objectname>>>task5204-1:task:tr1test1>>>task_synopsis>>>Create Cartman_sub03>>>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   338
>>>objectname>>>task5223-1:task:tr1test1>>>task_synopsis>>>cartman/next test1>>>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   339
>>>objectname>>>task5224-1:task:tr1test1>>>task_synopsis>>>test.txt>>>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   340
>>>objectname>>>task5225-1:task:tr1test1>>>task_synopsis>>>test.txt 2>>>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   341
>>>objectname>>>task5226-1:task:tr1test1>>>task_synopsis>>>test.txt merge>>>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   342
>>>objectname>>>task5240-1:task:tr1test1>>>task_synopsis>>>add calculator>>>
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   343
"""}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   344
        session = MockResultSession(behave)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   345
        result = session.execute('test_query', ccm.DataMapperListResult(session, '>>>', ['objectname', 'task_synopsis'], ['ccmobject', 'string']))        
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   346
        _logger.debug(result.output)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   347
        assert len(result.output) == 6
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   348
        
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   349
    def test_UpdatePropertiesRefreshResult_result(self):
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   350
        """ Validating UpdatePropertiesRefreshResult."""
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   351
        behave = {'test_refresh' : """Refreshing baseline and tasks for project grouping 'All cartman/next Integration Testing Projects from Database tr1test1'.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   352
Replacing tasks in folder tr1test1#2045
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   353
  Removed the following tasks from folder tr1test1#2045
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   354
        Task tr1test1#5225: test.txt 2
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   355
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   356
  Added the following tasks to folder tr1test1#2045
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   357
        Task tr1test1#5223: cartman/next test1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   358
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   359
Added the following tasks to project grouping 'All cartman/next Integration Testing Projects from Database tr1test1':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   360
        Task tr1test1#5223: cartman/next test1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   361
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   362
Removed the following tasks from project grouping 'All cartman/next Integration Testing Projects from Database tr1test1':
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   363
        Task tr1test1#5225: test.txt 2
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   364
"""}
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   365
        session = MockResultSession(behave)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   366
        result = session.execute('test_refresh', ccm.UpdatePropertiesRefreshResult(session))        
588
c7c26511138f helium-10.0.0-bc45d50958fe
wbernard
parents: 587
diff changeset
   367
        _logger.debug(result.output)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   368
        assert result.output['added'] == [session.create("Task tr1test1#5223")]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   369
        assert result.output['removed'] == [session.create("Task tr1test1#5225")]
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   370
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   371
    def test_update_log_result(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   372
        """ Testing update log parsing. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   373
        log = """Starting update process...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   374
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   375
Updating project 'MinibuildDomain-wbernard3:project:tr1test1#1' from object version 'MinibuildDomain-wbernard3:project:tr1test1#1'...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   376
Refreshing baseline and tasks for project grouping 'My MinibuildDomain/next Insulated Development Projects'.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   377
Replacing tasks in folder tr1test1#2068
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   378
  Contents of folder tr1test1#2068 have not changed.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   379
Setting path for work area of 'helloworldcons-wbernard2' to 'c:\users\ccm65\ccm_wa\tr1test1\MinibuildDomain'...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   380
Warning: 'c:\users\ccm65\ccm_wa\tr1test1\MinibuildDomain\helloworldcons' already used as work area for project 'helloworldcons-wbernard'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   381
Warning: Unable to update path for work area of 'helloworldcons-wbernard2'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   382
Warning: Unable to update membership of project 'MinibuildDomain-wbernard3'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   383
Work area delete of 'helloworldcons-wbernard2:project:tr1test1#1' failed
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   384
Warning: Unable to update membership of project MinibuildDomain-wbernard3 with MinibuildDomain-2:dir:tr1test1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   385
Rebind of MinibuildDomain-1:dir:tr1test1#1 failed
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   386
Warning: Update for project 'MinibuildDomain-wbernard3:project:tr1test1#1' failed.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   387
Warning: This work area 'c:\users\ccm65\ccm_wa\tr1sido\mrurlparserplugin\mrurlparserplugin' cannot be reused
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   388
Warning:  No candidates found for directory entry ecompluginnotifier.cpp:cppsrc:e003sa01#1.  It will be left empty!
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   389
WARNING: There is no matching baseline project for 'ci-hitchcock_nga' in baseline 'tr1s60#ABS_domain_mcl92-abs.mcl.92_200907'.  This baseline might not be complete
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   390
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   391
Update Summary
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   392
2 failures to use the selected object version
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   393
    Failed to remove selected object helloworldcons-wbernard2:project:tr1test1#1 under directory MinibuildDomain-1:dir:tr1test1#1 from project MinibuildDomain-wbernard3 : work area delete failed
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   394
    Failed to use selected object MinibuildDomain-2:dir:tr1test1#1 under directory MinibuildDomain-wbernard3:project:tr1test1#1 in project MinibuildDomain-wbernard3
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   395
Serious: 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   396
Update failed.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   397
"""
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   398
        count_logger = logging.getLogger('count.logger')
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   399
        count_logger.setLevel(logging.WARNING)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   400
        handler = CounterHandler()
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   401
        count_logger.addHandler(handler)
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   402
        ccm.log_result(log, ccm.UPDATE_LOG_RULES, count_logger)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   403
        print handler.warnings
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   404
        print handler.errors
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   405
        assert handler.warnings == 5
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   406
        assert handler.errors == 9
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   407
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   408
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   409
    def test_checkout_log_result(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   410
        """ Testing checkout log parsing. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   411
        log = """Setting path for work area of 'swservices_domain-ssdo_7132_200912_Shakira_Gwen1' to 'E:\Build_E\DaveS\Integration\_no_context_\swservices_domain'...
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   412
Saved work area options for project: 'swservices_domain-ssdo_7132_200912_Shakira_Gwen1'
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   413
Derive failed for MobileSearch-MobileSearch_4_10_09w09_S60_3_2:project:sa1mosx1#1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   414
Warning: Project name is either invalid or does not exist: 
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   415
Warning: fa1ssdo#MobileSearch_4_10_09w09_S60_3_3 too long, use name less than 32 characters long.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   416
Warning: Object version 'fa1ssdo#MobileSearch_4_10_09w09_S60_3_3' too long, use version less than 32 characters long.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   417
Copy Project complete with 1 errors.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   418
WARNING: There is no matching baseline project for 'ci-hitchcock_nga' in baseline 'tr1s60#ABS_domain_mcl92-abs.mcl.92_200907'.  This baseline might not be complete
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   419
"""
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   420
        count_logger = logging.getLogger('count.logger')
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   421
        count_logger.setLevel(logging.WARNING)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   422
        handler = CounterHandler()
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   423
        count_logger.addHandler(handler)
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   424
        ccm.log_result(log, ccm.CHECKOUT_LOG_RULES, count_logger)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   425
        print handler.warnings
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   426
        print handler.errors
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   427
        assert handler.warnings == 4
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   428
        assert handler.errors == 1
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   429
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   430
        
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   431
    def test_sync_log_result(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   432
        """ Testing sync log parsing. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   433
        log = """Synchronization summary:
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   434
       0 Update(s) for project MinibuildDomain-wbernard7
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   435
       0 Update(s) for project helloworldapi-wbernard7
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   436
       0 Update(s) for project helloworldcons-wbernard5
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   437
       0 Conflict(s) for project MinibuildDomain-wbernard7
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   438
       1 Conflict(s) for project helloworldapi-wbernard7
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   439
       0 Conflict(s) for project helloworldcons-wbernard5
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   440
You can use Reconcile to resolve work area conflicts
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   441
Warning: Conflicts detected during synchronization. Check your logs.
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   442
"""
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   443
        count_logger = logging.getLogger('count.logger')
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   444
        count_logger.setLevel(logging.WARNING)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   445
        handler = CounterHandler()
628
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   446
        count_logger.addHandler(handler)
7c4a911dc066 helium_11.0.0-e00f171ca185
wbernard
parents: 588
diff changeset
   447
        ccm.log_result(log, ccm.SYNC_LOG_RULES, count_logger)
587
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   448
        print handler.warnings
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   449
        print handler.errors
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   450
        assert handler.warnings == 0
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   451
        assert handler.errors == 2
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   452
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   453
    def test_ResultWithError(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   454
        """ Test result. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   455
        result = ccm.ResultWithError(None)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   456
        result.output = u"Nokia"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   457
        result.error = u"Nokio"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   458
        assert result.output == u"Nokia"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   459
        assert result.error == u"Nokio"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   460
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   461
    def test_ResultWithError_unicode_character(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   462
        """ Test result with unicode character. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   463
        result = ccm.ResultWithError(None)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   464
        result.output = u"Nokia\xc2"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   465
        result.error = u"Nokio\xc2"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   466
        print result.output.encode('ascii', 'replace')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   467
        print result.error.encode('ascii', 'replace')
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   468
        assert result.output == u"Nokia?"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   469
        assert result.error == u"Nokio?"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   470
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   471
    def test_ResultWithError_str(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   472
        """ Test result from str. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   473
        result = ccm.ResultWithError(None)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   474
        result.output = "Nokia"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   475
        result.error = "Nokio"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   476
        assert result.output == "Nokia"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   477
        assert result.error == "Nokio"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   478
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   479
    def test_ResultWithError_str_not_ascii(self):
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   480
        """ Test result from str with not ascii. """
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   481
        result = ccm.ResultWithError(None)
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   482
        result.output = "Noki\xe4"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   483
        result.error = "Nokio\xe5"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   484
        print result.output
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   485
        print result.error
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   486
        assert result.output == "Noki"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   487
        assert result.error == "Nokio"
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   488
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   489
if __name__ == "__main__":
85df38eb4012 helium_9.0-a7879c935424
wbernard
parents:
diff changeset
   490
    unittest.main()