use of com.cloud.network.VpnUser in project cosmic by MissionCriticalCloud.
the class VpcVirtualRouterElementTest method testApplyVpnUsersException1.
@Test
public void testApplyVpnUsersException1() {
vpcVirtualRouterElement._vpcRouterMgr = _vpcRouterMgr;
final AdvancedNetworkTopology advancedNetworkTopology = Mockito.mock(AdvancedNetworkTopology.class);
final BasicNetworkTopology basicNetworkTopology = Mockito.mock(BasicNetworkTopology.class);
networkTopologyContext.setAdvancedNetworkTopology(advancedNetworkTopology);
networkTopologyContext.setBasicNetworkTopology(basicNetworkTopology);
networkTopologyContext.init();
final RemoteAccessVpn remoteAccessVpn = Mockito.mock(RemoteAccessVpn.class);
final List<VpnUser> users = new ArrayList<>();
when(remoteAccessVpn.getVpcId()).thenReturn(null);
try {
final String[] results = vpcVirtualRouterElement.applyVpnUsers(remoteAccessVpn, users);
assertNull(results);
} catch (final ResourceUnavailableException e) {
fail(e.getMessage());
}
verify(remoteAccessVpn, times(1)).getVpcId();
}
use of com.cloud.network.VpnUser in project cloudstack by apache.
the class AddVpnUserCmd method create.
@Override
public void create() {
Account owner = _accountService.getAccount(getEntityOwnerId());
VpnUser vpnUser = _ravService.addVpnUser(owner.getId(), userName, password);
if (vpnUser == null) {
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to add vpn user");
}
setEntityId(vpnUser.getId());
setEntityUuid(vpnUser.getUuid());
}
use of com.cloud.network.VpnUser in project cloudstack by apache.
the class AddVpnUserCmdTest method testCreateSuccess.
@Test
public void testCreateSuccess() {
AccountService accountService = Mockito.mock(AccountService.class);
Account account = Mockito.mock(Account.class);
Mockito.when(accountService.getAccount(nullable(Long.class))).thenReturn(account);
addVpnUserCmd._accountService = accountService;
RemoteAccessVpnService ravService = Mockito.mock(RemoteAccessVpnService.class);
VpnUser vpnUser = Mockito.mock(VpnUser.class);
Mockito.when(ravService.addVpnUser(anyLong(), isNull(), isNull())).thenReturn(vpnUser);
addVpnUserCmd._ravService = ravService;
addVpnUserCmd.create();
}
use of com.cloud.network.VpnUser in project cloudstack by apache.
the class VpcVirtualRouterElementTest method testApplyVpnUsersException1.
@Test
public void testApplyVpnUsersException1() {
vpcVirtualRouterElement._vpcRouterMgr = _vpcRouterMgr;
final AdvancedNetworkTopology advancedNetworkTopology = Mockito.mock(AdvancedNetworkTopology.class);
final BasicNetworkTopology basicNetworkTopology = Mockito.mock(BasicNetworkTopology.class);
networkTopologyContext.setAdvancedNetworkTopology(advancedNetworkTopology);
networkTopologyContext.setBasicNetworkTopology(basicNetworkTopology);
networkTopologyContext.init();
final RemoteAccessVpn remoteAccessVpn = Mockito.mock(RemoteAccessVpn.class);
final List<VpnUser> users = new ArrayList<VpnUser>();
when(remoteAccessVpn.getVpcId()).thenReturn(null);
try {
final String[] results = vpcVirtualRouterElement.applyVpnUsers(remoteAccessVpn, users);
assertNull(results);
} catch (final ResourceUnavailableException e) {
fail(e.getMessage());
}
verify(remoteAccessVpn, times(1)).getVpcId();
}
Aggregations