Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions antchain-bridge-plugin-test/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/

### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr

### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache

### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/

### VS Code ###
.vscode/

### Mac OS ###
.DS_Store
103 changes: 103 additions & 0 deletions antchain-bridge-plugin-test/dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
<?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/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.ali.antchain</groupId>
<artifactId>antchain-bridge-plugin-tester</artifactId>
<name>PlugsTest</name>
<version>0.1.0</version>
<url>http://maven.apache.org</url>
<build>
<plugins>
<plugin>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer>
<mainClass>com.slc.antchain.PluginsTest</mainClass>
</transformer>
<transformer />
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.web3j</groupId>
<artifactId>core</artifactId>
<version>4.9.8</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<artifactId>slf4j-api</artifactId>
<groupId>org.slf4j</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.28</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>logback-core</artifactId>
<groupId>ch.qos.logback</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
<exclusions>
<exclusion>
<artifactId>hamcrest-core</artifactId>
<groupId>org.hamcrest</groupId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.alipay.antchain.bridge</groupId>
<artifactId>simple-ethereum-bbc</artifactId>
<version>0.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
117 changes: 117 additions & 0 deletions antchain-bridge-plugin-test/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
<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.ali.antchain</groupId>
<artifactId>antchain-bridge-plugin-tester</artifactId>
<version>0.1.0</version>
<packaging>jar</packaging>

<name>PlugsTest</name>
<url>http://maven.apache.org</url>

<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<dependencies>
<dependency>
<groupId>com.alipay.antchain.bridge</groupId>
<artifactId>antchain-bridge-plugin-lib</artifactId>
<version>0.2.3</version>
</dependency>
<dependency>
<groupId>com.alipay.antchain.bridge</groupId>
<artifactId>antchain-bridge-spi</artifactId>
<version>0.2.3</version>
</dependency>
<dependency>
<groupId>org.web3j</groupId>
<artifactId>core</artifactId>
<version>4.9.8</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.24</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.28</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>ch.qos.logback</groupId>
<artifactId>logback-classic</artifactId>
<version>1.2.11</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.13.2</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.alipay.antchain.bridge</groupId>
<artifactId>simple-ethereum-bbc</artifactId>
<version>0.2.0</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.2.4</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>com.slc.antchain.PluginsTest</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<filters>
<filter>
<artifact>*:*</artifact>
<excludes>
<exclude>META-INF/*.SF</exclude>
<exclude>META-INF/*.DSA</exclude>
<exclude>META-INF/*.RSA</exclude>
</excludes>
</filter>
</filters>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>

Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
package com.ali.antchain;

import com.ali.antchain.abstarct.IPluginTestTool;
import com.ali.antchain.core.*;
import com.ali.antchain.testers.EthTester;
import com.alipay.antchain.bridge.commons.bbc.AbstractBBCContext;
import com.alipay.antchain.bridge.plugins.spi.bbc.AbstractBBCService;

public class EthPluginTestTool implements IPluginTestTool {

AbstractBBCContext inContext;
AbstractBBCService bbcService;

public EthPluginTestTool(AbstractBBCContext _context, AbstractBBCService _service) {
inContext = _context;
bbcService = _service;
}

@Override
public void startupTest() {
StartUpTest.run(inContext, bbcService);
}

@Override
public void shutdownTest() {
ShutDownTest.run(inContext, bbcService);
}

@Override
public void getcontextTest(){
GetContextTest.run(inContext, bbcService);
}

@Override
public void setupamcontractTest(){
SetupAuthMessageContractTest.run(inContext, bbcService);
}

@Override
public void setupsdpcontractTest(){
SetupSDPMessageContractTest.run(inContext, bbcService);
}

@Override
public void setprotocolTest() throws Exception {
StartUpTest.runBefore(inContext, bbcService);
SetProtocolTest.run(bbcService, new EthTester(bbcService));
}

@Override
public void querysdpmessageseqTest() {
StartUpTest.runBefore(inContext, bbcService);
QuerySDPMessageSeqTest.run(bbcService);
}

@Override
public void setamcontractandlocaldomainTest() {
StartUpTest.runBefore(inContext, bbcService);
SetAMContractAndLocaldomainTest.run(bbcService);
}

@Override
public void readcrosschainmessagereceiptTest() {
StartUpTest.runBefore(inContext, bbcService);
ReadCrossChainMessageReceiptTest.run(bbcService, new EthTester(bbcService));
}

@Override
public void readcrosschainmessagebyheightTest() {
StartUpTest.runBefore(inContext, bbcService);
ReadCrossChainMessageByHeightTest.run(bbcService, new EthTester(bbcService));
}

@Override
public void relayauthmessageTest() {
StartUpTest.runBefore(inContext, bbcService);
RelayAuthMessageTest.run(bbcService, new EthTester(bbcService));
}

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package com.ali.antchain.abstarct;

import com.alipay.antchain.bridge.commons.bbc.AbstractBBCContext;
import com.alipay.antchain.bridge.plugins.spi.bbc.AbstractBBCService;
import lombok.Getter;
import lombok.Setter;
import org.slf4j.Logger;
import org.slf4j.helpers.NOPLogger;

/**
* 插件测试工具需要实现的定制化操作
* todo: 这里的方法肯定不能抛出异常啊!有异常的在接口里面处理妥当!
*/
@Getter
@Setter
public abstract class AbstractTester implements ITester {

private Logger bbcLogger;
public AbstractTester() {
bbcLogger = NOPLogger.NOP_LOGGER;
}
}
Loading