-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Started ScanossDetectService testing Signed-off-by: Vasyl Kerimov <[email protected]> * Revert "Reduce the number of warnings according to the test policy (#43)" This reverts commit f92b77e. * Changed a test to covers a more of ScanossService Signed-of-by: Vasyl Kerimov <[email protected]> * Fixed problem with incorrectly typed variable Signed-off-by: Vasyl Kerimov <[email protected]> * Added tests to cover 80% of code lines Signed-off-by: Vasyl Kerimov <[email protected]> * Fixed highlights, incl. making some fields final Signed-off-by: Vasyl Kerimov <[email protected]> * Added assertions to the tests Signed-off-by: Vasyl Kerimov <[email protected]> * Update LicenseServiceTest.java * Update pom.xml * Update ResponseWrapper.java * Update LicenseServiceTest.java * Update ScanossDetectServiceTest.java * Update FileUtilTest.java Signed-off-by: Vasyl Kerimov <[email protected]> Co-authored-by: Oleg Kopysov <[email protected]>
- Loading branch information
Showing
17 changed files
with
420 additions
and
22 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
/** | ||
* Copyright (c) 2022, Samsung Electronics Co., Ltd. All rights reserved. | ||
* | ||
* Use of this source code is governed by a MIT license that can be | ||
* found in the LICENSE file. | ||
*/ | ||
|
||
package com.lpvs.service; | ||
|
||
import com.lpvs.entity.LPVSFile; | ||
import com.lpvs.entity.LPVSLicense; | ||
import com.lpvs.entity.config.WebhookConfig; | ||
import org.junit.jupiter.api.Assertions; | ||
import org.junit.jupiter.api.Test; | ||
import org.springframework.test.util.ReflectionTestUtils; | ||
|
||
import java.util.ArrayList; | ||
import java.util.HashSet; | ||
import java.util.List; | ||
|
||
public class LicenseServiceTest { | ||
@Test | ||
public void testFindConflicts() { | ||
WebhookConfig webhookConfig = new WebhookConfig(); | ||
webhookConfig.setRepositoryName("LPVS"); | ||
webhookConfig.setRepositoryOrganization("Samsung"); | ||
webhookConfig.setRepositoryLicense("Apache-2.0"); | ||
webhookConfig.setPullRequestAPIUrl("http://url.com"); | ||
LPVSFile file = new LPVSFile(); | ||
LPVSLicense license = new LPVSLicense(){{ | ||
setChecklist_url(""); | ||
setAccess("unrviewed"); | ||
setSpdxId("LPGL-2.1-or-later"); | ||
}}; | ||
file.setLicenses(new HashSet<LPVSLicense>(){{ | ||
add(license); | ||
}}); | ||
file.setFilePath(""); | ||
file.setComponent(""); | ||
file.setSnippetMatch(""); | ||
file.setMatchedLines(""); | ||
|
||
LPVSFile file1 = new LPVSFile(); | ||
LPVSLicense license1 = new LPVSLicense(){{ | ||
setChecklist_url(""); | ||
setAccess("unrviewed"); | ||
setSpdxId("Apache-2.0"); | ||
}}; | ||
file1.setLicenses(new HashSet<LPVSLicense>(){{ | ||
add(license1); | ||
}}); | ||
file1.setFilePath(""); | ||
file1.setComponent(""); | ||
file1.setSnippetMatch(""); | ||
file1.setMatchedLines(""); | ||
|
||
LPVSFile file2 = new LPVSFile(); | ||
LPVSLicense license2 = new LPVSLicense(){{ | ||
setChecklist_url(""); | ||
setAccess("unrviewed"); | ||
setSpdxId("MIT"); | ||
}}; | ||
file2.setLicenses(new HashSet<LPVSLicense>(){{ | ||
add(license2); | ||
}}); | ||
file2.setFilePath(""); | ||
file2.setComponent(""); | ||
file2.setSnippetMatch(""); | ||
file2.setMatchedLines(""); | ||
|
||
List<LPVSFile> fileList = new ArrayList<LPVSFile>(){{ | ||
add(file); | ||
add(file1); | ||
add(file2); | ||
}}; | ||
LicenseService licenseService = new LicenseService("", ""); | ||
ReflectionTestUtils.setField(licenseService, "licenseConflicts", | ||
new ArrayList<LicenseService.Conflict<String, String>>() | ||
{{ add(new LicenseService.Conflict<>("", "")); }}); | ||
Assertions.assertNotNull(licenseService.findConflicts(webhookConfig, fileList)); | ||
} | ||
} |
Oops, something went wrong.