Browse Source

Fix Test case !

tags/1.0.0
shaozhuguang 6 years ago
parent
commit
c2ddfa9498
4 changed files with 40 additions and 24 deletions
  1. +2
    -5
      source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/LedgerPerformanceTest.java
  2. +21
    -14
      source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/Utils.java
  3. +15
    -4
      source/test/test-integration/src/main/resources/ledger_init_test_web2.init
  4. +2
    -1
      source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationBase.java

+ 2
- 5
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/LedgerPerformanceTest.java View File

@@ -10,17 +10,14 @@ import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;
import java.util.stream.DoubleStream; import java.util.stream.DoubleStream;


import com.jd.blockchain.crypto.*;
import com.jd.blockchain.ledger.core.CryptoConfig;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;


import com.jd.blockchain.binaryproto.DataContractRegistry; import com.jd.blockchain.binaryproto.DataContractRegistry;
import com.jd.blockchain.consensus.ConsensusProvider; import com.jd.blockchain.consensus.ConsensusProvider;
import com.jd.blockchain.consensus.ConsensusProviders; import com.jd.blockchain.consensus.ConsensusProviders;
import com.jd.blockchain.consensus.ConsensusSettings; import com.jd.blockchain.consensus.ConsensusSettings;
import com.jd.blockchain.crypto.AsymmetricKeypair;
import com.jd.blockchain.crypto.Crypto;
import com.jd.blockchain.crypto.CryptoAlgorithm;
import com.jd.blockchain.crypto.HashDigest;
import com.jd.blockchain.crypto.PrivKey;
import com.jd.blockchain.ledger.BlockchainIdentity; import com.jd.blockchain.ledger.BlockchainIdentity;
import com.jd.blockchain.ledger.BlockchainKeyGenerator; import com.jd.blockchain.ledger.BlockchainKeyGenerator;
import com.jd.blockchain.ledger.BlockchainKeypair; import com.jd.blockchain.ledger.BlockchainKeypair;


+ 21
- 14
source/test/test-integration/src/main/java/test/com/jd/blockchain/intgr/perf/Utils.java View File

@@ -6,16 +6,13 @@ import java.util.Map;
import java.util.Properties; import java.util.Properties;
import java.util.concurrent.ConcurrentHashMap; import java.util.concurrent.ConcurrentHashMap;


import com.jd.blockchain.crypto.*;
import com.jd.blockchain.crypto.service.classic.ClassicCryptoService;
import com.jd.blockchain.crypto.service.sm.SMCryptoService;
import org.springframework.core.io.ClassPathResource; import org.springframework.core.io.ClassPathResource;


