001: /*
002: * JOnAS: Java(TM) Open Application Server
003: * Copyright (C) 1999 Bull S.A.
004: * Contact: jonas-team@objectweb.org
005: *
006: * This library is free software; you can redistribute it and/or
007: * modify it under the terms of the GNU Lesser General Public
008: * License as published by the Free Software Foundation; either
009: * version 2.1 of the License, or 1any later version.
010: *
011: * This library is distributed in the hope that it will be useful,
012: * but WITHOUT ANY WARRANTY; without even the implied warranty of
013: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
014: * Lesser General Public License for more details.
015: *
016: * You should have received a copy of the GNU Lesser General Public
017: * License along with this library; if not, write to the Free Software
018: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
019: * USA
020: *
021: * Initial developer: Helene Joanin
022: * --------------------------------------------------------------------------
023: * $Id: WsDeploymentTest.java 4799 2004-05-25 14:26:36Z sauthieg $
024: * --------------------------------------------------------------------------
025: */
026:
027: package org.objectweb.jonas_ws.deployment.tests;
028:
029: import java.io.StringReader;
030: import java.io.Reader;
031: import org.objectweb.jonas_lib.deployment.xml.AbsElement;
032: import org.objectweb.jonas_lib.deployment.tests.AbsDeploymentTest;
033: import org.objectweb.jonas_ws.deployment.api.MappingFile;
034: import org.objectweb.jonas_ws.deployment.lib.WSDeploymentDescManager;
035: import org.objectweb.jonas_ws.deployment.lib.MappingFileManager;
036: import org.objectweb.jonas_ws.deployment.xml.Webservices;
037: import org.objectweb.jonas_ws.deployment.xml.JavaWsdlMapping;
038:
039: /**
040: * Defines a class for Web Services deployment tests
041: * @author Helene Joanin
042: * @author Philipe Coq
043: */
044:
045: public class WsDeploymentTest extends AbsDeploymentTest {
046:
047: /**
048: *
049: */
050:
051: public AbsElement getTopLevelElement() throws Exception {
052: Webservices ws = new Webservices();
053: return ws;
054: }
055:
056: /**
057: *
058: */
059:
060: public String parse(Reader reader, String name, boolean validation)
061: throws Exception {
062: WSDeploymentDescManager.setParsingWithValidation(validation);
063: String xmlParsed = WSDeploymentDescManager.loadWebservices(
064: reader, "test").toXML();
065: return xmlParsed;
066: }
067:
068: /**
069: * Defines the function for the jaxrpc-mapping test
070: * @param random use random or not to fill elements
071: * @throws Exception if the test failed
072: */
073: public void startJaxrpcMappingTest(boolean random) throws Exception {
074: JavaWsdlMapping jmp = new JavaWsdlMapping();
075: fill(jmp, random);
076: String xmlOriginal = jmp.toXML();
077: MappingFile mapFile = MappingFileManager.getInstance(
078: new StringReader(xmlOriginal), "test", false);
079: String xmlParsed = mapFile.getXmlJavaWsdlMapping().toXML();
080: checkDiff(xmlOriginal, xmlParsed);
081: }
082:
083: /**
084: * Gets the xml after digester parsing
085: * @throws Exception if the parsing fail
086: */
087: public void parseJaxrcpMappingElement() throws Exception {
088: JavaWsdlMapping jmp = new JavaWsdlMapping();
089: fill(jmp, false);
090: System.out.println("Parsing xml :");
091: System.out.println(jmp);
092: String xmlOriginal = jmp.toXML();
093: MappingFile mapFile = MappingFileManager.getInstance(
094: new StringReader(xmlOriginal), "test", false);
095: String xmlParsed = mapFile.getXmlJavaWsdlMapping().toXML();
096: System.out.println("Result = ");
097: System.out.println(xmlParsed);
098: }
099:
100: }
|