use of com.thinkbiganalytics.spark.shell.SparkLauncherSparkShellProcess in project kylo by Teradata.
the class SparkShellClusterListenerTest method processStopped.
/**
* Verify message to cluster on process stopped.
*/
@Test
public void processStopped() {
// Mock cluster service
final ClusterService clusterService = Mockito.mock(ClusterService.class);
Mockito.when(clusterService.isClustered()).thenReturn(true);
// Test process stopped
final SparkShellClusterListener clusterListener = new SparkShellClusterListener(clusterService, Mockito.mock(SparkShellClusterDelegate.class));
final SparkLauncherSparkShellProcess process = Mockito.mock(SparkLauncherSparkShellProcess.class);
Mockito.when(process.getClientId()).thenReturn(CLIENT_ID);
clusterListener.processStopped(process);
// Verify message
final ArgumentCaptor<SparkShellProcessChangedMessage> messageCaptor = ArgumentCaptor.forClass(SparkShellProcessChangedMessage.class);
Mockito.verify(clusterService).sendMessageToOthers(Mockito.eq(SparkShellProcessChangedMessage.TYPE), messageCaptor.capture());
Assert.assertEquals(CLIENT_ID, messageCaptor.getValue().getClientId());
Assert.assertNull(messageCaptor.getValue().getProcess());
}
use of com.thinkbiganalytics.spark.shell.SparkLauncherSparkShellProcess in project kylo by Teradata.
the class SparkShellClusterListenerTest method processStarted.
/**
* Verify message to cluster on process started.
*/
@Test
public void processStarted() {
// Mock cluster service
final ClusterService clusterService = Mockito.mock(ClusterService.class);
Mockito.when(clusterService.isClustered()).thenReturn(true);
// Test process started
final SparkShellClusterListener clusterListener = new SparkShellClusterListener(clusterService, Mockito.mock(SparkShellClusterDelegate.class));
final SparkLauncherSparkShellProcess process = Mockito.mock(SparkLauncherSparkShellProcess.class);
Mockito.when(process.getClientId()).thenReturn(CLIENT_ID);
clusterListener.processStarted(process);
// Verify message
final ArgumentCaptor<SparkShellProcessChangedMessage> messageCaptor = ArgumentCaptor.forClass(SparkShellProcessChangedMessage.class);
Mockito.verify(clusterService).sendMessageToOthers(Mockito.eq(SparkShellProcessChangedMessage.TYPE), messageCaptor.capture());
Assert.assertEquals(CLIENT_ID, messageCaptor.getValue().getClientId());
Assert.assertEquals(process, messageCaptor.getValue().getProcess());
}
use of com.thinkbiganalytics.spark.shell.SparkLauncherSparkShellProcess in project kylo by Teradata.
the class SparkShellClusterListenerTest method processReady.
/**
* Verify message to cluster on process ready.
*/
@Test
public void processReady() {
// Mock cluster service
final ClusterService clusterService = Mockito.mock(ClusterService.class);
Mockito.when(clusterService.isClustered()).thenReturn(true);
// Test process ready
final SparkShellClusterListener clusterListener = new SparkShellClusterListener(clusterService, Mockito.mock(SparkShellClusterDelegate.class));
final SparkLauncherSparkShellProcess process = Mockito.mock(SparkLauncherSparkShellProcess.class);
Mockito.when(process.getClientId()).thenReturn(CLIENT_ID);
clusterListener.processReady(process);
// Verify message
final ArgumentCaptor<SparkShellProcessChangedMessage> messageCaptor = ArgumentCaptor.forClass(SparkShellProcessChangedMessage.class);
Mockito.verify(clusterService).sendMessageToOthers(Mockito.eq(SparkShellProcessChangedMessage.TYPE), messageCaptor.capture());
Assert.assertEquals(CLIENT_ID, messageCaptor.getValue().getClientId());
Assert.assertEquals(process, messageCaptor.getValue().getProcess());
}
Aggregations