summaryrefslogtreecommitdiff
path: root/scripting/workben/mod
diff options
context:
space:
mode:
Diffstat (limited to 'scripting/workben/mod')
-rw-r--r--scripting/workben/mod/_scripting/Dispatch.java108
-rw-r--r--scripting/workben/mod/_scripting/Function.java95
-rw-r--r--scripting/workben/mod/_scripting/FunctionProvider.java82
-rw-r--r--scripting/workben/mod/_scripting/ScriptInfo.java108
-rw-r--r--scripting/workben/mod/_scripting/ScriptRuntimeManager.java65
-rw-r--r--scripting/workben/mod/_scripting/ScriptStorage.java103
-rw-r--r--scripting/workben/mod/_scripting/ScriptStorageManager.java82
-rw-r--r--scripting/workben/mod/_scripting/TestDataLoader.java123
-rw-r--r--scripting/workben/mod/_scripting/makefile.mk40
9 files changed, 806 insertions, 0 deletions
diff --git a/scripting/workben/mod/_scripting/Dispatch.java b/scripting/workben/mod/_scripting/Dispatch.java
new file mode 100644
index 000000000000..21a54fec77d1
--- /dev/null
+++ b/scripting/workben/mod/_scripting/Dispatch.java
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._scripting;
+
+import java.net.URLEncoder;
+import java.io.PrintWriter;
+
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+import util.utils;
+import util.SOfficeFactory;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.lang.XComponent;
+
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XFrame;
+import com.sun.star.frame.XDesktop;
+
+
+import com.sun.star.util.URL;
+import com.sun.star.util.XURLTransformer;
+
+
+
+public class Dispatch extends TestCase {
+ //private String scriptURL = "script://MemoryUtils.MemUsage";
+ private String scriptURL = "script://HighlightText.showForm";
+ public void initialize( TestParameters tParam, PrintWriter log ) {
+ }
+
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log ) throws StatusException {
+ log.println("creating test environment");
+ XInterface oObj = null;
+ URL dispatchURL = null;
+ try {
+
+ XMultiServiceFactory xMSF = tParam.getMSF();
+ SOfficeFactory SOF = null;
+ SOF = SOfficeFactory.getFactory( xMSF );
+ String docPath = util.utils.getFullTestURL( "ExampleSpreadSheetLatest.sxc" );
+ XComponent doc = SOF.loadDocument( docPath );
+ XModel model = ( XModel ) UnoRuntime.queryInterface( XModel.class,
+ doc );
+ XFrame frame = model.getCurrentController().getFrame();
+ oObj = ( XInterface )xMSF.createInstanceWithArguments( "com.sun.star.comp.ScriptProtocolHandler", new Object[] { frame } );
+
+ XURLTransformer xParser=(XURLTransformer)
+ UnoRuntime.queryInterface(XURLTransformer.class,
+ tParam.getMSF().createInstance
+ ("com.sun.star.util.URLTransformer"));
+ // Because it's an in/out parameter we must use an array of
+ // URL objects.
+ URL[] aParseURL = new URL[1];
+ aParseURL[0] = new URL();
+ aParseURL[0].Complete = scriptURL;
+ xParser.parseStrict(aParseURL);
+ dispatchURL = aParseURL[0];
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ throw new StatusException("Can't create object environment", e) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+ tEnv.addObjRelation( "XDispatchProvider.URL", scriptURL );
+ tEnv.addObjRelation( "XDispatch.URL", dispatchURL );
+ return tEnv ;
+ }
+
+ public synchronized void disposeTestEnvironment( TestEnvironment tEnv,
+ TestParameters tParam) {
+ }
+}
+
+
diff --git a/scripting/workben/mod/_scripting/Function.java b/scripting/workben/mod/_scripting/Function.java
new file mode 100644
index 000000000000..7dc73cbd7140
--- /dev/null
+++ b/scripting/workben/mod/_scripting/Function.java
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._scripting;
+
+import com.sun.star.uno.XInterface;
+import java.io.PrintWriter;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.utils;
+import java.net.URLEncoder;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XFrame;
+import com.sun.star.lang.XComponent;
+import com.sun.star.frame.XDesktop;
+
+import util.SOfficeFactory;
+
+import drafts.com.sun.star.script.framework.provider.XFunction;
+import drafts.com.sun.star.script.framework.provider.XFunctionProvider;
+
+public class Function extends TestCase {
+ private String script = "script://returns-Integer";
+ private String doc = "doc_with_beanshell_scripts.sxw";
+
+ public void initialize( TestParameters tParam, PrintWriter log ) {
+ }
+
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log ) throws StatusException {
+ XInterface oObj = null;
+ XFunctionProvider provider = null;
+
+ log.println("creating test environment");
+ try {
+
+ XMultiServiceFactory xMSF = tParam.getMSF();
+ SOfficeFactory SOF = null;
+ SOF = SOfficeFactory.getFactory( xMSF );
+ String docPath = util.utils.getFullTestURL(doc);
+ XComponent doc = SOF.loadDocument( docPath );
+ XModel model = ( XModel ) UnoRuntime.queryInterface( XModel.class,
+ doc );
+ oObj =
+ (XInterface)xMSF.createInstanceWithArguments( "drafts.com.sun.star.script.framework.provider.FunctionProvider", new Object[]{ model } );
+ provider = ( XFunctionProvider )UnoRuntime.queryInterface( XFunctionProvider.class, oObj );
+ oObj = provider.getFunction( script );
+
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ throw new StatusException("Can't create object environment", e) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+ tEnv.addObjRelation("provider", provider);
+ TestDataLoader.setupData(tEnv, "Function");
+
+ return tEnv ;
+ }
+
+ public synchronized void disposeTestEnvironment( TestEnvironment tEnv,
+ TestParameters tParam) {
+ }
+}
+
+
diff --git a/scripting/workben/mod/_scripting/FunctionProvider.java b/scripting/workben/mod/_scripting/FunctionProvider.java
new file mode 100644
index 000000000000..f9ec85212c83
--- /dev/null
+++ b/scripting/workben/mod/_scripting/FunctionProvider.java
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._scripting;
+
+import com.sun.star.uno.XInterface;
+import java.io.PrintWriter;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.utils;
+import java.net.URLEncoder;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+
+import com.sun.star.frame.XModel;
+import com.sun.star.frame.XDesktop;
+
+public class FunctionProvider extends TestCase {
+
+ String docPath = null;
+ public void initialize( TestParameters tParam, PrintWriter log ) {
+ }
+
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log ) throws StatusException {
+ XInterface oObj = null;
+ log.println("creating test environment");
+ try {
+
+ XMultiServiceFactory xMSF = tParam.getMSF();
+
+ Object xInterface = xMSF.createInstance( "com.sun.star.frame.Desktop" );
+ XDesktop dtop = ( XDesktop )UnoRuntime.queryInterface( XDesktop.class,
+ xInterface );
+
+ XModel model = dtop.getCurrentFrame().getController().getModel();
+ oObj =
+ (XInterface)xMSF.createInstanceWithArguments( "drafts.com.sun.star.script.framework.provider.FunctionProvider", new Object[]{ model } );
+
+
+ } catch (com.sun.star.uno.Exception e) {
+ throw new StatusException("Can't create object environment", e) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+ TestDataLoader.setupData(tEnv, "FunctionProvider");
+
+ return tEnv ;
+ }
+
+ public synchronized void disposeTestEnvironment( TestEnvironment tEnv,
+ TestParameters tParam) {
+ }
+}
+
+
diff --git a/scripting/workben/mod/_scripting/ScriptInfo.java b/scripting/workben/mod/_scripting/ScriptInfo.java
new file mode 100644
index 000000000000..8e6e2a332f20
--- /dev/null
+++ b/scripting/workben/mod/_scripting/ScriptInfo.java
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._scripting;
+
+import com.sun.star.uno.XInterface;
+import java.io.PrintWriter;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.utils;
+import java.net.URLEncoder;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.ucb.XSimpleFileAccess;
+import com.sun.star.uno.UnoRuntime;
+
+import drafts.com.sun.star.script.framework.storage.XScriptInfoAccess;
+import drafts.com.sun.star.script.framework.storage.XScriptInfo;
+
+public class ScriptInfo extends TestCase {
+
+ String docPath = null;
+ public void initialize( TestParameters tParam, PrintWriter log ) {
+ // Get path to test documents
+ String rootDocPath = ( String )tParam.get( "DOCPTH" );
+ System.out.println( "DOCPTH is " + rootDocPath );
+ rootDocPath = util.utils.getFullTestURL( "ExampleSpreadSheetLatest.sxc" );
+ if ( rootDocPath != null && rootDocPath.length() > 1 ){
+ // convert all "\\" to "/", necessary for UCB
+ if ( rootDocPath.indexOf( "\\" ) > 0 ){
+ rootDocPath = rootDocPath.replace( '\\','/' );
+ }
+ System.out.println("After processing the path is " + rootDocPath);
+ // encode the ulr (for UCB)
+ String encodedPath = URLEncoder.encode( rootDocPath );
+ System.out.println("The encoded path is " + encodedPath );
+ docPath = "vnd.sun.star.pkg://" + encodedPath;
+ System.out.println( "docPath path is " + docPath );
+ }
+
+ }
+
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log ) throws StatusException {
+
+ log.println("creating test environment");
+ if ( docPath == null ){
+ log.println("Testdata not set up, docPath is null");
+ throw new StatusException(
+ "Can't create object environment, no test document available",
+ new Exception() ) ;
+ }
+
+ XInterface oObj = null;
+ XSimpleFileAccess access = null;
+ try {
+ XMultiServiceFactory xMSF = tParam.getMSF();
+ Object xInterface =
+ xMSF.createInstance( "com.sun.star.ucb.SimpleFileAccess" );
+ access = ( XSimpleFileAccess )
+ UnoRuntime.queryInterface( XSimpleFileAccess.class, xInterface );
+ Object storageObj = ( XInterface )xMSF.createInstanceWithArguments(
+ "drafts.com.sun.star.script.framework.storage.ScriptStorage",
+ new Object[]{ access, new Integer(99), docPath } );
+ XScriptInfoAccess infoAccess = ( XScriptInfoAccess )UnoRuntime.queryInterface(XScriptInfoAccess.class, storageObj);
+ XScriptInfo[] infos = infoAccess.getImplementations("script://MemoryUtils.MemUsage?location=document");
+ oObj = infos[0];
+ } catch (com.sun.star.uno.Exception e) {
+ throw new StatusException("Can't create object environment", e) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+ TestDataLoader.setupData(tEnv, "ScriptInfo");
+
+ return tEnv ;
+ }
+
+ public synchronized void disposeTestEnvironment( TestEnvironment tEnv,
+ TestParameters tParam) {
+ }
+}
+
+
diff --git a/scripting/workben/mod/_scripting/ScriptRuntimeManager.java b/scripting/workben/mod/_scripting/ScriptRuntimeManager.java
new file mode 100644
index 000000000000..28cd4d4843d9
--- /dev/null
+++ b/scripting/workben/mod/_scripting/ScriptRuntimeManager.java
@@ -0,0 +1,65 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._scripting;
+
+import com.sun.star.uno.XInterface;
+import java.io.PrintWriter;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+
+public class ScriptRuntimeManager extends TestCase {
+
+ public void initialize( TestParameters tParam, PrintWriter log ) {
+ }
+
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log ) throws StatusException {
+
+ log.println("creating test environment");
+
+ XInterface oObj = null;
+
+ try {
+ oObj = (XInterface) Param.getMSF().createInstance
+ ("drafts.com.sun.star.script.framework.runtime.ScriptRuntimeManager");
+ } catch (com.sun.star.uno.Exception e) {
+ throw new StatusException("Can't create object environment", e) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+ TestDataLoader.setupData(tEnv, "ScriptRuntimeManager");
+
+ return tEnv ;
+ }
+
+ public synchronized void disposeTestEnvironment( TestEnvironment tEnv,
+ TestParameters tParam) {
+ }
+}
diff --git a/scripting/workben/mod/_scripting/ScriptStorage.java b/scripting/workben/mod/_scripting/ScriptStorage.java
new file mode 100644
index 000000000000..556eb74e8421
--- /dev/null
+++ b/scripting/workben/mod/_scripting/ScriptStorage.java
@@ -0,0 +1,103 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._scripting;
+
+import com.sun.star.uno.XInterface;
+import java.io.PrintWriter;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.utils;
+import java.net.URLEncoder;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.ucb.XSimpleFileAccess;
+import com.sun.star.uno.UnoRuntime;
+
+public class ScriptStorage extends TestCase {
+
+ String docPath = null;
+ public void initialize( TestParameters tParam, PrintWriter log ) {
+ // Get path to test documents
+ String rootDocPath = ( String )tParam.get( "DOCPTH" );
+ System.out.println( "DOCPTH is " + rootDocPath );
+ rootDocPath = util.utils.getFullTestURL( "ExampleSpreadSheetLatest.sxc" );
+ if ( rootDocPath != null && rootDocPath.length() > 1 ){
+ // convert all "\\" to "/", necessary for UCB
+ if ( rootDocPath.indexOf( "\\" ) > 0 ){
+ rootDocPath = rootDocPath.replace( '\\','/' );
+ }
+ System.out.println("After processing the path is " + rootDocPath);
+ // encode the ulr (for UCB)
+ String encodedPath = URLEncoder.encode( rootDocPath );
+ System.out.println("The encoded path is " + encodedPath );
+ docPath = "vnd.sun.star.pkg://" + encodedPath;
+ System.out.println( "docPath path is " + docPath );
+ }
+
+ }
+
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters tParam, PrintWriter log ) throws StatusException {
+
+ log.println("creating test environment");
+ if ( docPath == null ){
+ log.println("Testdata not set up, docPath is null");
+ throw new StatusException(
+ "Can't create object environment, no test document available",
+ new Exception() ) ;
+ }
+
+ XInterface oObj = null;
+ XSimpleFileAccess access = null;
+ try {
+ XMultiServiceFactory xMSF = tParam.getMSF();
+ Object xInterface =
+ xMSF.createInstance( "com.sun.star.ucb.SimpleFileAccess" );
+ access = ( XSimpleFileAccess )
+ UnoRuntime.queryInterface( XSimpleFileAccess.class, xInterface );
+ oObj = ( XInterface )xMSF.createInstanceWithArguments(
+ "drafts.com.sun.star.script.framework.storage.ScriptStorage",
+ new Object[]{ access, new Integer(99), docPath } );
+
+ } catch (com.sun.star.uno.Exception e) {
+ throw new StatusException("Can't create object environment", e) ;
+ }
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+ TestDataLoader.setupData(tEnv, "ScriptStorage");
+
+ return tEnv ;
+ }
+
+ public synchronized void disposeTestEnvironment( TestEnvironment tEnv,
+ TestParameters tParam) {
+ }
+}
+
+
diff --git a/scripting/workben/mod/_scripting/ScriptStorageManager.java b/scripting/workben/mod/_scripting/ScriptStorageManager.java
new file mode 100644
index 000000000000..f0f863b7131e
--- /dev/null
+++ b/scripting/workben/mod/_scripting/ScriptStorageManager.java
@@ -0,0 +1,82 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._scripting;
+
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.beans.XPropertySet;
+import com.sun.star.uno.XInterface;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.uno.XComponentContext;
+import java.io.PrintWriter;
+import lib.StatusException;
+import lib.TestCase;
+import lib.TestEnvironment;
+import lib.TestParameters;
+import util.utils;
+
+public class ScriptStorageManager extends TestCase {
+
+ public void initialize( TestParameters tParam, PrintWriter log ) {
+ }
+
+ public synchronized TestEnvironment createTestEnvironment(
+ TestParameters Param, PrintWriter log ) throws StatusException {
+
+ XInterface oObj = null;
+ Object oInterface = null;
+
+ try {
+ XMultiServiceFactory xMSF = Param.getMSF();
+ XPropertySet xProp = (XPropertySet)UnoRuntime.queryInterface(
+ XPropertySet.class, xMSF);
+ // get context
+ XComponentContext xContext = (XComponentContext)
+ UnoRuntime.queryInterface(XComponentContext.class,
+ xProp.getPropertyValue("DefaultContext"));
+ // get the script storage manager from context
+ oInterface = xContext.getValueByName("/singletons/" +
+ "drafts.com.sun.star.script.framework.storage.theScriptStorageManager");
+ }
+ catch( Exception e ) {
+ log.println("ScriptStorageManager singleton service not available" );
+ e.printStackTrace();
+ }
+ oObj = (XInterface) oInterface;
+
+ TestEnvironment tEnv = new TestEnvironment(oObj) ;
+ TestDataLoader.setupData(tEnv, "ScriptStorageManager");
+
+ return tEnv ;
+ }
+
+ public synchronized void disposeTestEnvironment( TestEnvironment tEnv,
+ TestParameters tParam) {
+ }
+}
+
+
diff --git a/scripting/workben/mod/_scripting/TestDataLoader.java b/scripting/workben/mod/_scripting/TestDataLoader.java
new file mode 100644
index 000000000000..f5e947a54773
--- /dev/null
+++ b/scripting/workben/mod/_scripting/TestDataLoader.java
@@ -0,0 +1,123 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2000, 2010 Oracle and/or its affiliates.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+package mod._scripting;
+
+import java.io.File;
+import java.io.FileReader;
+import java.io.BufferedReader;
+import java.io.IOException;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.StringTokenizer;
+
+import lib.TestEnvironment;
+import lib.Parameters;
+
+public class TestDataLoader {
+
+ private TestDataLoader() {
+ }
+
+ public static void setupData(TestEnvironment tEnv, String name) {
+ String filename =
+ util.utils.getFullTestDocName("testdata");
+ File testdatadir = new File(filename);
+ File f = new File(testdatadir, name + ".csv");
+
+ if (!f.exists())
+ return;
+
+ BufferedReader in;
+
+ try {
+ in = new BufferedReader(new FileReader(f));
+
+ String s, previous, current;
+ ArrayList list = new ArrayList(11);
+
+ if ((s = in.readLine()) != null) {
+ StringTokenizer st = new StringTokenizer(s, ";");
+
+ current = previous = st.nextToken();
+ list.add(getParameters(st));
+ }
+ else {
+ return;
+ }
+
+ while ((s = in.readLine()) != null) {
+ StringTokenizer st = new StringTokenizer(s, ";");
+
+ current = st.nextToken();
+
+ if (!current.equals(previous)) {
+ tEnv.addObjRelation(previous, list);
+ previous = current;
+ list = new ArrayList(11);
+ }
+
+ list.add(getParameters(st));
+ }
+
+ tEnv.addObjRelation(previous, list);
+ }
+ catch (IOException ioe) {
+ }
+ }
+
+ private static Parameters getParameters(StringTokenizer st) {
+ String separator = "=";
+ HashMap map = new HashMap(5);
+
+ while (st.hasMoreTokens()) {
+ String pair = st.nextToken();
+ StringTokenizer tokens = new StringTokenizer(pair, separator);
+
+ String name;
+ String value;
+
+ if (tokens.countTokens() < 2)
+ continue;
+
+ name = tokens.nextToken();
+ if (tokens.countTokens() == 1)
+ value = tokens.nextToken();
+ else {
+ StringBuffer buf = new StringBuffer(tokens.nextToken());
+ while (tokens.hasMoreTokens())
+ buf.append(separator).append(tokens.nextToken());
+ value = buf.toString();
+ }
+
+ map.put(name, value);
+ }
+
+ return new Parameters(map);
+ }
+}
diff --git a/scripting/workben/mod/_scripting/makefile.mk b/scripting/workben/mod/_scripting/makefile.mk
new file mode 100644
index 000000000000..9d9e05d6010b
--- /dev/null
+++ b/scripting/workben/mod/_scripting/makefile.mk
@@ -0,0 +1,40 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2010 Oracle and/or its affiliates.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ = ..$/..$/..$/..
+PRJNAME = testcase
+TARGET = testcase
+
+# --- Settings -----------------------------------------------------
+.INCLUDE: settings.mk
+
+JARFILES = ridl.jar unoil.jar jurt.jar juh.jar $(CLASSPATH)
+JAVAFILES = $(foreach,j,$(shell @ls | grep java) $j)
+
+# --- Targets ------------------------------------------------------
+
+.INCLUDE : target.mk