private Collector createCollector() { CollectorRequest collectorReq = new CollectorRequest(); collectorReq.setName("JenkinsCucumberTest"); collectorReq.setCollectorType(CollectorType.Test); Collector col = collectorReq.toCollector(); col.setEnabled(true); col.setOnline(true); col.setLastExecuted(System.currentTimeMillis()); return collectorService.createCollector(col); }
private CollectorItem createCollectorItem(Collector collector, TestDataCreateRequest request) throws HygieiaException { CollectorItem tempCi = new CollectorItem(); tempCi.setCollectorId(collector.getId()); tempCi.setDescription(request.getDescription()); tempCi.setPushed(true); tempCi.setLastUpdated(System.currentTimeMillis()); Map<String, Object> option = new HashMap<>(); option.put("jobName", request.getTestJobName()); option.put("jobUrl", request.getTestJobUrl()); option.put("instanceUrl", request.getServerUrl()); tempCi.getOptions().putAll(option); tempCi.setNiceName(request.getNiceName()); if (StringUtils.isEmpty(tempCi.getNiceName())) { return collectorService.createCollectorItem(tempCi); } return collectorService.createCollectorItemByNiceNameAndJobName( tempCi, request.getTestJobName()); }