public ListClusterCommand(ClusterControllerFactory factory) { this(factory, new ClusterStateStoreFactory()); }
/** * Create the cluster state store object */ protected ClusterStateStore createClusterStateStore(ClusterSpec spec) { return stateStoreFactory.create(spec); }
private Cluster.Instance findPigInstance() throws IOException { Cluster cluster = new ClusterStateStoreFactory().create(clusterSpec).load(); return cluster.getInstanceMatching(anyRoleIn(newHashSet(PIG_CLIENT_ROLE))); } }
private Cluster.Instance findMahoutInstance() throws IOException { Cluster cluster = new ClusterStateStoreFactory().create(clusterSpec).load(); return cluster.getInstanceMatching(anyRoleIn(newHashSet(MAHOUT_CLIENT_ROLE))); } }
public RunScriptCommand(ClusterControllerFactory factory) { this(factory, new ClusterStateStoreFactory()); }
/** * Create the cluster state store object */ protected ClusterStateStore createClusterStateStore(ClusterSpec spec) { return stateStoreFactory.create(spec); }
public ConfigureServicesCommand(ClusterControllerFactory factory) { this(factory, new ClusterStateStoreFactory()); }
public ClusterStateStore getClusterStateStore(ClusterSpec clusterSpec) { return stateStoreFactory.create(clusterSpec); }
public RestartServicesCommand(ClusterControllerFactory factory) { this(factory, new ClusterStateStoreFactory()); }
public ClusterStateStore getClusterStateStore(ClusterSpec clusterSpec) { return stateStoreFactory.create(clusterSpec); }
public StartServicesCommand(ClusterControllerFactory factory) { this(factory, new ClusterStateStoreFactory()); }
@Test public void testRunScriptByRole() throws Exception { ClusterControllerFactory factory = mock(ClusterControllerFactory.class); ClusterController controller = mock(ClusterController.class); when(factory.create((String)any())).thenReturn(controller); ClusterStateStore memStore = new MemoryClusterStateStore(); memStore.save(createTestCluster( new String[]{"reg/A", "reg/B"}, new String[]{"A", "B"})); ClusterStateStoreFactory stateStoreFactory = mock(ClusterStateStoreFactory.class); when(stateStoreFactory.create((ClusterSpec) any())).thenReturn(memStore); RunScriptCommand command = new RunScriptCommand(factory, stateStoreFactory); Map<String, File> keys = KeyPair.generateTemporaryFiles(); int rc = command.run(null, out, System.err, Lists.newArrayList( "--instance-templates", "1 noop", "--script", "/dev/null", "--roles", "A", "--cluster-name", "test-cluster", "--provider", "provider", "--identity", "myusername", "--credential", "mypassword", "--private-key-file", keys.get("private").getAbsolutePath() )); assertThat(rc, is(0)); ArgumentCaptor<Predicate> predicate = ArgumentCaptor.forClass(Predicate.class); verify(controller).runScriptOnNodesMatching( (ClusterSpec)any(), predicate.capture(), (Statement) any()); // check predicate equality by using the object string representation Predicate<NodeMetadata> expected = Predicates.and( Predicates.<NodeMetadata>alwaysTrue(), withIds("reg/A")); assertThat(predicate.getValue().toString(), is(expected.toString())); }
public StopServicesCommand(ClusterControllerFactory factory) { this(factory, new ClusterStateStoreFactory()); }
when(stateStoreFactory.create((ClusterSpec) any())).thenReturn(memStore);
public StartServicesCommand(ClusterControllerFactory factory) { this(factory, new ClusterStateStoreFactory()); }
public AbstractClusterCommand(String name, String description, ClusterControllerFactory factory) { this(name, description, factory, new ClusterStateStoreFactory()); }
public StopServicesCommand(ClusterControllerFactory factory) { this(factory, new ClusterStateStoreFactory()); }
public CleanupClusterCommand(ClusterControllerFactory factory) { this(factory, new ClusterStateStoreFactory()); }
public ConfigureServicesCommand(ClusterControllerFactory factory) { this(factory, new ClusterStateStoreFactory()); }
public AbstractClusterCommand(String name, String description, ClusterControllerFactory factory) { this(name, description, factory, new ClusterStateStoreFactory()); }