Package org.apache.ambari.shell.completion

Examples of org.apache.ambari.shell.completion.Host


  public void testAssignForInvalidHostGroup() {
    Map<String, List<String>> map = singletonMap("group1", asList("host", "host2"));
    ReflectionTestUtils.setField(clusterCommands, "hostGroups", map);
    when(client.getHostNames()).thenReturn(singletonMap("host3", "HEALTHY"));

    String result = clusterCommands.assign(new Host("host3"), "group0");

    assertEquals("group0 is not a valid host group", result);
  }
View Full Code Here


    Map<String, List<String>> map = new HashMap<String, List<String>>();
    map.put("group1", new ArrayList<String>());
    ReflectionTestUtils.setField(clusterCommands, "hostGroups", map);
    when(client.getHostNames()).thenReturn(singletonMap("host3", "HEALTHY"));

    String result = clusterCommands.assign(new Host("host3"), "group1");

    assertEquals("host3 has been added to group1", result);
  }
View Full Code Here

    Map<String, List<String>> map = new HashMap<String, List<String>>();
    map.put("group1", new ArrayList<String>());
    ReflectionTestUtils.setField(clusterCommands, "hostGroups", map);
    when(client.getHostNames()).thenReturn(singletonMap("host2", "HEALTHY"));

    String result = clusterCommands.assign(new Host("host3"), "group1");

    assertEquals("host3 is not a valid hostname", result);
  }
View Full Code Here

  @Test
  public void testFocusHostForValidHost() {
    when(client.getHostNames()).thenReturn(singletonMap("host1", "HEALTHY"));

    String result = hostCommands.focusHost(new Host("host1"));

    verify(context).setFocus("host1", FocusType.HOST);
    assertEquals("Focus set to: host1", result);
  }
View Full Code Here

  @Test
  public void testFocusHostForInvalidHost() {
    when(client.getHostNames()).thenReturn(singletonMap("host3", "HEALTHY"));

    String result = hostCommands.focusHost(new Host("host1"));

    verify(context, times(0)).setFocus("host1", FocusType.HOST);
    assertEquals("host1 is not a valid host name", result);
  }
View Full Code Here

    return Host.class.isAssignableFrom(type);
  }

  @Override
  public Host convertFromText(String value, Class<?> targetType, String optionContext) {
    return new Host(value);
  }
View Full Code Here

TOP

Related Classes of org.apache.ambari.shell.completion.Host

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.