brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [36/51] [abbrv] [partial] brooklyn-server git commit: move subdir from incubator up a level as it is promoted to its own repo (first non-incubator commit!)
Date Mon, 01 Feb 2016 17:51:18 GMT
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
deleted file mode 100644
index 40fd757..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
+++ /dev/null
@@ -1,331 +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.spi.dsl.methods;
-
-import java.util.NoSuchElementException;
-import java.util.Set;
-import java.util.concurrent.Callable;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.api.sensor.AttributeSensor;
-import org.apache.brooklyn.api.sensor.Sensor;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
-import org.apache.brooklyn.camp.brooklyn.spi.dsl.BrooklynDslDeferredSupplier;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.EntityInternal;
-import org.apache.brooklyn.core.entity.EntityPredicates;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.EntityManagerInternal;
-import org.apache.brooklyn.core.sensor.DependentConfiguration;
-import org.apache.brooklyn.core.sensor.Sensors;
-import org.apache.brooklyn.util.core.task.TaskBuilder;
-import org.apache.brooklyn.util.core.task.Tasks;
-import org.apache.brooklyn.util.guava.Maybe;
-import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
-
-import com.google.common.base.Optional;
-import com.google.common.base.Preconditions;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Iterables;
-
-public class DslComponent extends BrooklynDslDeferredSupplier<Entity> {
-
-    private static final long serialVersionUID = -7715984495268724954L;
-    
-    private final String componentId;
-    private final DslComponent scopeComponent;
-    private final Scope scope;
-
-    public DslComponent(String componentId) {
-        this(Scope.GLOBAL, componentId);
-    }
-    
-    public DslComponent(Scope scope, String componentId) {
-        this(null, scope, componentId);
-    }
-    
-    public DslComponent(DslComponent scopeComponent, Scope scope, String componentId) {
-        Preconditions.checkNotNull(scope, "scope");
-        this.scopeComponent = scopeComponent;
-        this.componentId = componentId;
-        this.scope = scope;
-    }
-
-    // ---------------------------
-    
-    @Override
-    public Task<Entity> newTask() {
-        return TaskBuilder.<Entity>builder().displayName(toString()).tag(BrooklynTaskTags.TRANSIENT_TASK_TAG)
-            .body(new EntityInScopeFinder(scopeComponent, scope, componentId)).build();
-    }
-    
-    protected static class EntityInScopeFinder implements Callable<Entity> {
-        protected final DslComponent scopeComponent;
-        protected final Scope scope;
-        protected final String componentId;
-
-        public EntityInScopeFinder(DslComponent scopeComponent, Scope scope, String componentId) {
-            this.scopeComponent = scopeComponent;
-            this.scope = scope;
-            this.componentId = componentId;
-        }
-
-        protected EntityInternal getEntity() {
-            if (scopeComponent!=null) {
-                return (EntityInternal)scopeComponent.get();
-            } else {
-                return entity();
-            }
-        }
-        
-        @Override
-        public Entity call() throws Exception {
-            Iterable<Entity> entitiesToSearch = null;
-            switch (scope) {
-                case THIS:
-                    return getEntity();
-                case PARENT:
-                    return getEntity().getParent();
-                case GLOBAL:
-                    entitiesToSearch = ((EntityManagerInternal)getEntity().getManagementContext().getEntityManager())
-                        .getAllEntitiesInApplication( entity().getApplication() );
-                    break;
-                case ROOT:
-                    return getEntity().getApplication();
-                case SCOPE_ROOT:
-                    return Entities.catalogItemScopeRoot(getEntity());
-                case DESCENDANT:
-                    entitiesToSearch = Entities.descendants(getEntity());
-                    break;
-                case ANCESTOR:
-                    entitiesToSearch = Entities.ancestors(getEntity());
-                    break;
-                case SIBLING:
-                    entitiesToSearch = getEntity().getParent().getChildren();
-                    break;
-                case CHILD:
-                    entitiesToSearch = getEntity().getChildren();
-                    break;
-                default:
-                    throw new IllegalStateException("Unexpected scope "+scope);
-            }
-            
-            Optional<Entity> result = Iterables.tryFind(entitiesToSearch, EntityPredicates.configEqualTo(BrooklynCampConstants.PLAN_ID, componentId));
-            
-            if (result.isPresent())
-                return result.get();
-            
-            // TODO may want to block and repeat on new entities joining?
-            throw new NoSuchElementException("No entity matching id " + componentId+
-                (scope==Scope.GLOBAL ? "" : ", in scope "+scope+" wrt "+getEntity()+
-                (scopeComponent!=null ? " ("+scopeComponent+" from "+entity()+")" : "")));
-        }        
-    }
-    
-    // -------------------------------
-
-    // DSL words which move to a new component
-    
-    public DslComponent entity(String scopeOrId) {
-        return new DslComponent(this, Scope.GLOBAL, scopeOrId);
-    }
-    public DslComponent child(String scopeOrId) {
-        return new DslComponent(this, Scope.CHILD, scopeOrId);
-    }
-    public DslComponent sibling(String scopeOrId) {
-        return new DslComponent(this, Scope.SIBLING, scopeOrId);
-    }
-    public DslComponent descendant(String scopeOrId) {
-        return new DslComponent(this, Scope.DESCENDANT, scopeOrId);
-    }
-    public DslComponent ancestor(String scopeOrId) {
-        return new DslComponent(this, Scope.ANCESTOR, scopeOrId);
-    }
-    public DslComponent root() {
-        return new DslComponent(this, Scope.ROOT, "");
-    }
-    public DslComponent scopeRoot() {
-        return new DslComponent(this, Scope.SCOPE_ROOT, "");
-    }
-    
-    @Deprecated /** @deprecated since 0.7.0 */
-    public DslComponent component(String scopeOrId) {
-        return new DslComponent(this, Scope.GLOBAL, scopeOrId);
-    }
-    
-    public DslComponent parent() {
-        return new DslComponent(this, Scope.PARENT, "");
-    }
-    
-    public DslComponent component(String scope, String id) {
-        if (!DslComponent.Scope.isValid(scope)) {
-            throw new IllegalArgumentException(scope + " is not a vlaid scope");
-        }
-        return new DslComponent(this, DslComponent.Scope.fromString(scope), id);
-    }
-
-    // DSL words which return things
-    
-    public BrooklynDslDeferredSupplier<?> attributeWhenReady(final String sensorName) {
-        return new AttributeWhenReady(this, sensorName);
-    }
-    // class simply makes the memento XML files nicer
-    protected static class AttributeWhenReady extends BrooklynDslDeferredSupplier<Object> {
-        private static final long serialVersionUID = 1740899524088902383L;
-        private final DslComponent component;
-        private final String sensorName;
-        public AttributeWhenReady(DslComponent component, String sensorName) {
-            this.component = Preconditions.checkNotNull(component);
-            this.sensorName = sensorName;
-        }
-        @SuppressWarnings("unchecked")
-        @Override
-        public Task<Object> newTask() {
-            Entity targetEntity = component.get();
-            Sensor<?> targetSensor = targetEntity.getEntityType().getSensor(sensorName);
-            if (!(targetSensor instanceof AttributeSensor<?>)) {
-                targetSensor = Sensors.newSensor(Object.class, sensorName);
-            }
-            return (Task<Object>) DependentConfiguration.attributeWhenReady(targetEntity, (AttributeSensor<?>)targetSensor);
-        }
-        @Override
-        public String toString() {
-            return (component.scope==Scope.THIS ? "" : component.toString()+".") +
-                "attributeWhenReady("+JavaStringEscapes.wrapJavaString(sensorName)+")";
-        }
-    }
-
-    public BrooklynDslDeferredSupplier<?> config(final String keyName) {
-        return new DslConfigSupplier(this, keyName);
-    }
-    protected final static class DslConfigSupplier extends BrooklynDslDeferredSupplier<Object> {
-        private final DslComponent component;
-        private final String keyName;
-        private static final long serialVersionUID = -4735177561947722511L;
-
-        public DslConfigSupplier(DslComponent component, String keyName) {
-            this.component = Preconditions.checkNotNull(component);
-            this.keyName = keyName;
-        }
-
-        @Override
-        public Task<Object> newTask() {
-            return Tasks.builder().displayName("retrieving config for "+keyName).tag(BrooklynTaskTags.TRANSIENT_TASK_TAG).dynamic(false).body(new Callable<Object>() {
-                @Override
-                public Object call() throws Exception {
-                    Entity targetEntity = component.get();
-                    return targetEntity.getConfig(ConfigKeys.newConfigKey(Object.class, keyName));
-                }
-            }).build();
-        }
-
-        @Override
-        public String toString() {
-            return (component.scope==Scope.THIS ? "" : component.toString()+".") + 
-                "config("+JavaStringEscapes.wrapJavaString(keyName)+")";
-        }
-    }
-    
-    public BrooklynDslDeferredSupplier<Sensor<?>> sensor(final String sensorName) {
-        return new DslSensorSupplier(this, sensorName);
-    }
-    protected final static class DslSensorSupplier extends BrooklynDslDeferredSupplier<Sensor<?>> {
-        private final DslComponent component;
-        private final String sensorName;
-        private static final long serialVersionUID = -4735177561947722511L;
-
-        public DslSensorSupplier(DslComponent component, String sensorName) {
-            this.component = Preconditions.checkNotNull(component);
-            this.sensorName = sensorName;
-        }
-
-        @Override
-        public Task<Sensor<?>> newTask() {
-            return Tasks.<Sensor<?>>builder().displayName("looking up sensor for "+sensorName).dynamic(false).body(new Callable<Sensor<?>>() {
-                @Override
-                public Sensor<?> call() throws Exception {
-                    Entity targetEntity = component.get();
-                    Sensor<?> result = null;
-                    if (targetEntity!=null) {
-                        result = targetEntity.getEntityType().getSensor(sensorName);
-                    }
-                    if (result!=null) return result;
-                    return Sensors.newSensor(Object.class, sensorName);
-                }
-            }).build();
-        }
-
-        @Override
-        public String toString() {
-            return (component.scope==Scope.THIS ? "" : component.toString()+".") + 
-                "sensor("+JavaStringEscapes.wrapJavaString(sensorName)+")";
-        }
-    }
-
-    public static enum Scope {
-        GLOBAL ("global"),
-        CHILD ("child"),
-        PARENT ("parent"),
-        SIBLING ("sibling"),
-        DESCENDANT ("descendant"),
-        ANCESTOR("ancestor"),
-        ROOT("root"),
-        SCOPE_ROOT("scopeRoot"),
-        THIS ("this");
-        
-        public static final Set<Scope> VALUES = ImmutableSet.of(GLOBAL, CHILD, PARENT, SIBLING, DESCENDANT, ANCESTOR, ROOT, SCOPE_ROOT, THIS);
-        
-        private final String name;
-        
-        private Scope(String name) {
-            this.name = name;
-        }
-        
-        public static Scope fromString(String name) {
-            return tryFromString(name).get();
-        }
-        
-        public static Maybe<Scope> tryFromString(String name) {
-            for (Scope scope : VALUES)
-                if (scope.name.toLowerCase().equals(name.toLowerCase()))
-                    return Maybe.of(scope);
-            return Maybe.absent(new IllegalArgumentException(name + " is not a valid scope"));
-        }
-        
-        public static boolean isValid(String name) {
-            for (Scope scope : VALUES)
-                if (scope.name.toLowerCase().equals(name.toLowerCase()))
-                    return true;
-            return false;
-        }
-    }
-
-
-    @Override
-    public String toString() {
-        return "$brooklyn:entity("+
-            (scopeComponent==null ? "" : JavaStringEscapes.wrapJavaString(scopeComponent.toString())+", ")+
-            (scope==Scope.GLOBAL ? "" : JavaStringEscapes.wrapJavaString(scope.toString())+", ")+
-            JavaStringEscapes.wrapJavaString(componentId)+
-            ")";
-    }
-
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java
deleted file mode 100644
index 7b0f359..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/DslParser.java
+++ /dev/null
@@ -1,144 +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.spi.dsl.parse;
-
-import java.util.Collection;
-import java.util.List;
-
-import org.apache.brooklyn.util.collections.MutableList;
-
-public class DslParser {
-    private final String expression;
-    int index = -1;
-    
-    public DslParser(String expression) {
-        this.expression = expression;
-    }
-    
-    public synchronized Object parse() {
-        if (index>=0)
-            throw new IllegalStateException("Parser can only be used once");
-        
-        index++;
-        Object result = next();
-        
-        if (index < expression.length())
-            throw new IllegalStateException("Unexpected character at position "+index+" in "+expression);
-        
-        return result;
-    }
-    
-    @SuppressWarnings("unchecked")
-    public Object next() {
-        int start = index;
-        
-        skipWhitespace();
-        if (index >= expression.length())
-            throw new IllegalStateException("Unexpected end of expression to parse, looking for content since position "+start);
-        
-        if (expression.charAt(index)=='"') {
-            // assume a string
-            int stringStart = index;
-            index++;
-            do {
-                if (index >= expression.length())
-                    throw new IllegalStateException("Unexpected end of expression to parse, looking for close quote since position "+stringStart);
-                char c = expression.charAt(index);
-                if (c=='"') break;
-                if (c=='\\') index++;
-                index++;
-            } while (true);
-            index++;
-            return new QuotedString(expression.substring(stringStart, index));
-        }
-
-        // not a string, must be a function (or chain thereof)
-        List<FunctionWithArgs> result = new MutableList<FunctionWithArgs>();
-
-        int fnStart = index;
-        do {
-            if (index >= expression.length())
-                break;
-            char c = expression.charAt(index);
-            if (Character.isJavaIdentifierPart(c)) ;
-            // these chars also permitted
-            else if (".:".indexOf(c)>=0) ;
-            // other things e.g. whitespace, parentheses, etc, skip
-            else break;
-            index++;
-        } while (true);
-        String fn = expression.substring(fnStart, index);
-        if (fn.length()==0)
-            throw new IllegalStateException("Expected a function name at position "+start);
-        skipWhitespace();
-        
-        if (index < expression.length() && expression.charAt(index)=='(') {
-            // collect arguments
-            int parenStart = index;
-            List<Object> args = new MutableList<Object>();
-            index ++;
-            do {
-                skipWhitespace();
-                if (index >= expression.length())
-                    throw new IllegalStateException("Unexpected end of arguments to function '"+fn+"', no close parenthesis matching character at position "+parenStart);
-                char c = expression.charAt(index);
-                if (c==')') break;
-                if (c==',') {
-                    if (args.isEmpty())
-                        throw new IllegalStateException("Invalid character at position"+index);
-                    index++;
-                } else {
-                    if (!args.isEmpty())
-                        throw new IllegalStateException("Expected , before position"+index);
-                }
-                args.add(next());
-            } while (true);
-            result.add(new FunctionWithArgs(fn, args));
-            index++;
-            skipWhitespace();
-            if (index >= expression.length())
-                return result;
-            char c = expression.charAt(index);
-            if (c=='.') {
-                // chained expression
-                int chainStart = index;
-                index++;
-                Object next = next();
-                if (next instanceof List) {
-                    result.addAll((Collection<? extends FunctionWithArgs>) next);
-                    return result;
-                } else {
-                    throw new IllegalStateException("Expected functions following position"+chainStart);
-                }
-            } else {
-                // following word not something handled at this level; assume parent will handle (or throw) - e.g. a , or extra )
-                return result;
-            }
-        } else {
-            // it is just a word; return it with args as null
-            return new FunctionWithArgs(fn, null);
-        }
-    }
-
-    private void skipWhitespace() {
-        while (index<expression.length() && Character.isWhitespace(expression.charAt(index)))
-            index++;
-    }
-    
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/FunctionWithArgs.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/FunctionWithArgs.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/FunctionWithArgs.java
deleted file mode 100644
index 41bc837..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/FunctionWithArgs.java
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.camp.brooklyn.spi.dsl.parse;
-
-import java.util.List;
-
-import com.google.common.collect.ImmutableList;
-
-public class FunctionWithArgs {
-    private final String function;
-    private final List<Object> args;
-    
-    public FunctionWithArgs(String function, List<Object> args) {
-        this.function = function;
-        this.args = args==null ? null : ImmutableList.copyOf(args);
-    }
-    
-    public String getFunction() {
-        return function;
-    }
-    
-    /**
-     * arguments (typically {@link QuotedString} or more {@link FunctionWithArgs}).
-     * 
-     * null means it is a function in a map key which expects map value to be the arguments -- specified without parentheses;
-     * empty means parentheses already applied, with 0 args.
-     */
-    public List<Object> getArgs() {
-        return args;
-    }
-    
-    @Override
-    public String toString() {
-        return function+(args==null ? "" : args);
-    }
-
-    public Object arg(int i) {
-        return args.get(i);
-    }
-    
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/QuotedString.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/QuotedString.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/QuotedString.java
deleted file mode 100644
index cf1b67d..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/parse/QuotedString.java
+++ /dev/null
@@ -1,50 +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.spi.dsl.parse;
-
-import static com.google.common.base.Preconditions.checkNotNull;
-
-import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
-
-import com.google.common.base.Objects;
-
-public class QuotedString {
-    private final String s;
-    
-    public QuotedString(String s) {
-        this.s = checkNotNull(s, "string");
-    }
-    @Override
-    public String toString() {
-        return s;
-    }
-    public String unwrapped() {
-        return JavaStringEscapes.unwrapJavaString(s);
-    }
-    
-    @Override
-    public boolean equals(Object obj) {
-        return (obj instanceof QuotedString) && ((QuotedString)obj).toString().equals(toString());
-    }
-    
-    @Override
-    public int hashCode() {
-        return Objects.hashCode(s);
-    }
-}
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java
deleted file mode 100644
index b0514e6..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractBrooklynResourceLookup.java
+++ /dev/null
@@ -1,36 +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.spi.lookup;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.camp.spi.AbstractResource;
-import org.apache.brooklyn.camp.spi.PlatformRootSummary;
-import org.apache.brooklyn.camp.spi.collection.AbstractResourceLookup;
-
-public abstract class AbstractBrooklynResourceLookup<T extends AbstractResource>  extends AbstractResourceLookup<T> {
-
-    protected final PlatformRootSummary root;
-    protected final ManagementContext bmc;
-
-    public AbstractBrooklynResourceLookup(PlatformRootSummary root, ManagementContext bmc) {
-        this.root = root;
-        this.bmc = bmc;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java
deleted file mode 100644
index f038e0f..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AbstractTemplateBrooklynLookup.java
+++ /dev/null
@@ -1,56 +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.spi.lookup;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.spi.AbstractResource;
-import org.apache.brooklyn.camp.spi.PlatformRootSummary;
-import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public abstract class AbstractTemplateBrooklynLookup<T extends AbstractResource>  extends AbstractBrooklynResourceLookup<T> {
-
-    private static final Logger log = LoggerFactory.getLogger(AbstractTemplateBrooklynLookup.class);
-    
-    public AbstractTemplateBrooklynLookup(PlatformRootSummary root, ManagementContext bmc) {
-        super(root, bmc);
-    }
-
-    @Override
-    public T get(String id) {
-        RegisteredType item = bmc.getTypeRegistry().get(id);
-        if (item==null) {
-            log.warn("Could not find item '"+id+"' in Brooklyn catalog; returning null");
-            return null;
-        }
-        return adapt(item);
-    }
-
-    public abstract T adapt(RegisteredType item);
-
-    protected ResolvableLink<T> newLink(CatalogItem<? extends Entity,EntitySpec<?>> li) {
-        return newLink(li.getId(), li.getDisplayName());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java
deleted file mode 100644
index 1ab2585..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyBrooklynLookup.java
+++ /dev/null
@@ -1,68 +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.spi.lookup;
-
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.camp.spi.Assembly;
-import org.apache.brooklyn.camp.spi.PlatformRootSummary;
-import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
-
-
-public class AssemblyBrooklynLookup extends AbstractBrooklynResourceLookup<Assembly> {
-
-    private PlatformComponentBrooklynLookup pcs;
-
-    public AssemblyBrooklynLookup(PlatformRootSummary root, ManagementContext bmc, PlatformComponentBrooklynLookup pcs) {
-        super(root, bmc);
-        this.pcs = pcs;
-    }
-
-    @Override
-    public Assembly get(String id) {
-        Entity entity = bmc.getEntityManager().getEntity(id);
-        if (!(entity instanceof Application))
-            throw new IllegalArgumentException("Element for "+id+" is not an Application ("+entity+")");
-        Assembly.Builder<? extends Assembly> builder = Assembly.builder()
-                .created(new Date(entity.getCreationTime()))
-                .id(entity.getId())
-                .name(entity.getDisplayName());
-        
-        builder.customAttribute("externalManagementUri", BrooklynUrlLookup.getUrl(bmc, entity));
-        
-        for (Entity child: entity.getChildren())
-            // FIXME this walks the whole damn tree!
-            builder.add( pcs.get(child.getId() ));
-        return builder.build();
-    }
-
-    @Override
-    public List<ResolvableLink<Assembly>> links() {
-        List<ResolvableLink<Assembly>> result = new ArrayList<ResolvableLink<Assembly>>();
-        for (Application app: bmc.getApplications())
-            result.add(newLink(app.getId(), app.getDisplayName()));
-        return result;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java
deleted file mode 100644
index e30d9c6..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/AssemblyTemplateBrooklynLookup.java
+++ /dev/null
@@ -1,70 +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.spi.lookup;
-
-import java.util.ArrayList;
-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.mgmt.ManagementContext;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynAssemblyTemplateInstantiator;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.camp.spi.PlatformRootSummary;
-import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
-import org.apache.brooklyn.core.catalog.CatalogPredicates;
-
-public class AssemblyTemplateBrooklynLookup extends AbstractTemplateBrooklynLookup<AssemblyTemplate> {
-
-    public AssemblyTemplateBrooklynLookup(PlatformRootSummary root, ManagementContext bmc) {
-        super(root, bmc);
-    }
-
-    @Override
-    public AssemblyTemplate adapt(RegisteredType item) {
-        return AssemblyTemplate.builder().
-                name(item.getDisplayName()).
-                id(item.getId()).
-                description(item.getDescription()).
-                created(root.getCreated()).
-                instantiator(BrooklynAssemblyTemplateInstantiator.class).
-                build();
-    }
-
-    @SuppressWarnings({ "unchecked", "rawtypes" })
-    // why can I not pass an EntitySpec<? extends Application> to    newLink(EntitySpec<?> spec)  ?
-    // feels to me (alexheneveld) that `? extends Application` should be both covariant and contravariant to `?` ..
-    // but it's not, so we introduce this conversion method
-    protected ResolvableLink<AssemblyTemplate> newApplicationLink(CatalogItem<? extends Entity, EntitySpec<? extends Application>> li) {
-        return super.newLink((CatalogItem)li);
-    }
-    
-    @Override
-    public List<ResolvableLink<AssemblyTemplate>> links() {
-        Iterable<CatalogItem<Application,EntitySpec<? extends Application>>> l = bmc.getCatalog().getCatalogItems(CatalogPredicates.IS_TEMPLATE);
-        List<ResolvableLink<AssemblyTemplate>> result = new ArrayList<ResolvableLink<AssemblyTemplate>>();
-        for (CatalogItem<Application,EntitySpec<? extends Application>> li: l)
-            result.add(newApplicationLink(li));
-        return result;
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/BrooklynUrlLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/BrooklynUrlLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/BrooklynUrlLookup.java
deleted file mode 100644
index 97ad8cc..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/BrooklynUrlLookup.java
+++ /dev/null
@@ -1,38 +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.spi.lookup;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.config.ConfigKey;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.util.net.Urls;
-
-public class BrooklynUrlLookup {
-
-    public static ConfigKey<String> BROOKLYN_ROOT_URL = ConfigKeys.newStringConfigKey("brooklyn.root.url");
-    
-    public static String getUrl(ManagementContext bmc, Entity entity) {
-        String root = bmc.getConfig().getConfig(BROOKLYN_ROOT_URL);
-        if (root==null) return null;
-        return Urls.mergePaths(root, "#/", 
-                "/v1/applications/"+entity.getApplicationId()+"/entities/"+entity.getId());
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java
deleted file mode 100644
index 6705b10..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentBrooklynLookup.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.camp.brooklyn.spi.lookup;
-
-import java.util.Collections;
-import java.util.Date;
-import java.util.List;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.camp.spi.PlatformComponent;
-import org.apache.brooklyn.camp.spi.PlatformRootSummary;
-import org.apache.brooklyn.camp.spi.PlatformComponent.Builder;
-import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
-
-
-public class PlatformComponentBrooklynLookup extends AbstractBrooklynResourceLookup<PlatformComponent> {
-
-    public PlatformComponentBrooklynLookup(PlatformRootSummary root, ManagementContext bmc) {
-        super(root, bmc);
-    }
-
-    @Override
-    public PlatformComponent get(String id) {
-        Entity entity = bmc.getEntityManager().getEntity(id);
-        Builder<? extends PlatformComponent> builder = PlatformComponent.builder()
-            .created(new Date(entity.getCreationTime()))
-            .id(entity.getId())
-            .name(entity.getDisplayName())
-            .externalManagementUri(BrooklynUrlLookup.getUrl(bmc, entity));
-        
-        for (Entity child: entity.getChildren())
-            // FIXME this walks the whole damn tree!
-            builder.add( get(child.getId() ));
-        return builder.build();
-    }
-
-    // platform components are not listed at the top level -- you have to walk the assemblies
-    @Override
-    public List<ResolvableLink<PlatformComponent>> links() {
-        return Collections.emptyList();
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java
deleted file mode 100644
index d70129a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/lookup/PlatformComponentTemplateBrooklynLookup.java
+++ /dev/null
@@ -1,59 +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.spi.lookup;
-
-import java.util.ArrayList;
-import java.util.List;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
-import org.apache.brooklyn.camp.spi.PlatformRootSummary;
-import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
-import org.apache.brooklyn.core.catalog.CatalogPredicates;
-
-public class PlatformComponentTemplateBrooklynLookup extends AbstractTemplateBrooklynLookup<PlatformComponentTemplate> {
-
-    public PlatformComponentTemplateBrooklynLookup(PlatformRootSummary root, ManagementContext bmc) {
-        super(root, bmc);
-    }
-
-    @Override
-    public PlatformComponentTemplate adapt(RegisteredType item) {
-        return PlatformComponentTemplate.builder().
-                name(item.getDisplayName()).
-                id(item.getId()).
-                description(item.getDescription()).
-                created(root.getCreated()).
-                build();
-    }
-
-    @Override
-    public List<ResolvableLink<PlatformComponentTemplate>> links() {
-        Iterable<CatalogItem<Entity,EntitySpec<?>>> l = bmc.getCatalog().getCatalogItems(CatalogPredicates.IS_ENTITY);
-        List<ResolvableLink<PlatformComponentTemplate>> result = new ArrayList<ResolvableLink<PlatformComponentTemplate>>();
-        for (CatalogItem<Entity,EntitySpec<?>> li: l)
-            result.add(newLink(li));
-        return result;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java b/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
deleted file mode 100644
index 7135480..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/platform/BrooklynImmutableCampPlatform.java
+++ /dev/null
@@ -1,108 +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.spi.platform;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.camp.CampPlatform;
-import org.apache.brooklyn.camp.brooklyn.spi.lookup.AssemblyBrooklynLookup;
-import org.apache.brooklyn.camp.brooklyn.spi.lookup.AssemblyTemplateBrooklynLookup;
-import org.apache.brooklyn.camp.brooklyn.spi.lookup.PlatformComponentBrooklynLookup;
-import org.apache.brooklyn.camp.brooklyn.spi.lookup.PlatformComponentTemplateBrooklynLookup;
-import org.apache.brooklyn.camp.spi.ApplicationComponent;
-import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
-import org.apache.brooklyn.camp.spi.Assembly;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.camp.spi.PlatformComponent;
-import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
-import org.apache.brooklyn.camp.spi.PlatformRootSummary;
-import org.apache.brooklyn.camp.spi.PlatformTransaction;
-import org.apache.brooklyn.camp.spi.collection.BasicResourceLookup;
-import org.apache.brooklyn.camp.spi.collection.ResourceLookup;
-import org.apache.brooklyn.camp.spi.collection.ResourceLookup.EmptyResourceLookup;
-import org.apache.brooklyn.core.mgmt.HasBrooklynManagementContext;
-
-/** Immutable CAMP platform which reflects things in the underlying Brooklyn system */
-public class BrooklynImmutableCampPlatform extends CampPlatform implements HasBrooklynManagementContext {
-
-    private final ManagementContext bmc;
-    private final AssemblyTemplateBrooklynLookup ats;
-    private final PlatformComponentTemplateBrooklynLookup pcts;
-    private final BasicResourceLookup<ApplicationComponentTemplate> acts;
-    private final PlatformComponentBrooklynLookup pcs;
-    private final AssemblyBrooklynLookup assemblies;
-
-    public BrooklynImmutableCampPlatform(PlatformRootSummary root, ManagementContext managementContext) {
-        super(root);
-        this.bmc = managementContext;
-        
-        // these come from brooklyn
-        pcts = new PlatformComponentTemplateBrooklynLookup(root(), getBrooklynManagementContext());
-        ats = new AssemblyTemplateBrooklynLookup(root(), getBrooklynManagementContext());
-        pcs = new PlatformComponentBrooklynLookup(root(), getBrooklynManagementContext());
-        assemblies = new AssemblyBrooklynLookup(root(), getBrooklynManagementContext(), pcs);
-        
-        // ACT's are not known in brooklyn (everything comes in as config) -- to be extended to support!
-        acts = new BasicResourceLookup<ApplicationComponentTemplate>();
-    }
-
-    // --- brooklyn setup
-    
-    @Override
-    public ManagementContext getBrooklynManagementContext() {
-        return bmc;
-    }
-    
-    // --- camp comatibility setup
-    
-    @Override
-    public ResourceLookup<PlatformComponentTemplate> platformComponentTemplates() {
-        return pcts;
-    }
-
-    @Override
-    public ResourceLookup<ApplicationComponentTemplate> applicationComponentTemplates() {
-        return acts;
-    }
-
-    @Override
-    public ResourceLookup<AssemblyTemplate> assemblyTemplates() {
-        return ats;
-    }
-    
-    @Override
-    public ResourceLookup<PlatformComponent> platformComponents() {
-        return pcs;
-    }
-
-    @Override
-    public ResourceLookup<ApplicationComponent> applicationComponents() {
-        return new EmptyResourceLookup<ApplicationComponent>();
-    }
-
-    @Override
-    public ResourceLookup<Assembly> assemblies() {
-        return assemblies;
-    }
-    
-    @Override
-    public PlatformTransaction transaction() {
-        throw new IllegalStateException(this+" does not support adding new items");
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer b/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.plan.PlanToSpecTransformer
deleted file mode 100644
index e93291e..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/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.camp.brooklyn.spi.creation.CampToSpecTransformer

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer b/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer
deleted file mode 100644
index 0c6fab3..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/main/resources/META-INF/services/org.apache.brooklyn.core.typereg.BrooklynTypePlanTransformer
+++ /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.camp.brooklyn.spi.creation.CampTypePlanTransformer

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
deleted file mode 100644
index 6982507..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
+++ /dev/null
@@ -1,207 +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;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Set;
-
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatform;
-import org.apache.brooklyn.camp.brooklyn.BrooklynCampPlatformLauncherNoServer;
-import org.apache.brooklyn.camp.spi.Assembly;
-import org.apache.brooklyn.camp.spi.AssemblyTemplate;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.mgmt.rebind.RebindOptions;
-import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixture;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.core.config.ConfigBag;
-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.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Iterables;
-
-public class AbstractYamlRebindTest extends RebindTestFixture<StartableApplication> {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractYamlTest.class);
-    protected static final String TEST_VERSION = "0.1.2";
-
-    protected BrooklynCampPlatform platform;
-    protected BrooklynCampPlatformLauncherNoServer launcher;
-    private boolean forceUpdate;
-    
-    @BeforeMethod(alwaysRun = true)
-    @Override
-    public void setUp() throws Exception {
-        super.setUp();
-        launcher = new BrooklynCampPlatformLauncherNoServer() {
-            @Override
-            protected LocalManagementContext newMgmtContext() {
-                return (LocalManagementContext) mgmt();
-            }
-        };
-        launcher.launch();
-        platform = launcher.getCampPlatform();
-    }
-
-    @AfterMethod(alwaysRun = true)
-    @Override
-    public void tearDown() throws Exception {
-        try {
-            super.tearDown();
-        } finally {
-            if (launcher != null) launcher.stopServers();
-        }
-    }
-
-    protected StartableApplication rebind(RebindOptions options) throws Exception {
-        StartableApplication result = super.rebind(options);
-        if (launcher != null) {
-            launcher.stopServers();
-            launcher = new BrooklynCampPlatformLauncherNoServer() {
-                @Override
-                protected LocalManagementContext newMgmtContext() {
-                    return (LocalManagementContext) mgmt();
-                }
-            };
-            launcher.launch();
-            platform = launcher.getCampPlatform();
-        }
-        return result;
-    }
-    
-    @Override
-    protected StartableApplication createApp() {
-        return null;
-    }
-
-    protected ManagementContext mgmt() {
-        return (newManagementContext != null) ? newManagementContext : origManagementContext;
-    }
-    
-    ///////////////////////////////////////////////////
-    // TODO code below is duplicate of AbstractYamlTest
-    ///////////////////////////////////////////////////
-    
-    protected void waitForApplicationTasks(Entity app) {
-        Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(mgmt().getExecutionManager(), app);
-        getLogger().info("Waiting on " + tasks.size() + " task(s)");
-        for (Task<?> t : tasks) {
-            t.blockUntilEnded();
-        }
-    }
-
-    protected Reader loadYaml(String yamlFileName, String ...extraLines) throws Exception {
-        String input = new ResourceUtils(this).getResourceAsString(yamlFileName).trim();
-        StringBuilder builder = new StringBuilder(input);
-        for (String l: extraLines)
-            builder.append("\n").append(l);
-        return new StringReader(builder.toString());
-    }
-    
-    protected Entity createAndStartApplication(String... multiLineYaml) throws Exception {
-        return createAndStartApplication(joinLines(multiLineYaml));
-    }
-    
-    protected Entity createAndStartApplication(String input) throws Exception {
-        return createAndStartApplication(new StringReader(input));
-    }
-
-    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) {
-            getLogger().warn("Unable to instantiate " + at + " (rethrowing): " + e);
-            throw e;
-        }
-        getLogger().info("Test - created " + assembly);
-        final Entity app = mgmt().getEntityManager().getEntity(assembly.getId());
-        getLogger().info("App - " + app);
-        
-        // wait for app to have started
-        Set<Task<?>> tasks = mgmt().getExecutionManager().getTasksWithAllTags(ImmutableList.of(
-                BrooklynTaskTags.EFFECTOR_TAG, 
-                BrooklynTaskTags.tagForContextEntity(app), 
-                BrooklynTaskTags.tagForEffectorCall(app, "start", ConfigBag.newInstance(ImmutableMap.of("locations", ImmutableMap.of())))));
-        Iterables.getOnlyElement(tasks).get();
-        
-        return app;
-    }
-
-    protected Entity createStartWaitAndLogApplication(Reader input) throws Exception {
-        Entity app = createAndStartApplication(input);
-        waitForApplicationTasks(app);
-
-        getLogger().info("App started:");
-        Entities.dumpInfo(app);
-        
-        return app;
-    }
-
-    protected void addCatalogItems(Iterable<String> catalogYaml) {
-        addCatalogItems(joinLines(catalogYaml));
-    }
-
-    protected void addCatalogItems(String... catalogYaml) {
-        addCatalogItems(joinLines(catalogYaml));
-    }
-
-    protected Iterable<? extends CatalogItem<?,?>> addCatalogItems(String catalogYaml) {
-        return mgmt().getCatalog().addItems(catalogYaml, forceUpdate);
-    }
-
-    protected void deleteCatalogEntity(String catalogItem) {
-        mgmt().getCatalog().deleteCatalogItem(catalogItem, TEST_VERSION);
-    }
-
-    protected Logger getLogger() {
-        return LOG;
-    }
-
-    private String joinLines(Iterable<String> catalogYaml) {
-        return Joiner.on("\n").join(catalogYaml);
-    }
-
-    private String joinLines(String[] catalogYaml) {
-        return Joiner.on("\n").join(catalogYaml);
-    }
-
-    protected String ver(String id) {
-        return CatalogUtils.getVersionedId(id, TEST_VERSION);
-    }
-
-    public void forceCatalogUpdate() {
-        forceUpdate = true;
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
deleted file mode 100644
index 4478f2b..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AbstractYamlTest.java
+++ /dev/null
@@ -1,176 +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;
-
-import java.io.Reader;
-import java.io.StringReader;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.catalog.BrooklynCatalog;
-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.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.CampTypePlanTransformer;
-import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.entity.trait.Startable;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.core.typereg.RegisteredTypeLoadingContexts;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.stream.Streams;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-
-import com.google.common.base.Joiner;
-
-public abstract class AbstractYamlTest {
-
-    private static final Logger LOG = LoggerFactory.getLogger(AbstractYamlTest.class);
-    protected static final String TEST_VERSION = "0.1.2";
-
-    private ManagementContext brooklynMgmt;
-    protected BrooklynCatalog catalog;
-    protected BrooklynCampPlatform platform;
-    protected BrooklynCampPlatformLauncherNoServer launcher;
-    private boolean forceUpdate;
-    
-    public AbstractYamlTest() {
-        super();
-    }
-
-    protected ManagementContext mgmt() { return brooklynMgmt; }
-    
-    @BeforeMethod(alwaysRun = true)
-    public void setUp() {
-        forceUpdate = false;
-        launcher = new BrooklynCampPlatformLauncherNoServer() {
-            @Override
-            protected LocalManagementContext newMgmtContext() {
-                return newTestManagementContext();
-            }
-        };
-        launcher.launch();
-        brooklynMgmt = launcher.getBrooklynMgmt();
-        catalog = brooklynMgmt.getCatalog();
-        platform = launcher.getCampPlatform();
-    }
-
-    protected LocalManagementContext newTestManagementContext() {
-        // TODO they don't all need osgi, just a few do, so could speed it up by specifying when they do
-        return LocalManagementContextForTests.newInstanceWithOsgi();
-    }
-    
-    @AfterMethod(alwaysRun = true)
-    public void tearDown() {
-        if (brooklynMgmt != null) Entities.destroyAll(brooklynMgmt);
-        if (launcher != null) launcher.stopServers();
-    }
-
-    protected void waitForApplicationTasks(Entity app) {
-        Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(brooklynMgmt.getExecutionManager(), app);
-        getLogger().info("Waiting on " + tasks.size() + " task(s)");
-        for (Task<?> t : tasks) {
-            t.blockUntilEnded();
-        }
-    }
-
-    protected Reader loadYaml(String yamlFileName, String ...extraLines) throws Exception {
-        String input = new ResourceUtils(this).getResourceAsString(yamlFileName).trim();
-        StringBuilder builder = new StringBuilder(input);
-        for (String l: extraLines)
-            builder.append("\n").append(l);
-        return new StringReader(builder.toString());
-    }
-    
-    protected Entity createAndStartApplication(String... multiLineYaml) throws Exception {
-        return createAndStartApplication(joinLines(multiLineYaml));
-    }
-    
-    protected Entity createAndStartApplication(Reader input) throws Exception {
-        return createAndStartApplication(Streams.readFully(input));
-    }
-
-    protected Entity createAndStartApplication(String input) throws Exception {
-        return createAndStartApplication(input, MutableMap.<String,String>of());
-    }
-    protected Entity createAndStartApplication(String input, Map<String,String> startParameters) throws Exception {
-        EntitySpec<?> spec = 
-            mgmt().getTypeRegistry().createSpecFromPlan(CampTypePlanTransformer.FORMAT, input, RegisteredTypeLoadingContexts.spec(Application.class), EntitySpec.class);
-        final Entity app = brooklynMgmt.getEntityManager().createEntity(spec);
-        // start the app (happens automatically if we use camp to instantiate, but not if we use crate spec approach)
-        app.invoke(Startable.START, startParameters).get();
-        return app;
-    }
-
-    protected Entity createStartWaitAndLogApplication(Reader input) throws Exception {
-        Entity app = createAndStartApplication(input);
-        waitForApplicationTasks(app);
-        getLogger().info("App started: "+app);
-        return app;
-    }
-
-    protected EntitySpec<?> createAppEntitySpec(String... yaml) {
-        return EntityManagementUtils.createEntitySpecForApplication(mgmt(), joinLines(yaml));
-    }
-
-    protected void addCatalogItems(Iterable<String> catalogYaml) {
-        addCatalogItems(joinLines(catalogYaml));
-    }
-
-    protected void addCatalogItems(String... catalogYaml) {
-        addCatalogItems(joinLines(catalogYaml));
-    }
-
-    protected void addCatalogItems(String catalogYaml) {
-        mgmt().getCatalog().addItems(catalogYaml, forceUpdate);
-    }
-
-    protected void deleteCatalogEntity(String catalogItem) {
-        mgmt().getCatalog().deleteCatalogItem(catalogItem, TEST_VERSION);
-    }
-
-    protected Logger getLogger() {
-        return LOG;
-    }
-
-    protected String joinLines(Iterable<String> catalogYaml) {
-        return Joiner.on("\n").join(catalogYaml);
-    }
-
-    protected String joinLines(String... catalogYaml) {
-        return Joiner.on("\n").join(catalogYaml);
-    }
-
-    protected String ver(String id) {
-        return CatalogUtils.getVersionedId(id, TEST_VERSION);
-    }
-
-    public void forceCatalogUpdate() {
-        forceUpdate = true;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java
deleted file mode 100644
index c462889..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/AppYamlTest.java
+++ /dev/null
@@ -1,121 +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;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import java.io.StringReader;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-import com.google.api.client.repackaged.com.google.common.base.Joiner;
-import com.google.common.collect.Iterables;
-
-@Test
-public class AppYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(AppYamlTest.class);
-
-    @Test
-    public void testAutoWrapsEntityInApp() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestEntity");
-        
-        BasicApplication app = (BasicApplication) createStartWaitAndLogApplication(new StringReader(yaml));
-        @SuppressWarnings("unused")
-        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
-    }
-    
-    @Test
-    public void testDoesNotAutoWrapApp() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication");
-        
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
-        assertTrue(app.getChildren().isEmpty());
-    }
-    
-    @Test
-    public void testWrapsAppIfNameAtTopLevelAndOnApp() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "name: myTopLevelName",
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
-                "  name: myEntityName");
-        
-        Entity app = createStartWaitAndLogApplication(new StringReader(yaml));
-        assertNull(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
-        assertEquals(app.getDisplayName(), "myTopLevelName");
-        assertEquals(app.getChildren().size(), 0);
-    }
-    
-    @Test
-    public void testDoesNotWrapAppIfNoConflictingNameOnApp() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "name: myTopLevelName",
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication");
-        
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
-        assertTrue(app.getChildren().isEmpty());
-        assertEquals(app.getDisplayName(), "myTopLevelName");
-    }
-    
-    @Test
-    public void testDoesNotWrapAppWithDefaultDisplayName() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "name: myTopLevelName",
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
-                "  brooklyn.config:",
-                "    defaultDisplayName: myDefaultEntityName");
-        
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
-        assertTrue(app.getChildren().isEmpty());
-        assertEquals(app.getDisplayName(), "myTopLevelName");
-    }
-    
-    @Test
-    public void testUsesDefaultDisplayNameIfNoOther() throws Exception {
-        String yaml = Joiner.on("\n").join(
-                "services:",
-                "- serviceType: org.apache.brooklyn.core.test.entity.TestApplication",
-                "  brooklyn.config:",
-                "    defaultDisplayName: myDefaultEntityName");
-        
-        TestApplication app = (TestApplication) createStartWaitAndLogApplication(new StringReader(yaml));
-        assertTrue(app.getChildren().isEmpty());
-        assertEquals(app.getDisplayName(), "myDefaultEntityName");
-    }
-    
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d03f254b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java
deleted file mode 100644
index 374df13..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ApplicationsYamlTest.java
+++ /dev/null
@@ -1,253 +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;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertNull;
-import static org.testng.Assert.assertTrue;
-
-import org.apache.brooklyn.api.entity.Application;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.camp.brooklyn.TestSensorAndEffectorInitializer.TestConfigurableInitializer;
-import org.apache.brooklyn.core.mgmt.EntityManagementUtils;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.core.test.policy.TestEnricher;
-import org.apache.brooklyn.core.test.policy.TestPolicy;
-import org.apache.brooklyn.entity.stock.BasicApplication;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-@Test
-public class ApplicationsYamlTest extends AbstractYamlTest {
-    private static final Logger log = LoggerFactory.getLogger(ApplicationsYamlTest.class);
-
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        // Don't need osgi
-        return LocalManagementContextForTests.newInstance();
-    }
-
-    @Test
-    public void testWrapsEntity() throws Exception {
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + BasicEntity.class.getName());
-        assertWrapped(app, BasicEntity.class);
-    }
-
-    @Test
-    public void testWrapsMultipleApps() throws Exception {
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + BasicApplication.class.getName(),
-                "- type: " + BasicApplication.class.getName());
-        assertTrue(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
-        assertTrue(app instanceof BasicApplication);
-        assertEquals(app.getChildren().size(), 2);
-    }
-
-    @Test
-    public void testWrapsWhenEnrichers() throws Exception {
-        Entity app = createAndStartApplication(
-                "brooklyn.enrichers:",
-                "- type: " + TestEnricher.class.getName(),
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertWrapped(app, BasicApplication.class);
-    }
-
-    @Test
-    public void testWrapsWhenPolicy() throws Exception {
-        Entity app = createAndStartApplication(
-                "brooklyn.policies:",
-                "- type: " + TestPolicy.class.getName(),
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertWrapped(app, BasicApplication.class);
-    }
-
-    @Test
-    public void testWrapsWhenInitializer() throws Exception {
-        Entity app = createAndStartApplication(
-                "brooklyn.initializers:",
-                "- type: " + TestConfigurableInitializer.class.getName(),
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertWrapped(app, BasicApplication.class);
-    }
-
-    @Test
-    public void testWrapsAppIfForced() throws Exception {
-        Entity app = createAndStartApplication(
-                "wrappedApp: true",
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertWrapped(app, BasicApplication.class);
-    }
-
-    @Test
-    public void testDoesNotWrapApp() throws Exception {
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertDoesNotWrap(app, BasicApplication.class, null);
-    }
-
-    @Test
-    public void testDoesNotWrapAppIfUnforced() throws Exception {
-        Entity app = createAndStartApplication(
-                "wrappedApp: false",
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertDoesNotWrap(app, BasicApplication.class, null);
-    }
-    
-    @Test
-    public void testDoesNotWrapEntityIfDifferentTopLevelName() throws Exception {
-        Entity app = createAndStartApplication(
-                "name: topLevel",
-                "services:",
-                "- type: " + BasicApplication.class.getName(),
-                "  name: bottomLevel");
-        assertDoesNotWrap(app, BasicApplication.class, "topLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapsEntityIfNoNameOnService() throws Exception {
-        Entity app = createAndStartApplication(
-                "name: topLevel",
-                "services:",
-                "- type: " + BasicApplication.class.getName());
-        assertDoesNotWrap(app, BasicApplication.class, "topLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapCatalogItemWithDisplayName() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: simple",
-                "  version: " + TEST_VERSION,
-                "  displayName: catalogLevel",
-                "  item:",
-                "    services:",
-                "    - type: " + BasicApplication.class.getName());
-        Entity app = createAndStartApplication(
-                "name: topLevel",
-                "services:",
-                "- type: simple:" + TEST_VERSION);
-        assertDoesNotWrap(app, BasicApplication.class, "topLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapCatalogItemWithServiceName() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: simple",
-                "  version: " + TEST_VERSION,
-                "  displayName: catalogLevel",
-                "  item:",
-                "    services:",
-                "    - type: " + BasicApplication.class.getName(),
-                "      defaultDisplayName: defaultServiceName",
-                "      displayName: explicitServiceName");
-        Entity app = createAndStartApplication(
-                "name: topLevel",
-                "services:",
-                "- type: simple:" + TEST_VERSION);
-        assertDoesNotWrap(app, BasicApplication.class, "topLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapCatalogItemAndOverridesName() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: simple",
-                "  version: " + TEST_VERSION,
-                "  displayName: catalogLevel",
-                "  item:",
-                "    services:",
-                "    - type: " + BasicApplication.class.getName());
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: simple:" + TEST_VERSION,
-                "  name: serviceLevel");
-        assertDoesNotWrap(app, BasicApplication.class, "serviceLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapCatalogItemAndUsesCatalogName() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: simple",
-                "  version: " + TEST_VERSION,
-                "  displayName: catalogLevel",
-                "  item:",
-                "    services:",
-                "    - type: " + BasicApplication.class.getName());
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: simple:" + TEST_VERSION);
-        assertDoesNotWrap(app, BasicApplication.class, "catalogLevel");
-    }
-
-    @Test
-    public void testDoesNotWrapCatalogItemAndUsesCatalogServiceName() throws Exception {
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: simple",
-                "  version: " + TEST_VERSION,
-                "  displayName: catalogLevel",
-                "  item:",
-                "    services:",
-                "    - type: " + BasicApplication.class.getName(),
-                "      name: catalogServiceLevel");
-        Entity app = createAndStartApplication(
-                "services:",
-                "- type: simple:" + TEST_VERSION);
-        assertDoesNotWrap(app, BasicApplication.class, "catalogServiceLevel");
-    }
-
-    @Override
-    protected Logger getLogger() {
-        return log;
-    }
-
-    private void assertWrapped(Entity app, Class<? extends Entity> wrappedEntityType) {
-        assertTrue(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
-        assertTrue(app instanceof BasicApplication);
-        Entity child = Iterables.getOnlyElement(app.getChildren());
-        assertTrue(wrappedEntityType.isInstance(child));
-        assertTrue(child.getChildren().isEmpty());
-    }
-
-    private void assertDoesNotWrap(Entity app, Class<? extends Application> entityType, String displayName) {
-        assertNull(app.getConfig(EntityManagementUtils.WRAPPER_APP_MARKER));
-        assertTrue(entityType.isInstance(app));
-        if (displayName != null) {
-            assertEquals(app.getDisplayName(), displayName);
-        }
-        assertEquals(app.getChildren().size(), 0);
-    }
-    
-}


Mime
View raw message