refactor the script editor js

This commit is contained in:
fanfuxiaoran 2014-05-04 17:24:51 +08:00
parent 3ee9a78c6b
commit 9fc26763bd
18 changed files with 441 additions and 250 deletions

View File

@ -57,8 +57,8 @@ public class AuthorizeActionController extends BaseControllerService {
@RequestMapping("register")
@ResponseBody
public BaseResponseModel register(@RequestParam String userName,
@RequestParam String password,
@RequestParam String scope) throws CustomGenericException {
@RequestParam String password, @RequestParam String scope)
throws CustomGenericException {
UserModel user = new UserModel();
user.setUserName(userName);
user.setPassword(password);

View File

@ -8,7 +8,7 @@ import javax.servlet.http.HttpServletRequest;
import org.bench4q.share.models.master.plugin.PluginResponseModel;
import org.bench4q.web.exception.CustomGenericException;
import org.bench4q.web.masterMessager.PluginMessager;
import org.bench4q.web.validation.PluginValidation;
import org.bench4q.web.validation.PluginValidate;
import org.bench4q.web.validation.ValidateResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.ModelAttribute;
@ -24,7 +24,7 @@ public class PluginController extends BaseController {
private PluginMessager pluginMessager;
private PluginValidation pluginValidation;
private PluginValidate pluginValidation;
public PluginMessager getPluginMessager() {
return pluginMessager;
@ -35,12 +35,12 @@ public class PluginController extends BaseController {
this.pluginMessager = pluginMessager;
}
public PluginValidation getPluginValidation() {
public PluginValidate getPluginValidation() {
return pluginValidation;
}
@Autowired
public void setPluginValidation(PluginValidation pluginValidation) {
public void setPluginValidation(PluginValidate pluginValidation) {
this.pluginValidation = pluginValidation;
}

View File

@ -1,8 +1,119 @@
package org.bench4q.web.newapi;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component
import org.bench4q.share.models.master.AuthorizeResponseModel;
import org.bench4q.share.models.master.RegisterResponseModel;
import org.bench4q.share.models.master.UserModel;
import org.bench4q.web.masterMessager.UserMessager;
import org.bench4q.web.model.TestPlanTaskModel;
import org.bench4q.web.validation.UserValidate;
import org.bench4q.web.validation.ValidateResponseModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;
@SessionAttributes({ "accessToken", "username", "testPlanTaskList" })
public class UserController extends BaseController {
private UserMessager userMessager;
private UserValidate userValidate;
public UserMessager getUserMessager() {
return userMessager;
}
@Autowired
public void setUserMessager(UserMessager userMessager) {
this.userMessager = userMessager;
}
public UserValidate getUserValidate() {
return userValidate;
}
@Autowired
public void setUserValidate(UserValidate userValidate) {
this.userValidate = userValidate;
}
@RequestMapping("register")
@ResponseBody
public Map<String, Object> register(@RequestParam String userName,
@RequestParam String password, @RequestParam String scope) {
Map<String, Object> map = new HashMap<String, Object>();
ValidateResponseModel validateResponseModel = this.getUserValidate()
.validateRegisterUser(userName, password, scope);
if (!validateResponseModel.isSuccess()) {
return fail(map, validateResponseModel.getMessage());
}
RegisterResponseModel registerResponseModel = this.getUserMessager()
.register(userName, password, scope);
if (!registerResponseModel.isSuccess()) {
fail(map, "please try again");
}
return success(map);
}
@RequestMapping("normalLogin")
@ResponseBody
public Map<String, Object> normalLogin(UserModel userModel,
ModelMap modelMap) {
Map<String, Object> map = new HashMap<String, Object>();
ValidateResponseModel validateResponseModel = this.getUserValidate()
.validateUserLogin(userModel.getUserName(),
userModel.getPassword());
if (!validateResponseModel.isSuccess()) {
return fail(map, "error userName or password");
}
AuthorizeResponseModel authorizeResponseModel = this.getUserMessager()
.normalLogin(userModel.getUserName(), userModel.getPassword());
if (!authorizeResponseModel.isSuccess()) {
return fail(map, "error userName or password");
} else {
updateSessionAttribute(modelMap, authorizeResponseModel,
userModel.getUserName());
return success(map);
}
}
@RequestMapping("adminLogin")
@ResponseBody
public Map<String, Object> adminLogin(UserModel userModel, ModelMap modelMap) {
Map<String, Object> map = new HashMap<String, Object>();
ValidateResponseModel validateResponseModel = this.getUserValidate()
.validateUserLogin(userModel.getUserName(),
userModel.getPassword());
if (!validateResponseModel.isSuccess()) {
return fail(map, "error userName or password");
}
AuthorizeResponseModel authorizeResponseModel = this.getUserMessager()
.adminLogin(userModel.getUserName(), userModel.getPassword());
if (!authorizeResponseModel.isSuccess()) {
return fail(map, "error userName or password");
} else {
updateSessionAttribute(modelMap, authorizeResponseModel,
userModel.getUserName());
return success(map);
}
}
private void updateSessionAttribute(ModelMap modelMap,
AuthorizeResponseModel authorizeResponseModel, String userName) {
modelMap.addAttribute("accessToken",
authorizeResponseModel.getAccessToken());
modelMap.addAttribute("username", userName);
List<TestPlanTaskModel> testPlanTaskModels = new ArrayList<TestPlanTaskModel>();
modelMap.addAttribute("testPlanTaskList", testPlanTaskModels);
}
}

View File

@ -2,7 +2,7 @@ package org.bench4q.web.validation;
import org.springframework.web.multipart.MultipartFile;
public class PluginValidation {
public class PluginValidate {
public ValidateResponseModel validatePluginName(String pluginName) {
if (ValidateHelper.validateStringInput(pluginName)) {

View File

@ -0,0 +1,31 @@
package org.bench4q.web.validation;
import org.springframework.stereotype.Component;
@Component
public class UserValidate {
public ValidateResponseModel validateRegisterUser(String userName,
String password, String scope) {
if (ValidateHelper.validateStringInput(userName)) {
return new ValidateResponseModel(false, "error user name");
}
if (ValidateHelper.validateStringInput(password)) {
return new ValidateResponseModel(false, "error password");
}
if (ValidateHelper.validateInteger(scope)) {
return new ValidateResponseModel(false, "error scope");
}
return new ValidateResponseModel(true, "");
}
public ValidateResponseModel validateUserLogin(String userName,String password){
if (ValidateHelper.validateStringInput(userName)) {
return new ValidateResponseModel(false, "error user name");
}
if (ValidateHelper.validateStringInput(password)) {
return new ValidateResponseModel(false, "error password");
}
return new ValidateResponseModel(true, "");
}
}

View File

@ -1 +1 @@
masterAddress=133.133.12.1:7979/
masterAddress=127.0.1.1:7979/

View File

@ -96,7 +96,7 @@ body {
</div>
<div class="box-content row-fluid">
<div id="pluginArea" class="listArea span8"></div>
<div id="usePlugin" class="listArea span8"></div>
<div class=" span4 button-div">
<div>
<button type="submit" class="btn btn-primary btn-width"
@ -200,7 +200,7 @@ body {
</h3>
</div>
<div class="modal-body" style="height: 260px;">
<div class="inset scroll" id="choosePlugin"></div>
<div class="inset scroll" id="pluginList"></div>
</div>
<div class="modal-footer">
@ -268,19 +268,15 @@ body {
<script src="lib/chrisma/js/jquery.cookie.js"></script>
<script src="lib/chrisma/js/theme.js"></script>
<script src="script/base.js"></script>
<script src="script/plugin.js"></script>
<script src="script/paramInfosForm.js"></script>
<script src="script/pluginModel.js"></script>
<script src="script/ScriptEditor/uiCommon.js"></script>
<script src="script/ScriptEditor/plugin.js"></script>
<script src="script/ScriptEditor/paramInfosForm.js"></script>
<script src="script/ScriptEditor/pluginModel.js"></script>
<script src="script/ScriptEditor/ContainerManager.js"></script>
<script src="script/ScriptEditor/usePluginEditor.js"></script>
<script src="script/ScriptEditor/useBehaviorEditor.js"></script>
<script src="script/ScriptEditor/scriptEditor.js"></script>
<script src="script/submitPluginMessage.js"></script>
<!-- <script src="script/pluginModel.js"></script>
<script src="script/pluginCommon.js"></script>
<script src="script/plugin-new.js"></script>
<script src="script/submitPluginMessage.js"></script>
<script src="script/behaviorsForm.js"></script> -->
<script src="script/ScriptEditor/submitPluginMessage.js"></script>
</fmt:bundle>
</body>
</html>

View File

@ -1,9 +1,9 @@
var Container = function() {
this.pluginListContainer = $("#choosePlugin");
this.usePluginContainer = $("#pluginArea");
this.pluginListContainer = $("#pluginList");
this.usePluginContainer = $("#usePlugin");
this.pluginParamConfigContainer = $("#pluginParams");
this.behaviorListForPlugin = $("#pluginMethod");
this.usePluginModal = $("#insertPluginAreaPlugins");
this.usePluginModal=$("#insertPluginAreaPlugins")
this.useBehaviorListContainer = $("#behaviorArea");
this.behaviorParamConfigContianer = $("#showPluginMethod");
@ -13,20 +13,6 @@ var ListContainer = function(container) {
};
Container.prototype.createLineWithRadio = function(lineText, nameAttr) {
var textNode = document.createTextNode(lineText);
var divNode = document.createElement("div");
var inputNode = document.createElement("input");
var brNode = document.createElement("br");
inputNode.setAttribute("type", "radio");
inputNode.setAttribute("name", nameAttr);
inputNode.setAttribute("class", "chooseOnePlugin");
inputNode.setAttribute("value", lineText);
divNode.appendChild(inputNode);
divNode.appendChild(textNode);
divNode.appendChild(brNode);
return $(divNode).html() + "<br>";
};
Container.prototype.createALine = function(name, index, list) {
var div = document.createElement("div");
var p = document.createElement("p");
@ -51,7 +37,7 @@ Container.prototype.createALine = function(name, index, list) {
};
Container.prototype.showChoosedLines = function(container, clickNode) {
var choosedNode = container.children();
for (var i = 0; i < choosedNode.length; i++) {
for ( var i = 0; i < choosedNode.length; i++) {
if (i == clickNode) {
$(choosedNode[i]).find("p").attr("class", "visited");
@ -62,7 +48,7 @@ Container.prototype.showChoosedLines = function(container, clickNode) {
};
Container.prototype.showChoosedParamInfos = function(container, clickNode) {
var div = container.children();// pluginParams
for (var j = 0; j < div.length; j++) {
for ( var j = 0; j < div.length; j++) {
if (div[j].getAttribute("id") == clickNode) {
$(div[j]).show();
} else {
@ -74,7 +60,7 @@ Container.prototype.showChoosedParamInfos = function(container, clickNode) {
Container.prototype.createBehaviorWithPluginLines = function(behavior) {
this.behaviorParamConfigContianer.html("");
this.useBehaviorListContainer.html("");
for (var j = 0; j < behavior.behaviorWithPluginList.length; j++) {
for ( var j = 0; j < behavior.behaviorWithPluginList.length; j++) {
var div = this.createALine(behavior.behaviorWithPluginList[j], j,
"pluginMethodList");
if (j == behavior.clickPluginBehaviorNode) {
@ -101,3 +87,4 @@ Container.prototype.createParamInforsContainer = function(data, name, index) {
+ "</div></div>";
return documentHtml;
};

View File

@ -1,26 +1,25 @@
var container = new Container();
var plugin = new Plugin(container);
var behavior = new Behavior(container, plugin);
var files = [] ;
var container;
var plugin;
var behavior;
var files = [];
$(document).ready(function() {
pluginEditorInit();
});
$("#addPlugin").click(function(e) {
$("#myModal_Plugin").modal('show');
});
$("#pluginFinish").click(function(e) {
$('#pluginArea').html("");
var item = $("input[type='radio']:checked").val();
container = new Container();
plugin = new Plugin(container);
behavior = new Behavior(container, plugin);
$("#pluginFinish").click(function(event) {
event.preventDefault();
var item = $("#pluginList input[type='radio']:checked").val();
plugin.addUsePlugin(item);
plugin.usePluginContainerInit(container.usePluginContainer);
plugin.usePluginParamInfosContainerInit(item);
$("#myModal_Plugin").modal('hide');
});
$("#addPlugin").click(function(e) {
$("#myModal_Plugin").modal('show');
});
});
function pluginEditorInit() {
plugin.pluginListContainerInit(container.pluginListContainer);
}
function choosePlugin(selectedNode) {

View File

@ -16,11 +16,12 @@ Behavior.prototype.usePluginListContainerInit = function(insertLocation,
container) {
var chooesedPluginHtml = "";
this.setInsertLocation(insertLocation);
for (var i = 0; i < this.plugin.usePluginList.length; i++) {
chooesedPluginHtml += this.containerManager.createLineWithRadio(
this.plugin.usePluginList[i], "plugin");
for ( var i = 0; i < this.plugin.usePluginList.length; i++) {
chooesedPluginHtml += createLineWithRadio(this.plugin.usePluginList[i],
"plugin");
}
container.html(chooesedPluginHtml);// insertPluginAreaPlugins
};
Behavior.prototype.setInsertLocation = function(insertLocation) {
@ -50,11 +51,10 @@ Behavior.prototype.getBehaviorListOfOnePlugin = function(pluginName) {
var behaviorHtml = "";
this.behaviorList.splice(0, this.behaviorList.length);
var behaviors = this.loadBehaviorList(pluginName.split("_")[0]);
for (var i = 0; i < behaviors.length; i++) {
for ( var i = 0; i < behaviors.length; i++) {
this.behaviorList.push(behaviors[i].name);
this.behaviorList[behaviors[i].name] = behaviors[i].paramInfoModels;
behaviorHtml += this.containerManager.createLineWithRadio(
behaviors[i].name, "method");
behaviorHtml += createLineWithRadio(behaviors[i].name, "method");
}
this.containerManager.behaviorListForPlugin.html(behaviorHtml);
};
@ -66,7 +66,7 @@ Behavior.prototype.useBehaviorOfOnePluginContainerInit = function(plugin,
var documentChild = this.containerManager.behaviorParamConfigContianer
.children();
if (this.insertLocation == "before") {
for (var j = length - 1; j > parseInt(this.clickPluginBehaviorNode - 1); j--) {
for ( var j = length - 1; j > parseInt(this.clickPluginBehaviorNode - 1); j--) {
alert("j=" + j);
this.behaviorWithPluginList[j + 1] = this.behaviorWithPluginList[j];
$(documentChild[j]).attr("id", parseInt(j + 1));
@ -79,7 +79,7 @@ Behavior.prototype.useBehaviorOfOnePluginContainerInit = function(plugin,
|| this.clickPluginBehaviorNode == -1) {
this.behaviorWithPluginList.push(behaviorWithPlugin);
} else {
for (var j = parseInt(length - 1); j > parseInt(this.clickPluginBehaviorNode); j--) {
for ( var j = parseInt(length - 1); j > parseInt(this.clickPluginBehaviorNode); j--) {
this.behaviorWithPluginList[j + 1] = this.behaviorWithPluginList[j];
$(documentChild[j]).attr("id", parseInt(j + 1));
}
@ -92,7 +92,7 @@ Behavior.prototype.useBehaviorOfOnePluginContainerInit = function(plugin,
Behavior.prototype.createBehaviorWithPluginLines = function() {
this.containerManager.behaviorParamConfigContianer.html("");
this.containerManager.useBehaviorListContainer.html("");
for (var j = 0; j < this.behaviorWithPluginList.length; j++) {
for ( var j = 0; j < this.behaviorWithPluginList.length; j++) {
var div = this.containerManager.createALine(
this.behaviorWithPluginList[j], j, "pluginMethodList");
if (j == this.clickPluginBehaviorNode) {
@ -112,7 +112,7 @@ Behavior.prototype.useParamInforsContainerInit = function(index) {
Behavior.prototype.removeInsertPluginByClicked = function() {
var length = $('#behaviorArea').children().length;
for (var i = parseInt(this.clickPluginBehaviorNode + 1); i < length; i++) {
for ( var i = parseInt(this.clickPluginBehaviorNode + 1); i < length; i++) {
this.behaviorWithPluginList[i - 1] = this.behaviorWithPluginList[i];
}
this.behaviorWithPluginList.splice(length - 1, 1);
@ -123,7 +123,7 @@ Behavior.prototype.removeInsertPluginByClicked = function() {
Behavior.prototype.removeUseBehaviorWithPluginParamInfo = function() {
var removeDocumentNode = $("#showPluginMethod").children();
for (var j = 0; j < length; j++) {
for ( var j = 0; j < length; j++) {
if ($(removeDocumentNode[j]).attr("id") == this.clickPluginBehaviorNode) {
document.getElementById("showPluginMethod").removeChild(
removeDocumentNode[j]);

View File

@ -1,19 +1,22 @@
$(document).ready(function() {
});
var Plugin = function(containerManager) {
this.pluginList = null;
this.pluginNameList = null;
this.pluginIndex = new HashMap();
this.usePluginList = new Array();
this.pluginParamInfoList = [];
this.clickPluginChoosedNodeIndex = 0;
this.clickPluginChoosedNodeName = "";
this.loadPluginNameList();
this.loadPluginList();
this.loadPluginUIList();
this.setPluginParamInfoList();
this.containerManager = containerManager;
};
Plugin.prototype.loadPluginNameList = function() {
var plugin = this;
$.ajax({
type : 'POST',
url : 'loadPluginName',
@ -25,14 +28,26 @@ Plugin.prototype.loadPluginNameList = function() {
alert(response.failedMessage);
return;
}
plugin.pluginNameList = response.data;
for (var i = 0; i < plugin.pluginNameList.length; i++) {
plugin.pluginIndex.put(plugin.pluginNameList[i], -1);
var pluginNameList = response.data;
for ( var i = 0; i < pluginNameList.length; i++) {
plugin.pluginIndex.put(pluginNameList[i], -1);
}
pluginListContainerInit($("#pluginList"), pluginNameList);
}
});
function pluginListContainerInit(container, pluginNameList) {
var pluginListHtmlContent = "";
for ( var i = 0; i < pluginNameList.length; i++) {
pluginListHtmlContent += createLineWithRadio(pluginNameList[i],
"plugin");
}
container.html(pluginListHtmlContent);
}
};
Plugin.prototype.loadPluginList = function() {
Plugin.prototype.loadPluginUIList = function() {
var plugin = this;
$.ajax({
type : 'POST',
@ -49,46 +64,41 @@ Plugin.prototype.loadPluginList = function() {
}
});
};
Plugin.prototype.pluginListContainerInit = function(container) {
var pluginListHtmlContent = "";
for (var j = 0; j < this.pluginNameList.length; j++) {
pluginListHtmlContent += this.containerManager.createLineWithRadio(
this.pluginNameList[j], "plugin");
}
container.html(pluginListHtmlContent);
$("input:radio").click(function() {
$(this).attr("checked", "checked");
});
};
Plugin.prototype.addUsePlugin = function(item) {
this.pluginIndex.put(item, this.pluginIndex.get(item) + 1);
this.usePluginList.push(this.createUsePluginName(item, this.pluginIndex
.get(item)));
var pluginName = createUsePluginName(item, this.pluginIndex.get(item));
this.usePluginList.push(pluginName);
$("#usePlugin").append(
createLine(pluginName, usePluginList.length, "pluginChoosedList"));
function createUsePluginName(pluginName, index) {
return pluginName + '_' + index;
}
function createLine(name, index, list) {
var div = document.createElement("div");
var p = document.createElement("p");
var i = document.createElement("i");
var textNode = document.createTextNode(name);
div.setAttribute("id", name);
i.setAttribute("class", "icon-hand-right");
p.setAttribute("id", index);
p.setAttribute("class", "");
if (list == "pluginMethodList") {
p.setAttribute("onClick", "showMethodDocument(this)");// loadMethodParams
} else if (list == "pluginChoosedList") {
p.setAttribute("onClick", "choosePlugin(this);");// 此处用于显示plugin文档
} else if (list == "editPluginChoosedList") {
p.setAttribute("onClick", "chooseEditPlugin(this);");
}
p.setAttribute("style", "cursor:pointer;width:85%");
p.appendChild(i);
p.appendChild(textNode);
div.appendChild(p);
return $(div);
};
Plugin.prototype.usePluginContainerInit = function(container) {
for (var i = 0; i < this.usePluginList.length; i++) {
var pluginName = this.usePluginList[i];
var div = this.containerManager.createALine(pluginName, i,
"pluginChoosedList");
container.append(div);
}
};
Plugin.prototype.configPluginContainerInit = function(container) {
};
// Plugin.prototype.deleteUsePlugin = function(pluginName) {
//
// for (var i = 0; i < this.usePluginList.length; i++) {
// if (this.usePluginList[i] == pluginName) {
// this.usePluginList.splice(i, 1);
// }
// }
//
// };
Plugin.prototype.createUsePluginName = function(pluginName, index) {
return pluginName + '_' + index;
};
Plugin.prototype.setClickPluginChoosedNodeIndex = function(selectedNode) {
this.clickPluginChoosedNodeIndex = $(selectedNode).attr("id");
@ -99,7 +109,7 @@ Plugin.prototype.setClickPluginChoosedNodeName = function(selectedNode) {
};
Plugin.prototype.setPluginParamInfoList = function() {
for (var i = 0; i < this.pluginList.length; i++) {
for ( var i = 0; i < this.pluginList.length; i++) {
var pluginInfoModel = this.pluginList[i].pluginInfoModel;
this.pluginParamInfoList.push(pluginInfoModel.name);
this.pluginParamInfoList[pluginInfoModel.name] = pluginInfoModel.paramInfoModels;
@ -115,7 +125,7 @@ Plugin.prototype.usePluginParamInfosContainerInit = function(item) {
};
Plugin.prototype.removeUsePluginByClicked = function(container) {
for (var i = parseInt(this.clickPluginChoosedNodeIndex + 1); i < this.usePluginList.length; i++) {
for ( var i = parseInt(this.clickPluginChoosedNodeIndex + 1); i < this.usePluginList.length; i++) {
this.usePluginList[i - 1] = this.usePluginList[i];
}
this.usePluginList.splice(length - 1, 1);
@ -123,7 +133,7 @@ Plugin.prototype.removeUsePluginByClicked = function(container) {
Plugin.prototype.removeUsePluginParamInfos = function() {
var removeDocumentNode = document.getElementById("pluginParams").childNodes;
for (var i = 0; i < removeDocumentNode.length; i++) {
for ( var i = 0; i < removeDocumentNode.length; i++) {
if ($(removeDocumentNode[i]).attr("id") == this.clickPluginChoosedNodeIndex) {
document.getElementById("pluginParams").removeChild(
removeDocumentNode[i]);
@ -134,7 +144,7 @@ Plugin.prototype.removeUsePluginParamInfos = function() {
Plugin.prototype.clearUsePluginContainer = function() {
this.usePluginList.splice(0, this.usePluginList.length);
for (var i = 0; i < this.pluginNameList.length; i++) {
for ( var i = 0; i < this.pluginNameList.length; i++) {
this.pluginIndex.put(this.pluginNameList[i], 0);
}
};

View File

@ -1,11 +1,32 @@
package org.benc4q.test.newapi;
import org.bench4q.web.tool.test.LoginHelper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest;
public abstract class ControllerTestBase {
private final String userName = "admin";
private final String password = "admin";
protected String baseUrl = "http://127.0.0.1:8080";
private LoginHelper loginHelper;
private String login() {
return "";
private HttpRequest httpRequest;
public LoginHelper getLoginHelper() {
return loginHelper;
}
@Autowired
private void setLoginHelper(LoginHelper loginHelper) {
this.loginHelper = loginHelper;
}
public HttpRequest getHttpRequest() {
return httpRequest;
}
@Autowired
public void setHttpRequest(HttpRequest httpRequest) {
this.httpRequest = httpRequest;
}
}

View File

@ -1,6 +1,40 @@
package org.benc4q.test.newapi;
import org.junit.Before;
import org.junit.Test;
public class PluginControllerTest {
public class PluginControllerTest extends ControllerTestBase {
private String accessToken;
@Before
public void setUp() {
this.accessToken = this.getLoginHelper().login();
}
@Test
public void testAddPlugin() {
}
@Test
public void testDeletePlugin() {
}
@Test
public void loadPluginNameList() {
}
@Test
public void loadPluginUIList() {
}
@Test
public void loadBehaviorList() {
}
}

View File

@ -11,6 +11,8 @@ import org.springframework.ui.ModelMap;
@Component
public class LoginHelper {
private final String userName = "admin";
private final String password = "admin";
private AuthorizeActionController authorizeActionController;
private Logger logger = Logger.getLogger(LoginHelper.class);
@ -28,14 +30,14 @@ public class LoginHelper {
public String login() {
UserModel userModel = new UserModel();
userModel.setUserName("admin");
userModel.setPassword("admin");
userModel.setUserName(userName);
userModel.setPassword(password);
try {
if (this.authorizeActionController == null) {
System.out.println(" null");
}
ModelMap modelMap = new ModelMap();
authorizeActionController.login(userModel, modelMap);
authorizeActionController.adminLogin(userModel, modelMap);
String accessToken = (String) modelMap.get("accessToken");
return accessToken;
} catch (CustomGenericException e) {