You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@jclouds.apache.org by na...@apache.org on 2015/10/07 21:03:46 UTC

[1/4] jclouds git commit: Adding elastichosts Dallas and Miami providers

Repository: jclouds
Updated Branches:
  refs/heads/master 07e64a2d0 -> 99c5b9ace


Adding elastichosts Dallas and Miami providers


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/c3f17751
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/c3f17751
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/c3f17751

Branch: refs/heads/master
Commit: c3f1775123667d8938abf6f5aa153fd9b88ffffa
Parents: 07e64a2
Author: Stuart Hendren <st...@tenode.com>
Authored: Sun May 24 13:45:40 2015 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Oct 7 20:39:36 2015 +0200

----------------------------------------------------------------------
 providers/elastichosts-dal-a/README.txt         |   6 +
 providers/elastichosts-dal-a/pom.xml            | 130 +++++++++++++++++++
 .../ElasticHostsDallasMetadata.java             |  82 ++++++++++++
 .../ElasticHostsDallasApiLiveTest.java          |  27 ++++
 .../ElasticHostsDallasProviderTest.java         |  29 +++++
 ...lasticHostsDallasComputeServiceLiveTest.java |  30 +++++
 ...asticHostsDallasTemplateBuilderLiveTest.java |  53 ++++++++
 providers/elastichosts-mmi-a/README.txt         |   6 +
 providers/elastichosts-mmi-a/pom.xml            | 130 +++++++++++++++++++
 .../elastichosts/ElasticHostsMiamiMetadata.java |  83 ++++++++++++
 .../ElasticHostsMiamiApiLiveTest.java           |  27 ++++
 .../ElasticHostsMiamiProviderTest.java          |  29 +++++
 ...ElasticHostsMiamiComputeServiceLiveTest.java |  30 +++++
 ...lasticHostsMiamiTemplateBuilderLiveTest.java |  53 ++++++++
 providers/pom.xml                               |   2 +
 15 files changed, 717 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-dal-a/README.txt
