@Test public void testRunToolSuccess() throws Exception { Properties properties = new Properties(); String testKey = "testKey"; String testValue = "testValue"; properties.setProperty(testKey, testValue); when(namedCluster.isMapr()).thenReturn(true); String[] testArgs = {"testARgs"}; assertEquals(0, sqoopService.runTool(new ArrayList<>(Arrays.asList(testArgs)), properties)); verify(configuration).set(testKey, testValue); verify(hadoopShim) .configureConnectionInformation( eq(""), eq(""), eq(""), eq(""), eq(configuration), any(List.class)); verify(sqoopShim).runTool(eq(testArgs), eq(configuration)); assertEquals(Boolean.toString(true), System.getProperty(SqoopServiceImpl.SQOOP_THROW_ON_ERROR)); }
@Test public void testRunToolFailure() { when(namedCluster.isMapr()).thenThrow(new RuntimeException()); assertEquals(1, sqoopService.runTool(new ArrayList<String>(), new Properties())); }