       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.io.IOException;
      30 import java.util.Date;
      31 import java.util.LinkedHashMap;
      32
      33 import com.sun.javatest.util.XMLWriter;
      34
      35 /*import javax.xml.bind.annotation.XmlAccessType;
      36  import javax.xml.bind.annotation.XmlAccessorType;
      37  import javax.xml.bind.annotation.XmlAttribute;
      38  import javax.xml.bind.annotation.XmlElement;
      39  import javax.xml.bind.annotation.XmlType;
      40  import javax.xml.bind.annotation.adapters.XmlJavaTypeAdapter;
      41  */
      42
      43 /**
      44  *
      45  *         The analysis setting is meant to allow remote groups to waive or
      46  *         accept the pass/fail status of the test using E-mail.
      47  *
      48  *
      49  * <p>Java class for TestCase complex type.
      50  *
      51  * <p>The following schema fragment specifies the expected content contained within this class.
      52  *
      53  * <pre>
      54  * &lt;complexType name="TestCase">
      55  *   &lt;complexContent>
      56  *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
      57  *       &lt;sequence>
      58  *         &lt;element name="name" type="{http://www.w3.org/2001/XMLSchema}string"/>
      59  *         &lt;element name="status" type="{http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema}Status" minOccurs="0"/>
      60  *         &lt;element name="starttime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
      61  *         &lt;element name="endtime" type="{http://www.w3.org/2001/XMLSchema}dateTime" minOccurs="0"/>
      62  *         &lt;element name="attributes" type="{http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema}TestAttributes" minOccurs="0"/>
      63  *         &lt;element name="description" type="{http://www.w3.org/2001/XMLSchema}string" minOccurs="0"/>
      64  *       &lt;/sequence>
      65  *       &lt;attribute name="analysis" default="accept">
      66  *         &lt;simpleType>
      67  *           &lt;restriction base="{http://www.w3.org/2001/XMLSchema}string">
      68  *             &lt;enumeration value="accept"/>
      69  *             &lt;enumeration value="waive"/>
      70  *           &lt;/restriction>
      71  *         &lt;/simpleType>
      72  *       &lt;/attribute>
      73  *       &lt;attribute name="id" use="required" type="{http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema}IDWithColon" />
      74  *     &lt;/restriction>
      75  *   &lt;/complexContent>
      76  * &lt;/complexType>
      77  * </pre>
      78  *
      79  *
      80  */
      81 /*@XmlAccessorType(XmlAccessType.FIELD)
      82  @XmlType(name = "TestCase", propOrder = {
      83  "name",
      84  "status",
      85  "starttime",
      86  "endtime",
      87  "attributes",
      88  "description"
      89  })*/
      90 public class COFTestCase extends COFItem {
      91         static long count = 0;
      92
      93         static LinkedHashMap xmlAttributes;
      94
      95         static LinkedHashMap xmlElements;
      96
      97         static String xmlTagName;
      98
      99         static {
     100                 xmlTagName = "testcase";
     101                 xmlElements = new LinkedHashMap();
     102                 xmlElements.put("name", "name");
     103                 xmlElements.put("status", "status");
     104                 xmlElements.put("starttime", "starttime");
     105                 xmlElements.put("endtime", "endtime");
     106                 xmlElements.put("attributes", "attributes");
     107                 xmlElements.put("description", "description");
     108                 xmlAttributes = new LinkedHashMap();
     109                 xmlAttributes.put("id", "id");
     110 //              xmlAttributes.put("analysis", "analysis");
     111         }
     112
     113         //    @XmlAttribute
     114         protected String analysis;
     115
     116         //    @XmlElement(namespace = "http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema")
     117         protected COFTestAttributes attributes;
     118
     119         //    @XmlElement(namespace = "http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema")
     120         protected String description;
     121
     122         //    @XmlElement(namespace = "http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema", type = String.class)
     123         //    @XmlJavaTypeAdapter(Adapter1 .class)
     124         protected Date endtime;
     125
     126         //    @XmlAttribute(required = true)
     127         protected String id;
     128
     129         final long idNum = count++;
     130
     131         //    @XmlElement(namespace = "http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema", required = true)
     132         protected String name;
     133
     134         //    @XmlElement(namespace = "http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema", type = String.class)
     135         //    @XmlJavaTypeAdapter(Adapter1 .class)
     136         protected Date starttime;
     137
     138         //    @XmlElement(namespace = "http://qare.sfbay.sun.com/projects/COF/2003/2_0_2/Schema")
     139         protected COFStatus status;
     140
     141         /**
     142          * Gets the value of the analysis property.
     143          *
     144          * @return
     145          *     possible object is
     146          *     {@link String }
     147          *
     148          */
     149         public String getAnalysis() {
     150                 if (analysis == null) {
     151                         return "accept";
     152                 } else {
     153                         return analysis;
     154                 }
     155         }
     156
     157         /**
     158          * Gets the value of the attributes property.
     159          *
     160          * @return
     161          *     possible object is
     162          *     {@link COFTestAttributes }
     163          *
     164          */
     165         public COFTestAttributes getAttributes() {
     166                 return attributes;
     167         }
     168
     169         /**
     170          * Gets the value of the description property.
     171          *
     172          * @return
     173          *     possible object is
     174          *     {@link String }
     175          *
     176          */
     177         public String getDescription() {
     178                 return description;
     179         }
     180
     181         /**
     182          * Gets the value of the endtime property.
     183          *
     184          * @return
     185          *     possible object is
     186          *     {@link String }
     187          *
     188          */
     189         public Date getEndtime() {
     190                 return endtime;
     191         }
     192
     193         /**
     194          * Gets the value of the id property.
     195          *
     196          * @return
     197          *     possible object is
     198          *     {@link String }
     199          *
     200          */
     201         public String getId() {
     202                 return name + ":" + idNum;
     203         }
     204
     205         LinkedHashMap getItemAttributes() {
     206                 return xmlAttributes;
     207         }
     208
     209         LinkedHashMap getItemElements() {
     210                 return xmlElements;
     211         }
     212
     213         String getItemTagName() {
     214                 return xmlTagName;
     215         }
     216
     217         /**
     218          * Gets the value of the name property.
     219          *
     220          * @return
     221          *     possible object is
     222          *     {@link String }
     223          *
     224          */
     225         public String getName() {
     226                 return name;
     227         }
     228
     229         /**
     230          * Gets the value of the starttime property.
     231          *
     232          * @return
     233          *     possible object is
     234          *     {@link String }
     235          *
     236          */
     237         public Date getStarttime() {
     238                 return starttime;
     239         }
     240
     241         /**
     242          * Gets the value of the status property.
     243          *
     244          * @return
     245          *     possible object is
     246          *     {@link COFStatus }
     247          *
     248          */
     249         public COFStatus getStatus() {
     250                 return status;
     251         }
     252
     253         /**
     254          * Sets the value of the analysis property.
     255          *
     256          * @param value
     257          *     allowed object is
     258          *     {@link String }
     259          *
     260          */
     261         public void setAnalysis(String value) {
     262                 this.analysis = value;
     263         }
     264
     265         /**
     266          * Sets the value of the attributes property.
     267          *
     268          * @param value
     269          *     allowed object is
     270          *     {@link COFTestAttributes }
     271          *
     272          */
     273         public void setAttributes(COFTestAttributes value) {
     274                 this.attributes = value;
     275         }
     276
     277         /**
     278          * Sets the value of the description property.
     279          *
     280          * @param value
     281          *     allowed object is
     282          *     {@link String }
     283          *
     284          */
     285         public void setDescription(String value) {
     286                 this.description = value;
     287         }
     288
     289         /**
     290          * Sets the value of the endtime property.
     291          *
     292          * @param value
     293          *     allowed object is
     294          *     {@link String }
     295          *
     296          */
     297         public void setEndtime(Date value) {
     298                 this.endtime = value;
     299         }
     300
     301         /**
     302          * Sets the value of the name property.
     303          *
     304          * @param value
     305          *     allowed object is
     306          *     {@link String }
     307          *
     308          */
     309         public void setName(String value) {
     310                 this.name = value;
     311         }
     312
     313         /**
     314          * Sets the value of the starttime property.
     315          *
     316          * @param value
     317          *     allowed object is
     318          *     {@link String }
     319          *
     320          */
     321         public void setStarttime(Date value) {
     322                 this.starttime = value;
     323         }
     324
     325         /**
     326          * Sets the value of the status property.
     327          *
     328          * @param value
     329          *     allowed object is
     330          *     {@link COFStatus }
     331          *
     332          */
     333         public void setStatus(COFStatus value) {
     334                 this.status = value;
     335         }
     336
     337         /* (non-Javadoc)
     338          * @see com.sun.javatest.cof.COFItem#write(com.sun.javatest.util.XMLWriter)
     339          */
     340         void write(XMLWriter out) throws IOException {
     341                 out.newLine();
     342                 super.write(out);
     343         }
     344 }