@Test public void testAddFeatures() throws Exception { FeaturesService featureService = mock(FeaturesService.class); featureService.installFeature(anyString()); EasyMock.expectLastCall().times(3); replay(featureService); RunMojo mojo = new RunMojo(); setPrivateField(mojo, "featuresToInstall", "liquibase-core, ukelonn-db-derby-test, ukelonn"); mojo.addFeatures(featureService); verify(featureService); }
void addFeatures(Object featureService) throws MojoExecutionException { if (featuresToInstall != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method installFeatureMethod = serviceClass.getMethod("installFeature", String.class); String[] features = featuresToInstall.split(" *, *"); for (String feature : features) { installFeatureMethod.invoke(featureService, feature); Thread.sleep(1000L); } } catch (Exception e) { throw new MojoExecutionException("Failed to add features to karaf", e); } } }
RunMojo extends MojoSupport { void addFeatures(Object featureService) throws MojoExecutionException { if (featuresToInstall != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method installFeatureMethod = serviceClass.getMethod("installFeature", String.class); String[] features = featuresToInstall.split(" *, *"); for (String feature : features) { installFeatureMethod.invoke(featureService, feature); Thread.sleep(1000L); } } catch (Exception e) { throw new MojoExecutionException("Failed to add features to karaf", e); } } } }
RunMojo extends MojoSupport { void addFeatures(Object featureService) throws MojoExecutionException { if (featuresToInstall != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method installFeatureMethod = serviceClass.getMethod("installFeature", String.class); String[] features = featuresToInstall.split(" *, *"); for (String feature : features) { installFeatureMethod.invoke(featureService, feature); Thread.sleep(1000L); } } catch (Exception e) { throw new MojoExecutionException("Failed to add features to karaf", e); } } }  }
RunMojo extends MojoSupport { void addFeatures(Object featureService) throws MojoExecutionException { if (featuresToInstall != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method installFeatureMethod = serviceClass.getMethod("installFeature", String.class); String[] features = featuresToInstall.split(" *, *"); for (String feature : features) { installFeatureMethod.invoke(featureService, feature); Thread.sleep(1000L); } } catch (Exception e) { throw new MojoExecutionException("Failed to add features to karaf", e); } } }  void execute(); static void extract(File sourceFile, File targetFolder); }
RunMojo extends MojoSupport { void addFeatures(Object featureService) throws MojoExecutionException { if (featuresToInstall != null) { try { Class<? extends Object> serviceClass = featureService.getClass(); Method installFeatureMethod = serviceClass.getMethod("installFeature", String.class); String[] features = featuresToInstall.split(" *, *"); for (String feature : features) { installFeatureMethod.invoke(featureService, feature); Thread.sleep(1000L); } } catch (Exception e) { throw new MojoExecutionException("Failed to add features to karaf", e); } } }  void execute(); static void extract(File sourceFile, File targetFolder);  }