@Override public void beforeAll(ContainerExtensionContext context) { if (!shouldBeBenchmarked(context)) return; storeNowAsLaunchTime(context, LaunchTimeKey.CLASS); }
@Override public void afterAll(ContainerExtensionContext context) { if (!shouldBeBenchmarked(context)) return; long launchTime = loadLaunchTime(context, LaunchTimeKey.CLASS); long elapsedTime = currentTimeMillis() - launchTime; report("Test container", context, elapsedTime); }
private static Optional<ExtensionContext> getAncestorContainerContext(ExtensionContext context) { Optional<ExtensionContext> containerContext = Optional.of(context); while (containerContext.isPresent() && !(containerContext.get() instanceof ContainerExtensionContext)) containerContext = containerContext.get().getParent(); return containerContext; }
@Override public Stream<? extends Arguments> arguments(ContainerExtensionContext context) { return new Random() .ints(0, 10) .mapToObj(ObjectArrayArguments::create) .limit(3); }
@Override // public void beforeAll(ExtensionContext context) throws Exception { public void beforeAll(ContainerExtensionContext context) throws Exception { System.setProperty(KEY_VAADIN_SERVER_IP, ipSupplierLocalIP.get()); }
@Override public ConditionEvaluationResult evaluate(ContainerExtensionContext context) { return evaluateIfAnnotated(context.getElement()); }
@Override public void beforeAll(ContainerExtensionContext context) throws Exception { ConfigurableApplicationContext application = Application.start(); context.getStore(NAMESPACE).put("application", application); }
@Override public void afterAll(ContainerExtensionContext context) throws Exception { context.getStore(NAMESPACE).get("application", ConfigurableApplicationContext.class).stop(); }