Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / mod / _dbaccess / DBContentLoader.java
blob253f7bbefbf29b072188ebde24a89b31e2c7bfd6
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package mod._dbaccess;
21 import java.io.PrintWriter;
23 import lib.Status;
24 import lib.StatusException;
25 import lib.TestCase;
26 import lib.TestEnvironment;
27 import lib.TestParameters;
29 import com.sun.star.uno.XInterface;
31 /**
32 * Test for object which is represented by service
33 * <code>com.sun.star.sdb.ContentLoader</code>. <p>
34 * Object implements the following interfaces :
35 * <ul>
36 * <li> <code>com::sun::star::beans::XPropertySet</code></li>
37 * <li> <code>com::sun::star::frame::FrameLoader</code></li>
38 * <li> <code>com::sun::star::frame::XFrameLoader</code></li>
39 * <li> <code>com::sun::star::lang::XInitialization</code></li>
40 * </ul>
41 * This object test <b> is NOT </b> designed to be run in several
42 * threads concurently.
43 * @see com.sun.star.beans.XPropertySet
44 * @see com.sun.star.frame.FrameLoader
45 * @see com.sun.star.frame.XSynchronousFrameLoader
46 * @see com.sun.star.lang.XInitialization
47 * @see ifc.beans._XPropertySet
48 * @see ifc.frame._FrameLoader
49 * @see ifc.frame._XSynchronousFrameLoader
50 * @see ifc.lang._XInitialization
52 public class DBContentLoader extends TestCase {
54 /**
55 * Creating a Testenvironment for the interfaces to be tested.
56 * Creates an instance of the service
57 * <code>com.sun.star.sdb.ContentLoader</code>. <p>
58 * Object relations created :
59 * <ul>
60 * <li> <code>'FrameLoader.URL"'</code> for
61 * {@link ifc.frame._XFrameLoader} </li>
62 * </ul>
64 @Override
65 public TestEnvironment createTestEnvironment( TestParameters Param,
66 PrintWriter log )
67 throws StatusException {
68 XInterface oObj = null;
69 Object oInterface = null ;
71 //now get the OButtonControl
72 try {
73 oInterface = Param.getMSF().createInstance
74 ("com.sun.star.sdb.ContentLoader") ;
75 } catch (com.sun.star.uno.Exception e) {
76 log.println("Couldn't get service");
77 e.printStackTrace(log);
78 throw new StatusException("Couldn't get GridControl", e );
81 if (oInterface == null) {
82 log.println("Service wasn't created") ;
83 throw new StatusException(Status.failed("Service wasn't created")) ;
86 oObj = (XInterface) oInterface ;
88 log.println("ImplementationName " + util.utils.getImplName(oObj));
89 log.println( "creating a new environment for object" );
90 TestEnvironment tEnv = new TestEnvironment( oObj );
92 // adding relation for XFrameLoader
93 tEnv.addObjRelation("FrameLoader.URL",
94 ".component:DB/DataSourceBrowser") ;
97 return tEnv;
98 } // finish method getTestEnvironment