diff --git a/.github/workflows/test_java.yml b/.github/workflows/test_1.x_java.yml
similarity index 91%
rename from .github/workflows/test_java.yml
rename to .github/workflows/test_1.x_java.yml
index 226e1d797..75eb22f68 100644
--- a/.github/workflows/test_java.yml
+++ b/.github/workflows/test_1.x_java.yml
@@ -1,4 +1,4 @@
-name: CT Java
+name: CT CDX-1.x Java
on:
push:
@@ -32,4 +32,4 @@ jobs:
distribution: 'zulu'
java-package: jdk
- name: test with Maven
- run: mvn clean test
+ run: mvn clean test -Pschema-v1-tests
diff --git a/.github/workflows/test_js.yml b/.github/workflows/test_1.x_js.yml
similarity index 92%
rename from .github/workflows/test_js.yml
rename to .github/workflows/test_1.x_js.yml
index f2029ba40..86f6e9a28 100644
--- a/.github/workflows/test_js.yml
+++ b/.github/workflows/test_1.x_js.yml
@@ -1,6 +1,6 @@
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
-name: CT JavaScript
+name: CT CDX-1.x JavaScript
on:
push:
@@ -14,7 +14,7 @@ concurrency:
defaults:
run:
- working-directory: tools/src/test/js
+ working-directory: tools/src/test/js/schema-v1
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions: {}
diff --git a/.github/workflows/test_php.yml b/.github/workflows/test_1.x_php.yml
similarity index 92%
rename from .github/workflows/test_php.yml
rename to .github/workflows/test_1.x_php.yml
index 3d044081b..c06be15ca 100644
--- a/.github/workflows/test_php.yml
+++ b/.github/workflows/test_1.x_php.yml
@@ -1,6 +1,6 @@
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
-name: CT PHP
+name: CT CDX-1.x PHP
on:
push:
@@ -14,7 +14,7 @@ concurrency:
defaults:
run:
- working-directory: tools/src/test/php
+ working-directory: tools/src/test/php/schema-v1
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions: {}
diff --git a/.github/workflows/test_proto.yml b/.github/workflows/test_1.x_proto.yml
similarity index 89%
rename from .github/workflows/test_proto.yml
rename to .github/workflows/test_1.x_proto.yml
index 7758e146e..ee4c33727 100644
--- a/.github/workflows/test_proto.yml
+++ b/.github/workflows/test_1.x_proto.yml
@@ -1,6 +1,6 @@
# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
-name: CT ProtoBuf
+name: CT CDX-1.x ProtoBuf
on:
push:
@@ -14,7 +14,7 @@ concurrency:
defaults:
run:
- working-directory: tools/src/test/proto
+ working-directory: tools/src/test/proto/schema-v1
# https://docs.github.com/en/actions/writing-workflows/choosing-what-your-workflow-does/controlling-permissions-for-github_token
permissions: {}
diff --git a/tools/pom.xml b/tools/pom.xml
index 9667d4090..92a85e825 100644
--- a/tools/pom.xml
+++ b/tools/pom.xml
@@ -154,6 +154,12 @@
5.11.4
test
+
+ org.junit.jupiter
+ junit-jupiter-engine
+ 5.11.4
+ test
+
org.slf4j
@@ -168,6 +174,13 @@
org.apache.maven.plugins
maven-surefire-plugin
3.5.2
+
+
+
+ junit.jupiter.tags=${surefire.includeTags}
+
+
+
@@ -179,4 +192,13 @@
+
+
+
+ schema-v1-tests
+
+ schema-v1
+
+
+
diff --git a/tools/src/test/java/org/cyclonedx/schema/BaseSchemaVerificationTest.java b/tools/src/test/java/org/cyclonedx/schema/v1/BaseSchemaVerificationTest.java
similarity index 98%
rename from tools/src/test/java/org/cyclonedx/schema/BaseSchemaVerificationTest.java
rename to tools/src/test/java/org/cyclonedx/schema/v1/BaseSchemaVerificationTest.java
index 27acc24a0..de3a6df9e 100644
--- a/tools/src/test/java/org/cyclonedx/schema/BaseSchemaVerificationTest.java
+++ b/tools/src/test/java/org/cyclonedx/schema/v1/BaseSchemaVerificationTest.java
@@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.cyclonedx.schema;
+package org.cyclonedx.schema.v1;
import org.apache.commons.io.IOUtils;
import java.io.InputStream;
diff --git a/tools/src/test/java/org/cyclonedx/schema/JsonSchemaVerificationTest.java b/tools/src/test/java/org/cyclonedx/schema/v1/JsonSchemaVerificationTest.java
similarity index 98%
rename from tools/src/test/java/org/cyclonedx/schema/JsonSchemaVerificationTest.java
rename to tools/src/test/java/org/cyclonedx/schema/v1/JsonSchemaVerificationTest.java
index 39a4a4ed6..00764dff2 100644
--- a/tools/src/test/java/org/cyclonedx/schema/JsonSchemaVerificationTest.java
+++ b/tools/src/test/java/org/cyclonedx/schema/v1/JsonSchemaVerificationTest.java
@@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.cyclonedx.schema;
+package org.cyclonedx.schema.v1;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -39,8 +39,10 @@
import java.util.List;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.DynamicTest;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.TestFactory;
+@Tag("schema-v1")
class JsonSchemaVerificationTest extends BaseSchemaVerificationTest {
private static final ObjectMapper MAPPER = new JsonMapper();
diff --git a/tools/src/test/java/org/cyclonedx/schema/XmlCatalogVerificationTest.java b/tools/src/test/java/org/cyclonedx/schema/v1/XmlCatalogVerificationTest.java
similarity index 98%
rename from tools/src/test/java/org/cyclonedx/schema/XmlCatalogVerificationTest.java
rename to tools/src/test/java/org/cyclonedx/schema/v1/XmlCatalogVerificationTest.java
index 30df90312..cb243c16c 100644
--- a/tools/src/test/java/org/cyclonedx/schema/XmlCatalogVerificationTest.java
+++ b/tools/src/test/java/org/cyclonedx/schema/v1/XmlCatalogVerificationTest.java
@@ -1,7 +1,8 @@
-package org.cyclonedx.schema;
+package org.cyclonedx.schema.v1;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DynamicTest;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.TestFactory;
import org.w3c.dom.Document;
@@ -27,6 +28,7 @@
import static org.junit.jupiter.api.DynamicTest.dynamicTest;
+@Tag("schema-v1")
public class XmlCatalogVerificationTest {
/**
diff --git a/tools/src/test/java/org/cyclonedx/schema/XmlSchemaVerificationTest.java b/tools/src/test/java/org/cyclonedx/schema/v1/XmlSchemaVerificationTest.java
similarity index 98%
rename from tools/src/test/java/org/cyclonedx/schema/XmlSchemaVerificationTest.java
rename to tools/src/test/java/org/cyclonedx/schema/v1/XmlSchemaVerificationTest.java
index 092aa3771..b2e5fa296 100644
--- a/tools/src/test/java/org/cyclonedx/schema/XmlSchemaVerificationTest.java
+++ b/tools/src/test/java/org/cyclonedx/schema/v1/XmlSchemaVerificationTest.java
@@ -11,7 +11,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.cyclonedx.schema;
+package org.cyclonedx.schema.v1;
import static org.junit.jupiter.api.Assertions.assertFalse;
import static org.junit.jupiter.api.Assertions.assertTrue;
@@ -26,11 +26,13 @@
import javax.xml.validation.Validator;
import org.apache.commons.lang3.StringUtils;
import org.junit.jupiter.api.DynamicTest;
+import org.junit.jupiter.api.Tag;
import org.junit.jupiter.api.TestFactory;
import org.xml.sax.ErrorHandler;
import org.xml.sax.SAXException;
import org.xml.sax.SAXParseException;
+@Tag("schema-v1")
public class XmlSchemaVerificationTest extends BaseSchemaVerificationTest {
private static final Schema VERSION_10;
diff --git a/tools/src/test/java/org/cyclonedx/schema/v2/.gitkeep b/tools/src/test/java/org/cyclonedx/schema/v2/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/tools/src/test/js/.gitignore b/tools/src/test/js/schema-v1/.gitignore
similarity index 100%
rename from tools/src/test/js/.gitignore
rename to tools/src/test/js/schema-v1/.gitignore
diff --git a/tools/src/test/js/README.md b/tools/src/test/js/schema-v1/README.md
similarity index 100%
rename from tools/src/test/js/README.md
rename to tools/src/test/js/schema-v1/README.md
diff --git a/tools/src/test/js/json-schema-functional-tests.js b/tools/src/test/js/schema-v1/json-schema-functional-tests.js
similarity index 96%
rename from tools/src/test/js/json-schema-functional-tests.js
rename to tools/src/test/js/schema-v1/json-schema-functional-tests.js
index 9dc1625c8..9ddbb1b7d 100644
--- a/tools/src/test/js/json-schema-functional-tests.js
+++ b/tools/src/test/js/schema-v1/json-schema-functional-tests.js
@@ -21,9 +21,9 @@ const _thisDir = dirname(fileURLToPath(import.meta.url))
// region config
const testschemaVersion = (parseArgs({options: {v: {type: 'string', short: 'v'}}}).values.v ?? '').trim()
-const schemaDir = join(_thisDir, '..', '..', '..', '..', 'schema')
+const schemaDir = join(_thisDir, '..', '..', '..', '..', '..', 'schema')
const schemaFile = join(schemaDir, `bom-${testschemaVersion}.schema.json`)
-const testdataDir = join(_thisDir, '..', 'resources', testschemaVersion)
+const testdataDir = join(_thisDir, '..', '..', 'resources', testschemaVersion)
if (testschemaVersion.length === 0) {
throw new Error('missing testschemaVersion. expected via argument')
diff --git a/tools/src/test/js/json-schema-lint-tests.js b/tools/src/test/js/schema-v1/json-schema-lint-tests.js
similarity index 98%
rename from tools/src/test/js/json-schema-lint-tests.js
rename to tools/src/test/js/schema-v1/json-schema-lint-tests.js
index b8411fcd9..b3849e220 100644
--- a/tools/src/test/js/json-schema-lint-tests.js
+++ b/tools/src/test/js/schema-v1/json-schema-lint-tests.js
@@ -13,7 +13,7 @@ import {glob} from 'glob'
// region config
const bomSchemasGlob = 'bom-*.schema.json'
-const schemaDir = join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..', 'schema')
+const schemaDir = join(dirname(fileURLToPath(import.meta.url)), '..', '..', '..', '..', '..', 'schema')
// endregion config
diff --git a/tools/src/test/js/package.json b/tools/src/test/js/schema-v1/package.json
similarity index 100%
rename from tools/src/test/js/package.json
rename to tools/src/test/js/schema-v1/package.json
diff --git a/tools/src/test/js/schema-v2/.gitkeep b/tools/src/test/js/schema-v2/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/tools/src/test/php/.gitignore b/tools/src/test/php/schema-v1/.gitignore
similarity index 100%
rename from tools/src/test/php/.gitignore
rename to tools/src/test/php/schema-v1/.gitignore
diff --git a/tools/src/test/php/README.md b/tools/src/test/php/schema-v1/README.md
similarity index 100%
rename from tools/src/test/php/README.md
rename to tools/src/test/php/schema-v1/README.md
diff --git a/tools/src/test/php/composer.json b/tools/src/test/php/schema-v1/composer.json
similarity index 100%
rename from tools/src/test/php/composer.json
rename to tools/src/test/php/schema-v1/composer.json
diff --git a/tools/src/test/php/json-schema-functional-tests.php b/tools/src/test/php/schema-v1/json-schema-functional-tests.php
similarity index 94%
rename from tools/src/test/php/json-schema-functional-tests.php
rename to tools/src/test/php/schema-v1/json-schema-functional-tests.php
index 0e4530a3a..815806439 100644
--- a/tools/src/test/php/json-schema-functional-tests.php
+++ b/tools/src/test/php/schema-v1/json-schema-functional-tests.php
@@ -12,9 +12,9 @@
// region config
define('TESTSCHEMA_VERSION', getopt('v:')['v']);
-define('SCHEMA_DIR', realpath(__DIR__ . '/../../../../schema'));
+define('SCHEMA_DIR', realpath(__DIR__ . '/../../../../../schema'));
define('SCHEMA_FILE', SCHEMA_DIR . '/bom-' . TESTSCHEMA_VERSION . '.schema.json');
-define('TESTDATA_DIR', realpath(__DIR__ . '/../resources/' . TESTSCHEMA_VERSION));
+define('TESTDATA_DIR', realpath(__DIR__ . '/../../resources/' . TESTSCHEMA_VERSION));
if (empty(TESTSCHEMA_VERSION)) {
throw new Exception('missing TESTSCHEMA_VERSION. expected via opt "-v"');
diff --git a/tools/src/test/php/json-schema-lint-tests.php b/tools/src/test/php/schema-v1/json-schema-lint-tests.php
similarity index 96%
rename from tools/src/test/php/json-schema-lint-tests.php
rename to tools/src/test/php/schema-v1/json-schema-lint-tests.php
index 12e8f1b49..b0d8671d4 100644
--- a/tools/src/test/php/json-schema-lint-tests.php
+++ b/tools/src/test/php/schema-v1/json-schema-lint-tests.php
@@ -3,7 +3,7 @@
// region config
const SchemaFileGlob = '*.schema.json';
-const SchemaDir = __DIR__.'/../../../../schema/';
+const SchemaDir = __DIR__.'/../../../../../schema/';
// endregion config
diff --git a/tools/src/test/php/xml-schema-functional-tests.php b/tools/src/test/php/schema-v1/xml-schema-functional-tests.php
similarity index 95%
rename from tools/src/test/php/xml-schema-functional-tests.php
rename to tools/src/test/php/schema-v1/xml-schema-functional-tests.php
index e5d4da638..1b127f572 100644
--- a/tools/src/test/php/xml-schema-functional-tests.php
+++ b/tools/src/test/php/schema-v1/xml-schema-functional-tests.php
@@ -12,11 +12,11 @@
// region config
define('TESTSCHEMA_VERSION', getopt('v:')['v']);
-define('SCHEMA_DIR', realpath(__DIR__ . '/../../../../schema'));
+define('SCHEMA_DIR', realpath(__DIR__ . '/../../../../../schema'));
define('SCHEMA_FILE', SCHEMA_DIR . '/bom-' . TESTSCHEMA_VERSION . '.xsd');
define('SPDX_FILE', SCHEMA_DIR . '/spdx.xsd');
-define('TESTDATA_DIR', realpath(__DIR__ . '/../resources/' . TESTSCHEMA_VERSION));
+define('TESTDATA_DIR', realpath(__DIR__ . '/../../resources/' . TESTSCHEMA_VERSION));
if (empty(TESTSCHEMA_VERSION)) {
throw new Exception('missing TESTSCHEMA_VERSION. expected via opt "-v"');
diff --git a/tools/src/test/php/schema-v2/.gitkeep b/tools/src/test/php/schema-v2/.gitkeep
new file mode 100644
index 000000000..e69de29bb
diff --git a/tools/src/test/proto/buf_breaking-remote.yaml b/tools/src/test/proto/schema-v1/buf_breaking-remote.yaml
similarity index 100%
rename from tools/src/test/proto/buf_breaking-remote.yaml
rename to tools/src/test/proto/schema-v1/buf_breaking-remote.yaml
diff --git a/tools/src/test/proto/buf_breaking-version.yaml b/tools/src/test/proto/schema-v1/buf_breaking-version.yaml
similarity index 100%
rename from tools/src/test/proto/buf_breaking-version.yaml
rename to tools/src/test/proto/schema-v1/buf_breaking-version.yaml
diff --git a/tools/src/test/proto/buf_lint.yaml b/tools/src/test/proto/schema-v1/buf_lint.yaml
similarity index 100%
rename from tools/src/test/proto/buf_lint.yaml
rename to tools/src/test/proto/schema-v1/buf_lint.yaml
diff --git a/tools/src/test/proto/test.sh b/tools/src/test/proto/schema-v1/test.sh
similarity index 88%
rename from tools/src/test/proto/test.sh
rename to tools/src/test/proto/schema-v1/test.sh
index e0a78e352..a9644ec75 100755
--- a/tools/src/test/proto/test.sh
+++ b/tools/src/test/proto/schema-v1/test.sh
@@ -2,7 +2,7 @@
set -ue
THIS_PATH="$(realpath "$(dirname "$0")")"
-ROOT_PATH="$(realpath "${THIS_PATH}/../../../..")"
+ROOT_PATH="$(realpath "${THIS_PATH}/../../../../..")"
# paths relative to $ROOT_PATH
SCHEMA_DIR='schema'
@@ -118,13 +118,24 @@ function schema-functional () {
--to /dev/null
}
- local SCHEMA_VERS
- shopt -s globstar
- for test_res in "$ROOT_PATH"/"$TEST_RES_DIR"/*/valid-*.textproto
+ local SCHEMA_VERS test_res
+ while IFS= read -r -d '' SCHEMA_VERS
do
- SCHEMA_VERS="$(basename "$(dirname "$test_res")")"
- validate "$test_res" "$SCHEMA_VERS"
- done
+ while IFS= read -r -d '' test_res
+ do
+ validate "$test_res" "$SCHEMA_VERS"
+ done < <(
+ find "$ROOT_PATH/$TEST_RES_DIR/$SCHEMA_VERS/" \
+ -mindepth 1 -maxdepth 1 -type f \
+ -name 'valid-*.textproto' -print0 \
+ | LC_ALL=C sort -z
+ )
+ done < <(
+ find "$ROOT_PATH/$TEST_RES_DIR" \
+ -mindepth 1 -maxdepth 1 \
+ -type d -name '1.*' -printf '%f\0' \
+ | LC_ALL=C sort -zr
+ )
echo '>> OK.' >&2
}