Skip to content

Commit

Permalink
Adjusted the job execution test to the context management changes.
Browse files Browse the repository at this point in the history
  • Loading branch information
nmihajlovski committed Aug 3, 2015
1 parent faff327 commit 2c6d6e2
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions rapidoid-http/src/test/java/org/rapidoid/webapp/JobsTest.java
Expand Up @@ -35,10 +35,10 @@
@Since("4.1.0")
public class JobsTest extends TestCommons {

@Test(timeout = 10000)
@Test(timeout = 20000)
public void testJobsExecution() {

int total = 300000;
int total = 100000;
final AtomicInteger counter = new AtomicInteger();

multiThreaded(1000, total, new Runnable() {
Expand All @@ -47,15 +47,18 @@ public void testJobsExecution() {
public void run() {
Ctxs.open();

final WebApp app = new WebApp(null, null, null, null, null, AppMode.DEVELOPMENT, null, null);
final UserInfo user = new UserInfo();
user.username = rndStr(50);

Ctxs.ctx().setUser(user);
ensureUser(user);
Ctxs.ctx().setApp(app);
ensureProperContext(user, app);

ScheduledFuture<?> future = Jobs.execute(new Runnable() {
@Override
public void run() {
ensureUser(user);
ensureProperContext(user, app);
counter.incrementAndGet();
}
});
Expand All @@ -75,8 +78,9 @@ public void run() {
eq(counter.get(), total);
}

private void ensureUser(UserInfo user) {
private void ensureProperContext(UserInfo user, WebApp app) {
eq(Ctxs.ctx().user(), user);
eq(Ctxs.ctx().app(), app);
}

}

0 comments on commit 2c6d6e2

Please sign in to comment.