add ways to get configuration files and upload files
add ways to get configuration files and upload files, and add tests
This commit is contained in:
commit
0cdc7eb0df
7
pom.xml
7
pom.xml
|
@ -67,11 +67,18 @@
|
|||
<artifactId>spring-test</artifactId>
|
||||
<version>3.2.5.RELEASE</version>
|
||||
</dependency>
|
||||
<!--Start: for upload file -->
|
||||
<dependency>
|
||||
<groupId>commons-fileupload</groupId>
|
||||
<artifactId>commons-fileupload</artifactId>
|
||||
<version>1.2</version>
|
||||
</dependency>
|
||||
<!--End : for upload file -->
|
||||
<dependency>
|
||||
<groupId>commons-io</groupId>
|
||||
<artifactId>commons-io</artifactId>
|
||||
<version>2.4</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
@ -20,6 +20,7 @@ import org.bench4q.agent.scenario.Scenario;
|
|||
import org.bench4q.agent.scenario.ScenarioContext;
|
||||
import org.bench4q.agent.scenario.ScenarioEngine;
|
||||
import org.bench4q.agent.scenario.behavior.Behavior;
|
||||
import org.bench4q.share.helper.MarshalHelper;
|
||||
import org.bench4q.share.models.agent.BehaviorBriefModel;
|
||||
import org.bench4q.share.models.agent.BehaviorStatusCodeResultModel;
|
||||
import org.bench4q.share.models.agent.CleanTestResultModel;
|
||||
|
@ -62,7 +63,7 @@ public class TestController {
|
|||
|
||||
@RequestMapping(value = "/prepare/{fileName}", method = RequestMethod.POST)
|
||||
@ResponseBody
|
||||
public String prepare(@RequestParam MultipartFile file,
|
||||
public String prepare(@RequestParam("file") MultipartFile file,
|
||||
@PathVariable String fileName) {
|
||||
RunScenarioResultModel result = new RunScenarioResultModel();
|
||||
try {
|
||||
|
@ -70,7 +71,7 @@ public class TestController {
|
|||
+ System.getProperty("file.separator") + fileName);
|
||||
file.transferTo(receiveFile);
|
||||
result.setRunId(UUID.randomUUID());
|
||||
return "It's ok!";
|
||||
return MarshalHelper.tryMarshal(result);
|
||||
} catch (IOException e) {
|
||||
logger.error("/prepare/fileName", e);
|
||||
return null;
|
||||
|
|
|
@ -31,27 +31,27 @@ public class TestWithScriptFile {
|
|||
private UUID testId;
|
||||
private static int load = 10;
|
||||
|
||||
public String getFilePath() {
|
||||
private String getFilePath() {
|
||||
return filePath;
|
||||
}
|
||||
|
||||
public void setFilePath(String filePath) {
|
||||
private void setFilePath(String filePath) {
|
||||
this.filePath = filePath;
|
||||
}
|
||||
|
||||
public HttpRequester getHttpRequester() {
|
||||
private HttpRequester getHttpRequester() {
|
||||
return httpRequester;
|
||||
}
|
||||
|
||||
public void setHttpRequester(HttpRequester httpRequester) {
|
||||
private void setHttpRequester(HttpRequester httpRequester) {
|
||||
this.httpRequester = httpRequester;
|
||||
}
|
||||
|
||||
public UUID getTestId() {
|
||||
private UUID getTestId() {
|
||||
return testId;
|
||||
}
|
||||
|
||||
public void setTestId(UUID testId) {
|
||||
private void setTestId(UUID testId) {
|
||||
this.testId = testId;
|
||||
}
|
||||
|
||||
|
@ -61,7 +61,7 @@ public class TestWithScriptFile {
|
|||
this.setHttpRequester(new HttpRequester());
|
||||
}
|
||||
|
||||
public void startTest() throws JAXBException {
|
||||
private void startTest() throws JAXBException {
|
||||
File file = new File(this.getFilePath());
|
||||
if (!file.exists()) {
|
||||
System.out.println("this script not exists!");
|
||||
|
|
Loading…
Reference in New Issue