File tree Expand file tree Collapse file tree
resources/dev/dbos/transact
test/java/dev/dbos/transact/config Expand file tree Collapse file tree Original file line number Diff line number Diff line change 3838 steps :
3939 - name : Checkout code
4040 uses : actions/checkout@v4
41+ with :
42+ fetch-depth : 0 # fetch-depth 0 needed for version calculation
4143
4244 - name : Set up JDK ${{ matrix.jdk-distro }} ${{ matrix.jdk-version }}
4345 uses : actions/setup-java@v4
Original file line number Diff line number Diff line change @@ -43,6 +43,7 @@ dependencies {
4343 testImplementation(" io.rest-assured:rest-assured:5.4.0" )
4444 testImplementation(" io.rest-assured:json-path:5.4.0" )
4545 testImplementation(" io.rest-assured:xml-path:5.4.0" )
46+ testImplementation(" org.apache.maven:maven-artifact:3.9.11" )
4647}
4748
4849tasks.processResources {
Original file line number Diff line number Diff line change @@ -47,14 +47,14 @@ private DBOS() {}
4747 private static final String version = loadVersionFromResources ();
4848
4949 private static String loadVersionFromResources () {
50- final String PROPERTIES_FILE = "/app.properties" ;
50+ final String PROPERTIES_FILE = "/dev/dbos/transact/ app.properties" ;
5151 final String VERSION_KEY = "app.version" ;
5252 Properties props = new Properties ();
5353 try (InputStream input = DBOS .class .getResourceAsStream (PROPERTIES_FILE )) {
5454
5555 if (input == null ) {
5656 logger .warn ("Could not find {} resource file" , PROPERTIES_FILE );
57- return "unknown (resource missing)" ;
57+ return "< unknown (resource missing)> " ;
5858 }
5959
6060 // Load the properties from the file
File renamed without changes.
Original file line number Diff line number Diff line change 44import static org .junit .jupiter .api .Assertions .assertEquals ;
55import static org .junit .jupiter .api .Assertions .assertFalse ;
66import static org .junit .jupiter .api .Assertions .assertNotNull ;
7+ import static org .junit .jupiter .api .Assertions .assertTrue ;
78
89import dev .dbos .transact .Constants ;
910import dev .dbos .transact .DBOS ;
1920
2021import com .zaxxer .hikari .HikariConfig ;
2122import com .zaxxer .hikari .HikariDataSource ;
23+ import org .apache .maven .artifact .versioning .ComparableVersion ;
2224import org .junit .jupiter .api .Test ;
2325import org .junit .jupiter .api .extension .ExtendWith ;
2426import uk .org .webcompere .systemstubs .environment .EnvironmentVariables ;
@@ -178,4 +180,15 @@ public void configDataSource() throws Exception {
178180 DBOS .shutdown ();
179181 }
180182 }
183+
184+ @ Test
185+ public void dbosVersion () throws Exception {
186+ assertNotNull (DBOS .version ());
187+ assertFalse (DBOS .version ().contains ("unknown" ));
188+ var version = assertDoesNotThrow (() -> new ComparableVersion (DBOS .version ()));
189+
190+ // an invalid version string will be parsed as 0.0-qualifier, so make sure
191+ // the value provided is later 0.6 (the initial published version)
192+ assertTrue (version .compareTo (new ComparableVersion ("0.6" )) > 0 );
193+ }
181194}
You can’t perform that action at this time.
0 commit comments