assertEquals(2, creator.getLayers().size());
assertEquals(1, creator.getConfiguration().size());
context=creator.getConfiguration().iterator().next();
renderer = creator.getRenderer(context);
assertSame( context, renderer.getContext() );
CompositeRenderContext compositeRenderContext = ((CompositeRenderContext)creator.getConfiguration().iterator().next());
assertEquals(2, compositeRenderContext.getContexts().size());
assertTrue("Expected MultiRenderer but was "+renderer, renderer instanceof MultiLayerRenderer); //$NON-NLS-1$
layer=MapTests.createLayer(new URL( "http://othername"), new RendererCreatorTestObjForMulitRenderer(), layer.getMapInternal()); //$NON-NLS-1$
creator.changed(listener.lastNotification);
assertEquals(3, creator.getLayers().size());
assertEquals(2, creator.getConfiguration().size());
for( RenderContext context2 : creator.getConfiguration() ) {
renderer = creator.getRenderer(context2);
assertTrue("Expected SingleRenderer but was "+renderer, renderer instanceof MultiLayerRenderer); //$NON-NLS-1$
}
map.lowerLayer(layer);
int indexOfOtherName=map.getMapLayers().indexOf(layer);
creator.changed(listener.lastNotification);
assertEquals(3, creator.getLayers().size());
assertEquals(3, creator.getConfiguration().size());
for( RenderContext context2 : creator.getConfiguration() ) {
renderer = creator.getRenderer(context2);
assertTrue("Expected SingleRenderer but was "+renderer, renderer instanceof MultiLayerRenderer); //$NON-NLS-1$
}
layer=MapTests.createLayer(new URL( "http://dummy"), new RendererCreatorTestObjForMulitRenderer(), null); //$NON-NLS-1$
map.getLayersInternal().set(indexOfOtherName, layer);
creator.changed(listener.lastNotification);
assertEquals(3, creator.getLayers().size());
assertEquals(1, creator.getConfiguration().size());
renderer = creator.getRenderer(creator.getConfiguration().iterator().next());
compositeRenderContext = ((CompositeRenderContext)creator.getConfiguration().iterator().next());
assertEquals(3, compositeRenderContext.getContexts().size());
map.getLayersInternal().remove(0);
creator.changed(listener.lastNotification);
assertEquals(2, creator.getLayers().size());
assertEquals(1, creator.getConfiguration().size());
renderer = creator.getRenderer(creator.getConfiguration().iterator().next());
compositeRenderContext = ((CompositeRenderContext)creator.getConfiguration().iterator().next());
assertEquals(2, compositeRenderContext.getContexts().size());
}