diff options
Diffstat (limited to 'dbaccess/qa/complex/dbaccess/TestCase.java')
-rw-r--r-- | dbaccess/qa/complex/dbaccess/TestCase.java | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/dbaccess/qa/complex/dbaccess/TestCase.java b/dbaccess/qa/complex/dbaccess/TestCase.java index 40370d9aeebd..e331ccc33e7c 100644 --- a/dbaccess/qa/complex/dbaccess/TestCase.java +++ b/dbaccess/qa/complex/dbaccess/TestCase.java @@ -29,8 +29,12 @@ ************************************************************************/ package complex.dbaccess; +import com.sun.star.beans.PropertyValue; import com.sun.star.beans.XPropertySet; +import com.sun.star.frame.XComponentLoader; +import com.sun.star.frame.XModel; import com.sun.star.lang.XMultiServiceFactory; +import com.sun.star.uno.Exception; import com.sun.star.uno.UnoRuntime; import com.sun.star.uno.XComponentContext; import helper.FileTools; @@ -38,8 +42,6 @@ import java.io.File; import java.io.IOException; import java.net.URI; import java.net.URISyntaxException; -import java.net.URI; -import java.net.URISyntaxException; public abstract class TestCase extends complexlib.ComplexTestCase { @@ -55,8 +57,8 @@ public abstract class TestCase extends complexlib.ComplexTestCase XComponentContext context = null; try { - final XPropertySet orbProps = (XPropertySet) UnoRuntime.queryInterface( XPropertySet.class, getORB() ); - context = (XComponentContext)UnoRuntime.queryInterface( XComponentContext.class, + final XPropertySet orbProps = UnoRuntime.queryInterface( XPropertySet.class, getORB() ); + context = UnoRuntime.queryInterface( XComponentContext.class, orbProps.getPropertyValue( "DefaultContext" ) ); } catch ( Exception ex ) @@ -109,6 +111,15 @@ public abstract class TestCase extends complexlib.ComplexTestCase } // -------------------------------------------------------------------------------------------------------- + protected final XModel loadDocument( final String _docURL ) throws Exception + { + final XComponentLoader loader = UnoRuntime.queryInterface( XComponentLoader.class, + getORB().createInstance( "com.sun.star.frame.Desktop" ) ); + return UnoRuntime.queryInterface( XModel.class, + loader.loadComponentFromURL( _docURL, "_blank", 0, new PropertyValue[] {} ) ); + } + + // -------------------------------------------------------------------------------------------------------- protected void assureException( Object _object, Class _unoInterfaceClass, String _methodName, Object[] _methodArgs, Class _expectedExceptionClass ) { |