fix the upload script and file
This commit is contained in:
parent
6a99c27878
commit
3207b48d3a
|
@ -9,8 +9,6 @@ import java.util.Date;
|
|||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
import javax.xml.bind.JAXBException;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.apache.log4j.Logger;
|
||||
import org.bench4q.master.domain.entity.Port;
|
||||
|
@ -22,8 +20,6 @@ import org.bench4q.master.domain.service.UserService;
|
|||
import org.bench4q.master.exception.Bench4QException;
|
||||
import org.bench4q.master.exception.ExceptionLog;
|
||||
import org.bench4q.recorder.ScriptCapturer;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.agent.RunScenarioModel;
|
||||
import org.bench4q.share.models.master.OperateScriptServerResponseModel;
|
||||
import org.bench4q.share.models.master.ScriptModel;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -163,11 +159,12 @@ public class ScriptController extends BaseController {
|
|||
}
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/uploadScript/{scriptName}", method = RequestMethod.PUT)
|
||||
@RequestMapping(value = "/uploadScript/{scriptName}", method = {
|
||||
RequestMethod.PUT, RequestMethod.POST })
|
||||
@ResponseBody
|
||||
public OperateScriptServerResponseModel uploadScriptToDB(
|
||||
@PathVariable String scriptName,
|
||||
@RequestParam RunScenarioModel scenarioModel,
|
||||
@RequestParam String scenarioModel,
|
||||
@RequestParam(value = "paramFiles[]", required = false) List<MultipartFile> paramFiles)
|
||||
throws Bench4QException {
|
||||
if (!this.checkScope(UserService.NORAML_AUTHENTICATION)) {
|
||||
|
@ -175,17 +172,11 @@ public class ScriptController extends BaseController {
|
|||
+ "for upload a script", "/uploadScript");
|
||||
}
|
||||
try {
|
||||
boolean success = this.getScriptService().saveScript(
|
||||
scriptName,
|
||||
this.getPrincipal().getId(),
|
||||
MarshalHelper
|
||||
.marshal(RunScenarioModel.class, scenarioModel),
|
||||
paramFiles);
|
||||
logger.info("upload script:"
|
||||
+ MarshalHelper.marshal(RunScenarioModel.class,
|
||||
scenarioModel));
|
||||
boolean success = this.getScriptService().saveScript(scriptName,
|
||||
this.getPrincipal().getId(), scenarioModel, paramFiles);
|
||||
logger.info("upload script:" + scenarioModel);
|
||||
return buildReponseModel(success, null, null, -1, null, null, null);
|
||||
} catch (JAXBException e) {
|
||||
} catch (Exception e) {
|
||||
this.logger.error(ExceptionLog.getStackTrace(e));
|
||||
return buildReponseModel(false,
|
||||
"The script is not in the right format", null, -1, null,
|
||||
|
|
|
@ -5,7 +5,7 @@ import javax.persistence.Entity;
|
|||
import javax.persistence.Table;
|
||||
|
||||
@Entity
|
||||
@Table(name = "fieldType")
|
||||
@Table(name = "fileType")
|
||||
public class FileType extends ParamType {
|
||||
private String text;
|
||||
|
||||
|
|
Loading…
Reference in New Issue