jsontestsuite android fixes.
This commit is contained in:
parent
b85abefebd
commit
fb31912de4
|
@ -15,12 +15,14 @@ import java.io.InputStreamReader;
|
||||||
import java.net.HttpURLConnection;
|
import java.net.HttpURLConnection;
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
import java.nio.file.Files;
|
//import java.nio.file.Files;
|
||||||
|
import org.apache.commons.io.FileUtils;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import org.apache.commons.codec.binary.Base64;
|
//import org.apache.commons.codec.binary.Base64;
|
||||||
|
import android.util.Base64;
|
||||||
|
|
||||||
public class JSONReader {
|
public class JSONReader {
|
||||||
|
|
||||||
|
@ -48,7 +50,8 @@ public class JSONReader {
|
||||||
}
|
}
|
||||||
System.out.println("From: " + System.getProperty("ETHEREUM_TEST_PATH"));
|
System.out.println("From: " + System.getProperty("ETHEREUM_TEST_PATH"));
|
||||||
File vmTestFile = new File(System.getProperty("ETHEREUM_TEST_PATH") + filename);
|
File vmTestFile = new File(System.getProperty("ETHEREUM_TEST_PATH") + filename);
|
||||||
return new String(Files.readAllBytes(vmTestFile.toPath()));
|
//return new String(Files.readAllBytes(vmTestFile.toPath()));
|
||||||
|
return new String(FileUtils.readFileToByteArray(vmTestFile));
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
@ -100,7 +103,8 @@ public class JSONReader {
|
||||||
|
|
||||||
testSuiteObj = (JSONObject) parser.parse(blobresult);
|
testSuiteObj = (JSONObject) parser.parse(blobresult);
|
||||||
String blob = (String) testSuiteObj.get("content");
|
String blob = (String) testSuiteObj.get("content");
|
||||||
byte[] valueDecoded= Base64.decodeBase64(blob.getBytes() );
|
//byte[] valueDecoded= Base64.decodeBase64(blob.getBytes() );
|
||||||
|
byte[] valueDecoded= Base64.decode(blob.getBytes(), Base64.DEFAULT);
|
||||||
//System.out.println("Decoded value is " + new String(valueDecoded));
|
//System.out.println("Decoded value is " + new String(valueDecoded));
|
||||||
return new String(valueDecoded);
|
return new String(valueDecoded);
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,6 +24,8 @@ import java.math.BigInteger;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -77,7 +79,7 @@ public class TestRunner {
|
||||||
logger.info("sign tx with: {}", Hex.toHexString(secretKey));
|
logger.info("sign tx with: {}", Hex.toHexString(secretKey));
|
||||||
tx.sign(secretKey);
|
tx.sign(secretKey);
|
||||||
|
|
||||||
BlockchainImpl blockchain = new BlockchainImpl();
|
BlockchainImpl blockchain = new BlockchainImpl(new HashSet<org.ethereum.core.Transaction>());
|
||||||
blockchain.setRepository(repository);
|
blockchain.setRepository(repository);
|
||||||
|
|
||||||
byte[] coinbase = testCase.getEnv().getCurrentCoinbase();
|
byte[] coinbase = testCase.getEnv().getCurrentCoinbase();
|
||||||
|
@ -126,8 +128,10 @@ public class TestRunner {
|
||||||
org.ethereum.core.AccountState accountState = repository.getAccountState(addr);
|
org.ethereum.core.AccountState accountState = repository.getAccountState(addr);
|
||||||
ContractDetails contractDetails = repository.getContractDetails(addr);
|
ContractDetails contractDetails = repository.getContractDetails(addr);
|
||||||
|
|
||||||
|
/*
|
||||||
logger.info("{} \n{} \n{}", Hex.toHexString(addr),
|
logger.info("{} \n{} \n{}", Hex.toHexString(addr),
|
||||||
accountState.toString(), contractDetails.toString());
|
accountState.toString(), contractDetails.toString());
|
||||||
|
*/
|
||||||
logger.info("");
|
logger.info("");
|
||||||
|
|
||||||
AccountState expectedAccountState = testCase.getPost().get(wrap(addr));
|
AccountState expectedAccountState = testCase.getPost().get(wrap(addr));
|
||||||
|
|
Loading…
Reference in New Issue