|
3 | 3 | import com.google.protobuf.Any; |
4 | 4 | import com.google.protobuf.ByteString; |
5 | 5 | import java.io.File; |
6 | | -import java.nio.charset.Charset; |
7 | 6 | import org.joda.time.DateTime; |
8 | 7 | import org.junit.AfterClass; |
9 | 8 | import org.junit.Assert; |
@@ -584,8 +583,9 @@ public void assetNameTest() { |
584 | 583 | } |
585 | 584 |
|
586 | 585 | //Contain chinese character, throw exception. |
587 | | - assetName = new String(ByteArray.fromHexString("E6B58BE8AF95"), Charset.forName("UTF-8")); |
588 | | - actuator = new ParticipateAssetIssueActuator(getContract(1000L, assetName), dbManager); |
| 586 | + actuator = new ParticipateAssetIssueActuator( |
| 587 | + getContract(1000L, ByteString.copyFrom(ByteArray.fromHexString("E6B58BE8AF95"))), |
| 588 | + dbManager); |
589 | 589 | ret = new TransactionResultCapsule(); |
590 | 590 | try { |
591 | 591 | actuator.validate(); |
@@ -825,39 +825,39 @@ public void multiplyOverflowTest() { |
825 | 825 | } |
826 | 826 |
|
827 | 827 | /** |
828 | | - * exchangeAmount <= 0 trx, throw exception |
| 828 | + * exchangeAmount <= 0 trx, throw exception |
829 | 829 | */ |
830 | 830 | @Test |
831 | 831 | public void exchangeAmountTest() { |
832 | 832 |
|
833 | 833 | dbManager.getDynamicPropertiesStore().saveLatestBlockHeaderTimestamp(1000000); |
834 | 834 | AssetIssueContract assetIssueContract = |
835 | | - AssetIssueContract.newBuilder() |
836 | | - .setOwnerAddress(ByteString.copyFrom(ByteArray.fromHexString(TO_ADDRESS))) |
837 | | - .setName(ByteString.copyFrom(ByteArray.fromString(ASSET_NAME))) |
838 | | - .setTotalSupply(TOTAL_SUPPLY) |
839 | | - .setTrxNum(100) |
840 | | - .setNum(1) |
841 | | - .setStartTime(dbManager.getHeadBlockTimeStamp() - 10000) |
842 | | - .setEndTime(dbManager.getHeadBlockTimeStamp() + 11000000) |
843 | | - .setVoteScore(VOTE_SCORE) |
844 | | - .setDescription(ByteString.copyFrom(ByteArray.fromString(DESCRIPTION))) |
845 | | - .setUrl(ByteString.copyFrom(ByteArray.fromString(URL))) |
846 | | - .build(); |
| 835 | + AssetIssueContract.newBuilder() |
| 836 | + .setOwnerAddress(ByteString.copyFrom(ByteArray.fromHexString(TO_ADDRESS))) |
| 837 | + .setName(ByteString.copyFrom(ByteArray.fromString(ASSET_NAME))) |
| 838 | + .setTotalSupply(TOTAL_SUPPLY) |
| 839 | + .setTrxNum(100) |
| 840 | + .setNum(1) |
| 841 | + .setStartTime(dbManager.getHeadBlockTimeStamp() - 10000) |
| 842 | + .setEndTime(dbManager.getHeadBlockTimeStamp() + 11000000) |
| 843 | + .setVoteScore(VOTE_SCORE) |
| 844 | + .setDescription(ByteString.copyFrom(ByteArray.fromString(DESCRIPTION))) |
| 845 | + .setUrl(ByteString.copyFrom(ByteArray.fromString(URL))) |
| 846 | + .build(); |
847 | 847 | AssetIssueCapsule assetIssueCapsule = new AssetIssueCapsule(assetIssueContract); |
848 | 848 | dbManager.getAssetIssueStore() |
849 | | - .put(assetIssueCapsule.getName().toByteArray(), assetIssueCapsule); |
| 849 | + .put(assetIssueCapsule.getName().toByteArray(), assetIssueCapsule); |
850 | 850 |
|
851 | 851 | AccountCapsule toAccountCapsule = dbManager.getAccountStore() |
852 | | - .get(ByteArray.fromHexString(TO_ADDRESS)); |
| 852 | + .get(ByteArray.fromHexString(TO_ADDRESS)); |
853 | 853 | toAccountCapsule.addAsset(ASSET_NAME, TOTAL_SUPPLY); |
854 | 854 | dbManager.getAccountStore().put(toAccountCapsule.getAddress().toByteArray(), toAccountCapsule); |
855 | 855 | AccountCapsule owner = dbManager.getAccountStore().get(ByteArray.fromHexString(OWNER_ADDRESS)); |
856 | 856 | owner.setBalance(100000000000000L); |
857 | 857 | dbManager.getAccountStore().put(owner.getAddress().toByteArray(), owner); |
858 | 858 |
|
859 | 859 | ParticipateAssetIssueActuator actuator = new ParticipateAssetIssueActuator(getContract(1), |
860 | | - dbManager); |
| 860 | + dbManager); |
861 | 861 |
|
862 | 862 | TransactionResultCapsule ret = new TransactionResultCapsule(); |
863 | 863 | try { |
|
0 commit comments