1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/samples/reexport/build.xml Sat Jun 14 09:54:12 2008 +0200
1.3 @@ -0,0 +1,76 @@
1.4 +<?xml version="1.0" encoding="UTF-8"?>
1.5 +<project name="Build Script" default="test" basedir=".">
1.6 + <target name="clean">
1.7 + <delete dir="build"/>
1.8 + </target>
1.9 +
1.10 + <target name="build" depends="-libraries">
1.11 + <antcall target="-build-one">
1.12 + <param name="version" value="api1.0"/>
1.13 + </antcall>
1.14 + <antcall target="-build-one">
1.15 + <param name="version" value="api2.0"/>
1.16 + </antcall>
1.17 + <antcall target="-build-one">
1.18 + <param name="version" value="query"/>
1.19 + <param name="cp" value="build/api1.0/classes"/>
1.20 + </antcall>
1.21 +
1.22 + <antcall target="-build-one">
1.23 + <param name="version" value="test"/>
1.24 + <param name="cp" value="build/api1.0/classes:build/query/classes:${junit.jar}"/>
1.25 + </antcall>
1.26 + </target>
1.27 +
1.28 + <target name="test" depends="build">
1.29 + <echo level="info" message="Running the Test against Query and Version 1.0 of String. This should succeeds."/>
1.30 + <antcall target="-run-one">
1.31 + <param name="version" value="api1.0"/>
1.32 + </antcall>
1.33 + <echo level="info" message="Running the Test against Query and Version 2.0 of String. This should fail."/>
1.34 + <antcall target="-run-one">
1.35 + <param name="version" value="api2.0"/>
1.36 + </antcall>
1.37 + </target>
1.38 +
1.39 + <!-- support methods -->
1.40 +
1.41 + <target name="-libraries">
1.42 + <ant dir="../libs/"/>
1.43 +
1.44 + <property name="junit.jar" location="../libs/dist/junit-4.4.jar"/>
1.45 + </target>
1.46 +
1.47 + <target name="-run-one">
1.48 + <fail message="You need to specify API version number" unless="version"/>
1.49 + <mkdir dir="build/testresults"/>
1.50 + <junit dir="build/test/classes" errorproperty="tests.failed" failureproperty="tests.failed" fork="true" showoutput="true">
1.51 + <batchtest todir="build/testresults">
1.52 + <fileset dir="build/test/classes">
1.53 + <filename name="**/*Test.class"/>
1.54 + </fileset>
1.55 + </batchtest>
1.56 + <classpath>
1.57 + <path location="build/${version}/classes"/>
1.58 + <path location="build/query/classes"/>
1.59 + <path location="build/test/classes"/>
1.60 + <path location="${junit.jar}"/>
1.61 + </classpath>
1.62 + <formatter type="brief" usefile="false"/>
1.63 + <formatter type="xml"/>
1.64 + </junit>
1.65 + </target>
1.66 +
1.67 + <target name="-build-one">
1.68 + <fail message="You need to specify version number" unless="version"/>
1.69 +
1.70 + <mkdir dir="build/${version}/classes"/>
1.71 + <property name="cp" value=""/>
1.72 + <javac
1.73 + srcdir="src-${version}"
1.74 + destdir="build/${version}/classes"
1.75 + source="1.5" target="1.5"
1.76 + classpath="${cp}"
1.77 + />
1.78 + </target>
1.79 +</project>
2.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
2.2 +++ b/samples/reexport/nbproject/project.xml Sat Jun 14 09:54:12 2008 +0200
2.3 @@ -0,0 +1,107 @@
2.4 +<?xml version="1.0" encoding="UTF-8"?>
2.5 +<project xmlns="http://www.netbeans.org/ns/project/1" xmlns:ns4="null">
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 + <name>reexport</name>
2.10 + </general-data>
2.11 + <general-data xmlns="http://www.netbeans.org/ns/freeform-project/2">
2.12 + <!-- Do not use Project Properties customizer when editing this file manually. -->
2.13 + <name>reexport</name>
2.14 + <properties/>
2.15 + <folders>
2.16 + <source-folder>
2.17 + <label>src-api1.0</label>
2.18 + <type>java</type>
2.19 + <location>src-api1.0</location>
2.20 + <encoding>UTF-8</encoding>
2.21 + </source-folder>
2.22 + <source-folder>
2.23 + <label>src-api2.0</label>
2.24 + <type>java</type>
2.25 + <location>src-api2.0</location>
2.26 + <encoding>UTF-8</encoding>
2.27 + </source-folder>
2.28 + <source-folder>
2.29 + <label>src-query</label>
2.30 + <type>java</type>
2.31 + <location>src-query</location>
2.32 + <encoding>UTF-8</encoding>
2.33 + </source-folder>
2.34 + <source-folder>
2.35 + <label>test</label>
2.36 + <type>java</type>
2.37 + <location>src-test</location>
2.38 + <encoding>UTF-8</encoding>
2.39 + </source-folder>
2.40 + </folders>
2.41 + <ide-actions>
2.42 + <action name="build">
2.43 + <target>build</target>
2.44 + </action>
2.45 + <action name="clean">
2.46 + <target>clean</target>
2.47 + </action>
2.48 + <action name="test">
2.49 + <target>test</target>
2.50 + </action>
2.51 + <action name="run">
2.52 + <target>test</target>
2.53 + </action>
2.54 + <action name="rebuild">
2.55 + <target>clean</target>
2.56 + <target>build</target>
2.57 + </action>
2.58 + </ide-actions>
2.59 + <view>
2.60 + <items>
2.61 + <source-folder style="packages">
2.62 + <label>API String 1.0</label>
2.63 + <location>src-api1.0</location>
2.64 + </source-folder>
2.65 + <source-folder style="packages">
2.66 + <label>API String 2.0</label>
2.67 + <location>src-api2.0</location>
2.68 + </source-folder>
2.69 + <source-folder style="packages">
2.70 + <label>Query using api.String</label>
2.71 + <location>src-query</location>
2.72 + </source-folder>
2.73 + <source-folder style="packages">
2.74 + <label>Usage of the API</label>
2.75 + <location>src-test</location>
2.76 + </source-folder>
2.77 + <source-file>
2.78 + <location>build.xml</location>
2.79 + </source-file>
2.80 + </items>
2.81 + <context-menu>
2.82 + <ide-action name="build"/>
2.83 + <ide-action name="rebuild"/>
2.84 + <ide-action name="clean"/>
2.85 + <ide-action name="test"/>
2.86 + </context-menu>
2.87 + </view>
2.88 + </general-data>
2.89 + <java-data xmlns="http://www.netbeans.org/ns/freeform-project-java/1">
2.90 + <compilation-unit>
2.91 + <package-root>src-api1.0</package-root>
2.92 + <source-level>1.5</source-level>
2.93 + </compilation-unit>
2.94 + <compilation-unit>
2.95 + <package-root>src-api2.0</package-root>
2.96 + <source-level>1.5</source-level>
2.97 + </compilation-unit>
2.98 + <compilation-unit>
2.99 + <package-root>src-query</package-root>
2.100 + <classpath mode="compile">src-api1.0</classpath>
2.101 + <source-level>1.5</source-level>
2.102 + </compilation-unit>
2.103 + <compilation-unit>
2.104 + <package-root>src-test</package-root>
2.105 + <classpath mode="compile">src-api1.0:src-query:../libs/dist/junit-4.4.jar</classpath>
2.106 + <source-level>1.5</source-level>
2.107 + </compilation-unit>
2.108 + </java-data>
2.109 + </configuration>
2.110 +</project>
3.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
3.2 +++ b/samples/reexport/src-api1.0/api/String.java Sat Jun 14 09:54:12 2008 +0200
3.3 @@ -0,0 +1,18 @@
3.4 +package api;
3.5 +
3.6 +// BEGIN: reexport.String10
3.7 +public final class String {
3.8 + private final char[] chars;
3.9 +
3.10 + public String(char[] chars) {
3.11 + this.chars = chars.clone();
3.12 + }
3.13 +
3.14 + public int length() {
3.15 + return chars.length;
3.16 + }
3.17 + public char charAt(int i) {
3.18 + return chars[i];
3.19 + }
3.20 +}
3.21 +// END: reexport.String10
4.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
4.2 +++ b/samples/reexport/src-api2.0/api/String.java Sat Jun 14 09:54:12 2008 +0200
4.3 @@ -0,0 +1,18 @@
4.4 +package api;
4.5 +
4.6 +import api.*;
4.7 +
4.8 +public final class String {
4.9 + private final char[] chars;
4.10 +
4.11 + public String(char[] chars) {
4.12 + this.chars = chars.clone();
4.13 + }
4.14 +
4.15 + public int getSize() {
4.16 + return chars.length;
4.17 + }
4.18 + public char charAt(int i) {
4.19 + return chars[i];
4.20 + }
4.21 +}
5.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
5.2 +++ b/samples/reexport/src-query/query/Query.java Sat Jun 14 09:54:12 2008 +0200
5.3 @@ -0,0 +1,10 @@
5.4 +package query;
5.5 +
5.6 +import api.String;
5.7 +
5.8 +public final class Query {
5.9 + public String computeReply() {
5.10 + char[] hello = { 'H', 'e', 'l', 'l', 'o' };
5.11 + return new String(hello);
5.12 + }
5.13 +}
6.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
6.2 +++ b/samples/reexport/src-test/usage/UseQueryTest.java Sat Jun 14 09:54:12 2008 +0200
6.3 @@ -0,0 +1,27 @@
6.4 +package usage;
6.5 +
6.6 +import api.String;
6.7 +import query.Query;
6.8 +import org.junit.Test;
6.9 +import static org.junit.Assert.*;
6.10 +
6.11 +public class UseQueryTest {
6.12 +
6.13 + public UseQueryTest() {
6.14 + }
6.15 +
6.16 + @Test public void verifyThatQueryReturnsHello() {
6.17 + // BEGIN: reexport.transitive.change.in.String
6.18 + Query query = new Query();
6.19 + String reply = query.computeReply();
6.20 + assertEquals("Length is correct", 5, reply.length());
6.21 + // END: reexport.transitive.change.in.String
6.22 +
6.23 + assertEquals('H', reply.charAt(0));
6.24 + assertEquals('e', reply.charAt(1));
6.25 + assertEquals('l', reply.charAt(2));
6.26 + assertEquals('l', reply.charAt(3));
6.27 + assertEquals('o', reply.charAt(4));
6.28 +
6.29 + }
6.30 +}