@Test public void isMuleArtifactJsonValidEmptyFileTest() throws IOException, ValidationException { expectedException.expect(ValidationException.class); expectedException.expectMessage("The mule-artifact.json file is empty"); isMuleArtifactJsonValid(projectBaseFolder.getRoot().toPath(), Optional.empty()); }
public static void isMuleArtifactJsonValid(Path projectBaseDir, Optional<String> deployMuleVersion) throws ValidationException { File muleArtifactJsonFile = projectBaseDir.resolve(MULE_ARTIFACT_JSON).toFile(); MuleApplicationModel muleArtifact; try { muleArtifact = new MuleApplicationModelJsonSerializer().deserialize(FileUtils.readFileToString(muleArtifactJsonFile, (String) null)); if (muleArtifact == null) { throw new ValidationException("The mule-artifact.json file is empty"); } } catch (IOException | JsonSyntaxException e) { throw new ValidationException(e); } validateMuleArtifactMandatoryFields(muleArtifact, deployMuleVersion); }
MuleArtifactJsonValidator { public static void isMuleArtifactJsonValid(Path projectBaseDir, Optional<String> deployMuleVersion) throws ValidationException { File muleArtifactJsonFile = projectBaseDir.resolve(MULE_ARTIFACT_JSON).toFile(); MuleApplicationModel muleArtifact; try { muleArtifact = new MuleApplicationModelJsonSerializer().deserialize(FileUtils.readFileToString(muleArtifactJsonFile, (String) null)); if (muleArtifact == null) { throw new ValidationException("The mule-artifact.json file is empty"); } } catch (IOException | JsonSyntaxException e) { throw new ValidationException(e); } validateMuleArtifactMandatoryFields(muleArtifact, deployMuleVersion); } }
MuleArtifactJsonValidator { public static void isMuleArtifactJsonValid(Path projectBaseDir, Optional<String> deployMuleVersion) throws ValidationException { File muleArtifactJsonFile = projectBaseDir.resolve(MULE_ARTIFACT_JSON).toFile(); MuleApplicationModel muleArtifact; try { muleArtifact = new MuleApplicationModelJsonSerializer().deserialize(FileUtils.readFileToString(muleArtifactJsonFile, (String) null)); if (muleArtifact == null) { throw new ValidationException("The mule-artifact.json file is empty"); } } catch (IOException | JsonSyntaxException e) { throw new ValidationException(e); } validateMuleArtifactMandatoryFields(muleArtifact, deployMuleVersion); }  }
MuleArtifactJsonValidator { public static void isMuleArtifactJsonValid(Path projectBaseDir, Optional<String> deployMuleVersion) throws ValidationException { File muleArtifactJsonFile = projectBaseDir.resolve(MULE_ARTIFACT_JSON).toFile(); MuleApplicationModel muleArtifact; try { muleArtifact = new MuleApplicationModelJsonSerializer().deserialize(FileUtils.readFileToString(muleArtifactJsonFile, (String) null)); if (muleArtifact == null) { throw new ValidationException("The mule-artifact.json file is empty"); } } catch (IOException | JsonSyntaxException e) { throw new ValidationException(e); } validateMuleArtifactMandatoryFields(muleArtifact, deployMuleVersion); }  static void validate(Path projectBaseDir, Optional<String> deployMuleVersion); static void isMuleArtifactJsonPresent(Path projectBaseDir); static void isMuleArtifactJsonValid(Path projectBaseDir, Optional<String> deployMuleVersion); }
MuleArtifactJsonValidator { public static void isMuleArtifactJsonValid(Path projectBaseDir, Optional<String> deployMuleVersion) throws ValidationException { File muleArtifactJsonFile = projectBaseDir.resolve(MULE_ARTIFACT_JSON).toFile(); MuleApplicationModel muleArtifact; try { muleArtifact = new MuleApplicationModelJsonSerializer().deserialize(FileUtils.readFileToString(muleArtifactJsonFile, (String) null)); if (muleArtifact == null) { throw new ValidationException("The mule-artifact.json file is empty"); } } catch (IOException | JsonSyntaxException e) { throw new ValidationException(e); } validateMuleArtifactMandatoryFields(muleArtifact, deployMuleVersion); }  static void validate(Path projectBaseDir, Optional<String> deployMuleVersion); static void isMuleArtifactJsonPresent(Path projectBaseDir); static void isMuleArtifactJsonValid(Path projectBaseDir, Optional<String> deployMuleVersion);  }