u
This commit is contained in:
parent
0589eb6bc6
commit
b74705ccfa
Binary file not shown.
|
@ -1,11 +1,37 @@
|
||||||
package restService;
|
package restService;
|
||||||
|
|
||||||
|
import blockchain.client.CAClientWrapper;
|
||||||
|
import blockchain.configuration.Config;
|
||||||
|
import blockchain.user.UserContext;
|
||||||
|
import org.hyperledger.fabric.sdk.Enrollment;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
|
import static org.junit.Assert.assertEquals;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
public class WelcomeResource {
|
public class WelcomeResource {
|
||||||
@RequestMapping("/")
|
@RequestMapping("/")
|
||||||
public String index(){return "Welcome from Monnethic !";}
|
public String index(){return "Welcome from Monnethic !";}
|
||||||
|
|
||||||
|
@RequestMapping("/bc/register/admin")
|
||||||
|
@ResponseStatus(HttpStatus.INTERNAL_SERVER_ERROR)
|
||||||
|
public void registerAdminApp(){
|
||||||
|
String caUrl = Config.CA_ORG1_URL;
|
||||||
|
try {
|
||||||
|
CAClientWrapper caClientWrapper = new CAClientWrapper(caUrl,null);
|
||||||
|
UserContext adminContext = new UserContext();
|
||||||
|
adminContext.setName(Config.ADMIN);
|
||||||
|
adminContext.setAffiliation(Config.ORG1);
|
||||||
|
adminContext.setMspId(Config.ORG1_MSP);
|
||||||
|
caClientWrapper.setAdminContext(adminContext);
|
||||||
|
caClientWrapper.enrollAdmin(adminContext.getName(),Config.ADMIN_PASSWORD,adminContext.getAffiliation());
|
||||||
|
}catch (Exception e){
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -35,6 +35,8 @@ public class WalletImplementationTest {
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void TestDeleteWallet() { //OK
|
public void TestDeleteWallet() { //OK
|
||||||
BasicConfigurator.configure();
|
BasicConfigurator.configure();
|
||||||
|
@ -82,15 +84,16 @@ public class WalletImplementationTest {
|
||||||
logger.warn("Error: "+e.getMessage());
|
logger.warn("Error: "+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
@Test
|
@Test
|
||||||
public void TestGetUserWallet(){ //OK
|
public void TestGetUserWallet(){ //OK
|
||||||
BasicConfigurator.configure();
|
BasicConfigurator.configure();
|
||||||
WalletImplementation walletImplementation = new WalletImplementation();
|
WalletImplementation walletImplementation = new WalletImplementation();
|
||||||
try{
|
try{
|
||||||
walletImplementation.getAllUserWallets("$2a$10$EBoYmkW7mdss58LtrNvcg.Igtkx/Vyncnw3o0MA99SJi32UXyKgwe");
|
walletImplementation.getAllUserWallets("$2a$10$r7jlPdeESPFd1dKjvrEmB.SoxOXh3jHtWiPTAFKB3lGSgvda.zMyC");
|
||||||
} catch (Exception e){
|
} catch (Exception e){
|
||||||
logger.warn("Error: "+e.getMessage());
|
logger.warn("Error: "+e.getMessage());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue