use of org.jboss.pnc.bpm.model.AnalyzeDeliverablesBpmRequest in project pnc by project-ncl.
the class RestConnectorRequestSerializationTest method mockAnalyzeDeliverablesTask.
private AnalyzeDeliverablesTask mockAnalyzeDeliverablesTask() {
String url1 = "http://hello.com";
String url2 = "http://world.com";
List<String> urls = new ArrayList<>();
urls.add(url1);
urls.add(url2);
String operationId = Sequence.nextBase32Id();
AnalyzeDeliverablesBpmRequest request = new AnalyzeDeliverablesBpmRequest(operationId, "id", urls);
List<Request.Header> headers = new ArrayList<>();
headers.add(new Request.Header(HttpHeaders.CONTENT_TYPE, MediaType.APPLICATION_JSON));
Request callback = new Request(Request.Method.POST, URI.create("http://mock.com/"), headers);
AnalyzeDeliverablesTask task = new AnalyzeDeliverablesTask(request, callback);
return task;
}
use of org.jboss.pnc.bpm.model.AnalyzeDeliverablesBpmRequest in project pnc by project-ncl.
the class DeliverableAnalyzerManagerImpl method startAnalysis.
private void startAnalysis(String milestoneId, List<String> sourcesLink, Base32LongID operationId) {
Request callback = operationsManager.getOperationCallback(operationId);
String id = operationId.getId();
try (RestConnector restConnector = new RestConnector(bpmConfig)) {
AnalyzeDeliverablesBpmRequest bpmRequest = new AnalyzeDeliverablesBpmRequest(id, milestoneId, sourcesLink);
AnalyzeDeliverablesTask analyzeTask = new AnalyzeDeliverablesTask(bpmRequest, callback);
restConnector.startProcess(bpmConfig.getAnalyzeDeliverablesBpmProcessId(), analyzeTask, id, userService.currentUserToken());
DeliverableAnalysisStatusChangedEvent analysisStatusChanged = DefaultDeliverableAnalysisStatusChangedEvent.started(id, milestoneId, sourcesLink);
analysisStatusChangedEventNotifier.fire(analysisStatusChanged);
} catch (ProcessManagerException e) {
log.error("Error trying to start analysis of deliverables task for milestone: {}", milestoneId, e);
throw new RuntimeException(e);
}
}
Aggregations