adminNetwork base

This commit is contained in:
danikov 2012-03-08 09:27:50 +00:00
parent 6dc3f8e045
commit 1c53a0402f
7 changed files with 186 additions and 2 deletions

View File

@ -33,6 +33,7 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.AdminOrgAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.AdminVdcAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.AdminNetworkAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.CatalogAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.GroupAsyncClient;
import org.jclouds.vcloud.director.v1_5.features.NetworkAsyncClient;
@ -128,7 +129,7 @@ public interface VCloudDirectorAsyncClient {
AdminCatalogAsyncClient getAdminCatalogClient();
/**
* @return asynchronous access to {@link Group} features
* @return asynchronous access to admin {@link Group} features
*/
@Delegate
GroupAsyncClient getGroupClient();
@ -150,4 +151,10 @@ public interface VCloudDirectorAsyncClient {
*/
@Delegate
AdminVdcAsyncClient getAdminVdcClient();
/**
* @return asynchronous access to admin {@link Network} features
*/
@Delegate
AdminNetworkAsyncClient getAdminNetworkClient();
}

View File

@ -36,6 +36,7 @@ import org.jclouds.vcloud.director.v1_5.domain.ovf.Network;
import org.jclouds.vcloud.director.v1_5.features.AdminCatalogClient;
import org.jclouds.vcloud.director.v1_5.features.AdminOrgClient;
import org.jclouds.vcloud.director.v1_5.features.AdminVdcClient;
import org.jclouds.vcloud.director.v1_5.features.AdminNetworkClient;
import org.jclouds.vcloud.director.v1_5.features.CatalogClient;
import org.jclouds.vcloud.director.v1_5.features.GroupClient;
import org.jclouds.vcloud.director.v1_5.features.MediaClient;
@ -132,7 +133,7 @@ public interface VCloudDirectorClient {
AdminCatalogClient getAdminCatalogClient();
/**
* @return synchronous access to {@link Group} features
* @return synchronous access to admin {@link Group} features
*/
@Delegate
GroupClient getGroupClient();
@ -154,4 +155,10 @@ public interface VCloudDirectorClient {
*/
@Delegate
AdminVdcClient getAdminVdcClient();
/**
* @return synchronous access to admin {@link Network} features
*/
@Delegate
AdminNetworkClient getAdminNetworkClient();
}

View File

@ -118,6 +118,7 @@ public class VCloudDirectorRestClientModule extends RestClientModule<VCloudDirec
.put(MetadataClient.Writeable.class, MetadataAsyncClient.Writable.class)
.put(GroupClient.class, GroupAsyncClient.class)
.put(UserClient.class, UserAsyncClient.class)
.put(AdminNetworkClient.class, AdminNetworkAsyncClient.class)
.build();
public VCloudDirectorRestClientModule() {

View File

@ -0,0 +1,37 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.features;
import org.jclouds.rest.annotations.RequestFilters;
import org.jclouds.vcloud.director.v1_5.filters.AddVCloudAuthorizationToRequest;
/**
* @see AdminNetworkClient
* @author danikov
*/
@RequestFilters(AddVCloudAuthorizationToRequest.class)
public interface AdminNetworkAsyncClient extends NetworkAsyncClient {
// GET /admin/network/{id}
// PUT /admin/network/{id}
// POST /admin/network/{id}/action/reset
}

View File

@ -0,0 +1,40 @@
/**
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.features;
import java.util.concurrent.TimeUnit;
import org.jclouds.concurrent.Timeout;
/**
* Provides synchronous access to admin {@link Network} objects.
*
* @see AdminNetworkAsyncClient
* @author danikov
*/
@Timeout(duration = 180, timeUnit = TimeUnit.SECONDS)
public interface AdminNetworkClient extends NetworkClient {
// GET /admin/network/{id}
// PUT /admin/network/{id}
// POST /admin/network/{id}/action/reset
}

View File

@ -0,0 +1,37 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.features;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorRestClientExpectTest;
import org.testng.annotations.Test;
/**
* Test the {@link GroupClient} by observing its side effects.
*
* @author danikov
*/
@Test(groups = { "unit", "user", "adminNetwork"}, singleThreaded = true, testName = "AdminNetworkClientExpectTest")
public class AdminNetworkClientExpectTest extends BaseVCloudDirectorRestClientExpectTest {
// GET /admin/network/{id}
// PUT /admin/network/{id}
// POST /admin/network/{id}/action/reset
}

View File

@ -0,0 +1,55 @@
/*
* Licensed to jclouds, Inc. (jclouds) under one or more
* contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. jclouds licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.jclouds.vcloud.director.v1_5.features;
import org.jclouds.vcloud.director.v1_5.internal.BaseVCloudDirectorClientLiveTest;
import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test;
/**
* Tests live behavior of {@link AdminCatalogClient}.
*
* @author danikov
*/
@Test(groups = { "live", "admin", "group" }, singleThreaded = true, testName = "CatalogClientLiveTest")
public class AdminNetworkLiveTest extends BaseVCloudDirectorClientLiveTest {
public static final String GROUP = "admin group";
/*
* Convenience references to API clients.
*/
private AdminNetworkClient networkClient;
/*
* Shared state between dependant tests.
*/
@BeforeClass(inheritGroups = true)
public void setupRequiredClients() {
networkClient = context.getApi().getAdminNetworkClient();
}
// GET /admin/network/{id}
// PUT /admin/network/{id}
// POST /admin/network/{id}/action/reset
}