Skip to content

Commit

Permalink
Update pom.xml to use newer compiler and json version
Browse files Browse the repository at this point in the history
  • Loading branch information
rudsberg committed Jan 6, 2025
1 parent db31894 commit 7602de2
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 20 deletions.
20 changes: 10 additions & 10 deletions __tests__/sbom.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -168,13 +168,13 @@ describe('sbom feature', () => {
type: 'library',
group: 'org.json',
name: 'json',
version: '20211205',
purl: 'pkg:maven/org.json/json@20211205',
'bom-ref': 'pkg:maven/org.json/json@20211205',
version: '20241224',
purl: 'pkg:maven/org.json/json@20241224',
'bom-ref': 'pkg:maven/org.json/json@20241224',
properties: [
{
name: 'syft:cpe23',
value: 'cpe:2.3:a:json:json:20211205:*:*:*:*:*:*:*'
value: 'cpe:2.3:a:json:json:20241224:*:*:*:*:*:*:*'
}
]
},
Expand All @@ -190,10 +190,10 @@ describe('sbom feature', () => {
dependencies: [
{
ref: 'pkg:maven/com.oracle/[email protected]',
dependsOn: ['pkg:maven/org.json/json@20211205']
dependsOn: ['pkg:maven/org.json/json@20241224']
},
{
ref: 'pkg:maven/org.json/json@20211205',
ref: 'pkg:maven/org.json/json@20241224',
dependsOn: []
}
]
Expand All @@ -206,12 +206,12 @@ describe('sbom feature', () => {
'Found SBOM: ' + join(workspace, 'test.sbom.json')
)
expect(spyInfo).toHaveBeenCalledWith('=== SBOM Content ===')
expect(spyInfo).toHaveBeenCalledWith('- pkg:maven/org.json/json@20211205')
expect(spyInfo).toHaveBeenCalledWith('- pkg:maven/org.json/json@20241224')
expect(spyInfo).toHaveBeenCalledWith(
'- pkg:maven/com.oracle/[email protected]'
)
expect(spyInfo).toHaveBeenCalledWith(
' depends on: pkg:maven/org.json/json@20211205'
' depends on: pkg:maven/org.json/json@20241224'
)
expect(spyWarning).not.toHaveBeenCalled()
})
Expand Down Expand Up @@ -277,13 +277,13 @@ describe('sbom feature', () => {
name: 'test.sbom.json',
resolved: expect.objectContaining({
json: expect.objectContaining({
package_url: 'pkg:maven/org.json/json@20211205',
package_url: 'pkg:maven/org.json/json@20241224',
dependencies: []
}),
'main-test-app': expect.objectContaining({
package_url:
'pkg:maven/com.oracle/[email protected]',
dependencies: ['pkg:maven/org.json/json@20211205']
dependencies: ['pkg:maven/org.json/json@20241224']
})
})
})
Expand Down
7 changes: 3 additions & 4 deletions __tests__/sbom/main-test-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@
<version>1.0.0</version>

<properties>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
</properties>

<dependencies>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20211205</version>
<version>20241224</version>
</dependency>
</dependencies>

Expand All @@ -39,7 +39,6 @@
</execution>
</executions>
<configuration>
<imageName>sbom</imageName>
<mainClass>com.oracle.sbom.SBOMTestApplication</mainClass>
<buildArgs>
<buildArg>-Ob</buildArg>
Expand Down
6 changes: 3 additions & 3 deletions __tests__/sbom/main-test-app/verify-sbom.cmd
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
@echo off
cd target
set "SCRIPT_DIR=%~dp0"

for %%p in (
"\"pkg:maven/org.json/json@20211205\""
"\"pkg:maven/org.json/json@20241224\""
"\"main-test-app\""
"\"svm\""
"\"nativeimage\""
) do (
echo Checking for %%p
findstr /c:%%p sbom.sbom.json || exit /b 1
findstr /c:%%p "%SCRIPT_DIR%target\main-test-app.sbom.json" || exit /b 1
)

echo SBOM was successfully generated and contained the expected components
6 changes: 3 additions & 3 deletions __tests__/sbom/main-test-app/verify-sbom.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/bash
cd target
script_dir="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

required_patterns=(
'"pkg:maven/org.json/json@20211205"'
'"pkg:maven/org.json/json@20241224"'
'"main-test-app"'
'"svm"'
'"nativeimage"'
)

for pattern in "${required_patterns[@]}"; do
echo "Checking for $pattern"
if ! grep -q "$pattern" sbom.sbom.json; then
if ! grep -q "$pattern" "$script_dir/target/main-test-app.sbom.json"; then
echo "Pattern not found: $pattern"
exit 1
fi
Expand Down

0 comments on commit 7602de2

Please sign in to comment.