1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the "License"); 7 * you may not use this file except in compliance with the License. 8 * You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, software 13 * distributed under the License is distributed on an "AS IS" BASIS, 14 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 * See the License for the specific language governing permissions and 16 * limitations under the License. 17 */ 18 /* 19 * $Id$ 20 */ 21 22 /* 23 * 24 * TransformStateDatalet.java 25 * 26 */ 27 package org.apache.qetest.xalanj2; 28 29 import java.util.Hashtable; 30 import java.util.Properties; 31 32 import org.apache.qetest.Datalet; 33 34 /** 35 * Datalet for holding ExpectedTransformState objects. 36 * 37 * @author Shane_Curcuru@lotus.com 38 * @version $Id$ 39 */ 40 public class TransformStateDatalet implements Datalet 41 { 42 //// Items associated with the normal test 43 /** URL of the stylesheet; default:.../identity.xsl. */ 44 public String inputName = "tests/api/trax/identity.xsl"; 45 46 /** URL of the xml document; default:.../identity.xml. */ 47 public String xmlName = "tests/api/trax/identity.xml"; 48 49 /** URL to put output into; default:TransformStateDatalet.out. */ 50 public String outputName = "TransformStateDatalet.out"; 51 52 /** URL of the a gold file or data; default:.../identity.out. */ 53 public String goldName = "tests/api-gold/trax/identity.out"; 54 55 /** 56 * A Hashtable of ExpectedTransformState objects to validate. 57 * Users should put ExpectedTransformState objects in here with 58 * some sort of hashKey that they want to use. 59 */ 60 /*********************************************** 61 // Comment out validation using ExpectedObjects since they hang 28-Jun-01 -sc 62 public Hashtable expectedTransformStates = new Hashtable(); 63 // Comment out validation using ExpectedObjects since they hang 28-Jun-01 -sc 64 ***********************************************/ 65 66 /** 67 * Cheap-o hash of items to validate for column 99. 68 * Temporary use until we solve problem in TransformStateTestlet: 69 * "Comment out validation using ExpectedObjects since they hang 28-Jun-01 -sc". 70 */ 71 public Hashtable validate99 = new Hashtable(); 72 73 74 /** Description of what this Datalet tests. */ 75 protected String description = "TransformStateDatalet: String inputName, String xmlName, String outputName, String goldName, String flavor; plus second Templates object"; 76 77 78 /** 79 * No argument constructor is a no-op. 80 */ TransformStateDatalet()81 public TransformStateDatalet() { /* no-op */ } 82 83 84 /** 85 * Initialize this datalet from a string, perhaps from 86 * a command line. 87 * We will parse the command line with whitespace and fill 88 * in our member variables in order: 89 * <pre>inputName, xmlName, outputName, goldName, flavor</pre>, 90 * if there are too few tokens, remaining variables will default. 91 */ TransformStateDatalet(String args)92 public TransformStateDatalet(String args) 93 { 94 load(args); 95 } 96 97 98 /** 99 * Accesor method for a brief description of this Datalet. 100 * 101 * @return String describing the specific set of data 102 * this Datalet contains (can often be used as the description 103 * of any check() calls made from the Testlet). 104 */ getDescription()105 public String getDescription() 106 { 107 return description; 108 } 109 110 111 /** 112 * Accesor method for a brief description of this Datalet. 113 * 114 * @param s description to use for this Datalet. 115 */ setDescription(String s)116 public void setDescription(String s) 117 { 118 description = s; 119 } 120 121 122 /** 123 * Load fields of this Datalet from a Hashtable. 124 * Caller must provide data for all of our fields. 125 * //@todo NOT FULLY IMPLEMENTED!. 126 * 127 * @param Hashtable to load 128 */ load(Hashtable h)129 public void load(Hashtable h) 130 { 131 if (null == h) 132 return; //@todo should this have a return val or exception? 133 134 inputName = (String)h.get("inputName"); 135 xmlName = (String)h.get("xmlName"); 136 outputName = (String)h.get("outputName"); 137 goldName = (String)h.get("goldName"); 138 } 139 140 141 /** 142 * Load fields of this Datalet from a Properties. 143 * Caller must provide data for all of our fields. 144 * //@todo NOT FULLY IMPLEMENTED!. 145 * 146 * @param Hashtable to load 147 */ load(Properties p)148 public void load(Properties p) 149 { 150 if (null == p) 151 return; //@todo should this have a return val or exception? 152 153 inputName = (String)p.getProperty("inputName"); 154 xmlName = (String)p.getProperty("xmlName"); 155 outputName = (String)p.getProperty("outputName"); 156 goldName = (String)p.getProperty("goldName"); 157 } 158 /** 159 * Load fields of this Datalet from a String. 160 * NOT IMPLEMENTED! No easy way to load the Templates from string. 161 * 162 * @param s String to load 163 */ load(String s)164 public void load(String s) 165 { 166 throw new RuntimeException("TransformStateDatalet.load(String) not implemented!"); 167 } 168 /** 169 * Load fields of this Datalet from a String[]. 170 * NOT IMPLEMENTED! No easy way to load the Templates from string. 171 * 172 * @param s String array to load 173 */ load(String[] s)174 public void load(String[] s) 175 { 176 throw new RuntimeException("TransformStateDatalet.load(String[]) not implemented!"); 177 } 178 } // end of class TransformStateDatalet 179 180