       1 /*
       2  * $Id$
       3  *
       4  * Copyright (c) 2006, 2009, Oracle and/or its affiliates. All rights reserved.
       5  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       6  *
       7  * This code is free software; you can redistribute it and/or modify it
       8  * under the terms of the GNU General Public License version 2 only, as
       9  * published by the Free Software Foundation.  Oracle designates this
      10  * particular file as subject to the "Classpath" exception as provided
      11  * by Oracle in the LICENSE file that accompanied this code.
      12  *
      13  * This code is distributed in the hope that it will be useful, but WITHOUT
      14  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
      15  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
      16  * version 2 for more details (a copy is included in the LICENSE file that
      17  * accompanied this code).
      18  *
      19  * You should have received a copy of the GNU General Public License version
      20  * 2 along with this work; if not, write to the Free Software Foundation,
      21  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
      22  *
      23  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
      24  * or visit www.oracle.com if you need additional information or have any
      25  * questions.
      26  */
      27 package com.sun.javatest.cof;
      28
      29 import java.util.ArrayList;
      30 import java.util.LinkedHashMap;
      31 import java.util.List;
      32 /*import javax.xml.bind.annotation.XmlAccessType;
      33 import javax.xml.bind.annotation.XmlAccessorType;
      34 import javax.xml.bind.annotation.XmlElement;
      35 import javax.xml.bind.annotation.XmlType;
      36 */
      37
      38 /**
      39  *
      40  *         In general, a Java command line flag argument that it is agreed
      41  *         will get tracked as an attribute, say -foo,will get tracked by a
      42  *         test attribute
      43  *
      44  * <pre>
      45  * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;name xmlns:cof="http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;foo&lt;/name&gt;
      46  * </pre>
      47  *
      48  *         without a corresponding value element. A Java command line
      49  *         argument pair "-foo bar" will get tracked by a test attribute
      50  *
      51  * <pre>
      52  * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;name xmlns:cof="http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;foo&lt;/name&gt;
      53  * </pre>
      54  *
      55  * <pre>
      56  * &lt;?xml version="1.0" encoding="UTF-8"?&gt;&lt;value xmlns:cof="http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema" xmlns:jxb="http://java.sun.com/xml/ns/jaxb" xmlns:xsd="http://www.w3.org/2001/XMLSchema"&gt;bar&lt;/value&gt;
      57  * </pre>
      58  *
      59  *         .
      60  *
      61  *
      62  * <p>Java class for TestAttribute complex type.
      63  *
      64  * <p>The following schema fragment specifies the expected content contained within this class.
      65  *
      66  * <pre>
      67  * &lt;complexType name="TestAttribute">
      68  *   &lt;complexContent>
      69  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
      70  *       &lt;sequence>
      71  *         &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded"/>
      72  *         &lt;element name="value" type="{http://www.w3.org/2001/XMLSchema}string" maxOccurs="unbounded" minOccurs="0"/>
      73  *       &lt;/sequence>
      74  *     &lt;/restriction>
      75  *   &lt;/complexContent>
      76  * &lt;/complexType>
      77  * </pre>
      78  *
      79  *
      80  */
      81 /*@XmlAccessorType(XmlAccessType.FIELD)
      82 @XmlType(name = "TestAttribute", propOrder = {
      83     "name",
      84     "value"
      85 })*/
      86 public class COFTestAttribute extends COFItem{
      87
      88 static LinkedHashMap<String, String> xmlAttributes;
      89 static LinkedHashMap<String, String> xmlElements;
      90
      91     static String xmlTagName;
      92
      93     static {
      94                 xmlElements = new LinkedHashMap<>();
      95                 xmlElements.put("name","name");
      96                 xmlElements.put("value","value");
      97                 xmlTagName = "attribute";
      98         }
      99
     100     //    @XmlElement(namespace = "http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema", required = true)
     101     protected List<String> name;
     102
     103         //    @XmlElement(namespace = "http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema", required = true)
     104     protected List<String> value;
     105
     106         public COFTestAttribute(String name, String value) {
     107                 this.getName().add(name);
     108                 this.getValue().add(value);
     109         }
     110
     111         LinkedHashMap<String, String> getItemAttributes() {
     112                 return xmlAttributes;
     113         }
     114
     115         LinkedHashMap<String, String> getItemElements() {
     116                 return xmlElements;
     117         }
     118
     119         String getItemTagName() {
     120                 return xmlTagName;
     121         }
     122
     123         /**
     124      * Gets the value of the name property.
     125      *
     126      * <p>
     127      * This accessor method returns a reference to the live list,
     128      * not a snapshot. Therefore any modification you make to the
     129      * returned list will be present inside the JAXB object.
     130      * This is why there is not a <CODE>set</CODE> method for the name property.
     131      *
     132      * <p>
     133      * For example, to add a new item, do as follows:
     134      * <pre>
     135      *    getName().add(newItem);
     136      * </pre>
     137      *
     138      *
     139      * <p>
     140      * Objects of the following type(s) are allowed in the list
     141      * {@link String }
     142      *
     143      *
     144      */
     145     public List<String> getName() {
     146         if (name == null) {
     147             name = new ArrayList<>();
     148         }
     149         return this.name;
     150     }
     151
     152         /**
     153      * Gets the value of the value property.
     154      *
     155      * <p>
     156      * This accessor method returns a reference to the live list,
     157      * not a snapshot. Therefore any modification you make to the
     158      * returned list will be present inside the JAXB object.
     159      * This is why there is not a <CODE>set</CODE> method for the value property.
     160      *
     161      * <p>
     162      * For example, to add a new item, do as follows:
     163      * <pre>
     164      *    getValue().add(newItem);
     165      * </pre>
     166      *
     167      *
     168      * <p>
     169      * Objects of the following type(s) are allowed in the list
     170      * {@link String }
     171      *
     172      *
     173      */
     174     public List<String> getValue() {
     175         if (value == null) {
     176             value = new ArrayList<>();
     177         }
     178         return this.value;
     179     }
     180
     181 }