This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

View | Details | Raw Unified | Return to bug 208873
Collapse All | Expand All

(-)a/java.j2seproject/nbproject/project.properties (-1 / +2 lines)
Lines 1-6 Link Here
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
1
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
#
2
#
3
# Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
3
# Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved.
4
#
4
#
5
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
5
# Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6
# Other names may be trademarks of their respective owners.
6
# Other names may be trademarks of their respective owners.
Lines 52-56 Link Here
52
test-unit-sys-prop.test.bridge.jar=${cluster}/ant/nblib/bridge.jar
52
test-unit-sys-prop.test.bridge.jar=${cluster}/ant/nblib/bridge.jar
53
test-unit-sys-prop.test.ant.home=${cluster}/ant
53
test-unit-sys-prop.test.ant.home=${cluster}/ant
54
test-unit-sys-prop.test.junit.jar=${nb_all}/libs.junit4/external/junit-4.10.jar
54
test-unit-sys-prop.test.junit.jar=${nb_all}/libs.junit4/external/junit-4.10.jar
55
test-unit-sys-prop.test.testng.jar=${nb_all}/libs.testng/external/testng-6.4.1beta.jar
55
extra.module.files=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
56
extra.module.files=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
56
jnlp.indirect.jars=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
57
jnlp.indirect.jars=ant/extra/org-netbeans-modules-java-j2seproject-copylibstask.jar
(-)a/java.j2seproject/src/org/netbeans/modules/java/j2seproject/resources/build-impl.xsl (-32 / +510 lines)
Lines 2-8 Link Here
2
<!--
2
<!--
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
4
4
5
Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
5
Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved.
6
6
7
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
Oracle and Java are registered trademarks of Oracle and/or its affiliates.
8
Other names may be trademarks of their respective owners.
8
Other names may be trademarks of their respective owners.
Lines 72-80 Link Here
72
  - execution
72
  - execution
73
  - debugging
73
  - debugging
74
  - javadoc
74
  - javadoc
75
  - junit compilation
75
  - test compilation
76
  - junit execution
76
  - test execution
77
  - junit debugging
77
  - test debugging
78
  - applet
78
  - applet
79
  - cleanup
79
  - cleanup
80
80
Lines 352-357 Link Here
352
                <property name="jar.index.metainf" value="${{jar.index}}"/>
352
                <property name="jar.index.metainf" value="${{jar.index}}"/>
353
                <property name="copylibs.rebase" value="true"/>
353
                <property name="copylibs.rebase" value="true"/>
354
                <available file="${{meta.inf.dir}}/persistence.xml" property="has.persistence.xml"/>
354
                <available file="${{meta.inf.dir}}/persistence.xml" property="has.persistence.xml"/>
355
                <condition property="junit.available">
356
                    <or>
357
                        <available classname="org.junit.Test" classpath="${{run.test.classpath}}"/>
358
                        <available classname="junit.framework.Test" classpath="${{run.test.classpath}}"/>
359
                    </or>
360
                </condition>
361
                <condition property="testng.available">
362
                    <available classname="org.testng.annotations.Test" classpath="${{run.test.classpath}}"/>
363
                </condition>
364
                <condition property="junit+testng.available">
365
                    <and>
366
                        <istrue value="${{junit.available}}"/>
367
                        <istrue value="${{testng.available}}"/>
368
                    </and>
369
                </condition>
370
                <condition property="testng.mode" value="mixed" else="testng">
371
                    <istrue value="${{junit+testng.available}}"/>
372
                </condition>
373
                <condition property="testng.debug.mode" value="-mixed" else="">
374
                    <istrue value="${{junit+testng.available}}"/>
375
                </condition>
355
            </target>
376
            </target>
356
377
357
            <target name="-post-init">
378
            <target name="-post-init">
Lines 662-669 Link Here
662
                    </sequential>
683
                    </sequential>
663
                </macrodef>
684
                </macrodef>
664
            </target>
685
            </target>
686
687
            <target name="-init-macrodef-junit-init" if="${{junit.available}}">
688
                <condition property="nb.junit.batch" value="true" else="false">
689
                    <and>
690
                        <istrue value="${{junit.available}}"/>
691
                        <not>
692
                            <isset property="test.method"/>
693
                        </not>
694
                    </and>
695
                </condition>
696
                <condition property="nb.junit.single" value="true" else="false">
697
                    <and>
698
                        <istrue value="${{junit.available}}"/>
699
                        <isset property="test.method"/>
700
                    </and>
701
                </condition>
702
            </target>
665
            
703
            
666
            <target name="-init-macrodef-junit">
704
            <target name="-init-macrodef-junit-single" if="${{nb.junit.single}}" unless="${{nb.junit.batch}}">
667
                <macrodef>
705
                <macrodef>
668
                    <xsl:attribute name="name">junit</xsl:attribute>
706
                    <xsl:attribute name="name">junit</xsl:attribute>
669
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
707
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
Lines 679-684 Link Here
679
                        <xsl:attribute name="name">testincludes</xsl:attribute>
717
                        <xsl:attribute name="name">testincludes</xsl:attribute>
680
                        <xsl:attribute name="default">**</xsl:attribute>
718
                        <xsl:attribute name="default">**</xsl:attribute>
