-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ISSUE #3 Changed string search row to include lines and comments
- Loading branch information
Ryan O'Meara
committed
Jan 13, 2016
1 parent
3d7c024
commit 7c1a768
Showing
2 changed files
with
90 additions
and
14 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
71 changes: 71 additions & 0 deletions
71
...ksoftware/sdk/protex/client/examples/test/report/SampleReportDataIdentifiedFilesTest.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,71 @@ | ||
package com.blackducksoftware.sdk.protex.client.examples.test.report; | ||
|
||
import org.testng.annotations.AfterClass; | ||
import org.testng.annotations.BeforeClass; | ||
import org.testng.annotations.Test; | ||
|
||
import com.blackducksoftware.sdk.protex.client.examples.SampleGetFilesIdentifiedWithConflicts; | ||
import com.blackducksoftware.sdk.protex.client.examples.test.type.AbstractSdkSampleTest; | ||
import com.blackducksoftware.sdk.protex.client.examples.test.type.TestSources; | ||
import com.blackducksoftware.sdk.protex.client.examples.test.type.Tests; | ||
import com.blackducksoftware.sdk.protex.common.BomRefreshMode; | ||
import com.blackducksoftware.sdk.protex.common.UsageLevel; | ||
import com.blackducksoftware.sdk.protex.component.Component; | ||
import com.blackducksoftware.sdk.protex.license.License; | ||
import com.blackducksoftware.sdk.protex.license.LicenseCategory; | ||
import com.blackducksoftware.sdk.protex.license.LicenseInfo; | ||
import com.blackducksoftware.sdk.protex.project.AnalysisSourceLocation; | ||
import com.blackducksoftware.sdk.protex.project.ProjectRequest; | ||
import com.blackducksoftware.sdk.protex.project.codetree.identification.IdentificationRequest; | ||
|
||
public class SampleReportDataIdentifiedFilesTest extends AbstractSdkSampleTest { | ||
|
||
private String projectId; | ||
|
||
@BeforeClass | ||
protected void createProject() throws Exception { | ||
ProjectRequest projectRequest = new ProjectRequest(); | ||
projectRequest.setName("SampleReportDataIdentifiedFilesTest Project"); | ||
|
||
AnalysisSourceLocation sourceLocation = TestSources.getAnalysisSourceLocation(getProxy()); | ||
|
||
projectRequest.setAnalysisSourceLocation(sourceLocation); | ||
|
||
projectId = getProxy().getProjectApi().createProject(projectRequest, LicenseCategory.PROPRIETARY); | ||
|
||
TestSources.synchronousSourceScan(getProxy(), projectId, 1000); | ||
|
||
Component component = getProxy().getComponentApi().getComponentsByName("Cyclos", "3.0.7").get(0); | ||
License license = getProxy().getLicenseApi().getLicenseById("gpl20"); | ||
LicenseInfo licenseInfo = new LicenseInfo(); | ||
licenseInfo.setLicenseId(license.getLicenseId()); | ||
licenseInfo.setName(license.getName()); | ||
|
||
// Identify stuff to GPL | ||
IdentificationRequest toGpl = new IdentificationRequest(); | ||
toGpl.setIdentifiedComponentKey(component.getComponentKey()); | ||
toGpl.setIdentifiedLicenseInfo(licenseInfo); | ||
toGpl.setIdentifiedUsageLevel(UsageLevel.COMPONENT); | ||
|
||
getProxy().getIdentificationApi().addDeclaredIdentification(projectId, "/", toGpl, BomRefreshMode.SYNCHRONOUS); | ||
} | ||
|
||
@Test(groups = { Tests.SOURCE_DEPENDENT_TEST }) | ||
public void runSample() throws Exception { | ||
String[] args = new String[4]; | ||
args[0] = Tests.getServerUrl(); | ||
args[1] = Tests.getServerUsername(); | ||
args[2] = Tests.getServerPassword(); | ||
args[3] = projectId; | ||
|
||
SampleGetFilesIdentifiedWithConflicts.main(args); | ||
} | ||
|
||
@AfterClass(alwaysRun = true) | ||
protected void deleteProject() throws Exception { | ||
if (projectId != null) { | ||
getProxy().getProjectApi().deleteProject(projectId); | ||
} | ||
} | ||
|
||
} |