Merge branch '1.5.x'
This commit is contained in:
commit
a90bad37bd
|
@ -161,20 +161,31 @@ public class EnableAutoConfigurationImportSelector
|
|||
|
||||
private void checkExcludedClasses(List<String> configurations,
|
||||
Set<String> exclusions) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
List<String> invalidExcludes = new ArrayList<String>();
|
||||
for (String exclusion : exclusions) {
|
||||
if (ClassUtils.isPresent(exclusion, getClass().getClassLoader())
|
||||
&& !configurations.contains(exclusion)) {
|
||||
message.append("\t- ").append(exclusion).append(String.format("%n"));
|
||||
invalidExcludes.add(exclusion);
|
||||
}
|
||||
}
|
||||
if (!message.toString().isEmpty()) {
|
||||
throw new IllegalStateException(String.format(
|
||||
"The following classes could not be excluded because they are"
|
||||
+ " not auto-configuration classes:%n%s",
|
||||
message.toString()));
|
||||
if (!invalidExcludes.isEmpty()) {
|
||||
handleInvalidExcludes(invalidExcludes);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle any invalid excludes that have been specified.
|
||||
* @param invalidExcludes the list of invalid excludes (will always have at least on
|
||||
* element)
|
||||
*/
|
||||
protected void handleInvalidExcludes(List<String> invalidExcludes) {
|
||||
StringBuilder message = new StringBuilder();
|
||||
for (String exclude : invalidExcludes) {
|
||||
message.append("\t- ").append(exclude).append(String.format("%n"));
|
||||
}
|
||||
throw new IllegalStateException(String
|
||||
.format("The following classes could not be excluded because they are"
|
||||
+ " not auto-configuration classes:%n%s", message));
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -146,4 +146,9 @@ class ImportAutoConfigurationImportSelector
|
|||
return super.getOrder() - 1;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleInvalidExcludes(List<String> invalidExcludes) {
|
||||
// Ignore for test
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -116,6 +116,15 @@ public class ImportAutoConfigurationImportSelectorTests {
|
|||
assertThat(imports).containsOnly(FreeMarkerAutoConfiguration.class.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exclusionsWithoutImport() throws Exception {
|
||||
AnnotationMetadata annotationMetadata = new SimpleMetadataReaderFactory()
|
||||
.getMetadataReader(ExclusionWithoutImport.class.getName())
|
||||
.getAnnotationMetadata();
|
||||
String[] imports = this.importSelector.selectImports(annotationMetadata);
|
||||
assertThat(imports).containsOnly(FreeMarkerAutoConfiguration.class.getName());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void exclusionsAliasesAreApplied() throws Exception {
|
||||
AnnotationMetadata annotationMetadata = new SimpleMetadataReaderFactory()
|
||||
|
@ -149,6 +158,12 @@ public class ImportAutoConfigurationImportSelectorTests {
|
|||
|
||||
}
|
||||
|
||||
@ImportOne
|
||||
@ImportAutoConfiguration(exclude = ThymeleafAutoConfiguration.class)
|
||||
static class ExclusionWithoutImport {
|
||||
|
||||
}
|
||||
|
||||
@SelfAnnotating
|
||||
static class ImportWithSelfAnnotatingAnnotation {
|
||||
|
||||
|
|
|
@ -83,9 +83,8 @@ public class LiveReloadServerTests {
|
|||
@Test
|
||||
public void triggerReload() throws Exception {
|
||||
LiveReloadWebSocketHandler handler = connect();
|
||||
handler.setExpectedMessageCount(1);
|
||||
this.server.triggerReload();
|
||||
handler.awaitMessages();
|
||||
Thread.sleep(200);
|
||||
this.server.stop();
|
||||
assertThat(handler.getMessages().get(0))
|
||||
.contains("http://livereload.com/protocols/official-7");
|
||||
|
@ -208,8 +207,6 @@ public class LiveReloadServerTests {
|
|||
|
||||
private final CountDownLatch helloLatch = new CountDownLatch(2);
|
||||
|
||||
private CountDownLatch messagesLatch;
|
||||
|
||||
private final List<String> messages = new ArrayList<String>();
|
||||
|
||||
private int pongCount;
|
||||
|
@ -229,19 +226,12 @@ public class LiveReloadServerTests {
|
|||
Thread.sleep(200);
|
||||
}
|
||||
|
||||
public void setExpectedMessageCount(int count) {
|
||||
this.messagesLatch = new CountDownLatch(count);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void handleTextMessage(WebSocketSession session, TextMessage message)
|
||||
throws Exception {
|
||||
if (message.getPayload().contains("hello")) {
|
||||
this.helloLatch.countDown();
|
||||
}
|
||||
if (this.messagesLatch != null) {
|
||||
this.messagesLatch.countDown();
|
||||
}
|
||||
this.messages.add(message.getPayload());
|
||||
}
|
||||
|
||||
|
@ -265,10 +255,6 @@ public class LiveReloadServerTests {
|
|||
this.session.close();
|
||||
}
|
||||
|
||||
public void awaitMessages() throws InterruptedException {
|
||||
this.messagesLatch.await(1, TimeUnit.MINUTES);
|
||||
}
|
||||
|
||||
public List<String> getMessages() {
|
||||
return this.messages;
|
||||
}
|
||||
|
|
|
@ -212,9 +212,9 @@ force_stop() {
|
|||
|
||||
do_force_stop() {
|
||||
kill -9 "$1" &> /dev/null || { echoRed "Unable to kill process $1"; return 1; }
|
||||
for i in $(seq 1 60); do
|
||||
for i in $(seq 1 $STOP_WAIT_TIME); do
|
||||
isRunning "$1" || { echoGreen "Stopped [$1]"; rm -f "$2"; return 0; }
|
||||
[[ $i -eq 30 ]] && kill -9 "$1" &> /dev/null
|
||||
[[ $i -eq STOP_WAIT_TIME/2 ]] && kill "$1" &> /dev/null
|
||||
sleep 1
|
||||
done
|
||||
echoRed "Unable to kill process $1";
|
||||
|
@ -271,7 +271,7 @@ status)
|
|||
run)
|
||||
run "$@"; exit $?;;
|
||||
*)
|
||||
echo "Usage: $0 {start|stop|restart|force-reload|status|run}"; exit 1;
|
||||
echo "Usage: $0 {start|stop|force-stop|restart|force-reload|status|run}"; exit 1;
|
||||
esac
|
||||
|
||||
exit 0
|
||||
|
|
Loading…
Reference in New Issue