buildframework/helium/sf/java/blocks/tests/antunits/test_blocks.ant.xml
changeset 645 b8d81fa19e7d
equal deleted inserted replaced
643:27cf35f95864 645:b8d81fa19e7d
       
     1 <?xml version="1.0" encoding="UTF-8"?>
       
     2 <!-- 
       
     3 ============================================================================ 
       
     4 Name        : test_blocks.ant.xml 
       
     5 Part of     : Helium AntLib
       
     6 
       
     7 Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
       
     8 All rights reserved.
       
     9 This component and the accompanying materials are made available
       
    10 under the terms of the License "Eclipse Public License v1.0"
       
    11 which accompanies this distribution, and is available
       
    12 at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
    13 
       
    14 Initial Contributors:
       
    15 Nokia Corporation - initial contribution.
       
    16 
       
    17 Contributors:
       
    18 
       
    19 Description:
       
    20 
       
    21 ============================================================================
       
    22 -->
       
    23 <project name="helium-antlib-blocks-unittest" xmlns:hlm="http://www.nokia.com/helium" xmlns:au="antlib:org.apache.ant.antunit">
       
    24     <description>Helium Antlib blocks unittests.</description>
       
    25     
       
    26     <target name="setUp">
       
    27         <tstamp>
       
    28             <format property="tstamp" pattern="yyyyMMddHHmmssSSS" locale="en,UK" />
       
    29         </tstamp>
       
    30         <mkdir dir="${test.temp.dir}" />
       
    31         <delete file="${test.temp.dir}" />
       
    32         <mkdir dir="${test.temp.dir}" />
       
    33     </target>
       
    34 
       
    35     <target name="tearDown">
       
    36         <delete dir="${test.temp.dir}" />
       
    37     </target>
       
    38     
       
    39     <target name="is-blocks-available">
       
    40         <exec executable="blocks.bat"  resultproperty="blocks.result" failifexecutionfails="false" osfamily="windows" />
       
    41         <exec executable="blocks"  resultproperty="blocks.result" failifexecutionfails="false" osfamily="unix" />
       
    42         <condition property="execute.test" value="true">
       
    43             <equals arg1="${blocks.result}" arg2="0" />
       
    44         </condition>
       
    45         <echo>execute.test: ${execute.test}</echo>    
       
    46     </target>
       
    47     
       
    48     <target name="test-addworkspace" depends="is-blocks-available" if="execute.test">
       
    49         <mkdir dir="${test.temp.dir}/workspace-addworkspace" />
       
    50         <hlm:blocksAddWorkspace name="unittest-addworkspace-${tstamp}" dir="${test.temp.dir}/workspace-addworkspace" wsidproperty="wsid" />
       
    51         <hlm:blocksRemoveWorkspace wsid="${wsid}" />
       
    52     </target>
       
    53 
       
    54     <target name="test-workspace-cond-dir" depends="is-blocks-available" if="execute.test">
       
    55         <mkdir dir="${test.temp.dir}/workspace-workspacecond" />
       
    56         <hlm:blocksAddWorkspace name="workspace-workspacecond-${tstamp}" dir="${test.temp.dir}/workspace-workspacecond" wsidproperty="wsid" />
       
    57         <au:assertTrue>
       
    58             <hlm:blocksWorkspaceExists dir="${test.temp.dir}/workspace-workspacecond" />
       
    59         </au:assertTrue>
       
    60         <hlm:blocksRemoveWorkspace wsid="${wsid}" />
       
    61     </target>
       
    62 
       
    63     <target name="test-workspace-cond-name" depends="is-blocks-available" if="execute.test">
       
    64         <mkdir dir="${test.temp.dir}/workspace-workspacecond" />
       
    65         <hlm:blocksAddWorkspace name="workspace-workspacecond-${tstamp}" dir="${test.temp.dir}/workspace-workspacecond" wsidproperty="wsid" />
       
    66         <au:assertTrue>
       
    67             <hlm:blocksWorkspaceExists name="workspace-workspacecond-${tstamp}" />
       
    68         </au:assertTrue>
       
    69         <hlm:blocksRemoveWorkspace wsid="${wsid}" />
       
    70     </target>
       
    71 
       
    72     <target name="test-workspace-cond-not-workspace-dir" depends="is-blocks-available" if="execute.test">
       
    73         <mkdir dir="${test.temp.dir}/workspace-workspacecond" />
       
    74         <au:assertTrue>
       
    75             <not>
       
    76                 <hlm:blocksWorkspaceExists dir="${test.temp.dir}/workspace-workspacecond" />
       
    77             </not>
       
    78         </au:assertTrue>
       
    79     </target>
       
    80 
       
    81     <target name="test-workspace-cond-not-workspace-name" depends="is-blocks-available" if="execute.test">
       
    82         <mkdir dir="${test.temp.dir}/workspace-workspacecond" />
       
    83         <au:assertTrue>
       
    84             <not>
       
    85                 <hlm:blocksWorkspaceExists name="workspacecond" />
       
    86             </not>
       
    87         </au:assertTrue>
       
    88     </target>
       
    89 
       
    90     <target name="test-workspace-get-workspace-id-no-args" depends="is-blocks-available" if="execute.test">
       
    91         <au:expectfailure message="You must define either name or dir attribute">
       
    92         	<hlm:blocksGetWorkspaceId />
       
    93         </au:expectfailure>
       
    94     </target>
       
    95 
       
    96     <target name="test-workspace-get-workspace-id-both-args" depends="is-blocks-available" if="execute.test">
       
    97         <mkdir dir="${test.temp.dir}/workspace-addworkspace" />
       
    98         <au:expectfailure message="You must define either name or dir attribute">
       
    99         	<hlm:blocksGetWorkspaceId name="some-invalid-name" dir="${test.temp.dir}/workspace-addworkspace"/>
       
   100         </au:expectfailure>
       
   101     </target>
       
   102 
       
   103     <target name="test-workspace-get-workspace-name" depends="is-blocks-available" if="execute.test">
       
   104         <mkdir dir="${test.temp.dir}/workspace-workspacecond" />
       
   105         <hlm:blocksAddWorkspace name="workspace-workspacecond-${tstamp}" dir="${test.temp.dir}/workspace-workspacecond" wsidproperty="wsid" />
       
   106         <hlm:blocksGetWorkspaceId name="workspace-workspacecond-${tstamp}" wsidoutput="get.wsid"/>
       
   107         <hlm:blocksRemoveWorkspace wsid="${wsid}" />
       
   108         <au:assertTrue>
       
   109             <equals arg1="${get.wsid}" arg2="${wsid}" />
       
   110         </au:assertTrue>
       
   111     </target>
       
   112 
       
   113     <target name="test-workspace-get-workspace-dir" depends="is-blocks-available" if="execute.test">
       
   114         <mkdir dir="${test.temp.dir}/workspace-workspacecond" />
       
   115         <hlm:blocksAddWorkspace name="workspace-workspacecond-${tstamp}" dir="${test.temp.dir}/workspace-workspacecond" wsidproperty="wsid" />
       
   116         <hlm:blocksGetWorkspaceId dir="${test.temp.dir}/workspace-workspacecond" wsidoutput="get.wsid"/>
       
   117         <hlm:blocksRemoveWorkspace wsid="${wsid}" />
       
   118         <au:assertTrue>
       
   119             <equals arg1="${get.wsid}" arg2="${wsid}" />
       
   120         </au:assertTrue>
       
   121     </target>
       
   122 </project>