cid#1607171 Data race condition
[LibreOffice.git] / qadevOOo / tests / java / ifc / configuration / backend / _XLayer.java
blob879a3113e2cf2a34ee2f1ac874de40068f5cf678
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.XLayer;
22 import lib.MultiMethodTest;
23 import util.XLayerHandlerImpl;
25 public class _XLayer extends MultiMethodTest {
27 public XLayer oObj;
29 public void _readData() {
30 boolean res = false;
32 log.println("Checking for Exception in case of nul argument");
34 try {
35 oObj.readData(null);
36 } catch (com.sun.star.lang.NullPointerException e) {
37 log.println("Expected Exception -- OK");
38 res = true;
39 } catch (com.sun.star.lang.WrappedTargetException e) {
40 log.println("Unexpected Exception ("+e+") -- FAILED");
41 } catch (com.sun.star.configuration.backend.MalformedDataException e) {
42 log.println("Unexpected Exception ("+e+") -- FAILED");
45 log.println("checking read data with own XLayerHandler implementation");
46 try {
47 XLayerHandlerImpl xLayerHandler = new XLayerHandlerImpl();
48 oObj.readData(xLayerHandler);
49 String implCalled = xLayerHandler.getCalls();
50 log.println(implCalled);
51 int sl = implCalled.indexOf("startLayer");
52 if (sl < 0) {
53 log.println("startLayer wasn't called -- FAILED");
54 res &= false;
55 } else {
56 log.println("startLayer was called -- OK");
57 res &= true;
59 int el = implCalled.indexOf("endLayer");
60 if (el < 0) {
61 log.println("endLayer wasn't called -- FAILED");
62 res &= false;
63 } else {
64 log.println("endLayer was called -- OK");
65 res &= true;
67 } catch (com.sun.star.lang.NullPointerException e) {
68 log.println("Unexpected Exception ("+e+") -- FAILED");
69 res &= false;
70 } catch (com.sun.star.lang.WrappedTargetException e) {
71 log.println("Unexpected Exception ("+e+") -- FAILED");
72 res &= false;
73 } catch (com.sun.star.configuration.backend.MalformedDataException e) {
74 log.println("Unexpected Exception ("+e+") -- FAILED");
75 res &= false;
78 tRes.tested("readData()",res);