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 .
20 import com
.sun
.star
.form
.XDatabaseParameterBroadcaster
;
21 import com
.sun
.star
.form
.XDatabaseParameterListener
;
22 import com
.sun
.star
.sdbc
.XRowSet
;
23 import com
.sun
.star
.uno
.UnoRuntime
;
24 import java
.io
.PrintWriter
;
25 import lib
.MultiMethodTest
;
30 public class _XDatabaseParameterBroadcaster
extends MultiMethodTest
{
32 // oObj filled by MultiMethodTest
33 public XDatabaseParameterBroadcaster oObj
= null ;
34 private CheckParameterListener listenerChecker
= null;
37 * Interface to implement so the call of the listener can be checked.
39 public interface CheckParameterListener
extends XDatabaseParameterListener
{
41 * Set a log of the listener, so messages of the listener get printed
42 * into the file of the interface
44 void setLog(PrintWriter log
);
46 * Return True, when the listener was called correctly.
48 boolean checkListener();
52 * Get the object relation 'ParameterListenerChecker' and
53 * set the log inside of the implementation.
56 protected void before() {
57 listenerChecker
= (CheckParameterListener
)
58 tEnv
.getObjRelation("ParameterListenerChecker");
59 listenerChecker
.setLog(log
);
64 public void _addParameterListener() {
65 oObj
.addParameterListener(listenerChecker
);
66 tRes
.tested("addParameterListener()", true);
71 public void _removeParameterListener() {
72 requiredMethod("addParameterListener()");
74 // trigger the action.
76 XRowSet xRowSet
= UnoRuntime
.queryInterface(XRowSet
.class, oObj
);
79 catch(com
.sun
.star
.sdbc
.SQLException e
) {
80 log
.println("Exception in XDatabaseParameterBroadcaster test.");
81 log
.println("This does not let the test fail, but should be inquired.");
82 e
.printStackTrace(log
);
84 // was the listener called?
85 oObj
.removeParameterListener(listenerChecker
);
86 tRes
.tested("removeParameterListener()", listenerChecker
.checkListener());
90 protected void after() {