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