add paramTypeModel in paramInfoModel

This commit is contained in:
fanfuxiaoran 2014-04-21 15:27:23 +08:00
parent 67b0a9e206
commit 755599e5aa
9 changed files with 220 additions and 269 deletions

View File

@ -16,7 +16,7 @@ public class ParamInfo {
private int id;
private String name;
private String lable;
private ParamType type;
private ParamType paramType;
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
@ -49,12 +49,12 @@ public class ParamInfo {
@OneToOne(cascade = CascadeType.ALL, orphanRemoval = true, fetch = FetchType.EAGER)
@JoinColumn(name = "typeId", nullable = false)
public ParamType getType() {
return type;
public ParamType getParamType() {
return paramType;
}
public void setType(ParamType type) {
this.type = type;
public void setParamType(ParamType paramType) {
this.paramType = paramType;
}
}

View File

@ -1,29 +1,38 @@
package org.bench4q.master.domain.entity.plugin;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
@Entity
@Table(name = "paramType")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class ParamType {
private int id;
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
@Column(name = "id", nullable = false)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
}
package org.bench4q.master.domain.entity.plugin;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Inheritance;
import javax.persistence.InheritanceType;
import javax.persistence.Table;
@Entity
@Table(name = "paramType")
@Inheritance(strategy = InheritanceType.TABLE_PER_CLASS)
public abstract class ParamType {
private int id;
private String type;
@Id
@GeneratedValue(strategy = GenerationType.TABLE)
@Column(name = "id", nullable = false)
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
@Column(name="paramType")
public String getType() {
return type;
}
public void setType(String type) {
this.type = type;
}
}

View File

@ -20,7 +20,6 @@ import org.bench4q.master.domain.entity.plugin.PluginUI;
import org.bench4q.master.domain.entity.plugin.RadioButtonType;
import org.bench4q.master.domain.entity.plugin.TableType;
import org.bench4q.master.exception.ExceptionLog;
import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.plugin.BehaviorInfoModel;
import org.bench4q.share.models.master.plugin.CheckBoxModel;
import org.bench4q.share.models.master.plugin.ChoiceModel;
@ -28,30 +27,18 @@ import org.bench4q.share.models.master.plugin.ComboModel;
import org.bench4q.share.models.master.plugin.FieldModel;
import org.bench4q.share.models.master.plugin.NFieldModel;
import org.bench4q.share.models.master.plugin.ParamInfoModel;
import org.bench4q.share.models.master.plugin.ParamTypeClassAndContnet;
import org.bench4q.share.models.master.plugin.ParamTypeModel;
import org.bench4q.share.models.master.plugin.PluginInfoModel;
import org.bench4q.share.models.master.plugin.PluginUIModel;
import org.bench4q.share.models.master.plugin.RadioButtonModel;
import org.bench4q.share.models.master.plugin.TableModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class PluginDomainFactory {
private ParamTypeClassAndContentFactory paramTypeClassAndContentFactory;
private Logger logger = Logger.getLogger(PluginDomainFactory.class);
public ParamTypeClassAndContentFactory getParamTypeClassAndContentFactory() {
return paramTypeClassAndContentFactory;
}
@Autowired
public void setParamTypeClassAndContentFactory(
ParamTypeClassAndContentFactory paramTypeClassAndContentFactory) {
this.paramTypeClassAndContentFactory = paramTypeClassAndContentFactory;
}
public PluginUIModel createPluginUIModelwithOutBehaviors(PluginUI pluginUI) {
PluginUIModel pluginUIModel = new PluginUIModel();
pluginUIModel.setPluginInfoModel(createPluginInfoModel(pluginUI
@ -72,15 +59,12 @@ public class PluginDomainFactory {
ParamInfoModel paramInfoModel = new ParamInfoModel();
paramInfoModel.setLable(paramInfo.getLable());
paramInfoModel.setName(paramInfo.getName());
paramInfoModel.setType(paramInfo.getParamType().getType());
try {
paramInfoModel
.setParamTypeClassAndContnet(paramTypeClassAndContentFactory
.createParamTypeClassAndContnet(paramInfo));
paramInfoModel.setType(getParamTypeByParamClass(paramInfoModel
.getParamTypeClassAndContnet().getParamTypeClass()
.toString()));
ParamTypeModelFactory paramTypeModelFactory = new ParamTypeModelFactory();
paramInfoModel.setParamTypeModel(paramTypeModelFactory
.createParamTypeClassAndContnet(paramInfo));
} catch (JAXBException e) {
// TODO Auto-generated catch block
logger.info(ExceptionLog.getStackTrace(e));
@ -89,11 +73,6 @@ public class PluginDomainFactory {
return paramInfoModel;
}
private String getParamTypeByParamClass(String paramTypeClass) {
return paramTypeClass = paramTypeClass.substring(
paramTypeClass.lastIndexOf(".") + 1, paramTypeClass.length());
}
private List<ParamInfoModel> createParamInfoModels(
Set<? extends ParamInfo> paramInfos) {
List<ParamInfoModel> paramInfoModels = new LinkedList<ParamInfoModel>();
@ -129,37 +108,25 @@ public class PluginDomainFactory {
}
@Component
class ParamTypeClassAndContentFactory {
class ParamTypeModelFactory {
public ParamTypeClassAndContnet createParamTypeClassAndContnet(
ParamInfo paramInfo) throws JAXBException {
ParamType paramType = paramInfo.getType();
public ParamTypeModel createParamTypeClassAndContnet(ParamInfo paramInfo)
throws JAXBException {
ParamType paramType = paramInfo.getParamType();
if (paramType instanceof FieldType) {
String content = MarshalHelper.marshal(FieldModel.class,
createFieldModel((FieldType) paramType));
return new ParamTypeClassAndContnet(FieldModel.class, content);
return createFieldModel((FieldType) paramType);
}
else if (paramType instanceof NFieldType) {
String content = MarshalHelper.marshal(NFieldModel.class,
createNFieldModel((NFieldType) paramType));
return new ParamTypeClassAndContnet(NFieldModel.class, content);
return createNFieldModel((NFieldType) paramType);
} else if (paramType instanceof TableType) {
String content = MarshalHelper.marshal(TableModel.class,
createTableModel((TableType) paramType));
return new ParamTypeClassAndContnet(TableModel.class, content);
return createTableModel((TableType) paramType);
} else if (paramType instanceof CheckBoxType) {
String content = MarshalHelper.marshal(CheckBoxModel.class,
createCheckBoxModel((CheckBoxType) paramType));
return new ParamTypeClassAndContnet(CheckBoxModel.class, content);
return createCheckBoxModel((CheckBoxType) paramType);
} else if (paramType instanceof ComboType) {
String content = MarshalHelper.marshal(ComboModel.class,
createComboModel((ComboType) paramType));
return new ParamTypeClassAndContnet(ComboModel.class, content);
return createComboModel((ComboType) paramType);
} else if (paramType instanceof RadioButtonType) {
String content = MarshalHelper.marshal(RadioButtonModel.class,
createRadioButton((RadioButtonType) paramType));
return new ParamTypeClassAndContnet(RadioButtonModel.class, content);
return createRadioButton((RadioButtonType) paramType);
} else
return null;
}

View File

@ -6,7 +6,6 @@ import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.Set;
import org.apache.log4j.Logger;
import org.bench4q.master.domain.entity.plugin.BehaviorInfo;
import org.bench4q.master.domain.entity.plugin.BehaviorParamInfo;
@ -89,12 +88,8 @@ public class PluginEntityFactory {
.getAttribute(element, "lable"));
behaviorParamInfo.setName(XmlParseHelper.getAttribute(element, "name"));
ParamTypeFactory paramTypeFactory = new ParamTypeFactory();
if (XmlParseHelper.getSingleChild(element) != null)
behaviorParamInfo
.setType(paramTypeFactory
.createParamTypeInfo(XmlParseHelper
.getSingleChild(element)));
behaviorParamInfo.setParamType(paramTypeFactory
.createParamTypeInfo(XmlParseHelper.getSingleChild(element)));
behaviorParamInfo.setBehaviorInfo(behaviorInfo);
return behaviorParamInfo;
@ -122,8 +117,8 @@ public class PluginEntityFactory {
}
private Set<PluginParamInfo> createPluginParamInfos(
List<Element> elements, PluginInfo pluginInfo) {
private Set<PluginParamInfo> createPluginParamInfos(List<Element> elements,
PluginInfo pluginInfo) {
Set<PluginParamInfo> paramInfos = new HashSet<PluginParamInfo>();
for (Element element : elements) {
PluginParamInfo pluginParamInfo = createPluginParamInfoWithOutId(
@ -144,7 +139,7 @@ public class PluginEntityFactory {
pluginParamInfo.setLable(XmlParseHelper.getAttribute(element, "label"));
pluginParamInfo.setName(XmlParseHelper.getAttribute(element, "name"));
ParamTypeFactory paramTypeFactory = new ParamTypeFactory();
pluginParamInfo.setType(paramTypeFactory
pluginParamInfo.setParamType(paramTypeFactory
.createParamTypeInfo(XmlParseHelper.getSingleChild(element)));
pluginParamInfo.setPluginInfo(pluginInfo);
return pluginParamInfo;
@ -175,6 +170,7 @@ class ParamTypeFactory {
private FieldType createFileType(Element element) {
FieldType fieldType = new FieldType();
fieldType.setType("field");
fieldType.setSize(Integer.parseInt(XmlParseHelper.getAttribute(element,
"size")));
fieldType.setText(XmlParseHelper.getAttribute(element, "text"));
@ -183,6 +179,7 @@ class ParamTypeFactory {
private NFieldType createNFieldType(Element element) {
NFieldType nFieldType = new NFieldType();
nFieldType.setType("nfield");
if (XmlParseHelper.getAttribute(element, "size") != null)
nFieldType.setSize(Integer.parseInt(XmlParseHelper.getAttribute(
element, "size")));
@ -192,12 +189,14 @@ class ParamTypeFactory {
private TableType createTableType(Element element) {
TableType tableType = new TableType();
tableType.setType("table");
tableType.setCols(XmlParseHelper.getAttribute(element, "cols"));
return tableType;
}
private RadioButtonType createRadioButtonType(Element element) {
RadioButtonType radioButtonType = new RadioButtonType();
radioButtonType.setType("radioButton");
radioButtonType.setChoices(createChoiceTypes(
XmlParseHelper.getChildElements(element), radioButtonType));
return radioButtonType;
@ -205,7 +204,7 @@ class ParamTypeFactory {
private CheckBoxType createCheckBoxType(Element element) {
CheckBoxType checkBoxType = new CheckBoxType();
checkBoxType.setType("choiceBox");
checkBoxType.setChoiceList(createChoiceTypes(
XmlParseHelper.getChildElements(element), checkBoxType));
return checkBoxType;
@ -213,6 +212,7 @@ class ParamTypeFactory {
private ComboType createComboType(Element element) {
ComboType comboType = new ComboType();
comboType.setType("combo");
comboType.setChoiceList(createChoiceTypes(
XmlParseHelper.getChildElements(element), comboType));
return comboType;

View File

@ -1,27 +1,29 @@
package org.bench4q.master.domain.transaction.impl;
import org.bench4q.master.domain.RunningScriptInterface;
public class ScriptLoadCommand extends ScriptLoadBase {
private int requiredLoad;
private int getRequiredLoad() {
return requiredLoad;
}
private void setRequiredLoad(int requiredLoad) {
this.requiredLoad = requiredLoad;
}
public ScriptLoadCommand(RunningScriptInterface runningScript,
int requiredLoad) {
super(runningScript);
this.setRequiredLoad(requiredLoad);
}
@Override
protected int getRequireLoad() {
return this.getRequiredLoad();
}
}
package org.bench4q.master.domain.transaction.impl;
import org.bench4q.master.domain.RunningScriptInterface;
public class ScriptLoadCommand extends ScriptLoadBase {
private int requiredLoad;
private int getRequiredLoad() {
return requiredLoad;
}
private void setRequiredLoad(int requiredLoad) {
this.requiredLoad = requiredLoad;
}
public ScriptLoadCommand(RunningScriptInterface runningScript,
int requiredLoad) {
super(runningScript);
this.setRequiredLoad(requiredLoad);
}
@Override
protected int getRequireLoad() {
return this.getRequiredLoad();
}
}

View File

@ -1,117 +1,115 @@
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.infrastructure.highavailable.HighAvailablePool;
import org.bench4q.share.enums.master.TestPlanStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class LoadDistribute {
private HighAvailablePool highAvailableAgentPool;
private TestPlanRepository testPlanRepository;
private static Logger logger = Logger.getLogger(LoadDistribute.class);
public HighAvailablePool getHighAvailableAgentPool() {
return highAvailableAgentPool;
}
@Autowired
public void setHighAvailableAgentPool(
HighAvailablePool highAvailableAgentPool) {
this.highAvailableAgentPool = highAvailableAgentPool;
}
private TestPlanRepository getTestPlanRepository() {
return testPlanRepository;
}
@Autowired
private void setTestPlanRepository(TestPlanRepository testPlanRepository) {
this.testPlanRepository = testPlanRepository;
}
private boolean hasEnoughCurrentLoad(int totalRequireLoad) {
return this.highAvailableAgentPool.getCurrentAvailableLoad() >= totalRequireLoad;
}
private boolean hasEnoughMaxLoad(int totalRequireLoad) {
return this.getHighAvailableAgentPool().getMaxAvailableLoad() >= totalRequireLoad;
}
public TestPlanStatus generateLoadForTestPlan(TestPlan testPlanInDomain) {
synchronized (this.highAvailableAgentPool.getPool()) {
if (!hasEnoughMaxLoad(testPlanInDomain.getRequiredLoad())) {
logger.error("There is no enough max load in the pool!");
return TestPlanStatus.PendingNoEnoughMaxLoad;
}
if (!hasEnoughCurrentLoad(testPlanInDomain.getRequiredLoad())) {
logger.info("There is no enough current load in the pool!");
return TestPlanStatus.PendingNoEnoughCurrentLoad;
}
for (RunningScriptInterface testPlanScript : testPlanInDomain
.getTestPlanScripts()) {
if (!distributeLoadForScript(testPlanScript)) {
return TestPlanStatus.ErrorInDistributeLoadForScript;
}
}
doAfterDistributeLoadForTestPlan(testPlanInDomain);
return TestPlanStatus.InRunning;
}
}
private void doAfterDistributeLoadForTestPlan(TestPlan testPlanInDomain) {
this.getHighAvailableAgentPool().timerTask();
testPlanInDomain.doAfterRun();
}
private boolean distributeLoadForScript(RunningScriptInterface runningScript) {
return distributeLoadForScript(runningScript,
runningScript.getRequireLoad());
}
@SuppressWarnings("unchecked")
public boolean distributeLoadForScript(
RunningScriptInterface runningScript, int requireLoad) {
Transaction scriptLoadCommand = TransactionFactory
.buildScriptTransaction(runningScript, requireLoad);
List<? extends RunningAgentInterface> runningAgents = null;
try {
runningAgents = (List<? extends RunningAgentInterface>) scriptLoadCommand
.execute();
} catch (Exception e) {
logger.error("distribute load error, the runningAgents is null");
scriptLoadCommand.rollBack();
return false;
}
if (runningAgents == null) {
logger.error("distribute load error, the runningAgents is null");
scriptLoadCommand.rollBack();
return false;
}
doAfterDistributeLoadSuccessForScript(runningScript, runningAgents);
return true;
}
private void doAfterDistributeLoadSuccessForScript(
RunningScriptInterface scriptInput,
List<? extends RunningAgentInterface> runningAgents) {
scriptInput.doAfterDistributeLoad(runningAgents);
if (!(scriptInput instanceof TestPlanScript)) {
return;
}
this.getTestPlanRepository().updateEntity(
((TestPlanScript) scriptInput).getTestPlan());
}
}
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.infrastructure.highavailable.HighAvailablePool;
import org.bench4q.share.enums.master.TestPlanStatus;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@Component
public class LoadDistribute {
private HighAvailablePool highAvailableAgentPool;
private TestPlanRepository testPlanRepository;
private static Logger logger = Logger.getLogger(LoadDistribute.class);
public HighAvailablePool getHighAvailableAgentPool() {
return highAvailableAgentPool;
}
@Autowired
public void setHighAvailableAgentPool(
HighAvailablePool highAvailableAgentPool) {
this.highAvailableAgentPool = highAvailableAgentPool;
}
private TestPlanRepository getTestPlanRepository() {
return testPlanRepository;
}
@Autowired
private void setTestPlanRepository(TestPlanRepository testPlanRepository) {
this.testPlanRepository = testPlanRepository;
}
private boolean hasEnoughCurrentLoad(int totalRequireLoad) {
return this.highAvailableAgentPool.getCurrentAvailableLoad() >= totalRequireLoad;
}
private boolean hasEnoughMaxLoad(int totalRequireLoad) {
return this.getHighAvailableAgentPool().getMaxAvailableLoad() >= totalRequireLoad;
}
public TestPlanStatus generateLoadForTestPlan(TestPlan testPlanInDomain) {
synchronized (this.highAvailableAgentPool.getPool()) {
if (!hasEnoughMaxLoad(testPlanInDomain.getRequiredLoad())) {
logger.error("There is no enough max load in the pool!");
return TestPlanStatus.PendingNoEnoughMaxLoad;
}
if (!hasEnoughCurrentLoad(testPlanInDomain.getRequiredLoad())) {
logger.info("There is no enough current load in the pool!");
return TestPlanStatus.PendingNoEnoughCurrentLoad;
}
for (RunningScriptInterface testPlanScript : testPlanInDomain
.getTestPlanScripts()) {
if (!distributeLoadForScript(testPlanScript)) {
return TestPlanStatus.ErrorInDistributeLoadForScript;
}
}
doAfterDistributeLoadForTestPlan(testPlanInDomain);
return TestPlanStatus.InRunning;
}
}
private void doAfterDistributeLoadForTestPlan(TestPlan testPlanInDomain) {
this.getHighAvailableAgentPool().timerTask();
testPlanInDomain.doAfterRun();
}
private boolean distributeLoadForScript(RunningScriptInterface runningScript) {
return distributeLoadForScript(runningScript,
runningScript.getRequireLoad());
}
@SuppressWarnings("unchecked")
public boolean distributeLoadForScript(
RunningScriptInterface runningScript, int requireLoad) {
Transaction scriptLoadCommand = TransactionFactory
.buildScriptTransaction(runningScript, requireLoad);
List<? extends RunningAgentInterface> runningAgents = null;
try {
runningAgents = (List<? extends RunningAgentInterface>) scriptLoadCommand
.execute();
} catch (Exception e) {
logger.error("distribute load error, the runningAgents is null");
scriptLoadCommand.rollBack();
return false;
}
if (runningAgents == null) {
logger.error("distribute load error, the runningAgents is null");
scriptLoadCommand.rollBack();
return false;
}
doAfterDistributeLoadSuccessForScript(runningScript, runningAgents);
return true;
}
private void doAfterDistributeLoadSuccessForScript(
RunningScriptInterface scriptInput,
List<? extends RunningAgentInterface> runningAgents) {
scriptInput.doAfterDistributeLoad(runningAgents);
if (!(scriptInput instanceof TestPlanScript)) {
return;
}
this.getTestPlanRepository().updateEntity(
((TestPlanScript) scriptInput).getTestPlan());
}
}

View File

@ -15,9 +15,6 @@ import org.bench4q.master.exception.ExceptionLog;
import org.bench4q.master.test.testHelper.Test_PluginHelper;
import org.bench4q.share.communication.HttpRequester.HttpResponse;
import org.bench4q.share.helper.MarshalHelper;
import org.bench4q.share.models.master.plugin.FieldModel;
import org.bench4q.share.models.master.plugin.ParamInfoModel;
import org.bench4q.share.models.master.plugin.PluginInfoModel;
import org.bench4q.share.models.master.plugin.PluginResponseModel;
import org.junit.After;
import org.junit.Assert;
@ -28,6 +25,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = { "classpath:service-test-context.xml" })
public class PluginControllerTest extends TestBase {
@ -163,25 +161,19 @@ public class PluginControllerTest extends TestBase {
.getAccessTocken());
HttpResponse httpResponse = this.httpRequester.sendPost(url, null,
properties);
logger.info(httpResponse.getContent());
PluginResponseModel pluginResponseModel = null;
try {
pluginResponseModel = (PluginResponseModel) MarshalHelper
.unmarshal(PluginResponseModel.class,
httpResponse.getContent());
System.out
.println(pluginResponseModel.getPluginUIModels().get(0)
.getPluginInfoModel().getParamInfoModels().get(0)
.getType());
} catch (Exception e) {
logger.info(ExceptionLog.getStackTrace(e));
}
assertNotNull(pluginResponseModel);
PluginInfoModel pluginInfoModel = pluginResponseModel
.getPluginUIModels().get(0).getPluginInfoModel();
int count = 0;
for (ParamInfoModel paramInfoModel : pluginInfoModel
.getParamInfoModels()) {
if (paramInfoModel.createParamTypeModel() instanceof FieldModel)
count++;
}
assertEquals(2, count);
}

View File

@ -2,17 +2,14 @@ package org.bench4q.master.test.factory;
import static org.junit.Assert.*;
import java.util.List;
import java.util.Set;
import javax.xml.bind.JAXBException;
import org.apache.log4j.Logger;
import org.bench4q.master.domain.entity.plugin.BehaviorInfo;
import org.bench4q.master.domain.entity.plugin.PluginUI;
import org.bench4q.master.domain.factory.PluginDomainFactory;
import org.bench4q.master.domain.repository.PluginRepository;
import org.bench4q.master.test.testHelper.Test_PluginHelper;
import org.bench4q.share.models.master.plugin.ParamInfoModel;
import org.bench4q.share.models.master.plugin.PluginUIModel;
import org.junit.After;
import org.junit.Before;
@ -29,7 +26,6 @@ public class Test_PluginDomainFactory extends Test_PluginHelper {
private PluginDomainFactory pluginDomainFactory;
private PluginRepository pluginRepository;
private String pluginName;
private Logger logger = Logger.getLogger(Test_PluginDomainFactory.class);
public PluginDomainFactory getPluginDomainFactory() {
return pluginDomainFactory;
@ -81,19 +77,6 @@ public class Test_PluginDomainFactory extends Test_PluginHelper {
PluginUIModel pluginUIModel = this.getPluginDomainFactory()
.createPluginUIModelwithOutBehaviors(pluginUI);
assertNotNull(pluginUIModel);
List<ParamInfoModel> paramInfoModels = pluginUIModel
.getPluginInfoModel().getParamInfoModels();
int count = 0;
for (ParamInfoModel paramInfoModel : paramInfoModels) {
if (paramInfoModel.getParamTypeClassAndContnet()
.getParamTypeClass().toString().contains("CheckBoxModel")) {
logger.info( paramInfoModel
.getParamTypeClassAndContnet().getParamTypeClass());
count++;
}
}
System.out.println(count);
}
@Test

View File

@ -54,8 +54,8 @@ public class Test_PluginEntityFactory {
.getPluginParamInfos();
FieldType fieldType = null;
for (PluginParamInfo pluginParamInfo : pluginParamInfos) {
if (pluginParamInfo.getType() instanceof FieldType)
fieldType = (FieldType) pluginParamInfo.getType();
if (pluginParamInfo.getParamType() instanceof FieldType)
fieldType = (FieldType) pluginParamInfo.getParamType();
}
assertTrue(fieldType.getSize() == 7);
assertEquals(2, pluginUI.getBehaviorInfos().size());