From 030794d5cad81e1b7b3a1ff3e3419256db1bd155 Mon Sep 17 00:00:00 2001 From: coderfengyun Date: Mon, 15 Sep 2014 15:08:56 +0800 Subject: [PATCH] refactor refactor --- .../BehaviorsBriefStatisticsTest.java | 30 ---- .../models/agent/BehaviorBriefModel.java | 70 --------- .../agent/BehaviorStatusCodeResultModel.java | 138 ------------------ 3 files changed, 238 deletions(-) delete mode 100644 Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/datastatistics/BehaviorsBriefStatisticsTest.java delete mode 100644 Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/BehaviorBriefModel.java delete mode 100644 Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/BehaviorStatusCodeResultModel.java diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/datastatistics/BehaviorsBriefStatisticsTest.java b/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/datastatistics/BehaviorsBriefStatisticsTest.java deleted file mode 100644 index 1e5b3b12..00000000 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/unitTest/datastatistics/BehaviorsBriefStatisticsTest.java +++ /dev/null @@ -1,30 +0,0 @@ -package org.bench4q.master.unitTest.datastatistics; - -import java.util.Arrays; - -import org.bench4q.master.domain.valueobject.datastatistics.impl.BehaviorsBriefStatistics; -import org.bench4q.share.helper.MarshalHelper; -import org.bench4q.share.models.agent.BehaviorBriefModel; -import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel; -import org.bench4q.share.models.agent.statistics.AgentBehaviorsBriefModel; -import org.junit.Test; - -public class BehaviorsBriefStatisticsTest { - @Test - public void testAddNull() { - BehaviorsBriefStatistics behaviorsBriefStatistics = new BehaviorsBriefStatistics(); - AgentBehaviorsBriefModel dataUnit = new AgentBehaviorsBriefModel(); - BehaviorBriefModel e = new BehaviorBriefModel(); - e.setBehaviorId(1); - e.setBehaviorUrl("www.baidu.com"); - e.setDetailStatusCodeResultModels(Arrays - .asList(new BehaviorStatusCodeResultModel())); - e.setSuccessfulCount(2); - e.setTotalCount(3); - dataUnit.getBehaviorBriefModels().add(e); - - behaviorsBriefStatistics.add(dataUnit); - System.out.println(MarshalHelper.tryMarshal(behaviorsBriefStatistics - .getStatistics())); - } -} diff --git a/Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/BehaviorBriefModel.java b/Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/BehaviorBriefModel.java deleted file mode 100644 index 5ae14572..00000000 --- a/Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/BehaviorBriefModel.java +++ /dev/null @@ -1,70 +0,0 @@ -package org.bench4q.share.models.agent; - -import java.util.LinkedList; -import java.util.List; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlElementWrapper; -import javax.xml.bind.annotation.XmlRootElement; - -import org.bench4q.share.models.agent.statistics.DataStatisticsModel; - -@XmlRootElement(name = "BehaviorBriefModel") -public class BehaviorBriefModel extends DataStatisticsModel { - private int behaviorId; - private String behaviorUrl; - private long totalCount; - private long successfulCount; - private List detailStatusCodeResultModels; - - @XmlElement - public int getBehaviorId() { - return behaviorId; - } - - public void setBehaviorId(int behaviorId) { - this.behaviorId = behaviorId; - } - - @XmlElement - public String getBehaviorUrl() { - return behaviorUrl; - } - - public void setBehaviorUrl(String behaviorUrl) { - this.behaviorUrl = behaviorUrl; - } - - @XmlElementWrapper(name = "detailStatusCodeResultList") - @XmlElement(name = "detailStatusCodeResult") - public List getDetailStatusCodeResultModels() { - return detailStatusCodeResultModels; - } - - public void setDetailStatusCodeResultModels( - List detailStatusCodeResultModels) { - this.detailStatusCodeResultModels = detailStatusCodeResultModels; - } - - @XmlElement - public long getTotalCount() { - return totalCount; - } - - public void setTotalCount(long totalCount) { - this.totalCount = totalCount; - } - - @XmlElement - public long getSuccessfulCount() { - return successfulCount; - } - - public void setSuccessfulCount(long successfulCount) { - this.successfulCount = successfulCount; - } - - public BehaviorBriefModel() { - this.setDetailStatusCodeResultModels(new LinkedList()); - } -} diff --git a/Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/BehaviorStatusCodeResultModel.java b/Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/BehaviorStatusCodeResultModel.java deleted file mode 100644 index 33f4a37a..00000000 --- a/Bench4Q-Share/src/main/java/org/bench4q/share/models/agent/BehaviorStatusCodeResultModel.java +++ /dev/null @@ -1,138 +0,0 @@ -package org.bench4q.share.models.agent; - -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement(name = "BehaviorStatusCodeResultModel") -public class BehaviorStatusCodeResultModel { - private int behaviorId; - private int statusCode; - private long countThisTime; - private long count; - private String contentType; - private long contentLength; - private long minResponseTime; - private long maxResponseTime; - private long totalResponseTimeThisTime; - - @XmlElement - public int getBehaviorId() { - return behaviorId; - } - - public void setBehaviorId(int behaviorId) { - this.behaviorId = behaviorId; - } - - @XmlElement - public int getStatusCode() { - return statusCode; - } - - public void setStatusCode(int statusCode) { - this.statusCode = statusCode; - } - - @XmlElement - public long getCount() { - return count; - } - - public void setCount(long count) { - this.count = count; - } - - @XmlElement - public long getCountThisTime() { - return countThisTime; - } - - public void setCountThisTime(long countThisTime) { - this.countThisTime = countThisTime; - } - - @XmlElement - public String getContentType() { - return contentType; - } - - public void setContentType(String contentType) { - this.contentType = contentType; - } - - @XmlElement - public long getContentLength() { - return contentLength; - } - - public void setContentLength(long contentLength) { - this.contentLength = contentLength; - } - - @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 getTotalResponseTimeThisTime() { - return totalResponseTimeThisTime; - } - - public void setTotalResponseTimeThisTime(long totalResponseTimeThisTime) { - this.totalResponseTimeThisTime = totalResponseTimeThisTime; - } - - /** - * It's just the http's success judgement, if we'll turn to other protocal, - * we should build a inheritance system - * - * @return - */ - public boolean isSuccess() { - return this.getStatusCode() == 200; - } - - public BehaviorStatusCodeResultModel getCopy() { - BehaviorStatusCodeResultModel ret = new BehaviorStatusCodeResultModel(); - ret.setStatusCode(getStatusCode()); - ret.setContentLength(getContentLength()); - ret.setContentType(getContentType()); - ret.setCount(getCount()); - ret.setMaxResponseTime(getMaxResponseTime()); - ret.setMinResponseTime(getMinResponseTime()); - ret.setTotalResponseTimeThisTime(getTotalResponseTimeThisTime()); - return ret; - } - - public synchronized void plus(BehaviorStatusCodeResultModel newOne) { - this.setContentLength(this.getContentLength() - + newOne.getContentLength()); - this.setCount(this.getCount() + newOne.getCount()); - this.setTotalResponseTimeThisTime(this.getTotalResponseTimeThisTime() - + newOne.getTotalResponseTimeThisTime()); - if (newOne.getMaxResponseTime() > this.getMaxResponseTime()) { - this.setMaxResponseTime(newOne.getMaxResponseTime()); - } - if (newOne.getMinResponseTime() < this.getMinResponseTime()) { - this.setMinResponseTime(newOne.getMinResponseTime()); - } - } - - public BehaviorStatusCodeResultModel() { - } - -}