// ....................................................................
// 2. XLoadable::load
databaseDoc = UnoRuntime.queryInterface(XModel.class, getMSF().createInstance("com.sun.star.sdb.OfficeDatabaseDocument"));
documentURL = copyToTempFile(documentURL);
// load the doc, and verify it's initialized then, and has the proper URL
XLoadable loadDoc = UnoRuntime.queryInterface(XLoadable.class, databaseDoc);
loadDoc.load(new PropertyValue[]
{
new PropertyValue("URL", 0, documentURL, PropertyState.DIRECT_VALUE)
});
databaseDoc.attachResource(documentURL, new PropertyValue[0]);
assertEquals("wrong URL after loading the document", documentURL, databaseDoc.getURL());
impl_checkDocumentInitState(databaseDoc, true);
// and while we are here ... initilizing the same document again should not be possible
assureException( databaseDoc, XLoadable.class, "initNew", new Object[0],
DoubleInitializationException.class );
assureException( databaseDoc, XLoadable.class, "load", new Object[] { new PropertyValue[0] },
DoubleInitializationException.class );
// ....................................................................
// 3. XLoadable::initNew
impl_closeDocument(databaseDoc);
databaseDoc = impl_createDocument();
loadDoc = UnoRuntime.queryInterface(XLoadable.class, databaseDoc);
loadDoc.initNew();
assertEquals("wrong URL after initializing the document", "", databaseDoc.getURL());
impl_checkDocumentInitState(databaseDoc, true);
// same as above - initializing the document a second time must fail
assureException( databaseDoc, XLoadable.class, "initNew", new Object[0],