@Override public void apply(Map<String, Object> storage) { PublishedInfo pi = (PublishedInfo) storage.get(KEY); LocalPublished.set(pi); }
Dispatcher.REQUEST.set(request); final LayerInfo layer = new LayerInfoImpl(); LocalPublished.set(layer); final WorkspaceInfo ws = new WorkspaceInfoImpl(); LocalWorkspace.set(ws);
@Test public void testRequest() throws InterruptedException, ExecutionException { // setup the state final LayerInfo layer = new LayerInfoImpl(); LocalPublished.set(layer); // test it's transferred properly using the base class machinery testThreadLocalTransfer( new ThreadLocalTransferCallable(new LocalPublishedThreadLocalTransfer()) { @Override void assertThreadLocalCleaned() { assertNull(LocalPublished.get()); } @Override void assertThreadLocalApplied() { assertSame(layer, LocalPublished.get()); } }); } }
@Test public void testLayerLocalWithContainingGroup() throws Exception { CatalogFactory factory = catalog.getFactory(); WorkspaceInfo citeWs = catalog.getWorkspaceByName("cite"); addLocalGroup(factory, citeWs); // set a local layer that's in the group final LayerInfo buildingsLayer = getBuildingsLayer(); LocalPublished.set(buildingsLayer); assertNotNull(catalog.getLayerByName(buildingsLayer.prefixedName())); assertNull(catalog.getLayerGroupByName(GLOBAL_GROUP)); assertNull(catalog.getLayerGroupByName(LOCAL_GROUP)); assertEquals(1, catalog.getLayers().size()); assertThat(catalog.getLayerGroups(), empty()); }
@Test public void testLayerLocalWithNonContainingGroup() throws Exception { CatalogFactory factory = catalog.getFactory(); WorkspaceInfo citeWs = catalog.getWorkspaceByName("cite"); addLocalGroup(factory, citeWs); // set a local layer that's not in the group final LayerInfo dividedRoutes = catalog.getLayerByName(getLayerId(SystemTestData.DIVIDED_ROUTES)); LocalPublished.set(dividedRoutes); assertNotNull(catalog.getLayerByName(dividedRoutes.prefixedName())); assertNull(catalog.getLayerGroupByName(GLOBAL_GROUP)); assertNull(catalog.getLayerGroupByName(LOCAL_GROUP)); assertEquals(1, catalog.getLayers().size()); assertThat(catalog.getLayerGroups(), empty()); }
catalog.add(globalGroup2); LocalPublished.set(catalog.getLayerGroupByName(GLOBAL_GROUP));
LocalPublished.set(catalog.getLayerGroupByName(LOCAL_GROUP));
catalog.add(globalGroup); LocalPublished.set(catalog.getLayerGroupByName(GLOBAL_GROUP));