|
|
@ -1,5 +1,5 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright 2012-2019 the original author or authors.
|
|
|
|
* Copyright 2012-2021 the original author or authors.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
@ -18,10 +18,12 @@ package org.springframework.boot.devtools.restart;
|
|
|
|
|
|
|
|
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URLClassLoader;
|
|
|
|
import java.net.URLClassLoader;
|
|
|
|
|
|
|
|
import java.time.Duration;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collection;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.Collections;
|
|
|
|
import java.util.concurrent.ThreadFactory;
|
|
|
|
import java.util.concurrent.ThreadFactory;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import org.awaitility.Awaitility;
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
|
import org.junit.jupiter.api.AfterEach;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
import org.junit.jupiter.api.BeforeEach;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
|
import org.junit.jupiter.api.Test;
|
|
|
@ -80,10 +82,11 @@ class RestarterTests {
|
|
|
|
Restarter.clearInstance();
|
|
|
|
Restarter.clearInstance();
|
|
|
|
Thread thread = new Thread(SampleApplication::main);
|
|
|
|
Thread thread = new Thread(SampleApplication::main);
|
|
|
|
thread.start();
|
|
|
|
thread.start();
|
|
|
|
Thread.sleep(2600);
|
|
|
|
Awaitility.await().atMost(Duration.ofSeconds(30)).untilAsserted(() -> {
|
|
|
|
assertThat(StringUtils.countOccurrencesOf(output.toString(), "Tick 0")).isGreaterThan(1);
|
|
|
|
assertThat(StringUtils.countOccurrencesOf(output.toString(), "Tick 0")).isGreaterThan(1);
|
|
|
|
assertThat(StringUtils.countOccurrencesOf(output.toString(), "Tick 1")).isGreaterThan(1);
|
|
|
|
assertThat(StringUtils.countOccurrencesOf(output.toString(), "Tick 1")).isGreaterThan(1);
|
|
|
|
assertThat(CloseCountingApplicationListener.closed).isGreaterThan(0);
|
|
|
|
assertThat(CloseCountingApplicationListener.closed).isGreaterThan(0);
|
|
|
|
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Test
|
|
|
|
@Test
|
|
|
|