681
                    </attribute>
719
                    </attribute>
720
                    <attribute>
721
                        <xsl:attribute name="name">testmethods</xsl:attribute>
722
                        <xsl:attribute name="default"></xsl:attribute>
723
                    </attribute>
724
                    <element>
725
                        <xsl:attribute name="name">customize</xsl:attribute>
726
                        <xsl:attribute name="optional">true</xsl:attribute>
727
                    </element>
728
                    <sequential>
729
                        <property name="junit.forkmode" value="perTest"/>
730
                        <junit>
731
                            <xsl:attribute name="showoutput">true</xsl:attribute>
732
                            <xsl:attribute name="fork">true</xsl:attribute>
733
                            <xsl:attribute name="forkmode">${junit.forkmode}</xsl:attribute>
734
                            <xsl:attribute name="dir">${work.dir}</xsl:attribute> <!-- #47474: match <java> --> 
735
                            <xsl:attribute name="failureproperty">tests.failed</xsl:attribute>
736
                            <xsl:attribute name="errorproperty">tests.failed</xsl:attribute>
737
                            <xsl:attribute name="tempdir">${build.dir}</xsl:attribute>
738
                            <xsl:if test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
739
                                <xsl:attribute name="jvm">${platform.java}</xsl:attribute>
740
                            </xsl:if>
741
                            <test todir="${{build.test.results.dir}}" name="@{{testincludes}}" methods="@{{testmethods}}"/>
742
                            <syspropertyset>
743
                                <propertyref prefix="test-sys-prop."/>
744
                                <mapper type="glob" from="test-sys-prop.*" to="*"/>
745
                            </syspropertyset>
746
                            <formatter type="brief" usefile="false"/>
747
                            <formatter type="xml"/>
748
                            <jvmarg value="-ea"/>
749
                            <customize/>
750
                        </junit>
751
                    </sequential>
752
                </macrodef>
753
            </target>
754
755
            <target name="-init-macrodef-junit-batch" if="${{nb.junit.batch}}" unless="${{nb.junit.single}}">
756
                <macrodef>
757
                    <xsl:attribute name="name">junit</xsl:attribute>
758
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
759
                    <attribute>
760
                        <xsl:attribute name="name">includes</xsl:attribute>
761
                        <xsl:attribute name="default">${includes}</xsl:attribute>
762
                    </attribute>
763
                    <attribute>
764
                        <xsl:attribute name="name">excludes</xsl:attribute>
765
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
766
                    </attribute>
767
                    <attribute>
768
                        <xsl:attribute name="name">testincludes</xsl:attribute>
769
                        <xsl:attribute name="default">**</xsl:attribute>
770
                    </attribute>
771
                    <attribute>
772
                        <xsl:attribute name="name">testmethods</xsl:attribute>
773
                        <xsl:attribute name="default"></xsl:attribute>
774
                    </attribute>
775
                    <element>
776
                        <xsl:attribute name="name">customize</xsl:attribute>
777
                        <xsl:attribute name="optional">true</xsl:attribute>
778
                    </element>
682
                    <sequential>
779
                    <sequential>
683
                        <property name="junit.forkmode" value="perTest"/>
780
                        <property name="junit.forkmode" value="perTest"/>
684
                        <junit>
781
                        <junit>
Lines 700-722 Link Here
700
                                    <xsl:with-param name="excludes">@{excludes}</xsl:with-param>
797
                                    <xsl:with-param name="excludes">@{excludes}</xsl:with-param>
701
                                </xsl:call-template>
798
                                </xsl:call-template>
702
                            </batchtest>
799
                            </batchtest>
703
                            <classpath>
704
                                <path path="${{run.test.classpath}}"/>
705
                            </classpath>
706
                            <syspropertyset>
800
                            <syspropertyset>
707
                                <propertyref prefix="test-sys-prop."/>
801
                                <propertyref prefix="test-sys-prop."/>
708
                                <mapper type="glob" from="test-sys-prop.*" to="*"/>
802
                                <mapper type="glob" from="test-sys-prop.*" to="*"/>
709
                            </syspropertyset>
803
                            </syspropertyset>
710
                            <formatter type="brief" usefile="false"/>
804
                            <formatter type="brief" usefile="false"/>
711
                            <formatter type="xml"/>
805
                            <formatter type="xml"/>
712
                            <jvmarg line="${{endorsed.classpath.cmd.line.arg}}"/>
713
                            <jvmarg value="-ea"/>
806
                            <jvmarg value="-ea"/>
714
                            <jvmarg line="${{run.jvmargs}}"/>
807
                            <customize/>
715
                        </junit>
808
                        </junit>
716
                    </sequential>
809
                    </sequential>
717
                </macrodef>
810
                </macrodef>
718
            </target>
811
            </target>
719
812
813
            <target name="-init-macrodef-junit" if="${{junit.available}}" depends="-init-macrodef-junit-init,-init-macrodef-junit-single, -init-macrodef-junit-batch"/>
814
815
            <target name="-init-macrodef-testng" if="${{testng.available}}">
816
                <macrodef>
817
                    <xsl:attribute name="name">testng</xsl:attribute>
818
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
819
                    <attribute>
