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}/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 / +529 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
                        <isset property="junit.available"/>
367
                        <isset property="testng.available"/>
368
                    </and>
369
                </condition>
370
                <condition property="testng.mode" value="mixed" else="testng">
371
                    <and>
372
                        <isset property="junit+testng.available"/>
373
                        <isset property="use.testng"/>
374
                        <istrue value="${{use.testng}}"/>
375
                    </and>
376
                </condition>
377
                <condition property="testng.debug.mode" value="-mixed" else="">
378
                    <and>
379
                        <isset property="junit+testng.available"/>
380
                        <isset property="use.testng"/>
381
                        <istrue value="${{use.testng}}"/>
382
                    </and>
383
                </condition>
384
                <condition property="native.testing">
385
                    <and>
386
                        <isset property="junit+testng.available"/>
387
                        <or>
388
                            <not>
389
                                <isset property="use.testng"/>
390
                            </not>
391
                            <isfalse value="${{use.testng}}"/>
392
                        </or>
393
                    </and>
394
                </condition>
355
            </target>
395
            </target>
356
396
357
            <target name="-post-init">
397
            <target name="-post-init">
Lines 663-669 Link Here
663
                </macrodef>
703
                </macrodef>
664
            </target>
704
            </target>
665
            
705
            
666
            <target name="-init-macrodef-junit">
706
            <target name="-init-macrodef-junit" if="junit.available">
667
                <macrodef>
707
                <macrodef>
668
                    <xsl:attribute name="name">junit</xsl:attribute>
708
                    <xsl:attribute name="name">junit</xsl:attribute>
669
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
709
                    <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>
719
                        <xsl:attribute name="name">testincludes</xsl:attribute>
680
                        <xsl:attribute name="default">**</xsl:attribute>
720
                        <xsl:attribute name="default">**</xsl:attribute>
681
                    </attribute>
721
                    </attribute>
722
                    <attribute>
723
                        <xsl:attribute name="name">testmethods</xsl:attribute>
724
                        <xsl:attribute name="default"></xsl:attribute>
725
                    </attribute>
726
                    <element>
727
                        <xsl:attribute name="name">customize</xsl:attribute>
728
                        <xsl:attribute name="optional">true</xsl:attribute>
729
                    </element>
682
                    <sequential>
730
                    <sequential>
683
                        <property name="junit.forkmode" value="perTest"/>
731
                        <property name="junit.forkmode" value="perTest"/>
684
                        <junit>
732
                        <junit>
Lines 700-722 Link Here
700
                                    <xsl:with-param name="excludes">@{excludes}</xsl:with-param>
748
                                    <xsl:with-param name="excludes">@{excludes}</xsl:with-param>
701
                                </xsl:call-template>
749
                                </xsl:call-template>
702
                            </batchtest>
750
                            </batchtest>
703
                            <classpath>
704
                                <path path="${{run.test.classpath}}"/>
705
                            </classpath>
706
                            <syspropertyset>
751
                            <syspropertyset>
707
                                <propertyref prefix="test-sys-prop."/>
752
                                <propertyref prefix="test-sys-prop."/>
708
                                <mapper type="glob" from="test-sys-prop.*" to="*"/>
753
                                <mapper type="glob" from="test-sys-prop.*" to="*"/>
709
                            </syspropertyset>
754
                            </syspropertyset>
710
                            <formatter type="brief" usefile="false"/>
755
                            <formatter type="brief" usefile="false"/>
711
                            <formatter type="xml"/>
756
                            <formatter type="xml"/>
712
                            <jvmarg line="${{endorsed.classpath.cmd.line.arg}}"/>
713
                            <jvmarg value="-ea"/>
757
                            <jvmarg value="-ea"/>
714
                            <jvmarg line="${{run.jvmargs}}"/>
758
                            <customize/>
715
                        </junit>
759
                        </junit>
716
                    </sequential>
760
                    </sequential>
717
                </macrodef>
761
                </macrodef>
718
            </target>
762
            </target>
719
763
764
            <target name="-init-macrodef-testng" if="testng.available">
765
                <macrodef>
