-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Support suppressing to apply curations (#235)
* Generate Curation Template without applied curations * update test and master-solicitor.asciidoc * adapt javadoc * update after Review * update javadoc * update javadoc * adapt javadoc in FilteredScancodeComponentInfoProvider.java * Documentation improvements, added a unit test for SingleFileCurationProvider * Fixed typo in Asciidoc --------- Co-authored-by: ohecker <[email protected]>
- Loading branch information
1 parent
1b2368d
commit ccc6fc1
Showing
10 changed files
with
101 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...va/com/devonfw/tools/solicitor/componentinfo/curating/SingleFileCurationProviderTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package com.devonfw.tools.solicitor.componentinfo.curating; | ||
|
||
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertNull; | ||
|
||
import org.junit.jupiter.api.BeforeEach; | ||
import org.junit.jupiter.api.Test; | ||
import org.mockito.Mockito; | ||
|
||
import com.devonfw.tools.solicitor.common.packageurl.AllKindsPackageURLHandler; | ||
import com.devonfw.tools.solicitor.componentinfo.ComponentInfoAdapterException; | ||
import com.devonfw.tools.solicitor.componentinfo.curation.SingleFileCurationProvider; | ||
import com.devonfw.tools.solicitor.componentinfo.curation.model.ComponentInfoCuration; | ||
|
||
/** | ||
* Test for {@link SingleFileCurationProvider}. | ||
* | ||
*/ | ||
class SingleFileCurationProviderTest { | ||
|
||
private SingleFileCurationProvider objectUnderTest; | ||
|
||
@BeforeEach | ||
public void setup() { | ||
|
||
AllKindsPackageURLHandler packageUrlHandler = Mockito.mock(AllKindsPackageURLHandler.class); | ||
Mockito.when(packageUrlHandler.pathFor("pkg:maven/somenamespace/[email protected]")) | ||
.thenReturn("pkg/maven/somenamespace/somecomponent/2.3.4"); | ||
Mockito.when(packageUrlHandler.pathFor("pkg:maven/somenamespace/[email protected]")) | ||
.thenReturn("pkg/maven/somenamespace/somecomponent/2.3.5"); | ||
|
||
this.objectUnderTest = new SingleFileCurationProvider(packageUrlHandler); | ||
this.objectUnderTest.setCurationsFileName("src/test/resources/curations/array_of_curations.yaml"); | ||
} | ||
|
||
/** | ||
* Test method for | ||
* {@link com.devonfw.tools.solicitor.componentinfo.curation.SingleFileCurationProvider#findCurations(java.lang.String, java.lang.String)}. | ||
* | ||
* @throws ComponentInfoAdapterException | ||
*/ | ||
@Test | ||
void testFindCurationsWithSelectorNull() throws ComponentInfoAdapterException { | ||
|
||
ComponentInfoCuration result; | ||
|
||
result = this.objectUnderTest.findCurations("pkg:maven/somenamespace/[email protected]", null); | ||
assertEquals("https://scancode-licensedb.aboutcode.org/apache-2.0.LICENSE", result.getLicenses().get(0).getUrl()); | ||
result = this.objectUnderTest.findCurations("pkg:maven/somenamespace/[email protected]", null); | ||
assertEquals("https://scancode-licensedb.aboutcode.org/bsd-simplified.LICENSE", | ||
result.getLicenses().get(0).getUrl()); | ||
} | ||
|
||
/** | ||
* Test method for | ||
* {@link com.devonfw.tools.solicitor.componentinfo.curation.SingleFileCurationProvider#findCurations(java.lang.String, java.lang.String)}. | ||
* | ||
* @throws ComponentInfoAdapterException | ||
*/ | ||
@Test | ||
void testFindCurationsWithSelectorNone() throws ComponentInfoAdapterException { | ||
|
||
ComponentInfoCuration result; | ||
|
||
result = this.objectUnderTest.findCurations("pkg:maven/somenamespace/[email protected]", "none"); | ||
assertNull(result); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters