You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@brooklyn.apache.org by aledsage <gi...@git.apache.org> on 2016/10/19 10:02:27 UTC
[GitHub] brooklyn-server pull request #387: Convert jclouds yaml tests to unit tests
GitHub user aledsage opened a pull request:
https://github.com/apache/brooklyn-server/pull/387
Convert jclouds yaml tests to unit tests
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/aledsage/brooklyn-server convert-jclouds-tests-to-unitTests
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/brooklyn-server/pull/387.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #387
----
commit b1407d08ca077c49ae8bd454613d7f593021c197
Author: Aled Sage <al...@gmail.com>
Date: 2016-10-18T18:11:35Z
Rename JcloudsLocationExternalConfigYamlLiveTest
commit ff021884ebd9d45bd330fe61731fc269544e2495
Author: Aled Sage <al...@gmail.com>
Date: 2016-10-18T18:13:17Z
LocalManagementContextForTests supports properties map
commit 554f50e9745a9c06ca43bb023c541bb14d1919ce
Author: Aled Sage <al...@gmail.com>
Date: 2016-10-18T23:37:02Z
Disable JavaWebAppWithDslYamlRebindIntegrationTest
Needs to be moved to brooklyn-library, or deleted
commit cb3bfa5ab67d950d9e02678fb86324c796f6e171
Author: Aled Sage <al...@gmail.com>
Date: 2016-10-18T23:38:39Z
Reflections utils: improve use of generics
commit 70fd9bdf74d42c3a2a735c782392ae6b771700a3
Author: Aled Sage <al...@gmail.com>
Date: 2016-10-19T08:54:48Z
Convert jclouds yaml tests to unit tests
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server pull request #387: Convert jclouds yaml tests to unit tests
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/brooklyn-server/pull/387
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server pull request #387: Convert jclouds yaml tests to unit tests
Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/387#discussion_r84120460
--- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractJcloudsStubYamlTest.java ---
@@ -0,0 +1,179 @@
+/*
+ * 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.apache.brooklyn.camp.brooklyn;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.Reader;
+import java.util.Set;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.camp.brooklyn.AbstractJcloudsStubYamlTest.ByonComputeServiceStaticRef;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
+import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
+import org.apache.brooklyn.location.jclouds.AbstractJcloudsStubbedUnitTest;
+import org.apache.brooklyn.location.jclouds.ComputeServiceRegistry;
+import org.apache.brooklyn.location.jclouds.JcloudsLocation;
+import org.apache.brooklyn.location.jclouds.JcloudsStubTemplateBuilder;
+import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry;
+import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry.NodeCreator;
+import org.apache.brooklyn.location.ssh.SshMachineLocation;
+import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool;
+import org.apache.brooklyn.util.core.internal.winrm.RecordingWinRmTool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+/**
+ * This is a combination of the jclouds tests and the yaml tests. As such, it extends
+ * {@link AbstractJcloudsStubbedUnitTest} and duplicates some of the utility methods in
+ * {@link AbstractYamlTest}.
+ */
+public abstract class AbstractJcloudsStubYamlTest extends AbstractJcloudsStubbedUnitTest {
+
+ // TODO Some duplication compared to AbstractJcloudsRebindStubYamlTest
+
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractJcloudsStubYamlTest.class);
+
+ public static final String LOCATION_CATALOG_ID = "stubbed-aws-ec2";
+
+ protected BrooklynCampPlatformLauncherNoServer launcher;
+ protected BrooklynCampPlatform platform;
+
+ @BeforeMethod(alwaysRun=true)
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ NodeCreator nodeCreator = newNodeCreator();
+ StubbedComputeServiceRegistry computeServiceRegistry = new StubbedComputeServiceRegistry(nodeCreator, false);
+ ByonComputeServiceStaticRef.setInstance(computeServiceRegistry);
+
+ addStubbedLocationToCatalog();
+ }
+
+ @AfterMethod(alwaysRun=true)
+ @Override
+ public void tearDown() throws Exception {
+ try {
+ super.tearDown();
+ } finally {
+ ByonComputeServiceStaticRef.clearInstance();
+ if (launcher != null) launcher.stopServers();
+ }
+ }
+
+ @Override
+ protected LocalManagementContext newManagementContext() {
+ launcher = new BrooklynCampPlatformLauncherNoServer() {
+ @Override
+ protected LocalManagementContext newMgmtContext() {
+ return AbstractJcloudsStubYamlTest.super.newManagementContext();
+ }
+ };
+ launcher.launch();
+ platform = launcher.getCampPlatform();
+ LocalManagementContext mgmt = (LocalManagementContext) launcher.getBrooklynMgmt();
+ return mgmt;
+ }
+
+ protected void addStubbedLocationToCatalog() {
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: " + LOCATION_CATALOG_ID,
+ " version: 1.0.0",
+ " itemType: location",
+ " item:",
+ " type: " + LOCATION_SPEC,
+ " brooklyn.config:",
+ " identity: myidentity",
+ " credential: mycredential",
+ " jclouds.computeServiceRegistry:",
+ " $brooklyn:object:",
+ " type: " + ByonComputeServiceStaticRef.class.getName(),
+ " " + SshMachineLocation.SSH_TOOL_CLASS.getName() + ": " + RecordingSshTool.class.getName(),
+ " templateBuilder:",
+ " $brooklyn:object:",
+ " type: "+JcloudsStubTemplateBuilder.class.getName(),
+ " factoryMethod.name: create",
+ " " + JcloudsLocation.POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE.getName() + ":",
+ " $brooklyn:object:",
+ " type: "+Predicates.class.getName(),
+ " factoryMethod.name: alwaysTrue",
+ " " + SshMachineLocation.SSH_TOOL_CLASS.getName() + ": " + RecordingSshTool.class.getName(),
+ " " + WinRmMachineLocation.WINRM_TOOL_CLASS.getName() + ": " + RecordingWinRmTool.class.getName());
+ }
+
+ protected void addCatalogItems(String... catalogYaml) {
+ addCatalogItems(Joiner.on("\n").join(catalogYaml));
+ }
+
+ protected void addCatalogItems(String catalogYaml) {
+ mgmt().getCatalog().addItems(catalogYaml, false);
+ }
+
+ protected Entity createAndStartApplication(Reader input) throws Exception {
+ AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
+ Assembly assembly;
+ try {
+ assembly = at.getInstantiator().newInstance().instantiate(at, platform);
+ } catch (Exception e) {
+ LOG.warn("Unable to instantiate " + at + " (rethrowing): " + e);
+ throw e;
+ }
+ LOG.info("Test - created " + assembly);
+ final Entity app = mgmt().getEntityManager().getEntity(assembly.getId());
--- End diff --
Could use `EntityManagementUtils.createStarting(ManagementContext, String)` instead.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server pull request #387: Convert jclouds yaml tests to unit tests
Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/387#discussion_r84445667
--- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractJcloudsStubYamlTest.java ---
@@ -0,0 +1,179 @@
+/*
+ * 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.apache.brooklyn.camp.brooklyn;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.Reader;
+import java.util.Set;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.camp.brooklyn.AbstractJcloudsStubYamlTest.ByonComputeServiceStaticRef;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
+import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
+import org.apache.brooklyn.location.jclouds.AbstractJcloudsStubbedUnitTest;
+import org.apache.brooklyn.location.jclouds.ComputeServiceRegistry;
+import org.apache.brooklyn.location.jclouds.JcloudsLocation;
+import org.apache.brooklyn.location.jclouds.JcloudsStubTemplateBuilder;
+import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry;
+import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry.NodeCreator;
+import org.apache.brooklyn.location.ssh.SshMachineLocation;
+import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool;
+import org.apache.brooklyn.util.core.internal.winrm.RecordingWinRmTool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+/**
+ * This is a combination of the jclouds tests and the yaml tests. As such, it extends
+ * {@link AbstractJcloudsStubbedUnitTest} and duplicates some of the utility methods in
+ * {@link AbstractYamlTest}.
+ */
+public abstract class AbstractJcloudsStubYamlTest extends AbstractJcloudsStubbedUnitTest {
+
+ // TODO Some duplication compared to AbstractJcloudsRebindStubYamlTest
+
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractJcloudsStubYamlTest.class);
+
+ public static final String LOCATION_CATALOG_ID = "stubbed-aws-ec2";
+
+ protected BrooklynCampPlatformLauncherNoServer launcher;
+ protected BrooklynCampPlatform platform;
+
+ @BeforeMethod(alwaysRun=true)
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ NodeCreator nodeCreator = newNodeCreator();
+ StubbedComputeServiceRegistry computeServiceRegistry = new StubbedComputeServiceRegistry(nodeCreator, false);
+ ByonComputeServiceStaticRef.setInstance(computeServiceRegistry);
+
+ addStubbedLocationToCatalog();
+ }
+
+ @AfterMethod(alwaysRun=true)
+ @Override
+ public void tearDown() throws Exception {
+ try {
+ super.tearDown();
+ } finally {
+ ByonComputeServiceStaticRef.clearInstance();
+ if (launcher != null) launcher.stopServers();
+ }
+ }
+
+ @Override
+ protected LocalManagementContext newManagementContext() {
+ launcher = new BrooklynCampPlatformLauncherNoServer() {
+ @Override
+ protected LocalManagementContext newMgmtContext() {
+ return AbstractJcloudsStubYamlTest.super.newManagementContext();
+ }
+ };
+ launcher.launch();
+ platform = launcher.getCampPlatform();
+ LocalManagementContext mgmt = (LocalManagementContext) launcher.getBrooklynMgmt();
+ return mgmt;
+ }
+
+ protected void addStubbedLocationToCatalog() {
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: " + LOCATION_CATALOG_ID,
+ " version: 1.0.0",
+ " itemType: location",
+ " item:",
+ " type: " + LOCATION_SPEC,
+ " brooklyn.config:",
+ " identity: myidentity",
+ " credential: mycredential",
+ " jclouds.computeServiceRegistry:",
+ " $brooklyn:object:",
+ " type: " + ByonComputeServiceStaticRef.class.getName(),
+ " " + SshMachineLocation.SSH_TOOL_CLASS.getName() + ": " + RecordingSshTool.class.getName(),
+ " templateBuilder:",
+ " $brooklyn:object:",
+ " type: "+JcloudsStubTemplateBuilder.class.getName(),
+ " factoryMethod.name: create",
+ " " + JcloudsLocation.POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE.getName() + ":",
+ " $brooklyn:object:",
+ " type: "+Predicates.class.getName(),
+ " factoryMethod.name: alwaysTrue",
+ " " + SshMachineLocation.SSH_TOOL_CLASS.getName() + ": " + RecordingSshTool.class.getName(),
+ " " + WinRmMachineLocation.WINRM_TOOL_CLASS.getName() + ": " + RecordingWinRmTool.class.getName());
+ }
+
+ protected void addCatalogItems(String... catalogYaml) {
+ addCatalogItems(Joiner.on("\n").join(catalogYaml));
+ }
+
+ protected void addCatalogItems(String catalogYaml) {
+ mgmt().getCatalog().addItems(catalogYaml, false);
+ }
+
+ protected Entity createAndStartApplication(Reader input) throws Exception {
+ AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
+ Assembly assembly;
+ try {
+ assembly = at.getInstantiator().newInstance().instantiate(at, platform);
+ } catch (Exception e) {
+ LOG.warn("Unable to instantiate " + at + " (rethrowing): " + e);
+ throw e;
+ }
+ LOG.info("Test - created " + assembly);
+ final Entity app = mgmt().getEntityManager().getEntity(assembly.getId());
--- End diff --
Yes, replace the code up to this point with the `createStarting` call. Still need to block on the start task so that the location is created.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server pull request #387: Convert jclouds yaml tests to unit tests
Posted by aledsage <gi...@git.apache.org>.
Github user aledsage commented on a diff in the pull request:
https://github.com/apache/brooklyn-server/pull/387#discussion_r84324445
--- Diff: camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractJcloudsStubYamlTest.java ---
@@ -0,0 +1,179 @@
+/*
+ * 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.apache.brooklyn.camp.brooklyn;
+
+import static com.google.common.base.Preconditions.checkNotNull;
+
+import java.io.Reader;
+import java.util.Set;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.mgmt.Task;
+import org.apache.brooklyn.camp.brooklyn.AbstractJcloudsStubYamlTest.ByonComputeServiceStaticRef;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
+import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
+import org.apache.brooklyn.location.jclouds.AbstractJcloudsStubbedUnitTest;
+import org.apache.brooklyn.location.jclouds.ComputeServiceRegistry;
+import org.apache.brooklyn.location.jclouds.JcloudsLocation;
+import org.apache.brooklyn.location.jclouds.JcloudsStubTemplateBuilder;
+import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry;
+import org.apache.brooklyn.location.jclouds.StubbedComputeServiceRegistry.NodeCreator;
+import org.apache.brooklyn.location.ssh.SshMachineLocation;
+import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
+import org.apache.brooklyn.util.core.config.ConfigBag;
+import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool;
+import org.apache.brooklyn.util.core.internal.winrm.RecordingWinRmTool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+
+import com.google.common.base.Joiner;
+import com.google.common.base.Predicates;
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+
+/**
+ * This is a combination of the jclouds tests and the yaml tests. As such, it extends
+ * {@link AbstractJcloudsStubbedUnitTest} and duplicates some of the utility methods in
+ * {@link AbstractYamlTest}.
+ */
+public abstract class AbstractJcloudsStubYamlTest extends AbstractJcloudsStubbedUnitTest {
+
+ // TODO Some duplication compared to AbstractJcloudsRebindStubYamlTest
+
+ private static final Logger LOG = LoggerFactory.getLogger(AbstractJcloudsStubYamlTest.class);
+
+ public static final String LOCATION_CATALOG_ID = "stubbed-aws-ec2";
+
+ protected BrooklynCampPlatformLauncherNoServer launcher;
+ protected BrooklynCampPlatform platform;
+
+ @BeforeMethod(alwaysRun=true)
+ @Override
+ public void setUp() throws Exception {
+ super.setUp();
+
+ NodeCreator nodeCreator = newNodeCreator();
+ StubbedComputeServiceRegistry computeServiceRegistry = new StubbedComputeServiceRegistry(nodeCreator, false);
+ ByonComputeServiceStaticRef.setInstance(computeServiceRegistry);
+
+ addStubbedLocationToCatalog();
+ }
+
+ @AfterMethod(alwaysRun=true)
+ @Override
+ public void tearDown() throws Exception {
+ try {
+ super.tearDown();
+ } finally {
+ ByonComputeServiceStaticRef.clearInstance();
+ if (launcher != null) launcher.stopServers();
+ }
+ }
+
+ @Override
+ protected LocalManagementContext newManagementContext() {
+ launcher = new BrooklynCampPlatformLauncherNoServer() {
+ @Override
+ protected LocalManagementContext newMgmtContext() {
+ return AbstractJcloudsStubYamlTest.super.newManagementContext();
+ }
+ };
+ launcher.launch();
+ platform = launcher.getCampPlatform();
+ LocalManagementContext mgmt = (LocalManagementContext) launcher.getBrooklynMgmt();
+ return mgmt;
+ }
+
+ protected void addStubbedLocationToCatalog() {
+ addCatalogItems(
+ "brooklyn.catalog:",
+ " id: " + LOCATION_CATALOG_ID,
+ " version: 1.0.0",
+ " itemType: location",
+ " item:",
+ " type: " + LOCATION_SPEC,
+ " brooklyn.config:",
+ " identity: myidentity",
+ " credential: mycredential",
+ " jclouds.computeServiceRegistry:",
+ " $brooklyn:object:",
+ " type: " + ByonComputeServiceStaticRef.class.getName(),
+ " " + SshMachineLocation.SSH_TOOL_CLASS.getName() + ": " + RecordingSshTool.class.getName(),
+ " templateBuilder:",
+ " $brooklyn:object:",
+ " type: "+JcloudsStubTemplateBuilder.class.getName(),
+ " factoryMethod.name: create",
+ " " + JcloudsLocation.POLL_FOR_FIRST_REACHABLE_ADDRESS_PREDICATE.getName() + ":",
+ " $brooklyn:object:",
+ " type: "+Predicates.class.getName(),
+ " factoryMethod.name: alwaysTrue",
+ " " + SshMachineLocation.SSH_TOOL_CLASS.getName() + ": " + RecordingSshTool.class.getName(),
+ " " + WinRmMachineLocation.WINRM_TOOL_CLASS.getName() + ": " + RecordingWinRmTool.class.getName());
+ }
+
+ protected void addCatalogItems(String... catalogYaml) {
+ addCatalogItems(Joiner.on("\n").join(catalogYaml));
+ }
+
+ protected void addCatalogItems(String catalogYaml) {
+ mgmt().getCatalog().addItems(catalogYaml, false);
+ }
+
+ protected Entity createAndStartApplication(Reader input) throws Exception {
+ AssemblyTemplate at = platform.pdp().registerDeploymentPlan(input);
+ Assembly assembly;
+ try {
+ assembly = at.getInstantiator().newInstance().instantiate(at, platform);
+ } catch (Exception e) {
+ LOG.warn("Unable to instantiate " + at + " (rethrowing): " + e);
+ throw e;
+ }
+ LOG.info("Test - created " + assembly);
+ final Entity app = mgmt().getEntityManager().getEntity(assembly.getId());
--- End diff --
Not sure I follow. Are you suggesting I can replace this entire method with `return EntityManagementUtils.createStarting(mgmt(), input).get()`? I just tried that, but `testJcloudsInheritanceAndPasswordSecret` then fails because the `EmptySoftwareProcess` doesn't have a location.
I copied this method (verbatim) from `AbstractYamlRebindTest`.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #387: Convert jclouds yaml tests to unit tests
Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the issue:
https://github.com/apache/brooklyn-server/pull/387
Looks good, a very welcome clean up.
Jenkins is failing with, looks related:
```
java.lang.ClassCastException: org.apache.brooklyn.core.location.dynamic.clocker.StubInfrastructureImpl cannot be cast to org.apache.brooklyn.core.test.entity.TestApplication
at org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp.rebind(RebindTestFixtureWithApp.java:49)
at org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp.rebind(RebindTestFixtureWithApp.java:32)
at org.apache.brooklyn.core.mgmt.rebind.RebindTestFixture.rebind(RebindTestFixture.java:231)
at org.apache.brooklyn.core.location.dynamic.clocker.ClockerDynamicLocationPatternRebindTest.testRebind(ClockerDynamicLocationPatternRebindTest.java:103)
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] brooklyn-server issue #387: Convert jclouds yaml tests to unit tests
Posted by neykov <gi...@git.apache.org>.
Github user neykov commented on the issue:
https://github.com/apache/brooklyn-server/pull/387
Tests are passing, merging.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---