public void testAttachmentRefs2()
throws Exception
{
ReferenceManager refMgr = m_engine.getReferenceManager();
AttachmentManager attMgr = m_engine.getAttachmentManager();
m_engine.saveText( NAME1, "[TestAtt.txt]");
// check a few pre-conditions
Collection c = refMgr.findReferrers( "TestAtt.txt" );
assertTrue( "normal, unexisting page",
c!=null && ((String)c.iterator().next()).equals( NAME1 ) );
c = refMgr.findReferrers( NAME1+"/TestAtt.txt" );
assertTrue( "no attachment", c==null || c.size()==0 );
c = refMgr.findUncreated();
assertTrue( "unknown attachment",
c!=null &&
c.size()==1 &&
((String)c.iterator().next()).equals( "TestAtt.txt" ) );
// now we create the attachment
Attachment att = new Attachment( m_engine, NAME1, "TestAtt.txt" );
att.setAuthor( "FirstPost" );
attMgr.storeAttachment( att, m_engine.makeAttachmentFile() );
try
{
// and check post-conditions
c = refMgr.findUncreated();
assertTrue( "attachment exists: ",