Author: tpalsulich
Date: Thu Jan 22 00:36:00 2015
New Revision: 1653724

URL: http://svn.apache.org/r1653724
Log:
OODT-762. Fix directory structure for xmlquery.

Added:
    oodt/trunk/xmlquery/src/test/java/
    oodt/trunk/xmlquery/src/test/java/org/
    oodt/trunk/xmlquery/src/test/java/org/apache/
    oodt/trunk/xmlquery/src/test/java/org/apache/oodt/
    oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/
    
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecFactoryTest.java
   (with props)
    oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecTest.java   
(with props)
    
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedObjectCodecTest.java
   (with props)
    
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedStringCodecTest.java
   (with props)
    
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/EmptyByteArrayCodecTest.java
   (with props)
    oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/HeaderTest.java  
 (with props)
    
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ObjectCodecTest.java 
  (with props)
    
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/QueryElementTest.java
   (with props)
    oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ResultTest.java  
 (with props)
    
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/StringCodecTest.java 
  (with props)
    
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/XMLQueryTest.java   
(with props)
Removed:
    oodt/trunk/xmlquery/src/test/org/

Added: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecFactoryTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecFactoryTest.java?rev=1653724&view=auto
==============================================================================
--- 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecFactoryTest.java
 (added)
+++ 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecFactoryTest.java
 Thu Jan 22 00:36:00 2015
