Package com.github.ebnew.ki4so.core.key

Examples of com.github.ebnew.ki4so.core.key.KeyService


        key.setKeyId(keyId);
       
        Mockito.when(appService.findKi4soServerApp()).thenReturn(app);
        Mockito.when(appService.findAppByHost(service)).thenReturn(clientApp);
        
        KeyService keyService = Mockito.mock(KeyService.class);
        Mockito.when(keyService.findKeyByAppId(appId)).thenReturn(key);
        Mockito.when(keyService.findKeyByAppId(app2Id)).thenReturn(key);
       
        this.handler.setKeyService(keyService);
        EncryCredentialManager encryCredentialManager = Mockito.mock(EncryCredentialManager.class);
        Mockito.when(encryCredentialManager.encrypt(Mockito.any(EncryCredentialInfo.class))).thenReturn(encStringValue);
        this.handler.setEncryCredentialManager(encryCredentialManager);
View Full Code Here


  public void tearDown() throws Exception {
  }
 
  @Test
  public void testFetchKey() throws UnsupportedEncodingException {
    KeyService keyService = Mockito.mock(KeyService.class);
    Ki4soKey ki4soKey = Mockito.mock(Ki4soKey.class);
    Mockito.when(keyService.findKeyByAppId(Mockito.anyString())).thenReturn(ki4soKey);
    keyAction.setKeyService(keyService);
    Ki4soKey result = keyAction.fetchKey("100");
    Assert.assertTrue(ki4soKey==result);
  }
View Full Code Here

   
    /**
     * 测试传入的参数不合法的情况。
     */
    EncryCredentialInfo encryCredentialInfo = new EncryCredentialInfo();
    KeyService keyService = Mockito.mock(KeyService.class);
    encryCredentialManager.setKeyService(keyService);
    String result = encryCredentialManager.encrypt(encryCredentialInfo);
    checkData(result, encryCredentialInfo);
   
   
    /**
     * 设置模拟服务,查询到的key为null.
     */
    result = encryCredentialManager.encrypt(encryCredentialInfo);
    checkData(result, encryCredentialInfo);
   
    /**
     * 设置模拟服务,查询到的key不是null.
     */
    String keyId = "1001";
    Ki4soKey key = new Ki4soKey();
    key.setKeyId(keyId);
    key.setValue("dafdasfdasfds");
    encryCredentialInfo.setKeyId(keyId);
    Mockito.when(keyService.findKeyByKeyId(keyId)).thenReturn(key);
    result = encryCredentialManager.encrypt(encryCredentialInfo);
    checkData(result, encryCredentialInfo);
 
    /**
     * 测试正常的情况。
 
View Full Code Here

TOP

Related Classes of com.github.ebnew.ki4so.core.key.KeyService

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.