ant-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ste...@apache.org
Subject cvs commit: ant/src/testcases/org/apache/tools/ant/taskdefs RmicAdvancedTest.java
Date Mon, 07 Mar 2005 15:12:25 GMT
stevel      2005/03/07 07:12:25

  Modified:    src/etc/testcases/taskdefs/rmic rmic.xml
               src/main/org/apache/tools/ant/taskdefs/rmic
                        DefaultRmicAdapter.java
               src/testcases/org/apache/tools/ant/taskdefs
                        RmicAdvancedTest.java
  Log:
  First fix the tests to fail when they should, then fix rmic to work as before, even on Java1.5,
then add new tests to explicitly do version checks.
  bug "rmic always compiles on Java1.5"
  http://issues.apache.org/bugzilla/show_bug.cgi?id=33862
  
  Revision  Changes    Path
  1.4       +67 -6     ant/src/etc/testcases/taskdefs/rmic/rmic.xml
  
  Index: rmic.xml
  ===================================================================
  RCS file: /home/cvs/ant/src/etc/testcases/taskdefs/rmic/rmic.xml,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- rmic.xml	24 Aug 2004 20:34:53 -0000	1.3
  +++ rmic.xml	7 Mar 2005 15:12:25 -0000	1.4
  @@ -37,26 +37,71 @@
       <macrodef name="assertFileCreated">
         <attribute name="file" />
         <sequential>
  -        <property name="file.to.find" location="${build.dir}/@{file}" />
  -        <available property="file.found" file="${file.to.find}"/>
  -        <fail unless="file.found">Not found : ${file.to.find}</fail>
  +        <fail>Not found : ${build.dir}/@{file}
  +          <condition>
  +            <not><available file="${build.dir}/@{file}"/></not>
  +          </condition>
  +        </fail>
         </sequential>
       </macrodef>
   
  -    <macrodef name="assertBaseCompiled">
  +    <macrodef name="assertFileAbsent">
  +      <attribute name="file" />
  +      <sequential>
  +        <fail>Expected to be missing : ${build.dir}/@{file}
  +          <condition>
  +            <available file="${build.dir}/@{file}"/>
  +          </condition>
  +        </fail>
  +      </sequential>
  +    </macrodef>
  +
  +    
  +    <macrodef name="assertStubCompiled">
         <sequential>
           <assertFileCreated file="RemoteTimestampImpl_Stub.class"  />
  -        <assertFileCreated file="RemoteTimestampImpl_Skel.class"/>
         </sequential>
       </macrodef>
   
  -    <macrodef name="assertAntCompiled">
  +    <macrodef name="assertSkelCompiled">
  +      <sequential>
  +        <assertFileCreated file="RemoteTimestampImpl_Skel.class"  />
  +      </sequential>
  +    </macrodef>
  +
  +    <macrodef name="assertSkelAbsent">
  +      <sequential>
  +        <assertFileAbsent file="RemoteTimestampImpl_Skel.class"  />
  +      </sequential>
  +    </macrodef>
  +    
  +    <macrodef name="assertBaseCompiled">
  +      <sequential>
  +        <assertStubCompiled />
  +        <assertSkelCompiled />
  +      </sequential>
  +    </macrodef>
  +
  +    
  +    <macrodef name="assertAntStubCompiled">
         <sequential>
           <assertFileCreated file="AntTimestamp_Stub.class"/>
  +      </sequential>
  +    </macrodef>
  +    
  +    <macrodef name="assertAntSkelCompiled">
  +      <sequential>
           <assertFileCreated file="AntTimestamp_Skel.class"/>
         </sequential>
       </macrodef>
   
  +    <macrodef name="assertAntCompiled">
  +      <sequential>
  +        <assertAntStubCompiled />
  +        <assertAntSkelCompiled />
  +      </sequential>
  +    </macrodef>
  +
     </target>
     
     <target name="probe-rmic">
  @@ -75,6 +120,22 @@
       <assertBaseCompiled/>
     </target>
   
  +  <target name="testVersion11" depends="init">
  +    <base-rmic compiler="default" stubversion="1.1" />
  +    <assertBaseCompiled/>
  +  </target>
  +
  +  <target name="testVersion12" depends="init">
  +    <base-rmic compiler="default" stubversion="1.2" />
  +    <assertStubCompiled/>
  +    <assertSkelAbsent/>
  +  </target>
  +  
  +  <target name="testVersionCompat" depends="init">
  +    <base-rmic compiler="default" stubversion="compat" />
  +    <assertBaseCompiled/>
  +  </target>
  +  
     <target name="testRmic" if="rmic.present" depends="init">
       <base-rmic compiler="sun"/>
       <assertBaseCompiled/>
  
  
  
  1.36      +15 -4     ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java
  
  Index: DefaultRmicAdapter.java
  ===================================================================
  RCS file: /home/cvs/ant/src/main/org/apache/tools/ant/taskdefs/rmic/DefaultRmicAdapter.java,v
  retrieving revision 1.35
  retrieving revision 1.36
  diff -u -r1.35 -r1.36
  --- DefaultRmicAdapter.java	13 Dec 2004 17:56:15 -0000	1.35
  +++ DefaultRmicAdapter.java	7 Mar 2005 15:12:25 -0000	1.36
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2001-2004 The Apache Software Foundation
  + * Copyright  2001-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -44,6 +44,9 @@
       public static final String RMI_SKEL_SUFFIX = "_Skel";
       /** suffix denoting a tie file */
       public static final String RMI_TIE_SUFFIX = "_Tie";
  +    public static final String STUB_COMPAT = "-vcompat";
  +    public static final String STUB_1_1 = "-v1.1";
  +    public static final String STUB_1_2 = "-v1.2";
   
       /**
        * Default constructor
  @@ -186,16 +189,24 @@
           cmd.createArgument().setValue("-classpath");
           cmd.createArgument().setPath(classpath);
   
  +        //handle the many different stub options.
           String stubVersion = attributes.getStubVersion();
  +        //default is compatibility
  +        String stubOption=STUB_COMPAT;
           if (null != stubVersion) {
               if ("1.1".equals(stubVersion)) {
  -                cmd.createArgument().setValue("-v1.1");
  +                stubOption = STUB_1_1;
               } else if ("1.2".equals(stubVersion)) {
  -                cmd.createArgument().setValue("-v1.2");
  +                stubOption = STUB_1_2;
  +            } else if ("compat".equals(stubVersion)) {
  +                stubOption = STUB_COMPAT;
               } else {
  -                cmd.createArgument().setValue("-vcompat");
  +                //anything else
  +                attributes.log("Unknown stub option "+stubVersion);
  +                //do nothing with the value? or go -v+stubVersion??
               }
           }
  +        cmd.createArgument().setValue(stubOption);
   
           if (null != attributes.getSourceBase()) {
               cmd.createArgument().setValue("-keepgenerated");
  
  
  
  1.4       +29 -3     ant/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java
  
  Index: RmicAdvancedTest.java
  ===================================================================
  RCS file: /home/cvs/ant/src/testcases/org/apache/tools/ant/taskdefs/RmicAdvancedTest.java,v
  retrieving revision 1.3
  retrieving revision 1.4
  diff -u -r1.3 -r1.4
  --- RmicAdvancedTest.java	5 Aug 2004 17:13:42 -0000	1.3
  +++ RmicAdvancedTest.java	7 Mar 2005 15:12:25 -0000	1.4
  @@ -1,5 +1,5 @@
   /*
  - * Copyright  2004 The Apache Software Foundation
  + * Copyright  2004-2005 The Apache Software Foundation
    *
    *  Licensed under the Apache License, Version 2.0 (the "License");
    *  you may not use this file except in compliance with the License.
  @@ -92,7 +92,7 @@
       /**
        * test the forking compiler
        */
  -    public void NotestForkingAntClasspath() throws Exception {
  +    public void testForkingAntClasspath() throws Exception {
           executeTarget("testForkingAntClasspath");
       }
   
  @@ -154,7 +154,7 @@
   
   
       /**
  -     * test the forking compiler
  +     *
        */
       public void testMagicPropertyIsEmptyString() throws Exception {
           executeTarget("testMagicPropertyIsEmptyString");
  @@ -169,6 +169,32 @@
   
   
       /**
  +     * test that version 1.1 stubs are good
  +     * @throws Exception
  +     */
  +    public void testVersion11() throws Exception {
  +        executeTarget("testVersion11");
  +    }
  +
  +    /**
  +     * test that version 1.2 stubs are good
  +     *
  +     * @throws Exception
  +     */
  +    public void testVersion12() throws Exception {
  +        executeTarget("testVersion12");
  +    }
  +
  +    /**
  +     * test that version compat stubs are good
  +     *
  +     * @throws Exception
  +     */
  +    public void testVersionCompat() throws Exception {
  +        executeTarget("testVersionCompat");
  +    }
  +
  +    /**
        * this little bunny verifies that we can load stuff, and that
        * a failure to execute is turned into a fault
        */
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@ant.apache.org
For additional commands, e-mail: dev-help@ant.apache.org


Mime
View raw message