Rename bramble-j2se to bramble-java.

This commit is contained in:
akwizgran
2018-08-29 15:15:20 +01:00
parent 0d4cf4db68
commit da7cf4af28
40 changed files with 8 additions and 8 deletions

View File

@@ -0,0 +1,42 @@
package org.briarproject.bramble.lifecycle;
import org.briarproject.bramble.api.lifecycle.ShutdownManager;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.fail;
public class WindowsShutdownManagerImplTest extends ShutdownManagerImplTest {
@Override
protected ShutdownManager createShutdownManager() {
return new WindowsShutdownManagerImpl();
}
@Test
public void testManagerWaitsForHooksToRun() {
WindowsShutdownManagerImpl s = new WindowsShutdownManagerImpl();
SlowHook[] hooks = new SlowHook[10];
for (int i = 0; i < hooks.length; i++) {
hooks[i] = new SlowHook();
s.addShutdownHook(hooks[i]);
}
s.runShutdownHooks();
for (SlowHook hook : hooks) assertTrue(hook.finished);
}
private static class SlowHook implements Runnable {
private volatile boolean finished = false;
@Override
public void run() {
try {
Thread.sleep(100);
finished = true;
} catch (InterruptedException e) {
fail();
}
}
}
}