From cdde419b249de2fdd07c8c800f59fb80818ed517 Mon Sep 17 00:00:00 2001 From: David Ribeiro Alves Date: Wed, 18 Jul 2012 01:58:18 +0100 Subject: [PATCH 01/33] re-enabled most tests and corrected some minor bugs, only destoyPoolNodes is missing --- .../jclouds/nodepool/NodePoolApiMetadata.java | 11 +- .../NodePoolComputeServiceContextModule.java | 20 +++ .../BaseNodePoolComputeServiceAdapter.java | 6 +- .../internal/JsonNodeMetadataStore.java | 18 +++ .../internal/NodeMetadataStoreCache.java | 18 +++ .../jclouds/nodepool/BYONBackendLiveTest.java | 4 +- .../NodeMetadataStoreTestDisabled.java | 151 ------------------ .../NodePoolComputeServiceContextTest.java | 21 +-- .../NodePoolComputeServiceLiveTest.java | 29 ++-- .../config/BindBackendComputeServiceTest.java | 45 ++++-- ...dInputStreamToFilesystemBlobStoreTest.java | 27 ++-- labs/nodepool/src/test/resources/logback.xml | 2 +- .../login/AdminAccessBuilderSpec.java | 4 + 13 files changed, 146 insertions(+), 210 deletions(-) delete mode 100644 labs/nodepool/src/test/java/org/jclouds/nodepool/NodeMetadataStoreTestDisabled.java diff --git a/labs/nodepool/src/main/java/org/jclouds/nodepool/NodePoolApiMetadata.java b/labs/nodepool/src/main/java/org/jclouds/nodepool/NodePoolApiMetadata.java index df6296cfad..98b53571fb 100644 --- a/labs/nodepool/src/main/java/org/jclouds/nodepool/NodePoolApiMetadata.java +++ b/labs/nodepool/src/main/java/org/jclouds/nodepool/NodePoolApiMetadata.java @@ -26,6 +26,7 @@ import static org.jclouds.nodepool.config.NodePoolProperties.MIN_SIZE; import static org.jclouds.nodepool.config.NodePoolProperties.POOL_ADMIN_ACCESS; import static org.jclouds.nodepool.config.NodePoolProperties.REMOVE_DESTROYED; +import java.io.File; import java.net.URI; import java.util.Properties; @@ -62,7 +63,6 @@ public class NodePoolApiMetadata extends BaseApiMetadata { public static Properties defaultProperties() { Properties properties = BaseRestApiMetadata.defaultProperties(); - properties.setProperty("nodepool.identity", "nodepool-user"); properties.setProperty(BACKEND_GROUP, "nodepool"); properties.setProperty(METADATA_CONTAINER, "nodes"); properties.setProperty(BACKEND_MODULES, @@ -70,9 +70,12 @@ public class NodePoolApiMetadata extends BaseApiMetadata { properties.setProperty(MAX_SIZE, 10 + ""); properties.setProperty(MIN_SIZE, 5 + ""); properties.setProperty(REMOVE_DESTROYED, "true"); - // by default use the current user's user and private key - properties.setProperty(POOL_ADMIN_ACCESS, "adminUsername=" + System.getProperty("user.name") - + ",adminPrivateKeyFile=" + System.getProperty("user.home") + "/.ssh/id_rsa"); + // by default use the current user's user and private key if one exists, if not the properties + // will need to be set (no default passwords) + if (new File(System.getProperty("user.home") + "/.ssh/id_rsa").exists()) { + properties.setProperty(POOL_ADMIN_ACCESS, "adminUsername=" + System.getProperty("user.name") + + ",adminPrivateKeyFile=" + System.getProperty("user.home") + "/.ssh/id_rsa"); + } return properties; } diff --git a/labs/nodepool/src/main/java/org/jclouds/nodepool/config/NodePoolComputeServiceContextModule.java b/labs/nodepool/src/main/java/org/jclouds/nodepool/config/NodePoolComputeServiceContextModule.java index e2cfc0d7e1..2adb63c229 100644 --- a/labs/nodepool/src/main/java/org/jclouds/nodepool/config/NodePoolComputeServiceContextModule.java +++ b/labs/nodepool/src/main/java/org/jclouds/nodepool/config/NodePoolComputeServiceContextModule.java @@ -1,3 +1,22 @@ +/* + * Licensed to jclouds, Inc. (jclouds) under one or more + * contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. jclouds 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.nodepool.config; import javax.annotation.Nullable; @@ -44,6 +63,7 @@ public class NodePoolComputeServiceContextModule extends JCloudsNativeComputeSer bind(ComputeServiceContext.class).to(NodePoolComputeServiceContext.class); install(new LocationsFromComputeServiceAdapterModule() { }); + } @Override diff --git a/labs/nodepool/src/main/java/org/jclouds/nodepool/internal/BaseNodePoolComputeServiceAdapter.java b/labs/nodepool/src/main/java/org/jclouds/nodepool/internal/BaseNodePoolComputeServiceAdapter.java index ac3674abed..7073d8b04a 100644 --- a/labs/nodepool/src/main/java/org/jclouds/nodepool/internal/BaseNodePoolComputeServiceAdapter.java +++ b/labs/nodepool/src/main/java/org/jclouds/nodepool/internal/BaseNodePoolComputeServiceAdapter.java @@ -61,8 +61,10 @@ public abstract class BaseNodePoolComputeServiceAdapter implements NodePoolCompu protected final AdminAccess.Builder initialCredentialsBuilder; public BaseNodePoolComputeServiceAdapter(@Backend Supplier backendComputeService, - @Backend Supplier