cid#1607171 Data race condition
[LibreOffice.git] / qadevOOo / tests / java / ifc / configuration / backend / _XLayerImporter.java
blob0e42ec526464e24f0dd50ea2d1a38de6de6cb545
1 /*
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() {
36 boolean res = false;
37 log.println("checking for exception is argument null is given");
38 try {
39 oObj.importLayer(null);
40 log.println("\tException expected -- FAILED");
41 } catch (com.sun.star.lang.NullPointerException ne) {
42 res = true;
43 log.println("\tExpected exception was thrown -- OK");
44 } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
45 res = false;
46 log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
47 } catch (com.sun.star.lang.IllegalArgumentException iae) {
48 res = false;
49 log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
50 } catch (com.sun.star.lang.WrappedTargetException wte) {
51 res = false;
52 log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
55 log.println("checking own implementation of XLayer");
56 try {
57 util.XLayerImpl xLayer = new util.XLayerImpl();
58 oObj.importLayer(xLayer);
59 if (! xLayer.hasBeenCalled()) {
60 log.println("\tXLayer hasn't been imported -- FAILED");
61 res &= false;
62 } else {
63 log.println("\tXLayer has been imported -- OK");
64 res &= true;
66 } catch (com.sun.star.lang.NullPointerException ne) {
67 res &= false;
68 log.println("\tExpected exception "+ne+" was thrown -- FAILED");
69 } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
70 res &= false;
71 log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
72 } catch (com.sun.star.lang.IllegalArgumentException iae) {
73 res &= false;
74 log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
75 } catch (com.sun.star.lang.WrappedTargetException wte) {
76 res &= false;
77 log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
80 tRes.tested("importLayer()",res);
83 public void _importLayerForEntity() {
84 boolean res = false;
85 log.println("checking for exception for argument (null,\"\")");
86 try {
87 oObj.importLayerForEntity(null,"");
88 log.println("\tException expected -- FAILED");
89 } catch (com.sun.star.lang.NullPointerException ne) {
90 res = true;
91 log.println("\tExpected exception was thrown -- OK");
92 } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
93 res = false;
94 log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
95 } catch (com.sun.star.lang.IllegalArgumentException iae) {
96 res = false;
97 log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
98 } catch (com.sun.star.lang.WrappedTargetException wte) {
99 res = false;
100 log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
103 log.println("checking own implementation of XLayer");
104 try {
105 util.XLayerImpl xLayer = new util.XLayerImpl();
106 oObj.importLayerForEntity(xLayer,"");
107 if (! xLayer.hasBeenCalled()) {
108 log.println("\tXLayer hasn't been imported -- FAILED");
109 res &= false;
110 } else {
111 log.println("\tXLayer has been imported -- OK");
112 res &= true;
114 } catch (com.sun.star.lang.NullPointerException ne) {
115 res &= false;
116 log.println("\tExpected exception "+ne+" was thrown -- FAILED");
117 } catch (com.sun.star.configuration.backend.MalformedDataException mde) {
118 res &= false;
119 log.println("\tWrong Expected "+mde+" exception was thrown -- FAILED");
120 } catch (com.sun.star.lang.IllegalArgumentException iae) {
121 res &= false;
122 log.println("\tWrong Expected "+iae+" exception was thrown -- FAILED");
123 } catch (com.sun.star.lang.WrappedTargetException wte) {
124 res &= false;
125 log.println("\tWrong Expected "+wte+" exception was thrown -- FAILED");
128 tRes.tested("importLayerForEntity()",res);
131 public void _setTargetBackend() {
132 requiredMethod("getTargetBackend()");
133 boolean res = false;
134 log.println("checking for exception if argument null is given");
135 try {
136 oObj.setTargetBackend(null);
137 log.println("\tException expected -- FAILED");
138 } catch (com.sun.star.lang.NullPointerException ne) {
139 res = true;
140 log.println("\tExpected exception was thrown -- OK");
143 log.println("checking argument previously gained by getTargetBackend");
144 try {
145 oObj.setTargetBackend(xBackend);
146 log.println("\t No Exception thrown -- OK");
147 res &= true;
148 } catch (com.sun.star.lang.NullPointerException ne) {
149 res &= false;
150 log.println("\tException was thrown -- FAILED");
153 tRes.tested("setTargetBackend()",res);