766
                    <xsl:attribute name="name">testng</xsl:attribute>
767
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
768
                    <attribute>
769
                        <xsl:attribute name="name">includes</xsl:attribute>
770
                        <xsl:attribute name="default">${includes}</xsl:attribute>
771
                    </attribute>
772
                    <attribute>
773
                        <xsl:attribute name="name">excludes</xsl:attribute>
774
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
775
                    </attribute>
776
                    <attribute>
777
                        <xsl:attribute name="name">testincludes</xsl:attribute>
778
                        <xsl:attribute name="default">**</xsl:attribute>
779
                    </attribute>
780
                    <attribute>
781
                        <xsl:attribute name="name">testmethods</xsl:attribute>
782
                        <xsl:attribute name="default"></xsl:attribute>
783
                    </attribute>
784
                    <element>
785
                        <xsl:attribute name="name">customize</xsl:attribute>
786
                        <xsl:attribute name="optional">true</xsl:attribute>
787
                    </element>
788
                    <sequential>
789
                        <pathconvert pathsep="${{line.separator}}" property="testng.testincludes">
790
                            <path>
791
                                <filelist dir="${{build.test.classes.dir}}" files="@{{testincludes}}"/>
792
                            </path>
793
                            <chainedmapper>
794
                                <globmapper from="*.java" to="*.class"/>
795
                                <globmapper from="${{basedir}}/${{build.test.classes.dir}}/*" to="*"/>                    
796
                            </chainedmapper>
797
                        </pathconvert>
798
                        <pathconvert pathsep="${{line.separator}}" property="testng.excludes">
799
                            <path>
800
                                <filelist dir="${{build.test.classes.dir}}" files="@{{excludes}}"/>
801
                                <filelist dir="${{build.test.classes.dir}}" files="${{excludes}}"/>
802
                            </path>
803
                            <chainedmapper>
804
                                <globmapper from="*.java" to="*.class"/>
805
                                <globmapper from="${{basedir}}/${{build.test.classes.dir}}/*" to="*"/>
806
                            </chainedmapper>
807
                        </pathconvert>
808
                        <pathconvert pathsep="${{line.separator}}" property="testng.includes">
809
                            <path>
810
                                <filelist dir="${{build.test.classes.dir}}" files="@{{includes}}"/>
811
                            </path>
812
                            <chainedmapper>
813
                                <globmapper from="*.java" to="*.class"/>
814
                                <globmapper from="${{basedir}}/${{build.test.classes.dir}}/*" to="*"/>
815
                            </chainedmapper>
816
                        </pathconvert>
817
818
                        <taskdef name="testng" classname="org.testng.TestNGAntTask" classpath="${{run.test.classpath}}"/>
819
                        <testng>
820
                            <xsl:attribute name="mode">${testng.mode}</xsl:attribute>
821
                            <xsl:attribute name="enableAssert">true</xsl:attribute>
822
                            <xsl:attribute name="workingDir">${work.dir}</xsl:attribute> <!-- #47474: match <java> --> 
823
                            <xsl:attribute name="failureProperty">tests.failed</xsl:attribute>
824
                            <xsl:attribute name="methods">@{testmethods}</xsl:attribute>
825
                            <xsl:attribute name="outputdir">${build.test.results.dir}</xsl:attribute>
826
                            <xsl:attribute name="suitename"><xsl:value-of select="$codename"/></xsl:attribute>
827
                            <xsl:attribute name="testname">TestNG tests</xsl:attribute>
828
                            <xsl:if test="/p:project/p:configuration/j2seproject3:data/j2seproject3:explicit-platform">
829
                                <xsl:attribute name="jvm">${platform.java}</xsl:attribute>
830
                            </xsl:if>
831
                            <classfileset dir="${{build.test.classes.dir}}" excludes="${{testng.excludes}}" includes="${{testng.includes}}">
832
                                <filename name="${{testng.testincludes}}"/>
833
                            </classfileset>
834
                            <propertyset>
835
                                <propertyref prefix="test-sys-prop."/>
836
                                <mapper from="test-sys-prop.*" to="*" type="glob"/>
