删除不用的依赖

This commit is contained in:
Captain.B 2020-03-28 10:49:49 +08:00
parent 30ac861702
commit 408f3f0d47
4 changed files with 12 additions and 41 deletions

View File

@ -110,7 +110,6 @@
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.12</version>
</dependency>
<dependency>
<groupId>junit</groupId>
@ -128,43 +127,12 @@
<artifactId>slf4j-simple</artifactId>
</dependency>
<!-- jmeter -->
<dependency>
<groupId>org.apache.jmeter</groupId>
<artifactId>ApacheJMeter_http</artifactId>
<version>${jmeter.version}</version>
<exclusions>
<exclusion>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- https://mvnrepository.com/artifact/kg.apc/jmeter-plugins-tst -->
<dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-tst</artifactId>
<version>2.5</version>
</dependency>
<!-- https://mvnrepository.com/artifact/kg.apc/jmeter-plugins-casutg -->
<dependency>
<groupId>kg.apc</groupId>
<artifactId>jmeter-plugins-casutg</artifactId>
<version>2.9</version>
</dependency>
<dependency>
<groupId>com.opencsv</groupId>
<artifactId>opencsv</artifactId>
<version>5.1</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.5.3</version>
</dependency>
</dependencies>
<build>

View File

@ -6,8 +6,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.quartz.QuartzAutoConfiguration;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.Bean;
import org.springframework.web.client.RestTemplate;
@SpringBootApplication(exclude = {QuartzAutoConfiguration.class})
@ServletComponentScan
@ -17,8 +15,5 @@ public class Application {
SpringApplication.run(Application.class, args);
}
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}

View File

@ -1,7 +1,9 @@
package io.metersphere.config;
import io.metersphere.interceptor.TestInterceptor;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;
@ -12,4 +14,9 @@ public class WebConfig implements WebMvcConfigurer {
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(new TestInterceptor());
}
@Bean
public RestTemplate restTemplate() {
return new RestTemplate();
}
}

View File

@ -16,7 +16,7 @@ import io.metersphere.dto.TestResourcePoolDTO;
import io.metersphere.engine.kubernetes.provider.KubernetesProvider;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.apache.http.HttpStatus;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@ -43,6 +43,8 @@ public class TestResourcePoolService {
private TestResourceMapper testResourceMapper;
@Resource
private ExtTestReourcePoolMapper extTestReourcePoolMapper;
@Resource
private RestTemplate restTemplate;
public TestResourcePoolDTO addTestResourcePool(TestResourcePoolDTO testResourcePool) {
testResourcePool.setId(UUID.randomUUID().toString());
@ -100,9 +102,8 @@ public class TestResourcePoolService {
private boolean validateNode(NodeDTO node) {
try {
RestTemplate restTemplate = new RestTemplate();
ResponseEntity<String> entity = restTemplate.getForEntity(String.format(nodeControllerUrl, node.getIp(), node.getPort()), String.class);
return entity.getStatusCode().value() == HttpStatus.SC_OK;
return HttpStatus.OK.equals(entity.getStatusCode());
} catch (Exception e) {
return false;
}