Commit 5dd18c95 by 朽木不可雕也

first commit

parents
.idea
target
*.class
*.jar
*.iml
*.classpath
*.log
\ No newline at end of file
# 服务器自动测试服务
## 模块介绍
bootstrap:整个项目的启动引导模块,负责加载所有模块,并运行模块
barrage-crawler-server:弹幕采集服务器自动化测试模块
public: 这个模块用于存储所用模块通用的单例对象(比如 OkHttpClient),或者配置(比如log4j配置)
## 注意事项
项目的启动入口:
bootstrap 模块的 com.zhiweidata.automatictest.bootstrap.AutomaticTestBootstrap 类
所有要使用的模块需要在 [bootstrap/src/main/resources/automatic-test.xml](bootstrap/src/main/resources/automatic-test.xml) 文件中进行配置
所有模块的入口都需要实现 java.lang.Runnable 接口
\ No newline at end of file
# 弹幕采集服务自动化测试
弹幕采集服务项目地址:[http://git.zhiweidata.top/zhongzhangqian/barrage-crawler-server](http://git.zhiweidata.top/zhongzhangqian/barrage-crawler-server)
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>automatic-test</artifactId>
<groupId>com.zhiweidata.automatic-test</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>barrage-crawler-server</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<JsoupXpath.version>2.5.0</JsoupXpath.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/cn.wanghaomiao/JsoupXpath -->
<dependency>
<groupId>cn.wanghaomiao</groupId>
<artifactId>JsoupXpath</artifactId>
<version>${JsoupXpath.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.zhiweidata.automatictest.barragecrawlerserver;
import lombok.extern.slf4j.Slf4j;
/**
* 弹幕采集自动化测试模块
*
* @author aszswaz
* @createTime 2021-08-23 14:38:27
* @ide IntelliJ IDEA
*/
@Slf4j
@SuppressWarnings("JavaDoc")
public class BarrageCrawlerServerTest implements Runnable {
@Override
public void run() {
try {
} catch (Exception e) {
log.error(e.getMessage(), e);
}
}
}
# 自动化测试服务的启动引导器
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.zhiweidata.automatic-test</groupId>
<artifactId>automatic-test</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>bootstrap</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<dom4j.version>2.1.3</dom4j.version>
<barrage-crawler-server.version>1.0-SNAPSHOT</barrage-crawler-server.version>
</properties>
<dependencies>
<!--弹幕采集服务自动测试-->
<dependency>
<groupId>com.zhiweidata.automatic-test</groupId>
<artifactId>barrage-crawler-server</artifactId>
<version>${barrage-crawler-server.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.dom4j/dom4j -->
<dependency>
<groupId>org.dom4j</groupId>
<artifactId>dom4j</artifactId>
<version>${dom4j.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.zhiweidata.automatictest.bootstrap;
import java.io.FileNotFoundException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.nio.charset.StandardCharsets;
import java.util.Iterator;
import java.util.Objects;
import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.dom4j.Document;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import static java.util.Objects.requireNonNull;
/**
* 自动化测试服务启动引导器
*
* @author aszswaz
* @createTime 2021-08-23 14:41:11
* @ide IntelliJ IDEA
*/
@Slf4j
@SuppressWarnings("JavaDoc")
public class AutomaticTestBootstrap {
public static void main(String[] args) throws Exception {
startModules();
}
/**
* 读取 xml 文件,所得所有模块的class和模块名称,并启动模块自动化测试
*/
private static void startModules() throws Exception {
try (InputStream inputStream = AutomaticTestBootstrap.class.getClassLoader().getResourceAsStream("automatic-test.xml")) {
SAXReader reader = new SAXReader();
if (Objects.isNull(inputStream)) throw new FileNotFoundException("没有在类路径中找到 automatic-test.xml 文件");
Document document = reader.read(new InputStreamReader(inputStream, StandardCharsets.UTF_8));
Element element = document.getRootElement();
element = element.element("modules");
Iterator<Element> iterator = element.elementIterator("module");
while (iterator.hasNext()) {
element = iterator.next();
String name = requireNonNull(element.attributeValue("name"));
String classPath = requireNonNull(element.attributeValue("class"));
Runnable runnable = (Runnable) Class.forName(classPath).newInstance();
log.info("start module {}", name);
new Thread(runnable, name).start();
}
}
}
}
<?xml version="1.0" encoding="UTF-8" ?>
<configuration>
<modules>
<module name="barrage-crawler-server" class="com.zhiweidata.automatictest.barragecrawlerserver.BarrageCrawlerServerTest"/>
</modules>
</configuration>
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.zhiweidata.automatic-test</groupId>
<artifactId>automatic-test</artifactId>
<packaging>pom</packaging>
<version>1.0-SNAPSHOT</version>
<modules>
<module>barrage-crawler-server</module>
<module>bootstrap</module>
<module>public</module>
</modules>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<jackson.version>2.13.0-rc1</jackson.version>
<easyexcel.version>2.2.10</easyexcel.version>
<commons-lang3.version>3.12.0</commons-lang3.version>
<projectlombok.version>1.18.20</projectlombok.version>
<public.version>1.0-SNAPSHOT</public.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-core -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/com.alibaba/easyexcel -->
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easyexcel.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>${commons-lang3.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.projectlombok/lombok -->
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${projectlombok.version}</version>
<scope>provided</scope>
</dependency>
<!--公共模块-->
<dependency>
<groupId>com.zhiweidata.automatic-test</groupId>
<artifactId>public</artifactId>
<version>${public.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
# 公共模块
所有模块通用的 Bean 或者配置,都存放在该模块
\ No newline at end of file
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>automatic-test</artifactId>
<groupId>com.zhiweidata.automatic-test</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>public</artifactId>
<properties>
<maven.compiler.source>8</maven.compiler.source>
<maven.compiler.target>8</maven.compiler.target>
<okhttp.version>5.0.0-alpha.2</okhttp.version>
<lo4j.version>2.14.1</lo4j.version>
</properties>
<dependencies>
<!-- https://mvnrepository.com/artifact/com.squareup.okhttp3/okhttp -->
<dependency>
<groupId>com.squareup.okhttp3</groupId>
<artifactId>okhttp</artifactId>
<version>${okhttp.version}</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.logging.log4j/log4j-slf4j-impl -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<version>${lo4j.version}</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
package com.zhiweidata.automatictest.publics;
import okhttp3.OkHttpClient;
/**
* Bean容器
*
* @author aszswaz
* @createTime 2021-08-23 16:06:42
* @ide IntelliJ IDEA
*/
@SuppressWarnings("JavaDoc")
public class BeanContainer {
/**
* http 客户端
*/
public static final OkHttpClient OK_HTTP_CLIENT = new OkHttpClient();
}
<?xml version="1.0" encoding="UTF-8"?>
<configuration status="warn">
<Appenders>
<!-- 输出到控制台 -->
<Console name="console" target="SYSTEM_OUT">
<!--输出日志的格式,使用SpringBoot配色(仅能在SpringBoot项目中使用) -->
<PatternLayout
pattern="%d{yyyy-MM-dd HH:mm:ss.SSS} %highlight{%5p} --- [%-20t] %-80c %-40M %-5L: %m%n"/>
<ThresholdFilter level="info" onMatch="ACCEPT" onMismatch="DENY"/>
</Console>
</Appenders>
<!-- sync/async -->
<Loggers>
<Root level="info" includeLocation="true">
<AppenderRef ref="console"/>
</Root>
</Loggers>
</configuration>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment