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
= "";
29 public XBackendEntities oObj
;
32 public void before() {
33 adm
= (String
) tEnv
.getObjRelation("NoAdmin");
36 public void _getAdminEntity() {
40 "This component doesn't have an AdminEntity, setting it to default");
41 tRes
.tested("getAdminEntity()", true);
46 AdminEntity
= oObj
.getAdminEntity();
48 boolean res
= AdminEntity
.endsWith("/share/registry");
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");
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() {
73 boolean localRes
= true;
76 localRes
= oObj
.isEqualEntity("", "");
78 "No Exception thrown for isEqualEntity(\"\",\"\") -- FAILED");
80 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
81 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
83 } catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
84 log
.println("Expected Exception (" + e
+ ") -- OK");
89 localRes
= oObj
.isEqualEntity(AdminEntity
, AdminEntity
);
93 "isEqualEntity(AdminEntity,AdminEntity) returns false -- FAILED");
98 localRes
= oObj
.isEqualEntity(OwnerEntity
, OwnerEntity
);
102 "isEqualEntity(OwnerEntity,OwnerEntity) returns false -- FAILED");
107 localRes
= !oObj
.isEqualEntity(AdminEntity
, OwnerEntity
);
111 "isEqualEntity(AdminEntity,OwnerEntity) returns true -- FAILED");
115 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
116 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
118 } catch (com
.sun
.star
.lang
.IllegalArgumentException e
) {
119 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
123 tRes
.tested("isEqualEntity()", res
);
126 public void _supportsEntity() {
128 boolean localRes
= true;
131 localRes
= oObj
.supportsEntity("illegal");
133 "No Exception thrown for supportsEntity(\"\") -- FAILED");
135 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
136 log
.println("Expected Exception (" + e
+ ") -- OK");
141 localRes
= oObj
.supportsEntity(AdminEntity
);
144 Object msb
= tEnv
.getObjRelation("MSB") ;
146 localRes
= !localRes
;
147 log
.println("This Component doesn't support the AdminEntity");
153 "supportsEntity(AdminEntity) returns false -- FAILED");
158 localRes
= oObj
.supportsEntity(OwnerEntity
);
162 "supportsEntity(OwnerEntity) returns false -- FAILED");
166 } catch (com
.sun
.star
.configuration
.backend
.BackendAccessException e
) {
167 log
.println("Unexpected Exception (" + e
+ ") -- FAILED");
171 tRes
.tested("supportsEntity()", res
);