brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [32/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:14 GMT
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/WindowsYamlLiveTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java
deleted file mode 100644
index a149f18..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WindowsYamlLiveTest.java
+++ /dev/null
@@ -1,410 +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 com.google.common.base.Preconditions.checkNotNull;
-import static org.testng.Assert.assertNotNull;
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.io.StringReader;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.location.MachineProvisioningLocation;
-import org.apache.brooklyn.api.mgmt.HasTaskChildren;
-import org.apache.brooklyn.api.mgmt.Task;
-import org.apache.brooklyn.core.entity.Attributes;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.core.mgmt.BrooklynTaskTags;
-import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
-import org.apache.brooklyn.entity.software.base.SoftwareProcess;
-import org.apache.brooklyn.entity.software.base.VanillaWindowsProcess;
-import org.apache.brooklyn.entity.software.base.test.location.WindowsTestFixture;
-import org.apache.brooklyn.location.winrm.WinRmMachineLocation;
-import org.apache.brooklyn.test.EntityTestUtils;
-import org.apache.brooklyn.util.core.task.TaskPredicates;
-import org.apache.brooklyn.util.text.StringPredicates;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterClass;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeClass;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.base.Joiner;
-import com.google.common.base.Optional;
-import com.google.common.base.Predicate;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.Lists;
-
-/**
- * Tests Windows YAML blueprint features.
- */
-@Test
-public class WindowsYamlLiveTest extends AbstractYamlTest {
-    
-    // TODO Remove duplication of assertStreams and VanillaWindowsProcessWinrmStreamsLiveTest.assertStreams
-    
-    private static final Logger log = LoggerFactory.getLogger(WindowsYamlLiveTest.class);
-
-    /**
-     * Maps from the task names that are used to the names used in log/exception messages.
-     */
-    private static final Map<String, String> TASK_REGEX_TO_COMMAND = ImmutableMap.<String, String>builder()
-            .put("winrm: pre-install-command.*", "pre-install-command")
-            .put("winrm: install.*", "install-command")
-            .put("winrm: post-install-command.*", "post-install-command")
-            .put("winrm: customize.*", "customize-command")
-            .put("winrm: pre-launch-command.*", "pre-launch-command")
-            .put("winrm: launch.*", "launch-command")
-            .put("winrm: post-launch-command.*", "post-launch-command")
-            .put("winrm: stop-command.*", "stop-command")
-            .put("winrm: is-running-command.*", "is-running-command")
-            .build();
-
-    protected List<String> yamlLocation;
-    protected MachineProvisioningLocation<WinRmMachineLocation> location;
-    protected WinRmMachineLocation machine;
-    protected Entity app;
-    
-    @BeforeClass(alwaysRun = true)
-    public void setUpClass() throws Exception {
-        super.setUp();
-        
-        location = WindowsTestFixture.setUpWindowsLocation(mgmt());
-        machine = (WinRmMachineLocation) location.obtain(ImmutableMap.of());
-        String ip = machine.getAddress().getHostAddress();
-        String password = machine.config().get(WinRmMachineLocation.PASSWORD);
-
-        yamlLocation = ImmutableList.of(
-                "location:",
-                "  byon:",
-                "    hosts:",
-                "    - winrm: "+ip+":5985",
-                "      password: "+password,
-                "      user: Administrator",
-                "      osFamily: windows");
-    }
-
-    @AfterClass(alwaysRun = true)
-    public void tearDownClass() {
-        try {
-            if (location != null) location.release(machine);
-        } catch (Throwable t) {
-            log.error("Caught exception in tearDownClass method", t);
-        } finally {
-            super.tearDown();
-        }
-    }
-
-    @BeforeMethod(alwaysRun = true)
-    @Override
-    public void setUp() {
-        // no-op; everything done @BeforeClass
-    }
-
-    @AfterMethod(alwaysRun = true)
-    @Override
-    public void tearDown() {
-        try {
-            if (app != null) Entities.destroy(app);
-        } catch (Throwable t) {
-            log.error("Caught exception in tearDown method", t);
-        } finally {
-            app = null;
-        }
-    }
-    
-    @Override
-    protected ManagementContextInternal mgmt() {
-        return (ManagementContextInternal) super.mgmt();
-    }
-    
-    @Test(groups="Live")
-    public void testPowershellMinimalist() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("checkRunning.powershell.command", "\"& c:\\\\exit0.bat\"")
-                .build();
-        
-        Map<String, List<String>> stdouts = ImmutableMap.of();
-        
-        runWindowsApp(cmds, stdouts, null);
-    }
-    
-    @Test(groups="Live")
-    public void testPowershell() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("pre.install.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("install.powershell.command", "\"& c:\\\\echoMyArg.ps1 -myarg myInstall\"")
-                .put("post.install.powershell.command", "\"& c:\\\\echoArg.bat myPostInstall\"")
-                .put("customize.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.bat\"")
-                .put("pre.launch.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.ps1\"")
-                .put("launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("post.launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("checkRunning.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("stop.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .build();
-        
-        Map<String, List<String>> stdouts = ImmutableMap.<String, List<String>>builder()
-                .put("winrm: install.*", ImmutableList.of("myInstall"))
-                .put("winrm: post-install-command.*", ImmutableList.of("myPostInstall"))
-                .put("winrm: customize.*", ImmutableList.of("myval"))
-                .put("winrm: pre-launch-command.*", ImmutableList.of("myval"))
-                .build();
-        
-        runWindowsApp(cmds, stdouts, null);
-    }
-    
-    @Test(groups="Live")
-    public void testBatch() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("pre.install.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\exit0.ps1\"")
-                .put("install.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\echoMyArg.ps1 -myarg myInstall\"")
-                .put("post.install.command", "\"c:\\\\echoArg.bat myPostInstall\"")
-                .put("customize.command", "\"c:\\\\echoFreemarkerMyarg.bat\"")
-                .put("pre.launch.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\echoFreemarkerMyarg.ps1\"")
-                .put("launch.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\exit0.ps1\"")
-                .put("post.launch.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\exit0.ps1\"")
-                .put("checkRunning.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\exit0.ps1\"")
-                .put("stop.command", "\"PowerShell -NonInteractive -NoProfile -Command c:\\\\exit0.ps1\"")
-                .build();
-
-        Map<String, List<String>> stdouts = ImmutableMap.<String, List<String>>builder()
-                .put("winrm: install.*", ImmutableList.of("myInstall"))
-                .put("winrm: post-install-command.*", ImmutableList.of("myPostInstall"))
-                .put("winrm: customize.*", ImmutableList.of("myval"))
-                .put("winrm: pre-launch-command.*", ImmutableList.of("myval"))
-                .build();
-        
-        runWindowsApp(cmds, stdouts, null);
-    }
-    
-    @Test(groups="Live")
-    public void testPowershellExit1() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("pre.install.powershell.command", "\"& c:\\\\exit1.ps1\"")
-                .put("install.powershell.command", "\"& c:\\\\echoMyArg.ps1 -myarg myInstall\"")
-                .put("post.install.powershell.command", "\"& c:\\\\echoArg.bat myPostInstall\"")
-                .put("customize.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.bat\"")
-                .put("pre.launch.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.ps1\"")
-                .put("launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("post.launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("checkRunning.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("stop.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .build();
-        
-        Map<String, List<String>> stdouts = ImmutableMap.of();
-        
-        runWindowsApp(cmds, stdouts, "winrm: pre-install-command.*");
-    }
-    
-    // FIXME Failing to match the expected exception, but looks fine! Needs more investigation.
-    @Test(groups="Live")
-    public void testPowershellCheckRunningExit1() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("pre.install.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("install.powershell.command", "\"& c:\\\\echoMyArg.ps1 -myarg myInstall\"")
-                .put("post.install.powershell.command", "\"& c:\\\\echoArg.bat myPostInstall\"")
-                .put("customize.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.bat\"")
-                .put("pre.launch.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.ps1\"")
-                .put("launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("post.launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("checkRunning.powershell.command", "\"& c:\\\\exit1.ps1\"")
-                .put("stop.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .build();
-        
-        Map<String, List<String>> stdouts = ImmutableMap.of();
-        
-        runWindowsApp(cmds, stdouts, "winrm: is-running-command.*");
-    }
-    
-    // FIXME Needs more work to get the stop's task that failed, so can assert got the right error message
-    @Test(groups="Live")
-    public void testPowershellStopExit1() throws Exception {
-        Map<String, String> cmds = ImmutableMap.<String, String>builder()
-                .put("myarg", "myval")
-                .put("pre.install.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("install.powershell.command", "\"& c:\\\\echoMyArg.ps1 -myarg myInstall\"")
-                .put("post.install.powershell.command", "\"& c:\\\\echoArg.bat myPostInstall\"")
-                .put("customize.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.bat\"")
-                .put("pre.launch.powershell.command", "\"& c:\\\\echoFreemarkerMyarg.ps1\"")
-                .put("launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("post.launch.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("checkRunning.powershell.command", "\"& c:\\\\exit0.ps1\"")
-                .put("stop.powershell.command", "\"& c:\\\\exit1.ps1\"")
-                .build();
-        
-        Map<String, List<String>> stdouts = ImmutableMap.of();
-        
-        runWindowsApp(cmds, stdouts, "winrm: stop-command.*");
-    }
-    
-    protected void runWindowsApp(Map<String, String> commands, Map<String, List<String>> stdouts, String taskRegexFailed) throws Exception {
-        String cmdFailed = (taskRegexFailed == null) ? null : TASK_REGEX_TO_COMMAND.get(taskRegexFailed);
-        
-        List<String> yaml = Lists.newArrayList();
-        yaml.addAll(yamlLocation);
-        yaml.addAll(ImmutableList.of(
-                "services:",
-                "- type: org.apache.brooklyn.entity.software.base.VanillaWindowsProcess",
-                "  brooklyn.config:",
-                "    onbox.base.dir.skipResolution: true",
-                "    templates.preinstall:",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.bat: c:\\echoFreemarkerMyarg.bat",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/echoFreemarkerMyarg.ps1: c:\\echoFreemarkerMyarg.ps1",
-                "    files.preinstall:",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/echoArg.bat: c:\\echoArg.bat",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/echoMyArg.ps1: c:\\echoMyArg.ps1",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/exit0.bat: c:\\exit0.bat",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/exit1.bat: c:\\exit1.bat",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/exit0.ps1: c:\\exit0.ps1",
-                "      classpath://org/apache/brooklyn/camp/brooklyn/exit1.ps1: c:\\exit1.ps1",
-                ""));
-        
-        for (Map.Entry<String, String> entry : commands.entrySet()) {
-            yaml.add("    "+entry.getKey()+": "+entry.getValue());
-        }
-
-        if (Strings.isBlank(cmdFailed)) {
-            app = createAndStartApplication(new StringReader(Joiner.on("\n").join(yaml)));
-            waitForApplicationTasks(app);
-            log.info("App started:");
-            Entities.dumpInfo(app);
-            
-            VanillaWindowsProcess entity = (VanillaWindowsProcess) app.getChildren().iterator().next();
-            
-            EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
-            assertStreams(entity, stdouts);
-            
-        } else if (cmdFailed.equals("stop-command")) {
-            app = createAndStartApplication(new StringReader(Joiner.on("\n").join(yaml)));
-            waitForApplicationTasks(app);
-            log.info("App started:");
-            Entities.dumpInfo(app);
-            VanillaWindowsProcess entity = (VanillaWindowsProcess) app.getChildren().iterator().next();
-            EntityTestUtils.assertAttributeEqualsEventually(entity, Attributes.SERVICE_UP, true);
-            
-            entity.stop();
-            assertSubTaskFailures(entity, ImmutableMap.of(taskRegexFailed, StringPredicates.containsLiteral("for "+cmdFailed)));
-            
-        } else {
-            try {
-                app = createAndStartApplication(new StringReader(Joiner.on("\n").join(yaml)));
-                fail("start should have failed for app="+app);
-            } catch (Exception e) {
-                if (e.toString().contains("invalid result") && e.toString().contains("for "+cmdFailed)) throw e;
-            }
-        }
-    }
-
-    protected void assertStreams(SoftwareProcess entity, Map<String, List<String>> stdouts) {
-        Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(mgmt().getExecutionManager(), entity);
-
-        for (Map.Entry<String, List<String>> entry : stdouts.entrySet()) {
-            String taskNameRegex = entry.getKey();
-            List<String> expectedOuts = entry.getValue();
-
-            Task<?> subTask = findTaskOrSubTask(tasks, TaskPredicates.displayNameSatisfies(StringPredicates.matchesRegex(taskNameRegex))).get();
-
-            String stdin = getStreamOrFail(subTask, BrooklynTaskTags.STREAM_STDIN);
-            String stdout = getStreamOrFail(subTask, BrooklynTaskTags.STREAM_STDOUT);
-            String stderr = getStreamOrFail(subTask, BrooklynTaskTags.STREAM_STDERR);
-            String env = getStream(subTask, BrooklynTaskTags.STREAM_ENV);
-            String msg = "stdin="+stdin+"; stdout="+stdout+"; stderr="+stderr+"; env="+env;
-
-            for (String expectedOut : expectedOuts) {
-                assertTrue(stdout.contains(expectedOut), msg);
-            }
-        }
-    }
-
-    protected void assertSubTaskFailures(SoftwareProcess entity, Map<String, Predicate<CharSequence>> taskErrs) throws Exception {
-        Set<Task<?>> tasks = BrooklynTaskTags.getTasksInEntityContext(mgmt().getExecutionManager(), entity);
-
-        for (Map.Entry<String, Predicate<CharSequence>> entry : taskErrs.entrySet()) {
-            String taskNameRegex = entry.getKey();
-            Predicate<? super String> errChecker = entry.getValue();
-            Task<?> subTask = findTaskOrSubTask(tasks, TaskPredicates.displayNameSatisfies(StringPredicates.matchesRegex(taskNameRegex))).get();
-            String msg = "regex="+taskNameRegex+"; task="+subTask;
-            assertNotNull(subTask, msg);
-            assertTrue(subTask.isDone(), msg);
-            assertTrue(subTask.isError(), msg);
-            try {
-                subTask.get();
-                fail();
-            } catch (Exception e) {
-                if (!errChecker.apply(e.toString())) {
-                    throw e;
-                }
-            }
-        }
-    }
-
-    public static String getStreamOrFail(Task<?> task, String streamType) {
-        String msg = "task="+task+"; stream="+streamType;
-        BrooklynTaskTags.WrappedStream stream = checkNotNull(BrooklynTaskTags.stream(task, streamType), "Stream null: " + msg);
-        return checkNotNull(stream.streamContents.get(), "Contents null: "+msg);
-    }
-
-    public static String getStream(Task<?> task, String streamType) {
-        BrooklynTaskTags.WrappedStream stream = BrooklynTaskTags.stream(task, streamType);
-        return (stream != null) ? stream.streamContents.get() : null;
-    }
-
-    protected Optional<Task<?>> findTaskOrSubTask(Iterable<? extends Task<?>> tasks, Predicate<? super Task<?>> matcher) {
-        List<String> taskNames = Lists.newArrayList();
-        Optional<Task<?>> result = findTaskOrSubTaskImpl(tasks, matcher, taskNames);
-        if (!result.isPresent() && log.isDebugEnabled()) {
-            log.debug("Task not found matching "+matcher+"; contender names were "+taskNames);
-        }
-        return result;
-    }
-
-    protected Optional<Task<?>> findTaskOrSubTaskImpl(Iterable<? extends Task<?>> tasks, Predicate<? super Task<?>> matcher, List<String> taskNames) {
-        for (Task<?> task : tasks) {
-            if (matcher.apply(task)) return Optional.<Task<?>>of(task);
-
-            if (!(task instanceof HasTaskChildren)) {
-                return Optional.absent();
-            } else {
-                Optional<Task<?>> subResult = findTaskOrSubTask(((HasTaskChildren) task).getChildren(), matcher);
-                if (subResult.isPresent()) return subResult;
-            }
-        }
-
-        return Optional.<Task<?>>absent();
-    }
-
-    @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/WrapAppTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java
deleted file mode 100644
index 6df5093..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/WrapAppTest.java
+++ /dev/null
@@ -1,92 +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.StringReader;
-
-import org.apache.brooklyn.core.entity.StartableApplication;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-public class WrapAppTest extends AbstractYamlTest {
-    private static final String NO_WRAP_APP_IMPLICIT =
-            "name: Empty App\n" +
-            "services:\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestApplication";
-        
-    private static final String NO_WRAP_APP_EXPLICIT =
-            "name: Empty App\n" +
-            "wrappedApp: false\n" +
-            "services:\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestApplication";
-        
-    private static final String WRAP_APP_IMPLICIT =
-            "name: Empty App\n" +
-            "services:\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestApplication\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestApplication";
-        
-    private static final String WRAP_APP_EXPLICIT =
-            "name: Empty App\n" +
-            "wrappedApp: true\n" +
-            "services:\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestApplication";
-    
-    private static final String WRAP_ENTITY =
-            "name: Empty App\n" +
-            "services:\n" +
-            "   - type: org.apache.brooklyn.core.test.entity.TestEntity";
-    
-    @Test
-    public void testNoWrapAppImplicit() throws Exception {
-        StartableApplication app = createApp(NO_WRAP_APP_IMPLICIT);
-        Assert.assertTrue(app.getChildren().size() == 0);
-    }
-    
-    @Test
-    public void testNoWrapAppExplicit() throws Exception {
-        StartableApplication app = createApp(NO_WRAP_APP_EXPLICIT);
-        Assert.assertTrue(app.getChildren().size() == 0);
-    }
-    
-    @Test
-    public void testWrapAppImplicit() throws Exception {
-        StartableApplication app = createApp(WRAP_APP_IMPLICIT);
-        Assert.assertTrue(app.getChildren().size() == 2);
-    }
-    
-    @Test
-    public void testWrapAppExplicit() throws Exception {
-        StartableApplication app = createApp(WRAP_APP_EXPLICIT);
-        Assert.assertTrue(app.getChildren().size() == 1);
-    }
-    
-    @Test
-    public void testWrapEntity() throws Exception {
-        StartableApplication app = createApp(WRAP_ENTITY);
-        Assert.assertTrue(app.getChildren().size() == 1);
-    }
-    
-    private StartableApplication createApp(String yaml) throws Exception {
-        StringReader in = new StringReader(yaml);
-        StartableApplication app = (StartableApplication)createAndStartApplication(in);
-        in.close();
-        return app;
-    }
-}

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/catalog/AbstractCatalogXmlTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.java
deleted file mode 100644
index 7985bb8..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/AbstractCatalogXmlTest.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.catalog;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.internal.BrooklynProperties;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.util.osgi.OsgiTestResources;
-import org.apache.brooklyn.core.server.BrooklynServerConfig;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.os.Os;
-import org.apache.brooklyn.util.stream.ReaderInputStream;
-import org.apache.brooklyn.util.stream.Streams;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.io.StringReader;
-
-import com.google.common.io.ByteStreams;
-
-public class AbstractCatalogXmlTest extends AbstractYamlTest {
-    
-    private String catalogUrl;
-    
-    public AbstractCatalogXmlTest(String catalogUrl) {
-        this.catalogUrl = catalogUrl;
-    }
-    
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        ResourceUtils ru = new ResourceUtils(this);
-        File jar = createJar(ru);
-        File catalog = createCatalog(ru, jar);
-
-        BrooklynProperties properties = BrooklynProperties.Factory.newEmpty();
-        properties.put(BrooklynServerConfig.BROOKLYN_CATALOG_URL, catalog.toURI().toString());
-        return LocalManagementContextForTests.builder(true)
-                .useProperties(properties)
-                .disableOsgi(false)
-                .build();
-    }
-
-    protected Entity startApp(String type) throws Exception {
-        String yaml = "name: simple-app-yaml\n" +
-                "location: localhost\n" +
-                "services: \n" +
-                "  - type: " + type;
-        return createAndStartApplication(yaml);
-    }
-
-    private File createCatalog(ResourceUtils ru, File tmpJar) {
-        String catalogTemplate = ru.getResourceAsString(catalogUrl);
-        String catalog = catalogTemplate.replace("${osgi-entities-path}", tmpJar.toURI().toString());
-        File catalogTmp = Os.newTempFile("simple-catalog-", ".xml");
-        copy(catalog, catalogTmp);
-        return catalogTmp;
-    }
-
-    private File createJar(ResourceUtils ru) {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        File tmpJar = Os.newTempFile("osgi-entities-", ".jar");
-        InputStream in = ru.getResourceFromUrl("classpath://" + OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_PATH);
-        copy(in, tmpJar);
-        return tmpJar;
-    }
-
-    private void copy(String src, File dst) {
-        try {
-            copy(new ReaderInputStream(new StringReader(src), "UTF-8"), dst);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-    private void copy(InputStream in, File tmpJar) {
-        try {
-            OutputStream out = new FileOutputStream(tmpJar);
-            ByteStreams.copy(in, out);
-            Streams.closeQuietly(in);
-            Streams.closeQuietly(out);
-        } catch (Exception e) {
-            throw Exceptions.propagate(e);
-        }
-    }
-
-}

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/catalog/CatalogOsgiVersionMoreEntityTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java
deleted file mode 100644
index 5a26f7a..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityTest.java
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.camp.brooklyn.catalog;
-
-import static org.testng.Assert.assertTrue;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.policy.PolicySpec;
-import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.camp.brooklyn.spi.creation.BrooklynEntityMatcher;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiVersionMoreEntityTest;
-import org.apache.brooklyn.core.objs.BrooklynTypes;
-import org.apache.brooklyn.core.typereg.RegisteredTypePredicates;
-import org.apache.brooklyn.core.typereg.RegisteredTypes;
-import org.apache.brooklyn.test.support.TestResourceUnavailableException;
-import org.apache.brooklyn.util.core.ResourceUtils;
-import org.apache.brooklyn.util.text.Strings;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-/** Many of the same tests as per {@link OsgiVersionMoreEntityTest} but using YAML for catalog and entities, so catalog item ID is set automatically */
-public class CatalogOsgiVersionMoreEntityTest extends AbstractYamlTest {
-    
-    private static final Logger log = LoggerFactory.getLogger(CatalogOsgiVersionMoreEntityTest.class);
-    
-    private static String getLocalResource(String filename) {
-        return ResourceUtils.create(CatalogOsgiVersionMoreEntityTest.class).getResourceAsString(
-            "classpath:/"+CatalogOsgiVersionMoreEntityTest.class.getPackage().getName().replace('.', '/')+"/"+filename);
-    }
-    
-    @Test
-    public void testMoreEntityV1() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar");
-
-        addCatalogItems(getLocalResource("more-entity-v1-osgi-catalog.yaml"));
-        RegisteredType item = mgmt().getTypeRegistry().get("more-entity");
-        Assert.assertNotNull(item);
-        Assert.assertEquals(item.getVersion(), "1.0");
-        Assert.assertTrue(RegisteredTypePredicates.IS_ENTITY.apply(item));
-        Assert.assertEquals(item.getLibraries().size(), 1);
-        
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        Assert.assertEquals(moreEntity.getCatalogItemId(), "more-entity:1.0");
-        OsgiVersionMoreEntityTest.assertV1EffectorCall(moreEntity);
-        OsgiVersionMoreEntityTest.assertV1MethodCall(moreEntity);
-    }
-
-    /** TODO we get warnings from {@link BrooklynEntityMatcher#extractValidConfigFlagsOrKeys};
-     * if we passed the correct loader at that point we could avoid those warnings. */ 
-    @Test
-    public void testMoreEntityV1WithPolicy() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("simple-policy-osgi-catalog.yaml"));
-        addCatalogItems(getLocalResource("more-entity-v1-with-policy-osgi-catalog.yaml"));
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        Assert.assertEquals(moreEntity.getCatalogItemId(), "more-entity:1.0");
-        
-        Assert.assertEquals(moreEntity.policies().size(), 1, "wrong policies: "+moreEntity.policies());
-        Policy policy = Iterables.getOnlyElement(moreEntity.policies());
-        // it was loaded by yaml w ref to catalog, so should have the simple-policy catalog-id
-        Assert.assertEquals(policy.getCatalogItemId(), "simple-policy:1.0");
-    }
-
-    @Test
-    public void testMoreEntityV2() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("more-entity-v2-osgi-catalog.yaml"));
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        Assert.assertEquals(moreEntity.getCatalogItemId(), "more-entity:1.0");
-        OsgiVersionMoreEntityTest.assertV2EffectorCall(moreEntity);
-        OsgiVersionMoreEntityTest.assertV2MethodCall(moreEntity);
-        
-        Assert.assertEquals(moreEntity.policies().size(), 1, "wrong policies: "+moreEntity.policies());
-        Policy policy = Iterables.getOnlyElement(moreEntity.policies());
-        // it was loaded from the java so should have the base more-entity catalog id
-        Assert.assertEquals(policy.getCatalogItemId(), "more-entity:1.0");
-    }
-
-    @Test
-    /** TODO this test works if we assume most recent version wins, but semantics TBC */
-    public void testMoreEntityV2ThenV1GivesV1() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("more-entity-v2-osgi-catalog.yaml"));
-        forceCatalogUpdate();
-        addCatalogItems(getLocalResource("more-entity-v1-osgi-catalog.yaml"));
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        OsgiVersionMoreEntityTest.assertV1EffectorCall(moreEntity);
-        OsgiVersionMoreEntityTest.assertV1MethodCall(moreEntity);
-    }
-
-    /** unlike {@link #testMoreEntityV2ThenV1GivesV1()} this test should always work,
-     * because default should probably be either most-recent version or highest version,
-     * in either case this works */
-    @Test
-    public void testMoreEntityV1ThenV2GivesV2() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("more-entity-v1-osgi-catalog.yaml"));
-        forceCatalogUpdate();
-        addCatalogItems(getLocalResource("more-entity-v2-osgi-catalog.yaml"));
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        OsgiVersionMoreEntityTest.assertV2EffectorCall(moreEntity);
-        OsgiVersionMoreEntityTest.assertV2MethodCall(moreEntity);
-    }
-
-    @Test
-    public void testMoreEntityBothV1AndV2() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.1.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("more-entity-v1-called-v1-osgi-catalog.yaml"));
-        addCatalogItems(getLocalResource("more-entity-v2-osgi-catalog.yaml"));
-        Entity v1 = createAndStartApplication("services: [ { type: 'more-entity-v1:1.0' } ]");
-        Entity v2 = createAndStartApplication("services: [ { type: 'more-entity:1.0' } ]");
-        
-        Entity moreEntityV1 = Iterables.getOnlyElement(v1.getChildren());
-        Entity moreEntityV2 = Iterables.getOnlyElement(v2.getChildren());
-        
-        OsgiVersionMoreEntityTest.assertV1EffectorCall(moreEntityV1);
-        OsgiVersionMoreEntityTest.assertV1MethodCall(moreEntityV1);
-        
-        OsgiVersionMoreEntityTest.assertV2EffectorCall(moreEntityV2);
-        OsgiVersionMoreEntityTest.assertV2MethodCall(moreEntityV2);
-    }
-
-    @Test
-    public void testMoreEntityV2AutoscanWithClasspath() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-        
-        addCatalogItems(getLocalResource("more-entities-osgi-catalog-scan.yaml"));
-        
-        log.info("autoscan for osgi found catalog items: "+Strings.join(mgmt().getCatalog().getCatalogItems(), ", "));
-
-        RegisteredType item = mgmt().getTypeRegistry().get("more-entity");
-        Assert.assertNotNull(item);
-        Assert.assertEquals(item.getVersion(), "2.0.test");
-        Assert.assertTrue(RegisteredTypePredicates.IS_ENTITY.apply(item));
-        
-        // this refers to the java item, where the libraries are defined
-        item = mgmt().getTypeRegistry().get("org.apache.brooklyn.test.osgi.entities.more.MoreEntity");
-        Assert.assertEquals(item.getVersion(), "2.0.test_java");
-        Assert.assertEquals(item.getLibraries().size(), 2);
-        
-        Entity app = createAndStartApplication("services: [ { type: 'more-entity:2.0.test' } ]");
-        Entity moreEntity = Iterables.getOnlyElement(app.getChildren());
-        
-        Assert.assertEquals(moreEntity.getCatalogItemId(), "more-entity:2.0.test");
-        OsgiVersionMoreEntityTest.assertV2EffectorCall(moreEntity);
-        OsgiVersionMoreEntityTest.assertV2MethodCall(moreEntity);
-    }
-
-    @Test
-    public void testMorePolicyV2AutoscanWithClasspath() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-        
-        addCatalogItems(getLocalResource("more-policies-osgi-catalog-scan.yaml"));
-        
-        log.info("autoscan for osgi found catalog items: "+Strings.join(mgmt().getCatalog().getCatalogItems(), ", "));
-
-        RegisteredType item = mgmt().getTypeRegistry().get("more-policy");
-        Assert.assertNotNull(item);
-        Assert.assertEquals(item.getVersion(), "2.0.test");
-        Assert.assertTrue(RegisteredTypePredicates.IS_POLICY.apply(item));
-        
-        // this refers to the java item, where the libraries are defined
-        item = mgmt().getTypeRegistry().get("org.apache.brooklyn.test.osgi.entities.more.MorePolicy");
-        Assert.assertEquals(item.getVersion(), "2.0.test_java");
-        Assert.assertEquals(item.getLibraries().size(), 2);
-        
-        Entity app = createAndStartApplication(
-                "services: ",
-                "- type: org.apache.brooklyn.entity.stock.BasicEntity",
-                "  brooklyn.policies:",
-                "  - type: more-policy:2.0.test");
-        Entity basicEntity = Iterables.getOnlyElement(app.getChildren());
-        Policy morePolicy = Iterables.getOnlyElement(basicEntity.policies());
-        
-        Assert.assertEquals(morePolicy.getCatalogItemId(), "more-policy:2.0.test");
-        OsgiVersionMoreEntityTest.assertV2MethodCall(morePolicy);
-    }
-
-    @Test
-    public void testAutoscanWithClasspathCanCreateSpecs() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-more-entities_0.2.0.jar");
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), "/brooklyn/osgi/brooklyn-test-osgi-entities.jar");
-
-        addCatalogItems(getLocalResource("more-entities-osgi-catalog-scan.yaml"));
-
-        log.info("autoscan for osgi found catalog items: "+Strings.join(mgmt().getTypeRegistry().getAll(), ", "));
-
-        BrooklynTypeRegistry types = mgmt().getTypeRegistry();
-        Iterable<RegisteredType> items = types.getAll();
-        for (RegisteredType item: items) {
-            Object spec = types.createSpec(item, null, null);
-            int match = 0;
-            if (RegisteredTypes.isSubtypeOf(item, Entity.class)) {
-                assertTrue(spec instanceof EntitySpec, "Not an EntitySpec: " + spec);
-                BrooklynTypes.getDefinedEntityType(((EntitySpec<?>)spec).getType());
-                match++;
-            }
-            if (RegisteredTypes.isSubtypeOf(item, Policy.class)) {
-                assertTrue(spec instanceof PolicySpec, "Not a PolicySpec: " + spec);
-                BrooklynTypes.getDefinedBrooklynType(((PolicySpec<?>)spec).getType());
-                match++;
-            }
-            if (RegisteredTypes.isSubtypeOf(item, Location.class)) {
-                assertTrue(spec instanceof LocationSpec, "Not a LocationSpec: " + spec);
-                BrooklynTypes.getDefinedBrooklynType(((LocationSpec<?>)spec).getType());
-                match++;
-            }
-            if (match==0) {
-                Assert.fail("Unexpected type: "+item+" ("+item.getSuperTypes()+")");
-            }
-        }
-    }
-
-}

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/catalog/CatalogXmlOsgiTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlOsgiTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlOsgiTest.java
deleted file mode 100644
index 2161fec..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlOsgiTest.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.camp.brooklyn.catalog;
-
-import org.testng.annotations.Test;
-
-public class CatalogXmlOsgiTest extends AbstractCatalogXmlTest {
-
-    public CatalogXmlOsgiTest(String catalogUrl) {
-        super("classpath://osgi-catalog.xml");
-    }
-
-    @Test
-    public void testOsgiItem() throws Exception {
-        startApp("OsgiApp");
-        // previously OSGi libraries were not supported with old-style catalog items;
-        // now they are (2015-10), even though the XML is not supported,
-        // we may use the same type instantiator from CAMP and elsewhere
-    }
-
-}

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/catalog/CatalogXmlVersionTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlVersionTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlVersionTest.java
deleted file mode 100644
index b47bf76..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogXmlVersionTest.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.catalog;
-
-import static org.testng.Assert.assertTrue;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.testng.annotations.DataProvider;
-import org.testng.annotations.Test;
-
-public class CatalogXmlVersionTest extends AbstractCatalogXmlTest {
-
-    public CatalogXmlVersionTest(String catalogUrl) {
-        super("classpath://simple-catalog.xml");
-    }
-
-    @DataProvider(name = "types")
-    public Object[][] createTypes() {
-        return new Object[][] {
-                {"org.apache.brooklyn.entity.stock.BasicApplication"},
-                {"org.apache.brooklyn.entity.stock.BasicApplication:0.0.0.SNAPSHOT"},
-                {"org.apache.brooklyn.entity.stock.BasicApplication:2.0"},
-                {"BasicApp"}, // test that items with symbolicName not matching the type work
-                {"BasicApp:0.0.0.SNAPSHOT"},
-                {"BasicApp:2.0"},
-                {"org.apache.brooklyn.test.osgi.entities.SimpleApplication"}, //test that classpath is used
-        };
-    }
-
-    @Test(dataProvider = "types")
-    public void testXmlCatalogItem(String type) throws Exception {
-        startApp(type);
-    }
-
-    @Test
-    public void testJavaPrefixDoesNotLoadXMLCatalogItem() throws Exception {
-        Entity entity = startApp("java:org.apache.brooklyn.camp.brooklyn.catalog.TestBasicApp");
-        assertTrue(entity instanceof TestBasicApp, "Entity is not a " + TestBasicApp.class.getName() + ", instead the type is " + entity.getEntityType().getName());
-    }
-
-}

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/catalog/CatalogYamlAppTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java
deleted file mode 100644
index f4e58be..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlAppTest.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.camp.brooklyn.catalog;
-
-import org.testng.annotations.Test;
-
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-
-
-public class CatalogYamlAppTest extends AbstractYamlTest {
-
-    @Override
-    protected LocalManagementContext newTestManagementContext() {
-        // Don't need osgi
-        return LocalManagementContextForTests.newInstance();
-    }
-
-    /**
-     * "Contrived" example was encountered by a customer in a real use-case!
-     * I couldn't yet simplify it further while still reproducing the failure.
-     * Throws StackOverlfowError, without giving a nice error message about 
-     * "BasicEntity" cyclic reference.
-     * 
-     * The circular reference comes from the member spec referencing 
-     * "org.apache.brooklyn.entity.stock.BasicEntity", but that has been defined in the
-     * catalog as this new blueprint (which overrides the previous value of it
-     * being a reference to the Java class).
-     * 
-     * We need to use an id that matches something else already on the classpath.
-     * Otherwise we'd get an error telling us "could not resolve item ..." when
-     * attempting to add the initial catalog item.
-     */
-    @Test(groups="WIP") // TODO Fix this!
-    public void testAddCatalogItemWithCircularReference() throws Exception {
-        // Add a catalog item with a circular reference to its own id.
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: org.apache.brooklyn.entity.stock.BasicEntity",
-                "  version: "+TEST_VERSION,
-                "services:",
-                "- type: org.apache.brooklyn.entity.stock.BasicApplication",
-                "  brooklyn.config:",
-                "    memberSpec:",
-                "      $brooklyn:entitySpec:",
-                "      - type: org.apache.brooklyn.entity.stock.BasicApplication",
-                "        brooklyn.children:",
-                "        - type: org.apache.brooklyn.entity.stock.BasicEntity");
-
-        try {
-            // Use the blueprint from the catalog that has the circular reference.
-            // This should really give a nice error (rather than a StackOverflowError!).
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: another.app.in.the.catalog",
-                    "  version: "+TEST_VERSION,
-                    "services:",
-                    "- type: org.apache.brooklyn.entity.stock.BasicEntity");
-            deleteCatalogEntity("another.app.in.the.catalog");
-        } finally {
-            deleteCatalogEntity("org.apache.brooklyn.entity.stock.BasicEntity");
-        }
-    }
-
-    @Test // same as above, but the minimal possible setup
-    public void testAddCatalogItemWithMemberSpecCircularReference() throws Exception {
-        // Add a catalog item with a circular reference to its own id through a $brooklyn:entitySpec
-        addCatalogItems(
-                "brooklyn.catalog:",
-                "  id: org.apache.brooklyn.entity.stock.BasicApplication",
-                "  version: "+TEST_VERSION,
-                "services:",
-                "- type: org.apache.brooklyn.entity.stock.BasicApplication",
-                "  brooklyn.config:",
-                "    memberSpec:",
-                "      $brooklyn:entitySpec:",
-                "      - type: org.apache.brooklyn.entity.stock.BasicApplication");
-
-        try {
-            // Use the blueprint from the catalog that has the circular reference.
-            addCatalogItems(
-                    "brooklyn.catalog:",
-                    "  id: another.app.in.the.catalog",
-                    "  version: "+TEST_VERSION,
-                    "services:",
-                    "- type: org.apache.brooklyn.entity.stock.BasicApplication");
-            deleteCatalogEntity("another.app.in.the.catalog");
-        } finally {
-            deleteCatalogEntity("org.apache.brooklyn.entity.stock.BasicApplication");
-        }
-    }
-}

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/catalog/CatalogYamlCombiTest.java
----------------------------------------------------------------------
diff --git a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java b/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java
deleted file mode 100644
index 8ce0023..0000000
--- a/brooklyn-server/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlCombiTest.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.camp.brooklyn.catalog;
-
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.typereg.RegisteredType;
-import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest;
-import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.Entities;
-import org.apache.brooklyn.entity.stock.BasicEntity;
-import org.apache.brooklyn.entity.stock.BasicStartable;
-import org.apache.brooklyn.policy.ha.ServiceRestarter;
-import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.Assert;
-import org.testng.annotations.Test;
-
-import com.google.common.collect.Iterables;
-
-
-public class CatalogYamlCombiTest extends AbstractYamlTest {
-
-    private static final Logger log = LoggerFactory.getLogger(CatalogYamlCombiTest.class);
-    
-    @Test
-    public void testBRefEntityA() throws Exception {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  version: "+TEST_VERSION,
-            "  items:",
-            
-            "  - itemType: entity",
-            "    item:",
-            // TODO inclusion of the above information gives a better error message when no transformers
-//            "  - item:",
-            
-            "      id: A",
-            "      type: "+BasicEntity.class.getName(),
-            "      brooklyn.config: { a: 1, b: 0 }",
-            "  - item:",
-            "      id: B",
-            "      type: A",
-            "      brooklyn.config: { b: 1 }");
-
-        RegisteredType item = mgmt().getTypeRegistry().get("B", TEST_VERSION);
-        Assert.assertNotNull(item);
-
-        Entity a = launchEntity("A");
-        Assert.assertTrue(BasicEntity.class.isInstance(a), "Wrong type: "+a);
-        Assert.assertEquals(a.config().get(ConfigKeys.newIntegerConfigKey("a")), (Integer)1);
-        Assert.assertEquals(a.config().get(ConfigKeys.newIntegerConfigKey("b")), (Integer)0);
-
-        Entity b = launchEntity("B");
-        Assert.assertTrue(BasicEntity.class.isInstance(b), "Wrong type: "+b);
-        Assert.assertEquals(b.config().get(ConfigKeys.newIntegerConfigKey("a")), (Integer)1);
-        Assert.assertEquals(b.config().get(ConfigKeys.newIntegerConfigKey("b")), (Integer)1);
-
-        deleteCatalogEntity("A");
-        
-        // now loading B makes an error
-        try {
-            launchEntity("B");
-            Assert.fail("B should not be launchable");
-        } catch (Exception e) {
-            Exceptions.propagateIfFatal(e);
-            log.info("Got expected error: "+e);
-        }
-        
-        deleteCatalogEntity("B");
-    }
-
-    @Test
-    public void testBRefPolicyALocationZ() throws Exception {
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  version: "+TEST_VERSION,
-            "  id: Z",
-            "  items:",
-            "  - item: ",
-            "      type: localhost",
-            "      brooklyn.config: { z: 9 }");
-        addCatalogItems(
-            "brooklyn.catalog:",
-            "  version: "+TEST_VERSION,
-            "  items:",
-            "  - item_type: policy", 
-            "    item:",
-            "      id: A",
-            "      type: "+ServiceRestarter.class.getName(),
-            "      brooklyn.config: { a: 99 }",
-            "  - item:",
-            "      id: B",
-            "      type: "+BasicStartable.class.getName(),
-            "      location: Z",
-            "      brooklyn.policies:",
-            "      - type: A");
-
-        RegisteredType item = mgmt().getTypeRegistry().get("A", TEST_VERSION);
-        Assert.assertNotNull(item);
-
-        Entity b = launchEntity("B", false);
-        Assert.assertTrue(BasicStartable.class.isInstance(b), "Wrong type: "+b);
-        Entities.dumpInfo(b);
-        
-        Assert.assertEquals(Iterables.getOnlyElement(b.getLocations()).getConfig(ConfigKeys.newIntegerConfigKey("z")), (Integer)9);
-        
-        Policy p = Iterables.getOnlyElement(b.policies());
-        Assert.assertTrue(ServiceRestarter.class.isInstance(p), "Wrong type: "+p);
-        Assert.assertEquals(p.getConfig(ConfigKeys.newIntegerConfigKey("a")), (Integer)99);
-        
-        deleteCatalogEntity("A");
-        deleteCatalogEntity("B");
-        deleteCatalogEntity("Z");
-    }
-
-    private Entity launchEntity(String symbolicName) throws Exception {
-        return launchEntity(symbolicName, true);
-    }
-    
-    private Entity launchEntity(String symbolicName, boolean includeLocation) throws Exception {
-        String yaml = "name: simple-app-yaml\n" +
-                      (includeLocation ? "location: localhost\n" : "") +
-                      "services: \n" +
-                      "  - type: "+ver(symbolicName);
-        Entity app = createAndStartApplication(yaml);
-        return Iterables.getOnlyElement(app.getChildren());
-    }
-
-
-}


Mime
View raw message