Skip to content

Commit

Permalink
Fix component SWID tag ID not being considered in project cloning
Browse files Browse the repository at this point in the history
Fixes #4478

Signed-off-by: nscuro <nscuro@protonmail.com>
  • Loading branch information
nscuro committed Dec 19, 2024
1 parent 45982a2 commit 332e0d4
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,7 @@ public Component cloneComponent(Component sourceComponent, Project destinationPr
component.setCpe(sourceComponent.getCpe());
component.setPurl(sourceComponent.getPurl());
component.setPurlCoordinates(sourceComponent.getPurlCoordinates());
component.setSwidTagId(sourceComponent.getSwidTagId());
component.setInternal(sourceComponent.isInternal());
component.setDescription(sourceComponent.getDescription());
component.setCopyright(sourceComponent.getCopyright());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1797,6 +1797,7 @@ public void cloneProjectTest() {
componentA.setProject(project);
componentA.setName("acme-lib-a");
componentA.setVersion("2.0.0");
componentA.setSwidTagId("swidTagId");
componentA.setSupplier(componentSupplier);
qm.persist(componentA);

Expand Down Expand Up @@ -1866,7 +1867,8 @@ public void cloneProjectTest() {
"objectType": "COMPONENT",
"uuid": "${json-unit.matches:notSourceComponentUuid}",
"name": "acme-lib-a",
"version": "2.0.0"
"version": "2.0.0",
"swidTagId":"swidTagId"
}
]
""");
Expand Down Expand Up @@ -1896,6 +1898,7 @@ public void cloneProjectTest() {
assertThat(clonedComponent.getUuid()).isNotEqualTo(componentA.getUuid());
assertThat(clonedComponent.getName()).isEqualTo("acme-lib-a");
assertThat(clonedComponent.getVersion()).isEqualTo("2.0.0");
assertThat(clonedComponent.getSwidTagId()).isEqualTo("swidTagId");
assertThat(clonedComponent.getSupplier()).isNotNull();
assertThat(clonedComponent.getSupplier().getName()).isEqualTo("componentSupplier");
assertThatJson(clonedComponent.getDirectDependencies())
Expand Down

0 comments on commit 332e0d4

Please sign in to comment.