use of com.thinkbiganalytics.spark.shell.SparkShellProcessManager in project kylo by Teradata.
the class SparkFileSchemaParserServiceTest method parseQueryResult.
private Schema parseQueryResult(List<QueryResultColumn> columns, SparkFileSchemaParserService.SparkFileType sparkFileType, TableSchemaType tableSchemaType) throws Exception {
final SparkShellRestClient restClient = Mockito.mock(SparkShellRestClient.class);
final SparkShellProcessManager sparkShellProcessManager = Mockito.mock(SparkShellProcessManager.class);
SparkFileSchemaParserService service = Mockito.mock(SparkFileSchemaParserService.class);
Whitebox.setInternalState(service, "shellProcessManager", sparkShellProcessManager);
Whitebox.setInternalState(service, "restClient", restClient);
Mockito.when(service.doParse(Mockito.any(InputStream.class), Mockito.any(), Mockito.any())).thenCallRealMethod();
Mockito.when(sparkShellProcessManager.getSystemProcess()).thenReturn(null);
Mockito.when(restClient.transform(Mockito.any(), Mockito.any())).thenReturn(transformResponse(columns));
byte[] b = new byte[] {};
InputStream inputStream = new ByteArrayInputStream(b);
Schema schema = service.doParse(inputStream, sparkFileType, tableSchemaType);
return schema;
}
Aggregations