Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / configuration / backend / _XBackendEntities.java
blob8ee19542481e25724469fa04990a3b78141c4da2
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XBackendEntities.java,v $
10 * $Revision: 1.5 $
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 ************************************************************************/
30 package ifc.configuration.backend;
32 import com.sun.star.configuration.backend.XBackendEntities;
34 import lib.MultiMethodTest;
37 public class _XBackendEntities extends MultiMethodTest {
38 String AdminEntity = "";
39 String OwnerEntity = "";
40 String adm = "";
41 public XBackendEntities oObj;
43 public void before() {
44 adm = (String) tEnv.getObjRelation("NoAdmin");
47 public void _getAdminEntity() {
48 if (adm != null) {
49 AdminEntity = adm;
50 log.println(
51 "This component doesn't have an AdminEntity, setting it to default");
52 tRes.tested("getAdminEntity()", true);
54 return;
57 AdminEntity = oObj.getAdminEntity();
59 boolean res = AdminEntity.endsWith("/share/registry");
61 if (!res) {
62 log.println("Expected the Entity to end with /share/registry");
63 log.println("getting: " + AdminEntity + " -- FAILED");
66 tRes.tested("getAdminEntity()", res);
69 public void _getOwnerEntity() {
70 OwnerEntity = oObj.getOwnerEntity();
72 boolean res = OwnerEntity.endsWith("/user/registry");
74 if (!res) {
75 log.println("Expected the Entity to end with /user/registry");
76 log.println("getting: " + OwnerEntity + " -- FAILED");
79 tRes.tested("getOwnerEntity()", res);
82 public void _isEqualEntity() {
83 boolean res = true;
84 boolean localRes = true;
86 try {
87 localRes = oObj.isEqualEntity("", "");
88 log.println(
89 "No Exception thrown for isEqualEntity(\"\",\"\") -- FAILED");
90 res &= false;
91 } catch (com.sun.star.configuration.backend.BackendAccessException e) {
92 log.println("Unexpected Exception (" + e + ") -- FAILED");
93 res &= false;
94 } catch (com.sun.star.lang.IllegalArgumentException e) {
95 log.println("Expected Exception (" + e + ") -- OK");
96 res &= true;
99 try {
100 localRes = oObj.isEqualEntity(AdminEntity, AdminEntity);
102 if (!localRes) {
103 log.println(
104 "isEqualEntity(AdminEntity,AdminEntity) returns false -- FAILED");
107 res &= localRes;
109 localRes = oObj.isEqualEntity(OwnerEntity, OwnerEntity);
111 if (!localRes) {
112 log.println(
113 "isEqualEntity(OwnerEntity,OwnerEntity) returns false -- FAILED");
116 res &= localRes;
118 localRes = !oObj.isEqualEntity(AdminEntity, OwnerEntity);
120 if (!localRes) {
121 log.println(
122 "isEqualEntity(AdminEntity,OwnerEntity) returns true -- FAILED");
125 res &= localRes;
126 } catch (com.sun.star.configuration.backend.BackendAccessException e) {
127 log.println("Unexpected Exception (" + e + ") -- FAILED");
128 res &= false;
129 } catch (com.sun.star.lang.IllegalArgumentException e) {
130 log.println("Unexpected Exception (" + e + ") -- FAILED");
131 res &= false;
134 tRes.tested("isEqualEntity()", res);
137 public void _supportsEntity() {
138 boolean res = true;
139 boolean localRes = true;
141 try {
142 localRes = oObj.supportsEntity("illegal");
143 log.println(
144 "No Exception thrown for supportsEntity(\"\") -- FAILED");
145 res &= false;
146 } catch (com.sun.star.configuration.backend.BackendAccessException e) {
147 log.println("Expected Exception (" + e + ") -- OK");
148 res &= true;
151 try {
152 localRes = oObj.supportsEntity(AdminEntity);
154 if (adm != null) {
155 Object msb = tEnv.getObjRelation("MSB") ;
156 if (msb == null){
157 localRes = !localRes;
158 log.println("This Component doesn't support the AdminEntity");
162 if (!localRes) {
163 log.println(
164 "supportsEntity(AdminEntity) returns false -- FAILED");
167 res &= localRes;
169 localRes = oObj.supportsEntity(OwnerEntity);
171 if (!localRes) {
172 log.println(
173 "supportsEntity(OwnerEntity) returns false -- FAILED");
176 res &= localRes;
177 } catch (com.sun.star.configuration.backend.BackendAccessException e) {
178 log.println("Unexpected Exception (" + e + ") -- FAILED");
179 res &= false;
182 tRes.tested("supportsEntity()", res);