837
                            </propertyset>
838
                            <customize/>
839
                        </testng>
840
                    </sequential>
841
                </macrodef>
842
            </target>
843
844
            <target name="-init-macrodef-junit-impl" depends="-init-macrodef-junit" unless="native.testing">
845
                <macrodef>
846
                    <xsl:attribute name="name">test-impl</xsl:attribute>
847
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
848
                    <attribute>
849
                        <xsl:attribute name="name">includes</xsl:attribute>
850
                        <xsl:attribute name="default">${includes}</xsl:attribute>
851
                    </attribute>
852
                    <attribute>
853
                        <xsl:attribute name="name">excludes</xsl:attribute>
854
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
855
                    </attribute>
856
                    <attribute>
857
                        <xsl:attribute name="name">testincludes</xsl:attribute>
858
                        <xsl:attribute name="default">**</xsl:attribute>
859
                    </attribute>
860
                    <attribute>
861
                        <xsl:attribute name="name">testmethods</xsl:attribute>
862
                        <xsl:attribute name="default"></xsl:attribute>
863
                    </attribute>
864
                    <element>
865
                        <xsl:attribute name="name">customize</xsl:attribute>
866
                        <xsl:attribute name="optional">true</xsl:attribute>
867
                        <xsl:attribute name="implicit">true</xsl:attribute>
868
                    </element>
869
                    <sequential>
870
                        <j2seproject3:junit includes="@{{includes}}" excludes="@{{excludes}}" testincludes="@{{testincludes}}" testmethods="@{{testmethods}}">
871
                            <customize/>
872
                        </j2seproject3:junit>
873
                    </sequential>
874
                </macrodef>
875
            </target>
876
            
877
            <target name="-init-macrodef-testng-impl" depends="-init-macrodef-testng" if="testng.available" unless="native.testing">
878
                <macrodef>
879
                    <xsl:attribute name="name">test-impl</xsl:attribute>
880
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
881
                    <attribute>
882
                        <xsl:attribute name="name">includes</xsl:attribute>
883
                        <xsl:attribute name="default">${includes}</xsl:attribute>
884
                    </attribute>
885
                    <attribute>
886
                        <xsl:attribute name="name">excludes</xsl:attribute>
887
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
888
                    </attribute>
889
                    <attribute>
890
                        <xsl:attribute name="name">testincludes</xsl:attribute>
891
                        <xsl:attribute name="default">**</xsl:attribute>
892
                    </attribute>
893
                    <attribute>
894
                        <xsl:attribute name="name">testmethods</xsl:attribute>
895
                        <xsl:attribute name="default"></xsl:attribute>
896
                    </attribute>
897
                    <element>
898
                        <xsl:attribute name="name">customize</xsl:attribute>
899
                        <xsl:attribute name="optional">true</xsl:attribute>
900
                        <xsl:attribute name="implicit">true</xsl:attribute>
901
                    </element>
902
                    <sequential>
903
                        <j2seproject3:testng includes="@{{includes}}" excludes="@{{excludes}}" testincludes="@{{testincludes}}" testmethods="@{{testmethods}}">
904
                            <customize/>
905
                        </j2seproject3:testng>
906
                    </sequential>
907
                </macrodef>
908
            </target>
909
                        
910
            <target name="-init-macrodef-test-nativeimpl" depends="-init-macrodef-junit,-init-macrodef-testng" if="native.testing">
911
                <macrodef>
912
                    <xsl:attribute name="name">test-impl</xsl:attribute>
913
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
914
                    <attribute>
915
                        <xsl:attribute name="name">includes</xsl:attribute>
916
                        <xsl:attribute name="default">${includes}</xsl:attribute>
917
                    </attribute>
918
                    <attribute>
919
                        <xsl:attribute name="name">excludes</xsl:attribute>
920
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
921
                    </attribute>
922
                    <attribute>
923
                        <xsl:attribute name="name">testincludes</xsl:attribute>
924
                        <xsl:attribute name="default">**</xsl:attribute>
925
                    </attribute>
926
                    <attribute>