----------------------------------------------------------------------
diff --git a/providers/elastichosts-dal-a/README.txt b/providers/elastichosts-dal-a/README.txt
new file mode 100644
index 0000000..b0a81c5
--- /dev/null
+++ b/providers/elastichosts-dal-a/README.txt
@@ -0,0 +1,6 @@
+#
+# The jclouds provider for ElasticHosts' Dallas ElasticStack  (http://www.elastichosts.com/).
+#
+# Expects the jclouds elasticstack API to be present on your application's classpath.
+#
+

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-dal-a/pom.xml
----------------------------------------------------------------------
diff --git a/providers/elastichosts-dal-a/pom.xml b/providers/elastichosts-dal-a/pom.xml
new file mode 100644
index 0000000..270a0c3
--- /dev/null
+++ b/providers/elastichosts-dal-a/pom.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.jclouds</groupId>
+    <artifactId>jclouds-project</artifactId>
+    <version>2.0.0-SNAPSHOT</version>
+    <relativePath>../../project/pom.xml</relativePath>
+  </parent>
+  <groupId>org.apache.jclouds.provider</groupId>
+  <artifactId>elastichosts-dal-a</artifactId>
+  <name>jclouds ElasticHosts Dallas provider</name>
+  <description>ElasticHosts implementation targeted to Dallas</description>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <test.elastichosts-dal-a.endpoint>https://api-dal-a.elastichosts.com</test.elastichosts-dal-a.endpoint>
+    <test.elastichosts-dal-a.api-version>2.0</test.elastichosts-dal-a.api-version>
+    <test.elastichosts-dal-a.build-version />
+    <test.elastichosts-dal-a.identity>FIXME_IDENTITY</test.elastichosts-dal-a.identity>
+    <test.elastichosts-dal-a.credential>FIXME_CREDENTIAL</test.elastichosts-dal-a.credential>
+    <test.elastichosts-dal-a.template />
+
+    <jclouds.osgi.export>org.jclouds.elastichosts*;version="${project.version}"</jclouds.osgi.export>
+    <jclouds.osgi.import>
+      org.jclouds.compute.internal;version="${project.version}",
+      org.jclouds.rest.internal;version="${project.version}",
+      org.jclouds*;version="${project.version}",
+      *
+    </jclouds.osgi.import>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.jclouds.api</groupId>
+      <artifactId>elasticstack</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds.api</groupId>
+      <artifactId>elasticstack</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds</groupId>
+      <artifactId>jclouds-core</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds</groupId>
+      <artifactId>jclouds-compute</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds.driver</groupId>
+      <artifactId>jclouds-log4j</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds.driver</groupId>
+      <artifactId>jclouds-sshj</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.auto.service</groupId>
+      <artifactId>auto-service</artifactId>
+      <optional>true</optional>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>live</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>integration</id>
+                <phase>integration-test</phase>
+                <goals>
+                  <goal>test</goal>
+                </goals>
+                <configuration>
+                  <systemPropertyVariables>
+                    <test.elastichosts-dal-a.endpoint>${test.elastichosts-dal-a.endpoint}</test.elastichosts-dal-a.endpoint>
+                    <test.elastichosts-dal-a.api-version>${test.elastichosts-dal-a.api-version}</test.elastichosts-dal-a.api-version>
+                    <test.elastichosts-dal-a.build-version>${test.elastichosts-dal-a.build-version}</test.elastichosts-dal-a.build-version>
+                    <test.elastichosts-dal-a.identity>${test.elastichosts-dal-a.identity}</test.elastichosts-dal-a.identity>
+                    <test.elastichosts-dal-a.credential>${test.elastichosts-dal-a.credential}</test.elastichosts-dal-a.credential>
+                    <test.elastichosts-dal-a.template>${test.elastichosts-dal-a.template}</test.elastichosts-dal-a.template>
+                  </systemPropertyVariables>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
+

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-dal-a/src/main/java/org/jclouds/elastichosts/ElasticHostsDallasMetadata.java
----------------------------------------------------------------------
diff --git a/providers/elastichosts-dal-a/src/main/java/org/jclouds/elastichosts/ElasticHostsDallasMetadata.java b/providers/elastichosts-dal-a/src/main/java/org/jclouds/elastichosts/ElasticHostsDallasMetadata.java
new file mode 100644
index 0000000..7444f12
--- /dev/null
+++ b/providers/elastichosts-dal-a/src/main/java/org/jclouds/elastichosts/ElasticHostsDallasMetadata.java
@@ -0,0 +1,82 @@
+/*
+ * 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.elastichosts;
+
+import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.elasticstack.ElasticStackApiMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.providers.internal.BaseProviderMetadata;
+
+import com.google.auto.service.AutoService;
+
+/**
+ * Implementation of {@link ProviderMetadata} for ElasticHosts Dallas.
+ */
+@AutoService(ProviderMetadata.class)
+public class ElasticHostsDallasMetadata extends BaseProviderMetadata {
+
+   public static Builder builder() {
+      return new Builder();
+   }
+
+   @Override
+   public Builder toBuilder() {
+      return builder().fromProviderMetadata(this);
+   }
+
+   public ElasticHostsDallasMetadata() {
+      super(builder());
+   }
+
+   public ElasticHostsDallasMetadata(Builder builder) {
+      super(builder);
+   }
+
+   public static Properties defaultProperties() {
+      Properties properties = new Properties();
+      properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04],os64Bit=true");
+      return properties;
+   }
+
+   public static class Builder extends BaseProviderMetadata.Builder {
+
+      protected Builder() {
+         id("elastichosts-dal-a").name("ElasticHosts Dallas")
+               .apiMetadata(new ElasticStackApiMetadata().toBuilder().version("2.0").build())
+               .homepage(URI.create("https://dal-a.elastichosts.com"))
+               .console(URI.create("https://dal-a.elastichosts.com/accounts")).iso3166Codes("US-TX")
+               .endpoint("https://api-dal-a.elastichosts.com")
+               .defaultProperties(ElasticHostsDallasMetadata.defaultProperties());
+      }
+
+      @Override
+      public ElasticHostsDallasMetadata build() {
+         return new ElasticHostsDallasMetadata(this);
+      }
+
+      @Override
+      public Builder fromProviderMetadata(ProviderMetadata in) {
+         super.fromProviderMetadata(in);
+         return this;
+      }
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/ElasticHostsDallasApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/ElasticHostsDallasApiLiveTest.java b/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/ElasticHostsDallasApiLiveTest.java
new file mode 100644
index 0000000..7fc9132
--- /dev/null
+++ b/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/ElasticHostsDallasApiLiveTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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.elastichosts;
+
+import org.jclouds.elasticstack.ElasticStackApiLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsDallasApiLiveTest")
+public class ElasticHostsDallasApiLiveTest extends ElasticStackApiLiveTest {
+   public ElasticHostsDallasApiLiveTest() {
+      provider = "elastichosts-dal-a";
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/ElasticHostsDallasProviderTest.java
----------------------------------------------------------------------
diff --git a/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/ElasticHostsDallasProviderTest.java b/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/ElasticHostsDallasProviderTest.java
new file mode 100644
index 0000000..d1db8ec
--- /dev/null
+++ b/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/ElasticHostsDallasProviderTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.elastichosts;
+
+import org.jclouds.elasticstack.ElasticStackApiMetadata;
+import org.jclouds.providers.internal.BaseProviderMetadataTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "ElasticHostsDallasProviderTest")
+public class ElasticHostsDallasProviderTest extends BaseProviderMetadataTest {
+
+   public ElasticHostsDallasProviderTest() {
+      super(new ElasticHostsDallasMetadata(), new ElasticStackApiMetadata());
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsDallasComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsDallasComputeServiceLiveTest.java b/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsDallasComputeServiceLiveTest.java
new file mode 100644
index 0000000..2426a7a
--- /dev/null
+++ b/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsDallasComputeServiceLiveTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.elastichosts.compute;
+
+import org.jclouds.elasticstack.compute.ElasticStackComputeServiceLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "ElasticHostsDallasComputeServiceLiveTest")
+public class ElasticHostsDallasComputeServiceLiveTest extends ElasticStackComputeServiceLiveTest {
+
+   public ElasticHostsDallasComputeServiceLiveTest() {
+      provider = "elastichosts-dal-a";
+      group = "elastichosts";
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsDallasTemplateBuilderLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsDallasTemplateBuilderLiveTest.java b/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsDallasTemplateBuilderLiveTest.java
new file mode 100644
index 0000000..0ba8e2a
--- /dev/null
+++ b/providers/elastichosts-dal-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsDallasTemplateBuilderLiveTest.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.elastichosts.compute;
+
+import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+@Test(groups = "live", testName = "ElasticHostsDallasTemplateBuilderLiveTest")
+public class ElasticHostsDallasTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
+
+   public ElasticHostsDallasTemplateBuilderLiveTest() {
+      provider = "elastichosts-dal-a";
+   }
+
+   @Override
+   public void testDefaultTemplateBuilder() throws IOException {
+      Template defaultTemplate = view.getComputeService().templateBuilder().build();
+      assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04]"));
+      assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
+      assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
+      assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
+   }
+
+   @Override
+   protected Set<String> getIso3166Codes() {
+      return ImmutableSet.<String> of("US-TX");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-mmi-a/README.txt
----------------------------------------------------------------------
diff --git a/providers/elastichosts-mmi-a/README.txt b/providers/elastichosts-mmi-a/README.txt
new file mode 100644
index 0000000..f630668
--- /dev/null
+++ b/providers/elastichosts-mmi-a/README.txt
@@ -0,0 +1,6 @@
+#
+# The jclouds provider for ElasticHosts' Miami ElasticStack  (http://www.elastichosts.com/).
+#
+# Expects the jclouds elasticstack API to be present on your application's classpath.
+#
+

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-mmi-a/pom.xml
----------------------------------------------------------------------
diff --git a/providers/elastichosts-mmi-a/pom.xml b/providers/elastichosts-mmi-a/pom.xml
new file mode 100644
index 0000000..7c76691
--- /dev/null
+++ b/providers/elastichosts-mmi-a/pom.xml
@@ -0,0 +1,130 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+
+    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.
+
+-->
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+    <groupId>org.apache.jclouds</groupId>
+    <artifactId>jclouds-project</artifactId>
+    <version>2.0.0-SNAPSHOT</version>
+    <relativePath>../../project/pom.xml</relativePath>
+  </parent>
+  <groupId>org.apache.jclouds.provider</groupId>
+  <artifactId>elastichosts-mmi-a</artifactId>
+  <name>jclouds ElasticHosts Miami provider</name>
+  <description>ElasticHosts implementation targeted to Miami</description>
+  <packaging>bundle</packaging>
+
+  <properties>
+    <test.elastichosts-mmi-a.endpoint>https://api-mmi-a.elastichosts.com</test.elastichosts-mmi-a.endpoint>
+    <test.elastichosts-mmi-a.api-version>2.0</test.elastichosts-mmi-a.api-version>
+    <test.elastichosts-mmi-a.build-version />
+    <test.elastichosts-mmi-a.identity>FIXME_IDENTITY</test.elastichosts-mmi-a.identity>
+    <test.elastichosts-mmi-a.credential>FIXME_CREDENTIAL</test.elastichosts-mmi-a.credential>
+    <test.elastichosts-mmi-a.template />
+
+    <jclouds.osgi.export>org.jclouds.elastichosts*;version="${project.version}"</jclouds.osgi.export>
+    <jclouds.osgi.import>
+      org.jclouds.compute.internal;version="${project.version}",
+      org.jclouds.rest.internal;version="${project.version}",
+      org.jclouds*;version="${project.version}",
+      *
+    </jclouds.osgi.import>
+  </properties>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.jclouds.api</groupId>
+      <artifactId>elasticstack</artifactId>
+      <version>${project.version}</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds.api</groupId>
+      <artifactId>elasticstack</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds</groupId>
+      <artifactId>jclouds-core</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds</groupId>
+      <artifactId>jclouds-compute</artifactId>
+      <version>${project.version}</version>
+      <type>test-jar</type>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds.driver</groupId>
+      <artifactId>jclouds-log4j</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.jclouds.driver</groupId>
+      <artifactId>jclouds-sshj</artifactId>
+      <version>${project.version}</version>
+      <scope>test</scope>
+    </dependency>
+    <dependency>
+      <groupId>com.google.auto.service</groupId>
+      <artifactId>auto-service</artifactId>
+      <optional>true</optional>
+    </dependency>
+  </dependencies>
+
+  <profiles>
+    <profile>
+      <id>live</id>
+      <build>
+        <plugins>
+          <plugin>
+            <groupId>org.apache.maven.plugins</groupId>
+            <artifactId>maven-surefire-plugin</artifactId>
+            <executions>
+              <execution>
+                <id>integration</id>
+                <phase>integration-test</phase>
+                <goals>
+                  <goal>test</goal>
+                </goals>
+                <configuration>
+                  <systemPropertyVariables>
+                    <test.elastichosts-mmi-a.endpoint>${test.elastichosts-mmi-a.endpoint}</test.elastichosts-mmi-a.endpoint>
+                    <test.elastichosts-mmi-a.api-version>${test.elastichosts-mmi-a.api-version}</test.elastichosts-mmi-a.api-version>
+                    <test.elastichosts-mmi-a.build-version>${test.elastichosts-mmi-a.build-version}</test.elastichosts-mmi-a.build-version>
+                    <test.elastichosts-mmi-a.identity>${test.elastichosts-mmi-a.identity}</test.elastichosts-mmi-a.identity>
+                    <test.elastichosts-mmi-a.credential>${test.elastichosts-mmi-a.credential}</test.elastichosts-mmi-a.credential>
+                    <test.elastichosts-mmi-a.template>${test.elastichosts-mmi-a.template}</test.elastichosts-mmi-a.template>
+                  </systemPropertyVariables>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+</project>
+

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-mmi-a/src/main/java/org/jclouds/elastichosts/ElasticHostsMiamiMetadata.java
----------------------------------------------------------------------
diff --git a/providers/elastichosts-mmi-a/src/main/java/org/jclouds/elastichosts/ElasticHostsMiamiMetadata.java b/providers/elastichosts-mmi-a/src/main/java/org/jclouds/elastichosts/ElasticHostsMiamiMetadata.java
new file mode 100644
index 0000000..93b2180
--- /dev/null
+++ b/providers/elastichosts-mmi-a/src/main/java/org/jclouds/elastichosts/ElasticHostsMiamiMetadata.java
@@ -0,0 +1,83 @@
+/*
+ * 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.elastichosts;
+
+import static org.jclouds.compute.config.ComputeServiceProperties.TEMPLATE;
+
+import java.net.URI;
+import java.util.Properties;
+
+import org.jclouds.elasticstack.ElasticStackApiMetadata;
+import org.jclouds.providers.ProviderMetadata;
+import org.jclouds.providers.internal.BaseProviderMetadata;
+
+import com.google.auto.service.AutoService;
+
+/**
+ * Implementation of {@link ProviderMetadata} for ElasticHosts Miami.
+ */
+@AutoService(ProviderMetadata.class)
+public class ElasticHostsMiamiMetadata extends BaseProviderMetadata {
+
+   public static Builder builder() {
+      return new Builder();
+   }
+
+   @Override
+   public Builder toBuilder() {
+      return builder().fromProviderMetadata(this);
+   }
+
+   public ElasticHostsMiamiMetadata() {
+      super(builder());
+   }
+
+   public ElasticHostsMiamiMetadata(Builder builder) {
+      super(builder);
+   }
+
+   public static Properties defaultProperties() {
+      Properties properties = new Properties();
+      properties.setProperty(TEMPLATE, "osFamily=UBUNTU,osVersionMatches=1[01234].[01][04],os64Bit=true");
+      return properties;
+   }
+
+   public static class Builder extends BaseProviderMetadata.Builder {
+
+      protected Builder() {
+         id("elastichosts-mmi-a").name("ElasticHosts Miami")
+               .apiMetadata(new ElasticStackApiMetadata().toBuilder().version("2.0").build())
+               .homepage(URI.create("https://mmi-a.elastichosts.com"))
+               .console(URI.create("https://mmi-a.elastichosts.com/accounts"))
+               .iso3166Codes("US-FL")
+               .endpoint("https://api-mmi-a.elastichosts.com")
+               .defaultProperties(ElasticHostsMiamiMetadata.defaultProperties());
+      }
+
+      @Override
+      public ElasticHostsMiamiMetadata build() {
+         return new ElasticHostsMiamiMetadata(this);
+      }
+
+      @Override
+      public Builder fromProviderMetadata(ProviderMetadata in) {
+         super.fromProviderMetadata(in);
+         return this;
+      }
+
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/ElasticHostsMiamiApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/ElasticHostsMiamiApiLiveTest.java b/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/ElasticHostsMiamiApiLiveTest.java
new file mode 100644
index 0000000..340a7ca
--- /dev/null
+++ b/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/ElasticHostsMiamiApiLiveTest.java
@@ -0,0 +1,27 @@
+/*
+ * 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.elastichosts;
+
+import org.jclouds.elasticstack.ElasticStackApiLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", singleThreaded = true, testName = "ElasticHostsMiamiApiLiveTest")
+public class ElasticHostsMiamiApiLiveTest extends ElasticStackApiLiveTest {
+   public ElasticHostsMiamiApiLiveTest() {
+      provider = "elastichosts-mmi-a";
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/ElasticHostsMiamiProviderTest.java
----------------------------------------------------------------------
diff --git a/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/ElasticHostsMiamiProviderTest.java b/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/ElasticHostsMiamiProviderTest.java
new file mode 100644
index 0000000..1daaf44
--- /dev/null
+++ b/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/ElasticHostsMiamiProviderTest.java
@@ -0,0 +1,29 @@
+/*
+ * 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.elastichosts;
+
+import org.jclouds.elasticstack.ElasticStackApiMetadata;
+import org.jclouds.providers.internal.BaseProviderMetadataTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit", testName = "ElasticHostsMiamiProviderTest")
+public class ElasticHostsMiamiProviderTest extends BaseProviderMetadataTest {
+
+   public ElasticHostsMiamiProviderTest() {
+      super(new ElasticHostsMiamiMetadata(), new ElasticStackApiMetadata());
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsMiamiComputeServiceLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsMiamiComputeServiceLiveTest.java b/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsMiamiComputeServiceLiveTest.java
new file mode 100644
index 0000000..b3d310b
--- /dev/null
+++ b/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsMiamiComputeServiceLiveTest.java
@@ -0,0 +1,30 @@
+/*
+ * 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.elastichosts.compute;
+
+import org.jclouds.elasticstack.compute.ElasticStackComputeServiceLiveTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "live", testName = "ElasticHostsMiamiComputeServiceLiveTest")
+public class ElasticHostsMiamiComputeServiceLiveTest extends ElasticStackComputeServiceLiveTest {
+
+   public ElasticHostsMiamiComputeServiceLiveTest() {
+      provider = "elastichosts-mmi-a";
+      group = "elastichosts";
+   }
+
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsMiamiTemplateBuilderLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsMiamiTemplateBuilderLiveTest.java b/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsMiamiTemplateBuilderLiveTest.java
new file mode 100644
index 0000000..9b3057d
--- /dev/null
+++ b/providers/elastichosts-mmi-a/src/test/java/org/jclouds/elastichosts/compute/ElasticHostsMiamiTemplateBuilderLiveTest.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.elastichosts.compute;
+
+import static org.jclouds.compute.util.ComputeServiceUtils.getCores;
+import static org.testng.Assert.assertEquals;
+import static org.testng.Assert.assertTrue;
+
+import java.io.IOException;
+import java.util.Set;
+
+import org.jclouds.compute.domain.OsFamily;
+import org.jclouds.compute.domain.Template;
+import org.jclouds.compute.internal.BaseTemplateBuilderLiveTest;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.ImmutableSet;
+
+@Test(groups = "live", testName = "ElasticHostsMiamiTemplateBuilderLiveTest")
+public class ElasticHostsMiamiTemplateBuilderLiveTest extends BaseTemplateBuilderLiveTest {
+
+   public ElasticHostsMiamiTemplateBuilderLiveTest() {
+      provider = "elastichosts-mmi-a";
+   }
+
+   @Override
+   public void testDefaultTemplateBuilder() throws IOException {
+      Template defaultTemplate = view.getComputeService().templateBuilder().build();
+      assertTrue(defaultTemplate.getImage().getOperatingSystem().getVersion().matches("1[01234].[01][04]"));
+      assertEquals(defaultTemplate.getImage().getOperatingSystem().is64Bit(), true);
+      assertEquals(defaultTemplate.getImage().getOperatingSystem().getFamily(), OsFamily.UBUNTU);
+      assertEquals(getCores(defaultTemplate.getHardware()), 1.0d);
+   }
+
+   @Override
+   protected Set<String> getIso3166Codes() {
+      return ImmutableSet.<String> of("US-FL");
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c3f17751/providers/pom.xml
----------------------------------------------------------------------
diff --git a/providers/pom.xml b/providers/pom.xml
index 77bf0e2..6edcaa5 100644
--- a/providers/pom.xml
+++ b/providers/pom.xml
@@ -45,6 +45,8 @@
     <module>elastichosts-sjc-c</module>
     <module>elastichosts-hkg-e</module>
     <module>elastichosts-syd-v</module>
+    <module>elastichosts-mmi-a</module>
+    <module>elastichosts-dal-a</module>
     <module>openhosting-east1</module>
     <module>serverlove-z1-man</module>
     <module>skalicloud-sdg-my</module>


[4/4] jclouds git commit: Add .gitattributes to avoid line endings issues

Posted by na...@apache.org.
Add .gitattributes to avoid line endings issues

Since commit 56e687f4979d, Linux line endings (LF) are enforced. But on
Windows, a common practice is to set core.autocrlf to 'auto', wich mean
that the local copy of the file has Windows line endings, whereas the
remote copy has Linux line endings (cf. https://help.github.com/articles/dealing-with-line-endings/#platform-windows).

With core.autoclrf=auto, Checkstyle will throw an error because local
files will have Windows line endings.

This setting will set Linux line endings for all text files, except
.cmd files.


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/99c5b9ac
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/99c5b9ac
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/99c5b9ac

Branch: refs/heads/master
Commit: 99c5b9ace7491afbe4ad511fc3b9fd3b849dcd57
Parents: c73b82b
Author: olivierlemasle <ol...@apalia.net>
Authored: Sun Oct 4 20:47:35 2015 +0200
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Oct 7 20:43:55 2015 +0200

----------------------------------------------------------------------
 .gitattributes | 2 ++
 1 file changed, 2 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/99c5b9ac/.gitattributes
----------------------------------------------------------------------
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 0000000..6008505
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,2 @@
+* text eol=lf
+*.cmd binary


[2/4] jclouds git commit: Add new Softlayer API method to return arbitrary VirtualGuest fields

Posted by na...@apache.org.
Add new Softlayer API method to return arbitrary VirtualGuest fields


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/cf0e659c
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/cf0e659c
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/cf0e659c

Branch: refs/heads/master
Commit: cf0e659ccfc0f8de797bd6ef4f537350703917ff
Parents: c3f1775
Author: Andrew Kennedy <an...@cloudsoftcorp.com>
Authored: Thu Jul 30 14:26:35 2015 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Oct 7 20:40:51 2015 +0200

----------------------------------------------------------------------
 .../softlayer/features/VirtualGuestApi.java     | 19 +++++++-
 .../features/VirtualGuestApiLiveTest.java       | 11 +++++
 .../features/VirtualGuestApiMockTest.java       | 38 ++++++++++-----
 .../parse/VirtualGuestFilteredParseTest.java    | 50 ++++++++++++++++++++
 .../resources/virtual_guest_get_filtered.json   | 10 ++++
 5 files changed, 114 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/cf0e659c/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestApi.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestApi.java b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestApi.java
index 75d6171..daf626b 100644
--- a/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestApi.java
+++ b/providers/softlayer/src/main/java/org/jclouds/softlayer/features/VirtualGuestApi.java
@@ -19,6 +19,7 @@ package org.jclouds.softlayer.features;
 import static org.jclouds.Fallbacks.FalseOnNotFoundOr404;
 import static org.jclouds.Fallbacks.NullOnNotFoundOr404;
 import static org.jclouds.Fallbacks.VoidOnNotFoundOr404;
+
 import java.util.Set;
 
 import javax.inject.Named;
@@ -28,6 +29,7 @@ import javax.ws.rs.POST;
 import javax.ws.rs.Path;
 import javax.ws.rs.PathParam;
 import javax.ws.rs.Produces;
+import javax.ws.rs.QueryParam;
 import javax.ws.rs.core.MediaType;
 
 import org.jclouds.http.filters.BasicAuthentication;
@@ -71,8 +73,7 @@ public interface VirtualGuestApi {
    VirtualGuest createVirtualGuest(@BinderParam(VirtualGuestToJson.class) VirtualGuest virtualGuest);
 
    /**
-    * @param id
-    *           id of the virtual guest
+    * @param id id of the virtual guest
     * @return virtual guest or null if not found
     * @see <a href="http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getObject" />
     */
@@ -84,6 +85,20 @@ public interface VirtualGuestApi {
    VirtualGuest getVirtualGuest(@PathParam("id") long id);
 
    /**
+    * Returns a {@link VirtualGuest} with <b>only</b> the fields listed in the filter string.
+    * @param id id of the virtual guest
+    * @param filter semicolon separated list of fields to return in the resulting object
+    * @return virtual guest or null if not found
+    * @see <a href="http://sldn.softlayer.com/reference/services/SoftLayer_Virtual_Guest/getObject" />
+    * @see <a href="http://sldn.softlayer.com/article/object-masks" />
+    */
+   @Named("VirtualGuests:get")
+   @GET
+   @Path("/SoftLayer_Virtual_Guest/{id}/getObject")
+   @Fallback(NullOnNotFoundOr404.class)
+   VirtualGuest getVirtualGuestFiltered(@PathParam("id") long id, @QueryParam("objectMask") String filter);
+
+   /**
     * Delete a computing instance
     * @param id the id of the virtual guest.
     * @return the result of the deletion

http://git-wip-us.apache.org/repos/asf/jclouds/blob/cf0e659c/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiLiveTest.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiLiveTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiLiveTest.java
index 3e7b161..37cf750 100644
--- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiLiveTest.java
+++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiLiveTest.java
@@ -21,6 +21,7 @@ import static org.jclouds.softlayer.compute.strategy.SoftLayerComputeServiceAdap
 import static org.jclouds.util.Predicates2.retry;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
+import static org.testng.Assert.assertNull;
 import static org.testng.Assert.assertTrue;
 import java.util.Properties;
 import java.util.Set;
@@ -112,9 +113,19 @@ public class VirtualGuestApiLiveTest extends BaseSoftLayerApiLiveTest {
    public void testGetVirtualGuest() throws Exception {
       VirtualGuest found = virtualGuestApi.getVirtualGuest(virtualGuest.getId());
       assertEquals(found, virtualGuest);
+      assertNull(found.getPrimaryBackendNetworkComponent(), "backendNetworkComponent should be null");
    }
 
    @Test(dependsOnMethods = "testGetVirtualGuest")
+   public void testGetVirtualGuestFiltered() throws Exception {
+      VirtualGuest found = virtualGuestApi.getVirtualGuestFiltered(virtualGuest.getId(), "id;primaryBackendNetworkComponent;primaryBackendNetworkComponent.networkVlan");
+      assertEquals(found.getId(), virtualGuest.getId());
+      assertNotNull(found.getPrimaryBackendNetworkComponent(), "backendNetworkComponent must be returned");
+      assertNotNull(found.getPrimaryBackendNetworkComponent().getNetworkVlan(), "backendNetworkComponent networkVlan must be returned");
+      assertTrue(found.getPrimaryBackendNetworkComponent().getNetworkVlan().getId() > 0, "backendNetworkComponent must have a valid networkVlan ID");
+   }
+
+   @Test(dependsOnMethods = "testGetVirtualGuestFiltered")
    public void testSetTagsOnVirtualGuest() throws Exception {
       ImmutableSet<String> tags = ImmutableSet.of("test", "jclouds");
       assertTrue(virtualGuestApi.setTags(virtualGuest.getId(), tags));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/cf0e659c/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiMockTest.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiMockTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiMockTest.java
index 853c5c9..c8280b2 100644
--- a/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiMockTest.java
+++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/features/VirtualGuestApiMockTest.java
@@ -29,30 +29,44 @@ import org.jclouds.softlayer.domain.OperatingSystem;
 import org.jclouds.softlayer.domain.VirtualGuest;
 import org.jclouds.softlayer.internal.BaseSoftLayerMockTest;
 import org.jclouds.softlayer.parse.GetCreateObjectOptionsParseTest;
+import org.jclouds.softlayer.parse.VirtualGuestFilteredParseTest;
 import org.jclouds.softlayer.parse.VirtualGuestParseTest;
 import org.testng.annotations.Test;
 
-import com.google.common.collect.ImmutableSet;
 import com.squareup.okhttp.mockwebserver.MockResponse;
 import com.squareup.okhttp.mockwebserver.MockWebServer;
 
+import com.google.common.collect.ImmutableSet;
+
 /**
  * Mock tests for the {@link org.jclouds.softlayer.features.VirtualGuestApi} class.
  */
 @Test(groups = "unit", testName = "VirtualGuestApiMockTest")
 public class VirtualGuestApiMockTest extends BaseSoftLayerMockTest {
 
-   public void testGetVirtualGuest() throws Exception {
-      MockWebServer server = mockWebServer(new MockResponse().setBody(payloadFromResource("/virtual_guest_get.json")));
-      VirtualGuestApi api = getVirtualGuestApi(server);
-
-      try {
-         assertEquals(api.getVirtualGuest(3001812), new VirtualGuestParseTest().expected());
-         assertSent(server, "GET", "/SoftLayer_Virtual_Guest/3001812/getObject?objectMask=id%3Bhostname%3Bdomain%3BfullyQualifiedDomainName%3BpowerState%3BmaxCpu%3BmaxMemory%3BstatusId%3BoperatingSystem.passwords%3BprimaryBackendIpAddress%3BprimaryIpAddress%3BactiveTransactionCount%3BblockDevices.diskImage%3Bdatacenter%3BtagReferences%3BprivateNetworkOnlyFlag%3BsshKeys");
-      } finally {
-         server.shutdown();
-      }
-   }
+    public void testGetVirtualGuest() throws Exception {
+       MockWebServer server = mockWebServer(new MockResponse().setBody(payloadFromResource("/virtual_guest_get.json")));
+       VirtualGuestApi api = getVirtualGuestApi(server);
+
+       try {
+          assertEquals(api.getVirtualGuest(3001812), new VirtualGuestParseTest().expected());
+          assertSent(server, "GET", "/SoftLayer_Virtual_Guest/3001812/getObject?objectMask=id%3Bhostname%3Bdomain%3BfullyQualifiedDomainName%3BpowerState%3BmaxCpu%3BmaxMemory%3BstatusId%3BoperatingSystem.passwords%3BprimaryBackendIpAddress%3BprimaryIpAddress%3BactiveTransactionCount%3BblockDevices.diskImage%3Bdatacenter%3BtagReferences%3BprivateNetworkOnlyFlag%3BsshKeys");
+       } finally {
+          server.shutdown();
+       }
+    }
+
+    public void testGetVirtualGuestFiltered() throws Exception {
+       MockWebServer server = mockWebServer(new MockResponse().setBody(payloadFromResource("/virtual_guest_get_filtered.json")));
+       VirtualGuestApi api = getVirtualGuestApi(server);
+
+       try {
+          assertEquals(api.getVirtualGuestFiltered(3001812, "id;primaryBackendNetworkComponent;primaryBackendNetworkComponent.networkVlan"), new VirtualGuestFilteredParseTest().expected());
+          assertSent(server, "GET", "/SoftLayer_Virtual_Guest/3001812/getObject?objectMask=id%3BprimaryBackendNetworkComponent%3BprimaryBackendNetworkComponent.networkVlan");
+       } finally {
+          server.shutdown();
+       }
+    }
 
    public void testGetNullVirtualGuest() throws Exception {
       MockWebServer server = mockWebServer(new MockResponse().setResponseCode(404));

http://git-wip-us.apache.org/repos/asf/jclouds/blob/cf0e659c/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestFilteredParseTest.java
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestFilteredParseTest.java b/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestFilteredParseTest.java
new file mode 100644
index 0000000..8d4c57a
--- /dev/null
+++ b/providers/softlayer/src/test/java/org/jclouds/softlayer/parse/VirtualGuestFilteredParseTest.java
@@ -0,0 +1,50 @@
+/*
+ * 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.softlayer.parse;
+
+import javax.ws.rs.Consumes;
+import javax.ws.rs.core.MediaType;
+
+import org.jclouds.softlayer.domain.NetworkVlan;
+import org.jclouds.softlayer.domain.VirtualGuest;
+import org.jclouds.softlayer.domain.VirtualGuestNetworkComponent;
+import org.jclouds.softlayer.internal.BaseSoftLayerParseTest;
+import org.testng.annotations.Test;
+
+@Test(groups = "unit")
+public class VirtualGuestFilteredParseTest extends BaseSoftLayerParseTest<VirtualGuest> {
+
+   @Override
+   public String resource() {
+      return "/virtual_guest_get_filtered.json";
+   }
+
+   @Override
+   @Consumes(MediaType.APPLICATION_JSON)
+   public VirtualGuest expected() {
+      return VirtualGuest.builder()
+                              .id(3001812)
+                              .primaryBackendNetworkComponent(VirtualGuestNetworkComponent.builder()
+                                      .networkId(123456)
+                                      .networkVlan(NetworkVlan.builder()
+                                              .id(1234)
+                                              .name("abc")
+                                              .build())
+                                      .build())
+                              .build();
+   }
+}

http://git-wip-us.apache.org/repos/asf/jclouds/blob/cf0e659c/providers/softlayer/src/test/resources/virtual_guest_get_filtered.json
----------------------------------------------------------------------
diff --git a/providers/softlayer/src/test/resources/virtual_guest_get_filtered.json b/providers/softlayer/src/test/resources/virtual_guest_get_filtered.json
new file mode 100644
index 0000000..3f3235b
--- /dev/null
+++ b/providers/softlayer/src/test/resources/virtual_guest_get_filtered.json
@@ -0,0 +1,10 @@
+{
+    "primaryBackendNetworkComponent": {
+        "networkId" : 123456,
+        "networkVlan": {
+            "id": 1234,
+            "name": "abc"
+        }
+    },
+    "id": 3001812
+}
\ No newline at end of file


[3/4] jclouds git commit: As in JCLOUDS-991 it appears size is missing as a UsageResponse parameter, particularily for Volume usages. This commit adds it into the UsageRecord class.

Posted by na...@apache.org.
As in JCLOUDS-991 it appears size is missing as a UsageResponse parameter, particularily for Volume usages.  This commit adds it into the UsageRecord class.


Project: http://git-wip-us.apache.org/repos/asf/jclouds/repo
Commit: http://git-wip-us.apache.org/repos/asf/jclouds/commit/c73b82b5
Tree: http://git-wip-us.apache.org/repos/asf/jclouds/tree/c73b82b5
Diff: http://git-wip-us.apache.org/repos/asf/jclouds/diff/c73b82b5

Branch: refs/heads/master
Commit: c73b82b58b6ad0270bc24402ee44ceeb83fad978
Parents: cf0e659
Author: John McDonnell <mc...@gmail.com>
Authored: Mon Aug 17 21:29:40 2015 +0100
Committer: Ignasi Barrera <na...@apache.org>
Committed: Wed Oct 7 20:42:47 2015 +0200

----------------------------------------------------------------------
 .../jclouds/cloudstack/domain/UsageRecord.java  | 28 ++++++++++++++++----
 .../parse/ListUsageRecordsResponseTest.java     |  3 ++-
 2 files changed, 25 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/jclouds/blob/c73b82b5/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/UsageRecord.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/UsageRecord.java b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/UsageRecord.java
index fe54b70..164c9ae 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/UsageRecord.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/domain/UsageRecord.java
@@ -111,6 +111,7 @@ public class UsageRecord {
       protected boolean isSourceNAT;
       protected double rawUsageHours;
       protected String usage;
+      protected Long size;
       protected String type;
       protected UsageType usageType;
 
@@ -257,6 +258,14 @@ public class UsageRecord {
          this.usage = usage;
          return self();
       }
+      
+      /**
+       * @see UsageRecord#getSize()
+       */
+      public T size(Long size) {
+         this.size = size;
+         return self();
+      }
 
       /**
        * @see UsageRecord#getType()
@@ -277,7 +286,7 @@ public class UsageRecord {
       public UsageRecord build() {
          return new UsageRecord(id, description, accountId, accountName, domainId, startDate, endDate, assignDate, releaseDate,
                zoneId, virtualMachineId, virtualMachineName, serviceOfferingId, templateId, ipAddress, isSourceNAT, rawUsageHours,
-               usage, type, usageType);
+               usage, size, type, usageType);
       }
 
       public T fromUsageRecord(UsageRecord in) {
@@ -300,6 +309,7 @@ public class UsageRecord {
                .isSourceNAT(in.isSourceNAT())
                .rawUsageHours(in.getRawUsageHours())
                .usage(in.getUsage())
+               .size(in.getSize())
                .type(in.getType())
                .usageType(in.getUsageType());
       }
@@ -330,19 +340,21 @@ public class UsageRecord {
    private final boolean isSourceNAT;
    private final double rawUsageHours;
    private final String usage;
+   private final Long size;
    private final String type;
    private final UsageType usageType;
 
    @ConstructorProperties({
          "usageid", "description", "accountid", "account", "domainid", "startdate", "enddate", "assigndate", "releasedate",
          "zoneid", "virtualmachineid", "name", "offeringid", "templateid", "ipaddress", "issourcenat", "rawusage", "usage",
-         "type", "usagetype"
+         "size", "type", "usagetype"
    })
    protected UsageRecord(String id, @Nullable String description, @Nullable String accountId, @Nullable String accountName,
                          @Nullable String domainId, @Nullable Date startDate, @Nullable Date endDate, @Nullable Date assignDate,
                          @Nullable String releaseDate, @Nullable String zoneId, @Nullable String virtualMachineId, @Nullable String virtualMachineName,
                          @Nullable String serviceOfferingId, @Nullable String templateId, @Nullable String ipAddress,
-                         boolean isSourceNAT, double rawUsageHours, @Nullable String usage, @Nullable String type, @Nullable UsageType usageType) {
+                         boolean isSourceNAT, double rawUsageHours, @Nullable String usage, @Nullable Long size,
+                         @Nullable String type, @Nullable UsageType usageType) {
       this.id = id;
       this.description = description;
       this.accountId = accountId;
@@ -361,6 +373,7 @@ public class UsageRecord {
       this.isSourceNAT = isSourceNAT;
       this.rawUsageHours = rawUsageHours;
       this.usage = usage;
+      this.size = size;
       this.type = type;
       this.usageType = usageType;
    }
@@ -451,6 +464,10 @@ public class UsageRecord {
    public String getUsage() {
       return this.usage;
    }
+   
+   public Long getSize() {
+      return this.size;
+   }
 
    @Nullable
    public String getType() {
@@ -466,7 +483,7 @@ public class UsageRecord {
    public int hashCode() {
       return Objects.hashCode(id, description, accountId, accountName, domainId, startDate, endDate, assignDate, releaseDate,
             zoneId, virtualMachineId, virtualMachineName, serviceOfferingId, templateId, ipAddress, isSourceNAT, rawUsageHours,
-            usage, type, usageType);
+            size, usage, type, usageType);
    }
 
    @Override
@@ -492,6 +509,7 @@ public class UsageRecord {
             && Objects.equal(this.isSourceNAT, that.isSourceNAT)
             && Objects.equal(this.rawUsageHours, that.rawUsageHours)
             && Objects.equal(this.usage, that.usage)
+            && Objects.equal(this.size, that.size)
             && Objects.equal(this.type, that.type)
             && Objects.equal(this.usageType, that.usageType);
    }
@@ -503,7 +521,7 @@ public class UsageRecord {
             .add("releaseDate", releaseDate).add("zoneId", zoneId).add("virtualMachineId", virtualMachineId)
             .add("virtualMachineName", virtualMachineName).add("serviceOfferingId", serviceOfferingId).add("templateId", templateId)
             .add("ipAddress", ipAddress).add("isSourceNAT", isSourceNAT).add("rawUsageHours", rawUsageHours).add("usage", usage)
-            .add("type", type).add("usageType", usageType);
+            .add("size", size).add("type", type).add("usageType", usageType);
    }
 
    @Override

http://git-wip-us.apache.org/repos/asf/jclouds/blob/c73b82b5/apis/cloudstack/src/test/java/org/jclouds/cloudstack/parse/ListUsageRecordsResponseTest.java
----------------------------------------------------------------------
diff --git a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/parse/ListUsageRecordsResponseTest.java b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/parse/ListUsageRecordsResponseTest.java
index 9ecd895..8a4fd25 100644
--- a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/parse/ListUsageRecordsResponseTest.java
+++ b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/parse/ListUsageRecordsResponseTest.java
@@ -60,7 +60,8 @@ public class ListUsageRecordsResponseTest extends BaseSetParserTest<UsageRecord>
                .accountName("admin").accountId("2").domainId("1").zoneId("1")
                .description("Template Id:203 Size:3117171712")
                .usage("24 Hrs").usageType(UsageRecord.UsageType.TEMPLATE).rawUsageHours(24)
-            .templateId("0").id("203").startDate(start).endDate(end).build());
+               .size(3117171712l).templateId("0").id("203")
+               .startDate(start).endDate(end).build());
 
    }