820
                        <xsl:attribute name="name">includes</xsl:attribute>
821
                        <xsl:attribute name="default">${includes}</xsl:attribute>
822
                    </attribute>
823
                    <attribute>
824
                        <xsl:attribute name="name">excludes</xsl:attribute>
825
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
826
                    </attribute>
827
                    <attribute>
828
                        <xsl:attribute name="name">testincludes</xsl:attribute>
829
                        <xsl:attribute name="default">**</xsl:attribute>
830
                    </attribute>
831
                    <attribute>
832
                        <xsl:attribute name="name">testmethods</xsl:attribute>
833
                        <xsl:attribute name="default"></xsl:attribute>
834
                    </attribute>
835
                    <element>
836
                        <xsl:attribute name="name">customize</xsl:attribute>
837
                        <xsl:attribute name="optional">true</xsl:attribute>
838
                    </element>
839
                    <sequential>
840
                        <pathconvert pathsep="${{line.separator}}" property="testng.testincludes">
841
                            <path>
842
                                <filelist dir="${{build.test.classes.dir}}" files="@{{testincludes}}"/>
843
                            </path>
844
                            <chainedmapper>
845
                                <globmapper from="*.java" to="*.class"/>
846
                                <globmapper from="${{basedir}}/${{build.test.classes.dir}}/*" to="*"/>                    
847
                            </chainedmapper>
848
                        </pathconvert>
849
                        <pathconvert pathsep="${{line.separator}}" property="testng.excludes">
850
                            <path>
851
                                <filelist dir="${{build.test.classes.dir}}" files="@{{excludes}}"/>
852
                                <filelist dir="${{build.test.classes.dir}}" files="${{excludes}}"/>
853
                            </path>
854
                            <chainedmapper>
855
                                <globmapper from="*.java" to="*.class"/>
856
                                <globmapper from="${{basedir}}/${{build.test.classes.dir}}/*" to="*"/>
857
                            </chainedmapper>
858
                        </pathconvert>
859
                        <pathconvert pathsep="${{line.separator}}" property="testng.includes">
860
                            <path>
861
                                <filelist dir="${{build.test.classes.dir}}" files="@{{includes}}"/>
862
                            </path>
863
                            <chainedmapper>
864
                                <globmapper from="*.java" to="*.class"/>
865
                                <globmapper from="${{basedir}}/${{build.test.classes.dir}}/*" to="*"/>
866
                            </chainedmapper>
867
                        </pathconvert>
868
                        <condition property="testng.methods.arg" value="@{{testincludes}}.@{{testmethods}}" else="">
869
                            <isset property="test.method"/>
870
                        </condition>
871
                        <taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${{run.test.classpath}}"/>
872
                        <testng>
873
                            <xsl:attribute name="mode">${testng.mode}</xsl:attribute>
874
                            <xsl:attribute name="enableAssert">true</xsl:attribute>
875
                            <xsl:attribute name="workingDir">${work.dir}</xsl:attribute> <!-- #47474: match <java> --> 
876
                            <xsl:attribute name="failureProperty">tests.failed</xsl:attribute>
877
                            <xsl:attribute name="methods">${testng.methods.arg}</xsl:attribute>
878
                            <xsl:attribute name="outputdir">${build.test.results.dir}</xsl:attribute>
879
                            <xsl:attribute name="suitename"><xsl:value-of select="$codename"/></xsl:attribute>
880
                            <xsl:attribute name="testname">TestNG tests</xsl:attribute>
881
                            <xsl:if test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
882
                                <xsl:attribute name="jvm">${platform.java}</xsl:attribute>
883
                            </xsl:if>
884
                            <classfileset dir="${{build.test.classes.dir}}" excludes="${{testng.excludes}}" includes="${{testng.includes}}">
885
                                <filename name="${{testng.testincludes}}"/>
886
                            </classfileset>
887
                            <xmlfileset dir="${{build.test.classes.dir}}" includes="@{{testincludes}}"/>
888
                            <propertyset>
889
                                <propertyref prefix="test-sys-prop."/>
890
                                <mapper from="test-sys-prop.*" to="*" type="glob"/>
891
                            </propertyset>
892
                            <customize/>
893
                        </testng>
894
                    </sequential>
895
                </macrodef>
896
            </target>
897
898
            <target name="-init-macrodef-test-impl">
899
                <macrodef>
900
                    <xsl:attribute name="name">test-impl</xsl:attribute>
901
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
902
                    <attribute>
903
                        <xsl:attribute name="name">includes</xsl:attribute>
904
                        <xsl:attribute name="default">${includes}</xsl:attribute>
905
                    </attribute>
906
                    <attribute>
907
                        <xsl:attribute name="name">excludes</xsl:attribute>
908
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
909
                    </attribute>
910
                    <attribute>
911
                        <xsl:attribute name="name">testincludes</xsl:attribute>
912
                        <xsl:attribute name="default">**</xsl:attribute>
913
                    </attribute>
914
                    <attribute>
915
                        <xsl:attribute name="name">testmethods</xsl:attribute>
916
                        <xsl:attribute name="default"></xsl:attribute>
917
                    </attribute>
918
                    <element>
919
                        <xsl:attribute name="name">customize</xsl:attribute>
