cid#1607171 Data race condition
[LibreOffice.git] / qadevOOo / tests / java / ifc / configuration / backend / _XBackendEntities.java
blob5ed64c292105586403c3d06c5342adab4466ebf4
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 .
18 package ifc.configuration.backend;
20 import com.sun.star.configuration.backend.XBackendEntities;
22 import lib.MultiMethodTest;
25 public class _XBackendEntities extends MultiMethodTest {
26 String AdminEntity = "";
27 String OwnerEntity = "";
28 String adm = "";
29 public XBackendEntities oObj;
31 @Override
32 public void before() {
33 adm = (String) tEnv.getObjRelation("NoAdmin");
36 public void _getAdminEntity() {
37 if (adm != null) {
38 AdminEntity = adm;
39 log.println(
40 "This component doesn't have an AdminEntity, setting it to default");
41 tRes.tested("getAdminEntity()", true);
43 return;
46 AdminEntity = oObj.getAdminEntity();
48 boolean res = AdminEntity.endsWith("/share/registry");
50 if (!res) {
51 log.println("Expected the Entity to end with /share/registry");
52 log.println("getting: " + AdminEntity + " -- FAILED");
55 tRes.tested("getAdminEntity()", res);
58 public void _getOwnerEntity() {
59 OwnerEntity = oObj.getOwnerEntity();
61 boolean res = OwnerEntity.endsWith("/user/registry");
63 if (!res) {
64 log.println("Expected the Entity to end with /user/registry");
65 log.println("getting: " + OwnerEntity + " -- FAILED");
68 tRes.tested("getOwnerEntity()", res);
71 public void _isEqualEntity() {
72 boolean res = true;
73 boolean localRes = true;
75 try {
76 localRes = oObj.isEqualEntity("", "");
77 log.println(
78 "No Exception thrown for isEqualEntity(\"\",\"\") -- FAILED");
79 res &= false;
80 } catch (com.sun.star.configuration.backend.BackendAccessException e) {
81 log.println("Unexpected Exception (" + e + ") -- FAILED");
82 res &= false;
83 } catch (com.sun.star.lang.IllegalArgumentException e) {
84 log.println("Expected Exception (" + e + ") -- OK");
85 res &= true;
88 try {
89 localRes = oObj.isEqualEntity(AdminEntity, AdminEntity);
91 if (!localRes) {
92 log.println(
93 "isEqualEntity(AdminEntity,AdminEntity) returns false -- FAILED");
96 res &= localRes;
98 localRes = oObj.isEqualEntity(OwnerEntity, OwnerEntity);
100 if (!localRes) {
101 log.println(
102 "isEqualEntity(OwnerEntity,OwnerEntity) returns false -- FAILED");
105 res &= localRes;
107 localRes = !oObj.isEqualEntity(AdminEntity, OwnerEntity);
109 if (!localRes) {
110 log.println(
111 "isEqualEntity(AdminEntity,OwnerEntity) returns true -- FAILED");
114 res &= localRes;
115 } catch (com.sun.star.configuration.backend.BackendAccessException e) {
116 log.println("Unexpected Exception (" + e + ") -- FAILED");
117 res &= false;
118 } catch (com.sun.star.lang.IllegalArgumentException e) {
119 log.println("Unexpected Exception (" + e + ") -- FAILED");
120 res &= false;
123 tRes.tested("isEqualEntity()", res);
126 public void _supportsEntity() {
127 boolean res = true;
128 boolean localRes = true;
130 try {
131 localRes = oObj.supportsEntity("illegal");
132 log.println(
133 "No Exception thrown for supportsEntity(\"\") -- FAILED");
134 res &= false;
135 } catch (com.sun.star.configuration.backend.BackendAccessException e) {
136 log.println("Expected Exception (" + e + ") -- OK");
137 res &= true;
140 try {
141 localRes = oObj.supportsEntity(AdminEntity);
143 if (adm != null) {
144 Object msb = tEnv.getObjRelation("MSB") ;
145 if (msb == null){
146 localRes = !localRes;
147 log.println("This Component doesn't support the AdminEntity");
151 if (!localRes) {
152 log.println(
153 "supportsEntity(AdminEntity) returns false -- FAILED");
156 res &= localRes;
158 localRes = oObj.supportsEntity(OwnerEntity);
160 if (!localRes) {
161 log.println(
162 "supportsEntity(OwnerEntity) returns false -- FAILED");
165 res &= localRes;
166 } catch (com.sun.star.configuration.backend.BackendAccessException e) {
167 log.println("Unexpected Exception (" + e + ") -- FAILED");
168 res &= false;
171 tRes.tested("supportsEntity()", res);