This commit is contained in:
Captain.B 2020-03-16 19:23:04 +08:00
parent 940631faa3
commit f90b870c3f
6 changed files with 4 additions and 12 deletions

View File

@ -7,7 +7,6 @@ import io.metersphere.base.domain.FileMetadata;
import io.metersphere.base.domain.LoadTestWithBLOBs;
import io.metersphere.commons.constants.EngineType;
import io.metersphere.commons.exception.MSException;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.engine.docker.DockerTestEngine;
import io.metersphere.engine.kubernetes.KubernetesTestEngine;
import io.metersphere.parse.EngineSourceParser;
@ -22,9 +21,9 @@ public class EngineFactory {
switch (type) {
case DOCKER:
return CommonBeanFactory.getBean(DockerTestEngine.class);
return new DockerTestEngine();
case KUBERNETES:
return CommonBeanFactory.getBean(KubernetesTestEngine.class);
return new KubernetesTestEngine();
}
return null;
}

View File

@ -2,9 +2,7 @@ package io.metersphere.engine.docker;
import io.metersphere.engine.Engine;
import io.metersphere.engine.EngineContext;
import org.springframework.stereotype.Service;
@Service
public class DockerTestEngine implements Engine {
private EngineContext context;

View File

@ -11,11 +11,9 @@ import io.metersphere.engine.kubernetes.crds.jmeter.Jmeter;
import io.metersphere.engine.kubernetes.crds.jmeter.JmeterSpec;
import io.metersphere.engine.kubernetes.provider.ClientCredential;
import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
import org.springframework.stereotype.Service;
import java.util.HashMap;
@Service
public class KubernetesTestEngine implements Engine {
private EngineContext context;

View File

@ -1,7 +1,6 @@
package io.metersphere.parse;
import io.metersphere.commons.constants.FileType;
import io.metersphere.commons.utils.CommonBeanFactory;
import io.metersphere.parse.xml.XmlEngineSourceParse;
public class EngineSourceParserFactory {
@ -9,7 +8,7 @@ public class EngineSourceParserFactory {
final FileType engineType = FileType.valueOf(type);
if (FileType.JMX.equals(engineType)) {
return CommonBeanFactory.getBean(XmlEngineSourceParse.class);
return new XmlEngineSourceParse();
}
return null;

View File

@ -4,7 +4,6 @@ import io.metersphere.engine.EngineContext;
import io.metersphere.parse.EngineSourceParser;
import io.metersphere.parse.xml.reader.DocumentParser;
import io.metersphere.parse.xml.reader.DocumentParserFactory;
import org.springframework.stereotype.Service;
import org.w3c.dom.Document;
import org.xml.sax.InputSource;
@ -12,7 +11,6 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import java.io.InputStream;
@Service
public class XmlEngineSourceParse implements EngineSourceParser {
@Override
public String parse(EngineContext context, InputStream source) throws Exception {

View File

@ -161,7 +161,7 @@ public class LoadTestService {
LogUtil.info("Load test started " + loadTest.getName());
// engine type (DOCKER|KUBERNETES)
// todo set type
Engine engine = EngineFactory.createEngine(fileMetadata.getEngine());
final Engine engine = EngineFactory.createEngine(fileMetadata.getEngine());
if (engine == null) {
MSException.throwException(String.format("Test cannot be runtest ID%sfile type%s",
request.getId(),