diff -Nru jtharness-6.0-b15/build/build.properties jtharness-6.0-b22/build/build.properties --- jtharness-6.0-b15/build/build.properties 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/build/build.properties 2022-03-27 19:40:32.000000000 +0000 @@ -27,7 +27,7 @@ build.version = 6.0 build.milestone = ea -build.number = b15 +build.number = b22 build.classes = ${BUILD_DIR}/classes build.unit-tests = ${BUILD_DIR}/unit-tests @@ -57,7 +57,7 @@ javadoc.use = true javadoc.version = false javadoc.windowtitle = JT Harness Version 6.0 -javadoc.footer = Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. +javadoc.footer = Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. run.class = com.sun.javatest.tool.Main jdk14.classpath = ${servletjar} diff -Nru jtharness-6.0-b15/build/build.xml jtharness-6.0-b22/build/build.xml --- jtharness-6.0-b15/build/build.xml 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/build/build.xml 2022-03-27 19:40:32.000000000 +0000 @@ -23,7 +23,10 @@ or visit www.oracle.com if you need additional information or have any questions. --> - + @@ -61,18 +64,24 @@ + + + + + # Build info - date=${build.date} - version=${build.version} - milestone=${build.milestone} - build=${build.number} - java=${jdk.builder.version} - bundle-type=Classpath Loader - harness-variety=Full Bundle - +date=${build.date} +version=${build.version} +milestone=${build.milestone} +build=${build.number} +commit=${BUILT_FROM_COMMIT} +java=${jdk.builder.version} +bundle-type=Classpath Loader +harness-variety=Full Bundle + @@ -262,10 +271,10 @@ - + 'git' command not found on the system path, unable to identify latest commit ID JTHARNESS_VERSION=${build.version} ${build.number}${line.separator} @@ -350,18 +359,27 @@ - + + destdir="${build.unit-tests}"> + + + + + + + + + + - + + @@ -412,13 +431,15 @@ + - + @@ -538,7 +559,7 @@ - + jdk.builder.home: ${jdk.builder.home} @@ -546,9 +567,9 @@ - + @@ -562,6 +583,14 @@ + + + + + + + + diff -Nru jtharness-6.0-b15/build/ivy.xml jtharness-6.0-b22/build/ivy.xml --- jtharness-6.0-b15/build/ivy.xml 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/build/ivy.xml 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,31 @@ + + + + + + + + diff -Nru jtharness-6.0-b15/build/local.properties jtharness-6.0-b22/build/local.properties --- jtharness-6.0-b15/build/local.properties 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/build/local.properties 2022-03-27 19:40:32.000000000 +0000 @@ -38,6 +38,14 @@ # JUnit Library - Version 4 currently used to compile 3 and 4 support junitlib = junit.jar +# Jemmy Library - used only for UI testing +jemmylib = jemmy.jar + +# [Reg Tests] Path to Ivy Dependency Manager single jar - needed by regression tests +# (this boot jar could be downloaded for example from https://repo1.maven.org/maven2/org/apache/ivy/ivy/2.5.0/ivy-2.5.0.jar ) +# Ivy is needed to manage dependencies of regression tests - JUnit, Mockito etc. +ivylib = ivy.jar + # Please specify location where the build distribution (output) will be created BUILD_DIR = ../JTHarness-build diff -Nru jtharness-6.0-b15/debian/changelog jtharness-6.0-b22/debian/changelog --- jtharness-6.0-b15/debian/changelog 2021-11-04 17:10:44.000000000 +0000 +++ jtharness-6.0-b22/debian/changelog 2022-10-25 10:32:36.000000000 +0000 @@ -1,8 +1,23 @@ -jtharness (6.0-b15-1~20.04) focal-security; urgency=medium +jtharness (6.0-b22-1~20.04) focal-security; urgency=medium - * LP: #1949879. Build for 20.04 LTS, required for openjdk-lts. + * Backport jtharness 6.0b22 to 20.04 LTS. Requirement for OpenJDK 11 and 18. - -- Matthias Klose Thu, 04 Nov 2021 18:10:44 +0100 + -- Matthias Klose Tue, 25 Oct 2022 12:32:36 +0200 + +jtharness (6.0-b22-1) unstable; urgency=medium + + * Team upload. + * New upstream release + * Standards-Version updated to 4.6.0.1 + + -- Emmanuel Bourg Mon, 02 May 2022 18:50:56 +0200 + +jtharness (6.0-b17-1) unstable; urgency=medium + + * Team upload. + * New upstream release + + -- Emmanuel Bourg Fri, 28 May 2021 09:35:39 +0200 jtharness (6.0-b15-1) unstable; urgency=medium diff -Nru jtharness-6.0-b15/debian/compat jtharness-6.0-b22/debian/compat --- jtharness-6.0-b15/debian/compat 2021-02-28 11:02:47.000000000 +0000 +++ jtharness-6.0-b22/debian/compat 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -11 diff -Nru jtharness-6.0-b15/debian/control jtharness-6.0-b22/debian/control --- jtharness-6.0-b15/debian/control 2021-02-28 11:02:47.000000000 +0000 +++ jtharness-6.0-b22/debian/control 2022-10-25 10:32:36.000000000 +0000 @@ -5,14 +5,14 @@ Uploaders: Guillaume Mazoyer Build-Depends: ant, - debhelper (>= 11), + debhelper-compat (= 11), default-jdk, javahelper, junit4, libasm-java (>= 5.0), librxtx-java, libservlet-api-java -Standards-Version: 4.5.1 +Standards-Version: 4.6.0.1 Vcs-Git: https://salsa.debian.org/java-team/jtharness.git Vcs-Browser: https://salsa.debian.org/java-team/jtharness Homepage: https://wiki.openjdk.java.net/display/CodeTools/JT+Harness diff -Nru jtharness-6.0-b15/examples/tutorial/doc/tutorial.html jtharness-6.0-b22/examples/tutorial/doc/tutorial.html --- jtharness-6.0-b15/examples/tutorial/doc/tutorial.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/doc/tutorial.html 2022-03-27 19:40:32.000000000 +0000 @@ -27,13 +27,13 @@ --> - + JT Harness Tutorial - +
diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/AppendTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/AppendTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/AppendTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/AppendTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -67,9 +67,9 @@ boolean ok = true; - Integer one = new Integer(1); - Integer two = new Integer(2); - Integer three = new Integer(3); + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); ok = ok & test(new Object[] { "a", "b", "c", "d" }); ok = ok & test(new Object[] { one, two, three }); @@ -144,4 +144,3 @@ */ private PrintWriter err; } - diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/EqualsTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/EqualsTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/EqualsTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/EqualsTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -67,9 +67,9 @@ boolean ok = true; - Integer one = new Integer(1); - Integer two = new Integer(2); - Integer three = new Integer(3); + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); ok = ok & positive_test(new Object[] { }); ok = ok & positive_test(new Object[] { null }); @@ -157,4 +157,3 @@ */ private PrintWriter err; } - diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/InsertTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/InsertTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/InsertTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/InsertTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -67,9 +67,9 @@ boolean ok = true; - Integer one = new Integer(1); - Integer two = new Integer(2); - Integer three = new Integer(3); + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); ok = ok & test(new Object[] { "a", "b", "c", "d" }); ok = ok & test(new Object[] { one, two, three }); @@ -148,4 +148,3 @@ */ private PrintWriter err; } - diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/RemoveTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/RemoveTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/RemoveTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/DoublyLinkedList/RemoveTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -65,11 +65,11 @@ // save error stream to which to write error messages this.err = err; - Integer i0 = new Integer(0); - Integer i10 = new Integer(10); - Integer i100 = new Integer(100); - Integer i1000 = new Integer(1000); - Integer i10000 = new Integer(10000); + Integer i0 = Integer.valueOf(0); + Integer i10 = Integer.valueOf(10); + Integer i100 = Integer.valueOf(100); + Integer i1000 = Integer.valueOf(1000); + Integer i10000 = Integer.valueOf(10000); boolean ok = true; diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/AppendTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/AppendTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/AppendTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/AppendTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -67,9 +67,9 @@ boolean ok = true; - Integer one = new Integer(1); - Integer two = new Integer(2); - Integer three = new Integer(3); + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); ok = ok & test(new Object[] { "a", "b", "c", "d" }); ok = ok & test(new Object[] { one, two, three }); @@ -124,4 +124,3 @@ */ private PrintWriter err; } - diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/EqualsTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/EqualsTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/EqualsTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/EqualsTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -67,9 +67,9 @@ boolean ok = true; - Integer one = new Integer(1); - Integer two = new Integer(2); - Integer three = new Integer(3); + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); ok = ok & positive_test(new Object[] { }); ok = ok & positive_test(new Object[] { null }); @@ -157,4 +157,3 @@ */ private PrintWriter err; } - diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/InsertTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/InsertTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/InsertTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/InsertTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -67,9 +67,9 @@ boolean ok = true; - Integer one = new Integer(1); - Integer two = new Integer(2); - Integer three = new Integer(3); + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); ok = ok & test(new Object[] { "a", "b", "c", "d" }); ok = ok & test(new Object[] { one, two, three }); @@ -124,4 +124,3 @@ */ private PrintWriter err; } - diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/RemoveTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/RemoveTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/RemoveTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/LinkedList/RemoveTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -65,11 +65,11 @@ // save error stream to which to write error messages this.err = err; - Integer i0 = new Integer(0); - Integer i10 = new Integer(10); - Integer i100 = new Integer(100); - Integer i1000 = new Integer(1000); - Integer i10000 = new Integer(10000); + Integer i0 = Integer.valueOf(0); + Integer i10 = Integer.valueOf(10); + Integer i100 = Integer.valueOf(100); + Integer i1000 = Integer.valueOf(1000); + Integer i10000 = Integer.valueOf(10000); boolean ok = true; diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/SortedList/EqualsTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/SortedList/EqualsTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/SortedList/EqualsTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/SortedList/EqualsTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -73,9 +73,9 @@ } }; - Integer one = new Integer(1); - Integer two = new Integer(2); - Integer three = new Integer(3); + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); boolean ok = true; @@ -153,4 +153,3 @@ */ private PrintWriter err; } - diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/SortedList/InsertTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/SortedList/InsertTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/SortedList/InsertTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/SortedList/InsertTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -73,11 +73,11 @@ } }; - Integer i0 = new Integer(0); - Integer i10 = new Integer(10); - Integer i100 = new Integer(100); - Integer i1000 = new Integer(1000); - Integer i10000 = new Integer(10000); + Integer i0 = Integer.valueOf(0); + Integer i10 = Integer.valueOf(10); + Integer i100 = Integer.valueOf(100); + Integer i1000 = Integer.valueOf(1000); + Integer i10000 = Integer.valueOf(10000); boolean ok = true; diff -Nru jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/SortedList/RemoveTest.java jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/SortedList/RemoveTest.java --- jtharness-6.0-b15/examples/tutorial/simpleTags/demots/tests/lists/SortedList/RemoveTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/examples/tutorial/simpleTags/demots/tests/lists/SortedList/RemoveTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -73,11 +73,11 @@ } }; - Integer i0 = new Integer(0); - Integer i10 = new Integer(10); - Integer i100 = new Integer(100); - Integer i1000 = new Integer(1000); - Integer i10000 = new Integer(10000); + Integer i0 = Integer.valueOf(0); + Integer i10 = Integer.valueOf(10); + Integer i100 = Integer.valueOf(100); + Integer i1000 = Integer.valueOf(1000); + Integer i10000 = Integer.valueOf(10000); boolean ok = true; diff -Nru jtharness-6.0-b15/gui-tests/src/build.xml jtharness-6.0-b22/gui-tests/src/build.xml --- jtharness-6.0-b15/gui-tests/src/build.xml 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/build.xml 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,323 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/democonfig_another_suite.jti jtharness-6.0-b22/gui-tests/src/gui/data/democonfig_another_suite.jti --- jtharness-6.0-b15/gui-tests/src/gui/data/democonfig_another_suite.jti 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/democonfig_another_suite.jti 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,51 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +#JT Harness Configuration Interview +#Fri Jul 10 21:00:22 BST 2009 +DESCRIPTION=demo config +INTERVIEW=com.sun.demos.DemoTSInterview +LOCALE=ru_RU +NAME=democonfiguration +QUESTION=demoTS.epilog +demoTS.cmdType=otherVM +demoTS.concurrency.concurrency=1 +demoTS.desc=demo config +demoTS.excludeList.latestAutoCheck=No +demoTS.excludeList.latestAutoCheckInterval=7 +demoTS.excludeList.latestAutoCheckMode=everyXDays +demoTS.excludeList.needExcludeList=No +demoTS.keywords.keywords.mode=expr +demoTS.keywords.needKeywords=No +demoTS.name=democonfiguration +demoTS.priorStatus.needStatus=No +demoTS.priorStatus.status= +demoTS.testVerboseLevel=low +demoTS.tests.needTests=No +demoTS.tests.tests= +demoTS.tests.treeOrFile=tree +demoTS.timeout.timeout=1 diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/democonfig_broken.jti jtharness-6.0-b22/gui-tests/src/gui/data/democonfig_broken.jti --- jtharness-6.0-b15/gui-tests/src/gui/data/democonfig_broken.jti 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/democonfig_broken.jti 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,49 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +#JT Harness Configuration Interview +#Fri Jul 17 15:31:14 BST 2009 +CHECKSUM=5f9cae841e494 +DESCRIPTION=some broken config +LOCALE=ru_RU +NAME=broken_democonfig +QUESTIOdemoTS.epilog +demoTS.cmdType=otherVM +demoTS.desc=some broken config +demoTS.excludeList.latestAutoCheck=No +demoTS.excludeList.latestAutoCheckInterval=7 +demoTS.excludeList.latestAutoCheckMode=everyXDays +demoTS.excludeList.needExcludeList=No +demoTS.keywords.keywords.mode=expr +demoTS.keywords.needKeywords=No +demoTS.name=broken_democonfig +demoTS.priorStatus.needStatus=No +demoTS.priorStatus.status= +demoTS.tests.needTests=No +demoTS.tests.tests= +demoTS.tests.treeOrFile=tree +demoTS.timeout.timeout=1 diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/democonfig.jti jtharness-6.0-b22/gui-tests/src/gui/data/democonfig.jti --- jtharness-6.0-b15/gui-tests/src/gui/data/democonfig.jti 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/democonfig.jti 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,53 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +#JT Harness Configuration Interview +#Mon Apr 12 18:56:17 MSD 2010 +DESCRIPTION=demo config +INTERVIEW=com.sun.demots.DemoTSInterview +LOCALE=ru_RU +NAME=democonfig +QUESTION=demoTS.jvm +WORKDIR=/tmp/aaaa +demoTS.cmdType=otherVM +demoTS.concurrency.concurrency=1 +demoTS.desc=demo config +demoTS.excludeList.latestAutoCheck=No +demoTS.excludeList.latestAutoCheckInterval=7 +demoTS.excludeList.latestAutoCheckMode=everyXDays +demoTS.excludeList.needExcludeList=No +demoTS.jvm= +demoTS.keywords.keywords.mode=expr +demoTS.keywords.needKeywords=No +demoTS.name=democonfig +demoTS.priorStatus.needStatus=No +demoTS.priorStatus.status= +demoTS.testVerboseLevel=low +demoTS.tests.needTests=No +demoTS.tests.tests= +demoTS.tests.treeOrFile=tree +demoTS.timeout.timeout=1 diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/democonfig_second.jti jtharness-6.0-b22/gui-tests/src/gui/data/democonfig_second.jti --- jtharness-6.0-b15/gui-tests/src/gui/data/democonfig_second.jti 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/democonfig_second.jti 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,51 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +#JT Harness Configuration Interview +#Mon Apr 12 19:04:37 MSD 2010 +DESCRIPTION=demo config +INTERVIEW=com.sun.demots.DemoTSInterview +LOCALE=ru_RU +NAME=democonfig_second.jti +QUESTION=demoTS.cmdType +demoTS.cmdType=otherVM +demoTS.concurrency.concurrency=1 +demoTS.desc=demo config +demoTS.excludeList.latestAutoCheck=No +demoTS.excludeList.latestAutoCheckInterval=7 +demoTS.excludeList.latestAutoCheckMode=everyXDays +demoTS.excludeList.needExcludeList=No +demoTS.keywords.keywords.mode=expr +demoTS.keywords.needKeywords=No +demoTS.name=democonfig_second.jti +demoTS.priorStatus.needStatus=No +demoTS.priorStatus.status= +demoTS.testVerboseLevel=low +demoTS.tests.needTests=No +demoTS.tests.tests= +demoTS.tests.treeOrFile=tree +demoTS.timeout.timeout=1 diff -Nru "/tmp/tmpg4dav_8_/ljZ5mTRuAH/jtharness-6.0-b15/gui-tests/src/gui/data/democonfig with spaces.jti" "/tmp/tmpg4dav_8_/TeOwvXnHIj/jtharness-6.0-b22/gui-tests/src/gui/data/democonfig with spaces.jti" --- "/tmp/tmpg4dav_8_/ljZ5mTRuAH/jtharness-6.0-b15/gui-tests/src/gui/data/democonfig with spaces.jti" 1970-01-01 00:00:00.000000000 +0000 +++ "/tmp/tmpg4dav_8_/TeOwvXnHIj/jtharness-6.0-b22/gui-tests/src/gui/data/democonfig with spaces.jti" 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,51 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +#JT Harness Configuration Interview +#Mon Apr 12 18:56:01 MSD 2010 +DESCRIPTION=demo config +INTERVIEW=com.sun.demots.DemoTSInterview +LOCALE=ru_RU +NAME=democonfig +QUESTION=demoTS.name +demoTS.cmdType=otherVM +demoTS.concurrency.concurrency=1 +demoTS.desc=demo config +demoTS.excludeList.latestAutoCheck=No +demoTS.excludeList.latestAutoCheckInterval=7 +demoTS.excludeList.latestAutoCheckMode=everyXDays +demoTS.excludeList.needExcludeList=No +demoTS.keywords.keywords.mode=expr +demoTS.keywords.needKeywords=No +demoTS.name=democonfig +demoTS.priorStatus.needStatus=No +demoTS.priorStatus.status= +demoTS.testVerboseLevel=low +demoTS.tests.needTests=No +demoTS.tests.tests= +demoTS.tests.treeOrFile=tree +demoTS.timeout.timeout=1 diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/demo.jtx jtharness-6.0-b22/gui-tests/src/gui/data/demo.jtx --- jtharness-6.0-b15/gui-tests/src/gui/data/demo.jtx 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/demo.jtx 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,30 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# demo exclude list +# test name bugid(s) keyword(s) brief description +lists/DoublyLinkedList/insertTest.html 0 test test contains error diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/demotemplate_brokenchecksum.jtm jtharness-6.0-b22/gui-tests/src/gui/data/demotemplate_brokenchecksum.jtm --- jtharness-6.0-b15/gui-tests/src/gui/data/demotemplate_brokenchecksum.jtm 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/demotemplate_brokenchecksum.jtm 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,51 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +#JT Harness Configuration Interview +#Fri Jul 17 15:24:17 BST 2009 +CHECKSUM=16fb412345678988 +DESCRIPTION= +INTERVIEW=com.sun.demots.DemoTSInterview +IS_TEMPLATE=true +LOCALE=ru_RU +NAME=demotemplate_with_brokenchecksum +QUESTION=demoTS.desc +demoTS.concurrency.concurrency=1 +demoTS.desc= +demoTS.excludeList.latestAutoCheck=No +demoTS.excludeList.latestAutoCheckInterval=7 +demoTS.excludeList.latestAutoCheckMode=everyXDays +demoTS.excludeList.needExcludeList=No +demoTS.keywords.keywords.mode=expr +demoTS.keywords.needKeywords=No +demoTS.name=demotemplate_with_brokenchecksum +demoTS.priorStatus.needStatus=No +demoTS.priorStatus.status= +demoTS.tests.needTests=No +demoTS.tests.tests= +demoTS.tests.treeOrFile=tree +demoTS.timeout.timeout=1 diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/demotemplate_broken.jtm jtharness-6.0-b22/gui-tests/src/gui/data/demotemplate_broken.jtm --- jtharness-6.0-b15/gui-tests/src/gui/data/demotemplate_broken.jtm 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/demotemplate_broken.jtm 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,50 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +#JT Harness Configuration Interview +#Fri Jul 17 15:24:52 BST 2009 +DSCRIPTION=some broken template +INTERVIEW=com.sun.demots.DemoTSInterview +IS_TEMPLATE=true +LOCALE=ru_RU +NAME=broken_demotemplate +QUESTION=demoTS.cmdType +demoTS.concurrency.concurrency=1 +demoTS.desc=some broken template +demoTS.excludeList.latestAutoCheck=No +emoTS.excludeList.latestAutoCheckInterval=7 +demoTS.excludeList.latestAutoCheckMode=everyXDays +demoTS.excludeList.needExcludeList=No +demoTS.keywords.keywords.mode=expr +demoTS.keywords.needKeywords=No +demoTS.name=broken_demotemplate +demoTS.priorStatus.needStatus=No +demoTS.priorStatus.status= +demoTS.tests.needTests=No +demoTS.tests.tests= +demoTS.tests.treeOrFile=tree +demoTS.timeout.timeout=1 diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/demotemplate_incomplete.jtm jtharness-6.0-b22/gui-tests/src/gui/data/demotemplate_incomplete.jtm --- jtharness-6.0-b15/gui-tests/src/gui/data/demotemplate_incomplete.jtm 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/demotemplate_incomplete.jtm 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,50 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +#JT Harness Configuration Interview +#Fri Jul 10 21:01:23 BST 2009 +DESCRIPTION=demo template +INTERVIEW=com.sun.demots.DemoTSInterview +IS_TEMPLATE=true +LOCALE=ru_RU +NAME=demotemplate +QUESTION=demoTS.epilog +demoTS.cmdType=otherVM +demoTS.concurrency.concurrency=1 +demoTS.desc=demo template +demoTS.excludeList.latestAutoCheck=No +demoTS.excludeList.latestAutoCheckInterval=7 +demoTS.excludeList.latestAutoCheckMode=everyXDays +demoTS.excludeList.needExcludeList=No +demoTS.keywords.keywords.mode=expr +demoTS.keywords.needKeywords=No +demoTS.name=demotemplate +demoTS.priorStatus.needStatus=No +demoTS.priorStatus.status= +demoTS.tests.needTests=No +demoTS.tests.tests= +demoTS.tests.treeOrFile=tree diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/demotemplate.jtm jtharness-6.0-b22/gui-tests/src/gui/data/demotemplate.jtm --- jtharness-6.0-b15/gui-tests/src/gui/data/demotemplate.jtm 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/demotemplate.jtm 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,51 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +#JT Harness Configuration Interview +#Fri Jul 10 21:01:23 BST 2009 +DESCRIPTION=demo template +INTERVIEW=com.sun.demots.DemoTSInterview +IS_TEMPLATE=true +LOCALE=ru_RU +NAME=demotemplate +QUESTION=demoTS.epilog +demoTS.cmdType=otherVM +demoTS.concurrency.concurrency=1 +demoTS.desc=demo template +demoTS.excludeList.latestAutoCheck=No +demoTS.excludeList.latestAutoCheckInterval=7 +demoTS.excludeList.latestAutoCheckMode=everyXDays +demoTS.excludeList.needExcludeList=No +demoTS.keywords.keywords.mode=expr +demoTS.keywords.needKeywords=No +demoTS.name=demotemplate +demoTS.priorStatus.needStatus=No +demoTS.priorStatus.status= +demoTS.tests.needTests=No +demoTS.tests.tests= +demoTS.tests.treeOrFile=tree +demoTS.timeout.timeout=1 diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/kfl_tc_all.kfl jtharness-6.0-b22/gui-tests/src/gui/data/kfl_tc_all.kfl --- jtharness-6.0-b15/gui-tests/src/gui/data/kfl_tc_all.kfl 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/kfl_tc_all.kfl 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,49 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +TestCasesTests/ManyTest.java[PassingTest01] +TestCasesTests/ManyTest.java[PassingTest02] +TestCasesTests/ManyTest.java[PassingTest03] +TestCasesTests/ManyTest.java[PassingTest04] +TestCasesTests/ManyTest.java[PassingTest05] +TestCasesTests/ManyTest.java[FailingTest01] +TestCasesTests/ManyTest.java[FailingTest02] +TestCasesTests/ManyTest.java[ErrorTest01] +TestCasesTests/ManyTest.java[ErrorTest02] +TestCasesTests/PassingTest.java[PassingTest01] +TestCasesTests/PassingTest.java[PassingTest02] +TestCasesTests/PassingTest.java[PassingTest03] +TestCasesTests/FailingTest1.java[FailingTest01] +TestCasesTests/FailingTest1.java[FailingTest02] +TestCasesTests/FailingTest1.java[FailingTest03] +TestCasesTests/FailingTest2.java[PassingTest01] +TestCasesTests/FailingTest2.java[PassingTest02] +TestCasesTests/FailingTest2.java[FailingTest01] +TestCasesTests/FailingTest2.java[FailingTest02] +TestCasesTests/ErrorTest.java[ErrorTest01] +TestCasesTests/ErrorTest.java[PassingTest01] +TestCasesTests/ErrorTest.java[PassingTest02] diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/knownfailures.kfl jtharness-6.0-b22/gui-tests/src/gui/data/knownfailures.kfl --- jtharness-6.0-b15/gui-tests/src/gui/data/knownfailures.kfl 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/knownfailures.kfl 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,28 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +lists/DoublyLinkedList/InsertTest.java diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/knownfailures_missing.kfl jtharness-6.0-b22/gui-tests/src/gui/data/knownfailures_missing.kfl --- jtharness-6.0-b15/gui-tests/src/gui/data/knownfailures_missing.kfl 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/knownfailures_missing.kfl 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,32 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +lists/DoublyLinkedList/AppendTest.java +lists/DoublyLinkedList/InsertTest.java +BigNum/AddTest.java +BigNum/EqualsTest.java +missing_package/MissingTest.java diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/knownfailures_passed.kfl jtharness-6.0-b22/gui-tests/src/gui/data/knownfailures_passed.kfl --- jtharness-6.0-b15/gui-tests/src/gui/data/knownfailures_passed.kfl 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/knownfailures_passed.kfl 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,31 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +lists/DoublyLinkedList/AppendTest.java +lists/DoublyLinkedList/InsertTest.java +BigNum/AddTest.java +BigNum/EqualsTest.java diff -Nru jtharness-6.0-b15/gui-tests/src/gui/data/knownfailures_recursive.kfl jtharness-6.0-b22/gui-tests/src/gui/data/knownfailures_recursive.kfl --- jtharness-6.0-b15/gui-tests/src/gui/data/knownfailures_recursive.kfl 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/data/knownfailures_recursive.kfl 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,28 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +lists/ diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse2.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse2.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse2.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse2.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,77 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +/* + * Start JavaTest with -newdesktop. The JavaTest Quick Start wizard will be displayed. + * Click on Browse the testsuite and click on Next button. Specify an exiting test + * suite and click on Next. Choose the Create a new configuration and click on Next. + * Check the Start the configuration editor. Click on Finish button. Click on Create + * Work directory. Specify a new directory and click on Create. Verify that the + * configuration editor is displayed + */ +package jthtest.Browse; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JDialogOperator; + +public class Browse2 extends Browse { + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Browse.Browse2"); + } + + @Test + public void testBrowse2() { + browseTestsuite(quickStartDialog); + + try { + Thread.sleep(1000); + } catch (InterruptedException ex) { + } + + next(quickStartDialog); + + pickDefaultTestsuite(quickStartDialog); + + next(quickStartDialog); + + createConfiguration(quickStartDialog); + + next(quickStartDialog); + + finish(quickStartDialog, true); + + pickWorkDir(mainFrame); + + new JDialogOperator(mainFrame, "Configuration Editor"); + + } + + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse3.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse3.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse3.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse3.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,47 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jthtest.Browse; + +import org.junit.Test; +import org.junit.runner.JUnitCore; + +public class Browse3 extends Browse { + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Browse.Browse3"); + } + + @Test + public void testBrowse3() { + + browseTestsuite(quickStartDialog); + + next(quickStartDialog); + + getTextField(quickStartDialog, "Test Suite"); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse4.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse4.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse4.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse4.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,52 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jthtest.Browse; + +import org.junit.Test; +import org.junit.runner.JUnitCore; + +public class Browse4 extends Browse { + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Browse.Browse4"); + } + + @Test + public void testBrowse4() { + browseTestsuite(quickStartDialog); + + next(quickStartDialog); + + pickDefaultTestsuite(quickStartDialog); + + next(quickStartDialog); + + useConfigTemplate(quickStartDialog); + + next(quickStartDialog); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse5.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse5.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse5.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse5.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,72 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jthtest.Browse; + +import org.junit.Test; +import org.junit.runner.JUnitCore; + +import junit.framework.Assert; + +public class Browse5 extends Browse { + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Browse.Browse5"); + } + + @Test + public void test_incomplete_configuration_template() { + + // click on Browse the Test Suite Radio button + browseTestsuite(quickStartDialog); + + // click on next button + next(quickStartDialog); + + // Select the test suite + pickDefaultTestsuite(quickStartDialog); + + // Click on next button + next(quickStartDialog); + + // Select the incomplete configuration template + useIncompleteConfigTemplate(quickStartDialog); + + // Click on next button + next(quickStartDialog); + + Assert.assertEquals("The text should specify that the configuration is incomplete", + getJckResource("qsw.end.needEditor"), getTextArea(quickStartDialog)); + + Assert.assertEquals("Almost done text should be clear and easy to understand", getJckResource("qsw.end.hd"), + getTextField(quickStartDialog)); + } + + // TestCase Description + public String getDescription() { + return "This test case verifies that using an incomplete configuration template file an error will be generated."; + } +} \ No newline at end of file diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse7.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse7.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse7.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse7.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,61 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jthtest.Browse; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JDialogOperator; + +public class Browse7 extends Browse { + + public static void main(String[] args) { + JUnitCore.main("com.sun.javatest.tests.Browse.Browse7"); + } + + @Test + public void testBrowse7() { + browseTestsuite(quickStartDialog); + + next(quickStartDialog); + + pickDefaultTestsuite(quickStartDialog); + + next(quickStartDialog); + + useConfigTemplate(quickStartDialog); + + next(quickStartDialog); + + startConfigEditor(quickStartDialog); + + finish(quickStartDialog, true); + + pickWorkDir(mainFrame); + + new JDialogOperator(mainFrame, "Configuration Editor"); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse8.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse8.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse8.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse8.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,74 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jthtest.Browse; + +import org.junit.Test; +import org.junit.runner.JUnitCore; + +public class Browse8 extends Browse { + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Browse.Browse8"); + } + + @Test + public void test_correct_numbers_shown_after_testsuite_loaded() { + + // click on Browse the Test Suite Radio button + browseTestsuite(quickStartDialog); + + // click on next button + next(quickStartDialog); + + // Select the test suite + pickDefaultTestsuite(quickStartDialog); + + // click on next button + next(quickStartDialog); + + // Select the complete configuration template + useConfigTemplate(quickStartDialog); + + // click on next button + next(quickStartDialog); + + // start configuration editor + startConfigEditor(quickStartDialog); + + // click on finish button + finish(quickStartDialog, false); + + // verify that the correct numbers are shown in the right panel + checkCounters(mainFrame, new int[] { 0, 0, 0, 22, 22, 0, 22 }); + + } + + // TestCase Description + public String getDescription() { + return "This test case verifies that the correct numbers will be shown in the right panel after loading a test suite with complete configuration."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Browse/Browse.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Browse/Browse.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,62 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.Browse; + +import jthtest.CreateWorkdir.CreateWorkdir; +import jthtest.Tools; +import org.junit.Before; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JRadioButtonOperator; + +import java.lang.reflect.InvocationTargetException; + +public class Browse extends Tools { + protected JFrameOperator mainFrame; + protected JDialogOperator quickStartDialog; + + static void browseTestsuite(JDialogOperator quickStartDialog) { + //Click on the "Browse" radio button + new JRadioButtonOperator(quickStartDialog, "Browse the test suite").push(); + } + + public static void pickWorkDir(JFrameOperator mainFrame) { + + JDialogOperator wd = CreateWorkdir.findWorkDir(mainFrame); + CreateWorkdir.createWorkDirInTemp(CreateWorkdir.findWorkDirectoryCreation(mainFrame), true); + } + + @Before + public void setUp() throws InterruptedException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + startJavatest(NEWDESKTOP_ARG); + mainFrame = findMainFrame(); + quickStartDialog = findQuickStart(mainFrame); + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,78 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.Config_Edit; + +import jthtest.Test; +import jthtest.tools.ConfigDialog; +import jthtest.tools.Configuration; +import jthtest.tools.JTFrame; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JListOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; +import org.netbeans.jemmy.util.NameComponentChooser; + +import java.lang.reflect.InvocationTargetException; + +public class Config_Edit1 extends Test { + + public Config_Edit1() { + super(); + depricated = true; + } + + public void testImpl() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + mainFrame = new JTFrame(true); + + mainFrame.openDefaultTestSuite(); + addUsedFile(mainFrame.createWorkDirectoryInTemp()); + Configuration conf = mainFrame.getConfiguration(); + conf.load(CONFIG_NAME, true); + + ConfigDialog cd = conf.openByKey(); + checkAnswers(cd.getConfigDialog()); + cd.closeByMenu(); + cd = conf.openByKey(); + checkAnswers(cd.getConfigDialog()); + + } + + private void checkAnswers(JDialogOperator config) { + JListOperator list = new JListOperator(config); + list.setSelectedIndex(list.getModel().getSize() - 1); + if (!new JTextFieldOperator(config, new NameComponentChooser("qu.title")).getText().equals("Congratulations!")) { + throw new JemmyException("Configuration is not complete"); + } + } + + @Override + public String getDescription() { + return "This test checks that reopening Config Editor will show 2 full configurations. This test is depricated as far as Config Editor is now modal and it is not possible to open 2 such dialogs."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit3.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit3.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit3.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit3.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,69 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2011, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Config_Edit; + +import java.lang.reflect.InvocationTargetException; + +import jthtest.Test; +import jthtest.tools.ConfigDialog; +import jthtest.tools.Configuration; +import jthtest.tools.JTFrame; + +public class Config_Edit3 extends Test { + + public void testImpl() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + mainFrame = new JTFrame(true); + + // Open default test suite, create workdirectory and load configuration + mainFrame.openDefaultTestSuite(); + addUsedFile(mainFrame.createWorkDirectoryInTemp()); + Configuration conf = mainFrame.getConfiguration(); + conf.load(CONFIG_NAME, true); + + // push back button on configuration editor and verify back button is disabled + ConfigDialog cd = conf.openByKey(); + cd.pushBackConfigEditor(); + if (cd.getBackButton().isEnabled()) { + errors.add("Back button is enabled while unexpected"); + } + + // push next and back buttons and verify that the configuration editor will go + // back to previous question + cd.pushNextConfigEditor(); + cd.pushBackConfigEditor(); + if (!cd.isSelectedIndex(0)) { + errors.add("After back button pushing list selection is not on first question"); + } + } + + // TestCase Description + public String getDescription() { + return "This test case verifies that Back button in the configuration editor will go back to the previous question."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit4.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit4.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit4.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit4.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,74 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Config_Edit; + +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JListOperator; + +public class Config_Edit4 extends Config_Edit { + public static void main(String args[]) { + JUnitCore.main("jthtest.gui.Config_Edit.Config_Edit4"); + } + + @Test + public void test_next_button_config_editor_next_question() + throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + // start javatest with -newDesktop option + startJavatestNewDesktop(); + JFrameOperator mainFrame = findMainFrame(); + + // Open test suite and load configuration + openTestSuite(mainFrame); + createWorkDirInTemp(mainFrame); + openConfigFile(openLoadConfigDialogByMenu(mainFrame), CONFIG_NAME); + waitForConfigurationLoading(mainFrame, CONFIG_NAME); + + openConfigDialogByKey(mainFrame); + JDialogOperator config = findConfigEditor(mainFrame); + + // push next button on configuration editor + pushNextConfigEditor(config); + + // verify that Next button in the configuration editor will go forward to the + // next question + if (!new JListOperator(config).isSelectedIndex(2)) + throw new JemmyException("After next button pushing list selection is not on third page"); + } + + // TestCase Description + public String getDescription() { + return "This test case verifies that Next button in the configuration editor will go forward to the next question."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit5.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit5.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit5.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit5.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,67 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jthtest.Config_Edit; + +import org.netbeans.jemmy.operators.JListOperator; + +import jthtest.Test; +import jthtest.Tools; +import jthtest.tools.ConfigDialog; +import jthtest.tools.Configuration; +import jthtest.tools.JTFrame; + +public class Config_Edit5 extends Test { + + public void testImpl() throws Exception { + mainFrame = new JTFrame(true); + + // Open default test suite + mainFrame.openDefaultTestSuite(); + addUsedFile(mainFrame.createWorkDirectoryInTemp()); + + // load configuration + Configuration configuration = mainFrame.getConfiguration(); + configuration.load(Tools.CONFIG_NAME, true); + + // push last button on the configuration editor + ConfigDialog dialog = configuration.openByKey(); + dialog.pushLastConfigEditor(); + JListOperator list = new JListOperator(dialog.getConfigDialog()); + + // verifies that Last button in the configuration editor will go to the last + // question. + if (list.getSelectedIndex() != list.getModel().getSize() - 1) { + errors.add("Selected element (" + list.getSelectedIndex() + ") is not the last (" + + (list.getModel().getSize() - 1) + ") after last button pushing"); + } + } + + // TestCase Description + public String getDescription() { + return "This test case verifies that Last button in the configuration editor will go to the last question."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit6.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit6.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit6.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit6.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,63 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jthtest.Config_Edit; + +import jthtest.Test; +import jthtest.Tools; +import jthtest.tools.ConfigDialog; +import jthtest.tools.Configuration; +import jthtest.tools.JTFrame; + +public class Config_Edit6 extends Test { + + public void testImpl() throws Exception { + mainFrame = new JTFrame(true); + + // Open default test suite + mainFrame.openDefaultTestSuite(); + mainFrame.createWorkDirectoryInTemp(); + + // load configuration + Configuration configuration = mainFrame.getConfiguration(); + configuration.load(Tools.CONFIG_NAME, false); + + ConfigDialog config = configuration.openByKey(); + + // Push Done button on configuration editor + config.pushDoneConfigEditor(); + + // Verify that the Done button should dismiss the editor dialog box. + if (config.getConfigDialog().isVisible()) { + errors.add("Config editor is not closed after clicking on Done button on configuration editor"); + } + } + + @Override + public String getDescription() { + return "This test case verifies that Done button in the configuration editor will finish all the questions and dismiss the editor."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit7.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit7.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit7.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit7.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,112 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Config_Edit; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; +import org.netbeans.jemmy.util.NameComponentChooser; + +import javax.swing.JTextField; + +import jthtest.Tools; + +public class Config_Edit7 extends Config_Edit { + public static void main(String args[]) { + JUnitCore.main("jthtest.gui.Config_Edit.Config_Edit7"); + } + + @Test + public void testConfig_Edit7() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + // Start Java Test application with -newDesktop + startJavatestNewDesktop(); + + // get the reference of mainframe + JFrameOperator mainFrame = findMainFrame(); + + // Open default test suite + openTestSuite(mainFrame); + + // Create work directory + createWorkDirInTemp(mainFrame); + + // Load existing configuration file + openConfigFile(openLoadConfigDialogByMenu(mainFrame), CONFIG_NAME); + waitForConfigurationLoading(mainFrame, CONFIG_NAME); + openConfigCreation(mainFrame); + JDialogOperator config = findConfigEditor(mainFrame); + + // Push next button on configuration editor + pushNextConfigEditor(config); + new JTextFieldOperator(config, new NameComponentChooser("str.txt")).typeText("some_jti"); + + // Click on Done button + pushDoneConfigEditor(config); + + // configuration editor will bring up a Save Configuration file chooser. + saveConfig(); + + // Bring up configuration editor by doing Ctrl-E + openConfigDialogByKey(mainFrame); + + // Verify that the name of the jti file should be displayed. + if (!findConfigEditor(mainFrame).getTitle().contains("some_jti")) { + File f = new File(LOCAL_PATH + "jt_gui_test_temp_some_jti-this_file_will_be_deleted.jti"); + f.delete(); + throw new JemmyException("Wrong jti filename in config editor: " + findConfigEditor(mainFrame).getTitle()); + } + File f = new File(LOCAL_PATH + "jt_gui_test_temp_some_jti-this_file_will_be_deleted.jti"); + f.delete(); + } + + private void saveConfig() { + File f = new File(LOCAL_PATH + "jt_gui_test_temp_some_jti-this_file_will_be_deleted.jti"); + if (f.exists()) + f.delete(); + JDialogOperator save = new JDialogOperator(getExecResource("ce.okToClose.title")); + new JButtonOperator(save, "Ok").push(); + save = new JDialogOperator(getExecResource("ce.save.title")); + JTextFieldOperator tf; + + tf = new JTextFieldOperator( + (JTextField) Tools.getComponent(save, new String[] { "Folder name:", "File name:" })); + tf.enterText("jt_gui_test_temp_some_jti-this_file_will_be_deleted"); + } + + public String getDescription() { + return "This test case verifies that Done button in the an empty configuration editor will bring up a Save Configuration file chooser."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Edit/Config_Edit.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,55 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.Config_Edit; + +import jthtest.ConfigTools; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; +import org.netbeans.jemmy.util.NameComponentChooser; + +import java.util.logging.Level; +import java.util.logging.Logger; + +public class Config_Edit extends ConfigTools { + public static void waitForConfigurationLoading(JFrameOperator mainFrame, String name) { + JTextFieldOperator label = new JTextFieldOperator(mainFrame, new NameComponentChooser("bcc.Configuration")); + int time = 0; + while (!label.getText().equals(name)) { + try { + Thread.sleep(100); + time += 100; + if (time > MAX_WAIT_TIME) + throw new JemmyException("Configuration loading error"); + } catch (InterruptedException ex) { + Logger.getLogger(Config_Edit.class.getName()).log(Level.SEVERE, null, ex); + } + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,68 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Config_Load; + +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JFrameOperator; + +public class Config_Load1 extends Config_Load { + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Config_Load.Config_Load1"); + } + + @Test + public void testConfig_Load1() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + // Start Java Test application with -newDesktop + startJavatestNewDesktop(); + + // get the reference of mainframe + JFrameOperator mainFrame = findMainFrame(); + + // Close Quick Start + closeQS(mainFrame); + + // Open default test suite + openTestSuite(mainFrame); + + // Create work directory + createWorkDirInTemp(mainFrame); + + // Verify that file chooser should be displayed for loading an existing jti + // file. + openLoadConfigDialogByMenu(mainFrame); + } + + // TestCase Description + public String getDescription() { + return "This test case verifies that Load button under configure menu will bring up a file chooser to select a jti file to be used."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load2.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load2.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load2.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load2.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,82 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Config_Load; + +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; +import org.netbeans.jemmy.util.NameComponentChooser; + +public class Config_Load2 extends Config_Load { + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Config_Load.Config_Load2"); + } + + @Test + public void testConfig_Load2() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + // Start Java Test application with -newDesktop + startJavatestNewDesktop(); + + // get the reference of mainframe + JFrameOperator mainFrame = findMainFrame(); + + // Close Quick Start + closeQS(mainFrame); + + // Open default test suite + openTestSuite(mainFrame); + + // Create work directory + createWorkDirInTemp(mainFrame); + + JDialogOperator fileChooser = openLoadConfigDialogByMenu(mainFrame); + openConfigFile(fileChooser, CONFIG_NAME); + + if (!new JTextFieldOperator(mainFrame, new NameComponentChooser("bcc.Configuration")).getText() + .equals(CONFIG_NAME)) { + throw new JemmyException("Configuration file wasn't opened"); + } + + // Bring up configuration editor by doing Ctrl-E + openConfigDialogByKey(mainFrame); + + // Verify that the existing jti file should be displayed. + findConfigEditor(mainFrame); + } + + // TestCase Description + public String getDescription() { + return "This test case verifies that Load button under configure menu will bring up a configuration with a valid jti file."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load3.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load3.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load3.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load3.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,71 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Config_Load; + +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; + +public class Config_Load3 extends Config_Load { + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Config_Load.Config_Load3"); + } + + @Test + public void testConfig_Load3() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + // Start Java Test application with -newDesktop + startJavatestNewDesktop(); + + // get the reference of mainframe + JFrameOperator mainFrame = findMainFrame(); + + // Close Quick Start + closeQS(mainFrame); + + // Open default test suite + openTestSuite(mainFrame); + + // Create work directory + createWorkDirInTemp(mainFrame); + + JDialogOperator fileChooser = openLoadConfigDialogByMenu(mainFrame); + openConfigFile(fileChooser, "democonfig_another_suite.jti"); + + // Verify under configure menu will generate an error for an invalid jti file. + new JDialogOperator(WINDOWNAME + " Harness: Error"); + } + + // TestCase Description + public String getDescription() { + return "This test case verifies that Load button under configure menu will generate an error for an invalid jti file."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load4.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load4.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load4.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load4.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,96 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Config_Load; + +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JListOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; +import org.netbeans.jemmy.util.NameComponentChooser; + +import jthtest.Config_Edit.Config_Edit; + +public class Config_Load4 extends Config_Load { + private JFrameOperator mainFrame; + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Config_Load.Config_Load4"); + } + + @Test + public void testConfig_Load4() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + // Start Java Test application with -newDesktop + startJavatestNewDesktop(); + mainFrame = findMainFrame(); + + // Open default test suite + openTestSuite(mainFrame); + + // Create work directory + createWorkDirInTemp(mainFrame); + + openConfigFile(openLoadConfigDialogByMenu(mainFrame), CONFIG_NAME); + Config_Edit.waitForConfigurationLoading(mainFrame, CONFIG_NAME); + + // Bring up Edit configuration by doing Ctrl-E + openConfigDialogByKey(mainFrame); + + // Push Done button on configuration editor + pushDoneConfigEditor(findConfigEditor(mainFrame)); + + // Bring up Load configuration under File menu and select a new jti file. + openConfigFile(openLoadConfigDialogByMenu(mainFrame), SECOND_CONFIG_NAME); + Config_Edit.waitForConfigurationLoading(mainFrame, SECOND_CONFIG_NAME); + + // Bring up Edit configuration by doing Ctrl-E + openConfigDialogByKey(mainFrame); + + // Verify that the new config file will be displayed. + if (!verifyOpeningNewConfigFile()) { + throw new JemmyException("Old config is shown in config editor"); + } + } + + private boolean verifyOpeningNewConfigFile() { + JDialogOperator config = findConfigEditor(mainFrame); + JListOperator list = new JListOperator(config); + list.selectItem(1); + return new JTextFieldOperator(config, new NameComponentChooser("str.txt")).getText().equals(SECOND_CONFIG_NAME); + } + + // TestCase Description + public String getDescription() { + return "This test case verifies that Load button under configure menu will display the new config if the config editor is already open."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Config_Load/Config_Load.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,34 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Config_Load; + +import jthtest.ConfigTools; + +public class Config_Load extends ConfigTools { + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ConfigTools.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ConfigTools.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ConfigTools.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ConfigTools.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,234 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest; + +import jthtest.menu.Menu; +import jthtest.tools.JTFrame; +import org.netbeans.jemmy.operators.*; + +import javax.swing.*; +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.File; + +public class ConfigTools extends Tools { + + public static final String SECOND_CONFIG_NAME = "democonfig_second.jti"; + public static final String DONE_BUTTON = "Done"; + public static final String NEXT_BUTTON = "Next"; + public static final String PREV_BUTTON = "Back"; + public static final String LAST_BUTTON = "Last"; + public static final String CONFIG_LOADER_DIALOG_NAME_EI18N = "wdc.loadconfig"; + public static final String CONFIG_LOADER_LOAD_BUTTON_NAME_EI18N = "wdc.load.btn"; + public static final String CONFIG_LOADER_CONFIG_LOCATION_DIALOG_EI18N = "wdc.configchoosertitle"; + public static final String CONFIG_LOADER_BROWSE_BUTTON = "Browse"; + public static final String SAVE_CONFIG_FILE_DIALOG_NAME_EI18N = "ce.save.title"; + + public static int findRow(JTableOperator table, String searching) { + int i; + for (i = 0; i < table.getRowCount(); i++) { + if (table.getValueAt(i, 0).toString().equals(searching)) { + return i; + } + } + return -1; + } + + public static JDialogOperator openLoadConfigDialogByMenu(JFrameOperator mainFrame) { + Menu.getConfigure_LoadConfigurationMenu(mainFrame).pushNoBlock(); + return new JDialogOperator(getLoadConfigurationDialogName()); + } + + public static void openConfigDialogByKey(JFrameOperator mainFrame) { + mainFrame.requestFocus(); + mainFrame.clickMouse(); + pause(1); + mainFrame.requestFocus(); + mainFrame.pressKey(KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK); + } + + public static void openConfigDialogByMenu(JFrameOperator mainFrame) { + Menu.getConfigure_EditConfigurationMenu(mainFrame); + } + + public static void pushDoneConfigEditor(JDialogOperator config) { + new JButtonOperator(config, DONE_BUTTON).push(); + } + + public static void pushNextConfigEditor(JDialogOperator config) { + new JButtonOperator(config, NEXT_BUTTON).push(); + } + + public static void pushBackConfigEditor(JDialogOperator config) { + new JButtonOperator(config, PREV_BUTTON).push(); + } + + public static void pushLastConfigEditor(JDialogOperator config) { + new JButtonOperator(config, LAST_BUTTON).push(); + } + + public static void openConfigFile(JDialogOperator fileChooser, String path, String name) { + new JButtonOperator(fileChooser, CONFIG_LOADER_BROWSE_BUTTON).push(); + + JDialogOperator fc = new JDialogOperator(getConfigLocationDialogName()); + JTextFieldOperator tf = new JTextFieldOperator(fc); + tf.enterText(path + File.separator + name); + + new JButtonOperator(fileChooser, getConfigLoaderLoadButtonName()).push(); + } + + public static void openConfigFile(JDialogOperator fileChooser, String name) { + openConfigFile(fileChooser, LOCAL_PATH, name); + } + + public static void openConfigCreation(JFrameOperator mainFrame) { + Menu.getConfigure_NewConfigurationMenu(mainFrame).pushNoBlock(); + } + + public static void openConfigCreationBlock(JFrameOperator mainFrame) { + Menu.getConfigure_NewConfigurationMenu(mainFrame).push(); + } + + public static void selectQuestion(JDialogOperator config, int index) { + new JListOperator(config).selectItem(index); + } + + public static void saveConfig(JDialogOperator config, String name) { + getFile_SaveMenu(config).pushNoBlock(); + JDialogOperator saving = new JDialogOperator(getSaveConfigurationDialogName()); + + JTextFieldOperator tf; + + tf = new JTextFieldOperator((JTextField) Tools.getComponent(saving, new String[]{"Folder name:", "File name:", "File Name:", "Folder Name:"})); + tf.enterText(name); + } + + public static JMenuBarOperator getMenu(JDialogOperator configDialog) { + return new JMenuBarOperator(configDialog); + } + + public static JMenuItemOperator getFile_SaveMenu(JDialogOperator configDialog) { + return getMenu(configDialog).showMenuItem(new String[]{getFileMenuName(), getFile_SaveMenuName()}); + } + + public static String getLoadConfigurationDialogName() { + return getExecResource(CONFIG_LOADER_DIALOG_NAME_EI18N); + } + + public static String getSaveConfigurationDialogName() { + return getExecResource(SAVE_CONFIG_FILE_DIALOG_NAME_EI18N); + } + + public static String getConfigLocationDialogName() { + return getExecResource(CONFIG_LOADER_CONFIG_LOCATION_DIALOG_EI18N); + } + + public static String getConfigLoaderLoadButtonName() { + return getExecResource(CONFIG_LOADER_LOAD_BUTTON_NAME_EI18N); + } + + public static String getFileMenuName() { + return "File"; + } + + public static String getFile_SaveMenuName() { + return "Save"; + } + + public boolean isFullConfiguration(JDialogOperator config) { + JListOperator list = new JListOperator(config); + return ((JLabel) list.getRenderedComponent(list.getModel().getSize() - 1)).getText().equals(" Congratulations!"); + } + + public static class ConfigDialog { + + private JDialogOperator config; + private JTFrame mainFrame; + + private ConfigDialog(JTFrame mainFrame) { + this.mainFrame = mainFrame; + config = new JDialogOperator(mainFrame.getJFrameOperator(), getExecResource("ce.name")); + } + + public static ConfigDialog openConfigCreation(JTFrame mainFrame) { + new JMenuOperator(mainFrame.getJFrameOperator(), getExecResource("ch.menu")).pushMenuNoBlock(new String[]{getExecResource("ch.menu"), getExecResource("ch.new.act")}); + return new ConfigDialog(mainFrame); + } + + public static ConfigDialog openConfigCreationBlock(JTFrame mainFrame) { + new JMenuOperator(mainFrame.getJFrameOperator(), getExecResource("ch.menu")).pushMenu(new String[]{getExecResource("ch.menu"), getExecResource("ch.new.act")}); + return new ConfigDialog(mainFrame); + } + + public static ConfigDialog openConfigDialogByKey(JTFrame mainFrame) { + mainFrame.getJFrameOperator().pressKey(KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK); + return new ConfigDialog(mainFrame); + } + + public static ConfigDialog openConfigDialogByMenu(JTFrame mainFrame) { + Menu.getConfigure_EditConfigurationMenu(mainFrame.getJFrameOperator()); + return new ConfigDialog(mainFrame); + } + + public void pushDoneConfigEditor() { + new JButtonOperator(config, DONE_BUTTON).push(); + } + + public void pushNextConfigEditor() { + new JButtonOperator(config, NEXT_BUTTON).push(); + } + + public void pushBackConfigEditor() { + new JButtonOperator(config, PREV_BUTTON).push(); + } + + public void pushLastConfigEditor() { + new JButtonOperator(config, LAST_BUTTON).push(); + } + + public void selectQuestion(int index) { + new JListOperator(config).selectItem(index); + } + + public void saveConfig(String name) { + getFile_SaveMenu(config).pushNoBlock(); + JDialogOperator saving = new JDialogOperator(getSaveConfigurationDialogName()); + + JTextFieldOperator tf; + + tf = new JTextFieldOperator((JTextField) Tools.getComponent(saving, new String[]{"Folder name:", "File name:", "Folder Name:", "File Name:"})); + tf.enterText(name); + } + + public boolean isFullConfiguration() { + JListOperator list = new JListOperator(config); + return ((JLabel) list.getRenderedComponent(list.getModel().getSize() - 1)).getText().equals(" Congratulations!"); + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Create_demowd_config.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Create_demowd_config.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Create_demowd_config.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Create_demowd_config.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,68 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest; + +import jthtest.tools.JTFrame; +import org.netbeans.jemmy.operators.JFrameOperator; + +import java.io.File; +import java.io.FileNotFoundException; +import java.lang.reflect.InvocationTargetException; + +public class Create_demowd_config extends ConfigTools { + + private static JTFrame mainFrame; + private static String targetDir; + + public static void main(String args[]) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InterruptedException, FileNotFoundException { + + System.setProperty("com.sun.javatest.exec.templateMode", "true"); + JTFrame.closeQSOnOpen = false; + mainFrame = JTFrame.startJTWithDefaultTestSuite(); + //Tools.pause(500); + + targetDir = new File("").getAbsolutePath(); + // disabled excessive call: openTestSuite(mainFrame.getJFrameOperator()); + createWD("demowd_config", args[0], null); + closeJT(mainFrame.getJFrameOperator()); + } + + static void createWD(String name, String config, RunManager run) throws InterruptedException { + mainFrame.getWorkDirectory().createWorkDirectory(targetDir, name, true); + if (config != null) { + mainFrame.getConfiguration().load(targetDir, config, true); + } + } + + private static abstract class RunManager { + + public abstract void runTests(JFrameOperator mainFrame); + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Create_demowd.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Create_demowd.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Create_demowd.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Create_demowd.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,64 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest; + +import jthtest.tools.JTFrame; +import org.netbeans.jemmy.operators.JFrameOperator; + +import java.io.File; +import java.io.FileNotFoundException; +import java.lang.reflect.InvocationTargetException; + +public class Create_demowd extends ConfigTools { + + private static JTFrame mainFrame; + private static String targetDir; + + public static void main(String args[]) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InterruptedException, FileNotFoundException { + + System.setProperty("com.sun.javatest.exec.templateMode", "true"); + JTFrame.closeQSOnOpen = false; + mainFrame = JTFrame.startJTWithDefaultTestSuite(); + targetDir = new File("").getAbsolutePath(); + // disabled excessive call: openTestSuite(mainFrame.getJFrameOperator()); + createWD("demowd", null, null); + closeJT(mainFrame.getJFrameOperator()); + } + + static void createWD(String name, String config, RunManager run) throws InterruptedException { + + mainFrame.getWorkDirectory().createWorkDirectory(targetDir, name, true); + + } + + private static abstract class RunManager { + + public abstract void runTests(JFrameOperator mainFrame); + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Create_demowd_run.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Create_demowd_run.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Create_demowd_run.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Create_demowd_run.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,79 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest; + +import jthtest.tools.JTFrame; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JTreeOperator; + +import java.io.File; +import java.io.FileNotFoundException; +import java.lang.reflect.InvocationTargetException; + +public class Create_demowd_run extends ConfigTools { + + private static JTFrame mainFrame; + private static String targetDir; + + public static void main(String args[]) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InterruptedException, FileNotFoundException { + + System.setProperty("com.sun.javatest.exec.templateMode", "true"); + JTFrame.closeQSOnOpen = false; + mainFrame = JTFrame.startJTWithDefaultTestSuite(); + //Tools.pause(500); + + targetDir = new File("").getAbsolutePath(); + // disabled excessive call: openTestSuite(mainFrame.getJFrameOperator()); + createWD("demowd_run", args[0], new RunManager() { + + public void runTests(JFrameOperator mainFrame) { + final JTreeOperator tree = findTree(mainFrame); + tree.selectRow(2); + Create_demowd_run.mainFrame.runTests(2); + } + }); + closeJT(mainFrame.getJFrameOperator()); + } + + static void createWD(String name, String config, RunManager run) throws InterruptedException { + mainFrame.getWorkDirectory().createWorkDirectory(targetDir, name, true); + if (config != null) { + mainFrame.getConfiguration().load(targetDir, config, true); + } + if (run != null && config != null) { + run.runTests(mainFrame.getJFrameOperator()); + } + } + + private static abstract class RunManager { + + public abstract void runTests(JFrameOperator mainFrame); + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Create_demowd_template.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Create_demowd_template.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Create_demowd_template.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Create_demowd_template.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,67 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest; + +import jthtest.tools.JTFrame; +import org.netbeans.jemmy.operators.JFrameOperator; + +import java.io.File; +import java.io.FileNotFoundException; +import java.lang.reflect.InvocationTargetException; + +public class Create_demowd_template extends ConfigTools { + + private static JTFrame mainFrame; + private static String targetDir; + + public static void main(String args[]) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InterruptedException, FileNotFoundException { + + System.setProperty("com.sun.javatest.exec.templateMode", "true"); + JTFrame.closeQSOnOpen = false; + mainFrame = JTFrame.startJTWithDefaultTestSuite(); + + targetDir = new File("").getAbsolutePath(); + // disabled excessive call: openTestSuite(mainFrame.getJFrameOperator()); + createWD("demowd_template", args[0], null); + closeJT(mainFrame.getJFrameOperator()); + } + + static void createWD(String name, String config, RunManager run) throws InterruptedException { + mainFrame.getWorkDirectory().createWorkDirectory(targetDir, name, true); + if (config != null) { + mainFrame.getConfiguration().load(targetDir, config, true); + } + } + + private static abstract class RunManager { + + public abstract void runTests(JFrameOperator mainFrame); + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/CreateWorkdir/CreateWorkdir01.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/CreateWorkdir/CreateWorkdir01.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/CreateWorkdir/CreateWorkdir01.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/CreateWorkdir/CreateWorkdir01.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,53 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.CreateWorkdir; + +import jthtest.Test; +import jthtest.tools.JTFrame; + +import java.io.File; + +public class CreateWorkdir01 extends Test { + + public void testImpl() throws Exception { + JTFrame mainFrame = JTFrame.startJTWithDefaultTestSuite(); + + File created = mainFrame.createWorkDirectoryInTemp(); + addUsedFile(created); + + if (!created.exists()) { + errors.add("Work directory wasn't created propertly with path " + created.getPath() + " " + created.exists()); + } + } + + @Override + public String getDescription() { + return "This test tryes to create a work directory in temp directory using default test suite"; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/CreateWorkdir/CreateWorkdir.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/CreateWorkdir/CreateWorkdir.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/CreateWorkdir/CreateWorkdir.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/CreateWorkdir/CreateWorkdir.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,246 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.CreateWorkdir; + +import jthtest.Tools; +import org.netbeans.jemmy.ClassReference; +import org.netbeans.jemmy.operators.*; +import org.netbeans.jemmy.util.NameComponentChooser; + +import javax.swing.*; +import java.io.File; +import java.lang.reflect.InvocationTargetException; + +public class CreateWorkdir extends Tools { + + public static final String OPEN_WD_MENU_PATH = getExecResource("tmgr.openMenu.menu") + "|" + getExecResource("ch.setWorkDir.act"); + public static final String CREATE_WD_MENU_PATH = getExecResource("ch.newWorkDir.act"); + public static final String OPEN_DIALOG_NAME = getToolResource("wdc.open.title"); + public static final String CREATE_DIALOG_NAME = getToolResource("wdc.new.title"); + public static final String COMMIT_BUTTON_NAME = getExecResource("wdc.create.btn"); + public static final String[] TEXT_FIELD_NAMES = {"Folder name:", "File name:", "Folder Name:", "File Name:"}; + public static String NEW_WD_NAME = "some_temp_wd_that_will_be_deleted"; + + public static void startJavaTestWithDefaultTestSuite() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + new ClassReference("com.sun.javatest.tool.Main").startApplication(new String[]{"-NewDesktop", "-open", TEST_SUITE_NAME}); + } + + public static WorkdirOperator openWorkDirectoryOpening(JFrameOperator mainFrame) { + new JMenuOperator(mainFrame, getExecResource("qlb.file.menu")).pushMenuNoBlock(getExecResource("qlb.file.menu") + "|" + OPEN_WD_MENU_PATH, "|", new SimpleStringComparator()); + WorkdirOperator workdirOperator = new WorkdirOperator(OPEN_DIALOG_NAME); + workdirOperator.commitButtonName = "Open"; + return workdirOperator; + } + + public static WorkdirOperator openWorkDirectoryCreation(JFrameOperator mainFrame) { + new JMenuOperator(mainFrame, getExecResource("qlb.file.menu")).pushMenuNoBlock(getExecResource("qlb.file.menu") + "|" + CREATE_WD_MENU_PATH, "|"); + return findWorkDirectoryCreation(mainFrame); + } + + public static WorkdirOperator findWorkDirectoryCreation(JFrameOperator mainFrame) { + WorkdirOperator workdirOperator = new WorkdirOperator(mainFrame, CREATE_DIALOG_NAME); + workdirOperator.commitButtonName = COMMIT_BUTTON_NAME; + return workdirOperator; + } + + private static void setPath(WorkdirOperator dialog, String path) { + JTextFieldOperator tf = new JTextFieldOperator((JTextField) Tools.getComponent(dialog, TEXT_FIELD_NAMES)); + tf.setText(path); + } + + private static void commit(WorkdirOperator dialog) { + new JButtonOperator(dialog, dialog.commitButtonName).push(); + } + + // creates standard work directory using menu, deleting previous optionary + public static void createWorkDirInTemp(WorkdirOperator mainFrame, boolean delete) { + String path = TEMP_PATH + TEMP_WD_NAME; + createWorkDir(mainFrame, TEMP_PATH, TEMP_WD_NAME, delete); + } + + // creates standard work directory using menu + public static String createWorkDirInCurrent(WorkdirOperator mainFrame) { + String path = new File("").getAbsolutePath(); + createWorkDir(mainFrame, path, TEMP_WD_NAME, true); + return path; + } + + public static void createWorkDir_(JFrameOperator mainFrame, String path, String workDir, boolean delete) { + createWorkDir(openWorkDirectoryCreation(mainFrame), path, workDir, delete); + } + + public static void createWorkDir(WorkdirOperator wrkDir, String path, String workDir, boolean delete) { + String fullPath; + if (path != null) + fullPath = path + File.separator + workDir; + else + fullPath = workDir; + + if (delete) { + deleteDirectory(new File(fullPath)); + } + + setPath(wrkDir, fullPath); + + commit(wrkDir); + } + + public static boolean verifyWorkdirCreation() { + return new File(TEMP_PATH + TEMP_WD_NAME).exists(); + } + + public static boolean verifyWorkdirCreation(String path) { + return new File(path).exists(); + } + + public static JDialogOperator getOpenErrorDialog(JFrameOperator mainFrame) { + return new JDialogOperator(mainFrame, getToolResource("wdc.exists_openIt.title")); + } + + public static String createWorkDirDefWithConfig_() { + String path; + JFrameOperator mainFrame = findMainFrame(); + new JMenuOperator(mainFrame).pushMenuNoBlock(OPEN_WD_MENU_PATH, "|"); + + JDialogOperator wrkDir = new JDialogOperator(mainFrame, CREATE_DIALOG_NAME); + + new JButtonOperator(wrkDir, getExecResource("wdc.browse.btn")).push(); + JDialogOperator filer = new JDialogOperator(mainFrame, getExecResource("wdc.filechoosertitle")); + JTextFieldOperator tf; + tf = new JTextFieldOperator((JTextField) Tools.getComponent(filer, new String[]{"Folder name:", "File name:"})); + path = tf.getText() + "/"; + tf.typeText(path); + deleteDirectory(new File(path + TEMP_WD_NAME)); + new JButtonOperator(filer, "Open").push(); + + getTextField(wrkDir, getExecResource("wdc.dir.name.lbl")).typeText(TEMP_WD_NAME); + + new JRadioButtonOperator(wrkDir, getExecResource("wdc.template.rb")).push(); + + new JButtonOperator(wrkDir, new NameComponentChooser("wdc.template.browse")).push(); + + filer = new JDialogOperator(mainFrame, getExecResource("wdc.templchoosertitle")); + + tf = new JTextFieldOperator((JTextField) Tools.getComponent(filer, new String[]{"Folder name:", "File name:"})); + tf.enterText(TEMPLATE_NAME); + + new JButtonOperator(wrkDir, getExecResource("wdc.create.btn")).push(); + + return path; + } + + public static void createWorkDirWithTemplate_(String basePath) { + JFrameOperator mainFrame = findMainFrame(); + new JMenuOperator(mainFrame).pushMenuNoBlock(OPEN_WD_MENU_PATH, "|"); + + JDialogOperator wrkDir = new JDialogOperator(mainFrame, CREATE_DIALOG_NAME); + + deleteDirectory(new File(basePath + TEMP_WD_NAME)); + getTextField(wrkDir, getExecResource("wdc.dir.name.lbl")).typeText(TEMP_WD_NAME); + + new JButtonOperator(wrkDir, getExecResource("wdc.browse.btn")).push(); + + JDialogOperator filer = new JDialogOperator(mainFrame, getExecResource("wdc.filechoosertitle")); + + JTextFieldOperator tf; + + tf = new JTextFieldOperator((JTextField) Tools.getComponent(filer, new String[]{"Folder name:", "File name:"})); + tf.enterText(basePath); + + new JRadioButtonOperator(wrkDir, getExecResource("wdc.template.rb")).push(); + + new JButtonOperator(wrkDir, new NameComponentChooser("wdc.template.browse")).push(); + + filer = new JDialogOperator(mainFrame, getExecResource("wdc.templchoosertitle")); + + tf = new JTextFieldOperator((JTextField) Tools.getComponent(filer, new String[]{"Folder name:", "File name:"})); + tf.enterText(TEMPLATE_NAME); + + new JButtonOperator(wrkDir, getExecResource("wdc.create.btn")).push(); + } + + public static class WorkdirOperator extends JDialogOperator { + private static final String CREATE_DIALOG_NAME = getToolResource("wdc.new.title"); + private static final String OPEN_DIALOG_NAME = getToolResource("wdc.open.title"); + private static final String MENU_OPEN_PATH = getExecResource("qlb.file.menu") + "|Open|Work Directory ..."; + private static final String MENU_CREATE_PATH = getExecResource("qlb.file.menu") + "|" + getExecResource("ch.newWorkDir.act"); + private JDialogOperator dialog; + private String commitButtonName; + + private WorkdirOperator() { + } + + private WorkdirOperator(JFrameOperator mainFrame, String name) { + super(mainFrame, name); + } + + private WorkdirOperator(String name) { + super(name); + } + + public static WorkdirOperator openWorkdirByMenu() { + WorkdirOperator workdirOperator = new WorkdirOperator(); + workdirOperator.dialog = callOpenByMenu(); + + return workdirOperator; + } + + public static WorkdirOperator createWorkdirByMenu() { + WorkdirOperator workdirOperator = new WorkdirOperator(); + workdirOperator.dialog = callCreateByMenu(); + + return workdirOperator; + } + + private static JDialogOperator callOpenByMenu() { + JFrameOperator mainFrame = findMainFrame(); + new JMenuOperator(mainFrame).pushMenu(MENU_OPEN_PATH, "|"); + return new JDialogOperator(mainFrame, OPEN_DIALOG_NAME); + } + + private static JDialogOperator callCreateByMenu() { + JFrameOperator mainFrame = findMainFrame(); + new JMenuOperator(mainFrame).pushMenu(MENU_CREATE_PATH, "|"); + return new JDialogOperator(mainFrame, CREATE_DIALOG_NAME); + } + + public String getCommitButtonName() { + return commitButtonName; + } + + public void setPath(String path) { + } + + public void dismiss() { + } + + public void accept() { + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Init.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Init.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Init.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Init.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,122 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest; + +import jthtest.tools.JTFrame; +import org.netbeans.jemmy.operators.*; +import org.netbeans.jemmy.util.NameComponentChooser; + +import java.io.File; +import java.io.FileNotFoundException; +import java.lang.reflect.InvocationTargetException; + +public class Init extends ConfigTools { + + private static JTFrame mainFrame; + private static String targetDir; + + public static void main(String args[]) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InterruptedException, FileNotFoundException { + if (args.length < 2) { + System.out.println("please provide paths for config and template files: config_path template_path [javahome_path]"); + System.exit(1); + } + String javaPath; + if (args.length > 2) { + javaPath = args[2]; + } else { + javaPath = System.getProperty("java.home"); + if (javaPath == null) { + System.out.println("please provide javahome path in arguments or in system properties: config_path template_path [javahome_path]"); + System.exit(1); + } else { + if (File.separatorChar == '/') { + javaPath += "/bin/java"; + } else { + javaPath += "\\bin\\java.exe"; + } + } + } + System.setProperty("com.sun.javatest.exec.templateMode", "true"); + JTFrame.closeQSOnOpen = false; + mainFrame = JTFrame.startJTWithDefaultTestSuite(); + //Tools.pause(500); + + mainFrame.getFile_PreferencesMenu().pushNoBlock(); + JDialogOperator prefs = new JDialogOperator(WINDOWNAME + " Harness Preferences"); + new JTreeOperator(prefs).selectRow(2); + new JCheckBoxOperator(prefs, "Warn if All Tests filter is selected when test runs starts").setSelected(true); + new JButtonOperator(prefs, "OK").push(); + + targetDir = new File("").getAbsolutePath(); + File toDelete = mainFrame.createWorkDirectoryInTemp(); + repairConfig("democonfig.jti", javaPath); + repairConfig("democonfig_second.jti", javaPath); + repairConfig("democonfig with spaces.jti", javaPath); + + mainFrame.getMenuBar().showMenuItem(new String[]{"Configure", "Load Template..."}).push(); + JDialogOperator dop = new JDialogOperator("Load Template"); + new JButtonOperator(dop, "Browse...").push(); + JDialogOperator locd = new JDialogOperator("Template Location"); + new JTextFieldOperator(locd).enterText(Tools.LOCAL_PATH + File.separator + "demotemplate.jtm"); + new JCheckBoxOperator(dop, "Launch Template Editor").push(); + new JButtonOperator(dop, "Load").push(); + + JDialogOperator edit = new JDialogOperator("Template Editor"); + new JButtonOperator(edit, "Last").push(); + new JTextFieldOperator(edit, new NameComponentChooser("file.txt")).enterText(javaPath); + new JButtonOperator(edit, "Last").push(); + new JButtonOperator(edit, "Done").push(); + + Tools.deleteDirectory(toDelete); + Thread.sleep(4000); + closeJT(mainFrame.getJFrameOperator()); + } + + public static void repairConfig(String name, String javaPath) { +// openConfigFile(openLoadConfigDialogByMenu(mainFrame), name); + mainFrame.getConfiguration().load(name, true); + + jthtest.tools.ConfigDialog configDialog = mainFrame.getConfiguration().openByMenu(true); +// openConfigDialogByMenu(mainFrame); +// JDialogOperator config = findConfigEditor(mainFrame); + configDialog.selectQuestion(4); + JTextFieldOperator file = new JTextFieldOperator(configDialog.getConfigDialog(), new NameComponentChooser("file.txt")); + file.setText(""); + file.typeText(javaPath); + + configDialog.pushLastConfigEditor(); + configDialog.selectQuestion(1); + configDialog.pushDoneConfigEditor(); + } + + private static abstract class RunManager { + + public abstract void runTests(JFrameOperator mainFrame); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/menu/Menu.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/menu/Menu.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/menu/Menu.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/menu/Menu.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,402 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.menu; + +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JMenuBarOperator; +import org.netbeans.jemmy.operators.JMenuItemOperator; +import org.netbeans.jemmy.operators.JMenuOperator; + +import static jthtest.Tools.*; + +public class Menu { + public static final String FILE_MENU_TI18N = "dt.file.menu"; + public static final String FILE_MENU_MNEMONIC_TI18N = "dt.file.mne"; + public static final String FILE_OPENQS_MENU_EI18N = "mgr.openQuickStart.act"; + public static final String FILE_OPEN_MENU_TI18N = "???"; + public static final String FILE_OPEN_WD_MENU_EI18N = "ch.setWorkDir.act"; + public static final String FILE_OPEN_WD_MNEMONIC_EI18N = "ch.setWorkDir.mne"; + public static final String FILE_OPEN_TS_MENU_EI18N = "mgr.openTestSuite.act"; + public static final String FILE_OPEN_TS_MNEMONIC_EI18N = "mgr.openTestSuite.mne"; + public static final String FILE_RECENTWD_MENU_TI18N = "dt.file.recentwd.menu"; + public static final String FILE_PREFS_MENU_TI18N = "dt.file.prefs.mit"; + public static final String FILE_CLOSE_MENU_TI18N = "tdi.file.close.act"; + public static final String FILE_EXIT_MENU_TI18N = "dt.file.exit.mit"; + public static final String FILE_CREATEWD_MENU_EI18N = "mgr.createWorkDir.act"; + public static final String CONFIGURE_MENU_EI18N = "ch.menu"; + public static final String CONFIGURE_EDIT_MENU_EI18N = "ch.full.act"; + public static final String CONFIGURE_EDIT_QS_MENU_EI18N = "ch.change.menu"; + public static final String CONFIGURE_NEW_MENU_EI18N = "ch.new.act"; + public static final String CONFIGURE_LOAD_MENU_I18N = "ce.file.load.mit"; + public static final String CONFIGURE_RECENT_MENU_I18N = "ce.history.menu"; + public static final String RUNTESTS_MENU_EI18N = "rh.menu"; + public static final String RUNTESTS_START_MENU_EI18N = "rh.start.act"; + public static final String RUNTESTS_STOP_MENU_EI18N = "rh.stop.act"; + public static final String RUNTESTS_MONITOR_MENU_EI18N = "rh.progress.act"; + public static final String REPORT_MENU_EI18N = "rpth.menu"; + public static final String REPORT_CREATE_MENU_EI18N = "rpth.new.act"; + public static final String REPORT_OPEN_MENU_EI18N = "rpth.open.act"; + public static final String VIEW_MENU_EI18N = "ce.view.menu"; + public static final String VIEW_CONFIGURATION_MENU_EI18N = "exec.view.cfg.menu"; + public static final String VIEW_FILTER_MENU_EI18N = "fconfig.submenu.menu"; + public static final String VIEW_PROPERTIES_MENU_EI18N = "exec.view.props.act"; + public static final String VIEW_LOGS_MENU_EI18N = "exec.view.logviewer.act"; + public static final String VIEW_TSERRORS_MENU_EI18N = "exec.view.testSuiteErrors.act"; + public static final String VIEW_CONFIGURATION_SHOWTESTENV_MENU_EI18N = "ch.env.act"; + public static final String VIEW_CONFIGURATION_SHOWEXCLUDELIST_MENU_EI18N = "ch.excl.act"; + public static final String VIEW_CONFIGURATION_SHOWCHECKLIST_MENU_EI18N = "ch.checkList.act"; + public static final String VIEW_CONFIGURATION_SHOWQUESTIONLOG_MENU_EI18N = "ch.quLog.act"; + public static final String TOOLS_MENU_TI18N = "dt.tasks.menu"; + public static final String TOOLS_MENU_MNEMONIC_TI18N = "dt.tasks.mne"; + public static final String TOOLS_TEST_RESULTS_AUDITOR_I18N = "???"; + public static final String TOOLS_AGENT_MONITOR_I18N = "???"; + public static final String TOOLS_OPENQS_EI18N = "mgr.openQuickStart.act"; + public static final String WINDOWS_MENU_TI18N = "dt.windows.menu"; + public static final String WINDOWS_MENU_MNEMONIC_TI18N = "dt.windows.mne"; + public static final String HELP_MENU_EI18N = "qlb.help.btn"; + public static final String HELP_MENU_MNEMONIC_TI18N = "qlb.help.mne"; + public static final String HELP_ONLINEHELP_MENU_TI18N = "hm.help.mit"; + public static final String HELP_ONLINEHELP_MNEMONIC_TI18N = "hm.help.mne"; + public static final String HELP_ABOUTJT_MENU_I18N = "hm.aboutJavaTest.mit"; + public static final String HELP_ABOUTJT_MNEMONIC_I18N = "hm.aboutJavaTest.mne"; + public static final String HELP_ABOUTJVM_MENU_I18N = "hm.aboutJava.mit"; + public static final String HELP_ABOUTJVM_MNEMONIC_I18N = "hm.aboutJava.mne"; + private static JMenuBarOperator menuBar; + + public static JMenuBarOperator getMenuBar(JFrameOperator mainFrame) { + if (menuBar == null) + menuBar = new JMenuBarOperator(mainFrame); + return menuBar; + } + + public static JMenuOperator getFileMenu(JFrameOperator mainFrame) { + return new JMenuOperator(mainFrame, getFileMenuName()); + } + + public static JMenuItemOperator getFile_OpenQuickStartMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getFileMenuName(), getFile_OpenQuickStartMenuName()}); + } + + public static JMenuItemOperator getFile_OpenMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItems(new String[]{getFileMenuName()}, new SimpleStringComparator())[1]; + } + + public static JMenuItemOperator getFile_RecentWorkDirectoryMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getFileMenuName(), getFile_RecentWorkDirectoryMenuName()}); + } + + public static JMenuItemOperator getFile_PreferencesMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getFileMenuName(), getFile_PreferencesMenuName()}); + } + + public static JMenuItemOperator getFile_CloseMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getFileMenuName(), getFile_CloseMenuName()}); + } + + public static JMenuItemOperator getFile_ExitMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getFileMenuName(), getFile_ExitMenuName()}); + } + + public static JMenuItemOperator getFile_Open_WorkDirectoryMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getFileMenuName(), getFile_OpenMenuName(), getFile_Open_WorkDirectoryMenuName()}, new SimpleStringComparator()); + } + + public static JMenuItemOperator getFile_Open_TestSuiteMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getFileMenuName(), getFile_OpenMenuName(), getFile_Open_TestSuiteMenuName()}, new SimpleStringComparator()); + } + + public static JMenuItemOperator getFile_CreateWorkDirectoryMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getFileMenuName(), getFile_CreateWorkDirectoryMenuName()}); + } + + public static String getFileMenuName() { + return getToolResource(FILE_MENU_TI18N); + } + + public static String getFile_OpenQuickStartMenuName() { + return getExecResource(FILE_OPENQS_MENU_EI18N); + } + + public static String getFile_OpenMenuName() { + return "Open"; + } + + public static String getFile_RecentWorkDirectoryMenuName() { + return getToolResource(FILE_RECENTWD_MENU_TI18N); + } + + public static String getFile_PreferencesMenuName() { + return getToolResource(FILE_PREFS_MENU_TI18N); + } + + public static String getFile_CloseMenuName() { + return getToolResource(FILE_CLOSE_MENU_TI18N); + } + + public static String getFile_ExitMenuName() { + return getToolResource(FILE_EXIT_MENU_TI18N); + } + + public static String getFile_Open_WorkDirectoryMenuName() { + return getExecResource(FILE_OPEN_WD_MENU_EI18N); + } + + public static String getFile_Open_TestSuiteMenuName() { + return getExecResource(FILE_OPEN_TS_MENU_EI18N); + } + + public static String getFile_CreateWorkDirectoryMenuName() { + return getExecResource(FILE_CREATEWD_MENU_EI18N); + } + + public static JMenuOperator getConfigureMenu(JFrameOperator mainFrame) { + return new JMenuOperator(mainFrame, getConfigureMenuName()); + } + + public static JMenuItemOperator getConfigure_EditConfigurationMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getConfigureMenuName(), getConfigure_EditConfigurationMenuName()}); + } + + public static JMenuItemOperator getConfigure_EditQuickSetMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getConfigureMenuName(), getConfigure_EditQuickSetMenuName()}); + } + + public static JMenuItemOperator getConfigure_NewConfigurationMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getConfigureMenuName(), getConfigure_NewConfigurationMenuName()}); + } + + public static JMenuItemOperator getConfigure_LoadConfigurationMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getConfigureMenuName(), getConfigure_LoadConfigurationMenuName()}); + } + + public static JMenuItemOperator getConfigure_LoadRecentConfigurationMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getConfigureMenuName(), getConfigure_LoadRecentConfigurationMenuName()}); + } + + public static String getConfigureMenuName() { + return getExecResource(CONFIGURE_MENU_EI18N); + } + + public static String getConfigure_EditConfigurationMenuName() { + return getExecResource(CONFIGURE_EDIT_MENU_EI18N); + } + + public static String getConfigure_EditQuickSetMenuName() { + return getExecResource(CONFIGURE_EDIT_QS_MENU_EI18N); + } + + public static String getConfigure_NewConfigurationMenuName() { + return getExecResource(CONFIGURE_NEW_MENU_EI18N); + } + + public static String getConfigure_LoadConfigurationMenuName() { + return getExecResource(CONFIGURE_LOAD_MENU_I18N); + } + + public static String getConfigure_LoadRecentConfigurationMenuName() { + return getExecResource(CONFIGURE_RECENT_MENU_I18N); + } + + public static JMenuOperator getRunTestsMenu(JFrameOperator mainFrame) { + return new JMenuOperator(mainFrame, getRunTestsMenuName()); + } + + public static JMenuItemOperator getRunTests_StartMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getRunTestsMenuName(), getRunTests_StartMenuName()}); + } + + public static JMenuItemOperator getRunTests_StopMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getRunTestsMenuName(), getRunTests_StopMenuName()}); + } + + public static JMenuItemOperator getRunTests_MonitorProgressMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getRunTestsMenuName(), getRunTests_MonitorProgressMenuName()}); + } + + public static String getRunTestsMenuName() { + return getExecResource(RUNTESTS_MENU_EI18N); + } + + public static String getRunTests_StartMenuName() { + return getExecResource(RUNTESTS_START_MENU_EI18N); + } + + public static String getRunTests_StopMenuName() { + return getExecResource(RUNTESTS_STOP_MENU_EI18N); + } + + public static String getRunTests_MonitorProgressMenuName() { + return getExecResource(RUNTESTS_MONITOR_MENU_EI18N); + } + + public static JMenuOperator getReportMenu(JFrameOperator mainFrame) { + return new JMenuOperator(mainFrame, getReportMenuName()); + } + + public static JMenuItemOperator getReport_CreateReportMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getReportMenuName(), getReport_CreateReportMenuName()}); + } + + public static JMenuItemOperator getReport_OpenReportMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getReportMenuName(), getReport_OpenReportMenuName()}); + } + + public static String getReportMenuName() { + return getExecResource(REPORT_MENU_EI18N); + } + + public static String getReport_CreateReportMenuName() { + return getExecResource(REPORT_CREATE_MENU_EI18N); + } + + public static String getReport_OpenReportMenuName() { + return getExecResource(REPORT_OPEN_MENU_EI18N); + } + + public static JMenuOperator getViewMenu(JFrameOperator mainFrame) { + return new JMenuOperator(mainFrame, getViewMenuName()); + } + + public static JMenuItemOperator getView_ConfigurationMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getViewMenuName(), getView_ConfigurationMenuName()}); + } + + public static JMenuItemOperator getView_FilterMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getViewMenuName(), getView_FilterMenuName()}); + } + + public static JMenuItemOperator getView_PropertiesMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getViewMenuName(), getView_PropertiesMenuName()}); + } + + public static JMenuItemOperator getView_LogsMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getViewMenuName(), getView_LogsMenuName()}); + } + + public static JMenuItemOperator getView_TestSuiteErrorsMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getViewMenuName(), getView_TestSuiteErrorsMenuName()}); + } + + public static JMenuItemOperator getView_Configuration_ShowChecklistMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getViewMenuName(), getView_ConfigurationMenuName(), getView_Configuration_ShowChecklistMenuName()}); + } + + public static JMenuItemOperator getView_Configuration_ShowExcludeListMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getViewMenuName(), getView_ConfigurationMenuName(), getView_Configuration_ShowExcludeListMenuName()}); + } + + public static JMenuItemOperator getView_Configuration_ShowQuestionLogMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getViewMenuName(), getView_ConfigurationMenuName(), getView_Configuration_ShowQuestionLogMenuName()}); + } + + public static JMenuItemOperator getView_Configuration_ShowTestEnvironmentMenu(JFrameOperator mainFrame) { + return getMenuBar(mainFrame).showMenuItem(new String[]{getViewMenuName(), getView_ConfigurationMenuName(), getView_Configuration_ShowTestEnvironmentMenuName()}); + } + + public static String getViewMenuName() { + return getExecResource(VIEW_MENU_EI18N); + } + + public static String getView_ConfigurationMenuName() { + return getExecResource(VIEW_CONFIGURATION_MENU_EI18N); + } + + public static String getView_FilterMenuName() { + return getExecResource(VIEW_FILTER_MENU_EI18N); + } + + public static String getView_PropertiesMenuName() { + return getExecResource(VIEW_PROPERTIES_MENU_EI18N); + } + + public static String getView_LogsMenuName() { + return getExecResource(VIEW_LOGS_MENU_EI18N); + } + + public static String getView_TestSuiteErrorsMenuName() { + return getExecResource(VIEW_TSERRORS_MENU_EI18N); + } + + public static String getView_Configuration_ShowTestEnvironmentMenuName() { + return getExecResource(VIEW_CONFIGURATION_SHOWTESTENV_MENU_EI18N); + } + + public static String getView_Configuration_ShowChecklistMenuName() { + return getExecResource(VIEW_CONFIGURATION_SHOWCHECKLIST_MENU_EI18N); + } + + public static String getView_Configuration_ShowExcludeListMenuName() { + return getExecResource(VIEW_CONFIGURATION_SHOWEXCLUDELIST_MENU_EI18N); + } + + public static String getView_Configuration_ShowQuestionLogMenuName() { + return getExecResource(VIEW_CONFIGURATION_SHOWQUESTIONLOG_MENU_EI18N); + } + + public static String getToolsMenuName() { + return getToolResource(TOOLS_MENU_TI18N); + } + + public static String getTools_TestResultsAuditorMenuName() { + return "Test Results Auditor..."; + } + + public static String getTools_AgentMonitorMenuName() { + return "Agent Monitor..."; + } + + public static String getTools_OpenQuickStartWizardMenuName() { + return getExecResource(TOOLS_OPENQS_EI18N); + } + + public static String getTools_ReportConverterMenuName() { + return "Report Converter..."; + } + + public static String getWindowsMenuName() { + return getToolResource(WINDOWS_MENU_TI18N); + } + + public static String getHelpMenuName() { + return getExecResource(HELP_MENU_EI18N); + } + + public static String getHelp_OnlineHelpMenuName() { + return getToolResource(HELP_ONLINEHELP_MENU_TI18N); + } + + public static String getHelp_AboutJTHarnessMenuName() { + return getToolResource(HELP_ABOUTJT_MENU_I18N); + } + + public static String getHelp_AboutJVMMenuName() { + return getToolResource(HELP_ABOUTJVM_MENU_I18N); + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/menu/QSWizard.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/menu/QSWizard.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/menu/QSWizard.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/menu/QSWizard.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,131 @@ +/* + * $Id$ + * + * Copyright (c) 2009, 2010, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jthtest.menu; + +import jthtest.Tools; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JRadioButtonOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +public class QSWizard { + + public static String QUICK_START_WIZARD_TITLE = Tools.WINDOWNAME + " Harness Quick Start"; + private JDialogOperator dialog; + private Panel panel; + + public QSWizard() { + dialog = new JDialogOperator(QUICK_START_WIZARD_TITLE); + panel = new GreetingsPanel(); + } + + public Panel getPanel() { + return panel; + } + + public abstract class Panel { + + public JDialogOperator getDialog() { + return dialog; + } + + public JButtonOperator next() { + return new JButtonOperator(dialog, "Next"); + } + + public JButtonOperator cancel() { + return new JButtonOperator(dialog, "Cancel"); + } + + public JButtonOperator finish() { + return new JButtonOperator(dialog, "Finish"); + } + + public JButtonOperator back() { + return new JButtonOperator(dialog, "Back"); + } + + public abstract Panel pushNext(); + } + + public class GreetingsPanel extends Panel { + + private boolean startNew = false; + private boolean resume = false; + private boolean browse = false; + + public void setStartNewTestRun() { + browse = resume = false; + startNew = true; + } + + public void setResumeTestRun() { + browse = startNew = false; + resume = true; + } + + public void setBrowseTestSuite() { + new JRadioButtonOperator(dialog, "Browse the test suite").push(); + startNew = resume = false; + browse = true; + } + + @Override + public Panel pushNext() { + next().push(); + return new ChooseTestSuitePanel(); + } + } + + public class ChooseTestSuitePanel extends Panel { + private String testsuite = null; + + public void setTestsuite(String testsuite) { + JTextFieldOperator op = Tools.getTextField(dialog, Tools.getExecResource("qsw.ts.hd")); + op.clearText(); + op.enterText(testsuite); + this.testsuite = testsuite; + } + + @Override + public ChooseConfigurationPanel pushNext() { + if (testsuite == null || "".equals(testsuite)) + return null; + + next().push(); + return new ChooseConfigurationPanel(); + } + } + + public class ChooseConfigurationPanel extends Panel { + + @Override + public Panel pushNext() { + throw new UnsupportedOperationException("Not supported yet."); + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/New/New1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/New/New1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/New/New1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/New/New1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,53 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.New; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JLabelOperator; + +public class New1 extends New { + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.New.New1"); + } + + @Test + public void testNew1() { + + startTestRun(quickStartDialog); + + next(quickStartDialog); + + //Check that label "Test suite" exists in the dialog + new JLabelOperator(quickStartDialog, "Test suite"); + + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/New/New.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/New/New.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/New/New.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/New/New.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,79 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.New; + +import jthtest.Tools; +import org.junit.Before; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JRadioButtonOperator; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; + +public class New extends Tools { + + protected JFrameOperator mainFrame; + protected JDialogOperator quickStartDialog; + + public static void startTestRun(JDialogOperator dialog) { + //Click on the "New" radio button + new JRadioButtonOperator(dialog, "Start a new test run").push(); + } + + public static void pickTempWorkDir(JDialogOperator dialog) { + + deleteDirectory(new File(TEMP_WD_NAME)); + getTextField(dialog, "Work directory").typeText(TEMP_WD_NAME); + + } + + public static void pickExistingWorkDir(JDialogOperator dialog) { + + getTextField(dialog, "Work directory").typeText(TEMP_WD_NAME); + + } + + public static void pickWorkDirWithConfiguration(JDialogOperator dialog) { + getTextField(dialog, "Work directory").typeText(DEFAULT_WD_NAME); + } + + public static void done(JDialogOperator dialog) { + new JButtonOperator(dialog, "Done").push(); + } + + @Before + public void setUp() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + startJavatest(NEWDESKTOP_ARG); + mainFrame = findMainFrame(); + quickStartDialog = openQuickStart(mainFrame); + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/nongui/PropertiesTest1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/nongui/PropertiesTest1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/nongui/PropertiesTest1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/nongui/PropertiesTest1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,119 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.nongui; + +import jthtest.NonguiTest; + +import java.io.IOException; +import java.io.StringReader; +import java.util.Properties; + +public class PropertiesTest1 extends NonguiTest { + // should always give a : 1; b : 2; c : 3 + String tests1[] = {"a=1\nb:2\nc 3\n", "a=1\r\nb:2\r\nc 3\r\n", "a=1\r\nb:2\nc 3\r\n", "a =1\nb :2\nc 3\n", "a= 1\nb: 2\nc 3\n", "a = 1\nb : 2\nc 3\n", "a \t =\f1\nb\t\t :\f2\nc\t\t3\n"}; + // should give a\b : 1; a=b : 2; c : =3; ac : 4; + // a\c should be null + String test2 = "a\\\\b=1\na\\=b=2\nc==3\na\\c=4"; + + public void testImpl() throws Exception { + test1(); + test2(); + } + + private void test2() throws Exception { + Properties p = new Properties(); + p.load(new StringReader(test2)); + boolean b = false; + if (!"1".equals(p.getProperty("a\\b"))) { + if (!b) { + b = true; + errors.add("Error in test string '" + test2 + "' :\n"); + } + errors.add("a\\b == " + p.getProperty("a\\b") + " (should be 1)"); + } + if (!"2".equals(p.getProperty("a=b"))) { + if (!b) { + b = true; + errors.add("Error in test string '" + test2 + "' :\n"); + } + errors.add("a=b == " + p.getProperty("a=b") + " (should be 2)"); + } + if (!"=3".equals(p.getProperty("c"))) { + if (!b) { + b = true; + errors.add("Error in test string '" + test2 + "' :\n"); + } + errors.add("c == " + p.getProperty("c") + " (should be =3)"); + } + if (!"4".equals(p.getProperty("ac"))) { + if (!b) { + b = true; + errors.add("Error in test string '" + test2 + "' :\n"); + } + errors.add("a\\b == " + p.getProperty("a\\b") + " (should be 1)"); + } + if (p.getProperty("a\\c") != null) { + if (!b) { + b = true; + errors.add("Error in test string '" + test2 + "' :\n"); + } + errors.add("a\\c == " + p.getProperty("a\\c") + " (should be null)"); + } + } + + private void test1() throws IOException { + for (String s : tests1) { + Properties p = new Properties(); + p.load(new StringReader(s)); + boolean b = false; + if (!"1".equals(p.getProperty("a"))) { + if (!b) { + errors.add("Error in test string '" + s + "' :\n"); + b = true; + } + errors.add("a == '" + p.getProperty("a") + "' ('1' expected)\n"); + } + if (!"2".equals(p.getProperty("b"))) { + if (!b) { + errors.add("Error in test string '" + s + "' :\n"); + b = true; + } + errors.add("b == '" + p.getProperty("b") + "' ('2' expected)\n"); + } + if (!"3".equals(p.getProperty("c"))) { + if (!b) { + errors.add("Error in test string '" + s + "' :\n"); + b = true; + } + errors.add("c == '" + p.getProperty("c") + "' ('3' expected)\n"); + } + } + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/NonguiTest.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/NonguiTest.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/NonguiTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/NonguiTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,231 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest; + +import org.netbeans.jemmy.JemmyException; + +import java.io.File; +import java.io.IOException; +import java.util.LinkedList; + +public abstract class NonguiTest { + + public static final String TEMP_WD_NAME = "javatest_guitest_demowd"; + public static final String DEFAULT_WD_NAME = "demowd_config"; + public static final String WD_RUN_NAME = "demowd_run"; + public static final String TEST_SUITE_NAME = "demots"; + public static final String TEMPLATE_NAME = "demotemplate.jtm"; + public static final String REPORT_NAME = "demoreport"; + public static final String CONFIG_NAME = "democonfig.jti"; + public static final String TESTS_DIRECTORY_PREFIX = "tests" + File.separator; + public static final String NEWDESKTOP_ARG = "-newdesktop"; + public static final String WINDOWNAME = System.getProperty("jt_gui_test.name"); + public static final String TESTSUITENAME = "DemoTS 1.0 Test Suite (Tag Tests)"; + public static final String REPORT_WD_PATH = "demowd_run"; + public static final String KFL_NORMAL_PATH = "knownfailures.kfl"; + public static final String KFL_PASSED_PATH = "knownfailures_passed.kfl"; + public static String TEMP_PATH; + public static String LOCAL_PATH; + public static String DEFAULT_PATH; + public static String USER_HOME_PATH; + public static boolean showWarnings = true; + + static { + String temp = System.getProperty("user.dir") + File.separator; + if (temp == null || "".equals(temp)) { + File tmp = new File(""); + temp = tmp.getAbsolutePath(); + } + DEFAULT_PATH = LOCAL_PATH = temp; + + TEMP_PATH = temp + File.separator + "temp"; + + USER_HOME_PATH = System.getProperty("user.home") + File.separator; + + String showWarningsStr = System.getProperty("jt_gui_test.showWarnings"); + if (showWarningsStr != null) { + showWarnings = Boolean.parseBoolean(showWarningsStr); + } + } + + public int maxTime = 1200000; // 20 minutes + public int step = 1000; + public int t = 0; + public boolean isWorkReady = false; + protected LinkedList errors; + protected LinkedList warnings; + protected LinkedList usedFiles; + protected boolean depricated = false; + protected LinkedList toCopyFiles; + private boolean ignoreDepricated = true; + + public NonguiTest() { + warnings = new LinkedList(); + errors = new LinkedList(); + usedFiles = new LinkedList(); + toCopyFiles = new LinkedList(); + } + + public NonguiTest(File... files) { + errors = new LinkedList(); + warnings = new LinkedList(); + usedFiles = new LinkedList(); + toCopyFiles = new LinkedList(); + for (File f : files) { + toCopyFiles.add(f); + } + } + + public void addUsedFile(File f) { + usedFiles.add(f); + } + + public void addUsedFile(String f) { + usedFiles.add(new File(f)); + } + + public void addToCopyFile(String f) { + toCopyFiles.add(new File(f)); + } + + private void preTest() throws IOException { + File name = new File(TESTS_DIRECTORY_PREFIX + this.getClass().getSimpleName()); + if (name.exists()) { + Tools.deleteDirectory(name); + } + name.mkdirs(); + Tools.DEFAULT_PATH = Tools.USER_HOME_PATH = Tools.LOCAL_PATH = name.getAbsolutePath() + File.separator; + Tools.TEMP_PATH = name.getAbsolutePath() + File.separator + "temp" + File.separator; + DEFAULT_PATH = USER_HOME_PATH = LOCAL_PATH = name.getAbsolutePath() + File.separator; + TEMP_PATH = name.getAbsolutePath() + File.separator + "temp" + File.separator; + for (File f : toCopyFiles) { + Tools.copyDirectory(f, name); + } + } + + @org.junit.Test//(timeout=1200000) + public final void test() throws Throwable { + if (!depricated || !ignoreDepricated) { + Worker w = null; + try { + preTest(); + w = new Worker(); + Thread tr = new Thread(w); + tr.start(); + + t = 0; + while (t < maxTime && w.isWorking) { + try { + Thread.sleep(step); + t += step; + } catch (InterruptedException ex) { + } + } + + if (w.isWorking) { + tr.interrupt(); + errors.add("Test was interrupted. Waited " + t / 1000 + "s"); + throw new InterruptedException(); + } + } finally { + releaseResources(); + if (w != null && w.error != null) { + throw w.error; + } + if (!warnings.isEmpty() && showWarnings) { + System.out.println("Warnings: "); + for (String s : warnings) { + System.out.println(s); + } + } + if (!errors.isEmpty()) { + StringBuilder builder = new StringBuilder("Failed: \n"); + for (String s : errors) { + builder.append(s).append("\n"); + } + String description = getDescription(); + if (description != null) { + builder.append("\n").append(description).append("\n"); + } + + throw new JemmyException(builder.toString()); + } + } + } else { + System.out.println("Test is depticated. Marking as Passed. "); + } + } + + public abstract void testImpl() throws Exception; + + public String getDescription() { + return null; + } + + public void releaseImpl() throws Exception { + } + + private void releaseResources() { + try { + releaseImpl(); + } catch (Exception e) { + } + for (File f : usedFiles) { + try { + if (f.exists()) { + if (f.isDirectory()) { + Tools.deleteDirectory(f); + } else if (f.isFile()) { + f.delete(); + } + if (f.exists()) { + System.err.println("Temporary file " + f.getAbsolutePath() + " was not removed. Please remove it manualy."); + } + } + } catch (Exception e) { + } + } + } + + private class Worker implements Runnable { + + public Throwable error = null; + public boolean isWorking = true; + + @Override + public void run() { + try { + testImpl(); + } catch (Throwable ex) { + this.error = ex; + } + isWorking = false; + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/OpenTestSuite/OpenTestSuite.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/OpenTestSuite/OpenTestSuite.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/OpenTestSuite/OpenTestSuite.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/OpenTestSuite/OpenTestSuite.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jthtest.OpenTestSuite; + +import java.lang.reflect.InvocationTargetException; + +import org.junit.Before; +import org.netbeans.jemmy.operators.JFrameOperator; + +import jthtest.Tools; + +public class OpenTestSuite extends Tools { + + protected static final String TAB_CAPTION = "DemoTS 1.0 Test Suite (Tag Tests)"; + protected JFrameOperator mainFrame; + + @Before + public void setUp() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + /** start JavaTest application with -newDesktop */ + startJavatest(NEWDESKTOP_ARG); + mainFrame = findMainFrame(); + } +} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ReportCreate/ReportCreate1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ReportCreate/ReportCreate1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ReportCreate/ReportCreate1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ReportCreate/ReportCreate1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,83 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.ReportCreate; + +import jthtest.Test; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; + +import java.io.File; + +import static jthtest.ReportCreate.ReportCreate.*; + +public class ReportCreate1 extends Test { + + public void testImpl() throws Exception { + deleteUserData(); + startJavaTestWithDefaultWorkDirectory(); + + JFrameOperator mainFrame = findMainFrame(); + + JDialogOperator rep = openReportCreation(mainFrame); + String path = TEMP_PATH + REPORT_NAME + "_default" + File.separator; + deleteDirectory(path); + setPath(rep, path); + + pressCreate(rep); + addUsedFile(path); + + findShowReportDialog(); + + if (!new File(path + "html" + File.separator + "report.html").exists()) { + throw new JemmyException("report.html was not found in"); + } + if (!new File(path + "html" + File.separator + "error.html").exists()) { + throw new JemmyException("error.html was not found"); + } + if (!new File(path + "html" + File.separator + "notRun.html").exists()) { + throw new JemmyException("notRun.html was not found"); + } + if (!new File(path + "html" + File.separator + "failed.html").exists()) { + throw new JemmyException("failed.html was not found"); + } + if (!new File(path + "html" + File.separator + "passed.html").exists()) { + throw new JemmyException("passed.html was not found"); + } + if (!new File(path + "html" + File.separator + "report.css").exists()) { + throw new JemmyException("report.css was not found"); + } + if (!new File(path + "text" + File.separator + "summary.txt").exists()) { + throw new JemmyException("summary.txt was not found"); + } + if (!new File(path + "html" + File.separator + "excluded.html").exists()) { + throw new JemmyException("excluded.html was not found"); + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ReportCreate/ReportCreate.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ReportCreate/ReportCreate.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ReportCreate/ReportCreate.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ReportCreate/ReportCreate.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,846 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.ReportCreate; + +import jthtest.ReportTools; +import jthtest.Tools; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.*; +import org.netbeans.jemmy.util.NameComponentChooser; + +import javax.swing.*; +import javax.swing.event.HyperlinkEvent; +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URL; +import java.util.ArrayList; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class ReportCreate extends ReportTools { + + public static void selectCustomFilter(JFrameOperator mainFrame) { + new JMenuOperator(mainFrame, getExecResource("ce.view.menu")).pushMenu(getExecResource("ce.view.menu") + "|" + getExecResource("fconfig.submenu.menu") + "|4 Custom", "|"); + } + + public static void chooseFilter(JDialogOperator rep, FiltersType type) { + JComboBoxOperator chooser = new JComboBoxOperator(rep, new NameComponentChooser("fconfig.box")); + switch (type) { + case LAST_TEST_RUN: + chooser.setSelectedIndex(0); + break; + case CURRENT_CONFIGURATION: + chooser.setSelectedIndex(1); + break; +// case CURRENT_TEMPLATE: chooser.setSelectedIndex(2); break; + case ALL_TESTS: + chooser.setSelectedIndex(2); + break; + case CUSTOM: + chooser.setSelectedIndex(3); + break; + } + } + + public static void checkSpecifiedReportFiles(HtmlReport report, String path) { + if (report.isFGenerateFailed()) { + if (!(new File(path + "html" + File.separator + "failed.html").exists())) { + throw new JemmyException("failed.html was not created"); + } + } else { + if (new File(path + "html" + File.separator + "falied.html").exists()) { + throw new JemmyException("failed.html was created while unexpected"); + } + } + + if (report.isFGenerateError()) { + if (!(new File(path + "html" + File.separator + "error.html").exists())) { + throw new JemmyException("passed.html was not created"); + } + } else { + if (new File(path + "html" + File.separator + "error.html").exists()) { + throw new JemmyException("passed.html was created while unexpected"); + } + } + + if (report.isFGenerateNotRun()) { + if (!(new File(path + "html" + File.separator + "notRun.html").exists())) { + throw new JemmyException("passed.html was not created"); + } + } else { + if (new File(path + "html" + File.separator + "notRun.html").exists()) { + throw new JemmyException("passed.html was created while unexpected"); + } + } + + if (report.isFGeneratePassed()) { + if (!(new File(path + "html" + File.separator + "passed.html").exists())) { + throw new JemmyException("passed.html was not created"); + } + } else { + if (new File(path + "html" + File.separator + "passed.html").exists()) { + throw new JemmyException("passed.html was created while unexpected"); + } + } + + } + + public static void createFakeRepDir(String path) { + try { + if (new File(path).exists()) { + deleteDirectory(new File(path)); + } + new File(path).mkdirs(); + new File(path + "index.html").createNewFile(); + new File(path + "reportdir.dat").createNewFile(); + new File(path + "html").mkdir(); + new File(path + "html" + File.separator + "report.html").createNewFile(); + new File(path + "html" + File.separator + "report.css").createNewFile(); + } catch (IOException ex) { + Logger.getLogger(ReportCreate.class.getName()).log(Level.SEVERE, null, ex); + } + } + + public static class HtmlReport { + + private final String TAB_FILES_NAME = "HTML Files"; + private final String TAB_OPTIONS_NAME = "HTML Options"; + private JDialogOperator rep; + private Tabs tab; + private boolean fPutInIndex, fPutInReport, fGeneratePassed, fGenerateError, fGenerateFailed, + fGenerateNotRun; + private boolean eBackUp; + private int eBackUpNum; + private boolean oConfig, oConfig_QuestionLog, oConfig_TestEnv, oConfig_StdValues, oResults, oKeywords; + + public HtmlReport(JDialogOperator d) { + rep = d; + tab = Tabs.HTML_OPTIONS_TAB; + select(); + } + + public HtmlReport(JDialogOperator d, boolean init) { + rep = d; + tab = Tabs.UNSET; + select(); + + if (init) { + eBackUp = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.backup.bak")).isSelected(); + eBackUpNum = Integer.parseInt(getTextField(rep, getExecResource("nrd.backup.bak.level.lbl")).getText()); + selectTab(Tabs.HTML_FILES_TAB); + fPutInIndex = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.idx")).isSelected(); + fPutInReport = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.rpt")).isSelected(); + fGeneratePassed = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.pass")).isSelected(); + fGenerateError = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.err")).isSelected(); + fGenerateFailed = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.fail")).isSelected(); + fGenerateNotRun = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.nr")).isSelected(); + selectTab(Tabs.HTML_OPTIONS_TAB); + oConfig = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.config")).isSelected(); + oConfig_QuestionLog = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.ql")).isSelected(); + oConfig_TestEnv = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.env")).isSelected(); + oConfig_StdValues = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.std")).isSelected(); + oResults = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.res")).isSelected(); + oKeywords = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.kw")).isSelected(); + } else { + setExtraBackUp(true); + setExtraBackUpNum(1); + setFilesAll(true); + setOptionsAll(true); + } + } + + public boolean isEBackUp() { + return eBackUp; + } + + public int getEBackUpNum() { + return eBackUpNum; + } + + public boolean isFGenerateError() { + return fGenerateError; + } + + public boolean isFGenerateFailed() { + return fGenerateFailed; + } + + public boolean isFGenerateNotRun() { + return fGenerateNotRun; + } + + public boolean isFGeneratePassed() { + return fGeneratePassed; + } + + public boolean isFPutInIndex() { + return fPutInIndex; + } + + public boolean isFPutInReport() { + return fPutInReport; + } + + public boolean isOConfig() { + return oConfig; + } + + public boolean isOConfig_QuestionLog() { + return oConfig_QuestionLog; + } + + public boolean isOConfig_StdValues() { + return oConfig_StdValues; + } + + public boolean isOConfig_TestEnv() { + return oConfig_TestEnv; + } + + public boolean isOKeywords() { + return oKeywords; + } + + public boolean isOResults() { + return oResults; + } + + private void select() { + setHtmlChecked(rep, true); + } + + public void selectTab(Tabs tab) { + switch (tab) { + case HTML_FILES_TAB: + new JTabbedPaneOperator(rep, new NameComponentChooser("nrd.tabs")).selectPage(TAB_FILES_NAME); + break; + case HTML_OPTIONS_TAB: + new JTabbedPaneOperator(rep, new NameComponentChooser("nrd.tabs")).selectPage(TAB_OPTIONS_NAME); + break; + } + this.tab = Tabs.HTML_FILES_TAB; + } + + public void setExtraBackUp(boolean b) { + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.backup.bak")).setSelected(b); + eBackUp = b; + } + + public void setExtraBackUpNum(Integer num) { + getTextField(rep, getExecResource("nrd.backup.bak.level.lbl")).typeText(num.toString()); + eBackUpNum = num; + } + + public void setFilesPutInIndex(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.idx")).setSelected(b); + fPutInIndex = b; + } + + public void setFilesPutInReport(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.rpt")).setSelected(b); + fPutInReport = b; + } + + public void setFilesGeneratePassedTests(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.pass")).setSelected(b); + fGeneratePassed = b; + } + + public void setFilesGenerateErrorTests(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.err")).setSelected(b); + fGenerateError = b; + } + + public void setFilesGenerateFailedTests(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.fail")).setSelected(b); + fGenerateFailed = b; + } + + public void setFilesGenerateNotRunTests(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.nr")).setSelected(b); + fGenerateNotRun = b; + } + + public void setOptionsConfiguration(boolean config, boolean questionLog, boolean testEnviroment, boolean standartVal) { + if (tab != Tabs.HTML_OPTIONS_TAB) { + selectTab(Tabs.HTML_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.config")).setSelected(config); + oConfig = config; + if (config) { + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.ql")).setSelected(questionLog); + oConfig_QuestionLog = questionLog; + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.env")).setSelected(testEnviroment); + oConfig_TestEnv = testEnviroment; + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.std")).setSelected(standartVal); + oConfig_StdValues = standartVal; + } else { + oConfig_QuestionLog = oConfig_StdValues = oConfig_TestEnv = false; + } + } + + public void setOptionsResults(boolean b) { + if (tab != Tabs.HTML_OPTIONS_TAB) { + selectTab(Tabs.HTML_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.res")).setSelected(b); + oResults = b; + } + + public void setOptionsKeyword(boolean b) { + if (tab != Tabs.HTML_OPTIONS_TAB) { + selectTab(Tabs.HTML_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.kw")).setSelected(b); + oKeywords = b; + } + + public void setOptionsAll(boolean b) { + if (tab != Tabs.HTML_OPTIONS_TAB) { + selectTab(Tabs.HTML_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.ql")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.env")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.std")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.config")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.res")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.kw")).setSelected(b); + oConfig = oConfig_QuestionLog = oConfig_StdValues = oConfig_TestEnv = oKeywords = oResults = b; + } + + public void setFilesAll(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.nr")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.fail")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.err")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.pass")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.rpt")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.idx")).setSelected(b); + fGenerateError = fGenerateFailed = fGenerateNotRun = fGeneratePassed = fPutInIndex = fPutInReport = b; + } + + public enum Tabs { + + HTML_FILES_TAB, HTML_OPTIONS_TAB, UNSET + } + } + + public static class ReportBrowser { + + private JDialogOperator browser; + private String text; + private String[] urls; + private String basePath; + + public ReportBrowser(String path) { + browser = new JDialogOperator("Report Browser"); + text = null; + urls = null; + basePath = path; + } + + public void waitForPageLoading(String ends, String contains) { + int time = 0; + ends = ends.replaceAll("[\t\n\r\f ]", ""); + contains = contains.replaceAll("[\t\n\r\f ]", ""); + String text = getTextForced().replaceAll("[\t\n\r\f ]", ""); + do { + try { + if (time > 60000) { + throw new JemmyException("Page containing '" + contains + "' and '" + ends + "' was not opened. Full page: \n" + text); + } + Thread.sleep(100); + time += 100; + text = getTextForced().replaceAll("[\t\n\r\f ]", ""); + } catch (InterruptedException ex) { + Logger.getLogger(ReportCreate.class.getName()).log(Level.SEVERE, null, ex); + } + } while (!text.contains(ends) || !text.contains(contains)); + } + + public JDialogOperator getBrowser() { + return browser; + } + + public void home() { + new JButtonOperator(browser, new NameComponentChooser("Home")).push(); + urls = null; + text = null; + } + + public String[] getUrls() { + if (urls != null) { + return urls; + } + if (text == null) { + getText(); + } + + int pos = 0; + int last = 0; + ArrayList tempList = new ArrayList(); + while ((pos = text.indexOf("href", pos)) != -1) { + pos += 6; + last = text.indexOf("\"", pos); + tempList.add(text.substring(pos, last)); + pos = last; + } + urls = new String[tempList.size()]; + urls = tempList.toArray(urls); + return urls; + } + + public void clickUrl(String url) throws MalformedURLException { + clickUrl(new URL(url)); + } + + public void clickUrl(final URL url) { + try { + SwingUtilities.invokeAndWait(new Runnable() { + + public void run() { + JEditorPane editor = (JEditorPane) (new JEditorPaneOperator(browser).getSource()); + final HyperlinkEvent hyperlinkEvent = new HyperlinkEvent(editor, HyperlinkEvent.EventType.ACTIVATED, url); + new JEditorPaneOperator(browser, new NameComponentChooser("text")).fireHyperlinkUpdate(hyperlinkEvent); + urls = null; + text = null; + Tools.pause(2); + } + }); + } catch (InterruptedException ex) { + Logger.getLogger(ReportCreate.class.getName()).log(Level.SEVERE, null, ex); + } catch (InvocationTargetException ex) { + Logger.getLogger(ReportCreate.class.getName()).log(Level.SEVERE, null, ex); + } + urls = null; + text = null; + } + + public String getText() { + if (text == null) { + text = new JEditorPaneOperator(browser, new NameComponentChooser("text")).getText(); + } + return text; + } + + public URL getPath() { + JComboBoxOperator p = new JComboBoxOperator(browser, new NameComponentChooser("np.choice")); + URL u = (URL) (p.getModel().getSelectedItem()); + return u; + } + + private String getTextForced() { + text = new JEditorPaneOperator(browser, new NameComponentChooser("text")).getText(); + return text; + } + } + + public static class HtmlReportChecker { + + private String basePath; + private ReportBrowser browser; + private HtmlReport htmlReport; + + public HtmlReportChecker(String path, HtmlReport report) { + basePath = path; + browser = new ReportBrowser(path); + htmlReport = report; + } + + ; + + private void checkReportPage() throws JemmyException { + String htmlPath = basePath + "html" + File.separator; + String[] urls = browser.getUrls(); + StringBuffer error = new StringBuffer(""); + int i = -1; + + if (htmlReport.isFGenerateError()) { + if (!(new File(htmlPath + "error.html").exists())) { + error.append("error.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "error.html").exists()) { + error.append("error.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (htmlReport.isFGenerateFailed()) { + if (!(new File(htmlPath + "failed.html").exists())) { + error.append("failed.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "failed.html").exists()) { + error.append("failed.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (htmlReport.isFGenerateNotRun()) { + if (!(new File(htmlPath + "notRun.html").exists())) { + error.append("notRun.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "notRun.html").exists()) { + error.append("notRun.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (htmlReport.isFGeneratePassed()) { + if (!(new File(htmlPath + "passed.html").exists())) { + error.append("passed.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "passed.html").exists()) { + error.append("passed.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (htmlReport.isFPutInIndex()) { + if (!(new File(htmlPath + "index.html").exists())) { + error.append("index.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "index.html").exists()) { + error.append("index.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (htmlReport.isFPutInReport()) { + if (!(new File(htmlPath + "report.html").exists())) { + error.append("report.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "report.html").exists()) { + error.append("report.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (htmlReport.isOConfig()) { + checkFileUrls(urls); + i = findInStringArray(urls, "#Configuration and Other Settings"); + if (i == -1) { + error.append("report doesn't contain configuration url '#Configuration and Other Settings'\n"); + } + if (!browser.getText().contains("name=\"Configuration and Other Settings\"")) { + error.append("report doesn't contain configuration block\n"); + } +// i = findInStringArray(urls, "#locations"); +// if (i == -1) { +// error.append("report doesn't contain url to 'Where to put the results' block\n"); +// } + if (!browser.getText().contains("name=locations") && !browser.getText().contains("name=\"locations\"")) { + error.append("report doesn't contain 'Where to put the results' block\n"); + } + + if (htmlReport.isOConfig_QuestionLog()) { + i = findInStringArray(urls, "config.html"); + if (i == -1) { + error.append("report doesn't contain url to config.html\n"); + } + if (!(new File(htmlPath + "config.html").exists())) { + error.append("config.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + i = findInStringArray(urls, "config.html"); + if (i != -1) { + error.append("report contains url to config.html while unexpected\n"); + } + if (new File(htmlPath + "config.html").exists()) { + error.append("config.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (htmlReport.isOConfig_StdValues()) { + i = findInStringArray(urls, "#selection"); + if (i == -1) { + error.append("report doesn't contain url to standart values block\n"); + } + if (!browser.getText().contains("name=\"selection\"")) { + error.append("report doesn't contain standart values block\n"); + } + if (!new File(htmlPath + "excluded.html").exists()) { + error.append("excluded.html wasn't found at the path '" + htmlPath + "'\n"); + } + } else { + i = findInStringArray(urls, "#selection"); + if (i != -1) { + error.append("report contains url to standart values block while unexpected\n"); + } + if (browser.getText().contains("name=\"selection\"")) { + error.append("report contains standart values block while unexpected\n"); + } + if (new File(htmlPath + "excluded.html").exists()) { + error.append("excluded.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (htmlReport.isOConfig_TestEnv()) { +// i = findInStringArray(urls, "#execution"); +// if (i == -1) { +// error.append("report doesn't contain url to test enviroment ('How to run') block\n"); +// } + if (!browser.getText().contains("name=execution") && !browser.getText().contains("name=\"execution\"")) { + error.append("report doesn't contain test enviroment ('How to run') block\n"); + } + if (!(new File(htmlPath + "env.html").exists())) { + error.append("env.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + i = findInStringArray(urls, "#execution"); + if (i != -1) { + error.append("report contains url to test enviroment ('How to run') block while unexpected\n"); + } + if (browser.getText().contains("name=\"execution\"")) { + error.append("report contains test enviroment ('How to run') block while unexpected\n"); + } + if (new File(htmlPath + "env.html").exists()) { + error.append("env.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + } else { + i = findInStringArray(urls, "#Configuration and Other Settings"); + if (i != -1) { + error.append("report contains configuration url '#Configuration and Other Settings' while unexpected\n"); + } + if (browser.getText().contains("name=\"Configuration and Other Settings\"")) { + error.append("report contains configuration block while unexpected\n"); + } + i = findInStringArray(urls, "config.html"); + if (i != -1) { + error.append("report contains url to config.html while unexpected\n"); + } + if (new File(htmlPath + "config.html").exists()) { + error.append("config.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + i = findInStringArray(urls, "#selection"); + if (i != -1) { + error.append("report contains url to standart values block while unexpected\n"); + } + if (browser.getText().contains("name=\"selection\"")) { + error.append("report contains standart values block while unexpected\n"); + } + i = findInStringArray(urls, "#locations"); + if (i != -1) { + error.append("report contains url to 'Where to put the results' block while unexpected\n"); + } + if (browser.getText().contains("name=\"locations\"")) { + error.append("report contains 'Where to put the results' block while unexpected\n"); + } + i = findInStringArray(urls, "#execution"); + if (i != -1) { + error.append("report contains url to test enviroment ('How to run') block while unexpected\n"); + } + if (browser.getText().contains("name=\"execution\"")) { + error.append("report contains test enviroment ('How to run') block while unexpected\n"); + } + if (new File(htmlPath + "env.html").exists()) { + error.append("env.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + if (new File(htmlPath + "excluded.html").exists()) { + error.append("excluded.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (htmlReport.isOKeywords()) { + i = findInStringArray(urls, "#Statistics"); + if (i == -1) { + error.append("report doesn't contain url to Statistics block (produced by options-keywords)\n"); + } + if (!browser.getText().contains("name=Statistics") && !browser.getText().contains("name=\"Statistics\"")) { + error.append("report doesn't contain Statistics block (produced by options-keywords)\n"); + } + i = findInStringArray(urls, "#keywordSummary"); + if (i == -1) { + error.append("report doesn't contain url to keywordSummary block\n"); + } + if (!browser.getText().contains("name=keywordSummary") && !browser.getText().contains("name=\"keywordSummary\"")) { + error.append("report doesn't contain keywordSummary block\n"); + } + } else { + i = findInStringArray(urls, "#Statistics"); + if (i != -1) { + error.append("report contains url to Statistics block while unexpected\n"); + } + if (browser.getText().contains("name=\"Statistics\"")) { + error.append("report contains Statistics block while unexpected\n"); + } + i = findInStringArray(urls, "#keywordSummary"); + if (i != -1) { + error.append("report contains url to keywordSummary block while unexpected\n"); + } + if (browser.getText().contains("name=\"keywordSummary\"")) { + error.append("report contains keywordSummary block while unexpected\n"); + } + } + + if (htmlReport.isOResults()) { + i = findInStringArray(urls, "#Results"); + if (i == -1) { + error.append("report doesn't contain url to Results block\n"); + } + if (!browser.getText().contains("name=Results") && !browser.getText().contains("name=\"Results\"")) { + error.append("report doesn't contain Results block\n"); + } + } else { + i = findInStringArray(urls, "#Results"); + if (i != -1) { + error.append("report contains url to Results block while unexpected\n"); + } + if (browser.getText().contains("name=\"Results\"")) { + error.append("report contains Results block while unexpected\n"); + } + } + if (error.length() > 0) { + throw new JemmyException(error.toString()); + } + } + + private String getUrlToHtmlReportPage() { + String[] urls = browser.getUrls(); + int i = -1; + String t = ""; + if (htmlReport.isFPutInIndex()) { + i = findInStringArray(urls, "html/index.html"); + t = "index"; + } else { + if (htmlReport.isFPutInReport()) { + i = findInStringArray(urls, "html/report.html"); + t = "report"; + } else { + throw new JemmyException("NIY - nor index.html nor report.html selected"); + } + } + if (i == -1) { + throw new JemmyException("Url to html report page was not found. Tring to browse from '" + browser.getPath().toString() + "' to " + t); + } + + return urls[i]; + } + + private void goToHtmlReport(ReportType type) { + String path = browser.getPath().getPath(); + if (path.equals(basePath + "html/report.html") && type == ReportType.REPORT_HTML) { + return; + } + if (path.equals(basePath + "html/index.html") && type == ReportType.INDEX_HTML) { + return; + } + + if (type == ReportType.INDEX_HTML && htmlReport.isFPutInIndex()) { + if (!path.equals(basePath + "index.html")) { + browser.home(); + browser.waitForPageLoading("", TESTSUITENAME); + } + String url = getUrlToHtmlReportPage(); + + URL u = urlFile(basePath + File.separator + url); + browser.clickUrl(u); + browser.waitForPageLoading("", "" + WINDOWNAME + " Harness : Report"); + } + + if (type == ReportType.REPORT_HTML && htmlReport.isFPutInReport()) { + URL u = urlFile(basePath + File.separator + "html"); + browser.clickUrl(u); + browser.waitForPageLoading("</html>", "Directory listing for html"); + u = urlFile(basePath + File.separator + "html" + File.separator + "report.html"); + browser.clickUrl(u); + browser.waitForPageLoading("</html>", "<title>" + WINDOWNAME + " Harness : Report"); + } + } + + public void commitMainCheck() { + if (htmlReport.isFPutInIndex()) { + goToHtmlReport(ReportType.INDEX_HTML); + checkReportPage(); + } + if (htmlReport.isFPutInReport()) { + goToHtmlReport(ReportType.REPORT_HTML); + checkReportPage(); + } + if (!htmlReport.isFPutInIndex() && !htmlReport.isFPutInReport()) { + throw new JemmyException("NIY"); + } + + + } + + private StringBuffer checkFileUrls(String urls[]) { + StringBuffer temp = new StringBuffer(""); + boolean ts = false, wd = false, rp = false; + for (int i = 0; i < urls.length; i++) { + if (urls[i].equals(LOCAL_PATH + TEST_SUITE_NAME)) { + ts = true; + } + if (urls[i].equals(LOCAL_PATH + REPORT_WD_PATH)) { + wd = true; + } + if (urls[i].equals(basePath + "html")) { + rp = true; + } + } + if (!ts) { + temp.append("Url for testsuite was not found"); + } + if (!wd) { + temp.append("Url for workdirektory was not found"); + } + if (!rp) { + temp.append("Url for report directory was not found"); + } + return temp; + } + + private enum ReportType { + + INDEX_HTML, REPORT_HTML + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ReportTools.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ReportTools.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ReportTools.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ReportTools.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,130 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest; + +import org.netbeans.jemmy.ClassReference; +import org.netbeans.jemmy.operators.*; +import org.netbeans.jemmy.util.NameComponentChooser; + +import javax.swing.*; +import java.lang.reflect.InvocationTargetException; + +public class ReportTools extends Tools { + public static final String REPORT_POSTFIX_HTML = "_html"; + + ; + public static final String REPORT_POSTFIX_XML = "_xml"; + public static final String REPORT_POSTFIX_PLAIN = "_text"; + public static final String REPORT_WD_PATH = "demowd_run"; + + public static void startJavaTestWithDefaultWorkDirectory() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + new ClassReference("com.sun.javatest.tool.Main").startApplication(new String[]{"-NewDesktop", "-open", LOCAL_PATH + java.io.File.separator + REPORT_WD_PATH}); + } + + public static void setPath(JDialogOperator rep, String path) { + new JButtonOperator(rep, getExecResource("nrd.browse.btn")).push(); + JDialogOperator browser = new JDialogOperator("Report Directory"); + getTextField(browser, "File Name:").typeText(path); + try { + Thread.sleep(1000); + } catch (Exception e) { + } + new JButtonOperator(browser, "Open").push(); + } + + public static void pressCreate(JDialogOperator rep) { + new JButtonOperator(rep, getExecResource("nrd.ok.btn")).push(); + } + + public static JDialogOperator openReportCreation(JFrameOperator mainFrame) { + new JMenuOperator(mainFrame, getExecResource("rpth.menu")).pushMenuNoBlock(("rpth.menu") + "|" + getExecResource("rpth.new.act"), "|"); + return new JDialogOperator(getExecResource("nrd.title")); + } + + public static JCheckBox getListElement(JDialogOperator rep, int index) { + JListOperator types = getList(rep); + return (JCheckBox) types.getModel().getElementAt(index); + } + + public static JListOperator getList(JDialogOperator rep) { + JListOperator types = new JListOperator(rep, new NameComponentChooser("nrd.typel")); + return types; + } + + public static JDialogOperator createReports(JFrameOperator mainFrame, String path, boolean createHtml, boolean createPlain, boolean createXml) { + JDialogOperator rep = openReportCreation(mainFrame); + + setPath(rep, path); + + setHtmlChecked(rep, createHtml); + setPlainChecked(rep, createPlain); + setXmlChecked(rep, createXml); + + rep.invalidate(); + + pressCreate(rep); + + return findShowReportDialog(); + } + + public static JDialogOperator findShowReportDialog() { + return new JDialogOperator(getExecResource("nrd.showReport.title")); + } + + // returns previous state + public static boolean setHtmlChecked(JDialogOperator rep, boolean set) { + JCheckBox element = getListElement(rep, 0); + boolean temp = element.isSelected(); + element.setSelected(set); + return temp; + } + + // returns previous state + public static boolean setPlainChecked(JDialogOperator rep, boolean set) { +// JListOperator types = new JListOperator(rep, new NameComponentChooser("nrd.typel")); +// JCheckBoxOperator element = new JCheckBoxOperator(types, getExecResource("nrd.type.pt.ckb")); +// JListOperator types = new JListOperator(rep, new NameComponentChooser("nrd.typel")); + JCheckBox element = getListElement(rep, 1); + boolean temp = element.isSelected(); + element.setSelected(set); + return temp; + } + + // returns previous state + public static boolean setXmlChecked(JDialogOperator rep, boolean set) { +// JListOperator types = new JListOperator(rep, new NameComponentChooser("nrd.typel")); +// JCheckBox element = (JCheckBox)types.getModel().getElementAt(2); + JCheckBox element = getListElement(rep, 2); + boolean temp = element.isSelected(); + element.setSelected(set); + return temp; + } + + public enum ReportType {HTML, PLAIN_TEXT, XML, CUSTOM_TEXT, CUSTOM_XML} +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Config_New.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Config_New.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Config_New.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Config_New.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,49 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import jthtest.ConfigTools; +import org.junit.Before; +import org.netbeans.jemmy.operators.JFrameOperator; + +import java.lang.reflect.InvocationTargetException; + +public class Config_New extends ConfigTools { + + protected static final String TAB_CAPTION = "DemoTS 1.0 Test Suite (Tag Tests)"; + + protected JFrameOperator mainFrame; + protected JFrameOperator mainFrame1; + + @Before + public void setUp() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + startJavatest(NEWDESKTOP_ARG); + mainFrame = findMainFrame(); + } +} \ No newline at end of file diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Create_Work_Dir.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Create_Work_Dir.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Create_Work_Dir.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Create_Work_Dir.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.Sanity_Tests; + +import jthtest.Tools; +import org.junit.Before; +import org.netbeans.jemmy.operators.JFrameOperator; + +import java.lang.reflect.InvocationTargetException; + +public class Create_Work_Dir extends Tools { + + protected static final String TAB_CAPTION = "DemoTS 1.0 Test Suite (Tag Tests)"; + + protected JFrameOperator mainFrame; + + @Before + public void setUp() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + startJavatest(NEWDESKTOP_ARG); + mainFrame = findMainFrame(); + } +} \ No newline at end of file diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Open_Test_Suite.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Open_Test_Suite.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Open_Test_Suite.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Open_Test_Suite.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.Sanity_Tests; + +import jthtest.Tools; +import org.junit.Before; +import org.netbeans.jemmy.operators.JFrameOperator; + +import java.lang.reflect.InvocationTargetException; + +public class Open_Test_Suite extends Tools { + + protected static final String TAB_CAPTION = "DemoTS 1.0 Test Suite (Tag Tests)"; + + protected JFrameOperator mainFrame; + + @Before + public void setUp() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + startJavatest(NEWDESKTOP_ARG); + mainFrame = findMainFrame(); + } +} \ No newline at end of file diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Open_Work_Dir.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Open_Work_Dir.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Open_Work_Dir.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Open_Work_Dir.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.Sanity_Tests; + +import jthtest.Tools; +import org.junit.Before; +import org.netbeans.jemmy.operators.JFrameOperator; + +import java.lang.reflect.InvocationTargetException; + +public class Open_Work_Dir extends Tools { + + protected static final String TAB_CAPTION = "DemoTS 1.0 Test Suite (Tag Tests)"; + + protected JFrameOperator mainFrame; + + @Before + public void setUp() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + startJavatest(NEWDESKTOP_ARG); + mainFrame = findMainFrame(); + } +} \ No newline at end of file diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Agentpool1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Agentpool1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Agentpool1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Agentpool1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,77 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.Sanity_Tests; + +import jthtest.menu.Menu; +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JCheckBoxOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JMenuBarOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + +import static org.junit.Assert.fail; + +public class Test_Agentpool1 extends Config_New { + //This is the 29th Sanity Test. It tests that when a negative value is given to the Timeout value in agent monitor an error message should appear. + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Sanity_Tests.Test_Agentpool1"); + } + + @Test + public void test29() throws InterruptedException { + //Selecting Tools->Agent Monitor. + JMenuBarOperator jmbo = new JMenuBarOperator(mainFrame); + jmbo.pushMenu(Menu.getToolsMenuName(), "/"); + + Thread.sleep(200); + jmbo.pushMenu(Menu.getToolsMenuName() + "/" + Menu.getTools_AgentMonitorMenuName(), "/"); + + //Getting Timeout text field and listening check box. + JTextFieldOperator timeout_value = new JTextFieldOperator(mainFrame, 1); + JCheckBoxOperator listening = new JCheckBoxOperator(mainFrame, 0); + + //Inputting -1 as port value and pressing listening checkbox. + timeout_value.clearText(); + timeout_value.typeText("-1"); + listening.push(); + + //getting expected error dialog box. + JDialogOperator error = new JDialogOperator("JT Harness: Error"); + //If no dialog box appear failing the test. + if (!error.isVisible()) { + fail("Failure because no error message was prompted even when a value -1 was given as input to timeout."); + } + } +} \ No newline at end of file diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Agentpool2.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Agentpool2.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Agentpool2.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Agentpool2.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,77 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.Sanity_Tests; + +import jthtest.menu.Menu; +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JCheckBoxOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JMenuBarOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +import java.io.FileNotFoundException; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + +import static org.junit.Assert.fail; + +public class Test_Agentpool2 extends Config_New { + //This is the 30th Sanity Test. It tests that when a negative value is given to the port value in agent monitor an error message should appear. + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Sanity_Tests.Test_Agentpool2"); + } + + @Test + public void test30() throws InterruptedException { + //Selecting Tools->Agent Monitor. + JMenuBarOperator jmbo = new JMenuBarOperator(mainFrame); + jmbo.pushMenu(Menu.getToolsMenuName(), "/"); + + Thread.sleep(200); + jmbo.pushMenu(Menu.getToolsMenuName() + "/" + Menu.getTools_AgentMonitorMenuName(), "/"); + + //Getting Port text field and listening check box. + JTextFieldOperator port_value = new JTextFieldOperator(mainFrame, 0); + JCheckBoxOperator listening = new JCheckBoxOperator(mainFrame, 0); + + //Inputting -1 as port value and pressing listening checkbox. + port_value.clearText(); + port_value.typeText("-1"); + listening.push(); + + //getting expected error dialog box. + JDialogOperator error = new JDialogOperator("JT Harness: Error"); + //If no dialog box appear failing the test. + if (!error.isVisible()) { + fail("Failure because no error message was prompted even when a value -1 was given as input to port value."); + } + } +} \ No newline at end of file diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Edit3.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Edit3.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Edit3.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Edit3.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,114 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import java.io.File; +import java.io.IOException; +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; +import org.netbeans.jemmy.util.NameComponentChooser; + +import javax.swing.JTextField; + +import jthtest.Tools; +import jthtest.Config_Edit.Config_Edit; + +public class Test_Config_Edit3 extends Config_Edit { + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Sanity_Tests.Test_Config_Edit3"); + } + + /** + * This test case Verify that \"Done\" button in an empty Configuration Editor + * will bring up a Save Configuration file browser. + * + * @throws ClassNotFoundException + * + * @throws InvocationTargetException + * + * @throws NoSuchMethodException + */ + @Test + public void testConfig_Edit7() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + startJavatestNewDesktop(); + JFrameOperator mainFrame = findMainFrame(); + openTestSuite(mainFrame); + createWorkDirInTemp(mainFrame); + + openConfigFile(openLoadConfigDialogByMenu(mainFrame), CONFIG_NAME); + waitForConfigurationLoading(mainFrame, CONFIG_NAME); + openConfigCreation(mainFrame); + JDialogOperator config = findConfigEditor(mainFrame); + + pushNextConfigEditor(config); + new JTextFieldOperator(config, new NameComponentChooser("str.txt")).typeText("some_jti"); + + pushDoneConfigEditor(config); + saveConfig(); + openConfigDialogByKey(mainFrame); + + if (!findConfigEditor(mainFrame).getTitle().contains("some_jti")) { + File f = new File(LOCAL_PATH + "jt_gui_test_temp_some_jti-this_file_will_be_deleted.jti"); + f.delete(); + throw new JemmyException("Wrong jti filename in config editor: " + findConfigEditor(mainFrame).getTitle()); + } + File f = new File(LOCAL_PATH + "jt_gui_test_temp_some_jti-this_file_will_be_deleted.jti"); + f.delete(); + } + + /** + * This method clicks on OK button on Save Configuration file browser and save + * the configuration (.jti) file. + * + * @throws IOException + * + */ + @SuppressWarnings("deprecation") + private void saveConfig() { + File f = new File(LOCAL_PATH + "jt_gui_test_temp_some_jti-this_file_will_be_deleted.jti"); + if (f.exists()) + f.delete(); + JDialogOperator save = new JDialogOperator(getExecResource("ce.okToClose.title")); + new JButtonOperator(save, "Ok").push(); + save = new JDialogOperator(getExecResource("ce.save.title")); + JTextFieldOperator tf; + + tf = new JTextFieldOperator( + (JTextField) Tools.getComponent(save, new String[] { "Folder name:", "File name:" })); + tf.enterText("jt_gui_test_temp_some_jti-this_file_will_be_deleted"); + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Load1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Load1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Load1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Load1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import static org.junit.Assert.fail; + +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JFrameOperator; + +import jthtest.ConfigTools; + +public class Test_Config_Load1 extends ConfigTools { + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Config_Load.Config_Load1"); + } + + /** + * This test is to verify that Load button under configuration will bring up a + * file browser to select a jti file to be used. + * + * @throws ClassNotFoundException + * + * @throws InvocationTargetException + * + * @throws NoSuchMethodException + */ + @Test + public void testConfig_Load1() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + startJavatestNewDesktop(); + JFrameOperator mainFrame = findMainFrame(); + closeQS(mainFrame); + + openTestSuite(mainFrame); + createWorkDirInTemp(mainFrame); + + if (!(openLoadConfigDialogByMenu(mainFrame).isVisible())) { + fail("Load button under configuration does not bring up a file browser to select a jti file to be used"); + } + + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_New1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_New1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_New1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_New1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,64 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import java.lang.reflect.InvocationTargetException; + +import jthtest.Test; +import jthtest.tools.ConfigDialog; +import jthtest.tools.JTFrame; + +public class Test_Config_New1 extends Test { + /** + * This test is to verify that menu item \"Configure-> New configuration\" in an + * existing directory and configuration will reset it to an empty state. + * + * @throws ClassNotFoundException + * + * @throws InvocationTargetException + * + * @throws NoSuchMethodException + */ + public void testImpl() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + JTFrame frame = JTFrame.startJTWithDefaultWorkDirectory(); + ConfigDialog cd = frame.getConfiguration().openByKey(); + boolean firstly = cd.isFullConfiguration(); + cd.closeByMenu(); + + cd = frame.getConfiguration().create(true); + boolean secondly = cd.isFullConfiguration(); + + if (secondly) { + errors.add("Configuration is full after creation"); + } + if (!firstly) { + errors.add("Warning: configuration was not full before creation"); + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_New2.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_New2.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_New2.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_New2.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,51 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package jthtest.Sanity_Tests; + +import jthtest.Test; +import jthtest.tools.JTFrame; + +public class Test_Config_New2 extends Test { + + public void testImpl() throws Exception { + + JTFrame mainFrame = new JTFrame(true); + mainFrame.openDefaultTestSuite(); + addUsedFile(mainFrame.createWorkDirectoryInTemp()); + + if (mainFrame.getConfiguration().create(false).isFullConfiguration()) { + errors.add("Newly created configuration is full while unexpected"); + } + + } + + /** TestCase Description */ + public String getDescription() { + return "Verify that menu item \"Configure-> New configuration\" will bring up an empty configuration editor."; + } +} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Save2.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Save2.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Save2.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Config_Save2.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,84 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import java.io.File; +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; + +import jthtest.ConfigTools; + +public class Test_Config_Save2 extends ConfigTools { + public static void main(String args[]) { + JUnitCore.main("jthtest.gui.Config_SaveEdit.Test_Config_SaveEdit2"); + } + /** + * Verify that "File->Save" menu item in Configuration Editor will save the + * current configuration in a new file if there is no file name. + * + * @throws ClassNotFoundException + * + * @throws InvocationTargetException + * + * @throws NoSuchMethodException + * + */ + @Test + public void testConfig_SaveEdit2() + throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, InterruptedException { + File f = new File(LOCAL_PATH + "jt_gui_test_Config_SaveEdit2_test_this_file_will_be_deleted.jti"); + if (f.exists()) + f.delete(); + f = null; + startJavatestNewDesktop(); + JFrameOperator mainFrame = findMainFrame(); + closeQS(mainFrame); + + openTestSuite(mainFrame); + createWorkDirInTemp(mainFrame); + openConfigCreation(mainFrame); + JDialogOperator config = findConfigEditor(mainFrame); + saveConfig(config, "jt_gui_test_Config_SaveEdit2_test_this_file_will_be_deleted"); + + f = new File(LOCAL_PATH + "jt_gui_test_Config_SaveEdit2_test_this_file_will_be_deleted.jti"); + int t = 0; + while (t < 1000 && !f.exists()) { + f = new File(LOCAL_PATH + "jt_gui_test_Config_SaveEdit2_test_this_file_will_be_deleted.jti"); + t += 100; + Thread.sleep(100); + } + if (!f.exists()) + throw new JemmyException("File was not created"); + f.delete(); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Create_Work_Dir1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Create_Work_Dir1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Create_Work_Dir1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Create_Work_Dir1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,54 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import java.io.File; + +import jthtest.Test; +import jthtest.tools.JTFrame; + +public class Test_Create_Work_Dir1 extends Test { + + public void testImpl() throws Exception { + JTFrame mainFrame = JTFrame.startJTWithDefaultTestSuite(); + + /** Create a new work directory */ + File created = mainFrame.createWorkDirectoryInTemp(); + addUsedFile(created); + Thread.sleep(2000); + if (!created.exists()) { + errors.add( + "Error while creating a non-existing work directory." + created.getPath() + " " + created.exists()); + } + } + + /** TestCase Description */ + public String getDescription() { + return "This test case verifies that creating a non-existing work directory would create a directory."; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Test_Suite1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Test_Suite1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Test_Suite1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Test_Suite1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,63 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import static org.junit.Assert.fail; + +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JTabbedPaneOperator; + +import jthtest.OpenTestSuite.OpenTestSuite; + +public class Test_Open_Test_Suite1 extends OpenTestSuite { + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Sanity_Tests.Test_Open_Test_Suite1"); + } + + @Test + public void testOpenTestSuite1() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + /** Open existing test suite */ + openTestSuite(mainFrame); + waitForWDLoading(mainFrame, WDLoadingResult.SOME_NOTRUN); + JTabbedPaneOperator tab = new JTabbedPaneOperator(mainFrame, TAB_CAPTION); + if (!tab.isVisible()) { + fail("Error while opening an existing test suite."); + } + } + + /** TestCase Description */ + public String getDescription() { + return "This test case verifies that opening an existing test suite would correctly load tests."; + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Work_Dir1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Work_Dir1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Work_Dir1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Work_Dir1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,79 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import static org.junit.Assert.assertEquals; + +import java.io.FileNotFoundException; +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.ComponentChooser; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JTabbedPaneOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; +import org.netbeans.jemmy.util.NameComponentChooser; + +import jthtest.menu.Menu; + +public class Test_Open_Work_Dir1 extends Open_Work_Dir { + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Sanity_Tests.Test_Open_Work_Dir1"); + } + + @Test + public void testOpenTestSuite1() + throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException, FileNotFoundException { + + /** Open existing work directory */ + Menu.getFile_Open_WorkDirectoryMenu(mainFrame).pushNoBlock(); + JDialogOperator openDialog = new JDialogOperator(getToolResource("wdc.open.title")); + new JTextFieldOperator(openDialog, "").enterText(DEFAULT_WD_NAME); + + /** Finding the text field which displays the current work directory name */ + ComponentChooser ncc = new NameComponentChooser("bcc.WorkDir"); + JTextFieldOperator work_directory_name = new JTextFieldOperator(mainFrame, ncc); + waitForWDLoading(mainFrame, WDLoadingResult.SOME_NOTRUN); + new JTabbedPaneOperator(mainFrame, TAB_CAPTION); + + /** + * verifying that the opening existing work directory would correctly load + * tests. + */ + assertEquals("opening an existing work directory should correctly load tests" + DEFAULT_WD_NAME + ".", + work_directory_name.getText(), DEFAULT_WD_NAME); + } + + /** TestCase Description */ + public String getDescription() { + return "This test case verifies that opening an existing work directory would correctly load tests."; + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Work_Dir2.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Work_Dir2.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Work_Dir2.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_Open_Work_Dir2.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,71 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import static org.junit.Assert.fail; + +import java.lang.reflect.InvocationTargetException; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +import jthtest.menu.Menu; + +public class Test_Open_Work_Dir2 extends Open_Work_Dir { + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Sanity_Tests.Test_Open_Work_Dir2"); + } + + @Test + public void testOpenTestSuite1() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + + /** navigating to a non work directory */ + Menu.getFile_Open_WorkDirectoryMenu(mainFrame).pushNoBlock(); + JDialogOperator openDialog = new JDialogOperator(getToolResource("wdc.open.title")); + + /** Trying to open a non work directory */ + new JTextFieldOperator(openDialog, "").enterText("classes"); + + /** Checking if work directory opens or not */ + if (!openDialog.isVisible()) { + fail("Failure... because the work directory dialog window closed after selecting non-work directory."); + } else { + openDialog.close(); + } + + } + + /** TestCase Description */ + public String getDescription() { + return "This test case verifies that opening a non-work directory should navigate through directory."; + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,104 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import static org.junit.Assert.assertEquals; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JRadioButtonOperator; +import org.netbeans.jemmy.operators.JTextAreaOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +public class Test_QSW1 extends Config_New { + // This test case checks if Quick Start wizard Shows correct display text and + // next and back button works. + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Sanity_Tests.Test_QSW1"); + } + + @Test + public void test() { + // Selecting the quick start dialog box and checking the header. + JDialogOperator quickstart = new JDialogOperator(getExecResource("qsw.title")); + JTextFieldOperator qsw_header = new JTextFieldOperator(quickstart, 0); + + // Checking header text + assertEquals("Failed because of Incorrect header text - ", "Welcome to the JT Harness!", qsw_header.getText()); + + // Checking Text inside the body. + JTextAreaOperator qsw_text = new JTextAreaOperator(quickstart, 0); + assertEquals("Failed because of Incorrect text in text body - ", + "This Quick Start Guide will lead you through the process of setting up the JT Harness to perform common tasks.\n" + + "\n" + "Which of the following tasks do you want to do?", + qsw_text.getText()); + + // Selecting the next and back buttons. + JButtonOperator next = new JButtonOperator(quickstart, 1); + JButtonOperator back = new JButtonOperator(quickstart, 0); + + // Selecting the checkbox named 'start a new run'. + JTextFieldOperator qsw_temp; + JRadioButtonOperator qsw_check = new JRadioButtonOperator(quickstart, 0); + qsw_check.push(); + next.push(); + + // Checking text header that appears after next button is press. + qsw_temp = new JTextFieldOperator(quickstart, 0); + assertEquals("Failed because of Incorrect header text - ", "Test Suite", qsw_temp.getText()); + back.push(); + + // Repeating the above process for 2 more times for the remaining 2 radio + // buttons on the main QS wizard dialog. + qsw_temp = new JTextFieldOperator(quickstart, 0); + assertEquals("Failed because of Incorrect header text - ", "Welcome to the JT Harness!", qsw_temp.getText()); + + qsw_check = new JRadioButtonOperator(quickstart, 1); + qsw_check.push(); + + next.push(); + qsw_temp = new JTextFieldOperator(quickstart, 0); + assertEquals("Failed because of Incorrect header text - ", "Work Directory", qsw_temp.getText()); + + back.push(); + qsw_temp = new JTextFieldOperator(quickstart, 0); + assertEquals("Failed because of Incorrect header text - ", "Welcome to the JT Harness!", qsw_temp.getText()); + + qsw_check = new JRadioButtonOperator(quickstart, 2); + qsw_check.push(); + next.push(); + qsw_temp = new JTextFieldOperator(quickstart, 0); + assertEquals("Failed because of Incorrect header text - ", "Test Suite", qsw_temp.getText()); + + back.push(); + qsw_temp = new JTextFieldOperator(quickstart, 0); + assertEquals("Failed because of Incorrect header text - ", "Welcome to the JT Harness!", qsw_temp.getText()); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW2.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW2.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW2.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW2.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,110 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import static org.junit.Assert.fail; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JCheckBoxOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JRadioButtonOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +public class Test_QSW2 extends Config_New { + // This test case checks if Quick Start wizard Opens up configuration editor. + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Sanity_Tests.Test_QSW2"); + } + + @Test + public void test() { + // Selecting the quick start dialog box and checking the header. + JDialogOperator quickstart = new JDialogOperator(getExecResource("qsw.title")); + + // Selecting the next and back buttons. + JButtonOperator next = new JButtonOperator(quickstart, 1); + + // Selecting the checkbox named 'start a new run'. + JRadioButtonOperator qsw_check = new JRadioButtonOperator(quickstart, 0); + qsw_check.push(); + next.push(); + + // pressing browse button. + JButtonOperator browse = new JButtonOperator(quickstart, 0); + browse.push(); + + // Selecting Test suite to open. + JDialogOperator opentestdialog = new JDialogOperator(getToolResource("tsc.title")); + new JTextFieldOperator(opentestdialog, "").enterText("demots"); + next.push(); + + // Selecting the configuration template radio button and then selecting the + // configuration file. + JRadioButtonOperator test = new JRadioButtonOperator(quickstart, 0); + test.push(); + next.push(); + browse = new JButtonOperator(quickstart, 0); + browse.push(); + JDialogOperator createworkdialog = new JDialogOperator(getToolResource("wdc.new.title")); + new JTextFieldOperator(createworkdialog, "").enterText("temp_qsw_dir1"); + next.push(); + + // Selecting and testing check box function. + JCheckBoxOperator start_ce = new JCheckBoxOperator(quickstart, 0); + JCheckBoxOperator start_test = new JCheckBoxOperator(quickstart, 1); + + if (!start_ce.isSelected()) { + fail("Expected: Start configuration Editor check box should be selected by default. \nActual: Start configuration Editor check box not selected by default."); + } + + start_ce.push(); + start_test.push(); + + if (start_test.isSelected() && !start_ce.isSelected()) { + fail("Expected: Start test run checkbox should not select without Start configuration Editor check box being set. \nActual: Start test run checkbox is selected without start config editor check box being set."); + } + + // Pressing finish button. + start_test.push(); + JButtonOperator finish = new JButtonOperator(quickstart, 2); + finish.push(); + + if (quickstart.isVisible()) { + fail("Expected: Quick Start Wizard should not visible after clicking on finish button. \nActual: Quick Start Wizard is still visible even after clicking on finish."); + } + + // Waiting for the configuration editor to open up. + JDialogOperator config_editor = new JDialogOperator(getExecResource("ce.name")); + + if (!config_editor.isVisible()) { + fail("Expected: Configuration Editor should visible after closing Quick Start Wizard. \nActual: Configuration Editor is not visible after closing Quick Start Wizard."); + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW3.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW3.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW3.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Sanity_Tests/Test_QSW3.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,139 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.Sanity_Tests; + +import static org.junit.Assert.assertTrue; +import static org.junit.Assert.fail; + +import java.nio.file.Path; +import java.nio.file.Paths; + +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JCheckBoxOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JRadioButtonOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; +import org.netbeans.jemmy.util.NameComponentChooser; + +public class Test_QSW3 extends Config_New { + // This test case checks if Quick Start wizard starts running test when start + // test check box is clicked and a valid configuration file is loaded. + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.Sanity_Tests.Test_QSW3"); + } + + @Test + public void test() throws InterruptedException { + // Selecting the quick start dialog box and checking the header. + JDialogOperator quickstart = new JDialogOperator(getExecResource("qsw.title")); + + // Selecting the next and back buttons. + JButtonOperator next = new JButtonOperator(quickstart, 1); + + // Selecting the checkbox named 'start a new run'. + JRadioButtonOperator qsw_check = new JRadioButtonOperator(quickstart, 0); + qsw_check.push(); + next.push(); + + // pressing browse button. + JButtonOperator browse = new JButtonOperator(quickstart, 0); + browse.push(); + + // Selecting Test suite to open. + JDialogOperator opentestdialog = new JDialogOperator(getToolResource("tsc.title")); + new JTextFieldOperator(opentestdialog, "").enterText("demots"); + next.push(); + + // Selecting the configuration template radio button and then selecting the + // configuration file. + JRadioButtonOperator test = new JRadioButtonOperator(quickstart, 1); + test.push(); + + Path p = Paths.get("democonfig.jti"); + String configfile = p.toAbsolutePath().toString(); + System.out.println(configfile); + + browse = new JButtonOperator(quickstart, 0); + browse.push(); + JDialogOperator loadconfig = new JDialogOperator(getExecResource("ce.load.title")); + new JTextFieldOperator(loadconfig, "").enterText(configfile); + next.push(); + + // Creating directory. + browse = new JButtonOperator(quickstart, 0); + browse.push(); + JDialogOperator createworkdialog = new JDialogOperator(getToolResource("wdc.new.title")); + new JTextFieldOperator(createworkdialog, "").enterText("temp_qsw_dir7"); + next.push(); + + // Selecting and testing check box function. + JCheckBoxOperator start_ce = new JCheckBoxOperator(quickstart, 0); + JCheckBoxOperator start_test = new JCheckBoxOperator(quickstart, 1); + + if (!start_ce.isSelected()) { + fail("Expected: Start configuration Editor check box should be selected by default. \nActual: Start configuration Editor check box is not selected by default."); + } + + start_ce.push(); + start_test.push(); + + if (start_test.isSelected() && start_ce.isSelected()) { + fail("Expected: Selecting Start test run checkbox should not select Start configuration Editor checkbox. \nActual: Selecting Start test run checkbox has selected Start configuration Editor checkbox."); + } + + JButtonOperator finish = new JButtonOperator(quickstart, 2); + finish.push(); + + if (quickstart.isVisible()) { + fail("Expected: Quick Start Wizard should not visible after clicking on finish button. \nActual: Quick Start Wizard is still visible even after clicking on finish button."); + } + + // Check that tests started performing. + JTextFieldOperator strip = new JTextFieldOperator(mainFrame, new NameComponentChooser("strip.msg")); + int time = 0; + + // Waiting for Execution of tests to finish. + while (time < 60) { + if (strip.getText().startsWith("Finished")) { + break; + } else if (!strip.getText().startsWith("Running")) { + fail("Expected: message starting with 'Running' has to be displayed in the strip message field. \nActual: wrong message " + + strip.getText() + "is displayed in the strip message field."); + } else { + // Sleeping for one second if message in strip starts with 'Running'. + Thread.sleep(1000); + } + } + + assertTrue("Expected: tests should run successfully. \nActual: Error while tests are running.", + strip.getText().startsWith("Finished")); + + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Test.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Test.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Test.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Test.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,401 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest; + +import jthtest.tools.JTFrame; +import jthtest.tools.Task.Waiter; +import org.netbeans.jemmy.JemmyException; + +import java.io.*; +import java.security.Permission; +import java.util.Arrays; +import java.util.LinkedList; + +public abstract class Test { + + public static final String TEMP_WD_NAME = "javatest_guitest_demowd"; + public static final String DEFAULT_WD_NAME = "demowd_config"; + public static final String WD_RUN_NAME = "demowd_run"; + public static final String TEST_SUITE_NAME = "demots"; + public static final String TESTCASES_TEST_SUITE_NAME = "demots_withtestcases"; + public static final String TEMPLATE_NAME = "demotemplate.jtm"; + public static final String REPORT_NAME = "demoreport"; + public static final String CONFIG_NAME = "democonfig.jti"; + public static final String TESTS_DIRECTORY_PREFIX = "tests" + File.separator; + public static final String NEWDESKTOP_ARG = "-newdesktop"; + public static final String WINDOWNAME = System.getProperty("jt_gui_test.name"); + public static final String TESTSUITENAME = "DemoTS 1.0 Test Suite (Tag Tests)"; + public static final String REPORT_WD_PATH = "demowd_run"; + public static final String KFL_NORMAL_PATH = "knownfailures.kfl"; + public static final String KFL_PASSED_PATH = "knownfailures_passed.kfl"; + public static final String KFL_MISSING_PATH = "knownfailures_missing.kfl"; + public static final String KFL_RECURSIVE_PATH = "knownfailures_recursive.kfl"; + public static final String KFL_TC_ALL_PATH = "kfl_tc_all.kfl"; + public static String TEMP_PATH; + public static String LOCAL_PATH; + public static String DEFAULT_PATH; + public static String USER_HOME_PATH; + public static boolean showWarnings = true; + public static boolean ignoreDepricated = true; + public static boolean notrunKnownFail = false; + public static boolean overrideKnownFail = false; + + static { + String temp = System.getProperty("user.dir") + File.separator; + if (temp == null || "".equals(temp)) { + File tmp = new File(""); + temp = tmp.getAbsolutePath(); + } + DEFAULT_PATH = LOCAL_PATH = temp; + + TEMP_PATH = temp + File.separator + "temp"; + + USER_HOME_PATH = System.getProperty("user.home") + File.separator; + + showWarnings = getBooleanProperty("jt_gui_test.showWarnings"); + ignoreDepricated = getBooleanProperty("jt_gui_test.ignoreDepricated"); + notrunKnownFail = getBooleanProperty("jt_gui_test.not_run_knownfail"); + overrideKnownFail = getBooleanProperty("jt_gui_test.override_knownfail"); + } + + protected final StringWriter OUT = new StringWriter(); + protected final StringWriter ERR = new StringWriter(); + private final PrintStream ST_OUT = System.out; + private final PrintStream ST_ERR = System.err; + public int maxTime = 600000; // 10 minutes + public int step = 1000; + public int t = 0; + public boolean isWorkReady = false; + protected LinkedList<String> errors; + protected LinkedList<String> warnings; + protected LinkedList<File> usedFiles; + protected boolean depricated = false; + protected boolean knownFail = false; + protected boolean catchAnyExceptions = false; + protected JTFrame mainFrame; + protected LinkedList<File> toCopyFiles; + + public Test() { + System.setOut(new PrintStream(new java.io.OutputStream() { + + @Override + public void write(int b) throws IOException { + OUT.write(b); + ST_OUT.write(b); + } + })); + System.setErr(new PrintStream(new java.io.OutputStream() { + + @Override + public void write(int b) throws IOException { + ERR.write(b); + ST_ERR.write(b); + } + })); + + warnings = new LinkedList<String>(); + errors = new LinkedList<String>(); + usedFiles = new LinkedList<File>(); + toCopyFiles = new LinkedList<File>(); + toCopyFiles.add(new File(DEFAULT_WD_NAME)); + toCopyFiles.add(new File(TEST_SUITE_NAME)); + toCopyFiles.add(new File(CONFIG_NAME)); + toCopyFiles.add(new File(REPORT_WD_PATH)); + toCopyFiles.add(new File(ConfigTools.SECOND_CONFIG_NAME)); + } + + public Test(File... files) { + errors = new LinkedList<String>(); + warnings = new LinkedList<String>(); + usedFiles = new LinkedList<File>(); + toCopyFiles = new LinkedList<File>(); + for (File f : files) { + toCopyFiles.add(f); + } + } + + public static void printBools() { + System.out.println("showWarnings " + showWarnings); + System.out.println("ignoreDepricated " + ignoreDepricated); + System.out.println("notrunKnownFail " + notrunKnownFail); + System.out.println("overrideKnownFail " + overrideKnownFail); + } + + private static boolean getBooleanProperty(String property) { + String prop = System.getProperty(property); +// System.out.println(property + " " + prop); + return prop != null && Boolean.parseBoolean(prop); + } + + public void addUsedFile(File f) { + usedFiles.add(f); + } + + public void addUsedFile(String f) { + usedFiles.add(new File(f)); + } + + public void addToCopyFile(String f) { + toCopyFiles.add(new File(f)); + } + + private String getErrorMessage() { + if (errors.isEmpty()) { + return ""; + } + StringBuilder builder = new StringBuilder("Failed: \n"); + for (String s : errors) { + builder.append(s).append("\n"); + } + String description = getDescription(); + if (description != null) { + builder.append("\n").append(description).append("\n"); + } + return builder.toString(); + } + + private void preTest() throws IOException { + File name = new File(TESTS_DIRECTORY_PREFIX + this.getClass().getSimpleName()); + if (name.exists()) { + Tools.deleteDirectory(name); + } + name.mkdirs(); + Tools.DEFAULT_PATH = Tools.USER_HOME_PATH = Tools.LOCAL_PATH = name.getAbsolutePath() + File.separator; + Tools.TEMP_PATH = name.getAbsolutePath() + File.separator + "temp" + File.separator; + DEFAULT_PATH = USER_HOME_PATH = LOCAL_PATH = name.getAbsolutePath() + File.separator; + TEMP_PATH = name.getAbsolutePath() + File.separator + "temp" + File.separator; + for (File f : toCopyFiles) { + Tools.copyDirectory(f, name); + } + } + + @org.junit.Test//(timeout=1200000) + public final void test() throws Throwable { +// printBools(); + if (!depricated || ignoreDepricated) { + Worker w = null; + try { + if (!knownFail || !notrunKnownFail) { + preTest(); + w = new Worker(); + Thread tr = new Thread(w); + tr.start(); + + t = 0; + while (t < maxTime && w.isWorking) { + try { + Thread.sleep(step); + t += step; + } catch (InterruptedException ex) { + } + } + + if (w.isWorking) { + tr.interrupt(); + errors.add("Test was interrupted. Waited " + t / 1000 + "s"); + throw new InterruptedException(); + } + } + } finally { + System.setOut(ST_OUT); + System.setErr(ST_ERR); + String outString = OUT.getBuffer().toString(); + + BufferedReader readOut = new BufferedReader(new StringReader(outString)); + String line; + LinkedList<String> exceptions = new LinkedList<String>(); + boolean outCatch = false; + while ((line = readOut.readLine()) != null) { + if (line.contains("Exception in thread")) { + outCatch = true; + exceptions.add(line); + } + } + readOut.close(); + String errString = ERR.getBuffer().toString(); + + readOut = new BufferedReader(new StringReader(errString)); + boolean errCatch = false; + while ((line = readOut.readLine()) != null) { + if (line.contains("Exception in thread")) { + errCatch = true; + exceptions.add(line); + } + } + + if (catchAnyExceptions && !exceptions.isEmpty()) { + errors.add("JavaTest threw exceptions in system output:\n" + Arrays.toString(exceptions.toArray(new String[exceptions.size()]))); + if (outCatch) { + System.out.println(outString); + } + if (errCatch) { + System.out.println(errString); + } + } + + try { + Waiter releaser = new Waiter(20000) { // 20 seconds to remove temp files and close JT + + @Override + protected boolean check() { + return true; + } + }; + releaseResources(w.error == null); // if passed - delete test directory forcely + releaser.stopWaiter(); + } catch (Exception e) { + warnings.add("Timeout exception while releasing resources. " + e.getMessage()); + } + + if (knownFail && !overrideKnownFail) { + if (w != null && w.error != null) { + warnings.add("Test is failed but is marked as known failure. Exception: " + w.error.getMessage()); + } else if (!errors.isEmpty()) { + warnings.add("Test is failed but is marked as known failure. Errors: " + getErrorMessage()); + } else { + warnings.add("Test is passed but is marked as known failure"); + } + if (showWarnings) { + showWarnings(); + } + } else { + if (showWarnings) { + showWarnings(); + } + + if (!errors.isEmpty() || (w != null && w.error != null)) { + JemmyException ex; + if (w != null && w.error != null) { + ex = new JemmyException(getErrorMessage(), w.error); + } else { + ex = new JemmyException(getErrorMessage()); + } + throw ex; + } + } + } + } else { + System.out.println("Test is depticated. Marking as Passed. "); + } + } + + private void showWarnings() { + if (!warnings.isEmpty() && showWarnings) { + System.out.println("Warnings: "); + for (String s : warnings) { + System.out.println(s); + } + } + } + + public abstract void testImpl() throws Exception; + + public String getDescription() { + return null; + } + + public void releaseImpl() throws Exception { + } + + private void releaseResources(boolean force) { + try { + releaseImpl(); + if (mainFrame != null && mainFrame.getJFrameOperator().isVisible()) { + mainFrame.closeAllTools(); + mainFrame.closeFrame(); + } + } catch (Exception e) { + } + for (File f : usedFiles) { + try { + if (f.exists()) { + if (f.isDirectory()) { + Tools.deleteDirectory(f); + } else if (f.isFile()) { + f.delete(); + } + if (f.exists()) { + System.err.println("Temporary file " + f.getAbsolutePath() + " was not removed. Please remove it manualy."); + } + } + } catch (Exception e) { + } + } + if (force && LOCAL_PATH.contains(TESTS_DIRECTORY_PREFIX + this.getClass().getSimpleName())) { + Tools.deleteDirectory(LOCAL_PATH); + } + } + + @org.junit.Before + public void setUp() { + System.setSecurityManager(new ExceptionOnExitSecurityManager()); + } + + @org.junit.After + public void tearDown() { + System.setSecurityManager(null); + } + + public static class ExitException extends SecurityException { + } + + public static class ExceptionOnExitSecurityManager extends SecurityManager { + + @Override + public void checkPermission(Permission perm) { + } + + @Override + public void checkPermission(Permission perm, Object context) { + } + + @Override + public void checkExit(int status) { + super.checkExit(status); + throw new ExitException(); + } + } + + private class Worker implements Runnable { + + public Throwable error = null; + public boolean isWorking = true; + + @Override + public void run() { + try { + testImpl(); + } catch (ExitException ex) { + } catch (Throwable ex) { + this.error = ex; + } + isWorking = false; + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/ConfigDialog.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/ConfigDialog.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/ConfigDialog.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/ConfigDialog.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,847 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package jthtest.tools; + +import com.sun.interview.wizard.selectiontree.SelectionTree; +import jthtest.Tools; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.QueueTool; +import org.netbeans.jemmy.operators.*; + +import javax.swing.*; +import java.awt.*; +import java.awt.event.MouseEvent; +import java.io.File; + +public class ConfigDialog { + + public static final String DONE_BUTTON = "Done"; + public static final String NEXT_BUTTON = "Next"; + public static final String PREV_BUTTON = "Back"; + public static final String LAST_BUTTON = "Last"; + public static final String CONFIG_LOADER_DIALOG_NAME_EI18N = "wdc.loadconfig"; + public static final String CONFIG_LOADER_LOAD_BUTTON_NAME_EI18N = "wdc.load.btn"; + public static final String CONFIG_LOADER_CONFIG_LOCATION_DIALOG_EI18N = "wdc.configchoosertitle"; + public static final String CONFIG_LOADER_BROWSE_BUTTON = "Browse"; + public static final String CONFIG_EDITOR_DIALOG_NAME_EI18N = "ce.name"; + public static final String SAVE_CONFIG_FILE_DIALOG_NAME_EI18N = "ce.save.title"; + public static final String CONFIG_CONFIRN_CLOSE_DIALOG_NAME_EI18N = "ce.okToClose.title"; + public static final String MENU_FILE_CLOSE_NAME_EI18N = "ce.file.close.mit"; + public static final String MENU_FILE_SAVE_NAME_EI18N = "ce.file.save.mit"; + public static final String MENU_FILE_NEW_NAME_EI18N = "ce.file.new.mit"; + public static final String MENU_FILE_NAME_EI18N = "ce.file.menu"; + public static final String MENU_FILE_LOAD_NAME_EI18N = "ce.file.load.mit"; + public static final String MENU_FILE_LOAD_RECENT_NAME_EI18N = "ce.history.menu"; + public static final String BOOKMARKS_MENU_NAME_EI18N = "ct.markers.ckb"; + public static final String BOOKMARKS_MENU_NAME = "Bookmarks"; + public static final String BOOKMARKS__SHOW_ONLY_BOOKMARKED_MENU_NAME = "Show Only Bookmarked Questions"; + public static final String BOOKMARKS__MARK_CURRENT_QUESTION_MENU_NAME = "Mark Current Question"; + public static final String BOOKMARKS__UNMARK_CURRENT_QUESTION_MENU_NAME = "Unmark Current Question"; + public static final String BOOKMARKS__CLOSE_HIDDEN_GROUP = "Close \". . .\" Group"; + public static final String BOOKMARKS__OPEN_HIDDEN_GROUP_MENU_NAME = "Open \". . .\" Group"; + public static final String BOOKMARKS__CLEAR_ANSWER_FOR_CURRENT_MENU_NAME = "Clear Answer For Current Question"; + public static final String BOOKMARKS__CLEAR_ANSWER_TO_BOOKMARKED_QUESTIONS_MENU_NAME = "Clear Answers to Bookmarked Questions"; + private JDialogOperator configDialog; + private JTFrame mainFrame; + private JListOperator _list = null; + + ConfigDialog(JTFrame mainFrame) { + this.mainFrame = mainFrame; + configDialog = new JDialogOperator(mainFrame.getJFrameOperator(), getConfigEditorDialogName()); + } + + public static String getConfigEditorDialogName() { + return Tools.getExecResource(CONFIG_EDITOR_DIALOG_NAME_EI18N); + } + + public static String getSaveConfigurationDialogName() { + return Tools.getExecResource(SAVE_CONFIG_FILE_DIALOG_NAME_EI18N); + } + + public static String getConfirmCloseIncomleteConfigurationDialogName() { + return Tools.getExecResource(CONFIG_CONFIRN_CLOSE_DIALOG_NAME_EI18N); + } + + public static String getBookmarks_EnableBookmarksMenuName() { + return Tools.getExecResource(BOOKMARKS_MENU_NAME_EI18N); + } + + public static String getLoadConfigurationDialogName() { + return Tools.getExecResource(CONFIG_LOADER_DIALOG_NAME_EI18N); + } + + public static String getConfigLocationDialogName() { + return Tools.getExecResource(CONFIG_LOADER_CONFIG_LOCATION_DIALOG_EI18N); + } + + public static String getConfigLoaderLoadButtonName() { + return Tools.getExecResource(CONFIG_LOADER_LOAD_BUTTON_NAME_EI18N); + } + + public static String getFileMenuName() { + return Tools.getExecResource(MENU_FILE_NAME_EI18N); + } + + public static String getFile_SaveMenuName() { + return Tools.getExecResource(MENU_FILE_SAVE_NAME_EI18N); + } + + public static String getFile_NewMenuName() { + return Tools.getExecResource(MENU_FILE_NEW_NAME_EI18N); + } + + public static String getFile_CloseMenuName() { + return Tools.getExecResource(MENU_FILE_CLOSE_NAME_EI18N); + } + + public static String getFile_LoadConfigurationMenuName() { + return Tools.getExecResource(MENU_FILE_LOAD_NAME_EI18N); + } + + public static String getFile_LoadRecentConfigurationMenuName() { + return Tools.getExecResource(MENU_FILE_LOAD_RECENT_NAME_EI18N); + } + + public JButtonOperator getBackButton() { + return new JButtonOperator(configDialog, PREV_BUTTON); + } + + public JListOperator getJListOperator() { + if (_list == null) + _list = new JListOperator(configDialog); + return _list; + } + + public void refindList() { + _list = null; + } + + public ConfigurationBrowser openBrowser(boolean block) { + if (block) { + getFile_LoadConfigurationMenu().push(); + } else { + getFile_LoadConfigurationMenu().pushNoBlock(); + } + + return ConfigurationBrowser.open(); + } + + public void load(String name, boolean block) { + load(Tools.DEFAULT_PATH, name, block); + } + + public void load(String path, String name, boolean block) { + ConfigurationBrowser browser = openBrowser(block); + browser.setPath(path + File.separator + name); + browser.commit(); + } + + public void pushDoneConfigEditor() { + new JButtonOperator(configDialog, DONE_BUTTON).push(); + } + + public void pushNextConfigEditor() { + new JButtonOperator(configDialog, NEXT_BUTTON).push(); + } + + public void pushBackConfigEditor() { + getBackButton().push(); + } + + public void pushLastConfigEditor() { + new JButtonOperator(configDialog, LAST_BUTTON).push(); + } + + public void selectQuestion(int index) { + getJListOperator().selectItem(index); + } + + public void saveConfig(String name) { + getFile_SaveMenu().pushNoBlock(); + JDialogOperator saving = new JDialogOperator(getSaveConfigurationDialogName()); + + JTextFieldOperator tf; + + tf = new JTextFieldOperator((JTextField) Tools.getComponent(saving, new String[]{"Folder name:", "File name:", "Folder Name:", "File Name:"})); + tf.enterText(name); + } + + public boolean isFullConfiguration() { + JListOperator list = getJListOperator(); + return ((JLabel) list.getRenderedComponent(list.getModel().getSize() - 1)).getText().equals(" Congratulations!"); + } + + public void closeByMenu() { + _list = null; + getFile_CloseMenu().push(); + } + + public void setBookmarkedByMenu(int index) { + getJListOperator().selectItem(index); + getBookmarks_MarkCurrentQuestion_Menu().push(); + } + + public JMenuItemOperator getBookmarks_ShowOnlyBookmarkedMenu() { + return getMenu().showMenuItem(new String[]{BOOKMARKS_MENU_NAME, BOOKMARKS__SHOW_ONLY_BOOKMARKED_MENU_NAME}); + } + + public JMenuItemOperator getBookmarks_MarkCurrentQuestion_Menu() { + return getMenu().showMenuItem(new String[]{BOOKMARKS_MENU_NAME, BOOKMARKS__MARK_CURRENT_QUESTION_MENU_NAME}); + } + + public JMenuItemOperator getBookmarks_UnmarkCurrentQuestion_Menu() { + return getMenu().showMenuItem(new String[]{BOOKMARKS_MENU_NAME, BOOKMARKS__UNMARK_CURRENT_QUESTION_MENU_NAME}); + } + + public JMenuItemOperator getBookmarksMenu() { + return getMenu().showMenuItem(new String[]{BOOKMARKS_MENU_NAME}); + } + + public void unsetBookmarkedByMenu(int index) { + getJListOperator().selectItem(index); + getBookmarks_UnmarkCurrentQuestion_Menu().push(); + } + + public void setBookmarkedByMenu(int[] indexes) { + JMenuItemOperator markQuestionMenu = null; + String[] menuPath = new String[]{"Bookmarks", "Mark Current Question"}; + JListOperator list = getJListOperator(); + for (int index : indexes) { + list.selectItem(index); + if (markQuestionMenu == null) + markQuestionMenu = getBookmarks_MarkCurrentQuestion_Menu(); + markQuestionMenu.push(); + } + } + + public void setBookmarkedByPopup(int[] indexes) { + for (int index : indexes) + setBookmarkedByPopup(index); + } + + public void setBookmarkedByMouse(int index) { + JListOperatorExt list = new JListOperatorExt(configDialog); + list.clickOnItem(index, 1, MouseEvent.BUTTON1_MASK, 6); + } + + public void setBookmarkedByPopup(int index) { + JListOperatorExt list = new JListOperatorExt(configDialog); + list.clickOnItem(index, 1); + if (list.clickOnItem(index, 1, MouseEvent.BUTTON3_MASK) == null) { + throw new JemmyException("Error occured while clicking on " + index + " item of list " + list); + } + new JPopupMenuOperator(configDialog).pushMenu("Mark Current Question"); + } + + public void clickBookmarkedByMouse(int index) { + JListOperatorExt list = new JListOperatorExt(configDialog); + list.clickOnItem(index, 1); + if (list.clickOnItem(index, 1, MouseEvent.BUTTON3_MASK) == null) { + throw new JemmyException("Error occured while clicking on " + index + " item of list " + list); + } + new JPopupMenuOperator(configDialog).pushMenu("Mark Current Question"); + } + + public void unsetBookmarkedByPopup(int index) { + JListOperatorExt list = new JListOperatorExt(configDialog); + list.clickOnItem(index, 1); + if (list.clickOnItem(index, 1, MouseEvent.BUTTON3_MASK) == null) { + throw new JemmyException("Error occured while clicking on " + index + " item of list " + list); + } + new JPopupMenuOperator(configDialog).pushMenu("Unmark Current Question"); + } + + public void clearByPopup(int index) { + JListOperatorExt list = new JListOperatorExt(configDialog); + getJListOperator().selectItem(index); + if (list.clickOnItem(index, 1, MouseEvent.BUTTON3_MASK) == null) { + throw new JemmyException("Error occured while clicking on " + index + " item of list " + list); + } + new JPopupMenuOperator(configDialog).pushMenu("Clear Answer For Current Question"); + } + + public int[] checkVisibility(String[] names) { + JListOperator list = getJListOperator(); + + int marks[] = new int[names.length]; + for (int mark : marks) { + mark = -1; + } + for (int i = 0; i < list.getModel().getSize(); i++) { + String text = ((JLabel) list.getRenderedComponent(i)).getText(); + if (text != null) { + for (int j = 0; j < names.length; j++) { + if (text.equals(names[j])) { + marks[j] = i; + } + } + } + } + + for (int i = 0; i < marks.length; i++) { + if (marks[i] == -1) { + throw new JemmyException("Element with name '" + names[i] + "' wasn't found"); + } + } + + return marks; + } + + public void checkVisibilityAll(String[] names) { + JListOperator list = getJListOperator(); + for (int i = 0; i < list.getModel().getSize(); i++) { + String text = ((JLabel) list.getRenderedComponent(i)).getText(); + if (text == null) { + throw new JemmyException("Element N" + i + " hasn't any name while expected '" + names[i] + "'"); + } + if (!text.equals(names[i])) { + throw new JemmyException("Element N" + i + " has name '" + list.getRenderedComponent(i).getName() + "' while expected '" + names[i] + "'"); + } + } + } + + public void checkHiddenGroups(int[] indexes, String[] names) { + JListOperator list = getJListOperator(); + + if (indexes.length > 0) { + int temp = 0; + + for (int i = 0; i < indexes.length; i++) { + if (indexes[i] - temp > 1) { + if (((JLabel) list.getRenderedComponent(indexes[i] - 1)).getText() != null) { + throw new JemmyException("element " + (indexes[i] - 1) + " isn't '...'"); + } + } + temp = indexes[i]; + } + } + } + + public void pushOpenHiddenGroupByMouse(int index) { + JListOperatorExt list = new JListOperatorExt(configDialog); + list.clickOnItem(index, 1); + if (list.clickOnItem(index, 2, MouseEvent.BUTTON1_MASK) == null) { + throw new JemmyException("Error occured while clicking on " + index + " item of list " + list); + } + } + + private void pushOpenHiddenGroupByMenu() { + getBookmarks_OpenHiddenGroupMenu().push(); + } + + public JMenuItemOperator getBookmarks_OpenHiddenGroupMenu() { + return getMenu().showMenuItem(new String[]{BOOKMARKS_MENU_NAME, BOOKMARKS__OPEN_HIDDEN_GROUP_MENU_NAME}); + } + + public void openGroupByMenu(String[] namesAll, String[] namesHidden) { + JListOperator list = getJListOperator(); + + int i; + for (i = 0; i < list.getModel().getSize(); i++) { + if (((JLabel) list.getRenderedComponent(i)).getText() == null) { + break; + } + } + + list.selectItem(i); + pushOpenHiddenGroupByMenu(); + + for (int j = i; j < list.getModel().getSize(); j++) { + String text = ((JLabel) list.getRenderedComponent(j)).getText(); + if (!(text.equals(namesAll[j]))) { + throw new JemmyException("Element " + j + " is '" + text + "' after opening '...' group while expected '" + namesAll[j] + "'"); + } + if (text.equals(namesHidden[i + 1])) { + break; + } + } + } + + public void openGroupByMouse(String[] namesAll, String[] namesHidden) { + JListOperator list = getJListOperator(); + + int i; + for (i = 0; i < list.getModel().getSize(); i++) { + if (((JLabel) list.getRenderedComponent(i)).getText() == null) { + break; + } + } + + pushOpenHiddenGroupByMouse(i); + + for (int j = i; j < list.getModel().getSize(); j++) { + String text = ((JLabel) list.getRenderedComponent(j)).getText(); + if (!(text.equals(namesAll[j]))) { + throw new JemmyException("Element " + j + " is '" + text + "' after opening '...' group while expected '" + namesAll[j] + "'"); + } + if (text.equals(namesHidden[i + 1])) { + break; + } + } + } + + public void pushOpenHiddenGroupByPopup(int index) { + JListOperatorExt list = new JListOperatorExt(configDialog); + list.clickOnItem(index, 1); + if (list.clickOnItem(index, 1, MouseEvent.BUTTON3_MASK) == null) { + throw new JemmyException("Error occured while clicking on " + index + " item of list " + list); + } + new JPopupMenuOperator(configDialog).pushMenu("Open \". . .\" Group"); + } + + public void openGroupByPopup(String[] namesAll, String[] namesHidden) { + JListOperator list = getJListOperator(); + + int i; + for (i = 0; i < list.getModel().getSize(); i++) { + if (((JLabel) list.getRenderedComponent(i)).getText() == null) { + break; + } + } + + pushOpenHiddenGroupByPopup(i); + + for (int j = i; j < list.getModel().getSize(); j++) { + String text = ((JLabel) list.getRenderedComponent(j)).getText(); + if (!(text.equals(namesAll[j]))) { + throw new JemmyException("Element " + j + " is '" + text + "' after opening '...' group while expected '" + namesAll[j] + "'"); + } + if (text.equals(namesHidden[i + 1])) { + break; + } + } + + } + + public JMenuItemOperator getBookmarks_CloseHiddenGroupMenu() { + return getMenu().showMenuItem(new String[]{BOOKMARKS_MENU_NAME, BOOKMARKS__CLOSE_HIDDEN_GROUP}); + } + + public void pushCloseGroupByMenu() { + getBookmarks_CloseHiddenGroupMenu().push(); + } + + public void closeGroupByMenu(String[] namesAll, String[] namesHidden) { + JListOperator list = getJListOperator(); + + int i; + for (i = 0; i < namesHidden.length; i++) { + if (namesHidden[i] == null) { + break; + } + } + + list.selectItem(i); + pushCloseGroupByMenu(); + + if (((JLabel) list.getRenderedComponent(i)).getText() != null) { + throw new JemmyException("Element " + i + " isn't '...' after closing"); + } + if (!(((JLabel) list.getRenderedComponent(i + 1)).getText().equals(namesHidden[i + 1]))) { + throw new JemmyException("Element " + (i + 1) + " isn't " + namesHidden[i + 1] + " after closing"); + } + } + + public void pushCloseByPopup(int index) { + JListOperatorExt list = new JListOperatorExt(configDialog); + list.clickOnItem(index, 1); + if (list.clickOnItem(index, 1, MouseEvent.BUTTON3_MASK) == null) { + throw new JemmyException("Error occured while clicking on " + index + " item of list " + list); + } + new JPopupMenuOperator(configDialog).pushMenu("Close \". . .\" Group"); + } + + public void closeGroupByPopup(String[] namesAll, String[] namesHidden) { + JListOperator list = getJListOperator(); + + int i; + for (i = 0; i < namesHidden.length; i++) { + if (namesHidden[i] == null) { + break; + } + } + + pushCloseByPopup(i); + + if (((JLabel) list.getRenderedComponent(i)).getText() != null) { + throw new JemmyException("Element " + i + " isn't '...' after closing"); + } + if (!(((JLabel) list.getRenderedComponent(i + 1)).getText().equals(namesHidden[i + 1]))) { + throw new JemmyException("Element " + (i + 1) + " isn't " + namesHidden[i + 1] + " after closing"); + } + } + + public void pushCloseHiddenGroupByMouse(int index) { + JListOperatorExt list = new JListOperatorExt(configDialog); + list.clickOnItem(index, 1); + if (list.clickOnItem(index, 2, MouseEvent.BUTTON1_MASK) == null) { + throw new JemmyException("Error occured while clicking on " + index + " item of list " + list); + } + } + + public void closeGroupByMouse(String[] namesAll, String[] namesHidden) { + JListOperator list = getJListOperator(); + + int i; + for (i = 0; i < namesHidden.length; i++) { + if (namesHidden[i] == null) { + break; + } + } + + pushCloseHiddenGroupByMouse(i); + + if (((JLabel) list.getRenderedComponent(i)).getText() != null) { + throw new JemmyException("Element " + i + " isn't '...' after closing"); + } + if (!(((JLabel) list.getRenderedComponent(i + 1)).getText().equals(namesHidden[i + 1]))) { + throw new JemmyException("Element " + (i + 1) + " isn't " + namesHidden[i + 1] + " after closing"); + } + } + + public boolean checkBookmarked(int index) { + JListOperator list = getJListOperator(); + return ((JLabel) list.getRenderedComponent(index)).getIcon() != null; + } + + public JMenuItemOperator getBookmarks_ClearAnswerForCurrentQuestionMenu() { + return getMenu().showMenuItem(new String[]{BOOKMARKS_MENU_NAME, BOOKMARKS__CLEAR_ANSWER_FOR_CURRENT_MENU_NAME}); + } + + public JMenuItemOperator getBookmarks_ClearAnswerToBookmarkedQuestionsMenu() { + return getMenu().showMenuItem(new String[]{BOOKMARKS_MENU_NAME, BOOKMARKS__CLEAR_ANSWER_TO_BOOKMARKED_QUESTIONS_MENU_NAME}); + } + + public void clearByMenu(int index) { + getJListOperator().selectItem(index); + getBookmarks_ClearAnswerForCurrentQuestionMenu().push(); + } + + public Icon getIcon(int index) { + Icon icon = ((JLabel) getJListOperator().getRenderedComponent(index)).getIcon(); + return icon; + } + + public boolean isSelectedIndex(int i) { + return getJListOperator().isSelectedIndex(i); + } + + public int getSelectedQuestionNumber() { + return getJListOperator().getSelectedIndex(); + } + + public QuestionTree getQuestionTree() { + String[] names = getElementsNames(); + int index = -1; + for (int i = 0; i < names.length; i++) { + if ("Specify Tests to Run?".equals(names[i].trim())) { + index = i; + break; + } + } + if (index < 0) { + throw new RuntimeException("Error: 'Specify Tests to Run?' question was not found, can't execute test"); + } + + selectQuestion(index); + JRadioButtonOperator rb = new JRadioButtonOperator(getConfigDialog()); + rb.push(); + pushNextConfigEditor(); + pushNextConfigEditor(); + + return new QuestionTree(configDialog); + } + + public JDialogOperator getConfigDialog() { + return configDialog; + } + + public JMenuBarOperator getMenu() { + return new JMenuBarOperator(configDialog); + } + + public JMenuItemOperator getFile_SaveMenu() { + return getMenu().showMenuItem(new String[]{getFileMenuName(), getFile_SaveMenuName()}); + } + + public JMenuItemOperator getFile_CloseMenu() { + return getMenu().showMenuItem(new String[]{getFileMenuName(), getFile_CloseMenuName()}); + } + + public JMenuItemOperator getFile_NewConfigurationMenu() { + return getMenu().showMenuItem(new String[]{getFileMenuName(), getFile_NewMenuName()}); + } + + public JMenuItemOperator getFile_LoadConfigurationMenu() { + return getMenu().showMenuItem(new String[]{getFileMenuName(), getFile_LoadConfigurationMenuName()}); + } + + public JMenuItemOperator getFile_LoadRecentConfigurationMenu() { + return getMenu().showMenuItem(new String[]{getFileMenuName(), getFile_LoadRecentConfigurationMenuName()}); + } + + public JMenuItemOperator[] getFile_LoadRecentConfiguration_subMenu() { + return getMenu().showMenuItems(new String[]{getFileMenuName(), getFile_LoadRecentConfigurationMenuName()}); + } + + public JMenuItemOperator getBookmarks_EnableBookmarks() { + return getMenu().showMenuItem(new String[]{"Bookmarks", getBookmarks_EnableBookmarksMenuName()}); + } + + public String[] getElementsNames() { + JListOperator list = getJListOperator(); + String temp[] = new String[list.getModel().getSize()]; + for (int i = 0; i < list.getModel().getSize(); i++) { + temp[i] = ((JLabel) list.getRenderedComponent(i)).getText(); + } + return temp; + } + + public String[] getElementsNames(int[] indexes) { + JListOperator list = getJListOperator(); + String temp[] = new String[indexes.length]; + for (int i = 0; i < indexes.length; i++) { + temp[i] = ((JLabel) list.getRenderedComponent(indexes[i])).getText(); + } + return temp; + } + + public static class JListOperatorExt extends JListOperator { + + public JListOperatorExt(ContainerOperator c) { + super(c); + } + + public Object clickOnItem(final int itemIndex, final int clickCount, final int mouseButton) { + if (itemIndex > getModel().getSize()) { + throw new JemmyException("bad index"); + } + scrollToItem(itemIndex); + + if (((JList) getSource()).getModel().getSize() <= itemIndex) { + return (null); + } + if (((JList) getSource()).getAutoscrolls()) { + ((JList) getSource()).ensureIndexIsVisible(itemIndex); + } + return (getQueueTool().invokeSmoothly(new QueueTool.QueueAction("Path selecting") { + + public Object launch() { + Rectangle rect = getCellBounds(itemIndex, itemIndex); + if (rect == null) { + return (null); + } + Point point = new Point((int) (rect.getX() + rect.getWidth() / 2), + (int) (rect.getY() + rect.getHeight() / 2)); + Object result = getModel().getElementAt(itemIndex); + clickMouse(point.x, point.y, clickCount, mouseButton); + return (result); + } + })); + } + + public Object clickOnItem(final int itemIndex, final int clickCount, final int mouseButton, final int x) { + if (itemIndex > getModel().getSize()) { + throw new JemmyException("bad index"); + } + scrollToItem(itemIndex); + + if (((JList) getSource()).getModel().getSize() <= itemIndex) { + return (null); + } + if (((JList) getSource()).getAutoscrolls()) { + ((JList) getSource()).ensureIndexIsVisible(itemIndex); + } + return (getQueueTool().invokeSmoothly(new QueueTool.QueueAction("Path selecting") { + + public Object launch() { + Rectangle rect = getCellBounds(itemIndex, itemIndex); + if (rect == null) { + return (null); + } + Point point = new Point((int) (rect.getX() + x == 0 ? rect.getWidth() / 2 : x), + (int) (rect.getY() + rect.getHeight() / 2)); + Object result = getModel().getElementAt(itemIndex); + clickMouse(point.x, point.y, clickCount, mouseButton); + return (result); + } + })); + } + } + + public class QuestionTree extends JTreeOperator { + + QuestionTree(JDialogOperator config) { + super(config); + } + + public void clickOnCheckbox(int row) { + Rectangle r = getRowBounds(row); + prepareToClickOnRow(row); + super.clickMouse((int) r.getX() + 6, (int) r.getY() + (int) (r.getHeight() / 2), 1, getDefaultMouseButton(), 0, false); +// Tools.pause(1); + } + + public void prepareToClickOnRow(int row) { + makeComponentVisible(); + scrollToRow(row); + makeVisible(getPathForRow(row)); + if (!isVisible(getPathForRow(row))) { + System.out.println("Error, row is not visible after prepairing. Index " + row + ", tree width " + getWidth()); + } + } + + public void clickOnCheckbox(int row, int count) { + Rectangle r = getRowBounds(row); + prepareToClickOnRow(row); + super.clickMouse((int) r.getX() + 6, (int) r.getY() + (int) (r.getHeight() / 2), count, getDefaultMouseButton(), 0, false); +// Tools.pause(1); + } + + public void clickOnCheckbox(int row, int x, int y, int count, int mouseButton, int modifier, boolean forPopup) { + Rectangle r = getRowBounds(row); + prepareToClickOnRow(row); + super.clickMouse((int) r.getX() + 6 + x, (int) r.getY() + (int) (r.getHeight() / 2) + y, count, mouseButton, modifier, forPopup); +// Tools.pause(1); + } + + public void clickOnRow(int row) { + Rectangle r = getRowBounds(row); + prepareToClickOnRow(row); + super.clickMouse((int) r.getX() + 14, (int) r.getY() + (int) (r.getHeight() / 2), 1, getDefaultMouseButton(), 0, false); +// Tools.pause(1); + } + + public void clickOnRow(int row, int count) { + Rectangle r = getRowBounds(row); + prepareToClickOnRow(row); + super.clickMouse((int) r.getX() + 14, (int) r.getY() + (int) (r.getHeight() / 2), count, getDefaultMouseButton(), 0, false); +// Tools.pause(1); + } + + public void clickOnRow(int row, int x, int y, int count, int mouseButton, int modifier, boolean forPopup) { + Rectangle r = getRowBounds(row); + prepareToClickOnRow(row); + super.clickMouse((int) r.getX() + 14 + x, (int) r.getY() + (int) (r.getHeight() / 2) + y, count, mouseButton, modifier, forPopup); +// Tools.pause(1); + } + + public void clickOnArrow(int row) { + boolean isNimbus = UIManager.getLookAndFeel().getClass().getSimpleName().equals("NimbusLookAndFeel"); + if (row > 0 || isNimbus) { + Rectangle r = getRowBounds(row); + prepareToClickOnRow(row); + if (isNimbus) { + super.clickMouse((int) r.getX() + 1, (int) r.getY() + (int) (r.getHeight() / 2), 1, getDefaultMouseButton(), 0, false); + } else { + super.clickMouse((int) r.getX() - 9, (int) r.getY() + (int) (r.getHeight() / 2), 1, getDefaultMouseButton(), 0, false); + } + } else { + System.out.println("WARNING: NimbusLAF is not installed. clickOnArrow method is not possible as there is no arrow on root element in MetalLAF. Using double-click on row"); + clickOnRow(row, 2); + } +// Tools.pause(1); + } + + public void clickOnArrow(int row, int count) { + boolean isNimbus = UIManager.getLookAndFeel().getClass().getSimpleName().equals("NimbusLookAndFeel"); + if (row > 0 || isNimbus) { + Rectangle r = getRowBounds(row); + prepareToClickOnRow(row); + if (isNimbus) { + super.clickMouse((int) r.getX() + 1, (int) r.getY() + (int) (r.getHeight() / 2), count, getDefaultMouseButton(), 0, false); + } else { + super.clickMouse((int) r.getX() - 9, (int) r.getY() + (int) (r.getHeight() / 2), count, getDefaultMouseButton(), 0, false); + } + } else { + System.out.println("WARNING: NimbusLAF is not installed. clickOnArrow method is not possible as there is no arrow on root element in MetalLAF. Using double-click on row"); + clickOnRow(row, 2); + } +// Tools.pause(1); + } + + public void clickOnArrow(int row, int x, int y, int count, int mouseButton, int modifier, boolean forPopup) { + boolean isNimbus = UIManager.getLookAndFeel().getClass().getSimpleName().equals("NimbusLookAndFeel"); + if (row > 0 || isNimbus) { + Rectangle r = getRowBounds(row); + prepareToClickOnRow(row); + if (isNimbus) { + super.clickMouse((int) r.getX() + 1 + x, (int) r.getY() + (int) (r.getHeight() / 2) + y, count, mouseButton, modifier, forPopup); + } else { + super.clickMouse((int) r.getX() - 9 + x, (int) r.getY() + (int) (r.getHeight() / 2) + y, count, mouseButton, modifier, forPopup); + } + } else { + System.out.println("WARNING: NimbusLAF is not installed. clickOnArrow method is not possible as there is no arrow on root element in MetalLAF. Using double-click on row"); + clickOnRow(row, 2); + } +// Tools.pause(1); + } + + public SelectionTree getTree() { + return (SelectionTree) super.getSource(); + } + + public PopupMenu openContextMenu(int row) { + if (row < 0) { + makeComponentVisible(); + Rectangle r = getRowBounds(0); + clickForPopup((int) r.getX() + (int) r.getWidth() + 1, 1); + return new PopupMenu(new JPopupMenuOperator()); + } else { + makeComponentVisible(); + scrollToRow(row); + clickOnRow(row, 0, 0, 1, getPopupMouseButton(), 0, true); + return new PopupMenu(new JPopupMenuOperator()); + } + } + + public class PopupMenu { + JPopupMenuOperator menu; + + PopupMenu(JPopupMenuOperator menu) { + this.menu = menu; + } + + public void pushSelectAll() { + menu.pushMenu("Select All"); + } + + public void pushDeselectAll() { + menu.pushMenu("Deselect All"); + } + + public void pushExpandAll() { + menu.pushMenu("Expand All"); + } + + public void pushCollapseAll() { + menu.pushMenu("Collapse All"); + } + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/ConfigurationBrowser.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/ConfigurationBrowser.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/ConfigurationBrowser.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/ConfigurationBrowser.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,83 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import jthtest.Tools; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +public class ConfigurationBrowser { + public static final String CONFIG_LOADER_DIALOG_NAME_EI18N = "wdc.loadconfig"; + public static final String CONFIG_LOADER_LOAD_BUTTON_NAME_EI18N = "wdc.load.btn"; + public static final String CONFIG_LOADER_CONFIG_LOCATION_DIALOG_EI18N = "wdc.configchoosertitle"; + public static final String CONFIG_LOADER_BROWSE_BUTTON = "Browse"; + + private JDialogOperator browser; + private boolean closed; + + public ConfigurationBrowser() { + browser = new JDialogOperator(getLoadConfigurationDialogName()); + closed = false; + } + + public static ConfigurationBrowser open() { + return new ConfigurationBrowser(); + } + + public static String getLoadConfigurationDialogName() { + return Tools.getExecResource(CONFIG_LOADER_DIALOG_NAME_EI18N); + } + + public static String getConfigLocationDialogName() { + return Tools.getExecResource(CONFIG_LOADER_CONFIG_LOCATION_DIALOG_EI18N); + } + + public static String getConfigLoaderLoadButtonName() { + return Tools.getExecResource(CONFIG_LOADER_LOAD_BUTTON_NAME_EI18N); + } + + public void setPath(String path) { + new JButtonOperator(browser, CONFIG_LOADER_BROWSE_BUTTON).push(); + + JDialogOperator fc = new JDialogOperator(getConfigLocationDialogName()); + JTextFieldOperator tf = new JTextFieldOperator(fc); + tf.clearText(); + tf.enterText(path); + } + + public void commit() { + new JButtonOperator(browser, getConfigLoaderLoadButtonName()).push(); + closed = true; + } + + public void cancel() { + closed = true; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/Configuration.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/Configuration.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/Configuration.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/Configuration.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,149 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import jthtest.Tools; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JMenuItemOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; +import org.netbeans.jemmy.util.NameComponentChooser; + +import java.awt.event.InputEvent; +import java.awt.event.KeyEvent; +import java.io.File; + +public class Configuration { + + public static final String STATUS_BAR_CONFIGURATION_FIELD_NAME = "bcc.Configuration"; + public static int MAX_WAIT_TIME = 10000; + private final JTFrame mainFrame; + private ConfigDialog configDialog; + + public Configuration(JTFrame mainFrame) { + this.mainFrame = mainFrame; + } + + public boolean isLoaded() { + return false; + } + + public String getName() { + if (isLoaded()) { + return ""; + } else { + return null; + } + } + + public ConfigurationBrowser openBrowser(boolean block) { + JMenuItemOperator menu = mainFrame.getConfigure_LoadConfigurationMenu(); + if (block) { + menu.push(); + } else { + menu.pushNoBlock(); + } + + return ConfigurationBrowser.open(); + } + + public void load(String path, String name, boolean block) { + ConfigurationBrowser browser = openBrowser(block); + browser.setPath(path + File.separator + name); + browser.commit(); + //waitForConfigurationLoading(name); + } + + public void load(File file, boolean block) { + ConfigurationBrowser browser = openBrowser(block); + browser.setPath(file.getPath()); + browser.commit(); + waitForConfigurationLoading(file.getName()); + } + + public void load(String name, boolean block) { + ConfigurationBrowser browser = openBrowser(block); + browser.setPath(Tools.LOCAL_PATH + File.separator + name); + browser.commit(); + waitForConfigurationLoading(name); + } + + public ConfigDialog create(boolean block) { + JMenuItemOperator menu = mainFrame.getConfigure_NewConfigurationMenu(); + if (block) { + menu.push(); + } else { + menu.pushNoBlock(); + } + return findConfigEditorDialog(); + } + + public ConfigDialog openByKey() { + mainFrame.getJFrameOperator().requestFocus(); + mainFrame.getJFrameOperator().clickMouse(); + Tools.pause(1); + mainFrame.getJFrameOperator().pressKey(KeyEvent.VK_E, InputEvent.CTRL_DOWN_MASK); + return findConfigEditorDialog(); + } + + public ConfigDialog openByMenu(boolean block) { + JMenuItemOperator menu = mainFrame.getConfigure_EditConfigurationMenu(); + if (block) { + menu.push(); + } else { + menu.pushNoBlock(); + } + return findConfigEditorDialog(); + } + + public ConfigDialog findConfigEditorDialog() { +// if (configDialog == null) { +// configDialog = new ConfigDialog(mainFrame); +// } + + return new ConfigDialog(mainFrame); + } + + public JTextFieldOperator getConfigurationNameField() { + return new JTextFieldOperator(mainFrame.getJFrameOperator(), new NameComponentChooser(STATUS_BAR_CONFIGURATION_FIELD_NAME)); + } + + public void waitForConfigurationLoading(String name) { + JTextFieldOperator label = getConfigurationNameField(); + int time = 0; + while (!label.getText().equals(name)) { + try { + Thread.sleep(100); + time += 100; + if (time > MAX_WAIT_TIME) + throw new JemmyException("Configuration loading error"); + } catch (InterruptedException ex) { + } + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/JTFrame.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/JTFrame.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/JTFrame.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/JTFrame.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,841 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import jthtest.ReportCreate.ReportCreate; +import jthtest.Test; +import jthtest.Tools; +import jthtest.menu.QSWizard; +import org.netbeans.jemmy.ComponentChooser; +import org.netbeans.jemmy.TimeoutExpiredException; +import org.netbeans.jemmy.operators.*; +import org.netbeans.jemmy.util.NameComponentChooser; + +import javax.swing.*; +import java.awt.*; +import java.io.File; +import java.lang.reflect.InvocationTargetException; +import java.util.Arrays; + +import static jthtest.Tools.*; + +public class JTFrame { + + public static final String FILE_MENU_TI18N = "dt.file.menu"; + public static final String FILE_MENU_MNEMONIC_TI18N = "dt.file.mne"; + public static final String FILE_OPENQS_MENU_EI18N = "mgr.openQuickStart.act"; + public static final String FILE_OPEN_MENU_TI18N = "???"; + public static final String FILE_OPEN_WD_MENU_EI18N = "ch.setWorkDir.act"; + public static final String FILE_OPEN_WD_MNEMONIC_EI18N = "ch.setWorkDir.mne"; + public static final String FILE_OPEN_TS_MENU_EI18N = "mgr.openTestSuite.act"; + public static final String FILE_OPEN_TS_MNEMONIC_EI18N = "mgr.openTestSuite.mne"; + public static final String FILE_RECENTWD_MENU_TI18N = "dt.file.recentwd.menu"; + public static final String FILE_PREFS_MENU_TI18N = "dt.file.prefs.mit"; + public static final String FILE_CLOSE_MENU_TI18N = "tdi.file.close.act"; + public static final String FILE_EXIT_MENU_TI18N = "dt.file.exit.mit"; + public static final String FILE_CREATEWD_MENU_EI18N = "mgr.createWorkDir.act"; + public static final String CONFIGURE_MENU_EI18N = "ch.menu"; + public static final String CONFIGURE_EDIT_MENU_EI18N = "ch.full.act"; + public static final String CONFIGURE_EDIT_QS_MENU_EI18N = "ch.change.menu"; + public static final String CONFIGURE_NEW_MENU_EI18N = "ch.new.act"; + public static final String CONFIGURE_LOAD_MENU_I18N = "ce.file.load.mit"; + public static final String CONFIGURE_RECENT_MENU_I18N = "ce.history.menu"; + public static final String RUNTESTS_MENU_EI18N = "rh.menu"; + public static final String RUNTESTS_START_MENU_EI18N = "rh.start.act"; + public static final String RUNTESTS_STOP_MENU_EI18N = "rh.stop.act"; + public static final String RUNTESTS_MONITOR_MENU_EI18N = "rh.progress.act"; + public static final String REPORT_MENU_EI18N = "rpth.menu"; + public static final String REPORT_CREATE_MENU_EI18N = "rpth.new.act"; + public static final String REPORT_OPEN_MENU_EI18N = "rpth.open.act"; + public static final String VIEW_MENU_EI18N = "ce.view.menu"; + public static final String VIEW_CONFIGURATION_MENU_EI18N = "exec.view.cfg.menu"; + public static final String VIEW_FILTER_MENU_EI18N = "fconfig.submenu.menu"; + public static final String VIEW_PROPERTIES_MENU_EI18N = "exec.view.props.act"; + public static final String VIEW_LOGS_MENU_EI18N = "exec.view.logviewer.act"; + public static final String VIEW_TSERRORS_MENU_EI18N = "exec.view.testSuiteErrors.act"; + public static final String VIEW_CONFIGURATION_SHOWTESTENV_MENU_EI18N = "ch.env.act"; + public static final String VIEW_CONFIGURATION_SHOWEXCLUDELIST_MENU_EI18N = "ch.excl.act"; + public static final String VIEW_CONFIGURATION_SHOWCHECKLIST_MENU_EI18N = "ch.checkList.act"; + public static final String VIEW_CONFIGURATION_SHOWQUESTIONLOG_MENU_EI18N = "ch.quLog.act"; + public static final String TOOLS_MENU_TI18N = "dt.tasks.menu"; + public static final String TOOLS_MENU_MNEMONIC_TI18N = "dt.tasks.mne"; + public static final String TOOLS_TEST_RESULTS_AUDITOR_I18N = "???"; + public static final String TOOLS_AGENT_MONITOR_I18N = "???"; + public static final String TOOLS_OPENQS_EI18N = "mgr.openQuickStart.act"; + public static final String WINDOWS_MENU_TI18N = "dt.windows.menu"; + public static final String WINDOWS_MENU_MNEMONIC_TI18N = "dt.windows.mne"; + public static final String HELP_MENU_EI18N = "qlb.help.btn"; + public static final String HELP_MENU_MNEMONIC_TI18N = "qlb.help.mne"; + public static final String HELP_ONLINEHELP_MENU_TI18N = "hm.help.mit"; + public static final String HELP_ONLINEHELP_MNEMONIC_TI18N = "hm.help.mne"; + public static final String HELP_ABOUTJT_MENU_I18N = "hm.aboutJavaTest.mit"; + public static final String HELP_ABOUTJT_MNEMONIC_I18N = "hm.aboutJavaTest.mne"; + public static final String HELP_ABOUTJVM_MENU_I18N = "hm.aboutJava.mit"; + public static final String HELP_ABOUTJVM_MNEMONIC_I18N = "hm.aboutJava.mne"; + public static boolean closeQSOnOpen = true; + + static { + String qs = System.getProperty("jt_gui_test.QSdefault"); + if (qs != null) { + closeQSOnOpen = Boolean.parseBoolean(qs); + } + } + + private JFrameOperator mainFrame; + private Configuration configuration; + private JMenuBarOperator menuBar; + private TestSuite testSuite; + private WorkDirectory workDirectory; + + public JTFrame() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + Tools.startJavatest(); + init(); + } + + public JTFrame(boolean newDesktop) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + if (newDesktop) { + Tools.startJavatestNewDesktop(); + } else { + Tools.startJavatest(); + } + init(); + } + + public JTFrame(String params) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + Tools.startJavatest(params); + init(); + } + + public JTFrame(String params[]) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + Tools.startJavatest(params); + init(); + } + + public JTFrame(String testsuite, String workdir, String config) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + Tools.startJavatest(testsuite, workdir, config); + init(); + } + + public static JTFrame startJTWithDefaultWorkDirectory() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + closeQSOnOpen = false; + return new JTFrame(new String[]{"-NewDesktop", "-open", Test.LOCAL_PATH + File.separator + Test.DEFAULT_WD_NAME}); + } + + public static JTFrame startJTWithDefaultTestSuite() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + closeQSOnOpen = false; + return new JTFrame(new String[]{"-NewDesktop", "-open", Tools.TEST_SUITE_NAME}); + } + + public static JTFrame startJTWithRunWD() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + closeQSOnOpen = false; + return new JTFrame(new String[]{"-NewDesktop", "-open", Tools.WD_RUN_NAME}); + } + + /////////////////////////// static name getters //////////////////////////// + //////////////////////////////////////////////////////////////////////////// + public static String getFileMenuName() { + return getToolResource(FILE_MENU_TI18N); + } + + public static String getFile_OpenQuickStartMenuName() { + return getExecResource(FILE_OPENQS_MENU_EI18N); + } + + public static String getFile_OpenMenuName() { + return "Open"; + } + + public static String getFile_RecentWorkDirectoryMenuName() { + return getToolResource(FILE_RECENTWD_MENU_TI18N); + } + + public static String getFile_PreferencesMenuName() { + return getToolResource(FILE_PREFS_MENU_TI18N); + } + + public static String getFile_CloseMenuName() { + return getToolResource(FILE_CLOSE_MENU_TI18N); + } + + public static String getFile_ExitMenuName() { + return getToolResource(FILE_EXIT_MENU_TI18N); + } + + public static String getFile_Open_WorkDirectoryMenuName() { + return getExecResource(FILE_OPEN_WD_MENU_EI18N); + } + + public static String getFile_Open_TestSuiteMenuName() { + return getExecResource(FILE_OPEN_TS_MENU_EI18N); + } + + public static String getFile_CreateWorkDirectoryMenuName() { + return getExecResource(FILE_CREATEWD_MENU_EI18N); + } + + public static String getConfigureMenuName() { + return getExecResource(CONFIGURE_MENU_EI18N); + } + + public static String getConfigure_EditConfigurationMenuName() { + return getExecResource(CONFIGURE_EDIT_MENU_EI18N); + } + + public static String getConfigure_EditQuickSetMenuName() { + return getExecResource(CONFIGURE_EDIT_QS_MENU_EI18N); + } + + public static String getConfigure_EditQuickSet_TestsToRunMenuName() { + return "Tests To Run ..."; + } + + public static String getConfigure_EditQuickSet_ExcludeListMenuName() { + return "Exclude List ..."; + } + + public static String getConfigure_EditQuickSet_PriorStatusMenuName() { + return "Prior Status ..."; + } + + public static String getConfigure_EditQuickSet_ConcurrencyMenuName() { + return "Concurrency ..."; + } + + public static String getConfigure_EditQuickSet_TimeoutFactorMenuName() { + return "Timeout Factor ..."; + } + + public static String getConfigure_NewConfigurationMenuName() { + return getExecResource(CONFIGURE_NEW_MENU_EI18N); + } + + public static String getConfigure_LoadConfigurationMenuName() { + return getExecResource(CONFIGURE_LOAD_MENU_I18N); + } + + public static String getConfigure_LoadRecentConfigurationMenuName() { + return getExecResource(CONFIGURE_RECENT_MENU_I18N); + } + + public static String getRunTestsMenuName() { + return getExecResource(RUNTESTS_MENU_EI18N); + } + + public static String getRunTests_StartMenuName() { + return getExecResource(RUNTESTS_START_MENU_EI18N); + } + + public static String getRunTests_StopMenuName() { + return getExecResource(RUNTESTS_STOP_MENU_EI18N); + } + + public static String getRunTests_MonitorProgressMenuName() { + return getExecResource(RUNTESTS_MONITOR_MENU_EI18N); + } + + public static String getReportMenuName() { + return getExecResource(REPORT_MENU_EI18N); + } + + public static String getReport_CreateReportMenuName() { + return getExecResource(REPORT_CREATE_MENU_EI18N); + } + + public static String getReport_OpenReportMenuName() { + return getExecResource(REPORT_OPEN_MENU_EI18N); + } + + public static String getViewMenuName() { + return getExecResource(VIEW_MENU_EI18N); + } + + public static String getView_ConfigurationMenuName() { + return getExecResource(VIEW_CONFIGURATION_MENU_EI18N); + } + + public static String getView_FilterMenuName() { + return getExecResource(VIEW_FILTER_MENU_EI18N); + } + + public static String getView_Filter_ConfigureFiltersMenuName() { + return "Configure Filters ..."; + } + + public static String getView_PropertiesMenuName() { + return getExecResource(VIEW_PROPERTIES_MENU_EI18N); + } + + public static String getView_LogsMenuName() { + return getExecResource(VIEW_LOGS_MENU_EI18N); + } + + public static String getView_TestSuiteErrorsMenuName() { + return getExecResource(VIEW_TSERRORS_MENU_EI18N); + } + + public static String getView_Configuration_ShowTestEnvironmentMenuName() { + return getExecResource(VIEW_CONFIGURATION_SHOWTESTENV_MENU_EI18N); + } + + public static String getView_Configuration_ShowChecklistMenuName() { + return getExecResource(VIEW_CONFIGURATION_SHOWCHECKLIST_MENU_EI18N); + } + + public static String getView_Configuration_ShowExcludeListMenuName() { + return getExecResource(VIEW_CONFIGURATION_SHOWEXCLUDELIST_MENU_EI18N); + } + + public static String getView_Configuration_ShowQuestionLogMenuName() { + return getExecResource(VIEW_CONFIGURATION_SHOWQUESTIONLOG_MENU_EI18N); + } + + public static String getToolsMenuName() { + return "Tools"; + } + + public static String getTools_ReportConverterMenuName() { + return "Report Converter..."; + } + + public static String getTools_OpenQuickStartWizardMenuName() { + return "Open Quick Start Wizard ..."; + } + + public static String getTools_AgentMonitorMenuName() { + return "Agent Monitor..."; + } + + public static String getTools_TestResultsAuditorMenuName() { + return "Test Manager..."; + } + + public void closeQS() { + new JDialogOperator(mainFrame, getExecResource("qsw.title")).close(); + } + + public void closeQSGently() { +// new JDialogOperator(mainFrame, getExecResource("qsw.title")).close(); + try { + new Thread() { + + public void run() { + JDialog d = JDialogOperator.findJDialog(mainFrame.getWindow(), new ComponentChooser() { + + public boolean checkComponent(Component cmpnt) { + if (cmpnt instanceof JDialog) { + if (((JDialog) cmpnt).getTitle().equals(getExecResource("qsw.title"))) { + return true; + } + } + return false; + } + + public String getDescription() { + return "searching QuickStartWizard"; + } + }); + if (d != null) { + new JDialogOperator(d).close(); + } + } + }.start(); + } catch (Exception e) { + } + } + + private void init() { + configuration = new Configuration(this); + testSuite = new TestSuite(this); + workDirectory = new WorkDirectory(this); + mainFrame = Tools.findMainFrame(); + if (closeQSOnOpen) { + closeQSGently(); + } + } + + public int getTabsCount() { + JTabbedPaneOperator tabs = new JTabbedPaneOperator(mainFrame); + return tabs.getTabCount(); + } + + public String getTabName(int i) { + JTabbedPaneOperator tabs = new JTabbedPaneOperator(mainFrame); + return tabs.getTitleAt(i); + } + + public void closeCurrentTool() { + getFile_CloseMenu().push(); + } + + public void closeAllTools() throws InterruptedException { + if (mainFrame.isVisible()) { + Tools.closeAll(mainFrame); + } + } + + public void closeFrame() throws InterruptedException { + Tools.closeJT(mainFrame); + } + + public JFrameOperator getJFrameOperator() { + return mainFrame; + } + + public Configuration getConfiguration() { + return configuration; + } + + public TestSuite getTestSuite() { + return testSuite; + } + + public WorkDirectory getWorkDirectory() { + return workDirectory; + } + + /////////////////////////////// menu methods /////////////////////////////// + //////////////////////////////////////////////////////////////////////////// + public JMenuBarOperator getMenuBar() { + if (menuBar == null) { + menuBar = new JMenuBarOperator(mainFrame); + } + return menuBar; + } + + public JMenuOperator getFileMenu() { + return new JMenuOperator(mainFrame, getFileMenuName()); + } + + public JMenuItemOperator getFile_OpenQuickStartMenu() { + return getMenuBar().showMenuItem(new String[]{getFileMenuName(), getFile_OpenQuickStartMenuName()}); + } + + public JMenuItemOperator getFile_OpenMenu() { + return getMenuBar().showMenuItems(new String[]{getFileMenuName()}, new SimpleStringComparator())[1]; + } + + public JMenuItemOperator getFile_RecentWorkDirectoryMenu() { + return getMenuBar().showMenuItem(new String[]{getFileMenuName(), getFile_RecentWorkDirectoryMenuName()}); + } + + public JMenuItemOperator getFile_PreferencesMenu() { + return getMenuBar().showMenuItem(new String[]{getFileMenuName(), getFile_PreferencesMenuName()}); + } + + public JMenuItemOperator getFile_CloseMenu() { + return getMenuBar().showMenuItem(new String[]{getFileMenuName(), getFile_CloseMenuName()}); + } + + public JMenuItemOperator getFile_ExitMenu() { + return getMenuBar().showMenuItem(new String[]{getFileMenuName(), getFile_ExitMenuName()}); + } + + public JMenuItemOperator getFile_Open_WorkDirectoryMenu() { + return getMenuBar().showMenuItem(new String[]{getFileMenuName(), getFile_OpenMenuName(), getFile_Open_WorkDirectoryMenuName()}, new SimpleStringComparator()); + } + + public JMenuItemOperator getFile_Open_TestSuiteMenu() { + return getMenuBar().showMenuItem(new String[]{getFileMenuName(), getFile_OpenMenuName(), getFile_Open_TestSuiteMenuName()}, new SimpleStringComparator()); + } + + public JMenuItemOperator getFile_CreateWorkDirectoryMenu() { + return getMenuBar().showMenuItem(new String[]{getFileMenuName(), getFile_CreateWorkDirectoryMenuName()}); + } + + public JMenuOperator getConfigureMenu() { + return new JMenuOperator(mainFrame, getConfigureMenuName()); + } + + public JMenuItemOperator getConfigure_EditConfigurationMenu() { + return getMenuBar().showMenuItem(new String[]{getConfigureMenuName(), getConfigure_EditConfigurationMenuName()}); + } + + public JMenuItemOperator getConfigure_EditQuickSetMenu() { + return getMenuBar().showMenuItem(new String[]{getConfigureMenuName(), getConfigure_EditQuickSetMenuName()}); + } + + public JMenuItemOperator getConfigure_EditQuickSet_TestsToRunMenu() { + return getMenuBar().showMenuItem(new String[]{getConfigureMenuName(), getConfigure_EditQuickSetMenuName(), getConfigure_EditQuickSet_TestsToRunMenuName()}); + } + + public JMenuItemOperator getConfigure_EditQuickSet_ExcludeListMenu() { + return getMenuBar().showMenuItem(new String[]{getConfigureMenuName(), getConfigure_EditQuickSetMenuName(), getConfigure_EditQuickSet_ExcludeListMenuName()}); + } + + public JMenuItemOperator getConfigure_EditQuickSet_PriorStatusMenu() { + return getMenuBar().showMenuItem(new String[]{getConfigureMenuName(), getConfigure_EditQuickSetMenuName(), getConfigure_EditQuickSet_PriorStatusMenuName()}); + } + + public JMenuItemOperator getConfigure_EditQuickSet_ConcurrencyMenu() { + return getMenuBar().showMenuItem(new String[]{getConfigureMenuName(), getConfigure_EditQuickSetMenuName(), getConfigure_EditQuickSet_ConcurrencyMenuName()}); + } + + public JMenuItemOperator getConfigure_EditQuickSet_TimeoutFactorMenu() { + return getMenuBar().showMenuItem(new String[]{getConfigureMenuName(), getConfigure_EditQuickSetMenuName(), getConfigure_EditQuickSet_TimeoutFactorMenuName()}); + } + + public JMenuItemOperator getConfigure_NewConfigurationMenu() { + return getMenuBar().showMenuItem(new String[]{getConfigureMenuName(), getConfigure_NewConfigurationMenuName()}); + } + + public JMenuItemOperator getConfigure_LoadConfigurationMenu() { + return getMenuBar().showMenuItem(new String[]{getConfigureMenuName(), getConfigure_LoadConfigurationMenuName()}, new SimpleStringComparator()); + } + + public JMenuItemOperator getConfigure_LoadRecentConfigurationMenu() { + return getMenuBar().showMenuItem(new String[]{getConfigureMenuName(), getConfigure_LoadRecentConfigurationMenuName()}); + } + + public JMenuItemOperator[] getConfigure_LoadRecentConfiguration_subMenu() { + return getMenuBar().showMenuItems(new String[]{getConfigureMenuName(), getConfigure_LoadRecentConfigurationMenuName()}); + } + + public JMenuOperator getRunTestsMenu() { + return new JMenuOperator(mainFrame, getRunTestsMenuName()); + } + + public JMenuItemOperator getRunTests_StartMenu() { + return getMenuBar().showMenuItem(new String[]{getRunTestsMenuName(), getRunTests_StartMenuName()}); + } + + public JMenuItemOperator getRunTests_StopMenu() { + return getMenuBar().showMenuItem(new String[]{getRunTestsMenuName(), getRunTests_StopMenuName()}); + } + + public JMenuItemOperator getRunTests_MonitorProgressMenu() { + return getMenuBar().showMenuItem(new String[]{getRunTestsMenuName(), getRunTests_MonitorProgressMenuName()}); + } + + public JMenuOperator getReportMenu() { + return new JMenuOperator(mainFrame, getReportMenuName()); + } + + public JMenuItemOperator getReport_CreateReportMenu() { + return getMenuBar().showMenuItem(new String[]{getReportMenuName(), getReport_CreateReportMenuName()}); + } + + public JMenuItemOperator getReport_OpenReportMenu() { + return getMenuBar().showMenuItem(new String[]{getReportMenuName(), getReport_OpenReportMenuName()}); + } + + public JMenuOperator getViewMenu() { + return new JMenuOperator(mainFrame, getViewMenuName()); + } + + public JMenuItemOperator getView_ConfigurationMenu() { + return getMenuBar().showMenuItem(new String[]{getViewMenuName(), getView_ConfigurationMenuName()}); + } + + public JMenuItemOperator getView_FilterMenu() { + return getMenuBar().showMenuItem(new String[]{getViewMenuName(), getView_FilterMenuName()}); + } + + public JMenuItemOperator getView_Filter_ConfigureFiltersMenu() { + return getMenuBar().showMenuItem(new String[]{getViewMenuName(), getView_FilterMenuName(), getView_Filter_ConfigureFiltersMenuName()}); + } + + public JMenuItemOperator getView_PropertiesMenu() { + return getMenuBar().showMenuItem(new String[]{getViewMenuName(), getView_PropertiesMenuName()}); + } + + public JMenuItemOperator getView_LogsMenu() { + return getMenuBar().showMenuItem(new String[]{getViewMenuName(), getView_LogsMenuName()}); + } + + public JMenuItemOperator getView_TestSuiteErrorsMenu() { + return getMenuBar().showMenuItem(new String[]{getViewMenuName(), getView_TestSuiteErrorsMenuName()}); + } + + public JMenuItemOperator getView_Configuration_ShowChecklistMenu() { + return getMenuBar().showMenuItem(new String[]{getViewMenuName(), getView_ConfigurationMenuName(), getView_Configuration_ShowChecklistMenuName()}); + } + + public JMenuItemOperator getView_Configuration_ShowExcludeListMenu() { + return getMenuBar().showMenuItem(new String[]{getViewMenuName(), getView_ConfigurationMenuName(), getView_Configuration_ShowExcludeListMenuName()}); + } + + public JMenuItemOperator getView_Configuration_ShowQuestionLogMenu() { + return getMenuBar().showMenuItem(new String[]{getViewMenuName(), getView_ConfigurationMenuName(), getView_Configuration_ShowQuestionLogMenuName()}); + } + + public JMenuItemOperator getView_Configuration_ShowTestEnvironmentMenu() { + return getMenuBar().showMenuItem(new String[]{getViewMenuName(), getView_ConfigurationMenuName(), getView_Configuration_ShowTestEnvironmentMenuName()}); + } + + public JMenuItemOperator getTools_ReportConverterMenu() { + return getMenuBar().showMenuItem(new String[]{getToolsMenuName(), getTools_ReportConverterMenuName()}); + } + + public JMenuItemOperator getTools_OpenQuickStartWizardMenu() { + return getMenuBar().showMenuItem(new String[]{getToolsMenuName(), getTools_OpenQuickStartWizardMenuName()}); + } + + public JMenuItemOperator getTools_AgentMonitorMenu() { + return getMenuBar().showMenuItem(new String[]{getToolsMenuName(), getTools_AgentMonitorMenuName()}); + } + + /*There is no Test Results Auditor... menu item and it Test Manager... + * public static String getTools_TestResultsAuditorMenuName() { return + * "Test Results Auditor..."; } + */ + + public JMenuItemOperator getTools_TestResultsAuditorMenu() { + return getMenuBar().showMenuItem(new String[]{getToolsMenuName(), getTools_TestResultsAuditorMenuName()}); + } + + public void openDefaultTestSuite() { + testSuite.openTestSuite(Tools.LOCAL_PATH + Tools.TEST_SUITE_NAME); + } + + public File createWorkDirectoryInTemp() { + return workDirectory.createWorkDirectoryInTemp(); + } + + public QSWizard openQuickStartWizard() { + getFile_OpenQuickStartMenu().push(); + return new QSWizard(); + } + + public TestTree getTestTree() { + return new TestTree(this); + } + + public Task<Boolean> runTests() { + return new TestRunner(true); + } + + public Task<Boolean> runTests(boolean start) { + return new TestRunner(start); + } + + public Task<Boolean> runTests(int row) { + return new TestRunner(row); + } + + public int getPassedCounter() { + String actual = new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ.0")).getText(); + return Integer.parseInt(actual); + } + + public int getFailedCounter() { + String actual = new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ.1")).getText(); + return Integer.parseInt(actual); + } + + public int getErrorCounter() { + String actual = new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ.2")).getText(); + return Integer.parseInt(actual); + } + + public int getNotRunCounter() { + String actual = new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ.3")).getText(); + return Integer.parseInt(actual); + } + + public int getNotFilteredCounter() { + String actual = new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ.4")).getText(); + return Integer.parseInt(actual); + } + + public int getFilteredCounter() { + String actual = new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ.5")).getText(); + return Integer.parseInt(actual); + } + + public int getAllTestsCounter() { + String actual = new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ.6")).getText(); + return Integer.parseInt(actual); + } + + public void click() { + mainFrame.clickMouse(); + } + + public ReportDialog openReportDialog() { + getReport_CreateReportMenu().push(); + return new ReportDialog(new JDialogOperator(getExecResource("nrd.title")), true); + } + + public ReportDialog openReportDialog(boolean init) { + getReport_CreateReportMenu().push(); + return new ReportDialog(new JDialogOperator(getExecResource("nrd.title")), init); + } + + public int checkCounters(int[] counters) { + for (int i = 0; i < counters.length; i++) { + int value = counters[i]; + + String actual = new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ." + i)).getText(); + + if (!actual.equals(Integer.toString(value))) { + return i; + } + } + return -1; + } + + public void waitForCounters(final int[] counters) { + Task.Waiter countersWaiter = new Task.Waiter(true) { + + @Override + protected void init() { + super.maxTimeToWaitMS = 10000; + } + + @Override + protected boolean check() { + for (int i = 0; i < counters.length; i++) { + int value = counters[i]; + + String actual = new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ." + i)).getText(); + + if (!actual.equals(Integer.toString(value))) { + return false; + } + } + return true; + } + + @Override + protected String getTimeoutExceptionDescription() { + return "Timeout occured while waiting for counters '" + Arrays.toString(counters) + "'. Current counters values: '" + Arrays.toString(getCounters()) + "'"; + } + }; + + countersWaiter.waitForDone(); + } + + public int[] getCounters() { + int[] counters = new int[7]; + for (int i = 0; i < 7; i++) { + counters[i] = Integer.parseInt(new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ." + i)).getText()); + } + return counters; + } + + /** + * Creates full (with html, xml and plain) report + * + * @param path Path to report directory + * @param openViewer Open or not report viewer + * @return + */ + public ReportChecker createFullReport(String path, boolean openViewer) { + ReportCreate rc; + + ReportDialog rep = openReportDialog(false); + rep.setPath(path); + rep.pushCreate(); + JDialogOperator showReport = ReportDialog.findShowReportDialog(); + + if (openViewer) { + new JButtonOperator(showReport, "Yes").push(); + return new ReportChecker(path, rep); + } else { + new JButtonOperator(showReport, "No").push(); + return null; + } + } + + /** + * Waits for tests execution done. + * Attention! This method should be used only when tests are runned without JTFrame.TestRunner. + * Do not use this method along with runTests()! Use Task.waitForDone() instead. + * + * @see #runTests() + * @see #runTests(boolean) + * @see Task#waitForDone() + */ + public void waitForExecutionDone() { + try { + final JTextFieldOperator filed1 = new JTextFieldOperator(mainFrame, new NameComponentChooser("strip.msg")); + Task.Waiter waiter = new Task.Waiter(false) { + + @Override + protected void init() { + setName("FinishedRunWaiter" + (int) (Math.random() * 10)); + } + + @Override + protected boolean check() { + return Tools.getExecResource("strip.finish").equals(filed1.getText()); + } + }; + waiter.maxTimeToWaitMS = 600000; + waiter.start(); + waiter.waitForDone(); + } catch (TimeoutExpiredException e) { + } + } + + private class TestRunner extends Task<Boolean> { + + private int row; + + public TestRunner(boolean start) { + super(false); + this.row = -1; + start(); + } + + public TestRunner(int row) { + super(false); + this.row = row; + start(); + } + + @Override + protected void init() { + setName("RunTestsThread" + (int) (Math.random() * 100)); + } + + @Override + protected void runImpl() { + try { + if (row < 0) { + getRunTests_StartMenu().push(); + } else { + getTestTree().clickPopup(row); + + new JPopupMenuOperator(mainFrame).pushMenuNoBlock("Execute These Tests"); + new JButtonOperator(new JDialogOperator("Run Tests"), "Yes").push(); + } + try { + new JButtonOperator(new JDialogOperator("View Filter Info"), "OK").push(); + } catch (Exception e) { + } + waitForExecutionDone(); + } catch (TimeoutExpiredException e) { + result = false; + exception = e; + } + result = true; + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/QSWizard.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/QSWizard.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/QSWizard.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/QSWizard.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,222 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import jthtest.Tools; +import org.netbeans.jemmy.operators.*; +import org.netbeans.jemmy.util.NameComponentChooser; + +public class QSWizard { + + public static String QUICK_START_WIZARD_TITLE = Tools.WINDOWNAME + " Harness Quick Start"; + private JDialogOperator dialog; + private Panel panel; + + public QSWizard() { + dialog = new JDialogOperator(QUICK_START_WIZARD_TITLE); + panel = new GreetingsPanel(); + } + + public Panel getPanel() { + return panel; + } + + public abstract class Panel { + + public JDialogOperator getDialog() { + return dialog; + } + + public JButtonOperator next() { + return new JButtonOperator(dialog, "Next"); + } + + public JButtonOperator cancel() { + return new JButtonOperator(dialog, "Cancel"); + } + + public JButtonOperator finish() { + return new JButtonOperator(dialog, "Finish"); + } + + public JButtonOperator back() { + return new JButtonOperator(dialog, "Back"); + } + + public abstract Panel pushNext(); + } + + public class GreetingsPanel extends Panel { + + private boolean startNew = false; + private boolean resume = false; + private boolean browse = false; + + public void setStartNewTestRun() { + new JRadioButtonOperator(dialog, Tools.getExecResource("qsw.tsk.new.rb")).push(); + browse = resume = false; + startNew = true; + } + + public void setResumeTestRun() { + new JRadioButtonOperator(dialog, Tools.getExecResource("qsw.tsk.resume.rb")).push(); + browse = startNew = false; + resume = true; + } + + public void setBrowseTestSuite() { + new JRadioButtonOperator(dialog, Tools.getExecResource("qsw.tsk.browse.rb")).push(); + startNew = resume = false; + browse = true; + } + + @Override + public ChooseTestSuitePanel pushNext() { + next().push(); + return new ChooseTestSuitePanel(); + } + } + + public class ChooseTestSuitePanel extends Panel { + public static final String QSW_TS_TEXTFIELD = "qsw.ts.file.ed"; + + private String testsuite = null; + + public String getTestsuite() { + JTextFieldOperator op = new JTextFieldOperator(dialog, new NameComponentChooser("ComboBox.textField")); + return op.getText(); + } + + public void setTestsuite(String testsuite) { + JTextFieldOperator op = Tools.getTextField(dialog, "Test Suite:");// new JTextFieldOperator(dialog); + op.clearText(); + op.enterText(testsuite); + this.testsuite = testsuite; + } + + @Override + public ChooseConfigurationPanel pushNext() { + next().push(); + return new ChooseConfigurationPanel(); + } + } + + public class ChooseConfigurationPanel extends Panel { + + private boolean createNew = false; + private boolean useOld = false; + + @Override + public ChooseWorkDirectoryPanel pushNext() { + if (createNew || useOld) { + next().push(); + return new ChooseWorkDirectoryPanel(); + } else { + return null; + } + } + + public void setCreateANewConfiguration() { + new JRadioButtonOperator(dialog, Tools.getExecResource("qsw.cfg.new.rb")).push(); + createNew = true; + useOld = false; + } + + public void setUseAConfigurationTemplate() { + new JRadioButtonOperator(dialog, Tools.getExecResource("qsw.cfg.template.rb")).push(); + useOld = true; + createNew = false; + } + + public boolean setPath(String path) { + if (!useOld || createNew) + return false; + JTextFieldOperator tf = getTextFieled(); + tf.clearText(); + tf.typeText(path); + return true; + } + + public JTextFieldOperator getTextFieled() { + return Tools.getTextField(dialog, "File:"); + } + + public JButtonOperator browse() { + return new JButtonOperator(dialog, Tools.getExecResource("qsw.cfg.jtm.field.browse.btn")); + } + } + + public class ChooseWorkDirectoryPanel extends Panel { + + @Override + public NewTestsuiteAlmostDone pushNext() { + next().push(); + return new NewTestsuiteAlmostDone(); + } + + public JTextFieldOperator getTextField() { + return Tools.getTextField(dialog, Tools.getExecResource("qsw.nwd.file.lbl")); + } + + public void setWorkDirectory(String path) { + JTextFieldOperator tf = getTextField(); + tf.clearText(); + tf.typeText(path); + } + + public JButtonOperator browse() { + return new JButtonOperator(dialog, Tools.getExecResource("qsw.nwd.file.browse.btn")); + } + } + + public class NewTestsuiteAlmostDone extends Panel { + + @Override + public Panel pushNext() { + finish().push(); + return null; + } + + public JCheckBoxOperator getStartTheConfigEditorCheckBox() { + return new JCheckBoxOperator(dialog, Tools.getExecResource("qsw.end.cfg.ckb")); + } + + public JCheckBoxOperator getStartTestRunCheckBox() { + return new JCheckBoxOperator(dialog, Tools.getExecResource("qsw.end.run.ckb")); + } + + public void setStartTheConfigEditor(boolean set) { + getStartTheConfigEditorCheckBox().setSelected(set); + } + + public void setStartTestRun(boolean set) { + getStartTestRunCheckBox().setSelected(set); + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/ReportChecker.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/ReportChecker.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/ReportChecker.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/ReportChecker.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,728 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import jthtest.ReportCreate.ReportCreate.ReportBrowser; +import jthtest.Test; +import jthtest.Tools; +import org.netbeans.jemmy.JemmyException; + +import java.io.File; +import java.net.URL; + +public class ReportChecker { + + public static final String F2E = "ahref=kfl_fail2error.html>"; + public static final String F2F = "<ahref=kfl_fail2fail.html>"; + public static final String F2M = "ahref=kfl_fail2missing.html>"; + public static final String F2N = "<ahref=kfl_fail2notrun.html>"; + public static final String F2P = "<ahref=kfl_fail2pass.html>"; + //public static final String KFL_1 = "name=KnownFailureAnalysis"; + //public static final String KFL_2 = "name=KnownFailureAnalysis"; + public static final String KFL_1 = "aid=#KnownFailureAnalysis"; + public static final String KFL_2 = "ahref=#KnownFailureAnalysis"; + public static final String NF = "<ahref=kfl_newfailures.html>"; + public static final String TESTS_TEXT = "<thscope=row>Tests("; + public static final String NOT_CALC = "<td>(notcalculated)</td>"; + public static final String TC_F2E_LINK = "<ahref=kfl_tc_fail2error.html>"; + public static final String TC_F2M_LINK = "<ahref=kfl_tc_fail2missing.html>"; + public static final String TC_F2N_LINK = "<ahref=kfl_tc_fail2notrun.html>"; + public static final String TC_F2P_LINK = "<ahref=kfl_tc_fail2pass.html>"; + public static final String TC_NEW_LINK = "<ahref=kfl_tc_newfailures.html>"; + public static final String TEST_CASES_TEXT = "<thscope=row>TestCases("; + private String basePath; + private ReportBrowser browser; + private ReportDialog reportDialog; + + public ReportChecker(String path, ReportDialog report) { + basePath = path; + browser = new ReportBrowser(path); + reportDialog = report; + } + + ; + + private void checkReportPage() throws JemmyException { + String htmlPath = basePath + "html" + File.separator; + String[] urls = browser.getUrls(); + StringBuffer error = new StringBuffer(""); + int i = -1; + + if (reportDialog.isFGenerateError()) { + if (!(new File(htmlPath + "error.html").exists())) { + error.append("error.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "error.html").exists()) { + error.append("error.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (reportDialog.isFGenerateFailed()) { + if (!(new File(htmlPath + "failed.html").exists())) { + error.append("failed.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "failed.html").exists()) { + error.append("failed.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (reportDialog.isFGenerateNotRun()) { + if (!(new File(htmlPath + "notRun.html").exists())) { + error.append("notRun.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "notRun.html").exists()) { + error.append("notRun.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (reportDialog.isFGeneratePassed()) { + if (!(new File(htmlPath + "passed.html").exists())) { + error.append("passed.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "passed.html").exists()) { + error.append("passed.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (reportDialog.isFPutInIndex()) { + if (!(new File(htmlPath + "index.html").exists())) { + error.append("index.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "index.html").exists()) { + error.append("index.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (reportDialog.isFPutInReport()) { + if (!(new File(htmlPath + "report.html").exists())) { + error.append("report.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + if (new File(htmlPath + "report.html").exists()) { + error.append("report.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (reportDialog.isOConfig()) { + checkFileUrls(urls); + i = Tools.findInStringArray(urls, "#Configuration and Other Settings"); + if (i == -1) { + error.append("report doesn't contain configuration url '#Configuration and Other Settings'\n"); + } + if (!browser.getText().contains("name=\"Configuration and Other Settings\"")) { + error.append("report doesn't contain configuration block\n"); + } +// i = findInStringArray(urls, "#locations"); +// if (i == -1) { +// error.append("report doesn't contain url to 'Where to put the results' block\n"); +// } + if (!browser.getText().contains("name=locations") && !browser.getText().contains("name=\"locations\"")) { + error.append("report doesn't contain 'Where to put the results' block\n"); + } + + if (reportDialog.isOConfig_QuestionLog()) { + i = Tools.findInStringArray(urls, "config.html"); + if (i == -1) { + error.append("report doesn't contain url to config.html\n"); + } + if (!(new File(htmlPath + "config.html").exists())) { + error.append("config.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + i = Tools.findInStringArray(urls, "config.html"); + if (i != -1) { + error.append("report contains url to config.html while unexpected\n"); + } + if (new File(htmlPath + "config.html").exists()) { + error.append("config.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (reportDialog.isOConfig_StdValues()) { + i = Tools.findInStringArray(urls, "#selection"); + if (i == -1) { + error.append("report doesn't contain url to standart values block\n"); + } + if (!browser.getText().contains("name=\"selection\"")) { + error.append("report doesn't contain standart values block\n"); + } + if (!new File(htmlPath + "excluded.html").exists()) { + error.append("excluded.html wasn't found at the path '" + htmlPath + "'\n"); + } + } else { + i = Tools.findInStringArray(urls, "#selection"); + if (i != -1) { + error.append("report contains url to standart values block while unexpected\n"); + } + if (browser.getText().contains("name=\"selection\"")) { + error.append("report contains standart values block while unexpected\n"); + } + if (new File(htmlPath + "excluded.html").exists()) { + error.append("excluded.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (reportDialog.isOConfig_TestEnv()) { +// i = findInStringArray(urls, "#execution"); +// if (i == -1) { +// error.append("report doesn't contain url to test enviroment ('How to run') block\n"); +// } + if (!browser.getText().contains("name=execution") && !browser.getText().contains("name=\"execution\"")) { + error.append("report doesn't contain test enviroment ('How to run') block\n"); + } + if (!(new File(htmlPath + "env.html").exists())) { + error.append("env.html was not found at the path '" + htmlPath + "' while expected\n"); + } + } else { + i = Tools.findInStringArray(urls, "#execution"); + if (i != -1) { + error.append("report contains url to test enviroment ('How to run') block while unexpected\n"); + } + if (browser.getText().contains("name=\"execution\"")) { + error.append("report contains test enviroment ('How to run') block while unexpected\n"); + } + if (new File(htmlPath + "env.html").exists()) { + error.append("env.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + } else { + i = Tools.findInStringArray(urls, "#Configuration and Other Settings"); + if (i != -1) { + error.append("report contains configuration url '#Configuration and Other Settings' while unexpected\n"); + } + if (browser.getText().contains("name=\"Configuration and Other Settings\"")) { + error.append("report contains configuration block while unexpected\n"); + } + i = Tools.findInStringArray(urls, "config.html"); + if (i != -1) { + error.append("report contains url to config.html while unexpected\n"); + } + if (new File(htmlPath + "config.html").exists()) { + error.append("config.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + i = Tools.findInStringArray(urls, "#selection"); + if (i != -1) { + error.append("report contains url to standart values block while unexpected\n"); + } + if (browser.getText().contains("name=\"selection\"")) { + error.append("report contains standart values block while unexpected\n"); + } + i = Tools.findInStringArray(urls, "#locations"); + if (i != -1) { + error.append("report contains url to 'Where to put the results' block while unexpected\n"); + } + if (browser.getText().contains("name=\"locations\"")) { + error.append("report contains 'Where to put the results' block while unexpected\n"); + } + i = Tools.findInStringArray(urls, "#execution"); + if (i != -1) { + error.append("report contains url to test enviroment ('How to run') block while unexpected\n"); + } + if (browser.getText().contains("name=\"execution\"")) { + error.append("report contains test enviroment ('How to run') block while unexpected\n"); + } + if (new File(htmlPath + "env.html").exists()) { + error.append("env.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + if (new File(htmlPath + "excluded.html").exists()) { + error.append("excluded.html was found at the path '" + htmlPath + "' while unexpected\n"); + } + } + + if (reportDialog.isOKeywords()) { + i = Tools.findInStringArray(urls, "#Statistics"); + if (i == -1) { + error.append("report doesn't contain url to Statistics block (produced by options-keywords)\n"); + } + if (!browser.getText().contains("name=Statistics") && !browser.getText().contains("name=\"Statistics\"")) { + error.append("report doesn't contain Statistics block (produced by options-keywords)\n"); + } + i = Tools.findInStringArray(urls, "#keywordSummary"); + if (i == -1) { + error.append("report doesn't contain url to keywordSummary block\n"); + } + if (!browser.getText().contains("name=keywordSummary") && !browser.getText().contains("name=\"keywordSummary\"")) { + error.append("report doesn't contain keywordSummary block\n"); + } + } else { + i = Tools.findInStringArray(urls, "#Statistics"); + if (i != -1) { + error.append("report contains url to Statistics block while unexpected\n"); + } + if (browser.getText().contains("name=\"Statistics\"")) { + error.append("report contains Statistics block while unexpected\n"); + } + i = Tools.findInStringArray(urls, "#keywordSummary"); + if (i != -1) { + error.append("report contains url to keywordSummary block while unexpected\n"); + } + if (browser.getText().contains("name=\"keywordSummary\"")) { + error.append("report contains keywordSummary block while unexpected\n"); + } + } + + if (reportDialog.isOResults()) { + i = Tools.findInStringArray(urls, "#Results"); + if (i == -1) { + error.append("report doesn't contain url to Results block\n"); + } + if (!browser.getText().contains("name=Results") && !browser.getText().contains("name=\"Results\"")) { + error.append("report doesn't contain Results block\n"); + } + } else { + i = Tools.findInStringArray(urls, "#Results"); + if (i != -1) { + error.append("report contains url to Results block while unexpected\n"); + } + if (browser.getText().contains("name=\"Results\"")) { + error.append("report contains Results block while unexpected\n"); + } + } + if (error.length() > 0) { + throw new JemmyException(error.toString()); + } + } + + private String getUrlToHtmlReportPage() { + String[] urls = browser.getUrls(); + int i = -1; + String t = ""; + if (reportDialog.isFPutInIndex()) { + i = Tools.findInStringArray(urls, "html/index.html"); + t = "index"; + } else { + if (reportDialog.isFPutInReport()) { + i = Tools.findInStringArray(urls, "html/report.html"); + t = "report"; + } else { + throw new JemmyException("NIY - nor index.html nor report.html selected"); + } + } + if (i == -1) { + throw new JemmyException("Url to html report page was not found. Tring to browse from '" + browser.getPath().toString() + "' to " + t); + } + + return urls[i]; + } + + public void goToHtmlReport(ReportType type) { + String path = browser.getPath().getPath(); + if (path.equals(basePath + "html/report.html") && type == ReportType.REPORT_HTML) { + return; + } + if (path.equals(basePath + "html/index.html") && type == ReportType.INDEX_HTML) { + return; + } + + if (type == ReportType.INDEX_HTML && reportDialog.isFPutInIndex()) { + if (!path.equals(basePath + "index.html")) { + browser.home(); + browser.waitForPageLoading("</html>", Test.TESTSUITENAME); + } + String url = getUrlToHtmlReportPage(); + + URL u = Tools.urlFile(basePath + File.separator + url); + browser.clickUrl(u); + browser.waitForPageLoading("</small></body></html>", "<title>" + Test.WINDOWNAME + " Harness : Report"); + } + + if (type == ReportType.REPORT_HTML && reportDialog.isFPutInReport()) { + URL u = Tools.urlFile(basePath + File.separator + "html"); + browser.clickUrl(u); + browser.waitForPageLoading("</html>", "Directory listing for html"); + u = Tools.urlFile(basePath + File.separator + "html" + File.separator + "report.html"); + browser.clickUrl(u); + browser.waitForPageLoading("</small></body></html>", "<title>" + Test.WINDOWNAME + " Harness : Report"); + } + + Tools.pause(1); + } + + public void commitMainCheck() { + if (reportDialog.isFPutInIndex()) { + goToHtmlReport(ReportType.INDEX_HTML); + checkReportPage(); + } + if (reportDialog.isFPutInReport()) { + goToHtmlReport(ReportType.REPORT_HTML); + checkReportPage(); + } + if (!reportDialog.isFPutInIndex() && !reportDialog.isFPutInReport()) { + throw new JemmyException("NIY"); + } + + + } + + private StringBuffer checkFileUrls(String urls[]) { + StringBuffer temp = new StringBuffer(""); + boolean ts = false, wd = false, rp = false; + for (int i = 0; i < urls.length; i++) { + if (urls[i].equals(Test.LOCAL_PATH + Test.TEST_SUITE_NAME)) { + ts = true; + } + if (urls[i].equals(Test.LOCAL_PATH + Test.REPORT_WD_PATH)) { + wd = true; + } + if (urls[i].equals(basePath + "html")) { + rp = true; + } + } + if (!ts) { + temp.append("Url for testsuite was not found"); + } + if (!wd) { + temp.append("Url for workdirektory was not found"); + } + if (!rp) { + temp.append("Url for report directory was not found"); + } + return temp; + } + + public KFLValues getKFLList() throws JemmyException { + if (reportDialog.isFPutInIndex()) { + goToHtmlReport(ReportType.INDEX_HTML); + return checkKFLImpl(); + } + if (reportDialog.isFPutInReport()) { + goToHtmlReport(ReportType.REPORT_HTML); + return checkKFLImpl(); + } + + return null; + } + + private KFLValues checkKFLImpl() { + String htmlPath = basePath + "html" + File.separator; + String[] urls = browser.getUrls(); + StringBuilder error = new StringBuilder(""); + + if (Tools.findInStringArray(urls, "Known Failure Analysis") >= 0) { + error.append("Url to KFL block was not found"); + } + + KFLValues res = new KFLValues(); + + String text = browser.getText().replaceAll("[\t\n\r\f \"']", ""); + if (!text.replace("%20", "").contains(KFL_1) && !text.replace("%20", "").contains(KFL_2)) { + error.append("report doesn't contain Known Failure Analysis block\n"); + } + + if (reportDialog.isKFLCheckForTestcases()) { + + String s = TEST_CASES_TEXT; + int i = text.indexOf(s); + if (i < 0) { + error.append("report doesn't contain Test Cases column in KFL section while the option is turned on\n"); + } else { + int j = text.indexOf(')', i + s.length()); + res.testcases = Integer.parseInt(text.substring(i + s.length(), j)); + } + + + s = TC_F2P_LINK; + i = text.indexOf(s); + if (i < 0) { + error.append("report doesn't contain Fail2Passed TestCases link in KFL section while the option is turned on\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.tc_f2p = Integer.parseInt(text.substring(i + s.length(), j)); + } + + + if (reportDialog.isKFLFail2Error()) { + s = TC_F2E_LINK; + i = text.indexOf(s); + if (i < 0) { + error.append("report doesn't contain Fail2Error TestCases link in KFL section while the option is turned on\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.tc_f2e = Integer.parseInt(text.substring(i + s.length(), j)); + } + } + + + s = TC_F2N_LINK; + i = text.indexOf(s); + if (i < 0) { + error.append("report doesn't contain Fail2NotRun TestCases link in KFL section while the option is turned on\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.tc_f2n = Integer.parseInt(text.substring(i + s.length(), j)); + } + + + if (reportDialog.isKFLFail2Missing()) { + s = TC_F2M_LINK; + i = text.indexOf(s); + if (i < 0) { + error.append("report doesn't contain Fail2Missing TestCases link in KFL section while the option is turned on\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.tc_f2m = Integer.parseInt(text.substring(i + s.length(), j)); + } + } + + + s = TC_NEW_LINK; + i = text.indexOf(s); + if (i < 0) { + error.append("report doesn't contain NewFailures TestCases link in KFL section while the option is turned on\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.tc_nf = Integer.parseInt(text.substring(i + s.length(), j)); + } + + + if (reportDialog.isKFLFail2Fail()) { + if (!text.contains(NOT_CALC)) { + error.append("report doesn't contain 'not calculated' label that should appear in Fail2Fail TestCases cell\n"); + } + } + + } else { + if (text.contains(TEST_CASES_TEXT)) { + error.append("report contain TestCases column while option is turned off\n"); + } + } + + + String s = F2F; + int i = text.indexOf(s); + if (reportDialog.isKFLFail2Fail()) { + if (i < 0) { + error.append("report doesn't contain Fail2Fail link while option is turned on\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.f2f = Integer.parseInt(text.substring(i + s.length(), j)); + } + } else { + if (i > -1) { + error.append("report contain Fail2Fail link while option is turned off\n"); + } + } + + s = F2E; + i = text.indexOf(s); + if (reportDialog.isKFLFail2Error()) { + if (i < 0) { + error.append("report doesn't contain Fail2Error link while option is turned on\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.f2e = Integer.parseInt(text.substring(i + s.length(), j)); + } + } else { + if (i > -1) { + error.append("report contain Fail2Error link while option is turned off\n"); + } + } + + + s = F2M; + i = text.indexOf(s); + if (reportDialog.isKFLFail2Missing()) { + if (i < 0) { + error.append("report doesn't contain Fail2Missing link while option is turned on\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.f2m = Integer.parseInt(text.substring(i + s.length(), j)); + } + } else { + if (i > -1) { + error.append("report contain Fail2Missing link while option is turned off\n"); + } + } + + + s = TESTS_TEXT; + i = text.indexOf(s); + if (i < 0) { + error.append("report doesn't contain 'Tests' label\n"); + } else { + int j = text.indexOf(')', i + s.length()); + res.tests = Integer.parseInt(text.substring(i + s.length(), j)); + } + + + s = F2P; + i = text.indexOf(s); + if (i < 0) { + error.append("report doesn't contain Fail2Pass link\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.f2p = Integer.parseInt(text.substring(i + s.length(), j)); + } + + + s = F2N; + i = text.indexOf(s); + if (i < 0) { + error.append("report doesn't contain Fail2NotRun link\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.f2n = Integer.parseInt(text.substring(i + s.length(), j)); + } + + + s = NF; + i = text.indexOf(s); + if (i < 0) { + error.append("report doesn't contain NewFailures link\n"); + } else { + int j = text.indexOf('<', i + s.length()); + res.nf = Integer.parseInt(text.substring(i + s.length(), j)); + } + + if (error.length() > 0) { + throw new JemmyException(error.toString() + "\n" + text); + } + + return res; + } + + public enum ReportType { + + INDEX_HTML, REPORT_HTML + } + + public static class KFLValues { + + public int tc_f2e = -1; + public int tc_f2p = -1; + public int tc_f2m = -1; + public int tc_f2n = -1; + public int tc_nf = -1; + public int f2f = -1; + public int f2e = -1; + public int f2p = -1; + public int f2m = -1; + public int f2n = -1; + public int nf = -1; + public int tests = -1; + public int testcases = -1; + public KFLValues() { + } + public KFLValues(int tests, int f2f, int f2e, int f2p, int f2m, int f2n, int nf, int testcases, int tc_f2e, int tc_f2p, int tc_f2m, int tc_f2n, int tc_nf) { + this.tc_f2e = tc_f2e; + this.tc_f2p = tc_f2p; + this.tc_f2m = tc_f2m; + this.tc_f2n = tc_f2n; + this.tc_nf = tc_nf; + this.f2f = f2f; + this.f2e = f2e; + this.f2p = f2p; + this.f2m = f2m; + this.f2n = f2n; + this.nf = nf; + this.tests = tests; + this.testcases = testcases; + } + + @Override + public String toString() { + return String.format("tests %d f2f %d f2e %d f2p %d f2m %d f2n %d nf %d testcases %d tc_f2e %d tc_f2p %d tc_f2m %d tc_f2n %d tc_nf %d", tests, f2f, f2e, f2p, f2m, f2n, nf, testcases, tc_f2e, tc_f2p, tc_f2m, tc_f2n, tc_nf); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (getClass() != obj.getClass()) { + return false; + } + final KFLValues other = (KFLValues) obj; + if (this.tc_f2e != other.tc_f2e) { + return false; + } + if (this.tc_f2p != other.tc_f2p) { + return false; + } + if (this.tc_f2m != other.tc_f2m) { + return false; + } + if (this.tc_f2n != other.tc_f2n) { + return false; + } + if (this.tc_nf != other.tc_nf) { + return false; + } + if (this.f2f != other.f2f) { + return false; + } + if (this.f2e != other.f2e) { + return false; + } + if (this.f2p != other.f2p) { + return false; + } + if (this.f2m != other.f2m) { + return false; + } + if (this.f2n != other.f2n) { + return false; + } + if (this.nf != other.nf) { + return false; + } + if (this.tests != other.tests) { + return false; + } + if (this.testcases != other.testcases) { + return false; + } + return true; + } + + @Override + public int hashCode() { + int hash = 3; + hash = 37 * hash + this.tc_f2e; + hash = 37 * hash + this.tc_f2p; + hash = 37 * hash + this.tc_f2m; + hash = 37 * hash + this.tc_f2n; + hash = 37 * hash + this.tc_nf; + hash = 37 * hash + this.f2f; + hash = 37 * hash + this.f2e; + hash = 37 * hash + this.f2p; + hash = 37 * hash + this.f2m; + hash = 37 * hash + this.f2n; + hash = 37 * hash + this.nf; + hash = 37 * hash + this.tests; + hash = 37 * hash + this.testcases; + return hash; + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/ReportDialog.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/ReportDialog.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/ReportDialog.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/ReportDialog.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,412 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import jthtest.Tools; +import org.netbeans.jemmy.operators.*; +import org.netbeans.jemmy.util.NameComponentChooser; + +import javax.swing.*; + +public class ReportDialog { + + private final String TAB_FILES_NAME = "HTML Files"; + private final String TAB_OPTIONS_NAME = "HTML Options"; + private JDialogOperator rep; + private Tabs tab; + private boolean fPutInIndex, fPutInReport, fGeneratePassed, fGenerateError, fGenerateFailed, + fGenerateNotRun; + private boolean eBackUp; + private int eBackUpNum; + private boolean oConfig, oConfig_QuestionLog, oConfig_TestEnv, oConfig_StdValues, oResults, oKeywords, kflTC, kflf2f, kflf2e, kflf2m; + + public ReportDialog(JDialogOperator d) { + rep = d; + tab = Tabs.HTML_OPTIONS_TAB; + select(); + } + + public ReportDialog(JDialogOperator d, boolean init) { + rep = d; + tab = Tabs.UNSET; + select(); + + if (init) { + eBackUp = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.backup.bak")).isSelected(); + eBackUpNum = Integer.parseInt(Tools.getTextField(rep, Tools.getExecResource("nrd.backup.bak.level.lbl")).getText()); + selectTab(Tabs.HTML_FILES_TAB); + fPutInIndex = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.idx")).isSelected(); + fPutInReport = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.rpt")).isSelected(); + fGeneratePassed = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.pass")).isSelected(); + fGenerateError = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.err")).isSelected(); + fGenerateFailed = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.fail")).isSelected(); + fGenerateNotRun = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.nr")).isSelected(); + selectTab(Tabs.HTML_OPTIONS_TAB); + oConfig = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.config")).isSelected(); + oConfig_QuestionLog = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.ql")).isSelected(); + oConfig_TestEnv = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.env")).isSelected(); + oConfig_StdValues = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.std")).isSelected(); + oResults = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.res")).isSelected(); + oKeywords = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.kw")).isSelected(); + selectTab(Tabs.KFL_OPTIONS_TAB); + kflTC = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.checktc")).isSelected(); + kflf2e = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.f2e")).isSelected(); + kflf2f = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.f2f")).isSelected(); + kflf2m = new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.missing")).isSelected(); + } else { + setExtraBackUp(true); + setExtraBackUpNum(1); + setFilesAll(true); + setOptionsAll(true); + setKFLAll(true); + } + } + + public static boolean setHtmlChecked(JDialogOperator rep, boolean set) { + JCheckBox element = getListElement(rep, 0); + boolean temp = element.isSelected(); + element.setSelected(set); + return temp; + } + + public static JCheckBox getListElement(JDialogOperator rep, int index) { + JListOperator types = getList(rep); + return (JCheckBox) types.getModel().getElementAt(index); + } + + public static JListOperator getList(JDialogOperator rep) { + JListOperator types = new JListOperator(rep, new NameComponentChooser("nrd.typel")); + return types; + } + + public static JDialogOperator findShowReportDialog() { + return new JDialogOperator(Tools.getExecResource("nrd.showReport.title")); + } + + public boolean isEBackUp() { + return eBackUp; + } + + public int getEBackUpNum() { + return eBackUpNum; + } + + public boolean isFGenerateError() { + return fGenerateError; + } + + public boolean isFGenerateFailed() { + return fGenerateFailed; + } + + public boolean isFGenerateNotRun() { + return fGenerateNotRun; + } + + public boolean isFGeneratePassed() { + return fGeneratePassed; + } + + public boolean isFPutInIndex() { + return fPutInIndex; + } + + public boolean isFPutInReport() { + return fPutInReport; + } + + public boolean isOConfig() { + return oConfig; + } + + public boolean isOConfig_QuestionLog() { + return oConfig_QuestionLog; + } + + public boolean isOConfig_StdValues() { + return oConfig_StdValues; + } + + public boolean isOConfig_TestEnv() { + return oConfig_TestEnv; + } + + public boolean isOKeywords() { + return oKeywords; + } + + public boolean isOResults() { + return oResults; + } + + public boolean isKFLCheckForTestcases() { + return kflTC; + } + + public void setKFLCheckForTestcases(boolean b) { + if (kflTC == b) + return; + if (tab != Tabs.KFL_OPTIONS_TAB) { + selectTab(Tabs.KFL_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.checktc")).setSelected(b); + kflTC = b; + } + + public boolean isKFLFail2Fail() { + return kflf2f; + } + + public void setKFLFail2Fail(boolean b) { + if (kflf2f == b) + return; + if (tab != Tabs.KFL_OPTIONS_TAB) { + selectTab(Tabs.KFL_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.f2f")).setSelected(b); + kflf2f = b; + } + + public boolean isKFLFail2Error() { + return kflf2e; + } + + public void setKFLFail2Error(boolean b) { + if (kflf2e == b) + return; + if (tab != Tabs.KFL_OPTIONS_TAB) { + selectTab(Tabs.KFL_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.f2e")).setSelected(b); + kflf2e = b; + } + + public boolean isKFLFail2Missing() { + return kflf2m; + } + + public void setKFLFail2Missing(boolean b) { + if (kflf2m == b) + return; + if (tab != Tabs.KFL_OPTIONS_TAB) { + selectTab(Tabs.KFL_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.missing")).setSelected(b); + kflf2m = b; + } + + private void select() { + setHtmlChecked(rep, true); + } + + public boolean setHtmlChecked(boolean set) { + JCheckBox element = getListElement(rep, 0); + boolean temp = element.isSelected(); + element.setSelected(set); + return temp; + } + + public boolean setXmlChecked(boolean set) { + JCheckBox element = getListElement(rep, 2); + boolean temp = element.isSelected(); + element.setSelected(set); + return temp; + } + + public boolean setPlainChecked(boolean set) { + JCheckBox element = getListElement(rep, 1); + boolean temp = element.isSelected(); + element.setSelected(set); + return temp; + } + + public boolean setTypeChecked(int num, boolean set) { + JCheckBox element = getListElement(rep, num); + boolean temp = element.isSelected(); + element.setSelected(set); + return temp; + } + + public void selectTab(Tabs tab) { + switch (tab) { + case HTML_FILES_TAB: + new JTabbedPaneOperator(rep, new NameComponentChooser("nrd.tabs")).selectPage(TAB_FILES_NAME); + break; + case HTML_OPTIONS_TAB: + new JTabbedPaneOperator(rep, new NameComponentChooser("nrd.tabs")).selectPage(TAB_OPTIONS_NAME); + break; + } + this.tab = Tabs.HTML_FILES_TAB; + } + + public void setExtraBackUp(boolean b) { + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.backup.bak")).setSelected(b); + eBackUp = b; + } + + public void setExtraBackUpNum(Integer num) { + Tools.getTextField(rep, Tools.getExecResource("nrd.backup.bak.level.lbl")).typeText(num.toString()); + eBackUpNum = num; + } + + public void setFilesPutInIndex(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.idx")).setSelected(b); + fPutInIndex = b; + } + + public void setFilesPutInReport(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.rpt")).setSelected(b); + fPutInReport = b; + } + + public void setFilesGeneratePassedTests(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.pass")).setSelected(b); + fGeneratePassed = b; + } + + public void setFilesGenerateErrorTests(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.err")).setSelected(b); + fGenerateError = b; + } + + public void setFilesGenerateFailedTests(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.fail")).setSelected(b); + fGenerateFailed = b; + } + + public void setFilesGenerateNotRunTests(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.nr")).setSelected(b); + fGenerateNotRun = b; + } + + public void setOptionsConfiguration(boolean config, boolean questionLog, boolean testEnviroment, boolean standartVal) { + if (tab != Tabs.HTML_OPTIONS_TAB) { + selectTab(Tabs.HTML_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.config")).setSelected(config); + oConfig = config; + if (config) { + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.ql")).setSelected(questionLog); + oConfig_QuestionLog = questionLog; + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.env")).setSelected(testEnviroment); + oConfig_TestEnv = testEnviroment; + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.std")).setSelected(standartVal); + oConfig_StdValues = standartVal; + } else { + oConfig_QuestionLog = oConfig_StdValues = oConfig_TestEnv = false; + } + } + + public void setOptionsResults(boolean b) { + if (tab != Tabs.HTML_OPTIONS_TAB) { + selectTab(Tabs.HTML_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.res")).setSelected(b); + oResults = b; + } + + public void setOptionsKeyword(boolean b) { + if (tab != Tabs.HTML_OPTIONS_TAB) { + selectTab(Tabs.HTML_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.kw")).setSelected(b); + oKeywords = b; + } + + public void setOptionsAll(boolean b) { + if (tab != Tabs.HTML_OPTIONS_TAB) { + selectTab(Tabs.HTML_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.ql")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.env")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.std")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.config")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.res")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlops.kw")).setSelected(b); + oConfig = oConfig_QuestionLog = oConfig_StdValues = oConfig_TestEnv = oKeywords = oResults = b; + } + + public void setFilesAll(boolean b) { + if (tab != Tabs.HTML_FILES_TAB) { + selectTab(Tabs.HTML_FILES_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.nr")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.fail")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.err")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.pass")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.rpt")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlf.idx")).setSelected(b); + fGenerateError = fGenerateFailed = fGenerateNotRun = fGeneratePassed = fPutInIndex = fPutInReport = b; + } + + public void setKFLAll(boolean b) { + if (tab != Tabs.KFL_OPTIONS_TAB) { + selectTab(Tabs.KFL_OPTIONS_TAB); + } + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.checktc")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.f2e")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.f2f")).setSelected(b); + new JCheckBoxOperator(rep, new NameComponentChooser("nrd.htmlkfl.missing")).setSelected(b); + kflTC = kflf2e = kflf2f = kflf2m = b; + } + + public void setPath(String path) { + new JButtonOperator(rep, Tools.getExecResource("nrd.browse.btn")).push(); + JDialogOperator browser = new JDialogOperator("Report Directory"); + Tools.getTextField(browser, "File Name:").typeText(path); + new JButtonOperator(browser, "Open").push(); + } + + public void pushCreate() { + new JButtonOperator(rep, Tools.getExecResource("nrd.ok.btn")).push(); + } + + public enum Tabs { + + HTML_FILES_TAB, HTML_OPTIONS_TAB, KFL_OPTIONS_TAB, UNSET + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/Task.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/Task.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/Task.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/Task.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,196 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import org.netbeans.jemmy.TimeoutExpiredException; + +public abstract class Task<resType> extends Thread { + + private final Object workingLock = new Object(); + protected resType result; + protected Throwable exception = null; + private State state = State.NOT_RUN; + + public Task() { + this(true); + } + + public Task(boolean start) { + super(); + init(); + if (start) { + this.start(); + } + } + + protected void init() { + } + + public final State getTaskState() { + if (exception != null) { + throw new RuntimeException(exception); + } + return state; + } + + public synchronized void interruptTask() { + if (exception != null) { + throw new RuntimeException(exception); + } + if (state != State.FINISHED) { + this.interrupt(); + state = State.INTERUPPED; + interruptImpl(); + } + } + + protected void interruptImpl() { + } + + public synchronized void pause() { + if (exception != null) { + throw new RuntimeException(exception); + } + if (state != State.INTERUPPED && state != State.FINISHED) { + state = State.INTERUPPED; + pauseImpl(); + } + } + + protected void pauseImpl() { + } + + public void waitForDone() { + synchronized (workingLock) { + if (exception != null) { + throw new RuntimeException(exception); + } + } + return; + } + + public resType getResult() { + synchronized (workingLock) { + if (exception != null) { + throw new RuntimeException(exception); + } + return result; + } + } + + protected abstract void runImpl() throws Throwable; + + @Override + public final void run() { + synchronized (workingLock) { + state = State.WORKING; + try { + runImpl(); + state = State.FINISHED; + } catch (Throwable ex) { + exception = ex; + state = State.INTERUPPED; + } + } + } + + public final void startAndWaitForDone() { + if (state == State.NOT_RUN) { + start(); + } + waitForDone(); + } + + @Override + public final void start() { + super.start(); + while (state == State.NOT_RUN) { + Thread.yield(); + } + } + + public static enum State { + + NOT_RUN, WORKING, INTERUPPED, FINISHED, PAUSED + } + + public abstract static class Waiter extends Task<Boolean> { + + protected int maxTimeToWaitMS; + protected int stepMS; + + public Waiter() { + this(true, 10000, 100); + } + + public Waiter(int maxtime) { + this(true, maxtime, 100); + } + + public Waiter(int maxtime, int step) { + this(true, maxtime, step); + } + + public Waiter(boolean start, int maxtime, int step) { + super(start); + maxTimeToWaitMS = maxtime; + stepMS = step; + init(); + } + + public Waiter(boolean start) { + this(start, 10000, 100); + } + + @Override + protected void runImpl() throws InterruptedException { + int t = 0; + while (!check() && super.getTaskState() == State.WORKING) { + if (t > maxTimeToWaitMS) { + result = false; + exception = new TimeoutExpiredException(getTimeoutExceptionDescription()); + return; + } + Waiter.sleep(stepMS); + t += stepMS; + } + result = true; + } + + public void stopWaiter() { + interruptTask(); + } + + protected abstract boolean check(); + + protected String getTimeoutExceptionDescription() { + return "Timeout expired in waiter task " + this; + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/TestSuite.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/TestSuite.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/TestSuite.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/TestSuite.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,58 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import jthtest.Tools; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +public class TestSuite { + public static String OPEN_TEST_SUITE_DIALOG_NAME_TI18N = "tsc.title"; + private final JTFrame mainFrame; + private String name; + + TestSuite(JTFrame mainFrame) { + this.mainFrame = mainFrame; + } + + public static String getOpenTestSuiteDialogName() { + return Tools.getToolResource(OPEN_TEST_SUITE_DIALOG_NAME_TI18N); + } + + public void openTestSuite(String path) { + mainFrame.getFile_Open_TestSuiteMenu().pushNoBlock(); + JDialogOperator openDialog = new JDialogOperator(getOpenTestSuiteDialogName()); + new JTextFieldOperator(openDialog, "").enterText(path); + name = path; + } + + public String getName() { + return name; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/TestTree.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/TestTree.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/TestTree.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/TestTree.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,215 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import jthtest.Tools; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.TimeoutExpiredException; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JPopupMenuOperator; +import org.netbeans.jemmy.operators.JTreeOperator; + +import javax.swing.*; +import javax.swing.tree.TreePath; +import java.awt.event.MouseEvent; +import java.util.LinkedList; +import java.util.logging.Level; +import java.util.logging.Logger; + +public class TestTree { + + private JTreeOperator tree; + private JTFrame frame; + + public TestTree(JTFrame mainFrame) { + tree = new JTreeOperator(mainFrame.getJFrameOperator()); + frame = mainFrame; + } + + public boolean[] getRowsVisibility() { + int rows = tree.getVisibleRowCount(); + boolean[] visibleRows = new boolean[rows]; + for (int i = 0; i < rows; i++) { + visibleRows[i] = tree.isVisible(tree.getPathForRow(i)); + } + return visibleRows; + } + + public TreePath[] getVisibleRows() { + int rows = tree.getVisibleRowCount(); + LinkedList<TreePath> paths = new LinkedList<TreePath>(); + for (int i = 0; i < rows; i++) { + TreePath path = tree.getPathForRow(i); + if (tree.isVisible(path)) { + paths.add(path); + } + } + return paths.toArray(new TreePath[0]); + } + + public int getVisibleRowCount() { + int rows = tree.getRowCount(); + int count = 0; + for (int i = 0; i < rows; i++) { + if (tree.isVisible(tree.getPathForRow(i))) { + count++; + } + } + return count; + } + + public Icon getIcon(int row) { + return (((JLabel) tree.getRenderedComponent(tree.getPathForRow(row))).getIcon()); + } + + public Icon getIcon(TreePath path) { + return (((JLabel) tree.getRenderedComponent(path)).getIcon()); + } + + public TreePath[] click(TreePath path) { + tree.clickOnPath(path, 2); + return tree.getChildPaths(path); + } + + public TreePath[] click(int row) { + TreePath path = tree.getPathForRow(row); + tree.clickOnPath(path, 2); + return tree.getChildPaths(path); + } + + public void clickPopup(TreePath path) { + tree.clickOnPath(path, 1, MouseEvent.BUTTON3_MASK); + } + + public void clickPopup(int row) { + TreePath path = tree.getPathForRow(row); + tree.clickOnPath(path, 1, MouseEvent.BUTTON3_MASK); + } + + public TreePath getRoot() { + return tree.getPathForRow(0); + } + + public boolean isVisible(TreePath path) { + return tree.isVisible(path); + } + + public boolean isExpanded(TreePath path) { + return tree.isExpanded(path); + } + + public void waitForExpand(TreePath path) { + int time = 0; + try { + while (time < Tools.MAX_WAIT_TIME) { + Thread.sleep(50); + time += 50; + if (isExpanded(path)) { + return; + } + } + throw new TimeoutExpiredException("Waiting for expanding path " + path); + } catch (InterruptedException ex) { + Logger.getLogger(TestTree.class.getName()).log(Level.SEVERE, null, ex); + throw new JemmyException("Exception occured", ex); + } + } + + public void waitForCollapse(TreePath path) { + int time = 0; + try { + while (time < Tools.MAX_WAIT_TIME) { + Thread.sleep(50); + time += 50; + if (tree.isCollapsed(path)) { + return; + } + } + throw new TimeoutExpiredException("Waiting for collapsing path " + path); + } catch (InterruptedException ex) { + Logger.getLogger(TestTree.class.getName()).log(Level.SEVERE, null, ex); + throw new JemmyException("Exception occured", ex); + } + } + + public void selectRows(int... rows) { + tree.setSelectionRows(rows); + } + + public TreePath[] getSelectedRows() { + return tree.getSelectionPaths(); + } + + public int[] getSelectedRowsIndexes() { + return tree.getSelectionRows(); + } + + public boolean isTest(TreePath path) { + return tree.getModel().isLeaf(path.getLastPathComponent()); + } + + public boolean isDirectory(TreePath path) { + return !isTest(path); + } + + public TreePath getPathForRow(int i) { + return tree.getPathForRow(i); + } + + public void clearResults() { + clickPopup(getRoot()); + new JPopupMenuOperator(frame.getJFrameOperator()).pushMenuNoBlock("Clear Results"); + new JButtonOperator(new JDialogOperator("Confirm Clear Operation"), "Yes").push(); + new Task.Waiter() { + + @Override + protected boolean check() { + return frame.getPassedCounter() == 0 && frame.getNotRunCounter() == frame.getAllTestsCounter(); + } + + @Override + protected String getTimeoutExceptionDescription() { + return "Timeout expired while waiting for clearing tests"; + } + }.waitForDone(); + } + + public Task<Boolean> runTests() { + if (tree.getSelectionCount() < 1) { + return frame.runTests(0); + } + + return frame.runTests(tree.getSelectionRows()[0]); + } + + public Task<Boolean> runAllTests() { + return frame.runTests(0); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/WorkDirectoryBrowser.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/WorkDirectoryBrowser.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/WorkDirectoryBrowser.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/WorkDirectoryBrowser.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,196 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import jthtest.Tools; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +import javax.swing.*; +import java.io.File; + +public class WorkDirectoryBrowser { + + public static final String OPEN_DIALOG_TI18N_NAME = "wdc.open.title"; + public static final String CREATE_DIALOG_TI18N_NAME = "wdc.new.title"; + public static final String CREATE_BUTTON_TI18N_NAME = "wdc.new.btn"; + public static final String OPEN_BUTTON_TI18N_NAME = "wdc.open.btn"; + public static final String CANCEL_BUTTON_TI18N_NAME = "uif.cancel.btn"; + public static final String[] TEXT_FIELD_NAMES = {"Folder name:", "File name:", "Folder Name:", "File Name:"}; + private Types type; + private JDialogOperator dialog; + private boolean opened = false; + private String path = ""; + private String name = ""; + private String fullPath = ""; + + private WorkDirectoryBrowser(Types type) { + this.type = type; + switch (type) { + case CREATE: + dialog = new JDialogOperator(getCreateWorkDirectoryDialogName()); + break; + case OPEN: + dialog = new JDialogOperator(getOpenWorkDirectoryDialogName()); + break; + } + opened = true; + } + + ; + + public static WorkDirectoryBrowser create() { + return new WorkDirectoryBrowser(Types.CREATE); + } + + public static WorkDirectoryBrowser open() { + return new WorkDirectoryBrowser(Types.OPEN); + } + + public static String getOpenWorkDirectoryDialogName() { + return Tools.getToolResource(OPEN_DIALOG_TI18N_NAME); + } + + public static String getCreateWorkDirectoryDialogName() { + return Tools.getToolResource(CREATE_DIALOG_TI18N_NAME); + } + + public static String getCancelButtonName() { + return Tools.getToolResource(CANCEL_BUTTON_TI18N_NAME); + } + + public void setPath(String path, String name) { + if (opened) { + if (("true").equalsIgnoreCase(System.getProperty("com.sun.javatest.exec.templateMode"))) { + setPath(path); + setName(name); + } else { + this.path = path; + this.name = name; + fullPath = path + File.separator + name; + JTextFieldOperator tf = getFileTextField(); + tf.clearText(); + tf.typeText(fullPath); + } + } + } + + public void setPath(String path) { + this.path = path + File.separator; + if (name != null) { + fullPath = this.path + name; + } else { + fullPath = this.path; + } + if (opened) { + if (("true").equalsIgnoreCase(System.getProperty("com.sun.javatest.exec.templateMode"))) { + JButtonOperator op = new JButtonOperator(dialog, "Browse..."); + op.push(); + JDialogOperator d = new JDialogOperator("Please select work directory"); + JTextFieldOperator tf = new JTextFieldOperator(d); + tf.clearText(); + tf.enterText(this.path); + } else { + JTextFieldOperator tf = getFileTextField(); + tf.clearText(); + tf.typeText(fullPath); + } + } + } + + public void setFullPath(String path) { + int separator = path.lastIndexOf(File.separator); + if (separator != -1) { + setPath(path.substring(0, separator)); + } + setName(path.substring(separator + 1, path.length())); + } + + public void setName(String name) { + this.name = name; + if (path != null) { + fullPath = path + name; + } else { + fullPath = name; + } + if (opened) { + if (("true").equals(System.getProperty("com.sun.javatest.exec.templateMode"))) { +// JTextFieldOperator tf = new JTextFieldOperator((JTextField) Tools.getComponent(dialog, new String[]{"Work Directory Name:"})); + JTextFieldOperator tf = new JTextFieldOperator(dialog); + tf.clearText(); + tf.typeText(this.name); + } else { + JTextFieldOperator tf = getFileTextField(); + tf.clearText(); + tf.typeText(fullPath); + } + } + } + + public void cancel() { + getCancelButton().push(); + } + + public void commit() { + getCommitButton().push(); + } + + public JButtonOperator getCancelButton() { + return new JButtonOperator(dialog, getCancelButtonName()); + } + + public JButtonOperator getCommitButton() { + return new JButtonOperator(dialog, getCommitButtonName()); + } + + private JTextFieldOperator getFileTextField() { + return new JTextFieldOperator((JTextField) Tools.getComponent(dialog, TEXT_FIELD_NAMES)); + } + + public String getCommitButtonName() { + switch (type) { + case CREATE: + return Tools.getToolResource(CREATE_BUTTON_TI18N_NAME); + case OPEN: + return Tools.getToolResource(OPEN_BUTTON_TI18N_NAME); + default: + return "Create"; + } + } + + public boolean isOpened() { + return opened; + } + + public static enum Types { + + CREATE, OPEN + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/WorkDirectory.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/WorkDirectory.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/tools/WorkDirectory.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/tools/WorkDirectory.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,153 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.tools; + +import jthtest.Tools; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +import java.io.File; + +public class WorkDirectory { + + public static String TO_DELETE_TEMP_WD_NAME = "some_temp_wd_that_will_be_deleted"; + private final JTFrame mainFrame; + private String fullPath; + + WorkDirectory(JTFrame mainFrame) { + this.mainFrame = mainFrame; + } + + public WorkDirectoryBrowser openWorkDirectoryCreation() { + mainFrame.getFile_CreateWorkDirectoryMenu().pushNoBlock(); + return WorkDirectoryBrowser.create(); + } + + public WorkDirectoryBrowser openWorkDirectoryOpening() { + mainFrame.getFile_Open_WorkDirectoryMenu().pushNoBlock(); + return WorkDirectoryBrowser.open(); + } + + public File createWorkDirectory(String path, String name, boolean delete) { + fullPath = path + File.separator + name; + File file = new File(fullPath); + if (delete) { + Tools.deleteDirectory(file); + } + + WorkDirectoryBrowser browser = openWorkDirectoryCreation(); + browser.setPath(path); + browser.setName(name); + browser.commit(); + + return file; + } + + public File createWorkDirectory(String name, boolean delete) { + fullPath = Tools.LOCAL_PATH + File.separator + name; + File file = new File(fullPath); + if (delete) { + Tools.deleteDirectory(file); + } + + WorkDirectoryBrowser browser = openWorkDirectoryCreation(); + browser.setFullPath(name); + browser.commit(); + + return file; + } + + public File createWorkDirectoryInTemp() { + int attempts = 0; + File temp = new File(Tools.TEMP_PATH); + if (!temp.exists()) { + temp.mkdirs(); + } + + WorkDirectoryBrowser browser = openWorkDirectoryCreation(); + + String wdName = Tools.TEMP_WD_NAME; + File file = null; + while (attempts < 10) { + String path = Tools.TEMP_PATH + wdName; + file = new File(path); + if (!file.exists()) { + break; + } + Tools.deleteDirectory(file); + file = new File(path); + if (!file.exists()) { + break; + } + wdName = Tools.TEMP_WD_NAME + (int) (Math.random() * 10000); + attempts++; + } + if (attempts >= 10) { + throw new JemmyException("error"); + } + + browser.setPath(Tools.TEMP_PATH, wdName); +// browser.setName(wdName); + browser.commit(); + + return file; + } + + public File openWorkDirectory(String path, String name) { + fullPath = path + File.separator + name; + File file = new File(fullPath); + + WorkDirectoryBrowser browser = openWorkDirectoryOpening(); + browser.setPath(path); + browser.setName(name); + browser.commit(); + + return file; + } + + public File openWorkDirectory(File wd) { + fullPath = wd.getAbsolutePath(); + File file = new File(fullPath); + + WorkDirectoryBrowser browser = openWorkDirectoryOpening(); + browser.setFullPath(fullPath); + browser.commit(); + + return file; + } + + public void waitForStatus(WDStatus status) { + new JTextFieldOperator(mainFrame.getJFrameOperator(), Tools.getExecResource("br.worst." + status.ordinal())); + } + + public enum WDStatus { + + ALL_PASSED, SOME_FAILED, SOME_ERRORS, SOME_NOTRUN + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Tools.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Tools.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/Tools.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/Tools.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,969 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest; + +import java.awt.Component; +import java.io.BufferedReader; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.FileReader; +import java.io.FileWriter; +import java.io.IOException; +import java.io.PrintWriter; +import java.lang.reflect.InvocationTargetException; +import java.net.MalformedURLException; +import java.net.URL; +import java.nio.channels.FileChannel; +import java.util.ArrayList; +import java.util.Arrays; +import java.util.LinkedList; +import java.util.List; +import java.util.ResourceBundle; +import java.util.logging.Level; +import java.util.logging.Logger; + +import org.junit.After; +import org.netbeans.jemmy.ClassReference; +import org.netbeans.jemmy.ComponentChooser; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.JemmyProperties; +import org.netbeans.jemmy.TestOut; +import org.netbeans.jemmy.TimeoutExpiredException; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JCheckBoxOperator; +import org.netbeans.jemmy.operators.JComboBoxOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JLabelOperator; +import org.netbeans.jemmy.operators.JMenuBarOperator; +import org.netbeans.jemmy.operators.JMenuOperator; +import org.netbeans.jemmy.operators.JRadioButtonOperator; +import org.netbeans.jemmy.operators.JTabbedPaneOperator; +import org.netbeans.jemmy.operators.JTableOperator; +import org.netbeans.jemmy.operators.JTextAreaOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; +import org.netbeans.jemmy.operators.JTreeOperator; +import org.netbeans.jemmy.operators.Operator.StringComparator; +import org.netbeans.jemmy.util.NameComponentChooser; + +import javax.swing.JComboBox; +import javax.swing.JComponent; +import javax.swing.JDialog; +import javax.swing.JTextField; + +import com.sun.javatest.TestResult; + +import jthtest.menu.Menu; + +public class Tools { + + @Deprecated + public static final String TEMP_WD_NAME = "javatest_guitest_demowd"; + @Deprecated + public static final String DEFAULT_WD_NAME = "demowd_config"; + @Deprecated + public static final String WD_RUN_NAME = "demowd_run"; + @Deprecated + public static final String TEST_SUITE_NAME = "demots"; + @Deprecated + public static final String TEMPLATE_NAME = "demotemplate.jtm"; + @Deprecated + public static final String INCOMPLETE_TEMPLATE_NAME = "demotemplate_incomplete.jtm"; + @Deprecated + public static final String REPORT_NAME = "demoreport"; + @Deprecated + public static final String CONFIG_NAME = "democonfig.jti"; + @Deprecated + public static final String TESTS_DIRECTORY_PREFIX = "tests" + File.separator; + @Deprecated + public static final String NEWDESKTOP_ARG = "-newdesktop"; + @Deprecated + //public static final String WINDOWNAME = System.getProperty("jt_gui_test.name"); + public static final String WINDOWNAME = "JT"; + @Deprecated + public static final String TESTSUITENAME = "DemoTS 1.0 Test Suite (Tag Tests)"; + public static final int MAX_WAIT_TIME = 20000; + @Deprecated + public static String TEMP_PATH; + @Deprecated + public static String LOCAL_PATH; + @Deprecated + public static String DEFAULT_PATH; + @Deprecated + public static String USER_HOME_PATH; + private static ResourceBundle i18nExecResources; // reading resources exacly from the javatest.jar to not to do mistakes in element's names + private static ResourceBundle i18nToolResources; // reading resources of dialog boxes exacly from the javatest.jar to not to do mistakes in element's names + private static ResourceBundle i18nJckResources; + private static LinkedList<File> usedFiles = new LinkedList<File>(); + + static { + JemmyProperties.getCurrentTimeouts().setTimeout("ComponentOperator.WaitComponentTimeout", MAX_WAIT_TIME); + JemmyProperties.setCurrentOutput(new TestOut(null, (PrintWriter) null, null)); + + i18nJckResources = ResourceBundle.getBundle("com.sun.javatest.tool.i18n_jck"); + i18nExecResources = ResourceBundle.getBundle("com.sun.javatest.exec.i18n"); + i18nToolResources = ResourceBundle.getBundle("com.sun.javatest.tool.i18n"); + + String temp = System.getProperty("user.dir") + File.separator; + if (temp == null || "".equals(temp)) { + File tmp = new File(""); + temp = tmp.getAbsolutePath(); + } + DEFAULT_PATH = LOCAL_PATH = temp; + + +// StringBuffer tempPath = new StringBuffer(); +// try { +// File tmp = File.createTempFile("xxxxxxx", "yyy"); +// tempPath.append(tmp.getCanonicalPath().split("xxxxxxx")[0]); +// tmp.delete(); +// } catch (IOException e) { +// System.err.println("Error while initialization: cannot create temp file"); +// } +// temp = tempPath.toString(); +// if (temp == null || "".equals(temp)) { +// temp = LOCAL_PATH; +// } +// TEMP_PATH = temp; + TEMP_PATH = LOCAL_PATH + File.separator + "temp"; + + USER_HOME_PATH = System.getProperty("user.home") + File.separator; + } + + ; + + public static JTabbedPaneOperator getPage(JFrameOperator frame, TestList list) { + JTabbedPaneOperator tabs = new JTabbedPaneOperator(frame, new NameComponentChooser("br.tabs")); + + switch (list) { + case PASSED: + tabs.selectPage(getExecResource("br.tabs.tl0.tab")); + break; + case FAILED: + tabs.selectPage(getExecResource("br.tabs.tl1.tab")); + break; + case ERROR: + tabs.selectPage(getExecResource("br.tabs.tl2.tab")); + break; + case NOT_RUN: + tabs.selectPage(getExecResource("br.tabs.tl3.tab")); + break; + case FILTERED_OUT: + tabs.selectPage(getExecResource("br.tabs.fo.tab")); + break; + } + return tabs; + } + + public static String getExecResource(String key) { + return i18nExecResources.getString(key); + } + + public static String getToolResource(String key) { + return i18nToolResources.getString(key); + } + + public static String getJckResource(String key) { + return i18nJckResources.getString(key); + } + + // checks if panel is opened + public static boolean checkPanel() { + return true; + } + + // checks if configuration editor contains standard config file + public static boolean checkStandardConfig(JDialogOperator configEditor) { + return true; + } + + // opens standard test suite + public static void openTestSuite(JFrameOperator frame) { + + try { + Thread.sleep(3000); + } catch (InterruptedException e) { + e.printStackTrace(); + } + + Menu.getFile_Open_TestSuiteMenu(frame).pushNoBlock(); + //Wait for dialog box to appear + JDialogOperator openDialog = new JDialogOperator(getToolResource("tsc.title")); + //Find edit box for file name + new JTextFieldOperator(openDialog, "").enterText(TEST_SUITE_NAME); + } + + // creates standard work directory using menu + @Deprecated + public static String createWorkDirInTemp(JFrameOperator mainFrame) { + int attempts = 0; + + new JMenuOperator(mainFrame).pushMenuNoBlock(getExecResource("qlb.file.menu") + "|" + getExecResource("ch.newWorkDir.act"), "|"); + + JDialogOperator filer = new JDialogOperator(mainFrame, getToolResource("wdc.new.title")); + String path = TEMP_PATH + TEMP_WD_NAME; + while (attempts < 10) { + File file = new File(path); + if (!file.exists()) { + usedFiles.add(file); + break; + } + deleteDirectory(file); + file = new File(path); + if (!file.exists()) { + usedFiles.add(file); + break; + } + path = TEMP_PATH + TEMP_WD_NAME + (int) (Math.random() * 10000); + attempts++; + } + if (attempts >= 10) { + throw new JemmyException("error"); + } + JTextFieldOperator tf; + + tf = new JTextFieldOperator((JTextField) Tools.getComponent(filer, new String[]{"Folder name:", "File name:", "Folder Name:", "File Name:"})); + tf.enterText(path); + return path; + } + + // picks standatd work directory using dialog box "work directory needed" + public static void pickWorkDir(JFrameOperator mainFrame) { + JDialogOperator wrkDir = new JDialogOperator(mainFrame, getExecResource("exec.wd.need.title")); + + new JButtonOperator(wrkDir, getExecResource("exec.wd.new.btn")).push(); + + wrkDir = new JDialogOperator(mainFrame, getExecResource("wdc.createtitle")); + + deleteDirectory(new File(TEMP_PATH + TEMP_WD_NAME)); + getTextField(wrkDir, getExecResource("wdc.dir.name.lbl")).typeText(TEMP_WD_NAME); + + new JButtonOperator(wrkDir, getExecResource("wdc.browse.btn")).push(); + + JDialogOperator filer = new JDialogOperator(mainFrame, getExecResource("wdc.filechoosertitle")); + + JTextFieldOperator tf; + + tf = new JTextFieldOperator((JTextField) Tools.getComponent(filer, new String[]{"Folder name:", "File name:"})); + tf.enterText(TEMP_WD_NAME); + + new JButtonOperator(wrkDir, getExecResource("wdc.create.btn")).push(); + } + + // gets TextField in dialog by it's caption + public static JTextFieldOperator getTextField(JDialogOperator dialog, String caption) { + JLabelOperator label = new JLabelOperator(dialog, caption); + return new JTextFieldOperator((JTextField) label.getLabelFor()); + } + + // gets JTextField in dialog by it's dialog name + public static String getTextField(JDialogOperator dialog) { + return new JTextFieldOperator(dialog, "").getText(); + } + + // gets JTextArea in dialog by it's dialog name + public static String getTextArea(JDialogOperator dialog) { + return new JTextAreaOperator(dialog, "").getText(); + } + + public static JComponent getComponent(final JDialogOperator dialog, final String captions[]) { + ComponentFinder threads[] = new ComponentFinder[captions.length]; + final JLabelOperatorRef ref = new JLabelOperatorRef(); + for (int i = 0; i < captions.length; i++) { + threads[i] = new ComponentFinder(ref, dialog, captions[i]); + threads[i].start(); + } + boolean someIsAlive = true; + while (ref.isOpNull() && someIsAlive) { + someIsAlive = false; + for (ComponentFinder finder : threads) { + if (finder.isAlive) { + someIsAlive = true; + } + if (!ref.isOpNull()) + break; + } + } + if (!ref.isOpNull()) { + return (JComponent) ref.getOp().getLabelFor(); + } + StringBuilder build = new StringBuilder("Was not found any of components: "); + for (String caption : captions) { + build.append(caption).append(" "); + } + throw new JemmyException("Error occured while searching components", new TimeoutExpiredException(build.toString())); + } + + public static <ComponentClass extends JComponent> ComponentClass getComponentPar(final JDialogOperator dialog, final String captions[]) { + ComponentFinder threads[] = new ComponentFinder[captions.length]; + final JLabelOperatorRef ref = new JLabelOperatorRef(); + for (int i = 0; i < captions.length; i++) { + threads[i] = new ComponentFinder(ref, dialog, captions[i]); + threads[i].start(); + } + boolean anyFinderAlive; + ComponentFindersCheck: + do { + anyFinderAlive = false; + for (ComponentFinder finder : threads) { + if (!ref.isOpNull()) { + try { + ComponentClass check = (ComponentClass) ref.getOp().getLabelFor(); + return check; + } catch (Exception e) { + } + } + if (finder.isAlive) { + anyFinderAlive = true; + continue ComponentFindersCheck; + } + } + } while (anyFinderAlive); + StringBuilder build = new StringBuilder("Was not found any of components: "); + for (String caption : captions) { + build.append(caption).append(" "); + } + throw new JemmyException("Error occured while searching components", new TimeoutExpiredException(build.toString())); + } + + public static JComboBoxOperator getComboBox(JDialogOperator dialog, String caption) { + JLabelOperator label = new JLabelOperator(dialog, caption); + return new JComboBoxOperator((JComboBox) label.getLabelFor()); + } + + /////////// Quick Start dialog box methods + // opens QS using menu dialog box + public static JDialogOperator openQuickStart(JFrameOperator mainFrame) { + new JMenuOperator(mainFrame).pushMenu(getExecResource("qlb.file.menu") + "|" + getExecResource("mgr.openQuickStart.act"), "|"); + return findQuickStart(mainFrame); + } + + // click "next" in QS + public static void next(JDialogOperator quickStartDialog) { + new JButtonOperator(quickStartDialog, getExecResource("qsw.next.btn")).push(); + } + + // click "finish" in QS with test running + public static void finish(JDialogOperator quickStartDialog, boolean startConfigEditor, boolean runTests) { + new JCheckBoxOperator(quickStartDialog, getExecResource("qsw.end.cfg.ckb")).setSelected(startConfigEditor); + new JCheckBoxOperator(quickStartDialog, getExecResource("qsw.end.run.ckb")).setSelected(runTests); + + new JButtonOperator(quickStartDialog, getExecResource("qsw.done.btn")).push(); + } + + // click "finish" in QS + public static void finish(JDialogOperator quickStartDialog, boolean startConfigEditor) { + new JCheckBoxOperator(quickStartDialog, getExecResource("qsw.end.cfg.ckb")).setSelected(startConfigEditor); + + new JButtonOperator(quickStartDialog, getExecResource("qsw.done.btn")).push(); + } + + // uses standart testsuite in QS + public static void pickDefaultTestsuite(JDialogOperator quickStartDialog) { + + getTextField(quickStartDialog, getExecResource("qsw.ts.hd")).typeText(TEST_SUITE_NAME); + + } + + // activates flag of creating new configuration in QS + public static void createConfiguration(JDialogOperator quickStartDialog) { + + new JRadioButtonOperator(quickStartDialog, getExecResource("qsw.cfg.new.rb")).push(); + } + + // activates flag of starting config editor in QS + public static void startConfigEditor(JDialogOperator quickStartDialog) { + new JCheckBoxOperator(quickStartDialog, getExecResource("qsw.end.cfg.ckb")).push(); + } + + // uses template config in QS + static public void useConfigTemplate(JDialogOperator quickStartDialog) { + + new JRadioButtonOperator(quickStartDialog, getExecResource("qsw.cfg.template.rb")).push(); + + getTextField(quickStartDialog, getExecResource("qsw.cfg.jtm.field.lbl")).typeText(TEMPLATE_NAME); + } + + // uses incomplete template config in QS + static public void useIncompleteConfigTemplate(JDialogOperator quickStartDialog) { + + new JRadioButtonOperator(quickStartDialog, getExecResource("qsw.cfg.template.rb")).push(); + + getTextField(quickStartDialog, getExecResource("qsw.cfg.jtm.field.lbl")).typeText(INCOMPLETE_TEMPLATE_NAME); + } + + // uses bad template config in QS + static public void useBadConfigTemplate(JDialogOperator quickStartDialog) { + + new JRadioButtonOperator(quickStartDialog, getExecResource("qsw.cfg.template.rb")).push(); + + getTextField(quickStartDialog, getExecResource("qsw.cfg.jtm.field.lbl")).typeText("democonfig_broken.jti"); + } + + // uses missing template config in QS + static public void useMissingConfigTemplate(JDialogOperator quickStartDialog) { + + new JRadioButtonOperator(quickStartDialog, getExecResource("qsw.cfg.template.rb")).push(); + + getTextField(quickStartDialog, getExecResource("qsw.cfg.jtm.field.lbl")).typeText("/tmp/missing.jti"); + } + + // checks if "next" button is available in QS + static public boolean isNextEnabled(JDialogOperator quickStartDialog) { + + return JButtonOperator.findJButton(quickStartDialog.getContentPane(), getExecResource("qsw.next.btn"), false, false).isEnabled(); + } + + // close QS + static public void closeQS(JFrameOperator mainFrame) { + new JDialogOperator(mainFrame, getExecResource("qsw.title")).close(); + } + + //////////// JavaTest starting + // starts the JT + public static void startJavaTestWithDefaultWorkDirectory() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + new ClassReference("com.sun.javatest.tool.Main").startApplication(new String[]{"-NewDesktop", "-open", DEFAULT_WD_NAME}); + } + + public static void startJavatest() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + //Start JT Harness + new ClassReference("com.sun.javatest.tool.Main").startApplication(new String[]{}); + } + + // starts the JT with specified params + public static void startJavatest(String params) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + //Start JT Harness with Specified parameters + new ClassReference("com.sun.javatest.tool.Main").startApplication(new String[]{params}); + } + + // starts the JT with specified params + public static void startJavatest(String[] params) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + //Start JT Harness with Specified parameters + new ClassReference("com.sun.javatest.tool.Main").startApplication(params); + } + + // starts the JT with specified testsuite, workdir and config + public static void startJavatest(String testsuite, String workdir, String config) throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + //Start JT Harness with specified testsuite, workdir and config file + new ClassReference("com.sun.javatest.tool.Main").startApplication(new String[]{"-open", testsuite, "-workdir", workdir, "-config", config}); + } + + public static void startJavatestNewDesktop() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + new ClassReference("com.sun.javatest.tool.Main").startApplication(new String[]{"-NewDesktop"}); + } + + // returns main frame + public static JFrameOperator findMainFrame() { + return new JFrameOperator(WINDOWNAME + " Harness"); + } + + // returns QS + public static JDialogOperator findQuickStart(JFrameOperator mainFrame) { + return new JDialogOperator(mainFrame, WINDOWNAME + " Harness Quick Start"); + } + + // returns config editor dialog box + public static JDialogOperator findConfigEditor(JFrameOperator mainFrame) { + return new JDialogOperator(mainFrame, getExecResource("ce.name")); + } + + // returns dialog box of work directory creation + public static JDialogOperator findWorkDir(JFrameOperator mainFrame) { + return new JDialogOperator(mainFrame, getToolResource("wdc.new.title")); + } + + // click "ok" in filter editor dialog box + public static void ok(JDialogOperator filterEditor) { + new JButtonOperator(filterEditor, getExecResource("fconfig.edit.done.btn")).push(); + } + + // click "cancel" in dialod box + public static void cancel(JDialogOperator dialog) { + new JButtonOperator(dialog, "cancel").push(); // Cancel of filter dialog not found in resource files + } + + // check some counters? + public static void checkCounters(JFrameOperator mainFrame, int[] counters) { + for (int i = 0; i < counters.length; i++) { + int value = counters[i]; + + String actual = new JTextFieldOperator(mainFrame, new NameComponentChooser("br.summ." + i)).getText(); + + if (!actual.equals(Integer.toString(value))) { + throw new JemmyException("Wrong counters value in the main frame. Expected: " + value + ". Found: " + actual + ". In row: " + i); + } + } + } + + static public boolean deleteDirectory(String path) { + return deleteDirectory(new File(path)); + } + + // deletes directory + static public boolean deleteDirectory(File path) { + if (path != null && path.exists()) { + File[] files = path.listFiles(); + for (int i = 0; i < files.length; i++) { + if (files[i].isDirectory()) { + deleteDirectory(files[i]); + } else { + files[i].delete(); + } + } + return (path.delete()); + } + return true; + } + + public static boolean copyFile(String from, String to) throws IOException { + return copyFile(new File(from), new File(to)); + } + + public static boolean copyFile(File from, File to) throws IOException { + if (from.isDirectory()) { + return copyDirectory(from, to); + } + + if (!from.exists()) { + throw new IOException("Source file " + from.getAbsolutePath() + " doesn't exist"); + } + if (!from.canRead()) { + throw new IOException("Can't read source file " + from.getAbsolutePath()); + } + + if (!to.exists()) { + if (!to.createNewFile()) { + throw new IOException("Can't create destination file " + to.getAbsolutePath()); + } + copyFile_(from, to); + return true; + } else { + if (to.isDirectory()) { + String name = from.getName(); + to = new File(to, name); + return copyFile(from, to); + } else { + throw new IOException("Destination file " + to.getAbsolutePath() + " exists"); + } + } + } + + private static void copyFile_(File from, File to) throws IOException { + to.createNewFile(); + if ("configHistory.jtl".equals(from.getName())) { + BufferedReader reader = new BufferedReader(new FileReader(from)); + FileWriter writer = new FileWriter(to); + String temp; + while ((temp = reader.readLine()).startsWith("#")) { + writer.write(temp + "\n"); + } + while (temp != null) { + File tempFile = new File(temp); + if (tempFile.exists()) { + if (!new File(to.getParentFile(), tempFile.getName()).exists()) { + copyFile(tempFile, to.getParentFile()); + } + writer.write(to.getParentFile().getAbsolutePath() + File.separator + tempFile.getName()); + } else { + writer.write(temp); + } + temp = reader.readLine(); + } + writer.flush(); + } else { + FileChannel fromChannel = new FileInputStream(from).getChannel(); + FileChannel toChannel = new FileOutputStream(to).getChannel(); + try { + fromChannel.transferTo(0, fromChannel.size(), toChannel); + } finally { + fromChannel.close(); + toChannel.close(); + } + } + } + + public static boolean copyDirectory(File from, File to) throws IOException { + System.out.println(from.getAbsolutePath()); + if (!from.exists()) { + throw new IOException("Source file " + from.getAbsolutePath() + " doesn't exist"); + } + if (!from.canRead()) { + throw new IOException("Can't read source file " + from.getAbsolutePath()); + } + if (from.isFile()) { + return copyFile(from, to); + } + + if (!to.exists()) { + to.mkdirs(); + boolean res = true; + for (File f : from.listFiles()) { + if (f.isFile()) { + copyFile_(f, new File(to, f.getName())); + } else if (f.isDirectory()) { + res = res & copyDirectory_(f, to); + } + return res; + } + } else { + if (!to.isDirectory()) { + throw new IOException("Destination file is not a directory"); + } + if (!to.canWrite()) { + throw new IOException("Can not write in destination directory"); + } + + return copyDirectory_(from, to); + } + + return true; + } + + private static boolean copyDirectory_(File from, File to) throws IOException { + File newDir = new File(to, from.getName()); + newDir.mkdir(); + for (File f : from.listFiles()) { + if (f.isFile()) { + copyFile_(f, new File(newDir, f.getName())); + } else if (f.isDirectory()) { + copyDirectory_(f, newDir); + } + } + return true; + } + + // finds the test tree in the main frame + public static JTreeOperator findTree(JFrameOperator mainFrame) { + return new JTreeOperator(mainFrame, new NameComponentChooser("tree")); + } + + public static JTreeOperator findTree(JFrameOperator mainFrame, int n) { + return new JTreeOperator(mainFrame, new NameComponentChooser("tree"), n); + } + + // checks tabs of test results + public static void checkAllTestLists(JFrameOperator frame, String[] passed, String[] failed, String[] error, String[] notrun, String[] filtered) { + JTabbedPaneOperator tabs = new JTabbedPaneOperator(frame, new NameComponentChooser("br.tabs")); + if (passed != null) { + checkTestList(frame, TestList.PASSED, passed); + } else { + if (tabs.isEnabledAt(2)) { + throw new JemmyException("The 'Passed' page is enabled while it must be not"); + } + } + + if (failed != null) { + checkTestList(frame, TestList.FAILED, failed); + } else { + if (tabs.isEnabledAt(3)) { + throw new JemmyException("The 'Failed' page is enabled while it must be not"); + } + } + + if (error != null) { + checkTestList(frame, TestList.ERROR, error); + } else { + if (tabs.isEnabledAt(4)) { + throw new JemmyException("The 'Error' page is enabled while it must be not"); + } + } + + if (notrun != null) { + checkTestList(frame, TestList.NOT_RUN, notrun); + } else { + if (tabs.isEnabledAt(5)) { + throw new JemmyException("The 'Not Run' page is enabled while it must be not"); + } + } + + if (filtered != null) { + checkTestList(frame, TestList.FILTERED_OUT, filtered); + } else { + if (tabs.isEnabledAt(6)) { + throw new JemmyException("The 'Filtered Out' page is enabled while it must be not"); + } + } + + } + + // checks a tab of test results + public static void checkTestList(JFrameOperator frame, TestList list, String[] expected) throws JemmyException { + JTreeOperator tree = findTree(frame); + tree.selectRow(0); + JTabbedPaneOperator tabs = getPage(frame, list); + checkTestList(new JTableOperator(tabs, 0), expected); + } + + // checks a tab of test results + private static void checkTestList(JTableOperator list, String[] expected) throws JemmyException { + + if (list.getRowCount() != expected.length) { + throw new JemmyException("Wrong test count. Expected: " + expected.length + ", found: " + list.getRowCount()); + } + + boolean[] appeared = new boolean[expected.length]; + + for (int i = 0; i < expected.length; i++) { + final Object o = list.getValueAt(i, 0); + final TestResult tr = (TestResult) o; + final String testName = tr.getTestName(); + final int pos = find(expected, testName); + + if (pos == -1) { + throw new JemmyException("Test " + testName + " is not expected"); + } + + if (appeared[pos]) { + throw new JemmyException("Test " + testName + " has been found more than once"); + } + + appeared[pos] = true; + } + } + + // find string s in string array a + private static int find(String[] a, String s) { + for (int i = 0; i < a.length; i++) { + if (a[i].equals(s)) { + return i; + } + } + return -1; + } + + // Prepares the JavaTest for the next test run + public static void closeAll(JFrameOperator frame) throws InterruptedException { + // Close all dialog windows + JDialog dialog; + while ((dialog = JDialogOperator.findJDialog(new AnyComponentChooser())) != null) { + new JDialogOperator(dialog).close(); + } + + // Close all tabs + JTabbedPaneOperator tabs = new JTabbedPaneOperator(frame); + while (tabs.getTabCount() > 0) { + Thread.sleep(500); + JMenuBarOperator jmbo = new JMenuBarOperator(frame); + jmbo.pushMenuNoBlock("File|Close"); + //new JMenuOperator(frame).pushMenuNoBlock(getExecResource("cb.file.menu") + "|Close", "|"); // Close from the File tab is in strange resource file + } + } + + public static void closeJT(JFrameOperator frame) throws InterruptedException { + closeAll(frame); + Thread.sleep(500); + JMenuBarOperator jmbo = new JMenuBarOperator(frame); + Thread.sleep(500); + jmbo.pushMenuNoBlock("File/Exit", "/"); + //new JMenuOperator(frame).pushMenuNoBlock(getExecResource("qlb.file.menu") + "|" + getToolResource("dt.file.exit.mit"), "|"); + } + + // concat 2 string arrays + public static String[] concat(String[] a, String[] b) { + List<String> list = new ArrayList<String>(a.length + b.length); + list.addAll(Arrays.asList(a)); + list.addAll(Arrays.asList(b)); + String[] result = new String[a.length + b.length]; + return list.toArray(result); + } + + public static void pressYes(JDialogOperator dialog) { + new JButtonOperator(dialog, "Yes").push(); + } + + public static URL urlFile(String path) { + URL u = null; + try { + u = new File(path).toURI().toURL(); + } catch (MalformedURLException ex) { + Logger.getLogger(Tools.class.getName()).log(Level.SEVERE, null, ex); + } + return u; + } + + public static int findInStringArray(String[] in, String what) { + for (int i = 0; i < in.length; i++) { + //String tmp=in[i].replaceAll("\\W"," "); + //String acin=tmp.replaceAll("\\d",""); + if (in[i].equals(what)) { + return i; + } + } + return -1; + } + + public static void deleteUserData() { + deleteDirectory(new File(USER_HOME_PATH + ".javatest")); + } + + public static void openWorkDirectory_(JFrameOperator mainFrame, String path) { + new JMenuOperator(mainFrame).pushMenuNoBlock(getExecResource("qlb.file.menu") + "|" + getExecResource("tmgr.openMenu.menu") + "|Work Directory ...", "|", new StringComparator() { + + public boolean equals(String arg0, String arg1) { + return arg0.equals(arg1); + } + }); + + JDialogOperator filer = new JDialogOperator(mainFrame, "Open Work Directory"); + + JTextFieldOperator tf; + + tf = new JTextFieldOperator((JTextField) Tools.getComponent(filer, new String[]{"Folder name:", "File name:"})); + tf.enterText(path); + } + + public static void waitForWDLoading(JFrameOperator mainFrame, WDLoadingResult type) { + new JTextFieldOperator(mainFrame, getExecResource("br.worst." + type.ordinal())); + } + + public static void startTests(JFrameOperator mainFrame) { + new JMenuOperator(mainFrame, "Run Tests").pushMenu(new String[]{"Run Tests", "Start"}); + } + + public static void pushClose(JFrameOperator mainFrame) { + new JMenuOperator(mainFrame, "File").pushMenuNoBlock(new String[]{"File", "Close"}); + } + + public static void startJavaTestWithDefaultTestSuite() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + new ClassReference("com.sun.javatest.tool.Main").startApplication(new String[]{"-NewDesktop", "-open", TEST_SUITE_NAME}); + } + + // sleep for 10 seconds + public static void pause() { + try { + Thread.sleep(10000); + } catch (Exception e) { + } + } + + ; + + public static void pause(int seconds) { + try { + Thread.sleep(seconds * 1000); + } catch (Exception e) { + } + } + + @After + public void removeFiles() { + for (File f : usedFiles) { + if (f.exists()) { + if (f.isDirectory()) { + deleteDirectory(f); + } else if (f.isFile()) { + f.delete(); + } + if (f.exists()) { + System.err.println("Temporary file " + f.getAbsolutePath() + " was not removed. Please remove it manualy."); + } + } + } + } + + public static enum TestList { + + PASSED, FAILED, ERROR, NOT_RUN, FILTERED_OUT + } + + public enum FiltersType { + + LAST_TEST_RUN, CURRENT_CONFIGURATION, ALL_TESTS, CUSTOM + } + + public enum WDLoadingResult { + + ALL_PASSED, SOME_FAILED, SOME_ERRORS, SOME_NOTRUN + } + + private static class JLabelOperatorRef { + + private JLabelOperator op1 = null; + + public synchronized boolean isOpNull() { + return op1 == null; + } + + public JLabelOperator getOp() { + return op1; + } + + public synchronized void setOp(JLabelOperator op) { + this.op1 = op; + } + } + + private static class ComponentFinder extends Thread { + + private final JLabelOperatorRef ref; + private JDialogOperator dialog; + private String caption; + private boolean isAlive = true; + + public ComponentFinder(JLabelOperatorRef ref, JDialogOperator dialog, String caption) { + this.dialog = dialog; + this.caption = caption; + this.ref = ref; + } + + public void run() { + try { + JLabelOperator op = new JLabelOperator(dialog, caption); + if (ref != null && ref.isOpNull()) { + ref.setOp(op); + } + } catch (TimeoutExpiredException ex) { + } + isAlive = false; + } + } + + public static class AnyComponentChooser implements ComponentChooser { + + public AnyComponentChooser() { + } + + public boolean checkComponent(Component arg0) { + return true; + } + + public String getDescription() { + return ""; + } + } + + public static class SimpleStringComparator implements StringComparator { + + public boolean equals(String arg0, String arg1) { + return arg0.equals(arg1); + } + } +} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ViewFilter/ViewFilter1.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ViewFilter/ViewFilter1.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ViewFilter/ViewFilter1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ViewFilter/ViewFilter1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,59 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.ViewFilter; + +import com.sun.javatest.AllTestsFilter; +import org.junit.Test; +import org.junit.runner.JUnitCore; +import org.netbeans.jemmy.operators.JComboBoxOperator; +import org.netbeans.jemmy.util.NameComponentChooser; + +import java.lang.reflect.InvocationTargetException; + +import static org.junit.Assert.fail; + +public class ViewFilter1 extends ViewFilter { + + public static void main(String[] args) { + JUnitCore.main("jthtest.gui.ViewFilter.ViewFilter1"); + } + + @Test + public void testViewFilter1() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + startWithDefaultWorkdir(); + + JComboBoxOperator comboBox = new JComboBoxOperator(mainFrame, new NameComponentChooser("fconfig.box")); + Object selectedItem = comboBox.getSelectedItem(); + + if (!(selectedItem instanceof AllTestsFilter)) { + fail("Wrong default value in filter selector. Expected: All Tests. Found: " + selectedItem); + } + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ViewFilter/ViewFilter.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ViewFilter/ViewFilter.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/ViewFilter/ViewFilter.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/ViewFilter/ViewFilter.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,138 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.ViewFilter; + +import jthtest.Tools; +import org.netbeans.jemmy.operators.*; +import org.netbeans.jemmy.util.NameComponentChooser; + +import java.lang.reflect.InvocationTargetException; + +public class ViewFilter extends Tools { + + + protected static final String[] failedListsTests = new String[]{"lists/DoublyLinkedList/InsertTest.java"}; + protected static final String[] passedListsTests = new String[]{"lists/DoublyLinkedList/AppendTest.java", "lists/DoublyLinkedList/EqualsTest.java", "lists/DoublyLinkedList/RemoveTest.java", "lists/LinkedList/AppendTest.java", "lists/LinkedList/EqualsTest.java", "lists/LinkedList/InsertTest.java", "lists/LinkedList/RemoveTest.java", "lists/SortedList/EqualsTest.java", "lists/SortedList/InsertTest.java", "lists/SortedList/RemoveTest.java"}; + protected static final String[] listsTests = new String[]{"lists/DoublyLinkedList/AppendTest.java", "lists/DoublyLinkedList/EqualsTest.java", "lists/DoublyLinkedList/InsertTest.java", "lists/DoublyLinkedList/RemoveTest.java", "lists/LinkedList/AppendTest.java", "lists/LinkedList/EqualsTest.java", "lists/LinkedList/InsertTest.java", "lists/LinkedList/RemoveTest.java", "lists/SortedList/EqualsTest.java", "lists/SortedList/InsertTest.java", "lists/SortedList/RemoveTest.java"}; + protected static final String[] bignumTests = new String[]{"BigNum/AddTest.java", "BigNum/CompareTest.java", "BigNum/EqualsTest.java", "BigNum/LongConstrTest.java", "BigNum/StringConstrTest.java", "BigNum/SubtractTest.java"}; + protected static final String[] allTests = new String[]{"BigNum/AddTest.java", "BigNum/CompareTest.java", "BigNum/EqualsTest.java", "BigNum/LongConstrTest.java", "BigNum/StringConstrTest.java", "BigNum/SubtractTest.java", "lists/DoublyLinkedList/AppendTest.java", "lists/DoublyLinkedList/EqualsTest.java", "lists/DoublyLinkedList/InsertTest.java", "lists/DoublyLinkedList/RemoveTest.java", "lists/LinkedList/AppendTest.java", "lists/LinkedList/EqualsTest.java", "lists/LinkedList/InsertTest.java", "lists/LinkedList/RemoveTest.java", "lists/SortedList/EqualsTest.java", "lists/SortedList/InsertTest.java", "lists/SortedList/RemoveTest.java"}; + protected JFrameOperator mainFrame; + + public static JDialogOperator openConfigurationEditor(JFrameOperator mainFrame) { + new JMenuOperator(mainFrame, "Configure").pushMenu("Configure|Edit Configuration...", "|"); + return new JDialogOperator(mainFrame, "Configuration Editor"); + } + + public static JDialogOperator openFilterEditor(JFrameOperator frame) { + new JMenuOperator(frame, "View").pushMenu("View|Filter|Configure Filters ...", "|"); + return new JDialogOperator(frame, "Filter Editor"); + } + + public static void selectFilter(JDialogOperator filterEditor, int filter) { + new JListOperator(filterEditor, new NameComponentChooser("fconfig.list")).clickOnItem(filter, 1); + } + + public static void selectFilter(JFrameOperator frame, String filter) { + new JMenuOperator(frame, "View").pushMenu("View|Filter|" + filter, "|"); + } + + public static void chooseTab(ContainerOperator mainFrame, String tab) { + new JTabbedPaneOperator(mainFrame).selectPage(tab); + } + + public static void setKeywordFilter(JFrameOperator mainFrame, int type, String value) { + + JDialogOperator filterEditor = openFilterEditor(mainFrame); + + selectFilter(filterEditor, 3); + + chooseTab(filterEditor, "Keywords"); + + new JRadioButtonOperator(filterEditor, "Match").push(); + + new JComboBoxOperator(filterEditor).selectItem(type); + + new JTextFieldOperator(filterEditor, new NameComponentChooser("basicTf.keywords.field")).enterText(value); + + } + + public static void disableKeywordFilter(JFrameOperator mainFrame) { + + JDialogOperator filterEditor = openFilterEditor(mainFrame); + + selectFilter(filterEditor, 4); + + chooseTab(filterEditor, "Keywords"); + + new JRadioButtonOperator(filterEditor, "All Tests").push(); + + } + + public static void setPrevStateFilter(JFrameOperator mainFrame, String prevState) { + + JDialogOperator filterEditor = openFilterEditor(mainFrame); + + selectFilter(filterEditor, 3); + + chooseTab(filterEditor, "Prior Status"); + + new JRadioButtonOperator(filterEditor, "Any Of").setSelected(true); + + new JCheckBoxOperator(filterEditor, "Passed").setSelected(false); + + new JCheckBoxOperator(filterEditor, "Failed").setSelected(false); + + new JCheckBoxOperator(filterEditor, "Error").setSelected(false); + + new JCheckBoxOperator(filterEditor, "Not Run").setSelected(false); + + new JCheckBoxOperator(filterEditor, prevState).setSelected(true); + + ok(filterEditor); + + selectFilter(mainFrame, "Custom"); + + pause(5); + } + + public void startWithDefaultWorkdir() throws ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + startJavatest(TEST_SUITE_NAME, DEFAULT_WD_NAME, CONFIG_NAME); + mainFrame = findMainFrame(); + + // wait for "Some tests in this folder have not been run" label + new JTextFieldOperator(mainFrame, getExecResource("br.worst.3")); + } + + public void startWithRunWorkdir() throws InterruptedException, ClassNotFoundException, InvocationTargetException, NoSuchMethodException { + startJavatest(TEST_SUITE_NAME, WD_RUN_NAME, CONFIG_NAME); + mainFrame = findMainFrame(); + new JTextFieldOperator(mainFrame, "There are some failed tests in this folder"); + } + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/workdir/Workdir.java jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/workdir/Workdir.java --- jtharness-6.0-b15/gui-tests/src/gui/src/jthtest/workdir/Workdir.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/src/jthtest/workdir/Workdir.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,140 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package jthtest.workdir; + +import jthtest.menu.Menu; +import org.netbeans.jemmy.JemmyException; +import org.netbeans.jemmy.operators.JButtonOperator; +import org.netbeans.jemmy.operators.JDialogOperator; +import org.netbeans.jemmy.operators.JFrameOperator; +import org.netbeans.jemmy.operators.JTextFieldOperator; + +import javax.swing.*; +import java.io.File; + +import static jthtest.Tools.*; + +public class Workdir { + + public static final String OPEN_DIALOG_TI18N_NAME = "wdc.open.title"; + public static final String CREATE_DIALOG_TI18N_NAME = "wdc.new.title"; + public static final String COMMIT_BUTTON_EI18N_NAME = "wdc.create.btn"; + public static final String[] TEXT_FIELD_NAMES = {"Folder name:", "File name:", "Folder Name:", "File Name:"}; + public static String TO_DELETE_TEMP_WD_NAME = "some_temp_wd_that_will_be_deleted"; + + public static String getOpenWorkDirectoryDialogName() { + return getToolResource(OPEN_DIALOG_TI18N_NAME); + } + + public static String getCreateWorkDirectoryDialogName() { + return getToolResource(CREATE_DIALOG_TI18N_NAME); + } + + public static String getCommitButtonName() { + return getExecResource("wdc.create.btn"); + } + + public static JDialogOperator openOpenWorkDirectoryDialog(JFrameOperator frame) { + Menu.getFile_Open_WorkDirectoryMenu(frame).push(); + return new JDialogOperator(frame, getOpenWorkDirectoryDialogName()); + } + + public static JDialogOperator openCreateWorkDirectoryDialog(JFrameOperator frame) { + Menu.getFile_CreateWorkDirectoryMenu(frame).push(); + return new JDialogOperator(frame, getCreateWorkDirectoryDialogName()); + } + + public static void chooseWorkDirectoryInDialog(JDialogOperator wdDialog, String wdPath) { + JTextFieldOperator fileField = new JTextFieldOperator((JTextField) getComponent(wdDialog, TEXT_FIELD_NAMES)); + fileField.clearText(); + fileField.typeText(wdPath); + } + + public static void commitWorkDirectoryDialog(JDialogOperator wdDialog) { + new JButtonOperator(wdDialog, getCommitButtonName()).push(); + } + + public static void openWorkDirectory(String wdPath, JFrameOperator frame) { + JDialogOperator wdDialog = openOpenWorkDirectoryDialog(frame); + JTextFieldOperator fileField = new JTextFieldOperator((JTextField) getComponent(wdDialog, TEXT_FIELD_NAMES)); + fileField.enterText(wdPath); + } + + public static void createWorkDirectory(String wdPath, JFrameOperator frame) { + JDialogOperator wdDialog = openCreateWorkDirectoryDialog(frame); + JTextFieldOperator fileField = new JTextFieldOperator((JTextField) getComponent(wdDialog, TEXT_FIELD_NAMES)); + fileField.enterText(wdPath); + } + + public static void createWorkDirectory(String wdPath, boolean delete, JFrameOperator frame) { + if (delete) { + deleteDirectory(wdPath); + } + JDialogOperator wdDialog = openCreateWorkDirectoryDialog(frame); + JTextFieldOperator fileField = new JTextFieldOperator((JTextField) getComponent(wdDialog, TEXT_FIELD_NAMES)); + fileField.enterText(wdPath); + } + + public static String createWorkDirectoryInTemp(JFrameOperator mainFrame) { + int attempts = 0; + + JDialogOperator wdDialog = openCreateWorkDirectoryDialog(mainFrame); + + String path = TEMP_PATH + TEMP_WD_NAME; + while (attempts < 10) { + File file = new File(path); + if (!file.exists()) { + break; + } + deleteDirectory(file); + file = new File(path); + if (!file.exists()) { + break; + } + path = TEMP_PATH + TEMP_WD_NAME + (int) (Math.random() * 10000); + attempts++; + } + if (attempts >= 10) { + throw new JemmyException("error"); + } + JTextFieldOperator tf; + + tf = new JTextFieldOperator((JTextField) getComponent(wdDialog, new String[]{"Folder name:", "File name:", "Folder Name:", "File Name:"})); + tf.enterText(path); + return path; + } + + public static boolean verifyWorkdirCreation() { + return new File(TEMP_PATH + TEMP_WD_NAME).exists(); + } + + public static boolean verifyWorkdirCreation(String path) { + return new File(path).exists(); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/BigNum.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/BigNum.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/BigNum.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/BigNum.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,369 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demoapi; + +/** + * Basic support for immutable arbitrary size integers. + * Numbers are held as a sign and an array of ints. The sign is + * +1 for positive numbers, 0 for zero, and -1 for negative + * numbers. Each element in the array holds a group of decimal + * digits; the array is of minimal size and is arranged in + * little-endian order (thus, element 0 holds the least + * significant group of digits.) Because the array is + * always of minimal size, zero is represented by a sign of zero + * and an empty array. + */ + +// Note: this class is purely provided to be the basis of some +// examples for writing a test suite. The code has been written with +// simplicity in mind, rather than efficiency, and may contain +// deliberate coding errors. For proper support for big numbers, +// see java.math.BigInteger. + +public class BigNum { + private static final int[] POWERS_OF_10 = {1, 10, 100, 1000, 10000, 100000, 1000000}; + private static final int DIGITS_PER_CELL = 6; + private static final int MAX_PER_CELL = POWERS_OF_10[DIGITS_PER_CELL]; + private int sign; + private int[] data; + + + /** + * Create a BigNum for a standard long integer. + * + * @param n the value to be converted to a BigNum representation + */ + public BigNum(long n) { + if (n == Integer.MIN_VALUE) { + throw new IllegalArgumentException(); + } else if (n < 0) { + sign = -1; + n = -n; + } else if (n == 0) { + data = new int[0]; + sign = 0; + return; + } else + sign = 1; + + int size = 0; + long n1 = n; + while (n1 > 0) { + size++; + n1 = n1 / MAX_PER_CELL; + } + + data = new int[size]; + for (int i = 0; i < size; i++) { + data[i] = (int) (n % MAX_PER_CELL); + n = n / MAX_PER_CELL; + } + } + + /** + * Create a BigNum from a string. The string must be of + * the form of an optional '-', followed by an arbitrary + * non-empty sequence of digits. + * + * @param s the string to be converted. + * @throws NullPointerException if the argument is null. + * @throws NumberFormatException if the argument string + * is invalid. + */ + public BigNum(String s) { + if (s == null) + throw new NullPointerException(); + + int slen = s.length(); + if (slen == 0) + throw new NumberFormatException("empty string"); + + int i = 0; + + // check for leading - sign + if (s.charAt(0) == '-') { + sign = -1; + i = 1; + } else + sign = 1; // assume positive, for now + + // check for (and ignore) redundant leading zeroes + while (i < slen - 1 && s.charAt(i) == '0') + i++; + + // check for 0 + if (i == slen - 1 && s.charAt(i) == '0') { + sign = 0; + data = new int[0]; + return; + } + + // check for no significant digits + if (i == slen) + throw new NumberFormatException("no digits"); + + // allocate array of cells for number + int numDigits = slen - i; // i currently points to the first significant digit + int numCells = (numDigits + DIGITS_PER_CELL - 1) / DIGITS_PER_CELL; + data = new int[numCells]; + + // scan digits in string + for (; i < slen; i++) { + char c = s.charAt(i); + if (c < '0' || c > '9') + throw new NumberFormatException("bad char"); + int d = (slen - 1 - i) / DIGITS_PER_CELL; + data[d] = data[d] * 10 + (c - '0'); + } + } + + private BigNum(int sign, int[] data) { + this.sign = sign; + this.data = data; + } + + /** + * Add another BigNum to this one. + * + * @param other The BigNum to be added + * @return a BigNum containing the sum + */ + public BigNum add(BigNum other) { + if (sign == 0) + return other; + else if (other.sign == 0) + return this; + else if (sign == other.sign) + return new BigNum(sign, add(data, other.data)); + else { + switch (compare(data, other.data)) { + case +1: + // this is bigger in magnitude, so result is + // the difference, with the sign of this + return new BigNum(sign, subtract(data, other.data)); + case 0: + // numbers are equal in magnitude, but different + // in sign; result must be zero + return new BigNum(0); + case -1: + // other is bigger in magnitude, so result is + // the difference, with the sign of other + return new BigNum(other.sign, subtract(other.data, data)); + default: + throw new Error("should not happen"); + } + } + } + + /** + * Subtract another BigNum from this one. + * + * @param other The BigNum to be added + * @return a BigNum containing the sum + */ + public BigNum subtract(BigNum other) { + if (sign == 0) + return new BigNum(-other.sign, other.data); + else if (other.sign == 0) + return this; + else if (sign == other.sign) { + switch (compare(data, other.data)) { + case +1: + // this is bigger in magnitude, so result is + // the difference, with the sign of this + return new BigNum(sign, subtract(data, other.data)); + case 0: + // numbers are equal in magnitude, but different + // in sign; result must be zero + return new BigNum(0); + case -1: + // other is bigger in magnitude, so result is + // the difference, with the opposite sign of other + return new BigNum(-other.sign, subtract(other.data, data)); + default: + throw new Error("should not happen"); + } + } else + return new BigNum(sign, add(data, other.data)); + } + + /** + * Compare this BigNum with another. + * + * @param other the BigNum to be compared against + * @return -1 is this BigNum is smaller than <i>other</i>, + * 0 if they are equal, + * and +1 if this BigNum is greater than <i>other</i> + */ + public int compare(BigNum other) { + if (sign == other.sign) { + int cmp = compare(data, other.data); + return (sign < 0 ? -cmp : cmp); + } else { + return (sign > other.sign ? 1 : -1); + } + } + + /** + * Check this BigNum for equality with another object. + * + * @param other the object to be compared against + * @return true if and only if <i>other</i> is a BigNum + * representing the same value as this one. + */ + public boolean equals(Object other) { + if (!(other instanceof BigNum)) + return false; + + BigNum o = (BigNum) other; + + if (sign != o.sign) + return false; + + if (data.length != o.data.length) + return false; + + for (int i = 0; i < data.length; i++) { + if (data[i] != o.data[i]) + return false; + } + + return true; + } + + /** + * Convert this BigNum to a printable representation. + * + * @return a string containing a negative sign if necessary, followed + * by the decimal digits of the number + */ + public String toString() { + if (sign == 0) + return "0"; + + StringBuffer sb = new StringBuffer(); + if (sign < 0) + sb.append('-'); + + boolean suppressZero = true; + for (int i = data.length - 1; i >= 0; i--) { + int d = data[i]; + for (int j = DIGITS_PER_CELL - 1; j >= 0; j--) { + int digit = (d / POWERS_OF_10[j]) % 10; + if (digit > 0) { + suppressZero = false; + sb.append((char) ('0' + digit)); + } else if (!suppressZero) + sb.append('0'); + } + } + + return sb.toString(); + } + + private int[] add(int[] d1, int[] d2) { + int[] sum = new int[Math.max(d1.length, d2.length)]; + + int carry = 0; + for (int i = 0; i < sum.length; i++) { + int s = carry; + if (i < d1.length) + s += d1[i]; + if (i < d2.length) + s += d2[i]; + sum[i] = s % MAX_PER_CELL; + carry = s / MAX_PER_CELL; + } + + if (carry > 0) { + int[] x = new int[sum.length + 1]; + System.arraycopy(sum, 0, x, 0, sum.length); + x[sum.length] = carry; + sum = x; + } + + return sum; + } + + // d1 is assumed to be greater than d2 + private int[] subtract(int[] d1, int[] d2) { + if (d1.length < d2.length) + throw new IllegalArgumentException(); + + int[] diff = new int[d1.length]; + + int borrow = 0; + for (int i = 0; i < diff.length; i++) { + int d = d1[i] - borrow; + if (i < d2.length) + d = d - d2[i]; + if (d < 0) { + d = d + MAX_PER_CELL; + borrow = 1; + } else + borrow = 0; + diff[i] = d; + } + + if (borrow != 0) + throw new IllegalArgumentException(); + + int newSize = diff.length; + while (newSize > 0 && diff[newSize - 1] == 0) + newSize--; + + if (newSize < diff.length) { + int[] newDiff = new int[newSize]; + System.arraycopy(diff, 0, newDiff, 0, newDiff.length); + diff = newDiff; + } + + return diff; + } + + private int compare(int[] d1, int[] d2) { + if (d1.length > d2.length) + return 1; + + if (d1.length < d2.length) + return -1; + + // d1.length == d2.length + for (int i = d1.length - 1; i >= 0; i--) { + int n1 = d1[i]; + int n2 = d2[i]; + if (n1 > n2) + return 1; + if (n1 < n2) + return -1; + } + + return 0; + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/DoublyLinkedList.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/DoublyLinkedList.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/DoublyLinkedList.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/DoublyLinkedList.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,291 @@ +/* + * $Id$ + * + * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.demoapi.lists; + +/** + * Simple linked lists of objects. + * A list is represented by a series of Entry objects, each containing + * an item of client data, and a link to the next entry in the list. + * The list keeps references to the first and last entry in the list. + */ + +// Note: this class is purely provided to be the basis of some +// examples for writing a testsuite. The code has been written with +// simplicity in mind, rather than efficiency, and may contain +// deliberate coding errors. For proper support for linked lists, +// see the classes in java.util. + +public class DoublyLinkedList { + private Entry first; + private Entry last; + + /** + * Create an empty linked list. + */ + public DoublyLinkedList() { + } + + /** + * Determine if a linked list is empty. + * + * @return true if the list has no entries, and false otherwise. + */ + public boolean isEmpty() { + return (first == null); + } + + /** + * Determine if the list contains an entry with a specific item of + * client data. + * + * @return true if the list contains an entry that matches the + * given client data, and false otherwise. + */ + public boolean contains(Object data) { + for (Entry e = first; e != null; e = e.next) { + if (e.data == data) + return true; + } + return false; + } + + + /** + * Get the first entry in the list. + * + * @return the first entry in the list + * @see Entry#getNext + */ + public Entry getFirst() { + return first; + } + + /** + * Get the last entry in the list. + * + * @return the first entry in the list + * @see Entry#getNext + */ + public Entry getLast() { + return last; + } + + /** + * Insert a new entry containing the specified client data + * at the beginning of the list. + * + * @param data the client data for the new entry + */ + public void insert(Object data) { + Entry e = new Entry(data, null, first); + if (first == null) + last = e; + else + first.prev = e; + first = e; + } + + /** + * Append an entry containing the specified client data + * to the end of the list. + */ + public void append(Object o) { + Entry e = new Entry(o, last, null); + if (first == null) + first = e; + else + last.next = e; + last = e; + } + + /** + * Remove the first entry from the list that contains the + * specified client data. + * + * @param data The client data indicating the entry to be removed + * @return true if an entry was found and removed that contained + * the specified client data, and false otherwise. + */ + public boolean remove(Object data) { + for (Entry e = first, prev = null; e != null; prev = e, e = e.next) { + if (e.data == data) { + e.remove(); + return true; + } + } + + // not found + return false; + } + + /** + * Check if the contents of this list match another. + * + * @param other An object to be checked for equality with this one + * @return true if the other object is a linked list, and corresponding + * entries in the two lists are either both null, or are equal. + */ + public boolean equals(Object other) { + if (!(other instanceof DoublyLinkedList)) + return false; + + Entry e1 = first; + Entry e2 = ((DoublyLinkedList) other).first; + while (e1 != null && e2 != null) { + boolean match = (e1.data == null ? e2.data == null : e1.data.equals(e2.data)); + if (!match) + return false; + + e1 = e1.next; + e2 = e2.next; + } + + return (e1 == null && e2 == null); + } + + /** + * Return a string representation of the list. + * + * @return a string representation of the list + */ + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("DoublyLinkedList["); + for (Entry p = first; p != null; p = p.next) { + if (p != first) + sb.append(","); + sb.append(String.valueOf(p.data)); + } + sb.append("]"); + return sb.toString(); + } + + /** + * An entry in a DoublyLinkedList, containing client data + * and links to the previous and next entries. + */ + public class Entry { + Object data; + Entry prev; + Entry next; + + + /** + * Create an entry to be put in a DoublyLinkedList. + * Entries are not created directly by the client: + * they are created automatically by the methods that + * insert data into the list as a whole. + * + * @param data Client data to be stored in this entry + * @param next The next entry to appear after this one. + * @see #insert + * @see ##append + * @see #insertAfter + */ + Entry(Object data, Entry prev, Entry next) { + this.data = data; + this.prev = prev; + this.next = next; + } + + /** + * Get the client data in this entry in the list + * + * @return the client data in this entry in the list + */ + public Object getData() { + return data; + } + + /** + * Get the next entry in the list, if any. + * + * @return the next entry in the list, + * or null if this is the last entry. + */ + public Entry getNext() { + return next; + } + + /** + * Get the previous entry in the list, if any. + * + * @return the previous entry in the list, + * or null if this is the first entry. + */ + public Entry getPrevious() { + return prev; + } + + /** + * Insert a new entry in the list, after this one. + * + * @param data the client data to be stored in this entry + */ + public void insertAfter(Object data) { + Entry e = new Entry(data, this, next); + if (next == null) + last = e; + else + next.prev = e; + next = e; + } + + /** + * Insert a new entry in the list, after this one. + * + * @param data the client data to be stored in this entry + */ + public void insertBefore(Object data) { + Entry e = new Entry(data, prev, this); + if (prev == null) + first = e; + else + prev.next = e; + prev = e; + } + + /** + * Remove this entry from the list. + * + * @return the next entry in the list, or null if none + */ + public Entry remove() { + if (prev == null) + first = next; + else + prev.next = next; + + if (next == null) + last = prev; + else + next.prev = prev; + + return next; + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/LinkedList.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/LinkedList.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/LinkedList.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/LinkedList.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,267 @@ +/* + * $Id$ + * + * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.demoapi.lists; + +/** + * Simple linked lists of objects. + * A list is represented by a series of Entry objects, each containing + * an item of client data, and a link to the next entry in the list. + * The list keeps references to the first and last entry in the list. + */ + +// Note: this class is purely provided to be the basis of some +// examples for writing a testsuite. The code has been written with +// simplicity in mind, rather than efficiency, and may contain +// deliberate coding errors. For proper support for linked lists, +// see the classes in java.util. + +public class LinkedList { + private Entry first; + private Entry last; + + /** + * Create an empty linked list. + */ + public LinkedList() { + } + + + + /** + * Determine if a linked list is empty. + * + * @return true if the list has no entries, and false otherwise. + */ + public boolean isEmpty() { + return (first == null); + } + + /** + * Determine if the list contains an entry with a specific item of + * client data. + * + * @return true if the list contains an entry that matches the + * given client data, and false otherwise. + */ + public boolean contains(Object data) { + for (Entry e = first; e != null; e = e.next) { + if (e.data == data) + return true; + } + return false; + } + + /** + * Get the first entry in the list. + * + * @return the first entry in the list + * @see Entry#getNext + */ + public Entry getFirst() { + return first; + } + + /** + * Insert a new entry containing the specified client data + * at the beginning of the list. + * + * @param data the client data for the new entry + */ + public void insert(Object data) { + Entry e = new Entry(data, first); + first = e; + if (last == null) + last = first; + } + + /** + * Append an entry containing the specified client data + * to the end of the list. + */ + public void append(Object o) { + Entry e = new Entry(o, null); + if (first == null) + first = e; + else + last.next = e; + last = e; + } + + /** + * Remove the first entry from the list that contains the + * specified client data. + * + * @param data The client data indicating the entry to be removed + * @return true if an entry was found and removed that contained + * the specified client data, and false otherwise. + */ + public boolean remove(Object data) { + for (Entry e = first, prev = null; e != null; prev = e, e = e.next) { + if (e.data == null ? data == null : e.data.equals(data)) { + // update the pointer to this cell + if (prev == null) + first = e.next; + else + prev.next = e.next; + + // update last pointer if necessary + if (e == last) + last = prev; + + return true; + } + } + + // not found + return false; + } + + /** + * Check if the contents of this list match another. + * + * @param other An object to be checked for equality with this one + * @return true if the other object is a linked list, and corresponding + * entries in the two lists are either both null, or are equal. + */ + public boolean equals(Object other) { + if (!(other instanceof LinkedList)) + return false; + + Entry e1 = first; + Entry e2 = ((LinkedList) other).first; + while (e1 != null && e2 != null) { + boolean match = (e1.data == null ? e2.data == null : e1.data.equals(e2.data)); + if (!match) + return false; + + e1 = e1.next; + e2 = e2.next; + } + + return (e1 == null && e2 == null); + } + + /** + * Return a string representation of the list. + * + * @return a string representation of the list + */ + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("LinkedList["); + for (Entry p = first; p != null; p = p.next) { + if (p != first) + sb.append(","); + sb.append(String.valueOf(p.data)); + } + sb.append("]"); + return sb.toString(); + } + + /** + * An entry in a LinkedList, containing client data and a link to the next entry. + */ + public class Entry { + Object data; + Entry next; + + /** + * Create an entry to be put in a LinkedList. + * Entries are not created directly by the client: + * they are created automatically by the methods that + * insert data into the list as a whole. + * + * @param data Client data to be stored in this entry + * @param next The next entry to appear after this one. + * @see #insert + * @see ##append + * @see #insertAfter + */ + Entry(Object data, Entry next) { + this.data = data; + this.next = next; + } + + /** + * Get the client data in this entry in the list + * + * @return the client data in this entry in the list + */ + public Object getData() { + return data; + } + + /** + * Get the next entry in the list, if any. + * + * @return the next entry in the list, + * or null if this is the last entry. + */ + public Entry getNext() { + return next; + } + + /** + * Insert a new entry in the list, after this one. + * + * @param data the client data to be stored in this entry + */ + public void insertAfter(Object data) { + next = new Entry(data, next); + if (last == this) + last = next; + } + + /** + * Remove this entry from the list. + * + * @return the next entry in the list, or null if none + * @throws IllegalStateException if this entry is not in the list + * in which it was created: for example, if it has already been removed. + */ + public Entry remove() { + for (Entry e = first, prev = null; e != null; prev = e, e = e.next) { + if (e == this) { + // update the pointer to this cell + if (prev == null) + first = e.next; + else + prev.next = e.next; + + // update last pointer if necessary + if (e == last) + last = prev; + + return next; + } + } + + // not found + throw new IllegalStateException(); + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/SortedList.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/SortedList.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/SortedList.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demoapi/src/com/sun/demoapi/lists/SortedList.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,270 @@ +/* + * $Id$ + * + * Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.demoapi.lists; + +/** + * Sorted linked lists of objects. + * A list is represented by a series of Entry objects, each containing + * an item of client data, and a link to the next entry in the list. + * The entries are sorted according to a Comparator used to compare the + * items of client data. + */ + +// Note: this class is purely provided to be the basis of some +// examples for writing a testsuite. The code has been written with +// simplicity in mind, rather than efficiency, and may contain +// deliberate coding errors. For proper support for linked lists, +// see the classes in java.util. + +public class SortedList { + private Entry first; + + private Comparator comp; + + private boolean ignoreDuplicates; + + /** + * Create an empty list. + */ + public SortedList(Comparator comp, boolean ignoreDuplicates) { + this.comp = comp; + this.ignoreDuplicates = ignoreDuplicates; + } + + /** + * Determine if a linked list is empty. + * + * @return true if the list has no entries, and false otherwise. + */ + public boolean isEmpty() { + return (first == null); + } + + /** + * Determine if the list contains an entry with a specific item of + * client data. + * + * @return true if the list contains an entry that matches the + * given client data, and false otherwise. + */ + public boolean contains(Object data) { + for (Entry e = first; e != null; e = e.next) { + if (comp.compare(e.data, data) == 0) + return true; + } + return false; + } + + /** + * Get the first entry in the list. + * + * @return the first entry in the list + * @see Entry#getNext + */ + public Entry getFirst() { + return first; + } + + /** + * Insert a new entry containing the specified client data + * at the beginning of the list. + * + * @param data the client data for the new entry + */ + public boolean insert(Object data) { + if (first == null) { + first = new Entry(data, null); + return true; + } + + Entry prev = null; + for (Entry e = first; e != null; prev = e, e = e.next) { + int c = comp.compare(data, e.data); + if (c > 0) + continue; + else if (c == 0 && ignoreDuplicates) + return false; + else + break; + } + + // found where to insert + if (prev == null) + first = new Entry(data, first); + else + prev.next = new Entry(data, prev.next); + + return true; + } + + /** + * Remove the first entry from the list that contains the + * specified client data. + * + * @param data The client data indicating the entry to be removed + * @return true if an entry was found and removed that contained + * the specified client data, and false otherwise. + */ + public boolean remove(Object data) { + for (Entry e = first, prev = null; e != null; prev = e, e = e.next) { + if (comp.compare(e.data, data) == 0) { + // update the pointer to this cell + if (prev == null) + first = e.next; + else + prev.next = e.next; + + return true; + } + } + + // not found + return false; + } + + /** + * Check if the contents of this list match another. + * + * @param other An object to be checked for equality with this one + * @return true if the other object is a linked list, and corresponding + * entries in the two lists are either both null, or are equal. + */ + public boolean equals(Object other) { + if (!(other instanceof SortedList)) + return false; + + Entry e1 = first; + Entry e2 = ((SortedList) other).first; + while (e1 != null && e2 != null) { + boolean match = (e1.data == null ? e2.data == null : e1.data.equals(e2.data)); + if (!match) + return false; + + e1 = e1.next; + e2 = e2.next; + } + + return (e1 == null && e2 == null); + } + + /** + * Return a string representation of the list. + * + * @return a string representation of the list + */ + public String toString() { + StringBuffer sb = new StringBuffer(); + sb.append("SortedList["); + for (Entry p = first; p != null; p = p.next) { + if (p != first) + sb.append(","); + sb.append(String.valueOf(p.data)); + } + sb.append("]"); + return sb.toString(); + } + public static interface Comparator { + int compare(Object a, Object b); + } + + /** + * An entry in a LinkedList, containing client data and a link to the next entry. + */ + public class Entry { + Object data; + Entry next; + + /** + * Create an entry to be put in a LinkedList. + * Entries are not created directly by the client: + * they are created automatically by the methods that + * insert data into the list as a whole. + * + * @param data Client data to be stored in this entry + * @param next The next entry to appear after this one. + * @see #insert + * @see ##append + * @see #insertAfter + */ + Entry(Object data, Entry next) { + this.data = data; + this.next = next; + } + + /** + * Get the client data in this entry in the list + * + * @return the client data in this entry in the list + */ + public Object getData() { + return data; + } + + /** + * Get the next entry in the list, if any. + * + * @return the next entry in the list, + * or null if this is the last entry. + */ + public Entry getNext() { + return next; + } + + /** + * Insert a new entry in the list, after this one. + * + * @param data the client data to be stored in this entry + */ + public void insertAfter(Object data) { + next = new Entry(data, next); + } + + /** + * Remove this entry from the list. + * + * @return the next entry in the list, or null if none + * @throws IllegalStateException if this entry is not in the list + * in which it was created: for example, if it has already been removed. + */ + public Entry remove() { + for (Entry e = first, prev = null; e != null; prev = e, e = e.next) { + if (e == this) { + // update the link to this entry + if (prev == null) + first = e.next; + else + prev.next = e.next; + + return next; + } + } + + // not found + throw new IllegalStateException(); + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/lib/demo.jtx jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/lib/demo.jtx --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/lib/demo.jtx 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/lib/demo.jtx 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,30 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +# demo exclude list +# test name bugid(s) keyword(s) brief description +lists/DoublyLinkedList/InsertTest.java 0 test test contains error diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/lib/demots.jti jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/lib/demots.jti --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/lib/demots.jti 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/lib/demots.jti 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,53 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# +demoTS.excludeList.excludeListType=custom +demoTS.keywords.needKeywords=No +TESTSUITE=../JTHarness-build/binaries/examples/tutorial/demots +QUESTION=demoTS.envEnd +demoTS.tests.needTests=No +demoTS.excludeList.needExcludeList=No +demoTS.concurrency.concurrency=1 +LOCALE=en_US +demoTS.desc=Configuration for dynamic i18n tests execution +NAME=i18n_testing_config +demoTS.tests.tests= +demoTS.keywords.keywords.mode=expr +WORKDIR=../JTHarness-build/tmp/demots_wd +demoTS.priorStatus.status= +demoTS.cmdType=otherVM +demoTS.name=i18n_testing_config +demoTS.timeout.timeout=1 +DESCRIPTION=Configuration for dynamic i18n tests execution +demoTS.priorStatus.needStatus=No +demoTS.testVerboseLevel=high +demoTS.excludeList.latestAutoCheckMode=everyXDays +demoTS.tests.treeOrFile=tree +INTERVIEW=com.sun.demots.DemoTSInterview +demoTS.excludeList.latestAutoCheckInterval=7 +demoTS.excludeList.latestAutoCheck=No + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/AddTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/AddTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/AddTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/AddTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,156 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.bignum; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum.add. + * + * @test + * @sources AddTest.java + * @executeClass com.sun.demots.tests.bignum.AddTest + */ +public class AddTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new AddTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + ok = ok & test("-12345678901234567890", "-12345678901234567890", "-24691357802469135780"); + ok = ok & test("-12345678901234567890", "-1234567890", "-12345678902469135780"); + ok = ok & test("-12345678901234567890", "-123", "-12345678901234568013"); + ok = ok & test("-12345678901234567890", "0", "-12345678901234567890"); + ok = ok & test("-12345678901234567890", "123", "-12345678901234567767"); + ok = ok & test("-12345678901234567890", "1234567890", "-12345678900000000000"); + ok = ok & test("-12345678901234567890", "12345678901234567890", "0"); + + ok = ok & test("-1234567890", "-12345678901234567890", "-12345678902469135780"); + ok = ok & test("-1234567890", "-1234567890", "-2469135780"); + ok = ok & test("-1234567890", "-123", "-1234568013"); + ok = ok & test("-1234567890", "0", "-1234567890"); + ok = ok & test("-1234567890", "123", "-1234567767"); + ok = ok & test("-1234567890", "1234567890", "0"); + ok = ok & test("-1234567890", "12345678901234567890", "12345678900000000000"); + + ok = ok & test("-123", "-12345678901234567890", "-12345678901234568013"); + ok = ok & test("-123", "-1234567890", "-1234568013"); + ok = ok & test("-123", "-123", "-246"); + ok = ok & test("-123", "0", "-123"); + ok = ok & test("-123", "123", "0"); + ok = ok & test("-123", "1234567890", "1234567767"); + ok = ok & test("-123", "12345678901234567890", "12345678901234567767"); + + ok = ok & test("0", "-12345678901234567890", "-12345678901234567890"); + ok = ok & test("0", "-1234567890", "-1234567890"); + ok = ok & test("0", "-123", "-123"); + ok = ok & test("0", "0", "0"); + ok = ok & test("0", "123", "123"); + ok = ok & test("0", "1234567890", "1234567890"); + ok = ok & test("0", "12345678901234567890", "12345678901234567890"); + + ok = ok & test("123", "-12345678901234567890", "-12345678901234567767"); + ok = ok & test("123", "-1234567890", "-1234567767"); + ok = ok & test("123", "-123", "0"); + ok = ok & test("123", "0", "123"); + ok = ok & test("123", "123", "246"); + ok = ok & test("123", "1234567890", "1234568013"); + ok = ok & test("123", "12345678901234567890", "12345678901234568013"); + + ok = ok & test("1234567890", "-12345678901234567890", "-12345678900000000000"); + ok = ok & test("1234567890", "-1234567890", "0"); + ok = ok & test("1234567890", "-123", "1234567767"); + ok = ok & test("1234567890", "0", "1234567890"); + ok = ok & test("1234567890", "123", "1234568013"); + ok = ok & test("1234567890", "1234567890", "2469135780"); + ok = ok & test("1234567890", "12345678901234567890", "12345678902469135780"); + + ok = ok & test("12345678901234567890", "-12345678901234567890", "0"); + ok = ok & test("12345678901234567890", "-1234567890", "12345678900000000000"); + ok = ok & test("12345678901234567890", "-123", "12345678901234567767"); + ok = ok & test("12345678901234567890", "0", "12345678901234567890"); + ok = ok & test("12345678901234567890", "123", "12345678901234568013"); + ok = ok & test("12345678901234567890", "1234567890", "12345678902469135780"); + ok = ok & test("12345678901234567890", "12345678901234567890", "24691357802469135780"); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(String s1, String s2, String expectedResult) { + BigNum bn1 = new BigNum(s1); + BigNum bn2 = new BigNum(s2); + BigNum sum = bn1.add(bn2); + if (sum.toString().equals(expectedResult)) + return true; + else { + err.println("s1: " + s1 + + " s2: " + s2 + + " expected result: " + expectedResult + + " actual result: " + sum); + return false; + } + } +} + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/CompareTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/CompareTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/CompareTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/CompareTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,170 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.bignum; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum.compare. + * + * @test + * @sources CompareTest.java + * @executeClass com.sun.demots.tests.bignum.CompareTest + */ +public class CompareTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new CompareTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + ok = ok & test("-12345678901234567890", "-12345678901234567891", 1); + ok = ok & test("-12345678901234567890", "-12345678901234567890", 0); + ok = ok & test("-12345678901234567890", "-12345678901234567889", -1); + ok = ok & test("-12345678901234567890", "-1234567890", -1); + ok = ok & test("-12345678901234567890", "-123", -1); + ok = ok & test("-12345678901234567890", "0", -1); + ok = ok & test("-12345678901234567890", "123", -1); + ok = ok & test("-12345678901234567890", "1234567890", -1); + ok = ok & test("-12345678901234567890", "12345678901234567890", -1); + + ok = ok & test("-1234567890", "-12345678901234567890", 1); + ok = ok & test("-1234567890", "-1234567891", 1); + ok = ok & test("-1234567890", "-1234567890", 0); + ok = ok & test("-1234567890", "-1234567889", -1); + ok = ok & test("-1234567890", "-123", -1); + ok = ok & test("-1234567890", "0", -1); + ok = ok & test("-1234567890", "123", -1); + ok = ok & test("-1234567890", "1234567890", -1); + ok = ok & test("-1234567890", "12345678901234567890", -1); + + ok = ok & test("-123", "-12345678901234567890", 1); + ok = ok & test("-123", "-1234567890", 1); + ok = ok & test("-123", "-124", 1); + ok = ok & test("-123", "-123", 0); + ok = ok & test("-123", "-122", -1); + ok = ok & test("-123", "0", -1); + ok = ok & test("-123", "123", -1); + ok = ok & test("-123", "1234567890", -1); + ok = ok & test("-123", "12345678901234567890", -1); + + ok = ok & test("0", "-12345678901234567890", 1); + ok = ok & test("0", "-1234567890", 1); + ok = ok & test("0", "-123", 1); + ok = ok & test("0", "-1", 1); + ok = ok & test("0", "0", 0); + ok = ok & test("0", "1", -1); + ok = ok & test("0", "123", -1); + ok = ok & test("0", "1234567890", -1); + ok = ok & test("0", "12345678901234567890", -1); + + ok = ok & test("123", "-12345678901234567890", 1); + ok = ok & test("123", "-1234567890", 1); + ok = ok & test("123", "-123", 1); + ok = ok & test("123", "0", 1); + ok = ok & test("123", "122", 1); + ok = ok & test("123", "123", 0); + ok = ok & test("123", "124", -1); + ok = ok & test("123", "1234567890", -1); + ok = ok & test("123", "12345678901234567890", -1); + + ok = ok & test("1234567890", "-12345678901234567890", 1); + ok = ok & test("1234567890", "-1234567890", 1); + ok = ok & test("1234567890", "-123", 1); + ok = ok & test("1234567890", "0", 1); + ok = ok & test("1234567890", "123", 1); + ok = ok & test("1234567890", "1234567889", 1); + ok = ok & test("1234567890", "1234567890", 0); + ok = ok & test("1234567890", "1234567891", -1); + ok = ok & test("1234567890", "12345678901234567890", -1); + + ok = ok & test("12345678901234567890", "-12345678901234567890", 1); + ok = ok & test("12345678901234567890", "-1234567890", 1); + ok = ok & test("12345678901234567890", "-123", 1); + ok = ok & test("12345678901234567890", "0", 1); + ok = ok & test("12345678901234567890", "123", 1); + ok = ok & test("12345678901234567890", "1234567890", 1); + ok = ok & test("12345678901234567890", "12345678901234567889", 1); + ok = ok & test("12345678901234567890", "12345678901234567890", 0); + ok = ok & test("12345678901234567890", "12345678901234567891", -1); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(String s1, String s2, int expectedResult) { + BigNum bn1 = new BigNum(s1); + BigNum bn2 = new BigNum(s2); + int actualResult = bn1.compare(bn2); + if (actualResult == expectedResult) + return true; + else { + err.println("s1: " + s1 + + " s2: " + s2 + + " expected result: " + expectedResult + + " actual result: " + actualResult); + return false; + } + } +} + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/EqualsTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/EqualsTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/EqualsTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/EqualsTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,171 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.bignum; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum.equals. + * + * @test + * @sources EqualsTest.java + * @executeClass com.sun.demots.tests.bignum.EqualsTest + */ +public class EqualsTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new EqualsTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + ok = ok & test("-12345678901234567890", "-12345678901234567891"); + ok = ok & test("-12345678901234567890", "-12345678901234567890"); + ok = ok & test("-12345678901234567890", "-12345678901234567889"); + ok = ok & test("-12345678901234567890", "-1234567890"); + ok = ok & test("-12345678901234567890", "-123"); + ok = ok & test("-12345678901234567890", "0"); + ok = ok & test("-12345678901234567890", "123"); + ok = ok & test("-12345678901234567890", "1234567890"); + ok = ok & test("-12345678901234567890", "12345678901234567890"); + + ok = ok & test("-1234567890", "-12345678901234567890"); + ok = ok & test("-1234567890", "-1234567891"); + ok = ok & test("-1234567890", "-1234567890"); + ok = ok & test("-1234567890", "-1234567889"); + ok = ok & test("-1234567890", "-123"); + ok = ok & test("-1234567890", "0"); + ok = ok & test("-1234567890", "123"); + ok = ok & test("-1234567890", "1234567890"); + ok = ok & test("-1234567890", "12345678901234567890"); + + ok = ok & test("-123", "-12345678901234567890"); + ok = ok & test("-123", "-1234567890"); + ok = ok & test("-123", "-124"); + ok = ok & test("-123", "-123"); + ok = ok & test("-123", "-122"); + ok = ok & test("-123", "0"); + ok = ok & test("-123", "123"); + ok = ok & test("-123", "1234567890"); + ok = ok & test("-123", "12345678901234567890"); + + ok = ok & test("0", "-12345678901234567890"); + ok = ok & test("0", "-1234567890"); + ok = ok & test("0", "-123"); + ok = ok & test("0", "-1"); + ok = ok & test("0", "0"); + ok = ok & test("0", "1"); + ok = ok & test("0", "123"); + ok = ok & test("0", "1234567890"); + ok = ok & test("0", "12345678901234567890"); + + ok = ok & test("123", "-12345678901234567890"); + ok = ok & test("123", "-1234567890"); + ok = ok & test("123", "-123"); + ok = ok & test("123", "0"); + ok = ok & test("123", "122"); + ok = ok & test("123", "123"); + ok = ok & test("123", "124"); + ok = ok & test("123", "1234567890"); + ok = ok & test("123", "12345678901234567890"); + + ok = ok & test("1234567890", "-12345678901234567890"); + ok = ok & test("1234567890", "-1234567890"); + ok = ok & test("1234567890", "-123"); + ok = ok & test("1234567890", "0"); + ok = ok & test("1234567890", "123"); + ok = ok & test("1234567890", "1234567889"); + ok = ok & test("1234567890", "1234567890"); + ok = ok & test("1234567890", "1234567891"); + ok = ok & test("1234567890", "12345678901234567890"); + + ok = ok & test("12345678901234567890", "-12345678901234567890"); + ok = ok & test("12345678901234567890", "-1234567890"); + ok = ok & test("12345678901234567890", "-123"); + ok = ok & test("12345678901234567890", "0"); + ok = ok & test("12345678901234567890", "123"); + ok = ok & test("12345678901234567890", "1234567890"); + ok = ok & test("12345678901234567890", "12345678901234567889"); + ok = ok & test("12345678901234567890", "12345678901234567890"); + ok = ok & test("12345678901234567890", "12345678901234567891"); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(String s1, String s2) { + BigNum bn1 = new BigNum(s1); + BigNum bn2 = new BigNum(s2); + boolean actualResult = bn1.equals(bn2); + boolean expectedResult = s1.equals(s2); + if (actualResult == expectedResult) + return true; + else { + err.println("s1: " + s1 + + " s2: " + s2 + + " expected result: " + expectedResult + + " actual result: " + actualResult); + return false; + } + } +} + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/index.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/index.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/index.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/index.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,47 @@ +<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"> +<!-- + $Id$ + + Copyright (c) 2002, 2021, Oracle and/or its affiliates. All rights reserved. + DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + + This code is free software; you can redistribute it and/or modify it + under the terms of the GNU General Public License version 2 only, as + published by the Free Software Foundation. Oracle designates this + particular file as subject to the "Classpath" exception as provided + by Oracle in the LICENSE file that accompanied this code. + + This code is distributed in the hope that it will be useful, but WITHOUT + ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + version 2 for more details (a copy is included in the LICENSE file that + accompanied this code). + + You should have received a copy of the GNU General Public License version + 2 along with this work; if not, write to the Free Software Foundation, + Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + + Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + or visit www.oracle.com if you need additional information or have any + questions. +--> +<html> + <head> + <title>Tests for com.sun.demoapi.BigNum + + + +

Tests for com.sun.demoapi.BigNum

+ + + + + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/LongConstrTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/LongConstrTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/LongConstrTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/LongConstrTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,113 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.bignum; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum(long). + * + * @test + * @sources LongConstrTest.java + * @executeClass com.sun.demots.tests.bignum.LongConstrTest + */ +public class LongConstrTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new LongConstrTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + // create some BigNums, convert them to strings and verify the results + ok = ok & test(0); + ok = ok & test(123); + ok = ok & test(123456); + ok = ok & test(123456789); + ok = ok & test(123456789123456789L); + + ok = ok & test(-123); + ok = ok & test(-123456); + ok = ok & test(-123456789); + ok = ok & test(-123456789123456789L); + + return (ok ? Status.passed("OK") : Status.failed("some test cases failed")); + } + + /** + * Test the BigNum(long) constructor. A BigNum is created with + * the specified argument; the creation is then verified by + * converting it to a string and comparing it against the string + * representation of the original argument. If the test fails, + * a message is written to the log. + * + * @param n the argument for the BigNum constructor + * @return true if the test succeeded, and false otherwise. + */ + private boolean test(long n) { + BigNum bn = new BigNum(n); + String bs = bn.toString(); + if (bs.equals(String.valueOf(n))) + return true; + else { + err.println("test failed: expected: " + n + "; found: " + bs); + return false; + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/StringConstrTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/StringConstrTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/StringConstrTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/StringConstrTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,177 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.bignum; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum(String). + * + * @test + * @sources StringConstrTest.java + * @executeClass com.sun.demots.tests.bignum.StringConstrTest + */ +public class StringConstrTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new StringConstrTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + // check zero + ok = ok & posTest("0"); + + // check positive numbers + ok = ok & posTest("123"); + ok = ok & posTest("123456789"); + ok = ok & posTest("1234567890123456789"); + + // check negative numbers + ok = ok & posTest("-123"); + ok = ok & posTest("-123456789"); + ok = ok & posTest("-1234567890123456789"); + + // check leading zeroes ignored + ok = ok & posTest("-0", "0"); + ok = ok & posTest("000123456789", "123456789"); + + // check invalid numbers detected + ok = ok & negTest(null, NullPointerException.class); + ok = ok & negTest("", NumberFormatException.class); + ok = ok & negTest("-", NumberFormatException.class); + ok = ok & negTest("a", NumberFormatException.class); + ok = ok & negTest("-a", NumberFormatException.class); + ok = ok & negTest("123a", NumberFormatException.class); + ok = ok & negTest("12.3", NumberFormatException.class); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + /** + * Test the BigNum(String) constructor. A BigNum is created + * with the specified argument; the creation is then verified by + * converting it to a string and comparing it against the + * original argument. If the test fails, a message is written + * to the log. + * + * @param s the argument for the BigNum constructor + * @return true if the test succeeded, and false otherwise. + */ + boolean posTest(String s) { + return posTest(s, s); + } + + /** + * Test the BigNum(String) constructor. A BigNum is created + * with a specified argument; the creation is then verified by + * converting it to a string and comparing it a reference value. + * If the test fails, a message is written to the log. + * + * @param s1 the argument for the BigNum constructor + * @param s2 the reference value, giving the expected string + * representation of the BigNum that is created + * @return true if the test succeeded, and false otherwise. + */ + boolean posTest(String s1, String s2) { + BigNum bn = new BigNum(s1); + String bs = bn.toString(); + if (bs != null && bs.equals(s2)) + return true; + else { + err.println("arg: " + s1 + ", expected: " + s2 + ", found: " + bs); + return false; + } + } + + /** + * Test the BigNum(String) constructor. A BigNum is created + * with a specified argument; the creation is expected to fail + * with a specified exception. The test passes if the correct + * exception is thrown. + * If the test fails, a message is written to the log. + * + * @param s the argument for the BigNum constructor + * @param expectedThrowableClass the class of the exception that + * is expected to be thrown + * @return true if the expected exception is thrown when calling + * the BigNum(String) constructor, and false otherwise. + */ + boolean negTest(String s, Class expectedThrowableClass) { + try { + BigNum bn = new BigNum(s); + err.println("arg: " + s + ", expected: " + + expectedThrowableClass.getName() + + ", no exception thrown"); + return false; + } catch (Throwable t) { + if (expectedThrowableClass.isInstance(t)) + return true; + else { + err.println("arg: " + s + ", expected: " + + expectedThrowableClass.getName() + + ", received " + t.getClass().getName()); + return false; + } + } + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/SubtractTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/SubtractTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/SubtractTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/BigNum/SubtractTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,156 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.bignum; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum.subtract. + * + * @test + * @sources SubtractTest.java + * @executeClass com.sun.demots.tests.bignum.SubtractTest + */ +public class SubtractTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new SubtractTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + ok = ok & test("-12345678901234567890", "-12345678901234567890", "0"); + ok = ok & test("-12345678901234567890", "-1234567890", "-12345678900000000000"); + ok = ok & test("-12345678901234567890", "-123", "-12345678901234567767"); + ok = ok & test("-12345678901234567890", "0", "-12345678901234567890"); + ok = ok & test("-12345678901234567890", "123", "-12345678901234568013"); + ok = ok & test("-12345678901234567890", "1234567890", "-12345678902469135780"); + ok = ok & test("-12345678901234567890", "12345678901234567890", "-24691357802469135780"); + + ok = ok & test("-1234567890", "-12345678901234567890", "12345678900000000000"); + ok = ok & test("-1234567890", "-1234567890", "0"); + ok = ok & test("-1234567890", "-123", "-1234567767"); + ok = ok & test("-1234567890", "0", "-1234567890"); + ok = ok & test("-1234567890", "123", "-1234568013"); + ok = ok & test("-1234567890", "1234567890", "-2469135780"); + ok = ok & test("-1234567890", "12345678901234567890", "-12345678902469135780"); + + ok = ok & test("-123", "-12345678901234567890", "12345678901234567767"); + ok = ok & test("-123", "-1234567890", "1234567767"); + ok = ok & test("-123", "-123", "0"); + ok = ok & test("-123", "0", "-123"); + ok = ok & test("-123", "123", "-246"); + ok = ok & test("-123", "1234567890", "-1234568013"); + ok = ok & test("-123", "12345678901234567890", "-12345678901234568013"); + + ok = ok & test("0", "-12345678901234567890", "12345678901234567890"); + ok = ok & test("0", "-1234567890", "1234567890"); + ok = ok & test("0", "-123", "123"); + ok = ok & test("0", "0", "0"); + ok = ok & test("0", "123", "-123"); + ok = ok & test("0", "1234567890", "-1234567890"); + ok = ok & test("0", "12345678901234567890", "-12345678901234567890"); + + ok = ok & test("123", "-12345678901234567890", "12345678901234568013"); + ok = ok & test("123", "-1234567890", "1234568013"); + ok = ok & test("123", "-123", "246"); + ok = ok & test("123", "0", "123"); + ok = ok & test("123", "123", "0"); + ok = ok & test("123", "1234567890", "-1234567767"); + ok = ok & test("123", "12345678901234567890", "-12345678901234567767"); + + ok = ok & test("1234567890", "-12345678901234567890", "12345678902469135780"); + ok = ok & test("1234567890", "-1234567890", "2469135780"); + ok = ok & test("1234567890", "-123", "1234568013"); + ok = ok & test("1234567890", "0", "1234567890"); + ok = ok & test("1234567890", "123", "1234567767"); + ok = ok & test("1234567890", "1234567890", "0"); + ok = ok & test("1234567890", "12345678901234567890", "-12345678900000000000"); + + ok = ok & test("12345678901234567890", "-12345678901234567890", "24691357802469135780"); + ok = ok & test("12345678901234567890", "-1234567890", "12345678902469135780"); + ok = ok & test("12345678901234567890", "-123", "12345678901234568013"); + ok = ok & test("12345678901234567890", "0", "12345678901234567890"); + ok = ok & test("12345678901234567890", "123", "12345678901234567767"); + ok = ok & test("12345678901234567890", "1234567890", "12345678900000000000"); + ok = ok & test("12345678901234567890", "12345678901234567890", "0"); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(String s1, String s2, String expectedResult) { + BigNum bn1 = new BigNum(s1); + BigNum bn2 = new BigNum(s2); + BigNum sum = bn1.subtract(bn2); + if (sum.toString().equals(expectedResult)) + return true; + else { + err.println("s1: " + s1 + + " s2: " + s2 + + " expected result: " + expectedResult + + " actual result: " + sum); + return false; + } + } +} + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/AppendTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/AppendTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/AppendTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/AppendTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,150 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.DoublyLinkedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.DoublyLinkedList; + +/** + * A test for com.sun.demoapi.lists.DoublyLinkedList.append. + * + * @test + * @sources AppendTest.java + * @executeClass com.sun.demots.tests.lists.DoublyLinkedList.AppendTest + */ +public class AppendTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new AppendTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); + + ok = ok & test(new Object[]{"a", "b", "c", "d"}); + ok = ok & test(new Object[]{one, two, three}); + ok = ok & test(new Object[]{one, "a", null, two}); + ok = ok & test(new Object[]{"a", "a", "a", "a"}); + ok = ok & test(new Object[]{"a", "a", one, one}); + ok = ok & test(new Object[]{"a", one, "a", one}); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(Object[] data) { + String expected = ""; + DoublyLinkedList list = new DoublyLinkedList(); + for (int i = 0; i < data.length; i++) { + Object d = data[i]; + list.append(d); + if (i == 0) + expected = String.valueOf(d); + else + expected = expected + "," + String.valueOf(d); + + if (!verify(list, expected)) { + err.println("mismatch:"); + err.println(" expected: " + expected); + err.println(" found: " + list); + return false; + } + } + return true; + } + + boolean verify(DoublyLinkedList l, String expected) { + return verifyForwards(l, expected) && verifyBackwards(l, expected); + } + + boolean verifyForwards(DoublyLinkedList l, String expected) { + StringBuffer sb = new StringBuffer(); + boolean first = true; + for (DoublyLinkedList.Entry e = l.getFirst(); e != null; e = e.getNext()) { + if (first) + first = false; + else + sb.append(","); + sb.append(String.valueOf(e.getData())); + } + + //System.err.println(l); + return (sb.toString().equals(expected)); + } + + boolean verifyBackwards(DoublyLinkedList l, String expected) { + StringBuffer sb = new StringBuffer(); + boolean first = true; + for (DoublyLinkedList.Entry e = l.getLast(); e != null; e = e.getPrevious()) { + if (first) + first = false; + else + sb.insert(0, ","); + sb.insert(0, String.valueOf(e.getData())); + } + + //System.err.println(l); + return (sb.toString().equals(expected)); + } +} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/EqualsTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/EqualsTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/EqualsTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/EqualsTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,163 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.DoublyLinkedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.LinkedList; + +/** + * A test for com.sun.demoapi.lists.LinkedList.equals. + * + * @test + * @sources EqualsTest.java + * @executeClass com.sun.demots.tests.lists.LinkedList.EqualsTest + */ +public class EqualsTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new EqualsTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); + + ok = ok & positive_test(new Object[]{}); + ok = ok & positive_test(new Object[]{null}); + ok = ok & positive_test(new Object[]{"a"}); + ok = ok & positive_test(new Object[]{one, "a"}); + ok = ok & positive_test(new Object[]{one, null, "a"}); + ok = ok & positive_test(new Object[]{"a", "b", "c", "d"}); + ok = ok & positive_test(new Object[]{one, two, three}); + ok = ok & positive_test(new Object[]{one, "a", null, two}); + ok = ok & positive_test(new Object[]{"a", "a", "a", "a"}); + ok = ok & positive_test(new Object[]{"a", "a", one, one}); + ok = ok & positive_test(new Object[]{"a", one, "a", one}); + ok = ok & negative_test(new Object[]{}, new Object[]{"a"}); + ok = ok & negative_test(new Object[]{"a"}, new Object[]{"b"}); + ok = ok & negative_test(new Object[]{"a"}, new Object[]{one}); + ok = ok & negative_test(new Object[]{"a"}, new Object[]{null}); + ok = ok & negative_test(new Object[]{"a", one}, new Object[]{"b", one}); + ok = ok & negative_test(new Object[]{"a", one}, new Object[]{one, one}); + ok = ok & negative_test(new Object[]{"a", one}, new Object[]{null, one}); + ok = ok & negative_test(new Object[]{"a", one}, new Object[]{"a", one, "b"}); + ok = ok & negative_test(new Object[]{"a", one}, one); + ok = ok & negative_test(new Object[]{"a", one}, "a"); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean positive_test(Object[] data) { + // create the list two different ways from the same data + LinkedList list1 = new LinkedList(); + LinkedList list2 = new LinkedList(); + for (int i = 0; i < data.length; i++) { + list1.insert(data[data.length - i - 1]); + list2.append(data[i]); + } + + if (!list1.equals(list2)) { + err.println("mismatch:"); + err.println(" list1: " + list1); + err.println(" list2: " + list2); + return false; + } + + return true; + } + + boolean negative_test(Object[] data1, Object[] data2) { + LinkedList list1 = new LinkedList(); + for (int i = 0; i < data1.length; i++) + list1.insert(data1[data1.length - i - 1]); + + LinkedList list2 = new LinkedList(); + for (int i = 0; i < data2.length; i++) + list2.insert(data2[data2.length - i - 1]); + + if (list1.equals(list2)) { + err.println("lists matched unexpectedly:"); + err.println(" list1: " + list1); + err.println(" list2: " + list2); + return false; + } + + return true; + } + + boolean negative_test(Object[] data1, Object data2) { + LinkedList list1 = new LinkedList(); + for (int i = 0; i < data1.length; i++) + list1.insert(data1[data1.length - i - 1]); + + if (list1.equals(data2)) { + err.println("lists matched unexpectedly:"); + err.println(" list1: " + list1); + err.println(" data2: " + data2); + return false; + } + + return true; + } +} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/index.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/index.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/index.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/index.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,43 @@ + + + + + Tests for com.sun.demoapi.lists.DoublyLinkedList + + +

Tests for com.sun.demoapi.lists.DoublyLinkedList

+ + + + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/InsertTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/InsertTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/InsertTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/InsertTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,154 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.DoublyLinkedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.DoublyLinkedList; + +/** + * A test for com.sun.demoapi.lists.DoublyLinkedList.insert. + * + * @test + * @sources InsertTest.java + * @executeClass com.sun.demots.tests.lists.DoublyLinkedList.InsertTest + */ +public class InsertTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new InsertTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); + + ok = ok & test(new Object[]{"a", "b", "c", "d"}); + ok = ok & test(new Object[]{one, two, three}); + ok = ok & test(new Object[]{one, "a", null, two}); + ok = ok & test(new Object[]{"a", "a", "a", "a"}); + ok = ok & test(new Object[]{"a", "a", one, one}); + ok = ok & test(new Object[]{"a", one, "a", one}); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(Object[] data) { + String expected = ""; + DoublyLinkedList list = new DoublyLinkedList(); + for (int i = 0; i < data.length; i++) { + Object d = data[i]; + // The following line is deliberately incorrect, so that + // the tutorial can illustrate the effects of a test that + // fails. The line should really be + // list.insert(d); + list.append(d); + if (i == 0) + expected = String.valueOf(d); + else + expected = String.valueOf(d) + "," + expected; + + if (!verify(list, expected)) { + err.println("mismatch:"); + err.println(" expected: " + expected); + err.println(" found: " + list); + return false; + } + } + return true; + } + + boolean verify(DoublyLinkedList l, String expected) { + return verifyForwards(l, expected) && verifyBackwards(l, expected); + } + + boolean verifyForwards(DoublyLinkedList l, String expected) { + StringBuffer sb = new StringBuffer(); + boolean first = true; + for (DoublyLinkedList.Entry e = l.getFirst(); e != null; e = e.getNext()) { + if (first) + first = false; + else + sb.append(","); + sb.append(String.valueOf(e.getData())); + } + + //System.err.println(l); + return (sb.toString().equals(expected)); + } + + boolean verifyBackwards(DoublyLinkedList l, String expected) { + StringBuffer sb = new StringBuffer(); + boolean first = true; + for (DoublyLinkedList.Entry e = l.getLast(); e != null; e = e.getPrevious()) { + if (first) + first = false; + else + sb.insert(0, ","); + sb.insert(0, String.valueOf(e.getData())); + } + + //System.err.println(l); + return (sb.toString().equals(expected)); + } +} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/RemoveTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/RemoveTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/RemoveTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/DoublyLinkedList/RemoveTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,280 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.DoublyLinkedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.DoublyLinkedList; + +/** + * A test for com.sun.demoapi.lists.DoublyLinkedList.remove. + * + * @test + * @sources RemoveTest.java + * @executeClass com.sun.demots.tests.lists.DoublyLinkedList.RemoveTest + */ +public class RemoveTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new RemoveTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + Integer i0 = Integer.valueOf(0); + Integer i10 = Integer.valueOf(10); + Integer i100 = Integer.valueOf(100); + Integer i1000 = Integer.valueOf(1000); + Integer i10000 = Integer.valueOf(10000); + + boolean ok = true; + + ok = ok & test(new Object[]{i0}); + ok = ok & test(new Object[]{i0, i10}); + ok = ok & test(new Object[]{i0, i10, i100}); + ok = ok & test(new Object[]{i0, i10, i100, i1000}); + ok = ok & test(new Object[]{i0, i10, i100, i1000, i10000}); + ok = ok & test(new Object[]{i0, i0, i10, i100}); + ok = ok & test(new Object[]{i0, i10, i0, i100}); + ok = ok & test(new Object[]{i0, i10, i100, i0}); + + ok = ok & test(new Object[]{"a"}); + ok = ok & test(new Object[]{"a", "b"}); + ok = ok & test(new Object[]{"a", "b", "c"}); + ok = ok & test(new Object[]{"a", "b", "c", i0}); + ok = ok & test(new Object[]{"a", "b", "c", i0, i10}); + ok = ok & test(new Object[]{"a", "b", "c", i0, i10, i100}); + + ok = ok & test(new Object[]{null, "a", "b", "c"}); + ok = ok & test(new Object[]{"a", null, "b", "c"}); + ok = ok & test(new Object[]{"a", "b", null, "c"}); + ok = ok & test(new Object[]{"a", "b", "c", null}); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(Object[] data) { + err.println("test: " + toString(data, 0, data.length)); + boolean ok1 = testRemoveFirst(data); + boolean ok2 = testRemoveLast(data); + boolean ok3 = testRemoveMiddle(data); + return (ok1 & ok2 & ok3); + } + + boolean testRemoveFirst(Object[] data) { + DoublyLinkedList list = createList(data); + Object[] ref = copy(data); + + for (int i = 0; i < ref.length; i++) { + int refLen = ref.length - i; + // select item to remove + Object o = ref[0]; + // remove from list + list.remove(o); + // remove from reference array + if (remove(ref, 0, refLen, o)) + refLen--; + // compare list and reference + if (!verify(list, ref, 0, refLen)) { + err.println("removeFirst mismatch:"); + err.println(" expected: " + toString(ref, 0, refLen)); + err.println(" found: " + list); + return false; + } + + } + + return true; + } + + boolean testRemoveLast(Object[] data) { + DoublyLinkedList list = createList(data); + Object[] ref = copy(data); + + for (int i = 0; i < ref.length; i++) { + int refLen = ref.length - i; + // select item to remove + Object o = ref[refLen - 1]; + // remove from list + list.remove(o); + // remove from reference array + if (remove(ref, 0, refLen, o)) + refLen--; + // compare list and reference + if (!verify(list, ref, 0, refLen)) { + err.println("removeLast mismatch:"); + err.println(" expected: " + toString(ref, 0, refLen)); + err.println(" found: " + list); + return false; + } + + } + + return true; + } + + boolean testRemoveMiddle(Object[] data) { + DoublyLinkedList list = createList(data); + Object[] ref = copy(data); + + for (int i = 0; i < ref.length; i++) { + int refLen = ref.length - i; + // select item to remove + Object o = ref[refLen / 2]; + // remove from list + list.remove(o); + // remove from reference array + if (remove(ref, 0, refLen, o)) + refLen--; + // compare list and reference + if (!verify(list, ref, 0, refLen)) { + err.println("removeLast mismatch:"); + err.println(" expected: " + toString(ref, 0, refLen)); + err.println(" found: " + list); + return false; + } + + } + + return true; + } + + Object[] copy(Object[] data) { + Object[] d = new Object[data.length]; + System.arraycopy(data, 0, d, 0, data.length); + return d; + } + + DoublyLinkedList createList(Object[] data) { + DoublyLinkedList list = new DoublyLinkedList(); + for (int i = data.length - 1; i >= 0; i--) + list.insert(data[i]); + return list; + } + + boolean remove(Object[] data, int offset, int length, Object o) { + for (int i = offset; i < offset + length; i++) { + boolean found = (data[i] == null ? o == null : data[i].equals(o)); + if (found) { + System.arraycopy(data, i + 1, data, i, offset + length - i - 1); + return true; + } + } + // not found + return false; + } + + String toString(Object[] array, int offset, int length) { + StringBuffer sb = new StringBuffer(); + for (int i = offset; i < (offset + length); i++) { + if (i > offset) + sb.append(","); + sb.append(String.valueOf(array[i])); + } + return sb.toString(); + } + + boolean verify(DoublyLinkedList l, Object[] ref, int offset, int length) { + return verifyForwards(l, ref, offset, length) + && verifyBackwards(l, ref, offset, length); + } + + boolean verifyForwards(DoublyLinkedList l, Object[] ref, int offset, int length) { + int i = offset; + for (DoublyLinkedList.Entry e = l.getFirst(); e != null; e = e.getNext()) { + if (i < offset + length) { + Object d = e.getData(); + if (d == null) { + if (ref[i] != null) + // data difference found + return false; + } else if (!d.equals(ref[i])) + // data difference found + return false; + } else + // list is longer than ref + return false; + + i++; + } + + return (i == offset + length); + } + + boolean verifyBackwards(DoublyLinkedList l, Object[] ref, int offset, int length) { + int i = offset + length - 1; + for (DoublyLinkedList.Entry e = l.getLast(); e != null; e = e.getPrevious()) { + if (i >= offset) { + Object d = e.getData(); + if (d == null) { + if (ref[i] != null) + // data difference found + return false; + } else if (!d.equals(ref[i])) + // data difference found + return false; + } else + // list is longer than ref + return false; + + i--; + } + + return (i == offset - 1); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/index.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/index.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/index.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/index.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,42 @@ + + + + + Tests for package com.sun.demoapi.lists + + +

Tests for package com.sun.demoapi.lists

+ + + + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/AppendTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/AppendTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/AppendTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/AppendTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,130 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.LinkedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.LinkedList; + +/** + * A test for com.sun.demoapi.lists.LinkedList.append. + * + * @test + * @sources AppendTest.java + * @executeClass com.sun.demots.tests.lists.LinkedList.AppendTest + */ +public class AppendTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new AppendTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); + + ok = ok & test(new Object[]{"a", "b", "c", "d"}); + ok = ok & test(new Object[]{one, two, three}); + ok = ok & test(new Object[]{one, "a", null, two}); + ok = ok & test(new Object[]{"a", "a", "a", "a"}); + ok = ok & test(new Object[]{"a", "a", one, one}); + ok = ok & test(new Object[]{"a", one, "a", one}); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(Object[] data) { + String expected = ""; + LinkedList list = new LinkedList(); + for (int i = 0; i < data.length; i++) { + Object d = data[i]; + list.append(d); + if (i == 0) + expected = String.valueOf(d); + else + expected = expected + "," + String.valueOf(d); + + if (!verify(list, expected)) { + err.println("mismatch:"); + err.println(" expected: " + expected); + err.println(" found: " + list); + return false; + } + } + return true; + } + + boolean verify(LinkedList l, String expected) { + StringBuffer sb = new StringBuffer(); + boolean first = true; + for (LinkedList.Entry e = l.getFirst(); e != null; e = e.getNext()) { + if (first) + first = false; + else + sb.append(","); + sb.append(String.valueOf(e.getData())); + } + //System.err.println(l); + return (sb.toString().equals(expected)); + } +} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/EqualsTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/EqualsTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/EqualsTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/EqualsTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,163 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.LinkedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.LinkedList; + +/** + * A test for com.sun.demoapi.lists.LinkedList.equals. + * + * @test + * @sources EqualsTest.java + * @executeClass com.sun.demots.tests.lists.LinkedList.EqualsTest + */ +public class EqualsTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new EqualsTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); + + ok = ok & positive_test(new Object[]{}); + ok = ok & positive_test(new Object[]{null}); + ok = ok & positive_test(new Object[]{"a"}); + ok = ok & positive_test(new Object[]{one, "a"}); + ok = ok & positive_test(new Object[]{one, null, "a"}); + ok = ok & positive_test(new Object[]{"a", "b", "c", "d"}); + ok = ok & positive_test(new Object[]{one, two, three}); + ok = ok & positive_test(new Object[]{one, "a", null, two}); + ok = ok & positive_test(new Object[]{"a", "a", "a", "a"}); + ok = ok & positive_test(new Object[]{"a", "a", one, one}); + ok = ok & positive_test(new Object[]{"a", one, "a", one}); + ok = ok & negative_test(new Object[]{}, new Object[]{"a"}); + ok = ok & negative_test(new Object[]{"a"}, new Object[]{"b"}); + ok = ok & negative_test(new Object[]{"a"}, new Object[]{one}); + ok = ok & negative_test(new Object[]{"a"}, new Object[]{null}); + ok = ok & negative_test(new Object[]{"a", one}, new Object[]{"b", one}); + ok = ok & negative_test(new Object[]{"a", one}, new Object[]{one, one}); + ok = ok & negative_test(new Object[]{"a", one}, new Object[]{null, one}); + ok = ok & negative_test(new Object[]{"a", one}, new Object[]{"a", one, "b"}); + ok = ok & negative_test(new Object[]{"a", one}, one); + ok = ok & negative_test(new Object[]{"a", one}, "a"); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean positive_test(Object[] data) { + // create the list two different ways from the same data + LinkedList list1 = new LinkedList(); + LinkedList list2 = new LinkedList(); + for (int i = 0; i < data.length; i++) { + list1.insert(data[data.length - i - 1]); + list2.append(data[i]); + } + + if (!list1.equals(list2)) { + err.println("mismatch:"); + err.println(" list1: " + list1); + err.println(" list2: " + list2); + return false; + } + + return true; + } + + boolean negative_test(Object[] data1, Object[] data2) { + LinkedList list1 = new LinkedList(); + for (int i = 0; i < data1.length; i++) + list1.insert(data1[data1.length - i - 1]); + + LinkedList list2 = new LinkedList(); + for (int i = 0; i < data2.length; i++) + list2.insert(data2[data2.length - i - 1]); + + if (list1.equals(list2)) { + err.println("lists matched unexpectedly:"); + err.println(" list1: " + list1); + err.println(" list2: " + list2); + return false; + } + + return true; + } + + boolean negative_test(Object[] data1, Object data2) { + LinkedList list1 = new LinkedList(); + for (int i = 0; i < data1.length; i++) + list1.insert(data1[data1.length - i - 1]); + + if (list1.equals(data2)) { + err.println("lists matched unexpectedly:"); + err.println(" list1: " + list1); + err.println(" data2: " + data2); + return false; + } + + return true; + } +} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/index.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/index.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/index.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/index.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,43 @@ + + + + + Tests for com.sun.demoapi.lists.LinkedList + + + +

Tests for com.sun.demoapi.lists.LinkedList

+ + + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/InsertTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/InsertTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/InsertTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/InsertTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,130 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.LinkedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.LinkedList; + +/** + * A test for com.sun.demoapi.lists.LinkedList.insert. + * + * @test + * @sources InsertTest.java + * @executeClass com.sun.demots.tests.lists.LinkedList.InsertTest + */ +public class InsertTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new InsertTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + boolean ok = true; + + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); + + ok = ok & test(new Object[]{"a", "b", "c", "d"}); + ok = ok & test(new Object[]{one, two, three}); + ok = ok & test(new Object[]{one, "a", null, two}); + ok = ok & test(new Object[]{"a", "a", "a", "a"}); + ok = ok & test(new Object[]{"a", "a", one, one}); + ok = ok & test(new Object[]{"a", one, "a", one}); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(Object[] data) { + String expected = ""; + LinkedList list = new LinkedList(); + for (int i = 0; i < data.length; i++) { + Object d = data[i]; + list.insert(d); + if (i == 0) + expected = String.valueOf(d); + else + expected = String.valueOf(d) + "," + expected; + + if (!verify(list, expected)) { + err.println("mismatch:"); + err.println(" expected: " + expected); + err.println(" found: " + list); + return false; + } + } + return true; + } + + boolean verify(LinkedList l, String expected) { + StringBuffer sb = new StringBuffer(); + boolean first = true; + for (LinkedList.Entry e = l.getFirst(); e != null; e = e.getNext()) { + if (first) + first = false; + else + sb.append(","); + sb.append(String.valueOf(e.getData())); + } + //System.err.println(l); + return (sb.toString().equals(expected)); + } +} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/RemoveTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/RemoveTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/RemoveTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/LinkedList/RemoveTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,253 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.LinkedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.LinkedList; + +/** + * A test for com.sun.demoapi.lists.LinkedList.remove. + * + * @test + * @sources RemoveTest.java + * @executeClass com.sun.demots.tests.lists.LinkedList.RemoveTest + */ +public class RemoveTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new RemoveTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + Integer i0 = Integer.valueOf(0); + Integer i10 = Integer.valueOf(10); + Integer i100 = Integer.valueOf(100); + Integer i1000 = Integer.valueOf(1000); + Integer i10000 = Integer.valueOf(10000); + + boolean ok = true; + + ok = ok & test(new Object[]{i0}); + ok = ok & test(new Object[]{i0, i10}); + ok = ok & test(new Object[]{i0, i10, i100}); + ok = ok & test(new Object[]{i0, i10, i100, i1000}); + ok = ok & test(new Object[]{i0, i10, i100, i1000, i10000}); + ok = ok & test(new Object[]{i0, i0, i10, i100}); + ok = ok & test(new Object[]{i0, i10, i0, i100}); + ok = ok & test(new Object[]{i0, i10, i100, i0}); + + ok = ok & test(new Object[]{"a"}); + ok = ok & test(new Object[]{"a", "b"}); + ok = ok & test(new Object[]{"a", "b", "c"}); + ok = ok & test(new Object[]{"a", "b", "c", i0}); + ok = ok & test(new Object[]{"a", "b", "c", i0, i10}); + ok = ok & test(new Object[]{"a", "b", "c", i0, i10, i100}); + + ok = ok & test(new Object[]{null, "a", "b", "c"}); + ok = ok & test(new Object[]{"a", null, "b", "c"}); + ok = ok & test(new Object[]{"a", "b", null, "c"}); + ok = ok & test(new Object[]{"a", "b", "c", null}); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(Object[] data) { + err.println("test: " + toString(data, 0, data.length)); + boolean ok1 = testRemoveFirst(data); + boolean ok2 = testRemoveLast(data); + boolean ok3 = testRemoveMiddle(data); + return (ok1 & ok2 & ok3); + } + + boolean testRemoveFirst(Object[] data) { + LinkedList list = createList(data); + Object[] ref = copy(data); + + for (int i = 0; i < ref.length; i++) { + int refLen = ref.length - i; + // select item to remove + Object o = ref[0]; + // remove from list + list.remove(o); + // remove from reference array + if (remove(ref, 0, refLen, o)) + refLen--; + // compare list and reference + if (!verify(list, ref, 0, refLen)) { + err.println("removeFirst mismatch:"); + err.println(" expected: " + toString(ref, 0, refLen)); + err.println(" found: " + list); + return false; + } + + } + + return true; + } + + boolean testRemoveLast(Object[] data) { + LinkedList list = createList(data); + Object[] ref = copy(data); + + for (int i = 0; i < ref.length; i++) { + int refLen = ref.length - i; + // select item to remove + Object o = ref[refLen - 1]; + // remove from list + list.remove(o); + // remove from reference array + if (remove(ref, 0, refLen, o)) + refLen--; + // compare list and reference + if (!verify(list, ref, 0, refLen)) { + err.println("removeLast mismatch:"); + err.println(" expected: " + toString(ref, 0, refLen)); + err.println(" found: " + list); + return false; + } + + } + + return true; + } + + boolean testRemoveMiddle(Object[] data) { + LinkedList list = createList(data); + Object[] ref = copy(data); + + for (int i = 0; i < ref.length; i++) { + int refLen = ref.length - i; + // select item to remove + Object o = ref[refLen / 2]; + // remove from list + list.remove(o); + // remove from reference array + if (remove(ref, 0, refLen, o)) + refLen--; + // compare list and reference + if (!verify(list, ref, 0, refLen)) { + err.println("removeLast mismatch:"); + err.println(" expected: " + toString(ref, 0, refLen)); + err.println(" found: " + list); + return false; + } + + } + + return true; + } + + Object[] copy(Object[] data) { + Object[] d = new Object[data.length]; + System.arraycopy(data, 0, d, 0, data.length); + return d; + } + + LinkedList createList(Object[] data) { + LinkedList list = new LinkedList(); + for (int i = data.length - 1; i >= 0; i--) + list.insert(data[i]); + return list; + } + + boolean remove(Object[] data, int offset, int length, Object o) { + for (int i = offset; i < offset + length; i++) { + boolean found = (data[i] == null ? o == null : data[i].equals(o)); + if (found) { + System.arraycopy(data, i + 1, data, i, offset + length - i - 1); + return true; + } + } + // not found + return false; + } + + String toString(Object[] array, int offset, int length) { + StringBuffer sb = new StringBuffer(); + for (int i = offset; i < (offset + length); i++) { + if (i > offset) + sb.append(","); + sb.append(String.valueOf(array[i])); + } + return sb.toString(); + } + + boolean verify(LinkedList l, Object[] ref, int offset, int length) { + int i = offset; + for (LinkedList.Entry e = l.getFirst(); e != null; e = e.getNext()) { + if (i < ref.length) { + Object d = e.getData(); + if (d == null) { + if (ref[i] != null) + // data difference found + return false; + } else if (!d.equals(ref[i])) + // data difference found + return false; + } else + // list is longer than ref + return false; + + i++; + } + + return (i == offset + length); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/EqualsTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/EqualsTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/EqualsTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/EqualsTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,159 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.SortedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.SortedList; + +/** + * A test for com.sun.demoapi.lists.SortedList.equals. + * + * @test + * @sources EqualsTest.java + * @executeClass com.sun.demots.tests.lists.SortedList.EqualsTest + */ +public class EqualsTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new EqualsTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + SortedList.Comparator intComp = new SortedList.Comparator() { + public int compare(Object a, Object b) { + int ia = ((Integer) a).intValue(); + int ib = ((Integer) b).intValue(); + return (ia < ib ? -1 : ia == ib ? 0 : 1); + } + }; + + Integer one = Integer.valueOf(1); + Integer two = Integer.valueOf(2); + Integer three = Integer.valueOf(3); + + boolean ok = true; + + ok = ok & positive_test(new Object[]{}, intComp); + ok = ok & positive_test(new Object[]{one}, intComp); + ok = ok & positive_test(new Object[]{one, two}, intComp); + ok = ok & positive_test(new Object[]{one, two, three}, intComp); + ok = ok & positive_test(new Object[]{one, two, one, two}, intComp); + ok = ok & negative_test(new Object[]{}, new Object[]{one}, intComp); + ok = ok & negative_test(new Object[]{one}, new Object[]{two}, intComp); + ok = ok & negative_test(new Object[]{one, one}, new Object[]{two, one}, intComp); + ok = ok & negative_test(new Object[]{one, two}, new Object[]{one, two, three}, intComp); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean positive_test(Object[] data, SortedList.Comparator c) { + // create the list two different ways from the same data + SortedList list1 = new SortedList(c, true); + SortedList list2 = new SortedList(c, true); + for (int i = 0; i < data.length; i++) { + list1.insert(data[data.length - i - 1]); + list2.insert(data[i]); + } + + if (!list1.equals(list2)) { + err.println("mismatch:"); + err.println(" list1: " + list1); + err.println(" list2: " + list2); + return false; + } + + return true; + } + + boolean negative_test(Object[] data1, Object[] data2, SortedList.Comparator c) { + SortedList list1 = new SortedList(c, true); + for (int i = 0; i < data1.length; i++) + list1.insert(data1[data1.length - i - 1]); + + SortedList list2 = new SortedList(c, true); + for (int i = 0; i < data2.length; i++) + list2.insert(data2[data2.length - i - 1]); + + if (list1.equals(list2)) { + err.println("lists matched unexpectedly:"); + err.println(" list1: " + list1); + err.println(" list2: " + list2); + return false; + } + + return true; + } + + boolean negative_test(Object[] data1, Object data2, SortedList.Comparator c) { + SortedList list1 = new SortedList(c, true); + for (int i = 0; i < data1.length; i++) + list1.insert(data1[data1.length - i - 1]); + + if (list1.equals(data2)) { + err.println("lists matched unexpectedly:"); + err.println(" list1: " + list1); + err.println(" data2: " + data2); + return false; + } + + return true; + } +} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/index.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/index.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/index.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/index.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,42 @@ + + + + + Tests for com.sun.demoapi.lists.SortedList + + +

Tests for com.sun.demoapi.lists.SortedList

+ + + + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/InsertTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/InsertTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/InsertTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/InsertTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,195 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.SortedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.SortedList; + +/** + * A test for com.sun.demoapi.lists.SortedList.insert. + * + * @test + * @sources InsertTest.java + * @executeClass com.sun.demots.tests.lists.SortedList.InsertTest + */ +public class InsertTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new InsertTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + SortedList.Comparator intComp = new SortedList.Comparator() { + public int compare(Object a, Object b) { + int ia = ((Integer) a).intValue(); + int ib = ((Integer) b).intValue(); + return (ia < ib ? -1 : ia == ib ? 0 : 1); + } + }; + + Integer i0 = Integer.valueOf(0); + Integer i10 = Integer.valueOf(10); + Integer i100 = Integer.valueOf(100); + Integer i1000 = Integer.valueOf(1000); + Integer i10000 = Integer.valueOf(10000); + + boolean ok = true; + + ok = ok & test(new Object[]{i0, i10, i100, i1000, i10000}, intComp); + ok = ok & test(new Object[]{i10000, i1000, i100, i10, i0}, intComp); + ok = ok & test(new Object[]{i0, i10000, i10, i1000, i100}, intComp); + ok = ok & test(new Object[]{i0, i0, i0, i0, i0}, intComp); + ok = ok & test(new Object[]{i0, i0, i10000, i0, i0}, intComp); + ok = ok & test(new Object[]{i0, i0, i10000, i10000, i0}, intComp); + ok = ok & test(new Object[]{i0, i0, i10000, i10000, i0}, intComp); + ok = ok & test(new Object[]{i0, i10000, i10000, i10000, i10000}, intComp); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(Object[] data, SortedList.Comparator c) { + return testAllowDups(data, c) && testNoDups(data, c); + } + + boolean testAllowDups(Object[] data, SortedList.Comparator c) { + err.println("test: " + toString(data, 0, data.length)); + SortedList list = new SortedList(c, false); + Object[] expected = new Object[data.length]; + + int n = 0; + for (int i = 0; i < data.length; i++) { + list.insert(data[i]); + expected[n++] = data[i]; + sort(expected, 0, n, c); + if (!verify(list, expected, 0, n, c)) { + err.println("mismatch:"); + err.println(" expected: " + toString(expected, 0, n)); + err.println(" found: " + list); + return false; + } + } + + return true; + } + + boolean testNoDups(Object[] data, SortedList.Comparator c) { + SortedList list = new SortedList(c, true); + Object[] expected = new Object[data.length]; + + int n = 0; + for (int i = 0; i < data.length; i++) { + list.insert(data[i]); + insert: + { + for (int j = 0; j < n; j++) { + if (c.compare(data[i], expected[j]) == 0) + break insert; + } + expected[n++] = data[i]; + sort(expected, 0, n, c); + } + if (!verify(list, expected, 0, n, c)) { + err.println("mismatch:"); + err.println(" expected: " + toString(expected, 0, n)); + err.println(" found: " + list); + return false; + } + } + + return true; + } + + void sort(Object[] data, int offset, int length, SortedList.Comparator c) { + for (int i = offset; i < offset + length; i++) { + for (int j = i; j > offset && c.compare(data[j - 1], data[j]) > 0; j--) { + Object o = data[j]; + data[j] = data[j - 1]; + data[j - 1] = o; + } + } + } + + String toString(Object[] array, int offset, int length) { + StringBuffer sb = new StringBuffer(); + for (int i = offset; i < (offset + length); i++) { + if (i > offset) + sb.append(","); + sb.append(String.valueOf(array[i])); + } + return sb.toString(); + } + + boolean verify(SortedList l, Object[] expected, int offset, int length, SortedList.Comparator c) { + int i = offset; + for (SortedList.Entry e = l.getFirst(); e != null; e = e.getNext()) { + if (i < expected.length) { + if (c.compare(e.getData(), expected[i]) != 0) + // data difference found + return false; + } else + // list is longer than expected + return false; + + i++; + } + + return (i == offset + length); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/RemoveTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/RemoveTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/RemoveTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/lists/SortedList/RemoveTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,265 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.lists.SortedList; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.Test; + +import com.sun.demoapi.lists.SortedList; + +/** + * A test for com.sun.demoapi.lists.SortedList.remove. + * + * @test + * @sources RemoveTest.java + * @executeClass com.sun.demots.tests.lists.SortedList.RemoveTest + */ +public class RemoveTest implements Test { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + Test t = new RemoveTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + /** + * Main test method. The test consists of a series of test cases; + * the test passes only if all the individual test cases pass. + * + * @param args ignored + * @param out ignored + * @param err a stream to which to write details about test failures + * @return a Status object indicating if the test passed or failed + */ + public Status run(String[] args, PrintWriter out, PrintWriter err) { + // save error stream to which to write error messages + this.err = err; + + SortedList.Comparator intComp = new SortedList.Comparator() { + public int compare(Object a, Object b) { + int ia = ((Integer) a).intValue(); + int ib = ((Integer) b).intValue(); + return (ia < ib ? -1 : ia == ib ? 0 : 1); + } + }; + + Integer i0 = Integer.valueOf(0); + Integer i10 = Integer.valueOf(10); + Integer i100 = Integer.valueOf(100); + Integer i1000 = Integer.valueOf(1000); + Integer i10000 = Integer.valueOf(10000); + + boolean ok = true; + + ok = ok & test(new Object[]{i0}, intComp); + ok = ok & test(new Object[]{i0, i10}, intComp); + ok = ok & test(new Object[]{i0, i10, i100}, intComp); + ok = ok & test(new Object[]{i0, i10, i100, i1000}, intComp); + ok = ok & test(new Object[]{i0, i10, i100, i1000, i10000}, intComp); + ok = ok & test(new Object[]{i0, i0, i10, i100}, intComp); + ok = ok & test(new Object[]{i0, i10, i0, i100}, intComp); + ok = ok & test(new Object[]{i0, i10, i100, i0}, intComp); + + if (ok) + return Status.passed("OK"); + else + return Status.failed("one or more test cases failed"); + } + + boolean test(Object[] data, SortedList.Comparator c) { + err.println("test: " + toString(data, 0, data.length)); + boolean ok1 = testRemoveFirst(data, c); + boolean ok2 = testRemoveLast(data, c); + boolean ok3 = testRemoveMiddle(data, c); + return (ok1 & ok2 & ok3); + } + + boolean testRemoveFirst(Object[] data, SortedList.Comparator c) { + SortedList list = createList(data, c); + Object[] ref = sortedCopy(data, c); + + for (int i = 0; i < ref.length; i++) { + int refLen = ref.length - i; + // select item to remove + Object o = ref[0]; + // remove from list + list.remove(o); + // remove from reference array + if (remove(ref, 0, refLen, o)) + refLen--; + // compare list and reference + if (!verify(list, ref, 0, refLen)) { + err.println("removeFirst mismatch:"); + err.println(" expected: " + toString(ref, 0, refLen)); + err.println(" found: " + list); + return false; + } + + } + + return true; + } + + boolean testRemoveLast(Object[] data, SortedList.Comparator c) { + SortedList list = createList(data, c); + Object[] ref = sortedCopy(data, c); + + for (int i = 0; i < ref.length; i++) { + int refLen = ref.length - i; + // select item to remove + Object o = ref[refLen - 1]; + // remove from list + list.remove(o); + // remove from reference array + if (remove(ref, 0, refLen, o)) + refLen--; + // compare list and reference + if (!verify(list, ref, 0, refLen)) { + err.println("removeLast mismatch:"); + err.println(" expected: " + toString(ref, 0, refLen)); + err.println(" found: " + list); + return false; + } + + } + + return true; + } + + boolean testRemoveMiddle(Object[] data, SortedList.Comparator c) { + SortedList list = createList(data, c); + Object[] ref = sortedCopy(data, c); + + for (int i = 0; i < ref.length; i++) { + int refLen = ref.length - i; + // select item to remove + Object o = ref[refLen / 2]; + // remove from list + list.remove(o); + // remove from reference array + if (remove(ref, 0, refLen, o)) + refLen--; + // compare list and reference + if (!verify(list, ref, 0, refLen)) { + err.println("removeLast mismatch:"); + err.println(" expected: " + toString(ref, 0, refLen)); + err.println(" found: " + list); + return false; + } + + } + + return true; + } + + Object[] copy(Object[] data) { + Object[] d = new Object[data.length]; + System.arraycopy(data, 0, d, 0, data.length); + return d; + } + + SortedList createList(Object[] data, SortedList.Comparator c) { + SortedList list = new SortedList(c, false); + for (int i = data.length - 1; i >= 0; i--) + list.insert(data[i]); + return list; + } + + boolean remove(Object[] data, int offset, int length, Object o) { + for (int i = offset; i < offset + length; i++) { + boolean found = (data[i] == null ? o == null : data[i].equals(o)); + if (found) { + System.arraycopy(data, i + 1, data, i, offset + length - i - 1); + return true; + } + } + // not found + return false; + } + + void sort(Object[] data, int offset, int length, SortedList.Comparator c) { + for (int i = offset; i < offset + length; i++) { + for (int j = i; j > offset && c.compare(data[j - 1], data[j]) > 0; j--) { + Object o = data[j]; + data[j] = data[j - 1]; + data[j - 1] = o; + } + } + } + + Object[] sortedCopy(Object[] data, SortedList.Comparator c) { + Object[] newData = copy(data); + sort(newData, 0, data.length, c); + return newData; + } + + String toString(Object[] array, int offset, int length) { + StringBuffer sb = new StringBuffer(); + for (int i = offset; i < (offset + length); i++) { + if (i > offset) + sb.append(","); + sb.append(String.valueOf(array[i])); + } + return sb.toString(); + } + + boolean verify(SortedList l, Object[] ref, int offset, int length) { + int i = offset; + for (SortedList.Entry e = l.getFirst(); e != null; e = e.getNext()) { + if (i < ref.length) { + Object d = e.getData(); + if (d == null) { + if (ref[i] != null) + // data difference found + return false; + } else if (!d.equals(ref[i])) + // data difference found + return false; + } else + // list is longer than ref + return false; + + i++; + } + + return (i == offset + length); + } +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/ErrorTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/ErrorTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/ErrorTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/ErrorTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.TestCasesTests; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.lib.MultiTest; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum.add. + * + * @test + * @sources ErrorTest.java + * @executeClass com.sun.demots.tests.TestCasesTests.ErrorTest + */ +public class ErrorTest extends MultiTest { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + ErrorTest t = new ErrorTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + public Status PassingTest01() { + System.err.println("PassingTest01: Passed."); + return Status.passed("OK"); + } + + public Status ErrorTest01() { + System.err.println("ErrorTest01: Error."); + return Status.error("this testcase is always failing"); + } + + public Status PassingTest02() { + System.err.println("PassingTest02: Passed."); + return Status.passed("OK"); + } + + boolean test(String s1, String s2, String expectedResult) { + BigNum bn1 = new BigNum(s1); + BigNum bn2 = new BigNum(s2); + BigNum sum = bn1.add(bn2); + if (sum.toString().equals(expectedResult)) + return true; + else { + err.println("s1: " + s1 + + " s2: " + s2 + + " expected result: " + expectedResult + + " actual result: " + sum); + return false; + } + } +} + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/FailingTest1.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/FailingTest1.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/FailingTest1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/FailingTest1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.TestCasesTests; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.lib.MultiTest; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum.add. + * + * @test + * @sources FailingTest1.java + * @executeClass com.sun.demots.tests.TestCasesTests.FailingTest1 + */ +public class FailingTest1 extends MultiTest { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + FailingTest1 t = new FailingTest1(); + Status s = t.run(args, null, err); + s.exit(); + } + + public Status FailingTest01() { + System.err.println("FailingTest01: Failed."); + return Status.failed("one or more test cases failed"); + } + + public Status FailingTest02() { + System.err.println("FailingTest02: Failed."); + return Status.failed("this testcase is always failing"); + } + + public Status FailingTest03() { + System.err.println("FailingTest03: Failed."); + return Status.failed("one or more test cases failed"); + } + + boolean test(String s1, String s2, String expectedResult) { + BigNum bn1 = new BigNum(s1); + BigNum bn2 = new BigNum(s2); + BigNum sum = bn1.add(bn2); + if (sum.toString().equals(expectedResult)) + return true; + else { + err.println("s1: " + s1 + + " s2: " + s2 + + " expected result: " + expectedResult + + " actual result: " + sum); + return false; + } + } +} + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/FailingTest2.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/FailingTest2.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/FailingTest2.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/FailingTest2.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,99 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.TestCasesTests; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.lib.MultiTest; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum.add. + * + * @test + * @sources FailingTest2.java + * @executeClass com.sun.demots.tests.TestCasesTests.FailingTest2 + */ +public class FailingTest2 extends MultiTest { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + FailingTest2 t = new FailingTest2(); + Status s = t.run(args, null, err); + s.exit(); + } + + public Status PassingTest01() { + System.err.println("PassingTest01: Passed."); + return Status.passed("passed"); + } + + public Status PassingTest02() { + System.err.println("PassingTest02: Passed."); + return Status.passed("passed"); + } + + public Status FailingTest01() { + System.err.println("FailingTest01: Failed."); + return Status.failed("this testcase is always failing"); + } + + public Status FailingTest02() { + System.err.println("FailingTest02: Failed."); + return Status.failed("this testcase is always failing"); + } + + boolean test(String s1, String s2, String expectedResult) { + BigNum bn1 = new BigNum(s1); + BigNum bn2 = new BigNum(s2); + BigNum sum = bn1.add(bn2); + if (sum.toString().equals(expectedResult)) + return true; + else { + err.println("s1: " + s1 + + " s2: " + s2 + + " expected result: " + expectedResult + + " actual result: " + sum); + return false; + } + } +} + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/index.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/index.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/index.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/index.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,46 @@ + + + + + Tests with testcases + + + +

Tests with testcases

+ + + +

Copyright © 2011, Oracle and/or its affiliates. All rights reserved.

+ + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/ManyTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/ManyTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/ManyTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/ManyTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,119 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.TestCasesTests; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.lib.MultiTest; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum.add. + * + * @test + * @sources ManyTest.java + * @executeClass com.sun.demots.tests.TestCasesTests.ManyTest + */ +public class ManyTest extends MultiTest { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + ManyTest t = new ManyTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + public Status PassingTest01() { + System.err.println("PassingTest01: Passed."); + return Status.passed("OK"); + } + + public Status PassingTest02() { + System.err.println("PassingTest02: Passed."); + return Status.passed("OK"); + } + + public Status PassingTest03() { + System.err.println("PassingTest03: Passed."); + return Status.passed("OK"); + } + + public Status PassingTest04() { + System.err.println("PassingTest04: Passed."); + return Status.passed("OK"); + } + + public Status FailingTest01() { + System.err.println("FailingTest01: Failed."); + return Status.failed("this testcase is always failing"); + } + + public Status FailingTest02() { + System.err.println("FailingTest02: Failed."); + return Status.failed("this testcase is always failing"); + } + + public Status ErrorTest01() { + System.err.println("ErrorTest01: Error."); + return Status.error("this testcase is always error"); + } + + public Status ErrorTest02() { + System.err.println("ErrorTest02: Error."); + return Status.error("this testcase is always error"); + } + + boolean test(String s1, String s2, String expectedResult) { + BigNum bn1 = new BigNum(s1); + BigNum bn2 = new BigNum(s2); + BigNum sum = bn1.add(bn2); + if (sum.toString().equals(expectedResult)) + return true; + else { + err.println("s1: " + s1 + + " s2: " + s2 + + " expected result: " + expectedResult + + " actual result: " + sum); + return false; + } + } +} + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/PassingTest.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/PassingTest.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/PassingTest.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/TestCasesTests/PassingTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots.tests.TestCasesTests; + +import java.io.PrintWriter; + +import com.sun.javatest.Status; +import com.sun.javatest.lib.MultiTest; + +import com.sun.demoapi.BigNum; + +/** + * A test for com.sun.demoapi.BigNum.add. + * + * @test + * @sources PassingTest.java + * @executeClass com.sun.demots.tests.TestCasesTests.PassingTest + */ +public class PassingTest extends MultiTest { + /** + * A stream to which to write info about test failures. + */ + private PrintWriter err; + + /** + * Standard command-line entry point. + * + * @param args command line args (ignored) + */ + public static void main(String[] args) { + PrintWriter err = new PrintWriter(System.err, true); + PassingTest t = new PassingTest(); + Status s = t.run(args, null, err); + s.exit(); + } + + public Status PassingTest01() { + System.err.println("PassingTest01: Passed."); + return Status.passed("OK"); + } + + public Status PassingTest02() { + System.err.println("PassingTest02: Passed."); + return Status.passed("OK"); + } + + public Status PassingTest03() { + System.err.println("PassingTest03: Passed."); + return Status.passed("OK"); + } + + boolean test(String s1, String s2, String expectedResult) { + BigNum bn1 = new BigNum(s1); + BigNum bn2 = new BigNum(s2); + BigNum sum = bn1.add(bn2); + if (sum.toString().equals(expectedResult)) + return true; + else { + err.println("s1: " + s1 + + " s2: " + s2 + + " expected result: " + expectedResult + + " actual result: " + sum); + return false; + } + } +} + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/testsuite.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/testsuite.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/tests/testsuite.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/tests/testsuite.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + simpleTags demoTS test suite + + +

simpleTags demoTS test suite

+ This is the root file for the simpleTags demoTS test suite. +

+ Note: Although not strictly necessary, it is + convenient to link the documentation files into + a web, to simplify browsing. + +


+

The tests are divided into the following sections: + +

+
BigNum +
Tests for the com.sun.demoapi.BigNum API +
lists +
Tests for the com.sun.demoapi.lists package +
TestCasesTests +
Tests with testcases +
+ + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/testsuite.jtt jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/testsuite.jtt --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/demots/testsuite.jtt 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/demots/testsuite.jtt 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,53 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# Test Suite properties file for Demo test suite with tag-style tests + +# This file describes fixed properties of the test suite +# and should not normally need to be edited. + +# The presentation name of the test suite +name=DemoTS 1.0 Test Suite (Tag Tests) + +# The ID for the test suite +id=DemoTS_tags_1.0 + +# The jar file containing the test suite's JavaTest plug in classes +classpath=lib/jtdemots.jar + +# The test finder to use +finder=com.sun.javatest.finder.TagTestFinder + +# The test script to use +script=com.sun.javatest.lib.StdTestScript + +# The configuration interview to use +interview=com.sun.demots.DemoTSInterview + +# No keywords +keywords= diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/DemoTSInterview.java jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/DemoTSInterview.java --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/DemoTSInterview.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/DemoTSInterview.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,259 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + + +package com.sun.demots; + +import java.io.File; +import java.util.HashMap; +import java.util.Map; + +import com.sun.interview.Checklist; +import com.sun.interview.ChoiceQuestion; +import com.sun.interview.ErrorQuestion; +import com.sun.interview.FileQuestion; +import com.sun.interview.FinalQuestion; +import com.sun.interview.IntQuestion; +import com.sun.interview.NullQuestion; +import com.sun.interview.Question; +import com.sun.interview.StringQuestion; + +import com.sun.javatest.Parameters.EnvParameters; +import com.sun.javatest.TestEnvironment; +import com.sun.javatest.interview.BasicInterviewParameters; + +public class DemoTSInterview + extends BasicInterviewParameters + implements EnvParameters { + private static final String AGENT = "agent"; + private static final String OTHER_VM = "otherVM"; + private static final String LOW = "low"; + private static final String MEDIUM = "medium"; + + //---------------------------------------------------------------------- + // + // Precompile mode + private static final String HIGH = "high"; + + //---------------------------------------------------------------------- + // + // Developer mode + private static final int PRECOMPILE = 1; private Question qDeveloper = new NullQuestion(this, "developer") { + public Question getNext() { + return qName; + } + + public void export(Map data) { + data.put("script.mode", "developer"); + data.put("command.compile.java", System.getProperty("command.compile.java")); + } + }; + + //---------------------------------------------------------------------- + // + // Give a name for this configuration + private static final int CERTIFY = 2; private StringQuestion qName = new StringQuestion(this, "name") { + public Question getNext() { + if (value == null || value.length() == 0) + return null; + else + return qDesc; + } + }; + + //---------------------------------------------------------------------- + // + // Give a description for this configuration + private static final int DEVELOPER = 3; private Question qDesc = new StringQuestion(this, "desc") { + public Question getNext() { + if (value == null || value.length() == 0) + return null; + else + return qCmdType; + } + + public void export(Map data) { + data.put("description", String.valueOf(value)); + } + }; + + //---------------------------------------------------------------------- + // + // How do you with to execute tests: + // OTHER_VM: on the same system as JT Harness, in separate process + // AGENT: on a different system, using JT Harness Agent + private Question qEnvEnd = new NullQuestion(this, "envEnd") { + public Question getNext() { + return getEnvSuccessorQuestion(); + } + }; + private Question qPrecompile = new NullQuestion(this, "precompile") { + public Question getNext() { + return qEnvEnd; + } + + public void export(Map data) { + data.put("script.mode", "precompile"); + data.put("command.compile.java", System.getProperty("command.compile.java")); + } + }; + private Question qTestVerboseLevel = new ChoiceQuestion(this, "testVerboseLevel") { + { + setChoices(new String[]{null, LOW, MEDIUM, HIGH}, true); + } + + public Question getNext() { + return qEnvEnd; + } + + public void export(Map data) { + data.put("testVerboseLevel", String.valueOf(value)); + } + }; private Question qCmdType = new ChoiceQuestion(this, "cmdType") { + { + setChoices(new String[]{null, OTHER_VM, AGENT}, true); + } + + public Question getNext() { + if (value == null || value.length() == 0) + return null; + else if (value.equals(OTHER_VM)) + return qJVM; + else + return qTestVerboseLevel; + } + + public Checklist.Item[] getChecklistItems() { + if (value != AGENT) + return null; + + return new Checklist.Item[]{ + createChecklistItem("agent", "agent.needToStart"), + }; + } + + public void export(Map data) { + String cmd; + if (value != null && value.equals(OTHER_VM)) + cmd = getOtherVMExecuteCommand(); + else + cmd = "com.sun.javatest.agent.ActiveAgentCommand " + + "com.sun.javatest.lib.ExecStdTestSameJVMCmd " + + "$testExecuteClass $testExecuteArgs"; + data.put("command.execute", cmd); + } + }; + + //---------------------------------------------------------------------- + // + // What is the path for the JVM you wish to use to execute the tests? + private int mode; private FileQuestion qJVM = new FileQuestion(this, "jvm") { + public Question getNext() { + if (value == null || value.getPath().length() == 0) + return null; + else if (!(value.exists() && value.isFile() && value.canRead())) + return qBadJVM; + else + return qTestVerboseLevel; + } + }; + + public DemoTSInterview() throws Fault { + super("demoTS"); + setHelpSet("moreInfo/demots"); + setResourceBundle("i18n"); + + String m = System.getProperty("interview.mode", "certify"); + if (m.equals("certify")) + mode = CERTIFY; + else if (m.equals("developer")) + mode = DEVELOPER; + else if (m.equals("precompile")) + mode = PRECOMPILE; + } private Question qBadJVM = new ErrorQuestion(this, "badJVM") { + public Object[] getTextArgs() { + return new Object[]{qJVM.getValue().getPath()}; + } + }; + + public TestEnvironment getEnv() { + HashMap envProps = new HashMap(); + export(envProps); + try { + String name = qName.getValue(); + if (name == null || name.length() == 0) + name = "unknown"; + return new TestEnvironment(name, envProps, "configuration interview"); + } catch (TestEnvironment.Fault e) { + throw new Error("should not happen"); + } + } + + //---------------------------------------------------------------------- + // + // What is the test verbose level? + + public EnvParameters getEnvParameters() { + return this; + } + + public Question getEnvFirstQuestion() { + switch (mode) { + case PRECOMPILE: + return qPrecompile; + case DEVELOPER: + return qDeveloper; + default: + return qName; + } + } + + private String getOtherVMExecuteCommand() { + char fs = File.separatorChar; + char ps = File.pathSeparatorChar; + + StringBuffer sb = new StringBuffer(); + sb.append("com.sun.javatest.lib.ExecStdTestOtherJVMCmd "); + File jvm = qJVM.getValue(); + sb.append(jvm == null ? "unknown_jvm" : jvm.getPath()); + sb.append(" -classpath $testSuiteRootDir" + fs + "lib" + fs + "jtdemots.jar" + ps + + "$testSuiteRootDir" + fs + "lib" + fs + "demoapi.jar" + ps + + "$testSuiteRootDir" + fs + "lib" + fs + "javatest.jar "); + sb.append("$testExecuteClass $testExecuteArgs"); + return sb.toString(); + } + + + + //---------------------------------------------------------------------- + + + + //---------------------------------------------------------------------- + + +} diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/i18n.properties jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/i18n.properties --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/i18n.properties 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/i18n.properties 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,76 @@ +# +# $Id$ +# +# +# Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# This code is free software; you can redistribute it and/or modify it +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +title=Demo TS Configuration Editor + +agent=JT Harness Agent +agent.needToStart=You elected run tests using the JT Harness Agent. Make sure you have started a JT Harness Agent, in Active mode. + +DemoTSInterview.badJVM.smry=*Invalid JVM +DemoTSInterview.badJVM.text=The path you specified does not identify a valid file:\n {0} + +DemoTSInterview.cmdType.smry=How to Run Tests +DemoTSInterview.cmdType.text=Do you wish to run the tests on this computer (using a separate JVM), or to run them on another computer using a JT Harness Agent? +DemoTSInterview.cmdType.agent=Using a JT Harness Agent +DemoTSInterview.cmdType.otherVM=On this computer + +DemoTSInterview.data.smry=Test Configuration Values... +DemoTSInterview.data.text=The following questions determine the local settings of some parameters required by some of the tests. + +DemoTSInterview.desc.smry=Description +DemoTSInterview.desc.text=Please provide a short description to identify the configuration you are creating here. + +DemoTSInterview.developer.smry=Developer Mode +DemoTSInterview.developer.text=Because of the setting of the system property `DemoTSInterview.mode'', the tests will be run in "developer" mode. + +DemoTSInterview.envEnd.smry=Parameters... +DemoTSInterview.envEnd.text=The remaining questions ask about which tests in the test suite you want to run, and where you want to put the test results. + +DemoTSInterview.epilog.smry=Completed! +DemoTSInterview.epilog.text=Congratulations!\n\nThis completes the configuration interview.\n\nClick the "check" button below to save your answers and dismiss the editor. + +DemoTSInterview.jvm.smry=Java Virtual Machine +DemoTSInterview.jvm.text=Specify the path for the Java Virtual Machine you wish to use to execute the tests. + +DemoTSInterview.name.smry=Configuration Name +DemoTSInterview.name.text=Please provide a short identifier to name the configuration you are creating here. + +DemoTSInterview.precompile.smry=Precompile Mode +DemoTSInterview.precompile.text=Because of the setting of the system property `DemoTSInterview.mode'', the tests will be run in "precompile" mode. + +DemoTSInterview.prolog.smry=Welcome! +DemoTSInterview.prolog.text=Welcome to the Demo TS Configuration Editor!\n\nIn order for the JT Harness harness to execute the test suite, it requires information about how your computing environment is configured -- this editor interviews you to obtain that information.\n\nThe panel to the right contains information that should help you answer the interview questions. + +DemoTSInterview.testVerboseLevel.smry=Test Verboseness +DemoTSInterview.testVerboseLevel.text=Specify how verbose tests should be. +DemoTSInterview.testVerboseLevel.low=Low +DemoTSInterview.testVerboseLevel.medium=Medium +DemoTSInterview.testVerboseLevel.high=High + +qsw.end.hd=Almost done ... +qsw.end.needEditor=Before you can run tests, you must complete a configuration by using the Configuration Editor. You can open the Configuration Editor automatically by checking the box below. You can also open the Configuration Editor at any time from the Configure menu. diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/cmdType.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/cmdType.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/cmdType.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/cmdType.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,52 @@ + + + + + +cmdType + + + + +You can run the Demo TS two different ways: +
    +
  • On the same computer that runs the JT Harness harness (in a +separate JVM) by means of the Runtime.exec Java API +method. +
  • +
  • On another computer or device using a JT Harness Agent. The +JT Harness Agent runs tests on a separate computer and communicates +with the JT Harness harness over the network. Choose this answer if +you cannot run your tests on the same computer that runs the JT Harness +harness. +
  • +
+


+ + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/copyright.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/copyright.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/copyright.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/copyright.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,63 @@ + + + + +JT Harness Tutorial + + + +Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. +
+DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +

+This code is free software; you can redistribute it and/or modify it +under the terms of the GNU General Public License version 2 only, as +published by the Free Software Foundation. Oracle designates this +particular file as subject to the "Classpath" exception as provided +by Oracle in the LICENSE file that accompanied this code. +

+

+This code is distributed in the hope that it will be useful, but WITHOUT +ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +version 2 for more details (a copy is included in the LICENSE file that +accompanied this code). +

+

+You should have received a copy of the GNU General Public License version +2 along with this work; if not, write to the Free Software Foundation, +Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +

+

+Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +CA 95054 USA or visit www.oracle.com +if you need additional information or questions. +

+ + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/desc.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/desc.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/desc.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/desc.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,47 @@ + + + + + + + +desc + + + + +The JT Harness harness uses this short description to +provide more detail about the configuration -- for +example, in reports. This information might be useful +to an auditor looking at test run reports and could +include information such as the version number of the +product, and the name of the tester. +


+ + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/developer.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/developer.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/developer.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/developer.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,50 @@ + + + + + + + developer + + + + + Developer mode has been implicitly specified for this interview, + because the system property DemoTSInterview.mode + has been set to developer. This means that the tests + will be compiled and executed when the test suite is run. + +

To compile the tests, you must have specified an additional + system property, command.compile.java, which should + be set to a template for a JT Harness command to invoke your Java + compiler. +


+ + + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/envEnd.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/envEnd.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/envEnd.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/envEnd.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,50 @@ + + + + + + +envEnd + + + + +Test parameters are values that determine which +tests in the test suite are run, how they are run, and +where the test results are stored. This information often +changes from test run to test run. +

+Note +
+You can use this view or the Standard Values view (View > +Standard Values) to change the following values at any time. +

+


+ + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/epilog.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/epilog.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/epilog.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/epilog.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,75 @@ + + + + + + +epilog + + + + +Now that you have completed the interview, you can begin to run +tests: +
    +
  • +If you started the editor directly, you can now use: +
    + +
    +to start the test run. +
  • + +
  • +If the editor started because you originally chose: +
    + +
    +the JT Harness harness will offer to start the test run for you when you +dismiss the editor. +
  • +
+ +note +
+You can use this editor at any time to change your answers. Start +the editor by choosing: + +

+Parameter information can also be changed using the Standard Values view +of this editor: +

+ +


+ + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/jvm.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/jvm.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/jvm.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/jvm.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,49 @@ + + + + + + +jvm + + + + +This is the path of the Java runtime +system you wish to run your tests. For example: +
+
jdk_install_dir\bin\java +
jdk_install_dir\jre\java +
+

+Type the path in the text box, or click Browse to +invoke a file chooser to make your selection. +


+ + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/map.xml jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/map.xml --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/map.xml 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/map.xml 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/moreInfo.css jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/moreInfo.css --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/moreInfo.css 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/moreInfo.css 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,88 @@ +/* + * $Id$ + * + * Copyright (c) 2001, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +body {background-color: #FFFFFF; + font-size: 12pt; + font-family: SansSerif;} + +p {font-size: 12pt; + font-family: SansSerif; + font-weight: normal; + font-style: normal; + margin-top: 10; + margin-bottom: 0} + +dl {margin-left: 10; + margin-top: 10; + margin-bottom: 10} + +dl.menupath {margin-bottom: 0} + +dd.menupath {margin-left: 5} + +dd.hang {margin-left:15; + margin-bottom:10} + +dd.hang_last {margin-left:15; + margin-bottom:0} + +dd p {margin-left: 20; + margin-top: 0; + margin-bottom: 0} + +ul {margin-top: 10; + margin-bottom: 0; + margin-left: 30; + -bullet-gap: 70; + list-style-image: ../images/blueListBull.gif} + +ul li {margin-bottom: 10} + +ul li.tight {margin-bottom: 2} + +table { + border-color: Gray; + border-style: outset; + margin-top: 10; + margin-bottom: 5; + margin-left: 5; + margin-right: 5} + +table.bullet { + border-color: Gray; + border-style: outset; + margin-top: 0; + margin-bottom: 5; + margin-left: 5; + margin-right: 5} + + +p.table {margin-bottom: 0} + +td.more_space {margin-top: 15} + +center {margin-top: 10} + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/name.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/name.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/name.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/name.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,51 @@ + + + + + + +name + + + + +This is a short string that identifies this particular +configuration. Choose a name that describes the +configuration, for example: +
+demots_win32
+
+Note +
+The name must begin with a letter, followed by letters, +digits, or '_' and must not contain white-space or punctuation +characters. +


+ + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/precompile.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/precompile.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/precompile.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/precompile.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,49 @@ + + + + + + + precompile + + + + + Precompile mode has been implicitly specified for this interview, + because the system property DemoTSInterview.mode + has been set to precompile. This means that the tests + will be compiled but not executed when the test suite is run. + +

To compile the tests, you must have specified an additional + system property, command.compile.java, which should + be set to a template for a JT Harness command to invoke your Java + compiler. +


+ + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/prolog.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/prolog.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/prolog.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/prolog.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,55 @@ + + + + + + +prolog + + + + +The Demo TS Configuration Editor interviews you about the +test environment and parameters you will use to run the +tests. +

+Please keep this More Info pane open the first +few times you use the editor; it contains important +information and examples about each question. +

+You can save your answers at any time using the commands in +the editor File menu. +

+Interviews typically consist of about 15 questions. +

+To begin the interview click Next. + +


+ + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/testVerboseLevel.html jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/testVerboseLevel.html --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/testVerboseLevel.html 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/default/testVerboseLevel.html 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,74 @@ + + + + + + + dateFormat + + + + + You can control the amount of test result output the tests emit: +
 
+ + + + + + + + + + + + + + +
+ Low + + The tests emit minimal status information about failed test cases and emit no + information about test cases that pass. +
+
+ Medium + + The tests emit minimal information about all executed test cases. +
+
+ High + + The tests emit extra information about the status of all tests. This + information can be very useful when debugging failed tests. +
+
+


+ + + diff -Nru jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/demots.hs jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/demots.hs --- jtharness-6.0-b15/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/demots.hs 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/gui-tests/src/gui/testsuite_src/src/com/sun/demots/moreInfo/demots.hs 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,43 @@ + + + + + + + + + DemoTS Configuration Interview - Help + + + + + + + diff -Nru jtharness-6.0-b15/src/com/sun/javatest/agent/Agent.java jtharness-6.0-b22/src/com/sun/javatest/agent/Agent.java --- jtharness-6.0-b15/src/com/sun/javatest/agent/Agent.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/agent/Agent.java 2022-03-27 19:40:32.000000000 +0000 @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 1996, 2018, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -128,6 +128,8 @@ this.connectionFactory = connectionFactory; maxThreads = concurrency; + traceOut.println("New JT Agent: handling " + maxThreads + " concurrent request" + + (maxThreads > 1 ? "s" : "") + ", using " + connectionFactory); } /** diff -Nru jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/additionalOptions.html jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/additionalOptions.html --- jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/additionalOptions.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/additionalOptions.html 2022-03-27 19:40:32.000000000 +0000 @@ -62,19 +62,19 @@ - - - -
+ Option + Function
+ -help or -usage + Displays command-line help.

Example:

@@ -125,51 +125,53 @@ table.

- + - - - + + - - - - - - - - +
+ Interface + Option or Setting
+ Default + None (empty)
+ Command line + -map map-file
+ Applet tag + <param name=map value=map-file-url>
+ GUI Parameter pane + GUI setting that specifies an agent use a map file to translate host specific values

Set Concurrency

@@ -181,50 +183,53 @@ table.

+ - - - + + - - - - - - - - +
+ Interface + Option or Setting
+ Default + One
+ Command line + -concurrency number-of-tests
+ Applet tag + <param name=concurrency value=number-of-tests>
+ GUI Parameter pane + GUI setting that sets the maximum number of simultaneous requests handled by the agent
@@ -240,55 +245,58 @@ or option from the following table.

+ - - - + + - - - - - - - - +
+ Interface + Option or Setting
+ Default + One
+ Command line + -history number-of-items
+ Applet tag + <param name=history value=number-of-items>
+ GUI + Not supported
-

AutoStart the Agent

+
AutoStart the Agent

Th start option is only used with the application GUI class or as a parameter @@ -304,54 +312,57 @@ or option from the following table.

+ - - - - - + + + - - - - - - - +
+ Interface + Option or Setting
+
Default + False
+ Command line + -start
+ Applet tag + <param name=start value=true>
+ GUI + GUI setting that automatically starts the agent after all command line options are validated
-

Set Tracing

+
Set Tracing

The trace option sends detailed information about agent activity to the system output stream. @@ -361,51 +372,53 @@ from the following table.

- + - - - + + - - - - - - - - +
+ Interface + Option or Setting
+ Default + False
+ Command line + -trace
+ Applet tag + <param name=trace value=true>
+ GUI + Not Supported

Next task:

diff -Nru jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/historyPane.html jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/historyPane.html --- jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/historyPane.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/historyPane.html 2022-03-27 19:40:32.000000000 +0000 @@ -119,53 +119,54 @@ table describes the states that a task might have.

- + - - - + + - - - - - - - - - +
+ State + Description
-PASS: + +PASS: + Task completed successfully.
-FAIL: + +FAIL: + Task indicated that it failed.
+ ERR: + Task encountered some error before it could properly be executed.
-!RUN: + +!RUN: + Task has inappropriately indicated that it has not been run. This state must never occur.
diff -Nru jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/loadingClasses.html jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/loadingClasses.html --- jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/loadingClasses.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/loadingClasses.html 2022-03-27 19:40:32.000000000 +0000 @@ -54,41 +54,44 @@

The following table provides links to the required classes for each type of agent user interface.

+ - - - + + - - - - - - +
+ Agent User Interface + Required Classes
+ Agent GUI + See Classes Required to Use the GUI for a list of the minimum set of classes required for using the GUI to run agents.
+ Command Line + See Classes Required to Use the Command Line for a list of the minimum set of classes required for using the command line to run agents.
+ Applets + See Classes Required to Use Applets for a list of the minimum set of classes required for using applets to run agents.
diff -Nru jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/startAgent.html jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/startAgent.html --- jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/startAgent.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/startAgent.html 2022-03-27 19:40:32.000000000 +0000 @@ -42,42 +42,45 @@ and run the agent, the applet requires that you use a GUI. The following table describes the agent interface support for application and applets.

- +
+ - - - - + + - - - - - - +
+ Interface + Application + Applet
+ GUI + Supported + Supported
+ Command Line + Supported + Not Supported
diff -Nru jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/startApplets.html jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/startApplets.html --- jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/startApplets.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/startApplets.html 2022-03-27 19:40:32.000000000 +0000 @@ -93,21 +93,22 @@ The following table describes the tags used in the applet.

+ - - - - + + - - - - - - - - +
+ Tag + Description
+ code + The agent applet class installed on your test system.

Example: @@ -118,11 +119,11 @@

+ archive -The URL of the classes required to run the agent applet on your test system. The classes are either located in the javatest.jar file or in a directory containing the minimum set of classes required to run the agent applet. + +The URL of the classes required to run the agent applet on your test system. The classes are either located in the javatest.jar file or in a directory containing the minimum set of classes required to run the agent applet.

In the following example, the classes are contained in the javatest.jar file located in the same directory as the HTML page. Refer to Installing Agent Classes on a Test System for a description of how the agent applet classes can be installed.

@@ -135,10 +136,10 @@
+ width +

Sets the width of the GUI. An initial value of 600 is suggested. However, you might need to adjust the value based on your screen size and resolution.

@@ -151,10 +152,10 @@
+ height +

Sets the height of the applet. An initial value of 600 is suggested. However, you might need to adjust the value based on your screen size and resolution.

@@ -165,6 +166,7 @@

diff -Nru jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/startApplication.html jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/startApplication.html --- jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/startApplication.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/startApplication.html 2022-03-27 19:40:32.000000000 +0000 @@ -86,23 +86,25 @@

The following table describes the classpaths that are required in the command line.

+ - - - + + - - - - + +
+ Classes + Description
+ Agent + The location of the agent classes installed on your test system.

The agent classes are either located in the javatest.jar file or in the directory containing the minimum set of classes required to run the agent from the GUI. -

+

Some test suites include additional .jar files containing classes needed for an agent to run tests. These .jar files must also be included in the command string. Refer to Installing Agent Classes on a Test System for a description of how agent classes can be installed.

@@ -110,12 +112,13 @@
-Test + +Test Test classes are located in the classes directory of the test suite.

@@ -126,27 +129,29 @@

- -

Application Classes

+ +

Application Classes

An application class is required in the command line to run the agent. The following table describes the two application classes.

+ - - - + + - - - - +
+ Mode + Application Class
+ No GUI + com.sun.javatest.agent.AgentMain options

Used when the agent GUI is not wanted or not available. In this mode, all options @@ -159,10 +164,10 @@

+ With GUI + com.sun.javatest.agent.AgentFrame options

Used to start the agent GUI. In this mode, options might either be given on the @@ -172,30 +177,33 @@

- -

Agent Options

+ +

Agent Options

The following table describes the two types of options used in the command line.

+ - - - + + - - - - +
+ Type of Option + Description
+ Agent parameters + Set the parameters for the type of agent that you are using. See the following topics for additional information:
    @@ -223,16 +231,17 @@
+ Additional parameters + Display help, run the agent, or configure other agent properties.

Refer to Specifying Additional Agent Options for a description of the additional parameters that can be set.

diff -Nru jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/statisticsPane.html jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/statisticsPane.html --- jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/statisticsPane.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/statisticsPane.html 2022-03-27 19:40:32.000000000 +0000 @@ -45,58 +45,60 @@

The following table describes the contents of the statistics tabbed pane.

+ - - - - + + - - - - + - - + - - + - - + - - + +
+ Field + Description
+ currently active + Number of tests being run by the agent
passed +passed Number of tests run by the agent that had passing results
failed +failed Number of tests run by the agent that had failing results
error +error Number of tests run by the agent that had errors
not run +not run Number of tests not run by the agent and not filtered out by the JT Harness harness
exceptions +exceptions Number of tests filtered out of the test run by the JT Harness harness
diff -Nru jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/taskPane.html jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/taskPane.html --- jtharness-6.0-b15/src/com/sun/javatest/agent/help/default/agent/taskPane.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/agent/help/default/agent/taskPane.html 2022-03-27 19:40:32.000000000 +0000 @@ -48,52 +48,53 @@

The following table describes the contents of the selected task tabbed pane.

- + - - - + + - - + - - + - - + - - + - - + - +
+ Field + Description
client +client Displays the network address (host and port) of the source of the task request. The host is normally identified by its host name, but if JT Harness harness cannot determine the host name, the IP address of the host is displayed instead.
request +request Displays the tag that was supplied with the request in order to identify itself.
class +class Displays the name of the class that was specified in the request. This is the class that is loaded and run in fulfillment of the request.
args +args Displays the arguments that were specified in the request. These arguments are passed to the class that is executed.
result +result If and when the task is completed, this field contains the outcome of the task, as indicated by a JT Harness harness Status object.
diff -Nru jtharness-6.0-b15/src/com/sun/javatest/batch/RunTestsCommand.java jtharness-6.0-b22/src/com/sun/javatest/batch/RunTestsCommand.java --- jtharness-6.0-b15/src/com/sun/javatest/batch/RunTestsCommand.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/batch/RunTestsCommand.java 2022-03-27 19:40:32.000000000 +0000 @@ -48,7 +48,8 @@ import java.util.HashMap; import java.util.ListIterator; import java.util.Map; -import java.util.TreeMap; + +import static com.sun.javatest.util.FormattingUtils.*; class RunTestsCommand extends Command { private static final String DATE_OPTION = "date"; @@ -166,42 +167,6 @@ } } - /** - * Converts the given duration in seconds to a more readable string representation: - * for example "2 days 1 minute 4 seconds". - * This method doesn't generates weeks, months or years, only days - * which is expected to be sufficient for printing total time taken by even a long test run. - * - * @param durationSeconds the seconds to convert to human-readable form - * @return formatted representation, i.e. "1 hour 53 seconds" - */ - public static String formattedDuration(long durationSeconds) { - - if (durationSeconds < 1) { - return "0 seconds"; - } - String result = ""; - long remaining_seconds = durationSeconds; - // have to map duration to names to have durations sorted (TreeMap maintains order for keys) - TreeMap units = new TreeMap(Comparator.reverseOrder()) {{ - put(1L, "second"); - put(60L, "minute"); - put(60L * 60L, "hour"); - put(60L * 60L * 24L, "day"); - }}; - for (Map.Entry entry : units.entrySet()) { - long amount = remaining_seconds / entry.getKey(); - if (amount > 0 ) { - remaining_seconds = remaining_seconds % entry.getKey(); - result += " " + amount + " " + entry.getValue(); - if (amount > 1) { - result += "s"; - } - } - } - return result.trim(); - } - private void showResultStats(int skipped, int... stats) { int passed = stats[Status.PASSED]; diff -Nru jtharness-6.0-b15/src/com/sun/javatest/cof/COFEnvironment.java jtharness-6.0-b22/src/com/sun/javatest/cof/COFEnvironment.java --- jtharness-6.0-b15/src/com/sun/javatest/cof/COFEnvironment.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/cof/COFEnvironment.java 2022-03-27 19:40:32.000000000 +0000 @@ -116,9 +116,9 @@ setTimezone(data.get("environment.timezone", TimeZone.getDefault() .getID())); setBits(data.get("environment.bits", null) == null ? null - : new Integer(data.get("environment.bits"))); + : Integer.valueOf(data.get("environment.bits"))); setDisplaydepth(data.get("environment.displaydepth", null) == null ? null - : new Integer(data.get("environment.displaydepth"))); + : Integer.valueOf(data.get("environment.displaydepth"))); setDescription(data.get("environment.description")); } diff -Nru jtharness-6.0-b15/src/com/sun/javatest/cof/ID.java jtharness-6.0-b22/src/com/sun/javatest/cof/ID.java --- jtharness-6.0-b15/src/com/sun/javatest/cof/ID.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/cof/ID.java 2022-03-27 19:40:32.000000000 +0000 @@ -50,7 +50,7 @@ ID create(String base) { Integer last = map.get(base); int index = (last == null ? 0 : last.intValue() + 1); - map.put(base, new Integer(index)); + map.put(base, Integer.valueOf(index)); return new ID(base, index); } } diff -Nru jtharness-6.0-b15/src/com/sun/javatest/ExcludeListUpdateHandler.java jtharness-6.0-b22/src/com/sun/javatest/ExcludeListUpdateHandler.java --- jtharness-6.0-b15/src/com/sun/javatest/ExcludeListUpdateHandler.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/ExcludeListUpdateHandler.java 2022-03-27 19:40:32.000000000 +0000 @@ -35,15 +35,16 @@ import java.io.OutputStream; import java.net.URL; import java.net.URLConnection; +import java.util.OptionalLong; /** * A class to handle downloading exclude lists from a server. */ public class ExcludeListUpdateHandler { private File localFile; - private long localFileLastModified; + private OptionalLong localFileLastModified = OptionalLong.empty(); private URL remoteURL; - private long remoteURLLastModified; + private OptionalLong remoteURLLastModified = OptionalLong.empty(); /** * Create a handler for downloading exclude lists from a server. @@ -78,10 +79,10 @@ * a problem determining the required information */ public long getLocalFileLastModified() { - if (localFileLastModified == 0) { - localFileLastModified = localFile.lastModified(); + if (!localFileLastModified.isPresent()) { + localFileLastModified = OptionalLong.of(localFile.lastModified()); } - return localFileLastModified; + return localFileLastModified.getAsLong(); } /** @@ -102,13 +103,13 @@ * @throws IOException if there is a problem determining the information. */ public long getRemoteURLLastModified() throws IOException { - if (remoteURLLastModified == 0) { + if (!remoteURLLastModified.isPresent()) { URLConnection c = remoteURL.openConnection(); c.connect(); - remoteURLLastModified = c.getLastModified(); + remoteURLLastModified = OptionalLong.of(c.getLastModified()); c.getInputStream().close(); } - return remoteURLLastModified; + return remoteURLLastModified.getAsLong(); } /** @@ -124,7 +125,7 @@ public boolean isUpdateAvailable() throws IOException { getLocalFileLastModified(); getRemoteURLLastModified(); - return remoteURLLastModified > localFileLastModified; + return remoteURLLastModified.getAsLong() > localFileLastModified.getAsLong(); } /** @@ -146,7 +147,8 @@ URLConnection c = remoteURL.openConnection(); c.getContentLength(); c.connect(); - remoteURLLastModified = c.getLastModified(); + long remoteURLLastModified = c.getLastModified(); + this.remoteURLLastModified = OptionalLong.of(remoteURLLastModified); if (remoteURLLastModified > getLocalFileLastModified()) { update(c); } else { diff -Nru jtharness-6.0-b15/src/com/sun/javatest/exec/i18n.properties jtharness-6.0-b22/src/com/sun/javatest/exec/i18n.properties --- jtharness-6.0-b15/src/com/sun/javatest/exec/i18n.properties 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/exec/i18n.properties 2022-03-27 19:40:32.000000000 +0000 @@ -1103,6 +1103,11 @@ np.home.act=Home np.home.icon=images/Home16.gif np.home.mne=U +np.browse.act=Browse +np.browse.icon=images/UpDir.gif +np.browse.mne=W +np.browse.tip=Launch default web browser or other application to display file +np.browse.err=Cannot launch default web browser or other application to display {0}\n\nYou might need to register an application for handling files of this type. np.home.tip=Go to the initial file np.back.act=Back np.back.icon=images/Back16.gif diff -Nru jtharness-6.0-b15/src/com/sun/javatest/exec/MultiFormatPane.java jtharness-6.0-b22/src/com/sun/javatest/exec/MultiFormatPane.java --- jtharness-6.0-b15/src/com/sun/javatest/exec/MultiFormatPane.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/exec/MultiFormatPane.java 2022-03-27 19:40:32.000000000 +0000 @@ -28,6 +28,7 @@ import com.sun.javatest.report.HTMLWriterEx; import com.sun.javatest.tool.UIFactory; +import com.sun.javatest.util.Log; import javax.imageio.ImageIO; import javax.imageio.ImageReader; @@ -637,10 +638,30 @@ public static String getMIMEType(URL url) { String filename = url.getFile(); - String ext = filename.substring(filename.lastIndexOf('.') + 1); - ext = ext.toLowerCase(); + String extLowerCase = filename.substring(filename.lastIndexOf('.') + 1).toLowerCase(); + // setting content type by default as extension in lower case + String type = extLowerCase; + + // Performing a special treatment of files that have .html/.htm extension + // yet contain XML contents inside, which is transformed to HTML + // with JavaScript on-the-fly in external web browser. + // In JavaTest we have to display such html files as XML files (in plain text), + // not trying to render them as HTML with Swing component. + if (extLowerCase.startsWith("htm")) { + // reading contents and checking first line + try (BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()))) { + String firstLine = reader.readLine(); + if (firstLine != null && firstLine.toLowerCase().startsWith(" - + - + + - + a non-editable field. - + field. - + If a new exclude list is available, you can choose to download it. - + of the exclude list for updates. - + for updates before each test run. - + for an update. +
Text and Controls @@ -118,54 +118,56 @@ Description
+ Location Displays the location of the exclude list specified by the test suite. This is - a non-editable field.
+ Last updated Displays the date that the exclude list was last updated. This is a non-editable - field.
+ Check For Updates Automatically Causes the harness to automatically check the location of the exclude list and compare the date-time stamps of the remote and local exclude lists. The harness then displays a dialog box advising you of the results. - If a new exclude list is available, you can choose to download it.
+ Every _ Days Sets an interval for the harness to automatically check the remote location - of the exclude list for updates.
+ Every Test Run Causes the harness to check the remote location of the exclude list - for updates before each test run.
+ Check Now Causes the harness to check the remote location of the exclude list - for an update.
@@ -175,7 +177,7 @@ exclude list option.

- + - - + + - - - - +
Button @@ -183,10 +185,10 @@ Description
+ Add Selects an exclude list file for your test suite. As you make selections with @@ -195,14 +197,14 @@
+ Remove Clears an item from the list. Select an item in the list and click Remove.
+ Move Up Moves an item one position higher in the list. Select an item in the list and @@ -210,12 +212,13 @@
+ Move Down Moves an item one position lower in the list. Select an item in the list and click Move Down.
@@ -226,4 +229,3 @@

Copyright © 2006, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/admin/keywordsTabTE.html jtharness-6.0-b22/src/com/sun/javatest/help/default/admin/keywordsTabTE.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/admin/keywordsTabTE.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/admin/keywordsTabTE.html 2022-03-27 19:40:32.000000000 +0000 @@ -85,15 +85,17 @@ that can be constructed.

+ - + + - + - + - + +
Expression Description
Any OfAny Of Runs all tests in the test suite having any of the keywords entered in the text field. @@ -113,7 +115,7 @@
All OfAll Of Runs all tests in the test suite having all of the keywords entered in the text field.

@@ -127,7 +129,7 @@

ExpressionExpression Runs all tests in the test suite having the expression entered in the text field. @@ -155,6 +157,7 @@
@@ -162,15 +165,16 @@

Logical operators are only available when Expression is selected in the list of expressions. The following table provides descriptions and examples of logical operators that can be used to build keyword expressions. The precedence column indicates the order in which the expression is resolved. Expressions in parentheses are evaluated first, with nested parentheses being evaluated from the innermost parentheses outward.

+ - + - + + - + - + - + - + - - - - +
Logical Operator Precedence -DescriptionDescription
( ) group 1( ) group 1

Used to create groups of expressions.

Example:
A test suite uses the keyword interactive to identify tests that require human interaction and color to identify tests that require @@ -180,7 +184,7 @@

! not 2! not 2

Logical not. Used to exclude tests containing the expression.

Example:
A test suite uses the keyword interactive to identify tests that require human interaction and color to identify tests @@ -191,7 +195,7 @@

& and 3& and 3

Logical and. Used to combine expressions.

Example:
A test suite uses the keyword interactive to identify tests that @@ -202,7 +206,7 @@

| or 4| or 4

Logical or. Used to specify either of two expressions. Example:
A test suite uses the keyword interactive to identify tests that require human interaction and color to identify tests that require @@ -210,10 +214,7 @@

interactive|color

The harness will only choose tests that include either keyword.

@@ -223,4 +224,3 @@

Copyright © 2006, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/admin/questionModeTE.html jtharness-6.0-b22/src/com/sun/javatest/help/default/admin/questionModeTE.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/admin/questionModeTE.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/admin/questionModeTE.html 2022-03-27 19:40:32.000000000 +0000 @@ -83,15 +83,16 @@ The File menu contains items to open, save, and restore template files. The following table describes the items in the File menu.

- + + Description - + + - + - + - + - + - + - - + - + - - + +
Menu Item - Description
SaveSave Saves the current template.

Choose File > Save at any time to save your answers and position in the template. If the template is new, the editor opens @@ -102,7 +103,7 @@

Save AsSave As Opens a dialog box that you can use to save a template with a new name or change the location of the template. If you do not provide the .jtm extension @@ -111,27 +112,27 @@
RevertRevert Discards any changes to the current template and restores the last saved version of the template.
New ConfigurationNew Configuration Clears the current configuration and starts a new configuration. See Creating a Configuration for a detailed description.
Load Configuration Load Configuration Opens an existing configuration file and makes it the current configuration. See Loading a Configuration for a detailed description.
+ Load Recent Configuration Displays a list of configuration files that have been opened in the Configuration @@ -140,7 +141,7 @@
New Template New Template Provides the option to save or clear the current template before starting a new template. See Creating @@ -148,7 +149,7 @@
Load Template Load Template Opens an existing template. See Loading a Template for a detailed @@ -156,7 +157,7 @@
+ Load Recent Template Displays a list of templates that have been opened in the Template @@ -165,10 +166,11 @@
CloseClose Closes the Template Editor.
@@ -182,42 +184,43 @@

The following table describes the items in the Bookmarks menu.

- + - + + - + - + - + - + - + - + - + - + +
Menu Item Description
Enable BookmarksEnable Bookmarks Enables or disables bookmarking in the template. When bookmarking is disabled, the remaining bookmark menu items are grayed out.
Show Only Bookmarked QuestionsShow Only Bookmarked Questions Displays only the bookmarked questions.
Mark Current QuestionMark Current Question Sets the bookmark for a question selected in the index pane.
Unmark Current QuestionUnmark Current Question Clears the bookmark from a question selected in the index pane. Enabled only if the selected question is bookmarked.
Clear Answer For Current QuestionClear Answer For Current Question Clears the answer for a selected question in the index pane.Enabled only if the selected question is @@ -225,25 +228,26 @@
Open GroupOpen Group Expands a selected set of questions in the index pane.
Clear Answers to Bookmarked QuestionsClear Answers to Bookmarked Questions Clears the values in all bookmarked questions.
Remove BookmarksRemove Bookmarks Removes all bookmarks from the Template.
@@ -259,16 +263,17 @@

The following table describes the items in the Search menu.

- + - + + - + - + +
Menu Item Description
FindFind Opens a dialog box used to search the template for a specific character or value string. @@ -276,12 +281,13 @@
Find NextFind Next Searches the template for the next occurrence of a specific character or value string.
@@ -296,49 +302,51 @@ table describes the items in the View menu.

- + - + + - + - + - + - - + + - + +
Menu Item Description
Question ModeQuestion Mode Displays the Template Editor in Question Mode.
Quick Set ModeQuick Set Mode Displays the Template Editor in Quick Set Mode.
More InfoMore Info Displays and hides the More Info pane in the Template Editor.
Question Tag - Displays and hides the Question Tag field in the Template Editor Question - pane. - Question Tag + Displays and hides the Question Tag field in the Template Editor Question + pane. +
RefreshRefresh Updates the values and questions displayed in the Template Editor.
@@ -349,23 +357,24 @@ - + - - - + + + + - + @@ -373,18 +382,19 @@ - + - + +
Menu Item Description
Configuration Editor
Configuration Editor Displays online help for the Configuration Editor.
Template EditorTemplate Editor Displays online help for the Template Editor.
Question ModeQuestion Mode Displays online documentation for the Question Mode.
Quick Set ModeQuick Set Mode Displays online documentation for the Quick Set Mode.
@@ -473,4 +483,3 @@

Copyright © 2006, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/admin/searchTemplateTE.html jtharness-6.0-b22/src/com/sun/javatest/help/default/admin/searchTemplateTE.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/admin/searchTemplateTE.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/admin/searchTemplateTE.html 2022-03-27 19:40:32.000000000 +0000 @@ -55,6 +55,7 @@

The following table describes the search criteria used in the Find Question dialog box.

+ - + + - - - + - - + - +
Item @@ -63,9 +64,10 @@ Description
+ String @@ -74,7 +76,7 @@
+ Where @@ -97,18 +99,18 @@
Options: Consider case Options: Consider case
Specifies that the search pattern match the case of the characters in the Find text field.
Options: Whole words
+
Options: Whole words
Specifies that the search pattern only match whole words from the Find text field.

@@ -131,5 +133,3 @@

Copyright © 2006, 2010, Oracle and/or its affiliates. All rights reserved.

- - diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/browse/summaryTab.html jtharness-6.0-b22/src/com/sun/javatest/help/default/browse/summaryTab.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/browse/summaryTab.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/browse/summaryTab.html 2022-03-27 19:40:32.000000000 +0000 @@ -51,7 +51,7 @@ Summary table and pie chart can display.

- + + + - - - - - - - +
Field @@ -60,8 +60,10 @@ Description
+ Passed @@ -73,7 +75,7 @@
+ Failed @@ -84,7 +86,7 @@
+ Error @@ -95,7 +97,7 @@
+ Not Run @@ -106,7 +108,7 @@
+ Sub-Total @@ -116,7 +118,7 @@
+ Filtered Out @@ -129,7 +131,7 @@
+ Total @@ -137,6 +139,7 @@ Total number of tests in a folder and its subordinate folders.

@@ -178,5 +181,3 @@

Copyright © 2001, 2010, Oracle and/or its affiliates. All rights reserved.

- - diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/browse/testInfo.html jtharness-6.0-b22/src/com/sun/javatest/help/default/browse/testInfo.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/browse/testInfo.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/browse/testInfo.html 2022-03-27 19:40:32.000000000 +0000 @@ -62,6 +62,7 @@ is visible in all of the test view panes.

+ - + + - - - - - - +
Tab @@ -70,9 +71,10 @@ Description
+ Test Description Pane @@ -80,14 +82,14 @@ are input data and always available.
+ Documentation Pane Displays test documentation, if it exists.
+ Files Pane @@ -97,8 +99,8 @@
-Configuration Pane + +Configuration Pane Displays a table of configuration name-value pairs used to run a specific test. @@ -106,7 +108,7 @@
+ Test Run Details Pane @@ -115,7 +117,7 @@
+ Test Run Messages Pane @@ -123,6 +125,7 @@ a name to display its contents. The contents are output data and only enabled if the test was run.

@@ -132,4 +135,3 @@


Copyright © 2001, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/command/commandHelp.html jtharness-6.0-b22/src/com/sun/javatest/help/default/command/commandHelp.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/command/commandHelp.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/command/commandHelp.html 2022-03-27 19:40:32.000000000 +0000 @@ -56,60 +56,63 @@

See About the Command-Line Examples for a description of the use of > harness.

The following table lists the available command-line help topics.

- + + + - - - - - - - - +
Topic Function
Desktop + Desktop Displays information about the command-line options for starting the harness graphical user interface.
harness Agent + harness Agent Displays information about the command-line options for the harness Agent.
Batch Mode + Batch Mode Displays information about the command-line options for running tests in batch mode.
Configuration + Configuration Displays information about the command-line options for setting up and changing a configuration.
Environment + Environment Displays information about the command-line options for adding values into harness environments.
HTTP server + HTTP server Displays information about the command-line options for the harness HTTP server.
Options + Options Displays information about the command-line options accepted on the command line.
Files + Files Displays information about the types of files accepted as command-line arguments.

Display the List of Available Topics

To display the list of help topics provided by command-line help, include -help, -usage, diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/command/configValues.html jtharness-6.0-b22/src/com/sun/javatest/help/default/command/configValues.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/command/configValues.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/command/configValues.html 2022-03-27 19:40:32.000000000 +0000 @@ -37,66 +37,69 @@

The following table identifies and describes the types of questions supported by the harness configuration interview. as well as provides a description of the format required to set the value in the command line.

- + + - + + + - - - + - - - + - - - + - - - - - - - + - +
Question Type Description
Choice Question + Choice Question + This question is used to get a selection from a finite list of possible values. For example, in the question "Which protocol would you use," where - the only possible responses are TCP or UDP. These questions are usually displayed in the Configuration Editor and the Template Editor as radio buttons + the only possible responses are TCP or UDP. These questions are usually displayed in the Configuration Editor and the Template Editor as radio buttons where you can only select one button at a time.

The following is an example of the format used to set this configuration value in a command line:
set My-testsuite.cipher 3DES

The value supplied is case sensitive. This type of question appears in the Configuration Editor as a set of radio buttons or single-selection list of choices.

File Question + File Question - This question is used to represent a file path. It may be absolute or relative, - depending on the context of the question. See the question's More Info for information about - the requirements. The value used is generally a platform specific path. The question may + This question is used to represent a file path. It may be absolute or relative, + depending on the context of the question. See the question's More Info for information about + the requirements. The value used is generally a platform specific path. The question may or may not check to see that the value is valid before it is accepted.

The following are examples of the format used to set this configuration value in a command line:
- + set My-testsuite.myfile c:\foo\bar.txt

-

set My-testsuite.myfile /tmp/bar.txt

+

set My-testsuite.myfile /tmp/bar.txt

File List Question +
File List Question If none of the file names have embedded spaces, you can use a space-separated list of file names. + If none of the file names have embedded spaces, you can use a space-separated list of file names. If any of the file names in the list have embedded spaces, use a newline character to terminate or separate all of the filenames.
Floating Point Question + Floating Point Question - This question is primarily used to enter fractional numbers, but can also - accept whole numbers. It might be used to collect values such as a timeout factor in seconds, - where a value similar to 1.5 might be entered. It usually appears as a type-in field in both the Configuration Editor and the Template Editor. - The question might be set to reject values outside a - specified range. See the More Info in the Configuration editor or the Template Editor for guidelines regarding + This question is primarily used to enter fractional numbers, but can also + accept whole numbers. It might be used to collect values such as a timeout factor in seconds, + where a value similar to 1.5 might be entered. It usually appears as a type-in field in both the Configuration Editor and the Template Editor. + The question might be set to reject values outside a + specified range. See the More Info in the Configuration editor or the Template Editor for guidelines regarding the values required for a specific question.

The following is an example of the format used to set this configuration value in a command line:
set My-testsuite.delay 5.0

The value is evaluated using the current locale (for example, in European locales, enter 5,0).

Integer Question + Integer Question - These questions are commonly used to get port numbers or to specify the number of times to do an action. The answers are always restricted to whole numbers and might have further restrictions that - prevent you from using certain ranges of numbers (such as negative numbers). You might also be restricted to using only a particular set + These questions are commonly used to get port numbers or to specify the number of times to do an action. The answers are always restricted to whole numbers and might have further restrictions that + prevent you from using certain ranges of numbers (such as negative numbers). You might also be restricted to using only a particular set of pre-determined numbers. In the Configuration Editor and in the Template Editor, these usually appear as plain type-in fields or may be a field which has up and down (spinner) controls to select the number.

The following is an example of the format used to set this configuration value in a command line:
@@ -105,59 +108,59 @@

IPAddress Question + IPAddress Question The standard textual representation of the IP Address, as defined by Internet Engineering Task Force (IETF).

A typical IPv4 address string would be "192.168.1.1".

Multi Choice Question + Multi Choice Question - This question is used when a selection of choices from a finite set of possible values is required from the user. In the + This question is used when a selection of choices from a finite set of possible values is required from the user. In the Configuration Editor and Template Editor, this question type resembles the Choice question in that it has a list of choices with checkboxes. The difference between them is that in a Multi Choice question, you can select more than one checkbox. - -

The values that you use in the set command must be separated by whitespace (newline, space - or tab) and must be the absolute new settings for the question. The values that you use are - absolute settings and cannot be based on the default or previous value. You must enter - the full list of values that you want to turn on (corresponding to the items checked in the + +

The values that you use in the set command must be separated by whitespace (newline, space + or tab) and must be the absolute new settings for the question. The values that you use are + absolute settings and cannot be based on the default or previous value. You must enter + the full list of values that you want to turn on (corresponding to the items checked in the Configuration Editor or Template Editor representation).

Property Question + Property Question - This question enables you to change a grouped set of property values for a test suite. In the - Configuration Editor and Template Editor, this question type enables the user to view multiple property settings and to change read-write values. The user + This question enables you to change a grouped set of property values for a test suite. In the + Configuration Editor and Template Editor, this question type enables the user to view multiple property settings and to change read-write values. The user can also copy both key and values to the clipboard. Value types supported by this question include integer, float, yes-no, file, and string. In the Configuration Editor and Template Editor, the question can provide suggestions to users for the integer, float, file, and string value types that it contains.

The following are examples of the format used to set this configuration value in a command line:
set question-key property-name:new-value

- +

set question-key=property-name:new-value

- Each set statement for a Property Question value must contain the question key, the property name, and a new value. The use of an equals sign or a space + Each set statement for a Property Question value must contain the question key, the property name, and a new value. The use of an equals sign or a space is determined by the tool and the type of value that you are changing. You cannot change multiple values within a single set statement.

String Question + String Question This question contains a generic field that enables you to enter a value. While this is much less restrictive than the integer or the file question, there might be some restrictions on the values that you can enter. In the most restrictive cases, you can only use values that - are predefined. The More Info displayed in the Configuration Editor and the Template Editor might indicate what constitutes a legal value - in this field. View the More Info for detailed information about the values that you can enter in this field. + are predefined. The More Info displayed in the Configuration Editor and the Template Editor might indicate what constitutes a legal value + in this field. View the More Info for detailed information about the values that you can enter in this field.

The following is an example of the format used to set this configuration value in a command line:
set My-testsuite.url http://machine/item

String List Question + String List Question This question is used when multiple discrete string values are required from the user. @@ -165,9 +168,9 @@ list. The list of strings provided in the set command become the new absolute answer to the question, not appended values. See Using Newlines Inside Strings.
YesNo Question + YesNo Question This question is used when either a positive or a negative response is needed from the user. @@ -178,6 +181,7 @@ The values are case sensitive and a lower-case value of yes or no is not acceptable.

diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/command/creatingCommandFile.html jtharness-6.0-b22/src/com/sun/javatest/help/default/command/creatingCommandFile.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/command/creatingCommandFile.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/command/creatingCommandFile.html 2022-03-27 19:40:32.000000000 +0000 @@ -39,14 +39,17 @@ and their arguments. The following table describes the contents of a command file.

+ + + - - - +
File Contents Description
Comments + Comments Comments can begin anywhere on a line, are started by the pound symbol ( #), and stop at the end of the line.

Example:
@@ -54,7 +57,7 @@

Commands + Commands Commands are executed in the sequence that they appear in the file (for example, setup commands must precede task commands). Commands used in the file must be separated by a semicolon (;) or a new line symbol (#). The # symbol acts as a new line character and can terminate a command.

Examples:
@@ -63,11 +66,12 @@

Command Arguments + Command Arguments Arguments that contain white space must be placed inside quotes. Use a backslash (\) to escape special characters such as quotes (" ") and backslashes (\).

After writing the commands, use a descriptive name and the extension .jtb to save the text file. Choose a file name that helps you identify the function of each command file.

diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/command/editConfig.html jtharness-6.0-b22/src/com/sun/javatest/help/default/command/editConfig.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/command/editConfig.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/command/editConfig.html 2022-03-27 19:40:32.000000000 +0000 @@ -124,20 +124,22 @@
The following table describes the return codes generated when a program exits. - + + + - - - - +
Code Description
0 + 0 The operations were successful. the configuration file is complete and ready to use.
1 + 1 The operations were successful, but the configuration file is incomplete and is not yet ready to use @@ -145,17 +147,18 @@
2 + 2 A problem exists with the command-line arguments.
3 + 3 An error occurred while trying to perform the copy.
SYSTEM PROPERTIES
Two system properties are recognized. diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/command/harnessSettings.html jtharness-6.0-b22/src/com/sun/javatest/help/default/command/harnessSettings.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/command/harnessSettings.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/command/harnessSettings.html 2022-03-27 19:40:32.000000000 +0000 @@ -48,14 +48,17 @@

The following table describes the commands used in the command line to specify how the harness starts.

+ + + - @@ -63,7 +66,7 @@ - @@ -72,7 +75,7 @@ -Ename=value command tunnels in values from the external shell. The method used in previous versions of the harness to tunnel in values from the external shell is now deprecated.

- @@ -81,7 +84,7 @@ - @@ -90,7 +93,7 @@ - @@ -98,6 +101,8 @@

If you use an active agent and run the harness from the command line, you must add -startAgentPoolto the command string to start the agent pool.

+ +
Command Function
+ -EsysProps
+ -Ename=value
+ -agentPoolPort port
+ -agentPoolTimeout #seconds
+ -startAgentPool

diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/command/moveReports.html jtharness-6.0-b22/src/com/sun/javatest/help/default/command/moveReports.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/command/moveReports.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/command/moveReports.html 2022-03-27 19:40:32.000000000 +0000 @@ -80,36 +80,39 @@
The following table describes the return codes that the program displays when it exits. - + + + - - - - +
Code Description
0 + 0 The copy was successful.
1 + 1 A problem exists with the command-line arguments.
2 + 2 A problem exists with the command-line arguments.
3 + 3 An error occurred while performing the copy.

Detailed Example of EditLinks Command

diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/command/troubleshooting.html jtharness-6.0-b22/src/com/sun/javatest/help/default/command/troubleshooting.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/command/troubleshooting.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/command/troubleshooting.html 2022-03-27 19:40:32.000000000 +0000 @@ -56,31 +56,34 @@ description of the exit codes.

- + + + - + - + - + - + - + +
Exit Code Description
00 If tests were executed, all tests had passed results.
11 One or more tests were executed and had failed results.
22 One or more tests were executed and had errors.
33 A problem exists with the command-line arguments.
44 Harness internal error exists.
diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/command/verbose.html jtharness-6.0-b22/src/com/sun/javatest/help/default/command/verbose.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/command/verbose.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/command/verbose.html 2022-03-27 19:40:32.000000000 +0000 @@ -50,14 +50,16 @@

The following table describes monitoring options specified in the command line.

- + + + - @@ -67,18 +69,18 @@ line of output prints the month, day, hour, minute and second. - + - + - + - + - - + +
Option Description
commandsTraces the individual harness commands as they are executed. If this option is used, it should be set first in the command line. + Traces the individual harness commands as they are executed. If this option is used, it should be set first in the command line. Traced harness commands include options given on the command line, commands given in command strings, and commands given in command files.
non-passnon-pass Prints non-passing (error, fail) test names and their status string. The status string includes the status (error, fail) and the reason for the failure or error.
max max Outputs the maximum possible amount of output. This includes all the options which are individually available. If this option is present, only the no-date and quiet flags have any additional effect.
quiet quiet Suppresses any output from the verbose system. It might be useful to temporarily deactivate monitoring while debugging, without removing other levels coded into a script. -verbose:stop,progress,quiet results in no @@ -87,25 +89,26 @@ fail, and error statistics printed at the end of the test run.
start start Prints the test name when it goes into the harness' engine for execution. Note: On some test suites, this might only indicate that the test has been handed to the plug-in framework, not that it is actually executing.
stop + stop Prints the test name and status string (see non-pass) when a test result is received by the harness.
progress progress Prints a progress summary, which indicates pass, fail, error, and not-run numbers. If any of the max, non-pass, stop, or stop options were specified, each summary migh be printed on its own line. If not, the summary will be updated on the current line. The progress information is printed/updated each time a test result is reported to the harness.
@@ -230,4 +233,3 @@

Copyright © 2004, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/command/writeReports.html jtharness-6.0-b22/src/com/sun/javatest/help/default/command/writeReports.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/command/writeReports.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/command/writeReports.html 2022-03-27 19:40:32.000000000 +0000 @@ -48,13 +48,17 @@

Include the -type option and a report-type argument in the command line to specify the format of the generated report. There is a direct relationship between the names of the directories in the report directories and the report type names used in the command, as shown in the following table:

+ - - - - + + + + + + +
Report Type
HTML Reporthtml
Plain Text Reporttxt
XML Reportxml
COF Reportcof
HTML Reporthtml
Plain Text Reporttxt
XML Reportxml
COF Reportcof

When the -type option is not used, the harness uses the default report types last used in the GUI, or html and txt if a type was not previously set in the GUI.

@@ -108,4 +112,3 @@

Copyright © 2002, 2015, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/confEdit/excludeList.html jtharness-6.0-b22/src/com/sun/javatest/help/default/confEdit/excludeList.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/confEdit/excludeList.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/confEdit/excludeList.html 2022-03-27 19:40:32.000000000 +0000 @@ -118,7 +118,7 @@ and controls displayed when you choose the Latest exclude list option.

- + - + + - - + field. - + If a new exclude list is available, you can choose to download it. - + of the exclude list for updates. - + for updates before each test run. - +Causes the harness to check the remote location of the exclude list for an update. +
Text and Controls @@ -127,9 +127,10 @@ Description
+ Location: @@ -137,46 +138,46 @@ a non-editable field.
+ Last updated: Displays the date that the exclude list was last updated. This is a non-editable - field.
+ Check For Updates Automatically Causes the harness to automatically check the location of the exclude list and compare the date-time stamps of the remote and local exclude lists. The harness then displays a dialog box advising you of the results. - If a new exclude list is available, you can choose to download it.
+ Every _ Days Sets an interval for the harness to automatically check the remote location - of the exclude list for updates.
+ Every Test Run Causes the harness to check the remote location of the exclude list - for updates before each test run.
+ Check Now -Causes the harness to check the remote location of the exclude list - for an update.
@@ -186,7 +187,7 @@ exclude list option.

- + - + + - - - - +
Button @@ -195,9 +196,10 @@ Description
+ Add Selects an exclude list file for your test suite. As you make selections with @@ -206,14 +208,14 @@
+ Remove Clears an item from the list. Select an item in the list and click Remove.
+ Move Up Moves an item one position higher in the list. Select an item in the list and @@ -221,16 +223,16 @@
+ Move Down Moves an item one position lower in the list. Select an item in the list and click Move Down.

Copyright © 2001, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/confEdit/fullViewDialog.html jtharness-6.0-b22/src/com/sun/javatest/help/default/confEdit/fullViewDialog.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/confEdit/fullViewDialog.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/confEdit/fullViewDialog.html 2022-03-27 19:40:32.000000000 +0000 @@ -81,16 +81,17 @@ The File menu contains items to open, save, and restore configuration files. The following table describes the items in the Configuration Editor File menu.

- + - + + - + - + - + - + - + - + - + - + - + - + +
Menu Item Description
SaveSave Saves the current configuration.

@@ -102,38 +103,38 @@

Save AsSave As Opens a dialog box that you can use to save a configuration with a new name. The Configuration Editor makes the saved configuration the current configuration. If you do not provide the .jti extension when you name the configuration file, the editor adds the extension when it saves the file.
RevertRevert Discards any changes to the current configuration and restores the last saved version of configuration file.
New ConfigurationNew Configuration Clears the current configuration and starts a new configuration. See Creating a Configuration for a detailed description.
Load Configuration Load Configuration Opens an existing configuration file and makes it the current configuration. See Loading a Configuration for a detailed description.
Load Recent Configuration Load Recent Configuration Displays a list of configuration files that have been opened in the Configuration Editor window. Choose a configuration file from the list to open it in the Configuration Editor window.
New Template New Template Provides the option to save or clear the current template before starting a new template. See Creating @@ -141,7 +142,7 @@
Load Template Load Template Opens an existing template. See Loading a Template for a detailed @@ -149,17 +150,18 @@
Load Recent Template Load Recent Template Displays a list of templates that have been opened in the Template Editor. Choose a template from the list to open it in the Template Editor.
CloseClose Closes the Configuration Editor window.
@@ -168,69 +170,71 @@ The Bookmarks menu contains items to use bookmarks in the configuration. The following table describes the items in the Bookmarks menu.

- + - + + - + - + - + - + - + - + - + - + +
Menu Item Description
Enable BookmarksEnable Bookmarks Enables and disables bookmarking in the configuration.
Show Only Bookmarked QuestionsShow Only Bookmarked Questions Display only the marked questions or all questions.
Mark Current QuestionMark Current Question Clears the bookmark from a selected question in the Configuration Editor window.
Unmark Current QuestionUnmark Current Question Bookmarks the selected question in the Configuration Editor window. Enabled only if the selected question is not bookmarked.
Clear Answer For Current QuestionClear Answer For Current Question Clears the answer for a selected question in the Configuration Editor window. Enabled only if the selected question is bookmarked.
Open GroupOpen Group Expands a selected set of questions in the Configuration Editor window.
Clear Answers to Bookmarked QuestionsClear Answers to Bookmarked Questions Clear the values in all marked questions.
Remove BookmarksRemove Bookmarks Remove all bookmarks from the configuration.

@@ -243,28 +247,29 @@ Use the Search menu items to find the occurrence in a configuration of a specific character or value string. When troubleshooting a test run, you can use the Search menu to quickly locate an answer that needs to be changed. The following table describes the items in the Search menu.

- + - + + - + - + - +
Menu Item Description
FindFind Opens a dialog box used to search the configuration for a specific character or value string.
Find NextFind Next Searches the configuration for the next occurrence of a specific character or value string.
@@ -281,49 +286,51 @@ table describes the items in the View menu.

- + - - + - + + - - + - - + - - + - - + - - + +
Menu Item + Menu Item Description
Question Mode + Question Mode Displays the Configuration Editor window in Question Mode.
Quick Set Mode + Quick Set Mode Displays the Configuration Editor window in Quick Set Mode.
More Info + More Info Displays and hides the More Info pane in the Configuration Editor window.
Question Tag + Question Tag Displays and hides the Question Tag field in the Configuration Editor Question Pane.
Refresh + Refresh Updates the values and questions displayed in the Configuration Editor window.
@@ -334,41 +341,43 @@ - + - + + - + - + - + - + +
Menu Item Description
Configuration EditorConfiguration Editor Displays online help for the Configuration Editor window.
Template EditorTemplate Editor Displays online help for the Template Editor window.
Question ModeQuestion Mode Displays online help for the Question Mode.
Quick Set ModeQuick Set Mode Displays online help for the Quick Set Mode.
@@ -457,4 +466,3 @@

Copyright © 2002, 2014, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/confEdit/keywords.html jtharness-6.0-b22/src/com/sun/javatest/help/default/confEdit/keywords.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/confEdit/keywords.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/confEdit/keywords.html 2022-03-27 19:40:32.000000000 +0000 @@ -100,14 +100,16 @@ that can be constructed.

+ - + + - + +To execute only the tests containing the interactive keyword, choose Any Of and then use the Insert Keyword button to choose the interactive keyword.

+ - + - + - + +
Expression Description
Any OfAny Of Runs all tests in the test suite having any of the keywords entered in the text field. @@ -118,11 +120,12 @@ require human interaction, and color to identify tests that require a color display.

-To execute only the tests containing the interactive keyword, choose Any Of and then use the Insert Keyword button to choose the interactive keyword.

All OfAll Of Runs all tests in the test suite having all of the keywords entered in the text field.

@@ -133,7 +136,7 @@

ExpressionExpression Runs all tests in the test suite having the expression entered in the text field. @@ -156,7 +159,8 @@ Keyword button to choose the color keyword, the Insert Operator button to choose the ! operator, and the Insert Keyword button to choose the interactive keyword.

@@ -165,15 +169,17 @@

Logical operators are only available when Expression is selected in the list of expressions. The following table provides descriptions and examples of logical operators that can be used to build keyword expressions. The precedence column indicates the order in which the expression is resolved. Expressions in parentheses are evaluated first, with nested parentheses being evaluated from the innermost parentheses outward.

+ - + + - + - + - + - + + a color display. +

interactive|color

+

The harness will only choose tests that include either keyword.

- - - +
Logical Operator Precedence Description
( ) group 1( ) group 1

Used to create groups of expressions.

Example:
A test suite uses the keyword interactive to identify tests that @@ -184,18 +190,18 @@

! not 2! not 2 Logical not. Used to exclude tests containing the expression.

Example:
A test suite uses the keyword interactive to identify tests that require human interaction and color to identify tests - that require a color display. -

!interactive&!color + that require a color display. +

!interactive&!color

The harness will exclude tests that include either keyword.

& and 3& and 3 Logical and. Used to combine expressions.

Example:
@@ -207,18 +213,16 @@

| or 4| or 4 Logical or. Used to specify either of two expressions.

Example:
A test suite uses the keyword interactive to identify tests that require human interaction and color to identify tests that require - a color display. -

interactive|color -

The harness will only choose tests that include either keyword.

@@ -227,4 +231,3 @@

Copyright © 2001, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/confEdit/searchConfiguration.html jtharness-6.0-b22/src/com/sun/javatest/help/default/confEdit/searchConfiguration.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/confEdit/searchConfiguration.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/confEdit/searchConfiguration.html 2022-03-27 19:40:32.000000000 +0000 @@ -100,17 +100,19 @@

The following table describes the search criteria used in the Find Question dialog box.

+ - - + + - - - + - + +
Item + Description
+ String @@ -119,7 +121,7 @@
+ Where @@ -142,17 +144,18 @@
Options: Consider case Options: Consider case Specifies that the search pattern match the case of the characters in the Find text field.
Options: Whole words Options: Whole words Specifies that the search pattern only match whole words from the Find text field.

@@ -160,4 +163,3 @@

Copyright © 2004, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/env/dialog.html jtharness-6.0-b22/src/com/sun/javatest/help/default/env/dialog.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/env/dialog.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/env/dialog.html 2022-03-27 19:40:32.000000000 +0000 @@ -74,6 +74,7 @@ The following table describes the contents of the Test Environment browser.

+ - + + - - @@ -105,7 +107,7 @@ - @@ -116,7 +118,7 @@ - @@ -124,6 +126,7 @@ When appropriate, this field displays the environment name from the configuration. +
Name @@ -81,21 +82,22 @@ Description
+ Entry Name Identifies a name-value pair derived from the configuration file and used by - test suite specific plug-in code to execute and run tests. + test suite specific plug-in code to execute and run tests.
+ Value
+ Defined in file
+ Defined in environment

@@ -131,4 +134,3 @@

Copyright © 2001, 2009, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/excl/dialog.html jtharness-6.0-b22/src/com/sun/javatest/help/default/excl/dialog.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/excl/dialog.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/excl/dialog.html 2022-03-27 19:40:32.000000000 +0000 @@ -81,7 +81,7 @@ - + - + + - - - +
Field @@ -89,9 +89,10 @@ Description
+ Synopsis Provides annotated information about the excluded test @@ -99,7 +100,7 @@
+ Keywords Provides a list of keywords that describe why the test was excluded @@ -107,12 +108,13 @@
+ Bug Ids Lists the bug tracking IDs for the excluded test

@@ -120,4 +122,3 @@

Copyright © 2001, 2009, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/execProps/dialog.html jtharness-6.0-b22/src/com/sun/javatest/help/default/execProps/dialog.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/execProps/dialog.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/execProps/dialog.html 2022-03-27 19:40:32.000000000 +0000 @@ -108,7 +108,7 @@ area.

- + - + + - - - - +
Property @@ -117,9 +117,10 @@ Description
+ Test Suite @@ -128,7 +129,7 @@
+ Test Finder @@ -138,7 +139,7 @@
+ Test Runner @@ -147,13 +148,14 @@
+ Interview The fully qualified name of the interview class used by the test manager.

@@ -161,4 +163,3 @@

Copyright © 2001, 2010, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/report/newReports.html jtharness-6.0-b22/src/com/sun/javatest/help/default/report/newReports.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/report/newReports.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/report/newReports.html 2022-03-27 19:40:32.000000000 +0000 @@ -331,61 +331,70 @@

In the html directory, the KFL report file names correspond to the KFL reports as follows:

+ - - - - + + + + + + + + - + - + - - - + + +
HTML ReportFile Names
New Passedkfl_fail2pass.html, kfl_tc_fail2pass.html
Unexpected Errorkfl_fail2error.html, kfl_tc_fail2error.html
Unrelated Errorkfl_fail2error.html, kfl_otherErrors.html
HTML ReportFile Names
New Passedkfl_fail2pass.html, kfl_tc_fail2pass.html
Unexpected Errorkfl_fail2error.html, kfl_tc_fail2error.html
Unrelated Errorkfl_fail2error.html, kfl_otherErrors.html
Missing (not run)
Missing (not run) kfl_fail2notrun.html, kfl_tc_fail2notrun.html
Missing (test not found)
Missing (test not found) kfl_fail2missing.html, kfl_tc_fail2missing.html
New Failurekfl_newfailures.html, kfl_tc_newfailures.html
Old Failurekfl_fail2fail.html, kfl_tc_fail2fail.html
New Failurekfl_newfailures.html, kfl_tc_newfailures.html
Old Failurekfl_fail2fail.html, kfl_tc_fail2fail.html

-

Plain Text Report Files

+

Plain Text Report Files

A plain text report directory contains a text/ directory which contains the main text report, summary.txt.

If the configuration associated with the work directory names at least one known failures list (KFL) file, the text/ directory contains the additional known failure analysis files listed here:

- + + + + - + - + - - + + - + - + - + - + +
Text Report File Names
New PassedNew Passed kfl_fail2pass.txt, kfl_tc_fail2pass.txt
Unexpected ErrorUnexpected Error kfl_fail2error.txt, kfl_tc_fail2error.txt
Unrelated Errorother_errors.txt>Unrelated Errorother_errors.txt
Missing (not run)Missing (not run) kfl_fail2notrun.txt, kfl_tc_fail2notrun.txt
Missing (test not found)Missing (test not found) kfl_fail2missing.txt, kfl_tc_fail2missing.txt
New FailureNew Failure kfl_newfailures.txt, kfl_tc_newfailures.txt
Old FailureOld Failure kfl_fail2fail.txt, kfl_tc_fail2fail.txt

The files whose names begin with tc_ are present only if the test suite supports test case identification.


@@ -393,4 +402,3 @@

Copyright © 2002, 2015, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/run/progressMonitor.html jtharness-6.0-b22/src/com/sun/javatest/help/default/run/progressMonitor.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/run/progressMonitor.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/run/progressMonitor.html 2022-03-27 19:40:32.000000000 +0000 @@ -242,17 +242,18 @@

- + + + - @@ -262,13 +263,14 @@ - +
Name Description -
+ Used:
+ Total: The total memory available for use by the virtual machine.
@@ -316,4 +318,3 @@

Copyright © 2002, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/configureMenu.html jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/configureMenu.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/configureMenu.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/configureMenu.html 2022-03-27 19:40:32.000000000 +0000 @@ -45,12 +45,15 @@ options listed in the following table are only available when template usage is enabled.

+ + + - + - + - + - + - + - + - + - + - + - + +
Menu Item Description
Edit Configuration Edit Configuration Opens the Configuration Editor and loads the current configuration. The harness uses the Configuration Editor to change configuration values required to run a test suite. @@ -58,7 +61,7 @@
Edit Template Edit Template Opens the Template Editor and loads the template on which the current configuration is based. If the test suite disables the template feature, this and all other template menu items are not displayed. This menu item is also disabled when the test suite only enables users to load but not edit templates. Use the Template Editor to change configuration values in the template and to propagate the changes to the current configuration. @@ -69,7 +72,7 @@
Edit Quick Set Edit Quick Set Opens an additional menu containing Tests to Run, Exclude List (optional), Keywords (optional), Environment (optional), Prior Status, Concurrency, and Timeout Factor menu items that you can use to change specific @@ -78,7 +81,7 @@ Values for detailed information.

New Configuration New Configuration Opens the Configuration Editor and loads an empty configuration. The harness uses the Configuration Editor to create configuration data containing the test environment and standard values required to run a test @@ -87,7 +90,7 @@ detailed information.

Load Configuration Load Configuration

Opens a Load Configuration File dialog box that you use to load an existing configuration into the Test Manager.

The harness does not open the Configuration Editor when you load an @@ -95,12 +98,12 @@

See Loading a Configuration for detailed information.

Load Recent Configuration Load Recent Configuration Displays a list of recently opened configuration. You can choose a configuration from the list to use as the current configuration.
New Template New Template Opens the Template Editor and loads an empty template. The harness uses the Template Editor to create a template containing known test environment and standard values required to run a test suite. @@ -108,24 +111,25 @@ detailed information about templates.

Load Template Load Template

Opens a Load Template dialog box that you use to load an existing template into the Test Manager.

See Loading a Template for detailed information.

Load Recent Template Load Recent Template Displays a list of templates that have been opened. You can choose a template from the list to use as the template for creating a configuration.
Update TemplateUpdate Template Enabled only when template propagation is enabled and the template on which current configuration is based has changed. Displays a dialog box that enables you to import changes from the template into your configuration.
diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/customFilters.html jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/customFilters.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/customFilters.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/customFilters.html 2022-03-27 19:40:32.000000000 +0000 @@ -148,15 +148,17 @@ that can be constructed.

- + + - + + - + - + - + +
Expression Description
Any OfAny Of Displays all tests in the test suite having any of the keywords entered in the text field. @@ -178,7 +180,7 @@
All OfAll Of Displays results for all tests in the test suite having all of the keywords entered in the text field.

@@ -192,7 +194,7 @@

ExpressionExpression Displays results for all tests in the test suite having the expression entered in the text field. @@ -220,6 +222,7 @@
@@ -313,4 +316,3 @@

Copyright © 2002, 2009, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/keyboardAccess.html jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/keyboardAccess.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/keyboardAccess.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/keyboardAccess.html 2022-03-27 19:40:32.000000000 +0000 @@ -68,6 +68,7 @@ help.

+ - + + - - - - +
Activation Keys @@ -76,9 +77,10 @@ GUI Action
+ F1 @@ -86,7 +88,7 @@
+ F10 @@ -95,14 +97,14 @@
+ Shift F10 Activates the pop-up menu if focus is on a folder or test in the test tree.
@@ -138,6 +140,7 @@ table lists the keys used for keyboard navigation.

+ - + + - - - - - - - - - - - - - - - - - +
Navigation Key @@ -146,9 +149,10 @@ GUI Action
+ Tab Navigates to the next focusable component in the GUI. The tab traversal order is generally left to right and top to bottom. @@ -156,7 +160,7 @@
+ Shift-Tab Navigates back to the next focusable component. @@ -164,7 +168,7 @@
+ Control-Tab Navigates to the next focusable component even if the current component accepts the Tab key as input (such as a text area). @@ -172,7 +176,7 @@
+ Control-Shift Tab Navigates back to the next focusable component even if the current component accepts the Tab key as input (such as a text area). @@ -180,14 +184,14 @@
+ Left arrow Moves keyboard focus left one character or component.
If focus is in the test tree, focus moves up the tree and closes the node.
If focus is on the splitter bar (F8 moves focus to the splitter bar), it moves the splitter bar left.
+ Right arrow Moves keyboard focus right one character or component.
If focus is in the test tree, focus moves sequentially down the tree, opening the node and traversing all tests in a folder.
If focus is on the splitter bar (F8 moves focus to the splitter bar), it moves the splitter bar right. @@ -195,7 +199,7 @@
+ Up arrow Moves keyboard focus up one line or component.
If focus is in the test tree, focus moves sequentially up the tree but does not open any closed folders.
If focus is on the splitter bar (F8 moves focus to the splitter bar), it moves the splitter bar left. @@ -203,7 +207,7 @@
+ Down arrow Moves keyboard focus down one line or component.
If focus is in the test tree, focus moves sequentially down the tree but does not open any closed folders.
If focus is on the splitter bar (F8 moves focus to the splitter bar), it moves the splitter bar right. @@ -211,7 +215,7 @@
+ Page Up Navigates up one pane of information within a scroll pane. @@ -219,7 +223,7 @@
+ Page Down Navigates down one pane of information within a scroll pane. @@ -227,7 +231,7 @@
+ Home Moves to the beginning of the data. In a table, moves to the beginning of a row. If focus is in the test tree, moves to the top of the tree. @@ -235,7 +239,7 @@
+ End Moves to the end of the data. In a table, moves to the last cell in a row. If focus is in the test tree, moves to the bottom of the tree. @@ -243,7 +247,7 @@
+ Control-F1 Displays the tool tip information for the GUI object that has focus. Can be used to determine which GUI object has focus. @@ -251,7 +255,7 @@
+ F6 Shifts focus between left and right panes. @@ -259,7 +263,7 @@
+ F8 Shifts focus to the splitter bar if focus is in the left or right pane. @@ -267,7 +271,7 @@
+ Control-T Shifts focus to the next link in a topic or in a report. @@ -275,12 +279,13 @@
+ Control-Shift-T Shifts focus to the previous link in a topic or in a report.

Navigation in Hyperlinked Text

@@ -337,7 +342,8 @@ components.

- + + @@ -345,9 +351,10 @@ GUI Action - + + - - - - - - +
Activation Keys
+ Enter or Return @@ -356,7 +363,7 @@
+ Escape @@ -365,7 +372,7 @@
+ Space Bar @@ -375,7 +382,7 @@
+ Shift-Space Bar @@ -384,14 +391,14 @@
+ Control-Space Bar If the item with focus is in a list, it toggles the selection state of the item without affecting any other list selections.
If the item is a link, it follows the link.

@@ -399,4 +406,3 @@

Copyright © 2003, 2010, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/reportMenu.html jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/reportMenu.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/reportMenu.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/reportMenu.html 2022-03-27 19:40:32.000000000 +0000 @@ -44,7 +44,7 @@ - + - + + - - - +
Menu Item @@ -53,9 +53,10 @@ Description
+ Create Report @@ -67,7 +68,7 @@
+ Open Report @@ -79,7 +80,7 @@
+ Report History @@ -88,6 +89,7 @@

See Displaying Reports for detailed information about the Report browser.


@@ -95,4 +97,3 @@

Copyright © 2003, 2010, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/runMenu.html jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/runMenu.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/runMenu.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/runMenu.html 2022-03-27 19:40:32.000000000 +0000 @@ -42,7 +42,7 @@

The Run Tests menu is used to start, stop, and monitor a test run. This menu can be customized to include additional actions, so you may see additional options. A custom menu is developed as part of a test suite, so it is visible only when the test suite is in use.

The following table describes the default items in the Run Tests menu.

- + + + - + - + - + - +
Menu Item @@ -51,9 +51,11 @@ Description
Start Test Run button displayed on the tool bar  StartStart Test Run button displayed on the tool bar  Start The harness enables the Start menu item when it is not running tests. Choose the Start menu item to start a test run. @@ -64,7 +66,7 @@
Stop Test Run button displayed on the tool bar  StopStop Test Run button displayed on the tool bar  Stop The harness enables the Stop menu item when it is running tests. Choose the Stop menu item to end a test run after the current test is completed. @@ -75,7 +77,7 @@
Monitor ProgressMonitor Progress When the harness is running tests, you can use the Progress Monitor to display the progress of the test run and current resource information about @@ -86,7 +88,7 @@

@@ -99,4 +101,3 @@

Copyright © 2003, 2010, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/viewMenu.html jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/viewMenu.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/viewMenu.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/viewMenu.html 2022-03-27 19:40:32.000000000 +0000 @@ -43,23 +43,24 @@ The following table describes the items in the View menu.

- + - + + - + - + - + - + - + - + - + - + - + - +
Menu Item Description
Configuration > Show Checklist (Optional) Configuration > Show Checklist (Optional) Enabled by the harness when your test suite supports the configuration checklist. Displays a checklist of tasks to be performed before running tests. See Displaying the Configuration Checklist for detailed information.
Configuration > Show Exclude List (Optional) Configuration > Show Exclude List (Optional) Opens an Exclude List dialog box that contains the exclude list used to run the test suite. You can use the Exclude List dialog box to review but not edit the contents of the exclude list. If you use multiple @@ -72,7 +73,7 @@ detailed information about viewing the contents of the exclude list.

Configuration > Show Test Environment Configuration > Show Test Environment Opens a Test Environment browser that displays the configuration values used when running the test suite.

You can browse but not change values in the Test Environment browser. @@ -81,34 +82,34 @@ detailed information about viewing the contents of the test environment.

Configuration > Show Question Log Configuration > Show Question Log Displays a log of the current configuration interview questions and answers. See Displaying the Question Log for detailed information.
FiltersFilters Displays the available view filters, the active filter, and enables you to modify the custom view filter.

See Using View Filters for detailed description.

PropertiesProperties Click the Properties menu item to display the Test Manager Properties dialog box containing the current settings of the Test Manager.

See Viewing Test Manager Properties for detailed information about using the Test Manager Properties dialog box.

LogsLogs Is enabled if the harness detects any log output, otherwise it is disabled. Click the Logs menu item to display logged output generated by the harness for the test suite.
Test Suite ErrorsTest Suite Errors Enables the Test Suite Errors menu item when it detects that the test suite (not the tests in the test suite) contains errors. Click @@ -119,11 +120,11 @@
ToolbarsToolbars Is enabled if more than one toolbar is available to the user, otherwise it is disabled.
@@ -132,4 +133,3 @@

Copyright © 2001, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/window.html jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/window.html --- jtharness-6.0-b15/src/com/sun/javatest/help/default/ui/window.html 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/help/default/ui/window.html 2022-03-27 19:40:32.000000000 +0000 @@ -90,6 +90,7 @@ The following table describes the tasks that you can perform from the Test Manager.

+ + + - - - - - - +
Task @@ -98,8 +99,10 @@ Description
+ Load, edit, or create a configuration @@ -109,7 +112,7 @@
+ Run tests @@ -121,7 +124,7 @@
+ Monitor test runs Use the test tree with the folder and test views to monitor the status of the test run. For more information about monitoring test runs, see Monitoring a Test Run. @@ -129,7 +132,7 @@
+ Browse test information @@ -138,7 +141,7 @@
+ Create and view test reports @@ -147,13 +150,14 @@
+ Troubleshoot a test run Use the test tree with the folder and test views to troubleshoot a test run. See Troubleshooting a Test Run for help with troubleshooting test run problems.

@@ -161,4 +165,3 @@

Copyright © 2001, 2011, Oracle and/or its affiliates. All rights reserved.

- diff -Nru jtharness-6.0-b15/src/com/sun/javatest/i18n.properties jtharness-6.0-b22/src/com/sun/javatest/i18n.properties --- jtharness-6.0-b15/src/com/sun/javatest/i18n.properties 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/i18n.properties 2022-03-27 19:40:32.000000000 +0000 @@ -362,8 +362,8 @@ trace.error=Error: {0} trace.starting=Starting tests.\nTest suite class: {0}\nTest finder class: {1} trace.stopping=Stopping tests -trace.testStarting=Test starting: {0} -trace.testFinished=Test finished: {0}: {1} +trace.testStarting=Starting: {0} +trace.testFinished=Finished: {0}: {1} #trc.abort=Cache update action aborted due to shutdown signal. #trc.badtr=An unrecoverable error occurred while trying to read a result file, the error was {0}. diff -Nru jtharness-6.0-b15/src/com/sun/javatest/InterviewParameters.java jtharness-6.0-b22/src/com/sun/javatest/InterviewParameters.java --- jtharness-6.0-b15/src/com/sun/javatest/InterviewParameters.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/InterviewParameters.java 2022-03-27 19:40:32.000000000 +0000 @@ -47,6 +47,7 @@ import java.io.OutputStream; import java.util.HashMap; import java.util.Map; +import java.util.OptionalLong; import java.util.ResourceBundle; import java.util.SortedMap; import java.util.TreeMap; @@ -100,7 +101,7 @@ private File currFile; private boolean isTemplate; private String templatePath; - private long currFileLastModified; + private OptionalLong currFileLastModified = OptionalLong.empty(); private boolean currFileLoaded; private CustomPropagationController pc = new CustomPropagationController(); @@ -1126,10 +1127,10 @@ currFile = f; currFileLoaded = false; if (f != null) { - currFileLastModified = f.lastModified(); + currFileLastModified = OptionalLong.of(f.lastModified()); } else { // means: unknown; will likely a trigger a reload - currFileLastModified = 0; + currFileLastModified = OptionalLong.empty(); } } @@ -1209,7 +1210,7 @@ setEdited(false); currFile = file; - currFileLastModified = file.lastModified(); + currFileLastModified = OptionalLong.of(file.lastModified()); currFileLoaded = true; return checkForUpdates(); } @@ -1443,7 +1444,7 @@ setEdited(false); currFile = file; - currFileLastModified = file.lastModified(); + currFileLastModified = OptionalLong.of(file.lastModified()); currFileLoaded = true; } @@ -1615,8 +1616,8 @@ */ public boolean isFileNewer() { File f = getFile(); - return f != null && f.exists() && ((currFileLastModified == 0) - || (f.lastModified() > currFileLastModified)); + return f != null && f.exists() && (!currFileLastModified.isPresent() + || (f.lastModified() > currFileLastModified.getAsLong())); } /** diff -Nru jtharness-6.0-b15/src/com/sun/javatest/JavaTestSecurityManager.java jtharness-6.0-b22/src/com/sun/javatest/JavaTestSecurityManager.java --- jtharness-6.0-b15/src/com/sun/javatest/JavaTestSecurityManager.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/JavaTestSecurityManager.java 2022-03-27 19:40:32.000000000 +0000 @@ -56,30 +56,27 @@ } /** - * Try to install a copy of this security manager. If another security manager is - * already installed, the install will fail; a warning message wil, be written to - * the console if the previously installed security manager is not a subtype of + * Please note that the new default behaviour is NOT installing JavaTestSecurityManager. + * + * This method would try to install a copy of this security manager only if "javatest.security.noSecurityManager" property + * is set to something else than 'true' (ignoring case). + * If "javatest.security.noSecurityManager" is not defined, security manager still would not be installed. + * The install can be enabled by setting system property "javatest.security.noSecurityManager" to 'false'. + * If another security manager is already installed, the install will fail; + * a warning message will be written to the console if the previously installed security manager is not a subtype of * com.sun.javatest.JavaTestSecurityManager. - * The install can be suppressed by setting the system property - * "javatest.security.noSecurityManager" to true. */ public static void install() { try { - // install our own permissive security manager, to prevent anyone else - // installing a less permissive one. String noSecurityMgr = "javatest.security.noSecurityManager"; - if (Boolean.getBoolean(noSecurityMgr)) { - System.err.println(); - System.err.println(" ---- WARNING -----"); - System.err.println(); - System.err.println("JT Harness did not install its own Security Manager"); - System.err.println("because the property " + noSecurityMgr + " was set."); - System.err.println("This is not a fatal error, but it may affect the"); - System.err.println("execution of sameJVM tests"); - System.err.println(); + if (Boolean.valueOf(System.getProperty(noSecurityMgr, "true"))) { + // not installing any custom security manager + // if 'javatest.security.noSecurityManager' property was not set + // or was set to 'true' (ignoring case) } else { try { - // test to see if permission API available: + // Trying to install our own Security Manager. + // First testing to see if permission API available: // if it's not, we'll get an exception and load // an old-style security manager Class.forName("java.security.Permission"); @@ -87,6 +84,10 @@ } catch (ClassNotFoundException e) { System.setSecurityManager(new JavaTestSecurityManager()); } + System.err.println("JT Harness installed its own Security Manager"); + System.err.println("because system property '" + noSecurityMgr + "' was set to '" + + System.getProperty(noSecurityMgr, "undefined") + "'"); + System.err.println(); } } catch (SecurityException e) { SecurityManager sm = System.getSecurityManager(); diff -Nru jtharness-6.0-b15/src/com/sun/javatest/ProductInfo.java jtharness-6.0-b22/src/com/sun/javatest/ProductInfo.java --- jtharness-6.0-b15/src/com/sun/javatest/ProductInfo.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/ProductInfo.java 2022-03-27 19:40:32.000000000 +0000 @@ -78,12 +78,13 @@ /** * Returns detailed version string of this product. - * Format of the returned string is the following: $VNUM-$MLSTN+$BUILDNUM(-$BLDDATE)? + * Format of the returned string is the following: $VNUM-$MLSTN+$BUILDNUM(-$BLDDATE)?-$COMMIT * where $VNUM value is provided by {@code ProductInfo.getVersion()}, * $MLSTN value is provided by {@code ProductInfo.getMilestone()}, * $BLDNUM value is provided by {@code ProductInfo.getBuildNumber()}. * $BLDDATE is optional and is provided by {@code ProductInfo.getBuildDate()} in 'yyyy-MM-dd' format * if returned date is not null. + * $COMMIT value is provided by {@code ProductInfo.getSourceCommitID()}. * * @return a string identifying detailed version of this product * including milestone, build number and (optionally) product build date. @@ -102,6 +103,7 @@ } sb.append('-').append(buildDateString); } + sb.append('-').append(getSourceCommitID()); return sb.toString(); } @@ -171,6 +173,15 @@ } /** + * Source repository commit ID that is used for building this product. + * + * @return a string identifying source repository commit ID. + */ + public static String getSourceCommitID() { + return getProperty("commit"); + } + + /** * The version of Java used to build this product. * * @return a string identifying a version of Java used to build this product. diff -Nru jtharness-6.0-b15/src/com/sun/javatest/report/ConfigSection.java jtharness-6.0-b22/src/com/sun/javatest/report/ConfigSection.java --- jtharness-6.0-b15/src/com/sun/javatest/report/ConfigSection.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/report/ConfigSection.java 2022-03-27 19:40:32.000000000 +0000 @@ -375,6 +375,7 @@ private void writeConfigInterview() throws IOException { WizPrint wp = new WizPrint(settings.getInterview()); wp.setShowResponses(true); + wp.setShowTags(true); wp.write(openWriter(HTMLReport.CONFIG_HTML)); } diff -Nru jtharness-6.0-b15/src/com/sun/javatest/TestEnvironment.java jtharness-6.0-b22/src/com/sun/javatest/TestEnvironment.java --- jtharness-6.0-b15/src/com/sun/javatest/TestEnvironment.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/TestEnvironment.java 2022-03-27 19:40:32.000000000 +0000 @@ -513,7 +513,7 @@ } i--; } else { - throw new Fault(i18n, "env.badExprChar", new Character(c)); + throw new Fault(i18n, "env.badExprChar", Character.valueOf(c)); } name = buf.toString(); } @@ -700,6 +700,153 @@ return table.values(); } + //region Environment access + + /** + * Looks up a parameter in the test environment and extracts a single value. + * If a parameter is found, and it has a non-empty array of values, and the first of these values is not null + * then that value is returned. + * Otherwise, an exception is thrown. + * + * @param name parameter to look up. + * + * @return first of the values associated with the named parameter. + * + * @throws RuntimeException if {@link TestEnvironment#lookup(String) lookup} + * throws {@link Fault}. + * @throws ArrayIndexOutOfBoundsException if {@link TestEnvironment#lookup(String) lookup} returns an empty array. + * @throws NullPointerException if {@link TestEnvironment#lookup(String) lookup} returns null + * or if the first element of the returned array is null. + */ + public String lookupOneOrFail(String name) { + String s = lookupMultipleOrFail(name)[0]; + + if (s == null) { + throw new NullPointerException("First value associated with parameter " + name + + " is unexpectedly null"); + } + + return s; + } + + /** + * Looks up a parameter in the test environment. + * If a parameter is found, returns array of values associated with it. + * Otherwise, an exception is thrown. + * + * @param name parameter to look up. + * + * @return array of values associated with the named parameter. + * + * @throws RuntimeException if {@link TestEnvironment#lookup(String) lookup} + * throws {@link Fault}. + * @throws NullPointerException if {@link TestEnvironment#lookup(String) lookup} returns null. + */ + public String[] lookupMultipleOrFail(String name) { + String[] values; + + try { + values = lookup(name); + } catch (Fault e) { + throw new RuntimeException(e); + } + + if (values == null) { + throw new NullPointerException("Array of values associated with parameter " + name + + " is unexpectedly null"); + } + + return values; + } + + /** + * Resolves a string using the test environment and joins the result into a single string. + * + * @param s string to resolve. + * + * @return string obtained by joining array of values produced by the string resolution with spaces. + * + * @throws RuntimeException if {@link TestEnvironment#resolve(String) resolve} throws {@link Fault}. + */ + public String resolveAndJoinOrFail(String s) { + return String.join(" ", resolveMultipleOrFail(s)); + } + + /** + * Resolves a string using the test environment. + * + * @param s string to resolve. + * + * @return array of values produced by the string resolution. + * + * @throws RuntimeException if {@link TestEnvironment#resolve(String) resolve} throws {@link Fault}. + */ + public String[] resolveMultipleOrFail(String s) { + try { + return resolve(s); + } catch (Fault e) { + throw new RuntimeException(e); + } + } + + /** + * Looks up a string using the test environment and joins the result into a single string. + * + * @param s string to resolve. + * + * @return string obtained by joining array of values produced by the string lookup with spaces. + * + * @throws RuntimeException if {@link TestEnvironment#lookup(String) resolve} throws {@link Fault}. + */ + public String lookupAndJoinOrFail(String s) { + return String.join(" ", lookupMultipleOrFail(s)); + } + + + /** + * Safely Looks up a parameter in the test environment. + * If a parameter is found and has non-empty value + * then first of the values in the array returned by {@link TestEnvironment#lookup(String)} is returned. + * Otherwise, null is returned. + * + * @param name parameter to look up. + * + * @return first of the values associated with the named parameter, if any; otherwise, null. + */ + public String lookupOneOrNull(String name) { + try { + String[] arr = lookup(name); + return (arr == null || arr.length == 0) + ? null + : arr[0]; + } catch (Fault ignored) { + return null; + } + } + + /** + * Safely Looks up a parameter in the test environment. + * If a parameter is found and has non-empty value + * then first of the values in the array returned by {@link TestEnvironment#lookup(String)} is returned. + * Otherwise, empty String is returned. + * + * @param name parameter to look up. + * + * @return first of the values associated with the named parameter, if any; otherwise, empty String. + */ + public String lookupOneOrEmpty(String name) { + try { + String[] arr = lookup(name); + return (arr == null || arr.length == 0) + ? "" + : arr[0]; + } catch (Fault ignored) { + return null; + } + } + + //endregion + /** * This exception is used to report resolving values in an environment. */ diff -Nru jtharness-6.0-b15/src/com/sun/javatest/TestResult.java jtharness-6.0-b22/src/com/sun/javatest/TestResult.java --- jtharness-6.0-b15/src/com/sun/javatest/TestResult.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/TestResult.java 2022-03-27 19:40:32.000000000 +0000 @@ -1432,7 +1432,8 @@ String name = td.getRootRelativeURL(); if (!testURL.equals(name)) { - throw new IllegalStateException(); + throw new IllegalStateException("testURL associated with this test result: '" + testURL + "' " + + "is not equal to the given test description's rootRelativeURL: '" + name + "'"); } if (desc != null) { // compare if possible diff -Nru jtharness-6.0-b15/src/com/sun/javatest/tool/i18n.properties jtharness-6.0-b22/src/com/sun/javatest/tool/i18n.properties --- jtharness-6.0-b15/src/com/sun/javatest/tool/i18n.properties 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/tool/i18n.properties 2022-03-27 19:40:32.000000000 +0000 @@ -353,7 +353,7 @@ help.cmd.syntax.string.desc=One or more commands can be put directly on the command line by enclosing them in quotation marks. help.cmd.syntax.string.name=command string help.cmd.tail=For complete details and examples, see the JT Harness online help. You can access this directly from the command line with "-onlineHelp ...", or you can start the JT Harness harness and use the Help menu. The online help is also available in PDF format in the JT Harness documentation directory. -help.copyright.txt=Copyright \u00a9 2005, 2020, Oracle and/or its affiliates. All rights reserved. +help.copyright.txt=Copyright \u00a9 2005, 2021, Oracle and/or its affiliates. All rights reserved. help.onlineHelp.pleaseWait=Opening online help; please wait... help.version.txt={0}, version {1} {2} {3} ({4}, {5})\nInstalled in {6}\nRunning on platform version {7} from {8}.\nBuilt with {9} on {10}. help.harnessType.full.txt=(Full) @@ -373,7 +373,7 @@ hm.aboutJavaTest.mit=About the JT Harness hm.aboutJavaTest.mne=A hm.aboutJavaTest={0} {1} {2} {3}\n{4}\n\nbuilt with {5}\nbuilt on {6}\n -hm.aboutJavaTest.copy.txt=Copyright \u00a9 2005, 2020, Oracle and/or its affiliates. All rights reserved.\nDO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n\nThis code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation. Oracle designates this particular file as subject to the "Classpath" exception as provided by Oracle in the LICENSE file that accompanied this code.\n\nThis code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details (a copy is included in the LICENSE file that accompanied this code).\n\nYou should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n\n Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or visit www.oracle.com if you need additional information or have any questions. +hm.aboutJavaTest.copy.txt=Copyright \u00a9 2005, 2021, Oracle and/or its affiliates. All rights reserved.\nDO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n\nThis code is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License version 2 only, as published by the Free Software Foundation. Oracle designates this particular file as subject to the "Classpath" exception as provided by Oracle in the LICENSE file that accompanied this code.\n\nThis code is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License version 2 for more details (a copy is included in the LICENSE file that accompanied this code).\n\nYou should have received a copy of the GNU General Public License version 2 along with this work; if not, write to the Free Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n\n Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA or visit www.oracle.com if you need additional information or have any questions. hm.aboutJavaTest.copy.desc=Long version of software copyright notice - multiple paragraphs. hm.aboutJavaTest.copy.name=Long copyright notice. hm.aboutJavaTest.text.desc=Build date, author, version, jar file name, copyright info. diff -Nru jtharness-6.0-b15/src/com/sun/javatest/Trace.java jtharness-6.0-b22/src/com/sun/javatest/Trace.java --- jtharness-6.0-b15/src/com/sun/javatest/Trace.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/Trace.java 2022-03-27 19:40:32.000000000 +0000 @@ -34,11 +34,17 @@ import java.io.IOException; import java.text.Format; import java.text.SimpleDateFormat; -import java.util.Date; +import java.util.*; +import java.util.concurrent.ConcurrentHashMap; +import java.util.stream.Collectors; + +import static com.sun.javatest.util.FormattingUtils.formattedDuration; class Trace implements Harness.Observer { private static final Format TIMESTAMP_FORMAT = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ"); + public static final String TEST_EXEC_TIME_STATS_LIMIT = "javatest.trace.execTimeStatsLimit"; + public static final int DEFAULT_STATS_LIMIT = 20; //------methods from Harness.Observer---------------------------------------- private static I18NResourceBundle i18n = I18NResourceBundle.getBundleForClass(Trace.class); @@ -46,6 +52,8 @@ private File reportDir; private BackupPolicy backupPolicy; private boolean useTimestamp; + private Map testStartedMillis = new ConcurrentHashMap<>(); + private Map runTimesMillis = new ConcurrentHashMap<>(); Trace(BackupPolicy backupPolicy) { this.backupPolicy = backupPolicy; @@ -78,6 +86,7 @@ if (td != null) { println(i18n, "trace.testStarting", td.getRootRelativeURL()); + testStartedMillis.put(td.getRootRelativeURL(), System.currentTimeMillis()); } } } @@ -87,8 +96,16 @@ if (out != null) { try { TestDescription td = tr.getDescription(); + Long started = testStartedMillis.get(td.getRootRelativeURL()); + String duration = ""; + if (started != null) { + long timeMillis = System.currentTimeMillis() - started; + runTimesMillis.put(td.getRootRelativeURL(), timeMillis); + testStartedMillis.remove(td.getRootRelativeURL()); + duration = "(" + formattedDuration(Math.round(timeMillis * 0.001)) + ") "; + } println(i18n, "trace.testFinished", - td.getRootRelativeURL(), tr.getStatus()); + duration + td.getRootRelativeURL(), tr.getStatus()); } catch (TestResult.Fault e) { e.printStackTrace(); } @@ -105,6 +122,33 @@ @Override public synchronized void finishedTesting() { if (out != null) { + int statsLimit = DEFAULT_STATS_LIMIT; + String statsLimitString = System.getProperty(TEST_EXEC_TIME_STATS_LIMIT); + if (statsLimitString != null) { + try { + statsLimit = Integer.valueOf(statsLimitString); + if (statsLimit <= 0) { + println("The parsed value of '" + TEST_EXEC_TIME_STATS_LIMIT + + "' system property is not a positive integer. The value is '" + statsLimitString + "'"); + println("Will skip stats printing."); + } + } catch (NumberFormatException e) { + println("Cannot parse the value of '" + TEST_EXEC_TIME_STATS_LIMIT + + "' system property as an integer. The value is '" + statsLimitString + "'"); + println("Using the default limit: " + DEFAULT_STATS_LIMIT); + statsLimit = DEFAULT_STATS_LIMIT; + } + } + if (statsLimit > 0) { + List> slowestTests = runTimesMillis.entrySet().stream() + .sorted((e1, e2) -> e2.getValue().compareTo(e1.getValue())) + .limit(statsLimit).collect(Collectors.toList()); + if (slowestTests.size() > 0) { + println("Below are the " + slowestTests.size() + " slowest tests: "); + slowestTests.forEach( + e -> println(formattedDuration(Math.round(e.getValue() * 0.001)) + ": " + e.getKey())); + } + } println(i18n, "trace.cleanup"); } } @@ -175,8 +219,12 @@ } private void printLocalizedLn(String msg) { + println(useTimestamp ? timeStamp() + " " + msg : msg); + } + + private void println(String msg) { try { - out.println(useTimestamp ? timeStamp() + " " + msg : msg); + out.println(msg); out.flush(); } catch (IOException e) { System.err.println("Exception occurred writing to trace file"); diff -Nru jtharness-6.0-b15/src/com/sun/javatest/TRT_TreeNode.java jtharness-6.0-b22/src/com/sun/javatest/TRT_TreeNode.java --- jtharness-6.0-b15/src/com/sun/javatest/TRT_TreeNode.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/TRT_TreeNode.java 2022-03-27 19:40:32.000000000 +0000 @@ -39,6 +39,7 @@ import java.util.List; import java.util.Map; import java.util.Objects; +import java.util.OptionalLong; /** * This is the implementation of a tree node structure for TestResultTable. @@ -63,7 +64,7 @@ private int counter; // nodes below this point and including self private int[] childStats; private String name; // basically the directory name, null means root node - private long lastScanDate; + private OptionalLong lastScanDate = OptionalLong.empty(); /** * List of files that makeup the on-disk contents of this node. * These are probably HTML files with test descriptions in them. The string is a @@ -277,7 +278,7 @@ @Override public boolean isUpToDate() { // compare timestamp in the future - return lastScanDate != 0; + return lastScanDate.isPresent(); } /** @@ -775,7 +776,7 @@ // special case for root if (isRoot() && filesToScan == null /* && root timestamp change check */) { File thisDir = table.getTestSuiteRoot(); - lastScanDate = table.getLastModifiedTime(thisDir); + lastScanDate = OptionalLong.of(table.getLastModifiedTime(thisDir)); processFile(thisDir); // to prevent infinite recursion @@ -790,7 +791,7 @@ File thisDir = new File(TestResultTable.getRootRelativePath(this)); long lmd = table.getLastModifiedTime(thisDir); - if (lmd <= lastScanDate) { + if (lastScanDate.isPresent() && lmd <= lastScanDate.getAsLong()) { return; } @@ -813,7 +814,7 @@ refreshIfNeeded(); } - lastScanDate = lmd; + lastScanDate = OptionalLong.of(lmd); // send observer msg? // delete unneeded objects from TestResultTable.TreeNode? @@ -892,7 +893,7 @@ */ public synchronized boolean refreshIfNeeded() { if (filesToScan != null || - (table != null && table.isFinderScanSuppressed() && lastScanDate == 0)) { + (table != null && table.isFinderScanSuppressed() && !isUpToDate())) { //File thisDir = new File(getTestSuiteRootPathPrefix(), // TestResultTable.getRootRelativePath(this)); File thisDir = new File(TestResultTable.getRootRelativePath(this)); @@ -903,7 +904,7 @@ // may be less than if the custom finder starts to return a // bogus value - like zero or 1 for whatever reason - if (thisScanDate <= lastScanDate) { + if (lastScanDate.isPresent() && thisScanDate <= lastScanDate.getAsLong()) { return false; } @@ -918,10 +919,10 @@ } // sync - long cachedScanDate = lastScanDate; + OptionalLong cachedScanDate = lastScanDate; // need to update lastScanDate before the loop to avoid // excessive recursion - lastScanDate = thisScanDate; + lastScanDate = OptionalLong.of(thisScanDate); List nodesUsed = new ArrayList<>(); List usedTests = new ArrayList<>(); @@ -931,7 +932,7 @@ } else { // scan if file is newer than the last time this folder // was scanned (cachedScanDate) - if (table.getLastModifiedTime(file) > cachedScanDate) { + if (!cachedScanDate.isPresent() || table.getLastModifiedTime(file) > cachedScanDate.getAsLong()) { usedTests.addAll(updateFile(file)); } else { } @@ -1184,7 +1185,8 @@ // do this if the file seems to need rescanning, or we // don't seem to have an "old" TD - if (table.getLastModifiedTime(fileToScan) > lastScanDate || + if (!lastScanDate.isPresent() || + table.getLastModifiedTime(fileToScan) > lastScanDate.getAsLong() || oldTd == null) { // run the finder on the correct file // find the matching TD diff -Nru jtharness-6.0-b15/src/com/sun/javatest/util/FormattingUtils.java jtharness-6.0-b22/src/com/sun/javatest/util/FormattingUtils.java --- jtharness-6.0-b15/src/com/sun/javatest/util/FormattingUtils.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/javatest/util/FormattingUtils.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,74 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.sun.javatest.util; + +import java.util.Comparator; +import java.util.Map; +import java.util.TreeMap; + +/** + * Helper methods related to data formatting. + */ +public class FormattingUtils { + + /** + * Converts the given duration in seconds to a more readable string representation: + * for example "2 days 1 minute 4 seconds". + * This method doesn't generates weeks, months or years, only days + * which is expected to be sufficient for printing total time taken by even a long test run. + * + * @param durationSeconds the seconds to convert to human-readable form + * @return formatted representation, i.e. "1 hour 53 seconds" + */ + public static String formattedDuration(long durationSeconds) { + + if (durationSeconds < 1) { + return "0 seconds"; + } + String result = ""; + long remaining_seconds = durationSeconds; + // have to map duration to names to have durations sorted (TreeMap maintains order for keys) + TreeMap units = new TreeMap(Comparator.reverseOrder()) {{ + put(1L, "second"); + put(60L, "minute"); + put(60L * 60L, "hour"); + put(60L * 60L * 24L, "day"); + }}; + for (Map.Entry entry : units.entrySet()) { + long amount = remaining_seconds / entry.getKey(); + if (amount > 0 ) { + remaining_seconds = remaining_seconds % entry.getKey(); + result += " " + amount + " " + entry.getValue(); + if (amount > 1) { + result += "s"; + } + } + } + return result.trim(); + } +} diff -Nru jtharness-6.0-b15/src/com/sun/tck/lib/tgf/Values.java jtharness-6.0-b22/src/com/sun/tck/lib/tgf/Values.java --- jtharness-6.0-b15/src/com/sun/tck/lib/tgf/Values.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/src/com/sun/tck/lib/tgf/Values.java 2022-03-27 19:40:32.000000000 +0000 @@ -50,7 +50,7 @@ * @param objs array of objects to multiply with * @return resulting set of values */ - Values multiply(Object... objs); + Values multiply(T... objs); /** * A shortcut method. @@ -101,7 +101,7 @@ * @param objs array of objects to pseudoMultiply with * @return resulting set of values */ - Values pseudoMultiply(Object... objs); + Values pseudoMultiply(T... objs); /** * A shortcut method. @@ -204,7 +204,7 @@ * @param objs objects to unite with * @return resulting set of values */ - Values unite(Object... objs); + Values unite(T... objs); /** * A shortcut method. @@ -257,7 +257,7 @@ * @param objs set of values to intersect with * @return resulting set of values */ - Values intersect(Object... objs); + Values intersect(T... objs); /** * A shortcut method. diff -Nru jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/I18NDynamicMain.java jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/I18NDynamicMain.java --- jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/I18NDynamicMain.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/I18NDynamicMain.java 2022-03-27 19:40:32.000000000 +0000 @@ -49,7 +49,7 @@ String[] testArgs = new String[args.length - 3]; System.arraycopy(args, 3, testArgs, 0, testArgs.length); - HashMap tests = new HashMap(); + HashMap tests = new HashMap<>(); tests.put("com.sun.jct.utils.i18ncheck.javatest.exec.I18NExecTest", "com.sun.javatest.exec"); tests.put("com.sun.jct.utils.i18ncheck.interview.wizard.I18NWizTest", "com.sun.interview.wizard"); tests.put("com.sun.jct.utils.i18ncheck.javatest.agent.I18NAgentTest", "com.sun.javatest.agent"); @@ -69,7 +69,7 @@ deleteDir(wd); } - Vector vcmd = new Vector(); + Vector vcmd = new Vector<>(); vcmd.add(System.getProperty("java.home") + "/bin/java"); vcmd.add("-classpath"); @@ -92,7 +92,7 @@ vcmd.toArray(xargs); Process test = Runtime.getRuntime().exec(xargs); - HashSet keys = new HashSet(); + HashSet keys = new HashSet<>(); // InputStreamReader isr = new InputStreamReader(test.getErrorStream());//usefull for debug InputStreamReader isr = new InputStreamReader(test.getInputStream()); BufferedReader r = new BufferedReader(isr); @@ -172,4 +172,3 @@ private HashMap> table; private File dynamic; } - diff -Nru jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/I18NStaticChecker.java jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/I18NStaticChecker.java --- jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/I18NStaticChecker.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/I18NStaticChecker.java 2022-03-27 19:40:32.000000000 +0000 @@ -76,17 +76,17 @@ /** * The list of patterns to search methods which localize strings. */ - protected HashMap patterns = new HashMap(); + protected HashMap patterns = new HashMap<>(); - protected Vector vstatic = new Vector(); + protected Vector vstatic = new Vector<>(); - protected Vector newRules = new Vector(); + protected Vector newRules = new Vector<>(); /** * The list of source files to check. */ - protected ArrayList sources = new ArrayList(); + protected ArrayList sources = new ArrayList<>(); /** * The localization properties. */ @@ -94,7 +94,7 @@ /** * Property keys, collected during dynamic search */ - protected HashSet dynKeys = new HashSet(); + protected HashSet dynKeys = new HashSet<>(); /** @@ -128,9 +128,9 @@ } private void resetChecker() { - keys = new HashSet(); - rqnd = new HashSet(); - dfnr = new HashSet(); + keys = new HashSet<>(); + rqnd = new HashSet<>(); + dfnr = new HashSet<>(); } public void checkI18N() { @@ -200,7 +200,7 @@ Context context = new Context(); JavaCompiler compiler = new JavaCompiler(context); Object parsedTree = compiler.parse(source.getAbsolutePath()); - HashSet keys = new HashSet(); + HashSet keys = new HashSet<>(); Class parsedTreeClass = parsedTree.getClass(); Class visitorClass; Class stdVisitorClass; @@ -258,7 +258,7 @@ writeSet(dfnrFile, dfnr); File defdFile = new File(dir.getPath() + File.separator + "properties.defd"); - Set props = new HashSet(); + Set props = new HashSet<>(); for (Object o : properties.keySet()) { props.add((String)o); } @@ -420,7 +420,7 @@ } private boolean resolveCond(Cond cond, PerfEnvironment env) { - Vector results = new Vector(); + Vector results = new Vector<>(); boolean result = true; boolean argLRes = true; @@ -617,7 +617,7 @@ static String[] split(String text) { String[] lines = new String[0]; - Vector res = new Vector(); + Vector res = new Vector<>(); lines = text.split(System.getProperty("line.separator")); for (String line : lines) { diff -Nru jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/I18NStaticMain.java jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/I18NStaticMain.java --- jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/I18NStaticMain.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/I18NStaticMain.java 2022-03-27 19:40:32.000000000 +0000 @@ -48,7 +48,7 @@ String java_v = System.getProperty("java.specification.version"); java_version = "1.5".equals(java_v) ? JAVA_5 : JAVA_6; - exludeDirs = new HashSet(); + exludeDirs = new HashSet<>(); exludeDirs.add(".svn"); String srcRoot = ""; @@ -120,7 +120,7 @@ File tmpDir = new File(tmpRoot/* + File.separator + srcDir.getName()*/); if (propsFile.exists()) { - ArrayList javaFiles = new ArrayList(); + ArrayList javaFiles = new ArrayList<>(); for (File f : srcDir.listFiles()) { if (f.getName().endsWith(".java")) javaFiles.add(f); @@ -139,7 +139,7 @@ checker.setProperties(props); if (needMerge) { - HashSet dynKeys = new HashSet(); + HashSet dynKeys = new HashSet<>(); String dynKeyFile = tmpRoot + File.separator + mergeFileName; File dynFile = new File(dynKeyFile); @@ -198,7 +198,7 @@ private static HashSet readKeySet(File f) { try { - HashSet set = new HashSet(); + HashSet set = new HashSet<>(); BufferedReader r = new BufferedReader(new FileReader(f)); String str; while ( (str = r.readLine()) != null ) { diff -Nru jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/I18NVisitor15.java jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/I18NVisitor15.java --- jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/I18NVisitor15.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/I18NVisitor15.java 2022-03-27 19:40:32.000000000 +0000 @@ -58,7 +58,7 @@ super(); this.filename = filename; this.checker = checker; - this.rules = new Vector(checker.patterns.values()); + this.rules = new Vector<>(checker.patterns.values()); this.newRules = checker.newRules; } diff -Nru jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/I18NVisitor16.java jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/I18NVisitor16.java --- jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/I18NVisitor16.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/I18NVisitor16.java 2022-03-27 19:40:32.000000000 +0000 @@ -55,7 +55,7 @@ super(); this.filename = filename; this.checker = checker; - this.rules = new Vector(checker.patterns.values()); + this.rules = new Vector<>(checker.patterns.values()); this.newRules = checker.newRules; } diff -Nru jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/XMLNode.java jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/XMLNode.java --- jtharness-6.0-b15/tests/com/sun/jct/utils/i18ncheck/XMLNode.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/tests/com/sun/jct/utils/i18ncheck/XMLNode.java 2022-03-27 19:40:32.000000000 +0000 @@ -51,7 +51,7 @@ public Rule(Node rule) throws Exception { NodeList childs = rule.getChildNodes(); - Vector vcases = new Vector(); + Vector vcases = new Vector<>(); for (int i = 0; i < childs.getLength(); i++) { Node child = childs.item(i); String name = child.getNodeName(); @@ -130,14 +130,14 @@ public Case(Node ccase) throws Exception { - HashSet tags = new HashSet(); + HashSet tags = new HashSet<>(); tags.add("case"); tags.add("action"); tags.add("cond"); - final Vector ca = new Vector(); - final Vector a = new Vector(); - final Vector c = new Vector(); + final Vector ca = new Vector<>(); + final Vector a = new Vector<>(); + final Vector c = new Vector<>(); getChildsByTags(ccase, tags, new Callback() { public void construct(String tag, Node node) throws Exception { @@ -176,7 +176,7 @@ public Cond(Node cond) throws Exception { - HashSet tags = new HashSet(); + HashSet tags = new HashSet<>(); tags.add("methodName"); tags.add("argslength"); tags.add("arg"); @@ -184,12 +184,12 @@ tags.add("stringarg"); tags.add("intarg"); - final Vector mn = new Vector(); - final Vector al = new Vector(); - final Vector a = new Vector(); - final Vector c = new Vector(); - final Vector sa = new Vector(); - final Vector ia = new Vector(); + final Vector mn = new Vector<>(); + final Vector al = new Vector<>(); + final Vector a = new Vector<>(); + final Vector c = new Vector<>(); + final Vector sa = new Vector<>(); + final Vector ia = new Vector<>(); getChildsByTags(cond, tags, new Callback() { public void construct(String tag, Node node) throws Exception { @@ -449,7 +449,7 @@ public Vector elems; public GoToArg(Node arg) throws Exception { - elems = new Vector(); + elems = new Vector<>(); Element elem = (Element)arg; String content = retrieveText(elem); diff -Nru jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/algebra/Mixed.java jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/algebra/Mixed.java --- jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/algebra/Mixed.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/algebra/Mixed.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,1251 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.tck.lib.autd2.unittests.tgfported.algebra; + +import com.oracle.tck.lib.autd2.unittests.tgfported.ValuesImplSlow; +import com.oracle.tck.lib.autd2.unittests.TU; +import com.oracle.tck.lib.autd2.unittests.TestObject; +import com.oracle.tck.lib.autd2.unittests.ValuesComparison; +import com.sun.tck.lib.tgf.DataFactory; +import com.sun.tck.lib.tgf.TestData; +import com.sun.tck.lib.tgf.Values; +import com.sun.tck.test.TestCase; +import com.sun.tck.test.TestGroup; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; +import static org.mockito.Mockito.*; +import static com.sun.tck.lib.tgf.DataFactory.*; +import static org.junit.Assert.assertTrue; + + +public class Mixed { + + @Test + public void test_0() { + Values v_1 = createColumn(); + Values v_2 = createColumn("a"); + Values v_3 = createColumn("a", "b"); + + Values vfinal = v_3.pseudoMultiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a", "a"} ); + expected.add(new Object[] {"b", "a"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_012() { + Values v_1 = createColumn(); + Values v_2 = createColumn("a"); + + Values vfinal = (v_1.unite(v_2)).pseudoMultiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a", "a"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_013() { + Values v_1 = createColumn(); + Values v_2 = createColumn("a"); + Values v_3 = createColumn("a", "b"); + + Values vfinal = (v_1.unite(v_3)).pseudoMultiply(v_1.unite(v_3)); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a", "a"} ); + expected.add(new Object[] {"b", "b"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_0_03() { + Values v_1 = createColumn(); + Values v_2 = createColumn("a"); + Values v_3 = createColumn("a", "b"); + + Values vfinal = v_3.multiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a", "a"} ); + expected.add(new Object[] {"b", "a"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_0_003() { + Values v_1 = createColumn(); + Values v_2 = createColumn(); + Values v_3 = createColumn(); + + Values vfinal = v_3.multiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_00001() { + Values v_1 = createColumn(); + Values v_2 = createColumn(); + Values v_3 = createColumn("a", "b"); + + Values vfinal = v_3.pseudoMultiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_00002() { + Values v_1 = createColumn(); + Values v_2 = createColumn(); + Values v_3 = createColumn("a", "b"); + + Values vfinal = v_3.multiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_00003() { + Values v_1 = createColumn(); + Values v_2 = createColumn(); + Values v_3 = createColumn("a", "b"); + + Values vfinal = v_3.unite(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a"} ); + expected.add(new Object[] {"b"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_00004() { + Values v_1 = createColumn("a", "b"); + Values v_2 = createColumn(); + Values v_3 = createColumn(); + + Values vfinal = v_3.unite(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a"} ); + expected.add(new Object[] {"b"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_001() { + Values v_1 = createColumn("a"); + Values v_2 = createColumn(); + Values v_3 = createColumn("a", "b"); + + Values vfinal = v_3.pseudoMultiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a", "a"} ); + expected.add(new Object[] {"b", "a"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_00() { + Values v_1 = createColumn(); + Values v_2 = createColumn("a"); + Values v_3 = createColumn("a", "b"); + + // o1.with( o2.with(v1, v2), v3 ) + Values vfinal = v_1.unite(v_2).pseudoMultiply(v_3); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a", "a"} ); + expected.add(new Object[] {"a", "b"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_01() { + Values v_1 = createColumn("c"); + Values v_2 = createColumn("a"); + Values v_3 = createColumn("a", "b"); + + // o1.with( o2.with(v1, v2), v3 ) + Values vfinal = v_1.unite(v_2).pseudoMultiply(v_3); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"c", "a"} ); + expected.add(new Object[] {"a", "b"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_0_04() { + Values v_1 = createColumn(); + Values v_2 = createColumn("a"); + Values v_3 = createColumn("a", "b", "c"); + + Values vfinal = v_3.pseudoMultiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a", "a"} ); + expected.add(new Object[] {"b", "a"} ); + expected.add(new Object[] {"c", "a"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_0_01() { + Values v_2 = createColumn("a"); + Values v_3 = createColumn("a", "b"); + + Values vfinal = v_3.pseudoMultiply(unite(v_2)); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a", "a"} ); + expected.add(new Object[] {"b", "a"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_0_02() { + Values v_2 = createColumn("a"); + Values v_3 = createColumn("a", "b"); + + Values vfinal = v_3.pseudoMultiply(v_2); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a", "a"} ); + expected.add(new Object[] {"b", "a"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_0_0() { + Values v_1 = createColumn(); + Values v_2 = createColumn("a", "v"); + Values v_3 = createColumn("a", "b"); + + Values vfinal = v_3.pseudoMultiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + expected.add(new Object[] {"a", "a"} ); + expected.add(new Object[] {"b", "v"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_0_1() { + Values v_1 = createColumn(); + Values v_2 = createColumn("a"); + Values v_3 = createColumn(); + + Values vfinal = v_3.pseudoMultiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_0_2() { + Values v_1 = createColumn(); + Values v_2 = createColumn(); + Values v_3 = createColumn(); + + Values vfinal = v_3.pseudoMultiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_0_3() { + Values v_1 = createColumn(); + Values v_2 = createColumn(); + Values v_3 = createColumn("x"); + + Values vfinal = v_3.pseudoMultiply(v_1.unite(v_2)); + + List expected = new ArrayList<>(); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_0_4() { + Values v_1 = createColumn("a"); + Values v_2 = createColumn(); + Values v_3 = createColumn("x"); + + Values vfinal = v_3.pseudoMultiply(v_1.unite(v_2)); + List expected = new ArrayList<>(); + expected.add(new Object[] {"x", "a"} ); + ValuesComparison.compare(vfinal, expected); + + } + + @Test + public void test_1_1() { + Values values = createColumn(1, 2); + values = values.multiply(createColumn(3, 4)); + values = values.pseudoMultiply("a", "b", "c", "d"); + List expected = new ArrayList(); + expected.add(new Object[] {1, 3, "a"} ); + expected.add(new Object[] {1, 4, "b"} ); + expected.add(new Object[] {2, 3, "c"} ); + expected.add(new Object[] {2, 4, "d"} ); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_1_2() { + Values values_1 = createColumn("a", "b", "c", "d"); + Values values_2 = createColumn(1, 2).multiply( + createColumn(3, 4) + ); + List expected = new ArrayList(); + expected.add( new Object[] {"a", 1, 3} ); + expected.add( new Object[] {"b", 1, 4} ); + expected.add( new Object[] {"c", 2, 3} ); + expected.add( new Object[] {"d", 2, 4} ); + ValuesComparison.compare(values_1.pseudoMultiply(values_2), expected); + } + + @Test + public void test_1_2_withEmpty_1() { + Values values_1 = createColumn("a", "b", "c", "d"); + Values values_2 = createColumn(1, 2).multiply( + createColumn(3, 4) + ).multiply( createColumn() ); + List expected = new ArrayList(); + ValuesComparison.compare(values_1.pseudoMultiply(values_2), expected); + } + + @Test + public void test_withEmpty_1() { + Values values = createColumn("a").intersect().multiply("a"); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_5() { + Values values = createColumn().multiply().intersect("a"); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_5_implSlow() { + Values values = new ValuesImplSlow().multiply().intersect(new ValuesImplSlow("a")); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_1_implSlow() { + Values values = new ValuesImplSlow("a").intersect().multiply(new ValuesImplSlow("a")); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_2_implSlow() { + Values values = new ValuesImplSlow("a").intersect().pseudoMultiply(new ValuesImplSlow("a")); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_2() { + Values values = createColumn("a", "b").intersect().multiply("a"); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_3() { + Values values = createColumn("a", "b", "c").intersect().multiply("a"); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_4() { + Values values = createColumn("a", "b", "c").intersect().multiply("a", "b", "c"); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_40() { + Values values = createColumn("a", "b").multiply( createColumn().intersect("a") ); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_41() { + Values values = createColumn("b").multiply( createColumn().intersect("a") ); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_40_dumbImpl() { + Values values = new ValuesImplSlow("w").multiply( new ValuesImplSlow().intersect("a") ); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_withEmpty_41_dumbImpl() { + Values values = new ValuesImplSlow("w").pseudoMultiply( new ValuesImplSlow().intersect("a") ); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_50() { + Values values = new ValuesImplSlow("a").multiply("a").intersect(new ValuesImplSlow("a")); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_50_1() { + Values values = new ValuesImplSlow("a").multiply(); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_50_2() { + Values values = new ValuesImplSlow().multiply("a"); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_50_3() { + Values values = new ValuesImplSlow().pseudoMultiply("a"); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_50_4() { + Values values = new ValuesImplSlow("a").pseudoMultiply(); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_51() { + Values values = createColumn("a").multiply("a").intersect("a"); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + + + @Test + public void test_1_2_withEmpty_2() { + Values values_1 = createColumn("a", "b", "c", "d").pseudoMultiply(createRow()); + Values values_2 = createColumn(1, 2).multiply( + createColumn(3, 4) ).multiply( createColumn() ); + List expected = new ArrayList(); + ValuesComparison.compare(values_1.pseudoMultiply(values_2), expected); + } + + @Test + public void test_1_2_cached() { + Values values_1 = createColumn("a", "b", "c", "d"); + Values values_2 = createColumn(1, 2).multiply( + createColumn(3, 4) + ); + List expected = new ArrayList(); + expected.add( new Object[] {"a", 1, 3} ); + expected.add( new Object[] {"b", 1, 4} ); + expected.add( new Object[] {"c", 2, 3} ); + expected.add( new Object[] {"d", 2, 4} ); + ValuesComparison.compare(values_1.pseudoMultiply(values_2).createCache(), expected); + } + + @Test + public void testCombine_Diag_1() { + Values values = createColumn(1, 2); + values = values.multiply(createColumn(3, 4)); + values = values.pseudoMultiply(createColumn(3)); + List expected = new ArrayList(); + expected.add(new Object[] {1, 3, 3}); + expected.add(new Object[] {1, 4, 3}); + expected.add(new Object[] {2, 3, 3}); + expected.add(new Object[] {2, 4, 3}); + ValuesComparison.compare (values, expected); + } + + @Test + public void testCombine_Diag_1_cached() { + Values values = createColumn(1, 2); + values = values.multiply(createColumn(3, 4)); + values = values.pseudoMultiply(createColumn(3)); + List expected = new ArrayList(); + expected.add(new Object[]{1, 3, 3}); + expected.add(new Object[]{1, 4, 3}); + expected.add(new Object[]{2, 3, 3}); + expected.add(new Object[]{2, 4, 3}); + ValuesComparison.compare(values.createCache(), expected); + } + + @Test + public void testCombine_Diag_2() { + Values values = createColumn(1, 2); + values = values.multiply(createColumn(3, 4)); + values = values.pseudoMultiply(createColumn(67, 45, 79, 13)); + List expected = new ArrayList(); + expected.add(new Object[]{1, 3, 67}); + expected.add(new Object[]{1, 4, 45}); + expected.add(new Object[]{2, 3, 79}); + expected.add(new Object[]{2, 4, 13}); + ValuesComparison.compare(values, expected); + } + + @Test + + public void test_Combine_Diag_Combine() { + Values values_1 = createColumn(1, 2); + values_1 = values_1.multiply(createColumn(3, 4)); + + Values values_2 = createColumn(6, 7); + values_2 = values_2.multiply(createColumn(8, 9)); + + Values result = values_1.pseudoMultiply(values_2); + + List expected = new ArrayList(); + expected.add(new Object[]{1, 3, 6, 8}); + expected.add(new Object[]{1, 4, 6, 9}); + expected.add(new Object[]{2, 3, 7, 8}); + expected.add(new Object[]{2, 4, 7, 9}); + ValuesComparison.compare(result, expected); + } + + @Test + public void testDiag_Combine_1() { + Values values = createColumn(1, 2); + values = values.pseudoMultiply(createColumn(3, 4)); + values = values.multiply(createColumn(7, 8)); + List expected = new ArrayList(); + expected.add(new Object[]{1, 3, 7}); + expected.add(new Object[]{1, 3, 8}); + expected.add(new Object[]{2, 4, 7}); + expected.add(new Object[]{2, 4, 8}); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_Combine_2_1() { + Values vs1 = createColumn("a", "b", "c", "d", "e"); + Values vs2 = createColumn("x", "y", "z"); + Values vs3 = createColumn(1); + Values vs4 = createColumn(new TestObject("2")); + + List expected = new ArrayList(); + expected.add(new Object[]{"a", "x", 1, new TestObject("2")}); + expected.add(new Object[]{"b", "y", 1, new TestObject("2")}); + expected.add(new Object[]{"c", "z", 1, new TestObject("2")}); + expected.add(new Object[]{"d", "x", 1, new TestObject("2")}); + expected.add(new Object[]{"e", "y", 1, new TestObject("2")}); + ValuesComparison.compare(vs1.pseudoMultiply(vs2).multiply(vs3).pseudoMultiply(vs4), expected); + } + + @Test + public void testDiag_Combine_2_2() { + Values vs1 = createColumn("a", "b", "c", "d", "e"); + Values vs2 = createColumn("x", "y", "z"); + Values vs3 = createColumn(1).pseudoMultiply(new TestObject("2")); + + List expected = new ArrayList(); + expected.add(new Object[]{"a", "x", 1, new TestObject("2")}); + expected.add(new Object[]{"b", "y", 1, new TestObject("2")}); + expected.add(new Object[]{"c", "z", 1, new TestObject("2")}); + expected.add(new Object[]{"d", "x", 1, new TestObject("2")}); + expected.add(new Object[]{"e", "y", 1, new TestObject("2")}); + ValuesComparison.compare(vs1.pseudoMultiply(vs2).multiply(vs3), expected); + } + + @Test + public void testDiag_Combine_2_3() { + Values vs1 = createColumn("a", "b", "c", "d", "e"); + Values vs2 = createColumn("x", "y", "z"); + Values vs3 = createColumn(1).pseudoMultiply(new TestObject("2")); + + List expected = new ArrayList(); + expected.add(new Object[]{"a", "x", 1, new TestObject("2")}); + expected.add(new Object[]{"b", "y", 1, new TestObject("2")}); + expected.add(new Object[]{"c", "z", 1, new TestObject("2")}); + expected.add(new Object[]{"d", "x", 1, new TestObject("2")}); + expected.add(new Object[]{"e", "y", 1, new TestObject("2")}); + ValuesComparison.compare(vs1.pseudoMultiply(vs2).pseudoMultiply(vs3), expected); + } + + @Test + public void testDiag_Combine_2_3_cached() { + Values vs1 = createColumn("a", "b", "c", "d", "e"); + Values vs2 = createColumn("x", "y", "z"); + Values vs3 = createColumn(1).pseudoMultiply(new TestObject("2")); + + List expected = new ArrayList(); + expected.add(new Object[]{"a", "x", 1, new TestObject("2")}); + expected.add(new Object[]{"b", "y", 1, new TestObject("2")}); + expected.add(new Object[]{"c", "z", 1, new TestObject("2")}); + expected.add(new Object[]{"d", "x", 1, new TestObject("2")}); + expected.add(new Object[]{"e", "y", 1, new TestObject("2")}); + ValuesComparison.compare(vs1.pseudoMultiply(vs2).pseudoMultiply(vs3).createCache(), expected); + } + + + + + @org.junit.Test + public void test_1() { + + final MyClass instance = mock(MyClass.class); + + @TestGroup + class MyTest { + + private Values setup() { + return createColumn("i_1", "i_2", "i_3").pseudoMultiply("j_1", "j_2", "j_3"); + } + + @TestCase + @TestData("setup") + public void test(String s1, String s2) { + instance.method_1(s1, s2); + } + } + + final com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + + assertTrue(status.isOK()); + + verify(instance).method_1("i_1", "j_1"); + verify(instance).method_1("i_2", "j_2"); + verify(instance).method_1("i_3", "j_3"); + verifyNoMoreInteractions(instance); + } + + @org.junit.Test + public void test_1_Multiplication() { + + final MyClass instance = mock(MyClass.class); + + @TestGroup + class MyTest { + + private Values setup() { + return createColumn("i_1", "i_2", "i_3").multiply("j_1", "j_2", "j_3"); + } + + @TestData("setup") + @TestCase + public void test(String s1, String s2) { + instance.method_1(s1, s2); + } + } + + + final com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + System.out.println("status = " + status); + assertTrue(status.isOK()); + + verify(instance).method_1("i_1", "j_1"); + verify(instance).method_1("i_1", "j_2"); + verify(instance).method_1("i_1", "j_3"); + verify(instance).method_1("i_2", "j_1"); + verify(instance).method_1("i_2", "j_2"); + verify(instance).method_1("i_2", "j_3"); + verify(instance).method_1("i_3", "j_1"); + verify(instance).method_1("i_3", "j_2"); + verify(instance).method_1("i_3", "j_3"); + verifyNoMoreInteractions(instance); + + } + + @org.junit.Test + public void test_2() { + + final MyClass mock = mock(MyClass.class); + + @TestGroup + class MyTest { + + private Values setup() { + return createColumn("i1", "i2", "i3", "i4").pseudoMultiply("j1", "j2", "j3", "j4").pseudoMultiply("k1", "k2", "k3", "k4"); + } + + @TestCase + @TestData("setup") + public void test(String s1, String s2, String s3) { + mock.method_2(s1, s2, s3); + } + } + + final com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + System.out.println("status = " + status); + assertTrue(status.isOK()); + + verify(mock).method_2("i1", "j1", "k1"); + verify(mock).method_2("i2", "j2", "k2"); + verify(mock).method_2("i3", "j3", "k3"); + verify(mock).method_2("i4", "j4", "k4"); + verifyNoMoreInteractions(mock); + + } + + @org.junit.Test + public void test_binded_together() { + + final MyClass mock = mock(MyClass.class); + + @TestGroup + class MyTest { + + private Values setup() { + return createColumn("i1", "i2", "i3").multiply("j1", "j2", "j3").pseudoMultiply("k1", "k2", "k3"); + } + + @TestCase + @TestData("setup") + public void test(String s1, String s2, String s3) { + mock.method_2(s1, s2, s3); + } + } + + + final com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + System.out.println("status = " + status); + assertTrue(status.isOK()); + verify(mock).method_2("i1", "j1", "k1"); + verify(mock).method_2("i1", "j2", "k2"); + verify(mock).method_2("i1", "j3", "k3"); + verify(mock).method_2("i2", "j1", "k1"); + verify(mock).method_2("i2", "j2", "k2"); + verify(mock).method_2("i2", "j3", "k3"); + verify(mock).method_2("i3", "j1", "k1"); + verify(mock).method_2("i3", "j2", "k2"); + verify(mock).method_2("i3", "j3", "k3"); + verifyNoMoreInteractions(mock); + + } + + + @org.junit.Test + public void test_binded_together_2() { + + final MyClass mock = mock(MyClass.class); + + @TestGroup + class MyTest { + + private Values setup() { + return createColumn("i1", "i2", "i3").pseudoMultiply("j1", "j2", "j3").pseudoMultiply("k1", "k2", "k3").multiply("n1", "n2", "n3"); + } + + @TestCase + @TestData("setup") + public void test(String s1, String s2, String s3, String s4) { + mock.method_3(s1, s2, s3, s4); + } + } + + final com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + System.out.println("status = " + status); + assertTrue(status.isOK()); + + verify(mock).method_3("i1", "j1", "k1", "n1"); + verify(mock).method_3("i1", "j1", "k1", "n2"); + verify(mock).method_3("i1", "j1", "k1", "n3"); + verify(mock).method_3("i2", "j2", "k2", "n1"); + verify(mock).method_3("i2", "j2", "k2", "n2"); + verify(mock).method_3("i2", "j2", "k2", "n3"); + verify(mock).method_3("i3", "j3", "k3", "n1"); + verify(mock).method_3("i3", "j3", "k3", "n2"); + verify(mock).method_3("i3", "j3", "k3", "n3"); + verifyNoMoreInteractions(mock); + + } + + + @org.junit.Test + public void test_binded_with_merge_ann_use() { + + final MyClass mock = mock(MyClass.class); + + @TestGroup + class MyTest { + + private Values setup_1() { + return createColumn("i1", "i2", "i3").pseudoMultiply("j1", "j2", "j3").unite( + createColumn("k1", "k2", "k3").pseudoMultiply("n1", "n2", "n3") + ); + } + + @TestCase + @TestData("setup_1") + public void test(String s1, String s2) { + mock.method_1(s1, s2); + } + } + + final com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + System.out.println("status = " + status); + assertTrue(status.isOK()); + + verify(mock).method_1("i1", "j1"); + verify(mock).method_1("i2", "j2"); + verify(mock).method_1("i3", "j3"); + verify(mock).method_1("k1", "n1"); + verify(mock).method_1("k2", "n2"); + verify(mock).method_1("k3", "n3"); + verifyNoMoreInteractions(mock); + } + + @org.junit.Test + public void test_binded_with_merge_ann_use_noMult() { + + final MyClass mock = mock(MyClass.class); + + @TestGroup + class MyTest { + + private Values setup_1() { + return createColumn("i1", "i2", "i3").pseudoMultiply("j1", "j2", "j3").unite( + createColumn("k1", "k2", "k3").pseudoMultiply("n1", "n2", "n3") + ); + } + + @TestCase + @TestData("setup_1") + public void test(String s1, String s2) { + mock.method_1(s1, s2); + } + } + + final com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + + assertTrue(status.isOK()); + + verify(mock).method_1("i1", "j1"); + verify(mock).method_1("i2", "j2"); + verify(mock).method_1("i3", "j3"); + verify(mock).method_1("k1", "n1"); + verify(mock).method_1("k2", "n2"); + verify(mock).method_1("k3", "n3"); + verifyNoMoreInteractions(mock); + } + + @org.junit.Test + public void test_binded_with_merge_ann_use_ArrayOfObjects() { + + final MyClass mock = mock(MyClass.class); + + @TestGroup + class MyTest { + + private Values setup_1() { + return createValues(new Object[][] { + {"i1", "j1"}, + {"i2", "j2"}, + {"i3", "j3"} + }).unite(createValues(new Object[][] { + {"k1", "n1"}, + {"k2", "n2"}, + {"k3", "n3"} + })); + } + + @TestCase + @TestData("setup_1") + public void test(String s1, String s2) { + mock.method_1(s1, s2); + } + } + + + + final com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + assertTrue(status.isOK()); + + verify(mock).method_1("i1", "j1"); + verify(mock).method_1("i2", "j2"); + verify(mock).method_1("i3", "j3"); + verify(mock).method_1("k1", "n1"); + verify(mock).method_1("k2", "n2"); + verify(mock).method_1("k3", "n3"); + + + } + + @org.junit.Test + public void test_InvalidArgSetsLength() { + + final MyClass mock = mock(MyClass.class); + + @TestGroup + class MyTest { + + private Values setup() { + return createColumn("i1", "i2", "i3", "i4").pseudoMultiply("j1", "j2").pseudoMultiply("k1", "k2", "k4"); + } + + @TestCase + @TestData("setup") + public void test(String s1, String s2, String s3) { + mock.method_2(s1, s2, s3); + } + } + + + TU.runTestGroup(new MyTest()); + + // this is enough + verify(mock).method_2("i1", "j1", "k1"); + verify(mock).method_2("i2", "j2", "k2"); + + } + + private interface MyClass { + void method_1(String s1, String s2); + void method_2(String s1, String s2, String s3); + void method_3(String s1, String s2, String s3, String s4); + } + + @Test + public void testDiag_pseudoMult_intersect_1() { + Values values = pseudoMultiply( + createColumn(1), + createColumn(1,2,3,4,5,6).intersect(2,3), + createColumn(3,4,5).pseudoMultiply(6,7,8,9), + createColumn(1,2,3,4,5).pseudoMultiply("a","b","c","d").pseudoMultiply("x","y","z"), + createColumn(0,1).pseudoMultiply(115) + ); + List expected = new ArrayList(); + expected.add(new Object[] {1, 2, 3, 6, 1, "a", "x", 0, 115}); + expected.add(new Object[] {1, 3, 4, 7, 2, "b", "y", 1, 115}); + expected.add(new Object[] {1, 2, 5, 8, 3, "c", "z", 0, 115}); + expected.add(new Object[] {1, 3, 3, 9, 4, "d", "x", 1, 115}); + expected.add(new Object[] {1, 2, 3, 6, 5, "a", "y", 0, 115}); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_2() { + Values values = pseudoMultiply( + createColumn(1,2,3,4,5,6).intersect(2,3), + createColumn(4,5,6,7,8,9,10) + ); + List expected = new ArrayList(); + expected.add(new Object[] {2, 4}); + expected.add(new Object[] {3, 5}); + expected.add(new Object[] {2, 6}); + expected.add(new Object[] {3, 7}); + expected.add(new Object[] {2, 8}); + expected.add(new Object[] {3, 9}); + expected.add(new Object[] {2, 10}); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_3() { + Values values = pseudoMultiply( + createColumn(1), + createColumn(1,2,3,4,5,6).intersect(2,3), + createColumn(4,5,6,7) + ); + List expected = new ArrayList(); + expected.add(new Object[] {1, 2, 4}); + expected.add(new Object[] {1, 3, 5}); + expected.add(new Object[] {1, 2, 6}); + expected.add(new Object[] {1, 3, 7}); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_4() { + Values values = pseudoMultiply( + createColumn(1), + createColumn(1,2,3,4,5,6).intersect(2,3).intersect(2), + createColumn(4,5,6,7) + ); + List expected = new ArrayList(); + expected.add(new Object[] {1, 2, 4}); + expected.add(new Object[] {1, 2, 5}); + expected.add(new Object[] {1, 2, 6}); + expected.add(new Object[] {1, 2, 7}); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_5() { + Values values = pseudoMultiply( + createColumn(1), + createColumn(1,2,3,4,5,6).intersect(2,3).intersect(2).intersect(999), + createColumn(4,5,6,7) + ); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_6() { + Values values = pseudoMultiply( + createColumn(1), + createColumn(1,2,3,4,5,6).intersect(2,3).intersect(2).intersect(999), + createColumn(4,5,6,7) + ).multiply( createColumn(56, 67, 89).intersect(67) ); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_7() { + Values values = pseudoMultiply( + createColumn(1), + createColumn(1,2,3,4,5,6).intersect(2,3).intersect(2).intersect(999), + createColumn(4,5,6,7) + ).multiply( createColumn(56, 67, 89).intersect(67) ).pseudoMultiply(5, 8); + values = createColumn(6).pseudoMultiply(values); + values = values.pseudoMultiply( + createColumn(7).intersect(7).intersect(7) + ); + List expected = new ArrayList(); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_8() { + Values values = pseudoMultiply( + createColumn(1).intersect(1).pseudoMultiply(8, 9), + createColumn(4,5,6).multiply(3).pseudoMultiply(6, 7), + createColumn("a", "b", "c", "d") + ); + + List expected = new ArrayList(); + expected.add(new Object[] { 1, 8, 4, 3, 6, "a" }); + expected.add(new Object[] { 1, 9, 5, 3, 7, "b" }); + expected.add(new Object[] { 1, 8, 6, 3, 6, "c" }); + expected.add(new Object[] { 1, 8, 4, 3, 6, "d" }); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_9() { + Values values = pseudoMultiply( + createColumn(6, 1, 9).intersect(1).pseudoMultiply(8, 9).unite(createRow(5, 6)), + createColumn(8, 6, 7, 9, 10, 11, 12) + ); + List expected = new ArrayList(); + expected.add(new Object[] { 1, 8, 8 }); + expected.add(new Object[] { 1, 9, 6 }); + expected.add(new Object[] { 5, 6, 7 }); + expected.add(new Object[] { 1, 8, 9 }); + expected.add(new Object[] { 1, 9, 10 }); + expected.add(new Object[] { 5, 6, 11 }); + expected.add(new Object[] { 1, 8, 12 }); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_10() { + Values values = + createRow(1, 9, 6).unite(createRow(5, 6, 11)).intersect( + pseudoMultiply( + createColumn(6, 1, 9).intersect(1).pseudoMultiply(8, 9).unite(createRow(5, 6)), + createColumn(8, 6, 7, 9, 10, 11, 12) + ) + ); + List expected = new ArrayList(); + expected.add(new Object[] { 1, 9, 6 }); + expected.add(new Object[] { 5, 6, 11 }); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_11() { + Values values = + createRow(1, 9, 6).unite(createRow(5, 6, 11)).intersect( + pseudoMultiply( createColumn(6, 1, 9).intersect(1).pseudoMultiply(8, 9).unite(createRow(5, 6)), + createColumn(8, 6, 7, 9, 10, 11, 12) + ) + ); + values = createColumn(5,6,7).pseudoMultiply(values); + List expected = new ArrayList(); + expected.add(new Object[] { 5, 1, 9, 6 }); + expected.add(new Object[] { 6, 5, 6, 11 }); + expected.add(new Object[] { 7, 1, 9, 6 }); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_12() { + Values values = + createRow(1, 9, 6).unite(createRow(5, 6, 11)).intersect( + createRow(1,9,6).unite(createRow(4,5,7)).unite(createRow(5, 6, 11)) + ); + values = createColumn(5,6,7).pseudoMultiply(values); + List expected = new ArrayList(); + expected.add(new Object[] { 5, 1, 9, 6 }); + expected.add(new Object[] { 6, 5, 6, 11 }); + expected.add(new Object[] { 7, 1, 9, 6 }); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_13() { + Values values = + createRow(1, 9, 6).unite(createRow(5, 6, 11)).intersect( + pseudoMultiply( createColumn(1, 5).pseudoMultiply(9, 6).pseudoMultiply(6, 11)) + ); + values = createColumn(5,6,7).pseudoMultiply(values); + List expected = new ArrayList(); + expected.add(new Object[] { 5, 1, 9, 6 }); + expected.add(new Object[] { 6, 5, 6, 11 }); + expected.add(new Object[] { 7, 1, 9, 6 }); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_14() { + Values values = + createRow(1, 9, 6).unite(createRow(5, 6, 11)).intersect( + pseudoMultiply( createColumn(6, 1, 9).intersect(1).pseudoMultiply(8, 9).unite(createRow(5, 6)), + createColumn(8, 6, 7, 9, 10, 11, 12) + ) + ); + values = createColumn(5,6,7).pseudoMultiply(values); + List expected = new ArrayList(); + expected.add(new Object[] { 5, 1, 9, 6 }); + expected.add(new Object[] { 6, 5, 6, 11 }); + expected.add(new Object[] { 7, 1, 9, 6 }); + ValuesComparison.compare(values, expected); + } + + + @Test + public void testDiag_pseudoMult_intersect_15() { + Values values = + createRow(1, 9).unite(createRow(5, 6)).intersect( + pseudoMultiply( createColumn(6, 1, 9).intersect(1).pseudoMultiply(8, 9).unite(createRow(5, 6)) + ) + ); + values = createColumn(5,6,7,8).pseudoMultiply(values); + List expected = new ArrayList(); + expected.add(new Object[] { 5, 1, 9 }); + expected.add(new Object[] { 6, 5, 6 }); + expected.add(new Object[] { 7, 1, 9 }); + expected.add(new Object[] { 8, 5, 6 }); + ValuesComparison.compare(values, expected); + } + + + @Test + public void testDiag_pseudoMult_intersect_16() { + Values values = + createRow(1, 9).unite(createRow(5, 6)).intersect( + pseudoMultiply( + createColumn(1).unite(9).unite(5), + createColumn(9, 6, 6, 9, 10, 11, 12) + ) + ); + values = createColumn(5,6,7,8).pseudoMultiply(values); + List expected = new ArrayList(); + expected.add(new Object[] { 5, 1, 9}); + expected.add(new Object[] { 6, 5, 6}); + expected.add(new Object[] { 7, 1, 9}); + expected.add(new Object[] { 8, 5, 6}); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_17() { + Values values = createRow(1, 9).unite(createRow(5, 6)) + .intersect( + pseudoMultiply( + createColumn(1,9,5), + createColumn(99, 6, 6, 9, 10, 11, 12) + ) + ); + List expected = new ArrayList(); + expected.add(new Object[] { 1, 9}); + expected.add(new Object[] { 5, 6}); + ValuesComparison.compare(values, expected); + } + + @Test + public void testDiag_pseudoMult_intersect_18() { + Values values = createColumn("a", "b").pseudoMultiply(1,2,3).pseudoMultiply(4,5,6,7,8,9) + .intersect(createRow("a", 3, 6).unite(createRow("b", 2, 5)).unite(createRow("b", 89, 56)) ); + values = pseudoMultiply(values); + List expected = new ArrayList(); + expected.add(new Object[] { "b", 2, 5}); + expected.add(new Object[] { "a", 3, 6}); + ValuesComparison.compare(values, expected); + } + + @Test + public void test_mult_impl_implSlow() { + Values values = DataFactory.createColumn(1).multiply(new ValuesImplSlow("a")); + List expected = new ArrayList<>(); + expected.add(new Object[]{ 1, "a" }); + ValuesComparison.compare(values, expected); + } +} diff -Nru jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/algebra/PseudoMultiply.java jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/algebra/PseudoMultiply.java --- jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/algebra/PseudoMultiply.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/algebra/PseudoMultiply.java 2022-03-27 19:40:32.000000000 +0000 @@ -92,7 +92,7 @@ @Test public void testDiag_cachedTheSame_1() { Values values = createColumn(1, 2, 7, 8, 9); - values = values.pseudoMultiply("12", "a", "b", "c", "e", 4, 435); + values = values.pseudoMultiply("12", "a", "b", "c", "e", 4, 435); ValuesComparison.checkCachedReturnsTheSame(values); } diff -Nru jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/beforeafter/TestAfter.java jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/beforeafter/TestAfter.java --- jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/beforeafter/TestAfter.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/beforeafter/TestAfter.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,698 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.tck.lib.autd2.unittests.tgfported.beforeafter; + +import com.oracle.tck.lib.autd2.TestResult; +import com.oracle.tck.lib.autd2.unittests.TU; +import com.sun.tck.lib.tgf.DataFactory; +import com.sun.tck.lib.tgf.TestData; +import com.sun.tck.lib.tgf.Values; +import com.sun.tck.test.TestCase; +import com.sun.tck.test.TestGroup; +import org.junit.Assert; +import org.junit.Test; +import org.mockito.InOrder; + +import java.io.PrintWriter; + +import static com.oracle.tck.lib.autd2.unittests.tgfported.beforeafter.TestAfter.ExceptionThrownFromAfter.RANDOM; +import static org.junit.Assert.*; +import static org.mockito.Mockito.inOrder; +import static org.mockito.Mockito.verifyNoMoreInteractions; + +public class TestAfter { + + @Test + public void afterWasCalled() { + + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new TestAfter.Mytest() { + + private void myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + } + + @TestCase // this is optional + @TestData("setup") + @com.sun.tck.lib.tgf.After("myAfter") + public void test(int i) { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, afterCounter[0]); + Assert.assertEquals( + "Passed. test cases: 1; all passed", + status.toString()); + } + + @Test + public void afterWasCalled_NoParams() { + + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new TestAfter.Mytest() { + + private void myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + } + + @TestCase + @com.sun.tck.lib.tgf.After("myAfter") + public void test() { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(1, counter[0]); + assertEquals(1, afterCounter[0]); + Assert.assertEquals( + "Passed. test cases: 1; all passed", + status.toString()); + } + + @Test + public void afterOfNonVoidTypeWasCalled() { + + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new TestAfter.Mytest() { + + private IllegalArgumentException myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + return new IllegalArgumentException(); + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.After("myAfter") + public void test(int i) { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, afterCounter[0]); + } + + @Test + public void afterOfNonVoidTypeWasCalled_NoParams() { + + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new TestAfter.Mytest() { + + private Class myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + return Runtime.class; + } + + @TestCase + @com.sun.tck.lib.tgf.After("myAfter") + public void test() { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(1, counter[0]); + assertEquals(1, afterCounter[0]); + } + + @Test + public void afterThrowsException() { + + PrintWriter log = TU.createMockedPrintWriter(); + PrintWriter ref = TU.createMockedPrintWriter(); + + + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + + TestResult status = TU.runTestGroup(new TestAfter.Mytest() { + + private void myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + throw new ExceptionThrownFromAfter(); + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.After("myAfter") + public void test(int i) { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + } + , log, ref, TU.EMPTY_ARGV + ); + assertTrue(!status.isOK()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, afterCounter[0]); + + InOrder inOrder = inOrder(log, ref); + inOrder.verify(log).println("Haha - this is overriden printStackTrace " + RANDOM); + inOrder.verify(log).println("Method \"myAfter\" has thrown an exception com.oracle.tck.lib.autd2.unittests.tgfported.beforeafter.TestAfter$ExceptionThrownFromAfter: This exception is thrown from After " + + RANDOM); + inOrder.verify(log).println("test: Failed. Failed trying to invoke @After method \"myAfter\""); + inOrder.verify(log).flush(); + inOrder.verify(ref).flush(); + verifyNoMoreInteractions(log, ref); + } + + @Test + public void afterThrowsException_nullOutput() { + + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + + TestResult status = TU.runTestGroup(new TestAfter.Mytest() { + + private void myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + throw new ExceptionThrownFromAfter(); + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.After("myAfter") + public void test(int i) { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, null, null, TU.EMPTY_ARGV); + assertTrue(!status.isOK()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, afterCounter[0]); + } + + @Test + public void afterThrowsException_NoParams() { + + PrintWriter log = TU.createMockedPrintWriter(); + PrintWriter ref = TU.createMockedPrintWriter(); + + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + TestResult status = TU.runTestGroup(new TestAfter.Mytest() { + + private void myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + throw new ExceptionThrownFromAfter(); + } + + @TestCase + @com.sun.tck.lib.tgf.After("myAfter") + public void test() { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + } + , log, ref, TU.EMPTY_ARGV + ); + assertTrue(!status.isOK()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(1, counter[0]); + assertEquals(1, afterCounter[0]); + + + InOrder inOrder = inOrder(log, ref); + inOrder.verify(log).println("Haha - this is overriden printStackTrace " + RANDOM); + inOrder.verify(log).println("Method \"myAfter\" has thrown an exception com.oracle.tck.lib.autd2.unittests.tgfported.beforeafter.TestAfter$ExceptionThrownFromAfter: This exception is thrown from After " + + RANDOM); + inOrder.verify(log).println("test: Failed. Failed trying to invoke @After method \"myAfter\""); + inOrder.verify(log).flush(); + inOrder.verify(ref).flush(); + verifyNoMoreInteractions(log, ref); + + } + + @Test + public void afterCalledOnce() { + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new TestAfter.Mytest() { + protected Values mySetup() { + return DataFactory.createColumn(1, 2, 3); + } + + private void myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + // to be sure that it was called only once + org.junit.Assert.assertFalse(afterCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + } + + @TestCase + @TestData("mySetup") + @com.sun.tck.lib.tgf.After("myAfter") + public void test(int i) { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, afterCounter[0]); + } + + @Test + public void inheritingAfter() { + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + PredefinedAfter testInstance = new PredefinedAfter() { + protected Values mySetup() { + return DataFactory.createColumn(1, 2, 3); + } + + @TestCase + @TestData("mySetup") + @com.sun.tck.lib.tgf.After("after") + public void test(int i) { + methodCalled[0] = true; + counter[0]++; + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(testInstance, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(testInstance.initialAfterWasCalled); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + } + + @Test + public void inheritingAfter_NoParams() { + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + PredefinedAfter testInstance = new PredefinedAfter() { + @TestCase + @com.sun.tck.lib.tgf.After("after") + public void test() { + methodCalled[0] = true; + counter[0]++; + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(testInstance, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(testInstance.initialAfterWasCalled); + assertTrue(methodCalled[0]); + assertEquals(1, counter[0]); + } + + @Test + public void overridingAfter() { + final boolean[] newAfterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + PredefinedAfter testInstance = new PredefinedAfter() { + protected Values mySetup() { + return DataFactory.createColumn(1, 2, 3); + } + + protected void after() { + org.junit.Assert.assertTrue(methodCalled[0]); + // to be sure that it was called only once + org.junit.Assert.assertFalse(newAfterCalled[0]); + newAfterCalled[0] = true; + afterCounter[0]++; + } + + @TestCase + @TestData("mySetup") + @com.sun.tck.lib.tgf.After("after") + public void test(int i) { + org.junit.Assert.assertFalse(newAfterCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(testInstance, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(newAfterCalled[0]); + assertFalse(testInstance.initialAfterWasCalled); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, afterCounter[0]); + } + + @Test + public void afterNotFound() { + + PrintWriter log = TU.createMockedPrintWriter(); + PrintWriter ref = TU.createMockedPrintWriter(); + + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + + TestResult status = TU.runTestGroup(new TestAfter.Mytest() { + protected Values mySetup() { + return DataFactory.createColumn(1, 2, 3); + } + + @TestCase + @TestData("mySetup") + @com.sun.tck.lib.tgf.After("myAfterThatDoesnotExist") + public void test(int i) { + methodCalled[0] = true; + counter[0]++; + } + } + , log, ref, TU.EMPTY_ARGV + ); + assertTrue(!status.isOK()); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + + InOrder inOrder = inOrder(log, ref); + inOrder.verify(log).println("Method \"myAfterThatDoesnotExist\" doesn't exist."); + inOrder.verify(log).println("test: Failed. Failed trying to invoke @After method \"myAfterThatDoesnotExist\""); + inOrder.verify(log).flush(); + inOrder.verify(ref).flush(); + verifyNoMoreInteractions(log, ref); + + } + + @Test + public void afterNotFound_NoParams() { + + PrintWriter log = TU.createMockedPrintWriter(); + PrintWriter ref = TU.createMockedPrintWriter(); + + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + + TestResult status = TU.runTestGroup(new TestAfter.Mytest() { + @TestCase + @com.sun.tck.lib.tgf.After("myAfterThatDoesnotExist") + public void test() { + methodCalled[0] = true; + counter[0]++; + } + } + , log, ref, TU.EMPTY_ARGV + ); + assertTrue(!status.isOK()); + assertTrue(methodCalled[0]); + assertEquals(1, counter[0]); + + + InOrder inOrder = inOrder(log, ref); + inOrder.verify(log).println("Method \"myAfterThatDoesnotExist\" doesn't exist."); + inOrder.verify(log).println("test: Failed. Failed trying to invoke @After method \"myAfterThatDoesnotExist\""); + inOrder.verify(log).flush(); + inOrder.verify(ref).flush(); + verifyNoMoreInteractions(log, ref); + + + } + + @Test + public void invalidSignature() { + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new TestAfter.Mytest() { + protected Values mySetup() { + return DataFactory.createColumn(1, 2, 3); + } + + protected boolean afterWithInvalidSignature(int i, int j) { + org.junit.Assert.assertTrue(methodCalled[0]); + // to be sure that it was called only once + return true; + } + + @TestCase + @TestData("mySetup") + @com.sun.tck.lib.tgf.After("afterWithInvalidSignature") + public void test(int i) { + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(!status.isOK()); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + } + + @Test + public void ifTestThrowsExceptionAfterIsNotCalled() { + + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new TestAfter.Mytest() { + + private void myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.After("myAfter") + public void test(int i) { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + throw new RuntimeException("Thrown from test"); + } + }, TU.EMPTY_ARGV); + assertFalse(status.isOK()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, afterCounter[0]); + } + + @Test + public void ifTestThrowsExceptionAfterIsNotCalled_NoParams() { + + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new TestAfter.Mytest() { + + private void myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + } + + @TestCase + @com.sun.tck.lib.tgf.After("myAfter") + public void test() { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + throw new RuntimeException("Thrown from test"); + } + }, TU.EMPTY_ARGV); + assertFalse(status.isOK()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(1, counter[0]); + assertEquals(1, afterCounter[0]); + } + + @Test + public void runtimeSkippingFromAfter_testPasses() { + + final boolean[] afterCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] afterCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new TestAfter.Mytest() { + protected Values mySetup() { + return DataFactory.createColumn(1, 2, 3); + } + + private void myAfter() { + org.junit.Assert.assertTrue(methodCalled[0]); + // to be sure that it was called only once + org.junit.Assert.assertFalse(afterCalled[0]); + afterCalled[0] = true; + afterCounter[0]++; + com.sun.tck.lib.Assert.reportNotApplicable(true); + } + + @TestCase + @TestData("mySetup") + @com.sun.tck.lib.tgf.After("myAfter") + public void test(int i) { + org.junit.Assert.assertFalse(afterCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertEquals("test cases: 1; all not applicable", status.getMessage()); + assertTrue(afterCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, afterCounter[0]); + } + + @Test + public void runtimeSkippingFromAfter_testFails() { + + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new TestAfter.Mytest() { + protected Values mySetup() { + return DataFactory.createColumn(1, 2, 3); + } + + private void myAfter() { + com.sun.tck.lib.Assert.reportNotApplicable(true); + } + + @TestCase + @TestData("mySetup") + @com.sun.tck.lib.tgf.After("myAfter") + public void test(int i) { + Assert.fail("Failed!!!"); + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertEquals("test cases: 1; all not applicable", status.getMessage()); + } + + public static class ExceptionThrownFromAfter extends RuntimeException { + public static String RANDOM = TU.generateRandomString(); + + public ExceptionThrownFromAfter() { + super("This exception is thrown from After " + RANDOM); + } + + public void printStackTrace(PrintWriter s) { + s.println("Haha - this is overriden printStackTrace " + RANDOM); + } + } + + @TestGroup + public abstract static class Mytest { + protected Values setup() { + return DataFactory.createColumn(1, 1, 1); + } + } + + @TestGroup + public abstract static class PredefinedAfter { + + boolean initialAfterWasCalled; + + protected void after() { + initialAfterWasCalled = true; + } + + protected Values setup() { + return DataFactory.createColumn(1); + } + } + + +} + diff -Nru jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/beforeafter/TestBefore.java jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/beforeafter/TestBefore.java --- jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/beforeafter/TestBefore.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/beforeafter/TestBefore.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,702 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.tck.lib.autd2.unittests.tgfported.beforeafter; + +import com.oracle.tck.lib.autd2.*; +import com.oracle.tck.lib.autd2.unittests.BaseTestGroup; +import com.oracle.tck.lib.autd2.unittests.TU; +import com.sun.tck.lib.tgf.*; +import com.sun.tck.test.TestCase; +import com.sun.tck.test.TestGroup; + +import org.junit.Assert; +import org.junit.Test; + +import javax.swing.*; +import java.io.PrintWriter; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.*; + +import org.mockito.InOrder; + + + + +public class TestBefore { + + @Test + public void beforeWasCalled() { + + final boolean[] beforeCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] beforeCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new Mytest() { + private void myBefore() { + org.junit.Assert.assertFalse(methodCalled[0]); + beforeCalled[0] = true; + beforeCounter[0]++; + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("myBefore") + public void test(int i) { + org.junit.Assert.assertTrue(beforeCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(beforeCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, beforeCounter[0]); + } + + @Test + public void beforeIsBeforeValuesInitialization() { + final boolean[] beforeCalled = new boolean[1]; + final boolean[] valuesInited = new boolean[1]; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() { + + Object[] objects() { + valuesInited[0] = true; + return new Object[]{new Object()}; + } + + private void before() { + Assert.assertFalse(valuesInited[0]); + beforeCalled[0] = true; + } + + @TestCase + @TestData("objects") + @Before("before") + public void test(Object o) { + Assert.assertTrue(beforeCalled[0]); + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(beforeCalled[0]); + assertTrue(valuesInited[0]); + } + + + @Test + public void beforeWasCalled_NoParams() { + + final boolean[] beforeCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] beforeCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new Mytest() { + private void myBefore() { + org.junit.Assert.assertFalse(methodCalled[0]); + beforeCalled[0] = true; + beforeCounter[0]++; + } + + @TestCase + @com.sun.tck.lib.tgf.Before("myBefore") + public void test() { + org.junit.Assert.assertTrue(beforeCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(beforeCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(1, counter[0]); + assertEquals(1, beforeCounter[0]); + } + + + @Test + public void beforeOfNonVoidTypeWasCalled() { + final boolean[] beforeCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] beforeCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new Mytest() { + private JOptionPane myBefore() { + org.junit.Assert.assertFalse(methodCalled[0]); + beforeCalled[0] = true; + beforeCounter[0]++; + return new JOptionPane(); + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("myBefore") + public void test(int i) { + org.junit.Assert.assertTrue(beforeCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(beforeCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, beforeCounter[0]); + Assert.assertEquals("Passed. test cases: 1; all passed", status.toString()); + } + + @Test + public void beforeNotFound() { + + PrintWriter log = TU.createMockedPrintWriter(); + PrintWriter ref = TU.createMockedPrintWriter(); + + + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + TestResult status = TU.runTestGroup(new Mytest() { + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("myBeforeThatDoesNotExist") + public void test(int i) { + methodCalled[0] = true; + counter[0]++; + } + } + , log, ref, TU.EMPTY_ARGV + ); + assertFalse(status.isOK()); + assertFalse(methodCalled[0]); + assertEquals(0, counter[0]); + + + Assert.assertEquals("Failed. test cases: 1; all failed", + status.toString()); + + InOrder inOrder = inOrder(log, ref); + inOrder.verify(log).println("Method \"myBeforeThatDoesNotExist\" doesn't exist."); + inOrder.verify(log).println("test: Failed. Failed trying to invoke @Before method \"myBeforeThatDoesNotExist\""); + inOrder.verify(log).flush(); + inOrder.verify(ref).flush(); + + verifyNoMoreInteractions(log, ref); + + } + + @Test + public void beforeNotFound_NoParams() { + + PrintWriter log = TU.createMockedPrintWriter(); + PrintWriter ref = TU.createMockedPrintWriter(); + + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + TestResult status = TU.runTestGroup(new Mytest() { + @TestCase + @com.sun.tck.lib.tgf.Before("myBeforeThatDoesNotExist") + public void testWithNoParams() { + methodCalled[0] = true; + counter[0]++; + } + } + , log, ref, TU.EMPTY_ARGV + ); + + assertFalse(status.isOK()); + assertFalse(methodCalled[0]); + assertEquals(0, counter[0]); + + Assert.assertEquals("Failed. test cases: 1; all failed", + status.toString()); + + + InOrder inOrder = inOrder(log, ref); + inOrder.verify(log).println("Method \"myBeforeThatDoesNotExist\" doesn't exist."); + inOrder.verify(log).println("testWithNoParams: Failed. Failed trying to invoke @Before method \"myBeforeThatDoesNotExist\""); + inOrder.verify(log).flush(); + inOrder.verify(ref).flush(); + + verifyNoMoreInteractions(log, ref); + + } + + @Test + public void beforeThrowsException() { + + PrintWriter log = TU.createMockedPrintWriter(); + PrintWriter ref = TU.createMockedPrintWriter(); + + final boolean[] beforeCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + TestResult status = TU.runTestGroup(new Mytest() { + + private void myBefore() { + org.junit.Assert.assertFalse(methodCalled[0]); + beforeCalled[0] = true; + throw new ExceptionThrownFromBefore(); + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("myBefore") + public void test(int i) { + // this won't be called + methodCalled[0] = true; + counter[0]++; + } + } + , log, ref, TU.EMPTY_ARGV + ); + assertFalse(status.isOK()); + assertTrue(beforeCalled[0]); + assertFalse(methodCalled[0]); + assertEquals(0, counter[0]); + + + Assert.assertEquals("Failed. test cases: 1; all failed", + status.toString()); + + InOrder inOrder = inOrder(log, ref); + inOrder.verify(log).println("hahaha, it's mocked printStackTrace method"); + inOrder.verify(log).println("Method \"myBefore\" has thrown an exception com.oracle.tck.lib.autd2.unittests.tgfported.beforeafter.TestBefore$ExceptionThrownFromBefore: Before throws this exception"); + inOrder.verify(log).println("test: Failed. Failed trying to invoke @Before method \"myBefore\""); + inOrder.verify(log).flush(); + inOrder.verify(ref).flush(); + verifyNoMoreInteractions(log, ref); + } + + @Test + public void beforeThrowsException_nullOutPut() { + + final boolean[] beforeCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + TestResult status = TU.runTestGroup(new Mytest() { + + private void myBefore() { + org.junit.Assert.assertFalse(methodCalled[0]); + beforeCalled[0] = true; + throw new ExceptionThrownFromBefore(); + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("myBefore") + public void test(int i) { + // this won't be called + methodCalled[0] = true; + counter[0]++; + } + }, null, null, TU.EMPTY_ARGV); + assertFalse(status.isOK()); + assertTrue(beforeCalled[0]); + assertFalse(methodCalled[0]); + assertEquals(0, counter[0]); + + Assert.assertEquals("Failed. test cases: 1; all failed", + status.toString()); + } + + @Test + public void beforeThrowsException_NoParams() { + + PrintWriter log = TU.createMockedPrintWriter(); + PrintWriter ref = TU.createMockedPrintWriter(); + + final boolean[] beforeCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + TestResult status = TU.runTestGroup(new Mytest() { + + private void myBefore() { + org.junit.Assert.assertFalse(methodCalled[0]); + beforeCalled[0] = true; + throw new ExceptionThrownFromBefore(); + } + + @TestCase + @com.sun.tck.lib.tgf.Before("myBefore") + public void myTestWithNoParams() { + // this won't be called + methodCalled[0] = true; + counter[0]++; + } + } + , log, ref, TU.EMPTY_ARGV + ); + assertFalse(status.isOK()); + assertTrue(beforeCalled[0]); + assertFalse(methodCalled[0]); + assertEquals(0, counter[0]); + + Assert.assertEquals("Failed. test cases: 1; all failed", + status.toString()); + + InOrder inOrder = inOrder(log, ref); + inOrder.verify(log).println("hahaha, it's mocked printStackTrace method"); +// log.println("Failed trying to invoke @Before method \"myBefore\""); + inOrder.verify(log).println("Method \"myBefore\" has thrown an exception com.oracle.tck.lib.autd2.unittests.tgfported.beforeafter.TestBefore$ExceptionThrownFromBefore: Before throws this exception"); + inOrder.verify(log).println("myTestWithNoParams: Failed. Failed trying to invoke @Before method \"myBefore\""); + inOrder.verify(log).flush(); + inOrder.verify(ref).flush(); + verifyNoMoreInteractions(log, ref); + + } + + @Test + public void beforeCalledOnce() { + + final boolean[] beforeCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] beforeCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new Mytest() { + private void myBefore() { + org.junit.Assert.assertFalse(methodCalled[0]); + // to be sure that it was called only once + org.junit.Assert.assertFalse(beforeCalled[0]); + beforeCalled[0] = true; + beforeCounter[0]++; + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("myBefore") + public void test(int i) { + org.junit.Assert.assertTrue(beforeCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(beforeCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, beforeCounter[0]); + Assert.assertEquals("Passed. test cases: 1; all passed", + status.toString()); + } + + @Test + public void beforeCalledOnce_Mixed() { + + final boolean[] beforeCalled = new boolean[1]; + final boolean[] testCalled = new boolean[1]; + final boolean[] anotherTestCalled = new boolean[1]; + final int[] testCounter = new int[]{0}; + final int[] anotherTestCounter = new int[]{0}; + final int[] beforeCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new Mytest() { + private void myBefore() { + org.junit.Assert.assertFalse(testCalled[0]); + + if (!anotherTestCalled[0]) { + org.junit.Assert.assertFalse(beforeCalled[0]); + } + beforeCalled[0] = true; + beforeCounter[0]++; + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("myBefore") + public void test(int i) { + org.junit.Assert.assertTrue(beforeCalled[0]); + testCalled[0] = true; + testCounter[0]++; + } + + @TestCase + @com.sun.tck.lib.tgf.Before("myBefore") + public void anotherTest() { + org.junit.Assert.assertTrue(beforeCalled[0]); + anotherTestCalled[0] = true; + anotherTestCounter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(beforeCalled[0]); + assertTrue(testCalled[0]); + assertTrue(anotherTestCalled[0]); + assertEquals(3, testCounter[0]); + assertEquals(1, anotherTestCounter[0]); + assertEquals(2, beforeCounter[0]); + Assert.assertEquals("Passed. test cases: 2; all passed", + status.toString()); + } + + @Test + public void beforeCalledOnce_NoParams() { + + final boolean[] beforeCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] beforeCounter = new int[]{0}; + + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new Mytest() { + + private void myBefore() { + org.junit.Assert.assertFalse(methodCalled[0]); + // to be sure that it was called only once + org.junit.Assert.assertFalse(beforeCalled[0]); + beforeCalled[0] = true; + beforeCounter[0]++; + } + + @TestCase + @com.sun.tck.lib.tgf.Before("myBefore") + public void testCaseWithNoArgs() { + org.junit.Assert.assertTrue(beforeCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(beforeCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(1, counter[0]); + assertEquals(1, beforeCounter[0]); + Assert.assertEquals("Passed. test cases: 1; all passed", + status.toString()); + } + + @Test + public void overridingBefore() { + + final boolean[] newBeforeCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] beforeCounter = new int[]{0}; + + PredefinedBefore testInstance = new PredefinedBefore() { + protected void before() { + org.junit.Assert.assertFalse(methodCalled[0]); + newBeforeCalled[0] = true; + beforeCounter[0]++; + } + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("before") + public void test(int i) { + org.junit.Assert.assertTrue(newBeforeCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(testInstance, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertFalse(testInstance.initialBeforeWasCalled); + assertTrue(newBeforeCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + assertEquals(1, beforeCounter[0]); + Assert.assertEquals("Passed. test cases: 1; all passed", + status.toString()); + } + + @Test + public void overridingBefore_NoParams() { + + final boolean[] newBeforeCalled = new boolean[1]; + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + final int[] beforeCounter = new int[]{0}; + + PredefinedBefore testInstance = new PredefinedBefore() { + + protected void before() { + org.junit.Assert.assertFalse(methodCalled[0]); + newBeforeCalled[0] = true; + beforeCounter[0]++; + } + + @TestCase + @com.sun.tck.lib.tgf.Before("before") + public void test() { + org.junit.Assert.assertTrue(newBeforeCalled[0]); + methodCalled[0] = true; + counter[0]++; + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(testInstance, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertFalse(testInstance.initialBeforeWasCalled); + assertTrue(newBeforeCalled[0]); + assertTrue(methodCalled[0]); + assertEquals(1, counter[0]); + assertEquals(1, beforeCounter[0]); + Assert.assertEquals("Passed. test cases: 1; all passed", + status.toString()); + } + + @Test + public void inheritingBefore() { + + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + PredefinedBefore testInstance = new PredefinedBefore() { + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("before") + public void test(int i) { + org.junit.Assert.assertTrue(initialBeforeWasCalled); + methodCalled[0] = true; + counter[0]++; + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(testInstance, TU.EMPTY_ARGV); + assertTrue(status.isOK()); + assertTrue(testInstance.initialBeforeWasCalled); + assertTrue(methodCalled[0]); + assertEquals(3, counter[0]); + Assert.assertEquals("Passed. test cases: 1; all passed", + status.toString()); + } + + @Test + public void invalidSignature() { + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + PredefinedBefore testInstance = new PredefinedBefore() { + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("beforeThatDoesntexist") + public void test(int i) { + methodCalled[0] = true; + counter[0]++; + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(testInstance, TU.EMPTY_ARGV); + assertFalse(status.isOK()); + assertFalse(testInstance.initialBeforeWasCalled); + assertFalse(methodCalled[0]); + assertEquals(0, counter[0]); + Assert.assertEquals("Failed. test cases: 1; all failed", + status.toString()); + } + + @Test + public void invalidSignature_NoParams() { + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + PredefinedBefore testInstance = new PredefinedBefore() { + + @TestCase + @com.sun.tck.lib.tgf.Before("beforeThatDoesntexist") + public void testWithNoParams() { + methodCalled[0] = true; + counter[0]++; + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(testInstance, TU.EMPTY_ARGV); + assertFalse(status.isOK()); + assertFalse(testInstance.initialBeforeWasCalled); + assertFalse(methodCalled[0]); + assertEquals(0, counter[0]); + Assert.assertEquals("Failed. test cases: 1; all failed", + status.toString()); + } + + @Test + public void invalidSignature_Mixed() { + final boolean[] methodCalled = new boolean[1]; + final int[] counter = new int[]{0}; + + PredefinedBefore testInstance = new PredefinedBefore() { + + @TestCase + @TestData("setup") + @com.sun.tck.lib.tgf.Before("beforeThatDoesntexist") + public void test_2(int i) { + methodCalled[0] = true; + counter[0]++; + } + + @TestCase + @com.sun.tck.lib.tgf.Before("beforeThatDoesntexist") + public void test_1() { + methodCalled[0] = true; + counter[0]++; + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(testInstance, TU.EMPTY_ARGV); + assertFalse(status.isOK()); + assertFalse(testInstance.initialBeforeWasCalled); + assertFalse(methodCalled[0]); + assertEquals(0, counter[0]); + Assert.assertEquals("Failed. test cases: 2; all failed", + status.toString()); + } + + private static class ExceptionThrownFromBefore extends RuntimeException { + private ExceptionThrownFromBefore() { + super("Before throws this exception"); + // overriden to be shure that is' called by Runner + } + + public void printStackTrace(PrintWriter s) { + s.println("hahaha, it's mocked printStackTrace method"); + } + } + + @TestGroup + public abstract static class Mytest { + protected Values setup() { + return DataFactory.createColumn(1, 2, 3); + } + } + + @TestGroup + public abstract static class PredefinedBefore extends Mytest { + boolean initialBeforeWasCalled; + + protected void before() { + initialBeforeWasCalled = true; + } + + } + + +} diff -Nru jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/executeargs/Exclusion.java jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/executeargs/Exclusion.java --- jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/executeargs/Exclusion.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/executeargs/Exclusion.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,1041 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.tck.lib.autd2.unittests.tgfported.executeargs; + +import com.oracle.tck.lib.autd2.unittests.BaseTestGroup; +import com.sun.tck.lib.tgf.DataFactory; +import com.sun.tck.lib.tgf.TestData; +import com.sun.tck.lib.tgf.Values; +import com.sun.tck.test.TestCase; +import org.junit.Assert; +import org.junit.Test; + +import java.util.ArrayList; +import java.util.List; + +import static com.oracle.tck.lib.autd2.unittests.TU.*; +import static com.sun.tck.lib.tgf.TGFUtils.*; + +/** + * + */ +public class Exclusion { + + + private void check_2(String... args) { + final int[] methodCounter = new int[]{0}; + final int[] blablaCounter = new int[]{0}; + final int[] fooCounter = new int[]{0}; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() { + protected Values mySetup() { + return DataFactory.createColumn(11, 22, 33, 44, 55); + } + + @TestCase + @TestData("mySetup") + public void myTest(int i) { + methodCounter[0]++; + } + + @TestCase + @TestData("mySetup") + public void blabla(int i) { + blablaCounter[0]++; + } + + @TestCase + @TestData("mySetup") + public void foo(int i) { + fooCounter[0]++; + } + + }, args); + Assert.assertTrue(status.isOK()); + Assert.assertEquals(5, methodCounter[0]); + Assert.assertEquals(0, blablaCounter[0]); + Assert.assertEquals(0, fooCounter[0]); + } + + @Test + public void tempTest_2() { + check_2( + "4532542345", "ewrtwert", "Wertwert", + EXCLUDE_WORD, "blabla", + EXCLUDE_WORD, "foo", + "dfsgdfg"); + } + + @Test + public void tempTest32() { + check_2(EXCLUDE_WORD, "blabla", "adsfasfd", + EXCLUDE_WORD, "foo"); + } + + @Test + public void tempTest33() { + check_2(EXCLUDE_WORD, "blabla,foo", "adsfasfd"); + } + + @Test + public void tempTest34() { + check_2(EXCLUDE_WORD, "foo,blabla", "adsfasfd"); + } + + @Test + public void tempTest35() { + check_2(EXCLUDE_WORD, "foo,blabla"); + } + + @Test + public void tempTest36() { + check_2(EXCLUDE_WORD, "blabla,foo"); + } + + @Test + public void tempTest37() { + check_2("myTest", EXCLUDE_WORD, "blabla,foo"); + } + + @Test + public void tempTest_nothingUseful_1() { + checkNothingFound(new String[]{}); + } + + @Test + public void tempTest_nothingUseful_2() { + checkNothingFound(new String[]{"1341241234"}); + } + + @Test + public void tempTest_nothingUseful_2_1() { + checkNothingFound(new String[]{EXCLUDE_WORD}); + } + + @Test + public void tempTest_nothingUseful_3() { + checkNothingFound(new String[]{"234234", "324234", "dfgdsfg", "dfsgdf"}); + } + + @Test + public void tempTest_nothingUseful_4() { + checkNothingFound(new String[]{"234234", "324234", "dfgdsfg", EXCLUDE_WORD}); + } + + @Test + public void tempTest_nothingUseful_5() { + checkNothingFound(new String[]{"234234", "324234", "dfgdsfg", EXCLUDE_WORD, "wertwert"}); + } + + @Test + public void tempTest_nothingUseful_6() { + checkNothingFound(new String[]{"234234", "324234", "dfgdsfg", EXCLUDE_WORD, "wertwert,wertwert,wertwet#3.4"}); + } + + @Test + public void tempTest_nothingUseful_8() { + checkNothingFound(new String[]{"23,4234", "324234", EXCLUDE_WORD}); + } + + private void checkNothingFound(String[] args) { + final int[] methodCounter = new int[]{0}; + final ArrayList expectedArgValues = + new ArrayList() { + { + add(1); + add(2); + add(3); + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() { + protected Values mySetup() { + return DataFactory.createColumn(1, 2, 3); + } + + @TestCase + @TestData("mySetup") + public void myTest(int i) { + Assert.assertTrue(i + " is not among expected", expectedArgValues.contains(i)); + methodCounter[0]++; + } + }, args); + Assert.assertTrue(status.isOK()); + Assert.assertEquals(3, methodCounter[0]); + } + + @Test + public void test_excludedArg() { + final int[] methodCounter = new int[]{0}; + final ArrayList expectedArgValues = + new ArrayList() { + { + add(2); + add(3); + } + }; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() { + protected Values mySetup() { + return DataFactory.createColumn(1, 2, 3); + } + + @TestCase + @TestData("mySetup") + public void myTest(int i) { + Assert.assertTrue(i + " is not among expected", expectedArgValues.contains(i)); + methodCounter[0]++; + } + }, new String[]{EXCLUDE_WORD, "myTest"}); + Assert.assertTrue(status.isOK()); + Assert.assertEquals(0, methodCounter[0]); + } + + @Test + public void test_excludedWholeTest_1() { + check_ExcludeWholeTest(EXCLUDE_WORD, "myTest"); + } + + @Test + public void test_excludedWholeTest_2() { + check_ExcludeWholeTest(EXCLUDE_WORD, "myTest,someOtherTest"); + } + + @Test + public void test_excludedWholeTest_3() { + check_ExcludeWholeTest(EXCLUDE_WORD, "qwer", EXCLUDE_WORD, "myTest,someOtherTest"); + } + + @Test + public void test_excludedWholeTest_4() { + check_ExcludeWholeTest(EXCLUDE_WORD, "someOtherTest,r,wert,ert,myTest,tr,rty"); + } + + private void check_ExcludeWholeTest(String... args) { + final int[] methodCounter = new int[]{0}; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() { + protected Values mySetup() { + return DataFactory.createColumn(1, 2, 3); + } + + @TestCase + @TestData("mySetup") + public void myTest(int i) { + methodCounter[0]++; + } + }, args); + Assert.assertTrue(status.isOK()); + Assert.assertEquals(0, methodCounter[0]); + } + + + @Test + public void test_Mixed_1() { + final int[] myTestCounter = new int[]{0}; + final int[] blablaCounter = new int[]{0}; + final int[] fooCounter = new int[]{0}; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() { + + private Values mySetup() { + return DataFactory.createColumn(11, 22, 33, 44, 55, 66); + } + + @TestCase + public void myTest() { + myTestCounter[0]++; + } + + @TestCase + public void blabla() { + blablaCounter[0]++; + } + + @TestCase + @TestData("mySetup") + public void foo(int i) { + fooCounter[0]++; + } + + }, new String[]{EXCLUDE_WORD}); + Assert.assertTrue(status.isOK()); + Assert.assertEquals("Passed. test cases: 3; all passed", status.toString()); + Assert.assertEquals(1, myTestCounter[0]); + Assert.assertEquals(1, blablaCounter[0]); + Assert.assertEquals(6, fooCounter[0]); + } + + @Test + public void test_Mixed_2() { + check_Mixed_2(EXCLUDE_WORD, " myTest"); + } + + @Test + public void test_Mixed_2_1() { + check_Mixed_2(EXCLUDE_WORD, "one, myTest,two"); + } + + @Test + public void test_Mixed_2_2() { + check_Mixed_2(EXCLUDE_WORD, "sdfgsdg", "qwerty", EXCLUDE_WORD, "one,myTest,two"); + } + + @Test + public void test_Mixed_2_3() { + check_Mixed_2(EXCLUDE_WORD, " one", EXCLUDE_WORD, "myTest", EXCLUDE_WORD, " two "); + } + + @Test + public void test_Mixed_2_4() { + check_Mixed_2(EXCLUDE_WORD, "one ", EXCLUDE_WORD, "myTest", EXCLUDE_WORD, " two,qwerqwer,adfadfasdf,asdfasdf"); + } + + private void check_Mixed_2(String... args) { + final int[] myTestCounter = new int[]{0}; + final int[] blablaCounter = new int[]{0}; + final int[] fooCounter = new int[]{0}; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() { + + private Values mySetup() { + return DataFactory.createColumn(11, 22, 33, 44, 55, 66); + } + + @TestCase + public void myTest() { + myTestCounter[0]++; + } + + @TestCase + public void blabla() { + blablaCounter[0]++; + } + + @TestCase + @TestData("mySetup") + public void foo(int i) { + fooCounter[0]++; + } + + }, args); + Assert.assertTrue(status.isOK()); + Assert.assertEquals("Passed. test cases: 2; all passed", status.toString()); + Assert.assertEquals(0, myTestCounter[0]); + Assert.assertEquals(1, blablaCounter[0]); + Assert.assertEquals(6, fooCounter[0]); + } + + @Test + public void test_Mixed_3_1() { + check_Mixed_3(EXCLUDE_WORD, "myTest", EXCLUDE_WORD, "blabla"); + } + + @Test + public void test_Mixed_3_1_1() { + check_Mixed_3(EXCLUDE_WORD, "myTest", EXCLUDE_WORD, "blabla", EXCLUDE_WORD, EXCLUDE_WORD); + } + + @Test + public void test_Mixed_3_2() { + check_Mixed_3(EXCLUDE_WORD, "myTest,blabla"); + } + + @Test + public void test_Mixed_3_3() { + check_Mixed_3(EXCLUDE_WORD, "blabla,myTest"); + } + + @Test + public void test_Mixed_3_4() { + check_Mixed_3(EXCLUDE_WORD, "myTest,blabla,somethingElse"); + } + + @Test + public void test_Mixed_3_5() { + check_Mixed_3(EXCLUDE_WORD, "blabla", "something", EXCLUDE_WORD, "myTest,somethingElse"); + } + + @Test + public void test_Mixed_3_6() { + check_Mixed_3(EXCLUDE_WORD, "myTest,asdf23141234sdfasfd,blabla", EXCLUDE_WORD, "somethingElse"); + } + + private void check_Mixed_3(String... args) { + final int[] myTestCounter = new int[]{0}; + final int[] blablaCounter = new int[]{0}; + final int[] fooCounter = new int[]{0}; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() { + + private Values mySetup() { + return DataFactory.createColumn(11, 22, 33, 44, 55, 66); + } + + @TestCase + public void myTest() { + myTestCounter[0]++; + } + + @TestCase + public void blabla() { + blablaCounter[0]++; + } + + @TestCase + @TestData("mySetup") + public void foo(int i) { + fooCounter[0]++; + } + + }, args); + Assert.assertTrue(status.isOK()); + Assert.assertEquals("Passed. test cases: 1; all passed", status.toString()); + Assert.assertEquals(0, myTestCounter[0]); + Assert.assertEquals(0, blablaCounter[0]); + Assert.assertEquals(6, fooCounter[0]); + } + + private void check_Mixed_4(List allData, + List expectedPassedToTestCase, + String expectedStatusMessage, + final int expectedMyTestCounter, + final int expectedBlablaCounter, String... args) { + final int[] myTestCounter = new int[]{0}; + final int[] blablaCounter = new int[]{0}; + final int[] fooCounter = new int[]{0}; + com.oracle.tck.lib.autd2.TestResult status = com.oracle.tck.lib.autd2.unittests.TU.runTestGroup(new BaseTestGroup() { + + private List mySetup() { + return allData; + } + + @TestCase + public void myTest() { + myTestCounter[0]++; + } + + @TestCase + public void blabla() { + blablaCounter[0]++; + } + + @TestCase + @TestData("mySetup") + public void foo(int i) { + Assert.assertEquals( + (int) expectedPassedToTestCase.get(fooCounter[0]), i); + fooCounter[0]++; + } + + }, args); + Assert.assertTrue(status.isOK()); + Assert.assertEquals(expectedStatusMessage, status.toString()); + Assert.assertEquals(expectedMyTestCounter, myTestCounter[0]); + Assert.assertEquals(expectedBlablaCounter, blablaCounter[0]); + Assert.assertEquals(expectedPassedToTestCase.size(), fooCounter[0]); + } + + @Test + public void test_Mixed_4_1() { + check_Mixed_4( + List.of(11, 22, 33, 44, 55, 66), List.of(11, 22, 33, 44, 55, 66), + "Passed. test cases: 1; all passed", 0, 0, + EXCLUDE_WORD, "myTest,blabla", EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Mixed_4_2() { + check_Mixed_4( + List.of(11, 22, 33), List.of(11, 22, 33), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla", EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Mixed_4_2_1() { + check_Mixed_4( + List.of(11, 22, 33), List.of(), + "Passed. test cases: 1; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo"); + } + + @Test + public void test_Mixed_4_2_2() { + check_Mixed_4( + List.of(11, 22, 33), List.of(), + "Passed. No test cases found (or all test cases excluded.)", 0, 0, + EXCLUDE_WORD, "blabla,foo,myTest"); + } + + @Test + public void test_Micro_1() { + check_Mixed_4( + List.of(11, 22, 33), + List.of(22, 33), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + INDICES_END, EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro_1_restIgnored() { + check_Mixed_4( + List.of(11, 22, 33), + List.of(22, 33), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + INDICES_END + ")()()()()()", EXCLUDE_WORD, "somethingElse"); + } + + @Test(expected = IllegalArgumentException.class) + public void test_Micro_1_IEA() { + check_Mixed_4( + List.of(11, 22, 33), + List.of(22, 33), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0", EXCLUDE_WORD, "somethingElse"); + } + + @Test(expected = IllegalArgumentException.class) + public void test_Micro_1_EmptyRange() { + check_Mixed_4( + List.of(11, 22, 33), + List.of(22, 33), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + INDICES_END, EXCLUDE_WORD, "somethingElse"); + } + + + @Test(expected = IllegalArgumentException.class) + public void test_Micro_1_BrokenRange() { + check_Mixed_4( + List.of(11, 22, 33), + List.of(22, 33), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + INDICES_START + INDICES_END, EXCLUDE_WORD, "somethingElse"); + } + + + @Test + public void test_Micro_2() { + check_Mixed_4( + List.of(11, 22, 33), + List.of(11, 33), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + INDICES_END, EXCLUDE_WORD, "somethingElse"); + } + + + @Test + public void test_Micro_2_repeatedSeveralTimes() { + check_Mixed_4( + List.of(11, 22, 33), + List.of(11, 33), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + INDICES_END, + INDICES_START + "1", + INDICES_START + "1", + INDICES_START + "1", + INDICES_START + "1", + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro_3() { + check_Mixed_4( + List.of(11, 2, 33), + List.of(11, 2), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "2" + INDICES_END, EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro_twoIndices() { + check_Mixed_4( + List.of(5, 2, 34), + List.of(34), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + INDEX_SEPARATOR + "1" + INDICES_END, EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro_twoIndices_1() { + check_Mixed_4( + List.of(5, 2, 34), + List.of(5), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + INDEX_SEPARATOR + "2" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro_twoIndices_1_repeated() { + check_Mixed_4( + List.of(5, 2, 34), + List.of(5), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + INDEX_SEPARATOR + "1" + + INDEX_SEPARATOR + "1" + + INDEX_SEPARATOR + "1" + + INDEX_SEPARATOR + "2" + INDICES_END, + INDEX_SEPARATOR + "2", + INDEX_SEPARATOR + "2" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro_threeIndices_1() { + check_Mixed_4( + List.of(5, 2, 34), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + INDEX_SEPARATOR + "1" + + INDEX_SEPARATOR + "2" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro_threeIndices_2() { + check_Mixed_4( + List.of(5, 2, 34), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + INDEX_SEPARATOR + "0" + + INDEX_SEPARATOR + "2" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro_threeIndices_3() { + check_Mixed_4( + List.of(5, 2, 34), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "2" + + INDEX_SEPARATOR + "1" + + INDEX_SEPARATOR + "0" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test(expected = NumberFormatException.class) + public void test_Micro_threeIndices_3_broken() { + check_Mixed_4( + List.of(5, 2, 34), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "2" + + INDEX_SEPARATOR + "1" + + INDEX_SEPARATOR + "g" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro_threeIndices_2_mentionedTwice() { + check_Mixed_4( + List.of(5, 2, 34), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + INDEX_SEPARATOR + "0" + + INDEX_SEPARATOR + "0" + + INDEX_SEPARATOR + "2" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro5_several_separate_indices() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + INDEX_SEPARATOR + "1" + + INDEX_SEPARATOR + "2" + + INDEX_SEPARATOR + "3" + + INDEX_SEPARATOR + "4" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro5_several_separate_indices_1() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15), + List.of(5, 4), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + INDEX_SEPARATOR + "2" + + INDEX_SEPARATOR + "4" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + + @Test + public void test_Micro5_several_separate_indices_1_secondColumnIgnored() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15), + List.of(5, 4), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + INDEX_SEPARATOR + "2" + + INDEX_SEPARATOR + "4" + INDICES_END + INDICES_START + "1" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + + @Test + public void test_Micro5_fullRange() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + RANGE_DELIMITER + "4" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro5_fullRange_exceedingRange() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + RANGE_DELIMITER + "10" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro5_severalRanges() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(4), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + RANGE_DELIMITER + "2" + + INDEX_SEPARATOR + "4" + + RANGE_DELIMITER + "5" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro5_severalRanges_filteringCompletely() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + RANGE_DELIMITER + "2" + + INDEX_SEPARATOR + "3" + + RANGE_DELIMITER + "5" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro5_severalRanges_filteringCompletely_1() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + RANGE_DELIMITER + "1" + + INDEX_SEPARATOR + "1" + + RANGE_DELIMITER + "3" + + INDEX_SEPARATOR + "4" + RANGE_DELIMITER + "5" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro5_severalRanges_filteringCompletely_2_overlap() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + RANGE_DELIMITER + "1" + + INDEX_SEPARATOR + "1" + + RANGE_DELIMITER + "5" + + INDEX_SEPARATOR + "3" + RANGE_DELIMITER + "5" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + + @Test(expected = IllegalArgumentException.class) + public void test_incorrectRange() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + RANGE_DELIMITER + "0", + EXCLUDE_WORD, "somethingElse"); + } + + + @Test(expected = IllegalArgumentException.class) + public void test_incorrectRange_1() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + RANGE_DELIMITER + "0", + EXCLUDE_WORD, "somethingElse"); + } + + @Test(expected = IllegalArgumentException.class) + public void test_incorrectRange_2() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "-5" + + RANGE_DELIMITER + "0", + EXCLUDE_WORD, "somethingElse"); + } + + @Test(expected = IllegalArgumentException.class) + public void test_incorrectRange_tripleRange() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + RANGE_DELIMITER + "2" + RANGE_DELIMITER + "4", + EXCLUDE_WORD, "somethingElse"); + } + + @Test(expected = IllegalArgumentException.class) + public void test_incorrectRange_tripleRange_01() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + RANGE_DELIMITER + "0" + INDICES_END); + } + + @Test(expected = IllegalArgumentException.class) + public void test_incorrectRange_tripleRange_02() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + RANGE_DELIMITER + "0" + INDICES_END); + } + + + @Test + public void test_Micro6_severalRanges_1() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6, 7, 8), + List.of(8, 4), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + RANGE_DELIMITER + "2" + + INDEX_SEPARATOR + "4" + + RANGE_DELIMITER + "7" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro6_severalRanges_2() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6, 7, 8), + List.of(8, 4, 8), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + RANGE_DELIMITER + "2" + + INDEX_SEPARATOR + "4" + + RANGE_DELIMITER + "6" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro6_severalRanges_3() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6, 7, 8), + List.of(8, 4, 8), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "4" + + RANGE_DELIMITER + "6" + + INDEX_SEPARATOR + "1" + + RANGE_DELIMITER + "2" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro6_severalRanges_4() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6, 7, 8), + List.of(8, 5, 89, 4, 15), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "5" + + RANGE_DELIMITER + "7" + + INDEX_SEPARATOR + "5" + + RANGE_DELIMITER + "7" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro6_severalRanges_5() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6, 7, 8), + List.of(8), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + RANGE_DELIMITER + "7" + + INDEX_SEPARATOR + "3" + + RANGE_DELIMITER + "5" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro6_severalRanges_5_1() { + check_Mixed_4( + List.of(8, 5, 89), + List.of(5, 89), + "Passed. test cases: 3; all passed", 1, 1, + EXCLUDE_WORD, "foo" + INDICES_START + "0" + INDICES_END); + } + + + + @Test + public void test_Micro6_allTheNumbers() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6, 7, 8), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + + INDEX_SEPARATOR + "1" + + INDEX_SEPARATOR + "2" + + INDEX_SEPARATOR + "3" + + INDEX_SEPARATOR + "4" + + INDEX_SEPARATOR + "5" + + INDEX_SEPARATOR + "6" + + INDEX_SEPARATOR + "7" + + INDICES_END); + } + + @Test + public void test_Micro6_fullRange() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6, 7, 8), + List.of(), + "Passed. test cases: 2; passed: 1; not applicable: 1", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "0" + RANGE_DELIMITER + "7" + + INDICES_END); + } + + @Test + public void test_Micro6_severalRanges_6() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6, 7, 8), + List.of(8, 15), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + RANGE_DELIMITER + "3" + + INDEX_SEPARATOR + "5" + + RANGE_DELIMITER + "7" + INDICES_END + INDICES_START + "3452345" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test(expected = NumberFormatException.class) + public void test_Micro6_severalRanges_7_NFE() { + check_Mixed_4( + List.of(9, 5, 89, 4, 15, 6, 7, 8), + List.of(9), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + INDEX_SEPARATOR + "5" + + INDICES_START + "2" + + RANGE_DELIMITER + "7" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void test_Micro6_severalRanges_7() { + check_Mixed_4( + List.of(9, 5, 89, 4, 15, 6, 7, 8), + List.of(9), + "Passed. test cases: 2; all passed", 1, 0, + EXCLUDE_WORD, "blabla,foo" + + INDICES_START + "1" + + INDEX_SEPARATOR + "5" + + INDEX_SEPARATOR + "2" + + RANGE_DELIMITER + "7" + INDICES_END, + EXCLUDE_WORD, "somethingElse"); + } + + @Test + public void excludingNotParameterizedWithParameterNumbers_02() { + check_Mixed_4( + List.of(8, 5, 89, 4, 15, 6), + List.of(), + "Passed. test cases: 2; all passed", 1, 1, + EXCLUDE_WORD, "foo,blabla" + + INDICES_START + "0" + RANGE_DELIMITER + "50" + INDICES_END); + } + + + +} diff -Nru jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups1.java jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups1.java --- jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups1.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups1.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,132 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.tck.lib.autd2.unittests.tgfported.general; + +import com.oracle.tck.lib.autd2.unittests.TU; +import com.sun.tck.lib.tgf.DataFactory; +import com.sun.tck.lib.tgf.TestData; +import com.sun.tck.lib.tgf.Values; +import com.sun.tck.test.TestCase; +import com.sun.tck.test.TestGroup; + +import org.junit.Assert; +import static org.mockito.Mockito.*; +/** + * + */ +public class BranchAndUniteSetups1 { + + + private static String[] ROW_1 = {"1", "2", "3"}; + private static String[] ROW_2 = {"4", "5", "6"}; + private static String[] ROW_3 = {"7", "8", "9"}; + private static String[] ROW_4 = {"10", "11", "12"}; + + @org.junit.Test + public void test() { + + final BranchAndUniteSetups1.MyTestedInstance mock = mock(BranchAndUniteSetups1.MyTestedInstance.class); + + @TestGroup + class MyTest { + + Values setup1() { + return DataFactory.createColumn((Object[])ROW_1); + } + Values setup2() { + return DataFactory.createColumn((Object[])ROW_1).multiply((Object[])ROW_2).unite( + DataFactory.createColumn((Object[])ROW_3).multiply((Object[])ROW_4) + ); + } + + @TestCase + @TestData("setup2") + public void test(String s1, String s2) { + mock.method(s1, s2); + } + } + + com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + Assert.assertTrue(status.isOK()); + + for (String s1 : ROW_1) { + for (String s2 : ROW_2) { + verify(mock).method(s1, s2); + } + } + + for (String s3 : ROW_3) { + for (String s4 : ROW_4) { + verify(mock).method(s3, s4); + } + } + + } + + @org.junit.Test + public void test_2() { + + final BranchAndUniteSetups1.MyTestedInstance mock = mock(BranchAndUniteSetups1.MyTestedInstance.class); + + @TestGroup + class MyTest { + + Values setup() { + return DataFactory.createColumn("i_1", "i_2").multiply("j_1", "j_2").unite( + DataFactory.createColumn("k_1", "k_2").multiply("m_1", "m_2") + ); + } + + @TestCase + @TestData("setup") + public void test(String s1, String s2) { + mock.method(s1, s2); + } + } + + com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + Assert.assertTrue(status.isOK()); + + verify(mock).method("i_1", "j_1"); + verify(mock).method("i_1", "j_2"); + verify(mock).method("i_2", "j_1"); + verify(mock).method("i_2", "j_2"); + verify(mock).method("k_1", "m_1"); + verify(mock).method("k_1", "m_2"); + verify(mock).method("k_2", "m_1"); + verify(mock).method("k_2", "m_2"); + verifyNoMoreInteractions(mock); + + } + + + public static interface MyTestedInstance { + void method(String s1, String s2); + } + + +} diff -Nru jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups2.java jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups2.java --- jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups2.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups2.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,130 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.tck.lib.autd2.unittests.tgfported.general; + +import com.oracle.tck.lib.autd2.unittests.TU; +import com.sun.tck.lib.tgf.DataFactory; +import com.sun.tck.lib.tgf.TestData; +import com.sun.tck.lib.tgf.Values; +import com.sun.tck.test.TestCase; +import com.sun.tck.test.TestGroup; +import org.junit.Assert; +import static org.mockito.Mockito.*; + + +/** + * + */ +public class BranchAndUniteSetups2 { + + + private static String[] ROW_1 = {"1", "2", "3"}; + private static String[] ROW_2 = {"4", "5", "6"}; + private static String[] ROW_3 = {"7", "8", "9"}; + private static String[] ROW_4 = {"10", "11", "12"}; + + @org.junit.Test public void test() { + + final BranchAndUniteSetups2.MyTestedInstance mock = mock(BranchAndUniteSetups2.MyTestedInstance.class); + + + @TestGroup + class MyTest { + + Values setup() { + return DataFactory.createColumn((Object[])ROW_1).multiply((Object[])ROW_2).unite( + DataFactory.createColumn((Object[])ROW_3).multiply((Object[])ROW_4) + ); + } + + @TestCase + @TestData("setup") + public void test(String s1, String s2) { + mock.method(s1, s2); + } + } + + com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + + Assert.assertTrue(status.isOK()); for (String s1 : ROW_1) { + for (String s2 : ROW_2) { + verify(mock).method(s1, s2); + } + } + + for (String s3 : ROW_3) { + for (String s4 : ROW_4) { + verify(mock).method(s3, s4); + } + } + + } + + @org.junit.Test + public void test_2() { + + final BranchAndUniteSetups2.MyTestedInstance mock = mock(BranchAndUniteSetups2.MyTestedInstance.class); + + + @TestGroup + class MyTest { + + Values setup() { + return DataFactory.createColumn("i_1", "i_2").multiply("j_1", "j_2").unite( + DataFactory.createColumn("k_1", "k_2").multiply("m_1", "m_2") + ); + } + + @TestCase + @TestData("setup") + public void test(String s1, String s2) { + mock.method(s1, s2); + } + } + + com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + + Assert.assertTrue(status.isOK()); + + verify(mock).method("i_1", "j_1"); + verify(mock).method("i_1", "j_2"); + verify(mock).method("i_2", "j_1"); + verify(mock).method("i_2", "j_2"); + verify(mock).method("k_1", "m_1"); + verify(mock).method("k_1", "m_2"); + verify(mock).method("k_2", "m_1"); + verify(mock).method("k_2", "m_2"); + verifyNoMoreInteractions(mock); + } + + + public static interface MyTestedInstance { + void method(String s1, String s2); + } + + +} diff -Nru jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups3.java jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups3.java --- jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups3.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups3.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,94 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.tck.lib.autd2.unittests.tgfported.general; + +import com.oracle.tck.lib.autd2.unittests.TU; +import com.sun.tck.lib.tgf.DataFactory; +import com.sun.tck.lib.tgf.TestData; +import com.sun.tck.lib.tgf.Values; +import com.sun.tck.test.TestCase; +import com.sun.tck.test.TestGroup; + +import org.junit.Assert; +import static org.mockito.Mockito.*; +/** + * + */ +public class BranchAndUniteSetups3 { + + + private static String[] ROW_1 = {"1", "2", "3"}; + private static String[] ROW_2 = {"4", "5", "6"}; + private static String[] ROW_3 = {"7", "8", "9"}; + private static String[] ROW_4 = {"10", "11", "12"}; + + + @org.junit.Test + public void test_2() { + + final BranchAndUniteSetups3.MyTestedInstance mock = mock(BranchAndUniteSetups3.MyTestedInstance.class); + + @TestGroup + class MyTest { + + Values setup() { + return DataFactory.createColumn("i_1", "i_2").multiply("j_1", "j_2").unite( + DataFactory.createColumn("k_1", "k_2").multiply("m_1", "m_2") + ); + } + + + @TestCase + @TestData("setup") + public void test(String s1, String s2) { + mock.method(s1, s2); + } + } + + com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + + Assert.assertTrue(status.isOK()); + + verify(mock).method("i_1", "j_1"); + verify(mock).method("i_1", "j_2"); + verify(mock).method("i_2", "j_1"); + verify(mock).method("i_2", "j_2"); + verify(mock).method("k_1", "m_1"); + verify(mock).method("k_1", "m_2"); + verify(mock).method("k_2", "m_1"); + verify(mock).method("k_2", "m_2"); + verifyNoMoreInteractions(mock); + + } + + + public static interface MyTestedInstance { + void method(String s1, String s2); + } + + +} diff -Nru jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups.java jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups.java --- jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/general/BranchAndUniteSetups.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,138 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2022, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package com.oracle.tck.lib.autd2.unittests.tgfported.general; + +import com.oracle.tck.lib.autd2.unittests.TU; +import com.sun.tck.lib.tgf.DataFactory; +import com.sun.tck.lib.tgf.TestData; +import com.sun.tck.lib.tgf.Values; +import com.sun.tck.test.TestCase; +import com.sun.tck.test.TestGroup; +import org.junit.Assert; + + +import static org.mockito.Mockito.*; + +/** + * + */ +public class BranchAndUniteSetups { + + + + private static String[] ROW_1 = {"1", "2", "3"}; + private static String[] ROW_2 = {"4", "5", "6"}; + private static String[] ROW_3 = {"7", "8", "9"}; + private static String[] ROW_4 = {"10", "11", "12"}; + + @org.junit.Test public void test() { + + final BranchAndUniteSetups.MyTestedInstance mock = mock(BranchAndUniteSetups.MyTestedInstance.class); + + + @TestGroup + class MyTest { + + Values setup1() { + Values values2 = DataFactory.createColumn((Object[])ROW_3).multiply((Object[])ROW_4); + Values values1 = DataFactory.createColumn((Object[])ROW_1).multiply((Object[])ROW_2); + return values1.unite(values2); + } + + + + @TestCase + @TestData("setup1") + public void test(String s1, String s2) { + mock.method(s1, s2); + } + } + + + + com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + Assert.assertTrue(status.isOK()); + + for (String s1 : ROW_1) { + for (String s2 : ROW_2) { + verify(mock).method(s1, s2); + } + } + + for (String s3 : ROW_3) { + for (String s4 : ROW_4) { + verify(mock).method(s3, s4); + } + } + + } + + @org.junit.Test + public void test_2() { + + final MyTestedInstance mock = mock(MyTestedInstance.class); + + + @TestGroup + class MyTest { + + Values setup1() { + return DataFactory.createColumn("i_1", "i_2").multiply("j_1", "j_2").unite( + DataFactory.createColumn("k_1", "k_2").multiply("m_1", "m_2") + ); + } + + @TestCase + @TestData("setup1") + public void test(String s1, String s2) { + mock.method(s1, s2); + } + } + + com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(new MyTest()); + + verify(mock).method("i_1", "j_1"); + verify(mock).method("i_1", "j_2"); + verify(mock).method("i_2", "j_1"); + verify(mock).method("i_2", "j_2"); + + verify(mock).method("k_1", "m_1"); + verify(mock).method("k_1", "m_2"); + verify(mock).method("k_2", "m_1"); + verify(mock).method("k_2", "m_2"); + verifyNoMoreInteractions(mock); + + Assert.assertTrue(status.isOK()); + } + + + public static interface MyTestedInstance { + void method(String s1, String s2); + } + +} diff -Nru jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/plainfailing/TestCaseThrowsException.java jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/plainfailing/TestCaseThrowsException.java --- jtharness-6.0-b15/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/plainfailing/TestCaseThrowsException.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/oracle/tck/lib/autd2/unittests/tgfported/plainfailing/TestCaseThrowsException.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,139 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.tck.lib.autd2.unittests.tgfported.plainfailing; + +import com.oracle.tck.lib.autd2.unittests.BaseTestGroup; +import com.oracle.tck.lib.autd2.unittests.CustomException; +import com.oracle.tck.lib.autd2.unittests.TU; +import com.sun.tck.lib.tgf.DataFactory; +import com.sun.tck.lib.tgf.TestData; +import com.sun.tck.lib.tgf.Values; +import com.sun.tck.test.TestCase; +import com.sun.tck.test.TestGroup; + +import org.junit.Assert; +import org.junit.Test; + +import java.io.PrintWriter; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; +import static org.mockito.Mockito.*; +import org.mockito.InOrder; + + +public class TestCaseThrowsException { + + + + @Test + public void unexpectedRuntimeException() { + PrintWriter log = TU.createMockedPrintWriter(); + PrintWriter ref = TU.createMockedPrintWriter(); + + + BaseTestGroup baseTestGroup = new BaseTestGroup() { + Values setup() { + return DataFactory.createColumn(115); + } + + @TestCase + @TestData("setup") + public void theTest(int i) { + throw new CustomException(Integer.toString(i)); + } + }; + com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup( + baseTestGroup, log, ref); + + Assert.assertTrue(!status.isOK()); + Assert.assertEquals("Failed. test cases: 1; all failed", status.toString()); + + InOrder inOrder = inOrder(log, ref); + inOrder.verify(log).println("Testcase \"theTest(0)\" has thrown an unexpected exception com.oracle.tck.lib.autd2.unittests.CustomException: 115"); + inOrder.verify(log).println(CustomException.STACKTRACE_LINE); + inOrder.verify(log).println("Testcase \"theTest(0)\" failed with arguments [115]"); + inOrder.verify(log).println("theTest: Failed. Testcase \"theTest(0)\" has thrown an unexpected exception com.oracle.tck.lib.autd2.unittests.CustomException: 115"); + inOrder.verify(log).flush(); + inOrder.verify(ref).flush(); + verifyNoMoreInteractions(log, ref); + } + + + + + @Test + public void primitiveTest() { + + @TestGroup + class _TestCase { + + private boolean properMethodWasCalled; + private boolean wrongMethodWasCalled; + + private Values setup() { + return DataFactory.createColumn(1); + } + + @TestCase + @TestData("setup") + public void test(int i) { + this.properMethodWasCalled = true; + throw new RuntimeException("Test just failed"); + } + + void testThatShouldNotBeCalled() { + this.wrongMethodWasCalled = true; + } + + boolean isProperMethodWasCalled() { + return properMethodWasCalled; + } + + boolean isWrongMethodWasCalled() { + return wrongMethodWasCalled; + } + + } + + _TestCase testCase = new _TestCase(); + com.oracle.tck.lib.autd2.TestResult status = TU.runTestGroup(testCase); + assertTrue(testCase.isProperMethodWasCalled()); + assertFalse(testCase.isWrongMethodWasCalled()); + + assertTrue(!status.isOK()); + assertEquals("test cases: 1; all failed", + status.getMessage()); + } + + + + + + +} diff -Nru jtharness-6.0-b15/unit-tests/com/sun/javatest/agent/RemoteTest.java jtharness-6.0-b22/unit-tests/com/sun/javatest/agent/RemoteTest.java --- jtharness-6.0-b15/unit-tests/com/sun/javatest/agent/RemoteTest.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/sun/javatest/agent/RemoteTest.java 2022-03-27 19:40:32.000000000 +0000 @@ -307,7 +307,7 @@ return Math.abs(nextInt()) % upb; } - int nextInt(int lwb, int upb) { + private int privateNextInt(int lwb, int upb) { return lwb + Math.abs(nextInt()) % (upb - lwb); } @@ -315,7 +315,7 @@ int l = nextInt(RemoteTest.MAX_CHARS_PER_LINE); StringBuffer sb = new StringBuffer(l); for (int i = 0; i < l; i++) { - sb.append((char) nextInt(32, 128)); // cheat!! + sb.append((char) privateNextInt(32, 128)); // cheat!! } return new String(sb); diff -Nru jtharness-6.0-b15/unit-tests/com/sun/javatest/batch/RunTestsCommand_formattedDuration.java jtharness-6.0-b22/unit-tests/com/sun/javatest/batch/RunTestsCommand_formattedDuration.java --- jtharness-6.0-b15/unit-tests/com/sun/javatest/batch/RunTestsCommand_formattedDuration.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/sun/javatest/batch/RunTestsCommand_formattedDuration.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,183 +0,0 @@ -/* - * $Id$ - * - * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * This code is free software; you can redistribute it and/or modify it - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ -package com.sun.javatest.batch; - - -import org.junit.Assert; -import org.junit.Test; - -import javax.script.ScriptEngine; -import javax.script.ScriptEngineFactory; -import javax.script.ScriptEngineManager; -import javax.script.ScriptException; -import java.util.List; - -/** - * Checking function that produces strings with human readable duration, i.e. "2 hours 31 minutes 1 second" - */ -public class RunTestsCommand_formattedDuration { - - @Test - public void zero() { - Assert.assertEquals("0 seconds", RunTestsCommand.formattedDuration(0)); - Assert.assertEquals("0 seconds", RunTestsCommand.formattedDuration(-1)); - Assert.assertEquals("0 seconds", RunTestsCommand.formattedDuration(-400)); - Assert.assertEquals("0 seconds", RunTestsCommand.formattedDuration(Integer.MIN_VALUE)); - Assert.assertEquals("0 seconds", RunTestsCommand.formattedDuration(Long.MIN_VALUE)); - } - - @Test - public void maxValues() { - Assert.assertEquals("24855 days 3 hours 14 minutes 7 seconds", - RunTestsCommand.formattedDuration(Integer.MAX_VALUE)); - Assert.assertEquals( - 24855 * 60 * 60 * 24 + 60 * 60 * 3 + 60 * 14 + 7, - Integer.MAX_VALUE - ); - - Assert.assertEquals("106751991167300 days 15 hours 30 minutes 7 seconds", - RunTestsCommand.formattedDuration(Long.MAX_VALUE)); - Assert.assertEquals( - 106751991167300L * 60L * 60L * 24L + 60L * 60L * 15L + 60L * 30L + 7L, - Long.MAX_VALUE - ); - } - - @Test - public void seconds() { - Assert.assertEquals("1 second", RunTestsCommand.formattedDuration(1)); - Assert.assertEquals("2 seconds", RunTestsCommand.formattedDuration(2)); - Assert.assertEquals("3 seconds", RunTestsCommand.formattedDuration(3)); - Assert.assertEquals("30 seconds", RunTestsCommand.formattedDuration(30)); - Assert.assertEquals("40 seconds", RunTestsCommand.formattedDuration(40)); - Assert.assertEquals("59 seconds", RunTestsCommand.formattedDuration(59)); - } - - @Test - public void minutes() { - Assert.assertEquals("1 minute", RunTestsCommand.formattedDuration(60)); - Assert.assertEquals("2 minutes", RunTestsCommand.formattedDuration(120)); - Assert.assertEquals("3 minutes", RunTestsCommand.formattedDuration(180)); - Assert.assertEquals("10 minutes", RunTestsCommand.formattedDuration(600)); - Assert.assertEquals("59 minutes", RunTestsCommand.formattedDuration(60 * 59)); - Assert.assertEquals("11 minutes", RunTestsCommand.formattedDuration(660)); - } - - @Test - public void hours() { - Assert.assertEquals("1 hour", RunTestsCommand.formattedDuration(60 * 60)); - Assert.assertEquals("7 hours", RunTestsCommand.formattedDuration(60 * 60 * 7)); - Assert.assertEquals("23 hours", RunTestsCommand.formattedDuration(60 * 60 * 23)); - } - - @Test - public void days() { - Assert.assertEquals("1 day", RunTestsCommand.formattedDuration(60 * 60 * 24)); - Assert.assertEquals("2 days", RunTestsCommand.formattedDuration(60 * 60 * 48)); - Assert.assertEquals("7 days", RunTestsCommand.formattedDuration(60 * 60 * 24 * 7)); - Assert.assertEquals("100 days", RunTestsCommand.formattedDuration(60 * 60 * 24 * 100)); - } - - @Test - public void days_hours() { - Assert.assertEquals("1 day 1 hour", RunTestsCommand.formattedDuration(60 * 60 * 25)); - Assert.assertEquals("2 days 3 hours", RunTestsCommand.formattedDuration(60 * 60 * 51)); - Assert.assertEquals("2 days 23 hours", RunTestsCommand.formattedDuration(60 * 60 * 71)); - } - - @Test - public void days_hours_minutes() { - Assert.assertEquals("1 day 1 hour 1 minute", RunTestsCommand.formattedDuration(60 * 60 * 25 + 60)); - Assert.assertEquals("1 day 5 hours 3 minutes", RunTestsCommand.formattedDuration(60 * 60 * 29 + 180)); - } - - @Test - public void days_seconds() { - Assert.assertEquals("1 day 59 seconds", RunTestsCommand.formattedDuration(60 * 60 * 24 + 59)); - Assert.assertEquals("1 day 1 second", RunTestsCommand.formattedDuration(60 * 60 * 24 + 1)); - Assert.assertEquals("1 day 2 seconds", RunTestsCommand.formattedDuration(60 * 60 * 24 + 2)); - Assert.assertEquals("3 days 1 second", RunTestsCommand.formattedDuration(60 * 60 * 72 + 1)); - } - - @Test - public void days_minutes() { - Assert.assertEquals("1 day 2 minutes", RunTestsCommand.formattedDuration(60 * 60 * 24 + 120)); - Assert.assertEquals("1 day 10 minutes", RunTestsCommand.formattedDuration(60 * 60 * 24 + 600)); - } - - @Test - public void days_hours_minutes_seconds() { - Assert.assertEquals("1 day 1 hour 1 minute 4 seconds", RunTestsCommand.formattedDuration(60 * 60 * 25 + 64)); - Assert.assertEquals("1 day 1 hour 2 minutes 7 seconds", RunTestsCommand.formattedDuration(60 * 60 * 25 + 127)); - Assert.assertEquals("2 days 1 hour 2 minutes 7 seconds", RunTestsCommand.formattedDuration(60 * 60 * 49 + 127)); - } - - @Test - public void days_minutes_seconds() { - Assert.assertEquals("1 day 8 minutes 15 seconds", RunTestsCommand.formattedDuration(60 * 60 * 24 + 60*8 + 15)); - Assert.assertEquals("2 days 1 minute 4 seconds", RunTestsCommand.formattedDuration(60 * 60 * 48 + 64)); - } - - @Test - public void days_hours_seconds() { - Assert.assertEquals("1 day 1 hour 4 seconds", RunTestsCommand.formattedDuration(60 * 60 * 25 + 4)); - Assert.assertEquals("1 day 23 hours 59 seconds", RunTestsCommand.formattedDuration(60 * 60 * 47 + 59)); - } - - @Test - public void minutes_seconds() { - Assert.assertEquals("1 minute 1 second", RunTestsCommand.formattedDuration(61)); - Assert.assertEquals("1 minute 59 seconds", RunTestsCommand.formattedDuration(119)); - Assert.assertEquals("2 minutes 1 second", RunTestsCommand.formattedDuration(121)); - Assert.assertEquals("2 minutes 3 seconds", RunTestsCommand.formattedDuration(123)); - Assert.assertEquals("2 minutes 6 seconds", RunTestsCommand.formattedDuration(126)); - Assert.assertEquals("3 minutes 11 seconds", RunTestsCommand.formattedDuration(191)); - Assert.assertEquals("10 minutes 1 second", RunTestsCommand.formattedDuration(601)); - Assert.assertEquals("10 minutes 5 seconds", RunTestsCommand.formattedDuration(605)); - Assert.assertEquals("10 minutes 59 seconds", RunTestsCommand.formattedDuration(659)); - } - - @Test - public void hours_minutes() { - Assert.assertEquals("1 hour 40 minutes", RunTestsCommand.formattedDuration(6000)); - Assert.assertEquals("1 hour 41 minutes", RunTestsCommand.formattedDuration(6060)); - Assert.assertEquals("1 hour 59 minutes", RunTestsCommand.formattedDuration(60 * 60 + 60 * 59)); - } - - @Test - public void hours_seconds() { - Assert.assertEquals("19 hours 15 seconds", RunTestsCommand.formattedDuration(60 * 60 * 19 + 15)); - } - - @Test - public void hours_minutes_seconds() { - Assert.assertEquals("1 hour 41 minutes 7 seconds", RunTestsCommand.formattedDuration(6067)); - Assert.assertEquals("5 hours 45 minutes 45 seconds", RunTestsCommand.formattedDuration(45 + 60*45 + 60*60*5)); - } - - -} diff -Nru jtharness-6.0-b15/unit-tests/com/sun/javatest/util/FormattedDuration.java jtharness-6.0-b22/unit-tests/com/sun/javatest/util/FormattedDuration.java --- jtharness-6.0-b15/unit-tests/com/sun/javatest/util/FormattedDuration.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests/com/sun/javatest/util/FormattedDuration.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,176 @@ +/* + * $Id$ + * + * Copyright (c) 2020, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.sun.javatest.util; + + +import org.junit.Assert; +import org.junit.Test; + +/** + * Checking function that produces strings with human readable duration, i.e. "2 hours 31 minutes 1 second" + */ +public class FormattedDuration { + + @Test + public void zero() { + Assert.assertEquals("0 seconds", FormattingUtils.formattedDuration(0)); + Assert.assertEquals("0 seconds", FormattingUtils.formattedDuration(-1)); + Assert.assertEquals("0 seconds", FormattingUtils.formattedDuration(-400)); + Assert.assertEquals("0 seconds", FormattingUtils.formattedDuration(Integer.MIN_VALUE)); + Assert.assertEquals("0 seconds", FormattingUtils.formattedDuration(Long.MIN_VALUE)); + } + + @Test + public void maxValues() { + Assert.assertEquals("24855 days 3 hours 14 minutes 7 seconds", + FormattingUtils.formattedDuration(Integer.MAX_VALUE)); + Assert.assertEquals( + 24855 * 60 * 60 * 24 + 60 * 60 * 3 + 60 * 14 + 7, + Integer.MAX_VALUE + ); + + Assert.assertEquals("106751991167300 days 15 hours 30 minutes 7 seconds", + FormattingUtils.formattedDuration(Long.MAX_VALUE)); + Assert.assertEquals( + 106751991167300L * 60L * 60L * 24L + 60L * 60L * 15L + 60L * 30L + 7L, + Long.MAX_VALUE + ); + } + + @Test + public void seconds() { + Assert.assertEquals("1 second", FormattingUtils.formattedDuration(1)); + Assert.assertEquals("2 seconds", FormattingUtils.formattedDuration(2)); + Assert.assertEquals("3 seconds", FormattingUtils.formattedDuration(3)); + Assert.assertEquals("30 seconds", FormattingUtils.formattedDuration(30)); + Assert.assertEquals("40 seconds", FormattingUtils.formattedDuration(40)); + Assert.assertEquals("59 seconds", FormattingUtils.formattedDuration(59)); + } + + @Test + public void minutes() { + Assert.assertEquals("1 minute", FormattingUtils.formattedDuration(60)); + Assert.assertEquals("2 minutes", FormattingUtils.formattedDuration(120)); + Assert.assertEquals("3 minutes", FormattingUtils.formattedDuration(180)); + Assert.assertEquals("10 minutes", FormattingUtils.formattedDuration(600)); + Assert.assertEquals("59 minutes", FormattingUtils.formattedDuration(60 * 59)); + Assert.assertEquals("11 minutes", FormattingUtils.formattedDuration(660)); + } + + @Test + public void hours() { + Assert.assertEquals("1 hour", FormattingUtils.formattedDuration(60 * 60)); + Assert.assertEquals("7 hours", FormattingUtils.formattedDuration(60 * 60 * 7)); + Assert.assertEquals("23 hours", FormattingUtils.formattedDuration(60 * 60 * 23)); + } + + @Test + public void days() { + Assert.assertEquals("1 day", FormattingUtils.formattedDuration(60 * 60 * 24)); + Assert.assertEquals("2 days", FormattingUtils.formattedDuration(60 * 60 * 48)); + Assert.assertEquals("7 days", FormattingUtils.formattedDuration(60 * 60 * 24 * 7)); + Assert.assertEquals("100 days", FormattingUtils.formattedDuration(60 * 60 * 24 * 100)); + } + + @Test + public void days_hours() { + Assert.assertEquals("1 day 1 hour", FormattingUtils.formattedDuration(60 * 60 * 25)); + Assert.assertEquals("2 days 3 hours", FormattingUtils.formattedDuration(60 * 60 * 51)); + Assert.assertEquals("2 days 23 hours", FormattingUtils.formattedDuration(60 * 60 * 71)); + } + + @Test + public void days_hours_minutes() { + Assert.assertEquals("1 day 1 hour 1 minute", FormattingUtils.formattedDuration(60 * 60 * 25 + 60)); + Assert.assertEquals("1 day 5 hours 3 minutes", FormattingUtils.formattedDuration(60 * 60 * 29 + 180)); + } + + @Test + public void days_seconds() { + Assert.assertEquals("1 day 59 seconds", FormattingUtils.formattedDuration(60 * 60 * 24 + 59)); + Assert.assertEquals("1 day 1 second", FormattingUtils.formattedDuration(60 * 60 * 24 + 1)); + Assert.assertEquals("1 day 2 seconds", FormattingUtils.formattedDuration(60 * 60 * 24 + 2)); + Assert.assertEquals("3 days 1 second", FormattingUtils.formattedDuration(60 * 60 * 72 + 1)); + } + + @Test + public void days_minutes() { + Assert.assertEquals("1 day 2 minutes", FormattingUtils.formattedDuration(60 * 60 * 24 + 120)); + Assert.assertEquals("1 day 10 minutes", FormattingUtils.formattedDuration(60 * 60 * 24 + 600)); + } + + @Test + public void days_hours_minutes_seconds() { + Assert.assertEquals("1 day 1 hour 1 minute 4 seconds", FormattingUtils.formattedDuration(60 * 60 * 25 + 64)); + Assert.assertEquals("1 day 1 hour 2 minutes 7 seconds", FormattingUtils.formattedDuration(60 * 60 * 25 + 127)); + Assert.assertEquals("2 days 1 hour 2 minutes 7 seconds", FormattingUtils.formattedDuration(60 * 60 * 49 + 127)); + } + + @Test + public void days_minutes_seconds() { + Assert.assertEquals("1 day 8 minutes 15 seconds", FormattingUtils.formattedDuration(60 * 60 * 24 + 60*8 + 15)); + Assert.assertEquals("2 days 1 minute 4 seconds", FormattingUtils.formattedDuration(60 * 60 * 48 + 64)); + } + + @Test + public void days_hours_seconds() { + Assert.assertEquals("1 day 1 hour 4 seconds", FormattingUtils.formattedDuration(60 * 60 * 25 + 4)); + Assert.assertEquals("1 day 23 hours 59 seconds", FormattingUtils.formattedDuration(60 * 60 * 47 + 59)); + } + + @Test + public void minutes_seconds() { + Assert.assertEquals("1 minute 1 second", FormattingUtils.formattedDuration(61)); + Assert.assertEquals("1 minute 59 seconds", FormattingUtils.formattedDuration(119)); + Assert.assertEquals("2 minutes 1 second", FormattingUtils.formattedDuration(121)); + Assert.assertEquals("2 minutes 3 seconds", FormattingUtils.formattedDuration(123)); + Assert.assertEquals("2 minutes 6 seconds", FormattingUtils.formattedDuration(126)); + Assert.assertEquals("3 minutes 11 seconds", FormattingUtils.formattedDuration(191)); + Assert.assertEquals("10 minutes 1 second", FormattingUtils.formattedDuration(601)); + Assert.assertEquals("10 minutes 5 seconds", FormattingUtils.formattedDuration(605)); + Assert.assertEquals("10 minutes 59 seconds", FormattingUtils.formattedDuration(659)); + } + + @Test + public void hours_minutes() { + Assert.assertEquals("1 hour 40 minutes", FormattingUtils.formattedDuration(6000)); + Assert.assertEquals("1 hour 41 minutes", FormattingUtils.formattedDuration(6060)); + Assert.assertEquals("1 hour 59 minutes", FormattingUtils.formattedDuration(60 * 60 + 60 * 59)); + } + + @Test + public void hours_seconds() { + Assert.assertEquals("19 hours 15 seconds", FormattingUtils.formattedDuration(60 * 60 * 19 + 15)); + } + + @Test + public void hours_minutes_seconds() { + Assert.assertEquals("1 hour 41 minutes 7 seconds", FormattingUtils.formattedDuration(6067)); + Assert.assertEquals("5 hours 45 minutes 45 seconds", FormattingUtils.formattedDuration(45 + 60*45 + 60*60*5)); + } + +} diff -Nru jtharness-6.0-b15/unit-tests-support/com/oracle/tck/lib/autd2/unittests/CustomException.java jtharness-6.0-b22/unit-tests-support/com/oracle/tck/lib/autd2/unittests/CustomException.java --- jtharness-6.0-b15/unit-tests-support/com/oracle/tck/lib/autd2/unittests/CustomException.java 1970-01-01 00:00:00.000000000 +0000 +++ jtharness-6.0-b22/unit-tests-support/com/oracle/tck/lib/autd2/unittests/CustomException.java 2022-03-27 19:40:32.000000000 +0000 @@ -0,0 +1,48 @@ +/* + * $Id$ + * + * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.tck.lib.autd2.unittests; + +import java.io.PrintWriter; + + + + +public class CustomException extends RuntimeException { + + public static final String STACKTRACE_LINE = "CustomException" + + ".printStackTrace 09237592073450293847520936502302378465"; + + + public CustomException(String message) { + super(message); + } + + public void printStackTrace(PrintWriter s) { + s.println(STACKTRACE_LINE); + } + +} \ No newline at end of file diff -Nru jtharness-6.0-b15/unit-tests-support/com/oracle/tck/lib/autd2/unittests/TU.java jtharness-6.0-b22/unit-tests-support/com/oracle/tck/lib/autd2/unittests/TU.java --- jtharness-6.0-b15/unit-tests-support/com/oracle/tck/lib/autd2/unittests/TU.java 2020-11-30 21:39:15.000000000 +0000 +++ jtharness-6.0-b22/unit-tests-support/com/oracle/tck/lib/autd2/unittests/TU.java 2022-03-27 19:40:32.000000000 +0000 @@ -1,7 +1,7 @@ /* * $Id$ * - * Copyright (c) 1996, 2020, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1996, 2021, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -41,6 +41,9 @@ import com.oracle.tck.lib.autd2.processors.tg.TestCaseSelecting; import com.sun.tck.lib.Assert; import com.sun.tck.lib.AssertionFailedException; +import com.sun.tck.lib.tgf.TGFUtils; +import org.mockito.InOrder; +import org.mockito.Mockito; import java.io.BufferedWriter; import java.io.OutputStreamWriter; @@ -49,6 +52,8 @@ import java.util.*; import java.util.Random; +import static org.mockito.Mockito.inOrder; + /** * Test utilities @@ -57,6 +62,11 @@ public static final String[] EMPTY_ARGV = new String[]{}; + public static final String EXCLUDE_WORD = TGFUtils.EXCLUDE; + + public static PrintWriter createMockedPrintWriter() { + return Mockito.mock(PrintWriter.class); + } public static String generateRandomString() { return "random" + new Random().nextInt(); } @@ -64,58 +74,49 @@ /** * Processors which are bound to @TestGroup annotation */ - public static final Set> TG_PROC = - new HashSet>() {{ - addAll(Arrays.asList( - TestCaseSelecting.class, - TestCaseExcluding.class, - RunningTestCases.class, - PublicNonTestCaseMethodsReporter.class, - NonPublicTestCasesReporter.class)); - }}; - + public static final Set> TG_PROC = Set.of( + TestCaseSelecting.class, + TestCaseExcluding.class, + RunningTestCases.class, + PublicNonTestCaseMethodsReporter.class, + NonPublicTestCasesReporter.class); /** * Processors which are bound to @TestCase annotation */ - public static final Set> TC_PROC_STATUS_RECOGNIZED = - new HashSet>() {{ - addAll(Arrays.asList( - DefaultThreadRunning.class, - DefaultExecutionResult.class, - DefaultNoArgTestCaseMethodSetting.class, - TestCaseResultCanBeStatus.class - )); - }}; + public static final Set> TC_PROC_STATUS_RECOGNIZED = Set.of( + DefaultThreadRunning.class, + DefaultExecutionResult.class, + DefaultNoArgTestCaseMethodSetting.class, + TestCaseResultCanBeStatus.class + ); + /** * Processors which are bound to @TestCase annotation */ - public static final Set> TC_PROC_STATUS_NOT_EXPECTED = - new HashSet>() {{ - addAll(Arrays.asList( - DefaultThreadRunning.class, - DefaultExecutionResult.class, - DefaultNoArgTestCaseMethodSetting.class - )); - }}; + public static final Set> TC_PROC_STATUS_NOT_EXPECTED = Set.of( + DefaultThreadRunning.class, + DefaultExecutionResult.class, + DefaultNoArgTestCaseMethodSetting.class + ); public static TestResult runTestGroup(Object tg, String... args) { - PrintWriter log = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.err, StandardCharsets.UTF_8)), true); - PrintWriter ref = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out, StandardCharsets.UTF_8)), true); + PrintWriter log = new PrintWriter(System.err, true, StandardCharsets.UTF_8); + PrintWriter ref = new PrintWriter(System.out, true, StandardCharsets.UTF_8); return runTestGroup(tg, log, ref, args); } public static TestResult runTestGroup(Object tg) { - PrintWriter log = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.err, StandardCharsets.UTF_8)), true); - PrintWriter ref = new PrintWriter(new BufferedWriter(new OutputStreamWriter(System.out, StandardCharsets.UTF_8)), true); + PrintWriter log = new PrintWriter(System.err, true, StandardCharsets.UTF_8); + PrintWriter ref = new PrintWriter(System.out, true, StandardCharsets.UTF_8); return runTestGroup(tg, log, ref, EMPTY_ARGV); } public static TestResult runTestGroup(Object tg, PrintWriter log, PrintWriter ref, Set> additionalUserTGProcessors, - Set> additionalUserTCProcessors, + Set> additionalUserTCProcessors, String... args) { Set> finalTGProc = new HashSet<>(TG_PROC); Set> finalTCProc = new HashSet<>(TC_PROC_STATUS_RECOGNIZED); @@ -129,7 +130,32 @@ PrintWriter log, PrintWriter ref, String... args) { - return runTestGroup(test, log, ref, new HashSet<>(), new HashSet<>(), args); + return runTestGroup(test, log, ref, Set.of(), Set.of(), args); + } + + public static void methodThatCallsAssertFail_1() { + methodThatCallsAssertFail_2(); + } + public static void methodThatCallsAssertFail_2() { + methodThatCallsAssertFail_3(); + } + public static void methodThatCallsAssertFail_3() { + Assert.fail("Assertion failed"); + } + public static void throwsAssertionFailedException() { + throw new AssertionFailedException("Failed!"); + } + + + @FunctionalInterface + interface PrintVerifier { + void verify(PrintWriter log); + } + + static void verify_(PrintWriter log, PrintVerifier pw) { + InOrder inOrder = inOrder(log); + pw.verify(inOrder.verify(log)); + inOrder.verifyNoMoreInteractions(); } }