View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *     http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.jxpath.ri.axes;
18  
19  import org.apache.commons.jxpath.JXPathTestCase;
20  import org.apache.commons.jxpath.TestBean;
21  import org.apache.commons.jxpath.xml.DocumentContainer;
22  import org.w3c.dom.Document;
23  
24  /**
25   * Test bean for mixed model JUnit tests.
26   *
27   * @author Dmitri Plotnikov
28   * @version $Revision: 480417 $ $Date: 2006-11-29 06:37:40 +0100 (Mi, 29 Nov 2006) $
29   */
30  public class TestBeanWithNode extends TestBean {
31      private Object node;
32      private Object object;
33  
34      public Object getVendor() {
35          return node;
36      }
37  
38      public Object[] getVendors() {
39          return new Object[] { node };
40      }
41  
42      public void setVendor(Object node) {
43          this.node = node;
44      }
45  
46      public Object getObject() {
47          return object;
48      }
49  
50      public void setObject(Object object) {
51          this.object = object;
52      }
53  
54      public static TestBeanWithNode createTestBeanWithDOM() {
55          DocumentContainer docCtr =
56              new DocumentContainer(
57                  JXPathTestCase.class.getResource("Vendor.xml"));
58          Document doc = (Document) docCtr.getValue();
59          TestBeanWithNode tbwdom = new TestBeanWithNode();
60          tbwdom.setVendor(doc.getDocumentElement());
61          tbwdom.setObject(docCtr);
62          return tbwdom;
63      }
64  
65  }