Home » rampart-dist-1.4-src » org.apache » axis2 » integration » [javadoc | source]

    1   /*
    2    * Copyright 2004,2005 The Apache Software Foundation.
    3    *
    4    * Licensed under the Apache License, Version 2.0 (the "License");
    5    * you may not use this file except in compliance with the License.
    6    * You may obtain a copy of the License at
    7    *
    8    *      http://www.apache.org/licenses/LICENSE-2.0
    9    *
   10    * Unless required by applicable law or agreed to in writing, software
   11    * distributed under the License is distributed on an "AS IS" BASIS,
   12    * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   13    * See the License for the specific language governing permissions and
   14    * limitations under the License.
   15    */
   16   
   17   package org.apache.axis2.integration;
   18   
   19   import junit.framework.TestCase;
   20   import org.apache.axiom.om.OMAbstractFactory;
   21   import org.apache.axiom.om.OMElement;
   22   import org.apache.axiom.om.OMFactory;
   23   import org.apache.axiom.om.OMNamespace;
   24   
   25   public class TestingUtils {
   26       public static OMElement createDummyOMElement() {
   27           OMFactory fac = OMAbstractFactory.getOMFactory();
   28           OMNamespace omNs = fac.createOMNamespace("http://org.apache.axis2/xsd", "ns1");
   29           OMElement method = fac.createOMElement("echoOM", omNs);
   30           OMElement value = fac.createOMElement("myValue", omNs);
   31           value.addChild(
   32                   fac.createOMText(value, "Isaac Asimov, The Foundation Trilogy"));
   33           method.addChild(value);
   34           return method;
   35       }
   36   
   37       public static OMElement createDummyOMElement(String nameSpace) {
   38           OMFactory fac = OMAbstractFactory.getOMFactory();
   39           OMNamespace omNs = fac.createOMNamespace(nameSpace, "ns1");
   40           OMElement method = fac.createOMElement("echoOM", omNs);
   41           OMElement value = fac.createOMElement("myValue", omNs);
   42           value.addChild(
   43                   fac.createOMText(value, "Isaac Asimov, The Foundation Trilogy"));
   44           method.addChild(value);
   45           return method;
   46       }
   47   
   48   
   49       public static void campareWithCreatedOMElement(OMElement element) {
   50           OMElement firstChild = element.getFirstElement();
   51           TestCase.assertNotNull(firstChild);
   52           String textValue = firstChild.getText();
   53           TestCase.assertEquals(textValue, "Isaac Asimov, The Foundation Trilogy");
   54       }
   55   
   56   }

Home » rampart-dist-1.4-src » org.apache » axis2 » integration » [javadoc | source]