import com.jd.blockchain.consensus.ConsensusProvider; import com.jd.blockchain.consensus.ConsensusProvider;
import com.jd.blockchain.consensus.ConsensusSettings; import com.jd.blockchain.consensus.ConsensusSettings;
import com.jd.blockchain.crypto.CryptoAlgorithm;
import com.jd.blockchain.crypto.AsymmetricKeypair;
import com.jd.blockchain.crypto.Crypto;
import com.jd.blockchain.crypto.HashDigest;
import com.jd.blockchain.crypto.PrivKey;
import com.jd.blockchain.crypto.SignatureDigest;
import com.jd.blockchain.ledger.CryptoSetting; import com.jd.blockchain.ledger.CryptoSetting;
import com.jd.blockchain.ledger.core.CryptoConfig; import com.jd.blockchain.ledger.core.CryptoConfig;
import com.jd.blockchain.ledger.core.LedgerInitDecision; import com.jd.blockchain.ledger.core.LedgerInitDecision;
@@ -40,16 +37,19 @@ public class Utils {
public static final String PASSWORD = "abc"; public static final String PASSWORD = "abc";


public static final String[] PUB_KEYS = { public static final String[] PUB_KEYS = {
"3snPdw7i7PapsDoW185c3kfK6p8s6SwiJAdEUzgnfeuUox12nxgzXu",
"3snPdw7i7Ph1SYLQt9uqVEqiuvNXjxCdGvEdN6otJsg5rbr7Aze7kf",
"3snPdw7i7PezptA6dNBkotPjmKEbTkY8fmusLBnfj8Cf7eFwhWDwKr",
"3snPdw7i7PerZYfRzEB61SAN9tFK4yHm9wUSRtkLSSGXHkQRbB5PkS" };
"3snPdw7i7PjVKiTH2VnXZu5H8QmNaSXpnk4ei533jFpuifyjS5zzH9",
"3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX",
"3snPdw7i7PZi6TStiyc6mzjprnNhgs2atSGNS8wPYzhbKaUWGFJt7x",
"3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk" };


public static final String[] PRIV_KEYS = { public static final String[] PRIV_KEYS = {
"177gjyoEUhdD1NkQSxBVvfSyovMd1ha5H46zsb9kyErLNBuQkLRAf2ea6CNjStjCFJQN8S1",
"177gjsa6KcyxUpx7T3tvCVMuqHvvguiQFRLmDY9jaMcH6L9R4k7XgANLfY3paC5XaXeASej",
"177gju7AgXp371qqprjEN3Lg4Hc4EWHnDH9eWgTttEUoN8PuNpQTbS253uTxdKn5w1zZXUp",
"177gjtddYr7CtN6iN6KRgu1kKzFn6quQsx3DQLnUD1xgj5E2QhUTMDnpZKzSKbB7kt35gzj" };
"177gjzHTznYdPgWqZrH43W3yp37onm74wYXT4v9FukpCHBrhRysBBZh7Pzdo5AMRyQGJD7x",
"177gju9p5zrNdHJVEQnEEKF4ZjDDYmAXyfG84V5RPGVc5xFfmtwnHA7j51nyNLUFffzz5UT",
"177gjtwLgmSx5v1hFb46ijh7L9kdbKUpJYqdKVf9afiEmAuLgo8Rck9yu5UuUcHknWJuWaF",
"177gk1pudweTq5zgJTh8y3ENCTwtSFsKyX7YnpuKPo7rKgCkCBXVXh5z2syaTCPEMbuWRns" };

private static final String[] SUPPORTED_PROVIDERS = { ClassicCryptoService.class.getName(),
SMCryptoService.class.getName() };


private Map<NetworkAddress, LedgerInitConsensusService> serviceRegisterMap = new ConcurrentHashMap<>(); private Map<NetworkAddress, LedgerInitConsensusService> serviceRegisterMap = new ConcurrentHashMap<>();


@@ -132,7 +132,14 @@ public class Utils {
public AsyncCallback<HashDigest> startInit(int currentId, PrivKey privKey, LedgerInitProperties setting, public AsyncCallback<HashDigest> startInit(int currentId, PrivKey privKey, LedgerInitProperties setting,
ConsensusSettings csProps, ConsensusProvider consensusProvider, DBConnectionConfig dbConnConfig, ConsensusSettings csProps, ConsensusProvider consensusProvider, DBConnectionConfig dbConnConfig,
Prompter prompter, boolean autoVerifyHash, CryptoAlgorithm hashAlg) { Prompter prompter, boolean autoVerifyHash, CryptoAlgorithm hashAlg) {

CryptoProvider[] supportedProviders = new CryptoProvider[SUPPORTED_PROVIDERS.length];
for (int i = 0; i < SUPPORTED_PROVIDERS.length; i++) {
supportedProviders[i] = Crypto.getProvider(SUPPORTED_PROVIDERS[i]);
}
CryptoConfig cryptoSetting = new CryptoConfig(); CryptoConfig cryptoSetting = new CryptoConfig();
cryptoSetting.setSupportedProviders(supportedProviders);
cryptoSetting.setSupportedProviders(supportedProviders);
cryptoSetting.setAutoVerifyHash(autoVerifyHash); cryptoSetting.setAutoVerifyHash(autoVerifyHash);
cryptoSetting.setHashAlgorithm(hashAlg); cryptoSetting.setHashAlgorithm(hashAlg);




+ 15
- 4
source/test/test-integration/src/main/resources/ledger_init_test_web2.init View File

@@ -4,6 +4,17 @@ ledger.seed=932dfe23-fe23232f-283f32fa-dd32aa76-8322ca2f-56236cda-7136b322-cb323
#账本的描述名称;此属性不参与共识,仅仅在当前参与方的本地节点用于描述用途; #账本的描述名称;此属性不参与共识,仅仅在当前参与方的本地节点用于描述用途;
#ledger.name= #ledger.name=


#共识服务提供者;必须;
consensus.service-provider=com.jd.blockchain.consensus.bftsmart.BftsmartConsensusProvider

#共识服务的参数配置;必须;
consensus.conf=classpath:bftsmart.config

#密码服务提供者列表,以英文逗点“,”分隔;必须;
crypto.service-providers=com.jd.blockchain.crypto.service.classic.ClassicCryptoService, \
com.jd.blockchain.crypto.service.sm.SMCryptoService


#参与方的个数,后续以 cons_parti.id 分别标识每一个参与方的配置; #参与方的个数,后续以 cons_parti.id 分别标识每一个参与方的配置;
cons_parti.count=4 cons_parti.count=4


@@ -12,7 +23,7 @@ cons_parti.0.name=jd.com
#第0个参与方的公钥文件路径; #第0个参与方的公钥文件路径;
cons_parti.0.pubkey-path=keys/jd-com.pub cons_parti.0.pubkey-path=keys/jd-com.pub
#第0个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数; #第0个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.0.pubkey=3snPdw7i7PapsDoW185c3kfK6p8s6SwiJAdEUzgnfeuUox12nxgzXu
cons_parti.0.pubkey=3snPdw7i7PjVKiTH2VnXZu5H8QmNaSXpnk4ei533jFpuifyjS5zzH9
#第0个参与方的账本初始服务的主机; #第0个参与方的账本初始服务的主机;
cons_parti.0.initializer.host=127.0.0.1 cons_parti.0.initializer.host=127.0.0.1
#第0个参与方的账本初始服务的端口; #第0个参与方的账本初始服务的端口;
@@ -25,7 +36,7 @@ cons_parti.1.name=at.com
#第1个参与方的公钥文件路径; #第1个参与方的公钥文件路径;
cons_parti.1.pubkey-path=keys/at-com.pub cons_parti.1.pubkey-path=keys/at-com.pub
#第1个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数; #第1个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.1.pubkey=3snPdw7i7Ph1SYLQt9uqVEqiuvNXjxCdGvEdN6otJsg5rbr7Aze7kf
cons_parti.1.pubkey=3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX
#第1个参与方的账本初始服务的主机; #第1个参与方的账本初始服务的主机;
cons_parti.1.initializer.host=127.0.0.1 cons_parti.1.initializer.host=127.0.0.1
#第1个参与方的账本初始服务的端口; #第1个参与方的账本初始服务的端口;
@@ -38,7 +49,7 @@ cons_parti.2.name=bt.com
#第2个参与方的公钥文件路径; #第2个参与方的公钥文件路径;
cons_parti.2.pubkey-path=keys/bt-com.pub cons_parti.2.pubkey-path=keys/bt-com.pub
#第2个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数; #第2个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.2.pubkey=3snPdw7i7PezptA6dNBkotPjmKEbTkY8fmusLBnfj8Cf7eFwhWDwKr
cons_parti.2.pubkey=3snPdw7i7PZi6TStiyc6mzjprnNhgs2atSGNS8wPYzhbKaUWGFJt7x
#第2个参与方的账本初始服务的主机; #第2个参与方的账本初始服务的主机;
cons_parti.2.initializer.host=127.0.0.1 cons_parti.2.initializer.host=127.0.0.1
#第2个参与方的账本初始服务的端口; #第2个参与方的账本初始服务的端口;
@@ -51,7 +62,7 @@ cons_parti.3.name=xt.com
#第3个参与方的公钥文件路径; #第3个参与方的公钥文件路径;
cons_parti.3.pubkey-path=keys/xt-com.pub cons_parti.3.pubkey-path=keys/xt-com.pub
#第3个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数; #第3个参与方的公钥内容(由keygen工具生成);此参数优先于 pubkey-path 参数;
cons_parti.3.pubkey=3snPdw7i7PerZYfRzEB61SAN9tFK4yHm9wUSRtkLSSGXHkQRbB5PkS
cons_parti.3.pubkey=3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk
#第3个参与方的账本初始服务的主机; #第3个参与方的账本初始服务的主机;
cons_parti.3.initializer.host=127.0.0.1 cons_parti.3.initializer.host=127.0.0.1
#第3个参与方的账本初始服务的端口; #第3个参与方的账本初始服务的端口;


+ 2
- 1
source/test/test-integration/src/test/java/test/com/jd/blockchain/intgr/IntegrationBase.java View File

@@ -72,7 +72,8 @@ public class IntegrationBase {


public static final String PASSWORD = "abc"; public static final String PASSWORD = "abc";


public static final String[] PUB_KEYS = { "3snPdw7i7PjVKiTH2VnXZu5H8QmNaSXpnk4ei533jFpuifyjS5zzH9",
public static final String[] PUB_KEYS = {
"3snPdw7i7PjVKiTH2VnXZu5H8QmNaSXpnk4ei533jFpuifyjS5zzH9",
"3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX", "3snPdw7i7PajLB35tEau1kmixc6ZrjLXgxwKbkv5bHhP7nT5dhD9eX",
"3snPdw7i7PZi6TStiyc6mzjprnNhgs2atSGNS8wPYzhbKaUWGFJt7x", "3snPdw7i7PZi6TStiyc6mzjprnNhgs2atSGNS8wPYzhbKaUWGFJt7x",
"3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk" }; "3snPdw7i7PifPuRX7fu3jBjsb3rJRfDe9GtbDfvFJaJ4V4hHXQfhwk" };


Loading…
Cancel
Save