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 24 package mod._scripting; 25 26 import com.sun.star.lang.XMultiServiceFactory; 27 import com.sun.star.beans.XPropertySet; 28 import com.sun.star.uno.XInterface; 29 import com.sun.star.uno.UnoRuntime; 30 import com.sun.star.uno.XComponentContext; 31 import java.io.PrintWriter; 32 import lib.StatusException; 33 import lib.TestCase; 34 import lib.TestEnvironment; 35 import lib.TestParameters; 36 import util.utils; 37 38 public class ScriptStorageManager extends TestCase { 39 initialize( TestParameters tParam, PrintWriter log )40 public void initialize( TestParameters tParam, PrintWriter log ) { 41 } 42 createTestEnvironment( TestParameters Param, PrintWriter log )43 public synchronized TestEnvironment createTestEnvironment( 44 TestParameters Param, PrintWriter log ) throws StatusException { 45 46 XInterface oObj = null; 47 Object oInterface = null; 48 49 try { 50 XMultiServiceFactory xMSF = Param.getMSF(); 51 XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface( 52 XPropertySet.class, xMSF); 53 // get context 54 XComponentContext xContext = (XComponentContext) 55 UnoRuntime.queryInterface(XComponentContext.class, 56 xProp.getPropertyValue("DefaultContext")); 57 // get the script storage manager from context 58 oInterface = xContext.getValueByName("/singletons/" + 59 "drafts.com.sun.star.script.framework.storage.theScriptStorageManager"); 60 } 61 catch( Exception e ) { 62 log.println("ScriptStorageManager singleton service not available" ); 63 e.printStackTrace(); 64 } 65 oObj = (XInterface) oInterface; 66 67 TestEnvironment tEnv = new TestEnvironment(oObj) ; 68 TestDataLoader.setupData(tEnv, "ScriptStorageManager"); 69 70 return tEnv ; 71 } 72 disposeTestEnvironment( TestEnvironment tEnv, TestParameters tParam)73 public synchronized void disposeTestEnvironment( TestEnvironment tEnv, 74 TestParameters tParam) { 75 } 76 } 77 78 79