# HG changeset patch # User Jaroslav Tulach # Date 1213429968 -7200 # Node ID 45b0d58e66ca60d49a0f81ff6f5df3209520154b # Parent a0b47629aad8729da5f8944693ed073dd5bcea07 Getting the solutions from the CVS, not just from the ZIP file diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/stackbasedsolution/nbproject/build-impl.xml --- a/samples/apifest1/day2/stackbasedsolution/nbproject/build-impl.xml Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/stackbasedsolution/nbproject/build-impl.xml Sat Jun 14 09:52:48 2008 +0200 @@ -18,32 +18,35 @@ - applet - cleanup ---> - - + --> + + + ====================== + INITIALIZATION SECTION + ====================== + --> - + + + - + - + + - + @@ -77,7 +80,10 @@ - + + + + @@ -90,12 +96,34 @@ + + + + + + + + + + + + + + + + + + + + + + - + Must set src.dir Must set test.src.dir Must set build.dir @@ -118,41 +146,70 @@ - - - - + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - + + + + + + Must set javac.includes + + + + + + + + + - + + + - + - + + + - + @@ -163,11 +220,11 @@ - - - + + + - + @@ -175,24 +232,36 @@ - + - + - + + + + + + + + + + + + + + + - - + + - - - - + + @@ -200,7 +269,7 @@ - + @@ -209,17 +278,17 @@ - + - + - + @@ -228,102 +297,102 @@ - + - + - - + =================== + COMPILATION SECTION + =================== + --> + + - + + + + - + - + - + Must select some files in the IDE or set javac.includes - - - - - + + - + - - + ==================== + JAR BUILDING SECTION + ==================== + --> + + - + - + - + To run this application from the command line without Ant, try: - - + + java -cp "${run.classpath.with.dist.jar}" ${main.class} - - + + - + - - + + @@ -331,183 +400,194 @@ To run this application from the command line without Ant, try: - + java -jar "${dist.jar.resolved}" - + - + ================= + EXECUTION SECTION + ================= + --> + - + + + + Must select one file in the IDE or set run.class - + ================= + DEBUGGING SECTION + ================= + --> + - + - - + + - - + + Must select one file in the IDE or set debug.class - - + + Must set fix.includes - + - + - + =============== + JAVADOC SECTION + =============== + --> + - + - - - - - + + + - + - + - + ========================= + JUNIT COMPILATION SECTION + ========================= + --> + - - + + + + + - + - + - + Must select some files in the IDE or set javac.includes - - - - - + + - + - + - + ======================= + JUNIT EXECUTION SECTION + ======================= + --> + - - + + - + Some tests failed; see details above. - - - - + + + + - + Must select some files in the IDE or set test.includes - + - + Some tests failed; see details above. - + - + ======================= + JUNIT DEBUGGING SECTION + ======================= + --> + Must select one file in the IDE or set test.class - + + + + - + + + + + + + + - - + + - - + + - + - + ========================= + APPLET EXECUTION SECTION + ========================= + --> + Must select one file in the IDE or set applet.url @@ -516,11 +596,11 @@ - + ========================= + APPLET DEBUGGING SECTION + ========================= + --> + Must select one file in the IDE or set applet.url @@ -528,14 +608,14 @@ - + - - + =============== + CLEANUP SECTION + =============== + --> + + @@ -543,5 +623,5 @@ - + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/stackbasedsolution/nbproject/genfiles.properties --- a/samples/apifest1/day2/stackbasedsolution/nbproject/genfiles.properties Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/stackbasedsolution/nbproject/genfiles.properties Sat Jun 14 09:52:48 2008 +0200 @@ -1,8 +1,8 @@ build.xml.data.CRC32=10562595 build.xml.script.CRC32=8e100d5a -build.xml.stylesheet.CRC32=a12b3d02 +build.xml.stylesheet.CRC32=be360661 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=10562595 -nbproject/build-impl.xml.script.CRC32=50f3448d -nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac +nbproject/build-impl.xml.script.CRC32=4a74b13c +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08 diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/stackbasedsolution/nbproject/project.properties --- a/samples/apifest1/day2/stackbasedsolution/nbproject/project.properties Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/stackbasedsolution/nbproject/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -15,6 +15,8 @@ dist.dir=dist dist.jar=${dist.dir}/boolcircuit.jar dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** jar.compress=false javac.classpath= # Space-separated list of extra javac options diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/stackbasedsolution/nbproject/project.xml --- a/samples/apifest1/day2/stackbasedsolution/nbproject/project.xml Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/stackbasedsolution/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -3,7 +3,7 @@ org.netbeans.modules.java.j2seproject - stackbasedsolution + stackbasedsolution - day2 1.6.5 diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit2.java --- a/samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit2.java Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/stackbasedsolution/src/org/netbeans/apifest/boolcircuit/Circuit2.java Sat Jun 14 09:52:48 2008 +0200 @@ -23,6 +23,8 @@ /** */ +//BEGIN: apifest.day2.stackbasedsolution.Circuit2 public interface Circuit2 extends Circuit { public double evaluate (double ... input) throws IllegalArgumentException; } +//END: apifest.day2.stackbasedsolution.Circuit2 diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/subclassingsolution/nbproject/build-impl.xml --- a/samples/apifest1/day2/subclassingsolution/nbproject/build-impl.xml Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/subclassingsolution/nbproject/build-impl.xml Sat Jun 14 09:52:48 2008 +0200 @@ -18,32 +18,35 @@ - applet - cleanup ---> - - + --> + + + ====================== + INITIALIZATION SECTION + ====================== + --> - + + + - + - + + - + @@ -77,7 +80,10 @@ - + + + + @@ -90,12 +96,34 @@ + + + + + + + + + + + + + + + + + + + + + + - + Must set src.dir Must set test.src.dir Must set build.dir @@ -118,41 +146,70 @@ - - - - + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - + + + + + + Must set javac.includes + + + + + + + + + - + + + - + - + + + - + @@ -163,11 +220,11 @@ - - - + + + - + @@ -175,24 +232,36 @@ - + - + - + + + + + + + + + + + + + + + - - + + - - - - + + @@ -200,7 +269,7 @@ - + @@ -209,17 +278,17 @@ - + - + - + @@ -228,102 +297,102 @@ - + - + - - + =================== + COMPILATION SECTION + =================== + --> + + - + + + + - + - + - + Must select some files in the IDE or set javac.includes - - - - - + + - + - - + ==================== + JAR BUILDING SECTION + ==================== + --> + + - + - + - + To run this application from the command line without Ant, try: - - + + java -cp "${run.classpath.with.dist.jar}" ${main.class} - - + + - + - - + + @@ -331,183 +400,194 @@ To run this application from the command line without Ant, try: - + java -jar "${dist.jar.resolved}" - + - + ================= + EXECUTION SECTION + ================= + --> + - + + + + Must select one file in the IDE or set run.class - + ================= + DEBUGGING SECTION + ================= + --> + - + - - + + - - + + Must select one file in the IDE or set debug.class - - + + Must set fix.includes - + - + - + =============== + JAVADOC SECTION + =============== + --> + - + - - - - - + + + - + - + - + ========================= + JUNIT COMPILATION SECTION + ========================= + --> + - - + + + + + - + - + - + Must select some files in the IDE or set javac.includes - - - - - + + - + - + - + ======================= + JUNIT EXECUTION SECTION + ======================= + --> + - - + + - + Some tests failed; see details above. - - - - + + + + - + Must select some files in the IDE or set test.includes - + - + Some tests failed; see details above. - + - + ======================= + JUNIT DEBUGGING SECTION + ======================= + --> + Must select one file in the IDE or set test.class - + + + + - + + + + + + + + - - + + - - + + - + - + ========================= + APPLET EXECUTION SECTION + ========================= + --> + Must select one file in the IDE or set applet.url @@ -516,11 +596,11 @@ - + ========================= + APPLET DEBUGGING SECTION + ========================= + --> + Must select one file in the IDE or set applet.url @@ -528,14 +608,14 @@ - + - - + =============== + CLEANUP SECTION + =============== + --> + + @@ -543,5 +623,5 @@ - + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/subclassingsolution/nbproject/genfiles.properties --- a/samples/apifest1/day2/subclassingsolution/nbproject/genfiles.properties Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/subclassingsolution/nbproject/genfiles.properties Sat Jun 14 09:52:48 2008 +0200 @@ -4,5 +4,5 @@ # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=0f6dc18a -nbproject/build-impl.xml.script.CRC32=079f4b62 -nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac +nbproject/build-impl.xml.script.CRC32=fde9979b +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08 diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/subclassingsolution/nbproject/project.properties --- a/samples/apifest1/day2/subclassingsolution/nbproject/project.properties Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/subclassingsolution/nbproject/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -15,6 +15,8 @@ dist.dir=dist dist.jar=${dist.dir}/boolcircuit.jar dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** jar.compress=false javac.classpath= # Space-separated list of extra javac options diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/subclassingsolution/nbproject/project.xml --- a/samples/apifest1/day2/subclassingsolution/nbproject/project.xml Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/subclassingsolution/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -3,7 +3,7 @@ org.netbeans.modules.java.j2seproject - subclassingsolution + subclassingsolution - day2 1.6.5 diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/subclassingsolution/src/org/netbeans/apifest/boolcircuit/FuzzyCircuit.java --- a/samples/apifest1/day2/subclassingsolution/src/org/netbeans/apifest/boolcircuit/FuzzyCircuit.java Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/subclassingsolution/src/org/netbeans/apifest/boolcircuit/FuzzyCircuit.java Sat Jun 14 09:52:48 2008 +0200 @@ -9,10 +9,6 @@ package org.netbeans.apifest.boolcircuit; -/** - * - * @author phrebejk - */ public abstract class FuzzyCircuit extends Circuit { /** Feel free to implement and don't hesitate to throw IllegalArgumentEception diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/welltestedsolution/nbproject/build-impl.xml --- a/samples/apifest1/day2/welltestedsolution/nbproject/build-impl.xml Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/welltestedsolution/nbproject/build-impl.xml Sat Jun 14 09:52:48 2008 +0200 @@ -18,32 +18,35 @@ - applet - cleanup ---> - - + --> + + + ====================== + INITIALIZATION SECTION + ====================== + --> - + + + - + - + + - + @@ -77,7 +80,10 @@ - + + + + @@ -90,12 +96,34 @@ + + + + + + + + + + + + + + + + + + + + + + - + Must set src.dir Must set test.src.dir Must set build.dir @@ -118,41 +146,70 @@ - - - - + + + + + + + - + + + + + + + + + + + + + + + - - - - - - - + + + + + + Must set javac.includes + + + + + + + + + - + + + - + - + + + - + @@ -163,11 +220,11 @@ - - - + + + - + @@ -175,24 +232,36 @@ - + - + - + + + + + + + + + + + + + + + - - + + - - - - + + @@ -200,7 +269,7 @@ - + @@ -209,17 +278,17 @@ - + - + - + @@ -228,102 +297,102 @@ - + - + - - + =================== + COMPILATION SECTION + =================== + --> + + - + + + + - + - + - + Must select some files in the IDE or set javac.includes - - - - - + + - + - - + ==================== + JAR BUILDING SECTION + ==================== + --> + + - + - + - + To run this application from the command line without Ant, try: - - + + java -cp "${run.classpath.with.dist.jar}" ${main.class} - - + + - + - - + + @@ -331,183 +400,194 @@ To run this application from the command line without Ant, try: - + java -jar "${dist.jar.resolved}" - + - + ================= + EXECUTION SECTION + ================= + --> + - + + + + Must select one file in the IDE or set run.class - + ================= + DEBUGGING SECTION + ================= + --> + - + - - + + - - + + Must select one file in the IDE or set debug.class - - + + Must set fix.includes - + - + - + =============== + JAVADOC SECTION + =============== + --> + - + - - - - - + + + - + - + - + ========================= + JUNIT COMPILATION SECTION + ========================= + --> + - - + + + + + - + - + - + Must select some files in the IDE or set javac.includes - - - - - + + - + - + - + ======================= + JUNIT EXECUTION SECTION + ======================= + --> + - - + + - + Some tests failed; see details above. - - - - + + + + - + Must select some files in the IDE or set test.includes - + - + Some tests failed; see details above. - + - + ======================= + JUNIT DEBUGGING SECTION + ======================= + --> + Must select one file in the IDE or set test.class - + + + + - + + + + + + + + - - + + - - + + - + - + ========================= + APPLET EXECUTION SECTION + ========================= + --> + Must select one file in the IDE or set applet.url @@ -516,11 +596,11 @@ - + ========================= + APPLET DEBUGGING SECTION + ========================= + --> + Must select one file in the IDE or set applet.url @@ -528,14 +608,14 @@ - + - - + =============== + CLEANUP SECTION + =============== + --> + + @@ -543,5 +623,5 @@ - + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/welltestedsolution/nbproject/genfiles.properties --- a/samples/apifest1/day2/welltestedsolution/nbproject/genfiles.properties Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/welltestedsolution/nbproject/genfiles.properties Sat Jun 14 09:52:48 2008 +0200 @@ -1,8 +1,8 @@ build.xml.data.CRC32=3022b908 build.xml.script.CRC32=fdb77cae -build.xml.stylesheet.CRC32=a12b3d02 +build.xml.stylesheet.CRC32=be360661 # This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml. # Do not edit this file. You may delete it but then the IDE will never regenerate such files for you. nbproject/build-impl.xml.data.CRC32=3022b908 -nbproject/build-impl.xml.script.CRC32=b9627854 -nbproject/build-impl.xml.stylesheet.CRC32=c10f1eac +nbproject/build-impl.xml.script.CRC32=8c67cdf0 +nbproject/build-impl.xml.stylesheet.CRC32=f1d9da08 diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/welltestedsolution/nbproject/project.properties --- a/samples/apifest1/day2/welltestedsolution/nbproject/project.properties Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/welltestedsolution/nbproject/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -15,6 +15,8 @@ dist.dir=dist dist.jar=${dist.dir}/boolcircuit.jar dist.javadoc.dir=${dist.dir}/javadoc +excludes= +includes=** jar.compress=false javac.classpath= # Space-separated list of extra javac options diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day2/welltestedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java --- a/samples/apifest1/day2/welltestedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java Sat Jun 14 09:52:47 2008 +0200 +++ b/samples/apifest1/day2/welltestedsolution/test/org/netbeans/apifest/boolcircuit/RealTest.java Sat Jun 14 09:52:48 2008 +0200 @@ -55,6 +55,7 @@ * own "element" type. This is all going to be exercise in the tests bellow * which you are supposed to implement. */ +// BEGIN: apifest.day2.welltestedsolution.RealTest public class RealTest extends TestCase { static { // your code shall run without any permissions @@ -171,3 +172,5 @@ assertEquals("0 0 0", 0.0, c.evaluateFuzzy(0.0, 0.0, 0.0), 0.0); } } +// END: apifest.day2.welltestedsolution.RealTest + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-stackbasedsolution/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-stackbasedsolution/build.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,97 @@ + + + + Builds the test against first version and runs them against two + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-stackbasedsolution/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-stackbasedsolution/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,77 @@ + + + org.netbeans.modules.ant.freeform + + + + Against Stack Based Solution + + build.xml + project.properties + + + + + java + test + + + + + + compile + + + + clean + + + + test + + + + test + + + + clean + compile + + + + folder + build/tests + + compile + + + + + + test + + + ${ant.script} + + + + + + + + + + + + + + + test + ${apiA}:${apifest}/lib/junit-3.8.2.jar + build/tests + 1.5 + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-stackbasedsolution/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-stackbasedsolution/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,17 @@ + +# location to root of the repository with apifest projects +apifest=../../.. + +# name of a project to test +apitotest=stackbasedsolution + +# the test shall expose a problem between two versions +# of one API. select the first version - dayA and a second +# version of the of the API dayB +dayA=${apifest}/day1 +dayB=${apifest}/day2 + +# usual locations of API classes for each version +apiA=${dayA}/${apitotest}/build/classes/ +apiB=${dayB}/${apitotest}/build/classes/ + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-stackbasedsolution/test/apifest/CircuitTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-stackbasedsolution/test/apifest/CircuitTest.java Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,58 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ +package apifest; + +import junit.framework.TestCase; +import org.netbeans.apifest.boolcircuit.Circuit; +import org.netbeans.apifest.boolcircuit.CircuitFactory; + + +/** Write a test that works with version from day A and fails with version B. + */ +public class CircuitTest extends TestCase { + public CircuitTest(String n) { + super(n); + } + + public void testClass() throws Exception { + Circuit c = CircuitFactory.getBasicCircuit(null); + } +} diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-subclassingsolution/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-subclassingsolution/build.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,97 @@ + + + + Builds the test against first version and runs them against two + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-subclassingsolution/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-subclassingsolution/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,77 @@ + + + org.netbeans.modules.ant.freeform + + + + Against Subclassing Solution + + build.xml + project.properties + + + + + java + test + + + + + + compile + + + + clean + + + + test + + + + test + + + + clean + compile + + + + folder + build/tests + + compile + + + + + + test + + + ${ant.script} + + + + + + + + + + + + + + + test + ${apiA}:${apifest}/lib/junit-3.8.2.jar + build/tests + 1.5 + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-subclassingsolution/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-subclassingsolution/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,17 @@ + +# location to root of the repository with apifest projects +apifest=../../.. + +# name of a project to test +apitotest=subclassingsolution + +# the test shall expose a problem between two versions +# of one API. select the first version - dayA and a second +# version of the of the API dayB +dayA=${apifest}/day1 +dayB=${apifest}/day2 + +# usual locations of API classes for each version +apiA=${dayA}/${apitotest}/build/classes/ +apiB=${dayB}/${apitotest}/build/classes/ + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-subclassingsolution/test/apifest/CircuitTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-subclassingsolution/test/apifest/CircuitTest.java Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,57 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ +package apifest; + +import junit.framework.TestCase; +import org.netbeans.apifest.boolcircuit.Circuit; + + +/** Write a test that works with version from day A and fails with version B. + */ +public class CircuitTest extends TestCase { + public CircuitTest(String n) { + super(n); + } + + public void testClass() throws Exception { + Circuit c = Circuit.AND; + } +} diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-welltestedsolution/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-welltestedsolution/build.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,97 @@ + + + + Builds the test against first version and runs them against two + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-welltestedsolution/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-welltestedsolution/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,77 @@ + + + org.netbeans.modules.ant.freeform + + + + Against Well Tested Solution + + build.xml + project.properties + + + + + java + test + + + + + + compile + + + + clean + + + + test + + + + test + + + + clean + compile + + + + folder + build/tests + + compile + + + + + + test + + + ${ant.script} + + + + + + + + + + + + + + + test + ${apiA}:${apifest}/lib/junit-3.8.2.jar + build/tests + 1.5 + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-welltestedsolution/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-welltestedsolution/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,17 @@ + +# location to root of the repository with apifest projects +apifest=../../.. + +# name of a project to test +apitotest=welltestedsolution + +# the test shall expose a problem between two versions +# of one API. select the first version - dayA and a second +# version of the of the API dayB +dayA=${apifest}/day1 +dayB=${apifest}/day2 + +# usual locations of API classes for each version +apiA=${dayA}/${apitotest}/build/classes/ +apiB=${dayB}/${apitotest}/build/classes/ + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/jtulach/against-welltestedsolution/test/apifest/CircuitTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/jtulach/against-welltestedsolution/test/apifest/CircuitTest.java Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,60 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ +package apifest; + +import junit.framework.TestCase; +import org.netbeans.apifest.boolcircuit.Circuit; + + +/** Write a test that works with version from day A and fails with version B. + */ +public class CircuitTest extends TestCase { + public CircuitTest(String n) { + super(n); + } + + public void testClass() throws Exception { + // I know this is not fair + if (!Circuit.createNotCircuit(null).getClass().getName().endsWith("Circuit")) { + fail("My class is not a Circuit"); + } + } +} diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-alwayscreatenewcircuit/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-alwayscreatenewcircuit/build.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,97 @@ + + + + Builds the test against first version and runs them against two + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-alwayscreatenewcircuit/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-alwayscreatenewcircuit/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,77 @@ + + + org.netbeans.modules.ant.freeform + + + + against-alwayscreatenewcircuit + + build.xml + project.properties + + + + + java + test + + + + + + compile + + + + clean + + + + test + + + + test + + + + clean + compile + + + + folder + build/tests + + compile + + + + + + test + + + ${ant.script} + + + + + + + + + + + + + + + test + ${apiA}:${apifest}/lib/junit-3.8.2.jar + build/tests + 1.5 + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-alwayscreatenewcircuit/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-alwayscreatenewcircuit/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,17 @@ + +# location to root of the repository with apifest projects +apifest=../../.. + +# name of a project to test +apitotest=alwayscreatenewcircuit + +# the test shall expose a problem between two versions +# of one API. select the first version - dayA and a second +# version of the of the API dayB +dayA=${apifest}/day1 +dayB=${apifest}/day2 + +# usual locations of API classes for each version +apiA=${dayA}/${apitotest}/build/classes/ +apiB=${dayB}/${apitotest}/build/classes/ + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-alwayscreatenewcircuit/test/apifest/CircuitTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-alwayscreatenewcircuit/test/apifest/CircuitTest.java Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,58 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ +package apifest; + +import junit.framework.TestCase; +import org.netbeans.apifest.boolcircuit.Circuit; + + +/** Write a test that works with version from day A and fails with version B. + */ +public class CircuitTest extends TestCase { + public CircuitTest(String n) { + super(n); + } + + public void testReallyUnrealistic() throws Exception { + // OK, this is not fair, right? + assertEquals(null, Circuit.or(false, false).getClass().getSuperclass().getSuperclass().getSuperclass()); + } +} diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-elementbasedsolution/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-elementbasedsolution/build.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,97 @@ + + + + Builds the test against first version and runs them against two + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-elementbasedsolution/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-elementbasedsolution/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,77 @@ + + + org.netbeans.modules.ant.freeform + + + + against-elementbasedsolution + + build.xml + project.properties + + + + + java + test + + + + + + compile + + + + clean + + + + test + + + + test + + + + clean + compile + + + + folder + build/tests + + compile + + + + + + test + + + ${ant.script} + + + + + + + + + + + + + + + test + ${apiA}:${apifest}/lib/junit-3.8.2.jar + build/tests + 1.5 + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-elementbasedsolution/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-elementbasedsolution/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,17 @@ + +# location to root of the repository with apifest projects +apifest=../../.. + +# name of a project to test +apitotest=elementbasedsolution + +# the test shall expose a problem between two versions +# of one API. select the first version - dayA and a second +# version of the of the API dayB +dayA=${apifest}/day1 +dayB=${apifest}/day2 + +# usual locations of API classes for each version +apiA=${dayA}/${apitotest}/build/classes/ +apiB=${dayB}/${apitotest}/build/classes/ + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-elementbasedsolution/test/apifest/CircuitTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-elementbasedsolution/test/apifest/CircuitTest.java Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,63 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ +package apifest; + +import junit.framework.TestCase; +import org.netbeans.apifest.boolcircuit.Circuit; + + +/** Write a test that works with version from day A and fails with version B. + */ +public class CircuitTest extends TestCase { + public CircuitTest(String n) { + super(n); + } + /** + * OK, elementbasedsolution looked bulletproof. Every code path was exactly + * the same as in the initial version. Except one. + */ + public void testEvaluateWithoutAssign() throws Exception { + Circuit.Variable var = Circuit.var(); + Circuit.Element circuit = Circuit.not(var); + + assertTrue (circuit.result()); + } +} diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-inputandoperation/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-inputandoperation/build.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,97 @@ + + + + Builds the test against first version and runs them against two + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-inputandoperation/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-inputandoperation/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,77 @@ + + + org.netbeans.modules.ant.freeform + + + + against-inputandoperation + + build.xml + project.properties + + + + + java + test + + + + + + compile + + + + clean + + + + test + + + + test + + + + clean + compile + + + + folder + build/tests + + compile + + + + + + test + + + ${ant.script} + + + + + + + + + + + + + + + test + ${apiA}:${apifest}/lib/junit-3.8.2.jar + build/tests + 1.5 + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-inputandoperation/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-inputandoperation/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,17 @@ + +# location to root of the repository with apifest projects +apifest=../../.. + +# name of a project to test +apitotest=inputandoperation + +# the test shall expose a problem between two versions +# of one API. select the first version - dayA and a second +# version of the of the API dayB +dayA=${apifest}/day1 +dayB=${apifest}/day2 + +# usual locations of API classes for each version +apiA=${dayA}/${apitotest}/build/classes/ +apiB=${dayB}/${apitotest}/build/classes/ + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-inputandoperation/test/apifest/CircuitTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-inputandoperation/test/apifest/CircuitTest.java Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,64 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ +package apifest; + +import junit.framework.TestCase; +import org.netbeans.apifest.boolcircuit.Circuit; +import org.netbeans.apifest.boolcircuit.Operation; + +/** Write a test that works with version from day A and fails with version B. + */ +public class CircuitTest extends TestCase { + public CircuitTest(String n) { + super(n); + } + + public void testSourceCompatibility() throws Exception { + } + + // One forgotten final and the dissaster is here. + // Of course Circuit has to be public, but it has to be anyway to be usable + class MyCircuit extends Circuit { + public double evaluateRealOperation(Operation op) { + return 0; + } + } +} diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-stackbasedsolution/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-stackbasedsolution/build.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,97 @@ + + + + Builds the test against first version and runs them against two + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-stackbasedsolution/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-stackbasedsolution/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,77 @@ + + + org.netbeans.modules.ant.freeform + + + + against-stackbasedsolution + + build.xml + project.properties + + + + + java + test + + + + + + compile + + + + clean + + + + test + + + + test + + + + clean + compile + + + + folder + build/tests + + compile + + + + + + test + + + ${ant.script} + + + + + + + + + + + + + + + test + ../../../lib/junit-3.8.2.jar:../../../day1/stackbasedsolution/dist/boolcircuit.jar + build/tests + 1.5 + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-stackbasedsolution/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-stackbasedsolution/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,17 @@ + +# location to root of the repository with apifest projects +apifest=../../.. + +# name of a project to test +apitotest=stackbasedsolution + +# the test shall expose a problem between two versions +# of one API. select the first version - dayA and a second +# version of the of the API dayB +dayA=${apifest}/day1 +dayB=${apifest}/day2 + +# usual locations of API classes for each version +apiA=${dayA}/${apitotest}/build/classes/ +apiB=${dayB}/${apitotest}/build/classes/ + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-stackbasedsolution/test/apifest/CircuitTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-stackbasedsolution/test/apifest/CircuitTest.java Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,95 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ +package apifest; + +import java.util.Arrays; +import java.util.Stack; +import junit.framework.TestCase; +import org.netbeans.apifest.boolcircuit.Circuit; +import org.netbeans.apifest.boolcircuit.CircuitFactory; +import org.netbeans.apifest.boolcircuit.Operation; + + +/** Write a test that works with version from day A and fails with version B. + */ +public class CircuitTest extends TestCase { + public CircuitTest(String n) { + super(n); + } + + // no need to comment + + public void testSourceComp() throws Exception { + Operation nand = new Operation() { + public char evaluate(char i1, char i2) throws IllegalArgumentException { + return i1 == '1' && i2 == '1' ? '0' : '1'; + } + }; + } + + public void testSourceComp2() throws Exception { + Operation nand = new Operation() { + public char evaluate(char i1, char i2) throws IllegalArgumentException { + evaluate(1, 2); + return i1 == '1' && i2 == '1' ? '0' : '1'; + } + // checker + public char evaluate(double d1, double d2) { + return '1'; + } + }; + } + + public void testBinaryComp() throws Exception { + Operation nand = new Operation() { + public char evaluate(char i1, char i2) throws IllegalArgumentException { + return i1 == '1' && i2 == '1' ? '0' : '1'; + } + }; + Circuit cir = CircuitFactory.getBasicCircuit(nand); + + Stack s = new Stack (); + s.addAll(Arrays.asList('0', '1')); + + assertEquals('1', cir.evaluate(s)); + } + +} diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-subclassingsolution/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-subclassingsolution/build.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,97 @@ + + + + Builds the test against first version and runs them against two + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-subclassingsolution/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-subclassingsolution/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,77 @@ + + + org.netbeans.modules.ant.freeform + + + + against-subclassingsolution + + build.xml + project.properties + + + + + java + test + + + + + + compile + + + + clean + + + + test + + + + test + + + + clean + compile + + + + folder + build/tests + + compile + + + + + + test + + + ${ant.script} + + + + + + + + + + + + + + + test + ${apiA}:${apifest}/lib/junit-3.8.2.jar + build/tests + 1.5 + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-subclassingsolution/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-subclassingsolution/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,17 @@ + +# location to root of the repository with apifest projects +apifest=../../.. + +# name of a project to test +apitotest=subclassingsolution + +# the test shall expose a problem between two versions +# of one API. select the first version - dayA and a second +# version of the of the API dayB +dayA=${apifest}/day1 +dayB=${apifest}/day2 + +# usual locations of API classes for each version +apiA=${dayA}/${apitotest}/build/classes/ +apiB=${dayB}/${apitotest}/build/classes/ + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-subclassingsolution/test/apifest/CircuitTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-subclassingsolution/test/apifest/CircuitTest.java Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,67 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ +package apifest; + +import junit.framework.TestCase; +import org.netbeans.apifest.boolcircuit.Circuit; + + +/** Write a test that works with version from day A and fails with version B. + */ +public class CircuitTest extends TestCase { + public CircuitTest(String n) { + super(n); + } + + // changing field type is incompatible + public void testAnd() throws Exception { + Circuit and = Circuit.AND; + } + + // changing field type is incompatible + public void testOr() throws Exception { + Circuit or = Circuit.OR; + } + + public void testNot() throws Exception { + Circuit not = Circuit.NOT; + } +} diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/build.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/build.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,97 @@ + + + + Builds the test against first version and runs them against two + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/nbproject/project.xml --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/nbproject/project.xml Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,77 @@ + + + org.netbeans.modules.ant.freeform + + + + Against Well Tested Solution + + build.xml + project.properties + + + + + java + test + + + + + + compile + + + + clean + + + + test + + + + test + + + + clean + compile + + + + folder + build/tests + + compile + + + + + + test + + + ${ant.script} + + + + + + + + + + + + + + + test + ${apiA}:${apifest}/lib/junit-3.8.2.jar + build/tests + 1.5 + + + + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/project.properties --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/project.properties Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,17 @@ + +# location to root of the repository with apifest projects +apifest=../../.. + +# name of a project to test +apitotest=welltestedsolution + +# the test shall expose a problem between two versions +# of one API. select the first version - dayA and a second +# version of the of the API dayB +dayA=${apifest}/day1 +dayB=${apifest}/day2 + +# usual locations of API classes for each version +apiA=${dayA}/${apitotest}/build/classes/ +apiB=${dayB}/${apitotest}/build/classes/ + diff -r a0b47629aad8 -r 45b0d58e66ca samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/test/apifest/CircuitTest.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/samples/apifest1/day3-intermezzo/pnejedly/against-welltestedsolution/test/apifest/CircuitTest.java Sat Jun 14 09:52:48 2008 +0200 @@ -0,0 +1,67 @@ +/* + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. + * + * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved. + * + * The contents of this file are subject to the terms of either the GNU + * General Public License Version 2 only ("GPL") or the Common + * Development and Distribution License("CDDL") (collectively, the + * "License"). You may not use this file except in compliance with the + * License. You can obtain a copy of the License at + * http://www.netbeans.org/cddl-gplv2.html + * or nbbuild/licenses/CDDL-GPL-2-CP. See the License for the + * specific language governing permissions and limitations under the + * License. When distributing the software, include this License Header + * Notice in each file and include the License file at + * nbbuild/licenses/CDDL-GPL-2-CP. Sun designates this + * particular file as subject to the "Classpath" exception as provided + * by Sun in the GPL Version 2 section of the License file that + * accompanied this code. If applicable, add the following below the + * License Header, with the fields enclosed by brackets [] replaced by + * your own identifying information: + * "Portions Copyrighted [year] [name of copyright owner]" + * + * Contributor(s): + * + * The Original Software is NetBeans. The Initial Developer of the Original + * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun + * Microsystems, Inc. All Rights Reserved. + * + * If you wish your version of this file to be governed by only the CDDL + * or only the GPL Version 2, indicate your decision by adding + * "[Contributor] elects to include this software in this distribution + * under the [CDDL or GPL Version 2] license." If you do not indicate a + * single choice of license, a recipient has the option to distribute + * your version of this file under either the CDDL, the GPL Version 2 or + * to extend the choice of license to its licensees as provided above. + * However, if you add GPL Version 2 code and therefore, elected the GPL + * Version 2 license, then the option applies only if the new code is + * made subject to such option by the copyright holder. + */ +package apifest; + +import junit.framework.TestCase; +import org.netbeans.apifest.boolcircuit.Circuit; + + +/** Write a test that works with version from day A and fails with version B. + */ +public class CircuitTest extends TestCase { + public CircuitTest(String n) { + super(n); + } + + public void testClass() throws Exception { + // OK, this is not fair as well. + assertEquals("Created AND circuit", "AndCircuit", getName(Circuit.createAndCircuit(null, null))); + assertEquals("Created OR circuit", "OrCircuit", getName(Circuit.createOrCircuit(null, null))); + } + + private String getName(Object obj) { + String base = obj.getClass().getName(); + int lastDot = base.lastIndexOf('.'); + int last = base.lastIndexOf('$'); + if (lastDot > last) last = lastDot; + return base.substring(last+1); + } +}