@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()); }
PemKeyCertOptions options = new PemKeyCertOptions(new JsonObject()); assertEquals(null, options.getKeyPath()); assertEquals(null, options.getKeyValue()); assertEquals(null, options.getCertPath()); assertEquals(null, options.getCertValue()); put("certValue", certValue1.getBytes())); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue()); put("certValues", new JsonArray().add(certValue1.getBytes()).add(certValue2.getBytes()))); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue());
options = new PemKeyCertOptions(options); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue()); options = new PemKeyCertOptions(options.toJson()); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue()); options = new PemKeyCertOptions(options); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue()); options = new PemKeyCertOptions(options.toJson()); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue());
@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()); }
PemKeyCertOptions options = new PemKeyCertOptions(new JsonObject()); assertEquals(null, options.getKeyPath()); assertEquals(null, options.getKeyValue()); assertEquals(null, options.getCertPath()); assertEquals(null, options.getCertValue()); put("certValue", certValue1.getBytes())); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue()); put("certValues", new JsonArray().add(certValue1.getBytes()).add(certValue2.getBytes()))); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue());
options = new PemKeyCertOptions(options); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue()); options = new PemKeyCertOptions(options.toJson()); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue()); options = new PemKeyCertOptions(options); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue()); options = new PemKeyCertOptions(options.toJson()); assertEquals(keyPath1, options.getKeyPath()); assertEquals(keyValue1, options.getKeyValue()); assertEquals(certPath1, options.getCertPath()); assertEquals(certValue1, options.getCertValue());