brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [2/9] incubator-brooklyn git commit: BROOKLYN-162 convert camp-base and camp-server to org.apache prefix
Date Tue, 18 Aug 2015 13:25:50 GMT
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java
new file mode 100644
index 0000000..b56e78e
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/DtoFactory.java
@@ -0,0 +1,176 @@
+/*
+ * 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.server.rest.util;
+
+import java.util.Map;
+
+import javax.ws.rs.Path;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.server.dto.ApplicationComponentDto;
+import org.apache.brooklyn.camp.server.dto.ApplicationComponentTemplateDto;
+import org.apache.brooklyn.camp.server.dto.AssemblyDto;
+import org.apache.brooklyn.camp.server.dto.AssemblyTemplateDto;
+import org.apache.brooklyn.camp.server.dto.PlatformComponentDto;
+import org.apache.brooklyn.camp.server.dto.PlatformComponentTemplateDto;
+import org.apache.brooklyn.camp.server.dto.PlatformDto;
+import org.apache.brooklyn.camp.server.rest.resource.AbstractCampRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.ApplicationComponentRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.ApplicationComponentTemplateRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.AssemblyRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.AssemblyTemplateRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformComponentRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformComponentTemplateRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformRestResource;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+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 brooklyn.util.collections.MutableMap;
+import brooklyn.util.net.Urls;
+
+import com.google.common.base.Function;
+import com.google.common.base.Preconditions;
+
+public class DtoFactory {
+
+    private CampPlatform platform;
+    private String uriBase;
+    
+    private UriFactory uriFactory;
+
+    public DtoFactory(CampPlatform campPlatform, String uriBase) {
+        this.platform = campPlatform;
+        this.uriBase = uriBase;
+        
+        uriFactory = new UriFactory();
+        uriFactory.registerIdentifiableRestResource(PlatformRootSummary.class, PlatformRestResource.class);
+        uriFactory.registerIdentifiableRestResource(AssemblyTemplate.class, AssemblyTemplateRestResource.class);
+        uriFactory.registerIdentifiableRestResource(PlatformComponentTemplate.class, PlatformComponentTemplateRestResource.class);
+        uriFactory.registerIdentifiableRestResource(ApplicationComponentTemplate.class, ApplicationComponentTemplateRestResource.class);
+        uriFactory.registerIdentifiableRestResource(Assembly.class, AssemblyRestResource.class);
+        uriFactory.registerIdentifiableRestResource(PlatformComponent.class, PlatformComponentRestResource.class);
+        uriFactory.registerIdentifiableRestResource(ApplicationComponent.class, ApplicationComponentRestResource.class);
+    }
+
+    public CampPlatform getPlatform() {
+        return platform;
+    }
+
+    public UriFactory getUriFactory() {
+        return uriFactory;
+    }
+
+    public String uri(AbstractResource x) {
+        return getUriFactory().uri(x);
+    }
+        
+    public String uri(Class<? extends AbstractResource> targetType, String id) {
+        return getUriFactory().uri(targetType, id);
+    }
+
+    public AssemblyTemplateDto adapt(AssemblyTemplate assemblyTemplate) {
+        return AssemblyTemplateDto.newInstance(this, assemblyTemplate);
+    }
+    public PlatformComponentTemplateDto adapt(PlatformComponentTemplate platformComponentTemplate) {
+        return PlatformComponentTemplateDto.newInstance(this, platformComponentTemplate);
+    }
+    public ApplicationComponentTemplateDto adapt(ApplicationComponentTemplate applicationComponentTemplate) {
+        return ApplicationComponentTemplateDto.newInstance(this, applicationComponentTemplate);
+    }
+
+    public AssemblyDto adapt(Assembly assembly) {
+        return AssemblyDto.newInstance(this, assembly);
+    }
+    public PlatformComponentDto adapt(PlatformComponent platformComponent) {
+        return PlatformComponentDto.newInstance(this, platformComponent);
+    }
+    public ApplicationComponentDto adapt(ApplicationComponent applicationComponent) {
+        return ApplicationComponentDto.newInstance(this, applicationComponent);
+    }
+
+    public PlatformDto adapt(PlatformRootSummary root) {
+        return PlatformDto.newInstance(this, root);
+    }
+
+    public class UriFactory {
+        /** registry of generating a URI given an object */
+        Map<Class<?>,Function<Object,String>> registryResource = new MutableMap<Class<?>, Function<Object,String>>();
+        /** registry of generating a URI given an ID */
+        Map<Class<?>,Function<String,String>> registryId = new MutableMap<Class<?>, Function<String,String>>();
+
+        /** registers a function which generates a URI given a type; note that this method cannot be used for links */
+        @SuppressWarnings("unchecked")
+        public synchronized <T> void registerResourceUriFunction(Class<T> type, Function<T,String> fnUri) {
+            registryResource.put(type, (Function<Object, String>) fnUri);
+        }
+
+        /** registers a type to generate a URI which concatenates the given base with the
+         * result of the given function to generate an ID against an object of the given type */
+        public synchronized <T> void registerIdentityFunction(Class<T> type, final String resourceTypeUriBase, final Function<T,String> fnIdentity) {
+            final Function<String,String> fnUriFromId = new Function<String,String>() {
+                public String apply(String id) {
+                    return Urls.mergePaths(resourceTypeUriBase, id);
+                }
+            };
+            registryId.put(type, (Function<String, String>) fnUriFromId);
+            registerResourceUriFunction(type, new Function<T,String>() {
+                public String apply(T input) {
+                    return fnUriFromId.apply(fnIdentity.apply(input));
+                }
+            });
+        }
+
+        /** registers a CAMP Resource type against a RestResource, generating the URI
+         * by concatenating the @Path annotation on the RestResource with the ID of the CAMP resource */
+        @SuppressWarnings({ "unchecked", "rawtypes" })
+        public synchronized <T extends AbstractResource> void registerIdentifiableRestResource(Class<T> type, Class<? extends AbstractCampRestResource> restResource) {
+            registerIdentityFunction(type, 
+                    uriOfRestResource(restResource),
+                    (Function) CampRestGuavas.IDENTITY_OF_REST_RESOURCE);
+        }
+        
+        public String uri(Class<? extends AbstractResource> targetType, String id) {
+            return Preconditions.checkNotNull(registryId.get(targetType), 
+                    "No REST ID converter registered for %s (id %s)", targetType, id)
+                    .apply(id);
+        }
+
+        public String uri(AbstractResource x) {
+            return Preconditions.checkNotNull(registryResource.get(x.getClass()), 
+                    "No REST converter registered for %s (%s)", x.getClass(), x)
+                    .apply(x);
+        }
+        
+        public String uriOfRestResource(Class<?> restResourceClass) {
+            return Urls.mergePaths(uriBase, 
+                    Preconditions.checkNotNull(restResourceClass.getAnnotation(Path.class),
+                            "No @Path on type %s", restResourceClass)
+                    .value());
+        }
+            
+
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java
new file mode 100644
index 0000000..964ae34
--- /dev/null
+++ b/camp/camp-server/src/main/java/org/apache/brooklyn/camp/server/rest/util/WebResourceUtils.java
@@ -0,0 +1,59 @@
+/*
+ * 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.server.rest.util;
+
+import java.net.URI;
+
+import javax.ws.rs.WebApplicationException;
+import javax.ws.rs.core.MediaType;
+import javax.ws.rs.core.Response;
+import javax.ws.rs.core.UriInfo;
+
+import org.apache.brooklyn.camp.server.dto.ApiErrorDto;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class WebResourceUtils {
+
+    private static final Logger log = LoggerFactory.getLogger(WebResourceUtils.class);
+    
+    public static WebApplicationException notFound(String format, Object... args) {
+        String msg = String.format(format, args);
+        if (log.isDebugEnabled()) log.debug("returning 404 notFound("+msg+")");
+        throw new WebApplicationException(Response.status(Response.Status.NOT_FOUND)
+                .type(MediaType.APPLICATION_JSON_TYPE)
+                .entity(ApiErrorDto.builder().message(msg).build()).build());
+    }
+
+    public static WebApplicationException preconditionFailed(String format, Object... args) {
+        String msg = String.format(format, args);
+        if (log.isDebugEnabled()) log.debug("returning 412 preconditionFailed("+msg+")");
+        throw new WebApplicationException(Response.status(Response.Status.PRECONDITION_FAILED)
+                .type(MediaType.APPLICATION_JSON_TYPE)
+                .entity(ApiErrorDto.builder().message(msg).build()).build());
+    }
+
+    public static Response created(UriInfo info, String resourceUriPath) {
+        // see http://stackoverflow.com/questions/13702481/javax-response-prepends-method-path-when-setting-location-header-path-on-status
+        // for why we have to return absolute path
+        URI resourceUri = info.getBaseUriBuilder().path( resourceUriPath ).build();
+        return Response.created(resourceUri).build();
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ApplicationCompomentTemplateDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ApplicationCompomentTemplateDtoTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ApplicationCompomentTemplateDtoTest.java
deleted file mode 100644
index 0219a04..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ApplicationCompomentTemplateDtoTest.java
+++ /dev/null
@@ -1,49 +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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class ApplicationCompomentTemplateDtoTest {
-
-    private static final Logger log = LoggerFactory.getLogger(ApplicationCompomentTemplateDtoTest.class);
-    
-    @Test
-    public void testAppServerPct() {
-        CampPlatform p = MockWebPlatform.newPlatform();
-        DtoFactory f = new DtoFactory(p, "");
-        
-        ApplicationComponentTemplate t = MockWebPlatform.WAR;
-        ApplicationComponentTemplateDto dto = f.adapt(t);
-        
-        log.info("War PCT serialized as: "+BasicDtoTest.tree(dto));
-        Assert.assertEquals(dto.getName(), t.getName());
-        Assert.assertNotNull(dto.getCreatedAsString());
-        Assert.assertTrue(dto.getCreatedAsString().startsWith("20"));
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/dto/BasicDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/BasicDtoTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/dto/BasicDtoTest.java
deleted file mode 100644
index 8e4dc2f..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/BasicDtoTest.java
+++ /dev/null
@@ -1,90 +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 io.brooklyn.camp.dto;
-
-import java.io.IOException;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import brooklyn.util.collections.MutableMap;
-import brooklyn.util.exceptions.Exceptions;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-/** Tests identity methods and custom attributes for DTO, including Jackson JSON serialization */
-public class BasicDtoTest {
-
-    private static final Logger log = LoggerFactory.getLogger(BasicDtoTest.class);
-    
-    @Test
-    public void testSimple() throws IOException {
-        DtoCustomAttributes l = new DtoCustomAttributes(null);
-        
-        JsonNode t = tree(l);
-        Assert.assertEquals(t.size(), 0);
-        Assert.assertTrue(l.getCustomAttributes()==null || l.getCustomAttributes().isEmpty());
-        
-        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), DtoCustomAttributes.class));
-    }
-
-    @Test
-    public void testCustomAttrs() throws IOException {
-        DtoCustomAttributes l = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
-        
-        JsonNode t = tree(l);
-        Assert.assertEquals(t.size(), 1);
-        Assert.assertEquals(t.get("bar").asText(), l.getCustomAttributes().get("bar"));
-        
-        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), DtoCustomAttributes.class));
-    }
-
-    @Test
-    public void testIdentity() throws IOException {
-        DtoCustomAttributes l1 = new DtoCustomAttributes(null);
-        DtoCustomAttributes l2 = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
-        DtoCustomAttributes l2o = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
-        
-        Assert.assertEquals(l1, l1);
-        Assert.assertEquals(l2, l2);
-        Assert.assertEquals(l2, l2o);
-        Assert.assertNotEquals(l1, l2);
-        
-        Assert.assertEquals(l1.hashCode(), l1.hashCode());
-        Assert.assertEquals(l2.hashCode(), l2.hashCode());
-        Assert.assertEquals(l2.hashCode(), l2o.hashCode());
-        Assert.assertNotEquals(l1.hashCode(), l2.hashCode());
-    }
-    
-    public static JsonNode tree(Object l) {
-        try {
-            ObjectMapper m = new ObjectMapper();
-            String s = m.writeValueAsString(l);
-            log.info(l.toString()+" -> "+s);
-            JsonNode t = m.readTree(s);
-            return t;
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/dto/LinkDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/LinkDtoTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/dto/LinkDtoTest.java
deleted file mode 100644
index a26eac1..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/LinkDtoTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package io.brooklyn.camp.dto;
-
-import java.io.IOException;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import brooklyn.util.collections.MutableMap;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@Test
-public class LinkDtoTest {
-
-//    private static final Logger log = LoggerFactory.getLogger(LinkDtoTest.class);
-    
-    @Test
-    public void testSimple() throws IOException {
-        LinkDto l = LinkDto.newInstance("http://foo", "Foo");
-        
-        JsonNode t = BasicDtoTest.tree(l);
-        Assert.assertEquals(t.size(), 2);
-        Assert.assertEquals(t.get("href").asText(), l.getHref());
-        Assert.assertEquals(t.get("targetName").asText(), l.getTargetName());
-        Assert.assertTrue(l.getCustomAttributes()==null || l.getCustomAttributes().isEmpty());
-        
-        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), LinkDto.class));
-    }
-
-    @Test
-    public void testCustomAttrs() throws IOException {
-        LinkDto l = LinkDto.newInstance("http://foo", "Foo", MutableMap.of("bar", "bee"));
-        
-        JsonNode t = BasicDtoTest.tree(l);
-        Assert.assertEquals(t.size(), 3);
-        Assert.assertEquals(t.get("href").asText(), l.getHref());
-        Assert.assertEquals(t.get("targetName").asText(), l.getTargetName());
-        Assert.assertEquals(t.get("bar").asText(), l.getCustomAttributes().get("bar"));
-        
-        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), LinkDto.class));
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/dto/PlatformCompomentTemplateDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/PlatformCompomentTemplateDtoTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/dto/PlatformCompomentTemplateDtoTest.java
deleted file mode 100644
index b3bc1ae..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/PlatformCompomentTemplateDtoTest.java
+++ /dev/null
@@ -1,49 +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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.rest.util.DtoFactory;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class PlatformCompomentTemplateDtoTest {
-
-    private static final Logger log = LoggerFactory.getLogger(PlatformCompomentTemplateDtoTest.class);
-    
-    @Test
-    public void testAppServerPct() {
-        CampPlatform p = MockWebPlatform.newPlatform();
-        DtoFactory f = new DtoFactory(p, "");
-        
-        PlatformComponentTemplate t = MockWebPlatform.APPSERVER;
-        PlatformComponentTemplateDto dto = f.adapt(t);
-        
-        log.info("Web PCT serialized as: "+BasicDtoTest.tree(dto));
-        Assert.assertEquals(dto.getName(), t.getName());
-        Assert.assertNotNull(dto.getCreatedAsString());
-        Assert.assertTrue(dto.getCreatedAsString().startsWith("20"));
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ResourceDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ResourceDtoTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ResourceDtoTest.java
deleted file mode 100644
index 24ad1d6..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/dto/ResourceDtoTest.java
+++ /dev/null
@@ -1,77 +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 io.brooklyn.camp.dto;
-
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.CampServer;
-import io.brooklyn.camp.commontypes.RepresentationSkew;
-import io.brooklyn.camp.rest.util.CampRestGuavas;
-import io.brooklyn.camp.spi.AbstractResource;
-
-import java.io.IOException;
-import java.util.Arrays;
-
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.fasterxml.jackson.databind.JsonNode;
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-@Test
-public class ResourceDtoTest {
-
-//    private static final Logger log = LoggerFactory.getLogger(ResourceDtoTest.class);
-    
-    CampServer s;
-    AbstractResource rr;
-    ResourceDto r;
-    
-    @SuppressWarnings("unchecked")
-    protected void initSimpleDto() {
-        s = new CampServer(new BasicCampPlatform(), "http://atest/");
-        s.getDtoFactory().getUriFactory().registerIdentityFunction(AbstractResource.class, "basic", CampRestGuavas.IDENTITY_OF_REST_RESOURCE);
-        rr = AbstractResource.builder().name("Name").description("a description").
-                tags(Arrays.asList("tag1", "tag 2")).representationSkew(RepresentationSkew.NONE).build();
-        r = ResourceDto.newInstance(s.getDtoFactory(), rr);
-    }
-    
-    @Test
-    public void testSimpleCreation() throws IOException {
-        initSimpleDto();
-        
-        Assert.assertNotNull(r.getCreatedAsString());
-        Assert.assertEquals(r.getName(), "Name");
-        Assert.assertEquals(r.getDescription(), "a description");
-        Assert.assertEquals(r.getTags(), Arrays.asList("tag1", "tag 2"));
-        Assert.assertEquals(r.getRepresentationSkew(), RepresentationSkew.NONE);
-    }
-    
-    public void testSimpleSerializationAndDeserialization() throws IOException {
-        initSimpleDto();
-        
-        JsonNode t = BasicDtoTest.tree(r);
-        
-//        Assert.assertEquals(t.get("uri").asText(), r.getUri());
-        ResourceDto r2 = new ObjectMapper().readValue(t.toString(), ResourceDto.class);
-        Assert.assertNotNull(r2.getCreated());
-        Assert.assertEquals(r, r2);
-    }
-
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/rest/resource/PlatformRestResourceTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/rest/resource/PlatformRestResourceTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/rest/resource/PlatformRestResourceTest.java
deleted file mode 100644
index b3d5ff0..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/rest/resource/PlatformRestResourceTest.java
+++ /dev/null
@@ -1,42 +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 io.brooklyn.camp.rest.resource;
-
-import io.brooklyn.camp.dto.PlatformComponentTemplateDto;
-import io.brooklyn.camp.dto.PlatformDto;
-import io.brooklyn.camp.test.fixture.AbstractRestResourceTest;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class PlatformRestResourceTest extends AbstractRestResourceTest {
-
-    private static final Logger log = LoggerFactory.getLogger(PlatformRestResourceTest.class);
-    
-    @Test
-    public void testPlatformIncludesList() {
-        PlatformDto p = load(PlatformRestResource.CAMP_URI_PATH, PlatformDto.class);
-        PlatformComponentTemplateDto pct = load(p.getPlatformComponentTemplates().get(0).getHref(), PlatformComponentTemplateDto.class);
-        log.debug("Loaded PCT via REST: "+pct);
-        Assert.assertNotNull(pct.getName());
-    }
-        
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/AbstractRestResourceTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/AbstractRestResourceTest.java b/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/AbstractRestResourceTest.java
deleted file mode 100644
index 7046129..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/AbstractRestResourceTest.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package io.brooklyn.camp.test.fixture;
-
-import java.net.URL;
-
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.CampServer;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.BeforeClass;
-import org.testng.reporters.Files;
-
-import brooklyn.util.exceptions.Exceptions;
-import brooklyn.util.net.Urls;
-
-import com.fasterxml.jackson.databind.ObjectMapper;
-
-public class AbstractRestResourceTest {
-
-    private static final Logger log = LoggerFactory.getLogger(AbstractRestResourceTest.class);
-    
-    protected BasicCampPlatform platform;
-    protected CampServer server;
-    
-    @BeforeClass
-    public void startServer() {
-        platform = new BasicCampPlatform();
-        populate();
-        
-        // new server
-        server = new CampServer(platform, "").start();
-    }
-    
-    protected void populate() {
-        MockWebPlatform.populate(platform);
-    }
-
-    @AfterClass 
-    public void stopServer() {
-        if (server!=null)
-            server.stop();
-    }
-    
-    public String load(String path) {
-        try {
-            String base = "http://localhost:"+server.getPort();
-            String x = path.startsWith(base) ? path : Urls.mergePaths(base, path);
-            log.debug("Reading from: "+x);
-            String s = Files.streamToString(new URL(x).openStream());
-            log.debug("Result from "+x+": "+s);
-            return s;
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-    
-    public <T> T load(String path, Class<T> type) {
-        try {
-            String data = load(path);
-            return new ObjectMapper().readValue(data, type);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/InMemoryCamp.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/InMemoryCamp.java b/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/InMemoryCamp.java
deleted file mode 100644
index 838e1e0..0000000
--- a/camp/camp-server/src/test/java/io/brooklyn/camp/test/fixture/InMemoryCamp.java
+++ /dev/null
@@ -1,53 +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 io.brooklyn.camp.test.fixture;
-
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.CampServer;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-public class InMemoryCamp {
-    
-    private static final Logger log = LoggerFactory.getLogger(InMemoryCamp.class);
-
-    
-    public static void main(String[] args) {
-        
-        // new platform with some mock types and some data structures
-        
-            // interface CampComponent
-            // getComponentTemplate() -> operations, links, etc
-        
-            // platformView.getComponent(id) -> returns instance of domain-specific component type
-        BasicCampPlatform p = new BasicCampPlatform();
-        MockWebPlatform.populate(p);
-        
-        // new server
-        CampServer s = new CampServer(p, "").start();
-        
-        log.info("Running at: "+s.getUriBase());
-        // requests against server
-        
-    }
-    
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java
new file mode 100644
index 0000000..476f23e
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ApplicationCompomentTemplateDtoTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.server.dto;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.server.dto.ApplicationComponentTemplateDto;
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class ApplicationCompomentTemplateDtoTest {
+
+    private static final Logger log = LoggerFactory.getLogger(ApplicationCompomentTemplateDtoTest.class);
+    
+    @Test
+    public void testAppServerPct() {
+        CampPlatform p = MockWebPlatform.newPlatform();
+        DtoFactory f = new DtoFactory(p, "");
+        
+        ApplicationComponentTemplate t = MockWebPlatform.WAR;
+        ApplicationComponentTemplateDto dto = f.adapt(t);
+        
+        log.info("War PCT serialized as: "+BasicDtoTest.tree(dto));
+        Assert.assertEquals(dto.getName(), t.getName());
+        Assert.assertNotNull(dto.getCreatedAsString());
+        Assert.assertTrue(dto.getCreatedAsString().startsWith("20"));
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java
new file mode 100644
index 0000000..e41d544
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/BasicDtoTest.java
@@ -0,0 +1,91 @@
+/*
+ * 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.server.dto;
+
+import java.io.IOException;
+
+import org.apache.brooklyn.camp.server.dto.DtoCustomAttributes;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import brooklyn.util.collections.MutableMap;
+import brooklyn.util.exceptions.Exceptions;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+/** Tests identity methods and custom attributes for DTO, including Jackson JSON serialization */
+public class BasicDtoTest {
+
+    private static final Logger log = LoggerFactory.getLogger(BasicDtoTest.class);
+    
+    @Test
+    public void testSimple() throws IOException {
+        DtoCustomAttributes l = new DtoCustomAttributes(null);
+        
+        JsonNode t = tree(l);
+        Assert.assertEquals(t.size(), 0);
+        Assert.assertTrue(l.getCustomAttributes()==null || l.getCustomAttributes().isEmpty());
+        
+        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), DtoCustomAttributes.class));
+    }
+
+    @Test
+    public void testCustomAttrs() throws IOException {
+        DtoCustomAttributes l = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
+        
+        JsonNode t = tree(l);
+        Assert.assertEquals(t.size(), 1);
+        Assert.assertEquals(t.get("bar").asText(), l.getCustomAttributes().get("bar"));
+        
+        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), DtoCustomAttributes.class));
+    }
+
+    @Test
+    public void testIdentity() throws IOException {
+        DtoCustomAttributes l1 = new DtoCustomAttributes(null);
+        DtoCustomAttributes l2 = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
+        DtoCustomAttributes l2o = new DtoCustomAttributes(MutableMap.of("bar", "bee"));
+        
+        Assert.assertEquals(l1, l1);
+        Assert.assertEquals(l2, l2);
+        Assert.assertEquals(l2, l2o);
+        Assert.assertNotEquals(l1, l2);
+        
+        Assert.assertEquals(l1.hashCode(), l1.hashCode());
+        Assert.assertEquals(l2.hashCode(), l2.hashCode());
+        Assert.assertEquals(l2.hashCode(), l2o.hashCode());
+        Assert.assertNotEquals(l1.hashCode(), l2.hashCode());
+    }
+    
+    public static JsonNode tree(Object l) {
+        try {
+            ObjectMapper m = new ObjectMapper();
+            String s = m.writeValueAsString(l);
+            log.info(l.toString()+" -> "+s);
+            JsonNode t = m.readTree(s);
+            return t;
+        } catch (Exception e) {
+            throw Exceptions.propagate(e);
+        }
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java
new file mode 100644
index 0000000..de1508d
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/LinkDtoTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.server.dto;
+
+import java.io.IOException;
+
+import org.apache.brooklyn.camp.server.dto.LinkDto;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import brooklyn.util.collections.MutableMap;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Test
+public class LinkDtoTest {
+
+//    private static final Logger log = LoggerFactory.getLogger(LinkDtoTest.class);
+    
+    @Test
+    public void testSimple() throws IOException {
+        LinkDto l = LinkDto.newInstance("http://foo", "Foo");
+        
+        JsonNode t = BasicDtoTest.tree(l);
+        Assert.assertEquals(t.size(), 2);
+        Assert.assertEquals(t.get("href").asText(), l.getHref());
+        Assert.assertEquals(t.get("targetName").asText(), l.getTargetName());
+        Assert.assertTrue(l.getCustomAttributes()==null || l.getCustomAttributes().isEmpty());
+        
+        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), LinkDto.class));
+    }
+
+    @Test
+    public void testCustomAttrs() throws IOException {
+        LinkDto l = LinkDto.newInstance("http://foo", "Foo", MutableMap.of("bar", "bee"));
+        
+        JsonNode t = BasicDtoTest.tree(l);
+        Assert.assertEquals(t.size(), 3);
+        Assert.assertEquals(t.get("href").asText(), l.getHref());
+        Assert.assertEquals(t.get("targetName").asText(), l.getTargetName());
+        Assert.assertEquals(t.get("bar").asText(), l.getCustomAttributes().get("bar"));
+        
+        Assert.assertEquals(l, new ObjectMapper().readValue(t.toString(), LinkDto.class));
+    }
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java
new file mode 100644
index 0000000..eb9f552
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/PlatformCompomentTemplateDtoTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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.server.dto;
+
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.server.dto.PlatformComponentTemplateDto;
+import org.apache.brooklyn.camp.server.rest.util.DtoFactory;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class PlatformCompomentTemplateDtoTest {
+
+    private static final Logger log = LoggerFactory.getLogger(PlatformCompomentTemplateDtoTest.class);
+    
+    @Test
+    public void testAppServerPct() {
+        CampPlatform p = MockWebPlatform.newPlatform();
+        DtoFactory f = new DtoFactory(p, "");
+        
+        PlatformComponentTemplate t = MockWebPlatform.APPSERVER;
+        PlatformComponentTemplateDto dto = f.adapt(t);
+        
+        log.info("Web PCT serialized as: "+BasicDtoTest.tree(dto));
+        Assert.assertEquals(dto.getName(), t.getName());
+        Assert.assertNotNull(dto.getCreatedAsString());
+        Assert.assertTrue(dto.getCreatedAsString().startsWith("20"));
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java
new file mode 100644
index 0000000..dd7a01c
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/dto/ResourceDtoTest.java
@@ -0,0 +1,77 @@
+/*
+ * 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.server.dto;
+
+import java.io.IOException;
+import java.util.Arrays;
+
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.commontypes.RepresentationSkew;
+import org.apache.brooklyn.camp.server.dto.ResourceDto;
+import org.apache.brooklyn.camp.server.rest.CampServer;
+import org.apache.brooklyn.camp.server.rest.util.CampRestGuavas;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.fasterxml.jackson.databind.JsonNode;
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+@Test
+public class ResourceDtoTest {
+
+//    private static final Logger log = LoggerFactory.getLogger(ResourceDtoTest.class);
+    
+    CampServer s;
+    AbstractResource rr;
+    ResourceDto r;
+    
+    @SuppressWarnings("unchecked")
+    protected void initSimpleDto() {
+        s = new CampServer(new BasicCampPlatform(), "http://atest/");
+        s.getDtoFactory().getUriFactory().registerIdentityFunction(AbstractResource.class, "basic", CampRestGuavas.IDENTITY_OF_REST_RESOURCE);
+        rr = AbstractResource.builder().name("Name").description("a description").
+                tags(Arrays.asList("tag1", "tag 2")).representationSkew(RepresentationSkew.NONE).build();
+        r = ResourceDto.newInstance(s.getDtoFactory(), rr);
+    }
+    
+    @Test
+    public void testSimpleCreation() throws IOException {
+        initSimpleDto();
+        
+        Assert.assertNotNull(r.getCreatedAsString());
+        Assert.assertEquals(r.getName(), "Name");
+        Assert.assertEquals(r.getDescription(), "a description");
+        Assert.assertEquals(r.getTags(), Arrays.asList("tag1", "tag 2"));
+        Assert.assertEquals(r.getRepresentationSkew(), RepresentationSkew.NONE);
+    }
+    
+    public void testSimpleSerializationAndDeserialization() throws IOException {
+        initSimpleDto();
+        
+        JsonNode t = BasicDtoTest.tree(r);
+        
+//        Assert.assertEquals(t.get("uri").asText(), r.getUri());
+        ResourceDto r2 = new ObjectMapper().readValue(t.toString(), ResourceDto.class);
+        Assert.assertNotNull(r2.getCreated());
+        Assert.assertEquals(r, r2);
+    }
+
+
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java
new file mode 100644
index 0000000..f0d2138
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/rest/resource/PlatformRestResourceTest.java
@@ -0,0 +1,43 @@
+/*
+ * 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.server.rest.resource;
+
+import org.apache.brooklyn.camp.server.dto.PlatformComponentTemplateDto;
+import org.apache.brooklyn.camp.server.dto.PlatformDto;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformRestResource;
+import org.apache.brooklyn.camp.server.rest.resource.PlatformRestResourceTest;
+import org.apache.brooklyn.camp.server.test.fixture.AbstractRestResourceTest;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+public class PlatformRestResourceTest extends AbstractRestResourceTest {
+
+    private static final Logger log = LoggerFactory.getLogger(PlatformRestResourceTest.class);
+    
+    @Test
+    public void testPlatformIncludesList() {
+        PlatformDto p = load(PlatformRestResource.CAMP_URI_PATH, PlatformDto.class);
+        PlatformComponentTemplateDto pct = load(p.getPlatformComponentTemplates().get(0).getHref(), PlatformComponentTemplateDto.class);
+        log.debug("Loaded PCT via REST: "+pct);
+        Assert.assertNotNull(pct.getName());
+    }
+        
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java
new file mode 100644
index 0000000..c085544
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/AbstractRestResourceTest.java
@@ -0,0 +1,85 @@
+/*
+ * 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.server.test.fixture;
+
+import java.net.URL;
+
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.server.rest.CampServer;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterClass;
+import org.testng.annotations.BeforeClass;
+import org.testng.reporters.Files;
+
+import brooklyn.util.exceptions.Exceptions;
+import brooklyn.util.net.Urls;
+
+import com.fasterxml.jackson.databind.ObjectMapper;
+
+public class AbstractRestResourceTest {
+
+    private static final Logger log = LoggerFactory.getLogger(AbstractRestResourceTest.class);
+    
+    protected BasicCampPlatform platform;
+    protected CampServer server;
+    
+    @BeforeClass
+    public void startServer() {
+        platform = new BasicCampPlatform();
+        populate();
+        
+        // new server
+        server = new CampServer(platform, "").start();
+    }
+    
+    protected void populate() {
+        MockWebPlatform.populate(platform);
+    }
+
+    @AfterClass 
+    public void stopServer() {
+        if (server!=null)
+            server.stop();
+    }
+    
+    public String load(String path) {
+        try {
+            String base = "http://localhost:"+server.getPort();
+            String x = path.startsWith(base) ? path : Urls.mergePaths(base, path);
+            log.debug("Reading from: "+x);
+            String s = Files.streamToString(new URL(x).openStream());
+            log.debug("Result from "+x+": "+s);
+            return s;
+        } catch (Exception e) {
+            throw Exceptions.propagate(e);
+        }
+    }
+    
+    public <T> T load(String path, Class<T> type) {
+        try {
+            String data = load(path);
+            return new ObjectMapper().readValue(data, type);
+        } catch (Exception e) {
+            throw Exceptions.propagate(e);
+        }
+    }
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java
----------------------------------------------------------------------
diff --git a/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java
new file mode 100644
index 0000000..114324d
--- /dev/null
+++ b/camp/camp-server/src/test/java/org/apache/brooklyn/camp/server/test/fixture/InMemoryCamp.java
@@ -0,0 +1,52 @@
+/*
+ * 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.server.test.fixture;
+
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.server.rest.CampServer;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+public class InMemoryCamp {
+    
+    private static final Logger log = LoggerFactory.getLogger(InMemoryCamp.class);
+
+    
+    public static void main(String[] args) {
+        
+        // new platform with some mock types and some data structures
+        
+            // interface CampComponent
+            // getComponentTemplate() -> operations, links, etc
+        
+            // platformView.getComponent(id) -> returns instance of domain-specific component type
+        BasicCampPlatform p = new BasicCampPlatform();
+        MockWebPlatform.populate(p);
+        
+        // new server
+        CampServer s = new CampServer(p, "").start();
+        
+        log.info("Running at: "+s.getUriBase());
+        // requests against server
+        
+    }
+    
+    
+}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java b/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
index 593202e..a314f9d 100644
--- a/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
+++ b/core/src/main/java/brooklyn/camp/brooklyn/api/AssemblyTemplateSpecInstantiator.java
@@ -18,14 +18,13 @@
  */
 package brooklyn.camp.brooklyn.api;
 
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-
 import java.util.Set;
 
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
 
 public interface AssemblyTemplateSpecInstantiator extends AssemblyTemplateInstantiator {
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/config/BrooklynServerConfig.java b/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
index e884bdd..b92bf76 100644
--- a/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
+++ b/core/src/main/java/brooklyn/config/BrooklynServerConfig.java
@@ -19,13 +19,13 @@
 package brooklyn.config;
 
 import static brooklyn.entity.basic.ConfigKeys.newStringConfigKey;
-import io.brooklyn.camp.CampPlatform;
 
 import java.io.File;
 import java.net.URI;
 import java.util.Map;
 
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.CampPlatform;
 import org.apache.brooklyn.core.catalog.internal.CatalogInitialization;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/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 03f77b6..abdd48c 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
@@ -20,10 +20,6 @@ package org.apache.brooklyn.core.catalog.internal;
 
 import static com.google.common.base.Preconditions.checkArgument;
 import static com.google.common.base.Preconditions.checkNotNull;
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-import io.brooklyn.camp.spi.pdp.DeploymentPlan;
 
 import java.lang.reflect.Method;
 import java.util.Collection;
@@ -37,8 +33,8 @@ import javax.annotation.Nullable;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.yaml.snakeyaml.Yaml;
-
 import org.apache.brooklyn.basic.BrooklynObjectInternal.ConfigurationSupportInternal;
+
 import brooklyn.camp.brooklyn.api.AssemblyTemplateSpecInstantiator;
 
 import org.apache.brooklyn.api.basic.AbstractBrooklynObjectSpec;
@@ -52,6 +48,10 @@ import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
 import org.apache.brooklyn.api.policy.Policy;
 import org.apache.brooklyn.api.policy.PolicySpec;
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
+import org.apache.brooklyn.camp.spi.pdp.DeploymentPlan;
 import org.apache.brooklyn.core.catalog.CatalogPredicates;
 import org.apache.brooklyn.core.catalog.internal.CatalogClasspathDo.CatalogScanningModes;
 import org.apache.brooklyn.core.management.internal.ManagementContextInternal;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java b/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
index b243cda..f21d93a 100644
--- a/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
+++ b/core/src/main/java/org/apache/brooklyn/core/management/internal/EntityManagementUtils.java
@@ -18,11 +18,6 @@
  */
 package org.apache.brooklyn.core.management.internal;
 
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-
 import java.io.StringReader;
 import java.util.List;
 import java.util.Set;
@@ -37,6 +32,10 @@ import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.Task;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
 import org.apache.brooklyn.core.management.classloading.JavaBrooklynClassLoadingContext;
 import org.apache.brooklyn.core.util.task.TaskBuilder;
 import org.apache.brooklyn.core.util.task.Tasks;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java b/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
index 3fad07e..9fe5910 100644
--- a/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
+++ b/core/src/test/java/brooklyn/camp/lite/CampPlatformWithJustBrooklynMgmt.java
@@ -19,8 +19,8 @@
 package brooklyn.camp.lite;
 
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.BasicCampPlatform;
 
-import io.brooklyn.camp.BasicCampPlatform;
 import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
 import brooklyn.config.BrooklynProperties;
 import brooklyn.config.BrooklynServerConfig;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java b/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
index d6a9ed0..70b3e5f 100644
--- a/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
+++ b/core/src/test/java/brooklyn/camp/lite/CampYamlLiteTest.java
@@ -26,11 +26,6 @@ import org.apache.brooklyn.test.entity.LocalManagementContextForTests;
 import org.apache.brooklyn.test.entity.TestApplication;
 import org.apache.brooklyn.test.entity.TestEntity;
 
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.pdp.PdpYamlTest;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
-
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
@@ -49,6 +44,10 @@ import org.apache.brooklyn.api.catalog.CatalogItem.CatalogBundle;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.Task;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.pdp.PdpYamlTest;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
 import org.apache.brooklyn.core.catalog.CatalogPredicates;
 import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
 import org.apache.brooklyn.core.catalog.internal.CatalogDto;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java b/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
index d82e564..a48827f 100644
--- a/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
+++ b/core/src/test/java/brooklyn/camp/lite/TestAppAssembly.java
@@ -18,10 +18,9 @@
  */
 package brooklyn.camp.lite;
 
+import org.apache.brooklyn.camp.spi.Assembly;
 import org.apache.brooklyn.test.entity.TestApplication;
 
-import io.brooklyn.camp.spi.Assembly;
-
 public class TestAppAssembly extends Assembly {
 
     private TestApplication brooklynApp;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java b/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
index 2fa3415..5e25bde 100644
--- a/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
+++ b/core/src/test/java/brooklyn/camp/lite/TestAppAssemblyInstantiator.java
@@ -18,20 +18,19 @@
  */
 package brooklyn.camp.lite;
 
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-import io.brooklyn.camp.spi.instantiate.BasicAssemblyTemplateInstantiator;
-
 import java.util.Map;
 import java.util.Set;
 
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.camp.CampPlatform;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
+import org.apache.brooklyn.camp.spi.instantiate.BasicAssemblyTemplateInstantiator;
 import org.apache.brooklyn.core.util.config.ConfigBag;
 import org.apache.brooklyn.test.entity.TestApplication;
 import org.apache.brooklyn.test.entity.TestEntity;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java b/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
index 996c656..2643a5d 100644
--- a/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
+++ b/core/src/test/java/brooklyn/entity/rebind/RebindCatalogItemTest.java
@@ -22,8 +22,6 @@ import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 import static org.testng.Assert.assertTrue;
 import static org.testng.Assert.fail;
-import io.brooklyn.camp.BasicCampPlatform;
-import io.brooklyn.camp.test.mock.web.MockWebPlatform;
 
 import java.io.File;
 
@@ -40,6 +38,8 @@ import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.catalog.CatalogItem.CatalogItemType;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.BasicCampPlatform;
+import org.apache.brooklyn.camp.test.mock.web.MockWebPlatform;
 import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
 import org.apache.brooklyn.core.catalog.internal.CatalogDto;
 import org.apache.brooklyn.core.internal.BrooklynFeatureEnablement;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java
index 4a2078b..f9a1e96 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampConstants.java
@@ -18,10 +18,10 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.CampPlatform;
-
 import java.util.Set;
 
+import org.apache.brooklyn.camp.CampPlatform;
+
 import brooklyn.config.BrooklynServerConfig;
 import brooklyn.config.ConfigInheritance;
 import brooklyn.config.ConfigKey;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
index e2044c1..fece562 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatform.java
@@ -18,15 +18,14 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.AggregatingCampPlatform;
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.PlatformRootSummary;
-
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.ManagementContext.PropertiesReloadListener;
+import org.apache.brooklyn.camp.AggregatingCampPlatform;
+import org.apache.brooklyn.camp.CampPlatform;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynEntityMatcher;
 import org.apache.brooklyn.camp.brooklyn.spi.dsl.BrooklynDslInterpreter;
 import org.apache.brooklyn.camp.brooklyn.spi.platform.BrooklynImmutableCampPlatform;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
 
 import brooklyn.camp.brooklyn.api.HasBrooklynManagementContext;
 import brooklyn.config.BrooklynProperties;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
index 7adf958..5003ac8 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/BrooklynCampPlatformLauncherAbstract.java
@@ -19,10 +19,9 @@
 package org.apache.brooklyn.camp.brooklyn;
 
 import org.apache.brooklyn.api.management.ManagementContext;
+import org.apache.brooklyn.camp.spi.PlatformRootSummary;
 import org.apache.brooklyn.core.management.internal.LocalManagementContext;
 
-import io.brooklyn.camp.spi.PlatformRootSummary;
-
 import com.google.common.annotations.Beta;
 
 /** launcher for {@link BrooklynCampPlatform}, which may or may not start a (web) server depending on children */

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
index 6296339..86eb256 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/YamlLauncherAbstract.java
@@ -18,9 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn;
 
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-
 import java.io.Reader;
 import java.util.Set;
 
@@ -28,6 +25,8 @@ import org.apache.brooklyn.api.entity.Application;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.Task;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
 import org.apache.brooklyn.core.util.ResourceUtils;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
index 3931a82..eeed738 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynAssemblyTemplateInstantiator.java
@@ -18,14 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation;
 
-import io.brooklyn.camp.CampPlatform;
-import io.brooklyn.camp.spi.Assembly;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.AssemblyTemplate.Builder;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.collection.ResolvableLink;
-import io.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
-
 import java.io.IOException;
 import java.io.InputStreamReader;
 import java.io.Reader;
@@ -46,7 +38,14 @@ import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
+import org.apache.brooklyn.camp.CampPlatform;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
+import org.apache.brooklyn.camp.spi.Assembly;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate.Builder;
+import org.apache.brooklyn.camp.spi.collection.ResolvableLink;
+import org.apache.brooklyn.camp.spi.instantiate.AssemblyTemplateInstantiator;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog.BrooklynLoaderTracker;
 import org.apache.brooklyn.core.management.internal.EntityManagementUtils;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
index 03e3920..d9e7eb2 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynComponentTemplateResolver.java
@@ -18,11 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation;
 
-import io.brooklyn.camp.spi.AbstractResource;
-import io.brooklyn.camp.spi.ApplicationComponentTemplate;
-import io.brooklyn.camp.spi.AssemblyTemplate;
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
 import java.util.Collection;
 import java.util.LinkedHashSet;
 import java.util.List;
@@ -46,6 +41,10 @@ import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.service.BrooklynServiceTypeResolver;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.service.ServiceTypeResolver;
+import org.apache.brooklyn.camp.spi.AbstractResource;
+import org.apache.brooklyn.camp.spi.ApplicationComponentTemplate;
+import org.apache.brooklyn.camp.spi.AssemblyTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 import org.apache.brooklyn.core.management.ManagementContextInjectable;
 import org.apache.brooklyn.core.management.classloading.JavaBrooklynClassLoadingContext;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
index 409ca1c..e8b6268 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
@@ -18,12 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-import io.brooklyn.camp.spi.PlatformComponentTemplate.Builder;
-import io.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
-import io.brooklyn.camp.spi.pdp.Service;
-import io.brooklyn.camp.spi.resolve.PdpMatcher;
-
 import java.util.List;
 import java.util.Map;
 
@@ -31,6 +25,11 @@ import org.apache.brooklyn.api.management.ManagementContext;
 import org.apache.brooklyn.api.management.classloading.BrooklynClassLoadingContext;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampConstants;
 import org.apache.brooklyn.camp.brooklyn.BrooklynCampReservedKeys;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate.Builder;
+import org.apache.brooklyn.camp.spi.pdp.AssemblyTemplateConstructor;
+import org.apache.brooklyn.camp.spi.pdp.Service;
+import org.apache.brooklyn.camp.spi.resolve.PdpMatcher;
 import org.apache.brooklyn.core.catalog.internal.BasicBrooklynCatalog;
 import org.apache.brooklyn.core.management.classloading.JavaBrooklynClassLoadingContext;
 import org.slf4j.Logger;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java
index 1f12663..9fd4e3a 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/BrooklynServiceTypeResolver.java
@@ -18,8 +18,6 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation.service;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
 import javax.annotation.Nullable;
 
 import org.slf4j.Logger;
@@ -29,6 +27,7 @@ import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynComponentTemplateResolver;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynEntityDecorationResolver;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
 import org.apache.brooklyn.core.catalog.internal.CatalogUtils;
 
 import brooklyn.util.text.Strings;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CatalogServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CatalogServiceTypeResolver.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CatalogServiceTypeResolver.java
index c5d00e9..e374476 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CatalogServiceTypeResolver.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/CatalogServiceTypeResolver.java
@@ -18,11 +18,10 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation.service;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
 import java.util.Map;
 
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ChefServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ChefServiceTypeResolver.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ChefServiceTypeResolver.java
index fdc9c86..cda6c74 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ChefServiceTypeResolver.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/ChefServiceTypeResolver.java
@@ -18,14 +18,13 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation.service;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.brooklyn.api.catalog.CatalogItem;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
 import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynComponentTemplateResolver;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
 
 import brooklyn.entity.chef.ChefConfig;
 import brooklyn.entity.chef.ChefEntity;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/7d782f34/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/JavaServiceTypeResolver.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/JavaServiceTypeResolver.java b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/JavaServiceTypeResolver.java
index 26ad322..c630622 100644
--- a/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/JavaServiceTypeResolver.java
+++ b/usage/camp/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/creation/service/JavaServiceTypeResolver.java
@@ -18,9 +18,8 @@
  */
 package org.apache.brooklyn.camp.brooklyn.spi.creation.service;
 
-import io.brooklyn.camp.spi.PlatformComponentTemplate;
-
 import org.apache.brooklyn.api.entity.proxying.EntitySpec;
+import org.apache.brooklyn.camp.spi.PlatformComponentTemplate;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 



Mime
View raw message