http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPortForwardingRulesOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPortForwardingRulesOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPortForwardingRulesOptionsTest.java new file mode 100644 index 0000000..82402ea --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPortForwardingRulesOptionsTest.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.ListPortForwardingRulesOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListPortForwardingRulesOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListPortForwardingRulesOptions.Builder.ipAddressId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListPortForwardingRulesOptions} + */ +@Test(groups = "unit") +public class ListPortForwardingRulesOptionsTest { + + public void testAccount() { + ListPortForwardingRulesOptions options = new ListPortForwardingRulesOptions().accountInDomain("account", "6"); + assertEquals(ImmutableList.of("account"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountStatic() { + ListPortForwardingRulesOptions options = accountInDomain("account", "6"); + assertEquals(ImmutableList.of("account"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testName() { + ListPortForwardingRulesOptions options = new ListPortForwardingRulesOptions().ipAddressId("9"); + assertEquals(ImmutableList.of("9"), options.buildQueryParameters().get("ipaddressid")); + } + + public void testNameStatic() { + ListPortForwardingRulesOptions options = ipAddressId("9"); + assertEquals(ImmutableList.of("9"), options.buildQueryParameters().get("ipaddressid")); + } + + public void testDomainId() { + ListPortForwardingRulesOptions options = new ListPortForwardingRulesOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListPortForwardingRulesOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + +}
http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPublicIPAddressesOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPublicIPAddressesOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPublicIPAddressesOptionsTest.java new file mode 100644 index 0000000..fb606ae --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPublicIPAddressesOptionsTest.java @@ -0,0 +1,131 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +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.domainId; +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.usesVirtualNetwork; +import static org.jclouds.cloudstack.options.ListPublicIPAddressesOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListIPAddressesOptions} + */ +@Test(groups = "unit") +public class ListPublicIPAddressesOptionsTest { + + public void testAllocatedOnly() { + ListPublicIPAddressesOptions options = new ListPublicIPAddressesOptions().allocatedOnly(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("allocatedonly")); + } + + public void testAllocatedOnlyStatic() { + ListPublicIPAddressesOptions options = allocatedOnly(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("allocatedonly")); + } + + public void testVLANId() { + ListPublicIPAddressesOptions options = new ListPublicIPAddressesOptions().VLANId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("vlanid")); + } + + public void testVLANIdStatic() { + ListPublicIPAddressesOptions options = VLANId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("vlanid")); + } + + public void testNetworkId() { + ListPublicIPAddressesOptions options = new ListPublicIPAddressesOptions().networkId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("networkid")); + } + + public void testNetworkIdStatic() { + ListPublicIPAddressesOptions options = networkId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("networkid")); + } + + public void testIPAddress() { + ListPublicIPAddressesOptions options = new ListPublicIPAddressesOptions().IPAddress("10.1.1.1"); + assertEquals(ImmutableList.of("10.1.1.1"), options.buildQueryParameters().get("ipaddress")); + } + + public void testIPAddressStatic() { + ListPublicIPAddressesOptions options = IPAddress("10.1.1.1"); + assertEquals(ImmutableList.of("10.1.1.1"), options.buildQueryParameters().get("ipaddress")); + } + + public void testAccountInDomainId() { + ListPublicIPAddressesOptions options = new ListPublicIPAddressesOptions().accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountInDomainIdStatic() { + ListPublicIPAddressesOptions options = accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testZoneId() { + ListPublicIPAddressesOptions options = new ListPublicIPAddressesOptions().zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListPublicIPAddressesOptions options = zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testUsingVirtualNetwork() { + ListPublicIPAddressesOptions options = new ListPublicIPAddressesOptions().usesVirtualNetwork(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("forvirtualnetwork")); + } + + public void testUsingVirtualNetworkStatic() { + ListPublicIPAddressesOptions options = usesVirtualNetwork(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("forvirtualnetwork")); + } + + public void testId() { + ListPublicIPAddressesOptions options = new ListPublicIPAddressesOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testDomainId() { + ListPublicIPAddressesOptions options = new ListPublicIPAddressesOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testIdStatic() { + ListPublicIPAddressesOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testDomainIdStatic() { + ListPublicIPAddressesOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListSecurityGroupsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListSecurityGroupsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListSecurityGroupsOptionsTest.java new file mode 100644 index 0000000..6b5a6e8 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListSecurityGroupsOptionsTest.java @@ -0,0 +1,85 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.ListSecurityGroupsOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListSecurityGroupsOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListSecurityGroupsOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListSecurityGroupsOptions.Builder.named; +import static org.jclouds.cloudstack.options.ListSecurityGroupsOptions.Builder.virtualMachineId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListSecurityGroupsOptions} + */ +@Test(groups = "unit") +public class ListSecurityGroupsOptionsTest { + + public void testId() { + ListSecurityGroupsOptions options = new ListSecurityGroupsOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListSecurityGroupsOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testAccount() { + ListSecurityGroupsOptions options = new ListSecurityGroupsOptions().accountInDomain("account", "1"); + assertEquals(ImmutableList.of("account"), options.buildQueryParameters().get("account")); + } + + public void testAccountStatic() { + ListSecurityGroupsOptions options = accountInDomain("account", "1"); + assertEquals(ImmutableList.of("account"), options.buildQueryParameters().get("account")); + } + + public void testName() { + ListSecurityGroupsOptions options = new ListSecurityGroupsOptions().named("securityGroupName"); + assertEquals(ImmutableList.of("securityGroupName"), options.buildQueryParameters().get("securitygroupname")); + } + + public void testNameStatic() { + ListSecurityGroupsOptions options = named("securityGroupName"); + assertEquals(ImmutableList.of("securityGroupName"), options.buildQueryParameters().get("securitygroupname")); + } + + public void testDomainId() { + ListSecurityGroupsOptions options = new ListSecurityGroupsOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListSecurityGroupsOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testVirtualMachineId() { + ListSecurityGroupsOptions options = new ListSecurityGroupsOptions().virtualMachineId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("virtualmachineid")); + } + + public void testVirtualMachineIdStatic() { + ListSecurityGroupsOptions options = virtualMachineId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("virtualmachineid")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListServiceOfferingsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListServiceOfferingsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListServiceOfferingsOptionsTest.java new file mode 100644 index 0000000..2c4745f --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListServiceOfferingsOptionsTest.java @@ -0,0 +1,74 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.ListServiceOfferingsOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListServiceOfferingsOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListServiceOfferingsOptions.Builder.name; +import static org.jclouds.cloudstack.options.ListServiceOfferingsOptions.Builder.virtualMachineId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListServiceOfferingsOptions} + */ +@Test(groups = "unit") +public class ListServiceOfferingsOptionsTest { + + public void testId() { + ListServiceOfferingsOptions options = new ListServiceOfferingsOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListServiceOfferingsOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testName() { + ListServiceOfferingsOptions options = new ListServiceOfferingsOptions().name("name"); + assertEquals(ImmutableList.of("name"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + ListServiceOfferingsOptions options = name("name"); + assertEquals(ImmutableList.of("name"), options.buildQueryParameters().get("name")); + } + + public void testDomainId() { + ListServiceOfferingsOptions options = new ListServiceOfferingsOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListServiceOfferingsOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testVirtualMachineId() { + ListServiceOfferingsOptions options = new ListServiceOfferingsOptions().virtualMachineId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("virtualmachineid")); + } + + public void testVirtualMachineIdStatic() { + ListServiceOfferingsOptions options = virtualMachineId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("virtualmachineid")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListStoragePoolsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListStoragePoolsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListStoragePoolsOptionsTest.java new file mode 100644 index 0000000..28e0ca0 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListStoragePoolsOptionsTest.java @@ -0,0 +1,119 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.ListStoragePoolsOptions.Builder.clusterId; +import static org.jclouds.cloudstack.options.ListStoragePoolsOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListStoragePoolsOptions.Builder.ipAddress; +import static org.jclouds.cloudstack.options.ListStoragePoolsOptions.Builder.keyword; +import static org.jclouds.cloudstack.options.ListStoragePoolsOptions.Builder.name; +import static org.jclouds.cloudstack.options.ListStoragePoolsOptions.Builder.path; +import static org.jclouds.cloudstack.options.ListStoragePoolsOptions.Builder.podId; +import static org.jclouds.cloudstack.options.ListStoragePoolsOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Test for the ListStoragePoolsOptions class. + */ +@Test(groups = "unit") +public class ListStoragePoolsOptionsTest { + + public void testClusterId() { + ListStoragePoolsOptions options = new ListStoragePoolsOptions().clusterId("14"); + assertEquals(ImmutableList.of(14 + ""), options.buildQueryParameters().get("clusterid")); + } + + public void testClusterIdStatic() { + ListStoragePoolsOptions options = clusterId("14"); + assertEquals(ImmutableList.of(14 + ""), options.buildQueryParameters().get("clusterid")); + } + + public void testId() { + ListStoragePoolsOptions options = new ListStoragePoolsOptions().id("15"); + assertEquals(ImmutableList.of(15 + ""), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListStoragePoolsOptions options = id("15"); + assertEquals(ImmutableList.of(15 + ""), options.buildQueryParameters().get("id")); + } + + public void testIpAddress() { + ListStoragePoolsOptions options = new ListStoragePoolsOptions().ipAddress("192.168.42.42"); + assertEquals(ImmutableList.of("192.168.42.42"), options.buildQueryParameters().get("ipaddress")); + } + + public void testIpAddressStatic() { + ListStoragePoolsOptions options = ipAddress("192.168.42.42"); + assertEquals(ImmutableList.of("192.168.42.42"), options.buildQueryParameters().get("ipaddress")); + } + + public void testKeyword() { + ListStoragePoolsOptions options = new ListStoragePoolsOptions().keyword("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("keyword")); + } + + public void testKeywordStatic() { + ListStoragePoolsOptions options = keyword("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("keyword")); + } + + public void testName() { + ListStoragePoolsOptions options = new ListStoragePoolsOptions().name("bob"); + assertEquals(ImmutableList.of("bob"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + ListStoragePoolsOptions options = name("bob"); + assertEquals(ImmutableList.of("bob"), options.buildQueryParameters().get("name")); + } + + public void testPath() { + ListStoragePoolsOptions options = new ListStoragePoolsOptions().path("/foo/bar"); + assertEquals(ImmutableList.of("/foo/bar"), options.buildQueryParameters().get("path")); + } + + public void testPathStatic() { + ListStoragePoolsOptions options = path("/foo/bar"); + assertEquals(ImmutableList.of("/foo/bar"), options.buildQueryParameters().get("path")); + } + + public void testPodId() { + ListStoragePoolsOptions options = new ListStoragePoolsOptions().podId("16"); + assertEquals(ImmutableList.of(16 + ""), options.buildQueryParameters().get("podid")); + } + + public void testPodIdStatic() { + ListStoragePoolsOptions options = podId("16"); + assertEquals(ImmutableList.of(16 + ""), options.buildQueryParameters().get("podid")); + } + + public void testZoneId() { + ListStoragePoolsOptions options = new ListStoragePoolsOptions().zoneId("17"); + assertEquals(ImmutableList.of(17 + ""), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListStoragePoolsOptions options = zoneId("17"); + assertEquals(ImmutableList.of(17 + ""), options.buildQueryParameters().get("zoneid")); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListTemplatesOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListTemplatesOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListTemplatesOptionsTest.java new file mode 100644 index 0000000..17be0e0 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListTemplatesOptionsTest.java @@ -0,0 +1,114 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.ListTemplatesOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListTemplatesOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListTemplatesOptions.Builder.filter; +import static org.jclouds.cloudstack.options.ListTemplatesOptions.Builder.hypervisor; +import static org.jclouds.cloudstack.options.ListTemplatesOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListTemplatesOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.jclouds.cloudstack.domain.TemplateFilter; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListTemplatesOptions} + */ +@Test(groups = "unit") +public class ListTemplatesOptionsTest { + + public void testId() { + ListTemplatesOptions options = new ListTemplatesOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListTemplatesOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testDomainId() { + ListTemplatesOptions options = new ListTemplatesOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListTemplatesOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountInDomainId() { + ListTemplatesOptions options = new ListTemplatesOptions().accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountInDomainIdStatic() { + ListTemplatesOptions options = accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testHypervisor() { + ListTemplatesOptions options = new ListTemplatesOptions().hypervisor("KVM"); + assertEquals(ImmutableList.of("KVM"), options.buildQueryParameters().get("hypervisor")); + } + + public void testHypervisorStatic() { + ListTemplatesOptions options = hypervisor("KVM"); + assertEquals(ImmutableList.of("KVM"), options.buildQueryParameters().get("hypervisor")); + } + + public void testName() { + ListTemplatesOptions options = new ListTemplatesOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testNameStatic() { + ListTemplatesOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testZoneId() { + ListTemplatesOptions options = new ListTemplatesOptions().zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListTemplatesOptions options = zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testFilterDefault() { + assertEquals(ImmutableList.of("executable"), + new ListTemplatesOptions().buildQueryParameters().get("templatefilter")); + } + + public void testFilter() { + ListTemplatesOptions options = new ListTemplatesOptions().filter(TemplateFilter.SELF_EXECUTABLE); + assertEquals(ImmutableList.of("self-executable"), options.buildQueryParameters().get("templatefilter")); + } + + public void testFilterStatic() { + ListTemplatesOptions options = filter(TemplateFilter.SELF_EXECUTABLE); + assertEquals(ImmutableList.of("self-executable"), options.buildQueryParameters().get("templatefilter")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListUsageRecordsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListUsageRecordsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListUsageRecordsOptionsTest.java new file mode 100644 index 0000000..80b9896 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListUsageRecordsOptionsTest.java @@ -0,0 +1,95 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.ListUsageRecordsOptions.Builder.accountId; +import static org.jclouds.cloudstack.options.ListUsageRecordsOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListUsageRecordsOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListUsageRecordsOptions.Builder.keyword; +import static org.jclouds.cloudstack.options.ListUsageRecordsOptions.Builder.page; +import static org.jclouds.cloudstack.options.ListUsageRecordsOptions.Builder.pageSize; +import static org.jclouds.cloudstack.options.ListUsageRecordsOptions.Builder.type; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * Options to the GlobalUsageApi.listUsageOptions() API call + */ +@Test(groups = "unit") +public class ListUsageRecordsOptionsTest { + + public void testAccountInDomain() { + ListUsageRecordsOptions options = new ListUsageRecordsOptions().accountInDomain("fred", "42"); + assertEquals(ImmutableSet.of("fred"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableSet.of("42"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountInDomainStatic() { + ListUsageRecordsOptions options = accountInDomain("fred", "42"); + assertEquals(ImmutableSet.of("fred"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableSet.of("42"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainId() { + ListUsageRecordsOptions options = new ListUsageRecordsOptions().domainId("42"); + assertEquals(ImmutableSet.of("42"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListUsageRecordsOptions options = domainId("42"); + assertEquals(ImmutableSet.of("42"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountId() { + ListUsageRecordsOptions options = new ListUsageRecordsOptions().accountId("41"); + assertEquals(ImmutableSet.of("41"), options.buildQueryParameters().get("accountid")); + } + + public void testAccountIdStatic() { + ListUsageRecordsOptions options = accountId("41"); + assertEquals(ImmutableSet.of("41"), options.buildQueryParameters().get("accountid")); + } + + public void testKeyword() { + ListUsageRecordsOptions options = new ListUsageRecordsOptions().keyword("bob"); + assertEquals(ImmutableSet.of("bob"), options.buildQueryParameters().get("keyword")); + } + + public void testKeywordStatic() { + ListUsageRecordsOptions options = keyword("bob"); + assertEquals(ImmutableSet.of("bob"), options.buildQueryParameters().get("keyword")); + } + + public void testTypeStatic() { + ListUsageRecordsOptions options = type("3"); + assertEquals(ImmutableSet.of("3"), options.buildQueryParameters().get("type")); + } + + public void testPageStatic() { + ListUsageRecordsOptions options = page("1"); + assertEquals(ImmutableSet.of("1"), options.buildQueryParameters().get("page")); + } + + public void testPageSizeStatic() { + ListUsageRecordsOptions options = pageSize("500"); + assertEquals(ImmutableSet.of("500"), options.buildQueryParameters().get("pagesize")); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListUsersOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListUsersOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListUsersOptionsTest.java new file mode 100644 index 0000000..fe3ac34 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListUsersOptionsTest.java @@ -0,0 +1,129 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.ListUsersOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListUsersOptions.Builder.accountType; +import static org.jclouds.cloudstack.options.ListUsersOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListUsersOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListUsersOptions.Builder.keyword; +import static org.jclouds.cloudstack.options.ListUsersOptions.Builder.page; +import static org.jclouds.cloudstack.options.ListUsersOptions.Builder.pageSize; +import static org.jclouds.cloudstack.options.ListUsersOptions.Builder.state; +import static org.jclouds.cloudstack.options.ListUsersOptions.Builder.userName; +import static org.testng.Assert.assertEquals; + +import org.jclouds.cloudstack.domain.User; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@code ListUsersOptions} + */ +@Test(groups = "unit") +public class ListUsersOptionsTest { + + + public void testId() { + ListUsersOptions options = new ListUsersOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListUsersOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testUserName() { + ListUsersOptions options = new ListUsersOptions().userName("andrei"); + assertEquals(ImmutableSet.of("andrei"), options.buildQueryParameters().get("name")); + } + + public void testUserNameStatic() { + ListUsersOptions options = userName("andrei"); + assertEquals(ImmutableSet.of("andrei"), options.buildQueryParameters().get("name")); + } + + public void testState() { + ListUsersOptions options = new ListUsersOptions().state(User.State.ENABLED); + assertEquals(ImmutableList.of("enabled"), options.buildQueryParameters().get("state")); + } + + public void testStateStatic() { + ListUsersOptions options = state(User.State.ENABLED); + assertEquals(ImmutableList.of("enabled"), options.buildQueryParameters().get("state")); + } + + public void testAccountType() { + ListUsersOptions options = new ListUsersOptions().accountType("user"); + assertEquals(ImmutableList.of("user"), options.buildQueryParameters().get("accounttype")); + } + + public void testAccountTypeStatic() { + ListUsersOptions options = accountType("user"); + assertEquals(ImmutableList.of("user"), options.buildQueryParameters().get("accounttype")); + } + + public void testKeyword() { + ListUsersOptions options = new ListUsersOptions().keyword("key"); + assertEquals(ImmutableList.of("key"), options.buildQueryParameters().get("keyword")); + } + + public void testKeywordStatic() { + ListUsersOptions options = keyword("key"); + assertEquals(ImmutableList.of("key"), options.buildQueryParameters().get("keyword")); + } + + public void testPage() { + ListUsersOptions options = new ListUsersOptions().page(6); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("page")); + } + + public void testPageStatic() { + ListUsersOptions options = page(6); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("page")); + } + + public void testPageSize() { + ListUsersOptions options = new ListUsersOptions().pageSize(6); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("pagesize")); + } + + public void testPageSizeStatic() { + ListUsersOptions options = pageSize(6); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("pagesize")); + } + + public void testAccountInDomainId() { + ListUsersOptions options = new ListUsersOptions().accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountInDomainIdStatic() { + ListUsersOptions options = accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListUsersOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListVirtualMachesOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListVirtualMachesOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListVirtualMachesOptionsTest.java new file mode 100644 index 0000000..bb5df4c --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListVirtualMachesOptionsTest.java @@ -0,0 +1,152 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.ListVirtualMachinesOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListVirtualMachinesOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListVirtualMachinesOptions.Builder.groupId; +import static org.jclouds.cloudstack.options.ListVirtualMachinesOptions.Builder.hostId; +import static org.jclouds.cloudstack.options.ListVirtualMachinesOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListVirtualMachinesOptions.Builder.networkId; +import static org.jclouds.cloudstack.options.ListVirtualMachinesOptions.Builder.podId; +import static org.jclouds.cloudstack.options.ListVirtualMachinesOptions.Builder.state; +import static org.jclouds.cloudstack.options.ListVirtualMachinesOptions.Builder.usesVirtualNetwork; +import static org.jclouds.cloudstack.options.ListVirtualMachinesOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListVirtualMachinesOptions} + */ +@Test(groups = "unit") +public class ListVirtualMachesOptionsTest { + + public void testHostId() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().hostId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("hostid")); + } + + public void testHostIdStatic() { + ListVirtualMachinesOptions options = hostId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("hostid")); + } + + public void testPodId() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().podId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("podid")); + } + + public void testPodIdStatic() { + ListVirtualMachinesOptions options = podId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("podid")); + } + + public void testNetworkId() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().networkId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("networkid")); + } + + public void testNetworkIdStatic() { + ListVirtualMachinesOptions options = networkId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("networkid")); + } + + public void testGroupId() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().groupId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("groupid")); + } + + public void testGroupIdStatic() { + ListVirtualMachinesOptions options = groupId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("groupid")); + } + + public void testAccountInDomainId() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountInDomainIdStatic() { + ListVirtualMachinesOptions options = accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testName() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testNameStatic() { + ListVirtualMachinesOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testZoneId() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListVirtualMachinesOptions options = zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testState() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().state("state"); + assertEquals(ImmutableList.of("state"), options.buildQueryParameters().get("state")); + } + + public void testStateStatic() { + ListVirtualMachinesOptions options = state("state"); + assertEquals(ImmutableList.of("state"), options.buildQueryParameters().get("state")); + } + + public void testUsingVirtualNetwork() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().usesVirtualNetwork(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("forvirtualnetwork")); + } + + public void testUsingVirtualNetworkStatic() { + ListVirtualMachinesOptions options = usesVirtualNetwork(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("forvirtualnetwork")); + } + + public void testId() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testDomainId() { + ListVirtualMachinesOptions options = new ListVirtualMachinesOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testIdStatic() { + ListVirtualMachinesOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testDomainIdStatic() { + ListVirtualMachinesOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListVlanIPRangesOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListVlanIPRangesOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListVlanIPRangesOptionsTest.java new file mode 100644 index 0000000..b8139f4 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListVlanIPRangesOptionsTest.java @@ -0,0 +1,132 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.ListVlanIPRangesOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListVlanIPRangesOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListVlanIPRangesOptions.Builder.forVirtualNetwork; +import static org.jclouds.cloudstack.options.ListVlanIPRangesOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListVlanIPRangesOptions.Builder.keyword; +import static org.jclouds.cloudstack.options.ListVlanIPRangesOptions.Builder.networkId; +import static org.jclouds.cloudstack.options.ListVlanIPRangesOptions.Builder.podId; +import static org.jclouds.cloudstack.options.ListVlanIPRangesOptions.Builder.vlan; +import static org.jclouds.cloudstack.options.ListVlanIPRangesOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListVlanIPRangesOptions} + */ +@Test(groups = "unit") +public class ListVlanIPRangesOptionsTest { + + public void testAccountInDomain() { + ListVlanIPRangesOptions options = new ListVlanIPRangesOptions().accountInDomain("fred", "19"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("19"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountInDomainStatic() { + ListVlanIPRangesOptions options = accountInDomain("fred", "19"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("19"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainId() { + ListVlanIPRangesOptions options = new ListVlanIPRangesOptions().domainId("19"); + assertEquals(ImmutableList.of("19"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListVlanIPRangesOptions options = domainId("19"); + assertEquals(ImmutableList.of("19"), options.buildQueryParameters().get("domainid")); + } + + public void testForVirtualNetwork() { + ListVlanIPRangesOptions options = new ListVlanIPRangesOptions().forVirtualNetwork(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("forvirtualnetwork")); + } + + public void testForVirtualNetworkStatic() { + ListVlanIPRangesOptions options = forVirtualNetwork(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("forvirtualnetwork")); + } + + public void testId() { + ListVlanIPRangesOptions options = new ListVlanIPRangesOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListVlanIPRangesOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testKeyword() { + ListVlanIPRangesOptions options = new ListVlanIPRangesOptions().keyword("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("keyword")); + } + + public void testKeywordStatic() { + ListVlanIPRangesOptions options = keyword("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("keyword")); + } + + public void testNetworkId() { + ListVlanIPRangesOptions options = new ListVlanIPRangesOptions().networkId("209"); + assertEquals(ImmutableList.of("209"), options.buildQueryParameters().get("networkid")); + } + + public void testNetworkIdStatic() { + ListVlanIPRangesOptions options = networkId("209"); + assertEquals(ImmutableList.of("209"), options.buildQueryParameters().get("networkid")); + } + + public void testPodId() { + ListVlanIPRangesOptions options = new ListVlanIPRangesOptions().podId("13"); + assertEquals(ImmutableList.of("13"), options.buildQueryParameters().get("podid")); + } + + public void testPodIdStatic() { + ListVlanIPRangesOptions options = podId("13"); + assertEquals(ImmutableList.of("13"), options.buildQueryParameters().get("podid")); + } + + public void testVlan() { + ListVlanIPRangesOptions options = new ListVlanIPRangesOptions().vlan(1001); + assertEquals(ImmutableList.of("1001"), options.buildQueryParameters().get("vlan")); + } + + public void testVlanStatic() { + ListVlanIPRangesOptions options = vlan(1001); + assertEquals(ImmutableList.of("1001"), options.buildQueryParameters().get("vlan")); + } + + public void testZoneId() { + ListVlanIPRangesOptions options = new ListVlanIPRangesOptions().zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListVlanIPRangesOptions options = zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListZonesOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListZonesOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListZonesOptionsTest.java new file mode 100644 index 0000000..17d1146 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListZonesOptionsTest.java @@ -0,0 +1,63 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.ListZonesOptions.Builder.available; +import static org.jclouds.cloudstack.options.ListZonesOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListZonesOptions.Builder.id; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListZonesOptions} + */ +@Test(groups = "unit") +public class ListZonesOptionsTest { + + public void testId() { + ListZonesOptions options = new ListZonesOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testAvailable() { + ListZonesOptions options = new ListZonesOptions().available(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("available")); + } + + public void testDomainId() { + ListZonesOptions options = new ListZonesOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testIdStatic() { + ListZonesOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testAvailableStatic() { + ListZonesOptions options = available(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("available")); + } + + public void testDomainIdStatic() { + ListZonesOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateAccountOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateAccountOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateAccountOptionsTest.java new file mode 100644 index 0000000..6d6cdee --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateAccountOptionsTest.java @@ -0,0 +1,41 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.UpdateAccountOptions.Builder.networkDomain; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@code UpdateAccountOptions} + */ +@Test(groups = "unit") +public class UpdateAccountOptionsTest { + + public void testNetworkDomain() { + UpdateAccountOptions options = new UpdateAccountOptions().networkDomain("net"); + assertEquals(ImmutableSet.of("net"), options.buildQueryParameters().get("networkdomain")); + } + + public void testNameStatic() { + UpdateAccountOptions options = networkDomain("net"); + assertEquals(ImmutableSet.of("net"), options.buildQueryParameters().get("networkdomain")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateClusterOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateClusterOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateClusterOptionsTest.java new file mode 100644 index 0000000..b5c933e --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateClusterOptionsTest.java @@ -0,0 +1,65 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.UpdateClusterOptions.Builder.allocationState; +import static org.testng.Assert.assertEquals; + +import org.jclouds.cloudstack.domain.AllocationState; +import org.jclouds.cloudstack.domain.Cluster; +import org.jclouds.cloudstack.domain.Host; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code UpdateClusterOptions} + */ +@Test(groups = "unit") +public class UpdateClusterOptionsTest { + + public void testAllocationState() { + UpdateClusterOptions options = new UpdateClusterOptions().allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testAllocationStateStatic() { + UpdateClusterOptions options = allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testClusterName() { + UpdateClusterOptions options = new UpdateClusterOptions().clusterName("My Cluster"); + assertEquals(ImmutableList.of("My Cluster"), options.buildQueryParameters().get("clustername")); + } + + public void testClusterType() { + UpdateClusterOptions options = new UpdateClusterOptions().clusterType(Host.ClusterType.CLOUD_MANAGED); + assertEquals(ImmutableList.of("CloudManaged"), options.buildQueryParameters().get("clustertype")); + } + + public void testHypervisor() { + UpdateClusterOptions options = new UpdateClusterOptions().hypervisor("XenServer"); + assertEquals(ImmutableList.of("XenServer"), options.buildQueryParameters().get("hypervisor")); + } + + public void testManagedState() { + UpdateClusterOptions options = new UpdateClusterOptions().managedState(Cluster.ManagedState.PREPARE_UNMANAGED); + assertEquals(ImmutableList.of("PrepareUnmanaged"), options.buildQueryParameters().get("managedstate")); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateDiskOfferingOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateDiskOfferingOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateDiskOfferingOptionsTest.java new file mode 100644 index 0000000..097b12d --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateDiskOfferingOptionsTest.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.UpdateDiskOfferingOptions.Builder.displayText; +import static org.jclouds.cloudstack.options.UpdateDiskOfferingOptions.Builder.name; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@code UpdateDiskOfferingOptions} + */ +@Test(groups = "unit") +public class UpdateDiskOfferingOptionsTest { + + public void testName() { + UpdateDiskOfferingOptions options = new UpdateDiskOfferingOptions().name("test-name"); + assertEquals(ImmutableSet.of("test-name"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + UpdateDiskOfferingOptions options = name("test-name"); + assertEquals(ImmutableSet.of("test-name"), options.buildQueryParameters().get("name")); + } + + public void testDisplayText() { + UpdateDiskOfferingOptions options = new UpdateDiskOfferingOptions().displayText("test-display-text"); + assertEquals(ImmutableSet.of("test-display-text"), options.buildQueryParameters().get("displaytext")); + } + + public void testDisplayTextStatic() { + UpdateDiskOfferingOptions options = displayText("test-display-text"); + assertEquals(ImmutableSet.of("test-display-text"), options.buildQueryParameters().get("displaytext")); + } + + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateHostOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateHostOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateHostOptionsTest.java new file mode 100644 index 0000000..bf4d088 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateHostOptionsTest.java @@ -0,0 +1,66 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.UpdateHostOptions.Builder.allocationState; +import static org.jclouds.cloudstack.options.UpdateHostOptions.Builder.hostTags; +import static org.jclouds.cloudstack.options.UpdateHostOptions.Builder.osCategoryId; +import static org.testng.Assert.assertEquals; + +import org.jclouds.cloudstack.domain.AllocationState; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@code UpdateHostOptions} + */ +@Test(groups = "unit") +public class UpdateHostOptionsTest { + + public void testAllocationState() { + UpdateHostOptions options = new UpdateHostOptions().allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testAllocationStateStatic() { + UpdateHostOptions options = allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testHostTags() { + UpdateHostOptions options = new UpdateHostOptions().hostTags(ImmutableSet.<String>of("foo", "bar", "baz")); + assertEquals(ImmutableList.of("foo,bar,baz"), options.buildQueryParameters().get("hosttags")); + } + + public void testHostTagsStatic() { + UpdateHostOptions options = hostTags(ImmutableSet.<String>of("foo", "bar", "baz")); + assertEquals(ImmutableList.of("foo,bar,baz"), options.buildQueryParameters().get("hosttags")); + } + + public void testOsCategoryId() { + UpdateHostOptions options = new UpdateHostOptions().osCategoryId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("oscategoryid")); + } + + public void testOsCategoryIdStatic() { + UpdateHostOptions options = osCategoryId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("oscategoryid")); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateNetworkOfferingOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateNetworkOfferingOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateNetworkOfferingOptionsTest.java new file mode 100644 index 0000000..a18311c --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateNetworkOfferingOptionsTest.java @@ -0,0 +1,64 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType.OPTIONAL; +import static org.jclouds.cloudstack.options.UpdateNetworkOfferingOptions.Builder.availability; +import static org.jclouds.cloudstack.options.UpdateNetworkOfferingOptions.Builder.displayText; +import static org.jclouds.cloudstack.options.UpdateNetworkOfferingOptions.Builder.name; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@code UpdateNetworkOfferingOptions} + */ +@Test(groups = "unit") +public class UpdateNetworkOfferingOptionsTest { + + public void testName() { + UpdateNetworkOfferingOptions options = new UpdateNetworkOfferingOptions().name("test-name"); + assertEquals(ImmutableSet.of("test-name"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + UpdateNetworkOfferingOptions options = name("test-name"); + assertEquals(ImmutableSet.of("test-name"), options.buildQueryParameters().get("name")); + } + + public void testDisplayText() { + UpdateNetworkOfferingOptions options = new UpdateNetworkOfferingOptions().displayText("test-display-text"); + assertEquals(ImmutableSet.of("test-display-text"), options.buildQueryParameters().get("displaytext")); + } + + public void testDisplayTextStatic() { + UpdateNetworkOfferingOptions options = displayText("test-display-text"); + assertEquals(ImmutableSet.of("test-display-text"), options.buildQueryParameters().get("displaytext")); + } + + public void testAvailability() { + UpdateNetworkOfferingOptions options = new UpdateNetworkOfferingOptions().availability(OPTIONAL); + assertEquals(ImmutableSet.of("Optional"), options.buildQueryParameters().get("availability")); + } + + public void testAvailabilityStatic() { + UpdateNetworkOfferingOptions options = availability(OPTIONAL); + assertEquals(ImmutableSet.of("Optional"), options.buildQueryParameters().get("availability")); + } +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdatePodOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdatePodOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdatePodOptionsTest.java new file mode 100644 index 0000000..a112549 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdatePodOptionsTest.java @@ -0,0 +1,98 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.UpdatePodOptions.Builder.allocationState; +import static org.jclouds.cloudstack.options.UpdatePodOptions.Builder.endIp; +import static org.jclouds.cloudstack.options.UpdatePodOptions.Builder.gateway; +import static org.jclouds.cloudstack.options.UpdatePodOptions.Builder.name; +import static org.jclouds.cloudstack.options.UpdatePodOptions.Builder.netmask; +import static org.jclouds.cloudstack.options.UpdatePodOptions.Builder.startIp; +import static org.testng.Assert.assertEquals; + +import org.jclouds.cloudstack.domain.AllocationState; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code UpdatePodOptions} + */ +@Test(groups = "unit") +public class UpdatePodOptionsTest { + + public void testName() { + UpdatePodOptions options = new UpdatePodOptions().name("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + UpdatePodOptions options = name("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("name")); + } + + public void testStartIp() { + UpdatePodOptions options = new UpdatePodOptions().startIp("192.168.42.42"); + assertEquals(ImmutableList.of("192.168.42.42"), options.buildQueryParameters().get("startip")); + } + + public void testStartIpStatic() { + UpdatePodOptions options = startIp("192.168.42.42"); + assertEquals(ImmutableList.of("192.168.42.42"), options.buildQueryParameters().get("startip")); + } + + public void testEndIp() { + UpdatePodOptions options = new UpdatePodOptions().endIp("192.168.42.52"); + assertEquals(ImmutableList.of("192.168.42.52"), options.buildQueryParameters().get("endip")); + } + + public void testEndIpStatic() { + UpdatePodOptions options = endIp("192.168.42.52"); + assertEquals(ImmutableList.of("192.168.42.52"), options.buildQueryParameters().get("endip")); + } + + public void testGateway() { + UpdatePodOptions options = new UpdatePodOptions().gateway("192.168.42.62"); + assertEquals(ImmutableList.of("192.168.42.62"), options.buildQueryParameters().get("gateway")); + } + + public void testGatewayStatic() { + UpdatePodOptions options = gateway("192.168.42.62"); + assertEquals(ImmutableList.of("192.168.42.62"), options.buildQueryParameters().get("gateway")); + } + + public void testNetmask() { + UpdatePodOptions options = new UpdatePodOptions().netmask("255.255.240.0"); + assertEquals(ImmutableList.of("255.255.240.0"), options.buildQueryParameters().get("netmask")); + } + + public void testNetmaskStatic() { + UpdatePodOptions options = netmask("255.255.240.0"); + assertEquals(ImmutableList.of("255.255.240.0"), options.buildQueryParameters().get("netmask")); + } + + public void testAllocationState() { + UpdatePodOptions options = new UpdatePodOptions().allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testAllocationStateStatic() { + UpdatePodOptions options = allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateServiceOfferingOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateServiceOfferingOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateServiceOfferingOptionsTest.java new file mode 100644 index 0000000..7bbe2b7 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateServiceOfferingOptionsTest.java @@ -0,0 +1,54 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.UpdateServiceOfferingOptions.Builder.displayText; +import static org.jclouds.cloudstack.options.UpdateServiceOfferingOptions.Builder.name; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@code UpdateServiceOfferingOptions} + */ +@Test(groups = "unit") +public class UpdateServiceOfferingOptionsTest { + + public void testName() { + UpdateServiceOfferingOptions options = new UpdateServiceOfferingOptions().name("test-name"); + assertEquals(ImmutableSet.of("test-name"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + UpdateServiceOfferingOptions options = name("test-name"); + assertEquals(ImmutableSet.of("test-name"), options.buildQueryParameters().get("name")); + } + + public void testDisplayText() { + UpdateServiceOfferingOptions options = new UpdateServiceOfferingOptions().displayText("test-display-text"); + assertEquals(ImmutableSet.of("test-display-text"), options.buildQueryParameters().get("displaytext")); + } + + public void testDisplayTextStatic() { + UpdateServiceOfferingOptions options = displayText("test-display-text"); + assertEquals(ImmutableSet.of("test-display-text"), options.buildQueryParameters().get("displaytext")); + } + + +} http://git-wip-us.apache.org/repos/asf/stratos/blob/86fd5cf2/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateUserOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateUserOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateUserOptionsTest.java new file mode 100644 index 0000000..595e9da --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/UpdateUserOptionsTest.java @@ -0,0 +1,107 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF 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.cloudstack.options; + +import static org.jclouds.cloudstack.options.UpdateUserOptions.Builder.email; +import static org.jclouds.cloudstack.options.UpdateUserOptions.Builder.firstName; +import static org.jclouds.cloudstack.options.UpdateUserOptions.Builder.lastName; +import static org.jclouds.cloudstack.options.UpdateUserOptions.Builder.timezone; +import static org.jclouds.cloudstack.options.UpdateUserOptions.Builder.userApiKey; +import static org.jclouds.cloudstack.options.UpdateUserOptions.Builder.userName; +import static org.jclouds.cloudstack.options.UpdateUserOptions.Builder.userSecretKey; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@code UpdateUserOptions} + */ +@Test(groups = "unit") +public class UpdateUserOptionsTest { + + public void testEmail() { + UpdateUserOptions options = new UpdateUserOptions().email("[email protected]"); + assertEquals(ImmutableSet.of("[email protected]"), options.buildQueryParameters().get("email")); + } + + public void testEmailStatic() { + UpdateUserOptions options = email("[email protected]"); + assertEquals(ImmutableSet.of("[email protected]"), options.buildQueryParameters().get("email")); + } + + public void testFirstName() { + UpdateUserOptions options = new UpdateUserOptions().firstName("First"); + assertEquals(ImmutableSet.of("First"), options.buildQueryParameters().get("firstname")); + } + + public void testFirstStatic() { + UpdateUserOptions options = firstName("First"); + assertEquals(ImmutableSet.of("First"), options.buildQueryParameters().get("firstname")); + } + + public void testLastName() { + UpdateUserOptions options = new UpdateUserOptions().lastName("Last"); + assertEquals(ImmutableSet.of("Last"), options.buildQueryParameters().get("lastname")); + } + + public void testLastNameStatic() { + UpdateUserOptions options = lastName("Last"); + assertEquals(ImmutableSet.of("Last"), options.buildQueryParameters().get("lastname")); + } + + public void testTimezone() { + UpdateUserOptions options = new UpdateUserOptions().timezone("timez"); + assertEquals(ImmutableSet.of("timez"), options.buildQueryParameters().get("timezone")); + } + + public void testTimezoneStatic() { + UpdateUserOptions options = timezone("timez"); + assertEquals(ImmutableSet.of("timez"), options.buildQueryParameters().get("timezone")); + } + + public void testUserApiKey() { + UpdateUserOptions options = new UpdateUserOptions().userApiKey("sdfoasdjfo"); + assertEquals(ImmutableSet.of("sdfoasdjfo"), options.buildQueryParameters().get("userapikey")); + } + + public void testUserApiKeyStatic() { + UpdateUserOptions options = userApiKey("sdfoasdjfo"); + assertEquals(ImmutableSet.of("sdfoasdjfo"), options.buildQueryParameters().get("userapikey")); + } + + public void testUserSecretKey() { + UpdateUserOptions options = new UpdateUserOptions().userSecretKey("sdfoasdjfo"); + assertEquals(ImmutableSet.of("sdfoasdjfo"), options.buildQueryParameters().get("usersecretkey")); + } + + public void testUserSecretKeyStatic() { + UpdateUserOptions options = userSecretKey("sdfoasdjfo"); + assertEquals(ImmutableSet.of("sdfoasdjfo"), options.buildQueryParameters().get("usersecretkey")); + } + + public void testUserName() { + UpdateUserOptions options = new UpdateUserOptions().userName("andrei"); + assertEquals(ImmutableSet.of("andrei"), options.buildQueryParameters().get("username")); + } + + public void testUserNameStatic() { + UpdateUserOptions options = userName("andrei"); + assertEquals(ImmutableSet.of("andrei"), options.buildQueryParameters().get("username")); + } +}
