From 260c8282e34d9ebdea5bd46dede10afbb9e27e50 Mon Sep 17 00:00:00 2001 From: coderfengyun Date: Mon, 23 Dec 2013 17:30:02 +0800 Subject: [PATCH] refactor --- src/main/java/org/bench4q/agent/scenario/Scenario.java | 4 ++-- .../bench4q/agent/scenario/behavior/BehaviorFactory.java | 4 ++-- src/test/java/org/bench4q/agent/test/model/ModelTest.java | 6 +++--- .../bench4q/agent/test/model/UserBehaviorModelTest.java | 8 ++++---- 4 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/org/bench4q/agent/scenario/Scenario.java b/src/main/java/org/bench4q/agent/scenario/Scenario.java index 56bd58aa..01a1a272 100644 --- a/src/main/java/org/bench4q/agent/scenario/Scenario.java +++ b/src/main/java/org/bench4q/agent/scenario/Scenario.java @@ -9,7 +9,7 @@ import org.bench4q.agent.scenario.behavior.BehaviorFactory; import org.bench4q.share.models.agent.ParameterModel; import org.bench4q.share.models.agent.RunScenarioModel; import org.bench4q.share.models.agent.scriptrecord.BatchModel; -import org.bench4q.share.models.agent.scriptrecord.BehaviorBaseModel; +import org.bench4q.share.models.agent.scriptrecord.BehaviorModel; import org.bench4q.share.models.agent.scriptrecord.PageModel; import org.bench4q.share.models.agent.scriptrecord.UsePluginModel; @@ -124,7 +124,7 @@ public class Scenario { } } - private static Behavior extractBehavior(BehaviorBaseModel behaviorModel) { + private static Behavior extractBehavior(BehaviorModel behaviorModel) { Behavior behavior = BehaviorFactory.getBuisinessObject(behaviorModel); behavior.setName(behaviorModel.getName()); behavior.setUse(behaviorModel.getUse()); diff --git a/src/main/java/org/bench4q/agent/scenario/behavior/BehaviorFactory.java b/src/main/java/org/bench4q/agent/scenario/behavior/BehaviorFactory.java index be82e11e..9c050110 100644 --- a/src/main/java/org/bench4q/agent/scenario/behavior/BehaviorFactory.java +++ b/src/main/java/org/bench4q/agent/scenario/behavior/BehaviorFactory.java @@ -1,9 +1,9 @@ package org.bench4q.agent.scenario.behavior; -import org.bench4q.share.models.agent.scriptrecord.BehaviorBaseModel; +import org.bench4q.share.models.agent.scriptrecord.BehaviorModel; public class BehaviorFactory { - public static Behavior getBuisinessObject(BehaviorBaseModel modelInput) { + public static Behavior getBuisinessObject(BehaviorModel modelInput) { if (modelInput.getType().equalsIgnoreCase("TIMERBEHAVIOR")) { return new TimerBehavior(); } else if (modelInput.getType().equalsIgnoreCase("USERBEHAVIOR")) { diff --git a/src/test/java/org/bench4q/agent/test/model/ModelTest.java b/src/test/java/org/bench4q/agent/test/model/ModelTest.java index cf404057..698d2df9 100644 --- a/src/test/java/org/bench4q/agent/test/model/ModelTest.java +++ b/src/test/java/org/bench4q/agent/test/model/ModelTest.java @@ -7,7 +7,7 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.annotation.XmlRootElement; -import org.bench4q.share.models.agent.scriptrecord.BehaviorBaseModel; +import org.bench4q.share.models.agent.scriptrecord.BehaviorModel; import org.junit.Test; import static org.junit.Assert.*; @@ -18,13 +18,13 @@ public class ModelTest { @Test public void unmarshalVerify() throws IOException, JAXBException { Object object = JAXBContext - .newInstance(BehaviorBaseModel.class) + .newInstance(BehaviorModel.class) .createUnmarshaller() .unmarshal( new File("Scripts" + System.getProperty("file.separator") + "behaviorModel.xml")); - assertTrue(object instanceof BehaviorBaseModel); + assertTrue(object instanceof BehaviorModel); } } diff --git a/src/test/java/org/bench4q/agent/test/model/UserBehaviorModelTest.java b/src/test/java/org/bench4q/agent/test/model/UserBehaviorModelTest.java index b7cbbf2d..6be857b2 100644 --- a/src/test/java/org/bench4q/agent/test/model/UserBehaviorModelTest.java +++ b/src/test/java/org/bench4q/agent/test/model/UserBehaviorModelTest.java @@ -8,7 +8,7 @@ import javax.xml.bind.JAXBContext; import javax.xml.bind.JAXBException; import javax.xml.bind.Unmarshaller; -import org.bench4q.share.models.agent.scriptrecord.BehaviorBaseModel; +import org.bench4q.share.models.agent.scriptrecord.BehaviorModel; import org.junit.Test; public class UserBehaviorModelTest { @@ -16,11 +16,11 @@ public class UserBehaviorModelTest { @Test public void testUnmarshal() throws JAXBException { Unmarshaller unmarshaller = JAXBContext.newInstance( - BehaviorBaseModel.class).createUnmarshaller(); + BehaviorModel.class).createUnmarshaller(); Object object = unmarshaller.unmarshal(new File("Scripts" + System.getProperty("file.separator") + "behaviorModel.xml")); - BehaviorBaseModel userBehaviorModel = (BehaviorBaseModel) object; + BehaviorModel userBehaviorModel = (BehaviorModel) object; System.out.println(userBehaviorModel.getUse()); - assertTrue(object instanceof BehaviorBaseModel); + assertTrue(object instanceof BehaviorModel); } }