try {
RepositoryStartupService.registerCheckinListener();
ServiceImplementation serv = getServiceImplementation();
RepositoryCategoryService repositoryCategoryService = getRepositoryCategoryService();
RepositoryPackageService repositoryPackageService = getRepositoryPackageService();
UserInbox ib = new UserInbox( serv.getRulesRepository() );
List<InboxEntry> inbox = ib.loadRecentEdited();
repositoryPackageService.listPackages();
repositoryCategoryService.createCategory( "/",
"testCheckinCategory",
"this is a description" );
repositoryCategoryService.createCategory( "/",
"testCheckinCategory2",
"this is a description" );
repositoryCategoryService.createCategory( "testCheckinCategory",
"deeper",
"description" );
String uuid = serv.createNewRule( "testChecking",
"this is a description",
"testCheckinCategory",
RulesRepository.DEFAULT_PACKAGE,
AssetFormats.DRL );
RepositoryAssetService repositoryAssetService = getRepositoryAssetService();
RuleAsset asset = repositoryAssetService.loadRuleAsset( uuid );
assertNotNull( asset.lastModified );
asset.metaData.coverage= "boo";
asset.content= new RuleContentText();
((RuleContentText) asset.content).content = "yeah !";
asset.description= "Description 1";
Date start = new Date();
Thread.sleep( 100 );
String uuid2 = repositoryAssetService.checkinVersion( asset );
assertEquals( uuid,
uuid2 );
assertTrue( ib.loadRecentEdited().size() > inbox.size() );
RuleAsset asset2 = repositoryAssetService.loadRuleAsset( uuid );
assertNotNull( asset2.lastModified );
assertTrue( asset2.lastModified.after(start) );