Solution 04 is not source compatible as it added new methods into a subclassable interface
authorJaroslav Tulach <jtulach@netbeans.org>
Sat, 11 Oct 2008 13:30:16 +0200
changeset 7622885b020f15
parent 75 7bc06ac56dd8
child 77 3d851a9f2016
Solution 04 is not source compatible as it added new methods into a subclassable interface
taskx/jtulach/against-solution04/build.xml
taskx/jtulach/against-solution04/nbproject/project.xml
taskx/jtulach/against-solution04/project.properties
taskx/jtulach/against-solution04/test/apifest/CurrencyTest.java
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/taskx/jtulach/against-solution04/build.xml	Sat Oct 11 13:30:16 2008 +0200
     1.3 @@ -0,0 +1,5 @@
     1.4 +<?xml version="1.0" encoding="UTF-8"?>
     1.5 +<!-- this is a template file to test  -->
     1.6 +<project name="testing-template" default="run" basedir=".">
     1.7 +    <import file="../../common.xml"/>
     1.8 +</project>    
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/taskx/jtulach/against-solution04/nbproject/project.xml	Sat Oct 11 13:30:16 2008 +0200
     2.3 @@ -0,0 +1,82 @@
     2.4 +<?xml version="1.0" encoding="UTF-8"?>
     2.5 +<project xmlns="http://www.netbeans.org/ns/project/1">
     2.6 +    <type>org.netbeans.modules.ant.freeform</type>
     2.7 +    <configuration>
     2.8 +        <general-data xmlns="http://www.netbeans.org/ns/freeform-project/1">
     2.9 +            <!-- Do not use Project Properties customizer when editing this file manually. -->
    2.10 +            <name>jtulach against solution 04</name>
    2.11 +            <properties>
    2.12 +                <property name="ant.script">build.xml</property>
    2.13 +                <property name="apifest">../../../</property>
    2.14 +                <property-file>project.properties</property-file>
    2.15 +                <property-file>${apifest}/taskx/common.properties</property-file>
    2.16 +            </properties>
    2.17 +            <folders>
    2.18 +                <source-folder>
    2.19 +                    <label>test</label>
    2.20 +                    <type>java</type>
    2.21 +                    <location>test</location>
    2.22 +                </source-folder>
    2.23 +            </folders>
    2.24 +            <ide-actions>
    2.25 +                <action name="build">
    2.26 +                    <script>${ant.script}</script>
    2.27 +                    <target>compile</target>
    2.28 +                </action>
    2.29 +                <action name="clean">
    2.30 +                    <script>${ant.script}</script>
    2.31 +                    <target>clean</target>
    2.32 +                </action>
    2.33 +                <action name="run">
    2.34 +                    <script>${ant.script}</script>
    2.35 +                    <target>test</target>
    2.36 +                </action>
    2.37 +                <action name="test">
    2.38 +                    <script>${ant.script}</script>
    2.39 +                    <target>test</target>
    2.40 +                </action>
    2.41 +                <action name="rebuild">
    2.42 +                    <script>${ant.script}</script>
    2.43 +                    <target>clean</target>
    2.44 +                    <target>compile</target>
    2.45 +                </action>
    2.46 +            </ide-actions>
    2.47 +            <export>
    2.48 +                <type>folder</type>
    2.49 +                <location>build/tests</location>
    2.50 +                <script>${ant.script}</script>
    2.51 +                <build-target>compile</build-target>
    2.52 +            </export>
    2.53 +            <view>
    2.54 +                <items>
    2.55 +                    <source-folder style="packages">
    2.56 +                        <label>test</label>
    2.57 +                        <location>test</location>
    2.58 +                    </source-folder>
    2.59 +                    <source-file>
    2.60 +                        <location>${ant.script}</location>
    2.61 +                    </source-file>
    2.62 +                    <source-file>
    2.63 +                        <location>project.properties</location>
    2.64 +                    </source-file>
    2.65 +                </items>
    2.66 +                <context-menu>
    2.67 +                    <ide-action name="build"/>
    2.68 +                    <ide-action name="clean"/>
    2.69 +                    <ide-action name="run"/>
    2.70 +                    <ide-action name="test"/>
    2.71 +                    <ide-action name="rebuild"/>
    2.72 +                </context-menu>
    2.73 +            </view>
    2.74 +            <subprojects/>
    2.75 +        </general-data>
    2.76 +        <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
    2.77 +            <compilation-unit>
    2.78 +                <package-root>test</package-root>
    2.79 +                <classpath mode="compile">${apiA}:${junit.jar}</classpath>
    2.80 +                <built-to>build/tests</built-to>
    2.81 +                <source-level>1.5</source-level>
    2.82 +            </compilation-unit>
    2.83 +        </java-data>
    2.84 +    </configuration>
    2.85 +</project>
     3.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     3.2 +++ b/taskx/jtulach/against-solution04/project.properties	Sat Oct 11 13:30:16 2008 +0200
     3.3 @@ -0,0 +1,14 @@
     3.4 +
     3.5 +# name of a project to test
     3.6 +apitotest=solution04
     3.7 +
     3.8 +# the test shall expose a problem between two versions
     3.9 +# of one API. select the first version - taskA and a second
    3.10 +# version of the of the API taskB
    3.11 +taskA=${apifest}/task1
    3.12 +taskB=${apifest}/task2
    3.13 +
    3.14 +# usual locations of API classes for each version
    3.15 +apiA=${taskA}/${apitotest}/build/classes/
    3.16 +apiB=${taskB}/${apitotest}/build/classes/
    3.17 +
     4.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.2 +++ b/taskx/jtulach/against-solution04/test/apifest/CurrencyTest.java	Sat Oct 11 13:30:16 2008 +0200
     4.3 @@ -0,0 +1,24 @@
     4.4 +package apifest;
     4.5 +
     4.6 +import java.math.BigDecimal;
     4.7 +import java.util.Currency;
     4.8 +import junit.framework.TestCase;
     4.9 +import org.apidesign.apifest08.currency.Convertor;
    4.10 +import org.apidesign.apifest08.currency.InvalidConversionException;
    4.11 +
    4.12 +
    4.13 +/** Write a test that works with version from task A and fails with version B.
    4.14 + */
    4.15 +public class CurrencyTest extends TestCase {
    4.16 +    public CurrencyTest(String n) {
    4.17 +        super(n);
    4.18 +    }
    4.19 +    
    4.20 +    public void testCompatibility() throws Exception {
    4.21 +        Convertor c = new Convertor() {
    4.22 +            public BigDecimal convert(Currency from, Currency to, BigDecimal amount) throws InvalidConversionException {
    4.23 +                return null;
    4.24 +            }
    4.25 +        };
    4.26 +    }
    4.27 +}