add vuser COunt to AgentBriefModel
This commit is contained in:
parent
3dd684164d
commit
a6901e5fe9
|
@ -1,163 +1,176 @@
|
|||
package org.bench4q.share.models.agent;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class AgentBriefStatusModel extends DataStatisticsModel {
|
||||
private long timeFrame;
|
||||
private long minResponseTime;
|
||||
private long maxResponseTime;
|
||||
private long successCountFromBegin;
|
||||
private long successThroughputThisTime;
|
||||
private long failCountFromBegin;
|
||||
private long failThroughputThisTime;
|
||||
|
||||
private long successCountThisTime;
|
||||
private long failCountThisTime;
|
||||
private long totalResponseTimeThisTime;
|
||||
private long totalSqureResponseTimeThisTime;
|
||||
|
||||
@XmlElement
|
||||
public long getTimeFrame() {
|
||||
return timeFrame;
|
||||
}
|
||||
|
||||
public void setTimeFrame(long timeFrame) {
|
||||
this.timeFrame = timeFrame;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getMinResponseTime() {
|
||||
return minResponseTime;
|
||||
}
|
||||
|
||||
public void setMinResponseTime(long minResponseTime) {
|
||||
this.minResponseTime = minResponseTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getMaxResponseTime() {
|
||||
return maxResponseTime;
|
||||
}
|
||||
|
||||
public void setMaxResponseTime(long maxResponseTime) {
|
||||
this.maxResponseTime = maxResponseTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getSuccessThroughputThisTime() {
|
||||
return successThroughputThisTime;
|
||||
}
|
||||
|
||||
public void setSuccessThroughputThisTime(long successThroughputThisTime) {
|
||||
this.successThroughputThisTime = successThroughputThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getSuccessCountFromBegin() {
|
||||
return successCountFromBegin;
|
||||
}
|
||||
|
||||
public void setSuccessCountFromBegin(long successCountFromBegin) {
|
||||
this.successCountFromBegin = successCountFromBegin;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getFailCountFromBegin() {
|
||||
return failCountFromBegin;
|
||||
}
|
||||
|
||||
public void setFailCountFromBegin(long failCountFromBegin) {
|
||||
this.failCountFromBegin = failCountFromBegin;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getFailThroughputThisTime() {
|
||||
return failThroughputThisTime;
|
||||
}
|
||||
|
||||
public void setFailThroughputThisTime(long failThroughputThisTime) {
|
||||
this.failThroughputThisTime = failThroughputThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getSuccessCountThisTime() {
|
||||
return successCountThisTime;
|
||||
}
|
||||
|
||||
public void setSuccessCountThisTime(long successCountThisTime) {
|
||||
this.successCountThisTime = successCountThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getFailCountThisTime() {
|
||||
return failCountThisTime;
|
||||
}
|
||||
|
||||
public void setFailCountThisTime(long failCountThisTime) {
|
||||
this.failCountThisTime = failCountThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getTotalResponseTimeThisTime() {
|
||||
return totalResponseTimeThisTime;
|
||||
}
|
||||
|
||||
public void setTotalResponseTimeThisTime(long totalResponseTimeThisTime) {
|
||||
this.totalResponseTimeThisTime = totalResponseTimeThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getTotalSqureResponseTimeThisTime() {
|
||||
return totalSqureResponseTimeThisTime;
|
||||
}
|
||||
|
||||
public void setTotalSqureResponseTimeThisTime(
|
||||
long totalSqureResponseTimeThisTime) {
|
||||
this.totalSqureResponseTimeThisTime = totalSqureResponseTimeThisTime;
|
||||
}
|
||||
|
||||
// if the all the fields of target object equals with this's except
|
||||
// timeFrame,
|
||||
// We call it equals.
|
||||
@Override
|
||||
public boolean equals(Object targetObj) {
|
||||
if (!(targetObj instanceof AgentBriefStatusModel) || targetObj == null) {
|
||||
return false;
|
||||
}
|
||||
boolean result = true;
|
||||
AgentBriefStatusModel convertedObject = (AgentBriefStatusModel) targetObj;
|
||||
Field[] fs = this.getClass().getDeclaredFields();
|
||||
try {
|
||||
for (Field field : fs) {
|
||||
field.setAccessible(true);
|
||||
if (field.getLong(this) != field.getLong(convertedObject)) {
|
||||
System.out.println(field.getName()
|
||||
+ " not equals! and the target is "
|
||||
+ field.getLong(convertedObject) + " and this is "
|
||||
+ field.getLong(this));
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static AgentBriefStatusModel extractBriefStatusModel(String content)
|
||||
throws JAXBException {
|
||||
Unmarshaller unmarshaller = JAXBContext.newInstance(
|
||||
AgentBriefStatusModel.class).createUnmarshaller();
|
||||
return (AgentBriefStatusModel) unmarshaller
|
||||
.unmarshal(new ByteArrayInputStream(content.getBytes()));
|
||||
}
|
||||
}
|
||||
package org.bench4q.share.models.agent;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.lang.reflect.Field;
|
||||
|
||||
import javax.xml.bind.JAXBContext;
|
||||
import javax.xml.bind.JAXBException;
|
||||
import javax.xml.bind.Unmarshaller;
|
||||
import javax.xml.bind.annotation.XmlElement;
|
||||
import javax.xml.bind.annotation.XmlRootElement;
|
||||
|
||||
@XmlRootElement
|
||||
public class AgentBriefStatusModel extends DataStatisticsModel {
|
||||
private long timeFrame;
|
||||
private long minResponseTime;
|
||||
private long maxResponseTime;
|
||||
private long successCountFromBegin;
|
||||
private long successThroughputThisTime;
|
||||
private long failCountFromBegin;
|
||||
private long failThroughputThisTime;
|
||||
private long successCountThisTime;
|
||||
private long failCountThisTime;
|
||||
private long totalResponseTimeThisTime;
|
||||
private long totalSqureResponseTimeThisTime;
|
||||
|
||||
private long vUserCount;
|
||||
|
||||
@XmlElement
|
||||
public long getTimeFrame() {
|
||||
return timeFrame;
|
||||
}
|
||||
|
||||
public void setTimeFrame(long timeFrame) {
|
||||
this.timeFrame = timeFrame;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getMinResponseTime() {
|
||||
return minResponseTime;
|
||||
}
|
||||
|
||||
public void setMinResponseTime(long minResponseTime) {
|
||||
this.minResponseTime = minResponseTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getMaxResponseTime() {
|
||||
return maxResponseTime;
|
||||
}
|
||||
|
||||
public void setMaxResponseTime(long maxResponseTime) {
|
||||
this.maxResponseTime = maxResponseTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getSuccessThroughputThisTime() {
|
||||
return successThroughputThisTime;
|
||||
}
|
||||
|
||||
public void setSuccessThroughputThisTime(long successThroughputThisTime) {
|
||||
this.successThroughputThisTime = successThroughputThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getSuccessCountFromBegin() {
|
||||
return successCountFromBegin;
|
||||
}
|
||||
|
||||
public void setSuccessCountFromBegin(long successCountFromBegin) {
|
||||
this.successCountFromBegin = successCountFromBegin;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getFailCountFromBegin() {
|
||||
return failCountFromBegin;
|
||||
}
|
||||
|
||||
public void setFailCountFromBegin(long failCountFromBegin) {
|
||||
this.failCountFromBegin = failCountFromBegin;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getFailThroughputThisTime() {
|
||||
return failThroughputThisTime;
|
||||
}
|
||||
|
||||
public void setFailThroughputThisTime(long failThroughputThisTime) {
|
||||
this.failThroughputThisTime = failThroughputThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getSuccessCountThisTime() {
|
||||
return successCountThisTime;
|
||||
}
|
||||
|
||||
public void setSuccessCountThisTime(long successCountThisTime) {
|
||||
this.successCountThisTime = successCountThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getFailCountThisTime() {
|
||||
return failCountThisTime;
|
||||
}
|
||||
|
||||
public void setFailCountThisTime(long failCountThisTime) {
|
||||
this.failCountThisTime = failCountThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getTotalResponseTimeThisTime() {
|
||||
return totalResponseTimeThisTime;
|
||||
}
|
||||
|
||||
public void setTotalResponseTimeThisTime(long totalResponseTimeThisTime) {
|
||||
this.totalResponseTimeThisTime = totalResponseTimeThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getTotalSqureResponseTimeThisTime() {
|
||||
return totalSqureResponseTimeThisTime;
|
||||
}
|
||||
|
||||
public void setTotalSqureResponseTimeThisTime(
|
||||
long totalSqureResponseTimeThisTime) {
|
||||
this.totalSqureResponseTimeThisTime = totalSqureResponseTimeThisTime;
|
||||
}
|
||||
|
||||
@XmlElement
|
||||
public long getvUserCount() {
|
||||
return vUserCount;
|
||||
}
|
||||
|
||||
public void setvUserCount(long vUserCount) {
|
||||
this.vUserCount = vUserCount;
|
||||
}
|
||||
|
||||
// if the all the fields of target object equals with this's except
|
||||
// timeFrame,
|
||||
// We call it equals.
|
||||
@Override
|
||||
public boolean equals(Object targetObj) {
|
||||
if (!(targetObj instanceof AgentBriefStatusModel) || targetObj == null) {
|
||||
return false;
|
||||
}
|
||||
boolean result = true;
|
||||
AgentBriefStatusModel convertedObject = (AgentBriefStatusModel) targetObj;
|
||||
Field[] fs = this.getClass().getDeclaredFields();
|
||||
try {
|
||||
for (Field field : fs) {
|
||||
if (field.getName().equals("vUserCount")) {
|
||||
continue;
|
||||
}
|
||||
field.setAccessible(true);
|
||||
if (field.getLong(this) != field.getLong(convertedObject)) {
|
||||
System.out.println(field.getName()
|
||||
+ " not equals! and the target is "
|
||||
+ field.getLong(convertedObject) + " and this is "
|
||||
+ field.getLong(this));
|
||||
result = false;
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result = false;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static AgentBriefStatusModel extractBriefStatusModel(String content)
|
||||
throws JAXBException {
|
||||
Unmarshaller unmarshaller = JAXBContext.newInstance(
|
||||
AgentBriefStatusModel.class).createUnmarshaller();
|
||||
return (AgentBriefStatusModel) unmarshaller
|
||||
.unmarshal(new ByteArrayInputStream(content.getBytes()));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue