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 package ifc.sdb; 24 25 import com.sun.star.sdb.XCompletedExecution; 26 import com.sun.star.task.XInteractionHandler; 27 import java.io.PrintWriter; 28 import lib.MultiMethodTest; 29 import lib.StatusException; 30 31 /** 32 * 33 */ 34 public class _XCompletedExecution extends MultiMethodTest { 35 36 // oObj filled by MultiMethodTest 37 public XCompletedExecution oObj = null ; 38 39 private CheckInteractionHandler checkHandler = null; 40 /** 41 * Interface to implement so the call of the listener can be checked. 42 */ 43 public static interface CheckInteractionHandler extends XInteractionHandler { 44 /** 45 * Set a log of the listener, so messages of the listener get printed 46 * into the file of the interface 47 */ setLog(PrintWriter log)48 public void setLog(PrintWriter log); 49 /** 50 * Return True, when the listener was called correctly. 51 */ checkInteractionHandler()52 public boolean checkInteractionHandler(); 53 } 54 before()55 protected void before() { 56 checkHandler = (CheckInteractionHandler) 57 tEnv.getObjRelation("InteractionHandlerChecker"); 58 if (checkHandler == null) 59 throw new StatusException("Missing object relation 'InteractionHandlerChecker'", new Exception()); 60 checkHandler.setLog((PrintWriter)log); 61 } 62 63 _executeWithCompletion()64 public void _executeWithCompletion() { 65 try { 66 oObj.executeWithCompletion(checkHandler); 67 } 68 catch(com.sun.star.sdbc.SQLException e) { 69 e.printStackTrace((PrintWriter)log); 70 tRes.tested("executeWithCompletion()", false); 71 return; 72 } 73 74 tRes.tested("executeWithCompletion()", checkHandler.checkInteractionHandler()); 75 } 76 after()77 protected void after() { 78 disposeEnvironment(); 79 } 80 } 81