Esempio n. 1
0
 @Test
 public void testSet_GetCurrentDeviceName() throws Exception {
   //        Assert.assertTrue(TelnetUtils.getCurrentDeviceName() == null); //test null
   String currentDeviceName = new String("test");
   TelnetUtils.setCurrentDeviceName(currentDeviceName);
   Assert.assertTrue(TelnetUtils.getCurrentDeviceName().equals("test"));
 }
Esempio n. 2
0
 @Test
 public void testSet_GetConfigOver() throws Exception {
   Assert.assertTrue(!TelnetUtils.isConfigOver()); // test null
   Boolean configOver = true;
   TelnetUtils.setConfigOver(configOver);
   Assert.assertTrue(TelnetUtils.isConfigOver());
 }
Esempio n. 3
0
 @Test
 public void testSet_GetInstanceOfNewCliTemplate() throws Exception {
   //        Assert.assertEquals(TelnetUtils.getInstanceOfNewCliTemplate(),null);//test null
   String instanceOfNewCliTemplate = new String("test");
   TelnetUtils.setInstanceOfNewCliTemplate(instanceOfNewCliTemplate);
   Assert.assertTrue(TelnetUtils.getInstanceOfNewCliTemplate().equals("test"));
 }
Esempio n. 4
0
  @Test
  public void testConfigL3vpnOnDeviceByCli() throws Exception {
    String deviceName = new String("deviceNamePE1");
    String clearOldConfigString = new String("clearOldConfigString");
    String cliExecutionSequences = new String("cliExecutionSequences");

    telnetUtils.configL3vpnOnDeviceByCli(deviceName, clearOldConfigString, cliExecutionSequences);

    Assert.assertTrue(!TelnetUtils.isConfigOver());
    Assert.assertEquals(TelnetUtils.getInstanceOfClearCliTemplate(), "clearOldConfigString");
    Assert.assertEquals(TelnetUtils.getInstanceOfNewCliTemplate(), "cliExecutionSequences");
    Assert.assertEquals(TelnetUtils.getCurrentDeviceName(), "deviceNamePE1");
  }
Esempio n. 5
0
  @Test
  public void testStartConnectAndConfig() throws Exception {
    Class<TelnetUtils> class1 = TelnetUtils.class;
    Method method =
        class1.getDeclaredMethod(
            "startConnectAndConfig", new Class[] {SimpleChannelUpstreamHandler.class});
    Method method1 = class1.getDeclaredMethod("sendNewConfig");
    method.setAccessible(true);
    method1.setAccessible(true);

    SimpleChannelUpstreamHandler simpleChannelUpstreamHandler =
        mock(SimpleChannelUpstreamHandler.class);
    Assert.assertEquals(TelnetUtils.getCurrentDeviceName(), "deviceNamePE1");
    method.invoke(telnetUtils, simpleChannelUpstreamHandler);
    method1.invoke(telnetUtils);
  }
Esempio n. 6
0
 @Test
 public void testSetClearOver() throws Exception {
   Boolean clearOver = false;
   TelnetUtils.setClearOver(clearOver);
   Assert.assertTrue(!TelnetUtils.isClearOver());
 }
Esempio n. 7
0
 @Test
 public void testIsClearOver() throws Exception {
   Assert.assertTrue(TelnetUtils.isClearOver());
 }
Esempio n. 8
0
 @Test
 public void testClose() throws Exception {
   telnetUtils.close();
   Assert.assertTrue(telnetUtils != null);
 }