http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/internal/BaseChefServiceTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/internal/BaseChefServiceTest.java b/core/src/test/java/org/jclouds/chef/internal/BaseChefServiceTest.java deleted file mode 100644 index e763d8f..0000000 --- a/core/src/test/java/org/jclouds/chef/internal/BaseChefServiceTest.java +++ /dev/null @@ -1,99 +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.chef.internal; - -import static org.testng.Assert.assertEquals; - -import java.util.List; - -import org.jclouds.ContextBuilder; -import org.jclouds.chef.ChefApiMetadata; -import org.jclouds.chef.domain.BootstrapConfig; -import org.jclouds.chef.filters.SignedHeaderAuthTest; -import org.jclouds.chef.util.RunListBuilder; -import org.jclouds.domain.JsonBall; -import org.jclouds.logging.config.NullLoggingModule; -import org.jclouds.rest.internal.BaseRestApiTest.MockModule; -import org.testng.annotations.BeforeClass; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Injector; -import com.google.inject.Module; - -/** - * Unit tests for the <code>BaseChefService</code> class. - */ -@Test(groups = "unit", testName = "BaseChefServiceTest") -public class BaseChefServiceTest { - - private BaseChefService chefService; - - @BeforeClass - public void setup() { - Injector injector = ContextBuilder.newBuilder(new ChefApiMetadata()) - .credentials(SignedHeaderAuthTest.USER_ID, SignedHeaderAuthTest.PRIVATE_KEY) - .modules(ImmutableSet.<Module> of(new MockModule(), new NullLoggingModule())).buildInjector(); - - chefService = injector.getInstance(BaseChefService.class); - } - - @Test(expectedExceptions = NullPointerException.class, expectedExceptionsMessageRegExp = "bootstrapConfig must not be null") - public void testBuildBootstrapConfigurationWithNullConfig() { - chefService.buildBootstrapConfiguration(null); - } - - public void testBuildBootstrapConfigurationWithEmptyRunlist() { - BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runList(ImmutableList.<String> of()).build(); - String config = chefService.buildBootstrapConfiguration(bootstrapConfig); - assertEquals(config, "{\"run_list\":[]}"); - } - - public void testBuildBootstrapConfigurationWithRunlist() { - List<String> runlist = new RunListBuilder().addRecipe("apache2").addRole("webserver").build(); - BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runList(runlist).build(); - String config = chefService.buildBootstrapConfiguration(bootstrapConfig); - assertEquals(config, "{\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"]}"); - } - - public void testBuildBootstrapConfigurationWithRunlistAndEmptyAttributes() { - List<String> runlist = new RunListBuilder().addRecipe("apache2").addRole("webserver").build(); - BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runList(runlist).attributes(new JsonBall("{}")) - .build(); - String config = chefService.buildBootstrapConfiguration(bootstrapConfig); - assertEquals(config, "{\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"]}"); - } - - public void testBuildBootstrapConfigurationWithRunlistAndAttributes() { - List<String> runlist = new RunListBuilder().addRecipe("apache2").addRole("webserver").build(); - BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runList(runlist) - .attributes(new JsonBall("{\"tomcat6\":{\"ssl_port\":8433}}")).build(); - String config = chefService.buildBootstrapConfiguration(bootstrapConfig); - assertEquals(config, "{\"tomcat6\":{\"ssl_port\":8433},\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"]}"); - } - - public void testBuildBootstrapConfigurationWithRunlistAndAttributesAndEnvironment() { - List<String> runlist = new RunListBuilder().addRecipe("apache2").addRole("webserver").build(); - BootstrapConfig bootstrapConfig = BootstrapConfig.builder().runList(runlist) - .attributes(new JsonBall("{\"tomcat6\":{\"ssl_port\":8433}}")).environment("env").build(); - String config = chefService.buildBootstrapConfiguration(bootstrapConfig); - assertEquals(config, - "{\"tomcat6\":{\"ssl_port\":8433},\"environment\":\"env\",\"run_list\":[\"recipe[apache2]\",\"role[webserver]\"]}"); - } - -}
http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/internal/BaseStubbedOhaiLiveTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/internal/BaseStubbedOhaiLiveTest.java b/core/src/test/java/org/jclouds/chef/internal/BaseStubbedOhaiLiveTest.java deleted file mode 100644 index 8779017..0000000 --- a/core/src/test/java/org/jclouds/chef/internal/BaseStubbedOhaiLiveTest.java +++ /dev/null @@ -1,60 +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.chef.internal; - -import java.util.Map; - -import org.jclouds.apis.ApiMetadata; -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.ChefApiMetadata; -import org.jclouds.chef.config.ChefBootstrapModule; -import org.jclouds.chef.config.ChefHttpApiModule; -import org.jclouds.chef.config.ChefParserModule; -import org.jclouds.domain.JsonBall; -import org.jclouds.ohai.AutomaticSupplier; -import org.jclouds.ohai.config.ConfiguresOhai; -import org.jclouds.ohai.config.OhaiModule; -import org.testng.annotations.Test; - -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; -import com.google.inject.Module; - -@Test(groups = "live") -@Deprecated -public class BaseStubbedOhaiLiveTest extends BaseChefLiveTest<ChefApi> { - - @ConfiguresOhai - static class TestOhaiModule extends OhaiModule { - - @Override - protected Supplier<Map<String, JsonBall>> provideAutomatic(AutomaticSupplier in) { - return Suppliers.<Map<String, JsonBall>> ofInstance(ImmutableMap.of("foo", new JsonBall("bar"))); - } - } - - @Override - protected ApiMetadata createApiMetadata() { - return new ChefApiMetadata() - .toBuilder() - .defaultModules( - ImmutableSet.<Class<? extends Module>> of(ChefHttpApiModule.class, ChefParserModule.class, - ChefBootstrapModule.class, TestOhaiModule.class)).build(); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/strategy/internal/CleanupStaleNodesAndClientsImplLiveTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/strategy/internal/CleanupStaleNodesAndClientsImplLiveTest.java b/core/src/test/java/org/jclouds/chef/strategy/internal/CleanupStaleNodesAndClientsImplLiveTest.java deleted file mode 100644 index e8b249b..0000000 --- a/core/src/test/java/org/jclouds/chef/strategy/internal/CleanupStaleNodesAndClientsImplLiveTest.java +++ /dev/null @@ -1,61 +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.chef.strategy.internal; - -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; - -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.internal.BaseChefLiveTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * Tests behavior of {@code CleanupStaleNodesAndClientsImpl} strategies - */ -@Test(groups = "live", testName = "CleanupStaleNodesAndClientsImplLiveTest") -public class CleanupStaleNodesAndClientsImplLiveTest extends BaseChefLiveTest<ChefApi> { - - private CreateNodeAndPopulateAutomaticAttributesImpl creator; - private CleanupStaleNodesAndClientsImpl strategy; - - @Override - protected void initialize() { - super.initialize(); - this.creator = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class); - this.strategy = injector.getInstance(CleanupStaleNodesAndClientsImpl.class); - } - - @Test - public void testExecute() throws InterruptedException { - try { - creator.execute(prefix, ImmutableSet.<String> of()); - // http://tickets.corp.opscode.com/browse/PL-522 - // assert chef.nodeExists(prefix); - assertNotNull(api.getNode(prefix)); - strategy.execute(prefix, 10); - assertNotNull(api.getNode(prefix)); - Thread.sleep(1000); - strategy.execute(prefix, 1); - assertNull(api.getNode(prefix)); - } finally { - api.deleteNode(prefix); - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/strategy/internal/CreateNodeAndPopulateAutomaticAttributesImplLiveTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/strategy/internal/CreateNodeAndPopulateAutomaticAttributesImplLiveTest.java b/core/src/test/java/org/jclouds/chef/strategy/internal/CreateNodeAndPopulateAutomaticAttributesImplLiveTest.java deleted file mode 100644 index 60f2661..0000000 --- a/core/src/test/java/org/jclouds/chef/strategy/internal/CreateNodeAndPopulateAutomaticAttributesImplLiveTest.java +++ /dev/null @@ -1,62 +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.chef.strategy.internal; - -import static org.testng.Assert.assertEquals; - -import java.util.Set; - -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.domain.Node; -import org.jclouds.chef.internal.BaseChefLiveTest; -import org.jclouds.ohai.config.OhaiModule.CurrentUserProvider; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * Tests behavior of {@code CreateNodeAndPopulateAutomaticAttributesImpl} - * strategies - */ -@Test(groups = "live", testName = "CreateNodeAndPopulateAutomaticAttributesImplLiveTest") -public class CreateNodeAndPopulateAutomaticAttributesImplLiveTest extends BaseChefLiveTest<ChefApi> { - - private CurrentUserProvider currentUserProvider; - private CreateNodeAndPopulateAutomaticAttributesImpl strategy; - - @Override - protected void initialize() { - super.initialize(); - this.currentUserProvider = injector.getInstance(CurrentUserProvider.class); - this.strategy = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class); - } - - @Test - public void testExecute() { - Set<String> runList = ImmutableSet.of("role[" + prefix + "]"); - try { - strategy.execute(prefix, runList); - Node node = api.getNode(prefix); - assertEquals(node.getName(), prefix); - assertEquals(node.getRunList(), runList); - assertEquals(node.getAutomaticAttributes().get("current_user").toString(), currentUserProvider.get().toString()); - } finally { - api.deleteNode(prefix); - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/strategy/internal/CreateNodeAndPopulateAutomaticAttributesImplTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/strategy/internal/CreateNodeAndPopulateAutomaticAttributesImplTest.java b/core/src/test/java/org/jclouds/chef/strategy/internal/CreateNodeAndPopulateAutomaticAttributesImplTest.java deleted file mode 100644 index 3ba7110..0000000 --- a/core/src/test/java/org/jclouds/chef/strategy/internal/CreateNodeAndPopulateAutomaticAttributesImplTest.java +++ /dev/null @@ -1,61 +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.chef.strategy.internal; - -import static org.easymock.classextension.EasyMock.createMock; -import static org.easymock.classextension.EasyMock.replay; -import static org.easymock.classextension.EasyMock.verify; - -import java.util.Map; - -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.domain.Node; -import org.jclouds.domain.JsonBall; -import org.testng.annotations.Test; - -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; -import com.google.common.collect.ImmutableMap; -import com.google.common.collect.ImmutableSet; - -/** - * Tests behavior of {@code CreateNodeAndPopulateAutomaticAttributesImpl} - */ -@Test(groups = "unit", testName = "CreateNodeAndPopulateAutomaticAttributesImplTest") -public class CreateNodeAndPopulateAutomaticAttributesImplTest { - - @Test - public void testWithNoRunlist() { - ChefApi chef = createMock(ChefApi.class); - - Supplier<Map<String, JsonBall>> automaticSupplier = Suppliers.<Map<String, JsonBall>> ofInstance(ImmutableMap.<String, JsonBall> of()); - - Node nodeWithAutomatic = Node.builder().name("name").environment("_default") - .automaticAttributes(automaticSupplier.get()).build(); - - chef.createNode(nodeWithAutomatic); - - replay(chef); - - CreateNodeAndPopulateAutomaticAttributesImpl updater = new CreateNodeAndPopulateAutomaticAttributesImpl(chef, - automaticSupplier); - - updater.execute("name", ImmutableSet.<String> of()); - verify(chef); - - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/strategy/internal/DeleteAllApisAndNodesInListImplLiveTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/strategy/internal/DeleteAllApisAndNodesInListImplLiveTest.java b/core/src/test/java/org/jclouds/chef/strategy/internal/DeleteAllApisAndNodesInListImplLiveTest.java deleted file mode 100644 index 6f0e595..0000000 --- a/core/src/test/java/org/jclouds/chef/strategy/internal/DeleteAllApisAndNodesInListImplLiveTest.java +++ /dev/null @@ -1,64 +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.chef.strategy.internal; - -import static org.testng.Assert.assertNotNull; -import static org.testng.Assert.assertNull; - -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.internal.BaseChefLiveTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * Tests behavior of {@code DeleteAllApisAndNodesInListImpl} strategies - */ -@Test(groups = "live", testName = "DeleteAllApisAndNodesInListImplLiveTest") -public class DeleteAllApisAndNodesInListImplLiveTest extends BaseChefLiveTest<ChefApi> { - - private DeleteAllNodesInListImpl strategy; - private CreateNodeAndPopulateAutomaticAttributesImpl creator; - - @Override - protected void initialize() { - super.initialize(); - this.creator = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class); - this.strategy = injector.getInstance(DeleteAllNodesInListImpl.class); - } - - @Test - public void testExecute() throws InterruptedException { - try { - creator.execute(prefix, ImmutableSet.<String> of()); - creator.execute(prefix + 1, ImmutableSet.<String> of()); - - // http://tickets.corp.opscode.com/browse/PL-522 - // assert api.nodeExists(prefix); - assertNotNull(api.getNode(prefix)); - assertNotNull(api.getNode(prefix + 1)); - - strategy.execute(ImmutableSet.of(prefix, prefix + 1)); - assertNull(api.getNode(prefix)); - assertNull(api.getNode(prefix + 1)); - } finally { - api.deleteNode(prefix); - api.deleteNode(prefix + 1); - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/strategy/internal/ListCookbookVersionsInEnvironmentImplLiveTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/strategy/internal/ListCookbookVersionsInEnvironmentImplLiveTest.java b/core/src/test/java/org/jclouds/chef/strategy/internal/ListCookbookVersionsInEnvironmentImplLiveTest.java deleted file mode 100644 index 5f68fcf..0000000 --- a/core/src/test/java/org/jclouds/chef/strategy/internal/ListCookbookVersionsInEnvironmentImplLiveTest.java +++ /dev/null @@ -1,217 +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.chef.strategy.internal; - -import static com.google.common.collect.Iterables.size; -import static org.testng.Assert.assertTrue; -import static org.testng.Assert.fail; - -import java.io.File; -import java.util.List; -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -import com.google.common.util.concurrent.ListeningExecutorService; -import com.google.common.util.concurrent.MoreExecutors; -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.domain.ChecksumStatus; -import org.jclouds.chef.domain.CookbookVersion; -import org.jclouds.chef.domain.Metadata; -import org.jclouds.chef.domain.Resource; -import org.jclouds.chef.domain.Sandbox; -import org.jclouds.chef.domain.UploadSandbox; -import org.jclouds.chef.internal.BaseChefLiveTest; -import org.jclouds.io.Payloads; -import org.jclouds.io.payloads.FilePayload; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.common.hash.Hashing; -import com.google.common.io.Files; -import com.google.common.primitives.Bytes; - -/** - * Tests behavior of {@code ListCookbookVersionsInEnvironmentImpl} strategies - */ -@Test(groups = "live", testName = "ListCookbookVersionsInEnvironmentImplLiveTest") -public class ListCookbookVersionsInEnvironmentImplLiveTest extends BaseChefLiveTest<ChefApi> { - public static final String PREFIX = "jcloudstest-strategy-" + System.getProperty("user.name"); - - private ListCookbookVersionsInEnvironmentImpl strategy; - private CreateNodeAndPopulateAutomaticAttributesImpl creator; - - private ExecutorService testExecutorService; - private ListeningExecutorService testListeningExecutorService; - - @Override - protected void initialize() { - super.initialize(); - - try { - createCookbooksWithMultipleVersions(PREFIX); - createCookbooksWithMultipleVersions(PREFIX + 1); - } catch (Exception e) { - fail("Could not create cookbooks", e); - } - - this.strategy = injector.getInstance(ListCookbookVersionsInEnvironmentImpl.class); - this.testExecutorService = Executors.newFixedThreadPool(5); - this.testListeningExecutorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(5)); - } - - @AfterClass(groups = { "integration", "live" }) - @Override - protected void tearDown() { - api.deleteCookbook(PREFIX, "0.0.0"); - api.deleteCookbook(PREFIX, "1.0.0"); - api.deleteCookbook(PREFIX + 1, "0.0.0"); - api.deleteCookbook(PREFIX + 1, "1.0.0"); - - this.testExecutorService.shutdown(); - this.testListeningExecutorService.shutdown(); - - super.tearDown(); - } - - @Test - public void testExecute() { - assertTrue(size(strategy.execute("_default")) > 0, "Expected one or more elements"); - } - - @Test - public void testExecuteConcurrentlyWithExecutorService() { - assertTrue(size(strategy.execute(testExecutorService, "_default")) > 0, - "Expected one or more elements"); - } - - @Test - public void testExecuteConcurrentlyWithListeningExecutorService() { - assertTrue(size(strategy.execute(testListeningExecutorService, "_default")) > 0, - "Expected one or more elements"); - } - - @Test - public void testExecuteWithNumVersions() { - assertTrue(size(strategy.execute("_default", "2")) > 0, "Expected one or more elements"); - } - - @Test - public void testExecuteConcurrentlyWithNumVersionsAndExecutorService() { - assertTrue(size(strategy.execute(testExecutorService, "_default", "2")) > 0, - "Expected one or more elements"); - } - - @Test - public void testExecuteConcurrentlyWithNumVersionsAndListeningExecutorService() { - assertTrue(size(strategy.execute(testListeningExecutorService, "_default", "2")) > 0, - "Expected one or more elements"); - } - - @Test - public void testExecuteWithNumVersionsAll() { - assertTrue(size(strategy.execute("_default", "all")) > 0, "Expected one or more elements"); - } - - @Test - public void testExecuteConcurrentlyWithNumVersionsAllAndExecutorService() { - assertTrue(size(strategy.execute(testExecutorService, "_default", "all")) > 0, - "Expected one or more elements"); - } - - @Test - public void testExecuteConcurrentlyWithNumVersionsAllAndListeningExecutorService() { - assertTrue(size(strategy.execute(testListeningExecutorService, "_default", "all")) > 0, - "Expected one or more elements"); - } - - private FilePayload uploadContent(String fileName) throws Exception { - // Define the file you want in the cookbook - File file = new File(System.getProperty("user.dir"), fileName); - FilePayload content = Payloads.newFilePayload(file); - content.getContentMetadata().setContentType("application/x-binary"); - - // Get an md5 so that you can see if the server already has it or not - content.getContentMetadata().setContentMD5(Files.asByteSource(file).hash(Hashing.md5()).asBytes()); - - // Note that java collections cannot effectively do equals or hashcodes on - // byte arrays, so let's convert to a list of bytes. - List<Byte> md5 = Bytes.asList(content.getContentMetadata().getContentMD5()); - - // Request an upload site for this file - UploadSandbox site = api.createUploadSandboxForChecksums(ImmutableSet.of(md5)); - assertTrue(site.getChecksums().containsKey(md5), md5 + " not in " + site.getChecksums()); - - try { - // Upload the file contents, if still not uploaded - ChecksumStatus status = site.getChecksums().get(md5); - if (status.needsUpload()) { - api.uploadContent(status.getUrl(), content); - } - Sandbox sandbox = api.commitSandbox(site.getSandboxId(), true); - assertTrue(sandbox.isCompleted(), "Sandbox should be completed after uploading"); - } catch (RuntimeException e) { - api.commitSandbox(site.getSandboxId(), false); - fail("Could not upload content", e); - } - - return content; - } - - private void createCookbooksWithMultipleVersions(String cookbookName) throws Exception { - FilePayload v0content = uploadContent("pom.xml"); - FilePayload v1content = uploadContent("../README.md"); - - // Create the metadata of the cookbook - Metadata metadata = Metadata.builder() // - .name(cookbookName) // - .version("0.0.0") // - .description("Jclouds test uploaded cookbook") // - .maintainer("jclouds") // - .maintainerEmail("[email protected]") // - .license("Apache 2.0") // - .build(); - - // Create new cookbook version - CookbookVersion cookbook = CookbookVersion.builder(cookbookName, "0.0.0") // - .metadata(metadata) // - .rootFile(Resource.builder().fromPayload(v0content).build()) // - .build(); - - // upload the cookbook to the remote server - api.updateCookbook(cookbookName, "0.0.0", cookbook); - - // Create the metadata of the cookbook - metadata = Metadata.builder() // - .name(cookbookName) // - .version("1.0.0") // - .description("Jclouds test uploaded cookbook") // - .maintainer("jclouds") // - .maintainerEmail("[email protected]") // - .license("Apache 2.0") // - .build(); - - // Create a new cookbook version - cookbook = CookbookVersion.builder(cookbookName, "1.0.0") // - .metadata(metadata) // - .rootFile(Resource.builder().fromPayload(v1content).build()) // - .build(); - - // upload the cookbook to the remote server - api.updateCookbook(cookbookName, "1.0.0", cookbook); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/strategy/internal/ListNodesImplLiveTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/strategy/internal/ListNodesImplLiveTest.java b/core/src/test/java/org/jclouds/chef/strategy/internal/ListNodesImplLiveTest.java deleted file mode 100644 index 903b998..0000000 --- a/core/src/test/java/org/jclouds/chef/strategy/internal/ListNodesImplLiveTest.java +++ /dev/null @@ -1,82 +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.chef.strategy.internal; - -import static com.google.common.collect.Iterables.size; -import static org.testng.Assert.assertTrue; - -import com.google.common.util.concurrent.ListeningExecutorService; -import com.google.common.util.concurrent.MoreExecutors; -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.internal.BaseChefLiveTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -/** - * Tests behavior of {@code ListNodesImpl} strategies - */ -@Test(groups = "live", testName = "ListNodesImplLiveTest") -public class ListNodesImplLiveTest extends BaseChefLiveTest<ChefApi> { - - private ListNodesImpl strategy; - private CreateNodeAndPopulateAutomaticAttributesImpl creator; - - private ExecutorService testExecutorService; - private ListeningExecutorService testListeningExecutorService; - - @Override - protected void initialize() { - super.initialize(); - this.creator = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class); - this.strategy = injector.getInstance(ListNodesImpl.class); - creator.execute(prefix, ImmutableSet.<String> of()); - creator.execute(prefix + 1, ImmutableSet.<String> of()); - - this.testExecutorService = Executors.newFixedThreadPool(5); - this.testListeningExecutorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(5)); - } - - @AfterClass(groups = { "integration", "live" }) - @Override - protected void tearDown() { - api.deleteNode(prefix); - api.deleteNode(prefix + 1); - - this.testExecutorService.shutdown(); - this.testListeningExecutorService.shutdown(); - - super.tearDown(); - } - - @Test - public void testExecute() { - assertTrue(size(strategy.execute()) > 0, "Expected one or more elements"); - } - - public void testExecuteConcurrentlyWithExecutorService() { - assertTrue(size(strategy.execute(testExecutorService)) > 0, "Expected one or more elements"); - } - - public void testExecuteConcurrentlyWithListeningExecutorService() { - assertTrue(size(strategy.execute(testListeningExecutorService)) > 0, "Expected one or more elements"); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/strategy/internal/ListNodesInEnvironmentImplLiveTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/strategy/internal/ListNodesInEnvironmentImplLiveTest.java b/core/src/test/java/org/jclouds/chef/strategy/internal/ListNodesInEnvironmentImplLiveTest.java deleted file mode 100644 index f655d52..0000000 --- a/core/src/test/java/org/jclouds/chef/strategy/internal/ListNodesInEnvironmentImplLiveTest.java +++ /dev/null @@ -1,86 +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.chef.strategy.internal; - -import static com.google.common.collect.Iterables.size; -import static org.testng.Assert.assertTrue; - -import com.google.common.util.concurrent.ListeningExecutorService; -import com.google.common.util.concurrent.MoreExecutors; -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.internal.BaseChefLiveTest; -import org.testng.annotations.AfterClass; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -import java.util.concurrent.ExecutorService; -import java.util.concurrent.Executors; - -/** - * Tests behavior of {@code ListNodesInEnvironmentImpl} strategies - */ -@Test(groups = "live", testName = "ListNodesInEnvironmentImplLiveTest") -public class ListNodesInEnvironmentImplLiveTest extends BaseChefLiveTest<ChefApi> { - - private ListNodesInEnvironmentImpl strategy; - private CreateNodeAndPopulateAutomaticAttributesImpl creator; - - private ExecutorService testExecutorService; - private ListeningExecutorService testListeningExecutorService; - - @Override - protected void initialize() { - super.initialize(); - this.creator = injector.getInstance(CreateNodeAndPopulateAutomaticAttributesImpl.class); - this.strategy = injector.getInstance(ListNodesInEnvironmentImpl.class); - creator.execute(prefix, ImmutableSet.<String>of()); - creator.execute(prefix + 1, ImmutableSet.<String>of()); - - this.testExecutorService = Executors.newFixedThreadPool(5); - this.testListeningExecutorService = MoreExecutors.listeningDecorator(Executors.newFixedThreadPool(5)); - } - - @AfterClass(groups = { "integration", "live" }) - @Override - protected void tearDown() { - api.deleteNode(prefix); - api.deleteNode(prefix + 1); - - this.testExecutorService.shutdown(); - this.testListeningExecutorService.shutdown(); - - super.tearDown(); - } - - @Test - public void testExecute() { - assertTrue(size(strategy.execute("_default")) > 0, "Expected one or more elements"); - } - - @Test - public void testExecuteConcurrentlyWithExecutorService() { - assertTrue(size(strategy.execute(testExecutorService, "_default")) > 0, - "Expected one or more elements"); - } - - @Test - public void testExecuteConcurrentlyWithListeningExecutorService() { - assertTrue(size(strategy.execute(testListeningExecutorService, "_default")) > 0, - "Expected one or more elements"); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/strategy/internal/UpdateAutomaticAttributesOnNodeImplLiveTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/strategy/internal/UpdateAutomaticAttributesOnNodeImplLiveTest.java b/core/src/test/java/org/jclouds/chef/strategy/internal/UpdateAutomaticAttributesOnNodeImplLiveTest.java deleted file mode 100644 index a8f7438..0000000 --- a/core/src/test/java/org/jclouds/chef/strategy/internal/UpdateAutomaticAttributesOnNodeImplLiveTest.java +++ /dev/null @@ -1,61 +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.chef.strategy.internal; - -import static org.testng.Assert.assertEquals; - -import java.util.Set; - -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.domain.Node; -import org.jclouds.chef.internal.BaseChefLiveTest; -import org.jclouds.ohai.config.OhaiModule.CurrentUserProvider; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; - -/** - * Tests behavior of {@code UpdateAutomaticAttributesOnNodeImpl} strategies - */ -@Test(groups = "live", testName = "UpdateAutomaticAttributesOnNodeImplLiveTest") -public class UpdateAutomaticAttributesOnNodeImplLiveTest extends BaseChefLiveTest<ChefApi> { - - private CurrentUserProvider currentUserProvider; - private UpdateAutomaticAttributesOnNodeImpl strategy; - - @Override - protected void initialize() { - super.initialize(); - this.currentUserProvider = injector.getInstance(CurrentUserProvider.class); - this.strategy = injector.getInstance(UpdateAutomaticAttributesOnNodeImpl.class); - } - - @Test - public void testExecute() { - Set<String> runList = ImmutableSet.of("role[" + prefix + "]"); - try { - api.createNode(Node.builder().name(prefix).runList(runList).environment("_default").build()); - strategy.execute(prefix); - Node node = api.getNode(prefix); - assertEquals(node.getName(), prefix); - assertEquals(node.getRunList(), runList); - assertEquals(node.getAutomaticAttributes().get("current_user").toString(), currentUserProvider.get().toString()); - } finally { - api.deleteNode(prefix); - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/strategy/internal/UpdateAutomaticAttributesOnNodeImplTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/strategy/internal/UpdateAutomaticAttributesOnNodeImplTest.java b/core/src/test/java/org/jclouds/chef/strategy/internal/UpdateAutomaticAttributesOnNodeImplTest.java deleted file mode 100644 index 2e0d198..0000000 --- a/core/src/test/java/org/jclouds/chef/strategy/internal/UpdateAutomaticAttributesOnNodeImplTest.java +++ /dev/null @@ -1,63 +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.chef.strategy.internal; - -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 java.util.Map; - -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.domain.Node; -import org.jclouds.domain.JsonBall; -import org.testng.annotations.Test; - -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; -import com.google.common.collect.ImmutableMap; - -/** - * Tests behavior of {@code UpdateAutomaticAttributesOnNodeImpl} - */ -@Test(groups = { "unit" }) -public class UpdateAutomaticAttributesOnNodeImplTest { - - @Test - public void test() { - ChefApi chef = createMock(ChefApi.class); - - Map<String, JsonBall> automatic = ImmutableMap.<String, JsonBall> of(); - Supplier<Map<String, JsonBall>> automaticSupplier = Suppliers.<Map<String, JsonBall>> ofInstance(automatic); - - Node node = Node.builder().name("name").environment("_default").build(); - Node nodeWithAutomatic = Node.builder().name("name").environment("_default").automaticAttributes(automatic) - .build(); - - expect(chef.getNode("name")).andReturn(node); - expect(chef.updateNode(nodeWithAutomatic)).andReturn(null); - - replay(chef); - - UpdateAutomaticAttributesOnNodeImpl updater = new UpdateAutomaticAttributesOnNodeImpl(chef, automaticSupplier); - - updater.execute("name"); - verify(chef); - - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/suppliers/ChefVersionSupplierTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/suppliers/ChefVersionSupplierTest.java b/core/src/test/java/org/jclouds/chef/suppliers/ChefVersionSupplierTest.java deleted file mode 100644 index 915f5cf..0000000 --- a/core/src/test/java/org/jclouds/chef/suppliers/ChefVersionSupplierTest.java +++ /dev/null @@ -1,47 +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.chef.suppliers; - -import static org.jclouds.chef.suppliers.ChefVersionSupplier.FALLBACK_VERSION; -import static org.testng.Assert.assertEquals; - -import org.testng.annotations.Test; - -/** - * Unit tests for the {@link ChefVersionSupplier} class. - */ -@Test(groups = "unit", testName = "ChefVersionSupplierTest") -public class ChefVersionSupplierTest { - - public void testReturnsDefaultVersion() { - assertEquals(new ChefVersionSupplier("15").get(), FALLBACK_VERSION); - assertEquals(new ChefVersionSupplier("0").get(), FALLBACK_VERSION); - assertEquals(new ChefVersionSupplier("0.").get(), FALLBACK_VERSION); - } - - public void testReturnsMajorVersionIfNotZero() { - assertEquals(new ChefVersionSupplier("11.6").get().intValue(), 11); - assertEquals(new ChefVersionSupplier("11.6.0").get().intValue(), 11); - assertEquals(new ChefVersionSupplier("11.6.0.1").get().intValue(), 11); - } - - public void testReturnsMinorVersionIfMajorIsZero() { - assertEquals(new ChefVersionSupplier("0.9").get().intValue(), 9); - assertEquals(new ChefVersionSupplier("0.9.8").get().intValue(), 9); - assertEquals(new ChefVersionSupplier("0.9.8.2").get().intValue(), 9); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/test/TransientChefApiIntegrationTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/test/TransientChefApiIntegrationTest.java b/core/src/test/java/org/jclouds/chef/test/TransientChefApiIntegrationTest.java deleted file mode 100644 index ecd5d16..0000000 --- a/core/src/test/java/org/jclouds/chef/test/TransientChefApiIntegrationTest.java +++ /dev/null @@ -1,69 +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.chef.test; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertNotNull; - -import java.util.Properties; - -import org.jclouds.chef.ChefApi; -import org.jclouds.chef.domain.DatabagItem; -import org.jclouds.chef.internal.BaseChefLiveTest; -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code TransientChefApi} - */ -@Test(groups = { "integration" }) -public class TransientChefApiIntegrationTest extends BaseChefLiveTest<ChefApi> { - public static final String PREFIX = System.getProperty("user.name") + "-jcloudstest"; - private DatabagItem databagItem; - - public TransientChefApiIntegrationTest() { - provider = "transientchef"; - } - - @Override - protected Properties setupProperties() { - return new Properties(); - } - - public void testCreateDatabag() { - api.deleteDatabag(PREFIX); - api.createDatabag(PREFIX); - } - - @Test(dependsOnMethods = { "testCreateDatabag" }) - public void testCreateDatabagItem() { - Properties config = new Properties(); - config.setProperty("foo", "bar"); - databagItem = api.createDatabagItem(PREFIX, new DatabagItem("config", json.toJson(config))); - assertNotNull(databagItem); - assertEquals(databagItem.getId(), "config"); - assertEquals(config, json.fromJson(databagItem.toString(), Properties.class)); - } - - @Test(dependsOnMethods = "testCreateDatabagItem") - public void testUpdateDatabagItem() { - for (String databagItemId : api.listDatabagItems(PREFIX)) { - DatabagItem databagItem = api.getDatabagItem(PREFIX, databagItemId); - api.updateDatabagItem(PREFIX, databagItem); - } - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/test/TransientChefApiMetadataTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/test/TransientChefApiMetadataTest.java b/core/src/test/java/org/jclouds/chef/test/TransientChefApiMetadataTest.java deleted file mode 100644 index eac33f3..0000000 --- a/core/src/test/java/org/jclouds/chef/test/TransientChefApiMetadataTest.java +++ /dev/null @@ -1,33 +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.chef.test; - -import org.jclouds.View; -import org.jclouds.rest.internal.BaseHttpApiMetadataTest; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableSet; -import com.google.common.reflect.TypeToken; - -@Test(groups = "unit", testName = "TransientChefApiMetadataTest") -public class TransientChefApiMetadataTest extends BaseHttpApiMetadataTest { - - // no config management abstraction, yet - public TransientChefApiMetadataTest() { - super(new TransientChefApiMetadata(), ImmutableSet.<TypeToken<? extends View>> of()); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/util/ChefUtilsTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/util/ChefUtilsTest.java b/core/src/test/java/org/jclouds/chef/util/ChefUtilsTest.java deleted file mode 100644 index 40645e7..0000000 --- a/core/src/test/java/org/jclouds/chef/util/ChefUtilsTest.java +++ /dev/null @@ -1,57 +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.chef.util; - -import static org.testng.Assert.assertEquals; - -import java.util.Date; -import java.util.NoSuchElementException; - -import org.jclouds.domain.JsonBall; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableList; - -/** - * Tests behavior of {@code ChefUtils} - */ -@Test(groups = { "unit" }, sequential = true) -public class ChefUtilsTest { - public static long millis = 1280251180727l; - public static String millisString = "1280251180727"; - public static Date now = new Date(1280251180727l); - - public void testToOhaiTime() { - assertEquals(ChefUtils.toOhaiTime(millis).toString(), millisString); - } - - public void testFromOhaiTime() { - assertEquals(ChefUtils.fromOhaiTime(new JsonBall(millisString)), now); - - } - - @Test(expectedExceptions = NoSuchElementException.class) - public void testFindRoleInRunListThrowsNoSuchElementOnRecipe() { - ChefUtils.findRoleInRunList(ImmutableList.of("recipe[java]")); - } - - public void testFindRoleInRunList() { - assertEquals(ChefUtils.findRoleInRunList(ImmutableList.of("role[prod]")), "prod"); - - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/chef/util/RunListBuilderTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/chef/util/RunListBuilderTest.java b/core/src/test/java/org/jclouds/chef/util/RunListBuilderTest.java deleted file mode 100644 index 674be80..0000000 --- a/core/src/test/java/org/jclouds/chef/util/RunListBuilderTest.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.chef.util; - -import static org.testng.Assert.assertEquals; - -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableList; - -/** - * Tests possible uses of RunListBuilder - */ -public class RunListBuilderTest { - - @Test - public void testRecipeAndRole() { - RunListBuilder options = new RunListBuilder(); - options.addRecipe("recipe").addRole("role"); - assertEquals(options.build(), ImmutableList.of("recipe[recipe]", "role[role]")); - } - - @Test - public void testRecipe() { - RunListBuilder options = new RunListBuilder(); - options.addRecipe("test"); - assertEquals(options.build(), ImmutableList.of("recipe[test]")); - } - - @Test - public void testRecipes() { - RunListBuilder options = new RunListBuilder(); - options.addRecipes("test", "test2"); - assertEquals(options.build(), ImmutableList.of("recipe[test]", "recipe[test2]")); - } - - @Test - public void testRole() { - RunListBuilder options = new RunListBuilder(); - options.addRole("test"); - assertEquals(options.build(), ImmutableList.of("role[test]")); - } - - @Test - public void testRoles() { - RunListBuilder options = new RunListBuilder(); - options.addRoles("test", "test2"); - assertEquals(options.build(), ImmutableList.of("role[test]", "role[test2]")); - } - - @Test - public void testNoneRecipe() { - RunListBuilder options = new RunListBuilder(); - assertEquals(options.build(), ImmutableList.<String> of()); - } - -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/ohai/config/JMXTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/ohai/config/JMXTest.java b/core/src/test/java/org/jclouds/ohai/config/JMXTest.java deleted file mode 100644 index bcda2e9..0000000 --- a/core/src/test/java/org/jclouds/ohai/config/JMXTest.java +++ /dev/null @@ -1,82 +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.ohai.config; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; -import static org.testng.Assert.assertEquals; - -import java.lang.management.RuntimeMXBean; -import java.util.Map; - -import javax.inject.Inject; - -import org.jclouds.chef.ChefApiMetadata; -import org.jclouds.chef.config.ChefParserModule; -import org.jclouds.domain.JsonBall; -import org.jclouds.json.Json; -import org.jclouds.json.config.GsonModule; -import org.jclouds.ohai.Automatic; -import org.jclouds.rest.annotations.ApiVersion; -import org.testng.annotations.Test; - -import com.google.common.base.Supplier; -import com.google.inject.AbstractModule; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * Tests behavior of {@code JMX} - */ -@Test(groups = { "unit" }) -public class JMXTest { - - @Test - public void test() { - - final RuntimeMXBean runtime = createMock(RuntimeMXBean.class); - - expect(runtime.getUptime()).andReturn(69876000l); - - replay(runtime); - - Injector injector = Guice.createInjector(new AbstractModule() { - @Override - protected void configure() { - bind(String.class).annotatedWith(ApiVersion.class).toInstance(ChefApiMetadata.DEFAULT_API_VERSION); - } - }, new ChefParserModule(), new GsonModule(), new JMXOhaiModule() { - @Override - protected RuntimeMXBean provideRuntimeMXBean() { - return runtime; - } - }); - Json json = injector.getInstance(Json.class); - Ohai ohai = injector.getInstance(Ohai.class); - assertEquals(json.toJson(ohai.ohai.get().get("uptime_seconds")), "69876"); - } - - static class Ohai { - private Supplier<Map<String, JsonBall>> ohai; - - @Inject - public Ohai(@Automatic Supplier<Map<String, JsonBall>> ohai) { - this.ohai = ohai; - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/ohai/config/OhaiModuleTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/ohai/config/OhaiModuleTest.java b/core/src/test/java/org/jclouds/ohai/config/OhaiModuleTest.java deleted file mode 100644 index ecc4562..0000000 --- a/core/src/test/java/org/jclouds/ohai/config/OhaiModuleTest.java +++ /dev/null @@ -1,147 +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.ohai.config; - -import static org.jclouds.chef.util.ChefUtils.ohaiAutomaticAttributeBinder; -import static org.testng.Assert.assertEquals; - -import java.net.SocketException; -import java.util.Map; -import java.util.Properties; - -import javax.inject.Inject; - -import org.jclouds.chef.ChefApiMetadata; -import org.jclouds.chef.config.ChefParserModule; -import org.jclouds.domain.JsonBall; -import org.jclouds.json.Json; -import org.jclouds.json.config.GsonModule; -import org.jclouds.ohai.Automatic; -import org.jclouds.rest.annotations.ApiVersion; -import org.testng.annotations.Test; - -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; -import com.google.inject.AbstractModule; -import com.google.inject.Guice; -import com.google.inject.Injector; -import com.google.inject.TypeLiteral; -import com.google.inject.multibindings.MapBinder; -import com.google.inject.util.Providers; - -/** - * Tests behavior of {@code OhaiModule} - */ -@Test(groups = { "unit" }) -public class OhaiModuleTest { - - @Test - public void test() throws SocketException { - - final Properties sysProperties = new Properties(); - - sysProperties.setProperty("os.name", "Mac OS X"); - sysProperties.setProperty("os.version", "10.3.0"); - sysProperties.setProperty("user.name", "user"); - - Injector injector = Guice.createInjector(new AbstractModule() { - @Override - protected void configure() { - bind(String.class).annotatedWith(ApiVersion.class).toInstance(ChefApiMetadata.DEFAULT_API_VERSION); - } - }, new ChefParserModule(), new GsonModule(), new OhaiModule() { - @Override - protected Long millis() { - return 127999291932529l; - } - - @Override - protected Properties systemProperties() { - return sysProperties; - } - - }); - Ohai ohai = injector.getInstance(Ohai.class); - Json json = injector.getInstance(Json.class); - - assertEquals( - json.toJson(ohai.ohai.get(), new TypeLiteral<Map<String, JsonBall>>() { - }.getType()), - "{\"ohai_time\":127999291932529,\"platform\":\"macosx\",\"platform_version\":\"10.3.0\",\"current_user\":\"user\",\"jvm\":{\"system\":{\"user.name\":\"user\",\"os.version\":\"10.3.0\",\"os.name\":\"Mac OS X\"}}}"); - } - - public void test2modules() throws SocketException { - - final Properties sysProperties = new Properties(); - - sysProperties.setProperty("os.name", "Mac OS X"); - sysProperties.setProperty("os.version", "10.3.0"); - sysProperties.setProperty("user.name", "user"); - - Injector injector = Guice.createInjector(new AbstractModule() { - @Override - protected void configure() { - bind(String.class).annotatedWith(ApiVersion.class).toInstance(ChefApiMetadata.DEFAULT_API_VERSION); - } - }, new ChefParserModule(), new GsonModule(), new OhaiModule() { - @Override - protected Long millis() { - return 1279992919l; - } - - @Override - protected Properties systemProperties() { - return sysProperties; - } - - }, new AbstractModule() { - - @Override - protected void configure() { - MapBinder<String, Supplier<JsonBall>> mapbinder = ohaiAutomaticAttributeBinder(binder()); - mapbinder.addBinding("test").toProvider( - Providers.of(Suppliers.ofInstance(new JsonBall("{\"prop1\":\"test1\"}")))); - } - - }, new AbstractModule() { - - @Override - protected void configure() { - MapBinder<String, Supplier<JsonBall>> mapbinder = ohaiAutomaticAttributeBinder(binder()); - mapbinder.addBinding("test").toProvider( - Providers.of(Suppliers.ofInstance(new JsonBall("{\"prop2\":\"test2\"}")))); - } - - }); - Ohai ohai = injector.getInstance(Ohai.class); - Json json = injector.getInstance(Json.class); - - assertEquals( - json.toJson(ohai.ohai.get(), new TypeLiteral<Map<String, JsonBall>>() { - }.getType()), - "{\"ohai_time\":1279992919,\"platform\":\"macosx\",\"platform_version\":\"10.3.0\",\"current_user\":\"user\",\"test\":{\"prop2\":\"test2\",\"prop1\":\"test1\"},\"jvm\":{\"system\":{\"user.name\":\"user\",\"os.version\":\"10.3.0\",\"os.name\":\"Mac OS X\"}}}"); - } - - static class Ohai { - private Supplier<Map<String, JsonBall>> ohai; - - @Inject - public Ohai(@Automatic Supplier<Map<String, JsonBall>> ohai) { - this.ohai = ohai; - } - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/ohai/functions/ByteArrayToMacAddressTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/ohai/functions/ByteArrayToMacAddressTest.java b/core/src/test/java/org/jclouds/ohai/functions/ByteArrayToMacAddressTest.java deleted file mode 100644 index f736dad..0000000 --- a/core/src/test/java/org/jclouds/ohai/functions/ByteArrayToMacAddressTest.java +++ /dev/null @@ -1,33 +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.ohai.functions; - -import static com.google.common.io.BaseEncoding.base16; -import static org.testng.Assert.assertEquals; - -import org.testng.annotations.Test; - -/** - * Tests behavior of {@code ByteArrayToMacAddress} - */ -@Test(groups = { "unit" }, sequential = true) -public class ByteArrayToMacAddressTest { - - public void test() { - assertEquals(new ByteArrayToMacAddress().apply(base16().lowerCase().decode("0026bb09e6c4")), "00:26:bb:09:e6:c4"); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/java/org/jclouds/ohai/functions/NestSlashKeysTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/jclouds/ohai/functions/NestSlashKeysTest.java b/core/src/test/java/org/jclouds/ohai/functions/NestSlashKeysTest.java deleted file mode 100644 index 594ab58..0000000 --- a/core/src/test/java/org/jclouds/ohai/functions/NestSlashKeysTest.java +++ /dev/null @@ -1,117 +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.ohai.functions; - -import static org.testng.Assert.assertEquals; - -import java.io.IOException; - -import org.jclouds.chef.ChefApiMetadata; -import org.jclouds.chef.config.ChefParserModule; -import org.jclouds.domain.JsonBall; -import org.jclouds.json.Json; -import org.jclouds.json.config.GsonModule; -import org.jclouds.rest.annotations.ApiVersion; -import org.testng.annotations.BeforeTest; -import org.testng.annotations.Test; - -import com.google.common.base.Supplier; -import com.google.common.base.Suppliers; -import com.google.common.collect.ImmutableMultimap; -import com.google.inject.AbstractModule; -import com.google.inject.Guice; -import com.google.inject.Injector; - -/** - * Tests behavior of {@code NestSlashKeys} - */ -@Test(groups = { "unit" }, sequential = true) -public class NestSlashKeysTest { - - private NestSlashKeys converter; - private Json json; - - @BeforeTest - protected void setUpInjector() throws IOException { - Injector injector = Guice.createInjector(new AbstractModule() { - @Override - protected void configure() { - bind(String.class).annotatedWith(ApiVersion.class).toInstance(ChefApiMetadata.DEFAULT_API_VERSION); - } - }, new ChefParserModule(), new GsonModule()); - converter = injector.getInstance(NestSlashKeys.class); - json = injector.getInstance(Json.class); - } - - @Test - public void testBase() { - assertEquals( - json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java", - Suppliers.ofInstance(new JsonBall("java"))))), "{\"java\":\"java\"}"); - } - - @Test(expectedExceptions = IllegalArgumentException.class) - public void testIllegal() { - json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java", - Suppliers.ofInstance(new JsonBall("java")), "java/system", Suppliers.ofInstance(new JsonBall("system"))))); - } - - @Test - public void testOne() { - assertEquals( - json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java", - Suppliers.ofInstance(new JsonBall("{\"time\":\"time\"}")), "java/system", - Suppliers.ofInstance(new JsonBall("system"))))), - "{\"java\":{\"system\":\"system\",\"time\":\"time\"}}"); - } - - @Test - public void testOneDuplicate() { - assertEquals( - json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java", - Suppliers.ofInstance(new JsonBall("{\"time\":\"time\"}")), "java", - Suppliers.ofInstance(new JsonBall("{\"system\":\"system\"}"))))), - "{\"java\":{\"system\":\"system\",\"time\":\"time\"}}"); - } - - @Test - public void testMerge() { - assertEquals( - json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java", - Suppliers.ofInstance(new JsonBall("{\"time\":{\"1\":\"hello\"}}")), "java/time", - Suppliers.ofInstance(new JsonBall("{\"2\":\"goodbye\"}"))))), - "{\"java\":{\"time\":{\"2\":\"goodbye\",\"1\":\"hello\"}}}"); - } - - @Test - public void testMergeNestedTwice() { - assertEquals( - json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java", - Suppliers.ofInstance(new JsonBall("{\"time\":{\"1\":\"hello\"}}")), "java", - Suppliers.ofInstance(new JsonBall("{\"time\":{\"2\":\"goodbye\"}}"))))), - "{\"java\":{\"time\":{\"2\":\"goodbye\",\"1\":\"hello\"}}}"); - } - - @Test - public void testReplaceList() { - assertEquals( - json.toJson(converter.apply(ImmutableMultimap.<String, Supplier<JsonBall>> of("java", - Suppliers.ofInstance(new JsonBall("{\"time\":{\"1\":[\"hello\"]}}")), "java/time", - Suppliers.ofInstance(new JsonBall("{\"1\":[\"goodbye\"]}"))))), - "{\"java\":{\"time\":{\"1\":[\"goodbye\"]}}}"); - } -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/resources/apache-chef-demo-cookbook.json ---------------------------------------------------------------------- diff --git a/core/src/test/resources/apache-chef-demo-cookbook.json b/core/src/test/resources/apache-chef-demo-cookbook.json deleted file mode 100644 index 228a3c0..0000000 --- a/core/src/test/resources/apache-chef-demo-cookbook.json +++ /dev/null @@ -1,46 +0,0 @@ -{ - "definitions": [], - "name": "apache-chef-demo-0.0.0", - "attributes": [], - "files": [], - "json_class": "Chef::CookbookVersion", - "providers": [], - "metadata": { - "dependencies": {}, - "name": "apache-chef-demo", - "maintainer_email": "[email protected]", - "attributes": {}, - "license": "Apache v2.0", - "maintainer": "Your Name", - "suggestions": {}, - "platforms": {}, - "long_description": "", - "recommendations": {}, - "version": "0.0.0", - "groupings": {}, - "recipes": {}, - "conflicting": {}, - "description": "A fabulous new cookbook", - "replacing": {}, - "providing": {} - }, "libraries": [], - "resources": [], - "templates": [], - "cookbook_name": "apache-chef-demo", - "version": "0.0.0", - "recipes": [], - "root_files": [{ - "name": "README", - "url": "https://s3.amazonaws.com/opscode-platform-production-data/organization-486ca3ac66264fea926aa0b4ff74341c/checksum-11637f98942eafbf49c71b7f2f048b78?AWSAccessKeyId=AKIAJOZTD2N26S7W6APA&Expires=1277766181&Signature=zgpNl6wSxjTNovqZu2nJq0JztU8%3D", - "checksum": "11637f98942eafbf49c71b7f2f048b78", - "path": "README", - "specificity": "default" - }, { - "name": "Rakefile", - "url": "https://s3.amazonaws.com/opscode-platform-production-data/organization-486ca3ac66264fea926aa0b4ff74341c/checksum-ebcf925a1651b4e04b9cd8aac2bc54eb?AWSAccessKeyId=AKIAJOZTD2N26S7W6APA&Expires=1277766181&Signature=EFzzDSKKytTl7b%2FxrCeNLh05zj4%3D", - "checksum": "ebcf925a1651b4e04b9cd8aac2bc54eb", - "path": "Rakefile", - "specificity": "default" - }], - "chef_type": "cookbook_version" -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/resources/bootstrap-env.sh ---------------------------------------------------------------------- diff --git a/core/src/test/resources/bootstrap-env.sh b/core/src/test/resources/bootstrap-env.sh deleted file mode 100755 index 315e248..0000000 --- a/core/src/test/resources/bootstrap-env.sh +++ /dev/null @@ -1,56 +0,0 @@ -mkdir -p /etc/chef -cat >> /etc/chef/client.rb <<-'END_OF_JCLOUDS_FILE' - require 'rubygems' - require 'ohai' - o = Ohai::System.new - o.all_plugins - node_name "foo-" + o[:ipaddress] - log_level :info - log_location STDOUT - validation_client_name "chef-validator" - chef_server_url "http://localhost:4000" -END_OF_JCLOUDS_FILE -cat >> /etc/chef/validation.pem <<-'END_OF_JCLOUDS_FILE' - -----BEGIN PRIVATE KEY----- - LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVB - eWIyWkpKcUdtMEtLUis4bmZRSk5zU2QrRjl0WE5NVjdDZk9jVzZqc3FzOEVaZ2lW - ClIwOWhEMUlZT2o0WXFNMHFKT05sZ3lnNHhSV2V3ZFNHN1FUUGoxbEpwVkFpZGE5 - c1h5MitrenlhZ1pBMUFtME8KWmNicWI1aG9lSURnY1grZURhNzlzMHUwRG9tamNm - TzlFS2h2SExCeit6TSszUXFQUmtQVjhuWVRiZnMrSGpWegp6T1U2RDFCMFhSMytJ - UFpabDJBbldzMmQwcWhuU3RIY0RVdm5SVlEwUDQ4Mll3TjlWZ2NlT1p0cFB6MERD - S0VKCjVUeDVTVHViOGswL3p0L1ZBTUhRYWZMU3VRTUxkMnM0Wkx1T1pwdE4vL3VB - c1RteGlyZXFkMzd6KzhaVGRCYkoKOExFcEoraUNYdVNmbTVhVWg3aXc2b3h2VG9Z - MkFMNTMraksyVVFJREFRQUJBb0lCQVFEQTg4QjNpL3hXbjB2WApCVnhGYW1DWW9l - Y3VOakd3WFhrU3laZXc2MTZBK0VPQ3U0N2JoNGFUdXJkRmJZTDBZRmFBdGFXdnps - YU4yZUhnCkRiK0hEdVRlZkUyOStXa2NHazZTc2hQbWl6NVQwWE9DQUlDV3c2d1NW - RGtIbUd3UzRqWnZiQUZtN1c4bndHazkKWWh4Z3hGaVJuZ3N3SlpGb3BPTG9GNVdY - czJ0ZDhndUlZTnNsTXBvN3R1NTBpRm5CSHdLTzJac1BBazh0OW5uUwp4bERhdkty - dXltRW1xSENyMytkdGlvNWVhZW5KY3AzZmpvWEJRT0tVazNpcElJMjlYUkI4TnFl - Q1ZWLzdLeHdxCmNrcU9CRWJSd0JjbGNreUliRCtSaUFnS3ZPZWxPUmpFaUU5UjQy - dnVxdnhSQTZrOWtkOW83dXRsWDBBVXRwRW4KM2daYzZMZXBBb0dCQVA5YWVsNVk3 - NStzSzJKSlVOT09oTzhhZTQ1Y2RzaWxwMnlJMFgrVUJhU3VRczIrZHlQcAprcEVI - QXhkNHBtbVN2bi84YzlUbEVaaHIrcVliQUJYVlBsRG5jeHBJdXcyQWpiazdzL1M0 - WGFTS3NScXBYTDU3CnpqL1FPcUxrUms4K09WVjlxNmxNZVFOcUx0RWoxdTZKUHZp - WDcwUm8rRlF0UnR0Tk9ZYmZkUC9mQW9HQkFNcEEKWGpSNXdvVjVzVWIrUkVnOXZF - dVlvOFJTeU9hcnhxS0ZDSVhWVU5zTE94KzIyK0FLNCtDUXBidWVXTjdqb3RybApZ - RDZ1VDZzdldpM0FBQzdraVkwVUkvZmpWUFJDVWk4dFZvUVVFMFRhVTVWTElUYVlP - QitXL2JCYURFNE05NTYwCjFOdURXTzkwYmFBNWRmVTQ0aXV6dmEwMnJHSlhLOStu - UzNvOG5rL1BBb0dCQUxPTDZkam5EZTRtd0FhRzZKY28KY2Q0eHI4amt5UHpDUlp1 - eUJDU0Jid3BoSVVYTGM3aERwclBreTA2NG5jSkQxVURtd0lka1hkL2ZwTWtnMlFt - QQovQ1VrNkxFRmpNaXNxSG9qT2FDTDlnUVpKUGhMTjVRVU4yeDFQSldHanMxdlFo - OFRreDBpVVVDT2E4YlFQWE5SCiszNE9Uc1c2VFVuYTRDU1pBeWNMZmhmZkFvR0JB - SWdnVnNlZkJDdnVRa0YwTmVVaG1EQ1JaZmhuZDh5NTVSSFIKMUhDdnFLSWxwdity - aGNYL3pteUJMdXRlb3BZeVJKUnNPaUUyRlcwMGk4K3JJUFJ1NFozUTVueWJ4N3cz - UHpWOQpvSE41UjViYUU5T3lJNEtwWld6dHBZWWl0WkY2N05jbkF2VlVMSEhPdlZK - UUduS1lmTEhKWW1ySkY3R0Exb2pNCkF1TWRGYmpGQW9HQVB4VWh4d0Z5OGdhcUJh - aEtVRVpuNEY4MUhGUDVpaEdoa1Q0UUw2QUZQTzJlK0poSUdqdVIKMjcrODVoY0Zx - UStISFZ0RnNtODFiL2ErUjdQNFV1Q1JnYzhlQ2p4UU1vSjFYbDRuN1ZialBiSE1u - SU4wUnl2ZApPNFpwV0RXWW5DTzAyMUpUT1VVT0o0Si95MDQxNkJ2a3cwejU5eTdz - Tlg3d0RCQkhIYksvWENjPQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo= - -----END PRIVATE KEY----- - -END_OF_JCLOUDS_FILE -cat >> /etc/chef/first-boot.json <<-'END_OF_JCLOUDS_FILE' - {"tomcat6":{"ssl_port":8433},"environment":"env","run_list":["recipe[apache2]","role[webserver]"]} -END_OF_JCLOUDS_FILE -chef-client -j /etc/chef/first-boot.json -E "env" http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/resources/bootstrap.sh ---------------------------------------------------------------------- diff --git a/core/src/test/resources/bootstrap.sh b/core/src/test/resources/bootstrap.sh deleted file mode 100755 index 0eb402e..0000000 --- a/core/src/test/resources/bootstrap.sh +++ /dev/null @@ -1,56 +0,0 @@ -mkdir -p /etc/chef -cat >> /etc/chef/client.rb <<-'END_OF_JCLOUDS_FILE' - require 'rubygems' - require 'ohai' - o = Ohai::System.new - o.all_plugins - node_name "foo-" + o[:ipaddress] - log_level :info - log_location STDOUT - validation_client_name "chef-validator" - chef_server_url "http://localhost:4000" -END_OF_JCLOUDS_FILE -cat >> /etc/chef/validation.pem <<-'END_OF_JCLOUDS_FILE' - -----BEGIN PRIVATE KEY----- - LS0tLS1CRUdJTiBSU0EgUFJJVkFURSBLRVktLS0tLQpNSUlFcFFJQkFBS0NBUUVB - eWIyWkpKcUdtMEtLUis4bmZRSk5zU2QrRjl0WE5NVjdDZk9jVzZqc3FzOEVaZ2lW - ClIwOWhEMUlZT2o0WXFNMHFKT05sZ3lnNHhSV2V3ZFNHN1FUUGoxbEpwVkFpZGE5 - c1h5MitrenlhZ1pBMUFtME8KWmNicWI1aG9lSURnY1grZURhNzlzMHUwRG9tamNm - TzlFS2h2SExCeit6TSszUXFQUmtQVjhuWVRiZnMrSGpWegp6T1U2RDFCMFhSMytJ - UFpabDJBbldzMmQwcWhuU3RIY0RVdm5SVlEwUDQ4Mll3TjlWZ2NlT1p0cFB6MERD - S0VKCjVUeDVTVHViOGswL3p0L1ZBTUhRYWZMU3VRTUxkMnM0Wkx1T1pwdE4vL3VB - c1RteGlyZXFkMzd6KzhaVGRCYkoKOExFcEoraUNYdVNmbTVhVWg3aXc2b3h2VG9Z - MkFMNTMraksyVVFJREFRQUJBb0lCQVFEQTg4QjNpL3hXbjB2WApCVnhGYW1DWW9l - Y3VOakd3WFhrU3laZXc2MTZBK0VPQ3U0N2JoNGFUdXJkRmJZTDBZRmFBdGFXdnps - YU4yZUhnCkRiK0hEdVRlZkUyOStXa2NHazZTc2hQbWl6NVQwWE9DQUlDV3c2d1NW - RGtIbUd3UzRqWnZiQUZtN1c4bndHazkKWWh4Z3hGaVJuZ3N3SlpGb3BPTG9GNVdY - czJ0ZDhndUlZTnNsTXBvN3R1NTBpRm5CSHdLTzJac1BBazh0OW5uUwp4bERhdkty - dXltRW1xSENyMytkdGlvNWVhZW5KY3AzZmpvWEJRT0tVazNpcElJMjlYUkI4TnFl - Q1ZWLzdLeHdxCmNrcU9CRWJSd0JjbGNreUliRCtSaUFnS3ZPZWxPUmpFaUU5UjQy - dnVxdnhSQTZrOWtkOW83dXRsWDBBVXRwRW4KM2daYzZMZXBBb0dCQVA5YWVsNVk3 - NStzSzJKSlVOT09oTzhhZTQ1Y2RzaWxwMnlJMFgrVUJhU3VRczIrZHlQcAprcEVI - QXhkNHBtbVN2bi84YzlUbEVaaHIrcVliQUJYVlBsRG5jeHBJdXcyQWpiazdzL1M0 - WGFTS3NScXBYTDU3CnpqL1FPcUxrUms4K09WVjlxNmxNZVFOcUx0RWoxdTZKUHZp - WDcwUm8rRlF0UnR0Tk9ZYmZkUC9mQW9HQkFNcEEKWGpSNXdvVjVzVWIrUkVnOXZF - dVlvOFJTeU9hcnhxS0ZDSVhWVU5zTE94KzIyK0FLNCtDUXBidWVXTjdqb3RybApZ - RDZ1VDZzdldpM0FBQzdraVkwVUkvZmpWUFJDVWk4dFZvUVVFMFRhVTVWTElUYVlP - QitXL2JCYURFNE05NTYwCjFOdURXTzkwYmFBNWRmVTQ0aXV6dmEwMnJHSlhLOStu - UzNvOG5rL1BBb0dCQUxPTDZkam5EZTRtd0FhRzZKY28KY2Q0eHI4amt5UHpDUlp1 - eUJDU0Jid3BoSVVYTGM3aERwclBreTA2NG5jSkQxVURtd0lka1hkL2ZwTWtnMlFt - QQovQ1VrNkxFRmpNaXNxSG9qT2FDTDlnUVpKUGhMTjVRVU4yeDFQSldHanMxdlFo - OFRreDBpVVVDT2E4YlFQWE5SCiszNE9Uc1c2VFVuYTRDU1pBeWNMZmhmZkFvR0JB - SWdnVnNlZkJDdnVRa0YwTmVVaG1EQ1JaZmhuZDh5NTVSSFIKMUhDdnFLSWxwdity - aGNYL3pteUJMdXRlb3BZeVJKUnNPaUUyRlcwMGk4K3JJUFJ1NFozUTVueWJ4N3cz - UHpWOQpvSE41UjViYUU5T3lJNEtwWld6dHBZWWl0WkY2N05jbkF2VlVMSEhPdlZK - UUduS1lmTEhKWW1ySkY3R0Exb2pNCkF1TWRGYmpGQW9HQVB4VWh4d0Z5OGdhcUJh - aEtVRVpuNEY4MUhGUDVpaEdoa1Q0UUw2QUZQTzJlK0poSUdqdVIKMjcrODVoY0Zx - UStISFZ0RnNtODFiL2ErUjdQNFV1Q1JnYzhlQ2p4UU1vSjFYbDRuN1ZialBiSE1u - SU4wUnl2ZApPNFpwV0RXWW5DTzAyMUpUT1VVT0o0Si95MDQxNkJ2a3cwejU5eTdz - Tlg3d0RCQkhIYksvWENjPQotLS0tLUVORCBSU0EgUFJJVkFURSBLRVktLS0tLQo= - -----END PRIVATE KEY----- - -END_OF_JCLOUDS_FILE -cat >> /etc/chef/first-boot.json <<-'END_OF_JCLOUDS_FILE' - {"tomcat6":{"ssl_port":8433},"run_list":["recipe[apache2]","role[webserver]"]} -END_OF_JCLOUDS_FILE -chef-client -j /etc/chef/first-boot.json http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/resources/brew-cookbook.json ---------------------------------------------------------------------- diff --git a/core/src/test/resources/brew-cookbook.json b/core/src/test/resources/brew-cookbook.json deleted file mode 100644 index dcf7aca..0000000 --- a/core/src/test/resources/brew-cookbook.json +++ /dev/null @@ -1,48 +0,0 @@ -{ "attributes" : [ ], - "chef_type" : "cookbook_version", - "cookbook_name" : "brew", - "definitions" : [ ], - "files" : [ ], - "json_class" : "Chef::CookbookVersion", - "libraries" : [ ], - "metadata" : { "attributes" : { }, - "conflicting" : { }, - "dependencies" : { }, - "description" : "A fabulous new cookbook", - "groupings" : { }, - "license" : "Apache v2.0", - "long_description" : "", - "maintainer" : "Your Name", - "maintainer_email" : "[email protected]", - "name" : "brew", - "platforms" : { }, - "providing" : { "brew" : "0.0.0" }, - "recipes" : { "brew" : "" }, - "recommendations" : { }, - "replacing" : { }, - "suggestions" : { }, - "version" : "0.0.0" - }, - "name" : "brew-0.0.0", - "providers" : [ { "checksum" : "0c5ecd7788cf4f6c7de2a57193897a6c", - "name" : "brew.rb", - "path" : "providers/brew.rb", - "specificity" : "default", - "url" : "https://s3.amazonaws.com/opscode-platform-production-data/organization-486ca3ac66264fea926aa0b4ff74341c/checksum-0c5ecd7788cf4f6c7de2a57193897a6c?AWSAccessKeyId=AKIAJOZTD2N26S7W6APA&Expires=1277774465&Signature=brTA3YkBF7iDnjPGCCHxgm7AHko%3D" - } ], - "recipes" : [ { "checksum" : "1dda05ed139664f1f89b9dec482b77c0", - "name" : "default.rb", - "path" : "recipes/default.rb", - "specificity" : "default", - "url" : "https://s3.amazonaws.com/opscode-platform-production-data/organization-486ca3ac66264fea926aa0b4ff74341c/checksum-1dda05ed139664f1f89b9dec482b77c0?AWSAccessKeyId=AKIAJOZTD2N26S7W6APA&Expires=1277774465&Signature=dOzPk64at92zOfZlxt1suDpGuPs%3D" - } ], - "resources" : [ { "checksum" : "0189e76ccc476701d6b374e5a1a27347", - "name" : "brew.rb", - "path" : "resources/brew.rb", - "specificity" : "default", - "url" : "https://s3.amazonaws.com/opscode-platform-production-data/organization-486ca3ac66264fea926aa0b4ff74341c/checksum-0189e76ccc476701d6b374e5a1a27347?AWSAccessKeyId=AKIAJOZTD2N26S7W6APA&Expires=1277774465&Signature=ufrI1k6pKJ1%2FBRMAaIGr6icJlpc%3D" - } ], - "root_files" : [ ], - "templates" : [ ], - "version" : "0.0.0" -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/resources/client.json ---------------------------------------------------------------------- diff --git a/core/src/test/resources/client.json b/core/src/test/resources/client.json deleted file mode 100644 index eef7c71..0000000 --- a/core/src/test/resources/client.json +++ /dev/null @@ -1,8 +0,0 @@ -{ "certificate" : "-----BEGIN CERTIFICATE-----\nMIIClzCCAgCgAwIBAgIBATANBgkqhkiG9w0BAQUFADCBnjELMAkGA1UEBhMCVVMx\nEzARBgNVBAgMCldhc2hpbmd0b24xEDAOBgNVBAcMB1NlYXR0bGUxFjAUBgNVBAoM\nDU9wc2NvZGUsIEluYy4xHDAaBgNVBAsME0NlcnRpZmljYXRlIFNlcnZpY2UxMjAw\nBgNVBAMMKW9wc2NvZGUuY29tL2VtYWlsQWRkcmVzcz1hdXRoQG9wc2NvZGUuY29t\nMB4XDTEwMDczMDIwNDEzMFoXDTIwMDcyNzIwNDEzMFowADCCASIwDQYJKoZIhvcN\nAQEBBQADggEPADCCAQoCggEBAMm9mSSahptCikfvJ30CTbEnfhfbVzTFewnznFuo\n7KrPBGYIlUdPYQ9SGDo+GKjNKiTjZYMoOMUVnsHUhu0Ez49ZSaVQInWvbF8tvpM8\nmoGQNQJtDmXG6m+YaHiA4HF/ng2u/bNLtA6Jo3HzvRCobxywc/szPt0Kj0ZD1fJ2\nE237Ph41c8zlOg9QdF0d/iD2WZdgJ1rNndKoZ0rR3A1L50VUND+PNmMDfVYHHjmb\naT89AwihCeU8eUk7m/JNP87f1QDB0Gny0rkDC3drOGS7jmabTf/7gLE5sYq3qnd+\n8/vGU3QWyfCxKSfogl7kn5uWlIe4sOqMb06GNgC+d/oytlECAwEAATANBgkqhkiG\n9w0BAQUFAAOBgQBftzSZxstWw60GqRTDNN/F2GnrdtnKBoXzHww3r6jtGEylYq20\n5KfKpEx+sPX0gyZuYJiXC2CkEjImAluWKcdN9ZF6VD541sheAjbiaU7q7ZsztTxF\nWUH2tCvHeDXYKPKek3QzL7bYpUhLnCN/XxEv6ibeMDwtI7f5qpk2Aspzcw==\n-----END CERTIFICATE-----\n", - "clientname" : "adriancole-jcloudstest", - "name" : "adriancole-jcloudstest", - "orgname" : "jclouds", - "private_key" : "-----BEGIN RSA PRIVATE KEY-----\nMIIEpQIBAAKCAQEAyb2ZJJqGm0KKR+8nfQJNsSd+F9tXNMV7CfOcW6jsqs8EZgiV\nR09hD1IYOj4YqM0qJONlgyg4xRWewdSG7QTPj1lJpVAida9sXy2+kzyagZA1Am0O\nZcbqb5hoeIDgcX+eDa79s0u0DomjcfO9EKhvHLBz+zM+3QqPRkPV8nYTbfs+HjVz\nzOU6D1B0XR3+IPZZl2AnWs2d0qhnStHcDUvnRVQ0P482YwN9VgceOZtpPz0DCKEJ\n5Tx5STub8k0/zt/VAMHQafLSuQMLd2s4ZLuOZptN//uAsTmxireqd37z+8ZTdBbJ\n8LEpJ+iCXuSfm5aUh7iw6oxvToY2AL53+jK2UQIDAQABAoIBAQDA88B3i/xWn0vX\nBVxFamCYoecuNjGwXXkSyZew616A+EOCu47bh4aTurdFbYL0YFaAtaWvzlaN2eHg\nDb+HDuTefE29+WkcGk6SshPmiz5T0XOCAICWw6wSVDkHmGwS4jZvbAFm7W8nwGk9\nYhxgxFiRngswJZFopOLoF5WXs2td8guIYNslMpo7tu50iFnBHwKO2ZsPAk8t9nnS\nxlDavKruymEmqHCr3+dtio5eaenJcp3fjoXBQOKUk3ipII29XRB8NqeCVV/7Kxwq\nckqOBEbRwBclckyIbD+RiAgKvOelORjEiE9R42vuqvxRA6k9kd9o7utlX0AUtpEn\n3gZc6LepAoGBAP9ael5Y75+sK2JJUNOOhO8ae45cdsilp2yI0X+UBaSuQs2+dyPp\nkpEHAxd4pmmSvn/8c9TlEZhr+qYbABXVPlDncxpIuw2Ajbk7s/S4XaSKsRqpXL57\nzj/QOqLkRk8+OVV9q6lMeQNqLtEj1u6JPviX70Ro+FQtRttNOYbfdP/fAoGBAMpA\nXjR5woV5sUb+REg9vEuYo 8RSyOarxqKFCIXVUNsLOx+22+AK4+CQpbueWN7jotrl\nYD6uT6svWi3AAC7kiY0UI/fjVPRCUi8tVoQUE0TaU5VLITaYOB+W/bBaDE4M9560\n1NuDWO90baA5dfU44iuzva02rGJXK9+nS3o8nk/PAoGBALOL6djnDe4mwAaG6Jco\ncd4xr8jkyPzCRZuyBCSBbwphIUXLc7hDprPky064ncJD1UDmwIdkXd/fpMkg2QmA\n/CUk6LEFjMisqHojOaCL9gQZJPhLN5QUN2x1PJWGjs1vQh8Tkx0iUUCOa8bQPXNR\n+34OTsW6TUna4CSZAycLfhffAoGBAIggVsefBCvuQkF0NeUhmDCRZfhnd8y55RHR\n1HCvqKIlpv+rhcX/zmyBLuteopYyRJRsOiE2FW00i8+rIPRu4Z3Q5nybx7w3PzV9\noHN5R5baE9OyI4KpZWztpYYitZF67NcnAvVULHHOvVJQGnKYfLHJYmrJF7GA1ojM\nAuMdFbjFAoGAPxUhxwFy8gaqBahKUEZn4F81HFP5ihGhkT4QL6AFPO2e+JhIGjuR\n27+85hcFqQ+HHVtFsm81b/a+R7P4UuCRgc8eCjxQMoJ1Xl4n7VbjPbHMnIN0Ryvd\nO4ZpWDWYnCO021JTOUUOJ4J/y0416Bvkw0z59y7sNX7wDBBHHbK/XCc=\n-----END RSA PRIVATE KEY-----\n", - "uri" : "https://api.opscode.com/organizations/jclouds/clients/adriancole-jcloudstest", - "validator" : false -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/resources/clients_list.json ---------------------------------------------------------------------- diff --git a/core/src/test/resources/clients_list.json b/core/src/test/resources/clients_list.json deleted file mode 100644 index 000110b..0000000 --- a/core/src/test/resources/clients_list.json +++ /dev/null @@ -1,5 +0,0 @@ -{ - "chef-webui": "http://localhost:4000/clients/chef-webui", - "chef-validator": "http://localhost:4000/clients/chef-validator", - "adam": "http://localhost:4000/clients/adam" -} http://git-wip-us.apache.org/repos/asf/jclouds-chef/blob/cffeede4/core/src/test/resources/data_list.json ---------------------------------------------------------------------- diff --git a/core/src/test/resources/data_list.json b/core/src/test/resources/data_list.json deleted file mode 100644 index de9205d..0000000 --- a/core/src/test/resources/data_list.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "users": "http://localhost:4000/data/users", - "applications": "http://localhost:4000/data/applications" -}
