diff --git a/build.gradle b/build.gradle index 2a12c43da..bb62a7401 100644 --- a/build.gradle +++ b/build.gradle @@ -73,7 +73,7 @@ ext { // jmeter jmeterVersion = "5.0" // jackson - jacksonVersion = "2.9.10.1" + jacksonVersion = "2.11.2" commonsNetVersion = "3.6" @@ -167,6 +167,7 @@ allprojects { resolutionStrategy { // fix security bug force "com.alibaba:fastjson:${fastjsonVersion}" + force "com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}" // force use netty force "io.netty:netty-all:${nettyVersion}" force "org.apache.zookeeper:zookeeper:${zookeeperVersion}" @@ -182,6 +183,11 @@ allprojects { implementation("org.apache.commons:commons-lang3:${apacheCommonsVersion.lang3}") implementation("org.apache.commons:commons-collections4:${apacheCommonsVersion.collections4}") + // jackson + implementation("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}") + implementation("com.fasterxml.jackson.core:jackson-core:${jacksonVersion}") + implementation("com.fasterxml.jackson.core:jackson-annotations:${jacksonVersion}") + // slf4j logger implementation("org.slf4j:slf4j-api:${slf4jVersion}") diff --git a/project/build-ci.sh b/project/build-ci.sh index 7cc89fdb1..12795b6ed 100644 --- a/project/build-ci.sh +++ b/project/build-ci.sh @@ -40,16 +40,16 @@ function installFisco(){ function installZookeeper(){ #unzip file cd ${current_path}/weevent-build/modules/zookeeper/ - tar -zxf apache-zookeeper-3.6.0-bin.tar.gz + tar -zxf apache-zookeeper-3.6.1-bin.tar.gz #modify configuration - sed -i '158s#\\#"-Dzookeeper.admin.enableServer=false" \\#' ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.0-bin/bin/zkServer.sh - cp ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.0-bin/conf/zoo_sample.cfg ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.0-bin/conf/zoo.cfg - sed -i '$a\dataDir=/tmp/zk_data' ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.0-bin/conf/zoo.cfg - sed -i '$a\dataLogDir=/tmp/zk_logs' ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.0-bin/conf/zoo.cfg + sed -i '158s#\\#"-Dzookeeper.admin.enableServer=false" \\#' ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.1-bin/bin/zkServer.sh + cp ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.1-bin/conf/zoo_sample.cfg ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.1-bin/conf/zoo.cfg + sed -i '$a\dataDir=/tmp/zk_data' ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.1-bin/conf/zoo.cfg + sed -i '$a\dataLogDir=/tmp/zk_logs' ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.1-bin/conf/zoo.cfg #start zookeeper - cd ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.0-bin/bin/ + cd ${current_path}/weevent-build/modules/zookeeper/apache-zookeeper-3.6.1-bin/bin/ bash zkServer.sh start } diff --git a/weevent-build/bin/start-all.sh b/weevent-build/bin/start-all.sh index 28ef000d8..175bb3937 100644 --- a/weevent-build/bin/start-all.sh +++ b/weevent-build/bin/start-all.sh @@ -8,7 +8,7 @@ if [[ -e ${current_path}/install-all.sh ]];then fi # start zookeeper first -cd ${current_path}/zookeeper/apache-zookeeper-3.6.0-bin/bin/ +cd ${current_path}/zookeeper/apache-zookeeper-3.6.1-bin/bin/ ./zkServer.sh start cd ${current_path} sleep 3 diff --git a/weevent-build/bin/stop-all.sh b/weevent-build/bin/stop-all.sh index 8b480b587..5bec596ab 100644 --- a/weevent-build/bin/stop-all.sh +++ b/weevent-build/bin/stop-all.sh @@ -19,6 +19,6 @@ do done # finally stop zookeeper -cd ${current_path}/zookeeper/apache-zookeeper-3.6.0-bin/bin/; +cd ${current_path}/zookeeper/apache-zookeeper-3.6.1-bin/bin/; ./zkServer.sh stop; diff --git a/weevent-build/modules/zookeeper/apache-zookeeper-3.6.0-bin.tar.gz b/weevent-build/modules/zookeeper/apache-zookeeper-3.6.1-bin.tar.gz similarity index 60% rename from weevent-build/modules/zookeeper/apache-zookeeper-3.6.0-bin.tar.gz rename to weevent-build/modules/zookeeper/apache-zookeeper-3.6.1-bin.tar.gz index 50d43af6d..d3cfcd3a6 100644 Binary files a/weevent-build/modules/zookeeper/apache-zookeeper-3.6.0-bin.tar.gz and b/weevent-build/modules/zookeeper/apache-zookeeper-3.6.1-bin.tar.gz differ diff --git a/weevent-build/modules/zookeeper/install-zookeeper.sh b/weevent-build/modules/zookeeper/install-zookeeper.sh index ff6185f48..fa326782f 100644 --- a/weevent-build/modules/zookeeper/install-zookeeper.sh +++ b/weevent-build/modules/zookeeper/install-zookeeper.sh @@ -11,13 +11,13 @@ while [[ $# -ge 2 ]] ; do done configzookeeper(){ - sed -i '/nohup/s/\\/"-Dzookeeper.admin.enableServer=false" \\/g' ${out_path}/apache-zookeeper-3.6.0-bin/bin/zkServer.sh - chmod +x ${out_path}/apache-zookeeper-3.6.0-bin/bin/zkServer.sh - cp ${out_path}/apache-zookeeper-3.6.0-bin/conf/zoo_sample.cfg ${out_path}/apache-zookeeper-3.6.0-bin/conf/zoo.cfg - sed -i '/dataDir=/cdataDir='${out_path}/apache-zookeeper-3.6.0-bin/zk_data ${out_path}/apache-zookeeper-3.6.0-bin/conf/zoo.cfg + sed -i '/nohup/s/\\/"-Dzookeeper.admin.enableServer=false" \\/g' ${out_path}/apache-zookeeper-3.6.1-bin/bin/zkServer.sh + chmod +x ${out_path}/apache-zookeeper-3.6.1-bin/bin/zkServer.sh + cp ${out_path}/apache-zookeeper-3.6.1-bin/conf/zoo_sample.cfg ${out_path}/apache-zookeeper-3.6.1-bin/conf/zoo.cfg + sed -i '/dataDir=/cdataDir='${out_path}/apache-zookeeper-3.6.1-bin/zk_data ${out_path}/apache-zookeeper-3.6.1-bin/conf/zoo.cfg zookeeper_pre="clientPort=" zookeeper_string=${zookeeper_pre}${zookeeper_port} - sed -i 's/^clientPort=.*$/'$(echo ${zookeeper_pre}${zookeeper_port})'/' ${out_path}/apache-zookeeper-3.6.0-bin/conf/zoo.cfg + sed -i 's/^clientPort=.*$/'$(echo ${zookeeper_pre}${zookeeper_port})'/' ${out_path}/apache-zookeeper-3.6.1-bin/conf/zoo.cfg } function copy_file(){ diff --git a/weevent-build/package.sh b/weevent-build/package.sh index 35d599831..7df24e260 100644 --- a/weevent-build/package.sh +++ b/weevent-build/package.sh @@ -116,7 +116,7 @@ function copy_install_file(){ cp -r ${top_path}/weevent-processor/dist/* ${out_path}/modules/processor mkdir -p ${out_path}/modules/zookeeper - tar -zxf ${current_path}/modules/zookeeper/apache-zookeeper-3.6.0-bin.tar.gz -C ${out_path}/modules/zookeeper + tar -zxf ${current_path}/modules/zookeeper/apache-zookeeper-3.6.1-bin.tar.gz -C ${out_path}/modules/zookeeper cp ${current_path}/modules/zookeeper/install-zookeeper.sh ${out_path}/modules/zookeeper } diff --git a/weevent-client/build.gradle b/weevent-client/build.gradle index a489347e1..45a06f1f0 100644 --- a/weevent-client/build.gradle +++ b/weevent-client/build.gradle @@ -2,9 +2,6 @@ apply plugin: "io.spring.dependency-management" apply plugin: "signing" dependencies { - // jackson - implementation("com.fasterxml.jackson.core:jackson-databind:${jacksonVersion}") - // stomp, see https://github.com/TooTallNate/Java-WebSocket implementation("org.java-websocket:Java-WebSocket:${WebSocketVersion}") implementation("org.springframework.data:spring-data-commons:${springBootVersion}") diff --git a/weevent-file/src/test/java/com/webank/weevent/file/FileChunksTransportTest.java b/weevent-file/src/test/java/com/webank/weevent/file/FileChunksTransportTest.java index 65be0d89a..14fcec9da 100644 --- a/weevent-file/src/test/java/com/webank/weevent/file/FileChunksTransportTest.java +++ b/weevent-file/src/test/java/com/webank/weevent/file/FileChunksTransportTest.java @@ -15,8 +15,6 @@ import com.webank.weevent.file.service.FileChunksMeta; import com.webank.weevent.file.service.FileChunksTransport; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import org.junit.Assert; import org.junit.Before; import org.junit.Ignore; @@ -24,6 +22,9 @@ import org.mockito.Mock; import org.mockito.Mockito; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + /** * FileChunks Tester. * diff --git a/weevent-file/src/test/java/com/webank/weevent/file/FtpClientServiceTest.java b/weevent-file/src/test/java/com/webank/weevent/file/FtpClientServiceTest.java index d5089f213..51b97bb8b 100644 --- a/weevent-file/src/test/java/com/webank/weevent/file/FtpClientServiceTest.java +++ b/weevent-file/src/test/java/com/webank/weevent/file/FtpClientServiceTest.java @@ -7,13 +7,14 @@ import com.webank.weevent.client.BrokerException; import com.webank.weevent.file.ftpclient.FtpClientService; -import static org.mockito.Mockito.mock; -import static org.mockito.Mockito.when; import lombok.extern.slf4j.Slf4j; import org.junit.Assert; import org.junit.Ignore; import org.junit.Test; +import static org.mockito.Mockito.mock; +import static org.mockito.Mockito.when; + @Slf4j public class FtpClientServiceTest { private String ftpHost = "127.0.0.1"; @@ -43,7 +44,6 @@ public void testFtpService() { } - @Test @Ignore public void testFtpUpLoad() throws BrokerException { diff --git a/weevent-file/src/test/java/com/webank/weevent/file/WeEventFileClientTest.java b/weevent-file/src/test/java/com/webank/weevent/file/WeEventFileClientTest.java index b30c64665..8ac4ea01a 100644 --- a/weevent-file/src/test/java/com/webank/weevent/file/WeEventFileClientTest.java +++ b/weevent-file/src/test/java/com/webank/weevent/file/WeEventFileClientTest.java @@ -1,5 +1,9 @@ package com.webank.weevent.file; +import java.io.File; +import java.util.ArrayList; +import java.util.List; + import com.webank.weevent.client.BrokerException; import com.webank.weevent.client.SendResult; import com.webank.weevent.core.config.FiscoConfig; @@ -10,6 +14,7 @@ import com.webank.weevent.file.inner.DiskFiles; import com.webank.weevent.file.service.FileChunksMeta; import com.webank.weevent.file.service.WeEventFileClient; + import lombok.extern.slf4j.Slf4j; import org.junit.Assert; import org.junit.Before; @@ -18,10 +23,6 @@ import org.springframework.core.io.Resource; import org.springframework.core.io.support.PathMatchingResourcePatternResolver; -import java.io.File; -import java.util.ArrayList; -import java.util.List; - @Slf4j public class WeEventFileClientTest { @@ -38,7 +39,6 @@ public class WeEventFileClientTest { private String passWd = ""; - @Before public void before() { this.fiscoConfig = new FiscoConfig(); @@ -90,7 +90,7 @@ public void testPublishFileWithVerify() throws Exception { weEventFileClient.openTransport4Sender(this.topicName, resource.getInputStream()); // handshake time delay for web3sdk - Thread.sleep(1000*10); + Thread.sleep(1000 * 10); FileChunksMeta fileChunksMeta = weEventFileClient.publishFile(this.topicName, new File("src/main/resources/ca.crt").getAbsolutePath(), true); @@ -125,7 +125,7 @@ public void onException(Throwable e) { @Test public void testCloseTransport() { - WeEventFileClient weEventFileClient = new WeEventFileClient(this.groupId, this.localReceivePath,this.fileChunkSize, this.fiscoConfig); + WeEventFileClient weEventFileClient = new WeEventFileClient(this.groupId, this.localReceivePath, this.fileChunkSize, this.fiscoConfig); weEventFileClient.closeTransport(this.topicName); Assert.assertTrue(true); } @@ -142,16 +142,16 @@ public void testListFile() { } - // new class for test status interface static class Runner4PublishFile implements Runnable { private final String topic; private final WeEventFileClient weEventFileClient; - Runner4PublishFile(WeEventFileClient weEventFileClient, String topic){ + Runner4PublishFile(WeEventFileClient weEventFileClient, String topic) { this.weEventFileClient = weEventFileClient; this.topic = topic; } + @Override public void run() { //publish file @@ -159,7 +159,7 @@ public void run() { try { weEventFileClient.publishFile(topic, new File("src/main/resources/bigfile.zip").getAbsolutePath(), true); - } catch(Exception e) { + } catch (Exception e) { e.printStackTrace(); } @@ -203,12 +203,14 @@ static class Runner4Status implements Runnable { private final String topic; private final WeEventFileClient weEventFileClient; private final boolean isSender; - Runner4Status(String groupId, String topic, WeEventFileClient weEventFileClient, boolean isSender){ + + Runner4Status(String groupId, String topic, WeEventFileClient weEventFileClient, boolean isSender) { this.groupId = groupId; this.topic = topic; this.weEventFileClient = weEventFileClient; this.isSender = isSender; } + @Override public void run() { FileTransportStats fileTransportStats = weEventFileClient.status(topic); @@ -241,14 +243,14 @@ public void run() { @Ignore public void testStatus4Sender() throws InterruptedException { WeEventFileClient weEventFileClient = new WeEventFileClient(this.groupId, this.localReceivePath, this.fileChunkSize, this.fiscoConfig); - new Thread(new Runner4PublishFile(weEventFileClient, this.topicName),"thread publish").start(); + new Thread(new Runner4PublishFile(weEventFileClient, this.topicName), "thread publish").start(); // thread delay for get sender status System.out.println("sender delay 10s:"); - Thread.sleep(1000*10); + Thread.sleep(1000 * 10); System.out.println("begin get sender status:"); - new Thread(new Runner4Status(this.groupId, this.topicName, weEventFileClient, true),"thread status").start(); - Thread.sleep(1000*60*5); + new Thread(new Runner4Status(this.groupId, this.topicName, weEventFileClient, true), "thread status").start(); + Thread.sleep(1000 * 60 * 5); Assert.assertTrue(true); } @@ -256,13 +258,13 @@ public void testStatus4Sender() throws InterruptedException { @Ignore public void testStatus4Receiver() throws InterruptedException { WeEventFileClient weEventFileClient = new WeEventFileClient(this.groupId, this.localReceivePath, this.fileChunkSize, this.fiscoConfig); - new Thread(new Runner4SubscribeFile(weEventFileClient, this.topicName),"thread publish").start(); + new Thread(new Runner4SubscribeFile(weEventFileClient, this.topicName), "thread publish").start(); // thread delay for get receiver status System.out.println("receiver waiting sender publish file, delay 30s:"); Thread.sleep(1000 * 30); System.out.println("begin get receiver status: "); - new Thread(new Runner4Status(this.groupId, this.topicName, weEventFileClient, false),"thread status").start(); + new Thread(new Runner4Status(this.groupId, this.topicName, weEventFileClient, false), "thread status").start(); // main thread sleep, waiting for subscribe file Thread.sleep(1000 * 60 * 5); @@ -315,7 +317,7 @@ public void testGetDiskFiles() { @Ignore public void testPublishFileFromFtp() throws Exception { FtpInfo ftpInfo = new FtpInfo(this.host, this.port, this.userName, this.passWd, ""); - WeEventFileClient weEventFileClient = new WeEventFileClient(this.groupId, this.localReceivePath, ftpInfo, this.fileChunkSize, this.fiscoConfig); + WeEventFileClient weEventFileClient = new WeEventFileClient(this.groupId, this.localReceivePath, ftpInfo, this.fileChunkSize, this.fiscoConfig); weEventFileClient.openTransport4Sender(topicName); FileChunksMeta fileChunksMeta = weEventFileClient.publishFile(this.topicName, "./test/build_chain.sh", true); @@ -342,7 +344,7 @@ public void onException(Throwable e) { WeEventFileClient weEventFileClient = new WeEventFileClient(this.groupId, this.localReceivePath, ftpInfo, this.fileChunkSize, this.fiscoConfig); weEventFileClient.openTransport4Receiver(this.topicName, fileListener); - Thread.sleep(1000*60*5); + Thread.sleep(1000 * 60 * 5); Assert.assertTrue(true); }