927
                        <xsl:attribute name="name">testmethods</xsl:attribute>
928
                        <xsl:attribute name="default"></xsl:attribute>
929
                    </attribute>
930
                    <element>
931
                        <xsl:attribute name="name">customize</xsl:attribute>
932
                        <xsl:attribute name="optional">true</xsl:attribute>
933
                        <xsl:attribute name="implicit">true</xsl:attribute>
934
                    </element>
935
                    <sequential>
936
                        <union id="testng.testset">
937
                            <xsl:call-template name="createFilesets">
938
                                <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
939
                                <xsl:with-param name="includes">@{includes}</xsl:with-param>
940
                                <xsl:with-param name="includes2">@{testincludes}</xsl:with-param>
941
                                <xsl:with-param name="excludes">@{excludes}</xsl:with-param>
942
                                <xsl:with-param name="condition">
943
                                    <xsl:element name="contains">
944
                                        <xsl:attribute name="text">
945
                                            <xsl:text>org.testng.annotations.</xsl:text>
946
                                        </xsl:attribute>
947
                                    </xsl:element>
948
                                </xsl:with-param>
949
                            </xsl:call-template>
950
                        </union>
951
952
                        <union id="junit.testset">
953
                            <xsl:call-template name="createFilesets">
954
                                <xsl:with-param name="roots" select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots"/>
955
                                <xsl:with-param name="includes">@{includes}</xsl:with-param>
956
                                <xsl:with-param name="includes2">@{testincludes}</xsl:with-param>
957
                                <xsl:with-param name="excludes">@{excludes}</xsl:with-param>
958
                                <xsl:with-param name="condition">
959
                                    <xsl:element name="not">
960
                                        <xsl:element name="contains">
961
                                            <xsl:attribute name="text">
962
                                                <xsl:text>org.testng.annotations.</xsl:text>
963
                                            </xsl:attribute>
964
                                        </xsl:element>
965
                                    </xsl:element>
966
                                </xsl:with-param>
967
                            </xsl:call-template>
968
                        </union>
969
970
                        <pathconvert pathsep="," property="testng.tests" refid="testng.testset">
971
                            <xsl:for-each select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots">
972
                                <xsl:choose>
973
                                    <xsl:when test="count(j2seproject3:root) > 1">
974
                                        <compositemapper>
975
                                            <xsl:for-each select="j2seproject3:root">
976
                                                <xsl:element name="globmapper">
977
                                                    <xsl:attribute name="from">
978
                                                        <xsl:text>${basedir}/${</xsl:text>
979
                                                        <xsl:value-of select="@id"/>
980
                                                        <xsl:text>}/*</xsl:text>
981
                                                    </xsl:attribute>
982
                                                    <xsl:attribute name="to">
983
                                                        <xsl:text>*</xsl:text>
984
                                                    </xsl:attribute>
985
                                                </xsl:element>
986
                                            </xsl:for-each>
987
                                        </compositemapper>
988
                                    </xsl:when>
989
                                    <xsl:otherwise>
990
                                        <xsl:element name="globmapper">
991
                                            <xsl:attribute name="from">
992
                                                <xsl:text>${basedir}/${</xsl:text>
993
                                                <xsl:value-of select="j2seproject3:root/@id"/>
994
                                                <xsl:text>}/*</xsl:text>
995
                                            </xsl:attribute>
996
                                            <xsl:attribute name="to">
997
                                                <xsl:text>*</xsl:text>
998
                                            </xsl:attribute>
999
                                        </xsl:element>
1000
                                    </xsl:otherwise>
1001
                                </xsl:choose>
1002
                            </xsl:for-each>
1003
                        </pathconvert>
1004
                        <pathconvert pathsep="," property="junit.tests" refid="junit.testset">
1005
                            <xsl:for-each select="/p:project/p:configuration/j2seproject3:data/j2seproject3:test-roots">
1006
                                <xsl:choose>
1007
                                    <xsl:when test="count(j2seproject3:root) > 1">
1008
                                        <compositemapper>
1009
                                            <xsl:for-each select="j2seproject3:root">
1010
                                                <xsl:element name="globmapper">
1011
                                                    <xsl:attribute name="from">
1012
                                                        <xsl:text>${basedir}/${</xsl:text>
1013
                                                        <xsl:value-of select="@id"/>
1014
                                                        <xsl:text>}/*</xsl:text>
1015
                                                    </xsl:attribute>
1016
                                                    <xsl:attribute name="to">
1017
                                                        <xsl:text>*</xsl:text>
1018
                                                    </xsl:attribute>
1019
                                                </xsl:element>
1020
                                            </xsl:for-each>
1021
                                        </compositemapper>
1022
                                    </xsl:when>
1023
                                    <xsl:otherwise>
1024
                                        <xsl:element name="globmapper">
1025
                                            <xsl:attribute name="from">
1026
                                                <xsl:text>${basedir}/${</xsl:text>
1027
                                                <xsl:value-of select="j2seproject3:root/@id"/>
1028
                                                <xsl:text>}/*</xsl:text>
1029
                                            </xsl:attribute>
1030
                                            <xsl:attribute name="to">
1031
                                                <xsl:text>*</xsl:text>
1032
                                            </xsl:attribute>
1033
                                        </xsl:element>
1034
                                    </xsl:otherwise>
1035
                                </xsl:choose>
1036
                            </xsl:for-each>
1037
                        </pathconvert>
1038
1039
                        <j2seproject3:junit includes="@{{includes}}" excludes="@{{excludes}},${{testng.tests}}" testincludes="@{{testincludes}}" testmethods="@{{testmethods}}">
1040
                            <customize/>
1041
                        </j2seproject3:junit>
1042
                        <j2seproject3:testng includes="@{{includes}}" excludes="@{{excludes}},${{junit.tests}}" testincludes="@{{testincludes}}" testmethods="@{{testmethods}}">
1043
                            <customize/>
1044
                        </j2seproject3:testng>
1045
                    </sequential>
1046
                </macrodef>
1047
            </target>
1048
                        
1049
            <target name="-init-macrodef-test" depends="-init-macrodef-junit-impl,-init-macrodef-testng-impl,-init-macrodef-test-nativeimpl">
1050
                <macrodef>
1051
                    <xsl:attribute name="name">test</xsl:attribute>
1052
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1053
                    <attribute>
1054
                        <xsl:attribute name="name">includes</xsl:attribute>
1055
                        <xsl:attribute name="default">${includes}</xsl:attribute>
1056
                    </attribute>
1057
                    <attribute>
1058
                        <xsl:attribute name="name">excludes</xsl:attribute>
1059
                        <xsl:attribute name="default">${excludes}</xsl:attribute>
1060
                    </attribute>
1061
                    <attribute>
1062
                        <xsl:attribute name="name">testincludes</xsl:attribute>
1063
                        <xsl:attribute name="default">**</xsl:attribute>
1064
                    </attribute>
1065
                    <attribute>
1066
                        <xsl:attribute name="name">testmethods</xsl:attribute>
1067
                        <xsl:attribute name="default"></xsl:attribute>
1068
                    </attribute>
1069
                    <sequential>
1070
                        <j2seproject3:test-impl includes="@{{includes}}" excludes="@{{excludes}}" testincludes="@{{testincludes}}" testmethods="@{{testmethods}}">
1071
                            <customize>
1072
                                <classpath>
1073
                                    <path path="${{run.test.classpath}}"/>
1074
                                </classpath>
1075
                                <jvmarg line="${{endorsed.classpath.cmd.line.arg}}"/>
1076
                                <jvmarg line="${{run.jvmargs}}"/>
1077
                            </customize>
1078
                        </j2seproject3:test-impl>
1079
                    </sequential>
1080
                </macrodef>
1081
            </target>
1082
1083
            <target name="-init-macrodef-junit-debug" if="junit.available">
1084
                <macrodef>
1085
                    <xsl:attribute name="name">junit-debug</xsl:attribute>
1086
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1087
                    <attribute>
1088
                        <xsl:attribute name="name">testClass</xsl:attribute>
1089
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
1090
                    </attribute>
1091
                    <attribute>
1092
                        <xsl:attribute name="name">testMethod</xsl:attribute>
1093
                        <xsl:attribute name="default"></xsl:attribute>
1094
                    </attribute>
1095
                    <xsl:element name="element">
1096
                        <xsl:attribute name="name">customize2</xsl:attribute>
1097
                        <xsl:attribute name="optional">true</xsl:attribute>
1098
                    </xsl:element>
1099
                    <sequential>
1100
                        <property name="test.report.file" location="${{build.test.results.dir}}/TEST-@{{testClass}}.xml"/>
1101
                        <delete file="${{test.report.file}}"/>
1102
                        <mkdir dir="${{build.test.results.dir}}"/>
1103
                        <!--Ugly, puts ant and ant-junit to the test classpath, but there is probably no other solution how to run the XML formatter -->
1104
                        <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}}">
1105
                            <customize>
1106
                                <arg value="@{{testClass}}"/>
1107
                                <arg value="showoutput=true"/>
1108
                                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.BriefJUnitResultFormatter"/>
1109
                                <arg value="formatter=org.apache.tools.ant.taskdefs.optional.junit.XMLJUnitResultFormatter,${{test.report.file}}"/>
1110
                                <customize2/>
1111
                            </customize>
1112
                        </j2seproject3:debug>
1113
                    </sequential>
1114
                </macrodef>
1115
            </target>
1116
1117
            <target name="-init-macrodef-junit-debug-impl" depends="-init-macrodef-junit-debug" if="junit.available">
1118
                <macrodef>
1119
                    <xsl:attribute name="name">test-debug-impl</xsl:attribute>
1120
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1121
                    <attribute>
1122
                        <xsl:attribute name="name">testClass</xsl:attribute>
1123
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
1124
                    </attribute>
1125
                    <attribute>
1126
                        <xsl:attribute name="name">testMethod</xsl:attribute>
1127
                        <xsl:attribute name="default"></xsl:attribute>
1128
                    </attribute>
1129
                    <xsl:element name="element">
1130
                        <xsl:attribute name="name">customize2</xsl:attribute>
1131
                        <xsl:attribute name="optional">true</xsl:attribute>
1132
                        <xsl:attribute name="implicit">true</xsl:attribute>
1133
                    </xsl:element>
1134
                    <sequential>
1135
                        <j2seproject3:junit-debug testClass="@{{testClass}}" testMethod="@{{testMethod}}">
1136
                            <customize2/>
1137
                        </j2seproject3:junit-debug>
1138
                    </sequential>
1139
                </macrodef>
1140
            </target>
1141
1142
            <target name="-init-macrodef-testng-debug" if="testng.available">
1143
                <macrodef>
1144
                    <xsl:attribute name="name">testng-debug</xsl:attribute>
1145
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1146
                    <attribute>
1147
                        <xsl:attribute name="name">testClass</xsl:attribute>
1148
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
1149
                    </attribute>
1150
                    <attribute>
1151
                        <xsl:attribute name="name">testMethod</xsl:attribute>
1152
                        <xsl:attribute name="default"></xsl:attribute>
1153
                    </attribute>
1154
                    <xsl:element name="element">
1155
                        <xsl:attribute name="name">customize2</xsl:attribute>
1156
                        <xsl:attribute name="optional">true</xsl:attribute>
1157
                    </xsl:element>
1158
                    <sequential>
1159
                        <condition property="test.class.or.method" value="-methods @{{testClass}}.@{{testMethod}}" else="-testclass @{{testClass}}">
1160
                            <isset property="@{{testMethod}}"/>
1161
                        </condition>
1162
                        <delete dir="${{build.test.results.dir}}" quiet="true"/>
1163
                        <mkdir dir="${{build.test.results.dir}}"/>
1164
                        <j2seproject3:debug classname="org.testng.TestNG" classpath="${{debug.test.classpath}}">
1165
                            <customize>
1166
                                <customize2/>
1167
                                <jvmarg value="-ea"/>
1168
                                <arg line="${{testng.debug.mode}}"/>
1169
                                <arg line="-d ${{build.test.results.dir}}"/>
1170
                                <arg line="-listener org.testng.reporters.VerboseReporter"/>
1171
                                <arg line="-suitename {$codename}"/>
1172
                                <arg line="-testname @{{testClass}}"/>
1173
                                <arg line="${{test.class.or.method}}"/>
1174
                            </customize>
1175
                        </j2seproject3:debug>
1176
                    </sequential>
1177
                </macrodef>
1178
            </target>
1179
1180
            <target name="-init-macrodef-testng-debug-impl" depends="-init-macrodef-testng-debug" if="testng.available">
1181
                <macrodef>
1182
                    <xsl:attribute name="name">test-debug-impl</xsl:attribute>
1183
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1184
                    <attribute>
1185
                        <xsl:attribute name="name">testClass</xsl:attribute>
1186
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
1187
                    </attribute>
1188
                    <attribute>
1189
                        <xsl:attribute name="name">testMethod</xsl:attribute>
1190
                        <xsl:attribute name="default"></xsl:attribute>
1191
                    </attribute>
1192
                    <xsl:element name="element">
1193
                        <xsl:attribute name="name">customize2</xsl:attribute>
1194
                        <xsl:attribute name="optional">true</xsl:attribute>
1195
                        <xsl:attribute name="implicit">true</xsl:attribute>
1196
                    </xsl:element>
1197
                    <sequential>
1198
                        <j2seproject3:testng-debug testClass="@{{testClass}}" testMethod="@{{testMethod}}">
1199
                            <customize2/>
1200
                        </j2seproject3:testng-debug>
1201
                    </sequential>
1202
                </macrodef>
1203
            </target>
1204
1205
            <target name="-init-macrodef-test-debug" depends="-init-macrodef-junit-debug-impl,-init-macrodef-testng-debug-impl">
1206
                <macrodef>
1207
                    <xsl:attribute name="name">test-debug</xsl:attribute>
1208
                    <xsl:attribute name="uri">http://www.netbeans.org/ns/j2se-project/3</xsl:attribute>
1209
                    <attribute>
1210
                        <xsl:attribute name="name">testClass</xsl:attribute>
1211
                        <xsl:attribute name="default">${main.class}</xsl:attribute>
1212
                    </attribute>
1213
                    <attribute>
1214
                        <xsl:attribute name="name">testMethod</xsl:attribute>
1215
                        <xsl:attribute name="default"></xsl:attribute>
1216
                    </attribute>
1217
                    <sequential>
1218
                        <j2seproject3:test-debug-impl testClass="@{{testClass}}" testMethod="@{{testMethod}}">
1219
                            <customize2>
1220
                                <syspropertyset>
1221
                                    <propertyref prefix="test-sys-prop."/>
1222
                                    <mapper from="test-sys-prop.*" to="*" type="glob"/>
1223
                                </syspropertyset>
1224
                            </customize2>
1225
                        </j2seproject3:test-debug-impl>
1226
                    </sequential>
1227
                </macrodef>
1228
            </target>
1229
720
            <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check"/>
1230
            <target name="profile-init" depends="-profile-pre-init, init, -profile-post-init, -profile-init-macrodef-profile, -profile-init-check"/>
721
1231
722
            <target name="-profile-pre-init">
1232
            <target name="-profile-pre-init">
Lines 1012-1018 Link Here
1012
            </target>
1522
            </target>
1013
1523
1014
            <target name="init">
1524
            <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>
1525
                <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>
1526
            </target>
1017
            
1527
            
1018
            <xsl:comment>
1528
            <xsl:comment>
Lines 1628-1634 Link Here
1628
            
2138
            
1629
            <xsl:comment>
2139
            <xsl:comment>
1630
                =========================
2140
                =========================
1631
                JUNIT COMPILATION SECTION
2141
                TEST COMPILATION SECTION
1632
                =========================
2142
                =========================
1633
            </xsl:comment>
2143
            </xsl:comment>
1634
            
2144
            
Lines 1736-1742 Link Here
1736
            
2246
            
1737
            <xsl:comment>
2247
            <xsl:comment>
1738
                =======================
2248
                =======================
1739
                JUNIT EXECUTION SECTION
2249
                TEST EXECUTION SECTION
1740
                =======================
2250
                =======================
1741
            </xsl:comment>
2251
            </xsl:comment>
1742
            
2252
            
Lines 1749-1755 Link Here
1749
            <target name="-do-test-run">
2259
            <target name="-do-test-run">
1750
                <xsl:attribute name="if">have.tests</xsl:attribute>
2260
                <xsl:attribute name="if">have.tests</xsl:attribute>
1751
                <xsl:attribute name="depends">init,compile-test,-pre-test-run</xsl:attribute>
2261
                <xsl:attribute name="depends">init,compile-test,-pre-test-run</xsl:attribute>
1752
                <j2seproject3:junit testincludes="**/*Test.java"/>