@@ -0,0 +1,61 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.InputStream;
+import org.apache.oodt.commons.io.NullInputStream;
+import org.apache.oodt.xmlquery.CodecFactory; // Imported solely for Javadoc
+import junit.framework.TestCase;
+import org.w3c.dom.Document;
+import org.w3c.dom.Node;
+
+/** Unit test the {@link CodecFactory} class.
+ *
+ * @author Kelly
+ */ 
+public class CodecFactoryTest extends TestCase {
+       /** Construct the test case for the {@link CodecFactory} class. */
+       public CodecFactoryTest(String name) {
+               super(name);
+       }
+
+       public void testInvalidCodec() {
+               try {
+                       Codec codec = 
CodecFactory.createCodec("unknown.class.name");
+                       fail("CodecFactory somehow created an object of an 
unknown class");
+               } catch (RuntimeException good) {}
+       }
+
+       public void testValidCodec() {
+               Codec c1 = 
CodecFactory.createCodec("org.apache.oodt.xmlquery.CodecFactoryTest$TestCodec");
+               assertNotNull(c1);
+               Codec c2 = 
CodecFactory.createCodec("org.apache.oodt.xmlquery.CodecFactoryTest$TestCodec");
+               assertSame(c1, c2);
+       }
+
+       public static class TestCodec implements Codec {
+               public TestCodec() {}
+               public Node encode(Object object, Document doc) { return null; }
+               public Object decode(Node node) { return null; }
+               public long sizeOf(Object obj) { return 0; }
+               public InputStream getInputStream(Object object) {
+                       return new NullInputStream();
+               }
+       }
+}

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecFactoryTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecTest.java?rev=1653724&view=auto
==============================================================================
--- oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecTest.java 
(added)
+++ oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecTest.java 
Thu Jan 22 00:36:00 2015
@@ -0,0 +1,80 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.*;
+import java.util.*;
+import org.apache.oodt.commons.util.*;
+import junit.framework.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+
+/** Unit test a codec.
+ *
+ * @author Kelly
+ */ 
+abstract class CodecTest extends TestCase {
+       /** Construct the test case for a codec. */
+       protected CodecTest(String name) {
+               super(name);
+       }
+
+       /** Test the codec. */
+       protected void runTest(Codec codec) throws Exception {
+               // Test encoding and decoding
+               Document doc = XML.createDocument();
+               Node node = codec.encode(getTestObject(), doc);
+               Object object = codec.decode(node);
+               checkEquality(object);
+
+               // Test size computation
+               assertEquals(getTestSize(), codec.sizeOf(getTestObject()));
+       }
+
+       /** Get the test object to encode.
+        *
+        * @return The test object.
+        */
+       protected Object getTestObject() {
+               return TEST_OBJECT;
+       }
+
+       /**
+        * Get the size of the test object.
+        *
+        * @return Size of the test object in bytes.
+        */
+       protected long getTestSize() {
+               return TEST_SIZE;
+       }
+
+       /** Test the encoded and decoded object for equality with the test 
object.
+        *
+        * @param encodedAndDecoded The encoded and decoded object.
+        */
+       protected void checkEquality(Object encodedAndDecoded) {
+               assertEquals(getTestObject(), encodedAndDecoded);
+       }
+
+       /** The object we'll encode and decode with the codec. */
+       private static final String TEST_OBJECT = "This is my test object.";
+
+       /** Size of the test object in bytes. */
+       private static final long TEST_SIZE = 23;
+}

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CodecTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedObjectCodecTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedObjectCodecTest.java?rev=1653724&view=auto
==============================================================================
--- 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedObjectCodecTest.java
 (added)
+++ 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedObjectCodecTest.java
 Thu Jan 22 00:36:00 2015
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.*;
+import java.util.*;
+import org.apache.oodt.commons.util.*;
+import junit.framework.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+import org.apache.oodt.xmlquery.CompressedObjectCodec; // Imported for javadoc
+
+/** Unit test the {@link CompressedObjectCodec} class.
+ *
+ * @author Kelly
+ */ 
+public class CompressedObjectCodecTest extends CodecTest {
+       /** Construct the test case for the {@link CompressedObjectCodec} 
class. */
+       public CompressedObjectCodecTest(String name) {
+               super(name);
+       }
+
+       public void testIt() throws Exception {
+               
runTest(CodecFactory.createCodec("org.apache.oodt.xmlquery.CompressedObjectCodec"));
+       }
+
+       public long getTestSize() {
+               // Serialization overhead adds a few bytes, so we override the 
method here
+               // with this value:
+               return 30;
+       }
+}

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedObjectCodecTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedStringCodecTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedStringCodecTest.java?rev=1653724&view=auto
==============================================================================
--- 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedStringCodecTest.java
 (added)
+++ 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedStringCodecTest.java
 Thu Jan 22 00:36:00 2015
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.*;
+import java.util.*;
+import org.apache.oodt.xmlquery.CompressedStringCodec; // Imported for Javadoc
+import org.apache.oodt.commons.util.*;
+import junit.framework.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+
+/** Unit test the {@link CompressedStringCodec} class.
+ *
+ * @author Kelly
+ */ 
+public class CompressedStringCodecTest extends CodecTest {
+       /** Construct the test case for the {@link CompressedStringCodec} 
class. */
+       public CompressedStringCodecTest(String name) {
+               super(name);
+       }
+
+       public void testIt() throws Exception {
+               
runTest(CodecFactory.createCodec("org.apache.oodt.xmlquery.CompressedStringCodec"));
+       }
+}

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/CompressedStringCodecTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/EmptyByteArrayCodecTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/EmptyByteArrayCodecTest.java?rev=1653724&view=auto
==============================================================================
--- 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/EmptyByteArrayCodecTest.java
 (added)
+++ 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/EmptyByteArrayCodecTest.java
 Thu Jan 22 00:36:00 2015
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.*;
+import java.util.*;
+import org.apache.oodt.commons.util.*;
+import junit.framework.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+import org.apache.oodt.xmlquery.ByteArrayCodec; // Imported for javadoc
+
+/**
+ * Unit test the {@link ByteArrayCodec} class with an empty byte array.
+ *
+ * @author Kelly
+ */ 
+public class EmptyByteArrayCodecTest extends CodecTest {
+       /** Construct the test case for the {@link ByteArrayCodec} class. */
+       public EmptyByteArrayCodecTest(String name) {
+               super(name);
+       }
+
+       public void testIt() throws Exception {
+               
runTest(CodecFactory.createCodec("org.apache.oodt.xmlquery.ByteArrayCodec"));
+       }
+
+       protected Object getTestObject() {
+               return TEST_OBJECT;
+       }
+
+       protected long getTestSize() {
+               return 0;
+       }
+
+       protected void checkEquality(Object encodedAndDecoded) {
+               assertTrue("Empty byte array codec failed", 
java.util.Arrays.equals(TEST_OBJECT, (byte[]) encodedAndDecoded));
+       }
+
+       private static final byte[] TEST_OBJECT = new byte[0];
+}

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/EmptyByteArrayCodecTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/HeaderTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/HeaderTest.java?rev=1653724&view=auto
==============================================================================
--- oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/HeaderTest.java 
(added)
+++ oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/HeaderTest.java 
Thu Jan 22 00:36:00 2015
@@ -0,0 +1,144 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.*;
+import java.util.*;
+import org.apache.oodt.commons.util.*;
+import junit.framework.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+
+/** Unit test the {@link Header} class.
+ *
+ * @author Kelly
+ */ 
+public class HeaderTest extends TestCase {
+       /** Construct the test case for the {@link Header} class. */
+       public HeaderTest(String name) {
+               super(name);
+       }
+
+       public void testNoArgsCtor() {
+               Header blank = new Header();
+               assertEquals("UNKNOWN", blank.getName());
+               assertNull(blank.getType());
+               assertNull(blank.getUnit());
+       }
+
+       public void testSimpleCtor() {
+               Header simple = new Header("name");
+               assertEquals("name", simple.getName());
+               assertNull(simple.getType());
+               assertNull(simple.getUnit());
+       }
+
+       public void testFullCtor() {
+               Header full = new Header("name", "type", "unit");
+               assertEquals("name", full.getName());
+               assertEquals("type", full.getType());
+               assertEquals("unit", full.getUnit());
+       }               
+
+       public void testSetters() {
+               Header h = new Header("name", "type", "unit");
+
+               assertEquals("name", h.getName());
+               h.setName("newName");
+               assertEquals("newName", h.getName());
+
+               assertEquals("type", h.getType());
+               h.setType("newType");
+               assertEquals("newType", h.getType());
+
+               assertEquals("unit", h.getUnit());
+               h.setUnit("newUnit");
+               assertEquals("newUnit", h.getUnit());
+       }
+
+       public void testObjectMethods() {
+               Header h1 = new Header("name1", "type1", "unit1");
+               Header h2 = new Header("name1", "type1", "unit1");
+               Header h3 = new Header("name2", "type2", "unit2");
+               assertEquals(h1, h1);
+               assertEquals(h1, h2);
+               assertTrue(!h1.equals(h3));
+               Header h4 = (Header) h3.clone();
+               assertEquals(h3, h4);
+               assertTrue(h3 != h4);
+       }
+
+       public void testXML() throws Exception {
+               Document doc = XML.createDocument();
+               Element bogus = doc.createElement("bogus");
+               try {
+                       Header h0 = new Header(bogus);
+                       fail("Header constructor failed to throw exception when 
given invalid XML node");
+               } catch (IllegalArgumentException good) {}
+
+               Header h1 = new Header("name1", "type1", "unit1");
+               Node root = h1.toXML(doc);
+               assertEquals("headerElement", root.getNodeName());
+               NodeList children = root.getChildNodes();
+               for (int i = 0; i < children.getLength(); ++i) {
+                       Node child = children.item(i);
+                       if ("elemName".equals(child.getNodeName())) {
+                               assertEquals("name1", XML.text(child));
+                       } else if ("elemType".equals(child.getNodeName())) {
+                               assertEquals("type1", XML.text(child));
+                       } else if ("elemUnit".equals(child.getNodeName())) {
+                               assertEquals("unit1", XML.text(child));
+                       } else fail("Unknown node \"" + child.getNodeName() + 
"\" in XML result");
+               }
+               Header h2 = new Header(root);
+               assertEquals(h1, h2);
+       }
+
+       public void testMultipleHeaders() throws Exception {
+               Document doc = XML.createDocument();
+               Element resultHeader = doc.createElement("resultHeader");
+               Element headerElement = doc.createElement("headerElement");
+               resultHeader.appendChild(headerElement);
+               XML.add(headerElement, "elemName", "name1");
+               headerElement = doc.createElement("headerElement");
+               resultHeader.appendChild(headerElement);
+               XML.add(headerElement, "elemName", "name2");
+               XML.add(headerElement, "elemType", "type2");
+               headerElement = doc.createElement("headerElement");
+               resultHeader.appendChild(headerElement);
+               XML.add(headerElement, "elemName", "name3");
+               XML.add(headerElement, "elemUnit", "unit3");
+               headerElement = doc.createElement("headerElement");
+               resultHeader.appendChild(headerElement);
+               XML.add(headerElement, "elemName", "name4");
+               XML.add(headerElement, "elemType", "type4");
+               XML.add(headerElement, "elemUnit", "unit4");
+
+               List headers = Header.createHeaders(resultHeader);
+               Header h1 = new Header("name1");
+               Header h2 = new Header("name2", "type2", null);
+               Header h3 = new Header("name3", null, "unit3");
+               Header h4 = new Header("name4", "type4", "unit4");
+               assertEquals(h1, headers.get(0));
+               assertEquals(h2, headers.get(1));
+               assertEquals(h3, headers.get(2));
+               assertEquals(h4, headers.get(3));
+       }
+}
+

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/HeaderTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ObjectCodecTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ObjectCodecTest.java?rev=1653724&view=auto
==============================================================================
--- 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ObjectCodecTest.java 
(added)
+++ 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ObjectCodecTest.java 
Thu Jan 22 00:36:00 2015
@@ -0,0 +1,48 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.*;
+import java.util.*;
+import org.apache.oodt.commons.util.*;
+import junit.framework.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+import org.apache.oodt.xmlquery.ObjectCodec; // Imported for javadoc
+
+/** Unit test the {@link ObjectCodec} class.
+ *
+ * @author Kelly
+ */ 
+public class ObjectCodecTest extends CodecTest {
+       /** Construct the test case for the {@link ObjectCodec} class. */
+       public ObjectCodecTest(String name) {
+               super(name);
+       }
+
+       public void testIt() throws Exception {
+               
runTest(CodecFactory.createCodec("org.apache.oodt.xmlquery.ObjectCodec"));
+       }
+
+       public long getTestSize() {
+               // Serialization overhead adds a few bytes, so we override the 
method here
+               // with this value:
+               return 30;
+       }
+}

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ObjectCodecTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/QueryElementTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/QueryElementTest.java?rev=1653724&view=auto
==============================================================================
--- 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/QueryElementTest.java
 (added)
+++ 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/QueryElementTest.java
 Thu Jan 22 00:36:00 2015
@@ -0,0 +1,96 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.*;
+import java.util.*;
+import org.apache.oodt.commons.util.*;
+import junit.framework.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+
+/** Unit test the {@link QueryElement} class.
+ *
+ * @author Kelly
+ */ 
+public class QueryElementTest extends TestCase {
+       /** Construct the test case for the {@link QueryElement} class. */
+       public QueryElementTest(String name) {
+               super(name);
+       }
+
+       public void testNoArgsCtor() {
+               QueryElement blank = new QueryElement();
+               assertEquals("UNKNOWN", blank.getRole());
+               assertEquals("UNKNOWN", blank.getValue());
+       }
+
+       public void testCtor() {
+               QueryElement full = new QueryElement("role", "value");
+               assertEquals("role", full.getRole());
+               assertEquals("value", full.getValue());
+       }               
+
+       public void testSetters() {
+               QueryElement q = new QueryElement("role", "value");
+
+               assertEquals("role", q.getRole());
+               q.setRole("newRole");
+               assertEquals("newRole", q.getRole());
+               q.setRole(null);
+               assertEquals("UNKNOWN", q.getRole());
+
+               assertEquals("value", q.getValue());
+               q.setValue("newValue");
+               assertEquals("newValue", q.getValue());
+               q.setValue(null);
+               assertEquals("UNKNOWN", q.getValue());
+       }
+
+       public void testObjectMethods() {
+               QueryElement q1 = new QueryElement("a", "1");
+               QueryElement q2 = new QueryElement("a", "1");
+               QueryElement q3 = new QueryElement("b", "2");
+               assertEquals(q1, q1);
+               assertEquals(q1, q2);
+               assertTrue(!q1.equals(q3));
+               QueryElement q4 = (QueryElement) q3.clone();
+               assertEquals(q3, q4);
+               assertTrue(q3 != q4);
+       }
+
+       public void testXML() throws Exception {
+               QueryElement q1 = new QueryElement("a", "1");
+               Document doc = XML.createDocument();
+               Node root = q1.toXML(doc);
+               assertEquals("queryElement", root.getNodeName());
+               NodeList children = root.getChildNodes();
+               for (int i = 0; i < children.getLength(); ++i) {
+                       Node child = children.item(i);
+                       if ("tokenRole".equals(child.getNodeName())) {
+                               assertEquals("a", XML.text(child));
+                       } else if ("tokenValue".equals(child.getNodeName())) {
+                               assertEquals("1", XML.text(child));
+                       } else fail("Unknown node \"" + child.getNodeName() + 
"\" in XML result");
+               }
+               QueryElement q2 = new QueryElement(root);
+               assertEquals(q1, q2);
+       }
+}
+

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/QueryElementTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ResultTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ResultTest.java?rev=1653724&view=auto
==============================================================================
--- oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ResultTest.java 
(added)
+++ oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ResultTest.java 
Thu Jan 22 00:36:00 2015
@@ -0,0 +1,168 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.*;
+import java.util.*;
+import org.apache.oodt.commons.util.*;
+import junit.framework.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+
+/** Unit test the {@link Result} class.
+ *
+ * @author Kelly
+ */ 
+public class ResultTest extends TestCase {
+       /** Construct the test case for the {@link Result} class. */
+       public ResultTest(String name) {
+               super(name);
+       }
+
+       public void testNoArgsCtor() {
+               Result blank = new Result();
+               assertEquals("UNKNOWN", blank.getID());
+               assertEquals("UNKNOWN", blank.getMimeType());
+               assertEquals("UNKNOWN", blank.getProfileID());
+               assertEquals("UNKNOWN", blank.getResourceID());
+               assertEquals(0, blank.getHeaders().size());
+               assertEquals("", blank.getValue());
+               assertTrue(!blank.isClassified());
+               assertEquals(Result.INFINITE, blank.getValidity());
+       }
+
+       public void testSimpleCtor() {
+               Result simple = new Result("1", "The Value");
+               assertEquals("1", simple.getID());
+               assertEquals("UNKNOWN", simple.getMimeType());
+               assertEquals("UNKNOWN", simple.getProfileID());
+               assertEquals("UNKNOWN", simple.getResourceID());
+               assertEquals(0, simple.getHeaders().size());
+               assertEquals("The Value", simple.getValue());
+               assertTrue(!simple.isClassified());
+               assertEquals(Result.INFINITE, simple.getValidity());
+       }
+
+       public void testFullCtor() {
+               List headers = new ArrayList();
+               headers.add(new Header("header"));
+               Result full = new Result("1", "text/xml", "edaDataSetInv1", 
"geeba1", headers,TEST_VALUE, /*classified*/true,
+                       /*validity*/12345L);
+               assertEquals("1", full.getID());
+               assertEquals("text/xml", full.getMimeType());
+               assertEquals("edaDataSetInv1", full.getProfileID());
+               assertEquals("geeba1", full.getResourceID());
+               assertEquals(1, full.getHeaders().size());
+               assertEquals(TEST_VALUE, full.getValue());
+               assertEquals(true, full.isClassified());
+               assertEquals(12345L, full.getValidity());
+       }               
+
+       public void testSetters() {
+               Result result = new Result("1", "text/xml", "edaDataSetInv1", 
"geeba1", new ArrayList(), TEST_VALUE);
+
+               assertEquals("1", result.getID());
+               result.setID("2");
+               assertEquals("2", result.getID());
+
+               assertEquals("text/xml", result.getMimeType());
+               result.setMimeType("text/sgml");
+               assertEquals("text/sgml", result.getMimeType());
+
+               assertEquals("edaDataSetInv1", result.getProfileID());
+               result.setProfileID("ptiDataSet");
+               assertEquals("ptiDataSet", result.getProfileID());
+
+               assertEquals("geeba1", result.getResourceID());
+               result.setResourceID("fish2");
+               assertEquals("fish2", result.getResourceID());
+
+               assertEquals(TEST_VALUE, result.getValue());
+               result.setValue("<hello>world</hello>");
+               assertEquals("<hello>world</hello>", result.getValue());
+
+               assertEquals(false, result.isClassified());
+               result.setClassified(true);
+               assertEquals(true, result.isClassified());
+
+               assertEquals(Result.INFINITE, result.getValidity());
+               result.setValidity(54321L);
+               assertEquals(54321L, result.getValidity());
+       }
+
+       public void testObjectMethods() {
+               Result r1 = new Result("1", "text/xml", "edaDataSetInv1", 
"geeba1", new ArrayList(), TEST_VALUE);
+               Result r2 = new Result("1", "text/xml", "edaDataSetInv1", 
"geeba1", new ArrayList(), TEST_VALUE);
+               Result r3 = new Result("2", "text/xml", "edaDataSetInv1", 
"geeba1", new ArrayList(), TEST_VALUE);
+               assertEquals(r1, r1);
+               assertEquals(r1, r2);
+               assertTrue(!r1.equals(r3));
+               Result r4 = (Result) r3.clone();
+               assertEquals(r3, r4);
+               assertTrue(r3 != r4);
+       }
+
+       public void testXML() throws Exception {
+               Document doc = XML.createDocument();
+               Element bogus = doc.createElement("bogus");
+               try {
+                       Result r0 = new Result(bogus);
+                       fail("Result constructor failed to throw exception when 
given invalid XML node");
+               } catch (IllegalArgumentException good) {}
+
+               Result r1 = new Result("1", "text/xml", "edaDataSetInv1", 
"geeba1", new ArrayList(), TEST_VALUE,
+                       /*classified*/true, /*validity*/3456789);
+               Node root = r1.toXML(doc);
+               assertEquals("resultElement", root.getNodeName());
+               assertEquals("true", ((Element) 
root).getAttribute("classified"));
+               assertEquals("3456789", ((Element) 
root).getAttribute("validity"));
+               NodeList children = root.getChildNodes();
+               for (int i = 0; i < children.getLength(); ++i) {
+                       Node child = children.item(i);
+                       if ("resultId".equals(child.getNodeName())) {
+                               assertEquals("1", XML.text(child));
+                       } else if 
("resultMimeType".equals(child.getNodeName())) {
+                               assertEquals("text/xml", XML.text(child));
+                       } else if ("profId".equals(child.getNodeName())) {
+                               assertEquals("edaDataSetInv1", XML.text(child));
+                       } else if ("identifier".equals(child.getNodeName())) {
+                               assertEquals("geeba1", XML.text(child));
+                       } else if ("resultHeader".equals(child.getNodeName())) {
+                               // ignore, use HeaderTest
+                       } else if ("resultValue".equals(child.getNodeName())) {
+                               assertEquals(TEST_VALUE, 
child.getFirstChild().getNodeValue());
+                       } else fail("Unknown node \"" + child.getNodeName() + 
"\" in XML result");
+               }
+               Result r2 = new Result(root);
+               assertEquals(r1, r2);
+       }
+
+       public void testMimeTypes() {
+               try {
+                       Result r = new Result("1", "invalid/mime.type", "", "", 
new ArrayList(), "");
+               } catch (IllegalArgumentException ex) {
+                       // Good.
+                       return;
+               }
+               fail("Result constructor failed to throw 
IllegalArgumentException for invalid mime type");
+       }
+
+       private static final String TEST_VALUE = "<?xml version='1.0' 
encoding='UTF-8'?>\n<test>value</test>";
+}
+

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/ResultTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/StringCodecTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/StringCodecTest.java?rev=1653724&view=auto
==============================================================================
--- 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/StringCodecTest.java 
(added)
+++ 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/StringCodecTest.java 
Thu Jan 22 00:36:00 2015
@@ -0,0 +1,42 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.*;
+import java.util.*;
+import org.apache.oodt.commons.util.*;
+import org.apache.oodt.xmlquery.StringCodec; // Imported for javadoc
+import junit.framework.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+
+/** Unit test the {@link StringCodec} class.
+ *
+ * @author Kelly
+ */ 
+public class StringCodecTest extends CodecTest {
+       /** Construct the test case for the {@link StringCodec} class. */
+       public StringCodecTest(String name) {
+               super(name);
+       }
+
+       public void testIt() throws Exception {
+               
runTest(CodecFactory.createCodec("org.apache.oodt.xmlquery.StringCodec"));
+       }
+}

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/StringCodecTest.java
------------------------------------------------------------------------------
    svn:executable = *

Added: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/XMLQueryTest.java
URL: 
http://svn.apache.org/viewvc/oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/XMLQueryTest.java?rev=1653724&view=auto
==============================================================================
--- 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/XMLQueryTest.java 
(added)
+++ 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/XMLQueryTest.java 
Thu Jan 22 00:36:00 2015
@@ -0,0 +1,227 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+
+package org.apache.oodt.xmlquery;
+
+import java.io.*;
+import java.util.*;
+import org.apache.oodt.commons.util.*;
+import junit.framework.*;
+import org.w3c.dom.*;
+import org.xml.sax.*;
+
+/** Unit test the {@link XMLQuery} class.
+ *
+ * @author Kelly
+ */ 
+public class XMLQueryTest extends org.apache.oodt.commons.ConfiguredTestCase {
+       /** Construct the test case for the {@link XMLQuery} class. */
+       public XMLQueryTest(String name) {
+               super(name);
+       }
+
+       public void testCtor() {
+               List mimes = new ArrayList();
+               mimes.add("text/plain");
+               mimes.add("image/jpeg");
+               XMLQuery q = new XMLQuery("profStatusId = UNKNOWN OR A > 3 AND 
RETURN = C",
+                       "id", "title", "description", "dataDictID", 
"resultModeID", "propType", "propLevels", 45, mimes);
+               assertEquals("profStatusId = UNKNOWN OR A > 3 AND RETURN = C", 
q.getKwdQueryString());
+               assertEquals(45, q.getMaxResults());
+               assertEquals(1, q.getSelectElementSet().size());
+               assertEquals(new QueryElement("elemName", "C"), 
q.getSelectElementSet().get(0));
+               assertEquals(0, q.getFromElementSet().size());
+               assertEquals(6, q.getWhereElementSet().size());
+               assertEquals(new QueryElement("elemName", "profStatusId"), 
q.getWhereElementSet().get(0));
+               assertEquals(new QueryElement("LITERAL", "UNKNOWN"), 
q.getWhereElementSet().get(1));
+               assertEquals(new QueryElement("RELOP", "EQ"), 
q.getWhereElementSet().get(2));
+               assertEquals(new QueryElement("elemName", "A"), 
q.getWhereElementSet().get(3));
+               assertEquals(new QueryElement("LITERAL", "3"), 
q.getWhereElementSet().get(4));
+               assertEquals(new QueryElement("RELOP", "GT"), 
q.getWhereElementSet().get(5));
+               // Need some testing of expressions with LOGOP's, but NOT 
handling seems broken.
+               assertEquals(0, q.getResults().size());
+               assertEquals(2, q.getMimeAccept().size());
+       }               
+       
+       public void testObjectMethods() {
+               XMLQuery q1 = new XMLQuery("Subject < Phrenology OR A > 3 AND 
RETURN = C",
+                       "id", "title", "description", "dataDictID", 
"resultModeID", "propType", "propLevels", 45);
+               XMLQuery q2 = new XMLQuery("Subject < Phrenology OR A > 3 AND 
RETURN = C",
+                       "id", "title", "description", "dataDictID", 
"resultModeID", "propType", "propLevels", 45);
+               XMLQuery q3 = new XMLQuery("Subject > Phrenology OR A < 3 AND 
RETURN = D",
+                       "id", "title", "description", "dataDictID", 
"resultModeID", "propType", "propLevels", 45);
+               assertEquals(q1, q1);
+               assertEquals(q1, q2);
+               assertTrue(!q1.equals(q3));
+               XMLQuery q4 = (XMLQuery) q3.clone();
+               assertEquals(q3, q4);
+               assertTrue(q3 != q4);
+       }
+
+       public void testParser() {
+               XMLQuery q1 = new XMLQuery("(A < 1 AND A > 2) AND RETURN = B", 
"id", "title", "description", "dataDictID",
+                       "resultModeID", "propType", "propLevels", 45);
+               List where = q1.getWhereElementSet();
+               assertEquals(7, where.size());
+
+               QueryElement qe;
+
+               qe = (QueryElement) where.get(0);
+               assertEquals("elemName", qe.getRole());
+               assertEquals("A", qe.getValue());
+
+               qe = (QueryElement) where.get(1);
+               assertEquals("LITERAL", qe.getRole());
+               assertEquals("1", qe.getValue());
+
+               qe = (QueryElement) where.get(2);
+               assertEquals("RELOP", qe.getRole());
+               assertEquals("LT", qe.getValue());
+
+               qe = (QueryElement) where.get(3);
+               assertEquals("elemName", qe.getRole());
+               assertEquals("A", qe.getValue());
+
+               qe = (QueryElement) where.get(4);
+               assertEquals("LITERAL", qe.getRole());
+               assertEquals("2", qe.getValue());
+
+               qe = (QueryElement) where.get(5);
+               assertEquals("RELOP", qe.getRole());
+               assertEquals("GT", qe.getValue());
+
+               qe = (QueryElement) where.get(6);
+               assertEquals("LOGOP", qe.getRole());
+               assertEquals("AND", qe.getValue());
+
+               List select = q1.getSelectElementSet();
+               assertEquals(1, select.size());
+               
+               qe = (QueryElement) select.get(0);
+               assertEquals("elemName", qe.getRole());
+               assertEquals("B", qe.getValue());
+       }
+
+       public void testXML() {
+               NodeList children;
+
+               List mimes = new ArrayList();
+               mimes.add("text/xml");
+               mimes.add("image/gif");
+               XMLQuery q1 = new XMLQuery("Subject < Phrenology OR A > 3 AND 
RETURN = C",
+                       "id", "title", "description", "dataDictID", 
"resultModeID", "propType", "propLevels", 45, mimes);
+               Document doc = q1.getXMLDoc();
+               Node root = doc.getDocumentElement();
+               assertEquals("query", root.getNodeName());
+
+               Node queryAttributes = root.getFirstChild();
+               assertEquals("queryAttributes", queryAttributes.getNodeName());
+               children = queryAttributes.getChildNodes();
+               for (int i = 0; i < children.getLength(); ++i) {
+                       Node child = children.item(i);
+                       String name = child.getNodeName();
+                       String text = XML.text(child);
+                       if ("queryId".equals(name)) {
+                               assertEquals("id", text);
+                       } else if ("queryTitle".equals(name)) {
+                               assertEquals("title", text);
+                       } else if ("queryDesc".equals(name)) {
+                               assertEquals("description", text);
+                       } else if ("queryType".equals(name)) {
+                               assertEquals("QUERY", text);
+                       } else if ("queryStatusId".equals(name)) {
+                               assertEquals("ACTIVE", text);
+                       } else if ("querySecurityType".equals(name)) {
+                               assertEquals("UNKNOWN", text);
+                       } else if ("queryRevisionNote".equals(name)) {
+                               assertEquals("1999-12-12 JSH V1.0 Under 
Development", text);
+                       } else if ("queryDataDictId".equals(name)) {
+                               assertEquals("dataDictID", text);
+                       } else fail("Unknown node <" + name + "> under 
<queryAttributes>");
+               }
+
+               Node queryResultMode = queryAttributes.getNextSibling();
+               assertEquals("queryResultModeId", 
queryResultMode.getNodeName());
+               assertEquals("resultModeID", XML.text(queryResultMode));
+
+               Node propogationType = queryResultMode.getNextSibling();
+               assertEquals("queryPropogationType", 
propogationType.getNodeName());
+               assertEquals("propType", XML.text(propogationType));
+
+               Node propogationLevels = propogationType.getNextSibling();
+               assertEquals("queryPropogationLevels", 
propogationLevels.getNodeName());
+               assertEquals("propLevels", XML.text(propogationLevels));
+
+               Node mimeNode = propogationLevels.getNextSibling();
+               assertEquals("queryMimeAccept", mimeNode.getNodeName());
+               assertEquals("text/xml", XML.text(mimeNode));
+
+               mimeNode = mimeNode.getNextSibling();
+               assertEquals("queryMimeAccept", mimeNode.getNodeName());
+               assertEquals("image/gif", XML.text(mimeNode));          
+
+               Node maxResults = mimeNode.getNextSibling();
+               assertEquals("queryMaxResults", maxResults.getNodeName());
+               assertEquals("45", XML.text(maxResults));
+
+               Node results = maxResults.getNextSibling();
+               assertEquals("queryResults", results.getNodeName());
+               assertEquals("0", XML.text(results));
+
+               Node kwqString = results.getNextSibling();
+               assertEquals("queryKWQString", kwqString.getNodeName());
+               assertEquals("Subject < Phrenology OR A > 3 AND RETURN = C", 
XML.text(kwqString));
+
+               Node node = kwqString.getNextSibling();
+               assertEquals("queryStatistics", node.getNodeName());
+               node = node.getNextSibling();
+               assertEquals("querySelectSet", node.getNodeName());
+               node = node.getNextSibling();
+               assertEquals("queryFromSet", node.getNodeName());
+               node = node.getNextSibling();
+               assertEquals("queryWhereSet", node.getNodeName());
+               node = node.getNextSibling();
+               assertEquals("queryResultSet", node.getNodeName());
+               assertNull(node.getNextSibling());
+
+               XMLQuery q2 = new XMLQuery(root);
+               assertEquals(q1, q2);
+       }
+
+       /**
+        * Test if we can parse an XML query document even with an inaccessible 
system ID.
+        *
+        * @throws SAXException if an error occurs.
+        */
+       public void testXMLEntityResolution() throws SAXException {
+               new XMLQuery(BAD_HOST);
+       }
+
+       private static String BAD_HOST = "<!DOCTYPE query PUBLIC '-//JPL//DTD 
OODT Query 1.0//EN' "
+               + 
"'http://unknown-host.unk/edm-query/query.dtd'>\n<query><queryAttributes><queryId>queryServlet</queryId>"
+               + "<queryTitle>QueryfromQueryServlet</queryTitle><queryDesc>Bad 
host name in system ID</queryDesc><queryType>"
+               + 
"QUERY</queryType><queryStatusId>ACTIVE</queryStatusId><querySecurityType>UNKNOWN</querySecurityType>"
+               + 
"<queryRevisionNote>1999-12-12JSHV1.0UnderDevelopment</queryRevisionNote><queryDataDictId>UNKNOWN"
+               + 
"</queryDataDictId></queryAttributes><queryResultModeId>ATTRIBUTE</queryResultModeId><queryPropogationType>"
+               + 
"BROADCAST</queryPropogationType><queryPropogationLevels>N/A</queryPropogationLevels><queryMimeAccept>*/*"
+               + 
"</queryMimeAccept><queryMaxResults>100</queryMaxResults><queryResults>0</queryResults><queryKWQString>"
+               + "RETURN = 
SPECIMEN_COLLECTED_CODE</queryKWQString><queryStatistics/><querySelectSet><queryElement>"
+               + 
"<tokenRole>elemName</tokenRole><tokenValue>SPECIMEN_COLLECTED_CODE</tokenValue></queryElement></querySelectSet>"
+               + "<queryFromSet/><queryWhereSet/><queryResultSet/></query>";
+
+}

Propchange: 
oodt/trunk/xmlquery/src/test/java/org/apache/oodt/xmlquery/XMLQueryTest.java
------------------------------------------------------------------------------
    svn:executable = *


Reply via email to