public void testTrackRecentOpenedChanged() throws Exception {
try {
RepositoryStartupService.registerCheckinListener();
ServiceImplementation impl = getServiceImplementation();
RepositoryCategoryService repositoryCategoryService = getRepositoryCategoryService();
UserInbox ib = new UserInbox( impl.getRulesRepository() );
ib.clearAll();
impl.getRulesRepository().createPackage( "testTrackRecentOpenedChanged",
"desc" );
repositoryCategoryService.createCategory( "",
"testTrackRecentOpenedChanged",
"this is a cat" );
String id = impl.createNewRule( "myrule",
"desc",
"testTrackRecentOpenedChanged",
"testTrackRecentOpenedChanged",
"drl" );
RepositoryAssetService repositoryAssetService = getRepositoryAssetService();
RuleAsset ass = repositoryAssetService.loadRuleAsset( id );
repositoryAssetService.checkinVersion( ass );
List<InboxEntry> es = ib.loadRecentEdited();
assertEquals( 1,
es.size() );
assertEquals( ass.getUuid(),
es.get( 0 ).assetUUID );
assertEquals( ass.getName(),
es.get( 0 ).note );
ib.clearAll();
repositoryAssetService.loadRuleAsset( ass.getUuid() );
es = ib.loadRecentEdited();
assertEquals( 0,
es.size() );
//now check they have it in their opened list...
es = ib.loadRecentOpened();
assertEquals( 1,
es.size() );
assertEquals( ass.getUuid(),
es.get( 0 ).assetUUID );
assertEquals( ass.getName(),
es.get( 0 ).note );
assertEquals( 0,
ib.loadRecentEdited().size() );
} finally {
RepositoryStartupService.removeListeners();
}
}