org.testcontainers.lifecycle.Startables Java Examples
The following examples show how to use
org.testcontainers.lifecycle.Startables.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DependenciesTest.java From testcontainers-java with MIT License | 6 votes |
@Test public void shouldHandleDiamondDependencies() throws Exception { InvocationCountingStartable a = new InvocationCountingStartable(); InvocationCountingStartable b = new InvocationCountingStartable(); InvocationCountingStartable c = new InvocationCountingStartable(); InvocationCountingStartable d = new InvocationCountingStartable(); // / b \ // a d // \ c / b.getDependencies().add(a); c.getDependencies().add(a); d.getDependencies().add(b); d.getDependencies().add(c); Startables.deepStart(Stream.of(d)).get(1, TimeUnit.SECONDS); VisibleAssertions.assertEquals("A started", 1, a.getStartInvocationCount().intValue()); VisibleAssertions.assertEquals("B started", 1, b.getStartInvocationCount().intValue()); VisibleAssertions.assertEquals("C started", 1, c.getStartInvocationCount().intValue()); VisibleAssertions.assertEquals("D started", 1, d.getStartInvocationCount().intValue()); }
Example #2
Source File: GenericContainer.java From testcontainers-java with MIT License | 5 votes |
/** * Starts the container using docker, pulling an image if necessary. */ @Override @SneakyThrows({InterruptedException.class, ExecutionException.class}) public void start() { if (containerId != null) { return; } Startables.deepStart(dependencies).get(); doStart(); }
Example #3
Source File: DependenciesTest.java From testcontainers-java with MIT License | 5 votes |
@Test public void shouldHandleParallelStream() throws Exception { List<Startable> startables = Stream.generate(InvocationCountingStartable::new) .limit(10) .collect(Collectors.toList()); for (int i = 1; i < startables.size(); i++) { startables.get(0).getDependencies().add(startables.get(i)); } Startables.deepStart(startables.parallelStream()).get(1, TimeUnit.SECONDS); }
Example #4
Source File: AbstractIntegrationTest.java From code-examples with MIT License | 4 votes |
private static void startContainers() { Startables.deepStart(Stream.of(postgres)).join(); // we can add further containers here like rabbitmq or other database }