Updated Branches:
  refs/heads/master e8ef5c066 -> bd984ba50

CloudStackApi should extend Closeable

Without that, you can't actually do view.unwrapApi(CloudStackApi.class).


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

Branch: refs/heads/master
Commit: bd984ba50828656dcb7c590b8e2da9c7dbf93654
Parents: e8ef5c0
Author: Andrew Bayer <[email protected]>
Authored: Fri Sep 27 11:58:33 2013 -0700
Committer: Andrew Bayer <[email protected]>
Committed: Fri Sep 27 11:58:33 2013 -0700

----------------------------------------------------------------------
 .../org/jclouds/cloudstack/CloudStackApi.java   |  4 ++-
 .../CloudStackContextBuilderTest.java           | 37 ++++++++++++++++++++
 2 files changed, 40 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bd984ba5/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackApi.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackApi.java 
b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackApi.java
index 2006347..9959421 100644
--- a/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackApi.java
+++ b/apis/cloudstack/src/main/java/org/jclouds/cloudstack/CloudStackApi.java
@@ -16,6 +16,8 @@
  */
 package org.jclouds.cloudstack;
 
+import java.io.Closeable;
+
 import org.jclouds.cloudstack.features.AccountApi;
 import org.jclouds.cloudstack.features.AddressApi;
 import org.jclouds.cloudstack.features.AsyncJobApi;
@@ -48,7 +50,7 @@ import org.jclouds.rest.annotations.Delegate;
  * @author Adrian Cole
  * @see <a 
href="http://download.cloud.com/releases/2.2.0/api_2.2.12/TOC_User.html"; />
  */
-public interface CloudStackApi {
+public interface CloudStackApi extends Closeable {
    /**
     * Provides synchronous access to Zone features.
     */

http://git-wip-us.apache.org/repos/asf/incubator-jclouds/blob/bd984ba5/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackContextBuilderTest.java
----------------------------------------------------------------------
diff --git 
a/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackContextBuilderTest.java
 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackContextBuilderTest.java
new file mode 100644
index 0000000..ff3ce9a
--- /dev/null
+++ 
b/apis/cloudstack/src/test/java/org/jclouds/cloudstack/CloudStackContextBuilderTest.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.jclouds.cloudstack;
+
+import static org.jclouds.reflect.Reflection2.typeToken;
+
+import org.jclouds.ContextBuilder;
+import org.jclouds.View;
+import org.jclouds.compute.ComputeServiceContext;
+import org.testng.annotations.Test;
+
+/**
+ * @author Andrew Bayer
+ */
+@Test(groups = "unit", testName = "CloudStackContextBuilderTest")
+public class CloudStackContextBuilderTest {
+
+   public void testAssignability() {
+      View view = ContextBuilder.newBuilder(new 
CloudStackApiMetadata()).credentials("foo", "bar")
+              .buildView(typeToken(ComputeServiceContext.class));
+      view.unwrapApi(CloudStackApi.class);
+   }
+}

Reply via email to