예제 #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"));
 }
예제 #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());
 }
예제 #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"));
 }
예제 #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");
  }
예제 #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);
  }
예제 #6
0
 @Test
 public void testSetClearOver() throws Exception {
   Boolean clearOver = false;
   TelnetUtils.setClearOver(clearOver);
   Assert.assertTrue(!TelnetUtils.isClearOver());
 }
예제 #7
0
 @Test
 public void testIsClearOver() throws Exception {
   Assert.assertTrue(TelnetUtils.isClearOver());
 }
예제 #8
0
 @Test
 public void testClose() throws Exception {
   telnetUtils.close();
   Assert.assertTrue(telnetUtils != null);
 }