1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XJobExecutor.java,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
33 import lib
.MultiMethodTest
;
35 import com
.sun
.star
.container
.XNamed
;
36 import com
.sun
.star
.task
.XJobExecutor
;
39 * Testing <code>com.sun.star.frame._XJobExecutor</code>
42 * <li><code> trigger() </code></li>
45 * This test needs the following object relations :
47 * <li> <code>'CallCounter'</code>
48 * (of type <code>com.sun.star.container.XNamed</code>):
49 * the <code>getName()</code> method of which must
50 * return number of calls to <code>XJob.execute</code>
51 * method which is registered for event 'TestEvent'
54 * @see com.sun.star.frame.XJobExecutor
56 public class _XJobExecutor
extends MultiMethodTest
{
57 public static XJobExecutor oObj
= null;
60 * Gets the number of Job calls before and after triggering event.
62 * Has <b>OK</b> status if the Job was called on triggering
65 public void _trigger() {
66 XNamed counter
= (XNamed
) tEnv
.getObjRelation("CallCounter");
68 int before
= Integer
.parseInt(counter
.getName());
70 oObj
.trigger("TestEvent");
74 } catch (InterruptedException ex
) {}
76 int after
= Integer
.parseInt(counter
.getName());
78 log
.println("Calls before: " + before
+ ", after: " + after
);
80 tRes
.tested("trigger()", after
== before
+ 1);