920
                        <xsl:attribute name="optional">true</xsl:attribute>
921
                        <xsl:attribute name="implicit">true</xsl:attribute>
922
                    </element>
923
                    <sequential>
924
                        <echo>No tests executed.</echo>
925
                    </sequential>
926
                </macrodef>
927
            </target>
928
929
            <target name="-init-macrodef-junit-impl" depends="-init-macrodef-junit" if="${{junit.available}}">
930
                <macrodef>
931
                    <xsl:attribute name="name">test-impl</xsl:attribute>
932
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
933
                    <attribute>
934
                        <xsl:attribute name="name">includes</xsl:attribute>
935
                        <xsl:attribute name="default">${includes}</xsl:attribute>
936
                    </attribute>
937
                    <attribute>
938
                        <xsl:attribute name="name">excludes</xsl:attribute>
939
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
940
                    </attribute>
941
                    <attribute>
942
                        <xsl:attribute name="name">testincludes</xsl:attribute>
943
                        <xsl:attribute name="default">**</xsl:attribute>
944
                    </attribute>
945
                    <attribute>
946
                        <xsl:attribute name="name">testmethods</xsl:attribute>
947
                        <xsl:attribute name="default"></xsl:attribute>
948
                    </attribute>
949
                    <element>
950
                        <xsl:attribute name="name">customize</xsl:attribute>
951
                        <xsl:attribute name="optional">true</xsl:attribute>
952
                        <xsl:attribute name="implicit">true</xsl:attribute>
953
                    </element>
954
                    <sequential>
955
                        <j2seproject3:junit includes="@{{includes}}" excludes="@{{excludes}}" testincludes="@{{testincludes}}" testmethods="@{{testmethods}}">
956
                            <customize/>
957
                        </j2seproject3:junit>
958
                    </sequential>
959
                </macrodef>
960
            </target>
961
            
962
            <target name="-init-macrodef-testng-impl" depends="-init-macrodef-testng" if="${{testng.available}}">
963
                <macrodef>
964
                    <xsl:attribute name="name">test-impl</xsl:attribute>
965
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
966
                    <attribute>
967
                        <xsl:attribute name="name">includes</xsl:attribute>
968
                        <xsl:attribute name="default">${includes}</xsl:attribute>
969
                    </attribute>
970
                    <attribute>
971
                        <xsl:attribute name="name">excludes</xsl:attribute>
972
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
973
                    </attribute>
974
                    <attribute>
975
                        <xsl:attribute name="name">testincludes</xsl:attribute>
976
                        <xsl:attribute name="default">**</xsl:attribute>
977
                    </attribute>
978
                    <attribute>
979
                        <xsl:attribute name="name">testmethods</xsl:attribute>
980
                        <xsl:attribute name="default"></xsl:attribute>
981
                    </attribute>
982
                    <element>
983
                        <xsl:attribute name="name">customize</xsl:attribute>
984
                        <xsl:attribute name="optional">true</xsl:attribute>
985
                        <xsl:attribute name="implicit">true</xsl:attribute>
986
                    </element>
987
                    <sequential>
988
                        <j2seproject3:testng includes="@{{includes}}" excludes="@{{excludes}}" testincludes="@{{testincludes}}" testmethods="@{{testmethods}}">
989
                            <customize/>
990
                        </j2seproject3:testng>
991
                    </sequential>
992
                </macrodef>
993
            </target>
994
                        
995
            <target name="-init-macrodef-test" depends="-init-macrodef-test-impl,-init-macrodef-junit-impl,-init-macrodef-testng-impl">
996
                <macrodef>
997
                    <xsl:attribute name="name">test</xsl:attribute>
998
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
999
                    <attribute>
1000
                        <xsl:attribute name="name">includes</xsl:attribute>
1001
                        <xsl:attribute name="default">${includes}</xsl:attribute>
1002
                    </attribute>
1003
                    <attribute>
1004
                        <xsl:attribute name="name">excludes</xsl:attribute>
1005
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
1006
                    </attribute>
1007
                    <attribute>
1008
                        <xsl:attribute name="name">testincludes</xsl:attribute>
1009
                        <xsl:attribute name="default">**</xsl:attribute>
1010
                    </attribute>
1011
                    <attribute>
1012
                        <xsl:attribute name="name">testmethods</xsl:attribute>
1013
                        <xsl:attribute name="default"></xsl:attribute>
1014
                    </attribute>
1015
                    <sequential>
1016
                        <j2seproject3:test-impl includes="@{{includes}}" excludes="@{{excludes}}" testincludes="@{{testincludes}}" testmethods="@{{testmethods}}">
1017
                            <customize>
1018
                                <classpath>
1019
                                    <path path="${{run.test.classpath}}"/>
1020
                                </classpath>
1021
                                <jvmarg line="${{endorsed.classpath.cmd.line.arg}}"/>
1022
                                <jvmarg line="${{run.jvmargs}}"/>
1023
                            </customize>
1024
                        </j2seproject3:test-impl>
1025
                    </sequential>
1026
                </macrodef>
1027
            </target>
1028
1029
            <target name="-init-macrodef-junit-debug" if="${{junit.available}}">
1030
                <macrodef>
