jsontestsuite android fixes.

This commit is contained in:
Adrian Tiberius 2015-05-06 16:00:34 +02:00
parent b85abefebd
commit fb31912de4
2 changed files with 13 additions and 5 deletions

View File

@ -15,12 +15,14 @@ import java.io.InputStreamReader;
import java.net.HttpURLConnection;
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.Iterator;
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 {
@ -48,7 +50,8 @@ public class JSONReader {
}
System.out.println("From: " + System.getProperty("ETHEREUM_TEST_PATH"));
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) {
e.printStackTrace();
}
@ -100,7 +103,8 @@ public class JSONReader {
testSuiteObj = (JSONObject) parser.parse(blobresult);
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));
return new String(valueDecoded);
}

View File

@ -24,6 +24,8 @@ import java.math.BigInteger;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@ -77,7 +79,7 @@ public class TestRunner {
logger.info("sign tx with: {}", Hex.toHexString(secretKey));
tx.sign(secretKey);
BlockchainImpl blockchain = new BlockchainImpl();
BlockchainImpl blockchain = new BlockchainImpl(new HashSet<org.ethereum.core.Transaction>());
blockchain.setRepository(repository);
byte[] coinbase = testCase.getEnv().getCurrentCoinbase();
@ -126,8 +128,10 @@ public class TestRunner {
org.ethereum.core.AccountState accountState = repository.getAccountState(addr);
ContractDetails contractDetails = repository.getContractDetails(addr);
/*
logger.info("{} \n{} \n{}", Hex.toHexString(addr),
accountState.toString(), contractDetails.toString());
*/
logger.info("");
AccountState expectedAccountState = testCase.getPost().get(wrap(addr));