2262
                <j2seproject3:test testincludes="**/*Test.java"/>
1753
            </target>
2263
            </target>
1754
            
2264
            
1755
            <target name="-post-test-run">
2265
            <target name="-post-test-run">
Lines 1794-1800 Link Here
1794
                <xsl:attribute name="if">have.tests</xsl:attribute>
2304
                <xsl:attribute name="if">have.tests</xsl:attribute>
1795
                <xsl:attribute name="depends">init,compile-test-single,-pre-test-run-single</xsl:attribute>
2305
                <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>
2306
                <fail unless="test.includes">Must select some files in the IDE or set test.includes</fail>
1797
                <j2seproject3:junit includes="${{test.includes}}" excludes=""/>
2307
                <j2seproject3:test includes="${{test.includes}}" excludes="" testincludes="${{test.includes}}" />
1798
            </target>
2308
            </target>
1799
            
2309
            
1800
            <target name="-post-test-run-single">
2310
            <target name="-post-test-run-single">
Lines 1810-1816 Link Here
1810
            
2320
            
1811
            <xsl:comment>
2321
            <xsl:comment>
1812
                =======================
2322
                =======================
1813
                JUNIT DEBUGGING SECTION
2323
                TEST DEBUGGING SECTION
1814
                =======================
2324
                =======================
1815
            </xsl:comment>
2325
            </xsl:comment>
1816
            
2326
            
Lines 1818-1839 Link Here
1818
                <xsl:attribute name="if">have.tests</xsl:attribute>
2328
                <xsl:attribute name="if">have.tests</xsl:attribute>
1819
                <xsl:attribute name="depends">init,compile-test</xsl:attribute>
2329
                <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>
2330
                <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"/>
2331
                <j2seproject3:test-debug testClass="${{test.class}}" testMethod="${{methodname}}"/>
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>
2332
            </target>
1838
            
2333
            
1839
            <target name="-debug-start-debugger-test">
2334
            <target name="-debug-start-debugger-test">
Lines 2070-2075 Link Here
2070
        <xsl:param name="includes" select="'${includes}'"/>
2565
        <xsl:param name="includes" select="'${includes}'"/>
2071
        <xsl:param name="includes2"/>
2566
        <xsl:param name="includes2"/>
2072
        <xsl:param name="excludes"/>
2567
        <xsl:param name="excludes"/>
2568
        <xsl:param name="condition"/>
2073
        <xsl:for-each select="$roots/j2seproject3:root">
2569
        <xsl:for-each select="$roots/j2seproject3:root">
2074
            <xsl:element name="fileset">
2570
            <xsl:element name="fileset">
2075
                <xsl:attribute name="dir"><xsl:text>${</xsl:text><xsl:value-of select="@id"/><xsl:text>}</xsl:text></xsl:attribute>
2571
                <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>
2580
                </xsl:choose>
2085
                <xsl:if test="$includes2">
2581
                <xsl:if test="$includes2">
2086
                    <filename name="{$includes2}"/>
2582
                    <filename name="{$includes2}"/>
2583
                    <xsl:copy-of select="$condition"/>
2087
                </xsl:if>
2584
                </xsl:if>
2088
            </xsl:element>
2585
            </xsl:element>
2089
        </xsl:for-each>
2586
        </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