Search in sources :

Example 11 with VpnUser

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();
}
Also used : BasicNetworkTopology(org.apache.cloudstack.network.topology.BasicNetworkTopology) VpnUser(com.cloud.network.VpnUser) ArrayList(java.util.ArrayList) ResourceUnavailableException(com.cloud.exception.ResourceUnavailableException) AdvancedNetworkTopology(org.apache.cloudstack.network.topology.AdvancedNetworkTopology) RemoteAccessVpn(com.cloud.network.RemoteAccessVpn) Test(org.junit.Test)

Aggregations

VpnUser (com.cloud.network.VpnUser)11 ArrayList (java.util.ArrayList)6 Account (com.cloud.user.Account)5 Test (org.junit.Test)4 ResourceUnavailableException (com.cloud.exception.ResourceUnavailableException)3 RemoteAccessVpn (com.cloud.network.RemoteAccessVpn)3 AdvancedNetworkTopology (org.apache.cloudstack.network.topology.AdvancedNetworkTopology)3 BasicNetworkTopology (org.apache.cloudstack.network.topology.BasicNetworkTopology)3 ServerApiException (com.cloud.api.ServerApiException)2 VpnUsersResponse (com.cloud.api.response.VpnUsersResponse)2 DataCenterVO (com.cloud.dc.DataCenterVO)2 ServerApiException (org.apache.cloudstack.api.ServerApiException)2 VpnUsersResponse (org.apache.cloudstack.api.response.VpnUsersResponse)2 VpnUsersCfgCommand (com.cloud.agent.api.routing.VpnUsersCfgCommand)1 ListResponse (com.cloud.api.response.ListResponse)1 Domain (com.cloud.domain.Domain)1 Vpc (com.cloud.network.vpc.Vpc)1 RemoteAccessVpnService (com.cloud.network.vpn.RemoteAccessVpnService)1 AccountService (com.cloud.user.AccountService)1 DomainRouterVO (com.cloud.vm.DomainRouterVO)1