remove warnings

remove warnings
This commit is contained in:
coderfengyun 2014-09-02 17:24:28 +08:00
parent bed2979980
commit 3a03b2906a
2 changed files with 38 additions and 31 deletions

View File

@ -43,7 +43,6 @@ import org.bench4q.share.models.master.TestPlanModel;
import org.bench4q.share.models.master.TestScriptConfig;
import org.bench4q.share.models.master.statistics.ScriptResultModel;
import org.bench4q.share.models.monitor.MonitorMain;
import org.python.antlr.PythonParser.return_stmt_return;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@ -127,7 +126,8 @@ public class TestPlanFactory {
testPlanScripts.add(createATestPlanScriptWithoutId(
runningScriptModel.getRequireLoad(),
runningScriptModel.getScriptId(),
runningScriptModel.getConfig(), result, runningScriptModel.getScriptFilterOptionsModel()));
runningScriptModel.getConfig(), result,
runningScriptModel.getScriptFilterOptionsModel()));
}
result.setRequiredLoad(requiredLoad);
result.setTestPlanScripts(testPlanScripts);
@ -150,17 +150,21 @@ public class TestPlanFactory {
}
public TestPlanScript createATestPlanScriptWithoutId(int requireLoad,
int scriptId, TestScriptConfig config, TestPlan testPlanDB, ScriptFilterOptionsModel scriptFilterOptionsModel) {
int scriptId, TestScriptConfig config, TestPlan testPlanDB,
ScriptFilterOptionsModel scriptFilterOptionsModel) {
TestPlanScript testPlanScript = new TestPlanScript();
testPlanScript.setRequireLoad(requireLoad);
// filter the script
testPlanScript.setScript(createAScriptWithFilter(scriptFilterOptionsModel, this.getScriptService().getScript(scriptId)));
testPlanScript.setScript(createAScriptWithFilter(
scriptFilterOptionsModel,
this.getScriptService().getScript(scriptId)));
testPlanScript.setPlanedConfig(createAPlanedConfigWithoutId(config));
testPlanScript.setTestPlan(testPlanDB);
return testPlanScript;
}
private Script createAScriptWithFilter(ScriptFilterOptionsModel scriptFilterOptionsModel, Script script){
private Script createAScriptWithFilter(
ScriptFilterOptionsModel scriptFilterOptionsModel, Script script) {
RunScenarioModel runScenarioModel = (RunScenarioModel) MarshalHelper
.tryUnmarshal(RunScenarioModel.class,
script.getFilteredScriptCnt());
@ -172,11 +176,17 @@ public class TestPlanFactory {
}
}
}
if(scriptFilterOptionsModel.getFilterTypeMatches() != null && !scriptFilterOptionsModel.getFilterTypeMatches().equals("")){
if (scriptFilterOptionsModel.getFilterTypeMatches() != null
&& !scriptFilterOptionsModel.getFilterTypeMatches().equals("")) {
for (PageModel pageModel : runScenarioModel.getPages()) {
for (BatchModel batchModel : pageModel.getBatches()) {
for(BehaviorModel behaviorModel: batchModel.getBehaviors()){
if(filterPluginId.contains(behaviorModel.getUse()) || isFilterType(scriptFilterOptionsModel.getFilterTypeMatches(), behaviorModel)){
for (BehaviorModel behaviorModel : batchModel
.getBehaviors()) {
if (filterPluginId.contains(behaviorModel.getUse())
|| isFilterType(
scriptFilterOptionsModel
.getFilterTypeMatches(),
behaviorModel)) {
batchModel.getBehaviors().remove(behaviorModel);
}
}
@ -188,7 +198,8 @@ public class TestPlanFactory {
return script;
}
private boolean isFilterType(String filterTypeMatch, BehaviorModel behaviorModel){
private boolean isFilterType(String filterTypeMatch,
BehaviorModel behaviorModel) {
for (ParameterModel parameterModel : behaviorModel.getParameters()) {
if (parameterModel.getKey().equals("expResCnttype")) {

View File

@ -1,11 +1,7 @@
package org.bench4q.master.domain.service;
import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.List;
import java.util.Properties;
import javax.xml.bind.JAXBException;
import org.apache.log4j.Logger;
@ -21,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.web.multipart.MultipartFile;
@Component
public class ScriptService {
private ScriptRepositoty scriptRepositoty;
@ -114,7 +109,8 @@ public class ScriptService {
}
}
public boolean alterScriptContent(int id, int ownerId, String content, String scriptName) {
public boolean alterScriptContent(int id, int ownerId, String content,
String scriptName) {
Script script = this.getScriptRepositoty().getEntity(id);
if (script.getUser().getId() != ownerId) {
return false;