Branch libreoffice-5-0-4
[LibreOffice.git] / qadevOOo / tests / java / ifc / xml / _UserDefinedAttributesSupplier.java
blob28ff8a00379c8871a7e2b544747dbce598eba09a
1 /*
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 .
19 package ifc.xml;
20 import com.sun.star.container.XNameContainer;
21 import com.sun.star.uno.AnyConverter;
22 import com.sun.star.uno.Type;
23 import com.sun.star.xml.AttributeData;
25 public class _UserDefinedAttributesSupplier extends lib.MultiPropertyTest {
27 public void _UserDefinedAttributes() {
28 XNameContainer uda = null;
29 boolean res = false;
30 try {
31 uda = (XNameContainer) AnyConverter.toObject(
32 new Type(XNameContainer.class),
33 oObj.getPropertyValue("UserDefinedAttributes"));
34 AttributeData attr = new AttributeData();
35 attr.Namespace = "http://www.sun.com/staroffice/apitest/Chartprop";
36 attr.Type="CDATA";
37 attr.Value="true";
38 uda.insertByName("Chartprop:has-first-alien-attribute",attr);
39 uda.getElementNames();
40 oObj.setPropertyValue("UserDefinedAttributes",uda);
41 uda = (XNameContainer) AnyConverter.toObject(
42 new Type(XNameContainer.class),
43 oObj.getPropertyValue("UserDefinedAttributes"));
44 uda.getElementNames();
45 uda.getByName("Chartprop:has-first-alien-attribute");
46 res = true;
47 } catch (com.sun.star.beans.UnknownPropertyException upe) {
48 log.println("Don't know the Property 'UserDefinedAttributes'");
49 } catch (com.sun.star.lang.WrappedTargetException wte) {
50 log.println("WrappedTargetException while getting Property 'UserDefinedAttributes'");
51 } catch (com.sun.star.container.NoSuchElementException nee) {
52 log.println("added Element isn't part of the NameContainer");
53 } catch (com.sun.star.lang.IllegalArgumentException iae) {
54 log.println("IllegalArgumentException while getting Property 'UserDefinedAttributes'");
55 } catch (com.sun.star.beans.PropertyVetoException pve) {
56 log.println("PropertyVetoException while getting Property 'UserDefinedAttributes'");
57 } catch (com.sun.star.container.ElementExistException eee) {
58 log.println("ElementExistException while getting Property 'UserDefinedAttributes'");
60 tRes.tested("UserDefinedAttributes",res);