use of com.epam.pipeline.config.JsonMapper in project cloud-pipeline by epam.
the class PipelineRunMapper method map.
/**
* Mapping a {@code PipelineRun}
* @param run {@code PipelineRun}
* @param threshold
* @return a mapped {@code PipelineRun}, {@code Map} key - a field name of {@code PipelineRun},
* {@code Map} value - a {@code PipelineRun} field value
*/
public static Map<String, Object> map(PipelineRun run, Long threshold) {
JsonMapper mapper = new JsonMapper();
Map<String, Object> params = mapper.convertValue(run, mapper.getTypeFactory().constructParametricType(Map.class, String.class, Object.class));
if (threshold != null) {
params.put("timeThreshold", threshold / SECONDS_IN_MINUTE);
}
params.put("runningTime", Duration.between(run.getStartDate().toInstant(), DateUtils.now().toInstant()).abs().getSeconds() / SECONDS_IN_MINUTE);
return params;
}
use of com.epam.pipeline.config.JsonMapper in project cloud-pipeline by epam.
the class CAdvisorMonitoringManagerTest method setUp.
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
JsonMapper objectMapper = new JsonMapper();
cAdvisorMonitoringManager = new CAdvisorMonitoringManager(nodesManager, messageHelper, objectMapper, kubernetesManager, TIMEOUT, C_ADVISOR_PORT, false);
}
Aggregations