1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XLayerImporter.java,v $
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() {
49 log
.println("checking for exception is argument null is given");
51 oObj
.importLayer(null);
52 log
.println("\tException expected -- FAILED");
53 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
55 log
.println("\tExpected exception was thrown -- OK");
56 } catch (com
.sun
.star
.configuration
.backend
.MalformedDataException mde
) {
58 log
.println("\tWrong Expected "+mde
+" exception was thrown -- FAILED");
59 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
61 log
.println("\tWrong Expected "+iae
+" exception was thrown -- FAILED");
62 } catch (com
.sun
.star
.lang
.WrappedTargetException wte
) {
64 log
.println("\tWrong Expected "+wte
+" exception was thrown -- FAILED");
67 log
.println("checking own implementation of XLayer");
69 util
.XLayerImpl xLayer
= new util
.XLayerImpl();
70 oObj
.importLayer(xLayer
);
71 if (! xLayer
.hasBeenCalled()) {
72 log
.println("\tXLayer hasn't been imported -- FAILED");
75 log
.println("\tXLayer has been imported -- OK");
78 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
80 log
.println("\tExpected exception "+ne
+" was thrown -- FAILED");
81 } catch (com
.sun
.star
.configuration
.backend
.MalformedDataException mde
) {
83 log
.println("\tWrong Expected "+mde
+" exception was thrown -- FAILED");
84 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
86 log
.println("\tWrong Expected "+iae
+" exception was thrown -- FAILED");
87 } catch (com
.sun
.star
.lang
.WrappedTargetException wte
) {
89 log
.println("\tWrong Expected "+wte
+" exception was thrown -- FAILED");
92 tRes
.tested("importLayer()",res
);
95 public void _importLayerForEntity() {
97 log
.println("checking for exception for argument (null,\"\")");
99 oObj
.importLayerForEntity(null,"");
100 log
.println("\tException expected -- FAILED");
101 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
103 log
.println("\tExpected exception was thrown -- OK");
104 } catch (com
.sun
.star
.configuration
.backend
.MalformedDataException mde
) {
106 log
.println("\tWrong Expected "+mde
+" exception was thrown -- FAILED");
107 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
109 log
.println("\tWrong Expected "+iae
+" exception was thrown -- FAILED");
110 } catch (com
.sun
.star
.lang
.WrappedTargetException wte
) {
112 log
.println("\tWrong Expected "+wte
+" exception was thrown -- FAILED");
115 log
.println("checking own implementation of XLayer");
117 util
.XLayerImpl xLayer
= new util
.XLayerImpl();
118 oObj
.importLayerForEntity(xLayer
,"");
119 if (! xLayer
.hasBeenCalled()) {
120 log
.println("\tXLayer hasn't been imported -- FAILED");
123 log
.println("\tXLayer has been imported -- OK");
126 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
128 log
.println("\tExpected exception "+ne
+" was thrown -- FAILED");
129 } catch (com
.sun
.star
.configuration
.backend
.MalformedDataException mde
) {
131 log
.println("\tWrong Expected "+mde
+" exception was thrown -- FAILED");
132 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
134 log
.println("\tWrong Expected "+iae
+" exception was thrown -- FAILED");
135 } catch (com
.sun
.star
.lang
.WrappedTargetException wte
) {
137 log
.println("\tWrong Expected "+wte
+" exception was thrown -- FAILED");
140 tRes
.tested("importLayerForEntity()",res
);
143 public void _setTargetBackend() {
144 requiredMethod("getTargetBackend()");
146 log
.println("checking for exception if argument null is given");
148 oObj
.setTargetBackend(null);
149 log
.println("\tException expected -- FAILED");
150 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
152 log
.println("\tExpected exception was thrown -- OK");
155 log
.println("checking argument previously gained by getTargetBackend");
157 oObj
.setTargetBackend(xBackend
);
158 log
.println("\t No Exception thrown -- OK");
160 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
162 log
.println("\tException was thrown -- FAILED");
165 tRes
.tested("setTargetBackend()",res
);