blob: 44cfe8318b2b0166b04f470165d72268d1de13ad (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
// Copyright 2017 Yahoo Holdings. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.jdisc.test;
import com.google.inject.AbstractModule;
import com.google.inject.name.Names;
import org.junit.Test;
import java.util.concurrent.CountDownLatch;
/**
* @author <a href="mailto:simon@yahoo-inc.com">Simon Thoresen</a>
*/
public class TestDriverIntegrationTest {
@Test
public void requireThatFactoryMethodsWork() {
TestDriver.newApplicationBundleInstance("app-a.jar", false, new MyModule()).close();
TestDriver.newInstance(TestDriver.newOsgiFramework(), "app-a.jar", false, new MyModule()).close();
}
private static class MyModule extends AbstractModule {
final CountDownLatch latch = new CountDownLatch(1);
@Override
protected void configure() {
bind(CountDownLatch.class).annotatedWith(Names.named("Init")).toInstance(latch);
bind(CountDownLatch.class).annotatedWith(Names.named("Start")).toInstance(latch);
bind(CountDownLatch.class).annotatedWith(Names.named("Stop")).toInstance(latch);
bind(CountDownLatch.class).annotatedWith(Names.named("Destroy")).toInstance(latch);
}
}
}
|