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 .
21 import java
.io
.PrintWriter
;
24 import lib
.TestEnvironment
;
25 import lib
.TestParameters
;
27 import com
.sun
.star
.container
.XIndexContainer
;
28 import com
.sun
.star
.lang
.XMultiServiceFactory
;
29 import com
.sun
.star
.uno
.UnoRuntime
;
30 import com
.sun
.star
.uno
.XInterface
;
33 * Test for object which is represented by service
34 * <code>com.sun.star.cnt.CntUnoDataContainer</code>. <p>
35 * Object implements the following interfaces :
37 * <li> <code>com::sun::star::io::XActiveDataSink</code></li>
38 * <li> <code>com::sun::star::container::XIndexContainer</code></li>
39 * <li> <code>com::sun::star::ucb::XDataContainer</code></li>
40 * <li> <code>com::sun::star::container::XIndexAccess</code></li>
41 * <li> <code>com::sun::star::container::XElementAccess</code></li>
42 * <li> <code>com::sun::star::container::XIndexReplace</code></li>
44 * This object test <b> is NOT </b> designed to be run in several
45 * threads concurrently.
46 * @see com.sun.star.io.XActiveDataSink
47 * @see com.sun.star.container.XIndexContainer
48 * @see com.sun.star.ucb.XDataContainer
49 * @see com.sun.star.container.XIndexAccess
50 * @see com.sun.star.container.XElementAccess
51 * @see com.sun.star.container.XIndexReplace
52 * @see ifc.io._XActiveDataSink
53 * @see ifc.container._XIndexContainer
54 * @see ifc.ucb._XDataContainer
55 * @see ifc.container._XIndexAccess
56 * @see ifc.container._XElementAccess
57 * @see ifc.container._XIndexReplace
59 public class CntUnoDataContainer
extends TestCase
{
62 * Creating a TestEnvironment for the interfaces to be tested.
63 * Creates an instance of the service
64 * <code>com.sun.star.cnt.CntUnoDataContainer</code> and adds
65 * to it one <code>CntUnoDataContainer</code> instance. <p>
66 * Object relations created :
68 * <li> <code>'INSTANCE1'</code> for
69 * {@link ifc.container._XIndexContainer},
70 * {@link ifc.container._XIndexReplace} : for this object
71 * elements contained in it are <code>CntUnoDataContainer</code>
72 * instances. (only one relation for one interface thread is now
74 * <li> <code>'InputStream'</code> for
75 * {@link ifc.io._XActiveDataSink} : a stream to set and get.
80 protected TestEnvironment
createTestEnvironment(
81 TestParameters Param
, PrintWriter log
) throws Exception
{
82 XMultiServiceFactory xMSF
= Param
.getMSF();
84 Object oInterface
= xMSF
.createInstance
85 ( "com.sun.star.ucb.DataContainer" );
87 // adding one child container
88 XIndexContainer xIC
= UnoRuntime
.queryInterface
89 (XIndexContainer
.class, oInterface
) ;
91 Object child
= xMSF
.createInstance
92 ( "com.sun.star.ucb.DataContainer" );
93 xIC
.insertByIndex(0, child
) ;
95 Object relationContainer
= xMSF
.createInstance
96 ( "com.sun.star.ucb.DataContainer" );
98 Object xIn
= xMSF
.createInstance
99 ( "com.sun.star.io.DataInputStream" );
101 XInterface oObj
= (XInterface
) oInterface
;
103 TestEnvironment tEnv
= new TestEnvironment( oObj
);
105 tEnv
.addObjRelation("INSTANCE1", relationContainer
) ;
106 tEnv
.addObjRelation("InputStream", xIn
) ;
109 } // finish method getTestEnvironment
111 } // finish class BreakIterator