JavaThreadPoolFactory_Test.java (2be43276) JavaThreadPoolFactory_Test.java (9cbd97ce)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 9 unchanged lines hidden (view full) ---

18 * under the License.
19 *
20 *************************************************************/
21
22
23
24package com.sun.star.lib.uno.environments.remote;
25
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements. See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership. The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance

--- 9 unchanged lines hidden (view full) ---

18 * under the License.
19 *
20 *************************************************************/
21
22
23
24package com.sun.star.lib.uno.environments.remote;
25
26import complexlib.ComplexTestCase;
26import org.junit.Test;
27import static org.junit.Assert.*;
27
28
28public final class JavaThreadPoolFactory_Test extends ComplexTestCase {
29 public String[] getTestMethodNames() {
30 return new String[] { "test" };
31 }
32
29public final class JavaThreadPoolFactory_Test {
30 @Test
33 public void test() throws InterruptedException {
34 ThreadId i1 = JavaThreadPoolFactory.getThreadId();
31 public void test() throws InterruptedException {
32 ThreadId i1 = JavaThreadPoolFactory.getThreadId();
35 assure(i1.equals(JavaThreadPoolFactory.getThreadId()));
33 assertTrue(i1.equals(JavaThreadPoolFactory.getThreadId()));
36 final ThreadId[] i2 = new ThreadId[1];
37 new Thread() {
38 public void run() {
39 synchronized (i2) {
40 i2[0] = JavaThreadPoolFactory.getThreadId();
41 i2.notify();
42 }
43 }
44 }.start();
45 synchronized (i2) {
46 while (i2[0] == null) {
47 i2.wait();
48 }
49 }
34 final ThreadId[] i2 = new ThreadId[1];
35 new Thread() {
36 public void run() {
37 synchronized (i2) {
38 i2[0] = JavaThreadPoolFactory.getThreadId();
39 i2.notify();
40 }
41 }
42 }.start();
43 synchronized (i2) {
44 while (i2[0] == null) {
45 i2.wait();
46 }
47 }
50 assure(!i1.equals(i2[0]));
48 assertTrue(!i1.equals(i2[0]));
51 }
52}
49 }
50}