Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / configuration / backend / _XLayerImporter.java
blob21e6d0070d40294a894b31b5f30557fa51fa0c7d
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XLayerImporter.java,v $
10 * $Revision: 1.4 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 package ifc.configuration.backend;
33 import com.sun.star.configuration.backend.XBackend;
34 import com.sun.star.configuration.backend.XLayerImporter;
35 import lib.MultiMethodTest;
37 public class _XLayerImporter extends MultiMethodTest {
39 public XLayerImporter oObj;
40 public XBackend xBackend = null;
42 public void _getTargetBackend() {
43 xBackend = oObj.getTargetBackend();
44 tRes.tested("getTargetBackend()", xBackend != null);
47 public void _importLayer() {
48 boolean res = false;
49 log.println("checking for exception is argument null is given");
50 try {
51 oObj.importLayer(null);
52 log.println("\tException expected -- FAILED");
53 } catch (com.sun.star.lang.NullPointerException ne) {
54 res = true;
55 log.println("\tExpected exception was thrown -- OK");
56 } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
57 res = false;
58 log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
59 } catch (com.sun.star.lang.IllegalArgumentException iae) {
60 res = false;
61 log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
62 } catch (com.sun.star.lang.WrappedTargetException wte) {
63 res = false;
64 log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
67 log.println("checking own implementation of XLayer");
68 try {
69 util.XLayerImpl xLayer = new util.XLayerImpl();
70 oObj.importLayer(xLayer);
71 if (! xLayer.hasBeenCalled()) {
72 log.println("\tXLayer hasn't been imported -- FAILED");
73 res &= false;
74 } else {
75 log.println("\tXLayer has been imported -- OK");
76 res &= true;
78 } catch (com.sun.star.lang.NullPointerException ne) {
79 res &= false;
80 log.println("\tExpected exception "+ne+" was thrown -- FAILED");
81 } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
82 res &= false;
83 log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
84 } catch (com.sun.star.lang.IllegalArgumentException iae) {
85 res &= false;
86 log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
87 } catch (com.sun.star.lang.WrappedTargetException wte) {
88 res &= false;
89 log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
92 tRes.tested("importLayer()",res);
95 public void _importLayerForEntity() {
96 boolean res = false;
97 log.println("checking for exception for argument (null,\"\")");
98 try {
99 oObj.importLayerForEntity(null,"");
100 log.println("\tException expected -- FAILED");
101 } catch (com.sun.star.lang.NullPointerException ne) {
102 res = true;
103 log.println("\tExpected exception was thrown -- OK");
104 } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
105 res = false;
106 log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
107 } catch (com.sun.star.lang.IllegalArgumentException iae) {
108 res = false;
109 log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
110 } catch (com.sun.star.lang.WrappedTargetException wte) {
111 res = false;
112 log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
115 log.println("checking own implementation of XLayer");
116 try {
117 util.XLayerImpl xLayer = new util.XLayerImpl();
118 oObj.importLayerForEntity(xLayer,"");
119 if (! xLayer.hasBeenCalled()) {
120 log.println("\tXLayer hasn't been imported -- FAILED");
121 res &= false;
122 } else {
123 log.println("\tXLayer has been imported -- OK");
124 res &= true;
126 } catch (com.sun.star.lang.NullPointerException ne) {
127 res &= false;
128 log.println("\tExpected exception "+ne+" was thrown -- FAILED");
129 } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
130 res &= false;
131 log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
132 } catch (com.sun.star.lang.IllegalArgumentException iae) {
133 res &= false;
134 log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
135 } catch (com.sun.star.lang.WrappedTargetException wte) {
136 res &= false;
137 log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
140 tRes.tested("importLayerForEntity()",res);
143 public void _setTargetBackend() {
144 requiredMethod("getTargetBackend()");
145 boolean res = false;
146 log.println("checking for exception if argument null is given");
147 try {
148 oObj.setTargetBackend(null);
149 log.println("\tException expected -- FAILED");
150 } catch (com.sun.star.lang.NullPointerException ne) {
151 res = true;
152 log.println("\tExpected exception was thrown -- OK");
155 log.println("checking argument previously gained by getTargetBackend");
156 try {
157 oObj.setTargetBackend(xBackend);
158 log.println("\t No Exception thrown -- OK");
159 res &= true;
160 } catch (com.sun.star.lang.NullPointerException ne) {
161 res &= false;
162 log.println("\tException was thrown -- FAILED");
165 tRes.tested("setTargetBackend()",res);