fix(impact-analysis): The mock code location view is now constructed correctly. (Fixes
@@ -36,9 +36,12 @@ import org.jetbrains.annotations.Nullable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
+import com.fasterxml.jackson.databind.node.JsonNodeFactory;
+import com.fasterxml.jackson.databind.node.NullNode;
import com.synopsys.integration.blackduck.api.generated.view.CodeLocationView;
import com.synopsys.integration.blackduck.api.generated.view.ProjectVersionView;
import com.synopsys.integration.blackduck.api.generated.view.ProjectView;
+import com.synopsys.integration.blackduck.api.manual.component.ResourceMetadata;
import com.synopsys.integration.blackduck.codelocation.CodeLocationCreationData;
import com.synopsys.integration.blackduck.service.BlackDuckService;
import com.synopsys.integration.blackduck.service.BlackDuckServicesFactory;
@@ -210,7 +213,14 @@ public class BlackDuckImpactAnalysisTool {
private void mapCodeLocation(String projectVersionUrl, String codeLocationUrl) throws IntegrationException {
// Retrieving a Code Location with just the Project Code Scanner role is not possible so we must construct it ourselves.
CodeLocationView codeLocationView = new CodeLocationView();
- codeLocationView.setUrl(codeLocationUrl);
+
+ ResourceMetadata resourceMetadata = new ResourceMetadata();
+ resourceMetadata.setHref(codeLocationUrl);
+ codeLocationView.setMeta(resourceMetadata);
+
+ NullNode pathJsonNode = new JsonNodeFactory(false).nullNode();
+ codeLocationView.setPatch(pathJsonNode);
+
codeLocationView.setMappedProjectVersion(projectVersionUrl);
blackDuckService.put(codeLocationView);
}
