model2.setName("testmodel");
model2.setEdbId("createevent/8");
commit = getTestEKBCommit().addInsert(model2.getModel());
persist.commit(commit);
QueryRequest request = QueryRequest.query("name", "testmodel");
List<Object> result = (List<Object>) query.query(getTestModel(), request);
assertThat(result.size(), is(2));
request.setContextId(CONTEXT);
result = (List<Object>) query.query(getTestModel(), request);
assertThat(result.size(), is(1));
assertThat(new TestModelDecorator(result.get(0)).getEdbId(), is("createevent/7"));
request.setContextId("othercontext");
result = (List<Object>) query.query(getTestModel(), request);
assertThat(result.size(), is(1));
assertThat(new TestModelDecorator(result.get(0)).getEdbId(), is("createevent/8"));
request.setContextId("somenonesensecontext");
result = (List<Object>) query.query(getTestModel(), request);
assertThat(result.size(), is(0));
ContextHolder.get().setCurrentContextId(CONTEXT);
}