dims 2002/06/03 10:57:01
Modified: java build.xml
java/samples/jaxm DelayedStockQuote.java
java/src/org/apache/axis/message MessageElement.java
java/src/org/apache/axis/wsdl/gen WSDL2.java
java/test build_functional_tests.xml
java/test/functional TestJAXMSamples.java
java/test/wsdl Wsdl2javaAntTask.java
Added: java/src/org/apache/axis/utils DefaultAuthenticator.java
Log:
- Print a header for axis version, ant version and build file name.
- Fix MessageElement's getValue
- Added JAXM DelayedStockQuote sample to the test harness
- Externalize DefaultAuthenticator.java
- Fix WSDL2 and WSDL2AntJavaTask to use the DefaultAuthenticator.java
- Fix test scripts to get all-tests to run well in an environment where
- a proxy server is required for internet access
- and the proxy server requires a userid and password.
- To be able to do the above all you need to do is specify the proxy parameters in
ANT's jvm as shown below:
java -Dhttp.proxyHost=XXXXXX -Dhttp.proxyPort=80 -Dhttp.nonProxyHosts=localhost
-Dhttp.proxyUser=XXXXXX -Dhttp.proxyPassword=XXXXXX org.apache.tools.ant.Main
Revision Changes Path
1.140 +7 -1 xml-axis/java/build.xml
Index: build.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/build.xml,v
retrieving revision 1.139
retrieving revision 1.140
diff -u -r1.139 -r1.140
--- build.xml 30 May 2002 12:16:00 -0000 1.139
+++ build.xml 3 Jun 2002 17:57:00 -0000 1.140
@@ -198,7 +198,13 @@
</condition>
- <echo message="--- Build environment for ${Name} ---" />
+ <echo
message="-----------------------------------------------------------------"/>
+ <echo message=" Build environment for ${Name} ${axis.version} [${year}]
"/>
+ <echo
message="-----------------------------------------------------------------"/>
+ <echo message="Building with ${ant.version}"/>
+ <echo message="using build file ${ant.file}"/>
+ <echo
message="-----------------------------------------------------------------"/>
+
<echo message="--- Flags (Note: If the {property name} is displayed, "/>
<echo message=" then the component is not present)" />
<echo message=""/>
1.2 +1 -4 xml-axis/java/samples/jaxm/DelayedStockQuote.java
Index: DelayedStockQuote.java
===================================================================
RCS file: /home/cvs/xml-axis/java/samples/jaxm/DelayedStockQuote.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- DelayedStockQuote.java 31 May 2002 20:24:30 -0000 1.1
+++ DelayedStockQuote.java 3 Jun 2002 17:57:00 -0000 1.2
@@ -109,10 +109,7 @@
Iterator it2 = bodyElement.getChildElements();
while (it2.hasNext()) {
SOAPElement element2 = (SOAPElement) it2.next();
-
System.out.println(((org.apache.axis.message.MessageElement)element2).toString());
- // TODO: Find out why getValue returns null.
- String lastPrice = element2.getValue();
- return lastPrice;
+ return element2.getValue();
}
}
return null;
1.100 +17 -2 xml-axis/java/src/org/apache/axis/message/MessageElement.java
Index: MessageElement.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/message/MessageElement.java,v
retrieving revision 1.99
retrieving revision 1.100
diff -u -r1.99 -r1.100
--- MessageElement.java 31 May 2002 19:08:08 -0000 1.99
+++ MessageElement.java 3 Jun 2002 17:57:00 -0000 1.100
@@ -754,11 +754,26 @@
}
// JAXM Node methods...
-
/**
- * Text nodes are not supported.
+ * Returns the the value of the immediate child of this <code>Node</code>
+ * object if a child exists and its value is text.
+ * @return a <code>String</code> with the text of the immediate child of
+ * this <code>Node</code> object if (1) there is a child and
+ * (2) the child is a <code>Text</code> object;
+ * <code>null</code> otherwise
*/
public String getValue() {
+ try {
+ Element element = getAsDOM();
+ if(element.hasChildNodes()){
+ org.w3c.dom.Node node = element.getFirstChild();
+ if(node.getNodeType()==org.w3c.dom.Node.TEXT_NODE){
+ return node.getNodeValue();
+ }
+ }
+ } catch (Exception t){
+ log.debug("getValue()", t);
+ }
return null;
}
1.1
xml-axis/java/src/org/apache/axis/utils/DefaultAuthenticator.java
Index: DefaultAuthenticator.java
===================================================================
/*
* The Apache Software License, Version 1.1
*
* Copyright (c) 2001 The Apache Software Foundation. All rights
* reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions
* are met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in
* the documentation and/or other materials provided with the
* distribution.
*
* 3. The end-user documentation included with the redistribution, if
* any, must include the following acknowlegement:
* "This product includes software developed by the
* Apache Software Foundation (http://www.apache.org/)."
* Alternately, this acknowlegement may appear in the software itself,
* if and wherever such third-party acknowlegements normally appear.
*
* 4. The names "The Jakarta Project", "Ant", and "Apache Software
* Foundation" must not be used to endorse or promote products derived
* from this software without prior written permission. For written
* permission, please contact [EMAIL PROTECTED]
*
* 5. Products derived from this software may not be called "Apache"
* nor may "Apache" appear in their names without prior written
* permission of the Apache Group.
*
* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
* ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
* ====================================================================
*
* This software consists of voluntary contributions made by many
* individuals on behalf of the Apache Software Foundation. For more
* information on the Apache Software Foundation, please see
* <http://www.apache.org/>.
*/
package org.apache.axis.utils;
/**
* This class is used by WSDL2javaAntTask and WSDL2.
* Supports the http.proxyUser and http.proxyPassword properties.
*/
public class DefaultAuthenticator extends java.net.Authenticator {
private String user;
private String password;
public DefaultAuthenticator(String user, String pass) {
this.user = user;
this.password = pass;
}
protected java.net.PasswordAuthentication getPasswordAuthentication() {
// if user and password weren't provided, check the system properties
if (user == null) {
user = System.getProperty("http.proxyUser", "");
}
if (password == null) {
password = System.getProperty("http.proxyPassword", "");
}
return new java.net.PasswordAuthentication(user, password.toCharArray());
}
}
1.7 +10 -36 xml-axis/java/src/org/apache/axis/wsdl/gen/WSDL2.java
Index: WSDL2.java
===================================================================
RCS file: /home/cvs/xml-axis/java/src/org/apache/axis/wsdl/gen/WSDL2.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- WSDL2.java 16 May 2002 13:51:28 -0000 1.6
+++ WSDL2.java 3 Jun 2002 17:57:01 -0000 1.7
@@ -54,19 +54,18 @@
*/
package org.apache.axis.wsdl.gen;
-import java.net.Authenticator;
-import java.net.MalformedURLException;
-import java.net.PasswordAuthentication;
-import java.net.URL;
-
-import java.util.List;
-
import org.apache.axis.utils.CLArgsParser;
import org.apache.axis.utils.CLOption;
import org.apache.axis.utils.CLOptionDescriptor;
import org.apache.axis.utils.CLUtil;
+import org.apache.axis.utils.DefaultAuthenticator;
import org.apache.axis.utils.JavaUtils;
+import java.net.Authenticator;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.List;
+
public class WSDL2 {
protected static final int DEBUG_OPT = 'D';
@@ -142,7 +141,7 @@
/**
* Parse an option
- * @param CLOption is the option
+ * @param CLOption is the option
*/
protected void parseOption(CLOption option) {
switch (option.getId()) {
@@ -218,7 +217,7 @@
} else {
parser.setUsername(userInfo);
}
- }
+ }
}
/**
@@ -239,7 +238,7 @@
} // printUsage
/**
- * run
+ * run
* checkes the command-line arguments and runs the tool.
* @param String[] command-line arguments.
*/
@@ -269,7 +268,7 @@
validateOptions();
parser.run(wsdlURI);
-
+
// everything is good
System.exit(0);
}
@@ -288,29 +287,4 @@
WSDL2 wsdl2 = new WSDL2();
wsdl2.run(args);
} // main
-
- /**
- * This class is used by WSDL2 main() only
- * Supports the http.proxyUser and http.proxyPassword properties.
- */
- public static class DefaultAuthenticator extends Authenticator {
- private String user;
- private String password;
-
- DefaultAuthenticator(String user, String pass) {
- this.user = user;
- this.password = pass;
- }
- protected PasswordAuthentication getPasswordAuthentication() {
- // if user and password weren't provided, check the system properties
- if (user == null) {
- user = System.getProperty("http.proxyUser","");
- }
- if (password == null) {
- password = System.getProperty("http.proxyPassword","");
- }
-
- return new PasswordAuthentication (user, password.toCharArray());
- }
- }
} // class WSDL2
1.41 +6 -0 xml-axis/java/test/build_functional_tests.xml
Index: build_functional_tests.xml
===================================================================
RCS file: /home/cvs/xml-axis/java/test/build_functional_tests.xml,v
retrieving revision 1.40
retrieving revision 1.41
diff -u -r1.40 -r1.41
--- build_functional_tests.xml 8 May 2002 19:20:08 -0000 1.40
+++ build_functional_tests.xml 3 Jun 2002 17:57:01 -0000 1.41
@@ -92,6 +92,12 @@
<!-- now, run the actual test -->
<junit dir="." printsummary="yes" haltonfailure="${test.functional.fail}"
fork="yes">
+ <!-- Pass through the proxy parameters -->
+ <jvmarg value="-Dhttp.proxyHost=${http.proxyHost}"/>
+ <jvmarg value="-Dhttp.proxyPort=${http.proxyPort}"/>
+ <jvmarg value="-Dhttp.nonProxyHosts=${http.nonProxyHosts}"/>
+ <jvmarg value="-Dhttp.proxyUser=${http.proxyUser}"/>
+ <jvmarg value="-Dhttp.proxyPassword=${http.proxyPassword}"/>
<classpath refid="test-classpath" />
<formatter type="xml" usefile="${test.functional.usefile}"/>
<batchtest todir="${test.functional.reportdir}">
1.2 +24 -0 xml-axis/java/test/functional/TestJAXMSamples.java
Index: TestJAXMSamples.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/functional/TestJAXMSamples.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- TestJAXMSamples.java 30 May 2002 16:40:42 -0000 1.1
+++ TestJAXMSamples.java 3 Jun 2002 17:57:01 -0000 1.2
@@ -60,6 +60,7 @@
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import samples.jaxm.UddiPing;
+import DelayedStockQuote;
/**
* Test the JAX-RPC compliance samples.
@@ -76,6 +77,29 @@
log.info("Testing JAXM UddiPing sample.");
UddiPing.searchUDDI("IBM",
"http://www-3.ibm.com/services/uddi/testregistry/inquiryapi");
log.info("Test complete.");
+ } catch (Throwable t) {
+ if (t instanceof AxisFault) ((AxisFault) t).dump();
+ t.printStackTrace();
+ throw new Exception("Fault returned from test: " + t);
+ }
+ } // testGetQuote
+
+ public void testDelayedStockQuote() throws Exception {
+ try {
+ log.info("Testing JAXM DelayedStockQuote sample.");
+ DelayedStockQuote stockQuote = new DelayedStockQuote();
+ System.out.print("The last price for SUNW is " +
stockQuote.getStockQuote("SUNW"));
+ log.info("Test complete.");
+ } catch (javax.xml.soap.SOAPException e) {
+ Throwable t = e.getCause();
+ if(t != null){
+ if (t instanceof AxisFault) ((AxisFault) t).dump();
+ t.printStackTrace();
+ throw new Exception("Fault returned from test: " + t);
+ } else {
+ e.printStackTrace();
+ throw new Exception("Exception returned from test: " + e);
+ }
} catch (Throwable t) {
if (t instanceof AxisFault) ((AxisFault) t).dump();
t.printStackTrace();
1.27 +5 -6 xml-axis/java/test/wsdl/Wsdl2javaAntTask.java
Index: Wsdl2javaAntTask.java
===================================================================
RCS file: /home/cvs/xml-axis/java/test/wsdl/Wsdl2javaAntTask.java,v
retrieving revision 1.26
retrieving revision 1.27
diff -u -r1.26 -r1.27
--- Wsdl2javaAntTask.java 10 May 2002 13:30:35 -0000 1.26
+++ Wsdl2javaAntTask.java 3 Jun 2002 17:57:01 -0000 1.27
@@ -53,19 +53,15 @@
*/
package test.wsdl;
-import org.apache.axis.utils.XMLUtils;
-
+import org.apache.axis.utils.DefaultAuthenticator;
import org.apache.axis.wsdl.toJava.Emitter;
-
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.Project;
import org.apache.tools.ant.Task;
-import org.w3c.dom.Document;
-import org.xml.sax.SAXException;
-
import java.io.File;
import java.io.IOException;
+import java.net.Authenticator;
import java.util.HashMap;
/**
@@ -145,6 +141,8 @@
emitter.setNStoPkg(project.resolveFile("NStoPkg.properties"));
emitter.setTimeout(timeout);
+ Authenticator.setDefault(new DefaultAuthenticator(null,null));
+
log("WSDL2Java " + url, Project.MSG_INFO);
try {
emitter.run(url);
@@ -263,6 +261,7 @@
namespaceMap.put(namespace, packageName);
}
}
+
}