1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <comphelper/processfactory.hxx>
11 #include <test/unoapi_test.hxx>
13 #include <com/sun/star/frame/XModel.hpp>
14 #include <com/sun/star/frame/Desktop.hpp>
15 #include <com/sun/star/sdb/XOfficeDatabaseDocument.hpp>
16 #include <com/sun/star/sdbc/XConnection.hpp>
17 #include <com/sun/star/sdbc/XDataSource.hpp>
19 using namespace ::com::sun::star
;
20 using namespace ::com::sun::star::frame
;
21 using namespace ::com::sun::star::sdb
;
22 using namespace ::com::sun::star::sdbc
;
23 using namespace ::com::sun::star::uno
;
29 DBTestBase() : UnoApiTest("dbaccess/qa/unit/data") {};
31 uno::Reference
< XOfficeDatabaseDocument
>
32 getDocumentForFileName(const OUString
&sFileName
);
34 uno::Reference
< XConnection
>
35 getConnectionForDocument(
36 uno::Reference
< XOfficeDatabaseDocument
>& xDocument
);
39 uno::Reference
< XOfficeDatabaseDocument
>
40 DBTestBase::getDocumentForFileName(const OUString
&sFileName
)
43 createFileURL(sFileName
, sFilePath
);
44 uno::Reference
< lang::XComponent
> xComponent (loadFromDesktop(sFilePath
));
45 CPPUNIT_ASSERT(xComponent
.is());
47 uno::Reference
< XOfficeDatabaseDocument
> xDocument(xComponent
, UNO_QUERY
);
48 CPPUNIT_ASSERT(xDocument
.is());
53 uno::Reference
< XConnection
> DBTestBase::getConnectionForDocument(
54 uno::Reference
< XOfficeDatabaseDocument
>& xDocument
)
56 uno::Reference
< XDataSource
> xDataSource
= xDocument
->getDataSource();
57 CPPUNIT_ASSERT(xDataSource
.is());
59 uno::Reference
< XConnection
> xConnection
= xDataSource
->getConnection("","");
60 CPPUNIT_ASSERT(xConnection
.is());
65 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */