add validate about the plugin is null
This commit is contained in:
parent
268f751220
commit
23f5642b3b
|
@ -29,8 +29,7 @@ public class PluginController extends BaseController {
|
||||||
public void setPluginService(PluginService pluginService) {
|
public void setPluginService(PluginService pluginService) {
|
||||||
this.pluginService = pluginService;
|
this.pluginService = pluginService;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping("/loadPluginList")
|
@RequestMapping("/loadPluginList")
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public PluginResponseModel loadPluginList() throws Bench4QException {
|
public PluginResponseModel loadPluginList() throws Bench4QException {
|
||||||
|
@ -92,8 +91,12 @@ public class PluginController extends BaseController {
|
||||||
throws Bench4QException {
|
throws Bench4QException {
|
||||||
if (!this.checkScope(UserService.SUPER_AUTHENTICATION)) {
|
if (!this.checkScope(UserService.SUPER_AUTHENTICATION)) {
|
||||||
throw new Bench4QException(400 + "", "not permitted",
|
throw new Bench4QException(400 + "", "not permitted",
|
||||||
"loadMethodParams/{pluginName}/{methodName}");
|
"addPlugin/{pluginName}/{methodName}");
|
||||||
}
|
}
|
||||||
|
if (pluginGUI.getPlugin() == null) {
|
||||||
|
throw new Bench4QException(400 + "", "plugin is null", "addPlugin");
|
||||||
|
}
|
||||||
|
|
||||||
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
PluginResponseModel pluginResponseModel = new PluginResponseModel();
|
||||||
pluginResponseModel.setSuccess(this.getPluginService().addPlugin(
|
pluginResponseModel.setSuccess(this.getPluginService().addPlugin(
|
||||||
pluginGUI.getPlugin()));
|
pluginGUI.getPlugin()));
|
||||||
|
|
|
@ -41,10 +41,10 @@ public class PluginFactory {
|
||||||
plugin.getPluginMethods().add(
|
plugin.getPluginMethods().add(
|
||||||
createMethodEntity(methodModel, plugin));
|
createMethodEntity(methodModel, plugin));
|
||||||
}
|
}
|
||||||
}
|
plugin.setName(pluginModel.getName());
|
||||||
|
return plugin;
|
||||||
plugin.setName(pluginModel.getName());
|
} else
|
||||||
return plugin;
|
throw new Bench4QException("", "no method in plugin", "");
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,7 +56,8 @@ public class PluginFactory {
|
||||||
if (methodModel.getMethodParams() != null) {
|
if (methodModel.getMethodParams() != null) {
|
||||||
for (MethodParamModel methodParamModel : methodModel
|
for (MethodParamModel methodParamModel : methodModel
|
||||||
.getMethodParams()) {
|
.getMethodParams()) {
|
||||||
Logger.getLogger(PluginFactory.class).info("method model:" + methodModel.getName());
|
Logger.getLogger(PluginFactory.class).info(
|
||||||
|
"method model:" + methodModel.getName());
|
||||||
method.getMethodParams().add(
|
method.getMethodParams().add(
|
||||||
createMethodParamEntity(methodParamModel, method));
|
createMethodParamEntity(methodParamModel, method));
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,8 +55,17 @@ public class PluginService {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean addPlugin(PluginModel pluginModel) throws Bench4QException {
|
public boolean addPlugin(PluginModel pluginModel) throws Bench4QException {
|
||||||
return this.getPluginRepository().attatch(
|
if (validatePlugin(pluginModel))
|
||||||
this.getPluginFactory().createPluginEntity(pluginModel));
|
return this.getPluginRepository().attatch(
|
||||||
|
this.getPluginFactory().createPluginEntity(pluginModel));
|
||||||
|
else {
|
||||||
|
throw new Bench4QException("", "invalidate plugin file", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private boolean validatePlugin(PluginModel pluginModel) {
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean deletePlugin(String pluginName) throws Bench4QException {
|
public boolean deletePlugin(String pluginName) throws Bench4QException {
|
||||||
|
|
|
@ -81,7 +81,6 @@ public class TestPlanEngine implements TaskCompleteCallback,
|
||||||
this.getScheduleExecutor().scheduleAtFixedRate(new Runnable() {
|
this.getScheduleExecutor().scheduleAtFixedRate(new Runnable() {
|
||||||
public void run() {
|
public void run() {
|
||||||
TestPlan testPlan = pickATestPlan();
|
TestPlan testPlan = pickATestPlan();
|
||||||
|
|
||||||
if (testPlan == null) {
|
if (testPlan == null) {
|
||||||
logger.info("testPlan by pick is null");
|
logger.info("testPlan by pick is null");
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -23,7 +23,8 @@ public class Test_TestPlanEngine extends TestBase_MakeUpTestPlan {
|
||||||
|
|
||||||
@Before
|
@Before
|
||||||
public void prepare() {
|
public void prepare() {
|
||||||
|
prepareForTestPlanRunning();
|
||||||
|
submitATestPlanWithOneScript();
|
||||||
}
|
}
|
||||||
|
|
||||||
@After
|
@After
|
||||||
|
@ -42,6 +43,10 @@ public class Test_TestPlanEngine extends TestBase_MakeUpTestPlan {
|
||||||
testForStatus(TestPlanStatus.InRunning);
|
testForStatus(TestPlanStatus.InRunning);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void testPickTestPlan(){
|
||||||
|
|
||||||
|
}
|
||||||
@Test
|
@Test
|
||||||
public void testRunTestPlanRightly() throws InterruptedException {
|
public void testRunTestPlanRightly() throws InterruptedException {
|
||||||
assertNotNull(this.getAgentMessenger().askLiving(Test_AGENT_HOSTNAME,
|
assertNotNull(this.getAgentMessenger().askLiving(Test_AGENT_HOSTNAME,
|
||||||
|
|
Loading…
Reference in New Issue