Search in sources :

Example 1 with AnalyzeDeliverablesBpmRequest

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;
}
Also used : AnalyzeDeliverablesTask(org.jboss.pnc.bpm.task.AnalyzeDeliverablesTask) ArrayList(java.util.ArrayList) AnalyzeDeliverablesBpmRequest(org.jboss.pnc.bpm.model.AnalyzeDeliverablesBpmRequest) LoggedRequest(com.github.tomakehurst.wiremock.verification.LoggedRequest) Request(org.jboss.pnc.api.dto.Request) AnalyzeDeliverablesBpmRequest(org.jboss.pnc.bpm.model.AnalyzeDeliverablesBpmRequest)

Example 2 with AnalyzeDeliverablesBpmRequest

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);
    }
}
Also used : RestConnector(org.jboss.pnc.bpm.RestConnector) ProcessManagerException(org.jboss.pnc.spi.exception.ProcessManagerException) AnalyzeDeliverablesTask(org.jboss.pnc.bpm.task.AnalyzeDeliverablesTask) AnalyzeDeliverablesBpmRequest(org.jboss.pnc.bpm.model.AnalyzeDeliverablesBpmRequest) Request(org.jboss.pnc.api.dto.Request) AnalyzeDeliverablesBpmRequest(org.jboss.pnc.bpm.model.AnalyzeDeliverablesBpmRequest)

Aggregations

Request (org.jboss.pnc.api.dto.Request)2 AnalyzeDeliverablesBpmRequest (org.jboss.pnc.bpm.model.AnalyzeDeliverablesBpmRequest)2 AnalyzeDeliverablesTask (org.jboss.pnc.bpm.task.AnalyzeDeliverablesTask)2 LoggedRequest (com.github.tomakehurst.wiremock.verification.LoggedRequest)1 ArrayList (java.util.ArrayList)1 RestConnector (org.jboss.pnc.bpm.RestConnector)1 ProcessManagerException (org.jboss.pnc.spi.exception.ProcessManagerException)1