Skip to content

Commit

Permalink
update pom checker
Browse files Browse the repository at this point in the history
  • Loading branch information
alx652 committed Feb 1, 2024
1 parent 0b19647 commit 4fc5769
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class SubstancesPomsVersionTest {
// Set to true when testing in IDE
boolean turnOffPomParameterCheck = false;

String shortVersion;
String longVersion;
String starterModuleVersion;
String substancesModuleVersion;
String rootDir;
String propertiesFile;
String installExtraJarsScriptText;
Expand All @@ -40,11 +40,10 @@ public void setup() {

try {
Properties properties = PomUtilities.readPomVersionProperties(rootDir + "/" + propertiesFile);
shortVersion = properties.getProperty("project.shortVersion");
longVersion = properties.getProperty("project.longVersion");
assertNotNull(shortVersion);
System.out.println("shortVersion: " + shortVersion);
System.out.println("longVersion: " + longVersion);
starterModuleVersion = properties.getProperty("gsrs.substances.pomversiontest.starterModuleVersion");
substancesModuleVersion = properties.getProperty("gsrs.substances.pomversiontest.substancesModuleVersion");
assertNotNull(starterModuleVersion);
assertNotNull(substancesModuleVersion);
} catch (IOException e) {
throw new RuntimeException(e);
}
Expand All @@ -66,16 +65,18 @@ public void testPomCheck() {
rootModel = PomUtilities.readPomToModel(rootDir + "/pom.xml");
Properties properties = rootModel.getProperties();
System.out.println("> checking root");
assertEquals( longVersion, rootModel.getVersion(), "version");
assertEquals(longVersion, properties.getProperty("gsrs.version"), "gsrs.version:");
assertEquals( substancesModuleVersion, rootModel.getVersion(), "version");
assertEquals(starterModuleVersion, properties.getProperty("gsrs.version"), "gsrs.version:");
assertEquals(substancesModuleVersion, properties.getProperty("gsrs.substance.version"), "gsrs.substance.version:");

List<String> modules = rootModel.getModules();
for (String module : modules) {
System.out.println("> checking "+ module);
Model moduleModel;
try {
moduleModel = PomUtilities.readPomToModel(rootDir + "/" + module + "/pom.xml");
String checkVersion = moduleModel.getParent().getVersion();
assertEquals (longVersion, checkVersion, "parent/version");
assertEquals (substancesModuleVersion, checkVersion, "parent/version");

if (module.equals("gsrs-fda-substance-extension")) {
List<Dependency> dependencies = moduleModel.getDependencies();
Expand Down
5 changes: 3 additions & 2 deletions pom-version.properties
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# For use in project pom version check test
project.shortVersion=3.1
project.longVersion=3.1

gsrs.substances.pomversiontest.starterModuleVersion=3.1
gsrs.substances.pomversiontest.substancesModuleVersion=3.1.0.5-SNAPSHOT

0 comments on commit 4fc5769

Please sign in to comment.