1031
                    <xsl:attribute name="name">junit-debug</xsl:attribute>
1032
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1033
                    <attribute>
1034
                        <xsl:attribute name="name">testClass</xsl:attribute>
1035
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
1036
                    </attribute>
1037
                    <attribute>
1038
                        <xsl:attribute name="name">testMethod</xsl:attribute>
1039
                        <xsl:attribute name="default"></xsl:attribute>
1040
                    </attribute>
1041
                    <xsl:element name="element">
1042
                        <xsl:attribute name="name">customize2</xsl:attribute>
1043
                        <xsl:attribute name="optional">true</xsl:attribute>
1044
                    </xsl:element>
1045
                    <sequential>
1046
                        <property name="test.report.file" location="${{build.test.results.dir}}/TEST-@{{testClass}}.xml"/>
1047
                        <delete file="${{test.report.file}}"/>
1048
                        <mkdir dir="${{build.test.results.dir}}"/>
1049
                        <condition property="junit.methods.arg" value="methods=@{{testMethod}}" else="">
1050
                            <isset property="test.method"/>
1051
                        </condition>
1052
                        <!--Ugly, puts ant and ant-junit to the test classpath, but there is probably no other solution how to run the XML formatter -->
1053
                        <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${{ant.home}}/lib/ant.jar:${{ant.home}}/lib/ant-junit.jar:${{debug.test.classpath}}">
1054
                            <customize>
1055
                                <arg value="@{{testClass}}"/>
1056
                                <arg value="${{junit.methods.arg}}"/>
1057
                                <arg value="showoutput=true"/>
1058
                                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
1059
                                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${{test.report.file}}"/>
1060
                                <customize2/>
1061
                            </customize>
1062
                        </j2seproject3:debug>
1063
                    </sequential>
1064
                </macrodef>
1065
            </target>
1066
1067
            <target name="-init-macrodef-junit-debug-impl" depends="-init-macrodef-junit-debug" if="${{junit.available}}">
1068
                <macrodef>
1069
                    <xsl:attribute name="name">test-debug-impl</xsl:attribute>
1070
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1071
                    <attribute>
1072
                        <xsl:attribute name="name">testClass</xsl:attribute>
1073
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
1074
                    </attribute>
1075
                    <attribute>
1076
                        <xsl:attribute name="name">testMethod</xsl:attribute>
1077
                        <xsl:attribute name="default"></xsl:attribute>
1078
                    </attribute>
1079
                    <xsl:element name="element">
1080
                        <xsl:attribute name="name">customize2</xsl:attribute>
1081
                        <xsl:attribute name="optional">true</xsl:attribute>
1082
                        <xsl:attribute name="implicit">true</xsl:attribute>
1083
                    </xsl:element>
1084
                    <sequential>
1085
                        <j2seproject3:junit-debug testClass="@{{testClass}}" testMethod="@{{testMethod}}">
1086
                            <customize2/>
1087
                        </j2seproject3:junit-debug>
1088
                    </sequential>
1089
                </macrodef>
1090
            </target>
1091
1092
            <target name="-init-macrodef-testng-debug" if="${{testng.available}}">
1093
                <macrodef>
1094
                    <xsl:attribute name="name">testng-debug</xsl:attribute>
1095
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1096
                    <attribute>
1097
                        <xsl:attribute name="name">testClass</xsl:attribute>
1098
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
1099
                    </attribute>
1100
                    <attribute>
1101
                        <xsl:attribute name="name">testMethod</xsl:attribute>
1102
                        <xsl:attribute name="default"></xsl:attribute>
1103
                    </attribute>
1104
                    <xsl:element name="element">
1105
                        <xsl:attribute name="name">customize2</xsl:attribute>
1106
                        <xsl:attribute name="optional">true</xsl:attribute>
1107
                    </xsl:element>
1108
                    <sequential>
1109
                        <condition property="test.class.or.method" value="-methods @{{testClass}}.@{{testMethod}}" else="-testclass @{{testClass}}">
1110
                            <isset property="test.method"/>
1111
                        </condition>
1112
                        <condition property="testng.cmd.args" value="@{{testClass}}" else="-suitename {$codename} -testname @{{testClass}} ${{test.class.or.method}}">
1113
                            <matches string="@{{testClass}}" pattern=".*\.xml"/>
1114
                        </condition>
1115
                        <delete dir="${{build.test.results.dir}}" quiet="true"/>
1116
                        <mkdir dir="${{build.test.results.dir}}"/>
1117
                        <j2seproject3:debug classname="org.testng.TestNG" classpath="${{debug.test.classpath}}">
1118
                            <customize>
1119
                                <customize2/>
1120
                                <jvmarg value="-ea"/>
1121
                                <arg line="${{testng.debug.mode}}"/>
1122
                                <arg line="-d ${{build.test.results.dir}}"/>
1123
                                <arg line="-listener org.testng.reporters.VerboseReporter"/>
1124
                                <arg line="${{testng.cmd.args}}"/>
1125
                            </customize>
1126
                        </j2seproject3:debug>
1127
                    </sequential>
1128
                </macrodef>
1129
            </target>
1130
1131
            <target name="-init-macrodef-testng-debug-impl" depends="-init-macrodef-testng-debug" if="${{testng.available}}">
