Compare commits

...
Author SHA1 Message Date
james.maesandClaude Opus 5.5 89a95737a5 fix: the qbit metadata version comes from the build, not a hardcoded constant
The producer read a literal version, so released artifacts reported a stale
or -SNAPSHOT version. qbit-edi.properties (version=${project.version}) is
Maven-filtered and the producer loads it; tests assert producer == bundle ==
artifact version.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-15 01:29:54 -05:00
james.maes 86b8dbf13d Merge pull request #21 from QRun-IO/fix/help-bundle-version-test
test(help): bundle version test compares with the artifact version
2026-10-14 23:18:42 -05:00
6 changed files with 40 additions and 2 deletions

No files matched your search

+2
View File
@@ -6,6 +6,8 @@ Following [Keep a Changelog](https://keepachangelog.com/en/1.1.0/) and [Semantic
### Changed
- Derive qbit metadata version from the Maven artifact version, keeping release metadata and help bundle versions in sync.
- Require QQQ 4.1.0-RC.7 for core help-bundle registration and coverage validation.
- X12 routing and sending honor identity `isActive`, matching EDIFACT.
+2
View File
@@ -133,6 +133,7 @@
<filtering>true</filtering>
<includes>
<include>help/*.yaml</include>
<include>qbit-edi.properties</include>
</includes>
</resource>
<resource>
@@ -140,6 +141,7 @@
<filtering>false</filtering>
<excludes>
<exclude>help/*.yaml</exclude>
<exclude>qbit-edi.properties</exclude>
</excludes>
</resource>
</resources>
@@ -21,6 +21,9 @@
package com.kingsrook.qbits.edi;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import com.kingsrook.qqq.backend.core.exceptions.QException;
import com.kingsrook.qqq.backend.core.model.metadata.MetaDataProducerMultiOutput;
import com.kingsrook.qqq.backend.core.model.metadata.QInstance;
@@ -37,13 +40,41 @@ public class EdiQBitProducer implements QBitMetaDataProducer<EdiQBitConfig>
{
public static final String GROUP_ID = "com.kingsrook.qbits";
public static final String ARTIFACT_ID = "qbit-edi";
public static final String VERSION = "0.1.0";
public static final String VERSION = loadVersion();
private EdiQBitConfig qBitConfig;
private String namespace;
/*******************************************************************************
** Read the artifact version from the Maven-filtered resource.
*******************************************************************************/
private static String loadVersion()
{
try(InputStream inputStream = EdiQBitProducer.class.getClassLoader().getResourceAsStream("qbit-edi.properties"))
{
if(inputStream == null)
{
throw new IllegalStateException("Missing qbit-edi.properties; build with Maven to supply the artifact version");
}
Properties properties = new Properties();
properties.load(inputStream);
String version = properties.getProperty("version");
if(version == null || version.isBlank() || version.contains("${"))
{
throw new IllegalStateException("Missing or unfiltered version in qbit-edi.properties; build with Maven");
}
return (version);
}
catch(IOException e)
{
throw new IllegalStateException("Could not read the artifact version from qbit-edi.properties", e);
}
}
/*******************************************************************************
** Fluent configuration setter.
*******************************************************************************/
+1
View File
@@ -0,0 +1 @@
version=${project.version}
@@ -49,7 +49,7 @@ class EdiHelpBundleTest
assertThat(HelpBundles.of(instance).getBundles()).singleElement().satisfies(bundle ->
{
assertThat(bundle.getId()).isEqualTo("qbit-edi");
assertThat(bundle.getVersion()).as("the help bundle carries the artifact version").isEqualTo(System.getProperty("qbit.artifactVersion"));
assertThat(bundle.getVersion()).as("the help bundle carries the artifact version").isEqualTo(System.getProperty("qbit.artifactVersion")).isEqualTo(EdiQBitProducer.VERSION);
});
HelpBundles.syncOnStartup(instance);
HelpBundleAssertions.forInstance(instance)
@@ -65,6 +65,8 @@ class EdiQBitProducerTest
assertThat(producer.getQBitConfig()).isSameAs(config);
assertThat(producer.getNamespace()).isEqualTo("ns");
assertThat(producer.getQBitMetaData().getArtifactId()).isEqualTo("qbit-edi");
assertThat(System.getProperty("qbit.artifactVersion")).isNotBlank();
assertThat(producer.getQBitMetaData().getVersion()).isEqualTo(System.getProperty("qbit.artifactVersion")).isEqualTo(EdiQBitProducer.VERSION);
assertThat(producer.getPackageNameForFindingMetaDataProducers()).isEqualTo("com.kingsrook.qbits.edi.metadata");
assertThat(config.getAppName()).isEqualTo("edi");
assertThat(config.getAppLabel()).isEqualTo("EDI");