Search in sources :

Example 76 with JsonObject

use of io.vertx.core.json.JsonObject in project vert.x by eclipse.

the class KeyStoreTest method testDefaultJKSOptionsJson.

@Test
public void testDefaultJKSOptionsJson() {
    JksOptions def = new JksOptions();
    JksOptions json = new JksOptions(new JsonObject());
    assertEquals(def.getPassword(), json.getPassword());
    assertEquals(def.getPath(), json.getPath());
    assertEquals(def.getValue(), json.getValue());
}
Also used : JksOptions(io.vertx.core.net.JksOptions) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 77 with JsonObject

use of io.vertx.core.json.JsonObject in project vert.x by eclipse.

the class KeyStoreTest method testKeyCertOptionsJson.

@Test
public void testKeyCertOptionsJson() throws Exception {
    PemKeyCertOptions options = new PemKeyCertOptions(new JsonObject());
    assertEquals(null, options.getKeyPath());
    assertEquals(null, options.getKeyValue());
    assertEquals(null, options.getCertPath());
    assertEquals(null, options.getCertValue());
    String keyPath = TestUtils.randomAlphaString(100);
    String keyValue = TestUtils.randomAlphaString(100);
    String certPath = TestUtils.randomAlphaString(100);
    String certValue = TestUtils.randomAlphaString(100);
    options = new PemKeyCertOptions(new JsonObject().put("keyPath", keyPath).put("keyValue", keyValue.getBytes()).put("certPath", certPath).put("certValue", certValue.getBytes()));
    assertEquals(keyPath, options.getKeyPath());
    assertEquals(Buffer.buffer(keyValue), options.getKeyValue());
    assertEquals(certPath, options.getCertPath());
    assertEquals(Buffer.buffer(certValue), options.getCertValue());
}
Also used : PemKeyCertOptions(io.vertx.core.net.PemKeyCertOptions) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 78 with JsonObject

use of io.vertx.core.json.JsonObject in project vert.x by eclipse.

the class KeyStoreTest method testPKCS12OptionsJson.

@Test
public void testPKCS12OptionsJson() throws Exception {
    PfxOptions options = new PfxOptions(new JsonObject());
    assertEquals(null, options.getPassword());
    assertEquals(null, options.getPath());
    assertEquals(null, options.getValue());
    String password = TestUtils.randomAlphaString(100);
    String path = TestUtils.randomAlphaString(100);
    String value = TestUtils.randomAlphaString(100);
    options = new PfxOptions(new JsonObject().put("password", password).put("path", path).put("value", value.getBytes()));
    assertEquals(password, options.getPassword());
    assertEquals(path, options.getPath());
    assertEquals(Buffer.buffer(value), options.getValue());
}
Also used : JsonObject(io.vertx.core.json.JsonObject) PfxOptions(io.vertx.core.net.PfxOptions) Test(org.junit.Test)

Example 79 with JsonObject

use of io.vertx.core.json.JsonObject in project vert.x by eclipse.

the class KeyStoreTest method testDefaultKeyCertOptionsJson.

@Test
public void testDefaultKeyCertOptionsJson() throws Exception {
    PemKeyCertOptions def = new PemKeyCertOptions();
    PemKeyCertOptions json = new PemKeyCertOptions(new JsonObject());
    assertEquals(def.getKeyPath(), json.getKeyPath());
    assertEquals(def.getCertPath(), json.getCertPath());
    assertEquals(def.getKeyValue(), json.getKeyValue());
    assertEquals(def.getCertValue(), json.getCertValue());
}
Also used : PemKeyCertOptions(io.vertx.core.net.PemKeyCertOptions) JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Example 80 with JsonObject

use of io.vertx.core.json.JsonObject in project vert.x by eclipse.

the class LauncherTest method testRunVerticleWithConfString.

@Test
public void testRunVerticleWithConfString() throws Exception {
    MyLauncher launcher = new MyLauncher();
    JsonObject conf = new JsonObject().put("foo", "bar").put("wibble", 123);
    String[] args = { "run", "java:" + TestVerticle.class.getCanonicalName(), "-conf", conf.encode() };
    launcher.dispatch(args);
    waitUntil(() -> TestVerticle.instanceCount.get() == 1);
    assertEquals(conf, TestVerticle.conf);
}
Also used : JsonObject(io.vertx.core.json.JsonObject) Test(org.junit.Test)

Aggregations

JsonObject (io.vertx.core.json.JsonObject)383 Test (org.junit.Test)210 JsonArray (io.vertx.core.json.JsonArray)89 HttpURLConnection (java.net.HttpURLConnection)68 Future (io.vertx.core.Future)55 Handler (io.vertx.core.Handler)51 Async (io.vertx.ext.unit.Async)50 Vertx (io.vertx.core.Vertx)48 TestContext (io.vertx.ext.unit.TestContext)48 VertxUnitRunner (io.vertx.ext.unit.junit.VertxUnitRunner)47 RunWith (org.junit.runner.RunWith)47 Timeout (org.junit.rules.Timeout)43 Before (org.junit.Before)41 Rule (org.junit.Rule)33 EventBusMessage (org.eclipse.hono.util.EventBusMessage)27 AsyncResult (io.vertx.core.AsyncResult)26 Buffer (io.vertx.core.buffer.Buffer)26 Constants (org.eclipse.hono.util.Constants)25 Mockito (org.mockito.Mockito)25 Objects (java.util.Objects)23