1132
                <macrodef>
1133
                    <xsl:attribute name="name">test-debug-impl</xsl:attribute>
1134
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1135
                    <attribute>
1136
                        <xsl:attribute name="name">testClass</xsl:attribute>
1137
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
1138
                    </attribute>
1139
                    <attribute>
1140
                        <xsl:attribute name="name">testMethod</xsl:attribute>
1141
                        <xsl:attribute name="default"></xsl:attribute>
1142
                    </attribute>
1143
                    <xsl:element name="element">
1144
                        <xsl:attribute name="name">customize2</xsl:attribute>
1145
                        <xsl:attribute name="optional">true</xsl:attribute>
1146
                        <xsl:attribute name="implicit">true</xsl:attribute>
1147
                    </xsl:element>
1148
                    <sequential>
1149
                        <j2seproject3:testng-debug testClass="@{{testClass}}" testMethod="@{{testMethod}}">
1150
                            <customize2/>
1151
                        </j2seproject3:testng-debug>
1152
                    </sequential>
1153
                </macrodef>
1154
            </target>
1155
1156
            <target name="-init-macrodef-test-debug" depends="-init-macrodef-junit-debug-impl,-init-macrodef-testng-debug-impl">
1157
                <macrodef>
1158
                    <xsl:attribute name="name">test-debug</xsl:attribute>
1159
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1160
                    <attribute>
1161
                        <xsl:attribute name="name">testClass</xsl:attribute>
1162
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
1163
                    </attribute>
1164
                    <attribute>
1165
                        <xsl:attribute name="name">testMethod</xsl:attribute>
1166
                        <xsl:attribute name="default"></xsl:attribute>
1167
                    </attribute>
1168
                    <sequential>
1169
                        <j2seproject3:test-debug-impl testClass="@{{testClass}}" testMethod="@{{testMethod}}">
1170
                            <customize2>
1171
                                <syspropertyset>
1172
                                    <propertyref prefix="test-sys-prop."/>
1173
                                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
1174
                                </syspropertyset>
1175
                            </customize2>
1176
                        </j2seproject3:test-debug-impl>
1177
                    </sequential>
1178
                </macrodef>
1179
            </target>
1180
720
            <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check"/>
1181
            <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check"/>
721
1182
722
            <target name="-profile-pre-init">
1183
            <target name="-profile-pre-init">
Lines 1012-1018 Link Here
1012
            </target>
1473
            </target>
1013
1474
1014
            <target name="init">
1475
            <target name="init">
1015
                <xsl:attribute name="depends">-pre-init,-init-private<xsl:if test="/p:project/p:configuration/libs:libraries/libs:definitions">,-init-libraries</xsl:if>,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-junit,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline</xsl:attribute>
1476
                <xsl:attribute name="depends">-pre-init,-init-private<xsl:if test="/p:project/p:configuration/libs:libraries/libs:definitions">,-init-libraries</xsl:if>,-init-user,-init-project,-do-init,-post-init,-init-check,-init-macrodef-property,-init-macrodef-javac,-init-macrodef-test,-init-macrodef-test-debug,-init-macrodef-nbjpda,-init-macrodef-debug,-init-macrodef-java,-init-presetdef-jar,-init-ap-cmdline</xsl:attribute>
1016
            </target>
1477
            </target>
1017
            
1478
            
1018
            <xsl:comment>
1479
            <xsl:comment>
Lines 1628-1634 Link Here
1628
            
2089
            
1629
            <xsl:comment>
2090
            <xsl:comment>
1630
                =========================
2091
                =========================
1631
                JUNIT COMPILATION SECTION
2092
                TEST COMPILATION SECTION
1632
                =========================
2093
                =========================
1633
            </xsl:comment>
2094
            </xsl:comment>
1634
            
2095
            
Lines 1736-1742 Link Here
1736
            
2197
            
1737
            <xsl:comment>
2198
            <xsl:comment>
1738
                =======================
2199
                =======================
1739
                JUNIT EXECUTION SECTION
2200
                TEST EXECUTION SECTION
1740
                =======================
2201
                =======================
1741
            </xsl:comment>
2202
            </xsl:comment>
1742
            
2203
            
Lines 1749-1755 Link Here
1749
            <target name="-do-test-run">
2210
            <target name="-do-test-run">
1750
                <xsl:attribute name="if">have.tests</xsl:attribute>
2211
                <xsl:attribute name="if">have.tests</xsl:attribute>
1751
                <xsl:attribute name="depends">init,compile-test,-pre-test-run</xsl:attribute>
2212
                <xsl:attribute name="depends">init,compile-test,-pre-test-run</xsl:attribute>
1752
                <j2seproject3:junit testincludes="**/*Test.java"/>
2213
                <j2seproject3:test testincludes="**/*Test.java"/>
1753
            </target>
2214
            </target>
1754
            
2215
            
1755
            <target name="-post-test-run">
2216
            <target name="-post-test-run">
Lines 1794-1800 Link Here
1794
                <xsl:attribute name="if">have.tests</xsl:attribute>
2255
                <xsl:attribute name="if">have.tests</xsl:attribute>
1795
                <xsl:attribute name="depends">init,compile-test-single,-pre-test-run-single</xsl:attribute>
