refactor the organization of the code

refactor the organization of the code
This commit is contained in:
coderfengyun 2014-04-16 16:49:11 +08:00
parent 50a4ad2720
commit bb854e437c
46 changed files with 74 additions and 72 deletions

View File

@ -15,8 +15,8 @@ import org.bench4q.master.domain.service.TestPlanEngine;
import org.bench4q.master.domain.service.TestPlanScriptResultService;
import org.bench4q.master.domain.service.TestPlanService;
import org.bench4q.master.domain.service.UserService;
import org.bench4q.master.domain.testplan.report.ReportService;
import org.bench4q.master.exception.Bench4QException;
import org.bench4q.master.report.ReportService;
import org.bench4q.share.enums.master.TestPlanStatus;
import org.bench4q.share.models.master.MonitorModel;
import org.bench4q.share.models.master.TestPlanScriptBriefResultModel;

View File

@ -29,12 +29,12 @@ import org.bench4q.master.domain.factory.TestPlanFactory;
import org.bench4q.master.domain.service.AgentService;
import org.bench4q.master.domain.service.TestPlanService;
import org.bench4q.master.domain.testplan.RunningScriptSampler;
import org.bench4q.master.domain.testplan.highavailable.AgentRunBlotter;
import org.bench4q.master.domain.testplan.highavailable.faultolerence.StopAgentFault;
import org.bench4q.master.domain.testplan.schedulscript.ExecutionOverTask;
import org.bench4q.master.domain.testplan.schedulscript.WarmUpOverTask;
import org.bench4q.master.exception.ExceptionLog;
import org.bench4q.master.infrastructure.communication.AgentMessenger;
import org.bench4q.master.testplan.highavailable.AgentRunBlotter;
import org.bench4q.master.testplan.highavailable.faultolerence.StopAgentFault;
import org.bench4q.master.testplan.schedulscript.ExecutionOverTask;
import org.bench4q.master.testplan.schedulscript.WarmUpOverTask;
import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.StopTestModel;

View File

@ -4,7 +4,7 @@ import java.util.List;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.domain.repository.AgentRepository;
import org.bench4q.master.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.domain.testplan.highavailable.HighAvailablePool;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -15,9 +15,9 @@ import org.bench4q.master.Main;
import org.bench4q.master.domain.entity.TestPlan;
import org.bench4q.master.domain.entity.User;
import org.bench4q.master.domain.repository.TestPlanRepository;
import org.bench4q.master.testplan.highavailable.CurrentLoadObserver;
import org.bench4q.master.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.testplan.schedulscript.TaskCompleteCallback;
import org.bench4q.master.domain.testplan.highavailable.CurrentLoadObserver;
import org.bench4q.master.domain.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.domain.testplan.schedulscript.TaskCompleteCallback;
import org.bench4q.share.enums.master.TestPlanStatus;
import org.bench4q.share.models.master.TestPlanModel;
import org.hibernate.criterion.Criterion;

View File

@ -8,9 +8,9 @@ import org.bench4q.master.domain.RunningScriptInterface;
import org.bench4q.master.domain.entity.TestPlan;
import org.bench4q.master.domain.entity.TestPlanScript;
import org.bench4q.master.domain.repository.TestPlanRepository;
import org.bench4q.master.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.transaction.Transaction;
import org.bench4q.master.transaction.TransactionFactory;
import org.bench4q.master.domain.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.domain.transaction.Transaction;
import org.bench4q.master.domain.transaction.TransactionFactory;
import org.bench4q.share.enums.master.TestPlanStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

View File

