diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/Agent.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/Agent.java index ce2580cc..aa57c4cd 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/Agent.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/entity/Agent.java @@ -8,8 +8,8 @@ import javax.persistence.Id; import javax.persistence.Table; import org.bench4q.master.domain.service.AgentService; -import org.bench4q.master.domain.transaction.exception.AgentRunException; -import org.bench4q.master.domain.transaction.impl.AgentDistribute; +import org.bench4q.master.domain.valueobject.transaction.exception.AgentRunException; +import org.bench4q.master.domain.valueobject.transaction.impl.AgentDistribute; import org.bench4q.share.models.agent.RunScenarioModel; @Entity @@ -98,7 +98,6 @@ public class Agent { agentDistribute.rollBack(); return false; } - } } diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/LoadDistribute.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/LoadDistribute.java index 5f2fac31..82068de4 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/LoadDistribute.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/LoadDistribute.java @@ -1,14 +1,15 @@ package org.bench4q.master.domain.valueobject; import java.util.List; + import org.apache.log4j.Logger; import org.bench4q.master.domain.RunningAgentInterface; 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.domain.transaction.Transaction; -import org.bench4q.master.domain.transaction.TransactionFactory; +import org.bench4q.master.domain.valueobject.transaction.Transaction; +import org.bench4q.master.domain.valueobject.transaction.TransactionFactory; import org.bench4q.master.infrastructure.highavailable.HighAvailablePool; import org.bench4q.share.enums.master.TestPlanStatus; import org.springframework.beans.factory.annotation.Autowired; diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/Transaction.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/Transaction.java similarity index 63% rename from Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/Transaction.java rename to Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/Transaction.java index 69a10847..5583ffd1 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/Transaction.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/Transaction.java @@ -1,4 +1,4 @@ -package org.bench4q.master.domain.transaction; +package org.bench4q.master.domain.valueobject.transaction; public interface Transaction { public Object execute() throws Exception; diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/TransactionFactory.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/TransactionFactory.java similarity index 62% rename from Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/TransactionFactory.java rename to Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/TransactionFactory.java index dc73e2c7..06fc5d10 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/TransactionFactory.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/TransactionFactory.java @@ -1,8 +1,8 @@ -package org.bench4q.master.domain.transaction; +package org.bench4q.master.domain.valueobject.transaction; import org.bench4q.master.domain.RunningScriptInterface; -import org.bench4q.master.domain.transaction.impl.ScriptDistribute; -import org.bench4q.master.domain.transaction.impl.TestPlanDistribute; +import org.bench4q.master.domain.valueobject.transaction.impl.ScriptDistribute; +import org.bench4q.master.domain.valueobject.transaction.impl.TestPlanDistribute; public class TransactionFactory { public static Transaction buildScriptTransaction( diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/exception/AgentRunException.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/exception/AgentRunException.java similarity index 84% rename from Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/exception/AgentRunException.java rename to Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/exception/AgentRunException.java index d0b6eec4..ef53b803 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/exception/AgentRunException.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/exception/AgentRunException.java @@ -1,4 +1,4 @@ -package org.bench4q.master.domain.transaction.exception; +package org.bench4q.master.domain.valueobject.transaction.exception; public class AgentRunException extends Exception { diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/exception/ScriptLoadDistributeException.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/exception/ScriptLoadDistributeException.java similarity index 84% rename from Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/exception/ScriptLoadDistributeException.java rename to Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/exception/ScriptLoadDistributeException.java index 17f5ba7e..b41327a4 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/exception/ScriptLoadDistributeException.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/exception/ScriptLoadDistributeException.java @@ -1,4 +1,4 @@ -package org.bench4q.master.domain.transaction.exception; +package org.bench4q.master.domain.valueobject.transaction.exception; public class ScriptLoadDistributeException extends Exception { private static final long serialVersionUID = -5230579598325900610L; diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/AgentDistribute.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/AgentDistribute.java similarity index 93% rename from Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/AgentDistribute.java rename to Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/AgentDistribute.java index dcf94f6a..238f6425 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/AgentDistribute.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/AgentDistribute.java @@ -1,12 +1,12 @@ -package org.bench4q.master.domain.transaction.impl; +package org.bench4q.master.domain.valueobject.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.domain.valueobject.transaction.Transaction; +import org.bench4q.master.domain.valueobject.transaction.exception.AgentRunException; import org.bench4q.master.exception.ExceptionLog; import org.bench4q.master.helper.ApplicationContextHelper; import org.bench4q.master.infrastructure.communication.AgentMessenger; diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/ScriptDistribute.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/ScriptDistribute.java similarity index 85% rename from Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/ScriptDistribute.java rename to Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/ScriptDistribute.java index 1eb042a9..d1dda6be 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/ScriptDistribute.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/ScriptDistribute.java @@ -1,4 +1,4 @@ -package org.bench4q.master.domain.transaction.impl; +package org.bench4q.master.domain.valueobject.transaction.impl; import org.bench4q.master.domain.RunningScriptInterface; diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/ScriptLoadBase.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/ScriptLoadBase.java similarity index 92% rename from Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/ScriptLoadBase.java rename to Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/ScriptLoadBase.java index 5b563114..a10ff6fd 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/ScriptLoadBase.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/ScriptLoadBase.java @@ -1,4 +1,4 @@ -package org.bench4q.master.domain.transaction.impl; +package org.bench4q.master.domain.valueobject.transaction.impl; import java.util.ArrayList; import java.util.List; @@ -12,9 +12,8 @@ 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.transaction.Transaction; -import org.bench4q.master.domain.transaction.exception.AgentRunException; -import org.bench4q.master.domain.transaction.exception.ScriptLoadDistributeException; +import org.bench4q.master.domain.valueobject.transaction.Transaction; +import org.bench4q.master.domain.valueobject.transaction.exception.ScriptLoadDistributeException; import org.bench4q.master.exception.ExceptionLog; import org.bench4q.master.helper.ApplicationContextHelper; import org.bench4q.master.infrastructure.communication.AgentMessenger; @@ -158,14 +157,7 @@ public abstract class ScriptLoadBase implements Transaction { } loadForRunCurrent = getMin(totalRequireLoad, agent.getRemainLoad()); runScenarioModel.setPoolSize(loadForRunCurrent); - AgentDistribute agentTransaction = new AgentDistribute( - agent.getHostName(), agent.getPort(), runScenarioModel); - try { - runScenarioResultModel = (RunScenarioResultModel) agentTransaction - .execute(); - } catch (AgentRunException e) { - logger.info(ExceptionLog.getStackTrace(e)); - agentTransaction.rollBack(); + if (!agent.runWithouParams(runScenarioModel)) { continue; } agent.setCurrentStatus(AgentService.AGENT_STATUS_InRun); diff --git a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/TestPlanDistribute.java b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/TestPlanDistribute.java similarity index 50% rename from Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/TestPlanDistribute.java rename to Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/TestPlanDistribute.java index e0795f05..a6328054 100644 --- a/Bench4Q-Master/src/main/java/org/bench4q/master/domain/transaction/impl/TestPlanDistribute.java +++ b/Bench4Q-Master/src/main/java/org/bench4q/master/domain/valueobject/transaction/impl/TestPlanDistribute.java @@ -1,6 +1,6 @@ -package org.bench4q.master.domain.transaction.impl; +package org.bench4q.master.domain.valueobject.transaction.impl; -import org.bench4q.master.domain.transaction.Transaction; +import org.bench4q.master.domain.valueobject.transaction.Transaction; public class TestPlanDistribute implements Transaction { diff --git a/Bench4Q-Master/src/test/java/org/bench4q/master/test/transaction/Test_ScriptLoadCommand.java b/Bench4Q-Master/src/test/java/org/bench4q/master/test/transaction/Test_ScriptLoadCommand.java index ea7ef8fc..b79d6012 100644 --- a/Bench4Q-Master/src/test/java/org/bench4q/master/test/transaction/Test_ScriptLoadCommand.java +++ b/Bench4Q-Master/src/test/java/org/bench4q/master/test/transaction/Test_ScriptLoadCommand.java @@ -8,7 +8,7 @@ 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.ScriptDistribute; +import org.bench4q.master.domain.valueobject.transaction.impl.ScriptDistribute; import org.bench4q.master.test.TestBase_MakeUpTestPlan; import org.junit.After; import org.junit.Before;