1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: _XBackendEntities.java,v $
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
= "";
41 public XBackendEntities oObj
;
43 public void before() {
44 adm
= (String
) tEnv
.getObjRelation("NoAdmin");
47 public void _getAdminEntity() {
51 "This component doesn't have an AdminEntity, setting it to default");
52 tRes
.tested("getAdminEntity()", true);
57 AdminEntity
= oObj
.getAdminEntity();
59 boolean res
= AdminEntity
.endsWith("/share/registry");
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");
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() {
84 boolean localRes
= true;
87 localRes
= oObj
.isEqualEntity("", "");
89 "No Exception thrown for isEqualEntity(\"\",\"\") -- FAILED");
91 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
92 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
94 } catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
95 log
.println("Expected Exception (" + e
+ ") -- OK");
100 localRes
= oObj
.isEqualEntity(AdminEntity
, AdminEntity
);
104 "isEqualEntity(AdminEntity,AdminEntity) returns false -- FAILED");
109 localRes
= oObj
.isEqualEntity(OwnerEntity
, OwnerEntity
);
113 "isEqualEntity(OwnerEntity,OwnerEntity) returns false -- FAILED");
118 localRes
= !oObj
.isEqualEntity(AdminEntity
, OwnerEntity
);
122 "isEqualEntity(AdminEntity,OwnerEntity) returns true -- FAILED");
126 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
127 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
129 } catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
130 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
134 tRes
.tested("isEqualEntity()", res
);
137 public void _supportsEntity() {
139 boolean localRes
= true;
142 localRes
= oObj
.supportsEntity("illegal");
144 "No Exception thrown for supportsEntity(\"\") -- FAILED");
146 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
147 log
.println("Expected Exception (" + e
+ ") -- OK");
152 localRes
= oObj
.supportsEntity(AdminEntity
);
155 Object msb
= tEnv
.getObjRelation("MSB") ;
157 localRes
= !localRes
;
158 log
.println("This Component doesn't support the AdminEntity");
164 "supportsEntity(AdminEntity) returns false -- FAILED");
169 localRes
= oObj
.supportsEntity(OwnerEntity
);
173 "supportsEntity(OwnerEntity) returns false -- FAILED");
177 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
178 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
182 tRes
.tested("supportsEntity()", res
);