@Test
public void service_activity_scoreboard_perthread() throws InterruptedException
{
final Registry r = buildRegistry(GreeterModule.class, PerThreadModule.class);
ServiceActivityScoreboard scoreboard = r.getService(ServiceActivityScoreboard.class);
// Force the state of a few services.
final StringHolder holder = r.getService(StringHolder.class);
Runnable runnable = new Runnable()
{
public void run()
{
holder.setValue("barney");
assertEquals(holder.getValue(), "barney");
r.cleanupThread();
}
};
Thread t = new Thread(runnable);
t.start();
t.join();
// Now get the activity list and poke around.
List<ServiceActivity> serviceActivity = scoreboard.getServiceActivity();
assertTrue(serviceActivity.size() > 0);
for (ServiceActivity a : serviceActivity)
{