01: package org.mockejb;
02:
03: /**
04: * Provides in-memory entity database implementation suitable for
05: * setting up test mock data.
06: * Entities can be searched only by the primary key.
07: * Users should populate EntityDatabase with the mock entities for their test.
08: * MockEJB searches EntityDatabase:
09: * 1) During the call to CMP findByPrimaryKey.
10: * 2) After a BMP finder returns a PK or collection of PKs.
11: * MockEJB automatically add an entity to this "database" if
12: * its ejbCreate method returns a PK.
13: *
14: * Note that you can use aspects/interceptors to intercept all calls to this
15: * class.
16: *
17: * @author Alexander Ananiev
18: */
19: public interface EntityDatabase {
20:
21: void add(Class homeIfaceClass, Object pk, Object entity);
22:
23: Object find(Class homeIfaceClass, Object pk);
24:
25: void clear();
26: }
|