summaryrefslogtreecommitdiff
path: root/qadevOOo/tests/java/ifc/configuration/backend
diff options
context:
space:
mode:
Diffstat (limited to 'qadevOOo/tests/java/ifc/configuration/backend')
-rw-r--r--qadevOOo/tests/java/ifc/configuration/backend/_XBackend.java265
-rw-r--r--qadevOOo/tests/java/ifc/configuration/backend/_XBackendEntities.java181
-rw-r--r--qadevOOo/tests/java/ifc/configuration/backend/_XLayer.java90
-rw-r--r--qadevOOo/tests/java/ifc/configuration/backend/_XLayerHandler.java266
-rw-r--r--qadevOOo/tests/java/ifc/configuration/backend/_XLayerImporter.java166
-rw-r--r--qadevOOo/tests/java/ifc/configuration/backend/_XMultiLayerStratum.java316
-rw-r--r--qadevOOo/tests/java/ifc/configuration/backend/_XSchema.java263
-rw-r--r--qadevOOo/tests/java/ifc/configuration/backend/_XSchemaSupplier.java118
-rw-r--r--qadevOOo/tests/java/ifc/configuration/backend/_XSingleLayerStratum.java152
-rw-r--r--qadevOOo/tests/java/ifc/configuration/backend/_XUpdateHandler.java260
10 files changed, 2077 insertions, 0 deletions
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XBackend.java b/qadevOOo/tests/java/ifc/configuration/backend/_XBackend.java
new file mode 100644
index 000000000000..68d113ebb8b4
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XBackend.java
@@ -0,0 +1,265 @@
+/*************************************************************************
+ *
+ * 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 ifc.configuration.backend;
+
+import com.sun.star.configuration.backend.XBackend;
+import com.sun.star.configuration.backend.XLayer;
+import com.sun.star.configuration.backend.XUpdateHandler;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.uno.UnoRuntime;
+import com.sun.star.util.XStringSubstitution;
+
+import lib.MultiMethodTest;
+
+import util.XLayerHandlerImpl;
+
+
+public class _XBackend extends MultiMethodTest {
+ public XBackend oObj;
+
+ public void _getOwnUpdateHandler() {
+ boolean res = true;
+
+ String noUpdate = (String) tEnv.getObjRelation("noUpdate");
+
+ if (noUpdate != null) {
+ log.println(noUpdate);
+ tRes.tested("getOwnUpdateHandler()", res);
+
+ return;
+ }
+
+ try {
+ XUpdateHandler aHandler = oObj.getOwnUpdateHandler(
+ "org.openoffice.Office.Linguistic");
+ res &= (aHandler != null);
+
+ if (aHandler == null) {
+ log.println("\treturned Layer is NULL -- FAILED");
+ }
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.NoSupportException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("getOwnUpdateHandler()", res);
+ }
+
+ public void _getUpdateHandler() {
+ boolean res = true;
+
+ String noUpdate = (String) tEnv.getObjRelation("noUpdate");
+
+ if (noUpdate != null) {
+ log.println(noUpdate);
+ tRes.tested("getUpdateHandler()", res);
+
+ return;
+ }
+
+ try {
+ XUpdateHandler aHandler = oObj.getUpdateHandler(
+ "org.openoffice.Office.TypeDetection",
+ "illegal");
+ log.println("Exception expected -- FAILED");
+ res = false;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("expected Exception -- OK");
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.NoSupportException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ }
+
+ try {
+ XStringSubstitution sts = createStringSubstitution(
+ (XMultiServiceFactory) tParam.getMSF());
+ String ent = sts.getSubstituteVariableValue("$(inst)") +
+ "/share/registry";
+ XUpdateHandler aHandler = oObj.getUpdateHandler(
+ "org.openoffice.Office.Jobs",
+ ent);
+
+ if (aHandler == null) {
+ log.println("\treturned Layer is NULL -- FAILED");
+ }
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.NoSupportException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("getUpdateHandler()", res);
+ }
+
+ public void _listLayers() {
+ boolean res = true;
+
+ try {
+ XStringSubstitution sts = createStringSubstitution(
+ (XMultiServiceFactory) tParam.getMSF());
+ String ent = sts.getSubstituteVariableValue("$(inst)") +
+ "/share/registry";
+ XLayer[] Layers = oObj.listLayers(
+ "org.openoffice.Office.Linguistic", ent);
+
+ for (int i = 0; i < Layers.length; i++) {
+ log.println("Checking Layer " + i);
+ res &= checkLayer(Layers[i]);
+ }
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ } catch (com.sun.star.container.NoSuchElementException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("listLayers()", res);
+ }
+
+ public void _listOwnLayers() {
+ boolean res = true;
+
+ try {
+ XLayer[] Layers = oObj.listOwnLayers(
+ "org.openoffice.Office.Common");
+
+ for (int i = 0; i < Layers.length; i++) {
+ log.println("Checking Layer " + i);
+ res &= checkLayer(Layers[i]);
+ }
+ if (Layers.length==0) {
+ System.out.println("No Layers found -- FAILED");
+ res &= false;
+ }
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("listOwnLayers()", res);
+ }
+
+ protected boolean checkLayer(XLayer aLayer) {
+ boolean res = false;
+
+ log.println("Checking for Exception in case of null argument");
+
+ try {
+ aLayer.readData(null);
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Expected Exception -- OK");
+ res = true;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ }
+
+ log.println("checking read data with own XLayerHandler implementation");
+
+ try {
+ XLayerHandlerImpl xLayerHandler = new XLayerHandlerImpl();
+ aLayer.readData(xLayerHandler);
+
+ String implCalled = xLayerHandler.getCalls();
+ log.println(implCalled);
+
+ int sl = implCalled.indexOf("startLayer");
+
+ if (sl < 0) {
+ log.println("startLayer wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("startLayer was called -- OK");
+ res &= true;
+ }
+
+ int el = implCalled.indexOf("endLayer");
+
+ if (el < 0) {
+ log.println("endLayer wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("endLayer was called -- OK");
+ res &= true;
+ }
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ }
+
+ return res;
+ }
+
+ public static XStringSubstitution createStringSubstitution(XMultiServiceFactory xMSF) {
+ Object xPathSubst = null;
+
+ try {
+ xPathSubst = xMSF.createInstance(
+ "com.sun.star.util.PathSubstitution");
+ } catch (com.sun.star.uno.Exception e) {
+ e.printStackTrace();
+ }
+
+ if (xPathSubst != null) {
+ return (XStringSubstitution) UnoRuntime.queryInterface(
+ XStringSubstitution.class, xPathSubst);
+ } else {
+ return null;
+ }
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XBackendEntities.java b/qadevOOo/tests/java/ifc/configuration/backend/_XBackendEntities.java
new file mode 100644
index 000000000000..6a36c889985f
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XBackendEntities.java
@@ -0,0 +1,181 @@
+/*************************************************************************
+ *
+ * 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 ifc.configuration.backend;
+
+import com.sun.star.configuration.backend.XBackendEntities;
+
+import lib.MultiMethodTest;
+
+
+public class _XBackendEntities extends MultiMethodTest {
+ String AdminEntity = "";
+ String OwnerEntity = "";
+ String adm = "";
+ public XBackendEntities oObj;
+
+ public void before() {
+ adm = (String) tEnv.getObjRelation("NoAdmin");
+ }
+
+ public void _getAdminEntity() {
+ if (adm != null) {
+ AdminEntity = adm;
+ log.println(
+ "This component doesn't have an AdminEntity, setting it to default");
+ tRes.tested("getAdminEntity()", true);
+
+ return;
+ }
+
+ AdminEntity = oObj.getAdminEntity();
+
+ boolean res = AdminEntity.endsWith("/share/registry");
+
+ if (!res) {
+ log.println("Expected the Entity to end with /share/registry");
+ log.println("getting: " + AdminEntity + " -- FAILED");
+ }
+
+ tRes.tested("getAdminEntity()", res);
+ }
+
+ public void _getOwnerEntity() {
+ OwnerEntity = oObj.getOwnerEntity();
+
+ boolean res = OwnerEntity.endsWith("/user/registry");
+
+ if (!res) {
+ log.println("Expected the Entity to end with /user/registry");
+ log.println("getting: " + OwnerEntity + " -- FAILED");
+ }
+
+ tRes.tested("getOwnerEntity()", res);
+ }
+
+ public void _isEqualEntity() {
+ boolean res = true;
+ boolean localRes = true;
+
+ try {
+ localRes = oObj.isEqualEntity("", "");
+ log.println(
+ "No Exception thrown for isEqualEntity(\"\",\"\") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Expected Exception (" + e + ") -- OK");
+ res &= true;
+ }
+
+ try {
+ localRes = oObj.isEqualEntity(AdminEntity, AdminEntity);
+
+ if (!localRes) {
+ log.println(
+ "isEqualEntity(AdminEntity,AdminEntity) returns false -- FAILED");
+ }
+
+ res &= localRes;
+
+ localRes = oObj.isEqualEntity(OwnerEntity, OwnerEntity);
+
+ if (!localRes) {
+ log.println(
+ "isEqualEntity(OwnerEntity,OwnerEntity) returns false -- FAILED");
+ }
+
+ res &= localRes;
+
+ localRes = !oObj.isEqualEntity(AdminEntity, OwnerEntity);
+
+ if (!localRes) {
+ log.println(
+ "isEqualEntity(AdminEntity,OwnerEntity) returns true -- FAILED");
+ }
+
+ res &= localRes;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ }
+
+ tRes.tested("isEqualEntity()", res);
+ }
+
+ public void _supportsEntity() {
+ boolean res = true;
+ boolean localRes = true;
+
+ try {
+ localRes = oObj.supportsEntity("illegal");
+ log.println(
+ "No Exception thrown for supportsEntity(\"\") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("Expected Exception (" + e + ") -- OK");
+ res &= true;
+ }
+
+ try {
+ localRes = oObj.supportsEntity(AdminEntity);
+
+ if (adm != null) {
+ Object msb = tEnv.getObjRelation("MSB") ;
+ if (msb == null){
+ localRes = !localRes;
+ log.println("This Component doesn't support the AdminEntity");
+ }
+ }
+
+ if (!localRes) {
+ log.println(
+ "supportsEntity(AdminEntity) returns false -- FAILED");
+ }
+
+ res &= localRes;
+
+ localRes = oObj.supportsEntity(OwnerEntity);
+
+ if (!localRes) {
+ log.println(
+ "supportsEntity(OwnerEntity) returns false -- FAILED");
+ }
+
+ res &= localRes;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ }
+
+ tRes.tested("supportsEntity()", res);
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XLayer.java b/qadevOOo/tests/java/ifc/configuration/backend/_XLayer.java
new file mode 100644
index 000000000000..784f14b4b5b0
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XLayer.java
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * 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 ifc.configuration.backend;
+
+import com.sun.star.configuration.backend.XLayer;
+import lib.MultiMethodTest;
+import util.XLayerHandlerImpl;
+
+public class _XLayer extends MultiMethodTest {
+
+ public XLayer oObj;
+
+ public void _readData() {
+ boolean res = false;
+
+ log.println("Checking for Exception in case of nul argument");
+
+ try {
+ oObj.readData(null);
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Expected Exception -- OK");
+ res = true;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception ("+e+") -- FAILED");
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception ("+e+") -- FAILED");
+ }
+
+ log.println("checking read data with own XLayerHandler implementation");
+ try {
+ XLayerHandlerImpl xLayerHandler = new XLayerHandlerImpl();
+ oObj.readData(xLayerHandler);
+ String implCalled = xLayerHandler.getCalls();
+ log.println(implCalled);
+ int sl = implCalled.indexOf("startLayer");
+ if (sl < 0) {
+ log.println("startLayer wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("startLayer was called -- OK");
+ res &= true;
+ }
+ int el = implCalled.indexOf("endLayer");
+ if (el < 0) {
+ log.println("endLayer wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("endLayer was called -- OK");
+ res &= true;
+ }
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Unexpected Exception ("+e+") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception ("+e+") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception ("+e+") -- FAILED");
+ res &= false;
+ }
+
+ tRes.tested("readData()",res);
+ }
+
+}
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XLayerHandler.java b/qadevOOo/tests/java/ifc/configuration/backend/_XLayerHandler.java
new file mode 100644
index 000000000000..181555180534
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XLayerHandler.java
@@ -0,0 +1,266 @@
+/*************************************************************************
+ *
+ * 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 ifc.configuration.backend;
+
+import com.sun.star.configuration.backend.XLayer;
+import com.sun.star.configuration.backend.XLayerHandler;
+import com.sun.star.io.XActiveDataSink;
+import com.sun.star.io.XInputStream;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.ucb.XSimpleFileAccess;
+import com.sun.star.uno.Type;
+import com.sun.star.uno.UnoRuntime;
+
+import lib.MultiMethodTest;
+
+import util.XLayerHandlerImpl;
+
+
+public class _XLayerHandler extends MultiMethodTest {
+ public XLayerHandler oObj = null;
+
+ /** this method contains the logic for all test methods
+ * the others will be passed OK if this one is
+ */
+ public void _endLayer() {
+ boolean res = false;
+
+ try {
+ oObj.startLayer();
+ oObj.overrideNode("org.openoffice.Setup", (short) 0, false);
+ oObj.overrideNode("Office", (short) 0, false);
+ oObj.overrideProperty("ooSetupInstCompleted", (short) 0,
+ new Type(java.lang.String.class), false);
+ oObj.setPropertyValue(new Boolean(false));
+ oObj.endProperty();
+ oObj.overrideProperty("ooSetupShowIntro", (short) 0,
+ new Type(java.lang.String.class), false);
+ oObj.setPropertyValue(new Boolean(true));
+ oObj.endProperty();
+ oObj.overrideProperty("ooSetupLocales", (short) 0,
+ new Type(java.lang.String.class), false);
+ oObj.setPropertyValue("en-US");
+ oObj.endProperty();
+ oObj.overrideNode("Factories", (short) 0, false);
+ oObj.addOrReplaceNode("com.sun.star.chart.ChartDocument",
+ (short) 0);
+ oObj.overrideProperty("ooSetupFactoryEmptyDocumentURL", (short) 0,
+ new Type(java.lang.String.class), false);
+ oObj.setPropertyValue("private:factory/schart");
+ oObj.endProperty();
+ oObj.overrideProperty("ooSetupFactoryIcon", (short) 0,
+ new Type(java.lang.Long.class), false);
+ oObj.setPropertyValue(new Integer(13));
+ oObj.endProperty();
+ oObj.overrideProperty("ooSetupFactoryShortName", (short) 0,
+ new Type(java.lang.String.class), false);
+ oObj.setPropertyValue("schart");
+ oObj.setPropertyValueForLocale("TemplateFile", "en-US");
+ oObj.endProperty();
+ oObj.overrideProperty("ooSetupFactoryTemplateFile", (short) 0,
+ new Type(java.lang.String.class), false);
+ oObj.setPropertyValue("empty");
+ oObj.endProperty();
+ oObj.addProperty("ooSetupFactoryTemplateFile", (short) 0,
+ new Type(java.lang.String.class));
+ oObj.addPropertyWithValue("ooSetupFactoryTemplateFile", (short) 0,
+ "TemplateFile");
+ oObj.endNode();
+
+ oObj.addOrReplaceNode("dropme", (short) 0);
+ oObj.overrideProperty("anyway", (short) 0,
+ new Type(java.lang.String.class), false);
+ oObj.setPropertyValue("nice");
+ oObj.endProperty();
+ oObj.dropNode("dropme");
+ oObj.endNode();
+
+ oObj.addOrReplaceNodeFromTemplate("FromTemplate",
+ new com.sun.star.configuration.backend.TemplateIdentifier(
+ "org.openoffice.Setup",
+ "Setup"), (short) 0);
+ oObj.endNode();
+
+ oObj.endNode();
+ oObj.endNode();
+ oObj.endNode();
+ oObj.endLayer();
+
+ Object LayerParser = ((XMultiServiceFactory) tParam.getMSF()).createInstance(
+ "com.sun.star.comp.configuration.backend.xml.LayerParser");
+
+ XActiveDataSink xSink = (XActiveDataSink) UnoRuntime.queryInterface(
+ XActiveDataSink.class, LayerParser);
+ Object fileacc = ((XMultiServiceFactory) tParam.getMSF()).createInstance(
+ "com.sun.star.comp.ucb.SimpleFileAccess");
+ XSimpleFileAccess simpleAccess = (XSimpleFileAccess) UnoRuntime.queryInterface(
+ XSimpleFileAccess.class,
+ fileacc);
+
+ String filename = util.utils.getOfficeTemp(
+ (XMultiServiceFactory) tParam.getMSF()) +
+ "LayerWriter.xcu";
+ log.println("Going to parse: " + filename);
+
+ XInputStream xStream = simpleAccess.openFileRead(filename);
+
+ xSink.setInputStream(xStream);
+
+ XLayer xLayer = (XLayer) UnoRuntime.queryInterface(XLayer.class,
+ LayerParser);
+
+ XLayerHandlerImpl xLayerHandler = new XLayerHandlerImpl();
+
+ xLayer.readData(xLayerHandler);
+
+ res = xLayerHandler.getCalls().equals(getExpected());
+
+ if (!res) {
+ log.println("#### Getting: ");
+ log.println(xLayerHandler.getCalls());
+ log.println("#### Expected: ");
+ log.println(getExpected());
+ }
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception " + e);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception " + e);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Unexpected Exception " + e);
+ }
+
+ tRes.tested("endLayer()", res);
+ }
+
+ public void _addOrReplaceNode() {
+ requiredMethod("endLayer()");
+ tRes.tested("addOrReplaceNode()", true);
+ }
+
+ public void _addOrReplaceNodeFromTemplate() {
+ requiredMethod("endLayer()");
+ tRes.tested("addOrReplaceNodeFromTemplate()", true);
+ }
+
+ public void _addProperty() {
+ requiredMethod("endLayer()");
+ tRes.tested("addProperty()", true);
+ }
+
+ public void _addPropertyWithValue() {
+ requiredMethod("endLayer()");
+ tRes.tested("addPropertyWithValue()", true);
+ }
+
+ public void _dropNode() {
+ requiredMethod("endLayer()");
+ tRes.tested("dropNode()", true);
+ }
+
+ public void _endNode() {
+ requiredMethod("endLayer()");
+ tRes.tested("endNode()", true);
+ }
+
+ public void _endProperty() {
+ requiredMethod("endLayer()");
+ tRes.tested("endProperty()", true);
+ }
+
+ public void _overrideNode() {
+ requiredMethod("endLayer()");
+ tRes.tested("overrideNode()", true);
+ }
+
+ public void _overrideProperty() {
+ requiredMethod("endLayer()");
+ tRes.tested("overrideProperty()", true);
+ }
+
+ public void _setPropertyValue() {
+ requiredMethod("endLayer()");
+ tRes.tested("setPropertyValue()", true);
+ }
+
+ public void _setPropertyValueForLocale() {
+ requiredMethod("endLayer()");
+ tRes.tested("setPropertyValueForLocale()", true);
+ }
+
+ public void _startLayer() {
+ requiredMethod("endLayer()");
+ tRes.tested("startLayer()", true);
+ }
+
+ protected String getExpected() {
+ String ls = System.getProperty("line.separator");
+ String expected = "startLayer();" + ls;
+ expected += ("overrideNode(org.openoffice.Setup,0,false);" + ls);
+ expected += ("overrideNode(Office,0,false);" + ls);
+ expected += ("overrideProperty(ooSetupInstCompleted,0,Type[string],false);" + ls);
+ expected += ("setPropertyValue(false);" + ls);
+ expected += ("endProperty();" + ls);
+ expected += ("overrideProperty(ooSetupShowIntro,0,Type[string],false);" + ls);
+ expected += ("setPropertyValue(true);" + ls);
+ expected += ("endProperty();" + ls);
+ expected += ("overrideProperty(ooSetupLocales,0,Type[string],false);" + ls);
+ expected += ("setPropertyValue(en-US);" + ls);
+ expected += ("endProperty();" + ls);
+ expected += ("overrideNode(Factories,0,false);" + ls);
+ expected += ("addOrReplace(com.sun.star.chart.ChartDocument,0);" + ls);
+ expected += ("overrideProperty(ooSetupFactoryEmptyDocumentURL,0,Type[string],false);" + ls);
+ expected += ("setPropertyValue(private:factory/schart);" + ls);
+ expected += ("endProperty();" + ls);
+ expected += ("overrideProperty(ooSetupFactoryIcon,0,Type[hyper],false);" + ls);
+ expected += ("setPropertyValue(13);" + ls);
+ expected += ("endProperty();" + ls);
+ expected += ("overrideProperty(ooSetupFactoryShortName,0,Type[string],false);" + ls);
+ expected += ("setPropertyValue(schart);" + ls);
+ expected += ("setPropertyValueForLocale(TemplateFile,en-US);" + ls);
+ expected += ("endProperty();" + ls);
+ expected += ("overrideProperty(ooSetupFactoryTemplateFile,0,Type[string],false);" + ls);
+ expected += ("setPropertyValue(empty);" + ls);
+ expected += ("endProperty();" + ls);
+ expected += ("addProperty(ooSetupFactoryTemplateFile,0,Type[string]);" + ls);
+ expected += ("addPropertyWithValue(ooSetupFactoryTemplateFile,0,TemplateFile);" + ls);
+ expected += ("endNode();" + ls);
+ expected += ("addOrReplace(dropme,0);" + ls);
+ expected += ("overrideProperty(anyway,0,Type[string],false);" + ls);
+ expected += ("setPropertyValue(nice);" + ls);
+ expected += ("endProperty();" + ls);
+ expected += ("dropNode(dropme);" + ls);
+ expected += ("endNode();" + ls);
+ expected += ("addOrReplace(FromTemplate,0);" + ls);
+ expected += ("endNode();" + ls);
+ expected += ("endNode();" + ls);
+ expected += ("endNode();" + ls);
+ expected += ("endNode();" + ls);
+ expected += ("endLayer();" + ls);
+
+ return expected;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XLayerImporter.java b/qadevOOo/tests/java/ifc/configuration/backend/_XLayerImporter.java
new file mode 100644
index 000000000000..39193787a857
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XLayerImporter.java
@@ -0,0 +1,166 @@
+/*************************************************************************
+ *
+ * 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 ifc.configuration.backend;
+
+import com.sun.star.configuration.backend.XBackend;
+import com.sun.star.configuration.backend.XLayerImporter;
+import lib.MultiMethodTest;
+
+public class _XLayerImporter extends MultiMethodTest {
+
+ public XLayerImporter oObj;
+ public XBackend xBackend = null;
+
+ public void _getTargetBackend() {
+ xBackend = oObj.getTargetBackend();
+ tRes.tested("getTargetBackend()", xBackend != null);
+ }
+
+ public void _importLayer() {
+ boolean res = false;
+ log.println("checking for exception is argument null is given");
+ try {
+ oObj.importLayer(null);
+ log.println("\tException expected -- FAILED");
+ } catch (com.sun.star.lang.NullPointerException ne) {
+ res = true;
+ log.println("\tExpected exception was thrown -- OK");
+ } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
+ res = false;
+ log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ res = false;
+ log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
+ } catch (com.sun.star.lang.WrappedTargetException wte) {
+ res = false;
+ log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
+ }
+
+ log.println("checking own implementation of XLayer");
+ try {
+ util.XLayerImpl xLayer = new util.XLayerImpl();
+ oObj.importLayer(xLayer);
+ if (! xLayer.hasBeenCalled()) {
+ log.println("\tXLayer hasn't been imported -- FAILED");
+ res &= false;
+ } else {
+ log.println("\tXLayer has been imported -- OK");
+ res &= true;
+ }
+ } catch (com.sun.star.lang.NullPointerException ne) {
+ res &= false;
+ log.println("\tExpected exception "+ne+" was thrown -- FAILED");
+ } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
+ res &= false;
+ log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ res &= false;
+ log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
+ } catch (com.sun.star.lang.WrappedTargetException wte) {
+ res &= false;
+ log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
+ }
+
+ tRes.tested("importLayer()",res);
+ }
+
+ public void _importLayerForEntity() {
+ boolean res = false;
+ log.println("checking for exception for argument (null,\"\")");
+ try {
+ oObj.importLayerForEntity(null,"");
+ log.println("\tException expected -- FAILED");
+ } catch (com.sun.star.lang.NullPointerException ne) {
+ res = true;
+ log.println("\tExpected exception was thrown -- OK");
+ } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
+ res = false;
+ log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ res = false;
+ log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
+ } catch (com.sun.star.lang.WrappedTargetException wte) {
+ res = false;
+ log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
+ }
+
+ log.println("checking own implementation of XLayer");
+ try {
+ util.XLayerImpl xLayer = new util.XLayerImpl();
+ oObj.importLayerForEntity(xLayer,"");
+ if (! xLayer.hasBeenCalled()) {
+ log.println("\tXLayer hasn't been imported -- FAILED");
+ res &= false;
+ } else {
+ log.println("\tXLayer has been imported -- OK");
+ res &= true;
+ }
+ } catch (com.sun.star.lang.NullPointerException ne) {
+ res &= false;
+ log.println("\tExpected exception "+ne+" was thrown -- FAILED");
+ } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
+ res &= false;
+ log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
+ } catch (com.sun.star.lang.IllegalArgumentException iae) {
+ res &= false;
+ log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
+ } catch (com.sun.star.lang.WrappedTargetException wte) {
+ res &= false;
+ log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
+ }
+
+ tRes.tested("importLayerForEntity()",res);
+ }
+
+ public void _setTargetBackend() {
+ requiredMethod("getTargetBackend()");
+ boolean res = false;
+ log.println("checking for exception if argument null is given");
+ try {
+ oObj.setTargetBackend(null);
+ log.println("\tException expected -- FAILED");
+ } catch (com.sun.star.lang.NullPointerException ne) {
+ res = true;
+ log.println("\tExpected exception was thrown -- OK");
+ }
+
+ log.println("checking argument previously gained by getTargetBackend");
+ try {
+ oObj.setTargetBackend(xBackend);
+ log.println("\t No Exception thrown -- OK");
+ res &= true;
+ } catch (com.sun.star.lang.NullPointerException ne) {
+ res &= false;
+ log.println("\tException was thrown -- FAILED");
+ }
+
+ tRes.tested("setTargetBackend()",res);
+
+ }
+
+}
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XMultiLayerStratum.java b/qadevOOo/tests/java/ifc/configuration/backend/_XMultiLayerStratum.java
new file mode 100644
index 000000000000..aae4743e01fc
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XMultiLayerStratum.java
@@ -0,0 +1,316 @@
+/*************************************************************************
+ *
+ * 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 ifc.configuration.backend;
+
+import com.sun.star.configuration.backend.XLayer;
+import com.sun.star.configuration.backend.XMultiLayerStratum;
+import com.sun.star.configuration.backend.XUpdatableLayer;
+import com.sun.star.lang.XMultiServiceFactory;
+
+import lib.MultiMethodTest;
+
+import util.XLayerHandlerImpl;
+
+
+public class _XMultiLayerStratum extends MultiMethodTest {
+ public XMultiLayerStratum oObj;
+ protected String aLayerID;
+
+ public void _getLayer() {
+ boolean res = true;
+
+ try {
+ XLayer aLayer = oObj.getLayer("", "");
+ log.println("Exception expected -- FAILED");
+ res = false;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("expected Exception -- OK");
+ }
+
+ try {
+ XLayer aLayer = oObj.getLayer(aLayerID, "");
+ res &= (aLayer != null);
+
+ if (aLayer == null) {
+ log.println("\treturned Layer is NULL -- FAILED");
+ }
+
+ res &= checkLayer(aLayer);
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("getLayer()", res);
+ }
+
+ public void _getLayers() {
+ boolean res = true;
+
+ try {
+ String[] LayerIds = new String[2];
+ LayerIds[0] = "1 /org/openoffice/Office/Jobs.xcu";
+ LayerIds[1] = "2 /org/openoffice/Office/Linguistic.xcu";
+
+ XLayer[] Layers = oObj.getLayers(LayerIds, "");
+ res = Layers.length == 2;
+ log.println("Getting two XLayers -- OK");
+ log.println("Checking first on "+LayerIds[0]);
+ res &= checkLayer(Layers[0]);
+ log.println("Checking second on "+LayerIds[1]);
+ res &= checkLayer(Layers[1]);
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("getLayers()", res);
+ }
+
+ public void _getMultipleLayers() {
+ boolean res = true;
+
+ try {
+ String[] LayerIds = new String[2];
+ LayerIds[0] = "1 /org/openoffice/Office/Jobs.xcu";
+ LayerIds[1] = "2 /org/openoffice/Office/Linguistic.xcu";
+ String[] Times = new String[2];
+ Times[0] = "";
+ Times[1] = "";
+
+ XLayer[] Layers = oObj.getMultipleLayers(LayerIds, Times);
+ res = Layers.length == 2;
+ log.println("Getting two XLayers -- OK");
+ log.println("Checking first on "+LayerIds[0]);
+ res &= checkLayer(Layers[0]);
+ log.println("Checking second on "+LayerIds[1]);
+ res &= checkLayer(Layers[1]);
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("getMultipleLayers()", res);
+ }
+
+ public void _getUpdatableLayer() {
+ boolean res = true;
+
+ try {
+ XUpdatableLayer aLayer = oObj.getUpdatableLayer("");
+ log.println("Exception expected -- FAILED");
+ res = false;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("expected Exception -- OK");
+ } catch (com.sun.star.lang.NoSupportException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ try {
+ XUpdatableLayer aLayer = oObj.getUpdatableLayer(aLayerID);
+ res &= (aLayer != null);
+
+ if (aLayer == null) {
+ log.println("\treturned Layer is NULL -- FAILED");
+ }
+
+ res &= checkLayer(aLayer);
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.NoSupportException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("getUpdatableLayer()", res);
+ }
+
+ public void _getUpdateLayerId() {
+ boolean res = true;
+
+ try {
+ String UpdateLayerID = oObj.getUpdateLayerId(
+ "org.openoffice.Office.TypeDetection",
+ "illegal");
+ log.println("Exception expected -- FAILED");
+ res = false;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("expected Exception -- OK");
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.NoSupportException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ try {
+ String ent = util.utils.getOfficeURL(
+ (XMultiServiceFactory) tParam.getMSF()) +
+ "/../share/registry";
+ String UpdateLayerID = oObj.getUpdateLayerId(
+ "org.openoffice.Office.Linguistic", ent);
+ res &= UpdateLayerID.endsWith("Linguistic.xcu");
+
+ if (!UpdateLayerID.endsWith("Linguistic.xcu")) {
+ log.println("\tExpected the id to end with Linguistic.xcu");
+ log.println("\tBut got " + UpdateLayerID);
+ log.println("\t=> FAILED");
+ }
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception "+e+" -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.NoSupportException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("getUpdateLayerId()", res);
+ }
+
+ public void _listLayerIds() {
+ boolean res = true;
+
+ try {
+ String[] LayerIDs = oObj.listLayerIds(
+ "org.openoffice.Office.TypeDetection",
+ "illegal");
+ log.println("Exception expected -- FAILED");
+ res = false;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("expected Exception -- OK");
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ try {
+ String ent = util.utils.getOfficeURL(
+ (XMultiServiceFactory) tParam.getMSF()) +
+ "/../share/registry";
+ String[] LayerIDs = oObj.listLayerIds("org.openoffice.Office.Jobs",
+ ent);
+ res &= LayerIDs[0].endsWith("Jobs.xcu");
+ aLayerID = LayerIDs[0];
+
+ if (!LayerIDs[0].endsWith("Jobs.xcu")) {
+ log.println("\tExpected the id to end with Jobs.xcu");
+ log.println("\tBut got " + LayerIDs[0]);
+ log.println("\t=> FAILED");
+ }
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("listLayerIds()", res);
+ }
+
+ protected boolean checkLayer(XLayer aLayer) {
+ boolean res = false;
+
+ log.println("Checking for Exception in case of null argument");
+
+ try {
+ aLayer.readData(null);
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Expected Exception -- OK");
+ res = true;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ }
+
+ log.println("checking read data with own XLayerHandler implementation");
+
+ try {
+ XLayerHandlerImpl xLayerHandler = new XLayerHandlerImpl();
+ aLayer.readData(xLayerHandler);
+
+ String implCalled = xLayerHandler.getCalls();
+ log.println(implCalled);
+
+ int sl = implCalled.indexOf("startLayer");
+
+ if (sl < 0) {
+ log.println("startLayer wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("startLayer was called -- OK");
+ res &= true;
+ }
+
+ int el = implCalled.indexOf("endLayer");
+
+ if (el < 0) {
+ log.println("endLayer wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("endLayer was called -- OK");
+ res &= true;
+ }
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ }
+
+ return res;
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XSchema.java b/qadevOOo/tests/java/ifc/configuration/backend/_XSchema.java
new file mode 100644
index 000000000000..36be98ebc1fb
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XSchema.java
@@ -0,0 +1,263 @@
+/*************************************************************************
+ *
+ * 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 ifc.configuration.backend;
+
+import com.sun.star.configuration.backend.XSchema;
+import com.sun.star.io.XActiveDataSink;
+import com.sun.star.io.XInputStream;
+import com.sun.star.lang.XMultiServiceFactory;
+import com.sun.star.ucb.XSimpleFileAccess;
+import com.sun.star.uno.UnoRuntime;
+
+import lib.MultiMethodTest;
+
+import util.XSchemaHandlerImpl;
+
+public class _XSchema extends MultiMethodTest {
+ public XSchema oObj;
+ XSchemaHandlerImpl xSchemaHandlerImpl = new XSchemaHandlerImpl();
+ String filename = null;
+
+ protected void before() {
+ filename = (String)tEnv.getObjRelation("ParsedFileName");
+ }
+
+ public void _readComponent() {
+ requiredMethod("readTemplates()");
+ boolean res = false;
+
+ log.println("Checking for Exception in case of null argument");
+
+ try {
+ oObj.readComponent(null);
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Expected Exception -- OK");
+ res = true;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ }
+
+ log.println(
+ "checking readComponent with own XSchemeHandler implementation");
+
+ try {
+ xSchemaHandlerImpl.cleanCalls();
+ oObj.readComponent(xSchemaHandlerImpl);
+
+ String implCalled = xSchemaHandlerImpl.getCalls();
+
+ System.out.println(implCalled);
+
+ int sc = implCalled.indexOf("startComponent");
+
+ if (sc < 0) {
+ log.println("startComponent wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("startComponent was called -- OK");
+ res &= true;
+ }
+
+ int ec = implCalled.indexOf("endComponent");
+
+ if (ec < 0) {
+ log.println("endComponent wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("endComponent was called -- OK");
+ res &= true;
+ }
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ }
+
+ tRes.tested("readComponent()", res);
+ reopenFile();
+ }
+
+ public void _readSchema() {
+ requiredMethod("readComponent()");
+ boolean res = false;
+
+ log.println("Checking for Exception in case of null argument");
+
+ try {
+ xSchemaHandlerImpl.cleanCalls();
+ oObj.readSchema(null);
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Expected Exception -- OK");
+ res = true;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ }
+
+ log.println(
+ "checking read data with own XSchemeHandler implementation");
+
+ try {
+ xSchemaHandlerImpl.cleanCalls();
+ oObj.readSchema(xSchemaHandlerImpl);
+
+ String implCalled = xSchemaHandlerImpl.getCalls();
+
+ int sc = implCalled.indexOf("startSchema");
+
+ if (sc < 0) {
+ log.println("startSchema wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("startSchema was called -- OK");
+ res &= true;
+ }
+
+ int ec = implCalled.indexOf("endSchema");
+
+ if (ec < 0) {
+ log.println("endSchema wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("endSchema was called -- OK");
+ res &= true;
+ }
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ }
+
+ // check for the wrapped target exception
+ try {
+ xSchemaHandlerImpl.cleanCalls();
+ oObj.readSchema(xSchemaHandlerImpl);
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Expected Exception -- OK");
+ res = true;
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ }
+
+ tRes.tested("readSchema()", res);
+ reopenFile();
+ }
+
+ public void _readTemplates() {
+ boolean res = false;
+
+ log.println("Checking for Exception in case of null argument");
+
+ try {
+ oObj.readTemplates(null);
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Expected Exception -- OK");
+ res = true;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ }
+
+ log.println(
+ "checking readComponent with own XSchemeHandler implementation");
+
+ try {
+ xSchemaHandlerImpl.cleanCalls();
+ oObj.readComponent(xSchemaHandlerImpl);
+
+ String implCalled = xSchemaHandlerImpl.getCalls();
+
+ int sc = implCalled.indexOf("startGroup");
+
+ if (sc < 0) {
+ log.println("startGroup wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("startGroup was called -- OK");
+ res &= true;
+ }
+
+ int ec = implCalled.indexOf("endNode");
+
+ if (ec < 0) {
+ log.println("endNode wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("endNode was called -- OK");
+ res &= true;
+ }
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ }
+
+ tRes.tested("readTemplates()", res);
+ reopenFile();
+ }
+
+ /**
+ * reopen the parsed file again, to avoid the wrapped target exception.
+ */
+ private void reopenFile() {
+ XSimpleFileAccess simpleAccess = null;
+ XInputStream xStream = null;
+ try {
+ Object fileacc = ((XMultiServiceFactory)tParam.getMSF()).createInstance("com.sun.star.comp.ucb.SimpleFileAccess");
+ simpleAccess = (XSimpleFileAccess)
+ UnoRuntime.queryInterface(XSimpleFileAccess.class,fileacc);
+ log.println("Going to parse: "+filename);
+ xStream = simpleAccess.openFileRead(filename);
+ } catch (com.sun.star.uno.Exception e) {
+ }
+
+ XActiveDataSink xSink = (XActiveDataSink) UnoRuntime.queryInterface(XActiveDataSink.class, oObj);
+ xSink.setInputStream(xStream);
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XSchemaSupplier.java b/qadevOOo/tests/java/ifc/configuration/backend/_XSchemaSupplier.java
new file mode 100644
index 000000000000..99346705b4fb
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XSchemaSupplier.java
@@ -0,0 +1,118 @@
+/*************************************************************************
+ *
+ * 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 ifc.configuration.backend;
+
+import com.sun.star.configuration.backend.XSchema;
+import com.sun.star.configuration.backend.XSchemaSupplier;
+
+import lib.MultiMethodTest;
+import util.XSchemaHandlerImpl;
+
+public class _XSchemaSupplier extends MultiMethodTest {
+ public XSchemaSupplier oObj;
+
+ public void _getComponentSchema() {
+ boolean res = true;
+ XSchema aSchema = null;
+
+ try {
+ aSchema = oObj.getComponentSchema("org.openoffice.Office.Linguistic");
+ res &= (aSchema != null);
+
+ if (aSchema == null) {
+ log.println("\treturned Layer is NULL -- FAILED");
+ }
+
+ res &= checkSchema(aSchema);
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ }
+ tRes.tested("getComponentSchema()",res);
+ }
+
+ protected boolean checkSchema(XSchema aSchema) {
+ boolean res = false;
+ XSchemaHandlerImpl xSchemaHandlerImpl = new XSchemaHandlerImpl();
+ log.println("Checking for Exception in case of null argument");
+
+ try {
+ aSchema.readTemplates(null);
+ log.println("NoException thrown for null argument -- FAILED");
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Expected Exception -- OK");
+ res = true;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ }
+
+ log.println(
+ "checking readComponent with own XSchemaHandler implementation");
+
+ try {
+ aSchema.readComponent(xSchemaHandlerImpl);
+
+ String implCalled = xSchemaHandlerImpl.getCalls();
+ int sc = implCalled.indexOf("startComponent");
+
+ if (sc < 0) {
+ log.println("startComponent wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("startComponent was called -- OK");
+ res &= true;
+ }
+
+ int ec = implCalled.indexOf("endComponent");
+
+ if (ec < 0) {
+ log.println("endComponent wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("endComponent was called -- OK");
+ res &= true;
+ }
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ }
+
+ return res;
+
+ }
+} \ No newline at end of file
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XSingleLayerStratum.java b/qadevOOo/tests/java/ifc/configuration/backend/_XSingleLayerStratum.java
new file mode 100644
index 000000000000..4ff3e8518f71
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XSingleLayerStratum.java
@@ -0,0 +1,152 @@
+/*
+ * _XSingleLayerStratum.java
+ *
+ * Created on 23. March 2004, 16:37
+ */
+package ifc.configuration.backend;
+import com.sun.star.configuration.backend.XLayer;
+import com.sun.star.configuration.backend.XSingleLayerStratum;
+import com.sun.star.configuration.backend.XUpdatableLayer;
+
+import lib.MultiMethodTest;
+
+import util.XLayerHandlerImpl;
+
+
+public class _XSingleLayerStratum extends MultiMethodTest {
+ public XSingleLayerStratum oObj;
+
+ public void _getLayer() {
+ String aLayerID = "org.openoffice.Office.Common";
+ boolean res = true;
+
+ try {
+ XLayer aLayer = oObj.getLayer("", "");
+ log.println("Exception expected -- FAILED");
+ res = false;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("expected Exception -- OK");
+ }
+
+ try {
+ XLayer aLayer = oObj.getLayer(aLayerID, "");
+ res &= (aLayer != null);
+
+ if (aLayer == null) {
+ log.println("\treturned Layer is NULL -- FAILED");
+ }
+
+ res &= checkLayer(aLayer);
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("getLayer()", res);
+ }
+
+ public void _getUpdatableLayer() {
+ String aLayerID = "org.openoffice.Office.Common";
+ boolean res = true;
+
+ try {
+ XUpdatableLayer aLayer = oObj.getUpdatableLayer("");
+ log.println("Exception expected -- FAILED");
+ res = false;
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception " + e + " -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("expected Exception -- OK");
+ } catch (com.sun.star.lang.NoSupportException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ try {
+ XUpdatableLayer aLayer = oObj.getUpdatableLayer(aLayerID);
+ res &= (aLayer != null);
+
+ if (aLayer == null) {
+ log.println("\treturned Layer is NULL -- FAILED");
+ }
+
+ res &= checkLayer(aLayer);
+ } catch (com.sun.star.configuration.backend.BackendAccessException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.IllegalArgumentException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ } catch (com.sun.star.lang.NoSupportException e) {
+ log.println("unexpected Exception -- FAILED");
+ res = false;
+ }
+
+ tRes.tested("getUpdatableLayer()", res);
+ }
+
+ protected boolean checkLayer(XLayer aLayer) {
+ boolean res = false;
+
+ log.println("Checking for Exception in case of null argument");
+
+ try {
+ aLayer.readData(null);
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Expected Exception -- OK");
+ res = true;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ }
+
+ log.println("checking read data with own XLayerHandler implementation");
+
+ try {
+ XLayerHandlerImpl xLayerHandler = new XLayerHandlerImpl();
+ aLayer.readData(xLayerHandler);
+
+ String implCalled = xLayerHandler.getCalls();
+ log.println(implCalled);
+
+ int sl = implCalled.indexOf("startLayer");
+
+ if (sl < 0) {
+ log.println("startLayer wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("startLayer was called -- OK");
+ res &= true;
+ }
+
+ int el = implCalled.indexOf("endLayer");
+
+ if (el < 0) {
+ log.println("endLayer wasn't called -- FAILED");
+ res &= false;
+ } else {
+ log.println("endLayer was called -- OK");
+ res &= true;
+ }
+ } catch (com.sun.star.lang.NullPointerException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception (" + e + ") -- FAILED");
+ res &= false;
+ }
+
+ return res;
+ }
+}
diff --git a/qadevOOo/tests/java/ifc/configuration/backend/_XUpdateHandler.java b/qadevOOo/tests/java/ifc/configuration/backend/_XUpdateHandler.java
new file mode 100644
index 000000000000..32049d8f7015
--- /dev/null
+++ b/qadevOOo/tests/java/ifc/configuration/backend/_XUpdateHandler.java
@@ -0,0 +1,260 @@
+/*************************************************************************
+ *
+ * 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 ifc.configuration.backend;
+
+import com.sun.star.configuration.backend.TemplateIdentifier;
+import com.sun.star.configuration.backend.XUpdateHandler;
+import com.sun.star.uno.Type;
+
+import lib.MultiMethodTest;
+
+import util.XLayerHandlerImpl;
+import util.XLayerImpl;
+
+
+/**
+ *
+ * @author sw93809
+ */
+public class _XUpdateHandler extends MultiMethodTest {
+ public XUpdateHandler oObj;
+ protected XLayerHandlerImpl xLayerHandler = null;
+
+ public void before() {
+ xLayerHandler = (XLayerHandlerImpl) tEnv.getObjRelation("LayerHandler");
+
+ try {
+ xLayerHandler.startLayer();
+ xLayerHandler.overrideNode("org.openoffice.Setup", (short) 0,
+ false);
+ xLayerHandler.overrideNode("Office", (short) 0, false);
+ xLayerHandler.overrideProperty("ooSetupInstCompleted", (short) 0,
+ new Type(java.lang.String.class),
+ false);
+ xLayerHandler.setPropertyValue(new Boolean(false));
+ xLayerHandler.endProperty();
+ xLayerHandler.overrideProperty("ooSetupShowIntro", (short) 0,
+ new Type(java.lang.String.class),
+ false);
+ xLayerHandler.setPropertyValue(new Boolean(true));
+ xLayerHandler.endProperty();
+ xLayerHandler.overrideProperty("ooSetupLocales", (short) 0,
+ new Type(java.lang.String.class),
+ false);
+ xLayerHandler.setPropertyValue("en-US");
+ xLayerHandler.endProperty();
+ xLayerHandler.overrideNode("Factories", (short) 0, false);
+ xLayerHandler.addOrReplaceNode("com.sun.star.chart.ChartDocument",
+ (short) 0);
+ xLayerHandler.overrideProperty("ooSetupFactoryEmptyDocumentURL",
+ (short) 0,
+ new Type(java.lang.String.class),
+ false);
+ xLayerHandler.setPropertyValue("private:factory/schart");
+ xLayerHandler.endProperty();
+ xLayerHandler.overrideProperty("ooSetupFactoryIcon", (short) 0,
+ new Type(java.lang.Long.class),
+ false);
+ xLayerHandler.setPropertyValue(new Integer(13));
+ xLayerHandler.endProperty();
+ xLayerHandler.overrideProperty("ooSetupFactoryShortName",
+ (short) 0,
+ new Type(java.lang.String.class),
+ false);
+ xLayerHandler.setPropertyValue("schart");
+ xLayerHandler.setPropertyValueForLocale("TemplateFile", "en-US");
+ xLayerHandler.endProperty();
+ xLayerHandler.overrideProperty("ooSetupFactoryTemplateFile",
+ (short) 0,
+ new Type(java.lang.String.class),
+ false);
+ xLayerHandler.setPropertyValue("empty");
+ xLayerHandler.endProperty();
+ xLayerHandler.addProperty("ooSetupFactoryTemplateFile", (short) 0,
+ new Type(java.lang.String.class));
+ xLayerHandler.addPropertyWithValue("ooSetupFactoryTemplateFile",
+ (short) 0, "TemplateFile");
+ xLayerHandler.endNode();
+
+ xLayerHandler.addOrReplaceNode("dropme", (short) 0);
+ xLayerHandler.overrideProperty("anyway", (short) 0,
+ new Type(java.lang.String.class),
+ false);
+ xLayerHandler.setPropertyValue("nice");
+ xLayerHandler.endProperty();
+ xLayerHandler.dropNode("dropme");
+ xLayerHandler.endNode();
+
+ xLayerHandler.addOrReplaceNodeFromTemplate("FromTemplate",
+ new com.sun.star.configuration.backend.TemplateIdentifier(
+ "org.openoffice.Setup",
+ "Setup"),
+ (short) 0);
+ xLayerHandler.endNode();
+
+ xLayerHandler.endNode();
+ xLayerHandler.endNode();
+ xLayerHandler.endNode();
+ xLayerHandler.endLayer();
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected Exception " + e);
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected Exception " + e);
+ } catch (com.sun.star.uno.Exception e) {
+ log.println("Unexpected Exception " + e);
+ }
+ }
+
+ public void _addOrReplaceNode() {
+ requiredMethod("startUpdate()");
+ tRes.tested("addOrReplaceNode()", true);
+ }
+
+ public void _addOrReplaceNodeFromTemplate() {
+ requiredMethod("startUpdate()");
+ tRes.tested("addOrReplaceNodeFromTemplate()", true);
+ }
+
+ public void _addOrReplaceProperty() {
+ requiredMethod("startUpdate()");
+ tRes.tested("addOrReplaceProperty()", true);
+ }
+
+ public void _addOrReplacePropertyWithValue() {
+ requiredMethod("startUpdate()");
+ tRes.tested("addOrReplacePropertyWithValue()", true);
+ }
+
+ public void _endNode() {
+ requiredMethod("startUpdate()");
+ tRes.tested("endNode()", true);
+ }
+
+ public void _endProperty() {
+ requiredMethod("startUpdate()");
+ tRes.tested("endProperty()", true);
+ }
+
+ public void _endUpdate() {
+ requiredMethod("startUpdate()");
+ tRes.tested("endUpdate()", true);
+ }
+
+ public void _modifyNode() {
+ requiredMethod("startUpdate()");
+ tRes.tested("modifyNode()", true);
+ }
+
+ public void _modifyProperty() {
+ requiredMethod("startUpdate()");
+ tRes.tested("modifyProperty()", true);
+ }
+
+ public void _removeNode() {
+ requiredMethod("startUpdate()");
+ tRes.tested("removeNode()", true);
+ }
+
+ public void _removeProperty() {
+ requiredMethod("startUpdate()");
+ tRes.tested("removeProperty()", true);
+ }
+
+ public void _resetProperty() {
+ requiredMethod("startUpdate()");
+ tRes.tested("resetProperty()", true);
+ }
+
+ public void _resetPropertyValue() {
+ requiredMethod("startUpdate()");
+ tRes.tested("resetPropertyValue()", true);
+ }
+
+ public void _resetPropertyValueForLocale() {
+ requiredMethod("startUpdate()");
+ tRes.tested("resetPropertyValueForLocale()", true);
+ }
+
+ public void _setPropertyValue() {
+ requiredMethod("startUpdate()");
+ tRes.tested("setPropertyValue()", true);
+ }
+
+ public void _setPropertyValueForLocale() {
+ requiredMethod("startUpdate()");
+ tRes.tested("setPropertyValueForLocale()", true);
+ }
+
+ public void _startUpdate() {
+ boolean res = true;
+
+ try {
+ XLayerImpl xLayer = (XLayerImpl) tEnv.getObjRelation("Layer");
+ log.println("Layer called (before): " + xLayer.hasBeenCalled());
+ oObj.startUpdate();
+ oObj.addOrReplaceNode("whatever", (short) 0);
+ oObj.addOrReplaceNodeFromTemplate("Office", (short) 0,
+ new TemplateIdentifier());
+ oObj.addOrReplaceProperty("prop", (short) 0,
+ new Type(java.lang.String.class));
+ oObj.addOrReplacePropertyWithValue("prop2", (short) 0, "this");
+ oObj.modifyProperty("ooSetupFactoryIcon", (short) 0, (short) 0,
+ new Type(java.lang.String.class));
+ oObj.resetPropertyValue();
+ oObj.resetPropertyValueForLocale("en-US");
+ oObj.endProperty();
+ oObj.modifyProperty("ooSetupFactoryEmptyDocumentURL", (short) 0,
+ (short) 0, new Type(java.lang.String.class));
+ oObj.setPropertyValue("newValue");
+ oObj.setPropertyValueForLocale("newValue-US", "de-DE");
+ oObj.endProperty();
+ oObj.removeProperty("ooSetupShowIntro");
+ oObj.modifyNode("org.openoffice.Setup", (short) 0, (short) 0, true);
+ oObj.removeNode("whatever");
+ oObj.resetProperty("prop");
+ oObj.endNode();
+ oObj.endNode();
+ oObj.endNode();
+ oObj.endUpdate();
+
+ log.println("Layer called (after): " + xLayer.hasBeenCalled());
+
+ res = xLayer.hasBeenCalled();
+ } catch (com.sun.star.configuration.backend.MalformedDataException e) {
+ log.println("Unexpected exception " + e.getMessage());
+ res = false;
+ } catch (com.sun.star.lang.IllegalAccessException e) {
+ log.println("Unexpected exception " + e.getMessage());
+ res = false;
+ } catch (com.sun.star.lang.WrappedTargetException e) {
+ log.println("Unexpected exception " + e.getMessage());
+ res = false;
+ }
+
+ tRes.tested("startUpdate()", res);
+ }
+}