when( assetItem.getDescription() ).thenReturn( "descriptiondescriptiondescriptiondescriptiondescriptiondescriptiondescriptiondescriptiondescription" ); when( assetItem.getStateDescription() ).thenReturn( "statedescription" ); when( assetItem.getCreator() ).thenReturn( "creator" ); when( assetItem.getCreatedDate() ).thenReturn( calendar ); when( assetItem.getLastContributor() ).thenReturn( "lastcontributor" ); assetItem.getStateDescription() ); assertEquals( makeAssetPageRow.getCreator(), assetItem.getCreator() ); assertEquals( makeAssetPageRow.getCreatedDate(), assetItem.getCreatedDate().getTime() );
AssetItem linkedAsset = getRepo().loadDefaultModule().addAssetImportedFromGlobalArea(asset.getName()); assertFalse(asset.getCreator().equals("")); assertFalse(linkedAsset.getCreator().equals("")); linkedAsset.updateContent("test content"); linkedAsset.checkin("yeah");
@Test public void testUpdateContent() throws Exception { AssetItem ruleItem1 = getDefaultPackage().addAsset("testUpdateContent", "test description"); assertFalse(ruleItem1.getCreator().equals( "" )); ruleItem1.updateContent( "test content" ); ruleItem1.checkin( "yeah" ); assertFalse(ruleItem1.getLastContributor().equals( "" )); ruleItem1.updateContent( "new rule content"); assertEquals("new rule content", ruleItem1.getContent()); assertTrue(ruleItem1.getNode().getSession().hasPendingChanges()); ruleItem1.checkin( "yeah !" ); assertFalse(ruleItem1.getNode().getSession().hasPendingChanges()); assertEquals("yeah !", ruleItem1.getCheckinComment()); AssetItem prev = (AssetItem) ruleItem1.getPrecedingVersion(); assertEquals("test content", prev.getContent()); assertFalse("yeah !".equals(prev.getCheckinComment())); assertEquals(prev, ruleItem1.getPrecedingVersion()); ruleItem1 = getDefaultPackage().loadAsset( "testUpdateContent" ); VersionIterator it = VersionableItem.getVersionManager(ruleItem1.getNode()).getVersionHistory(ruleItem1.getNode().getPath()).getAllVersions(); // and this shows using a version iterator. // perhaps migrate to using this rather then next/prev methods. //this way, we can skip. assertTrue(it.hasNext()); while (it.hasNext()) { Version n = it.nextVersion(); AssetItem item = new AssetItem(ruleItem1.getRulesRepository(), n); assertNotNull(item); } }