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/CreateUserOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateUserOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateUserOptionsTest.java new file mode 100644 index 0000000..00f56a9 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateUserOptionsTest.java @@ -0,0 +1,52 @@ +/* + * 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.CreateUserOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.CreateUserOptions.Builder.timezone; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@code CreateUserOptions} + */ +@Test(groups = "unit") +public class CreateUserOptionsTest { + + public void testDomainId() { + CreateUserOptions options = new CreateUserOptions().domainId("6"); + assertEquals(ImmutableSet.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + CreateUserOptions options = domainId("6"); + assertEquals(ImmutableSet.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testTimezone() { + CreateUserOptions options = new CreateUserOptions().timezone("something"); + assertEquals(ImmutableSet.of("something"), options.buildQueryParameters().get("timezone")); + } + + public void testTimezoneStatic() { + CreateUserOptions options = timezone("something"); + assertEquals(ImmutableSet.of("something"), options.buildQueryParameters().get("timezone")); + } +}
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/CreateVlanIPRangeOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateVlanIPRangeOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateVlanIPRangeOptionsTest.java new file mode 100644 index 0000000..570adad --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/CreateVlanIPRangeOptionsTest.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.CreateVlanIPRangeOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.CreateVlanIPRangeOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.CreateVlanIPRangeOptions.Builder.forVirtualNetwork; +import static org.jclouds.cloudstack.options.CreateVlanIPRangeOptions.Builder.gateway; +import static org.jclouds.cloudstack.options.CreateVlanIPRangeOptions.Builder.netmask; +import static org.jclouds.cloudstack.options.CreateVlanIPRangeOptions.Builder.networkId; +import static org.jclouds.cloudstack.options.CreateVlanIPRangeOptions.Builder.podId; +import static org.jclouds.cloudstack.options.CreateVlanIPRangeOptions.Builder.vlan; +import static org.jclouds.cloudstack.options.CreateVlanIPRangeOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@code CreateVlanIPRangeOptions} + */ +@Test(groups = "unit") +public class CreateVlanIPRangeOptionsTest { + + public void testAccountInDomain() { + CreateVlanIPRangeOptions options = new CreateVlanIPRangeOptions().accountInDomain("fred", "6"); + assertEquals(ImmutableSet.of("fred"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableSet.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountInDomainStatic() { + CreateVlanIPRangeOptions options = accountInDomain("fred", "6"); + assertEquals(ImmutableSet.of("fred"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableSet.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainId() { + CreateVlanIPRangeOptions options = new CreateVlanIPRangeOptions().domainId("6"); + assertEquals(ImmutableSet.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + CreateVlanIPRangeOptions options = domainId("6"); + assertEquals(ImmutableSet.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testForVirtualNetwork() { + CreateVlanIPRangeOptions options = new CreateVlanIPRangeOptions().forVirtualNetwork(true); + assertEquals(ImmutableSet.of("true"), options.buildQueryParameters().get("forvirtualnetwork")); + } + + public void testForVirtualNetworkStatic() { + CreateVlanIPRangeOptions options = forVirtualNetwork(true); + assertEquals(ImmutableSet.of("true"), options.buildQueryParameters().get("forvirtualnetwork")); + } + + public void testGateway() { + CreateVlanIPRangeOptions options = new CreateVlanIPRangeOptions().gateway("192.168.42.24"); + assertEquals(ImmutableSet.of("192.168.42.24"), options.buildQueryParameters().get("gateway")); + } + + public void testGatewayStatic() { + CreateVlanIPRangeOptions options = gateway("192.168.42.24"); + assertEquals(ImmutableSet.of("192.168.42.24"), options.buildQueryParameters().get("gateway")); + } + + public void testNetmask() { + CreateVlanIPRangeOptions options = new CreateVlanIPRangeOptions().netmask("255.255.255.240"); + assertEquals(ImmutableSet.of("255.255.255.240"), options.buildQueryParameters().get("netmask")); + } + + public void testNetmaskStatic() { + CreateVlanIPRangeOptions options = netmask("255.255.255.240"); + assertEquals(ImmutableSet.of("255.255.255.240"), options.buildQueryParameters().get("netmask")); + } + + public void testNetworkId() { + CreateVlanIPRangeOptions options = new CreateVlanIPRangeOptions().networkId("9"); + assertEquals(ImmutableSet.of("9"), options.buildQueryParameters().get("networkid")); + } + + public void testNetworkIdStatic() { + CreateVlanIPRangeOptions options = networkId("9"); + assertEquals(ImmutableSet.of("9"), options.buildQueryParameters().get("networkid")); + } + + public void testPodId() { + CreateVlanIPRangeOptions options = new CreateVlanIPRangeOptions().podId("8"); + assertEquals(ImmutableSet.of("8"), options.buildQueryParameters().get("podid")); + } + + public void testPodIdStatic() { + CreateVlanIPRangeOptions options = podId("8"); + assertEquals(ImmutableSet.of("8"), options.buildQueryParameters().get("podid")); + } + + public void testVlan() { + CreateVlanIPRangeOptions options = new CreateVlanIPRangeOptions().vlan(1001); + assertEquals(ImmutableSet.of("1001"), options.buildQueryParameters().get("vlan")); + } + + public void testVlanStatic() { + CreateVlanIPRangeOptions options = vlan(1001); + assertEquals(ImmutableSet.of("1001"), options.buildQueryParameters().get("vlan")); + } + + public void testZoneId() { + CreateVlanIPRangeOptions options = new CreateVlanIPRangeOptions().zoneId("7"); + assertEquals(ImmutableSet.of("7"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + CreateVlanIPRangeOptions options = zoneId("7"); + assertEquals(ImmutableSet.of("7"), 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/DeleteHostOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/DeleteHostOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/DeleteHostOptionsTest.java new file mode 100644 index 0000000..b601650 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/DeleteHostOptionsTest.java @@ -0,0 +1,53 @@ +/* + * 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.DeleteHostOptions.Builder.forceDestroyLocalStorage; +import static org.jclouds.cloudstack.options.DeleteHostOptions.Builder.forced; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code DeleteHostOptions} + */ +@Test(groups = "unit") +public class DeleteHostOptionsTest { + + public void testForced() { + DeleteHostOptions options = new DeleteHostOptions().forced(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("forced")); + } + + public void testForcedStatic() { + DeleteHostOptions options = forced(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("forced")); + } + + public void testForceDestroyLocalStorage() { + DeleteHostOptions options = new DeleteHostOptions().forceDestroyLocalStorage(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("forcedestroylocalstorage")); + } + + public void testForceDestroyLocalStorageStatic() { + DeleteHostOptions options = forceDestroyLocalStorage(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("forcedestroylocalstorage")); + } + +} 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/GenerateUsageRecordsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/GenerateUsageRecordsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/GenerateUsageRecordsOptionsTest.java new file mode 100644 index 0000000..62654f1 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/GenerateUsageRecordsOptionsTest.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.GenerateUsageRecordsOptions.Builder.domainId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@code GenerateUsageRecordsOptions} + */ +@Test(groups = "unit") +public class GenerateUsageRecordsOptionsTest { + + public void testDomainId() { + GenerateUsageRecordsOptions options = new GenerateUsageRecordsOptions().domainId("42"); + assertEquals(ImmutableSet.of("42"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + GenerateUsageRecordsOptions options = domainId("42"); + assertEquals(ImmutableSet.of("42"), 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/ListAccountsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListAccountsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListAccountsOptionsTest.java new file mode 100644 index 0000000..a630bc6 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListAccountsOptionsTest.java @@ -0,0 +1,108 @@ +/* + * 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.ListAccountsOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListAccountsOptions.Builder.cleanupRequired; +import static org.jclouds.cloudstack.options.ListAccountsOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListAccountsOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListAccountsOptions.Builder.recursive; +import static org.jclouds.cloudstack.options.ListAccountsOptions.Builder.state; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListAccountsOptions} + */ +@Test(groups = "unit") +public class ListAccountsOptionsTest { + + public void testAccountInDomainId() { + ListAccountsOptions options = new ListAccountsOptions().accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountInDomainIdStatic() { + ListAccountsOptions options = accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testName() { + ListAccountsOptions options = new ListAccountsOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testNameStatic() { + ListAccountsOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testRecursive() { + ListAccountsOptions options = new ListAccountsOptions().recursive(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("isrecursive")); + } + + public void testRecursiveStatic() { + ListAccountsOptions options = recursive(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("isrecursive")); + } + + public void testState() { + ListAccountsOptions options = new ListAccountsOptions().state("state"); + assertEquals(ImmutableList.of("state"), options.buildQueryParameters().get("state")); + } + + public void testStateStatic() { + ListAccountsOptions options = state("state"); + assertEquals(ImmutableList.of("state"), options.buildQueryParameters().get("state")); + } + + public void testCleanupRequired() { + ListAccountsOptions options = new ListAccountsOptions().cleanupRequired(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("iscleanuprequired")); + } + + public void testCleanupRequiredStatic() { + ListAccountsOptions options = cleanupRequired(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("iscleanuprequired")); + } + + public void testId() { + ListAccountsOptions options = new ListAccountsOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testDomainId() { + ListAccountsOptions options = new ListAccountsOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testIdStatic() { + ListAccountsOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testDomainIdStatic() { + ListAccountsOptions 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/ListAlertsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListAlertsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListAlertsOptionsTest.java new file mode 100644 index 0000000..be1d9c4 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListAlertsOptionsTest.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.ListAlertsOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListAlertsOptions.Builder.keyword; +import static org.jclouds.cloudstack.options.ListAlertsOptions.Builder.type; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListAlertsOptions} + */ +@Test(groups = "unit") +public class ListAlertsOptionsTest { + + public void testId() { + ListAlertsOptions options = new ListAlertsOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListAlertsOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testKeyword() { + ListAlertsOptions options = new ListAlertsOptions().keyword("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("keyword")); + } + + public void testKeywordStatic() { + ListAlertsOptions options = keyword("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("keyword")); + } + + public void testType() { + ListAlertsOptions options = new ListAlertsOptions().type("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("type")); + } + + public void testTypeStatic() { + ListAlertsOptions options = type("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("type")); + } +} 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/ListAsyncJobsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListAsyncJobsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListAsyncJobsOptionsTest.java new file mode 100644 index 0000000..42f192d --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListAsyncJobsOptionsTest.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.ListAsyncJobsOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListAsyncJobsOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListAsyncJobsOptions.Builder.startDate; +import static org.testng.Assert.assertEquals; + +import java.util.Date; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListAsyncJobsOptions} + */ +@Test(groups = "unit") +public class ListAsyncJobsOptionsTest { + public void testAccountInDomainId() { + ListAsyncJobsOptions options = new ListAsyncJobsOptions().accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountInDomainIdStatic() { + ListAsyncJobsOptions options = accountInDomain("adrian", "6"); + assertEquals(ImmutableList.of("adrian"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testStartDate() { + ListAsyncJobsOptions options = new ListAsyncJobsOptions().startDate(new Date(100000)); + assertEquals(ImmutableList.of("1970-01-01T00:01:40Z"), options.buildQueryParameters().get("startdate")); + } + + public void testDomainId() { + ListAsyncJobsOptions options = new ListAsyncJobsOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testStartDateStatic() { + ListAsyncJobsOptions options = startDate(new Date(100000)); + assertEquals(ImmutableList.of("1970-01-01T00:01:40Z"), options.buildQueryParameters().get("startdate")); + } + + public void testDomainIdStatic() { + ListAsyncJobsOptions 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/ListCapacityOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListCapacityOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListCapacityOptionsTest.java new file mode 100644 index 0000000..4a48ceb --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListCapacityOptionsTest.java @@ -0,0 +1,86 @@ +/* + * 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.ListCapacityOptions.Builder.hostId; +import static org.jclouds.cloudstack.options.ListCapacityOptions.Builder.keyword; +import static org.jclouds.cloudstack.options.ListCapacityOptions.Builder.podId; +import static org.jclouds.cloudstack.options.ListCapacityOptions.Builder.type; +import static org.jclouds.cloudstack.options.ListCapacityOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.jclouds.cloudstack.domain.Capacity; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListCapacityOptions} + */ +@Test(groups = "unit") +public class ListCapacityOptionsTest { + + public void testHostId() { + ListCapacityOptions options = new ListCapacityOptions().hostId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("hostid")); + } + + public void testHostIdStatic() { + ListCapacityOptions options = hostId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("hostid")); + } + + public void testKeyword() { + ListCapacityOptions options = new ListCapacityOptions().keyword("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("keyword")); + } + + public void testKeywordStatic() { + ListCapacityOptions options = keyword("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("keyword")); + } + + public void testPodId() { + ListCapacityOptions options = new ListCapacityOptions().podId("5"); + assertEquals(ImmutableList.of("5"), options.buildQueryParameters().get("podid")); + } + + public void testPodIdStatic() { + ListCapacityOptions options = podId("5"); + assertEquals(ImmutableList.of("5"), options.buildQueryParameters().get("podid")); + } + + public void testType() { + ListCapacityOptions options = new ListCapacityOptions().type(Capacity.Type.PUBLIC_IP_ADDRESSES); + assertEquals(ImmutableList.of("4"), options.buildQueryParameters().get("type")); + } + + public void testTypeStatic() { + ListCapacityOptions options = type(Capacity.Type.PUBLIC_IP_ADDRESSES); + assertEquals(ImmutableList.of("4"), options.buildQueryParameters().get("type")); + } + + public void testZoneId() { + ListCapacityOptions options = new ListCapacityOptions().zoneId("4"); + assertEquals(ImmutableList.of("4"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListCapacityOptions options = zoneId("4"); + assertEquals(ImmutableList.of("4"), 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/ListClustersOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListClustersOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListClustersOptionsTest.java new file mode 100644 index 0000000..88f2331 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListClustersOptionsTest.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.ListClustersOptions.Builder.allocationState; +import static org.jclouds.cloudstack.options.ListClustersOptions.Builder.clusterType; +import static org.jclouds.cloudstack.options.ListClustersOptions.Builder.hypervisor; +import static org.jclouds.cloudstack.options.ListClustersOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListClustersOptions.Builder.keyword; +import static org.jclouds.cloudstack.options.ListClustersOptions.Builder.managedState; +import static org.jclouds.cloudstack.options.ListClustersOptions.Builder.name; +import static org.jclouds.cloudstack.options.ListClustersOptions.Builder.podId; +import static org.jclouds.cloudstack.options.ListClustersOptions.Builder.zoneId; +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 ListClustersOptions} + */ +@Test(groups = "unit") +public class ListClustersOptionsTest { + + public void testAllocationState() { + ListClustersOptions options = new ListClustersOptions().allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testAllocationStateStatic() { + ListClustersOptions options = allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testClusterType() { + ListClustersOptions options = new ListClustersOptions().clusterType(Host.ClusterType.CLOUD_MANAGED); + assertEquals(ImmutableList.of("CloudManaged"), options.buildQueryParameters().get("clustertype")); + } + + public void testClusterTypeStatic() { + ListClustersOptions options = clusterType(Host.ClusterType.CLOUD_MANAGED); + assertEquals(ImmutableList.of("CloudManaged"), options.buildQueryParameters().get("clustertype")); + } + + public void testHypervisor() { + ListClustersOptions options = new ListClustersOptions().hypervisor("XenServer"); + assertEquals(ImmutableList.of("XenServer"), options.buildQueryParameters().get("hypervisor")); + } + + public void testHypervisorStatic() { + ListClustersOptions options = hypervisor("XenServer"); + assertEquals(ImmutableList.of("XenServer"), options.buildQueryParameters().get("hypervisor")); + } + + public void testId() { + ListClustersOptions options = new ListClustersOptions().id("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListClustersOptions options = id("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("id")); + } + + public void testKeyword() { + ListClustersOptions options = new ListClustersOptions().keyword("Enabled"); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("keyword")); + } + + public void testKeywordStatic() { + ListClustersOptions options = keyword("Enabled"); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("keyword")); + } + + public void testManagedState() { + ListClustersOptions options = new ListClustersOptions().managedState(Cluster.ManagedState.PREPARE_UNMANAGED); + assertEquals(ImmutableList.of("PrepareUnmanaged"), options.buildQueryParameters().get("managedstate")); + } + + public void testManagedStateStatic() { + ListClustersOptions options = managedState(Cluster.ManagedState.PREPARE_UNMANAGED); + assertEquals(ImmutableList.of("PrepareUnmanaged"), options.buildQueryParameters().get("managedstate")); + } + + public void testName() { + ListClustersOptions options = new ListClustersOptions().name("Host Name"); + assertEquals(ImmutableList.of("Host Name"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + ListClustersOptions options = name("Host Name"); + assertEquals(ImmutableList.of("Host Name"), options.buildQueryParameters().get("name")); + } + + public void testPodId() { + ListClustersOptions options = new ListClustersOptions().podId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("podid")); + } + + public void testPodIdStatic() { + ListClustersOptions options = podId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("podid")); + } + + public void testZoneId() { + ListClustersOptions options = new ListClustersOptions().zoneId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListClustersOptions options = zoneId("42"); + assertEquals(ImmutableList.of("42"), 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/ListDiskOfferingsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListDiskOfferingsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListDiskOfferingsOptionsTest.java new file mode 100644 index 0000000..8160d93 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListDiskOfferingsOptionsTest.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.options.ListDiskOfferingsOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListDiskOfferingsOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListDiskOfferingsOptions.Builder.name; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListDiskOfferingsOptions} + */ +@Test(groups = "unit") +public class ListDiskOfferingsOptionsTest { + + public void testId() { + ListDiskOfferingsOptions options = new ListDiskOfferingsOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListDiskOfferingsOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testName() { + ListDiskOfferingsOptions options = new ListDiskOfferingsOptions().name("foo"); + assertEquals(ImmutableList.of("foo"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + ListDiskOfferingsOptions options = name("foo"); + assertEquals(ImmutableList.of("foo"), options.buildQueryParameters().get("name")); + } + + public void testDomainId() { + ListDiskOfferingsOptions options = new ListDiskOfferingsOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListDiskOfferingsOptions 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/ListHostsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListHostsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListHostsOptionsTest.java new file mode 100644 index 0000000..6f3aaf8 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListHostsOptionsTest.java @@ -0,0 +1,165 @@ +/* + * 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.ListHostsOptions.Builder.allocationState; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.clusterId; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.keyword; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.name; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.page; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.pageSize; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.podId; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.state; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.type; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.virtualMachineId; +import static org.jclouds.cloudstack.options.ListHostsOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.jclouds.cloudstack.domain.AllocationState; +import org.jclouds.cloudstack.domain.Host; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListHostsOptions} + */ +@Test(groups = "unit") +public class ListHostsOptionsTest { + + public void testId() { + ListHostsOptions options = new ListHostsOptions().id("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListHostsOptions options = id("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("id")); + } + + public void testAllocationState() { + ListHostsOptions options = new ListHostsOptions().allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testAllocationStateStatic() { + ListHostsOptions options = allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testClusterId() { + ListHostsOptions options = new ListHostsOptions().clusterId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("clusterid")); + } + + public void testClusterIdStatic() { + ListHostsOptions options = clusterId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("clusterid")); + } + + public void testKeyword() { + ListHostsOptions options = new ListHostsOptions().keyword("Enabled"); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("keyword")); + } + + public void testKeywordStatic() { + ListHostsOptions options = keyword("Enabled"); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("keyword")); + } + + public void testName() { + ListHostsOptions options = new ListHostsOptions().name("Host Name"); + assertEquals(ImmutableList.of("Host Name"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + ListHostsOptions options = name("Host Name"); + assertEquals(ImmutableList.of("Host Name"), options.buildQueryParameters().get("name")); + } + + public void testPage() { + ListHostsOptions options = new ListHostsOptions().page(42L); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("page")); + } + + public void testPageStatic() { + ListHostsOptions options = page(42L); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("page")); + } + + public void testPageSize() { + ListHostsOptions options = new ListHostsOptions().pageSize(42L); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("pagesize")); + } + + public void testPageSizeStatic() { + ListHostsOptions options = pageSize(42L); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("pagesize")); + } + + public void testPodId() { + ListHostsOptions options = new ListHostsOptions().podId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("podid")); + } + + public void testPodIdStatic() { + ListHostsOptions options = podId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("podid")); + } + + public void testState() { + ListHostsOptions options = new ListHostsOptions().state("Up"); + assertEquals(ImmutableList.of("Up"), options.buildQueryParameters().get("state")); + } + + public void testStateStatic() { + ListHostsOptions options = state("Up"); + assertEquals(ImmutableList.of("Up"), options.buildQueryParameters().get("state")); + } + + public void testType() { + ListHostsOptions options = new ListHostsOptions().type(Host.Type.ROUTING); + assertEquals(ImmutableList.of("Routing"), options.buildQueryParameters().get("type")); + } + + public void testTypeStatic() { + ListHostsOptions options = type(Host.Type.ROUTING); + assertEquals(ImmutableList.of("Routing"), options.buildQueryParameters().get("type")); + } + + public void testVirtualMachineId() { + ListHostsOptions options = new ListHostsOptions().virtualMachineId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("virtualmachineid")); + } + + public void testVirtualMachineIdStatic() { + ListHostsOptions options = virtualMachineId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("virtualmachineid")); + } + + public void testZoneId() { + ListHostsOptions options = new ListHostsOptions().zoneId("42"); + assertEquals(ImmutableList.of("42"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListHostsOptions options = zoneId("42"); + assertEquals(ImmutableList.of("42"), 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/ListIPForwardingRulesOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListIPForwardingRulesOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListIPForwardingRulesOptionsTest.java new file mode 100644 index 0000000..34bc42f --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListIPForwardingRulesOptionsTest.java @@ -0,0 +1,87 @@ +/* + * 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.ListIPForwardingRulesOptions.Builder.IPAddressId; +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.id; +import static org.jclouds.cloudstack.options.ListIPForwardingRulesOptions.Builder.virtualMachineId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListIPForwardingRulesOptions} + */ +@Test(groups = "unit") +public class ListIPForwardingRulesOptionsTest { + + public void testId() { + ListIPForwardingRulesOptions options = new ListIPForwardingRulesOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListIPForwardingRulesOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testAccount() { + ListIPForwardingRulesOptions options = new ListIPForwardingRulesOptions().accountInDomain("account", "6"); + assertEquals(ImmutableList.of("account"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountStatic() { + ListIPForwardingRulesOptions options = accountInDomain("account", "6"); + assertEquals(ImmutableList.of("account"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testName() { + ListIPForwardingRulesOptions options = new ListIPForwardingRulesOptions().IPAddressId("9"); + assertEquals(ImmutableList.of("9"), options.buildQueryParameters().get("ipaddressid")); + } + + public void testNameStatic() { + ListIPForwardingRulesOptions options = IPAddressId("9"); + assertEquals(ImmutableList.of("9"), options.buildQueryParameters().get("ipaddressid")); + } + + public void testDomainId() { + ListIPForwardingRulesOptions options = new ListIPForwardingRulesOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListIPForwardingRulesOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testVirtualMachineId() { + ListIPForwardingRulesOptions options = new ListIPForwardingRulesOptions().virtualMachineId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("virtualmachineid")); + } + + public void testVirtualMachineIdStatic() { + ListIPForwardingRulesOptions 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/ListISOsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListISOsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListISOsOptionsTest.java new file mode 100644 index 0000000..2494a66 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListISOsOptionsTest.java @@ -0,0 +1,167 @@ +/* + * 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.ListISOsOptions.Builder.bootable; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.hypervisor; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.isNotReady; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.isPrivate; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.isPublic; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.isReady; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.isoFilter; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.keyword; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.name; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.notBootable; +import static org.jclouds.cloudstack.options.ListISOsOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import java.util.Set; + +import org.jclouds.cloudstack.domain.ISO; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableSet; + +/** + * Tests behavior of {@link ListISOsOptions} + */ +@Test(groups = "unit") +public class ListISOsOptionsTest { + private static final Set<String> TRUE = ImmutableSet.of(Boolean.toString(true)); + private static final Set<String> FALSE = ImmutableSet.of(Boolean.toString(false)); + + public void testBootable() { + ListISOsOptions options = new ListISOsOptions().bootable(); + assertEquals(options.buildQueryParameters().get("bootable"), TRUE); + } + + public void testBootableStatic() { + ListISOsOptions options = bootable(); + assertEquals(options.buildQueryParameters().get("bootable"), TRUE); + } + + public void testNotBootable() { + ListISOsOptions options = new ListISOsOptions().notBootable(); + assertEquals(options.buildQueryParameters().get("bootable"), FALSE); + } + + public void testNotBootableStatic() { + ListISOsOptions options = notBootable(); + assertEquals(options.buildQueryParameters().get("bootable"), FALSE); + } + + public void testHypervisor() { + ListISOsOptions options = new ListISOsOptions().hypervisor("KVM"); + assertEquals(options.buildQueryParameters().get("hypervisor"), ImmutableSet.of("KVM")); + } + + public void testHypervisorStatic() { + ListISOsOptions options = hypervisor("KVM"); + assertEquals(options.buildQueryParameters().get("hypervisor"), ImmutableSet.of("KVM")); + } + + public void testId() { + ListISOsOptions options = new ListISOsOptions().id("6"); + assertEquals(options.buildQueryParameters().get("id"), ImmutableSet.of("6")); + } + + public void testIdStatic() { + ListISOsOptions options = id("6"); + assertEquals(options.buildQueryParameters().get("id"), ImmutableSet.of("6")); + } + + public void testISOFilter() { + ListISOsOptions options = new ListISOsOptions().isoFilter(ISO.ISOFilter.community); + assertEquals(options.buildQueryParameters().get("isofilter"), ImmutableSet.of(ISO.ISOFilter.community.name())); + } + + public void testISOFilterStatic() { + ListISOsOptions options = isoFilter(ISO.ISOFilter.community); + assertEquals(options.buildQueryParameters().get("isofilter"), ImmutableSet.of(ISO.ISOFilter.community.name())); + } + + public void testIsPublic() { + ListISOsOptions options = new ListISOsOptions().isPublic(); + assertEquals(options.buildQueryParameters().get("ispublic"), TRUE); + } + + public void testIsPublicStatic() { + ListISOsOptions options = isPublic(); + assertEquals(options.buildQueryParameters().get("ispublic"), TRUE); + } + + public void testIsPrivate() { + ListISOsOptions options = new ListISOsOptions().isPrivate(); + assertEquals(options.buildQueryParameters().get("ispublic"), FALSE); + } + + public void testIsPrivateStatic() { + ListISOsOptions options = isPrivate(); + assertEquals(options.buildQueryParameters().get("ispublic"), FALSE); + } + + public void testIsReady() { + ListISOsOptions options = new ListISOsOptions().isReady(); + assertEquals(options.buildQueryParameters().get("isready"), TRUE); + } + + public void testIsReadyStatic() { + ListISOsOptions options = isReady(); + assertEquals(options.buildQueryParameters().get("isready"), TRUE); + } + + public void testIsNotReady() { + ListISOsOptions options = new ListISOsOptions().isNotReady(); + assertEquals(options.buildQueryParameters().get("isready"), FALSE); + } + + public void testIsNotReadyStatic() { + ListISOsOptions options = isNotReady(); + assertEquals(options.buildQueryParameters().get("isready"), FALSE); + } + + public void testKeyword() { + ListISOsOptions options = new ListISOsOptions().keyword("text"); + assertEquals(options.buildQueryParameters().get("keyword"), ImmutableSet.of("text")); + } + + public void testKeywordStatic() { + ListISOsOptions options = keyword("text"); + assertEquals(options.buildQueryParameters().get("keyword"), ImmutableSet.of("text")); + } + + public void testName() { + ListISOsOptions options = new ListISOsOptions().name("text"); + assertEquals(options.buildQueryParameters().get("name"), ImmutableSet.of("text")); + } + + public void testNameStatic() { + ListISOsOptions options = name("text"); + assertEquals(options.buildQueryParameters().get("name"), ImmutableSet.of("text")); + } + + public void testZoneId() { + ListISOsOptions options = new ListISOsOptions().zoneId("6"); + assertEquals(ImmutableSet.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListISOsOptions options = zoneId("6"); + assertEquals(ImmutableSet.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/ListLoadBalancerRulesOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListLoadBalancerRulesOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListLoadBalancerRulesOptionsTest.java new file mode 100644 index 0000000..228e323 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListLoadBalancerRulesOptionsTest.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.ListLoadBalancerRulesOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions.Builder.name; +import static org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions.Builder.page; +import static org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions.Builder.pageSize; +import static org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions.Builder.publicIPId; +import static org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions.Builder.virtualMachineId; +import static org.jclouds.cloudstack.options.ListLoadBalancerRulesOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListLoadBalancerRulesOptions} + */ +@Test(groups = "unit") +public class ListLoadBalancerRulesOptionsTest { + + public void testId() { + ListLoadBalancerRulesOptions options = new ListLoadBalancerRulesOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListLoadBalancerRulesOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testAccount() { + ListLoadBalancerRulesOptions options = new ListLoadBalancerRulesOptions().accountInDomain("account", "6"); + assertEquals(ImmutableList.of("account"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountStatic() { + ListLoadBalancerRulesOptions options = accountInDomain("account", "6"); + assertEquals(ImmutableList.of("account"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testName() { + ListLoadBalancerRulesOptions options = new ListLoadBalancerRulesOptions().name("name"); + assertEquals(ImmutableList.of("name"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + ListLoadBalancerRulesOptions options = name("name"); + assertEquals(ImmutableList.of("name"), options.buildQueryParameters().get("name")); + } + + public void testPublicIPId() { + ListLoadBalancerRulesOptions options = new ListLoadBalancerRulesOptions().publicIPId("9"); + assertEquals(ImmutableList.of("9"), options.buildQueryParameters().get("publicipid")); + } + + public void testPublicIPIdStatic() { + ListLoadBalancerRulesOptions options = publicIPId("9"); + assertEquals(ImmutableList.of("9"), options.buildQueryParameters().get("publicipid")); + } + + public void testDomainId() { + ListLoadBalancerRulesOptions options = new ListLoadBalancerRulesOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListLoadBalancerRulesOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testVirtualMachineId() { + ListLoadBalancerRulesOptions options = new ListLoadBalancerRulesOptions().virtualMachineId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("virtualmachineid")); + } + + public void testVirtualMachineIdStatic() { + ListLoadBalancerRulesOptions options = virtualMachineId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("virtualmachineid")); + } + + public void testZoneId() { + ListLoadBalancerRulesOptions options = new ListLoadBalancerRulesOptions().zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListLoadBalancerRulesOptions options = zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testPage() { + ListLoadBalancerRulesOptions options = new ListLoadBalancerRulesOptions().page(6); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("page")); + } + + public void testPageStatic() { + ListLoadBalancerRulesOptions options = page(6); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("page")); + } + + public void testPageSize() { + ListLoadBalancerRulesOptions options = new ListLoadBalancerRulesOptions().pageSize(6); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("pagesize")); + } + + public void testPageSizeStatic() { + ListLoadBalancerRulesOptions options = pageSize(6); + assertEquals(ImmutableList.of("6"), 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/ListNetworkOfferingsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListNetworkOfferingsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListNetworkOfferingsOptionsTest.java new file mode 100644 index 0000000..bac1c44 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListNetworkOfferingsOptionsTest.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.ListNetworkOfferingsOptions.Builder.availability; +import static org.jclouds.cloudstack.options.ListNetworkOfferingsOptions.Builder.displayText; +import static org.jclouds.cloudstack.options.ListNetworkOfferingsOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListNetworkOfferingsOptions.Builder.isDefault; +import static org.jclouds.cloudstack.options.ListNetworkOfferingsOptions.Builder.isShared; +import static org.jclouds.cloudstack.options.ListNetworkOfferingsOptions.Builder.specifyVLAN; +import static org.jclouds.cloudstack.options.ListNetworkOfferingsOptions.Builder.trafficType; +import static org.jclouds.cloudstack.options.ListNetworkOfferingsOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.jclouds.cloudstack.domain.NetworkOfferingAvailabilityType; +import org.jclouds.cloudstack.domain.TrafficType; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListNetworkOfferingsOptions} + */ +@Test(groups = "unit") +public class ListNetworkOfferingsOptionsTest { + + public void testIsDefault() { + ListNetworkOfferingsOptions options = new ListNetworkOfferingsOptions().isDefault(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("isdefault")); + } + + public void testIsDefaultStatic() { + ListNetworkOfferingsOptions options = isDefault(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("isdefault")); + } + + public void testIsShared() { + ListNetworkOfferingsOptions options = new ListNetworkOfferingsOptions().isShared(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("isshared")); + } + + public void testIsSharedStatic() { + ListNetworkOfferingsOptions options = isShared(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("isshared")); + } + + public void testId() { + ListNetworkOfferingsOptions options = new ListNetworkOfferingsOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListNetworkOfferingsOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testZoneId() { + ListNetworkOfferingsOptions options = new ListNetworkOfferingsOptions().zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListNetworkOfferingsOptions options = zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testSpecifyVLAN() { + ListNetworkOfferingsOptions options = new ListNetworkOfferingsOptions().specifyVLAN(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("specifyvlan")); + } + + public void testSpecifyVLANStatic() { + ListNetworkOfferingsOptions options = specifyVLAN(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("specifyvlan")); + } + + public void testAvailability() { + ListNetworkOfferingsOptions options = + new ListNetworkOfferingsOptions().availability(NetworkOfferingAvailabilityType.REQUIRED); + assertEquals(ImmutableList.of("Required"), options.buildQueryParameters().get("availability")); + } + + public void testAvailabilityStatic() { + ListNetworkOfferingsOptions options = availability(NetworkOfferingAvailabilityType.REQUIRED); + assertEquals(ImmutableList.of("Required"), options.buildQueryParameters().get("availability")); + } + + public void testTrafficType() { + ListNetworkOfferingsOptions options = new ListNetworkOfferingsOptions().trafficType(TrafficType.GUEST); + assertEquals(ImmutableList.of("Guest"), options.buildQueryParameters().get("traffictype")); + } + + public void testTrafficTypeStatic() { + ListNetworkOfferingsOptions options = trafficType(TrafficType.GUEST); + assertEquals(ImmutableList.of("Guest"), options.buildQueryParameters().get("traffictype")); + } + + public void testName() { + ListNetworkOfferingsOptions options = new ListNetworkOfferingsOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testNameStatic() { + ListNetworkOfferingsOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testDisplayText() { + ListNetworkOfferingsOptions options = new ListNetworkOfferingsOptions().displayText("text"); + assertEquals(ImmutableList.of("text"), options.buildQueryParameters().get("displaytext")); + } + + public void testDisplayTextStatic() { + ListNetworkOfferingsOptions options = displayText("text"); + assertEquals(ImmutableList.of("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/ListNetworksOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListNetworksOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListNetworksOptionsTest.java new file mode 100644 index 0000000..0db9e5a --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListNetworksOptionsTest.java @@ -0,0 +1,142 @@ +/* + * 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.ListNetworksOptions.Builder.accountInDomain; +import static org.jclouds.cloudstack.options.ListNetworksOptions.Builder.domainId; +import static org.jclouds.cloudstack.options.ListNetworksOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListNetworksOptions.Builder.isDefault; +import static org.jclouds.cloudstack.options.ListNetworksOptions.Builder.isShared; +import static org.jclouds.cloudstack.options.ListNetworksOptions.Builder.isSystem; +import static org.jclouds.cloudstack.options.ListNetworksOptions.Builder.trafficType; +import static org.jclouds.cloudstack.options.ListNetworksOptions.Builder.type; +import static org.jclouds.cloudstack.options.ListNetworksOptions.Builder.zoneId; +import static org.testng.Assert.assertEquals; + +import org.jclouds.cloudstack.domain.NetworkType; +import org.jclouds.cloudstack.domain.TrafficType; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListNetworksOptions} + */ +@Test(groups = "unit") +public class ListNetworksOptionsTest { + + public void testIsDefault() { + ListNetworksOptions options = new ListNetworksOptions().isDefault(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("isdefault")); + } + + public void testIsDefaultStatic() { + ListNetworksOptions options = isDefault(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("isdefault")); + } + + public void testIsSystem() { + ListNetworksOptions options = new ListNetworksOptions().isSystem(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("issystem")); + } + + public void testIsSystemStatic() { + ListNetworksOptions options = isSystem(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("issystem")); + } + + public void testIsShared() { + ListNetworksOptions options = new ListNetworksOptions().isShared(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("isshared")); + } + + public void testIsSharedStatic() { + ListNetworksOptions options = isShared(true); + assertEquals(ImmutableList.of("true"), options.buildQueryParameters().get("isshared")); + } + + public void testId() { + ListNetworksOptions options = new ListNetworksOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListNetworksOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testDomainId() { + ListNetworksOptions options = new ListNetworksOptions().domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testDomainIdStatic() { + ListNetworksOptions options = domainId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountId() { + ListNetworksOptions options = new ListNetworksOptions().accountInDomain("moo", "1"); + assertEquals(ImmutableList.of("1"), options.buildQueryParameters().get("domainid")); + } + + public void testAccountIdStatic() { + ListNetworksOptions options = accountInDomain("moo", "1"); + assertEquals(ImmutableList.of("moo"), options.buildQueryParameters().get("account")); + assertEquals(ImmutableList.of("1"), options.buildQueryParameters().get("domainid")); + } + + public void testTrafficType() { + ListNetworksOptions options = new ListNetworksOptions().trafficType(TrafficType.GUEST); + assertEquals(ImmutableList.of("Guest"), options.buildQueryParameters().get("traffictype")); + } + + public void testTrafficTypeStatic() { + ListNetworksOptions options = trafficType(TrafficType.GUEST); + assertEquals(ImmutableList.of("Guest"), options.buildQueryParameters().get("traffictype")); + } + + public void testName() { + ListNetworksOptions options = new ListNetworksOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testNameStatic() { + ListNetworksOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testZoneId() { + ListNetworksOptions options = new ListNetworksOptions().zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListNetworksOptions options = zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testType() { + ListNetworksOptions options = new ListNetworksOptions().type(NetworkType.ADVANCED); + assertEquals(ImmutableList.of("Advanced"), options.buildQueryParameters().get("type")); + } + + public void testTypeStatic() { + ListNetworksOptions options = type(NetworkType.ADVANCED); + assertEquals(ImmutableList.of("Advanced"), options.buildQueryParameters().get("type")); + } +} 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/ListOSTypesOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListOSTypesOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListOSTypesOptionsTest.java new file mode 100644 index 0000000..86ddf65 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListOSTypesOptionsTest.java @@ -0,0 +1,52 @@ +/* + * 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.ListOSTypesOptions.Builder.OSCategoryId; +import static org.jclouds.cloudstack.options.ListOSTypesOptions.Builder.id; +import static org.testng.Assert.assertEquals; + +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; + +/** + * Tests behavior of {@code ListOSTypesOptions} + */ +@Test(groups = "unit") +public class ListOSTypesOptionsTest { + + public void testId() { + ListOSTypesOptions options = new ListOSTypesOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListOSTypesOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testOSCategoryId() { + ListOSTypesOptions options = new ListOSTypesOptions().OSCategoryId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("oscategoryid")); + } + + public void testOSCategoryIdStatic() { + ListOSTypesOptions options = OSCategoryId("6"); + assertEquals(ImmutableList.of("6"), 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/ListPodsOptionsTest.java ---------------------------------------------------------------------- diff --git a/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPodsOptionsTest.java b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPodsOptionsTest.java new file mode 100644 index 0000000..3b2c682 --- /dev/null +++ b/dependencies/jclouds/apis/cloudstack/1.8.0-stratos/src/test/java/org/jclouds/cloudstack/options/ListPodsOptionsTest.java @@ -0,0 +1,87 @@ +/* + * 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.ListPodsOptions.Builder.allocationState; +import static org.jclouds.cloudstack.options.ListPodsOptions.Builder.id; +import static org.jclouds.cloudstack.options.ListPodsOptions.Builder.keyword; +import static org.jclouds.cloudstack.options.ListPodsOptions.Builder.name; +import static org.jclouds.cloudstack.options.ListPodsOptions.Builder.zoneId; +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 ListPodsOptions} + */ +@Test(groups = "unit") +public class ListPodsOptionsTest { + + public void testId() { + ListPodsOptions options = new ListPodsOptions().id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testIdStatic() { + ListPodsOptions options = id("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("id")); + } + + public void testAllocationState() { + ListPodsOptions options = new ListPodsOptions().allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testAllocationStateStatic() { + ListPodsOptions options = allocationState(AllocationState.ENABLED); + assertEquals(ImmutableList.of("Enabled"), options.buildQueryParameters().get("allocationstate")); + } + + public void testKeyword() { + ListPodsOptions options = new ListPodsOptions().keyword("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("keyword")); + } + + public void testKeywordStatic() { + ListPodsOptions options = keyword("fred"); + assertEquals(ImmutableList.of("fred"), options.buildQueryParameters().get("keyword")); + } + + public void testName() { + ListPodsOptions options = new ListPodsOptions().name("bob"); + assertEquals(ImmutableList.of("bob"), options.buildQueryParameters().get("name")); + } + + public void testNameStatic() { + ListPodsOptions options = name("bob"); + assertEquals(ImmutableList.of("bob"), options.buildQueryParameters().get("name")); + } + + public void testZoneId() { + ListPodsOptions options = new ListPodsOptions().zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + + public void testZoneIdStatic() { + ListPodsOptions options = zoneId("6"); + assertEquals(ImmutableList.of("6"), options.buildQueryParameters().get("zoneid")); + } + +}
