xref: /aoo41x/main/udkapi/com/sun/star/test/XTest.idl (revision cdf0e10c)
1/*************************************************************************
2 *
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2000, 2010 Oracle and/or its affiliates.
6 *
7 * OpenOffice.org - a multi-platform office productivity suite
8 *
9 * This file is part of OpenOffice.org.
10 *
11 * OpenOffice.org is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License version 3
13 * only, as published by the Free Software Foundation.
14 *
15 * OpenOffice.org is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 * GNU Lesser General Public License version 3 for more details
19 * (a copy is included in the LICENSE file that accompanied this code).
20 *
21 * You should have received a copy of the GNU Lesser General Public License
22 * version 3 along with OpenOffice.org.  If not, see
23 * <http://www.openoffice.org/license.html>
24 * for a copy of the LGPLv3 License.
25 *
26 ************************************************************************/
27#ifndef __com_sun_star_test_XTest_idl__
28#define __com_sun_star_test_XTest_idl__
29
30#ifndef __com_sun_star_uno_XInterface_idl__
31#include <com/sun/star/uno/XInterface.idl>
32#endif
33
34#ifndef __com_sun_star_lang_IllegalArgumentException_idl__
35#include <com/sun/star/lang/IllegalArgumentException.idl>
36#endif
37
38#ifndef __com_sun_star_test_XTestListener_idl__
39#include <com/sun/star/test/XTestListener.idl>
40#endif
41
42
43//=============================================================================
44
45module com { module sun { module star { module test {
46
47//=============================================================================
48/**
49	A simple interface to test a service or interface implementation.
50*/
51published interface XTest: com::sun::star::uno::XInterface
52{
53	//-------------------------------------------------------------------------
54	/**
55		Test the object TestObject against the test specified with TestName. This test
56		does not change the semantic state of the object, so it can be called on a existing
57		component that will used further on. Note: This can be a strong test limitation.
58		There are some components, that cannot perform their full test scenario.
59		@param TestName
60			the name of the test. Must be an interface, service, or implementation name.
61			Note: The name is only used by the test component to distinguish between test
62			scenarios.
63		@param TestObject
64				The instance to be tested.
65		@throws IllegalArgumentException
66			if the test does not support TestName or TestObject is null.
67	*/
68	void testInvariant( [in] string TestName,
69			 [in] com::sun::star::uno::XInterface TestObject )
70			raises( com::sun::star::lang::IllegalArgumentException );
71
72	//-------------------------------------------------------------------------
73	/**
74		Test the object TestObject against the test specified with TestName.
75		This test changes the state of the object. The object may be useless
76		afterwards (e.g., a closed XOutputStream). The method in general may
77		be called multiple times with a new test object instance. Note: Each test
78		scenario should be independent of each other, so even if a scenario
79		didn't pass the test, the other test can still be performed.
80		The error messages are cumulative.
81
82		@param TestName
83			The name of the test. Must be an interface, service, or
84			implementation name. Note: The name is only used by the test component
85			to distinguish between test scenarios.
86		@param TestObject
87				The instance to be tested.
88		@param hTestHandle
89				Internal test handle. Handle for first test is always 0.
90			Handle of next test is  returned by the method.
91		@return Handle of the next test. -1 if this was the last test.
92
93		@throws IllegalArgumentException
94			if the test does not support TestName or TestObject is null.
95	*/
96	long test( [in] string TestName,
97			 [in] com::sun::star::uno::XInterface TestObject,
98			 [in] long hTestHandle )
99			raises( com::sun::star::lang::IllegalArgumentException );
100
101	//-------------------------------------------------------------------------
102	/**
103		Test the object TestObject against the test specified with TestName	using
104		several threads. That does NOT mean that testMultiThread should	implement
105		a test using several threads but that this test method should be designed
106		to be called by several threads. So for example, it has to take into consideration
107		that a test object state that is changed by the method	can be
108		changed again by another thread. So it's not necessarily a mistake if an
109		expected state can't be confirmed after setting it. Besides that, everything
110		is the same as described for the test method.
111
112		If this way of testing with multiple threads is not appropriate for the
113		component to be tested this method should not be implemented (it should
114		only return -1) and a special multithread test adapted to the special
115		needs of testing this component should be integrated in the test method.
116
117		@param TestName
118			The name of the test. Must be an interface, service or
119			implementation name. Note: The name is only used by the test component
120			to distinguish between test scenarios.
121		@param TestObject
122			The instance to be tested.
123		@param hTestHandle
124			Internal test handle. Handle for first test is always 0.
125			Handle of next test is  returned by the method.
126		@return Handle of the next test. -1 if this was the last test.
127
128		@throws IllegalArgumentException
129			if the test does not support TestName or TestObject is null.
130	*/
131	long testMultiThread( [in] string TestName,
132			 [in] com::sun::star::uno::XInterface TestObject,
133			 [in] long hTestHandle )
134			raises( com::sun::star::lang::IllegalArgumentException );
135
136	//-------------------------------------------------------------------------
137	/**	registers an event listener, which will be called for reporting
138		errors/exceptions and warnings and for protocol purpuses.
139	*/
140	void addTestListener( [in] XTestListener xListener );
141
142	//-------------------------------------------------------------------------
143	/**	unregisters an event listener which was registered with
144		<member>XTest::addTestListener()</member>.
145
146	*/
147	void removeTestListener( [in] XTestListener xListener );
148
149};
150
151//=============================================================================
152
153}; }; }; };
154
155#endif
156