Issue #4727 setConfigurationDiscovered true per default
Signed-off-by: olivier lamy <oliver.lamy@gmail.com>
This commit is contained in:
parent
5c2e0b32a4
commit
5c38ae3549
|
@ -118,25 +118,25 @@ public class TestAnnotationConfiguration
|
|||
@Test
|
||||
public void testAnnotationScanControl() throws Exception
|
||||
{
|
||||
//check that a 2.5 webapp won't discover annotations
|
||||
//check that a 2.5 webapp with configurationDiscovered will discover annotations
|
||||
TestableAnnotationConfiguration config25 = new TestableAnnotationConfiguration();
|
||||
WebAppContext context25 = new WebAppContext();
|
||||
context25.setClassLoader(Thread.currentThread().getContextClassLoader());
|
||||
context25.setAttribute(AnnotationConfiguration.MULTI_THREADED, Boolean.FALSE);
|
||||
context25.setAttribute(AnnotationConfiguration.MAX_SCAN_WAIT, 0);
|
||||
context25.setConfigurationDiscovered(false);
|
||||
context25.getMetaData().setWebDescriptor(new WebDescriptor(Resource.newResource(web25)));
|
||||
context25.getServletContext().setEffectiveMajorVersion(2);
|
||||
context25.getServletContext().setEffectiveMinorVersion(5);
|
||||
config25.configure(context25);
|
||||
config25.assertAnnotationDiscovery(false);
|
||||
|
||||
//check that a 2.5 webapp with configurationDiscovered will discover annotations
|
||||
//check that a 2.5 webapp discover annotations
|
||||
TestableAnnotationConfiguration config25b = new TestableAnnotationConfiguration();
|
||||
WebAppContext context25b = new WebAppContext();
|
||||
context25b.setClassLoader(Thread.currentThread().getContextClassLoader());
|
||||
context25b.setAttribute(AnnotationConfiguration.MULTI_THREADED, Boolean.FALSE);
|
||||
context25b.setAttribute(AnnotationConfiguration.MAX_SCAN_WAIT, 0);
|
||||
context25b.setConfigurationDiscovered(true);
|
||||
context25b.getMetaData().setWebDescriptor(new WebDescriptor(Resource.newResource(web25)));
|
||||
context25b.getServletContext().setEffectiveMajorVersion(2);
|
||||
context25b.getServletContext().setEffectiveMinorVersion(5);
|
||||
|
@ -293,6 +293,7 @@ public class TestAnnotationConfiguration
|
|||
AnnotationConfiguration config = new AnnotationConfiguration();
|
||||
WebAppContext context = new WebAppContext();
|
||||
List<ServletContainerInitializer> scis;
|
||||
context.setConfigurationDiscovered(false);
|
||||
context.setClassLoader(webAppLoader);
|
||||
context.getMetaData().setWebDescriptor(new WebDescriptor(Resource.newResource(web25)));
|
||||
context.getMetaData().setWebInfClassesResources(classes);
|
||||
|
|
|
@ -209,7 +209,7 @@ public class WebAppContext extends ServletContextHandler implements WebAppClassL
|
|||
|
||||
private Map<String, String> _resourceAliases;
|
||||
private boolean _ownClassLoader = false;
|
||||
private boolean _configurationDiscovered = false;
|
||||
private boolean _configurationDiscovered = true;
|
||||
private boolean _allowDuplicateFragmentNames = false;
|
||||
private boolean _throwUnavailableOnStartupException = false;
|
||||
|
||||
|
|
|
@ -84,20 +84,20 @@ public class MetaInfConfigurationTest
|
|||
File web31 = MavenTestingUtils.getTestResourceFile("web31.xml");
|
||||
File web31false = MavenTestingUtils.getTestResourceFile("web31false.xml");
|
||||
|
||||
//test a 2.5 webapp will not look for fragments by default
|
||||
//test a 2.5 webapp will not look for fragments as manually configured
|
||||
MetaInfConfiguration meta25 = new TestableMetaInfConfiguration(MetaInfConfiguration.__allScanTypes,
|
||||
Arrays.asList(MetaInfConfiguration.METAINF_TLDS, MetaInfConfiguration.METAINF_RESOURCES));
|
||||
WebAppContext context25 = new WebAppContext();
|
||||
context25.setConfigurationDiscovered(false);
|
||||
context25.getMetaData().setWebDescriptor(new WebDescriptor(Resource.newResource(web25)));
|
||||
context25.getServletContext().setEffectiveMajorVersion(2);
|
||||
context25.getServletContext().setEffectiveMinorVersion(5);
|
||||
meta25.preConfigure(context25);
|
||||
|
||||
//test a 2.5 webapp will look for fragments if configurationDiscovered==true
|
||||
//test a 2.5 webapp will look for fragments as configurationDiscovered default true
|
||||
MetaInfConfiguration meta25b = new TestableMetaInfConfiguration(MetaInfConfiguration.__allScanTypes,
|
||||
MetaInfConfiguration.__allScanTypes);
|
||||
WebAppContext context25b = new WebAppContext();
|
||||
context25b.setConfigurationDiscovered(true);
|
||||
context25b.getMetaData().setWebDescriptor(new WebDescriptor(Resource.newResource(web25)));
|
||||
context25b.getServletContext().setEffectiveMajorVersion(2);
|
||||
context25b.getServletContext().setEffectiveMinorVersion(5);
|
||||
|
|
Loading…
Reference in New Issue