Search in sources :

Example 6 with AccountService

use of com.cloud.user.AccountService in project cosmic by MissionCriticalCloud.

the class AddVpnUserCmdTest method testCreateSuccess.

@Test
public void testCreateSuccess() {
    final AccountService accountService = Mockito.mock(AccountService.class);
    final Account account = Mockito.mock(Account.class);
    Mockito.when(accountService.getAccount(Matchers.anyLong())).thenReturn(account);
    addVpnUserCmd._accountService = accountService;
    final RemoteAccessVpnService ravService = Mockito.mock(RemoteAccessVpnService.class);
    final VpnUser vpnUser = Mockito.mock(VpnUser.class);
    Mockito.when(ravService.addVpnUser(Matchers.anyLong(), Matchers.anyString(), Matchers.anyString())).thenReturn(vpnUser);
    addVpnUserCmd._ravService = ravService;
    addVpnUserCmd.create();
}
Also used : Account(com.cloud.user.Account) VpnUser(com.cloud.network.VpnUser) AccountService(com.cloud.user.AccountService) RemoteAccessVpnService(com.cloud.network.vpn.RemoteAccessVpnService) Test(org.junit.Test)

Aggregations

Account (com.cloud.user.Account)6 AccountService (com.cloud.user.AccountService)6 Test (org.junit.Test)6 RemoteAccessVpnService (com.cloud.network.vpn.RemoteAccessVpnService)4 ServerApiException (org.apache.cloudstack.api.ServerApiException)3 VpnUser (com.cloud.network.VpnUser)2 VolumeApiService (com.cloud.storage.VolumeApiService)2 ExpectedException (org.junit.rules.ExpectedException)2 ArgumentMatchers.anyLong (org.mockito.ArgumentMatchers.anyLong)2 Matchers.anyLong (org.mockito.Matchers.anyLong)2 ServerApiException (com.cloud.api.ServerApiException)1 Snapshot (com.cloud.storage.Snapshot)1 HashMap (java.util.HashMap)1 Map (java.util.Map)1 ResponseGenerator (org.apache.cloudstack.api.ResponseGenerator)1 SnapshotResponse (org.apache.cloudstack.api.response.SnapshotResponse)1