6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package javafx.concurrent;
27
28 import java.util.concurrent.ConcurrentLinkedQueue;
29 import java.util.concurrent.Executor;
30 import org.junit.Before;
31
32 /**
33 * Base class for tests of the Service class. This class has built into it
34 * the notion of an event queue, and executing a Service on a background
35 * thread. It handles draining the EQ of events and so forth.
36 */
37 public abstract class ServiceTestBase {
38 protected final ConcurrentLinkedQueue<Runnable> eventQueue =
39 new ConcurrentLinkedQueue<Runnable>();
40 protected TestServiceFactory factory;
41 protected Service<String> service;
42
43 protected abstract TestServiceFactory setupServiceFactory();
44 protected Executor createExecutor() {
45 return command -> {
46 if (command == null) Thread.dumpStack();
47 Thread th = new Thread() {
48 @Override public void run() {
49 try {
|
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation. Oracle designates this
8 * particular file as subject to the "Classpath" exception as provided
9 * by Oracle in the LICENSE file that accompanied this code.
10 *
11 * This code is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
14 * version 2 for more details (a copy is included in the LICENSE file that
15 * accompanied this code).
16 *
17 * You should have received a copy of the GNU General Public License version
18 * 2 along with this work; if not, write to the Free Software Foundation,
19 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
20 *
21 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
22 * or visit www.oracle.com if you need additional information or have any
23 * questions.
24 */
25
26 package test.javafx.concurrent;
27
28 import java.util.concurrent.ConcurrentLinkedQueue;
29 import java.util.concurrent.Executor;
30 import javafx.concurrent.Service;
31 import org.junit.Before;
32
33 /**
34 * Base class for tests of the Service class. This class has built into it
35 * the notion of an event queue, and executing a Service on a background
36 * thread. It handles draining the EQ of events and so forth.
37 */
38 public abstract class ServiceTestBase {
39 protected final ConcurrentLinkedQueue<Runnable> eventQueue =
40 new ConcurrentLinkedQueue<Runnable>();
41 protected TestServiceFactory factory;
42 protected Service<String> service;
43
44 protected abstract TestServiceFactory setupServiceFactory();
45 protected Executor createExecutor() {
46 return command -> {
47 if (command == null) Thread.dumpStack();
48 Thread th = new Thread() {
49 @Override public void run() {
50 try {
|