Previously, AbstractEmbeddedServletContainerFactory detected an
exploded war by looking for `/WEB-INF/` in the path of its code
source's location. This failed on Windows due to the use of `\` rather
than `/` separators.
This commit updates AbstractEmbeddedServletContainerFactory to
uses the OS's separator rather than hardcoding `/`.
Closes gh-8100
Previously, when the ExpectedException JUnit rule was used with
FilteredClassPathRunner a LinkageError would occur if any of
ExpectedException's methods that take a Hamcrest Matcher were called.
This was due to the FilteredClassLoader delegating loading of
org.junit classes to its parent but not org.hamcrest classes. This
resulted in JUnit classes loading one version of the Hamcrest class
and the test class loading another.
This commit ensures that both the JUnit classes and the test class
use the same version of Hamcrest classes by also delegating the
loading of org.hamcrest classes to FilteredClassLoader's parent.
By default, `@DataJpaTest` (and `@AutoConfigureTestDatabase`) attempt to
replace any existing `DataSource` by an embedded one. Previously, if
there is was no embedded database on the classpath, the exception message
did not provide that context in the error message.
This commit clarifies the error message to conduct
`TestDatabaseAutoConfiguration` (that is replacing the existing
`DataSource`).
Closes gh-7797
Previously, TestRestTemplate would only apply the UriTemplateHandler
to Strings and not to URIs. When using the auto-configured
TestRestTemplate, this prevented relative URIs from being
made absolute using LocalHostUriTemplateHandler.
The commit updates TestRestTemplate to turn URIs into Strings before
passing them to the delegate RestTemplate. Turning them into Strings
ensures that the delegate calls the UriTemplateHandler.
Closes gh-7891
Previously, when DevTools' was used it would set the application
context's ResourceLoader and overwrite any custom ResourceLoader that
had been configured. On the rare occasion when the user had customized
the ResourceLoader this meant that the customization was lost and
certain resources would become unavailable.
This commit updates DevTools' ResourceLoader to delegate a custom
ResourceLoader if one has been configured. If one has not been
configured it delegates as before, i.e. to
WebApplicationContextResourceLoader for web applications and to
DefaultResourceLoader for all others apps.
Closes gh-8010
The root cause of the build failure something has a null message which
means there's no information available about why the build failed.
Instead of calling fail when a BuildException occurs, this commit
wraps it in a RuntimeException and rethrows it. This should make the
entire chain of exceptions available when a failure occurs.
Previously, JarResourceManager assumed that the path would begin with
a / but this isn't always the case. For example, it may be an empty
string. This could lead to a malformed jar:file: URL that used ! as
the separator rather than the required !/.
This commit updates JarResourceManager to prepend / to any path that
does not being with one before using it to construct the URL.
Closes gh-7717
The intent of the test is to:
1. Make a change
2. Sleep for long enough for that change to be picked up
3. Make another change
4. Stop that watcher after 1 further scan has been performed
5. Assert that a further scan was performed by checking that two
separate sets of changes (step 1 and step 3) have been picked up
Previously, step 2 relied on simply sleeping for a period of time
longer than the polling interval. In reality, the polling interval
is only a minimum time between scans and the actual time between them
depends on thread scheduling, GC pauses, etc. This lead to the
test failing intermittently if the scan didn't happen in a timely
manner.
This commit removes the sleep and replaces it with a while loop that
waits for first change to be picked up. This ensures that the second
change will be detected separately from the first and that two
separate change sets should always be available once the watcher has
stopped.
See gh-7782
Previously, in the DevTools integration tests, portions of a File's
path were used to create the name of a jar entry. On Windows this
resulted in the entry containing \ characters. As a result the
directory structure was incorrect and the classes could not be loaded
from the jar.
This commit ensures that any \ characters are replaced with /
characters.
See gh-7782
Previously, the beans endpoint would only expose the context that
contained the endpoint. This commit updates the endpoint so that
the context that contains the endpoint and all of its ancestors are
exposed.
In a context hierarhcy, the relation ship is child -> parent and there
is no way to navigate from a parent to a child. As a result, any
contexts that are descendants of the context containing the endpoint
are not exposed.
Closes gh-5188
* gh-4902:
Test that double registration of ServletContextInitializers does not happen
Avoid double-reg when a Servlet or Filter implements ServletContextInitializer