2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package ifc
.configuration
.backend
;
21 import com
.sun
.star
.configuration
.backend
.XBackend
;
22 import com
.sun
.star
.configuration
.backend
.XLayerImporter
;
23 import lib
.MultiMethodTest
;
25 public class _XLayerImporter
extends MultiMethodTest
{
27 public XLayerImporter oObj
;
28 public XBackend xBackend
= null;
30 public void _getTargetBackend() {
31 xBackend
= oObj
.getTargetBackend();
32 tRes
.tested("getTargetBackend()", xBackend
!= null);
35 public void _importLayer() {
37 log
.println("checking for exception is argument null is given");
39 oObj
.importLayer(null);
40 log
.println("\tException expected -- FAILED");
41 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
43 log
.println("\tExpected exception was thrown -- OK");
44 } catch (com
.sun
.star
.configuration
.backend
.MalformedDataException mde
) {
46 log
.println("\tWrong Expected "+mde
+" exception was thrown -- FAILED");
47 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
49 log
.println("\tWrong Expected "+iae
+" exception was thrown -- FAILED");
50 } catch (com
.sun
.star
.lang
.WrappedTargetException wte
) {
52 log
.println("\tWrong Expected "+wte
+" exception was thrown -- FAILED");
55 log
.println("checking own implementation of XLayer");
57 util
.XLayerImpl xLayer
= new util
.XLayerImpl();
58 oObj
.importLayer(xLayer
);
59 if (! xLayer
.hasBeenCalled()) {
60 log
.println("\tXLayer hasn't been imported -- FAILED");
63 log
.println("\tXLayer has been imported -- OK");
66 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
68 log
.println("\tExpected exception "+ne
+" was thrown -- FAILED");
69 } catch (com
.sun
.star
.configuration
.backend
.MalformedDataException mde
) {
71 log
.println("\tWrong Expected "+mde
+" exception was thrown -- FAILED");
72 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
74 log
.println("\tWrong Expected "+iae
+" exception was thrown -- FAILED");
75 } catch (com
.sun
.star
.lang
.WrappedTargetException wte
) {
77 log
.println("\tWrong Expected "+wte
+" exception was thrown -- FAILED");
80 tRes
.tested("importLayer()",res
);
83 public void _importLayerForEntity() {
85 log
.println("checking for exception for argument (null,\"\")");
87 oObj
.importLayerForEntity(null,"");
88 log
.println("\tException expected -- FAILED");
89 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
91 log
.println("\tExpected exception was thrown -- OK");
92 } catch (com
.sun
.star
.configuration
.backend
.MalformedDataException mde
) {
94 log
.println("\tWrong Expected "+mde
+" exception was thrown -- FAILED");
95 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
97 log
.println("\tWrong Expected "+iae
+" exception was thrown -- FAILED");
98 } catch (com
.sun
.star
.lang
.WrappedTargetException wte
) {
100 log
.println("\tWrong Expected "+wte
+" exception was thrown -- FAILED");
103 log
.println("checking own implementation of XLayer");
105 util
.XLayerImpl xLayer
= new util
.XLayerImpl();
106 oObj
.importLayerForEntity(xLayer
,"");
107 if (! xLayer
.hasBeenCalled()) {
108 log
.println("\tXLayer hasn't been imported -- FAILED");
111 log
.println("\tXLayer has been imported -- OK");
114 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
116 log
.println("\tExpected exception "+ne
+" was thrown -- FAILED");
117 } catch (com
.sun
.star
.configuration
.backend
.MalformedDataException mde
) {
119 log
.println("\tWrong Expected "+mde
+" exception was thrown -- FAILED");
120 } catch (com
.sun
.star
.lang
.IllegalArgumentException iae
) {
122 log
.println("\tWrong Expected "+iae
+" exception was thrown -- FAILED");
123 } catch (com
.sun
.star
.lang
.WrappedTargetException wte
) {
125 log
.println("\tWrong Expected "+wte
+" exception was thrown -- FAILED");
128 tRes
.tested("importLayerForEntity()",res
);
131 public void _setTargetBackend() {
132 requiredMethod("getTargetBackend()");
134 log
.println("checking for exception if argument null is given");
136 oObj
.setTargetBackend(null);
137 log
.println("\tException expected -- FAILED");
138 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
140 log
.println("\tExpected exception was thrown -- OK");
143 log
.println("checking argument previously gained by getTargetBackend");
145 oObj
.setTargetBackend(xBackend
);
146 log
.println("\t No Exception thrown -- OK");
148 } catch (com
.sun
.star
.lang
.NullPointerException ne
) {
150 log
.println("\tException was thrown -- FAILED");
153 tRes
.tested("setTargetBackend()",res
);