Update ooo320-m1
[ooovba.git] / qadevOOo / tests / java / ifc / xml / _UserDefinedAttributeSupplier.java
blob27ce9f20a23153019e1be619aed7fdd4c66bee7f
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: _UserDefinedAttributeSupplier.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 ************************************************************************/
31 package ifc.xml;
32 import com.sun.star.container.XNameContainer;
33 import com.sun.star.uno.AnyConverter;
34 import com.sun.star.uno.Type;
35 import com.sun.star.xml.AttributeData;
37 public class _UserDefinedAttributeSupplier extends lib.MultiPropertyTest {
39 public void _UserDefinedAttributes() {
40 XNameContainer uda = null;
41 boolean res = false;
42 try {
43 uda = (XNameContainer) AnyConverter.toObject(
44 new Type(XNameContainer.class),
45 oObj.getPropertyValue("UserDefinedAttributes"));
46 AttributeData attr = new AttributeData();
47 attr.Namespace = "http://www.sun.com/staroffice/apitest/Chartprop";
48 attr.Type="CDATA";
49 attr.Value="true";
50 uda.insertByName("Chartprop:has-first-alien-attribute",attr);
51 String[] els = uda.getElementNames();
52 oObj.setPropertyValue("UserDefinedAttributes",uda);
53 uda = (XNameContainer) AnyConverter.toObject(
54 new Type(XNameContainer.class),
55 oObj.getPropertyValue("UserDefinedAttributes"));
56 els = uda.getElementNames();
57 Object obj = uda.getByName("Chartprop:has-first-alien-attribute");
58 res = true;
59 } catch (com.sun.star.beans.UnknownPropertyException upe) {
60 log.println("Don't know the Property 'UserDefinedAttributes'");
61 } catch (com.sun.star.lang.WrappedTargetException wte) {
62 log.println("WrappedTargetException while getting Property 'UserDefinedAttributes'");
63 } catch (com.sun.star.container.NoSuchElementException nee) {
64 log.println("added Element isn't part of the NameContainer");
65 } catch (com.sun.star.lang.IllegalArgumentException iae) {
66 log.println("IllegalArgumentException while getting Property 'UserDefinedAttributes'");
67 } catch (com.sun.star.beans.PropertyVetoException pve) {
68 log.println("PropertyVetoException while getting Property 'UserDefinedAttributes'");
69 } catch (com.sun.star.container.ElementExistException eee) {
70 log.println("ElementExistException while getting Property 'UserDefinedAttributes'");
72 tRes.tested("UserDefinedAttributes",res);