Skip to content

Commit

Permalink
Make sure to always wait for exhaustion.
Browse files Browse the repository at this point in the history
  • Loading branch information
mnlipp committed May 2, 2024
1 parent 78aca66 commit dc4c714
Show file tree
Hide file tree
Showing 11 changed files with 21 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public void testDetach() throws InterruptedException, ExecutionException {
assertNull(comp2.getManager().parent());
assertEquals(comp2, comp2.getManager().root());
assertEquals(0, comp.getManager().children().size());
Components.awaitExhaustion();
}

@Test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ public void testComplete() throws InterruptedException {
}
test1.get();
assertTrue(app.testDone);
Components.awaitExhaustion();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ public void testDefaultHandler() throws InterruptedException {
} finally {
System.setErr(oldErr);
}
Components.awaitExhaustion();
}

public static class BuggyComponentWithHandler extends Component {
Expand All @@ -78,6 +79,7 @@ public void testComplete() throws InterruptedException {
BuggyComponentWithHandler app = new BuggyComponentWithHandler();
Components.start(app);
assertTrue(app.caughtError);
Components.awaitExhaustion();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ public void testComplete() throws InterruptedException {
PrioritisedHandlers app = new PrioritisedHandlers();
Components.start(app);
assertTrue(app.result.equals("Hello"));
Components.awaitExhaustion();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ public void testComplete() throws InterruptedException {
PrioritisedHandlers app = new PrioritisedHandlers();
Components.start(app);
assertTrue(app.result.equals("Hel"));
Components.awaitExhaustion();
}

}
2 changes: 2 additions & 0 deletions org.jgrapes.io/test/org/jgrapes/io/test/net/EchoTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,7 @@ public void testTcp() throws IOException, InterruptedException,
}
break;
}
Components.awaitExhaustion();
Components.checkAssertions();
}

Expand Down Expand Up @@ -276,6 +277,7 @@ public void checkServerTrusted(
}
break;
}
Components.awaitExhaustion();
Components.checkAssertions();
}

Expand Down
2 changes: 2 additions & 0 deletions org.jgrapes.io/test/org/jgrapes/io/test/net/EchoTest2.java
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@ public void testTcp() throws IOException, InterruptedException,
}
break;
}
Components.awaitExhaustion();
Components.checkAssertions();
}

Expand Down Expand Up @@ -235,6 +236,7 @@ public void testSsl() throws IOException, InterruptedException,
}
break;
}
Components.awaitExhaustion();
Components.checkAssertions();
}

Expand Down
3 changes: 3 additions & 0 deletions org.jgrapes.io/test/org/jgrapes/io/test/net/EchoTest3.java
Original file line number Diff line number Diff line change
Expand Up @@ -227,6 +227,7 @@ public void testTcp() throws IOException, InterruptedException,
}
break;
}
Components.awaitExhaustion();
Components.checkAssertions();
}

Expand Down Expand Up @@ -276,6 +277,7 @@ public void testUds() throws IOException, InterruptedException,
}
break;
}
Components.awaitExhaustion();
Components.checkAssertions();
Files.deleteIfExists(udsPath);
}
Expand Down Expand Up @@ -346,6 +348,7 @@ public void testSsl() throws IOException, InterruptedException,
}
break;
}
Components.awaitExhaustion();
Components.checkAssertions();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,7 @@ public void sendTest(int bufferSize)
}
break;
}
Components.awaitExhaustion();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import org.jgrapes.io.test.WaitForTests;
import org.jgrapes.net.SocketServer;
import org.jgrapes.net.events.Ready;
import org.junit.After;
import static org.junit.Assert.*;
import org.junit.Before;
import org.junit.Test;
Expand Down Expand Up @@ -85,6 +86,11 @@ public void setUp() throws Exception {
wf.get();
}

@After
public void tearDown() throws Exception {
Components.awaitExhaustion();
}

@Test
public void testStartClose() throws InterruptedException {
assertEquals(State.READY, checker.state);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ public void checkServerTrusted(
}
break;
}
Components.awaitExhaustion();
Components.checkAssertions();
}

Expand Down

0 comments on commit dc4c714

Please sign in to comment.