xref: /AOO41X/main/udkapi/com/sun/star/test/XTest.idl (revision 408a4873fc8bcc602c90ea4598886bb71abf0675)
1/**************************************************************
2 *
3 * Licensed to the Apache Software Foundation (ASF) under one
4 * or more contributor license agreements.  See the NOTICE file
5 * distributed with this work for additional information
6 * regarding copyright ownership.  The ASF licenses this file
7 * to you under the Apache License, Version 2.0 (the
8 * "License"); you may not use this file except in compliance
9 * with the License.  You may obtain a copy of the License at
10 *
11 *   http://www.apache.org/licenses/LICENSE-2.0
12 *
13 * Unless required by applicable law or agreed to in writing,
14 * software distributed under the License is distributed on an
15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16 * KIND, either express or implied.  See the License for the
17 * specific language governing permissions and limitations
18 * under the License.
19 *
20 *************************************************************/
21
22
23#ifndef __com_sun_star_test_XTest_idl__
24#define __com_sun_star_test_XTest_idl__
25
26#ifndef __com_sun_star_uno_XInterface_idl__
27#include <com/sun/star/uno/XInterface.idl>
28#endif
29
30#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
31#include <com/sun/star/lang/IllegalArgumentException.idl>
32#endif
33
34#ifndef __com_sun_star_test_XTestListener_idl__
35#include <com/sun/star/test/XTestListener.idl>
36#endif
37
38
39//=============================================================================
40
41module com { module sun { module star { module test {
42
43//=============================================================================
44/**
45    A simple interface to test a service or interface implementation.
46*/
47published interface XTest: com::sun::star::uno::XInterface
48{
49    //-------------------------------------------------------------------------
50    /**
51        Test the object TestObject against the test specified with TestName. This test
52        does not change the semantic state of the object, so it can be called on a existing
53        component that will used further on. Note: This can be a strong test limitation.
54        There are some components, that cannot perform their full test scenario.
55        @param TestName
56            the name of the test. Must be an interface, service, or implementation name.
57            Note: The name is only used by the test component to distinguish between test
58            scenarios.
59        @param TestObject
60                The instance to be tested.
61        @throws IllegalArgumentException
62            if the test does not support TestName or TestObject is null.
63    */
64    void testInvariant( [in] string TestName,
65             [in] com::sun::star::uno::XInterface TestObject )
66            raises( com::sun::star::lang::IllegalArgumentException );
67
68    //-------------------------------------------------------------------------
69    /**
70        Test the object TestObject against the test specified with TestName.
71        This test changes the state of the object. The object may be useless
72        afterwards (e.g., a closed XOutputStream). The method in general may
73        be called multiple times with a new test object instance. Note: Each test
74        scenario should be independent of each other, so even if a scenario
75        didn't pass the test, the other test can still be performed.
76        The error messages are cumulative.
77
78        @param TestName
79            The name of the test. Must be an interface, service, or
80            implementation name. Note: The name is only used by the test component
81            to distinguish between test scenarios.
82        @param TestObject
83                The instance to be tested.
84        @param hTestHandle
85                Internal test handle. Handle for first test is always 0.
86            Handle of next test is  returned by the method.
87        @return Handle of the next test. -1 if this was the last test.
88
89        @throws IllegalArgumentException
90            if the test does not support TestName or TestObject is null.
91    */
92    long test( [in] string TestName,
93             [in] com::sun::star::uno::XInterface TestObject,
94             [in] long hTestHandle )
95            raises( com::sun::star::lang::IllegalArgumentException );
96
97    //-------------------------------------------------------------------------
98    /**
99        Test the object TestObject against the test specified with TestName using
100        several threads. That does NOT mean that testMultiThread should implement
101        a test using several threads but that this test method should be designed
102        to be called by several threads. So for example, it has to take into consideration
103        that a test object state that is changed by the method  can be
104        changed again by another thread. So it's not necessarily a mistake if an
105        expected state can't be confirmed after setting it. Besides that, everything
106        is the same as described for the test method.
107
108        If this way of testing with multiple threads is not appropriate for the
109        component to be tested this method should not be implemented (it should
110        only return -1) and a special multithread test adapted to the special
111        needs of testing this component should be integrated in the test method.
112
113        @param TestName
114            The name of the test. Must be an interface, service or
115            implementation name. Note: The name is only used by the test component
116            to distinguish between test scenarios.
117        @param TestObject
118            The instance to be tested.
119        @param hTestHandle
120            Internal test handle. Handle for first test is always 0.
121            Handle of next test is  returned by the method.
122        @return Handle of the next test. -1 if this was the last test.
123
124        @throws IllegalArgumentException
125            if the test does not support TestName or TestObject is null.
126    */
127    long testMultiThread( [in] string TestName,
128             [in] com::sun::star::uno::XInterface TestObject,
129             [in] long hTestHandle )
130            raises( com::sun::star::lang::IllegalArgumentException );
131
132    //-------------------------------------------------------------------------
133    /** registers an event listener, which will be called for reporting
134        errors/exceptions and warnings and for protocol purpuses.
135    */
136    void addTestListener( [in] XTestListener xListener );
137
138    //-------------------------------------------------------------------------
139    /** unregisters an event listener which was registered with
140        <member>XTest::addTestListener()</member>.
141
142    */
143    void removeTestListener( [in] XTestListener xListener );
144
145};
146
147//=============================================================================
148
149}; }; }; };
150
151#endif
152