mirror of
https://github.com/apache/maven-mvnd.git
synced 2025-09-27 07:55:25 +00:00
@@ -32,7 +32,7 @@ public class TestClientOutput implements ClientOutput {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDaemonId(String uid) {
|
||||
public void setDaemonId(String daemonId) {
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@@ -52,7 +52,7 @@ public class ExtensionsNativeIT {
|
||||
assertTrue(daemon.getOptions().contains(
|
||||
"mvnd.coreExtensions=io.takari.aether:takari-local-repository:[0.11.3,);fr.jcgay.maven:maven-profiler:3.0"));
|
||||
|
||||
registry.awaitIdle(daemon.getUid());
|
||||
registry.awaitIdle(daemon.getId());
|
||||
|
||||
client.execute(o, "-v").assertSuccess();
|
||||
assertDaemonRegistrySize(1);
|
||||
|
@@ -58,7 +58,7 @@ public class NewManagedModuleNativeIT {
|
||||
|
||||
final DaemonInfo d = registry.getAll().get(0);
|
||||
/* Wait, till the instance becomes idle */
|
||||
registry.awaitIdle(d.getUid());
|
||||
registry.awaitIdle(d.getId());
|
||||
|
||||
/* Do the changes */
|
||||
final Path srcDir = parentDir.resolve("../changes").normalize();
|
||||
|
@@ -51,10 +51,10 @@ public class StopStatusTest {
|
||||
final TestClientOutput output = new TestClientOutput();
|
||||
client.execute(output, "--status").assertSuccess();
|
||||
|
||||
output.assertContainsMatchingSubsequence(d.getUid() + " +" + d.getPid() + " +" + d.getAddress());
|
||||
output.assertContainsMatchingSubsequence(d.getId() + " +" + d.getPid() + " +" + d.getAddress());
|
||||
}
|
||||
/* Wait, till the instance becomes idle */
|
||||
registry.awaitIdle(d.getUid());
|
||||
registry.awaitIdle(d.getId());
|
||||
|
||||
client.execute(new TestClientOutput(), "clean").assertSuccess();
|
||||
/* There should still be exactly one item in the registry after the second build */
|
||||
@@ -65,13 +65,13 @@ public class StopStatusTest {
|
||||
assertDaemonRegistrySize(0);
|
||||
|
||||
{
|
||||
/* After --stop, the output of --status may not contain the UID we have seen before */
|
||||
/* After --stop, the output of --status may not contain the daemon ID we have seen before */
|
||||
final TestClientOutput output = new TestClientOutput();
|
||||
client.execute(output, "--status").assertSuccess();
|
||||
|
||||
Assertions.assertThat(
|
||||
output.messagesToString().stream()
|
||||
.filter(m -> m.contains(d.getUid()))
|
||||
.filter(m -> m.contains(d.getId()))
|
||||
.collect(Collectors.toList()))
|
||||
.isEmpty();
|
||||
}
|
||||
|
@@ -54,7 +54,7 @@ public class UpgradesInBomNativeIT {
|
||||
assertDaemonRegistrySize(1);
|
||||
final DaemonInfo d = registry.getAll().get(0);
|
||||
/* Wait, till the instance becomes idle */
|
||||
registry.awaitIdle(d.getUid());
|
||||
registry.awaitIdle(d.getId());
|
||||
registry.killAll();
|
||||
}
|
||||
assertDaemonRegistrySize(0);
|
||||
@@ -70,7 +70,7 @@ public class UpgradesInBomNativeIT {
|
||||
|
||||
final DaemonInfo d = registry.getAll().get(0);
|
||||
/* Wait, till the instance becomes idle */
|
||||
registry.awaitIdle(d.getUid());
|
||||
registry.awaitIdle(d.getId());
|
||||
|
||||
/* Upgrade the dependency */
|
||||
final Path parentPomPath = parentDir.resolve("pom.xml");
|
||||
|
@@ -49,9 +49,9 @@ public class TestRegistry extends DaemonRegistry {
|
||||
exit.get(5, TimeUnit.SECONDS);
|
||||
}
|
||||
} catch (Exception t) {
|
||||
System.out.println("Daemon " + di.getUid() + ": " + t);
|
||||
System.out.println("Daemon " + di.getId() + ": " + t);
|
||||
} finally {
|
||||
remove(di.getUid());
|
||||
remove(di.getId());
|
||||
}
|
||||
}
|
||||
if (deadline < System.currentTimeMillis() && !getAll().isEmpty()) {
|
||||
@@ -63,20 +63,20 @@ public class TestRegistry extends DaemonRegistry {
|
||||
/**
|
||||
* Poll the state of the daemon with the given {@code uid} until it becomes idle.
|
||||
*
|
||||
* @param uid the uid of the daemon to poll
|
||||
* @param daemonId the ID of the daemon to poll
|
||||
* @throws IllegalStateException if the daemon is not available in the registry
|
||||
* @throws AssertionError if the timeout is exceeded
|
||||
*/
|
||||
public void awaitIdle(String uid) {
|
||||
public void awaitIdle(String daemonId) {
|
||||
final int timeoutMs = 5000;
|
||||
final long deadline = System.currentTimeMillis() + timeoutMs;
|
||||
while (getAll().stream()
|
||||
.filter(di -> di.getUid().equals(uid))
|
||||
.filter(di -> di.getId().equals(daemonId))
|
||||
.findFirst()
|
||||
.orElseThrow(() -> new IllegalStateException("Daemon " + uid + " is not available in the registry"))
|
||||
.orElseThrow(() -> new IllegalStateException("Daemon " + daemonId + " is not available in the registry"))
|
||||
.getState() != DaemonState.Idle) {
|
||||
Assertions.assertThat(deadline)
|
||||
.withFailMessage("Daemon %s should have become idle within %d", uid, timeoutMs)
|
||||
.withFailMessage("Daemon %s should have become idle within %d", daemonId, timeoutMs)
|
||||
.isGreaterThan(System.currentTimeMillis());
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user