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 28 package mod._fwl; 29 30 import java.io.PrintWriter; 31 32 import lib.Status; 33 import lib.StatusException; 34 import lib.TestCase; 35 import lib.TestEnvironment; 36 import lib.TestParameters; 37 import util.utils; 38 39 import com.sun.star.lang.XMultiServiceFactory; 40 import com.sun.star.uno.XInterface; 41 42 /** 43 * Test for object which is represented by service 44 * <code>com.sun.star.frame.FrameLoaderFactory</code>. <p> 45 * 46 * Object implements the following interfaces : 47 * <ul> 48 * <li> <code>com::sun::star::container::XNameAccess</code></li> 49 * <li> <code>com::sun::star::container::XElementAccess</code></li> 50 * <li> <code>com::sun::star::lang::XMultiServiceFactory</code></li> 51 * </ul> <p> 52 * 53 * @see com::sun::star::util::XStringSubstitution 54 * @see ifc.util._XStringSubstitution 55 */ 56 public class SubstituteVariables extends TestCase { 57 58 /** 59 * Creating a Testenvironment for the interfaces to be tested. 60 * Creates an instance of the service 61 * <code>com.sun.star.util.PathSubstitution</code>. <p> 62 */ 63 protected TestEnvironment createTestEnvironment 64 (TestParameters Param, PrintWriter log) { 65 XInterface oObj = null; 66 Object oInterface = null ; 67 68 //now get the OButtonControl 69 try { 70 oInterface = ((XMultiServiceFactory)Param.getMSF()).createInstance 71 ("com.sun.star.util.PathSubstitution") ; 72 } catch (com.sun.star.uno.Exception e) { 73 log.println("Couldn't get service"); 74 e.printStackTrace(log); 75 throw new StatusException("Couldn't get SubstituteVariables", e ); 76 } 77 78 if (oInterface == null) { 79 log.println("Service wasn't created") ; 80 throw new StatusException(Status.failed("Service wasn't created")) ; 81 } 82 83 oObj = (XInterface) oInterface ; 84 log.println("ImplName: "+utils.getImplName(oObj)); 85 86 log.println( "creating a new environment for object" ); 87 TestEnvironment tEnv = new TestEnvironment( oObj ); 88 89 90 return tEnv; 91 } // finish method getTestEnvironment 92 93 } 94 95