You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by he...@apache.org on 2015/08/19 13:10:10 UTC

[52/72] [abbrv] incubator-brooklyn git commit: BROOKLYN-162 - jclouds last few package prefixes needed, and tidy in core and elsewhere related (or observed in the process)

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/InMemoryObjectStore.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/InMemoryObjectStore.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/InMemoryObjectStore.java
deleted file mode 100644
index b0467fd..0000000
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/InMemoryObjectStore.java
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.core.mgmt.rebind.persister;
-
-import java.util.Date;
-import java.util.List;
-import java.util.Map;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode;
-import org.apache.brooklyn.core.mgmt.rebind.persister.PersistMode;
-import org.apache.brooklyn.core.mgmt.rebind.persister.PersistenceObjectStore;
-import org.apache.brooklyn.core.mgmt.rebind.persister.StoreObjectAccessorLocking;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Objects;
-
-public class InMemoryObjectStore implements PersistenceObjectStore {
-
-    private static final Logger log = LoggerFactory.getLogger(InMemoryObjectStore.class);
-
-    final Map<String,String> filesByName;
-    final Map<String, Date> fileModTimesByName;
-    boolean prepared = false;
-    
-    public InMemoryObjectStore() {
-        this(MutableMap.<String,String>of(), MutableMap.<String,Date>of());
-    }
-    
-    public InMemoryObjectStore(Map<String,String> map, Map<String, Date> fileModTimesByName) {
-        filesByName = map;
-        this.fileModTimesByName = fileModTimesByName;
-        log.debug("Using memory-based objectStore");
-    }
-    
-    @Override
-    public String getSummaryName() {
-        return "in-memory (test) persistence store";
-    }
-    
-    @Override
-    public void prepareForMasterUse() {
-    }
-
-    @Override
-    public void createSubPath(String subPath) {
-    }
-
-    @Override
-    public StoreObjectAccessor newAccessor(final String path) {
-        if (!prepared) throw new IllegalStateException("prepare method not yet invoked: "+this);
-        return new StoreObjectAccessorLocking(new SingleThreadedInMemoryStoreObjectAccessor(filesByName, fileModTimesByName, path));
-    }
-    
-    public static class SingleThreadedInMemoryStoreObjectAccessor implements StoreObjectAccessor {
-        private final Map<String, String> map;
-        private final Map<String, Date> mapModTime;
-        private final String key;
-
-        public SingleThreadedInMemoryStoreObjectAccessor(Map<String,String> map, Map<String, Date> mapModTime, String key) {
-            this.map = map;
-            this.mapModTime = mapModTime;
-            this.key = key;
-        }
-        @Override
-        public String get() {
-            synchronized (map) {
-                return map.get(key);
-            }
-        }
-        @Override
-        public byte[] getBytes() {
-            return get().getBytes();
-        }
-        @Override
-        public boolean exists() {
-            synchronized (map) {
-                return map.containsKey(key);
-            }
-        }
-        @Override
-        public void put(String val) {
-            synchronized (map) {
-                map.put(key, val);
-                mapModTime.put(key, new Date());
-            }
-        }
-        @Override
-        public void append(String val) {
-            synchronized (map) {
-                String val2 = get();
-                if (val2==null) val2 = val;
-                else val2 = val2 + val;
-
-                map.put(key, val2);
-                mapModTime.put(key, new Date());
-            }
-        }
-        @Override
-        public void delete() {
-            synchronized (map) {
-                map.remove(key);
-                mapModTime.remove(key);
-            }
-        }
-        @Override
-        public Date getLastModifiedDate() {
-            synchronized (map) {
-                return mapModTime.get(key);
-            }
-        }
-    }
-
-    @Override
-    public List<String> listContentsWithSubPath(final String parentSubPath) {
-        if (!prepared) throw new IllegalStateException("prepare method not yet invoked: "+this);
-        synchronized (filesByName) {
-            List<String> result = MutableList.of();
-            for (String file: filesByName.keySet())
-                if (file.startsWith(parentSubPath))
-                    result.add(file);
-            return result;
-        }
-    }
-
-    @Override
-    public void close() {
-    }
-
-    @Override
-    public String toString() {
-        return Objects.toStringHelper(this).add("size", filesByName.size()).toString();
-    }
-
-    @Override
-    public void injectManagementContext(ManagementContext mgmt) {
-    }
-    
-    @Override
-    public void prepareForSharedUse(PersistMode persistMode, HighAvailabilityMode haMode) {
-        prepared = true;
-    }
-
-    @Override
-    public void deleteCompletely() {
-        synchronized (filesByName) {
-            filesByName.clear();
-        }
-    }
-
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/InMemoryStoreObjectAccessorWriterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/InMemoryStoreObjectAccessorWriterTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/InMemoryStoreObjectAccessorWriterTest.java
deleted file mode 100644
index 01c6399..0000000
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/InMemoryStoreObjectAccessorWriterTest.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.core.mgmt.rebind.persister;
-
-import java.io.IOException;
-
-import org.apache.brooklyn.core.mgmt.rebind.persister.StoreObjectAccessorLocking;
-import org.apache.brooklyn.core.mgmt.rebind.persister.PersistenceObjectStore.StoreObjectAccessorWithLock;
-import org.testng.annotations.Test;
-
-@Test
-public class InMemoryStoreObjectAccessorWriterTest extends PersistenceStoreObjectAccessorWriterTestFixture {
-
-    protected StoreObjectAccessorWithLock newPersistenceStoreObjectAccessor() throws IOException {
-        InMemoryObjectStore store = new InMemoryObjectStore();
-        store.prepareForSharedUse(null, null);
-        return new StoreObjectAccessorLocking(store.newAccessor("foo"));
-    }
-    
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/ListeningObjectStore.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/ListeningObjectStore.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/ListeningObjectStore.java
deleted file mode 100644
index 374ec74..0000000
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/ListeningObjectStore.java
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.core.mgmt.rebind.persister;
-
-import java.util.Date;
-import java.util.List;
-import java.util.concurrent.TimeoutException;
-import java.util.concurrent.atomic.AtomicInteger;
-import java.util.concurrent.atomic.AtomicLong;
-
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.ha.HighAvailabilityMode;
-import org.apache.brooklyn.core.mgmt.rebind.persister.PersistMode;
-import org.apache.brooklyn.core.mgmt.rebind.persister.PersistenceObjectStore;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.text.Strings;
-import org.apache.brooklyn.util.time.CountdownTimer;
-import org.apache.brooklyn.util.time.Duration;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-
-import com.google.common.base.Preconditions;
-
-public class ListeningObjectStore implements PersistenceObjectStore {
-
-    protected final PersistenceObjectStore delegate;
-    protected final List<ObjectStoreTransactionListener> listeners = MutableList.of();
-    private boolean writesFailSilently = false;
-
-    public static interface ObjectStoreTransactionListener {
-        public void recordQueryOut(String summary, int size);
-        public void recordDataOut(String summary, int size);
-        public void recordDataIn(String summary, int size);
-    }
-    
-    public static class RecordingTransactionListener implements ObjectStoreTransactionListener {
-        private static final Logger log = LoggerFactory.getLogger(ListeningObjectStore.RecordingTransactionListener.class);
-        
-        protected final String prefix;
-        protected final AtomicLong bytesIn = new AtomicLong();
-        protected final AtomicLong bytesOut = new AtomicLong();
-        protected final AtomicInteger countQueriesOut = new AtomicInteger();
-        protected final AtomicInteger countDataOut = new AtomicInteger();
-        protected final AtomicInteger countDataIn = new AtomicInteger();
-        
-        public RecordingTransactionListener(String prefix) {
-            this.prefix = prefix;
-        }
-        
-        public long getBytesIn() {
-            return bytesIn.get();
-        }
-        
-        public long getBytesOut() {
-            return bytesOut.get();
-        }
-        
-        public int getCountQueriesOut() {
-            return countQueriesOut.get();
-        }
-        
-        public int getCountDataOut() {
-            return countDataOut.get();
-        }
-        
-        public int getCountDataIn() {
-            return countDataIn.get();
-        }
-        
-        public String getTotalString() {
-            return "totals: out="+Strings.makeSizeString(bytesOut.get())+" in="+Strings.makeSizeString(bytesIn.get());
-        }
-        
-        @Override
-        public void recordQueryOut(String summary, int size) {
-            synchronized (this) { this.notifyAll(); }
-            bytesOut.addAndGet(size);
-            countQueriesOut.incrementAndGet();
-            log.info(prefix+" "+summary+" -->"+size+"; "+getTotalString());
-        }
-        
-        @Override
-        public void recordDataOut(String summary, int size) {
-            synchronized (this) { this.notifyAll(); }
-            bytesOut.addAndGet(size);
-            countDataOut.incrementAndGet();
-            log.info(prefix+" "+summary+" -->"+size+"; "+getTotalString());
-        }
-        
-        @Override
-        public void recordDataIn(String summary, int size) {
-            synchronized (this) { this.notifyAll(); }
-            bytesIn.addAndGet(size);
-            countDataIn.incrementAndGet();
-            log.info(prefix+" "+summary+" <--"+size+"; "+getTotalString());
-        }
-
-        public void blockUntilDataWrittenExceeds(long count, Duration timeout) throws InterruptedException, TimeoutException {
-            CountdownTimer timer = CountdownTimer.newInstanceStarted(timeout);
-            synchronized (this) {
-                while (bytesOut.get()<count) {
-                    if (timer.isExpired())
-                        throw new TimeoutException();
-                    timer.waitOnForExpiry(this);
-                }
-            }
-        }
-    }
-
-    public ListeningObjectStore(PersistenceObjectStore delegate, ObjectStoreTransactionListener ...listeners) {
-        this.delegate = Preconditions.checkNotNull(delegate);
-        for (ObjectStoreTransactionListener listener: listeners)
-            this.listeners.add(listener);
-    }
-
-    @Override
-    public String getSummaryName() {
-        return delegate.getSummaryName();
-    }
-
-    @Override
-    public void prepareForMasterUse() {
-        delegate.prepareForMasterUse();
-    }
-
-    @Override
-    public StoreObjectAccessor newAccessor(String path) {
-        return new ListeningAccessor(path, delegate.newAccessor(path));
-    }
-
-    @Override
-    public void createSubPath(String subPath) {
-        if (writesFailSilently)
-            return;
-        
-        for (ObjectStoreTransactionListener listener: listeners)
-            listener.recordQueryOut("creating path "+subPath, 1+subPath.length());
-        delegate.createSubPath(subPath);
-    }
-
-    @Override
-    public List<String> listContentsWithSubPath(String subPath) {
-        for (ObjectStoreTransactionListener listener: listeners)
-            listener.recordQueryOut("requesting list "+subPath, 1+subPath.length());
-        
-        List<String> result = delegate.listContentsWithSubPath(subPath);
-        
-        for (ObjectStoreTransactionListener listener: listeners)
-            listener.recordDataIn("receiving list "+subPath, result.toString().length());
-        return result;
-    }
-
-    @Override
-    public void close() {
-        delegate.close();
-    }
-
-    @Override
-    public void injectManagementContext(ManagementContext managementContext) {
-        delegate.injectManagementContext(managementContext);
-    }
-    
-    @Override
-    public void prepareForSharedUse(PersistMode persistMode, HighAvailabilityMode haMode) {
-        delegate.prepareForSharedUse(persistMode, haMode);
-    }
-
-    @Override
-    public void deleteCompletely() {
-        for (ObjectStoreTransactionListener listener: listeners)
-            listener.recordDataOut("deleting completely", 1);
-        delegate.deleteCompletely();
-    }
-
-    public class ListeningAccessor implements StoreObjectAccessor {
-
-        protected final String path;
-        protected final StoreObjectAccessor delegate;
-        
-        public ListeningAccessor(String path, StoreObjectAccessor delegate) {
-            this.path = path;
-            this.delegate = delegate;
-        }
-        @Override
-        public boolean exists() {
-            return delegate.exists();
-        }
-        @Override
-        public void put(String val) {
-            if (writesFailSilently)
-                return;
-
-            for (ObjectStoreTransactionListener listener: listeners)
-                listener.recordDataOut("writing "+path, val.length());
-            delegate.put(val);
-        }
-        @Override
-        public void append(String s) {
-            if (writesFailSilently)
-                return;
-
-            for (ObjectStoreTransactionListener listener: listeners)
-                listener.recordDataOut("appending "+path, s.length());
-            delegate.append(s);
-        }
-        @Override
-        public void delete() {
-            if (writesFailSilently)
-                return;
-
-            for (ObjectStoreTransactionListener listener: listeners)
-                listener.recordQueryOut("deleting "+path, path.length());
-            delegate.delete();
-        }
-        @Override
-        public String get() {
-            for (ObjectStoreTransactionListener listener: listeners)
-                listener.recordQueryOut("requesting "+path, path.length());
-            String result = delegate.get();
-            
-            for (ObjectStoreTransactionListener listener: listeners)
-                listener.recordDataIn("reading "+path, (result==null ? 0 : result.length()));
-            return result;
-        }
-        @Override
-        public byte[] getBytes() {
-            return get().getBytes();
-        }
-        @Override
-        public Date getLastModifiedDate() {
-            return delegate.getLastModifiedDate();
-        }
-    }
-
-    public void setWritesFailSilently(boolean writesFailSilently) {
-        this.writesFailSilently = writesFailSilently;
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/PersistenceStoreObjectAccessorWriterTestFixture.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/PersistenceStoreObjectAccessorWriterTestFixture.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/PersistenceStoreObjectAccessorWriterTestFixture.java
deleted file mode 100644
index 27cbf25..0000000
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/PersistenceStoreObjectAccessorWriterTestFixture.java
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.core.mgmt.rebind.persister;
-
-import static org.testng.Assert.assertEquals;
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.io.IOException;
-import java.util.Date;
-import java.util.concurrent.Executors;
-
-import org.apache.brooklyn.core.mgmt.rebind.persister.PersistenceObjectStore.StoreObjectAccessorWithLock;
-import org.apache.brooklyn.util.text.Identifiers;
-import org.apache.brooklyn.util.time.Duration;
-import org.apache.brooklyn.util.time.Time;
-import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
-import com.google.common.util.concurrent.ListeningExecutorService;
-import com.google.common.util.concurrent.MoreExecutors;
-
-public abstract class PersistenceStoreObjectAccessorWriterTestFixture {
-
-    private static final Duration TIMEOUT = Duration.TEN_SECONDS;
-    
-    protected ListeningExecutorService executor;
-    protected StoreObjectAccessorWithLock accessor;
-    
-    @BeforeMethod(alwaysRun=true)
-    public void setUp() throws Exception {
-        executor = MoreExecutors.listeningDecorator(Executors.newCachedThreadPool());
-        accessor = newPersistenceStoreObjectAccessor();
-    }
-
-    protected abstract StoreObjectAccessorWithLock newPersistenceStoreObjectAccessor() throws IOException;
-    
-    @AfterMethod(alwaysRun=true)
-    public void tearDown() throws Exception {
-        if (accessor != null) {
-            accessor.delete();
-            accessor.waitForCurrentWrites(Duration.TEN_SECONDS);
-        }
-        if (executor != null) executor.shutdownNow();
-    }
-
-    @Test
-    public void testWritesFile() throws Exception {
-        accessor.put("abc");
-        accessor.waitForCurrentWrites(TIMEOUT);
-
-        assertEquals(accessor.get(), "abc");
-    }
-
-    @Test
-    public void testExists() throws Exception {
-        accessor.put("abc");
-        accessor.waitForCurrentWrites(TIMEOUT);
-        assertTrue(accessor.exists());
-        
-        accessor.delete();
-        accessor.waitForCurrentWrites(TIMEOUT);
-        assertFalse(accessor.exists());
-    }
-    
-    @Test
-    public void testAppendsFile() throws Exception {
-        accessor.put("abc\n");
-        accessor.append("def\n");
-        accessor.waitForCurrentWrites(TIMEOUT);
-
-        assertEquals(accessor.get(), "abc\ndef\n");
-    }
-
-    /** most storage systems support <= 1ms resolution; but some file systems -- esp FAT and OSX HFS+ are much much higher! */
-    protected Duration getLastModifiedResolution() {
-        return Duration.millis(1);
-    }
-    
-    @Test
-    public void testLastModifiedTime() throws Exception {
-        accessor.delete();
-        Assert.assertNull(accessor.getLastModifiedDate());
-        accessor.put("abc");
-        accessor.waitForCurrentWrites(TIMEOUT);
-        Date write1 = accessor.getLastModifiedDate();
-        Assert.assertNotNull(write1);
-        
-        Time.sleep(getLastModifiedResolution().times(2));
-        accessor.put("abc");
-        accessor.waitForCurrentWrites(TIMEOUT);
-        Date write2 = accessor.getLastModifiedDate();
-        Assert.assertNotNull(write2);
-        Assert.assertTrue(write2.after(write1), "dates are "+write1+" ("+write1.getTime()+") and "+write2+" ("+write2.getTime()+") ");
-    }
-    
-    @Test
-    public void testWriteBacklogThenDeleteWillLeaveFileDeleted() throws Exception {
-        String big = makeBigString(biggishSize());
-        
-        accessor.put(big);
-        accessor.put(big);
-        accessor.delete();
-        
-        accessor.waitForCurrentWrites(TIMEOUT);
-        assertFalse(accessor.exists());
-    }
-
-    protected int biggishSize() {
-        return 100000;
-    }
-    
-    protected String makeBigString(int size) {
-        // prefer non-random so can't be compressed
-        return Identifiers.makeRandomBase64Id(size);
-//        return com.google.common.base.Strings.repeat("x", size);
-    }
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/XmlMementoSerializerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/XmlMementoSerializerTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/XmlMementoSerializerTest.java
deleted file mode 100644
index 6cf46d7..0000000
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/persister/XmlMementoSerializerTest.java
+++ /dev/null
@@ -1,455 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied.  See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-package org.apache.brooklyn.core.mgmt.rebind.persister;
-
-import static org.testng.Assert.assertEquals;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedHashMap;
-import java.util.LinkedHashSet;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.NoSuchElementException;
-import java.util.Set;
-
-import org.apache.brooklyn.location.basic.SimulatedLocation;
-import org.apache.brooklyn.api.location.Location;
-import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.test.TestResourceUnavailableException;
-import org.apache.brooklyn.util.collections.MutableList;
-import org.apache.brooklyn.util.collections.MutableMap;
-import org.apache.brooklyn.util.collections.MutableSet;
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-import org.apache.brooklyn.api.catalog.CatalogItem;
-import org.apache.brooklyn.api.entity.Entity;
-import org.apache.brooklyn.api.entity.EntitySpec;
-import org.apache.brooklyn.api.mgmt.ManagementContext;
-import org.apache.brooklyn.api.mgmt.rebind.mementos.BrooklynMementoPersister.LookupContext;
-import org.apache.brooklyn.api.objs.BrooklynObject;
-import org.apache.brooklyn.api.objs.BrooklynObjectType;
-import org.apache.brooklyn.api.policy.Policy;
-import org.apache.brooklyn.api.sensor.Enricher;
-import org.apache.brooklyn.api.sensor.Feed;
-import org.apache.brooklyn.core.catalog.internal.CatalogItemBuilder;
-import org.apache.brooklyn.core.catalog.internal.CatalogItemDtoAbstract;
-import org.apache.brooklyn.core.catalog.internal.CatalogTestUtils;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiTestResources;
-import org.apache.brooklyn.core.mgmt.osgi.OsgiVersionMoreEntityTest;
-import org.apache.brooklyn.core.mgmt.rebind.persister.XmlMementoSerializer;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.core.test.entity.TestApplication;
-import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.entity.core.Entities;
-import org.apache.brooklyn.entity.group.DynamicCluster;
-
-import com.google.common.base.Objects;
-import com.google.common.collect.ImmutableList;
-import com.google.common.collect.ImmutableMap;
-import com.google.common.collect.ImmutableSet;
-import com.google.common.collect.Maps;
-
-public class XmlMementoSerializerTest {
-
-    private static final Logger LOG = LoggerFactory.getLogger(XmlMementoSerializerTest.class);
-
-    private XmlMementoSerializer<Object> serializer;
-
-    @BeforeMethod(alwaysRun=true)
-    public void setUp() throws Exception {
-        serializer = new XmlMementoSerializer<Object>(XmlMementoSerializerTest.class.getClassLoader());
-    }
-
-    @Test
-    public void testMutableSet() throws Exception {
-        Set<?> obj = MutableSet.of("123");
-        assertSerializeAndDeserialize(obj);
-    }
-
-    @Test
-    public void testLinkedHashSet() throws Exception {
-        Set<String> obj = new LinkedHashSet<String>();
-        obj.add("123");
-        assertSerializeAndDeserialize(obj);
-    }
-
-    @Test
-    public void testImmutableSet() throws Exception {
-        Set<String> obj = ImmutableSet.of("123");
-        assertSerializeAndDeserialize(obj);
-    }
-
-    @Test
-    public void testMutableList() throws Exception {
-        List<?> obj = MutableList.of("123");
-        assertSerializeAndDeserialize(obj);
-    }
-
-    @Test
-    public void testLinkedList() throws Exception {
-        List<String> obj = new LinkedList<String>();
-        obj.add("123");
-        assertSerializeAndDeserialize(obj);
-    }
-
-    @Test
-    public void testArraysAsList() throws Exception {
-        // For some reason Arrays.asList used in the catalog's libraries can't be deserialized correctly,
-        // but here works perfectly - the generated catalog xml contains
-        //    <libraries class="list">
-        //      <a ...>
-        //        <bundle....>
-        // which is deserialized as an ArrayList with a single member array of bundles.
-        // The cause is the class="list" type which should be java.util.Arrays$ArrayList instead.
-        Collection<String> obj = Arrays.asList("a", "b");
-        assertSerializeAndDeserialize(obj);
-    }
-
-    @Test
-    public void testImmutableList() throws Exception {
-        List<String> obj = ImmutableList.of("123");
-        assertSerializeAndDeserialize(obj);
-    }
-
-    @Test
-    public void testMutableMap() throws Exception {
-        Map<?,?> obj = MutableMap.of("mykey", "myval");
-        assertSerializeAndDeserialize(obj);
-    }
-
-    @Test
-    public void testLinkedHashMap() throws Exception {
-        Map<String,String> obj = new LinkedHashMap<String,String>();
-        obj.put("mykey", "myval");
-        assertSerializeAndDeserialize(obj);
-    }
-
-    @Test
-    public void testImmutableMap() throws Exception {
-        Map<?,?> obj = ImmutableMap.of("mykey", "myval");
-        assertSerializeAndDeserialize(obj);
-    }
-
-    @Test
-    public void testClass() throws Exception {
-        Class<?> t = XmlMementoSerializer.class;
-        assertSerializeAndDeserialize(t);
-    }
-
-    @Test
-    public void testEntity() throws Exception {
-        final TestApplication app = TestApplication.Factory.newManagedInstanceForTests();
-        ManagementContext managementContext = app.getManagementContext();
-        try {
-            serializer.setLookupContext(new LookupContextImpl(managementContext,
-                    ImmutableList.of(app), ImmutableList.<Location>of(), ImmutableList.<Policy>of(),
-                    ImmutableList.<Enricher>of(), ImmutableList.<Feed>of(), ImmutableList.<CatalogItem<?, ?>>of(), true));
-            assertSerializeAndDeserialize(app);
-        } finally {
-            Entities.destroyAll(managementContext);
-        }
-    }
-
-    @Test
-    public void testLocation() throws Exception {
-        final TestApplication app = TestApplication.Factory.newManagedInstanceForTests();
-        ManagementContext managementContext = app.getManagementContext();
-        try {
-            @SuppressWarnings("deprecation")
-            final Location loc = managementContext.getLocationManager().createLocation(LocationSpec.create(SimulatedLocation.class));
-            serializer.setLookupContext(new LookupContextImpl(managementContext,
-                    ImmutableList.<Entity>of(), ImmutableList.of(loc), ImmutableList.<Policy>of(),
-                    ImmutableList.<Enricher>of(), ImmutableList.<Feed>of(), ImmutableList.<CatalogItem<?, ?>>of(), true));
-            assertSerializeAndDeserialize(loc);
-        } finally {
-            Entities.destroyAll(managementContext);
-        }
-    }
-
-    @Test
-    public void testCatalogItem() throws Exception {
-        final TestApplication app = TestApplication.Factory.newManagedInstanceForTests();
-        ManagementContext managementContext = app.getManagementContext();
-        try {
-            CatalogItem<?, ?> catalogItem = CatalogItemBuilder.newEntity("symbolicName", "0.0.1")
-                    .displayName("test catalog item")
-                    .description("description")
-                    .plan("yaml plan")
-                    .iconUrl("iconUrl")
-                    .libraries(CatalogItemDtoAbstract.parseLibraries(ImmutableList.of("library-url")))
-                    .build();
-            serializer.setLookupContext(new LookupContextImpl(managementContext,
-                    ImmutableList.<Entity>of(), ImmutableList.<Location>of(), ImmutableList.<Policy>of(),
-                    ImmutableList.<Enricher>of(), ImmutableList.<Feed>of(), ImmutableList.of(catalogItem), true));
-            assertSerializeAndDeserialize(catalogItem);
-        } finally {
-            Entities.destroyAll(managementContext);
-        }
-    }
-
-    @Test
-    public void testEntitySpec() throws Exception {
-        EntitySpec<?> obj = EntitySpec.create(TestEntity.class);
-        assertSerializeAndDeserialize(obj);
-    }
-    
-    @Test
-    public void testEntitySpecFromOsgi() throws Exception {
-        TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiTestResources.BROOKLYN_TEST_MORE_ENTITIES_V1_PATH);
-        ManagementContext mgmt = LocalManagementContextForTests.builder(true).disableOsgi(false).build();
-        try {
-            CatalogItem<?, ?> ci = OsgiVersionMoreEntityTest.addMoreEntityV1(mgmt, "1.0");
-            
-            EntitySpec<DynamicCluster> spec = EntitySpec.create(DynamicCluster.class)
-                .configure(DynamicCluster.INITIAL_SIZE, 1)
-                .configure(DynamicCluster.MEMBER_SPEC, CatalogTestUtils.createEssentialEntitySpec(mgmt, ci));
-    
-            serializer.setLookupContext(new LookupContextImpl(mgmt,
-                ImmutableList.<Entity>of(), ImmutableList.<Location>of(), ImmutableList.<Policy>of(),
-                ImmutableList.<Enricher>of(), ImmutableList.<Feed>of(), ImmutableList.<CatalogItem<?,?>>of(), true));
-            assertSerializeAndDeserialize(spec);
-        } finally {
-            Entities.destroyAllCatching(mgmt);
-        }
-    }
-
-    @Test
-    public void testImmutableCollectionsWithDanglingEntityRef() throws Exception {
-        // If there's a dangling entity in an ImmutableList etc, then discard it entirely.
-        // If we try to insert null then it fails, breaking the deserialization of that entire file.
-        
-        final TestApplication app = TestApplication.Factory.newManagedInstanceForTests();
-        final TestEntity entity = app.createAndManageChild(EntitySpec.create(TestEntity.class));
-        ManagementContext managementContext = app.getManagementContext();
-        try {
-            serializer.setLookupContext(new LookupContextImpl(managementContext,
-                    ImmutableList.of(app), ImmutableList.<Location>of(), ImmutableList.<Policy>of(),
-                    ImmutableList.<Enricher>of(), ImmutableList.<Feed>of(), ImmutableList.<CatalogItem<?, ?>>of(), false));
-            
-            List<?> resultList = serializeAndDeserialize(ImmutableList.of(app, entity));
-            assertEquals(resultList, ImmutableList.of(app));
-            
-            Set<?> resultSet = serializeAndDeserialize(ImmutableSet.of(app, entity));
-            assertEquals(resultSet, ImmutableSet.of(app));
-            
-            Map<?, ?> resultMap = serializeAndDeserialize(ImmutableMap.of(app, "appval", "appkey", app, entity, "entityval", "entityKey", entity));
-            assertEquals(resultMap, ImmutableMap.of(app, "appval", "appkey", app));
-
-        } finally {
-            Entities.destroyAll(managementContext);
-        }
-    }
-
-    @Test
-    public void testFieldReffingEntity() throws Exception {
-        final TestApplication app = TestApplication.Factory.newManagedInstanceForTests();
-        ReffingEntity reffer = new ReffingEntity(app);
-        ManagementContext managementContext = app.getManagementContext();
-        try {
-            serializer.setLookupContext(new LookupContextImpl(managementContext,
-                    ImmutableList.of(app), ImmutableList.<Location>of(), ImmutableList.<Policy>of(),
-                    ImmutableList.<Enricher>of(), ImmutableList.<Feed>of(), ImmutableList.<CatalogItem<?, ?>>of(), true));
-            ReffingEntity reffer2 = assertSerializeAndDeserialize(reffer);
-            assertEquals(reffer2.entity, app);
-        } finally {
-            Entities.destroyAll(managementContext);
-        }
-    }
-
-    @Test
-    public void testUntypedFieldReffingEntity() throws Exception {
-        final TestApplication app = TestApplication.Factory.newManagedInstanceForTests();
-        ReffingEntity reffer = new ReffingEntity((Object)app);
-        ManagementContext managementContext = app.getManagementContext();
-        try {
-            serializer.setLookupContext(new LookupContextImpl(managementContext,
-                    ImmutableList.of(app), ImmutableList.<Location>of(), ImmutableList.<Policy>of(),
-                    ImmutableList.<Enricher>of(), ImmutableList.<Feed>of(), ImmutableList.<CatalogItem<?, ?>>of(), true));
-            ReffingEntity reffer2 = assertSerializeAndDeserialize(reffer);
-            assertEquals(reffer2.obj, app);
-        } finally {
-            Entities.destroyAll(managementContext);
-        }
-    }
-
-    public static class ReffingEntity {
-        public Entity entity;
-        public Object obj;
-        public ReffingEntity(Entity entity) {
-            this.entity = entity;
-        }
-        public ReffingEntity(Object obj) {
-            this.obj = obj;
-        }
-        @Override
-        public boolean equals(Object o) {
-            return (o instanceof ReffingEntity) && Objects.equal(entity, ((ReffingEntity)o).entity) && Objects.equal(obj, ((ReffingEntity)o).obj);
-        }
-        @Override
-        public int hashCode() {
-            return Objects.hashCode(entity, obj);
-        }
-    }
-
-    @SuppressWarnings("unchecked")
-    private <T> T assertSerializeAndDeserialize(T obj) throws Exception {
-        String serializedForm = serializer.toString(obj);
-        LOG.info("serializedForm=" + serializedForm);
-        Object deserialized = serializer.fromString(serializedForm);
-        assertEquals(deserialized, obj, "serializedForm="+serializedForm);
-        return (T) deserialized;
-    }
-
-    @SuppressWarnings("unchecked")
-    private <T> T serializeAndDeserialize(T obj) throws Exception {
-        String serializedForm = serializer.toString(obj);
-        LOG.info("serializedForm=" + serializedForm);
-        return (T) serializer.fromString(serializedForm);
-    }
-
-    static class LookupContextImpl implements LookupContext {
-        private final ManagementContext mgmt;
-        private final Map<String, Entity> entities;
-        private final Map<String, Location> locations;
-        private final Map<String, Policy> policies;
-        private final Map<String, Enricher> enrichers;
-        private final Map<String, Feed> feeds;
-        private final Map<String, CatalogItem<?, ?>> catalogItems;
-        private final boolean failOnDangling;
-
-        LookupContextImpl(ManagementContext mgmt, Iterable<? extends Entity> entities, Iterable<? extends Location> locations,
-                Iterable<? extends Policy> policies, Iterable<? extends Enricher> enrichers, Iterable<? extends Feed> feeds,
-                Iterable<? extends CatalogItem<?, ?>> catalogItems, boolean failOnDangling) {
-            this.mgmt = mgmt;
-            this.entities = Maps.newLinkedHashMap();
-            this.locations = Maps.newLinkedHashMap();
-            this.policies = Maps.newLinkedHashMap();
-            this.enrichers = Maps.newLinkedHashMap();
-            this.feeds = Maps.newLinkedHashMap();
-            this.catalogItems = Maps.newLinkedHashMap();
-            for (Entity entity : entities) this.entities.put(entity.getId(), entity);
-            for (Location location : locations) this.locations.put(location.getId(), location);
-            for (Policy policy : policies) this.policies.put(policy.getId(), policy);
-            for (Enricher enricher : enrichers) this.enrichers.put(enricher.getId(), enricher);
-            for (Feed feed : feeds) this.feeds.put(feed.getId(), feed);
-            for (CatalogItem<?, ?> catalogItem : catalogItems) this.catalogItems.put(catalogItem.getId(), catalogItem);
-            this.failOnDangling = failOnDangling;
-        }
-        LookupContextImpl(ManagementContext mgmt, Map<String,? extends Entity> entities, Map<String,? extends Location> locations,
-                Map<String,? extends Policy> policies, Map<String,? extends Enricher> enrichers, Map<String,? extends Feed> feeds,
-                Map<String, ? extends CatalogItem<?, ?>> catalogItems, boolean failOnDangling) {
-            this.mgmt = mgmt;
-            this.entities = ImmutableMap.copyOf(entities);
-            this.locations = ImmutableMap.copyOf(locations);
-            this.policies = ImmutableMap.copyOf(policies);
-            this.enrichers = ImmutableMap.copyOf(enrichers);
-            this.feeds = ImmutableMap.copyOf(feeds);
-            this.catalogItems = ImmutableMap.copyOf(catalogItems);
-            this.failOnDangling = failOnDangling;
-        }
-        @Override public ManagementContext lookupManagementContext() {
-            return mgmt;
-        }
-        @Override public Entity lookupEntity(String id) {
-            if (entities.containsKey(id)) {
-                return entities.get(id);
-            }
-            if (failOnDangling) {
-                throw new NoSuchElementException("no entity with id "+id+"; contenders are "+entities.keySet());
-            }
-            return null;
-        }
-        @Override public Location lookupLocation(String id) {
-            if (locations.containsKey(id)) {
-                return locations.get(id);
-            }
-            if (failOnDangling) {
-                throw new NoSuchElementException("no location with id "+id+"; contenders are "+locations.keySet());
-            }
-            return null;
-        }
-        @Override public Policy lookupPolicy(String id) {
-            if (policies.containsKey(id)) {
-                return policies.get(id);
-            }
-            if (failOnDangling) {
-                throw new NoSuchElementException("no policy with id "+id+"; contenders are "+policies.keySet());
-            }
-            return null;
-        }
-        @Override public Enricher lookupEnricher(String id) {
-            if (enrichers.containsKey(id)) {
-                return enrichers.get(id);
-            }
-            if (failOnDangling) {
-                throw new NoSuchElementException("no enricher with id "+id+"; contenders are "+enrichers.keySet());
-            }
-            return null;
-        }
-        @Override public Feed lookupFeed(String id) {
-            if (feeds.containsKey(id)) {
-                return feeds.get(id);
-            }
-            if (failOnDangling) {
-                throw new NoSuchElementException("no feed with id "+id+"; contenders are "+feeds.keySet());
-            }
-            return null;
-        }
-        @Override public CatalogItem<?, ?> lookupCatalogItem(String id) {
-            if (catalogItems.containsKey(id)) {
-                return catalogItems.get(id);
-            }
-            if (failOnDangling) {
-                throw new NoSuchElementException("no catalog item with id "+id+"; contenders are "+catalogItems.keySet());
-            }
-            return null;
-        }
-        
-        @Override
-        public BrooklynObject lookup(BrooklynObjectType type, String id) {
-            switch (type) {
-            case CATALOG_ITEM: return lookupCatalogItem(id);
-            case ENRICHER: return lookupEnricher(id);
-            case ENTITY: return lookupEntity(id);
-            case FEED: return lookupFeed(id);
-            case LOCATION: return lookupLocation(id);
-            case POLICY: return lookupPolicy(id);
-            case UNKNOWN: return null;
-            }
-            throw new IllegalStateException("Unexpected type "+type+" / id "+id);
-        }
-        @Override
-        public BrooklynObject peek(BrooklynObjectType type, String id) {
-            switch (type) {
-            case CATALOG_ITEM: return catalogItems.get(id);
-            case ENRICHER: return enrichers.get(id);
-            case ENTITY: return entities.get(id);
-            case FEED: return feeds.get(id);
-            case LOCATION: return locations.get(id);
-            case POLICY: return policies.get(id);
-            case UNKNOWN: return null;
-            }
-            throw new IllegalStateException("Unexpected type "+type+" / id "+id);
-        }
-    };
-}

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/transformer/CompoundTransformerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/transformer/CompoundTransformerTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/transformer/CompoundTransformerTest.java
index 6cf8216..ae87123 100644
--- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/transformer/CompoundTransformerTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/transformer/CompoundTransformerTest.java
@@ -36,14 +36,14 @@ import org.apache.brooklyn.api.objs.BrooklynObjectType;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.BasicConfigKey;
 import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
+import org.apache.brooklyn.core.mgmt.persist.BrooklynMementoPersisterToObjectStore;
+import org.apache.brooklyn.core.mgmt.persist.FileBasedObjectStore;
+import org.apache.brooklyn.core.mgmt.persist.PersistMode;
 import org.apache.brooklyn.core.mgmt.rebind.PersistenceExceptionHandlerImpl;
 import org.apache.brooklyn.core.mgmt.rebind.RebindOptions;
 import org.apache.brooklyn.core.mgmt.rebind.RebindTestFixtureWithApp;
 import org.apache.brooklyn.core.mgmt.rebind.RebindTestUtils;
 import org.apache.brooklyn.core.mgmt.rebind.RecordingRebindExceptionHandler;
-import org.apache.brooklyn.core.mgmt.rebind.persister.BrooklynMementoPersisterToObjectStore;
-import org.apache.brooklyn.core.mgmt.rebind.persister.FileBasedObjectStore;
-import org.apache.brooklyn.core.mgmt.rebind.persister.PersistMode;
 import org.apache.brooklyn.core.mgmt.rebind.transformer.CompoundTransformer;
 import org.apache.brooklyn.core.test.entity.TestApplication;
 import org.apache.brooklyn.util.guava.SerializablePredicate;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/policy/basic/PolicySubscriptionTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/policy/basic/PolicySubscriptionTest.java b/core/src/test/java/org/apache/brooklyn/core/policy/basic/PolicySubscriptionTest.java
index 2c36e72..b989d74 100644
--- a/core/src/test/java/org/apache/brooklyn/core/policy/basic/PolicySubscriptionTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/policy/basic/PolicySubscriptionTest.java
@@ -25,7 +25,7 @@ import org.apache.brooklyn.api.mgmt.SubscriptionHandle;
 import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
 import org.apache.brooklyn.core.test.entity.TestEntity;
 import org.apache.brooklyn.entity.core.RecordingSensorEventListener;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 import org.apache.brooklyn.policy.core.AbstractPolicy;
 import org.apache.brooklyn.sensor.core.BasicSensorEvent;
 import org.apache.brooklyn.test.Asserts;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/server/entity/BrooklynMetricsTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/server/entity/BrooklynMetricsTest.java b/core/src/test/java/org/apache/brooklyn/core/server/entity/BrooklynMetricsTest.java
index 2ee1752..74e86a4 100644
--- a/core/src/test/java/org/apache/brooklyn/core/server/entity/BrooklynMetricsTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/server/entity/BrooklynMetricsTest.java
@@ -39,7 +39,7 @@ import org.apache.brooklyn.util.time.Duration;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/test/HttpService.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/HttpService.java b/core/src/test/java/org/apache/brooklyn/core/test/HttpService.java
index e1f6acd..fe959f4 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/HttpService.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/HttpService.java
@@ -44,7 +44,7 @@ import org.eclipse.jetty.webapp.WebAppContext;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.apache.brooklyn.api.location.PortRange;
-import org.apache.brooklyn.location.basic.LocalhostMachineProvisioningLocation;
+import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
 
 import com.google.common.base.Optional;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/test/entity/TestApplication.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/entity/TestApplication.java b/core/src/test/java/org/apache/brooklyn/core/test/entity/TestApplication.java
index ae84eab..15dd766 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/entity/TestApplication.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/entity/TestApplication.java
@@ -28,8 +28,8 @@ import org.apache.brooklyn.api.sensor.AttributeSensor;
 import org.apache.brooklyn.entity.core.EntityInternal;
 import org.apache.brooklyn.entity.core.StartableApplication;
 import org.apache.brooklyn.entity.factory.ApplicationBuilder;
-import org.apache.brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
+import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
 import org.apache.brooklyn.sensor.core.Sensors;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/test/entity/TestApplicationImpl.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/entity/TestApplicationImpl.java b/core/src/test/java/org/apache/brooklyn/core/test/entity/TestApplicationImpl.java
index f142b4a..da8ccc9 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/entity/TestApplicationImpl.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/entity/TestApplicationImpl.java
@@ -30,8 +30,8 @@ import org.apache.brooklyn.api.sensor.SensorEventListener;
 import org.apache.brooklyn.entity.core.AbstractApplication;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
-import org.apache.brooklyn.location.basic.LocalhostMachineProvisioningLocation;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
+import org.apache.brooklyn.location.localhost.LocalhostMachineProvisioningLocation;
 import org.apache.brooklyn.util.logging.LoggingSetup;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/test/location/TestPaasLocation.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/location/TestPaasLocation.java b/core/src/test/java/org/apache/brooklyn/core/test/location/TestPaasLocation.java
index d68d7d3..d79476c 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/location/TestPaasLocation.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/location/TestPaasLocation.java
@@ -18,7 +18,7 @@
  */
 package org.apache.brooklyn.core.test.location;
 
-import org.apache.brooklyn.location.basic.AbstractLocation;
+import org.apache.brooklyn.location.core.AbstractLocation;
 import org.apache.brooklyn.location.paas.PaasLocation;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupLongevityTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupLongevityTest.java b/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupLongevityTest.java
index 5163c93..1e6a185 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupLongevityTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupLongevityTest.java
@@ -20,7 +20,7 @@ package org.apache.brooklyn.core.test.qa.longevity;
 
 import org.testng.annotations.Test;
 import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 import org.apache.brooklyn.util.javalang.JavaClassNames;
 
 /**

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupLongevityTestFixture.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupLongevityTestFixture.java b/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupLongevityTestFixture.java
index 4e9971f..3a0ecc1 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupLongevityTestFixture.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupLongevityTestFixture.java
@@ -46,7 +46,7 @@ import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.base.Stopwatch;
 import com.google.common.collect.ImmutableList;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupTest.java b/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupTest.java
index c98a448..b9fb501 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/qa/longevity/EntityCleanupTest.java
@@ -20,7 +20,7 @@ package org.apache.brooklyn.core.test.qa.longevity;
 
 import org.testng.annotations.Test;
 import org.apache.brooklyn.api.location.LocationSpec;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 import org.apache.brooklyn.util.javalang.JavaClassNames;
 
 public class EntityCleanupTest extends EntityCleanupLongevityTestFixture {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/AbstractPerformanceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/AbstractPerformanceTest.java b/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/AbstractPerformanceTest.java
index 7e338f9..cbf50f3 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/AbstractPerformanceTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/AbstractPerformanceTest.java
@@ -31,7 +31,7 @@ import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.base.Stopwatch;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/EntityPersistencePerformanceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/EntityPersistencePerformanceTest.java b/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/EntityPersistencePerformanceTest.java
index 1fab2ec..70737f6 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/EntityPersistencePerformanceTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/EntityPersistencePerformanceTest.java
@@ -33,7 +33,7 @@ import org.apache.brooklyn.test.PerformanceTestUtils;
 import org.apache.brooklyn.util.repeat.Repeater;
 import org.apache.brooklyn.util.time.Duration;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.base.Predicates;
 import com.google.common.collect.Iterables;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/FilePersistencePerformanceTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/FilePersistencePerformanceTest.java b/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/FilePersistencePerformanceTest.java
index a3bd0cc..594b102 100644
--- a/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/FilePersistencePerformanceTest.java
+++ b/core/src/test/java/org/apache/brooklyn/core/test/qa/performance/FilePersistencePerformanceTest.java
@@ -23,7 +23,7 @@ import java.io.IOException;
 import java.util.List;
 import java.util.concurrent.atomic.AtomicInteger;
 
-import org.apache.brooklyn.core.mgmt.rebind.persister.FileBasedStoreObjectAccessor;
+import org.apache.brooklyn.core.mgmt.persist.FileBasedStoreObjectAccessor;
 import org.apache.brooklyn.util.collections.MutableList;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.core.internal.ssh.process.ProcessTool;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/effector/core/EffectorBasicTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/effector/core/EffectorBasicTest.java b/core/src/test/java/org/apache/brooklyn/effector/core/EffectorBasicTest.java
index 3380032..078b2d2 100644
--- a/core/src/test/java/org/apache/brooklyn/effector/core/EffectorBasicTest.java
+++ b/core/src/test/java/org/apache/brooklyn/effector/core/EffectorBasicTest.java
@@ -40,7 +40,7 @@ import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/core/AbstractApplicationLegacyTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/core/AbstractApplicationLegacyTest.java b/core/src/test/java/org/apache/brooklyn/entity/core/AbstractApplicationLegacyTest.java
index 42e4796..740b9b2 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/core/AbstractApplicationLegacyTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/core/AbstractApplicationLegacyTest.java
@@ -38,7 +38,7 @@ import org.testng.annotations.Test;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 /**
  * Tests the deprecated use of AbstractAppliation, where its constructor is called directly.

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/core/AbstractEntityLegacyTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/core/AbstractEntityLegacyTest.java b/core/src/test/java/org/apache/brooklyn/entity/core/AbstractEntityLegacyTest.java
index 23b6fc3..60da5ad 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/core/AbstractEntityLegacyTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/core/AbstractEntityLegacyTest.java
@@ -35,7 +35,7 @@ import org.apache.brooklyn.util.collections.MutableMap;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 /**
  * Tests the deprecated use of AbstractAppliation, where its constructor is called directly.

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/core/EntitiesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/core/EntitiesTest.java b/core/src/test/java/org/apache/brooklyn/entity/core/EntitiesTest.java
index f2f3322..e413077 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/core/EntitiesTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/core/EntitiesTest.java
@@ -36,7 +36,7 @@ import org.apache.brooklyn.util.collections.MutableSet;
 import org.testng.Assert;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/core/EntitySetFromFlagTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/core/EntitySetFromFlagTest.java b/core/src/test/java/org/apache/brooklyn/entity/core/EntitySetFromFlagTest.java
index 1f3c7bf..51a163f 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/core/EntitySetFromFlagTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/core/EntitySetFromFlagTest.java
@@ -26,7 +26,7 @@ import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.location.PortRange;
 import org.apache.brooklyn.entity.core.AbstractEntity;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.PortRanges;
+import org.apache.brooklyn.location.core.PortRanges;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.core.flags.SetFromFlag;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/core/EntitySpecTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/core/EntitySpecTest.java b/core/src/test/java/org/apache/brooklyn/entity/core/EntitySpecTest.java
index 671140e..7c127ab 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/core/EntitySpecTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/core/EntitySpecTest.java
@@ -41,7 +41,7 @@ import org.apache.brooklyn.test.Asserts;
 import org.apache.brooklyn.util.core.flags.SetFromFlag;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableSet;
 import com.google.common.collect.Iterables;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/core/EntitySubscriptionTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/core/EntitySubscriptionTest.java b/core/src/test/java/org/apache/brooklyn/entity/core/EntitySubscriptionTest.java
index 81d8e25..cfdf9f3 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/core/EntitySubscriptionTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/core/EntitySubscriptionTest.java
@@ -32,7 +32,7 @@ import org.apache.brooklyn.test.Asserts;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Iterables;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/core/EntitySuppliersTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/core/EntitySuppliersTest.java b/core/src/test/java/org/apache/brooklyn/entity/core/EntitySuppliersTest.java
index 9c4bb9e..f75686c 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/core/EntitySuppliersTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/core/EntitySuppliersTest.java
@@ -29,7 +29,7 @@ import org.apache.brooklyn.core.test.entity.TestEntity;
 import org.apache.brooklyn.entity.core.EntitySuppliers;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SshMachineLocation;
+import org.apache.brooklyn.location.ssh.SshMachineLocation;
 
 import com.google.common.base.Supplier;
 import com.google.common.collect.ImmutableList;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/core/internal/EntityConfigMapUsageLegacyTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/core/internal/EntityConfigMapUsageLegacyTest.java b/core/src/test/java/org/apache/brooklyn/entity/core/internal/EntityConfigMapUsageLegacyTest.java
index 7120199..642e8c5 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/core/internal/EntityConfigMapUsageLegacyTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/core/internal/EntityConfigMapUsageLegacyTest.java
@@ -35,7 +35,7 @@ import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
 import org.apache.brooklyn.core.test.entity.TestEntity;
 import org.apache.brooklyn.core.test.entity.TestEntityImpl;
 import org.apache.brooklyn.entity.core.Entities;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.base.Function;
 import com.google.common.base.Predicates;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/core/internal/EntityConfigMapUsageTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/core/internal/EntityConfigMapUsageTest.java b/core/src/test/java/org/apache/brooklyn/entity/core/internal/EntityConfigMapUsageTest.java
index 1b9dd52..f87f182 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/core/internal/EntityConfigMapUsageTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/core/internal/EntityConfigMapUsageTest.java
@@ -37,7 +37,7 @@ import org.apache.brooklyn.sensor.core.DependentConfiguration;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.base.Function;
 import com.google.common.base.Predicates;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/drivers/BasicEntityDriverManagerTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/drivers/BasicEntityDriverManagerTest.java b/core/src/test/java/org/apache/brooklyn/entity/drivers/BasicEntityDriverManagerTest.java
index 2ce9245..b4928aa 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/drivers/BasicEntityDriverManagerTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/drivers/BasicEntityDriverManagerTest.java
@@ -29,8 +29,8 @@ import org.apache.brooklyn.entity.drivers.RegistryEntityDriverFactoryTest.MyOthe
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
-import org.apache.brooklyn.location.basic.SshMachineLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
+import org.apache.brooklyn.location.ssh.SshMachineLocation;
 import org.apache.brooklyn.util.collections.MutableMap;
 
 public class BasicEntityDriverManagerTest {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/drivers/EntityDriverRegistryTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/drivers/EntityDriverRegistryTest.java b/core/src/test/java/org/apache/brooklyn/entity/drivers/EntityDriverRegistryTest.java
index 34f14d3..765e40b 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/drivers/EntityDriverRegistryTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/drivers/EntityDriverRegistryTest.java
@@ -31,7 +31,7 @@ import org.apache.brooklyn.util.collections.MutableMap;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SshMachineLocation;
+import org.apache.brooklyn.location.ssh.SshMachineLocation;
 
 public class EntityDriverRegistryTest {
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/drivers/ReflectiveEntityDriverFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/drivers/ReflectiveEntityDriverFactoryTest.java b/core/src/test/java/org/apache/brooklyn/entity/drivers/ReflectiveEntityDriverFactoryTest.java
index e357695..7303b89 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/drivers/ReflectiveEntityDriverFactoryTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/drivers/ReflectiveEntityDriverFactoryTest.java
@@ -18,8 +18,8 @@
  */
 package org.apache.brooklyn.entity.drivers;
 
-import org.apache.brooklyn.location.basic.SshMachineLocation;
 import org.apache.brooklyn.location.paas.PaasLocation;
+import org.apache.brooklyn.location.ssh.SshMachineLocation;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.drivers.DriverDependentEntity;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/drivers/RegistryEntityDriverFactoryTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/drivers/RegistryEntityDriverFactoryTest.java b/core/src/test/java/org/apache/brooklyn/entity/drivers/RegistryEntityDriverFactoryTest.java
index 59e26c8..00a5a25 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/drivers/RegistryEntityDriverFactoryTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/drivers/RegistryEntityDriverFactoryTest.java
@@ -31,8 +31,8 @@ import org.apache.brooklyn.entity.drivers.ReflectiveEntityDriverFactoryTest.MyDr
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
-import org.apache.brooklyn.location.basic.SshMachineLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
+import org.apache.brooklyn.location.ssh.SshMachineLocation;
 import org.apache.brooklyn.util.collections.MutableMap;
 
 public class RegistryEntityDriverFactoryTest {

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/BasicDownloadsRegistryTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/BasicDownloadsRegistryTest.java b/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/BasicDownloadsRegistryTest.java
index 388bd59..386c25b 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/BasicDownloadsRegistryTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/BasicDownloadsRegistryTest.java
@@ -35,7 +35,7 @@ import org.apache.brooklyn.entity.factory.ApplicationBuilder;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadProducerFromLocalRepoTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadProducerFromLocalRepoTest.java b/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadProducerFromLocalRepoTest.java
index 5953583..5e114d4 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadProducerFromLocalRepoTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadProducerFromLocalRepoTest.java
@@ -38,7 +38,7 @@ import org.apache.brooklyn.entity.factory.ApplicationBuilder;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadProducerFromPropertiesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadProducerFromPropertiesTest.java b/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadProducerFromPropertiesTest.java
index 198f041..15b35e3 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadProducerFromPropertiesTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadProducerFromPropertiesTest.java
@@ -39,7 +39,7 @@ import org.apache.brooklyn.entity.factory.ApplicationBuilder;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadSubstitutersTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadSubstitutersTest.java b/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadSubstitutersTest.java
index 35a4737..7b75f48 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadSubstitutersTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/drivers/downloads/DownloadSubstitutersTest.java
@@ -33,7 +33,7 @@ import org.apache.brooklyn.entity.drivers.downloads.BasicDownloadRequirement;
 import org.apache.brooklyn.entity.drivers.downloads.DownloadSubstituters;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.base.Functions;
 import com.google.common.collect.ImmutableList;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
index 255c930..40dd6dd 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterTest.java
@@ -70,7 +70,7 @@ import org.apache.brooklyn.util.collections.MutableSet;
 import org.apache.brooklyn.util.collections.QuorumCheck.QuorumChecks;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.apache.brooklyn.util.time.Time;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.base.Function;
 import com.google.common.base.Predicates;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterWithAvailabilityZonesTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterWithAvailabilityZonesTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterWithAvailabilityZonesTest.java
index 9a7e5fa..1cff020 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterWithAvailabilityZonesTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicClusterWithAvailabilityZonesTest.java
@@ -44,10 +44,10 @@ import org.apache.brooklyn.test.Asserts;
 import org.apache.brooklyn.util.time.Duration;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.LocationInternal;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
 import org.apache.brooklyn.location.cloud.AbstractAvailabilityZoneExtension;
 import org.apache.brooklyn.location.cloud.AvailabilityZoneExtension;
+import org.apache.brooklyn.location.core.SimulatedLocation;
+import org.apache.brooklyn.location.core.internal.LocationInternal;
 
 import com.google.common.base.Predicate;
 import com.google.common.base.Ticker;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/group/DynamicFabricTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicFabricTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicFabricTest.java
index c026eab..c5000ce 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicFabricTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicFabricTest.java
@@ -44,8 +44,8 @@ import org.apache.brooklyn.entity.core.Entities;
 import org.apache.brooklyn.entity.factory.EntityFactory;
 import org.apache.brooklyn.entity.stock.BasicEntity;
 import org.apache.brooklyn.entity.trait.Startable;
-import org.apache.brooklyn.location.basic.PortRanges;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.PortRanges;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 import org.apache.brooklyn.test.Asserts;
 import org.apache.brooklyn.test.TestUtils;
 import org.apache.brooklyn.util.collections.MutableList;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/group/DynamicMultiGroupTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicMultiGroupTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicMultiGroupTest.java
index 514c9ae..c914d98 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicMultiGroupTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicMultiGroupTest.java
@@ -46,7 +46,7 @@ import org.apache.brooklyn.test.Asserts;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/group/DynamicRegionsFabricTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicRegionsFabricTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicRegionsFabricTest.java
index 0d8e3da..efc93ef 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/DynamicRegionsFabricTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/DynamicRegionsFabricTest.java
@@ -34,7 +34,7 @@ import org.apache.brooklyn.util.collections.MutableSet;
 import org.apache.brooklyn.util.exceptions.Exceptions;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/group/GroupTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/GroupTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/GroupTest.java
index 6c60c1d..bf0a529 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/GroupTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/GroupTest.java
@@ -37,7 +37,7 @@ import org.testng.annotations.Test;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableSet;
 
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 public class GroupTest extends BrooklynAppUnitTestSupport {
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/group/MembershipTrackingPolicyTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/MembershipTrackingPolicyTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/MembershipTrackingPolicyTest.java
index 7dc9548..4e3b346 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/MembershipTrackingPolicyTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/MembershipTrackingPolicyTest.java
@@ -41,7 +41,7 @@ import org.apache.brooklyn.test.Asserts;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.base.Objects;
 import com.google.common.collect.ImmutableList;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/group/QuarantineGroupTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/QuarantineGroupTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/QuarantineGroupTest.java
index 622b667..e85ce29 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/QuarantineGroupTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/QuarantineGroupTest.java
@@ -29,7 +29,7 @@ import org.apache.brooklyn.entity.core.Entities;
 import org.apache.brooklyn.entity.group.QuarantineGroup;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/a1ad34d7/core/src/test/java/org/apache/brooklyn/entity/group/zoneaware/BalancingNodePlacementStrategyTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/entity/group/zoneaware/BalancingNodePlacementStrategyTest.java b/core/src/test/java/org/apache/brooklyn/entity/group/zoneaware/BalancingNodePlacementStrategyTest.java
index 21e57bf..738ecfd 100644
--- a/core/src/test/java/org/apache/brooklyn/entity/group/zoneaware/BalancingNodePlacementStrategyTest.java
+++ b/core/src/test/java/org/apache/brooklyn/entity/group/zoneaware/BalancingNodePlacementStrategyTest.java
@@ -30,7 +30,7 @@ import org.apache.brooklyn.entity.group.zoneaware.BalancingNodePlacementStrategy
 import org.apache.brooklyn.test.Asserts;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
-import org.apache.brooklyn.location.basic.SimulatedLocation;
+import org.apache.brooklyn.location.core.SimulatedLocation;
 
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.LinkedHashMultimap;