1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 package ifc.beans;
25 
26 import lib.MultiMethodTest;
27 import lib.Status;
28 import lib.StatusException;
29 
30 import com.sun.star.beans.XExactName;
31 
32 
33 public class _XExactName extends MultiMethodTest {
34     protected String expectedName = "";
35     public XExactName oObj = null;
36 
_getExactName()37     public void _getExactName() {
38         String nameFor = expectedName.toLowerCase();
39 
40         log.println("Getting exact name for " + nameFor);
41 
42         String getting = oObj.getExactName(nameFor);
43 
44         boolean res = true;
45 
46         if (getting == null) {
47             res = false;
48         } else {
49             res = getting.equals(expectedName);
50         }
51 
52         if (!res) {
53             log.println("didn't get the expected Name:");
54             log.println("getting: " + getting);
55             log.println("Expected: " + expectedName);
56         }
57 
58         nameFor = expectedName.toUpperCase();
59 
60         log.println("Getting exact name for " + nameFor);
61         getting = oObj.getExactName(nameFor);
62 
63         if (getting == null) {
64             res = false;
65         } else {
66             res &= getting.equals(expectedName);
67         }
68 
69         if (!getting.equals(expectedName)) {
70             log.println("didn't get the expected Name:");
71             log.println("getting: " + getting);
72             log.println("Expected: " + expectedName);
73         }
74 
75         tRes.tested("getExactName()", res);
76     }
77 
78     /**
79      * Checking if the Object relation expectedName is given
80      * throw a StatusException if not.
81      */
before()82     protected void before() {
83         expectedName = (String) tEnv.getObjRelation("expectedName");
84 
85         if (expectedName == null) {
86             throw new StatusException(Status.failed(
87                                               "Object relation expectedName is missing"));
88         }
89     }
90 }