package org.genericsystem.cache;

import io.vertx.core.DeploymentOptions;
import io.vertx.core.Vertx;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;

import org.testng.annotations.AfterClass;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;

@Test
public class VertxTest extends AbstractTest {

	Vertx vertx = Vertx.vertx();
	Vertx vertxServer = Vertx.vertx();

	@BeforeClass
	public void beforeClass() {
		BlockingQueue<Integer> queue = new ArrayBlockingQueue<>(1);
		vertxServer.deployVerticle(HttpGSServer.class.getName(), new DeploymentOptions().setConfig(new GsDeploymentConfig()), result -> {
			try {
				queue.put(0);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
			;
		});
		try {
			queue.take();
		} catch (InterruptedException e) {
			e.printStackTrace();
			return;
		}
		System.out.println("beforeClass ok");
	}

	@Test(invocationCount = 10)
	public void test_001() {
		assert vertx != null;
		ClientEngine engine = new ClientEngine(vertx);
	}

	@AfterClass
	public void afterClass() {
		BlockingQueue<Integer> queue = new ArrayBlockingQueue<>(1);
		vertxServer.undeploy(HttpGSServer.class.getName(), result -> {
			try {
				queue.put(0);
			} catch (Exception e1) {
				e1.printStackTrace();
			}
		});
		try {
			queue.take();
		} catch (InterruptedException e) {
			e.printStackTrace();
			return;
		}
		System.out.println("afterClass ok");
	}
}

@@ -31,48 +31,8 @@
 e;%0A%0A
-import io.vertx.core.DeploymentOptions;%0A
 impo
@@ -55,17 +55,16 @@
 .Vertx;%0A
-%0A
 import j
@@ -146,16 +146,56 @@
 gQueue;%0A
+import org.genericsystem.kernel.Statics;
 %0Aimport 
@@ -429,16 +429,29 @@
 rtx();%0A%0A
+%09String id;%0A%0A
 %09@Before
@@ -493,39 +493,38 @@
 %09%09BlockingQueue%3C
-Integer
+String
 %3E queue = new Ar
@@ -609,16 +609,18 @@
 (), new 
+GS
 Deployme
@@ -633,44 +633,28 @@
 ons(
-).setConfig(new GsDeploymentConfig()
+Statics.ENGINE_VALUE
 ), r
@@ -679,33 +679,47 @@
 %7B%0A%09%09%09%09queue.put(
-0
+result.result()
 );%0A%09%09%09%7D catch (E
@@ -763,20 +763,16 @@
 ();%0A%09%09%09%7D
-%0A%09%09%09
 ;%0A%09%09%7D);%0A
@@ -774,32 +774,37 @@
 %09%7D);%0A%09%09try %7B%0A%09%09%09
+id = 
 queue.take();%0A%09%09
@@ -1183,58 +1183,80 @@
 loy(
-HttpGSServer.class.getName(), result -%3E %7B%0A%09%09%09try %7B
+id, result -%3E %7B%0A%09%09%09try %7B%0A%09%09%09%09assert result.succeeded() : result.cause();
 %0A%09%09%09

fix stop