Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: CT Java
name: CT CDX-1.x Java

on:
push:
Expand Down Expand Up @@ -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
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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: {}
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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: {}
Expand Down
Original file line number Diff line number Diff line change
@@ -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:
Expand All @@ -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: {}
Expand Down
22 changes: 22 additions & 0 deletions tools/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,12 @@
<version>5.11.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.11.4</version>
<scope>test</scope>
</dependency>
<!-- Runtime-only test dependency -->
<dependency>
<groupId>org.slf4j</groupId>
Expand All @@ -168,6 +174,13 @@
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>3.5.2</version>
<configuration>
<properties>
<configurationParameters>
junit.jupiter.tags=${surefire.includeTags}
</configurationParameters>
</properties>
</configuration>
</plugin>
</plugins>
<testResources>
Expand All @@ -179,4 +192,13 @@
</testResource>
</testResources>
</build>

<profiles>
<profile>
<id>schema-v1-tests</id>
<properties>
<surefire.includeTags>schema-v1</surefire.includeTags>
</properties>
</profile>
</profiles>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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();
Expand Down
Original file line number Diff line number Diff line change
@@ -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;
Expand All @@ -27,6 +28,7 @@

import static org.junit.jupiter.api.DynamicTest.dynamicTest;

@Tag("schema-v1")
public class XmlCatalogVerificationTest {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down
Empty file.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
Empty file.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -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"');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
// region config

const SchemaFileGlob = '*.schema.json';
const SchemaDir = __DIR__.'/../../../../schema/';
const SchemaDir = __DIR__.'/../../../../../schema/';

// endregion config

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"');
Expand Down
Empty file.
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down Expand Up @@ -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
}
Expand Down
Loading