@Test public void testRecipe_nonOfficial_withWarnings_1() throws Exception { ValidateApplicationMojo mojo = retriveAndPrepareMojo( "recipe" ); MavenProject project = (MavenProject) this.rule.getVariableValueFromObject( mojo, "project" ); this.rule.setVariableValueToObject( mojo, "recipe", true ); mojo.execute(); File resultsFile = new File( project.getBasedir(), MavenPluginConstants.VALIDATION_RESULT_PATH ); Assert.assertTrue( resultsFile.exists()); }
@Override public void execute() throws MojoExecutionException, MojoFailureException { File completeAppDirectory = new File( this.project.getBuild().getOutputDirectory()); if( ! completeAppDirectory.isDirectory()) throw new MojoExecutionException( "The target model directory could not be found. " + completeAppDirectory ); Collection<RoboconfError> reusableRecipeErrors = Collections.emptyList(); ProjectValidationResult pvr = ProjectValidator.validateProject( completeAppDirectory, this.recipe ); if( this.recipe ) { reusableRecipeErrors = validateRecipesSpecifics( this.project, pvr.getRawParsingResult().getApplicationTemplate(), this.official ); pvr.getErrors().addAll( reusableRecipeErrors ); } try { if( pvr.getErrors().size() > 0 ) { reportErrors( pvr.getErrors()); if( RoboconfErrorHelpers.containsCriticalErrors( pvr.getErrors())) throw new MojoFailureException( "Errors were found in the application." ); if( this.official && ! reusableRecipeErrors.isEmpty()) throw new MojoFailureException( "Warnings were found in official recipes. Please, fix them." ); } } catch( IOException e ) { throw new MojoExecutionException( "A problem occurred during the validation.", e ); } }
ValidateApplicationMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { File completeAppDirectory = new File( this.project.getBuild().getOutputDirectory()); if( ! completeAppDirectory.isDirectory()) throw new MojoExecutionException( "The target model directory could not be found. " + completeAppDirectory ); Collection<RoboconfError> reusableRecipeErrors = Collections.emptyList(); ProjectValidationResult pvr = ProjectValidator.validateProject( completeAppDirectory, this.recipe ); if( this.recipe ) { reusableRecipeErrors = validateRecipesSpecifics( this.project, pvr.getRawParsingResult().getApplicationTemplate(), this.official ); pvr.getErrors().addAll( reusableRecipeErrors ); } try { if( pvr.getErrors().size() > 0 ) { reportErrors( pvr.getErrors()); if( RoboconfErrorHelpers.containsCriticalErrors( pvr.getErrors())) throw new MojoFailureException( "Errors were found in the application." ); if( this.official && ! reusableRecipeErrors.isEmpty()) throw new MojoFailureException( "Warnings were found in official recipes. Please, fix them." ); } } catch( IOException e ) { throw new MojoExecutionException( "A problem occurred during the validation.", e ); } } }
ValidateApplicationMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { File completeAppDirectory = new File( this.project.getBuild().getOutputDirectory()); if( ! completeAppDirectory.isDirectory()) throw new MojoExecutionException( "The target model directory could not be found. " + completeAppDirectory ); Collection<RoboconfError> reusableRecipeErrors = Collections.emptyList(); ProjectValidationResult pvr = ProjectValidator.validateProject( completeAppDirectory, this.recipe ); if( this.recipe ) { reusableRecipeErrors = validateRecipesSpecifics( this.project, pvr.getRawParsingResult().getApplicationTemplate(), this.official ); pvr.getErrors().addAll( reusableRecipeErrors ); } try { if( pvr.getErrors().size() > 0 ) { reportErrors( pvr.getErrors()); if( RoboconfErrorHelpers.containsCriticalErrors( pvr.getErrors())) throw new MojoFailureException( "Errors were found in the application." ); if( this.official && ! reusableRecipeErrors.isEmpty()) throw new MojoFailureException( "Warnings were found in official recipes. Please, fix them." ); } } catch( IOException e ) { throw new MojoExecutionException( "A problem occurred during the validation.", e ); } }  }
ValidateApplicationMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { File completeAppDirectory = new File( this.project.getBuild().getOutputDirectory()); if( ! completeAppDirectory.isDirectory()) throw new MojoExecutionException( "The target model directory could not be found. " + completeAppDirectory ); Collection<RoboconfError> reusableRecipeErrors = Collections.emptyList(); ProjectValidationResult pvr = ProjectValidator.validateProject( completeAppDirectory, this.recipe ); if( this.recipe ) { reusableRecipeErrors = validateRecipesSpecifics( this.project, pvr.getRawParsingResult().getApplicationTemplate(), this.official ); pvr.getErrors().addAll( reusableRecipeErrors ); } try { if( pvr.getErrors().size() > 0 ) { reportErrors( pvr.getErrors()); if( RoboconfErrorHelpers.containsCriticalErrors( pvr.getErrors())) throw new MojoFailureException( "Errors were found in the application." ); if( this.official && ! reusableRecipeErrors.isEmpty()) throw new MojoFailureException( "Warnings were found in official recipes. Please, fix them." ); } } catch( IOException e ) { throw new MojoExecutionException( "A problem occurred during the validation.", e ); } }  @Override void execute(); }
ValidateApplicationMojo extends AbstractMojo { @Override public void execute() throws MojoExecutionException, MojoFailureException { File completeAppDirectory = new File( this.project.getBuild().getOutputDirectory()); if( ! completeAppDirectory.isDirectory()) throw new MojoExecutionException( "The target model directory could not be found. " + completeAppDirectory ); Collection<RoboconfError> reusableRecipeErrors = Collections.emptyList(); ProjectValidationResult pvr = ProjectValidator.validateProject( completeAppDirectory, this.recipe ); if( this.recipe ) { reusableRecipeErrors = validateRecipesSpecifics( this.project, pvr.getRawParsingResult().getApplicationTemplate(), this.official ); pvr.getErrors().addAll( reusableRecipeErrors ); } try { if( pvr.getErrors().size() > 0 ) { reportErrors( pvr.getErrors()); if( RoboconfErrorHelpers.containsCriticalErrors( pvr.getErrors())) throw new MojoFailureException( "Errors were found in the application." ); if( this.official && ! reusableRecipeErrors.isEmpty()) throw new MojoFailureException( "Warnings were found in official recipes. Please, fix them." ); } } catch( IOException e ) { throw new MojoExecutionException( "A problem occurred during the validation.", e ); } }  @Override void execute();  }