@Test public void testUpdatedNull() throws Exception { final NetconfConfiguration config = NetconfConfiguration.getInstance(); Assert.assertEquals(new InetSocketAddress("0.0.0.0", 1830), config.getSshServerAddress()); Assert.assertEquals(new InetSocketAddress("127.0.0.1", 8383), config.getTcpServerAddress()); Assert.assertEquals("./configuration/RSA.pk", config.getPrivateKeyPath()); final Dictionary<String, String> nullDictionary = null; config.updated(nullDictionary); Assert.assertEquals(new InetSocketAddress("0.0.0.0", 1830), config.getSshServerAddress()); Assert.assertEquals(new InetSocketAddress("127.0.0.1", 8383), config.getTcpServerAddress()); Assert.assertEquals("./configuration/RSA.pk", config.getPrivateKeyPath()); }
@Test public void testUpdated() throws Exception { final NetconfConfiguration config = NetconfConfiguration.getInstance(); Assert.assertEquals(new InetSocketAddress("0.0.0.0", 1830), config.getSshServerAddress()); Assert.assertEquals(new InetSocketAddress("127.0.0.1", 8383), config.getTcpServerAddress()); Assert.assertEquals("./configuration/RSA.pk", config.getPrivateKeyPath()); final Dictionary<String, String> newValues = new Hashtable<>(); final String newSshIp = "192.168.1.1"; final String newTcpIp = "192.168.1.2"; final int newSshPort = 1234; final int newTcpPort = 4567; final String newSshKeyPath = "./new_folder/configuration/RSA.pk"; newValues.put("ssh-address", newSshIp); newValues.put("ssh-port", Integer.toString(newSshPort)); newValues.put("tcp-address", newTcpIp); newValues.put("tcp-port", Integer.toString(newTcpPort)); newValues.put("ssh-pk-path", newSshKeyPath); config.updated(newValues); Assert.assertEquals(new InetSocketAddress(newSshIp, newSshPort), config.getSshServerAddress()); Assert.assertEquals(new InetSocketAddress(newTcpIp, newTcpPort), config.getTcpServerAddress()); Assert.assertEquals(newSshKeyPath, config.getPrivateKeyPath()); }