@Test public void checkMinMuleVersionAgainstDeploymentValidValueTest() throws IOException, ValidationException { MuleApplicationModel muleArtifact = new MuleApplicationModelJsonSerializer().deserialize("{ minMuleVersion:4.0.1 }"); when(deploymentConfigurationMock.getMuleVersion()).thenReturn(Optional.of("4.1.0")); checkMinMuleVersionValue(muleArtifact, missingFields, Optional.empty()); }
protected static void checkMinMuleVersionValue(MuleApplicationModel muleArtifact, List<String> missingFields, Optional<String> deployMuleVersion) throws ValidationException { String minMuleVersionValue = muleArtifact.getMinMuleVersion(); if (StringUtils.isBlank(minMuleVersionValue)) { missingFields.add("minMuleVersion"); } else { isProjectVersionValid(minMuleVersionValue); if (deployMuleVersion != null && deployMuleVersion.isPresent() && StringUtils.isNotBlank(deployMuleVersion.get())) { areVersionCompatible(deployMuleVersion.get(), minMuleVersionValue); } } }
MuleArtifactJsonValidator { protected static void checkMinMuleVersionValue(MuleApplicationModel muleArtifact, List<String> missingFields, Optional<String> deployMuleVersion) throws ValidationException { String minMuleVersionValue = muleArtifact.getMinMuleVersion(); if (StringUtils.isBlank(minMuleVersionValue)) { missingFields.add("minMuleVersion"); } else { isProjectVersionValid(minMuleVersionValue); if (deployMuleVersion != null && deployMuleVersion.isPresent() && StringUtils.isNotBlank(deployMuleVersion.get())) { areVersionCompatible(deployMuleVersion.get(), minMuleVersionValue); } } } }
MuleArtifactJsonValidator { protected static void checkMinMuleVersionValue(MuleApplicationModel muleArtifact, List<String> missingFields, Optional<String> deployMuleVersion) throws ValidationException { String minMuleVersionValue = muleArtifact.getMinMuleVersion(); if (StringUtils.isBlank(minMuleVersionValue)) { missingFields.add("minMuleVersion"); } else { isProjectVersionValid(minMuleVersionValue); if (deployMuleVersion != null && deployMuleVersion.isPresent() && StringUtils.isNotBlank(deployMuleVersion.get())) { areVersionCompatible(deployMuleVersion.get(), minMuleVersionValue); } } }  }
MuleArtifactJsonValidator { protected static void checkMinMuleVersionValue(MuleApplicationModel muleArtifact, List<String> missingFields, Optional<String> deployMuleVersion) throws ValidationException { String minMuleVersionValue = muleArtifact.getMinMuleVersion(); if (StringUtils.isBlank(minMuleVersionValue)) { missingFields.add("minMuleVersion"); } else { isProjectVersionValid(minMuleVersionValue); if (deployMuleVersion != null && deployMuleVersion.isPresent() && StringUtils.isNotBlank(deployMuleVersion.get())) { areVersionCompatible(deployMuleVersion.get(), minMuleVersionValue); } } }  static void validate(Path projectBaseDir, Optional<String> deployMuleVersion); static void isMuleArtifactJsonPresent(Path projectBaseDir); static void isMuleArtifactJsonValid(Path projectBaseDir, Optional<String> deployMuleVersion); }
MuleArtifactJsonValidator { protected static void checkMinMuleVersionValue(MuleApplicationModel muleArtifact, List<String> missingFields, Optional<String> deployMuleVersion) throws ValidationException { String minMuleVersionValue = muleArtifact.getMinMuleVersion(); if (StringUtils.isBlank(minMuleVersionValue)) { missingFields.add("minMuleVersion"); } else { isProjectVersionValid(minMuleVersionValue); if (deployMuleVersion != null && deployMuleVersion.isPresent() && StringUtils.isNotBlank(deployMuleVersion.get())) { areVersionCompatible(deployMuleVersion.get(), minMuleVersionValue); } } }  static void validate(Path projectBaseDir, Optional<String> deployMuleVersion); static void isMuleArtifactJsonPresent(Path projectBaseDir); static void isMuleArtifactJsonValid(Path projectBaseDir, Optional<String> deployMuleVersion);  }