use of com.synopsys.integration.blackduck.api.generated.view.CodeLocationView in project blackduck-common by blackducksoftware.
the class CodeLocationsRetrieverTest method testCodeLocationsBeingCreatedDuringRetrieve.
@Test
public void testCodeLocationsBeingCreatedDuringRetrieve() {
ProjectVersionView projectVersionView = buildProjectVersionView();
BlackDuckApiClient blackDuckApiClient = Mockito.mock(BlackDuckApiClient.class);
UrlMultipleResponses<CodeLocationView> expectedArg = new UrlMultipleResponses<>(url, CodeLocationView.class);
try {
Mockito.when(blackDuckApiClient.getAllResponses(Mockito.eq(expectedArg))).thenReturn(listWithDuplicates());
} catch (IntegrationException e) {
fail("No exception is expected when mocking.", e);
}
CodeLocationsRetriever codeLocationsRetriever = new CodeLocationsRetriever(blackDuckApiClient);
try {
Map<String, String> hrefToName = codeLocationsRetriever.retrieveCodeLocations(projectVersionView, expectedNames());
assertEquals(expectedResults(), hrefToName);
} catch (IntegrationException e) {
fail("No exception is expected when retrieving.", e);
}
// TODO ejk 2021-06-18 it appears that a single invocation of verify
// causes all unverified code to error
// Mockito.verify(blackDuckApiClient);
}
use of com.synopsys.integration.blackduck.api.generated.view.CodeLocationView in project blackduck-common by blackducksoftware.
the class CodeLocationsRetrieverTest method createCodeLocation.
private CodeLocationView createCodeLocation(String href, String name) {
ResourceMetadata resourceMetadata = new ResourceMetadata();
try {
resourceMetadata.setHref(new HttpUrl(href));
} catch (IntegrationException e) {
fail("The urls should all be valid.", e);
}
CodeLocationView codeLocationView = new CodeLocationView();
codeLocationView.setMeta(resourceMetadata);
codeLocationView.setName(name);
return codeLocationView;
}
use of com.synopsys.integration.blackduck.api.generated.view.CodeLocationView in project blackduck-common by blackducksoftware.
the class CodeLocationService method createFakeCodeLocationView.
private CodeLocationView createFakeCodeLocationView(HttpUrl codeLocationUrl) {
ResourceMetadata resourceMetadata = new ResourceMetadata();
resourceMetadata.setHref(codeLocationUrl);
CodeLocationView codeLocationView = new CodeLocationView();
codeLocationView.setMeta(resourceMetadata);
NullNode pathJsonNode = new JsonNodeFactory(false).nullNode();
codeLocationView.setPatch(pathJsonNode);
return codeLocationView;
}
use of com.synopsys.integration.blackduck.api.generated.view.CodeLocationView in project blackduck-common by blackducksoftware.
the class CodeLocationService method unmapCodeLocation.
public void unmapCodeLocation(HttpUrl codeLocationUrl) throws IntegrationException {
CodeLocationView codeLocationView = createFakeCodeLocationView(codeLocationUrl);
mapCodeLocation(codeLocationView, (HttpUrl) null);
}
use of com.synopsys.integration.blackduck.api.generated.view.CodeLocationView in project blackduck-common by blackducksoftware.
the class BinaryScanUploadServiceTestIT method testJapaneseCharactersForBinaryUpload.
@Test
@Disabled
public // also, because as of 2020.8.0, binary upload doesn't support utf-8
void testJapaneseCharactersForBinaryUpload() throws IntegrationException, InterruptedException {
BlackDuckServices blackDuckServices = new BlackDuckServices(intHttpClientTestHelper);
File binaryFile = getTestBinaryFile();
BinaryScan binaryScan = new BinaryScan(binaryFile, JAPANESE_PROJECT_NAME, JAPANESE_VERSION_NAME, JAPANESE_CODE_LOCATION_NAME);
BinaryScanData binaryScanData = createBinaryScanData(blackDuckServices, binaryScan);
assertBinaryUploadCompleted(blackDuckServices, binaryScanData);
Optional<ProjectVersionWrapper> optionalProjectVersionWrapper = blackDuckServices.projectService.getProjectVersion(JAPANESE_PROJECT_NAME, JAPANESE_VERSION_NAME);
Optional<CodeLocationView> optionalCodeLocationView = blackDuckServices.codeLocationService.getCodeLocationByName(JAPANESE_CODE_LOCATION_NAME);
assertTrue(optionalProjectVersionWrapper.isPresent());
assertTrue(optionalCodeLocationView.isPresent());
}
Aggregations