End test and fix
This commit is contained in:
parent
86f6abfce5
commit
1e479ff973
|
@ -36,7 +36,7 @@ public class Config {
|
|||
public static final String CHANNEL_NAME = "mychannel";
|
||||
|
||||
//public static final String CHAINCODE_NAME = "mycc";
|
||||
public static final String CHAINCODE_NAME = "monnethic_2";
|
||||
public static final String CHAINCODE_NAME = "monnethic_4";
|
||||
//public static final String CHAINCODE_NAME = "monnethic-dev-4";
|
||||
//public static final String CHAINCODE_PROD = "monnethic-prod";
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@ import com.j256.ormlite.stmt.PreparedQuery;
|
|||
import com.j256.ormlite.stmt.QueryBuilder;
|
||||
import com.j256.ormlite.stmt.UpdateBuilder;
|
||||
import database.DatabaseHelper;
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
import java.util.List;
|
||||
|
||||
public class WalletDao {
|
||||
|
@ -38,7 +38,9 @@ public class WalletDao {
|
|||
public void updateWalletBalance(String walletHash, double newBalance) throws Exception {
|
||||
walletDao = createWalletDaoConnection();
|
||||
UpdateBuilder<Wallet, String> updateBuilder = walletDao.updateBuilder();
|
||||
long now = Instant.now().toEpochMilli();
|
||||
updateBuilder.updateColumnValue("balance",newBalance);
|
||||
updateBuilder.updateColumnValue("modification_date",now);
|
||||
updateBuilder.where().eq("wallet_hash",walletHash);
|
||||
updateBuilder.update();
|
||||
}
|
||||
|
@ -63,8 +65,8 @@ public class WalletDao {
|
|||
walletDao = createWalletDaoConnection();
|
||||
UpdateBuilder<Wallet, String> updateBuilder = walletDao.updateBuilder();
|
||||
updateBuilder.updateColumnValue("user_hash",newUserHash);
|
||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||
long now = Instant.now().toEpochMilli();
|
||||
updateBuilder.updateColumnValue("modification_date",now);
|
||||
updateBuilder.where().eq("wallet_hash",walletHash).and().eq("is_active",true);
|
||||
updateBuilder.update();
|
||||
}
|
||||
|
@ -73,8 +75,8 @@ public class WalletDao {
|
|||
walletDao = createWalletDaoConnection();
|
||||
UpdateBuilder<Wallet, String> updateBuilder = walletDao.updateBuilder();
|
||||
updateBuilder.updateColumnValue("is_active",false);
|
||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||
long now = Instant.now().toEpochMilli();
|
||||
updateBuilder.updateColumnValue("modification_date",now);
|
||||
updateBuilder.where().eq("wallet_hash",walletHash).and().eq("user_hash",userHash);
|
||||
updateBuilder.update();
|
||||
}
|
||||
|
|
|
@ -7,8 +7,7 @@ import com.j256.ormlite.stmt.PreparedQuery;
|
|||
import com.j256.ormlite.stmt.QueryBuilder;
|
||||
import com.j256.ormlite.stmt.UpdateBuilder;
|
||||
import database.DatabaseHelper;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
import java.time.Instant;
|
||||
|
||||
//Class to communicate with database with ORMLite
|
||||
public class UserDao {
|
||||
|
@ -51,8 +50,8 @@ public class UserDao {
|
|||
userDao = createUserDaoConnection();
|
||||
UpdateBuilder<User, String> updateBuilder = userDao.updateBuilder();
|
||||
updateBuilder.updateColumnValue("password",password);
|
||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||
long now = Instant.now().toEpochMilli();
|
||||
updateBuilder.updateColumnValue("modification_date",now);
|
||||
updateBuilder.where().eq("email",email);
|
||||
updateBuilder.update();
|
||||
|
||||
|
@ -127,8 +126,8 @@ public class UserDao {
|
|||
userDao = createUserDaoConnection();
|
||||
UpdateBuilder<User, String> updateBuilder = userDao.updateBuilder();
|
||||
updateBuilder.updateColumnValue("approved",true);
|
||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||
long now = Instant.now().toEpochMilli();
|
||||
updateBuilder.updateColumnValue("modification_date",now);
|
||||
updateBuilder.where().eq("email",email);
|
||||
updateBuilder.update();
|
||||
}
|
||||
|
@ -137,8 +136,8 @@ public class UserDao {
|
|||
userDao = createUserDaoConnection();
|
||||
UpdateBuilder<User, String> updateBuilder = userDao.updateBuilder();
|
||||
updateBuilder.updateColumnValue("verified",true);
|
||||
Timestamp timestamp = new Timestamp(System.currentTimeMillis());
|
||||
updateBuilder.updateColumnValue("modification_date",timestamp.getTime());
|
||||
long now = Instant.now().toEpochMilli();
|
||||
updateBuilder.updateColumnValue("modification_date",now);
|
||||
updateBuilder.where().eq("email",email);
|
||||
updateBuilder.update();
|
||||
}
|
||||
|
|
|
@ -47,12 +47,14 @@ public class TransactionImplementation {
|
|||
transaction.setTransaction_hash(txID);
|
||||
transaction.setTransaction_unit(transactionUnit);
|
||||
|
||||
|
||||
TransactionDao transactionDao = new TransactionDao();
|
||||
transactionDao.addTransaction(transaction);
|
||||
|
||||
returnResponse.put("success",true);
|
||||
returnResponse.put("message",txID);
|
||||
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
walletImplementation.updateWalletBalance(sourceWalletHash,destinationWalletHash,amount);
|
||||
} else {
|
||||
returnResponse.put("success",false);
|
||||
returnResponse.put("message","Destination wallet doesn't exist");
|
||||
|
|
|
@ -16,6 +16,7 @@ import javax.json.JsonReader;
|
|||
import java.io.StringReader;
|
||||
import java.time.Instant;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class WalletImplementation {
|
||||
|
@ -43,6 +44,7 @@ public class WalletImplementation {
|
|||
response.put("walletHash",wallet.getWallet_hash());
|
||||
response.put("walletType",wallet.getType());
|
||||
response.put("walletSold",wallet.getBalance().toString());
|
||||
response.put("ownerHash",wallet.getUser_hash());
|
||||
response.put("response","true");
|
||||
|
||||
return response;
|
||||
|
@ -98,6 +100,19 @@ public class WalletImplementation {
|
|||
|
||||
}
|
||||
|
||||
//update DB balance after transaction
|
||||
public void updateWalletBalance(String sourceWalletHash, String destinationWalletHash, double amount) throws Exception {
|
||||
WalletDao walletDao = new WalletDao();
|
||||
double balanceWalletSource = walletDao.getWallet(sourceWalletHash).getBalance();
|
||||
double balanceWalletDestination = walletDao.getWallet(destinationWalletHash).getBalance();
|
||||
|
||||
double newBalanceWalletSource = balanceWalletSource-amount;
|
||||
double newBalanceWalletDestination = balanceWalletDestination+amount;
|
||||
|
||||
walletDao.updateWalletBalance(sourceWalletHash,newBalanceWalletSource);
|
||||
walletDao.updateWalletBalance(destinationWalletHash,newBalanceWalletDestination);
|
||||
}
|
||||
|
||||
//transfer
|
||||
public void transferWallet(String walletHash, String newUserHash) throws Exception {
|
||||
TransactionWrapper transactionWrapper = new TransactionWrapper();
|
||||
|
@ -117,6 +132,19 @@ public class WalletImplementation {
|
|||
walletDao.deleteWallet(walletHash,userHash);
|
||||
}
|
||||
|
||||
//getAll
|
||||
public JsonArray getAllWallets() throws Exception {
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
JsonArray walletList = null;
|
||||
String response = queryWrapper.sendQuery("query_all_wallets",new String[]{});
|
||||
|
||||
if(response != null) {
|
||||
JsonReader reader = Json.createReader(new StringReader(response));
|
||||
walletList = reader.readArray();
|
||||
}
|
||||
return walletList;
|
||||
}
|
||||
|
||||
|
||||
private String generateWalletHash(String walletBuilderString){
|
||||
return BCrypt.hashpw(walletBuilderString,BCrypt.gensalt());
|
||||
|
|
|
@ -24,8 +24,7 @@ public class QueryWalletByOwnerTest {
|
|||
try{
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
String functionName = "queryWalletsByOwner";
|
||||
//String[] args = new String[]{"$2a$10$tdkMwJ7BQSOXO2uofu/fEOlncUfuX7SsjB.2N9KVsXJUQiarAQzpG"};
|
||||
String[] args = new String[]{"chef"};
|
||||
String[] args = new String[]{"$2a$10$EBoYmkW7mdss58LtrNvcg.Igtkx/Vyncnw3o0MA99SJi32UXyKgwe"};
|
||||
String response = queryWrapper.sendQuery(functionName,args);
|
||||
logger.info("response : "+response);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ public class ReadWalletTest {
|
|||
try{
|
||||
QueryWrapper queryWrapper = new QueryWrapper();
|
||||
String functionName = "readWallet";
|
||||
String[] args = new String[]{"$2a$10$B2bESpzYaYlGtuf69Y8HIu1.libPO5NGKRnatvd2R7K/vciTAj/DS"};
|
||||
String[] args = new String[]{"$2a$10$WN6ARfShm9bgRZ8s9bzZqejvL.VzZrjXRmZLj6N3U6No9G/YLVqVi"};
|
||||
String response = queryWrapper.sendQuery(functionName,args);
|
||||
|
||||
if(response!=null){
|
||||
|
|
100
src/test/java/restImplementation/CreateDataSetProcess.java
Normal file
100
src/test/java/restImplementation/CreateDataSetProcess.java
Normal file
|
@ -0,0 +1,100 @@
|
|||
package restImplementation;
|
||||
|
||||
import database.Wallet.Wallet;
|
||||
import database.user.User;
|
||||
import org.apache.log4j.BasicConfigurator;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
public class CreateDataSetProcess {
|
||||
private static Logger logger = Logger.getLogger(CreateDataSetProcess.class);
|
||||
private static String userHashA = "";
|
||||
private static String userHashB = "";
|
||||
private static String walletHash1UserA = "";
|
||||
private static String walletHash2UserA = "";
|
||||
private static String walletHash1UserB = "";
|
||||
private static String walletHash2UserB = "";
|
||||
|
||||
|
||||
public static void main(String [ ] args){
|
||||
BasicConfigurator.configure();
|
||||
User userA = new User("TotoName","TotoFirstName","TotoEmail@gmail.com","totoPassword1234$","gonette");
|
||||
User userB = new User("TataName","TataFirstName","TataEmail@gmail.com","tataPassword1234$","0607080900","gonette");
|
||||
|
||||
registerUser(userA);
|
||||
userA.setUser_hash(userHashA);
|
||||
registerUser(userB);
|
||||
userB.setUser_hash(userHashB);
|
||||
|
||||
approveUser(userA);
|
||||
approveUser(userB);
|
||||
|
||||
Wallet walletAUserA = new Wallet("client",userHashA);
|
||||
Wallet walletBUserA = new Wallet("fournisseur",userHashA);
|
||||
Wallet walletAUserB = new Wallet("client",userHashB);
|
||||
Wallet walletBUserB = new Wallet("personnel",userHashB);
|
||||
|
||||
createWallet(walletAUserA);
|
||||
createWallet(walletBUserA);
|
||||
createWallet(walletAUserB);
|
||||
createWallet(walletBUserB);
|
||||
|
||||
}
|
||||
|
||||
private static void registerUser(User user){
|
||||
UserImplementation userImplementation = new UserImplementation();
|
||||
try{
|
||||
Map<String,String> response = userImplementation.registerUser(user);
|
||||
if(Boolean.parseBoolean(response.get("response"))){
|
||||
String userHash = response.get("userHash");
|
||||
|
||||
if(user.getEmail().equals("TotoEmail@gmail.com")){
|
||||
userHashA = userHash;
|
||||
} else {
|
||||
userHashB = userHash;
|
||||
}
|
||||
|
||||
logger.info("User: "+user.getEmail()+". User hash: "+userHash);
|
||||
}
|
||||
} catch (Exception e){
|
||||
logger.warn("Error registerUser : "+e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void approveUser(User user){
|
||||
UserImplementation userImplementation = new UserImplementation();
|
||||
try{
|
||||
userImplementation.approveUser(user);
|
||||
}catch (Exception e){
|
||||
logger.warn("Error approveUser : "+e);
|
||||
}
|
||||
}
|
||||
|
||||
private static void createWallet(Wallet wallet){
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
try{
|
||||
Map<String,String> walletResponse = walletImplementation.createWallet(wallet);
|
||||
if(wallet.getUser_hash().equals(userHashA) && wallet.getType().equals("client")){
|
||||
walletHash1UserA = walletResponse.get("walletHash");
|
||||
} else if(wallet.getUser_hash().equals(userHashA) && wallet.getType().equals("fournisseur")){
|
||||
walletHash2UserA = walletResponse.get("walletHash");
|
||||
} else if(wallet.getUser_hash().equals(userHashB) && wallet.getType().equals("personnel")){
|
||||
walletHash1UserB = walletResponse.get("walletHash");
|
||||
} else {
|
||||
walletHash2UserB = walletResponse.get("walletHash");
|
||||
}
|
||||
|
||||
logger.info("wallet hash: "+walletResponse.get("walletHash"));
|
||||
logger.info("wallet sold: "+walletResponse.get("walletSold"));
|
||||
logger.info("wallet type: "+walletResponse.get("walletType"));
|
||||
logger.info("onwer: "+walletResponse.get("ownerHash"));
|
||||
|
||||
}catch (Exception e){
|
||||
logger.warn("Error approveUser : "+e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,27 @@
|
|||
package restImplementation;
|
||||
|
||||
import org.apache.log4j.Logger;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@Ignore
|
||||
public class TransactionImplementationTest {
|
||||
private static Logger logger = Logger.getLogger(TransactionImplementationTest.class);
|
||||
|
||||
@Test
|
||||
public void doTransaction(){
|
||||
TransactionImplementation transactionImplementation = new TransactionImplementation();
|
||||
try {
|
||||
HashMap transactionResponse = transactionImplementation.sendTransaction("$2a$10$WN6ARfShm9bgRZ8s9bzZqejvL.VzZrjXRmZLj6N3U6No9G/YLVqVi","$2a$10$7gIjefImB/xYvsOukIbk5.miCn88CE9pBfhz9xE5NE4HwQKZWcorS",1.0,"gonette");
|
||||
if(Boolean.parseBoolean(transactionResponse.get("success").toString())){
|
||||
logger.info("transaction ID: "+transactionResponse.get("message"));
|
||||
} else {
|
||||
logger.warn("Error (else) : "+transactionResponse.get("message"));
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,12 +11,8 @@ import java.util.Map;
|
|||
@Ignore
|
||||
public class UserImplementationTest {
|
||||
private static Logger logger = Logger.getLogger(UserImplementationTest.class);
|
||||
String userHash1 = null;
|
||||
String userHash2 = null;
|
||||
|
||||
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void RegisterUserWithoutPhone() { //OK
|
||||
BasicConfigurator.configure();
|
||||
|
@ -28,7 +24,6 @@ public class UserImplementationTest {
|
|||
logger.info("response is: "+response.get("response"));
|
||||
if(Boolean.parseBoolean(response.get("response"))){
|
||||
StringResponse responseS = new StringResponse("Ok",response.get("userHash"));
|
||||
userHash1 = responseS.getUserHash();
|
||||
logger.info("StringResponse is: "+responseS.getResponse()+". User hash: "+responseS.getUserHash());
|
||||
}
|
||||
} catch (Exception e){
|
||||
|
@ -47,7 +42,6 @@ public class UserImplementationTest {
|
|||
logger.info("response is: "+responseTest.get("response"));
|
||||
if(Boolean.parseBoolean(responseTest.get("response"))){
|
||||
StringResponse responseS = new StringResponse("Ok",responseTest.get("userHash"));
|
||||
userHash2 = responseS.getUserHash();
|
||||
logger.info("StringResponse is: "+responseS.getResponse()+". User hash: "+responseS.getUserHash());
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
@ -58,7 +52,7 @@ public class UserImplementationTest {
|
|||
@Test
|
||||
public void approveUser1Test() { //ok
|
||||
BasicConfigurator.configure();
|
||||
User userTest = new User("TotoEmail@gmail.com",userHash1);
|
||||
User userTest = new User("TotoEmail@gmail.com","");
|
||||
UserImplementation userImplementation = new UserImplementation();
|
||||
try {
|
||||
userImplementation.approveUser(userTest);
|
||||
|
@ -70,7 +64,7 @@ public class UserImplementationTest {
|
|||
@Test
|
||||
public void approveUser2Test() { //ok
|
||||
BasicConfigurator.configure();
|
||||
User userTest = new User("TataEmail@gmail.com",userHash2);
|
||||
User userTest = new User("TataEmail@gmail.com","");
|
||||
UserImplementation userImplementation = new UserImplementation();
|
||||
try {
|
||||
userImplementation.approveUser(userTest);
|
||||
|
@ -81,6 +75,7 @@ public class UserImplementationTest {
|
|||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void userLoggerTest(){ //OK
|
||||
BasicConfigurator.configure();
|
||||
|
@ -100,6 +95,7 @@ public class UserImplementationTest {
|
|||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void deleteUserTest(){ //OK
|
||||
BasicConfigurator.configure();
|
||||
|
@ -111,7 +107,8 @@ public class UserImplementationTest {
|
|||
logger.warn("Error: "+e);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -10,11 +10,11 @@ import java.util.Map;
|
|||
|
||||
@Ignore
|
||||
public class WalletImplementationTest {
|
||||
private static Logger logger = Logger.getLogger(UserImplementationTest.class);
|
||||
private static Logger logger = Logger.getLogger(WalletImplementationTest.class);
|
||||
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void UserACreateWallet() { // OK
|
||||
public void CreateWalletTest() { // OK
|
||||
BasicConfigurator.configure();
|
||||
Wallet wallet = new Wallet("client","$2a$10$tdkMwJ7BQSOXO2uofu/fEOlncUfuX7SsjB.2N9KVsXJUQiarAQzpG");
|
||||
|
||||
|
@ -33,76 +33,31 @@ public class WalletImplementationTest {
|
|||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void UserBCreateWallet() { //OK
|
||||
BasicConfigurator.configure();
|
||||
Wallet wallet = new Wallet("fournisseur","$2a$10$iMk/RWukka34xhF7drB7z.mb3YWbRh0qtunTpPXLbTBaZu2TxAOAW");
|
||||
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
try{
|
||||
Map<String,String> walletResponse = walletImplementation.createWallet(wallet);
|
||||
Wallet returnWallet = new Wallet();
|
||||
returnWallet.setWallet_hash(walletResponse.get("walletHash"));
|
||||
returnWallet.setBalance(Double.parseDouble(walletResponse.get("walletSold")));
|
||||
returnWallet.setType(walletResponse.get("walletType"));
|
||||
|
||||
logger.info("wallet hash: "+returnWallet.getWallet_hash());
|
||||
logger.info("wallet sold: "+returnWallet.getBalance());
|
||||
logger.info("wallet type: "+returnWallet.getType());
|
||||
} catch (Exception e){
|
||||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void UserB2CreateWallet() { //OK
|
||||
BasicConfigurator.configure();
|
||||
Wallet wallet = new Wallet("client","$2a$10$iMk/RWukka34xhF7drB7z.mb3YWbRh0qtunTpPXLbTBaZu2TxAOAW");
|
||||
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
try{
|
||||
Map<String,String> walletResponse = walletImplementation.createWallet(wallet);
|
||||
Wallet returnWallet = new Wallet();
|
||||
returnWallet.setWallet_hash(walletResponse.get("walletHash"));
|
||||
returnWallet.setBalance(Double.parseDouble(walletResponse.get("walletSold")));
|
||||
returnWallet.setType(walletResponse.get("walletType"));
|
||||
|
||||
logger.info("wallet hash: "+returnWallet.getWallet_hash());
|
||||
logger.info("wallet sold: "+returnWallet.getBalance());
|
||||
logger.info("wallet type: "+returnWallet.getType());
|
||||
} catch (Exception e){
|
||||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
/*
|
||||
@Test
|
||||
public void TestDeleteWallet() { //OK
|
||||
BasicConfigurator.configure();
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
try{
|
||||
walletImplementation.deleteWallet("$2a$10$X2xW3CH/q7nij8yJpQTao.vEnuV31lNSMPhTCjGNl4oFp6MXW/6w6","$2a$10$iMk/RWukka34xhF7drB7z.mb3YWbRh0qtunTpPXLbTBaZu2TxAOAW");
|
||||
walletImplementation.deleteWallet("$2a$10$xhnfRbiSLkgnmLuw8uTZVONV7GuNmdDsEGVgj/nFZFkWmwF8AVKd2","$2a$10$caS/2oNhOgbZSrZqM3X4A.ethKG/g3QDwBToTSdzYTGtIHIn9YJee");
|
||||
} catch (Exception e){
|
||||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void TestGetWallet(){ //OK
|
||||
BasicConfigurator.configure();
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
try{
|
||||
Wallet wallet = walletImplementation.getWallet("$2a$10$PuJBO70uMfzUwbQ/Qz9kTe7JYJppwetyLyP0e6JAITr3B6pQf0cbe");
|
||||
Wallet wallet = walletImplementation.getWallet("$2a$10$WN6ARfShm9bgRZ8s9bzZqejvL.VzZrjXRmZLj6N3U6No9G/YLVqVi");
|
||||
logger.info("Wallet hash : "+wallet.getWallet_hash());
|
||||
logger.info("Wallet owner : "+wallet.getUser_hash());
|
||||
logger.info("Wallet type : "+wallet.getType());
|
||||
|
@ -111,39 +66,17 @@ public class WalletImplementationTest {
|
|||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void TestSetBalance(){ //TODO
|
||||
public void TestSetBalance(){ //OK
|
||||
BasicConfigurator.configure();
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
try{
|
||||
walletImplementation.setBalanceToWallet("$2a$10$B2bESpzYaYlGtuf69Y8HIu1.libPO5NGKRnatvd2R7K/vciTAj/DS",20.0);
|
||||
} catch (Exception e){
|
||||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestTransferWalelt(){ //TODO
|
||||
BasicConfigurator.configure();
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
try{
|
||||
walletImplementation.transferWallet("$2a$10$PuJBO70uMfzUwbQ/Qz9kTe7JYJppwetyLyP0e6JAITr3B6pQf0cbe","$2a$10$tdkMwJ7BQSOXO2uofu/fEOlncUfuX7SsjB.2N9KVsXJUQiarAQzpG");
|
||||
} catch (Exception e){
|
||||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void TestGetUserWallet(){ //TODO
|
||||
BasicConfigurator.configure();
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
try{
|
||||
walletImplementation.getAllUserWallets("$2a$10$tdkMwJ7BQSOXO2uofu/fEOlncUfuX7SsjB.2N9KVsXJUQiarAQzpG");
|
||||
walletImplementation.setBalanceToWallet("$2a$10$WN6ARfShm9bgRZ8s9bzZqejvL.VzZrjXRmZLj6N3U6No9G/YLVqVi",50.0);
|
||||
} catch (Exception e){
|
||||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
|
@ -153,4 +86,31 @@ public class WalletImplementationTest {
|
|||
|
||||
|
||||
|
||||
@Test
|
||||
public void TestTransferWalelt(){ //OK
|
||||
BasicConfigurator.configure();
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
try{
|
||||
walletImplementation.transferWallet("$2a$10$yagSqyq3hM1XR1qfmrFHe.vclXqj0ctl2MFkMtb0FPYCdah1wvVta","$2a$10$EBoYmkW7mdss58LtrNvcg.Igtkx/Vyncnw3o0MA99SJi32UXyKgwe");
|
||||
} catch (Exception e){
|
||||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Test
|
||||
public void TestGetUserWallet(){ //TODO wait for chaincode correction
|
||||
BasicConfigurator.configure();
|
||||
WalletImplementation walletImplementation = new WalletImplementation();
|
||||
try{
|
||||
walletImplementation.getAllUserWallets("$2a$10$EBoYmkW7mdss58LtrNvcg.Igtkx/Vyncnw3o0MA99SJi32UXyKgwe");
|
||||
} catch (Exception e){
|
||||
logger.warn("Error: "+e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue