Code Formatting commit.

This commit is contained in:
vijaykiran 2011-10-29 16:03:15 +02:00
parent 60f70a0589
commit 6d4ce41d15
39 changed files with 472 additions and 459 deletions

View File

@ -18,15 +18,16 @@
*/ */
package org.jclouds.cloudstack; package org.jclouds.cloudstack;
import com.google.inject.TypeLiteral; import java.io.IOException;
import java.util.concurrent.ExecutionException;
import org.jclouds.cloudstack.features.BaseCloudStackAsyncClientTest; import org.jclouds.cloudstack.features.BaseCloudStackAsyncClientTest;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.rest.internal.RestAnnotationProcessor; import org.jclouds.rest.internal.RestAnnotationProcessor;
import org.testng.annotations.BeforeClass; import org.testng.annotations.BeforeClass;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import java.io.IOException; import com.google.inject.TypeLiteral;
import java.util.concurrent.ExecutionException;
/** /**
* Tests behavior of {@code CloudStackAsyncClient} * Tests behavior of {@code CloudStackAsyncClient}

View File

@ -38,7 +38,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "AccountAsyncClientTest") @Test(groups = "unit", testName = "AccountAsyncClientTest")
public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<AccountAsyncClient> { public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<AccountAsyncClient> {
@ -61,8 +62,8 @@ public class AccountAsyncClientTest extends BaseCloudStackAsyncClientTest<Accoun
public void testListAccountsOptions() throws SecurityException, NoSuchMethodException, IOException { public void testListAccountsOptions() throws SecurityException, NoSuchMethodException, IOException {
Method method = AccountAsyncClient.class.getMethod("listAccounts", ListAccountsOptions[].class); Method method = AccountAsyncClient.class.getMethod("listAccounts", ListAccountsOptions[].class);
HttpRequest httpRequest = processor.createRequest(method, ListAccountsOptions.Builder.accountInDomain("jclouds", HttpRequest httpRequest = processor.createRequest(method,
123)); ListAccountsOptions.Builder.accountInDomain("jclouds", 123));
assertRequestLineEquals(httpRequest, assertRequestLineEquals(httpRequest,
"GET http://localhost:8080/client/api?response=json&command=listAccounts&account=jclouds&domainid=123 HTTP/1.1"); "GET http://localhost:8080/client/api?response=json&command=listAccounts&account=jclouds&domainid=123 HTTP/1.1");

View File

@ -18,12 +18,12 @@
*/ */
package org.jclouds.cloudstack.features; package org.jclouds.cloudstack.features;
import static org.testng.Assert.assertEquals;
import org.jclouds.cloudstack.domain.Account; import org.jclouds.cloudstack.domain.Account;
import org.jclouds.cloudstack.domain.User; import org.jclouds.cloudstack.domain.User;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import static org.testng.Assert.assertEquals;
/** /**
* Tests behavior of {@code AccountClient} * Tests behavior of {@code AccountClient}
* *

View File

@ -26,9 +26,9 @@ import org.jclouds.cloudstack.options.AssociateIPAddressOptions;
import org.jclouds.cloudstack.options.ListPublicIPAddressesOptions; import org.jclouds.cloudstack.options.ListPublicIPAddressesOptions;
import org.jclouds.functions.IdentityFunction; import org.jclouds.functions.IdentityFunction;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.UnwrapOnlyJsonValue; import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions; import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404; import org.jclouds.rest.functions.ReturnNullOnNotFoundOr404;
@ -43,12 +43,12 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "AddressAsyncClientTest") @Test(groups = "unit", testName = "AddressAsyncClientTest")
public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<AddressAsyncClient> { public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<AddressAsyncClient> {
public void testListPublicIPAddresses() throws SecurityException, NoSuchMethodException, IOException { public void testListPublicIPAddresses() throws SecurityException, NoSuchMethodException, IOException {
Method method = AddressAsyncClient.class.getMethod("listPublicIPAddresses", Method method = AddressAsyncClient.class.getMethod("listPublicIPAddresses", ListPublicIPAddressesOptions[].class);
ListPublicIPAddressesOptions[].class);
HttpRequest httpRequest = processor.createRequest(method); HttpRequest httpRequest = processor.createRequest(method);
assertRequestLineEquals(httpRequest, assertRequestLineEquals(httpRequest,
@ -65,8 +65,7 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
} }
public void testListPublicIPAddressesOptions() throws SecurityException, NoSuchMethodException, IOException { public void testListPublicIPAddressesOptions() throws SecurityException, NoSuchMethodException, IOException {
Method method = AddressAsyncClient.class.getMethod("listPublicIPAddresses", Method method = AddressAsyncClient.class.getMethod("listPublicIPAddresses", ListPublicIPAddressesOptions[].class);
ListPublicIPAddressesOptions[].class);
HttpRequest httpRequest = processor.createRequest(method, HttpRequest httpRequest = processor.createRequest(method,
ListPublicIPAddressesOptions.Builder.accountInDomain("adrian", 6).usesVirtualNetwork(true)); ListPublicIPAddressesOptions.Builder.accountInDomain("adrian", 6).usesVirtualNetwork(true));
@ -103,12 +102,11 @@ public class AddressAsyncClientTest extends BaseCloudStackAsyncClientTest<Addres
} }
public void testAssociateIPAddressInZone() throws SecurityException, NoSuchMethodException, IOException { public void testAssociateIPAddressInZone() throws SecurityException, NoSuchMethodException, IOException {
Method method = AddressAsyncClient.class.getMethod("associateIPAddressInZone", Method method = AddressAsyncClient.class.getMethod("associateIPAddressInZone", long.class,
long.class, AssociateIPAddressOptions[].class); AssociateIPAddressOptions[].class);
HttpRequest httpRequest = processor.createRequest(method, 6); HttpRequest httpRequest = processor.createRequest(method, 6);
assertRequestLineEquals( assertRequestLineEquals(httpRequest,
httpRequest,
"GET http://localhost:8080/client/api?response=json&command=associateIpAddress&zoneid=6 HTTP/1.1"); "GET http://localhost:8080/client/api?response=json&command=associateIpAddress&zoneid=6 HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);

View File

@ -37,7 +37,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "AsyncJobAsyncClientTest") @Test(groups = "unit", testName = "AsyncJobAsyncClientTest")
public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<AsyncJobAsyncClient> { public class AsyncJobAsyncClientTest extends BaseCloudStackAsyncClientTest<AsyncJobAsyncClient> {

View File

@ -58,7 +58,8 @@ public class AsyncJobClientLiveTest extends BaseCloudStackClientLiveTest {
assert query.getResultCode() >= 0 : query; assert query.getResultCode() >= 0 : query;
assert query.getProgress() >= 0 : query; assert query.getProgress() >= 0 : query;
if (query.getResultCode() == 0) { if (query.getResultCode() == 0) {
if (query.getResult() != null)// null is ok for result of success = true if (query.getResult() != null)// null is ok for result of success =
// true
// ensure we parsed properly // ensure we parsed properly
assert (query.getResult().getClass().getPackage().equals(AsyncJob.class.getPackage())) : query; assert (query.getResult().getClass().getPackage().equals(AsyncJob.class.getPackage())) : query;
} else if (query.getResultCode() > 400) { } else if (query.getResultCode() > 400) {

View File

@ -130,8 +130,8 @@ public class BaseCloudStackClientLiveTest {
if (currentUser.getAccountType() != Account.Type.USER) if (currentUser.getAccountType() != Account.Type.USER)
throw new IllegalArgumentException(String.format( throw new IllegalArgumentException(String.format(
"invalid account type: %s, please specify an apiKey of a USER, for example: %s", currentUser "invalid account type: %s, please specify an apiKey of a USER, for example: %s",
.getAccountType(), Iterables.filter(users, UserPredicates.isUserAccount()))); currentUser.getAccountType(), Iterables.filter(users, UserPredicates.isUserAccount())));
injector = Guice.createInjector(new SshjSshClientModule(), new Log4JLoggingModule()); injector = Guice.createInjector(new SshjSshClientModule(), new Log4JLoggingModule());
sshFactory = injector.getInstance(SshClient.Factory.class); sshFactory = injector.getInstance(SshClient.Factory.class);

View File

@ -34,7 +34,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "ConfigurationAsyncClientTest") @Test(groups = "unit", testName = "ConfigurationAsyncClientTest")
public class ConfigurationAsyncClientTest extends BaseCloudStackAsyncClientTest<ConfigurationAsyncClient> { public class ConfigurationAsyncClientTest extends BaseCloudStackAsyncClientTest<ConfigurationAsyncClient> {

View File

@ -23,9 +23,9 @@ import java.lang.reflect.Method;
import org.jclouds.cloudstack.options.ListPortForwardingRulesOptions; import org.jclouds.cloudstack.options.ListPortForwardingRulesOptions;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.http.functions.ReleasePayloadAndReturn; import org.jclouds.http.functions.ReleasePayloadAndReturn;
import org.jclouds.http.functions.UnwrapOnlyJsonValue; import org.jclouds.http.functions.UnwrapOnlyJsonValue;
import org.jclouds.http.functions.ParseFirstJsonValueNamed;
import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions; import org.jclouds.rest.functions.MapHttp4xxCodesToExceptions;
import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404; import org.jclouds.rest.functions.ReturnEmptySetOnNotFoundOr404;
import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404; import org.jclouds.rest.functions.ReturnVoidOnNotFoundOr404;
@ -39,7 +39,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "FirewallAsyncClientTest") @Test(groups = "unit", testName = "FirewallAsyncClientTest")
public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<FirewallAsyncClient> { public class FirewallAsyncClientTest extends BaseCloudStackAsyncClientTest<FirewallAsyncClient> {
public void testListPortForwardingRules() throws SecurityException, NoSuchMethodException, IOException { public void testListPortForwardingRules() throws SecurityException, NoSuchMethodException, IOException {

View File

@ -40,7 +40,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "GuestOSAsyncClientTest") @Test(groups = "unit", testName = "GuestOSAsyncClientTest")
public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestOSAsyncClient> { public class GuestOSAsyncClientTest extends BaseCloudStackAsyncClientTest<GuestOSAsyncClient> {

View File

@ -23,8 +23,8 @@ import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.Map.Entry; import java.util.Map.Entry;
import java.util.Set;
import org.jclouds.cloudstack.domain.OSType; import org.jclouds.cloudstack.domain.OSType;
import org.jclouds.cloudstack.options.ListOSTypesOptions; import org.jclouds.cloudstack.options.ListOSTypesOptions;

View File

@ -34,7 +34,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "HypervisorAsyncClientTest") @Test(groups = "unit", testName = "HypervisorAsyncClientTest")
public class HypervisorAsyncClientTest extends BaseCloudStackAsyncClientTest<HypervisorAsyncClient> { public class HypervisorAsyncClientTest extends BaseCloudStackAsyncClientTest<HypervisorAsyncClient> {

View File

@ -38,7 +38,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "LoadBalancerAsyncClientTest") @Test(groups = "unit", testName = "LoadBalancerAsyncClientTest")
public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<LoadBalancerAsyncClient> { public class LoadBalancerAsyncClientTest extends BaseCloudStackAsyncClientTest<LoadBalancerAsyncClient> {
public void testListLoadBalancerRules() throws SecurityException, NoSuchMethodException, IOException { public void testListLoadBalancerRules() throws SecurityException, NoSuchMethodException, IOException {

View File

@ -28,11 +28,11 @@ import java.util.Set;
import java.util.concurrent.TimeUnit; import java.util.concurrent.TimeUnit;
import org.jclouds.cloudstack.domain.LoadBalancerRule; import org.jclouds.cloudstack.domain.LoadBalancerRule;
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
import org.jclouds.cloudstack.domain.LoadBalancerRule.State;
import org.jclouds.cloudstack.domain.Network; import org.jclouds.cloudstack.domain.Network;
import org.jclouds.cloudstack.domain.PublicIPAddress; import org.jclouds.cloudstack.domain.PublicIPAddress;
import org.jclouds.cloudstack.domain.VirtualMachine; import org.jclouds.cloudstack.domain.VirtualMachine;
import org.jclouds.cloudstack.domain.LoadBalancerRule.Algorithm;
import org.jclouds.cloudstack.domain.LoadBalancerRule.State;
import org.jclouds.cloudstack.predicates.LoadBalancerRuleActive; import org.jclouds.cloudstack.predicates.LoadBalancerRuleActive;
import org.jclouds.cloudstack.predicates.NetworkPredicates; import org.jclouds.cloudstack.predicates.NetworkPredicates;
import org.jclouds.net.IPSocket; import org.jclouds.net.IPSocket;
@ -110,7 +110,8 @@ public class LoadBalancerClientLiveTest extends BaseCloudStackClientLiveTest {
loopAndCheckSSH(); loopAndCheckSSH();
} }
// note that when in LB mode, there's a chance you'll have a connection failure // note that when in LB mode, there's a chance you'll have a connection
// failure
private void loopAndCheckSSH() throws IOException { private void loopAndCheckSSH() throws IOException {
for (int i = 0; i < 5; i++) {// retry loop TODO replace with predicate. for (int i = 0; i < 5; i++) {// retry loop TODO replace with predicate.
try { try {

View File

@ -40,7 +40,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "NATAsyncClientTest") @Test(groups = "unit", testName = "NATAsyncClientTest")
public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncClient> { public class NATAsyncClientTest extends BaseCloudStackAsyncClientTest<NATAsyncClient> {
public void testListIPForwardingRules() throws SecurityException, NoSuchMethodException, IOException { public void testListIPForwardingRules() throws SecurityException, NoSuchMethodException, IOException {

View File

@ -41,7 +41,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "NetworkAsyncClientTest") @Test(groups = "unit", testName = "NetworkAsyncClientTest")
public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<NetworkAsyncClient> { public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<NetworkAsyncClient> {
public void testListNetworks() throws SecurityException, NoSuchMethodException, IOException { public void testListNetworks() throws SecurityException, NoSuchMethodException, IOException {
@ -102,7 +103,8 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
String.class, CreateNetworkOptions[].class); String.class, CreateNetworkOptions[].class);
HttpRequest httpRequest = processor.createRequest(method, 1, 2, "named", "lovely"); HttpRequest httpRequest = processor.createRequest(method, 1, 2, "named", "lovely");
assertRequestLineEquals(httpRequest, assertRequestLineEquals(
httpRequest,
"GET http://localhost:8080/client/api?response=json&command=createNetwork&zoneid=1&name=named&networkofferingid=2&displaytext=lovely HTTP/1.1"); "GET http://localhost:8080/client/api?response=json&command=createNetwork&zoneid=1&name=named&networkofferingid=2&displaytext=lovely HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);
@ -122,7 +124,8 @@ public class NetworkAsyncClientTest extends BaseCloudStackAsyncClientTest<Networ
HttpRequest httpRequest = processor.createRequest(method, 1, 2, "named", "lovely", CreateNetworkOptions.Builder HttpRequest httpRequest = processor.createRequest(method, 1, 2, "named", "lovely", CreateNetworkOptions.Builder
.netmask("255.255.255.0").domainId(6)); .netmask("255.255.255.0").domainId(6));
assertRequestLineEquals(httpRequest, assertRequestLineEquals(
httpRequest,
"GET http://localhost:8080/client/api?response=json&command=createNetwork&zoneid=1&name=named&networkofferingid=2&displaytext=lovely&netmask=255.255.255.0&domainid=6 HTTP/1.1"); "GET http://localhost:8080/client/api?response=json&command=createNetwork&zoneid=1&name=named&networkofferingid=2&displaytext=lovely&netmask=255.255.255.0&domainid=6 HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);

View File

@ -40,7 +40,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "ServiceOfferingAsyncClientTest") @Test(groups = "unit", testName = "ServiceOfferingAsyncClientTest")
public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<OfferingAsyncClient> { public class OfferingAsyncClientTest extends BaseCloudStackAsyncClientTest<OfferingAsyncClient> {
public void testListDiskOfferings() throws SecurityException, NoSuchMethodException, IOException { public void testListDiskOfferings() throws SecurityException, NoSuchMethodException, IOException {

View File

@ -46,7 +46,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "SecurityGroupAsyncClientTest") @Test(groups = "unit", testName = "SecurityGroupAsyncClientTest")
public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<SecurityGroupAsyncClient> { public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<SecurityGroupAsyncClient> {
@ -124,8 +125,8 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
public void testAuthorizeIngressPortsToCIDRs() throws SecurityException, NoSuchMethodException, IOException { public void testAuthorizeIngressPortsToCIDRs() throws SecurityException, NoSuchMethodException, IOException {
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressPortsToCIDRs", long.class, Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressPortsToCIDRs", long.class,
String.class, int.class, int.class, Iterable.class, AccountInDomainOptions[].class); String.class, int.class, int.class, Iterable.class, AccountInDomainOptions[].class);
HttpRequest httpRequest = processor.createRequest(method, 2, "tcp", 22, 22, ImmutableSet.of("1.1.1.1/24", HttpRequest httpRequest = processor.createRequest(method, 2, "tcp", 22, 22,
"1.2.2.2/16")); ImmutableSet.of("1.1.1.1/24", "1.2.2.2/16"));
assertRequestLineEquals( assertRequestLineEquals(
httpRequest, httpRequest,
@ -144,8 +145,8 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
public void testAuthorizeIngressPortsToSecurityGroups() throws SecurityException, NoSuchMethodException, IOException { public void testAuthorizeIngressPortsToSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressPortsToSecurityGroups", long.class, Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressPortsToSecurityGroups", long.class,
String.class, int.class, int.class, Multimap.class, AccountInDomainOptions[].class); String.class, int.class, int.class, Multimap.class, AccountInDomainOptions[].class);
HttpRequest httpRequest = processor.createRequest(method, 2, "tcp", 22, 22, ImmutableMultimap.of("adrian", HttpRequest httpRequest = processor.createRequest(method, 2, "tcp", 22, 22,
"group1", "adrian", "group2", "bob", "group1")); ImmutableMultimap.of("adrian", "group1", "adrian", "group2", "bob", "group1"));
assertRequestLineEquals( assertRequestLineEquals(
httpRequest, httpRequest,
@ -183,8 +184,8 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
public void testAuthorizeIngressICMPToSecurityGroups() throws SecurityException, NoSuchMethodException, IOException { public void testAuthorizeIngressICMPToSecurityGroups() throws SecurityException, NoSuchMethodException, IOException {
Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressICMPToSecurityGroups", long.class, Method method = SecurityGroupAsyncClient.class.getMethod("authorizeIngressICMPToSecurityGroups", long.class,
int.class, int.class, Multimap.class, AccountInDomainOptions[].class); int.class, int.class, Multimap.class, AccountInDomainOptions[].class);
HttpRequest httpRequest = processor.createRequest(method, 2, 22, 22, ImmutableMultimap.of("adrian", "group1", HttpRequest httpRequest = processor.createRequest(method, 2, 22, 22,
"adrian", "group2", "bob", "group1")); ImmutableMultimap.of("adrian", "group1", "adrian", "group2", "bob", "group1"));
assertRequestLineEquals( assertRequestLineEquals(
httpRequest, httpRequest,
@ -203,10 +204,11 @@ public class SecurityGroupAsyncClientTest extends BaseCloudStackAsyncClientTest<
public void testRevokeIngressRule() throws SecurityException, NoSuchMethodException, IOException { public void testRevokeIngressRule() throws SecurityException, NoSuchMethodException, IOException {
Method method = SecurityGroupAsyncClient.class.getMethod("revokeIngressRule", long.class, Method method = SecurityGroupAsyncClient.class.getMethod("revokeIngressRule", long.class,
AccountInDomainOptions[].class); AccountInDomainOptions[].class);
HttpRequest httpRequest = processor.createRequest(method, 5, AccountInDomainOptions.Builder.accountInDomain( HttpRequest httpRequest = processor.createRequest(method, 5,
"adrian", 1)); AccountInDomainOptions.Builder.accountInDomain("adrian", 1));
assertRequestLineEquals(httpRequest, assertRequestLineEquals(
httpRequest,
"GET http://localhost:8080/client/api?response=json&command=revokeSecurityGroupIngress&id=5&account=adrian&domainid=1 HTTP/1.1"); "GET http://localhost:8080/client/api?response=json&command=revokeSecurityGroupIngress&id=5&account=adrian&domainid=1 HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);

View File

@ -39,7 +39,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "TemplateAsyncClientTest") @Test(groups = "unit", testName = "TemplateAsyncClientTest")
public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<TemplateAsyncClient> { public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<TemplateAsyncClient> {
public void testListTemplates() throws SecurityException, NoSuchMethodException, IOException { public void testListTemplates() throws SecurityException, NoSuchMethodException, IOException {
@ -61,8 +62,11 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
public void testListTemplatesOptions() throws SecurityException, NoSuchMethodException, IOException { public void testListTemplatesOptions() throws SecurityException, NoSuchMethodException, IOException {
Method method = TemplateAsyncClient.class.getMethod("listTemplates", ListTemplatesOptions.class); Method method = TemplateAsyncClient.class.getMethod("listTemplates", ListTemplatesOptions.class);
HttpRequest httpRequest = processor.createRequest(method, ListTemplatesOptions.Builder.accountInDomain("adrian", HttpRequest httpRequest = processor
6).hypervisor("xen").filter(TemplateFilter.FEATURED)); .createRequest(
method,
ListTemplatesOptions.Builder.accountInDomain("adrian", 6).hypervisor("xen")
.filter(TemplateFilter.FEATURED));
assertRequestLineEquals( assertRequestLineEquals(
httpRequest, httpRequest,
@ -82,7 +86,8 @@ public class TemplateAsyncClientTest extends BaseCloudStackAsyncClientTest<Templ
Method method = TemplateAsyncClient.class.getMethod("getTemplateInZone", long.class, long.class); Method method = TemplateAsyncClient.class.getMethod("getTemplateInZone", long.class, long.class);
HttpRequest httpRequest = processor.createRequest(method, 1, 5); HttpRequest httpRequest = processor.createRequest(method, 1, 5);
assertRequestLineEquals(httpRequest, assertRequestLineEquals(
httpRequest,
"GET http://localhost:8080/client/api?response=json&command=listTemplates&templatefilter=executable&zoneid=1&id=5 HTTP/1.1"); "GET http://localhost:8080/client/api?response=json&command=listTemplates&templatefilter=executable&zoneid=1&id=5 HTTP/1.1");
assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n"); assertNonPayloadHeadersEqual(httpRequest, "Accept: application/json\n");
assertPayloadEquals(httpRequest, null, null, false); assertPayloadEquals(httpRequest, null, null, false);

View File

@ -18,13 +18,13 @@
*/ */
package org.jclouds.cloudstack.features; package org.jclouds.cloudstack.features;
import static org.jclouds.cloudstack.options.ListTemplatesOptions.Builder.zoneId;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;
import static org.testng.Assert.assertTrue; import static org.testng.Assert.assertTrue;
import java.util.Set; import java.util.Set;
import org.jclouds.cloudstack.domain.Template; import org.jclouds.cloudstack.domain.Template;
import static org.jclouds.cloudstack.options.ListTemplatesOptions.Builder.zoneId;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.Iterables; import com.google.common.collect.Iterables;

View File

@ -42,7 +42,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "VirtualMachineAsyncClientTest") @Test(groups = "unit", testName = "VirtualMachineAsyncClientTest")
public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest<VirtualMachineAsyncClient> { public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest<VirtualMachineAsyncClient> {
public void testListVirtualMachines() throws SecurityException, NoSuchMethodException, IOException { public void testListVirtualMachines() throws SecurityException, NoSuchMethodException, IOException {
@ -66,8 +67,8 @@ public class VirtualMachineAsyncClientTest extends BaseCloudStackAsyncClientTest
public void testListVirtualMachinesOptions() throws SecurityException, NoSuchMethodException, IOException { public void testListVirtualMachinesOptions() throws SecurityException, NoSuchMethodException, IOException {
Method method = VirtualMachineAsyncClient.class.getMethod("listVirtualMachines", Method method = VirtualMachineAsyncClient.class.getMethod("listVirtualMachines",
ListVirtualMachinesOptions[].class); ListVirtualMachinesOptions[].class);
HttpRequest httpRequest = processor.createRequest(method, ListVirtualMachinesOptions.Builder.accountInDomain( HttpRequest httpRequest = processor.createRequest(method,
"adrian", 6).usesVirtualNetwork(true)); ListVirtualMachinesOptions.Builder.accountInDomain("adrian", 6).usesVirtualNetwork(true));
assertRequestLineEquals( assertRequestLineEquals(
httpRequest, httpRequest,

View File

@ -39,7 +39,8 @@ import com.google.inject.TypeLiteral;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "ZoneAsyncClientTest") @Test(groups = "unit", testName = "ZoneAsyncClientTest")
public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest<ZoneAsyncClient> { public class ZoneAsyncClientTest extends BaseCloudStackAsyncClientTest<ZoneAsyncClient> {
public void testListZones() throws SecurityException, NoSuchMethodException, IOException { public void testListZones() throws SecurityException, NoSuchMethodException, IOException {

View File

@ -27,11 +27,11 @@ import java.util.Map;
import org.jclouds.PropertiesBuilder; import org.jclouds.PropertiesBuilder;
import org.jclouds.http.HttpRequest; import org.jclouds.http.HttpRequest;
import org.jclouds.logging.config.NullLoggingModule; import org.jclouds.logging.config.NullLoggingModule;
import org.jclouds.rest.BaseRestClientTest.MockModule;
import org.jclouds.rest.RequestSigner; import org.jclouds.rest.RequestSigner;
import org.jclouds.rest.RestContextBuilder; import org.jclouds.rest.RestContextBuilder;
import org.jclouds.rest.RestContextFactory; import org.jclouds.rest.RestContextFactory;
import org.jclouds.rest.RestContextSpec; import org.jclouds.rest.RestContextSpec;
import org.jclouds.rest.BaseRestClientTest.MockModule;
import org.testng.annotations.Test; import org.testng.annotations.Test;
import com.google.common.collect.ImmutableList; import com.google.common.collect.ImmutableList;
@ -43,7 +43,8 @@ import com.google.inject.Module;
* *
* @author Adrian Cole * @author Adrian Cole
*/ */
// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire // NOTE:without testName, this will not call @Before* and fail w/NPE during
// surefire
@Test(groups = "unit", testName = "QuerySignerTest") @Test(groups = "unit", testName = "QuerySignerTest")
public class QuerySignerTest { public class QuerySignerTest {
@SuppressWarnings({ "unchecked", "rawtypes" }) @SuppressWarnings({ "unchecked", "rawtypes" })
@ -60,33 +61,34 @@ public class QuerySignerTest {
@Test @Test
void testCreateStringToSign() { void testCreateStringToSign() {
QuerySigner filter = RestContextFactory.createContextBuilder(DUMMY_SPEC).buildInjector().getInstance( QuerySigner filter = RestContextFactory.createContextBuilder(DUMMY_SPEC).buildInjector()
QuerySigner.class); .getInstance(QuerySigner.class);
assertEquals(filter.createStringToSign(HttpRequest.builder().method("GET").endpoint( assertEquals(
URI.create("http://localhost:8080/client/api?command=listZones")).build()), filter.createStringToSign(HttpRequest.builder().method("GET")
.endpoint(URI.create("http://localhost:8080/client/api?command=listZones")).build()),
"apikey=apikey&command=listzones"); "apikey=apikey&command=listzones");
} }
@Test @Test
void testFilter() { void testFilter() {
QuerySigner filter = RestContextFactory.createContextBuilder(DUMMY_SPEC).buildInjector().getInstance( QuerySigner filter = RestContextFactory.createContextBuilder(DUMMY_SPEC).buildInjector()
QuerySigner.class); .getInstance(QuerySigner.class);
assertEquals( assertEquals(
filter.filter( filter.filter(
HttpRequest.builder().method("GET").endpoint( HttpRequest.builder().method("GET")
URI.create("http://localhost:8080/client/api?command=listZones")).build()) .endpoint(URI.create("http://localhost:8080/client/api?command=listZones")).build())
.getRequestLine(), .getRequestLine(),
"GET http://localhost:8080/client/api?command=listZones&apiKey=apiKey&signature=2UG8AcnMaozL3BINdjgkJ%2BRzjEY%3D HTTP/1.1"); "GET http://localhost:8080/client/api?command=listZones&apiKey=apiKey&signature=2UG8AcnMaozL3BINdjgkJ%2BRzjEY%3D HTTP/1.1");
} }
@Test @Test
void testFilterTwice() { void testFilterTwice() {
QuerySigner filter = RestContextFactory.createContextBuilder(DUMMY_SPEC).buildInjector().getInstance( QuerySigner filter = RestContextFactory.createContextBuilder(DUMMY_SPEC).buildInjector()
QuerySigner.class); .getInstance(QuerySigner.class);
HttpRequest request = HttpRequest.builder().method("GET").endpoint( HttpRequest request = HttpRequest.builder().method("GET")
URI.create("http://localhost:8080/client/api?command=listZones")).build(); .endpoint(URI.create("http://localhost:8080/client/api?command=listZones")).build();
for (int i = 0; i < 2; i++) { for (int i = 0; i < 2; i++) {
request = filter.filter(request); request = filter.filter(request);
assertEquals( assertEquals(

View File

@ -85,10 +85,13 @@ public class ParseAsyncJobFromHttpResponseTest {
public void testWithErrorSetsResultNullSoToAvoidClassCastExceptions() { public void testWithErrorSetsResultNullSoToAvoidClassCastExceptions() {
String input = "{ \"queryasyncjobresultresponse\" : {\"jobid\":1103,\"jobstatus\":2,\"jobprocstatus\":0,\"jobresultcode\":530,\"jobresulttype\":\"object\",\"jobresult\":{\"errorcode\":530,\"errortext\":\"Internal error executing command, please contact your system administrator\"}} }"; String input = "{ \"queryasyncjobresultresponse\" : {\"jobid\":1103,\"jobstatus\":2,\"jobprocstatus\":0,\"jobresultcode\":530,\"jobresulttype\":\"object\",\"jobresult\":{\"errorcode\":530,\"errortext\":\"Internal error executing command, please contact your system administrator\"}} }";
AsyncJob<PublicIPAddress> expects = AsyncJob.<PublicIPAddress> builder().id(1103).status(2).progress(0) AsyncJob<PublicIPAddress> expects = AsyncJob
.resultType("object").error( .<PublicIPAddress> builder()
new AsyncJobError(530, .id(1103)
"Internal error executing command, please contact your system administrator")) .status(2)
.progress(0)
.resultType("object")
.error(new AsyncJobError(530, "Internal error executing command, please contact your system administrator"))
.resultCode(530).build(); .resultCode(530).build();
ParseAsyncJobFromHttpResponse parser = i.getInstance(ParseAsyncJobFromHttpResponse.class); ParseAsyncJobFromHttpResponse parser = i.getInstance(ParseAsyncJobFromHttpResponse.class);
@ -114,13 +117,15 @@ public class ParseAsyncJobFromHttpResponseTest {
} }
public void testWithBadResultReturnsMap() { public void testWithBadResultReturnsMap() {
// Not the best result object, but this is an unexpected error case. Cloud.com have verified // Not the best result object, but this is an unexpected error case.
// that this case will not happen. This code is only here to prevent exceptions from being // Cloud.com have verified
// that this case will not happen. This code is only here to prevent
// exceptions from being
// thrown in case they change their minds. // thrown in case they change their minds.
String input = "{ \"queryasyncjobresultresponse\" : {\"jobid\":860,\"jobstatus\":0,\"jobprocstatus\":0,\"jobresultcode\":0,\"jobresult\":{\"foo\":{\"bar\":1},\"foo2\":{\"bar2\":2}}}}"; String input = "{ \"queryasyncjobresultresponse\" : {\"jobid\":860,\"jobstatus\":0,\"jobprocstatus\":0,\"jobresultcode\":0,\"jobresult\":{\"foo\":{\"bar\":1},\"foo2\":{\"bar2\":2}}}}";
AsyncJob<?> expects = AsyncJob.builder().id(860).status(0).progress(0).resultCode(0).result( AsyncJob<?> expects = AsyncJob.builder().id(860).status(0).progress(0).resultCode(0)
ImmutableMap.of("foo", new JsonBall("{\"bar\":1}"), "foo2", new JsonBall("{\"bar2\":2}"))).build(); .result(ImmutableMap.of("foo", new JsonBall("{\"bar\":1}"), "foo2", new JsonBall("{\"bar2\":2}"))).build();
ParseAsyncJobFromHttpResponse parser = i.getInstance(ParseAsyncJobFromHttpResponse.class); ParseAsyncJobFromHttpResponse parser = i.getInstance(ParseAsyncJobFromHttpResponse.class);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@ -132,9 +137,19 @@ public class ParseAsyncJobFromHttpResponseTest {
public void testPublicIPAddress() { public void testPublicIPAddress() {
InputStream is = getClass().getResourceAsStream("/queryasyncjobresultresponse-ipaddress.json"); InputStream is = getClass().getResourceAsStream("/queryasyncjobresultresponse-ipaddress.json");
AsyncJob<PublicIPAddress> expects = AsyncJob.<PublicIPAddress> builder().id(860).status(1).progress(0) AsyncJob<PublicIPAddress> expects = AsyncJob
.resultType("object").resultCode(0).result( .<PublicIPAddress> builder()
PublicIPAddress.builder().id(6).IPAddress("72.52.126.35").allocated( .id(860)
.status(1)
.progress(0)
.resultType("object")
.resultCode(0)
.result(
PublicIPAddress
.builder()
.id(6)
.IPAddress("72.52.126.35")
.allocated(
new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-02-23T20:15:01-0800")) new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-02-23T20:15:01-0800"))
.zoneId(1).zoneName("San Jose 1").isSourceNAT(false).account("adrian").domainId(1) .zoneId(1).zoneName("San Jose 1").isSourceNAT(false).account("adrian").domainId(1)
.domain("ROOT").usesVirtualNetwork(true).isStaticNAT(false).associatedNetworkId(204) .domain("ROOT").usesVirtualNetwork(true).isStaticNAT(false).associatedNetworkId(204)
@ -152,12 +167,17 @@ public class ParseAsyncJobFromHttpResponseTest {
public void testIPForwardingRule() { public void testIPForwardingRule() {
InputStream is = getClass().getResourceAsStream("/queryasyncjobresultresponse-ipforwardingrule.json"); InputStream is = getClass().getResourceAsStream("/queryasyncjobresultresponse-ipforwardingrule.json");
AsyncJob<IPForwardingRule> expects = AsyncJob.<IPForwardingRule> builder().id(1133).status(1).progress(0) AsyncJob<IPForwardingRule> expects = AsyncJob
.resultType("object").resultCode(0).result( .<IPForwardingRule> builder()
IPForwardingRule.builder().id(109).protocol("tcp").virtualMachineId(226).virtualMachineName( .id(1133)
"i-3-226-VM").IPAddressId(36).IPAddress("72.52.126.65").startPort(22).endPort(22) .status(1)
.state("Active").build() .progress(0)
).build(); .resultType("object")
.resultCode(0)
.result(
IPForwardingRule.builder().id(109).protocol("tcp").virtualMachineId(226)
.virtualMachineName("i-3-226-VM").IPAddressId(36).IPAddress("72.52.126.65").startPort(22)
.endPort(22).state("Active").build()).build();
ParseAsyncJobFromHttpResponse parser = i.getInstance(ParseAsyncJobFromHttpResponse.class); ParseAsyncJobFromHttpResponse parser = i.getInstance(ParseAsyncJobFromHttpResponse.class);
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")

View File

@ -67,7 +67,8 @@ public class ReuseOrAssociateNewPublicIPAddressTest {
replay(addressClient); replay(addressClient);
// run // run
assertEquals(new ReuseOrAssociateNewPublicIPAddress(client, jobComplete).apply(Network.builder().id(networkId) assertEquals(
new ReuseOrAssociateNewPublicIPAddress(client, jobComplete).apply(Network.builder().id(networkId)
.zoneId(zoneId).build()), address); .zoneId(zoneId).build()), address);
// verify mocks // verify mocks
@ -105,7 +106,8 @@ public class ReuseOrAssociateNewPublicIPAddressTest {
replay(jobClient); replay(jobClient);
// run // run
assertEquals(new ReuseOrAssociateNewPublicIPAddress(client, jobComplete).apply(Network.builder().id(networkId) assertEquals(
new ReuseOrAssociateNewPublicIPAddress(client, jobComplete).apply(Network.builder().id(networkId)
.zoneId(zoneId).build()), address); .zoneId(zoneId).build()), address);
// verify mocks // verify mocks
@ -134,7 +136,8 @@ public class ReuseOrAssociateNewPublicIPAddressTest {
// make sure we created the job relating to a new ip // make sure we created the job relating to a new ip
expect(addressClient.associateIPAddressInZone(zoneId, networkId(networkId))).andReturn(job); expect(addressClient.associateIPAddressInZone(zoneId, networkId(networkId))).andReturn(job);
// the alwaysfalse predicate above should blow up with IllegalStateException // the alwaysfalse predicate above should blow up with
// IllegalStateException
// replay mocks // replay mocks
replay(client); replay(client);

View File

@ -58,7 +58,6 @@ public class ListAsyncJobsOptionsTest {
assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid"));
} }
public void testStartDateStatic() { public void testStartDateStatic() {
ListAsyncJobsOptions options = startDate(new Date(100000)); ListAsyncJobsOptions options = startDate(new Date(100000));
assertEquals(ImmutableList.of("1970-01-01T00:01:40Z"), options.buildQueryParameters().get("startdate")); assertEquals(ImmutableList.of("1970-01-01T00:01:40Z"), options.buildQueryParameters().get("startdate"));

View File

@ -18,10 +18,10 @@
*/ */
package org.jclouds.cloudstack.options; package org.jclouds.cloudstack.options;
import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.IPAddressId;
import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.accountInDomain; import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.accountInDomain;
import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.domainId; import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.domainId;
import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.id; import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.id;
import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.IPAddressId;
import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.virtualMachineId; import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.virtualMachineId;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;

View File

@ -18,13 +18,13 @@
*/ */
package org.jclouds.cloudstack.options; package org.jclouds.cloudstack.options;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.accountInDomain;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.domainId;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.IPAddress; import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.IPAddress;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.VLANId;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.accountInDomain;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.allocatedOnly; import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.allocatedOnly;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.domainId;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.id; import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.id;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.networkId; import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.networkId;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.VLANId;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.usesVirtualNetwork; import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.usesVirtualNetwork;
import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.zoneId; import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.zoneId;
import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertEquals;

View File

@ -93,20 +93,11 @@ public class ListAccountsResponseTest extends BaseSetParserTest<Account> {
.VMsRunning(1) .VMsRunning(1)
.state(State.ENABLED) .state(State.ENABLED)
.users( .users(
ImmutableSet.of(User.builder() ImmutableSet.of(User.builder().id(505).name("jclouds").firstName("Adrian").lastName("Cole")
.id(505)
.name("jclouds")
.firstName("Adrian")
.lastName("Cole")
.email("adrian@jclouds.org") .email("adrian@jclouds.org")
.created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-04-19T01:57:24+0000")) .created(new SimpleDateFormatDateService().iso8601SecondsDateParse("2011-04-19T01:57:24+0000"))
.state("enabled") .state("enabled").account("jclouds").accountType(Type.USER).domainId(457)
.account("jclouds") .domain("AA000062-jclouds-dev").apiKey("APIKEY").secretKey("SECRETKEY").build())).build());
.accountType(Type.USER)
.domainId(457)
.domain("AA000062-jclouds-dev")
.apiKey("APIKEY")
.secretKey("SECRETKEY").build())).build());
} }
} }

View File

@ -43,9 +43,9 @@ public class ListOSCategoriesResponseTest extends BaseItemParserTest<Map<Long, S
@Override @Override
public Map<Long, String> expected() { public Map<Long, String> expected() {
return ImmutableMap.<Long, String> builder().put(1l, "CentOS").put(2l, "Debian").put(3l, "Oracle").put(4l, return ImmutableMap.<Long, String> builder().put(1l, "CentOS").put(2l, "Debian").put(3l, "Oracle")
"RedHat").put(5l, "SUSE").put(6l, "Windows").put(7l, "Other").put(8l, "Novel").put(9l, "Unix").put(10l, .put(4l, "RedHat").put(5l, "SUSE").put(6l, "Windows").put(7l, "Other").put(8l, "Novel").put(9l, "Unix")
"Ubuntu").build(); .put(10l, "Ubuntu").build();
} }
@Override @Override

View File

@ -42,189 +42,157 @@ public class ListOSTypesResponseTest extends BaseSetParserTest<OSType> {
@Override @Override
@SelectJson("ostype") @SelectJson("ostype")
public Set<OSType> expected() { public Set<OSType> expected() {
return ImmutableSet.<OSType> builder().add( return ImmutableSet
OSType.builder().id(69).OSCategoryId(7).description("Asianux 3(32-bit)").build()).add( .<OSType> builder()
OSType.builder().id(70).OSCategoryId(7).description("Asianux 3(64-bit)").build()).add( .add(OSType.builder().id(69).OSCategoryId(7).description("Asianux 3(32-bit)").build())
OSType.builder().id(1).OSCategoryId(1).description("CentOS 4.5 (32-bit)").build()).add( .add(OSType.builder().id(70).OSCategoryId(7).description("Asianux 3(64-bit)").build())
OSType.builder().id(2).OSCategoryId(1).description("CentOS 4.6 (32-bit)").build()).add( .add(OSType.builder().id(1).OSCategoryId(1).description("CentOS 4.5 (32-bit)").build())
OSType.builder().id(3).OSCategoryId(1).description("CentOS 4.7 (32-bit)").build()).add( .add(OSType.builder().id(2).OSCategoryId(1).description("CentOS 4.6 (32-bit)").build())
OSType.builder().id(4).OSCategoryId(1).description("CentOS 4.8 (32-bit)").build()).add( .add(OSType.builder().id(3).OSCategoryId(1).description("CentOS 4.7 (32-bit)").build())
OSType.builder().id(5).OSCategoryId(1).description("CentOS 5.0 (32-bit)").build()).add( .add(OSType.builder().id(4).OSCategoryId(1).description("CentOS 4.8 (32-bit)").build())
OSType.builder().id(6).OSCategoryId(1).description("CentOS 5.0 (64-bit)").build()).add( .add(OSType.builder().id(5).OSCategoryId(1).description("CentOS 5.0 (32-bit)").build())
OSType.builder().id(7).OSCategoryId(1).description("CentOS 5.1 (32-bit)").build()).add( .add(OSType.builder().id(6).OSCategoryId(1).description("CentOS 5.0 (64-bit)").build())
OSType.builder().id(8).OSCategoryId(1).description("CentOS 5.1 (64-bit)").build()).add( .add(OSType.builder().id(7).OSCategoryId(1).description("CentOS 5.1 (32-bit)").build())
OSType.builder().id(9).OSCategoryId(1).description("CentOS 5.2 (32-bit)").build()).add( .add(OSType.builder().id(8).OSCategoryId(1).description("CentOS 5.1 (64-bit)").build())
OSType.builder().id(10).OSCategoryId(1).description("CentOS 5.2 (64-bit)").build()).add( .add(OSType.builder().id(9).OSCategoryId(1).description("CentOS 5.2 (32-bit)").build())
OSType.builder().id(11).OSCategoryId(1).description("CentOS 5.3 (32-bit)").build()).add( .add(OSType.builder().id(10).OSCategoryId(1).description("CentOS 5.2 (64-bit)").build())
OSType.builder().id(12).OSCategoryId(1).description("CentOS 5.3 (64-bit)").build()).add( .add(OSType.builder().id(11).OSCategoryId(1).description("CentOS 5.3 (32-bit)").build())
OSType.builder().id(13).OSCategoryId(1).description("CentOS 5.4 (32-bit)").build()).add( .add(OSType.builder().id(12).OSCategoryId(1).description("CentOS 5.3 (64-bit)").build())
OSType.builder().id(14).OSCategoryId(1).description("CentOS 5.4 (64-bit)").build()).add( .add(OSType.builder().id(13).OSCategoryId(1).description("CentOS 5.4 (32-bit)").build())
OSType.builder().id(111).OSCategoryId(1).description("CentOS 5.5 (32-bit)").build()).add( .add(OSType.builder().id(14).OSCategoryId(1).description("CentOS 5.4 (64-bit)").build())
OSType.builder().id(112).OSCategoryId(1).description("CentOS 5.5 (64-bit)").build()).add( .add(OSType.builder().id(111).OSCategoryId(1).description("CentOS 5.5 (32-bit)").build())
OSType.builder().id(73).OSCategoryId(2).description("Debian GNU/Linux 4(32-bit)").build()).add( .add(OSType.builder().id(112).OSCategoryId(1).description("CentOS 5.5 (64-bit)").build())
OSType.builder().id(74).OSCategoryId(2).description("Debian GNU/Linux 4(64-bit)").build()).add( .add(OSType.builder().id(73).OSCategoryId(2).description("Debian GNU/Linux 4(32-bit)").build())
OSType.builder().id(72).OSCategoryId(2).description("Debian GNU/Linux 5(64-bit)").build()).add( .add(OSType.builder().id(74).OSCategoryId(2).description("Debian GNU/Linux 4(64-bit)").build())
OSType.builder().id(15).OSCategoryId(2).description("Debian GNU/Linux 5.0 (32-bit)").build()).add( .add(OSType.builder().id(72).OSCategoryId(2).description("Debian GNU/Linux 5(64-bit)").build())
OSType.builder().id(132).OSCategoryId(2).description("Debian GNU/Linux 6(32-bit)").build()).add( .add(OSType.builder().id(15).OSCategoryId(2).description("Debian GNU/Linux 5.0 (32-bit)").build())
OSType.builder().id(133).OSCategoryId(2).description("Debian GNU/Linux 6(64-bit)").build()).add( .add(OSType.builder().id(132).OSCategoryId(2).description("Debian GNU/Linux 6(32-bit)").build())
OSType.builder().id(102).OSCategoryId(6).description("DOS").build()).add( .add(OSType.builder().id(133).OSCategoryId(2).description("Debian GNU/Linux 6(64-bit)").build())
OSType.builder().id(118).OSCategoryId(4).description("Fedora 10").build()).add( .add(OSType.builder().id(102).OSCategoryId(6).description("DOS").build())
OSType.builder().id(117).OSCategoryId(4).description("Fedora 11").build()).add( .add(OSType.builder().id(118).OSCategoryId(4).description("Fedora 10").build())
OSType.builder().id(116).OSCategoryId(4).description("Fedora 12").build()).add( .add(OSType.builder().id(117).OSCategoryId(4).description("Fedora 11").build())
OSType.builder().id(115).OSCategoryId(4).description("Fedora 13").build()).add( .add(OSType.builder().id(116).OSCategoryId(4).description("Fedora 12").build())
OSType.builder().id(120).OSCategoryId(4).description("Fedora 8").build()).add( .add(OSType.builder().id(115).OSCategoryId(4).description("Fedora 13").build())
OSType.builder().id(119).OSCategoryId(4).description("Fedora 9").build()).add( .add(OSType.builder().id(120).OSCategoryId(4).description("Fedora 8").build())
OSType.builder().id(83).OSCategoryId(9).description("FreeBSD (32-bit)").build()).add( .add(OSType.builder().id(119).OSCategoryId(4).description("Fedora 9").build())
OSType.builder().id(84).OSCategoryId(9).description("FreeBSD (64-bit)").build()).add( .add(OSType.builder().id(83).OSCategoryId(9).description("FreeBSD (32-bit)").build())
OSType.builder().id(92).OSCategoryId(6).description("Microsoft Small Bussiness Server 2003").build()) .add(OSType.builder().id(84).OSCategoryId(9).description("FreeBSD (64-bit)").build())
.add(OSType.builder().id(78).OSCategoryId(8).description("Novell Netware 5.1").build()).add( .add(OSType.builder().id(92).OSCategoryId(6).description("Microsoft Small Bussiness Server 2003").build())
OSType.builder().id(77).OSCategoryId(8).description("Novell Netware 6.x").build()).add( .add(OSType.builder().id(78).OSCategoryId(8).description("Novell Netware 5.1").build())
OSType.builder().id(68).OSCategoryId(7).description("Open Enterprise Server").build()).add( .add(OSType.builder().id(77).OSCategoryId(8).description("Novell Netware 6.x").build())
OSType.builder().id(16).OSCategoryId(3).description("Oracle Enterprise Linux 5.0 (32-bit)") .add(OSType.builder().id(68).OSCategoryId(7).description("Open Enterprise Server").build())
.build()).add( .add(OSType.builder().id(16).OSCategoryId(3).description("Oracle Enterprise Linux 5.0 (32-bit)").build())
OSType.builder().id(17).OSCategoryId(3).description("Oracle Enterprise Linux 5.0 (64-bit)") .add(OSType.builder().id(17).OSCategoryId(3).description("Oracle Enterprise Linux 5.0 (64-bit)").build())
.build()).add( .add(OSType.builder().id(18).OSCategoryId(3).description("Oracle Enterprise Linux 5.1 (32-bit)").build())
OSType.builder().id(18).OSCategoryId(3).description("Oracle Enterprise Linux 5.1 (32-bit)") .add(OSType.builder().id(19).OSCategoryId(3).description("Oracle Enterprise Linux 5.1 (64-bit)").build())
.build()).add( .add(OSType.builder().id(20).OSCategoryId(3).description("Oracle Enterprise Linux 5.2 (32-bit)").build())
OSType.builder().id(19).OSCategoryId(3).description("Oracle Enterprise Linux 5.1 (64-bit)") .add(OSType.builder().id(21).OSCategoryId(3).description("Oracle Enterprise Linux 5.2 (64-bit)").build())
.build()).add( .add(OSType.builder().id(22).OSCategoryId(3).description("Oracle Enterprise Linux 5.3 (32-bit)").build())
OSType.builder().id(20).OSCategoryId(3).description("Oracle Enterprise Linux 5.2 (32-bit)") .add(OSType.builder().id(23).OSCategoryId(3).description("Oracle Enterprise Linux 5.3 (64-bit)").build())
.build()).add( .add(OSType.builder().id(24).OSCategoryId(3).description("Oracle Enterprise Linux 5.4 (32-bit)").build())
OSType.builder().id(21).OSCategoryId(3).description("Oracle Enterprise Linux 5.2 (64-bit)") .add(OSType.builder().id(25).OSCategoryId(3).description("Oracle Enterprise Linux 5.4 (64-bit)").build())
.build()).add( .add(OSType.builder().id(134).OSCategoryId(3).description("Oracle Enterprise Linux 5.5 (32-bit)").build())
OSType.builder().id(22).OSCategoryId(3).description("Oracle Enterprise Linux 5.3 (32-bit)") .add(OSType.builder().id(135).OSCategoryId(3).description("Oracle Enterprise Linux 5.5 (64-bit)").build())
.build()).add( .add(OSType.builder().id(104).OSCategoryId(7).description("OS/2").build())
OSType.builder().id(23).OSCategoryId(3).description("Oracle Enterprise Linux 5.3 (64-bit)") .add(OSType.builder().id(60).OSCategoryId(7).description("Other (32-bit)").build())
.build()).add( .add(OSType.builder().id(103).OSCategoryId(7).description("Other (64-bit)").build())
OSType.builder().id(24).OSCategoryId(3).description("Oracle Enterprise Linux 5.4 (32-bit)") .add(OSType.builder().id(75).OSCategoryId(7).description("Other 2.6x Linux (32-bit)").build())
.build()).add( .add(OSType.builder().id(76).OSCategoryId(7).description("Other 2.6x Linux (64-bit)").build())
OSType.builder().id(25).OSCategoryId(3).description("Oracle Enterprise Linux 5.4 (64-bit)") .add(OSType.builder().id(98).OSCategoryId(7).description("Other Linux (32-bit)").build())
.build()).add( .add(OSType.builder().id(99).OSCategoryId(7).description("Other Linux (64-bit)").build())
OSType.builder().id(134).OSCategoryId(3).description("Oracle Enterprise Linux 5.5 (32-bit)") .add(OSType.builder().id(59).OSCategoryId(10).description("Other Ubuntu (32-bit)").build())
.build()).add( .add(OSType.builder().id(100).OSCategoryId(10).description("Other Ubuntu (64-bit)").build())
OSType.builder().id(135).OSCategoryId(3).description("Oracle Enterprise Linux 5.5 (64-bit)") .add(OSType.builder().id(131).OSCategoryId(10).description("Red Hat Enterprise Linux 2").build())
.build()).add(OSType.builder().id(104).OSCategoryId(7).description("OS/2").build())
.add(OSType.builder().id(60).OSCategoryId(7).description("Other (32-bit)").build()).add(
OSType.builder().id(103).OSCategoryId(7).description("Other (64-bit)").build()).add(
OSType.builder().id(75).OSCategoryId(7).description("Other 2.6x Linux (32-bit)").build()).add(
OSType.builder().id(76).OSCategoryId(7).description("Other 2.6x Linux (64-bit)").build()).add(
OSType.builder().id(98).OSCategoryId(7).description("Other Linux (32-bit)").build()).add(
OSType.builder().id(99).OSCategoryId(7).description("Other Linux (64-bit)").build()).add(
OSType.builder().id(59).OSCategoryId(10).description("Other Ubuntu (32-bit)").build()).add(
OSType.builder().id(100).OSCategoryId(10).description("Other Ubuntu (64-bit)").build()).add(
OSType.builder().id(131).OSCategoryId(10).description("Red Hat Enterprise Linux 2").build())
.add(OSType.builder().id(66).OSCategoryId(4).description("Red Hat Enterprise Linux 3(32-bit)").build()) .add(OSType.builder().id(66).OSCategoryId(4).description("Red Hat Enterprise Linux 3(32-bit)").build())
.add(OSType.builder().id(67).OSCategoryId(4).description("Red Hat Enterprise Linux 3(64-bit)").build()) .add(OSType.builder().id(67).OSCategoryId(4).description("Red Hat Enterprise Linux 3(64-bit)").build())
.add(OSType.builder().id(106).OSCategoryId(4).description("Red Hat Enterprise Linux 4(64-bit)").build()) .add(OSType.builder().id(106).OSCategoryId(4).description("Red Hat Enterprise Linux 4(64-bit)").build())
.add( .add(OSType.builder().id(26).OSCategoryId(4).description("Red Hat Enterprise Linux 4.5 (32-bit)").build())
OSType.builder().id(26).OSCategoryId(4).description("Red Hat Enterprise Linux 4.5 (32-bit)") .add(OSType.builder().id(27).OSCategoryId(4).description("Red Hat Enterprise Linux 4.6 (32-bit)").build())
.build()).add( .add(OSType.builder().id(28).OSCategoryId(4).description("Red Hat Enterprise Linux 4.7 (32-bit)").build())
OSType.builder().id(27).OSCategoryId(4).description("Red Hat Enterprise Linux 4.6 (32-bit)") .add(OSType.builder().id(29).OSCategoryId(4).description("Red Hat Enterprise Linux 4.8 (32-bit)").build())
.build()).add( .add(OSType.builder().id(30).OSCategoryId(4).description("Red Hat Enterprise Linux 5.0 (32-bit)").build())
OSType.builder().id(28).OSCategoryId(4).description("Red Hat Enterprise Linux 4.7 (32-bit)") .add(OSType.builder().id(31).OSCategoryId(4).description("Red Hat Enterprise Linux 5.0 (64-bit)").build())
.build()).add( .add(OSType.builder().id(32).OSCategoryId(4).description("Red Hat Enterprise Linux 5.1 (32-bit)").build())
OSType.builder().id(29).OSCategoryId(4).description("Red Hat Enterprise Linux 4.8 (32-bit)") .add(OSType.builder().id(33).OSCategoryId(4).description("Red Hat Enterprise Linux 5.1 (64-bit)").build())
.build()).add( .add(OSType.builder().id(34).OSCategoryId(4).description("Red Hat Enterprise Linux 5.2 (32-bit)").build())
OSType.builder().id(30).OSCategoryId(4).description("Red Hat Enterprise Linux 5.0 (32-bit)") .add(OSType.builder().id(35).OSCategoryId(4).description("Red Hat Enterprise Linux 5.2 (64-bit)").build())
.build()).add( .add(OSType.builder().id(36).OSCategoryId(4).description("Red Hat Enterprise Linux 5.3 (32-bit)").build())
OSType.builder().id(31).OSCategoryId(4).description("Red Hat Enterprise Linux 5.0 (64-bit)") .add(OSType.builder().id(37).OSCategoryId(4).description("Red Hat Enterprise Linux 5.3 (64-bit)").build())
.build()).add( .add(OSType.builder().id(38).OSCategoryId(4).description("Red Hat Enterprise Linux 5.4 (32-bit)").build())
OSType.builder().id(32).OSCategoryId(4).description("Red Hat Enterprise Linux 5.1 (32-bit)") .add(OSType.builder().id(39).OSCategoryId(4).description("Red Hat Enterprise Linux 5.4 (64-bit)").build())
.build()).add( .add(OSType.builder().id(113).OSCategoryId(4).description("Red Hat Enterprise Linux 5.5 (32-bit)").build())
OSType.builder().id(33).OSCategoryId(4).description("Red Hat Enterprise Linux 5.1 (64-bit)") .add(OSType.builder().id(114).OSCategoryId(4).description("Red Hat Enterprise Linux 5.5 (64-bit)").build())
.build()).add( .add(OSType.builder().id(136).OSCategoryId(4).description("Red Hat Enterprise Linux 6.0 (32-bit)").build())
OSType.builder().id(34).OSCategoryId(4).description("Red Hat Enterprise Linux 5.2 (32-bit)") .add(OSType.builder().id(137).OSCategoryId(4).description("Red Hat Enterprise Linux 6.0 (64-bit)").build())
.build()).add( .add(OSType.builder().id(85).OSCategoryId(9).description("SCO OpenServer 5").build())
OSType.builder().id(35).OSCategoryId(4).description("Red Hat Enterprise Linux 5.2 (64-bit)") .add(OSType.builder().id(86).OSCategoryId(9).description("SCO UnixWare 7").build())
.build()).add( .add(OSType.builder().id(79).OSCategoryId(9).description("Sun Solaris 10(32-bit)").build())
OSType.builder().id(36).OSCategoryId(4).description("Red Hat Enterprise Linux 5.3 (32-bit)") .add(OSType.builder().id(80).OSCategoryId(9).description("Sun Solaris 10(64-bit)").build())
.build()).add( .add(OSType.builder().id(82).OSCategoryId(9).description("Sun Solaris 8(Experimental)").build())
OSType.builder().id(37).OSCategoryId(4).description("Red Hat Enterprise Linux 5.3 (64-bit)") .add(OSType.builder().id(81).OSCategoryId(9).description("Sun Solaris 9(Experimental)").build())
.build()).add( .add(OSType.builder().id(109).OSCategoryId(5).description("SUSE Linux Enterprise 10(32-bit)").build())
OSType.builder().id(38).OSCategoryId(4).description("Red Hat Enterprise Linux 5.4 (32-bit)") .add(OSType.builder().id(110).OSCategoryId(5).description("SUSE Linux Enterprise 10(64-bit)").build())
.build()).add( .add(OSType.builder().id(96).OSCategoryId(5).description("SUSE Linux Enterprise 8(32-bit)").build())
OSType.builder().id(39).OSCategoryId(4).description("Red Hat Enterprise Linux 5.4 (64-bit)")
.build()).add(
OSType.builder().id(113).OSCategoryId(4).description("Red Hat Enterprise Linux 5.5 (32-bit)")
.build()).add(
OSType.builder().id(114).OSCategoryId(4).description("Red Hat Enterprise Linux 5.5 (64-bit)")
.build()).add(
OSType.builder().id(136).OSCategoryId(4).description("Red Hat Enterprise Linux 6.0 (32-bit)")
.build()).add(
OSType.builder().id(137).OSCategoryId(4).description("Red Hat Enterprise Linux 6.0 (64-bit)")
.build()).add(
OSType.builder().id(85).OSCategoryId(9).description("SCO OpenServer 5").build()).add(
OSType.builder().id(86).OSCategoryId(9).description("SCO UnixWare 7").build()).add(
OSType.builder().id(79).OSCategoryId(9).description("Sun Solaris 10(32-bit)").build()).add(
OSType.builder().id(80).OSCategoryId(9).description("Sun Solaris 10(64-bit)").build()).add(
OSType.builder().id(82).OSCategoryId(9).description("Sun Solaris 8(Experimental)").build())
.add(OSType.builder().id(81).OSCategoryId(9).description("Sun Solaris 9(Experimental)").build()).add(
OSType.builder().id(109).OSCategoryId(5).description("SUSE Linux Enterprise 10(32-bit)")
.build()).add(
OSType.builder().id(110).OSCategoryId(5).description("SUSE Linux Enterprise 10(64-bit)")
.build()).add(
OSType.builder().id(96).OSCategoryId(5).description("SUSE Linux Enterprise 8(32-bit)").build())
.add(OSType.builder().id(97).OSCategoryId(5).description("SUSE Linux Enterprise 8(64-bit)").build()) .add(OSType.builder().id(97).OSCategoryId(5).description("SUSE Linux Enterprise 8(64-bit)").build())
.add(OSType.builder().id(107).OSCategoryId(5).description("SUSE Linux Enterprise 9(32-bit)").build()) .add(OSType.builder().id(107).OSCategoryId(5).description("SUSE Linux Enterprise 9(32-bit)").build())
.add(OSType.builder().id(108).OSCategoryId(5).description("SUSE Linux Enterprise 9(64-bit)").build()) .add(OSType.builder().id(108).OSCategoryId(5).description("SUSE Linux Enterprise 9(64-bit)").build())
.add( .add(OSType.builder().id(41).OSCategoryId(5).description("SUSE Linux Enterprise Server 10 SP1 (32-bit)")
OSType.builder().id(41).OSCategoryId(5).description( .build())
"SUSE Linux Enterprise Server 10 SP1 (32-bit)").build()).add( .add(OSType.builder().id(42).OSCategoryId(5).description("SUSE Linux Enterprise Server 10 SP1 (64-bit)")
OSType.builder().id(42).OSCategoryId(5).description( .build())
"SUSE Linux Enterprise Server 10 SP1 (64-bit)").build()).add( .add(OSType.builder().id(43).OSCategoryId(5).description("SUSE Linux Enterprise Server 10 SP2 (32-bit)")
OSType.builder().id(43).OSCategoryId(5).description( .build())
"SUSE Linux Enterprise Server 10 SP2 (32-bit)").build()).add( .add(OSType.builder().id(44).OSCategoryId(5).description("SUSE Linux Enterprise Server 10 SP2 (64-bit)")
OSType.builder().id(44).OSCategoryId(5).description( .build())
"SUSE Linux Enterprise Server 10 SP2 (64-bit)").build()).add( .add(OSType.builder().id(45).OSCategoryId(5).description("SUSE Linux Enterprise Server 10 SP3 (64-bit)")
OSType.builder().id(45).OSCategoryId(5).description( .build())
"SUSE Linux Enterprise Server 10 SP3 (64-bit)").build()).add( .add(OSType.builder().id(46).OSCategoryId(5).description("SUSE Linux Enterprise Server 11 (32-bit)")
OSType.builder().id(46).OSCategoryId(5).description("SUSE Linux Enterprise Server 11 (32-bit)") .build())
.build()).add( .add(OSType.builder().id(47).OSCategoryId(5).description("SUSE Linux Enterprise Server 11 (64-bit)")
OSType.builder().id(47).OSCategoryId(5).description("SUSE Linux Enterprise Server 11 (64-bit)") .build())
.build()).add( .add(OSType.builder().id(40).OSCategoryId(5).description("SUSE Linux Enterprise Server 9 SP4 (32-bit)")
OSType.builder().id(40).OSCategoryId(5).description( .build())
"SUSE Linux Enterprise Server 9 SP4 (32-bit)").build()).add( .add(OSType.builder().id(121).OSCategoryId(10).description("Ubuntu 10.04 (32-bit)").build())
OSType.builder().id(121).OSCategoryId(10).description("Ubuntu 10.04 (32-bit)").build()).add( .add(OSType.builder().id(126).OSCategoryId(10).description("Ubuntu 10.04 (64-bit)").build())
OSType.builder().id(126).OSCategoryId(10).description("Ubuntu 10.04 (64-bit)").build()).add( .add(OSType.builder().id(125).OSCategoryId(10).description("Ubuntu 8.04 (32-bit)").build())
OSType.builder().id(125).OSCategoryId(10).description("Ubuntu 8.04 (32-bit)").build()).add( .add(OSType.builder().id(130).OSCategoryId(10).description("Ubuntu 8.04 (64-bit)").build())
OSType.builder().id(130).OSCategoryId(10).description("Ubuntu 8.04 (64-bit)").build()).add( .add(OSType.builder().id(124).OSCategoryId(10).description("Ubuntu 8.10 (32-bit)").build())
OSType.builder().id(124).OSCategoryId(10).description("Ubuntu 8.10 (32-bit)").build()).add( .add(OSType.builder().id(129).OSCategoryId(10).description("Ubuntu 8.10 (64-bit)").build())
OSType.builder().id(129).OSCategoryId(10).description("Ubuntu 8.10 (64-bit)").build()).add( .add(OSType.builder().id(123).OSCategoryId(10).description("Ubuntu 9.04 (32-bit)").build())
OSType.builder().id(123).OSCategoryId(10).description("Ubuntu 9.04 (32-bit)").build()).add( .add(OSType.builder().id(128).OSCategoryId(10).description("Ubuntu 9.04 (64-bit)").build())
OSType.builder().id(128).OSCategoryId(10).description("Ubuntu 9.04 (64-bit)").build()).add( .add(OSType.builder().id(122).OSCategoryId(10).description("Ubuntu 9.10 (32-bit)").build())
OSType.builder().id(122).OSCategoryId(10).description("Ubuntu 9.10 (32-bit)").build()).add( .add(OSType.builder().id(127).OSCategoryId(10).description("Ubuntu 9.10 (64-bit)").build())
OSType.builder().id(127).OSCategoryId(10).description("Ubuntu 9.10 (64-bit)").build()).add( .add(OSType.builder().id(95).OSCategoryId(6).description("Windows 2000 Advanced Server").build())
OSType.builder().id(95).OSCategoryId(6).description("Windows 2000 Advanced Server").build()) .add(OSType.builder().id(105).OSCategoryId(6).description("Windows 2000 Professional").build())
.add(OSType.builder().id(105).OSCategoryId(6).description("Windows 2000 Professional").build()).add( .add(OSType.builder().id(61).OSCategoryId(6).description("Windows 2000 Server").build())
OSType.builder().id(61).OSCategoryId(6).description("Windows 2000 Server").build())
.add(OSType.builder().id(55).OSCategoryId(6).description("Windows 2000 Server SP4 (32-bit)").build()) .add(OSType.builder().id(55).OSCategoryId(6).description("Windows 2000 Server SP4 (32-bit)").build())
.add(OSType.builder().id(65).OSCategoryId(6).description("Windows 3.1").build()).add( .add(OSType.builder().id(65).OSCategoryId(6).description("Windows 3.1").build())
OSType.builder().id(48).OSCategoryId(6).description("Windows 7 (32-bit)").build()).add( .add(OSType.builder().id(48).OSCategoryId(6).description("Windows 7 (32-bit)").build())
OSType.builder().id(49).OSCategoryId(6).description("Windows 7 (64-bit)").build()).add( .add(OSType.builder().id(49).OSCategoryId(6).description("Windows 7 (64-bit)").build())
OSType.builder().id(63).OSCategoryId(6).description("Windows 95").build()).add( .add(OSType.builder().id(63).OSCategoryId(6).description("Windows 95").build())
OSType.builder().id(62).OSCategoryId(6).description("Windows 98").build()).add( .add(OSType.builder().id(62).OSCategoryId(6).description("Windows 98").build())
OSType.builder().id(64).OSCategoryId(6).description("Windows NT 4").build()).add( .add(OSType.builder().id(64).OSCategoryId(6).description("Windows NT 4").build())
OSType.builder().id(87).OSCategoryId(6).description( .add(OSType.builder().id(87).OSCategoryId(6).description("Windows Server 2003 DataCenter Edition(32-bit)")
"Windows Server 2003 DataCenter Edition(32-bit)").build()).add( .build())
OSType.builder().id(88).OSCategoryId(6).description( .add(OSType.builder().id(88).OSCategoryId(6).description("Windows Server 2003 DataCenter Edition(64-bit)")
"Windows Server 2003 DataCenter Edition(64-bit)").build()).add( .build())
OSType.builder().id(50).OSCategoryId(6).description( .add(OSType.builder().id(50).OSCategoryId(6).description("Windows Server 2003 Enterprise Edition(32-bit)")
"Windows Server 2003 Enterprise Edition(32-bit)").build()).add( .build())
OSType.builder().id(51).OSCategoryId(6).description( .add(OSType.builder().id(51).OSCategoryId(6).description("Windows Server 2003 Enterprise Edition(64-bit)")
"Windows Server 2003 Enterprise Edition(64-bit)").build()).add( .build())
OSType.builder().id(89).OSCategoryId(6).description( .add(OSType.builder().id(89).OSCategoryId(6).description("Windows Server 2003 Standard Edition(32-bit)")
"Windows Server 2003 Standard Edition(32-bit)").build()).add( .build())
OSType.builder().id(90).OSCategoryId(6).description( .add(OSType.builder().id(90).OSCategoryId(6).description("Windows Server 2003 Standard Edition(64-bit)")
"Windows Server 2003 Standard Edition(64-bit)").build()).add( .build())
OSType.builder().id(91).OSCategoryId(6).description("Windows Server 2003 Web Edition").build()) .add(OSType.builder().id(91).OSCategoryId(6).description("Windows Server 2003 Web Edition").build())
.add(OSType.builder().id(52).OSCategoryId(6).description("Windows Server 2008 (32-bit)").build()).add( .add(OSType.builder().id(52).OSCategoryId(6).description("Windows Server 2008 (32-bit)").build())
OSType.builder().id(53).OSCategoryId(6).description("Windows Server 2008 (64-bit)").build()) .add(OSType.builder().id(53).OSCategoryId(6).description("Windows Server 2008 (64-bit)").build())
.add(OSType.builder().id(54).OSCategoryId(6).description("Windows Server 2008 R2 (64-bit)").build()) .add(OSType.builder().id(54).OSCategoryId(6).description("Windows Server 2008 R2 (64-bit)").build())
.add(OSType.builder().id(56).OSCategoryId(6).description("Windows Vista (32-bit)").build()).add( .add(OSType.builder().id(56).OSCategoryId(6).description("Windows Vista (32-bit)").build())
OSType.builder().id(101).OSCategoryId(6).description("Windows Vista (64-bit)").build()).add( .add(OSType.builder().id(101).OSCategoryId(6).description("Windows Vista (64-bit)").build())
OSType.builder().id(93).OSCategoryId(6).description("Windows XP (32-bit)").build()).add( .add(OSType.builder().id(93).OSCategoryId(6).description("Windows XP (32-bit)").build())
OSType.builder().id(94).OSCategoryId(6).description("Windows XP (64-bit)").build()).add( .add(OSType.builder().id(94).OSCategoryId(6).description("Windows XP (64-bit)").build())
OSType.builder().id(57).OSCategoryId(6).description("Windows XP SP2 (32-bit)").build()).add( .add(OSType.builder().id(57).OSCategoryId(6).description("Windows XP SP2 (32-bit)").build())
OSType.builder().id(58).OSCategoryId(6).description("Windows XP SP3 (32-bit)").build()).build(); .add(OSType.builder().id(58).OSCategoryId(6).description("Windows XP SP3 (32-bit)").build()).build();
} }
} }

View File

@ -35,7 +35,6 @@ import com.google.common.collect.ImmutableSet;
@Test(groups = "unit") @Test(groups = "unit")
public class ListPublicIPAddressesResponseTest extends BaseSetParserTest<PublicIPAddress> { public class ListPublicIPAddressesResponseTest extends BaseSetParserTest<PublicIPAddress> {
@Override @Override
public String resource() { public String resource() {
return "/listpublicipaddressesresponse.json"; return "/listpublicipaddressesresponse.json";

View File

@ -47,7 +47,10 @@ public class NetworkPredicatesTest {
} }
public void testSupportsStaticNATFindsWhenFirewallHasStaticNatFeature() { public void testSupportsStaticNATFindsWhenFirewallHasStaticNatFeature() {
Network network = Network.builder().id(204).services( Network network = Network
.builder()
.id(204)
.services(
ImmutableSet.of(new NetworkService("Firewall", ImmutableMap.<String, String> of("StaticNat", "true")))) ImmutableSet.of(new NetworkService("Firewall", ImmutableMap.<String, String> of("StaticNat", "true"))))
.build(); .build();
@ -57,8 +60,8 @@ public class NetworkPredicatesTest {
} }
public void testNoSupport() { public void testNoSupport() {
Network network = Network.builder().id(204).services( Network network = Network.builder().id(204)
ImmutableSet.of(new NetworkService("Firewall", ImmutableMap.<String, String> of()))).build(); .services(ImmutableSet.of(new NetworkService("Firewall", ImmutableMap.<String, String> of()))).build();
assert !hasLoadBalancerService().apply(network); assert !hasLoadBalancerService().apply(network);
assert !supportsStaticNAT().apply(network); assert !supportsStaticNAT().apply(network);
@ -66,9 +69,12 @@ public class NetworkPredicatesTest {
} }
public void testSupportsPortForwardingFindsWhenFirewallHasPortForwardingFeature() { public void testSupportsPortForwardingFindsWhenFirewallHasPortForwardingFeature() {
Network network = Network.builder().id(204).services( Network network = Network
ImmutableSet.of(new NetworkService("Firewall", ImmutableMap .builder()
.<String, String> of("PortForwarding", "true")))).build(); .id(204)
.services(
ImmutableSet.of(new NetworkService("Firewall", ImmutableMap.<String, String> of("PortForwarding",
"true")))).build();
assert !hasLoadBalancerService().apply(network); assert !hasLoadBalancerService().apply(network);
assert !supportsStaticNAT().apply(network); assert !supportsStaticNAT().apply(network);
@ -76,7 +82,10 @@ public class NetworkPredicatesTest {
} }
public void testSupportsPortForwardingAndStaticNATWhenFirewallHasFeatures() { public void testSupportsPortForwardingAndStaticNATWhenFirewallHasFeatures() {
Network network = Network.builder().id(204).services( Network network = Network
.builder()
.id(204)
.services(
ImmutableSet.of(new NetworkService("Firewall", ImmutableMap.<String, String> of("StaticNat", "true", ImmutableSet.of(new NetworkService("Firewall", ImmutableMap.<String, String> of("StaticNat", "true",
"PortForwarding", "true")))).build(); "PortForwarding", "true")))).build();

View File

@ -53,16 +53,16 @@ public class PublicIPAddressPredicatesTest {
} }
public void testIsNotAvailableWhenSourceNAT() { public void testIsNotAvailableWhenSourceNAT() {
PublicIPAddress address = PublicIPAddress.builder().state(PublicIPAddress.State.ALLOCATED).isSourceNAT(true).id( PublicIPAddress address = PublicIPAddress.builder().state(PublicIPAddress.State.ALLOCATED).isSourceNAT(true)
204).build(); .id(204).build();
assert !available().apply(address); assert !available().apply(address);
} }
public void testIsNotAvailableWhenStaticNAT() { public void testIsNotAvailableWhenStaticNAT() {
PublicIPAddress address = PublicIPAddress.builder().state(PublicIPAddress.State.ALLOCATED).isStaticNAT(true).id( PublicIPAddress address = PublicIPAddress.builder().state(PublicIPAddress.State.ALLOCATED).isStaticNAT(true)
204).build(); .id(204).build();
assert !available().apply(address); assert !available().apply(address);