You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@stratos.apache.org by ra...@apache.org on 2014/12/23 05:26:54 UTC
[30/51] [partial] stratos git commit: dropping jclouds 1.8.0 clone
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/CreateVolumeOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/CreateVolumeOptionsTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/CreateVolumeOptionsTest.java
deleted file mode 100644
index 20f7475..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/CreateVolumeOptionsTest.java
+++ /dev/null
@@ -1,156 +0,0 @@
-/*
- * 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.ec2.options;
-
-import static org.jclouds.ec2.options.CreateVolumeOptions.Builder.fromSnapshotId;
-import static org.jclouds.ec2.options.CreateVolumeOptions.Builder.isEncrypted;
-import static org.jclouds.ec2.options.CreateVolumeOptions.Builder.volumeType;
-import static org.jclouds.ec2.options.CreateVolumeOptions.Builder.withIops;
-import static org.jclouds.ec2.options.CreateVolumeOptions.Builder.withSize;
-import static org.testng.Assert.assertEquals;
-
-import com.google.common.collect.ImmutableList;
-import org.jclouds.http.options.HttpRequestOptions;
-import org.testng.annotations.Test;
-
-/**
- * Tests possible uses of CreateVolumeOptions and CreateVolumeOptions.Builder.*
- */
-public class CreateVolumeOptionsTest {
-
- @Test
- public void testAssignability() {
- assert HttpRequestOptions.class.isAssignableFrom(CreateVolumeOptions.class);
- assert !String.class.isAssignableFrom(CreateVolumeOptions.class);
- }
-
- @Test
- public void testVolumeType() {
- CreateVolumeOptions options = new CreateVolumeOptions();
- options.volumeType("test");
- assertEquals(options.buildFormParameters().get("VolumeType"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testNullVolumeType() {
- CreateVolumeOptions options = new CreateVolumeOptions();
- assertEquals(options.buildFormParameters().get("VolumeType"), ImmutableList.of());
- }
-
- @Test
- public void testVolumeTypeStatic() {
- CreateVolumeOptions options = volumeType("test");
- assertEquals(options.buildFormParameters().get("VolumeType"),
- ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testVolmeTypeNPE() {
- volumeType(null);
- }
-
- @Test
- public void testFromSnapshotId() {
- CreateVolumeOptions options = new CreateVolumeOptions();
- options.fromSnapshotId("test");
- assertEquals(options.buildFormParameters().get("SnapshotId"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testNullFromSnapshotId() {
- CreateVolumeOptions options = new CreateVolumeOptions();
- assertEquals(options.buildFormParameters().get("SnapshotId"), ImmutableList.of());
- }
-
- @Test
- public void testWithSnapshotIdStatic() {
- CreateVolumeOptions options = fromSnapshotId("test");
- assertEquals(options.buildFormParameters().get("SnapshotId"),
- ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testFromSnapshotIdNPE() {
- fromSnapshotId(null);
- }
-
- @Test
- public void testWithIops() {
- CreateVolumeOptions options = new CreateVolumeOptions();
- options.withIops(5);
- assertEquals(options.buildFormParameters().get("Iops"),
- ImmutableList.of("5"));
- }
-
- @Test
- public void testNullWithIops() {
- CreateVolumeOptions options = new CreateVolumeOptions();
- assertEquals(options.buildFormParameters().get("Iops"), ImmutableList.of());
- }
-
- @Test
- public void testWithIopsStatic() {
- CreateVolumeOptions options = withIops(5);
- assertEquals(options.buildFormParameters().get("Iops"),
- ImmutableList.of("5"));
- }
-
- @Test
- public void testWithSize() {
- CreateVolumeOptions options = new CreateVolumeOptions();
- options.withSize(5);
- assertEquals(options.buildFormParameters().get("Size"),
- ImmutableList.of("5"));
- }
-
- @Test
- public void testNullWithSize() {
- CreateVolumeOptions options = new CreateVolumeOptions();
- assertEquals(options.buildFormParameters().get("Size"), ImmutableList.of());
- }
-
- @Test
- public void testWithSizeStatic() {
- CreateVolumeOptions options = withSize(5);
- assertEquals(options.buildFormParameters().get("Size"),
- ImmutableList.of("5"));
- }
-
- @Test
- public void testIsEncrypted() {
- CreateVolumeOptions options = new CreateVolumeOptions();
- options.isEncrypted(true);
- assertEquals(options.buildFormParameters().get("Encrypted"),
- ImmutableList.of("true"));
- }
-
- @Test
- public void testNullIsEncrypted() {
- CreateVolumeOptions options = new CreateVolumeOptions();
- assertEquals(options.buildFormParameters().get("Encrypted"), ImmutableList.of());
- }
-
- @Test
- public void testIsEncryptedStatic() {
- CreateVolumeOptions options = isEncrypted(true);
- assertEquals(options.buildFormParameters().get("Encrypted"),
- ImmutableList.of("true"));
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DescribeImagesOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DescribeImagesOptionsTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DescribeImagesOptionsTest.java
deleted file mode 100644
index 8435df4..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DescribeImagesOptionsTest.java
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * 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.ec2.options;
-
-import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.executableBy;
-import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.imageIds;
-import static org.jclouds.ec2.options.DescribeImagesOptions.Builder.ownedBy;
-import static org.testng.Assert.assertEquals;
-
-import com.google.common.collect.ImmutableList;
-
-import org.jclouds.http.options.HttpRequestOptions;
-import org.testng.annotations.Test;
-
-/**
- * Tests possible uses of DescribeImagesOptions and DescribeImagesOptions.Builder.*
- */
-public class DescribeImagesOptionsTest {
-
- @Test
- public void testAssignability() {
- assert HttpRequestOptions.class.isAssignableFrom(DescribeImagesOptions.class);
- assert !String.class.isAssignableFrom(DescribeImagesOptions.class);
- }
-
- @Test
- public void testExecutableBy() {
- DescribeImagesOptions options = new DescribeImagesOptions();
- options.executableBy("test");
- assertEquals(options.buildFormParameters().get("ExecutableBy"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testNullExecutableBy() {
- DescribeImagesOptions options = new DescribeImagesOptions();
- assertEquals(options.buildFormParameters().get("ExecutableBy"), ImmutableList.of());
- }
-
- @Test
- public void testExecutableByStatic() {
- DescribeImagesOptions options = executableBy("test");
- assertEquals(options.buildFormParameters().get("ExecutableBy"),
- ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testExecutableByNPE() {
- executableBy(null);
- }
-
- @Test
- public void testOwners() {
- DescribeImagesOptions options = new DescribeImagesOptions();
- options.ownedBy("test");
- assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
- }
-
- @Test
- public void testMultipleOwners() {
- DescribeImagesOptions options = new DescribeImagesOptions();
- options.ownedBy("test", "trouble");
- assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
- assertEquals(options.buildFormParameters().get("Owner.2"),
- ImmutableList.of("trouble"));
- }
-
- @Test
- public void testNullOwners() {
- DescribeImagesOptions options = new DescribeImagesOptions();
- assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of());
- }
-
- @Test
- public void testOwnersStatic() {
- DescribeImagesOptions options = ownedBy("test");
- assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
- }
-
- public void testNoOwners() {
- ownedBy();
- }
-
- @Test
- public void testImageIds() {
- DescribeImagesOptions options = new DescribeImagesOptions();
- options.imageIds("test");
- assertEquals(options.buildFormParameters().get("ImageId.1"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testMultipleImageIds() {
- DescribeImagesOptions options = new DescribeImagesOptions();
- options.imageIds("test", "trouble");
- assertEquals(options.buildFormParameters().get("ImageId.1"),
- ImmutableList.of("test"));
- assertEquals(options.buildFormParameters().get("ImageId.2"),
- ImmutableList.of("trouble"));
- }
-
- @Test
- public void testNullImageIds() {
- DescribeImagesOptions options = new DescribeImagesOptions();
- assertEquals(options.buildFormParameters().get("ImageId.1"), ImmutableList.of());
- }
-
- @Test
- public void testImageIdsStatic() {
- DescribeImagesOptions options = imageIds("test");
- assertEquals(options.buildFormParameters().get("ImageId.1"),
- ImmutableList.of("test"));
- }
-
- public void testNoImageIds() {
- imageIds();
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DescribeSnapshotsOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DescribeSnapshotsOptionsTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DescribeSnapshotsOptionsTest.java
deleted file mode 100644
index 27a09c2..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DescribeSnapshotsOptionsTest.java
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- * 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.ec2.options;
-
-import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.ownedBy;
-import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.restorableBy;
-import static org.jclouds.ec2.options.DescribeSnapshotsOptions.Builder.snapshotIds;
-import static org.testng.Assert.assertEquals;
-
-import com.google.common.collect.ImmutableList;
-
-import org.jclouds.http.options.HttpRequestOptions;
-import org.testng.annotations.Test;
-
-/**
- * Tests possible uses of DescribeSnapshotsOptions and DescribeSnapshotsOptions.Builder.*
- */
-public class DescribeSnapshotsOptionsTest {
-
- @Test
- public void testAssignability() {
- assert HttpRequestOptions.class.isAssignableFrom(DescribeSnapshotsOptions.class);
- assert !String.class.isAssignableFrom(DescribeSnapshotsOptions.class);
- }
-
- @Test
- public void testRestorableBy() {
- DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
- options.restorableBy("test");
- assertEquals(options.buildFormParameters().get("RestorableBy.1"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testNullRestorableBy() {
- DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
- assertEquals(options.buildFormParameters().get("RestorableBy.1"), ImmutableList.of());
- }
-
- @Test
- public void testRestorableByStatic() {
- DescribeSnapshotsOptions options = restorableBy("test");
- assertEquals(options.buildFormParameters().get("RestorableBy.1"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testOwners() {
- DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
- options.ownedBy("test");
- assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
- }
-
- @Test
- public void testMultipleOwners() {
- DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
- options.ownedBy("test", "trouble");
- assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
- assertEquals(options.buildFormParameters().get("Owner.2"),
- ImmutableList.of("trouble"));
- }
-
- @Test
- public void testNullOwners() {
- DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
- assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of());
- }
-
- @Test
- public void testOwnersStatic() {
- DescribeSnapshotsOptions options = ownedBy("test");
- assertEquals(options.buildFormParameters().get("Owner.1"), ImmutableList.of("test"));
- }
-
- public void testNoOwners() {
- ownedBy();
- }
-
- @Test
- public void testSnapshotIds() {
- DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
- options.snapshotIds("test");
- assertEquals(options.buildFormParameters().get("SnapshotId.1"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testMultipleSnapshotIds() {
- DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
- options.snapshotIds("test", "trouble");
- assertEquals(options.buildFormParameters().get("SnapshotId.1"),
- ImmutableList.of("test"));
- assertEquals(options.buildFormParameters().get("SnapshotId.2"),
- ImmutableList.of("trouble"));
- }
-
- @Test
- public void testNullSnapshotIds() {
- DescribeSnapshotsOptions options = new DescribeSnapshotsOptions();
- assertEquals(options.buildFormParameters().get("SnapshotId.1"), ImmutableList.of());
- }
-
- @Test
- public void testSnapshotIdsStatic() {
- DescribeSnapshotsOptions options = snapshotIds("test");
- assertEquals(options.buildFormParameters().get("SnapshotId.1"),
- ImmutableList.of("test"));
- }
-
- public void testNoSnapshotIds() {
- snapshotIds();
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DetachVolumeOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DetachVolumeOptionsTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DetachVolumeOptionsTest.java
deleted file mode 100644
index 2b7d502..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/DetachVolumeOptionsTest.java
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * 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.ec2.options;
-
-import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.fromDevice;
-import static org.jclouds.ec2.options.DetachVolumeOptions.Builder.fromInstance;
-import static org.testng.Assert.assertEquals;
-
-import com.google.common.collect.ImmutableList;
-
-import org.jclouds.http.options.HttpRequestOptions;
-import org.testng.annotations.Test;
-
-/**
- * Tests possible uses of DetachVolumeOptions and DetachVolumeOptions.Builder.*
- */
-public class DetachVolumeOptionsTest {
-
- @Test
- public void testAssignability() {
- assert HttpRequestOptions.class.isAssignableFrom(DetachVolumeOptions.class);
- assert !String.class.isAssignableFrom(DetachVolumeOptions.class);
- }
-
- @Test
- public void testFromDevice() {
- DetachVolumeOptions options = new DetachVolumeOptions();
- options.fromDevice("test");
- assertEquals(options.buildFormParameters().get("Device"), ImmutableList.of("test"));
- }
-
- @Test
- public void testNullFromDevice() {
- DetachVolumeOptions options = new DetachVolumeOptions();
- assertEquals(options.buildFormParameters().get("Device"), ImmutableList.of());
- }
-
- @Test
- public void testFromDeviceStatic() {
- DetachVolumeOptions options = fromDevice("test");
- assertEquals(options.buildFormParameters().get("Device"), ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testFromDeviceNPE() {
- fromDevice(null);
- }
-
- @Test
- public void testFromInstance() {
- DetachVolumeOptions options = new DetachVolumeOptions();
- options.fromInstance("test");
- assertEquals(options.buildFormParameters().get("InstanceId"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testNullFromInstance() {
- DetachVolumeOptions options = new DetachVolumeOptions();
- assertEquals(options.buildFormParameters().get("InstanceId"), ImmutableList.of());
- }
-
- @Test
- public void testFromInstanceStatic() {
- DetachVolumeOptions options = fromInstance("test");
- assertEquals(options.buildFormParameters().get("InstanceId"),
- ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testFromInstanceNPE() {
- fromInstance(null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptionsTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptionsTest.java
deleted file mode 100644
index 9d1612a..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RegisterImageBackedByEbsOptionsTest.java
+++ /dev/null
@@ -1,396 +0,0 @@
-/*
- * 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.ec2.options;
-
-import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.addBlockDeviceFromSnapshot;
-import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.addEphemeralBlockDeviceFromSnapshot;
-import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.addNewBlockDevice;
-import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.addNewEphemeralBlockDevice;
-import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.asArchitecture;
-import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.withDescription;
-import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.withKernelId;
-import static org.jclouds.ec2.options.RegisterImageBackedByEbsOptions.Builder.withRamdisk;
-import static org.testng.Assert.assertEquals;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMultimap;
-import org.jclouds.ec2.domain.Image.Architecture;
-import org.jclouds.http.options.HttpRequestOptions;
-import org.testng.annotations.Test;
-
-/**
- * Tests possible uses of RegisterImageBackedByEbsOptions and
- * RegisterImageBackedByEbsOptions.Builder.*
- */
-public class RegisterImageBackedByEbsOptionsTest {
-
- @Test
- public void testAssignability() {
- assert HttpRequestOptions.class.isAssignableFrom(RegisterImageBackedByEbsOptions.class);
- assert !String.class.isAssignableFrom(RegisterImageBackedByEbsOptions.class);
- }
-
- @Test
- public void testWithDescription() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.withDescription("test");
- assertEquals(options.buildFormParameters().get("Description"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testNullWithDescription() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- assertEquals(options.buildFormParameters().get("Description"), ImmutableList.of());
- }
-
- @Test
- public void testWithDescriptionStatic() {
- RegisterImageBackedByEbsOptions options = withDescription("test");
- assertEquals(options.buildFormParameters().get("Description"),
- ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithDescriptionNPE() {
- withDescription(null);
- }
-
- @Test
- public void testWithArchitecture() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.asArchitecture(Architecture.I386);
- assertEquals(options.buildFormParameters().get("Architecture"),
- ImmutableList.of("i386"));
- }
-
- @Test
- public void testNullWithArchitecture() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- assertEquals(options.buildFormParameters().get("Architecture"), ImmutableList.of());
- }
-
- @Test
- public void testWithArchitectureStatic() {
- RegisterImageBackedByEbsOptions options = asArchitecture(Architecture.I386);
- assertEquals(options.buildFormParameters().get("Architecture"),
- ImmutableList.of("i386"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithArchitectureNPE() {
- asArchitecture(null);
- }
-
- @Test
- public void testWithKernelId() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.withKernelId("test");
- assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
- }
-
- @Test
- public void testNullWithKernelId() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of());
- }
-
- @Test
- public void testWithKernelIdStatic() {
- RegisterImageBackedByEbsOptions options = withKernelId("test");
- assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithKernelIdNPE() {
- withKernelId(null);
- }
-
- @Test
- public void testWithRamdisk() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.withRamdisk("test");
- assertEquals(options.buildFormParameters().get("RamdiskId"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testNullWithRamdisk() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of());
- }
-
- @Test
- public void testWithRamdiskStatic() {
- RegisterImageBackedByEbsOptions options = withRamdisk("test");
- assertEquals(options.buildFormParameters().get("RamdiskId"),
- ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithRamdiskNPE() {
- withRamdisk(null);
- }
-
- @Test
- public void testAddBlockDeviceFromSnapshot() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.addBlockDeviceFromSnapshot("deviceName", "virtualName", "snapshotId");
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.Ebs.DeleteOnTermination", "false",
- "BlockDeviceMapping.1.DeviceName", "deviceName", "BlockDeviceMapping.1.VirtualName",
- "virtualName", "BlockDeviceMapping.1.Ebs.SnapshotId", "snapshotId").entries());
- }
-
- @Test
- public void testAddBlockDeviceFromSnapshotNullVirtualName() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.addBlockDeviceFromSnapshot("deviceName", null, "snapshotId");
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.Ebs.DeleteOnTermination", "false",
- "BlockDeviceMapping.1.DeviceName", "deviceName",
- "BlockDeviceMapping.1.Ebs.SnapshotId", "snapshotId").entries());
- }
-
- @Test
- public void testNullAddBlockDeviceFromSnapshot() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- assertEquals(options.buildFormParameters(), ImmutableMultimap.<String, String> of());
- }
-
- @Test
- public void testAddBlockDeviceFromSnapshotStatic() {
- RegisterImageBackedByEbsOptions options = addBlockDeviceFromSnapshot("deviceName",
- "virtualName", "snapshotId");
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.Ebs.DeleteOnTermination", "false",
- "BlockDeviceMapping.1.DeviceName", "deviceName", "BlockDeviceMapping.1.VirtualName",
- "virtualName", "BlockDeviceMapping.1.Ebs.SnapshotId", "snapshotId").entries());
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testAddBlockDeviceFromSnapshotNPE() {
- addBlockDeviceFromSnapshot(null, null, null);
- }
-
- @Test
- public void testAdvancedAddBlockDeviceFromSnapshot() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.addBlockDeviceFromSnapshot("deviceName", "virtualName", "snapshotId", true, "gp2", 0, false);
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.builder()
- .put("BlockDeviceMapping.1.Ebs.DeleteOnTermination", "true")
- .put("BlockDeviceMapping.1.Ebs.VolumeType", "gp2")
- .put("BlockDeviceMapping.1.Ebs.Iops", "0")
- .put("BlockDeviceMapping.1.DeviceName", "deviceName")
- .put("BlockDeviceMapping.1.VirtualName", "virtualName")
- .put("BlockDeviceMapping.1.Ebs.SnapshotId", "snapshotId")
- .build()
- .entries());
- }
-
- @Test
- public void testAdvancedAddBlockDeviceFromSnapshotStatic() {
- RegisterImageBackedByEbsOptions options = addBlockDeviceFromSnapshot("deviceName", "virtualName", "snapshotId", true, "gp2", 0, true);
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.builder()
- .put("BlockDeviceMapping.1.Ebs.DeleteOnTermination", "true")
- .put("BlockDeviceMapping.1.Ebs.VolumeType", "gp2")
- .put("BlockDeviceMapping.1.Ebs.Iops", "0")
- .put("BlockDeviceMapping.1.Ebs.Encrypted", "true")
- .put("BlockDeviceMapping.1.DeviceName", "deviceName")
- .put("BlockDeviceMapping.1.VirtualName", "virtualName")
- .put("BlockDeviceMapping.1.Ebs.SnapshotId", "snapshotId")
- .build()
- .entries());
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testAdvancedAddBlockDeviceFromSnapshotNPE() {
- addBlockDeviceFromSnapshot(null, null, null, false, null, null, false);
- }
-
- @Test
- public void testAddEphemeralBlockDeviceFromSnapshot() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.addEphemeralBlockDeviceFromSnapshot("deviceName", "virtualName", "snapshotId");
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.DeviceName", "deviceName", "BlockDeviceMapping.1.VirtualName",
- "virtualName", "BlockDeviceMapping.1.Ebs.SnapshotId", "snapshotId").entries());
- }
-
- @Test
- public void testAddEphemeralBlockDeviceFromSnapshotNullVirtualName() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.addEphemeralBlockDeviceFromSnapshot("deviceName", null, "snapshotId");
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.DeviceName", "deviceName",
- "BlockDeviceMapping.1.Ebs.SnapshotId", "snapshotId").entries());
- }
-
- @Test
- public void testNullAddEphemeralBlockDeviceFromSnapshot() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- assertEquals(options.buildFormParameters(), ImmutableMultimap.<String, String> of());
- }
-
- @Test
- public void testAddEphemeralBlockDeviceFromSnapshotStatic() {
- RegisterImageBackedByEbsOptions options = addEphemeralBlockDeviceFromSnapshot("deviceName",
- "virtualName", "snapshotId");
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.DeviceName", "deviceName", "BlockDeviceMapping.1.VirtualName",
- "virtualName", "BlockDeviceMapping.1.Ebs.SnapshotId", "snapshotId").entries());
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testAddEphemeralBlockDeviceFromSnapshotNPE() {
- addEphemeralBlockDeviceFromSnapshot(null, null, null);
- }
-
- // //////
- @Test
- public void testAddNewBlockDevice() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.addNewBlockDevice("deviceName", "virtualName", 1);
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.Ebs.DeleteOnTermination", "false",
- "BlockDeviceMapping.1.DeviceName", "deviceName", "BlockDeviceMapping.1.VirtualName",
- "virtualName", "BlockDeviceMapping.1.Ebs.VolumeSize", "1").entries());
- }
-
- @Test
- public void testAddNewBlockDeviceNullVirtualName() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.addNewBlockDevice("deviceName", null, 1);
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.Ebs.DeleteOnTermination", "false",
- "BlockDeviceMapping.1.DeviceName", "deviceName",
- "BlockDeviceMapping.1.Ebs.VolumeSize", "1").entries());
- }
-
- @Test
- public void testNullAddNewBlockDevice() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- assertEquals(options.buildFormParameters(), ImmutableMultimap.<String, String> of());
- }
-
- @Test
- public void testAddNewBlockDeviceStatic() {
- RegisterImageBackedByEbsOptions options = addNewBlockDevice("deviceName", "virtualName", 1);
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.Ebs.DeleteOnTermination", "false",
- "BlockDeviceMapping.1.DeviceName", "deviceName", "BlockDeviceMapping.1.VirtualName",
- "virtualName", "BlockDeviceMapping.1.Ebs.VolumeSize", "1").entries());
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testAddNewBlockDeviceNPE() {
- addNewBlockDevice(null, null, 1);
- }
-
- @Test
- public void testAdvancedAddNewBlockDevice() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.addNewBlockDevice("deviceName", "virtualName", 5, true, "gp2", 0, true);
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.builder()
- .put("BlockDeviceMapping.1.Ebs.DeleteOnTermination", "true")
- .put("BlockDeviceMapping.1.Ebs.VolumeType", "gp2")
- .put("BlockDeviceMapping.1.Ebs.Iops", "0")
- .put("BlockDeviceMapping.1.Ebs.Encrypted", "true")
- .put("BlockDeviceMapping.1.DeviceName", "deviceName")
- .put("BlockDeviceMapping.1.VirtualName", "virtualName")
- .put("BlockDeviceMapping.1.Ebs.VolumeSize", "5")
- .build()
- .entries());
- }
-
- @Test
- public void testAdvancedAddNewBlockDeviceStatic() {
- RegisterImageBackedByEbsOptions options = addNewBlockDevice("deviceName", "virtualName", 5, true, "gp2", 0, false);
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.builder()
- .put("BlockDeviceMapping.1.Ebs.DeleteOnTermination", "true")
- .put("BlockDeviceMapping.1.Ebs.VolumeType", "gp2")
- .put("BlockDeviceMapping.1.Ebs.Iops", "0")
- .put("BlockDeviceMapping.1.DeviceName", "deviceName")
- .put("BlockDeviceMapping.1.VirtualName", "virtualName")
- .put("BlockDeviceMapping.1.Ebs.VolumeSize", "5")
- .build()
- .entries());
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testAdvancedAddNewBlockDeviceNPE() {
- addNewBlockDevice(null, null, 5, false, null, null, false);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testAddNewBlockDeviceTooBig() {
- addNewBlockDevice("deviceName", "virtualName", 1025);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testAddNewBlockDeviceTooSmall() {
- addNewBlockDevice("deviceName", "virtualName", 0);
- }
-
- @Test
- public void testAddNewEphemeralBlockDevice() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.addNewEphemeralBlockDevice("deviceName", "virtualName", 1);
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.DeviceName", "deviceName", "BlockDeviceMapping.1.VirtualName",
- "virtualName", "BlockDeviceMapping.1.Ebs.VolumeSize", "1").entries());
- }
-
- @Test
- public void testAddNewEphemeralBlockDeviceNullVirtualName() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- options.addNewEphemeralBlockDevice("deviceName", null, 1);
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.DeviceName", "deviceName",
- "BlockDeviceMapping.1.Ebs.VolumeSize", "1").entries());
- }
-
- @Test
- public void testNullAddNewEphemeralBlockDevice() {
- RegisterImageBackedByEbsOptions options = new RegisterImageBackedByEbsOptions();
- assertEquals(options.buildFormParameters(), ImmutableMultimap.<String, String> of());
- }
-
- @Test
- public void testAddNewEphemeralBlockDeviceStatic() {
- RegisterImageBackedByEbsOptions options = addNewEphemeralBlockDevice("deviceName",
- "virtualName", 1);
- assertEquals(options.buildFormParameters().entries(), ImmutableMultimap.of(
- "BlockDeviceMapping.1.DeviceName", "deviceName", "BlockDeviceMapping.1.VirtualName",
- "virtualName", "BlockDeviceMapping.1.Ebs.VolumeSize", "1").entries());
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testAddNewEphemeralBlockDeviceNPE() {
- addNewEphemeralBlockDevice(null, null, 1);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testAddNewEphemeralBlockDeviceTooBig() {
- addNewEphemeralBlockDevice("deviceName", "virtualName", 1025);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testAddNewEphemeralBlockDeviceTooSmall() {
- addNewEphemeralBlockDevice("deviceName", "virtualName", 0);
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RegisterImageOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RegisterImageOptionsTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RegisterImageOptionsTest.java
deleted file mode 100644
index 20c352b..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RegisterImageOptionsTest.java
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- * 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.ec2.options;
-
-import static org.jclouds.ec2.options.RegisterImageOptions.Builder.asArchitecture;
-import static org.jclouds.ec2.options.RegisterImageOptions.Builder.withDescription;
-import static org.jclouds.ec2.options.RegisterImageOptions.Builder.withKernelId;
-import static org.jclouds.ec2.options.RegisterImageOptions.Builder.withRamdisk;
-import static org.testng.Assert.assertEquals;
-
-import com.google.common.collect.ImmutableList;
-
-import org.jclouds.ec2.domain.Image.Architecture;
-import org.jclouds.http.options.HttpRequestOptions;
-import org.testng.annotations.Test;
-
-/**
- * Tests possible uses of RegisterImageOptions and RegisterImageOptions.Builder.*
- */
-public class RegisterImageOptionsTest {
-
- @Test
- public void testAssignability() {
- assert HttpRequestOptions.class.isAssignableFrom(RegisterImageOptions.class);
- assert !String.class.isAssignableFrom(RegisterImageOptions.class);
- }
-
- @Test
- public void testWithDescription() {
- RegisterImageOptions options = new RegisterImageOptions();
- options.withDescription("test");
- assertEquals(options.buildFormParameters().get("Description"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testNullWithDescription() {
- RegisterImageOptions options = new RegisterImageOptions();
- assertEquals(options.buildFormParameters().get("Description"), ImmutableList.of());
- }
-
- @Test
- public void testWithDescriptionStatic() {
- RegisterImageOptions options = withDescription("test");
- assertEquals(options.buildFormParameters().get("Description"),
- ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithDescriptionNPE() {
- withDescription(null);
- }
-
- @Test
- public void testWithArchitecture() {
- RegisterImageOptions options = new RegisterImageOptions();
- options.asArchitecture(Architecture.I386);
- assertEquals(options.buildFormParameters().get("Architecture"),
- ImmutableList.of("i386"));
- }
-
- @Test
- public void testNullWithArchitecture() {
- RegisterImageOptions options = new RegisterImageOptions();
- assertEquals(options.buildFormParameters().get("Architecture"), ImmutableList.of());
- }
-
- @Test
- public void testWithArchitectureStatic() {
- RegisterImageOptions options = asArchitecture(Architecture.I386);
- assertEquals(options.buildFormParameters().get("Architecture"),
- ImmutableList.of("i386"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithArchitectureNPE() {
- asArchitecture(null);
- }
-
- @Test
- public void testWithKernelId() {
- RegisterImageOptions options = new RegisterImageOptions();
- options.withKernelId("test");
- assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
- }
-
- @Test
- public void testNullWithKernelId() {
- RegisterImageOptions options = new RegisterImageOptions();
- assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of());
- }
-
- @Test
- public void testWithKernelIdStatic() {
- RegisterImageOptions options = withKernelId("test");
- assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithKernelIdNPE() {
- withKernelId(null);
- }
-
- @Test
- public void testWithRamdisk() {
- RegisterImageOptions options = new RegisterImageOptions();
- options.withRamdisk("test");
- assertEquals(options.buildFormParameters().get("RamdiskId"),
- ImmutableList.of("test"));
- }
-
- @Test
- public void testNullWithRamdisk() {
- RegisterImageOptions options = new RegisterImageOptions();
- assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of());
- }
-
- @Test
- public void testWithRamdiskStatic() {
- RegisterImageOptions options = withRamdisk("test");
- assertEquals(options.buildFormParameters().get("RamdiskId"),
- ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithRamdiskNPE() {
- withRamdisk(null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RunInstancesOptionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RunInstancesOptionsTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RunInstancesOptionsTest.java
deleted file mode 100644
index a519541..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/options/RunInstancesOptionsTest.java
+++ /dev/null
@@ -1,264 +0,0 @@
-/*
- * 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.ec2.options;
-
-import static org.jclouds.ec2.options.RunInstancesOptions.Builder.asType;
-import static org.jclouds.ec2.options.RunInstancesOptions.Builder.withBlockDeviceMappings;
-import static org.jclouds.ec2.options.RunInstancesOptions.Builder.withClientToken;
-import static org.jclouds.ec2.options.RunInstancesOptions.Builder.withKernelId;
-import static org.jclouds.ec2.options.RunInstancesOptions.Builder.withKeyName;
-import static org.jclouds.ec2.options.RunInstancesOptions.Builder.withRamdisk;
-import static org.jclouds.ec2.options.RunInstancesOptions.Builder.withSecurityGroup;
-import static org.jclouds.ec2.options.RunInstancesOptions.Builder.withUserData;
-import static org.testng.Assert.assertEquals;
-
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableSet;
-import org.jclouds.ec2.domain.BlockDeviceMapping;
-import org.jclouds.ec2.domain.InstanceType;
-import org.jclouds.http.options.HttpRequestOptions;
-import org.testng.annotations.Test;
-
-/**
- * Tests possible uses of RunInstancesOptions and RunInstancesOptions.Builder.*
- */
-public class RunInstancesOptionsTest {
-
- @Test
- public void testAssignability() {
- assert HttpRequestOptions.class.isAssignableFrom(RunInstancesOptions.class);
- assert !String.class.isAssignableFrom(RunInstancesOptions.class);
- }
-
- @Test
- public void testWithKeyName() {
- RunInstancesOptions options = new RunInstancesOptions();
- options.withKeyName("test");
- assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of("test"));
- }
-
- @Test
- public void testNullWithKeyName() {
- RunInstancesOptions options = new RunInstancesOptions();
- assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of());
- }
-
- @Test
- public void testWithKeyNameStatic() {
- RunInstancesOptions options = withKeyName("test");
- assertEquals(options.buildFormParameters().get("KeyName"), ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithKeyNameNPE() {
- withKeyName(null);
- }
-
- @Test
- public void testWithSecurityGroup() {
- RunInstancesOptions options = new RunInstancesOptions();
- options.withSecurityGroup("test");
- assertEquals(options.buildFormParameters().get("SecurityGroup.1"), ImmutableList.of("test"));
- }
-
- @Test
- public void testNullWithSecurityGroup() {
- RunInstancesOptions options = new RunInstancesOptions();
- assertEquals(options.buildFormParameters().get("SecurityGroup"), ImmutableList.of());
- }
-
- @Test
- public void testWithSecurityGroupStatic() {
- RunInstancesOptions options = withSecurityGroup("test");
- assertEquals(options.buildFormParameters().get("SecurityGroup.1"), ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithSecurityGroupNPE() {
- withSecurityGroup(null);
- }
-
- @Test
- public void testNullWithAdditionalInfo() {
- RunInstancesOptions options = new RunInstancesOptions();
- assertEquals(options.buildFormParameters().get("AdditionalInfo"), ImmutableList.of());
- }
-
- @Test
- public void testWithUserData() {
- RunInstancesOptions options = new RunInstancesOptions();
- options.withUserData("test".getBytes());
- assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of("dGVzdA=="));
- }
-
- @Test
- public void testNullWithUserData() {
- RunInstancesOptions options = new RunInstancesOptions();
- assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of());
- }
-
- @Test
- public void testWithUserDataStatic() {
- RunInstancesOptions options = withUserData("test".getBytes());
- assertEquals(options.buildFormParameters().get("UserData"), ImmutableList.of("dGVzdA=="));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithUserDataNPE() {
- withUserData(null);
- }
-
- @Test(expectedExceptions = IllegalArgumentException.class)
- public void testWithUserDataEmpty() {
- withUserData("".getBytes());
- }
-
- @Test
- public void testWithInstanceType() {
- RunInstancesOptions options = new RunInstancesOptions();
- options.asType(InstanceType.C1_XLARGE);
- assertEquals(options.buildFormParameters().get("InstanceType"), ImmutableList.of("c1.xlarge"));
- }
-
- @Test
- public void testNullWithInstanceType() {
- RunInstancesOptions options = new RunInstancesOptions();
- assertEquals(options.buildFormParameters().get("InstanceType"), ImmutableList.of());
- }
-
- @Test
- public void testWithInstanceTypeStatic() {
- RunInstancesOptions options = asType(InstanceType.C1_XLARGE);
- assertEquals(options.buildFormParameters().get("InstanceType"), ImmutableList.of("c1.xlarge"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithInstanceTypeNPE() {
- asType(null);
- }
-
- @Test
- public void testWithKernelId() {
- RunInstancesOptions options = new RunInstancesOptions();
- options.withKernelId("test");
- assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
- }
-
- @Test
- public void testNullWithKernelId() {
- RunInstancesOptions options = new RunInstancesOptions();
- assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of());
- }
-
- @Test
- public void testWithKernelIdStatic() {
- RunInstancesOptions options = withKernelId("test");
- assertEquals(options.buildFormParameters().get("KernelId"), ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithKernelIdNPE() {
- withKernelId(null);
- }
-
- @Test
- public void testWithRamdisk() {
- RunInstancesOptions options = new RunInstancesOptions();
- options.withRamdisk("test");
- assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of("test"));
- }
-
- @Test
- public void testNullWithRamdisk() {
- RunInstancesOptions options = new RunInstancesOptions();
- assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of());
- }
-
- @Test
- public void testWithRamdiskStatic() {
- RunInstancesOptions options = withRamdisk("test");
- assertEquals(options.buildFormParameters().get("RamdiskId"), ImmutableList.of("test"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithRamdiskNPE() {
- withRamdisk(null);
- }
-
- @Test
- public void testNullWithVirtualName() {
- RunInstancesOptions options = new RunInstancesOptions();
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.VirtualName"), ImmutableList.of());
- }
-
- @Test
- public void testWithBlockDeviceMapping() {
- BlockDeviceMapping mapping = new BlockDeviceMapping.MapNewVolumeToDevice("/dev/sda1", 120, true, "gp2", 10, true);
- RunInstancesOptions options = new RunInstancesOptions().withBlockDeviceMappings(ImmutableSet
- .<BlockDeviceMapping> of(mapping));
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"),
- ImmutableList.of("/dev/sda1"));
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"),
- ImmutableList.of("120"));
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"),
- ImmutableList.of("true"));
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeType"),
- ImmutableList.of("gp2"));
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.Iops"),
- ImmutableList.of("10"));
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.Encrypted"),
- ImmutableList.of("true"));
- }
-
- @Test
- public void testNullWithBlockDeviceMapping() {
- RunInstancesOptions options = new RunInstancesOptions();
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping"), ImmutableList.of());
- }
-
- @Test
- public void testWithBlockDeviceMappingStatic() {
- BlockDeviceMapping mapping = new BlockDeviceMapping.MapNewVolumeToDevice("/dev/sda1", 120, true, null, null, false);
- RunInstancesOptions options = withBlockDeviceMappings(ImmutableSet
- .<BlockDeviceMapping> of(mapping));
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.DeviceName"),
- ImmutableList.of("/dev/sda1"));
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeSize"),
- ImmutableList.of("120"));
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.DeleteOnTermination"),
- ImmutableList.of("true"));
- assertEquals(options.buildFormParameters().get("BlockDeviceMapping.1.Ebs.VolumeType"),
- ImmutableList.of());
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithBlockDeviceMappingNPE() {
- withBlockDeviceMappings(null);
- }
-
- @Test
- public void testWithClientToken() {
- RunInstancesOptions options = withClientToken("some-token");
- assertEquals(options.buildFormParameters().get("ClientToken"), ImmutableList.of("some-token"));
- }
-
- @Test(expectedExceptions = NullPointerException.class)
- public void testWithClientTokenNPE() {
- withClientToken(null);
- }
-
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/DescribeSubnetsResponseTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/DescribeSubnetsResponseTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/DescribeSubnetsResponseTest.java
deleted file mode 100644
index 87dd2b1..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/DescribeSubnetsResponseTest.java
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * 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.ec2.parse;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.InputStream;
-
-import org.jclouds.ec2.domain.Subnet;
-import org.jclouds.ec2.xml.DescribeSubnetsResponseHandler;
-import org.jclouds.http.functions.BaseHandlerTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
-
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
-@Test(groups = "unit", testName = "DescribeSubnetsResponseTest")
-public class DescribeSubnetsResponseTest extends BaseHandlerTest {
-
- public void test() {
- InputStream is = getClass().getResourceAsStream("/describe_subnets.xml");
-
- FluentIterable<Subnet> expected = expected();
-
- DescribeSubnetsResponseHandler handler = injector.getInstance(DescribeSubnetsResponseHandler.class);
- FluentIterable<Subnet> result = factory.create(handler).parse(is);
-
- assertEquals(result.toString(), expected.toString());
-
- }
- public FluentIterable<Subnet> expected() {
- return FluentIterable.from(ImmutableSet.<Subnet>builder()
- .add(Subnet.builder()
- .subnetId("subnet-9d4a7b6c")
- .subnetState(Subnet.State.AVAILABLE)
- .vpcId("vpc-1a2b3c4d")
- .cidrBlock("10.0.1.0/24")
- .availableIpAddressCount(250)
- .availabilityZone("us-east-1a")
- .tag("Name", "ec2-o")
- .tag("Empty", "")
- .build())
- .add(Subnet.builder()
- .subnetId("subnet-6e7f829e")
- .subnetState(Subnet.State.AVAILABLE)
- .vpcId("vpc-1a2b3c4d")
- .cidrBlock("10.0.0.0/24")
- .availableIpAddressCount(250)
- .availabilityZone("us-east-1a")
- .build()).build());
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/DescribeTagsResponseTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/DescribeTagsResponseTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/DescribeTagsResponseTest.java
deleted file mode 100644
index 065f98a..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/DescribeTagsResponseTest.java
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * 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.ec2.parse;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.InputStream;
-
-import org.jclouds.ec2.domain.Tag;
-import org.jclouds.ec2.xml.DescribeTagsResponseHandler;
-import org.jclouds.http.functions.BaseHandlerTest;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.FluentIterable;
-import com.google.common.collect.ImmutableSet;
-
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
-@Test(groups = "unit", testName = "DescribeTagsResponseTest")
-public class DescribeTagsResponseTest extends BaseHandlerTest {
-
- public void test() {
- InputStream is = getClass().getResourceAsStream("/describe_tags.xml");
-
- FluentIterable<Tag> expected = expected();
-
- DescribeTagsResponseHandler handler = injector.getInstance(DescribeTagsResponseHandler.class);
- FluentIterable<Tag> result = factory.create(handler).parse(is);
-
- assertEquals(result.toString(), expected.toString());
-
- }
- public FluentIterable<Tag> expected() {
- return FluentIterable.from(ImmutableSet.<Tag>builder()
- .add(Tag.builder()
- .resourceId("i-5f4e3d2a")
- .resourceType("instance")
- .key("webserver")
- .build())
- .add(Tag.builder()
- .resourceId("i-5f4e3d2a")
- .resourceType("instance")
- .key("stack")
- .value("Production")
- .build())
- .add(Tag.builder()
- .resourceId("i-12345678")
- .resourceType("instance")
- .key("database_server")
- .build())
- .add(Tag.builder()
- .resourceId("i-12345678")
- .resourceType("instance")
- .key("stack")
- .value("Test")
- .build()).build());
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/GetPasswordDataResponseTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/GetPasswordDataResponseTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/GetPasswordDataResponseTest.java
deleted file mode 100644
index 93edb32..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/parse/GetPasswordDataResponseTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.ec2.parse;
-
-import static org.testng.Assert.assertEquals;
-
-import java.io.InputStream;
-
-import org.jclouds.date.DateService;
-import org.jclouds.date.internal.SimpleDateFormatDateService;
-import org.jclouds.ec2.domain.PasswordData;
-import org.jclouds.ec2.xml.GetPasswordDataResponseHandler;
-import org.jclouds.http.functions.BaseHandlerTest;
-import org.testng.annotations.Test;
-
-// NOTE:without testName, this will not call @Before* and fail w/NPE during surefire
-@Test(groups = "unit", testName = "GetPasswordDataResponseTest")
-public class GetPasswordDataResponseTest extends BaseHandlerTest {
- protected final DateService dateService = new SimpleDateFormatDateService();
-
- public void test() {
- InputStream is = getClass().getResourceAsStream("/get_passworddata.xml");
-
- PasswordData expected = expected();
-
- GetPasswordDataResponseHandler handler = injector.getInstance(GetPasswordDataResponseHandler.class);
- PasswordData result = factory.create(handler).parse(is);
-
- assertEquals(result.toString(), expected.toString());
- }
-
- public PasswordData expected() {
- return PasswordData.builder()
- .instanceId("i-2574e22a")
- .timestamp(dateService.iso8601DateParse("2012-07-30T07:27:23.000+0000"))
- .passwordData("TGludXggdmVyc2lvbiAyLjYuMTYteGVuVSAoYnVpbGRlckBwYXRjaGJhdC5hbWF6b25zYSkgKGdj").build();
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/predicates/VolumeDetachedTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/predicates/VolumeDetachedTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/predicates/VolumeDetachedTest.java
deleted file mode 100644
index 79a6929..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/predicates/VolumeDetachedTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * 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.ec2.predicates;
-
-import static com.google.common.collect.Sets.newHashSet;
-import static org.easymock.EasyMock.createMock;
-import static org.easymock.EasyMock.expect;
-import static org.easymock.EasyMock.replay;
-import static org.easymock.EasyMock.verify;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.util.Date;
-import java.util.Set;
-
-import org.jclouds.ec2.domain.Attachment;
-import org.jclouds.ec2.domain.Attachment.Status;
-import org.jclouds.ec2.domain.Volume;
-import org.jclouds.ec2.features.ElasticBlockStoreApi;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-@Test(groups = "unit", singleThreaded = true)
-public class VolumeDetachedTest {
-
- private ElasticBlockStoreApi client;
- private VolumeDetached volumeDetached;
-
- @BeforeMethod
- public void setUp() {
- client = createMock(ElasticBlockStoreApi.class);
- volumeDetached = new VolumeDetached(client);
- }
-
- @Test
- public void testVolumeWithEmptyListOfAttachments() {
- Attachment attachment = newAttachmentWithStatus(Status.ATTACHED);
- Set<Volume> volumes = newHashSet(newVolumeWithAttachments(/* empty */));
-
- expect(client.describeVolumesInRegion(attachment.getRegion(),
- attachment.getVolumeId())).andReturn(volumes);
- replay(client);
-
- assertTrue(volumeDetached.apply(attachment));
- verify(client);
- }
-
- @DataProvider(name = "notDetachedStatuses")
- public Object[][] provideNotDetachedStatuses() {
- return new Object[][] {
- {Status.ATTACHED},
- {Status.ATTACHING},
- {Status.BUSY},
- {Status.DETACHING},
- {Status.UNRECOGNIZED}
- };
- }
-
- @Test(dataProvider = "notDetachedStatuses")
- public void testWithDifferentStatus(Status attachmentStatus) {
- Attachment attachment = newAttachmentWithStatus(attachmentStatus);
- Set<Volume> volumes = newHashSet(newVolumeWithAttachments(attachment));
-
- expect(client.describeVolumesInRegion(attachment.getRegion(),
- attachment.getVolumeId())).andReturn(volumes);
- replay(client);
-
- assertFalse(volumeDetached.apply(attachment));
- verify(client);
- }
-
- @Test
- public void testWithStatusDetached() {
- Attachment attachment = newAttachmentWithStatus(Status.DETACHED);
- Set<Volume> volumes = newHashSet(newVolumeWithAttachments(attachment));
-
- expect(client.describeVolumesInRegion(attachment.getRegion(),
- attachment.getVolumeId())).andReturn(volumes);
- replay(client);
-
- assertTrue(volumeDetached.apply(attachment));
- verify(client);
- }
-
- private Volume newVolumeWithAttachments(Attachment... attachments) {
- return Volume.builder().region("us-east-1").attachments(attachments).build();
- }
-
- private Attachment newAttachmentWithStatus(Status status) {
- return Attachment.builder()
- .volumeId("1").status(status).region("us-east-1").attachTime(new Date())
- .device("/dev/sda").instanceId("us-east-1/i-1234").build();
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/suppliers/DescribeAvailabilityZonesInRegionTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/suppliers/DescribeAvailabilityZonesInRegionTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/suppliers/DescribeAvailabilityZonesInRegionTest.java
deleted file mode 100644
index 8d00242..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/suppliers/DescribeAvailabilityZonesInRegionTest.java
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- * 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.ec2.suppliers;
-
-import static org.easymock.EasyMock.expect;
-import static org.easymock.classextension.EasyMock.createControl;
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.fail;
-
-import java.util.Map;
-import java.util.Set;
-
-import org.easymock.classextension.IMocksControl;
-import org.jclouds.ec2.EC2Api;
-import org.jclouds.ec2.domain.AvailabilityZoneInfo;
-import org.jclouds.ec2.features.AvailabilityZoneAndRegionApi;
-import org.jclouds.http.HttpCommand;
-import org.jclouds.http.HttpResponseException;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Suppliers;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-
-/**
- * A test for {@link DescribeAvailabilityZonesInRegion}.
- */
-public class DescribeAvailabilityZonesInRegionTest {
- @Test
- public void testDescribeAvailabilityZonesInRegion_BestEffort() {
- IMocksControl control = createControl();
- EC2Api client = control.createMock(EC2Api.class);
- AvailabilityZoneAndRegionApi regionClient = control.createMock(AvailabilityZoneAndRegionApi.class);
- AvailabilityZoneInfo info1 = control.createMock(AvailabilityZoneInfo.class);
- AvailabilityZoneInfo info2 = control.createMock(AvailabilityZoneInfo.class);
- HttpCommand command = control.createMock(HttpCommand.class);
- HttpResponseException exception = new HttpResponseException("Error: Unable to tunnel through proxy: ...",
- command, null);
-
- expect(client.getAvailabilityZoneAndRegionApi()).andStubReturn((Optional) Optional.of(regionClient));
- expect(regionClient.describeAvailabilityZonesInRegion("accessibleRegion1")).andReturn(
- ImmutableSet.of(info1));
- expect(regionClient.describeAvailabilityZonesInRegion("inaccessibleRegion")).andThrow(exception);
- expect(regionClient.describeAvailabilityZonesInRegion("accessibleRegion2")).andReturn(
- ImmutableSet.of(info2));
- expect(info1.getZone()).andStubReturn("zone1");
- expect(info2.getZone()).andStubReturn("zone2");
-
- Set<String> regions = ImmutableSet.of("accessibleRegion1", "inaccessibleRegion", "accessibleRegion2");
- control.replay();
-
- Map<String, Set<String>> expectedResult = ImmutableMap.<String, Set<String>> builder().put("accessibleRegion1",
- ImmutableSet.of("zone1")).put("accessibleRegion2", ImmutableSet.of("zone2")).build();
-
- DescribeAvailabilityZonesInRegion regionIdToZoneId = new DescribeAvailabilityZonesInRegion(client, Suppliers
- .ofInstance(regions));
- assertEquals(Maps.transformValues(regionIdToZoneId.get(), Suppliers.<Set<String>> supplierFunction()),
- expectedResult);
- control.verify();
- }
-
- @Test
- public void testDescribeAvailabilityZonesInRegion_RethrowIfNoneFound() {
- IMocksControl control = createControl();
- EC2Api client = control.createMock(EC2Api.class);
- AvailabilityZoneAndRegionApi regionClient = control.createMock(AvailabilityZoneAndRegionApi.class);
- HttpCommand command = control.createMock(HttpCommand.class);
- HttpResponseException exception = new HttpResponseException("Error: Unable to tunnel through proxy: ...",
- command, null);
-
- expect(client.getAvailabilityZoneAndRegionApi()).andStubReturn((Optional) Optional.of(regionClient));
- expect(regionClient.describeAvailabilityZonesInRegion("inaccessibleRegion")).andThrow(exception);
-
- Set<String> regions = ImmutableSet.of("inaccessibleRegion");
- control.replay();
-
- DescribeAvailabilityZonesInRegion regionIdToZoneId = new DescribeAvailabilityZonesInRegion(client, Suppliers
- .ofInstance(regions));
- try {
- regionIdToZoneId.get();
- fail("expected exception");
- } catch (HttpResponseException e) {
- assertEquals(e, exception);
- }
- control.verify();
- }
-
- @Test
- public void testDescribeAvailabilityZonesInRegion_NoZones() {
- IMocksControl control = createControl();
- EC2Api client = control.createMock(EC2Api.class);
- AvailabilityZoneAndRegionApi regionClient = control.createMock(AvailabilityZoneAndRegionApi.class);
-
- expect(client.getAvailabilityZoneAndRegionApi()).andStubReturn((Optional) Optional.of(regionClient));
- expect(regionClient.describeAvailabilityZonesInRegion("emptyRegion")).andReturn(
- ImmutableSet.<AvailabilityZoneInfo> of());
-
- Set<String> regions = ImmutableSet.of("emptyRegion");
- control.replay();
-
- DescribeAvailabilityZonesInRegion regionIdToZoneId = new DescribeAvailabilityZonesInRegion(client, Suppliers
- .ofInstance(regions));
- assertEquals(regionIdToZoneId.get(), ImmutableMap.<String, String> of());
- control.verify();
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/util/IpPermissionsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/util/IpPermissionsTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/util/IpPermissionsTest.java
deleted file mode 100644
index 01ce950..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/util/IpPermissionsTest.java
+++ /dev/null
@@ -1,104 +0,0 @@
-/*
- * 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.ec2.util;
-
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.net.domain.IpProtocol;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableSet;
-
-/**
- * Tests possible uses of IpPermissions
- */
-@Test(testName = "IpPermissionsTest")
-public class IpPermissionsTest {
- public void testAllProtocol() {
- IpPermissions authorization = IpPermissions.permitAnyProtocol();
- assertEquals(
- IpPermissions.buildFormParametersForIndex(0, authorization).toString(),
- "{IpPermissions.0.IpProtocol=[-1], IpPermissions.0.FromPort=[1], IpPermissions.0.ToPort=[65535], IpPermissions.0.IpRanges.0.CidrIp=[0.0.0.0/0]}");
- }
-
- public void testAllProtocolCidrBound() {
- IpPermissions authorization = IpPermissions.permit(IpProtocol.ALL).originatingFromCidrBlock("1.1.1.1/32");
- assertEquals(
- IpPermissions.buildFormParametersForIndex(0, authorization).toString(),
- "{IpPermissions.0.IpProtocol=[-1], IpPermissions.0.FromPort=[1], IpPermissions.0.ToPort=[65535], IpPermissions.0.IpRanges.0.CidrIp=[1.1.1.1/32]}");
- }
-
- public void testJustProtocolAndCidr() {
- IpPermissions authorization = IpPermissions.permit(IpProtocol.TCP).originatingFromCidrBlock("1.1.1.1/32");
- assertEquals(
- IpPermissions.buildFormParametersForIndex(0, authorization).toString(),
- "{IpPermissions.0.IpProtocol=[tcp], IpPermissions.0.FromPort=[1], IpPermissions.0.ToPort=[65535], IpPermissions.0.IpRanges.0.CidrIp=[1.1.1.1/32]}");
- }
-
- public void testAnyProtocol() {
- IpPermissions authorization = IpPermissions.permitAnyProtocol().originatingFromCidrBlock("1.1.1.1/32");
- assertEquals(
- IpPermissions.buildFormParametersForIndex(0, authorization).toString(),
- "{IpPermissions.0.IpProtocol=[-1], IpPermissions.0.FromPort=[1], IpPermissions.0.ToPort=[65535], IpPermissions.0.IpRanges.0.CidrIp=[1.1.1.1/32]}");
- }
-
- public void testMultipleCidrs() {
- IpPermissions authorization = IpPermissions.permit(IpProtocol.TCP).originatingFromCidrBlocks(
- ImmutableSet.of("1.1.1.1/32", "1.1.1.2/32"));
- assertEquals(
- IpPermissions.buildFormParametersForIndex(0, authorization).toString(),
- "{IpPermissions.0.IpProtocol=[tcp], IpPermissions.0.FromPort=[1], IpPermissions.0.ToPort=[65535], IpPermissions.0.IpRanges.0.CidrIp=[1.1.1.1/32], IpPermissions.0.IpRanges.1.CidrIp=[1.1.1.2/32]}");
- }
-
- public void testProtocolFromAndToPortAndGroupIds() {
- IpPermissions authorization = IpPermissions.permit(IpProtocol.UDP).fromPort(11).to(53)
- .originatingFromSecurityGroupId("groupId");
- assertEquals(
- IpPermissions.buildFormParametersForIndex(0, authorization).toString(),
- "{IpPermissions.0.IpProtocol=[udp], IpPermissions.0.FromPort=[11], IpPermissions.0.ToPort=[53], IpPermissions.0.Groups.0.GroupId=[groupId]}");
- }
-
- public void testProtocolICMPAny() {
- IpPermissions authorization = IpPermissions.permitICMP().originatingFromSecurityGroupId("groupId");
- assertEquals(
- IpPermissions.buildFormParametersForIndex(0, authorization).toString(),
- "{IpPermissions.0.IpProtocol=[icmp], IpPermissions.0.FromPort=[-1], IpPermissions.0.ToPort=[-1], IpPermissions.0.Groups.0.GroupId=[groupId]}");
- }
-
- public void testProtocolICMPTypeAnyCode() {
- IpPermissions authorization = IpPermissions.permitICMP().type(8).originatingFromSecurityGroupId("groupId");
- assertEquals(
- IpPermissions.buildFormParametersForIndex(0, authorization).toString(),
- "{IpPermissions.0.IpProtocol=[icmp], IpPermissions.0.FromPort=[8], IpPermissions.0.ToPort=[-1], IpPermissions.0.Groups.0.GroupId=[groupId]}");
- }
-
- public void testProtocolICMPTypeCode() {
- IpPermissions authorization = IpPermissions.permitICMP().type(8).andCode(0)
- .originatingFromSecurityGroupId("groupId");
- assertEquals(
- IpPermissions.buildFormParametersForIndex(0, authorization).toString(),
- "{IpPermissions.0.IpProtocol=[icmp], IpPermissions.0.FromPort=[8], IpPermissions.0.ToPort=[0], IpPermissions.0.Groups.0.GroupId=[groupId]}");
- }
-
- public void testProtocolFromAndToPortAndUserGroups() {
- IpPermissions authorization = IpPermissions.permit(IpProtocol.ICMP).originatingFromUserAndSecurityGroup("userId",
- "groupId");
- assertEquals(
- IpPermissions.buildFormParametersForIndex(0, authorization).toString(),
- "{IpPermissions.0.IpProtocol=[icmp], IpPermissions.0.FromPort=[-1], IpPermissions.0.ToPort=[-1], IpPermissions.0.Groups.0.UserId=[userId], IpPermissions.0.Groups.0.GroupId=[groupId]}");
- }
-}
http://git-wip-us.apache.org/repos/asf/stratos/blob/a9834e9e/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/util/TagsTest.java
----------------------------------------------------------------------
diff --git a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/util/TagsTest.java b/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/util/TagsTest.java
deleted file mode 100644
index 72018e5..0000000
--- a/dependencies/jclouds/apis/ec2/1.8.0-stratos/src/test/java/org/jclouds/ec2/util/TagsTest.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.ec2.util;
-
-import static org.jclouds.ec2.domain.Tag.ResourceType.IMAGE;
-import static org.jclouds.ec2.domain.Tag.ResourceType.INSTANCE;
-import static org.testng.Assert.assertEquals;
-
-import org.jclouds.ec2.domain.Tag;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-
-@Test
-public class TagsTest {
- Tag resourceTag1 = Tag.builder().resourceType(IMAGE).resourceId("1").key("key").value("value").build();
-
- public void testValueFunction() {
- assertEquals(Tags.valueFunction().apply(resourceTag1), "value");
- }
-
- public void testKeyFunction() {
- assertEquals(Tags.keyFunction().apply(resourceTag1), "key");
- }
-
- Tag resourceTag2 = Tag.builder().resourceType(IMAGE).resourceId("1").key("foo").value("bar").build();
- Tag resource2Tag1 = Tag.builder().resourceType(INSTANCE).resourceId("2").key("absent").build();
- Tag resource2Tag2 = Tag.builder().resourceType(INSTANCE).resourceId("2").key("hello").value("world").build();
-
- public void testResourceToTagsAsMap() {
- assertEquals(
- Tags.resourceToTagsAsMap(ImmutableSet.of(resourceTag1, resourceTag2, resource2Tag1, resource2Tag2)),
- ImmutableMap.of("1", ImmutableMap.of("key", "value", "foo", "bar"),
- "2", ImmutableMap.of("absent", "", "hello", "world")));
- }
-
-}