2256
                <xsl:attribute name="depends">init,compile-test-single,-pre-test-run-single</xsl:attribute>
1796
                <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
2257
                <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
1797
                <j2seproject3:junit includes="${{test.includes}}" excludes=""/>
2258
                <j2seproject3:test includes="${{test.includes}}" excludes="" testincludes="${{test.includes}}" />
1798
            </target>
2259
            </target>
1799
            
2260
            
1800
            <target name="-post-test-run-single">
2261
            <target name="-post-test-run-single">
Lines 1808-1816 Link Here
1808
                <xsl:attribute name="description">Run single unit test.</xsl:attribute>
2269
                <xsl:attribute name="description">Run single unit test.</xsl:attribute>
1809
            </target>
2270
            </target>
1810
            
2271
            
2272
            <target name="-do-test-run-single-method">
2273
                <xsl:attribute name="if">have.tests</xsl:attribute>
2274
                <xsl:attribute name="depends">init,compile-test-single,-pre-test-run-single</xsl:attribute>
2275
                <fail unless="test.class">Must select some files in the IDE or set test.class</fail>
2276
                <fail unless="test.method">Must select some method in the IDE or set test.method</fail>
2277
                <j2seproject3:test includes="${{javac.includes}}" excludes="" testincludes="${{test.class}}" testmethods="${{test.method}}"/>
2278
            </target>
2279
            
2280
            <target name="-post-test-run-single-method">
2281
                <xsl:attribute name="if">have.tests</xsl:attribute>
2282
                <xsl:attribute name="depends">init,compile-test-single,-pre-test-run-single,-do-test-run-single-method</xsl:attribute>
2283
                <fail if="tests.failed" unless="ignore.failing.tests">Some tests failed; see details above.</fail>
2284
            </target>
2285
2286
            <target name="test-single-method">
2287
                <xsl:attribute name="depends">init,compile-test-single,-pre-test-run-single,-do-test-run-single-method,-post-test-run-single-method</xsl:attribute>
2288
                <xsl:attribute name="description">Run single unit test.</xsl:attribute>
2289
            </target>
2290
            
1811
            <xsl:comment>
2291
            <xsl:comment>
1812
                =======================
2292
                =======================
1813
                JUNIT DEBUGGING SECTION
2293
                TEST DEBUGGING SECTION
1814
                =======================
2294
                =======================
1815
            </xsl:comment>
2295
            </xsl:comment>
1816
            
2296
            
Lines 1818-1841 Link Here
1818
                <xsl:attribute name="if">have.tests</xsl:attribute>
2298
                <xsl:attribute name="if">have.tests</xsl:attribute>
1819
                <xsl:attribute name="depends">init,compile-test</xsl:attribute>
2299
                <xsl:attribute name="depends">init,compile-test</xsl:attribute>
1820
                <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
2300
                <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
1821
                <property name="test.report.file" location="${{build.test.results.dir}}/TEST-${{test.class}}.xml"/>
2301
                <j2seproject3:test-debug testClass="${{test.class}}"/>
1822
                <delete file="${{test.report.file}}"/>
1823
                <mkdir dir="${{build.test.results.dir}}"/>
1824
                <!--Ugly, puts ant and ant-junit to the test classpath, but there is probably no other solution how to run the XML formatter -->
1825
                <j2seproject3:debug classname="org.apache.tools.ant.taskdefs.optional.junit.JUnitTestRunner" classpath="${{ant.home}}/lib/ant.jar:${{ant.home}}/lib/ant-junit.jar:${{debug.test.classpath}}">
1826
                    <customize>                        
1827
                        <syspropertyset>
1828
                            <propertyref prefix="test-sys-prop."/>
1829
                            <mapper type="glob" from="test-sys-prop.*" to="*"/>
1830
                        </syspropertyset>                        
1831
                        <arg value="${{test.class}}"/>
1832
                        <arg value="showoutput=true"/>
1833
                        <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
1834
                        <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${{test.report.file}}"/>
1835
                    </customize>
1836
                </j2seproject3:debug>
1837
            </target>
2302
            </target>
1838
            
2303
            
2304
            <target name="-debug-start-debuggee-test-method">
2305
                <xsl:attribute name="if">have.tests</xsl:attribute>
2306
                <xsl:attribute name="depends">init,compile-test</xsl:attribute>
2307
                <fail unless="test.class">Must select one file in the IDE or set test.class</fail>
2308
                <j2seproject3:test-debug testClass="${{test.class}}" testMethod="${{test.method}}"/>
2309
            </target>
2310
1839
            <target name="-debug-start-debugger-test">
2311
            <target name="-debug-start-debugger-test">
1840
                <xsl:attribute name="if">netbeans.home+have.tests</xsl:attribute>
2312
                <xsl:attribute name="if">netbeans.home+have.tests</xsl:attribute>
1841
                <xsl:attribute name="depends">init,compile-test</xsl:attribute>
2313
                <xsl:attribute name="depends">init,compile-test</xsl:attribute>
Lines 1846-1851 Link Here
1846
                <xsl:attribute name="depends">init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test</xsl:attribute>
2318
                <xsl:attribute name="depends">init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test</xsl:attribute>
1847
            </target>
