com.adobe.cq.testing.client.jobs.TopicStat Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of aem-cloud-testing-clients Show documentation
Show all versions of aem-cloud-testing-clients Show documentation
AEM related clients and testing utilities for AEM as a Cloud Service
/*
* Copyright 2017 Adobe Systems Incorporated
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.adobe.cq.testing.client.jobs;
import org.codehaus.jackson.JsonNode;
public class TopicStat {
String topicName;
long lastActivated;
long lastFinished;
int finishedJobs;
int failedJobs;
int cancelledJobs;
long avgProcessingTime;
long avgWaitingTime;
public TopicStat(String topicName, long lastActivated, long lastFinished, int finishedJobs, int failedJobs, int cancelledJobs,
long avgProcessingTime, long avgWaitingTime) {
this.topicName = topicName;
this.lastActivated = lastActivated;
this.lastFinished = lastFinished;
this.finishedJobs = finishedJobs;
this.failedJobs = failedJobs;
this.cancelledJobs = cancelledJobs;
this.avgProcessingTime = avgProcessingTime;
this.avgWaitingTime = avgWaitingTime;
}
/**
* Constructor from a {@link JsonNode} object
* Format :
*
*
* {@code
{
topic: "/my/topic/name",
last_activated: 1375793524795,
last_finished: -1,
finished_jobs: 0,
failed_jobs: 4,
cancelled_jobs: 0,
avg_processing_time: 0,
avg_waiting_time: 1522
}
* }
*
*
* @param topicJson the topic JSON node
*/
public TopicStat(JsonNode topicJson) {
this.topicName = topicJson.get("topic").getTextValue();
this.lastActivated = topicJson.get("last_activated").getLongValue();
this.lastFinished = topicJson.get("last_finished").getLongValue();
this.finishedJobs = topicJson.get("finished_jobs").getIntValue();
this.failedJobs = topicJson.get("failed_jobs").getIntValue();
this.cancelledJobs = topicJson.get("cancelled_jobs").getIntValue();
this.avgProcessingTime = topicJson.get("avg_processing_time").getLongValue();
this.avgWaitingTime = topicJson.get("avg_waiting_time").getLongValue();
}
public String getTopicName() {
return topicName;
}
public long getLastActivated() {
return lastActivated;
}
public long getLastFinished() {
return lastFinished;
}
public int getFinishedJobs() {
return finishedJobs;
}
public int getFailedJobs() {
return failedJobs;
}
public int getCancelledJobs() {
return cancelledJobs;
}
public long getAvgProcessingTime() {
return avgProcessingTime;
}
public long getAvgWaitingTime() {
return avgWaitingTime;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy