@Test
public void testAllOptions() throws Exception {
ServiceFactory factory = mock(ServiceFactory.class);
Service service = mock(Service.class);
when(factory.create((String) any())).thenReturn(service);
NodeMetadata node1 = new NodeMetadataImpl(null, "name1", "id1",
new LocationImpl(LocationScope.PROVIDER, "location-id1",
"location-desc1", null),
null, Collections.<String,String>emptyMap(), null, null, "image-id",
null, NodeState.RUNNING,
Lists.newArrayList("100.0.0.1"),
Lists.newArrayList("10.0.0.1"), null);
NodeMetadata node2 = new NodeMetadataImpl(null, "name2", "id2",
new LocationImpl(LocationScope.PROVIDER, "location-id2",
"location-desc2", null),
null, Collections.<String,String>emptyMap(), null, null, "image-id",
null, NodeState.RUNNING,
Lists.newArrayList("100.0.0.2"),
Lists.newArrayList("10.0.0.2"), null);
when(service.getNodes((ClusterSpec) any())).thenReturn(
(Set) Sets.newLinkedHashSet(Lists.newArrayList(node1, node2)));
ListClusterCommand command = new ListClusterCommand(factory);
int rc = command.run(null, out, null, Lists.newArrayList(