2319
            </target>
1848
            
2320
            
2321
            <target name="debug-test-method">
2322
                <xsl:attribute name="depends">init,compile-test-single,-debug-start-debugger-test,-debug-start-debuggee-test-method</xsl:attribute>
2323
            </target>
2324
            
1849
            <target name="-do-debug-fix-test">
2325
            <target name="-do-debug-fix-test">
1850
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
2326
                <xsl:attribute name="if">netbeans.home</xsl:attribute>
1851
                <xsl:attribute name="depends">init,-pre-debug-fix,compile-test-single</xsl:attribute>
2327
                <xsl:attribute name="depends">init,-pre-debug-fix,compile-test-single</xsl:attribute>
Lines 2070-2075 Link Here
2070
        <xsl:param name="includes" select="'${includes}'"/>
2546
        <xsl:param name="includes" select="'${includes}'"/>
2071
        <xsl:param name="includes2"/>
2547
        <xsl:param name="includes2"/>
2072
        <xsl:param name="excludes"/>
2548
        <xsl:param name="excludes"/>
2549
        <xsl:param name="condition"/>
2073
        <xsl:for-each select="$roots/j2seproject3:root">
2550
        <xsl:for-each select="$roots/j2seproject3:root">
2074
            <xsl:element name="fileset">
2551
            <xsl:element name="fileset">
2075
                <xsl:attribute name="dir"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
2552
                <xsl:attribute name="dir"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
Lines 2084-2089 Link Here
2084
                </xsl:choose>
2561
                </xsl:choose>
2085
                <xsl:if test="$includes2">
2562
                <xsl:if test="$includes2">
2086
                    <filename name="{$includes2}"/>
2563
                    <filename name="{$includes2}"/>
2564
                    <xsl:copy-of select="$condition"/>
2087
                </xsl:if>
2565
                </xsl:if>
2088
            </xsl:element>
2566
            </xsl:element>
2089
        </xsl:for-each>
2567
        </xsl:for-each>
(-)a/java.j2seproject/test/unit/src/org/netbeans/modules/java/j2seproject/BuildImplTest.java (-3 / +9 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
2
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
3
 *
3
 *
4
 * Copyright 1997-2010 Oracle and/or its affiliates. All rights reserved.
4
 * Copyright 1997-2012 Oracle and/or its affiliates. All rights reserved.
5
 *
5
 *
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
6
 * Oracle and Java are registered trademarks of Oracle and/or its affiliates.
7
 * Other names may be trademarks of their respective owners.
7
 * Other names may be trademarks of their respective owners.
Lines 90-95 Link Here
90
    }
90
    }
91
91
92
    private File junitJar;
92
    private File junitJar;
93
    private File testNGJar;
93
94
94
    @Override protected Level logLevel() {
95
    @Override protected Level logLevel() {
95
        return Level.FINE;
96
        return Level.FINE;
Lines 105-110 Link Here
105
        assertNotNull("must set test.junit.jar", junitJarProp);
106
        assertNotNull("must set test.junit.jar", junitJarProp);
106
        junitJar = new File(junitJarProp);
107
        junitJar = new File(junitJarProp);
107
        assertTrue("file " + junitJar + " exists", junitJar.isFile());
108
        assertTrue("file " + junitJar + " exists", junitJar.isFile());
109
        String tngJarProp = System.getProperty("test.testng.jar");
110
        assertNotNull("must set test.testng.jar", tngJarProp);
111
        testNGJar = new File(tngJarProp);
112
        assertTrue("file " + testNGJar + " exists", testNGJar.isFile());
108
        MockLookup.setLayersAndInstances(new IOP(), new IFL());
113
        MockLookup.setLayersAndInstances(new IOP(), new IFL());
109
    }
114
    }
110
115
Lines 156-162 Link Here
156
161
157
    private Properties getProperties() {
162
    private Properties getProperties() {
158
        Properties p = new Properties();
163
        Properties p = new Properties();
159
        p.setProperty("libs.junit.classpath", junitJar.getAbsolutePath());
164
        p.setProperty("libs.junit.classpath", testNGJar.getAbsolutePath()  + ":" + junitJar.getAbsolutePath());
160
        return p;
165
        return p;
161
    }
166
    }
162
167
Lines 613-619 Link Here
613
        p.setProperty("javac.includes", "pkg/SomeTest.java");
618
        p.setProperty("javac.includes", "pkg/SomeTest.java");
614
        p.setProperty("test.includes", "pkg/SomeTest.java");
619
        p.setProperty("test.includes", "pkg/SomeTest.java");
615
        assertBuildSuccess(ActionUtils.runTarget(buildXml, new String[] {"test-single"}, p));
620
        assertBuildSuccess(ActionUtils.runTarget(buildXml, new String[] {"test-single"}, p));
616
        assertOutput("Testsuite: pkg.SomeTest");
621
        assertTrue("wrong default suite name", output.contains("testRunSingleTestWithDep"));
622
        assertTrue("wrong tests executed", output.contains("Total tests run: 1, Failures: 0, Skips: 0"));
617
    }
623
    }
618
624
619
    public void testSubprojects() throws Exception {
625
    public void testSubprojects() throws Exception {

Return to bug 208873