Java Code Examples for io.vertx.core.DeploymentOptions#setConfig()
The following examples show how to use
io.vertx.core.DeploymentOptions#setConfig() .
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: KafkaModuleDeployWithCorrectConfigIntegrationTest.java From vertx-kafka-service with Apache License 2.0 | 6 votes |
@Test public void test(TestContext testContext) throws Exception { JsonObject config = makeDefaultConfig(); config.put(KafkaProducerProperties.ADDRESS, ADDRESS); config.put(KafkaProducerProperties.DEFAULT_TOPIC, TOPIC); final DeploymentOptions deploymentOptions = new DeploymentOptions(); deploymentOptions.setConfig(config); deploy(testContext, deploymentOptions); final Async async = testContext.async(); try { sendMessage(testContext, async); } catch (Exception e) { testContext.fail(e); } }
Example 2
Source File: ServiceEntryPointTestQueryParam.java From vert.x-microservice with Apache License 2.0 | 5 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch = new CountDownLatch(1); CountDownLatch latch2 = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the module so you // don't have to hardecode it in your tests getVertx().deployVerticle("org.jacpfx.vertx.entrypoint.ServiceEntryPoint",options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete (or failed) System.out.println("start entry point: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! latch.countDown(); }); awaitLatch(latch); getVertx().deployVerticle(new WsServiceOne(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx(). createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 3
Source File: RESTServiceBlockingChainByteTest.java From vxms with Apache License 2.0 | 5 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceOne(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 4
Source File: Vertx3GatewayTestServer.java From apiman with Apache License 2.0 | 5 votes |
@Override public void start() { try { if (clustered) { CountDownLatch clusteredStart = new CountDownLatch(1); Vertx.clusteredVertx(new VertxOptions().setClustered(clustered).setClusterHost("localhost").setBlockedThreadCheckInterval(9999999), result -> { if (result.succeeded()) { System.out.println("**** Clustered Vert.x started up successfully! ****"); this.vertx = result.result(); clusteredStart.countDown(); } else { throw new RuntimeException(result.cause()); } }); clusteredStart.await(); } else { vertx = Vertx.vertx(new VertxOptions().setBlockedThreadCheckInterval(9999999)); } echoServer.start(); startLatch = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions(); options.setConfig(vertxConf); vertx.deployVerticle(InitVerticle.class.getCanonicalName(), options, result -> { if (result.succeeded()) { System.out.println("*** Started Non-clustered Vert.x successfully ***"); } else { throw new RuntimeException("InitVerticle deployment failed", result.cause()); } startLatch.countDown(); }); startLatch.await(); } catch (Exception e) { throw new RuntimeException(e); } }
Example 5
Source File: KafkaConsumerDeployWithIncorrectConfigIntegrationTest.java From vertx-kafka-service with Apache License 2.0 | 5 votes |
@Test public void testUnresolvableBoostrapUrl(TestContext testContext) throws Exception { final JsonObject config = makeDefaultConfig(); config.put(KafkaConsumerProperties.KEY_BOOTSTRAP_SERVERS, "someUnresolvableUrl.fail:9092"); final Async async = testContext.async(); final DeploymentOptions deploymentOptions = new DeploymentOptions(); deploymentOptions.setConfig(config); vertx.deployVerticle(SERVICE_NAME, deploymentOptions, asyncResult -> { testContext.assertTrue(asyncResult.failed()); testContext.assertNotNull("DeploymentID should not be null", asyncResult.result()); testContext.assertEquals("Failed to construct kafka consumer", asyncResult.cause().getMessage()); async.complete(); }); }
Example 6
Source File: RESTJerseyClientErrorTests.java From vxms with Apache License 2.0 | 5 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceOne(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 7
Source File: WSServiceSelfhostedTest.java From vert.x-microservice with Apache License 2.0 | 5 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch = new CountDownLatch(1); CountDownLatch latch2 = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the module so you // don't have to hardecode it in your tests getVertx().deployVerticle("org.jacpfx.vertx.entrypoint.ServiceEntryPoint",options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete (or failed) System.out.println("start entry point: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! latch.countDown(); }); awaitLatch(latch); getVertx().deployVerticle(new WsServiceOne(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx(). createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 8
Source File: RESTJerseyMimeTypeClientTests.java From vxms with Apache License 2.0 | 5 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceOne(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 9
Source File: RESTServiceChainStringTest.java From vxms with Apache License 2.0 | 5 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceOne(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 10
Source File: EventbusChainingStringTest.java From vxms with Apache License 2.0 | 5 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests WsServiceOne one = new WsServiceOne(); one.init(vertx, vertx.getOrCreateContext()); getVertx() .deployVerticle( one, options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 11
Source File: ManualTest.java From vertx-kafka-service with Apache License 2.0 | 5 votes |
public static void main(String[] args) { JsonObject config = new JsonObject(); config.put(KafkaProducerProperties.ADDRESS, "test-address"); config.put(KafkaProducerProperties.BOOTSTRAP_SERVERS, KafkaProducerProperties.BOOTSTRAP_SERVERS_DEFAULT); config.put(KafkaProducerProperties.DEFAULT_TOPIC, "test-topic"); config.put(KafkaProducerProperties.ACKS, KafkaProducerProperties.ACKS_DEFAULT); final Vertx vertx = Vertx.vertx(); final DeploymentOptions deploymentOptions = new DeploymentOptions(); deploymentOptions.setConfig(config); vertx.deployVerticle("service:com.hubrick.services.kafka-producer", deploymentOptions, result -> { System.out.println(result.result()); JsonObject jsonObject = new JsonObject(); jsonObject.put("payload", "your message goes here".getBytes()); final KafkaProducerService kafkaProducerService = KafkaProducerService.createProxy(vertx, "test-address"); kafkaProducerService.sendBytes(new ByteKafkaMessage(Buffer.buffer("your message goes here".getBytes()), "test-partition"), response -> { if (response.succeeded()) { System.out.println("OK"); } else { System.out.println("Failed"); response.cause().printStackTrace(); } vertx.close(); }); }); }
Example 12
Source File: EventbusBlockingChainingObjectTest.java From vxms with Apache License 2.0 | 5 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests WsServiceOne one = new WsServiceOne(); one.init(vertx, vertx.getOrCreateContext()); getVertx() .deployVerticle( one, options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 13
Source File: RESTServiceOnFailureByteResponseTest.java From vxms with Apache License 2.0 | 5 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceOne(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); awaitLatch(latch2); }
Example 14
Source File: RESTServiceChainByteTest.java From vxms with Apache License 2.0 | 5 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(1); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceOne(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 15
Source File: RESTJerseyClientEventByteCircuitBreakerTest.java From vxms with Apache License 2.0 | 4 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(3); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceTwo(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); getVertx() .deployVerticle( new TestVerticle(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); getVertx() .deployVerticle( new TestErrorVerticle(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 16
Source File: RESTJerseyClientCORSTest.java From vxms with Apache License 2.0 | 4 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(3); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceOne(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); getVertx() .deployVerticle( new WsServiceTwo(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); getVertx() .deployVerticle( new WsServiceThree(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 17
Source File: RESTJerseyClientEventByteResponseTest.java From vxms with Apache License 2.0 | 4 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(3); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceTwo(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); getVertx() .deployVerticle( new TestVerticle(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); getVertx() .deployVerticle( new TestErrorVerticle(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 18
Source File: Main.java From vertx-maven-plugin with Apache License 2.0 | 4 votes |
@Override public void beforeDeployingVerticle(DeploymentOptions deploymentOptions) { String prefix = "Buongiorno"; deploymentOptions.setConfig(new JsonObject().put("prefix", prefix)); }
Example 19
Source File: RESTJerseyClientEventByteResponseAsyncTest.java From vxms with Apache License 2.0 | 4 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(3); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceTwo(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); getVertx() .deployVerticle( new TestVerticle(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); getVertx() .deployVerticle( new TestErrorVerticle(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }
Example 20
Source File: StaticPostConstructTest.java From vxms with Apache License 2.0 | 4 votes |
@Before public void startVerticles() throws InterruptedException { CountDownLatch latch2 = new CountDownLatch(2); DeploymentOptions options = new DeploymentOptions().setInstances(1); options.setConfig(new JsonObject().put("clustered", false).put("host", HOST)); // Deploy the module - the System property `vertx.modulename` will contain the name of the // module so you // don'failure have to hardecode it in your tests getVertx() .deployVerticle( new WsServiceOne(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); getVertx() .deployVerticle( new WsServiceTwo(), options, asyncResult -> { // Deployment is asynchronous and this this handler will be called when it's complete // (or failed) System.out.println("start service: " + asyncResult.succeeded()); assertTrue(asyncResult.succeeded()); assertNotNull("deploymentID should not be null", asyncResult.result()); // If deployed correctly then start the tests! // latch2.countDown(); latch2.countDown(); }); client = getVertx().createHttpClient(new HttpClientOptions()); awaitLatch(latch2); }