Remove catalog item parameters in line with type registry changes The parameters are still populated in the spec, it's just the catalog item that doesn't have the API to get the parameters. Also fixes another shortcoming where parameters in catalog items were eagerly evaluated, not updating if dependant catalog items changed.
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/3edbaa98 Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/3edbaa98 Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/3edbaa98 Branch: refs/heads/master Commit: 3edbaa983487cf9004e4447b1ef22b63000c5543 Parents: 8b1d180 Author: Svetoslav Neykov <[email protected]> Authored: Tue Nov 17 11:50:39 2015 +0200 Committer: Svetoslav Neykov <[email protected]> Committed: Tue Nov 17 12:41:58 2015 +0200 ---------------------------------------------------------------------- .../brooklyn/api/catalog/CatalogItem.java | 4 - .../catalog/internal/BasicBrooklynCatalog.java | 32 -- .../catalog/internal/CatalogClasspathDo.java | 8 - .../catalog/internal/CatalogItemBuilder.java | 10 - .../core/catalog/internal/CatalogItemDo.java | 5 - .../internal/CatalogItemDtoAbstract.java | 24 +- .../internal/SpecParameterInMetaTest.java | 139 ------- .../catalog/internal/TestToSpecTransformer.java | 118 ------ ...che.brooklyn.core.plan.PlanToSpecTransformer | 19 - docs/guide/ops/catalog/index.md | 25 -- docs/guide/yaml/yaml-reference.md | 35 +- .../brooklyn/catalog/CatalogParametersTest.java | 317 ---------------- .../catalog/SpecParameterParsingTest.java | 140 +++++++ .../catalog/SpecParameterUnwrappingTest.java | 379 +++++++++++++++++++ .../rest/transform/CatalogTransformer.java | 5 +- .../osgi/more-entities-v2-evil-twin/pom.xml | 2 +- .../dependencies/osgi/more-entities-v2/pom.xml | 4 +- .../brooklyn-test-osgi-more-entities_0.2.0.jar | Bin 15745 -> 15646 bytes ...-test-osgi-more-entities_evil-twin_0.2.0.jar | Bin 13922 -> 13811 bytes 19 files changed, 558 insertions(+), 708 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java ---------------------------------------------------------------------- diff --git a/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java b/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java index 7f4e3b3..610967b 100644 --- a/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java +++ b/api/src/main/java/org/apache/brooklyn/api/catalog/CatalogItem.java @@ -19,7 +19,6 @@ package org.apache.brooklyn.api.catalog; import java.util.Collection; -import java.util.List; import javax.annotation.Nullable; @@ -27,7 +26,6 @@ import org.apache.brooklyn.api.mgmt.rebind.RebindSupport; import org.apache.brooklyn.api.mgmt.rebind.Rebindable; import org.apache.brooklyn.api.mgmt.rebind.mementos.CatalogItemMemento; import org.apache.brooklyn.api.objs.BrooklynObject; -import org.apache.brooklyn.api.objs.SpecParameter; import org.apache.brooklyn.api.typereg.OsgiBundleWithUrl; import com.google.common.annotations.Beta; @@ -97,8 +95,6 @@ public interface CatalogItem<T,SpecT> extends BrooklynObject, Rebindable { public String getVersion(); - public List<SpecParameter<?>> getParameters(); - public Collection<CatalogBundle> getLibraries(); public String toXmlString(); http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java index 262e3b4..0a39725 100644 --- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java +++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java @@ -37,13 +37,11 @@ import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; import org.apache.brooklyn.api.location.Location; import org.apache.brooklyn.api.location.LocationSpec; import org.apache.brooklyn.api.mgmt.ManagementContext; -import org.apache.brooklyn.api.objs.SpecParameter; import org.apache.brooklyn.core.catalog.CatalogPredicates; import org.apache.brooklyn.core.catalog.internal.CatalogClasspathDo.CatalogScanningModes; import org.apache.brooklyn.core.location.BasicLocationRegistry; import org.apache.brooklyn.core.mgmt.classloading.BrooklynClassLoadingContext; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; -import org.apache.brooklyn.core.objs.BasicSpecParameter; import org.apache.brooklyn.core.plan.PlanToSpecFactory; import org.apache.brooklyn.core.plan.PlanToSpecTransformer; import org.apache.brooklyn.util.collections.MutableList; @@ -325,9 +323,6 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { return input.createCatalogSpec(item, encounteredTypes); } }); - if (specMaybe.isPresent() && !item.getParameters().isEmpty()) { - specMaybe.get().parameters(item.getParameters()); - } return specMaybe.get(); } @@ -426,9 +421,6 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { // (this load is required for the scan below and I think also for yaml resolution) CatalogUtils.installLibraries(mgmt, libraryBundlesNew); - List<?> parametersRaw = MutableList.copyOf(getFirstAs(itemMetadata, List.class, "brooklyn.parameters", "parameters").orNull()); - List<SpecParameter<?>> metaParameters = BasicSpecParameter.fromConfigList(parametersRaw, CatalogUtils.newClassLoadingContext(mgmt, "<catalog_input_parser>", libraryBundles)); - Boolean scanJavaAnnotations = getFirstAs(itemMetadata, Boolean.class, "scanJavaAnnotations", "scan_java_annotations").orNull(); if (scanJavaAnnotations==null || !scanJavaAnnotations) { // don't scan @@ -577,7 +569,6 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { CatalogItemDtoAbstract<?, ?> dto = createItemBuilder(itemType, symbolicName, version) .libraries(libraryBundles) - .parameters(getParameters(metaParameters, planInterpreter)) .displayName(displayName) .description(description) .deprecated(catalogDeprecated) @@ -589,14 +580,6 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { result.add(dto); } - private List<SpecParameter<?>> getParameters(List<SpecParameter<?>> metaParameters, PlanInterpreterGuessingType planInterpreter) { - if (!metaParameters.isEmpty()) { - return metaParameters; - } else { - return planInterpreter.parameters; - } - } - private String setFromItemIfUnset(String oldValue, Map<?,?> item, String fieldAttr) { if (Strings.isNonBlank(oldValue)) return oldValue; if (item!=null) { @@ -660,7 +643,6 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { CatalogItemType catalogItemType; String planYaml; boolean resolved = false; - List<SpecParameter<?>> parameters = ImmutableList.of(); List<Exception> errors = MutableList.of(); List<Exception> entityErrors = MutableList.of(); @@ -698,17 +680,12 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { if (!resolved && catalogItemType==CatalogItemType.TEMPLATE) { // anything goes, for an explicit template, because we can't easily recurse into the types planYaml = itemYaml; - parameters = getItemParameters(); resolved = true; } return this; } - private List<SpecParameter<?>> getItemParameters() { - return BasicSpecParameter.fromConfigList((List<?>)item.get("brooklyn.parameters"), CatalogUtils.newClassLoadingContext(mgmt, "<template_parameters_parser>", libraryBundles)); - } - public boolean isResolved() { return resolved; } /** Returns potentially useful errors encountered while guessing types. @@ -753,10 +730,6 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { // matched - exit catalogItemType = candidateCiType; planYaml = candidateYaml; - parameters = getItemParameters(); - if (parameters.isEmpty()) { - parameters = candidate.getParameters(); - } resolved = true; return true; } @@ -776,10 +749,6 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { if (spec!=null) { catalogItemType = candidateCiType; planYaml = candidateYaml; - parameters = getItemParameters(); - if (parameters.isEmpty()) { - parameters = spec.getParameters(); - } resolved = true; } return true; @@ -818,7 +787,6 @@ public class BasicBrooklynCatalog implements BrooklynCatalog { if (cutdownSpec!=null) { catalogItemType = candidateCiType; planYaml = candidateYaml; - parameters = cutdownSpec.getParameters(); resolved = true; } return true; http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDo.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDo.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDo.java index 69ee940..f9dee80 100644 --- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDo.java +++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogClasspathDo.java @@ -24,7 +24,6 @@ import java.io.InputStream; import java.lang.reflect.Modifier; import java.net.URL; import java.util.Arrays; -import java.util.List; import java.util.Set; import javax.annotation.Nullable; @@ -35,11 +34,9 @@ import org.apache.brooklyn.api.entity.Application; import org.apache.brooklyn.api.entity.Entity; import org.apache.brooklyn.api.entity.ImplementedBy; import org.apache.brooklyn.api.location.Location; -import org.apache.brooklyn.api.objs.SpecParameter; import org.apache.brooklyn.api.policy.Policy; import org.apache.brooklyn.core.entity.factory.ApplicationBuilder; import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal; -import org.apache.brooklyn.core.objs.BasicSpecParameter; import org.apache.brooklyn.util.core.ResourceUtils; import org.apache.brooklyn.util.core.javalang.ReflectionScanner; import org.apache.brooklyn.util.core.javalang.UrlClassLoader; @@ -313,7 +310,6 @@ public class CatalogClasspathDo { } if (log.isTraceEnabled()) log.trace("adding to catalog: "+c+" (from catalog "+catalog+")"); - item.setParameters(getJavaTypeParameters(c)); catalog.addEntry(item); return item; } @@ -353,8 +349,4 @@ public class CatalogClasspathDo { classloader.addFirst(loader); } - private List<SpecParameter<?>> getJavaTypeParameters(Class<?> c) { - return BasicSpecParameter.fromClass(catalog.mgmt, c); - } - } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemBuilder.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemBuilder.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemBuilder.java index 1f9b9a2..8918a74 100644 --- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemBuilder.java +++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemBuilder.java @@ -20,10 +20,8 @@ package org.apache.brooklyn.core.catalog.internal; import java.util.Collection; import java.util.Collections; -import java.util.List; import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle; -import org.apache.brooklyn.api.objs.SpecParameter; import com.google.common.base.Preconditions; @@ -106,11 +104,6 @@ public class CatalogItemBuilder<CatalogItemType extends CatalogItemDtoAbstract<? return this; } - public CatalogItemBuilder<CatalogItemType> parameters(List<SpecParameter<?>> inputs) { - dto.setParameters(inputs); - return this; - } - public CatalogItemBuilder<CatalogItemType> libraries(Collection<CatalogBundle> libraries) { dto.setLibraries(libraries); return this; @@ -125,9 +118,6 @@ public class CatalogItemBuilder<CatalogItemType extends CatalogItemDtoAbstract<? Preconditions.checkNotNull(dto.getSymbolicName()); Preconditions.checkNotNull(dto.getVersion()); - if (dto.getParameters() == null) { - dto.setParameters(Collections.<SpecParameter<?>>emptyList()); - } if (dto.getLibraries() == null) { dto.setLibraries(Collections.<CatalogBundle>emptyList()); } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDo.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDo.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDo.java index 4224cb9..bc2926c 100644 --- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDo.java +++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDo.java @@ -179,11 +179,6 @@ public class CatalogItemDo<T,SpecT> implements CatalogItem<T,SpecT>, BrooklynObj return itemDto.getVersion(); } - @Override - public List<SpecParameter<?>> getParameters() { - return itemDto.getParameters(); - } - @Nonnull // but it is still null sometimes, see in CatalogDo.loadJavaClass @Override public Collection<CatalogBundle> getLibraries() { http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDtoAbstract.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDtoAbstract.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDtoAbstract.java index d891ae1..df0d2e4 100644 --- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDtoAbstract.java +++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogItemDtoAbstract.java @@ -18,11 +18,8 @@ */ package org.apache.brooklyn.core.catalog.internal; -import static com.google.common.base.Preconditions.checkNotNull; - import java.util.Collection; import java.util.Collections; -import java.util.List; import java.util.Map; import java.util.Set; @@ -32,7 +29,6 @@ import javax.annotation.Nullable; import org.apache.brooklyn.api.catalog.CatalogItem; import org.apache.brooklyn.api.mgmt.rebind.RebindSupport; import org.apache.brooklyn.api.mgmt.rebind.mementos.CatalogItemMemento; -import org.apache.brooklyn.api.objs.SpecParameter; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.mgmt.rebind.BasicCatalogItemRebindSupport; import org.apache.brooklyn.core.objs.AbstractBrooklynObject; @@ -61,11 +57,10 @@ public abstract class CatalogItemDtoAbstract<T, SpecT> extends AbstractBrooklynO private @SetFromFlag String iconUrl; private @SetFromFlag String javaType; - /**@deprecated since 0.7.0, left for deserialization backwards compatibility */ + /**@deprecated since 0.7.0, left for deserialization backwards compatibility (including xml based catalog format) */ private @Deprecated @SetFromFlag String type; private @SetFromFlag String planYaml; - private @SetFromFlag List<SpecParameter<?>> parameters = ImmutableList.of(); private @SetFromFlag Collection<CatalogBundle> libraries; private @SetFromFlag Set<Object> tags = Sets.newLinkedHashSet(); private @SetFromFlag boolean deprecated; @@ -177,16 +172,6 @@ public abstract class CatalogItemDtoAbstract<T, SpecT> extends AbstractBrooklynO public void setDisabled(boolean disabled) { this.disabled = disabled; } - - @Override - public List<SpecParameter<?>> getParameters() { - if (parameters != null) { - return parameters; - } else { - // Needed for the case when created by xstream - return ImmutableList.of(); - } - } @Nonnull @Override @@ -205,7 +190,7 @@ public abstract class CatalogItemDtoAbstract<T, SpecT> extends AbstractBrooklynO @Override public int hashCode() { - return Objects.hashCode(symbolicName, planYaml, javaType, nullIfEmpty(parameters), nullIfEmpty(libraries), version, getCatalogItemId()); + return Objects.hashCode(symbolicName, planYaml, javaType, nullIfEmpty(libraries), version, getCatalogItemId()); } @Override @@ -217,7 +202,6 @@ public abstract class CatalogItemDtoAbstract<T, SpecT> extends AbstractBrooklynO if (!Objects.equal(symbolicName, other.symbolicName)) return false; if (!Objects.equal(planYaml, other.planYaml)) return false; if (!Objects.equal(javaType, other.javaType)) return false; - if (!Objects.equal(nullIfEmpty(parameters), nullIfEmpty(other.parameters))) return false; if (!Objects.equal(nullIfEmpty(libraries), nullIfEmpty(other.libraries))) return false; if (!Objects.equal(getCatalogItemId(), other.getCatalogItemId())) return false; if (!Objects.equal(version, other.version)) return false; @@ -390,10 +374,6 @@ public abstract class CatalogItemDtoAbstract<T, SpecT> extends AbstractBrooklynO this.planYaml = planYaml; } - protected void setParameters(List<SpecParameter<?>> parameters) { - this.parameters = checkNotNull(parameters, "parameters"); - } - protected void setLibraries(Collection<CatalogBundle> libraries) { this.libraries = libraries; } http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/core/src/test/java/org/apache/brooklyn/core/catalog/internal/SpecParameterInMetaTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/catalog/internal/SpecParameterInMetaTest.java b/core/src/test/java/org/apache/brooklyn/core/catalog/internal/SpecParameterInMetaTest.java deleted file mode 100644 index 2f50c47..0000000 --- a/core/src/test/java/org/apache/brooklyn/core/catalog/internal/SpecParameterInMetaTest.java +++ /dev/null @@ -1,139 +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.apache.brooklyn.core.catalog.internal; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; -import static org.testng.Assert.assertTrue; - -import java.util.List; - -import org.apache.brooklyn.api.catalog.BrooklynCatalog; -import org.apache.brooklyn.api.catalog.CatalogItem; -import org.apache.brooklyn.api.entity.EntitySpec; -import org.apache.brooklyn.api.mgmt.ManagementContext; -import org.apache.brooklyn.api.objs.SpecParameter; -import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; -import org.apache.brooklyn.entity.stock.BasicEntity; -import org.apache.brooklyn.test.support.TestResourceUnavailableException; -import org.apache.brooklyn.util.osgi.OsgiTestResources; -import org.testng.annotations.BeforeMethod; -import org.testng.annotations.Test; - -import com.google.common.base.Joiner; -import com.google.common.collect.Iterables; -import com.google.common.reflect.TypeToken; - -public class SpecParameterInMetaTest { - private ManagementContext mgmt; - private BrooklynCatalog catalog; - private String spec; - - @BeforeMethod(alwaysRun=true) - public void setUp() { - mgmt = LocalManagementContextForTests.newInstanceWithOsgi(); - catalog = mgmt.getCatalog(); - spec = TestToSpecTransformer.registerSpec(EntitySpec.create(BasicEntity.class)); - } - - @Test - public void testYamlInputsParsed() { - CatalogItem<?, ?> item = add( - "brooklyn.catalog:", - " id: test.inputs", - " version: 0.0.1", - " parameters:", - " - simple", - " - name: explicit_name", - " - name: third_input", - " type: integer", - " item: " + spec); - List<SpecParameter<?>> inputs = item.getParameters(); - assertEquals(inputs.size(), 3); - SpecParameter<?> firstInput = inputs.get(0); - assertEquals(firstInput.getLabel(), "simple"); - assertEquals(firstInput.isPinned(), true); - assertEquals(firstInput.getType().getName(), "simple"); - assertEquals(firstInput.getType().getTypeToken(), TypeToken.of(String.class)); - - SpecParameter<?> secondInput = inputs.get(1); - assertEquals(secondInput.getLabel(), "explicit_name"); - assertEquals(secondInput.isPinned(), true); - assertEquals(secondInput.getType().getName(), "explicit_name"); - assertEquals(secondInput.getType().getTypeToken(), TypeToken.of(String.class)); - - SpecParameter<?> thirdInput = inputs.get(2); - assertEquals(thirdInput.getLabel(), "third_input"); - assertEquals(thirdInput.isPinned(), true); - assertEquals(thirdInput.getType().getName(), "third_input"); - assertEquals(thirdInput.getType().getTypeToken(), TypeToken.of(Integer.class)); - } - - @Test - public void testOsgiType() { - TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH); - - CatalogItem<?, ?> item = add( - "brooklyn.catalog:", - " id: test.inputs", - " version: 0.0.1", - " libraries:", - " - classpath://" + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH, - " parameters:", - " - name: simple", - " type: " + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY, - " item: " + spec); - List<SpecParameter<?>> inputs = item.getParameters(); - assertEquals(inputs.size(), 1); - SpecParameter<?> firstInput = inputs.get(0); - assertEquals(firstInput.getLabel(), "simple"); - assertTrue(firstInput.isPinned()); - assertEquals(firstInput.getType().getName(), "simple"); - assertEquals(firstInput.getType().getTypeToken().getRawType().getName(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY); - } - - @Test - public void testOsgiClassScanned() { - TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_MORE_ENTITIES_V2_PATH); - - addMulti("brooklyn.catalog:", - " items:", - " - scanJavaAnnotations: true", - " version: 2.0.test_java", - " libraries:", - " - classpath://" + OsgiTestResources.BROOKLYN_TEST_MORE_ENTITIES_V2_PATH); - - CatalogItem<?, ?> item = CatalogUtils.getCatalogItemOptionalVersion(mgmt, OsgiTestResources.BROOKLYN_TEST_MORE_ENTITIES_MORE_ENTITY); - assertEquals(item.getVersion(), "2.0.test_java"); - assertEquals(item.getLibraries().size(), 1); - SpecParameter<?> input = item.getParameters().get(0); - assertEquals(input.getLabel(), "more_config"); - assertFalse(input.isPinned()); - assertEquals(input.getType().getName(), "more_config"); - } - - private CatalogItem<?,?> add(String... def) { - return Iterables.getOnlyElement(addMulti(def)); - } - - private Iterable<? extends CatalogItem<?, ?>> addMulti(String... def) { - return catalog.addItems(Joiner.on('\n').join(def)); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/core/src/test/java/org/apache/brooklyn/core/catalog/internal/TestToSpecTransformer.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/catalog/internal/TestToSpecTransformer.java b/core/src/test/java/org/apache/brooklyn/core/catalog/internal/TestToSpecTransformer.java deleted file mode 100644 index 0dfe291..0000000 --- a/core/src/test/java/org/apache/brooklyn/core/catalog/internal/TestToSpecTransformer.java +++ /dev/null @@ -1,118 +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.apache.brooklyn.core.catalog.internal; - -import java.util.Map; -import java.util.Set; -import java.util.concurrent.ConcurrentHashMap; - -import org.apache.brooklyn.api.catalog.CatalogItem; -import org.apache.brooklyn.api.entity.Application; -import org.apache.brooklyn.api.entity.EntitySpec; -import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; -import org.apache.brooklyn.api.mgmt.ManagementContext; -import org.apache.brooklyn.core.plan.PlanNotRecognizedException; -import org.apache.brooklyn.core.plan.PlanToSpecTransformer; -import org.apache.brooklyn.util.text.Identifiers; -import org.apache.brooklyn.util.yaml.Yamls; - -/** - * Resolves previously registered specs by id. - * First create a spec and register it, keeping the returned ID: - * <pre> {@code - * String specId = TestToSpecTransformer.registerSpec(EntitySpec.create(BasicEntity.class)); - * }</pre> - * - * Then build a plan to be resolved such as: - * <pre> {@code - * brooklyn.catalog: - * id: test.inputs - * version: 0.0.1 - * item: <specId> - * } </pre> - */ -public class TestToSpecTransformer implements PlanToSpecTransformer { - private static final Map<String, AbstractBrooklynObjectSpec<?, ?>> REGISTERED_SPECS = new ConcurrentHashMap<>(); - public static String registerSpec(AbstractBrooklynObjectSpec<?, ?> spec) { - String id = Identifiers.makeRandomId(10); - REGISTERED_SPECS.put(id, spec); - return id; - } - - @Override - public void injectManagementContext(ManagementContext managementContext) { - } - - @Override - public String getShortDescription() { - return "test"; - } - - @Override - public boolean accepts(String planType) { - return "test".equals(planType); - } - - @SuppressWarnings("unchecked") - @Override - public EntitySpec<? extends Application> createApplicationSpec(String plan) throws PlanNotRecognizedException { - return (EntitySpec<? extends Application>) getSpec(plan); - } - - @SuppressWarnings("unchecked") - @Override - public <T, SpecT extends AbstractBrooklynObjectSpec<? extends T, SpecT>> SpecT createCatalogSpec(CatalogItem<T, SpecT> item, Set<String> encounteredTypes) - throws PlanNotRecognizedException { - return (SpecT) getSpecFromPlan(item.getPlanYaml()); - } - - private AbstractBrooklynObjectSpec<?,?> getSpecFromPlan(String plan) { - if (plan != null) { - Object planRaw = Yamls.parseAll(plan).iterator().next(); - if (planRaw instanceof String) { - return getSpec((String)planRaw); - } else if (planRaw instanceof Map) { - // The catalog parser assumes it's dealing with CAMP specs so will helpfully - // prepend "type: " if it's an inline item. - return getSpec((String)((Map<?, ?>)planRaw).get("type")); - } else { - throw notRecognized(); - } - } else { - throw notRecognized(); - } - } - - private AbstractBrooklynObjectSpec<?,?> getSpec(String plan) { - if (plan == null) { - throw notRecognized(); - } - AbstractBrooklynObjectSpec<?, ?> spec = REGISTERED_SPECS.get(plan); - if (spec != null) { - return spec; - } else { - throw notRecognized(); - } - } - - private PlanNotRecognizedException notRecognized() { - return new PlanNotRecognizedException("Not recognized as registered spec"); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/core/src/test/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer ---------------------------------------------------------------------- diff --git a/core/src/test/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer b/core/src/test/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer deleted file mode 100644 index 34d91b4..0000000 --- a/core/src/test/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer +++ /dev/null @@ -1,19 +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. -# -org.apache.brooklyn.core.catalog.internal.TestToSpecTransformer http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/docs/guide/ops/catalog/index.md ---------------------------------------------------------------------- diff --git a/docs/guide/ops/catalog/index.md b/docs/guide/ops/catalog/index.md index b738954..700b24f 100644 --- a/docs/guide/ops/catalog/index.md +++ b/docs/guide/ops/catalog/index.md @@ -111,31 +111,6 @@ The following optional catalog metadata is supported: This feature is experimental and may change or be removed. Also note that external OSGi dependencies are not supported and other metadata (such as versions, etc) may not be applied. -- `brooklyn.parameters`: a list of parameters the blueprint accepts. The items have - the following properties: - - `name` (required): identifier by which to reference the parameter when setting - or retrieving its value - - `label`: a value to present to the user, same as `name` if empty - - `description`: Short text describing the parameter behaviour/usage, presented - to the user - - `type`: the type of the parameter, one of `string`, `integer`, `long`, `float`, - `double`, `timestamp`, `port`, a fully qualified Java type name. Default is `string`. - - `default`: a default value, converted to the type above - - `constraints`: a list of constraints the parameter should meet, currently - `required` is supported - A shorthand notation is also supported where the name of the parameter is directly - passed as an item in the list. For example: - -~~~ yaml -brooklyn.properties: -- displayName -- name: user.name - constraints: - - required -- name: user.age - type: integer -~~~ - - `brooklyn.libraries`: a list of pointers to OSGi bundles required for the catalog item. This can be omitted if blueprints are pure YAML and everything required is included in the classpath and catalog. Where custom Java code or bundled resources is needed, however, OSGi JARs supply http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/docs/guide/yaml/yaml-reference.md ---------------------------------------------------------------------- diff --git a/docs/guide/yaml/yaml-reference.md b/docs/guide/yaml/yaml-reference.md index fc37ba8..36656bb 100644 --- a/docs/guide/yaml/yaml-reference.md +++ b/docs/guide/yaml/yaml-reference.md @@ -56,14 +56,43 @@ the entity being defined, with these being the most common: * `org.apache.brooklyn.core.sensor.ssh.SshCommandSensor`: takes a `name` and `command`, and optionally a `period`, to create a sensor feed which populates the sensor with - the given name by running the given command (on an entity which as an ssh-able machine) - -Entities, policies, and initializers may accept additional key-value pairs, + the given name by running the given command (on an entity which as an ssh-able machine) + +* `brooklyn.parameters`: documents a list of typed parameters the entity accepts. If none + are specified the config keys declared in the entity's class are used (including the + information from the `@CatalogConfig` annotation). The items have the following properties: + * `name` (required): identifier by which to reference the parameter when setting + or retrieving its value + * `label`: a value to present to the user, same as `name` if empty + * `description`: short text describing the parameter behaviour/usage, presented + to the user + * `type`: the type of the parameter, one of `string`, `integer`, `long`, `float`, + `double`, `timestamp`, `port`, a fully qualified Java type name. Default is `string`. + * `default`: a default value, converted to the type above + * `constraints`: a list of constraints the parameter should meet, currently + `required` is supported + + A shorthand notation is also supported where the name of the parameter is directly + passed as an item in the list. For example: + +~~~ yaml +brooklyn.parameters: +- displayName +- name: user.name + constraints: + - required +- name: user.age + type: integer +~~~ + +Entities, policies, and initializers may accept additional key-value pairs, usually documented in their documentation (e.g. javadoc), or in the case of Java often as static fields in the underlying Java class. Often there are config keys or flags (indicated by `@SetFromFlag`) declared on the class; these declared flags and config keys may be passed in at the root of the `ServiceSpecification` or in `brooklyn.config`. (Undeclared config is only accepted in the `brooklyn.config` map.) +Referencing the parameters from within java classes is identical to using config keys. In yaml it's +usually referenced using `$brooklyn:scopeRoot().config("displayName")`. See below for more details on scopes. ## Location Specification Elements http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogParametersTest.java ---------------------------------------------------------------------- diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogParametersTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogParametersTest.java deleted file mode 100644 index 810c117..0000000 --- a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogParametersTest.java +++ /dev/null @@ -1,317 +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.apache.brooklyn.camp.brooklyn.catalog; - -import static org.testng.Assert.assertEquals; -import static org.testng.Assert.assertFalse; - -import java.util.Iterator; -import java.util.List; - -import org.apache.brooklyn.api.catalog.CatalogItem; -import org.apache.brooklyn.api.entity.Application; -import org.apache.brooklyn.api.entity.Entity; -import org.apache.brooklyn.api.entity.EntitySpec; -import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; -import org.apache.brooklyn.api.objs.BrooklynObject; -import org.apache.brooklyn.api.objs.SpecParameter; -import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest; -import org.apache.brooklyn.config.ConfigKey; -import org.apache.brooklyn.core.config.ConfigKeys; -import org.apache.brooklyn.core.entity.AbstractEntity; -import org.apache.brooklyn.core.location.AbstractLocation; -import org.apache.brooklyn.core.mgmt.EntityManagementUtils; -import org.apache.brooklyn.core.objs.BasicSpecParameter; -import org.apache.brooklyn.core.policy.AbstractPolicy; -import org.apache.brooklyn.entity.stock.BasicApplication; -import org.testng.SkipException; -import org.testng.annotations.DataProvider; -import org.testng.annotations.Test; - -import com.google.common.collect.ImmutableList; -import com.google.common.collect.ImmutableSet; -import com.google.common.collect.Iterables; - -public class CatalogParametersTest extends AbstractYamlTest { - private static final String SYMBOLIC_NAME = "my.catalog.app.id.load"; - - private static final ConfigKey<String> SHARED_CONFIG = ConfigKeys.newStringConfigKey("sample.config"); - public static class ConfigEntityForTest extends AbstractEntity { - public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG; - } - public static class ConfigPolicyForTest extends AbstractPolicy { - public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG; - } - public static class ConfigLocationForTest extends AbstractLocation { - public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG; - } - - @DataProvider(name="brooklynTypes") - public Object[][] brooklynTypes() { - return new Object[][] { - {ConfigEntityForTest.class}, - {ConfigPolicyForTest.class}, - {ConfigLocationForTest.class}}; - } - - @DataProvider(name="catalogTemplates") - public Object[][] catalogTemplates() { - return new Object[][] { - {joinLines( - "brooklyn.catalog:", - " id: " + SYMBOLIC_NAME, - " version: " + TEST_VERSION, - " item:", - " type: ${testClass}", - " brooklyn.parameters:", - " - simple")}, - {joinLines( - "brooklyn.catalog:", - " id: " + SYMBOLIC_NAME, - " version: " + TEST_VERSION, - " brooklyn.parameters:", - " - simple", - " item:", - " type: ${testClass}")} - }; - } - - @DataProvider(name="typesAndTemplates") - public Object[][] typesAndTemplates() { - // cartesian product of brooklynTypes X catalogTemplates - Object[][] brooklynTypes = brooklynTypes(); - Object[][] catalogTemplates = catalogTemplates(); - Object[][] arr = new Object[brooklynTypes.length * catalogTemplates.length][]; - for (int i = 0; i < catalogTemplates.length; i++) { - for (int j = 0; j < brooklynTypes.length; j++) { - Object[] item = new Object[2]; - item[0] = brooklynTypes[j][0]; - item[1] = catalogTemplates[i][0]; - arr[i*brooklynTypes.length + j] = item; - } - } - return arr; - } - - @Test(dataProvider = "typesAndTemplates") - public void testParameters(Class<? extends BrooklynObject> testClass, String template) { - addCatalogItems(template.replace("${testClass}", testClass.getName())); - - ConfigKey<String> SIMPLE_CONFIG = ConfigKeys.newStringConfigKey("simple"); - SpecParameter<String> SIMPLE_PARAM = new BasicSpecParameter<>("simple", true, SIMPLE_CONFIG); - CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); - assertEquals(item.getParameters(), ImmutableList.of(SIMPLE_PARAM)); - @SuppressWarnings({"unchecked", "rawtypes"}) - AbstractBrooklynObjectSpec<?,?> spec = catalog.createSpec((CatalogItem)item); - assertEquals(ImmutableSet.copyOf(spec.getParameters()), ImmutableList.of(SIMPLE_PARAM)); - } - - @Test(dataProvider = "brooklynTypes") - public void testDefaultParameters(Class<? extends BrooklynObject> testClass) { - addCatalogItems( - "brooklyn.catalog:", - " id: " + SYMBOLIC_NAME, - " version: " + TEST_VERSION, - " item:", - " type: "+ testClass.getName()); - - CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); - assertEquals(ImmutableSet.copyOf(item.getParameters()), ImmutableSet.copyOf(BasicSpecParameter.fromClass(mgmt(), testClass))); - @SuppressWarnings({"unchecked", "rawtypes"}) - AbstractBrooklynObjectSpec<?,?> spec = (AbstractBrooklynObjectSpec<?,?>) catalog.createSpec((CatalogItem)item); - assertEquals(ImmutableSet.copyOf(spec.getParameters()), ImmutableSet.copyOf(BasicSpecParameter.fromClass(mgmt(),testClass))); - } - - - @Test - public void testRootParametersUnwrapped() { - addCatalogItems( - "brooklyn.catalog:", - " id: " + SYMBOLIC_NAME, - " version: " + TEST_VERSION, - " item:", - " services:", - " - type: " + ConfigEntityForTest.class.getName(), - " brooklyn.parameters:", - " - simple"); - - CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); - List<SpecParameter<?>> inputs = item.getParameters(); - assertEquals(inputs.size(), 1); - SpecParameter<?> firstInput = inputs.get(0); - assertEquals(firstInput.getLabel(), "simple"); - } - - @Test - public void testExplicitParametersInMetaOverride() { - addCatalogItems( - "brooklyn.catalog:", - " id: " + SYMBOLIC_NAME, - " version: " + TEST_VERSION, - " brooklyn.parameters:", - " - metaSimple", - " item:", - " type: " + ConfigEntityForTest.class.getName(), - " brooklyn.parameters:", - " - simple"); - - CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); - List<SpecParameter<?>> inputs = item.getParameters(); - assertEquals(inputs.size(), 1); - SpecParameter<?> firstInput = inputs.get(0); - assertEquals(firstInput.getLabel(), "metaSimple"); - } - - @Test(dataProvider="brooklynTypes") - public void testDepentantCatalogsInheritParameters(Class<? extends BrooklynObject> type) { - if (type == ConfigLocationForTest.class) { - //TODO - throw new SkipException("Locations don't inherit parameters, should migrate to the type registry first"); - } - addCatalogItems( - "brooklyn.catalog:", - " version: " + TEST_VERSION, - " items:", - " - id: paramItem", - " item:", - " type: " + type.getName(), - " brooklyn.parameters:", - " - simple", - " - id: " + SYMBOLIC_NAME, - " item:", - " type: paramItem:" + TEST_VERSION); - - CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); - List<SpecParameter<?>> inputs = item.getParameters(); - assertEquals(inputs.size(), 1); - SpecParameter<?> firstInput = inputs.get(0); - assertEquals(firstInput.getLabel(), "simple"); - } - - @Test(dataProvider="brooklynTypes") - public void testDepentantCatalogsOverrideParameters(Class<? extends BrooklynObject> type) { - addCatalogItems( - "brooklyn.catalog:", - " version: " + TEST_VERSION, - " items:", - " - id: paramItem", - " item:", - " type: " + type.getName(), - " brooklyn.parameters:", - " - simple", - " - id: " + SYMBOLIC_NAME, - " item:", - " type: paramItem:" + TEST_VERSION, - " brooklyn.parameters:", - " - override"); - - CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); - List<SpecParameter<?>> inputs = item.getParameters(); - assertEquals(inputs.size(), 1); - SpecParameter<?> firstInput = inputs.get(0); - assertEquals(firstInput.getLabel(), "override"); - } - - @Test - public void testChildEntitiyHasParameters() { - addCatalogItems( - "brooklyn.catalog:", - " id: " + SYMBOLIC_NAME, - " version: " + TEST_VERSION, - " items:", - " - item:", - " type: " + ConfigEntityForTest.class.getName(), - " brooklyn.children:", - " - type: " + ConfigEntityForTest.class.getName(), - " brooklyn.parameters:", - " - simple"); - - CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); - @SuppressWarnings({ "rawtypes", "unchecked"}) - EntitySpec<?> parentSpec = (EntitySpec<?>) catalog.createSpec((CatalogItem)item); - EntitySpec<?> spec = parentSpec.getChildren().get(0); - SpecParameter<?> firstInput = spec.getParameters().get(0); - assertEquals(firstInput.getLabel(), "simple"); - } - - @Test - public void testAppSpecInheritsCatalogParameters() { - addCatalogItems( - "brooklyn.catalog:", - " version: " + TEST_VERSION, - " items:", - " - id: " + SYMBOLIC_NAME, - " item:", - " type: " + BasicApplication.class.getName(), - " brooklyn.parameters:", - " - simple"); - - EntitySpec<? extends Application> spec = EntityManagementUtils.createEntitySpecForApplication(mgmt(), joinLines( - "services:", - "- type: " + ver(SYMBOLIC_NAME))); - List<SpecParameter<?>> params = spec.getParameters(); - assertEquals(params.size(), 1); - SpecParameter<?> firstInput = params.get(0); - assertEquals(firstInput.getLabel(), "simple"); - } - - @Test - public void testParametersCoercedOnSetAndReferences() throws Exception { - Integer testValue = Integer.valueOf(55); - addCatalogItems( - "brooklyn.catalog:", - " id: " + SYMBOLIC_NAME, - " version: " + TEST_VERSION, - " brooklyn.parameters:", - " - name: num", - " type: integer", - " item:", - " type: " + BasicApplication.class.getName(), - " brooklyn.children:", - " - type: " + ConfigEntityForTest.class.getName(), - " brooklyn.config:", - " refConfig: $brooklyn:scopeRoot().config(\"num\")", - " - type: " + ConfigEntityForTest.class.getName(), - " brooklyn.config:", - " refConfig: $brooklyn:config(\"num\")"); //inherited config - - Entity app = createAndStartApplication( - "services:", - "- type: " + BasicApplication.class.getName(), - " brooklyn.children:", - " - type: " + ver(SYMBOLIC_NAME), - " brooklyn.config:", - " num: \"" + testValue + "\""); - - Entity scopeRoot = Iterables.getOnlyElement(app.getChildren()); - - ConfigKey<Object> numKey = ConfigKeys.newConfigKey(Object.class, "num"); - assertEquals(scopeRoot.config().get(numKey), testValue); - - ConfigKey<Object> refConfigKey = ConfigKeys.newConfigKey(Object.class, "refConfig"); - - Iterator<Entity> childIter = scopeRoot.getChildren().iterator(); - Entity c1 = childIter.next(); - assertEquals(c1.config().get(refConfigKey), testValue); - Entity c2 = childIter.next(); - assertEquals(c2.config().get(refConfigKey), testValue); - assertFalse(childIter.hasNext()); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java ---------------------------------------------------------------------- diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java new file mode 100644 index 0000000..022a216 --- /dev/null +++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterParsingTest.java @@ -0,0 +1,140 @@ +/* + * 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.catalog; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; +import static org.testng.Assert.assertTrue; + +import java.util.List; + +import org.apache.brooklyn.api.catalog.CatalogItem; +import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; +import org.apache.brooklyn.api.objs.SpecParameter; +import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest; +import org.apache.brooklyn.core.catalog.internal.CatalogUtils; +import org.apache.brooklyn.entity.stock.BasicApplication; +import org.apache.brooklyn.test.support.TestResourceUnavailableException; +import org.apache.brooklyn.util.osgi.OsgiTestResources; +import org.testng.annotations.Test; + +import com.google.common.base.Joiner; +import com.google.common.collect.Iterables; +import com.google.common.reflect.TypeToken; + +public class SpecParameterParsingTest extends AbstractYamlTest { + + @Test + public void testYamlInputsParsed() { + CatalogItem<?, ?> item = add( + "brooklyn.catalog:", + " id: test.inputs", + " version: 0.0.1", + " item: ", + " type: "+ BasicApplication.class.getName(), + " brooklyn.parameters:", + " - simple", + " - name: explicit_name", + " - name: third_input", + " type: integer"); + AbstractBrooklynObjectSpec<?,?> spec = createSpec(item); + List<SpecParameter<?>> inputs = spec.getParameters(); + assertEquals(inputs.size(), 3); + SpecParameter<?> firstInput = inputs.get(0); + assertEquals(firstInput.getLabel(), "simple"); + assertEquals(firstInput.isPinned(), true); + assertEquals(firstInput.getType().getName(), "simple"); + assertEquals(firstInput.getType().getTypeToken(), TypeToken.of(String.class)); + + SpecParameter<?> secondInput = inputs.get(1); + assertEquals(secondInput.getLabel(), "explicit_name"); + assertEquals(secondInput.isPinned(), true); + assertEquals(secondInput.getType().getName(), "explicit_name"); + assertEquals(secondInput.getType().getTypeToken(), TypeToken.of(String.class)); + + SpecParameter<?> thirdInput = inputs.get(2); + assertEquals(thirdInput.getLabel(), "third_input"); + assertEquals(thirdInput.isPinned(), true); + assertEquals(thirdInput.getType().getName(), "third_input"); + assertEquals(thirdInput.getType().getTypeToken(), TypeToken.of(Integer.class)); + } + + @Test + public void testOsgiType() { + TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH); + + CatalogItem<?, ?> item = add( + "brooklyn.catalog:", + " id: test.inputs", + " version: 0.0.1", + " libraries:", + " - classpath://" + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH, + " item: ", + " type: "+ BasicApplication.class.getName(), + " brooklyn.parameters:", + " - name: simple", + " type: " + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY); + AbstractBrooklynObjectSpec<?,?> spec = createSpec(item); + List<SpecParameter<?>> inputs = spec.getParameters(); + assertEquals(inputs.size(), 1); + SpecParameter<?> firstInput = inputs.get(0); + assertEquals(firstInput.getLabel(), "simple"); + assertTrue(firstInput.isPinned()); + assertEquals(firstInput.getType().getName(), "simple"); + assertEquals(firstInput.getType().getTypeToken().getRawType().getName(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY); + } + + @Test + public void testOsgiClassScanned() { + TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH); + TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_MORE_ENTITIES_V2_PATH); + + addMulti("brooklyn.catalog:", + " items:", + " - scanJavaAnnotations: true", + " version: 2.0.test_java", + " libraries:", + " - classpath://" + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH, + " - classpath://" + OsgiTestResources.BROOKLYN_TEST_MORE_ENTITIES_V2_PATH); + + CatalogItem<?, ?> item = CatalogUtils.getCatalogItemOptionalVersion(mgmt(), OsgiTestResources.BROOKLYN_TEST_MORE_ENTITIES_MORE_ENTITY); + assertEquals(item.getVersion(), "2.0.test_java"); + assertEquals(item.getLibraries().size(), 2); + AbstractBrooklynObjectSpec<?,?> spec = createSpec(item); + List<SpecParameter<?>> inputs = spec.getParameters(); + SpecParameter<?> input = inputs.get(0); + assertEquals(input.getLabel(), "more_config"); + assertFalse(input.isPinned()); + assertEquals(input.getType().getName(), "more_config"); + } + + private CatalogItem<?,?> add(String... def) { + return Iterables.getOnlyElement(addMulti(def)); + } + + private Iterable<? extends CatalogItem<?, ?>> addMulti(String... def) { + return catalog.addItems(Joiner.on('\n').join(def)); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + private AbstractBrooklynObjectSpec<?, ?> createSpec(CatalogItem<?, ?> item) { + return (AbstractBrooklynObjectSpec<?,?>) catalog.createSpec((CatalogItem)item); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java ---------------------------------------------------------------------- diff --git a/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java new file mode 100644 index 0000000..1f7ba48 --- /dev/null +++ b/usage/camp/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java @@ -0,0 +1,379 @@ +/* + * 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.catalog; + +import static org.testng.Assert.assertEquals; +import static org.testng.Assert.assertFalse; + +import java.util.Iterator; +import java.util.List; + +import org.apache.brooklyn.api.catalog.CatalogItem; +import org.apache.brooklyn.api.entity.Application; +import org.apache.brooklyn.api.entity.Entity; +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.api.internal.AbstractBrooklynObjectSpec; +import org.apache.brooklyn.api.objs.BrooklynObject; +import org.apache.brooklyn.api.objs.SpecParameter; +import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest; +import org.apache.brooklyn.config.ConfigKey; +import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.entity.AbstractApplication; +import org.apache.brooklyn.core.entity.AbstractEntity; +import org.apache.brooklyn.core.location.AbstractLocation; +import org.apache.brooklyn.core.mgmt.EntityManagementUtils; +import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext; +import org.apache.brooklyn.core.objs.BasicSpecParameter; +import org.apache.brooklyn.core.policy.AbstractPolicy; +import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests; +import org.apache.brooklyn.entity.stock.BasicApplication; +import org.testng.SkipException; +import org.testng.annotations.DataProvider; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableSet; +import com.google.common.collect.Iterables; + +public class SpecParameterUnwrappingTest extends AbstractYamlTest { + private static final String SYMBOLIC_NAME = "my.catalog.app.id.load"; + + private static final ConfigKey<String> SHARED_CONFIG = ConfigKeys.newStringConfigKey("sample.config"); + public static class ConfigAppForTest extends AbstractApplication { + public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG; + } + public static class ConfigEntityForTest extends AbstractEntity { + public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG; + } + public static class ConfigPolicyForTest extends AbstractPolicy { + public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG; + } + public static class ConfigLocationForTest extends AbstractLocation { + public static final ConfigKey<String> SAMPLE_CONFIG = SHARED_CONFIG; + } + + @Override + protected LocalManagementContext newTestManagementContext() { + // Don't need OSGi + return LocalManagementContextForTests.newInstance(); + } + + @DataProvider(name="brooklynTypes") + public Object[][] brooklynTypes() { + return new Object[][] { + {ConfigEntityForTest.class}, + {ConfigPolicyForTest.class}, + {ConfigLocationForTest.class}}; + } + + @Test(dataProvider = "brooklynTypes") + public void testParameters(Class<? extends BrooklynObject> testClass) { + addCatalogItems("brooklyn.catalog:", + " id: " + SYMBOLIC_NAME, + " version: " + TEST_VERSION, + " item:", + " type: " + testClass.getName(), + " brooklyn.parameters:", + " - simple"); + + ConfigKey<String> SIMPLE_CONFIG = ConfigKeys.newStringConfigKey("simple"); + SpecParameter<String> SIMPLE_PARAM = new BasicSpecParameter<>("simple", true, SIMPLE_CONFIG); + CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); + AbstractBrooklynObjectSpec<?,?> spec = createSpec(item); + assertEquals(ImmutableSet.copyOf(spec.getParameters()), ImmutableList.of(SIMPLE_PARAM)); + } + + @Test(dataProvider = "brooklynTypes") + public void testDefaultParameters(Class<? extends BrooklynObject> testClass) { + addCatalogItems( + "brooklyn.catalog:", + " id: " + SYMBOLIC_NAME, + " version: " + TEST_VERSION, + " item:", + " type: "+ testClass.getName()); + + CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); + AbstractBrooklynObjectSpec<?, ?> spec = createSpec(item); + assertEquals(ImmutableSet.copyOf(spec.getParameters()), ImmutableSet.copyOf(BasicSpecParameter.fromClass(mgmt(),testClass))); + } + + @Test + public void testRootParametersUnwrapped() { + addCatalogItems( + "brooklyn.catalog:", + " id: " + SYMBOLIC_NAME, + " version: " + TEST_VERSION, + " item:", + " services:", + " - type: " + ConfigEntityForTest.class.getName(), + " brooklyn.parameters:", + " - simple"); + + CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); + AbstractBrooklynObjectSpec<?,?> spec = createSpec(item); + List<SpecParameter<?>> inputs = spec.getParameters(); + assertEquals(inputs.size(), 1); + SpecParameter<?> firstInput = inputs.get(0); + assertEquals(firstInput.getLabel(), "simple"); + } + + @Test(dataProvider="brooklynTypes") + public void testDepentantCatalogsInheritParameters(Class<? extends BrooklynObject> type) { + if (type == ConfigLocationForTest.class) { + //TODO + throw new SkipException("Locations don't inherit parameters, should migrate to the type registry first"); + } + addCatalogItems( + "brooklyn.catalog:", + " version: " + TEST_VERSION, + " items:", + " - id: paramItem", + " item:", + " type: " + type.getName(), + " brooklyn.parameters:", + " - simple", + " - id: " + SYMBOLIC_NAME, + " item:", + " type: paramItem:" + TEST_VERSION); + + CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); + AbstractBrooklynObjectSpec<?,?> spec = createSpec(item); + List<SpecParameter<?>> inputs = spec.getParameters(); + assertEquals(inputs.size(), 1); + SpecParameter<?> firstInput = inputs.get(0); + assertEquals(firstInput.getLabel(), "simple"); + } + + @Test(dataProvider="brooklynTypes") + public void testDepentantCatalogsOverrideParameters(Class<? extends BrooklynObject> type) { + addCatalogItems( + "brooklyn.catalog:", + " version: " + TEST_VERSION, + " items:", + " - id: paramItem", + " item:", + " type: " + type.getName(), + " brooklyn.parameters:", + " - simple", + " - id: " + SYMBOLIC_NAME, + " item:", + // Don't set explicit version, not supported by locations + " type: paramItem", + " brooklyn.parameters:", + " - override"); + + CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); + AbstractBrooklynObjectSpec<?,?> spec = createSpec(item); + List<SpecParameter<?>> inputs = spec.getParameters(); + assertEquals(inputs.size(), 1); + SpecParameter<?> firstInput = inputs.get(0); + assertEquals(firstInput.getLabel(), "override"); + } + + @Test + public void testChildEntitiyHasParameters() { + addCatalogItems( + "brooklyn.catalog:", + " id: " + SYMBOLIC_NAME, + " version: " + TEST_VERSION, + " items:", + " - item:", + " type: " + ConfigEntityForTest.class.getName(), + " brooklyn.children:", + " - type: " + ConfigEntityForTest.class.getName(), + " brooklyn.parameters:", + " - simple"); + + CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION); + @SuppressWarnings({ "rawtypes", "unchecked"}) + EntitySpec<?> parentSpec = (EntitySpec<?>) catalog.createSpec((CatalogItem)item); + EntitySpec<?> spec = parentSpec.getChildren().get(0); + SpecParameter<?> firstInput = spec.getParameters().get(0); + assertEquals(firstInput.getLabel(), "simple"); + } + + @Test + public void testAppSpecInheritsCatalogParameters() { + addCatalogItems( + "brooklyn.catalog:", + " version: " + TEST_VERSION, + " items:", + " - id: " + SYMBOLIC_NAME, + " item:", + " type: " + BasicApplication.class.getName(), + " brooklyn.parameters:", + " - simple"); + + EntitySpec<? extends Application> spec = createAppSpec( + "services:", + "- type: " + ver(SYMBOLIC_NAME)); + List<SpecParameter<?>> params = spec.getParameters(); + assertEquals(params.size(), 1); + SpecParameter<?> firstInput = params.get(0); + assertEquals(firstInput.getLabel(), "simple"); + } + + + @Test + public void testAppSpecInheritsCatalogRootParameters() { + addCatalogItems( + "brooklyn.catalog:", + " version: " + TEST_VERSION, + " items:", + " - id: " + SYMBOLIC_NAME, + " item:", + " type: " + BasicApplication.class.getName(), + " brooklyn.parameters:", + " - simple"); + + EntitySpec<? extends Application> spec = createAppSpec( + "services:", + "- type: " + ver(SYMBOLIC_NAME)); + List<SpecParameter<?>> params = spec.getParameters(); + assertEquals(params.size(), 1); + SpecParameter<?> firstInput = params.get(0); + assertEquals(firstInput.getLabel(), "simple"); + } + + @Test + public void testAppSpecInheritsCatalogRootParametersWithServices() { + addCatalogItems( + "brooklyn.catalog:", + " version: " + TEST_VERSION, + " items:", + " - id: " + SYMBOLIC_NAME, + " item:", + " brooklyn.parameters:", + " - simple", + " services:", + " - type: " + BasicApplication.class.getName()); + + EntitySpec<? extends Application> spec = createAppSpec( + "services:", + "- type: " + ver(SYMBOLIC_NAME)); + List<SpecParameter<?>> params = spec.getParameters(); + assertEquals(params.size(), 1); + SpecParameter<?> firstInput = params.get(0); + assertEquals(firstInput.getLabel(), "simple"); + } + + @Test + public void testUnresolvedCatalogItemParameters() { + // Insert template which is not instantiatable during catalog addition due to + // missing dependencies, but the spec can be created (the + // dependencies are already parsed). + addCatalogItems( + "brooklyn.catalog:", + " version: " + TEST_VERSION, + " items:", + " - id: " + SYMBOLIC_NAME, + " itemType: template", + " item:", + " services:", + " - type: basic-app", + " - id: basic-app", + " item:", + " type: " + ConfigAppForTest.class.getName()); + EntitySpec<? extends Application> spec = createAppSpec( + "services:", + "- type: " + ver(SYMBOLIC_NAME)); + List<SpecParameter<?>> params = spec.getParameters(); + assertEquals(params.size(), 2); // sample + defaultDisplayName + assertEquals(ImmutableSet.copyOf(params), ImmutableSet.copyOf(BasicSpecParameter.fromClass(mgmt(), ConfigAppForTest.class))); + } + + @Test + public void testParametersCoercedOnSetAndReferences() throws Exception { + Integer testValue = Integer.valueOf(55); + addCatalogItems( + "brooklyn.catalog:", + " id: " + SYMBOLIC_NAME, + " version: " + TEST_VERSION, + " item:", + " type: " + BasicApplication.class.getName(), + " brooklyn.parameters:", + " - name: num", + " type: integer", + " brooklyn.children:", + " - type: " + ConfigEntityForTest.class.getName(), + " brooklyn.config:", + " refConfig: $brooklyn:scopeRoot().config(\"num\")", + " - type: " + ConfigEntityForTest.class.getName(), + " brooklyn.config:", + " refConfig: $brooklyn:config(\"num\")"); //inherited config + + Entity app = createAndStartApplication( + "services:", + "- type: " + BasicApplication.class.getName(), + " brooklyn.children:", + " - type: " + ver(SYMBOLIC_NAME), + " brooklyn.config:", + " num: \"" + testValue + "\""); + + Entity scopeRoot = Iterables.getOnlyElement(app.getChildren()); + + ConfigKey<Object> numKey = ConfigKeys.newConfigKey(Object.class, "num"); + assertEquals(scopeRoot.config().get(numKey), testValue); + + ConfigKey<Object> refConfigKey = ConfigKeys.newConfigKey(Object.class, "refConfig"); + + Iterator<Entity> childIter = scopeRoot.getChildren().iterator(); + Entity c1 = childIter.next(); + assertEquals(c1.config().get(refConfigKey), testValue); + Entity c2 = childIter.next(); + assertEquals(c2.config().get(refConfigKey), testValue); + assertFalse(childIter.hasNext()); + } + + @Test + public void testAppRootParameters() throws Exception { + EntitySpec<? extends Application> spec = createAppSpec( + "brooklyn.parameters:", + "- simple", + "services:", + "- type: " + BasicApplication.class.getName()); + List<SpecParameter<?>> inputs = spec.getParameters(); + assertEquals(inputs.size(), 1); + SpecParameter<?> firstInput = inputs.get(0); + assertEquals(firstInput.getLabel(), "simple"); + } + + @Test + public void testAppServiceParameters() throws Exception { + EntitySpec<? extends Application> spec = createAppSpec( + "services:", + "- type: " + BasicApplication.class.getName(), + " brooklyn.parameters:", + " - simple"); + List<SpecParameter<?>> inputs = spec.getParameters(); + assertEquals(inputs.size(), 1); + SpecParameter<?> firstInput = inputs.get(0); + assertEquals(firstInput.getLabel(), "simple"); + } + + @SuppressWarnings({"unchecked", "rawtypes"}) + private AbstractBrooklynObjectSpec<?, ?> createSpec(CatalogItem<?, ?> item) { + return (AbstractBrooklynObjectSpec<?,?>) catalog.createSpec((CatalogItem)item); + } + + private EntitySpec<? extends Application> createAppSpec(String... lines) { + return EntityManagementUtils.createEntitySpecForApplication(mgmt(), joinLines(lines)); + } + +} http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/usage/rest-server/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java ---------------------------------------------------------------------- diff --git a/usage/rest-server/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java b/usage/rest-server/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java index 58bc473..a003c70 100644 --- a/usage/rest-server/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java +++ b/usage/rest-server/src/main/java/org/apache/brooklyn/rest/transform/CatalogTransformer.java @@ -63,15 +63,14 @@ public class CatalogTransformer { Set<SensorSummary> sensors = Sets.newTreeSet(SummaryComparators.nameComparator()); Set<EffectorSummary> effectors = Sets.newTreeSet(SummaryComparators.nameComparator()); - for (SpecParameter<?> input: item.getParameters()) - config.add(EntityTransformer.entityConfigSummary(input)); - try { @SuppressWarnings({ "unchecked", "rawtypes" }) EntitySpec<?> spec = (EntitySpec<?>) b.getCatalog().createSpec((CatalogItem) item); EntityDynamicType typeMap = BrooklynTypes.getDefinedEntityType(spec.getType()); EntityType type = typeMap.getSnapshot(); + for (SpecParameter<?> input: spec.getParameters()) + config.add(EntityTransformer.entityConfigSummary(input)); for (Sensor<?> x: type.getSensors()) sensors.add(SensorTransformer.sensorSummaryForCatalog(x)); for (Effector<?> x: type.getEffectors()) http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/utils/rt-osgi/src/test/dependencies/osgi/more-entities-v2-evil-twin/pom.xml ---------------------------------------------------------------------- diff --git a/utils/rt-osgi/src/test/dependencies/osgi/more-entities-v2-evil-twin/pom.xml b/utils/rt-osgi/src/test/dependencies/osgi/more-entities-v2-evil-twin/pom.xml index d9a3e79..ae70461 100644 --- a/utils/rt-osgi/src/test/dependencies/osgi/more-entities-v2-evil-twin/pom.xml +++ b/utils/rt-osgi/src/test/dependencies/osgi/more-entities-v2-evil-twin/pom.xml @@ -69,7 +69,7 @@ <version>2.3.2</version> <configuration> <outputDirectory>../../../resources/brooklyn/osgi</outputDirectory> - <finalName>brooklyn-test-osgi-more-entities_${project.version}</finalName> + <finalName>brooklyn-test-osgi-more-entities_evil-twin_${project.version}</finalName> </configuration> </plugin> <plugin> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/utils/rt-osgi/src/test/dependencies/osgi/more-entities-v2/pom.xml ---------------------------------------------------------------------- diff --git a/utils/rt-osgi/src/test/dependencies/osgi/more-entities-v2/pom.xml b/utils/rt-osgi/src/test/dependencies/osgi/more-entities-v2/pom.xml index ae70461..c8ecbd1 100644 --- a/utils/rt-osgi/src/test/dependencies/osgi/more-entities-v2/pom.xml +++ b/utils/rt-osgi/src/test/dependencies/osgi/more-entities-v2/pom.xml @@ -22,7 +22,7 @@ <modelVersion>4.0.0</modelVersion> <packaging>jar</packaging> - <groupId>org.apache.brooklyn.test.resources.osgi.evil_twin</groupId> + <groupId>org.apache.brooklyn.test.resources.osgi</groupId> <artifactId>brooklyn-test-osgi-more-entities</artifactId> <version>0.2.0</version> @@ -69,7 +69,7 @@ <version>2.3.2</version> <configuration> <outputDirectory>../../../resources/brooklyn/osgi</outputDirectory> - <finalName>brooklyn-test-osgi-more-entities_evil-twin_${project.version}</finalName> + <finalName>brooklyn-test-osgi-more-entities_${project.version}</finalName> </configuration> </plugin> <plugin> http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar ---------------------------------------------------------------------- diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar index c03ad4a..4de9b94 100644 Binary files a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar and b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar differ http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/3edbaa98/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar ---------------------------------------------------------------------- diff --git a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar index 95d697b..2c0e3a6 100644 Binary files a/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar and b/utils/rt-osgi/src/test/resources/brooklyn/osgi/brooklyn-test-osgi-more-entities_evil-twin_0.2.0.jar differ
