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 package ifc.container; 24 25 import com.sun.star.container.XHierarchicalName; 26 27 import lib.MultiMethodTest; 28 import lib.Status; 29 import lib.StatusException; 30 31 32 public class _XHierarchicalName extends MultiMethodTest { 33 public XHierarchicalName oObj; 34 _composeHierarchicalName()35 public void _composeHierarchicalName() { 36 String expName = (String) tEnv.getObjRelation("HierachicalName"); 37 String element = (String) tEnv.getObjRelation("ElementName"); 38 boolean res = false; 39 40 try { 41 String hn = oObj.composeHierarchicalName(element); 42 res = hn.startsWith(expName); 43 44 if (!res) { 45 log.println("Getting : " + hn + 46 " but expected it to start with " + expName); 47 } 48 } catch (com.sun.star.lang.IllegalArgumentException e) { 49 log.println("Exception " + e.getMessage()); 50 } catch (com.sun.star.lang.NoSupportException e) { 51 log.println("Exception " + e.getMessage()); 52 } 53 54 tRes.tested("composeHierarchicalName()", res); 55 } 56 _getHierarchicalName()57 public void _getHierarchicalName() { 58 String hName = oObj.getHierarchicalName(); 59 String expName = (String) tEnv.getObjRelation("HierachicalName"); 60 boolean res = true; 61 System.out.println("### "+hName); 62 if (expName != null) { 63 res = hName.startsWith(expName); 64 65 if (!res) { 66 log.println("Expected the name to start with " + expName); 67 log.println("got " + hName); 68 } 69 } else { 70 throw new StatusException(Status.failed( 71 "ObjectRelation 'HierachicalName' missing")); 72 } 73 74 tRes.tested("getHierarchicalName()", res); 75 } 76 }