@ -8,13 +8,13 @@ import java.util.List;
import javax.xml.bind.JAXBException;
import org.bench4q.master.domain.RunningAgentInterface;
import org.bench4q.master.domain.testplan.datastatistics.BehaviorsBriefStatistics;
import org.bench4q.master.domain.testplan.datastatistics.DataStatistics;
import org.bench4q.master.domain.testplan.datastatistics.PagesBriefStatistics;
import org.bench4q.master.domain.testplan.datastatistics.ScriptBriefStatistics;
import org.bench4q.master.domain.testplan.datastatistics.ScriptStatistics;
import org.bench4q.master.helper.ApplicationContextHelper;
import org.bench4q.master.infrastructure.communication.AgentMessenger;
import org.bench4q.master.testplan.datastatistics.BehaviorsBriefStatistics;
import org.bench4q.master.testplan.datastatistics.DataStatistics;
import org.bench4q.master.testplan.datastatistics.PagesBriefStatistics;
import org.bench4q.master.testplan.datastatistics.ScriptBriefStatistics;
import org.bench4q.master.testplan.datastatistics.ScriptStatistics;
import org.bench4q.share.models.agent.TestBriefStatusModel;
import org.bench4q.share.models.agent.statistics.AgentBehaviorsBriefModel;
import org.bench4q.share.models.agent.statistics.AgentBriefStatusModel;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.datastatistics;
package org.bench4q.master.domain.testplan.datastatistics;
import java.util.ArrayList;
import java.util.HashMap;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.datastatistics;
package org.bench4q.master.domain.testplan.datastatistics;
import org.bench4q.share.models.agent.statistics.DataStatisticsModel;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.datastatistics;
package org.bench4q.master.domain.testplan.datastatistics;
import org.bench4q.share.models.agent.statistics.AgentPageBriefModel;
import org.bench4q.share.models.agent.statistics.DataStatisticsModel;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.datastatistics;
package org.bench4q.master.domain.testplan.datastatistics;
import java.util.HashMap;
import java.util.Map;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.datastatistics;
package org.bench4q.master.domain.testplan.datastatistics;
import java.util.Date;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.datastatistics;
package org.bench4q.master.domain.testplan.datastatistics;
import java.util.Date;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.highavailable;
package org.bench4q.master.domain.testplan.highavailable;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.highavailable;
package org.bench4q.master.domain.testplan.highavailable;
public interface CurrentLoadObserver {
public void executePendingTestPlan();

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.highavailable;
package org.bench4q.master.domain.testplan.highavailable;
public class CurrentLoadSubject {
private CurrentLoadObserver observer;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.highavailable;
package org.bench4q.master.domain.testplan.highavailable;
import java.util.Collection;
import java.util.HashMap;

View File

@ -1,9 +1,9 @@
package org.bench4q.master.testplan.highavailable.faultolerence;
package org.bench4q.master.domain.testplan.highavailable.faultolerence;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.domain.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.helper.ApplicationContextHelper;
import org.bench4q.master.infrastructure.communication.AgentMessenger;
import org.bench4q.master.testplan.highavailable.HighAvailablePool;
public class BriefAgentFault implements FaultTolerance {
private HighAvailablePool haPool;

View File

@ -0,0 +1,5 @@
package org.bench4q.master.domain.testplan.highavailable.faultolerence;
public interface FaultTolerance {
public void doTolerance();
}

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.highavailable.faultolerence;
package org.bench4q.master.domain.testplan.highavailable.faultolerence;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.highavailable.faultolerence;
package org.bench4q.master.domain.testplan.highavailable.faultolerence;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.share.models.agent.RunScenarioModel;

View File

@ -1,9 +1,9 @@
package org.bench4q.master.testplan.highavailable.faultolerence;
package org.bench4q.master.domain.testplan.highavailable.faultolerence;
import java.util.UUID;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.testplan.highavailable.AgentRunBlotter;
import org.bench4q.master.domain.testplan.highavailable.AgentRunBlotter;
public class StopAgentFault implements FaultTolerance {

View File

@ -1,4 +1,4 @@
package org.bench4q.master.report;
package org.bench4q.master.domain.testplan.report;
import java.util.HashMap;
import java.util.List;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.report;
package org.bench4q.master.domain.testplan.report;
import java.awt.BasicStroke;
import java.awt.Color;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.report;
package org.bench4q.master.domain.testplan.report;
import java.lang.reflect.Field;
import java.util.ArrayList;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.schedulscript;
package org.bench4q.master.domain.testplan.schedulscript;
import java.util.TimerTask;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.schedulscript;
package org.bench4q.master.domain.testplan.schedulscript;
import java.util.UUID;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.testplan.schedulscript;
package org.bench4q.master.domain.testplan.schedulscript;
import java.util.TimerTask;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.transaction;
package org.bench4q.master.domain.transaction;
public interface Transaction {
public Object execute() throws Exception;

View File

@ -1,8 +1,8 @@
package org.bench4q.master.transaction;
package org.bench4q.master.domain.transaction;
import org.bench4q.master.domain.RunningScriptInterface;
import org.bench4q.master.transaction.impl.ScriptLoadCommand;
import org.bench4q.master.transaction.impl.TestPlanLoadCommand;
import org.bench4q.master.domain.transaction.impl.ScriptLoadCommand;
import org.bench4q.master.domain.transaction.impl.TestPlanLoadCommand;
public class TransactionFactory {
public static Transaction buildScriptTransaction(

View File

@ -1,4 +1,4 @@
package org.bench4q.master.transaction.exception;
package org.bench4q.master.domain.transaction.exception;
public class AgentRunException extends Exception {

View File

@ -1,4 +1,4 @@
package org.bench4q.master.transaction.exception;
package org.bench4q.master.domain.transaction.exception;
public class ScriptLoadDistributeException extends Exception {
private static final long serialVersionUID = -5230579598325900610L;

View File

@ -1,15 +1,15 @@
package org.bench4q.master.transaction.impl;
package org.bench4q.master.domain.transaction.impl;
import java.io.IOException;
import org.apache.log4j.Logger;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.domain.service.AgentService;
import org.bench4q.master.domain.transaction.Transaction;
import org.bench4q.master.domain.transaction.exception.AgentRunException;
import org.bench4q.master.exception.ExceptionLog;
import org.bench4q.master.helper.ApplicationContextHelper;
import org.bench4q.master.infrastructure.communication.AgentMessenger;
import org.bench4q.master.transaction.Transaction;
import org.bench4q.master.transaction.exception.AgentRunException;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.RunScenarioResultModel;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.transaction.impl;
package org.bench4q.master.domain.transaction.impl;
import java.util.ArrayList;
import java.util.List;
@ -12,14 +12,14 @@ import org.bench4q.master.domain.RunningScriptInterface;
import org.bench4q.master.domain.RunningAgentInterface.AbstractRunningAgent;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.domain.service.AgentService;
import org.bench4q.master.domain.testplan.highavailable.AgentRunBlotter;
import org.bench4q.master.domain.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.domain.transaction.Transaction;
import org.bench4q.master.domain.transaction.exception.AgentRunException;
import org.bench4q.master.domain.transaction.exception.ScriptLoadDistributeException;
import org.bench4q.master.exception.ExceptionLog;
import org.bench4q.master.helper.ApplicationContextHelper;
import org.bench4q.master.infrastructure.communication.AgentMessenger;
import org.bench4q.master.testplan.highavailable.AgentRunBlotter;
import org.bench4q.master.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.transaction.Transaction;
import org.bench4q.master.transaction.exception.AgentRunException;
import org.bench4q.master.transaction.exception.ScriptLoadDistributeException;
import org.bench4q.share.models.agent.RunScenarioModel;
import org.bench4q.share.models.agent.RunScenarioResultModel;
import org.bench4q.share.models.agent.StopTestModel;

View File

@ -1,4 +1,4 @@
package org.bench4q.master.transaction.impl;
package org.bench4q.master.domain.transaction.impl;
import org.bench4q.master.domain.RunningScriptInterface;

View File

@ -1,6 +1,6 @@
package org.bench4q.master.transaction.impl;
package org.bench4q.master.domain.transaction.impl;
import org.bench4q.master.transaction.Transaction;
import org.bench4q.master.domain.transaction.Transaction;
public class TestPlanLoadCommand implements Transaction {

View File

@ -10,8 +10,8 @@ import javax.xml.bind.JAXBException;
import org.apache.log4j.Logger;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.domain.testplan.highavailable.faultolerence.FaultTolerenceFactory;
import org.bench4q.master.exception.ExceptionLog;
import org.bench4q.master.testplan.highavailable.faultolerence.FaultTolerenceFactory;
import org.bench4q.share.communication.HttpRequester;
import org.bench4q.share.communication.HttpRequester.HttpResponse;
import org.bench4q.share.helper.MarshalHelper;

View File

@ -1,5 +0,0 @@
package org.bench4q.master.testplan.highavailable.faultolerence;
public interface FaultTolerance {
public void doTolerance();
}

View File

@ -3,6 +3,7 @@ package org.bench4q.master.test;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import org.bench4q.master.domain.entity.RunningAgentDB;
import org.bench4q.master.domain.entity.TestPlan;
import org.bench4q.master.domain.entity.User;
@ -15,10 +16,10 @@ import org.bench4q.master.domain.service.TestPlanScriptResultService;
import org.bench4q.master.domain.service.TestPlanScriptService;
import org.bench4q.master.domain.service.TestPlanService;
import org.bench4q.master.domain.service.UserService;
import org.bench4q.master.domain.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.helper.SessionHelper;
import org.bench4q.master.infrastructure.communication.AgentMessenger;
import org.bench4q.master.test.controller.TestBase;
import org.bench4q.master.testplan.highavailable.HighAvailablePool;
import org.bench4q.share.enums.master.TestPlanStatus;
import org.bench4q.share.models.master.MonitorModel;
import org.bench4q.share.models.master.RunningScriptModel;

View File

@ -2,7 +2,7 @@ package org.bench4q.master.test.datastatistics;
import static org.junit.Assert.*;
import org.bench4q.master.testplan.datastatistics.ScriptBriefStatistics;
import org.bench4q.master.domain.testplan.datastatistics.ScriptBriefStatistics;
import org.bench4q.share.models.agent.statistics.AgentBriefStatusModel;
import org.bench4q.share.models.master.statistics.ScriptBriefResultModel;
import org.junit.Test;

View File

@ -5,7 +5,7 @@ import static org.junit.Assert.*;
import java.util.ArrayList;
import java.util.List;
import org.bench4q.master.testplan.datastatistics.PageBriefStatistics;
import org.bench4q.master.domain.testplan.datastatistics.PageBriefStatistics;
import org.bench4q.share.models.agent.statistics.AgentPageBriefModel;
import org.bench4q.share.models.master.statistics.ScriptPageBriefModel;
import org.junit.Test;

View File

@ -3,11 +3,12 @@ package org.bench4q.master.test.datastatistics;
import java.util.ArrayList;
import java.util.List;
import org.bench4q.master.testplan.datastatistics.PagesBriefStatistics;
import org.bench4q.master.domain.testplan.datastatistics.PagesBriefStatistics;
import org.bench4q.share.models.agent.statistics.AgentPageBriefModel;
import org.bench4q.share.models.agent.statistics.AgentPagesBriefModel;
import org.bench4q.share.models.master.statistics.ScriptPagesBriefModel;
import org.junit.Test;
import static org.junit.Assert.*;
public class Test_PagesBrief {

View File

@ -7,8 +7,8 @@ import java.util.UUID;
import org.bench4q.master.domain.entity.TestPlan;
import org.bench4q.master.domain.entity.TestPlanScript;
import org.bench4q.master.domain.testplan.highavailable.AgentRunBlotter;
import org.bench4q.master.test.TestBase_MakeUpTestPlan;
import org.bench4q.master.testplan.highavailable.AgentRunBlotter;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

View File

@ -10,7 +10,7 @@ import java.util.Date;
import java.util.List;
import java.util.UUID;
import org.bench4q.master.report.ReportService;
import org.bench4q.master.domain.testplan.report.ReportService;
import org.jfree.data.time.Second;
import org.jfree.data.time.TimeSeries;
import org.junit.Test;

View File

@ -5,7 +5,7 @@ import static org.junit.Assert.*;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.domain.repository.AgentRepository;
import org.bench4q.master.domain.service.AgentService;
import org.bench4q.master.testplan.highavailable.HighAvailablePool;
import org.bench4q.master.domain.testplan.highavailable.HighAvailablePool;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;

View File

@ -4,7 +4,7 @@ import static org.junit.Assert.*;
import java.util.UUID;
import org.bench4q.master.report.ReportService;
import org.bench4q.master.domain.testplan.report.ReportService;
import org.bench4q.master.test.TestBase_MakeUpTestPlan;
import org.junit.Test;
import org.junit.runner.RunWith;

View File

@ -8,8 +8,8 @@ import java.util.UUID;
import org.bench4q.master.domain.RunningAgentInterface;
import org.bench4q.master.domain.entity.Agent;
import org.bench4q.master.domain.entity.TestPlanScript;
import org.bench4q.master.domain.transaction.impl.ScriptLoadCommand;
import org.bench4q.master.test.TestBase_MakeUpTestPlan;
import org.bench4q.master.transaction.impl.ScriptLoadCommand;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;