use of com.sequenceiq.ambari.shell.completion.Host in project ambari-shell by sequenceiq.
the class ClusterCommandsTest method testAssignForInvalidHostGroup.
@Test
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);
}
use of com.sequenceiq.ambari.shell.completion.Host in project ambari-shell by sequenceiq.
the class ClusterCommandsTest method testAssignForValidHostGroup.
@Test
public void testAssignForValidHostGroup() {
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);
}
use of com.sequenceiq.ambari.shell.completion.Host in project ambari-shell by sequenceiq.
the class HostCommandsTest method testFocusHostForValidHost.
@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);
}
use of com.sequenceiq.ambari.shell.completion.Host in project ambari-shell by sequenceiq.
the class ClusterCommandsTest method testAssignForInvalidHost.
@Test
public void testAssignForInvalidHost() {
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);
}
use of com.sequenceiq.ambari.shell.completion.Host in project ambari-shell by sequenceiq.
the class HostCommandsTest method testFocusHostForInvalidHost.
@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);
}
Aggregations