Package org.jclouds.cloudstack.features

Examples of org.jclouds.cloudstack.features.NetworkClient


   }

   @Override
   public Map<String, Network> get() {
      User currentUser = currentUserSupplier.get();
      NetworkClient networkClient = client.getNetworkClient();
      return Maps.uniqueIndex(
            networkClient.listNetworks(accountInDomain(currentUser.getAccount(), currentUser.getDomainId())),
            new Function<Network, String>() {

               @Override
               public String apply(Network arg0) {
                  return arg0.getId();
View Full Code Here


    @Test
    public void testEnsureNetworkExistsWithProvidedExistingNetwork() throws Exception {
        final String networkId = "network-id-0123";
        final CloudStackClient mockClient = mock(CloudStackClient.class);
        final NetworkClient mockNetworkClient = mock(NetworkClient.class);
        final Network mockNetwork = mock(Network.class);
        final org.apache.provisionr.api.network.Network network = org.apache.provisionr.api.network.Network.builder()
            .option(NetworkOptions.EXISTING_NETWORK_ID, networkId).createNetwork();

        execution.setVariable(ProcessVariables.NETWORK_ID, networkId);

        when(pool.getNetwork()).thenReturn(network);
        when(mockClient.getNetworkClient()).thenReturn(mockNetworkClient);
        when(mockNetworkClient.getNetwork(networkId)).thenReturn(mockNetwork);
        when(mockNetwork.getId()).thenReturn(networkId);

        activity.execute(mockClient, pool, execution);
        assertThat(collector.getVariable(ProcessVariables.NETWORK_ID)).isEqualTo(networkId);
    }
View Full Code Here

   }

   @Override
   public Map<String, Network> get() {
      User currentUser = currentUserSupplier.get();
      NetworkClient networkClient = client.getNetworkClient();
      return Maps.uniqueIndex(
            networkClient.listNetworks(accountInDomain(currentUser.getAccount(), currentUser.getDomainId())),
            new Function<Network, String>() {

               @Override
               public String apply(Network arg0) {
                  return arg0.getId();
View Full Code Here

    @Test
    public void testEnsureNetworkExistsWithProvidedExistingNetwork() throws Exception {
        final String networkId = "network-id-0123";
        final CloudStackClient mockClient = mock(CloudStackClient.class);
        final NetworkClient mockNetworkClient = mock(NetworkClient.class);
        final Network mockNetwork = mock(Network.class);
        final com.axemblr.provisionr.api.network.Network network = com.axemblr.provisionr.api.network.Network.builder()
            .option(NetworkOptions.EXISTING_NETWORK_ID, networkId).createNetwork();

        execution.setVariable(ProcessVariables.NETWORK_ID, networkId);

        when(pool.getNetwork()).thenReturn(network);
        when(mockClient.getNetworkClient()).thenReturn(mockNetworkClient);
        when(mockNetworkClient.getNetwork(networkId)).thenReturn(mockNetwork);
        when(mockNetwork.getId()).thenReturn(networkId);

        activity.execute(mockClient, pool, execution);
        assertThat(collector.getVariable(ProcessVariables.NETWORK_ID)).isEqualTo(networkId);
    }
View Full Code Here

TOP

Related Classes of org.jclouds.cloudstack.features.NetworkClient

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.