svn commit: r1332545 - in /axis/axis2/java/core/trunk/modules: kernel/pom.xml parent/pom.xml transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java
Author: sagara Date: Tue May 1 07:22:19 2012 New Revision: 1332545 URL: http://svn.apache.org/viewvc?rev=1332545&view=rev Log: Fixed AXIS2-5309. * Changed JSR311-api version. * Removed JSR311-api from HTTP transport test cases. Modified: axis/axis2/java/core/trunk/modules/kernel/pom.xml axis/axis2/java/core/trunk/modules/parent/pom.xml axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java Modified: axis/axis2/java/core/trunk/modules/kernel/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/pom.xml?rev=1332545&r1=1332544&r2=1332545&view=diff == --- axis/axis2/java/core/trunk/modules/kernel/pom.xml (original) +++ axis/axis2/java/core/trunk/modules/kernel/pom.xml Tue May 1 07:22:19 2012 @@ -86,7 +86,6 @@ javax.ws.rs jsr311-api -1.0 commons-io Modified: axis/axis2/java/core/trunk/modules/parent/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/parent/pom.xml?rev=1332545&r1=1332544&r2=1332545&view=diff == --- axis/axis2/java/core/trunk/modules/parent/pom.xml (original) +++ axis/axis2/java/core/trunk/modules/parent/pom.xml Tue May 1 07:22:19 2012 @@ -130,6 +130,7 @@ 1.1 2.2.5 2.2.5 +1.1.1 @@ -743,6 +744,11 @@ woden-impl-dom ${woden.version} + +javax.ws.rs +jsr311-api +${jsr311.api.version} + xmlunit xmlunit Modified: axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java?rev=1332545&r1=1332544&r2=1332545&view=diff == --- axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java (original) +++ axis/axis2/java/core/trunk/modules/transport/http/test/org/apache/axis2/transport/http/HTTPSenderTest.java Tue May 1 07:22:19 2012 @@ -23,8 +23,6 @@ import java.io.IOException; import java.net.URL; import javax.mail.MessagingException; -import javax.ws.rs.core.HttpHeaders; - import org.apache.axis2.Constants; import org.apache.axis2.context.ConfigurationContext; import org.apache.axis2.context.ConfigurationContextFactory; @@ -86,11 +84,11 @@ public class HTTPSenderTest extends Abst getHeaders().get("SOAPAction")); assertEquals("Not the expected HTTP Header value", "application/x-www-form-urlencoded;action=\"urn:getService\";", -getHeaders().get(HttpHeaders.CONTENT_TYPE)); +getHeaders().get("Content-Type")); assertEquals("Not the expected HTTP Header value", "localhost:" + port, -getHeaders().get(HttpHeaders.HOST)); +getHeaders().get("Host")); assertEquals("Not the expected HTTP Header value", "Axis2", -getHeaders().get(HttpHeaders.USER_AGENT)); +getHeaders().get("User-Agent")); } /** @@ -110,11 +108,11 @@ public class HTTPSenderTest extends Abst assertEquals("Not the expected HTTP Header value", "urn:postService", getHeaders().get("SOAPAction")); assertEquals("Not the expected HTTP Header value", "application/xml", -getHeaders().get(HttpHeaders.CONTENT_TYPE)); +getHeaders().get("Content-Type")); assertEquals("Not the expected HTTP Header value", "localhost:" + port, -getHeaders().get(HttpHeaders.HOST)); +getHeaders().get("Host")); assertEquals("Not the expected HTTP Header value", "Axis2", -getHeaders().get(HttpHeaders.USER_AGENT)); +getHeaders().get("User-Agent")); // test with SOAP payload. sendViaHTTP(Constants.Configuration.HTTP_METHOD_POST, "urn:postService", @@ -125,11 +123,11 @@ public class HTTPSenderTest extends Abst assertEquals("Not the expected HTTP Header value", "urn:postService", getHeaders().get("SOAPAction").replace("\"", "")); assertEquals("Not the expected HTTP Header value", "text/xml", -getHeaders().get(HttpHeaders.CONTENT_TYPE)); +getHeaders().get("Content-Type")); assertEquals("Not the expected HTTP Header value", "localhost:" + port, -getHeaders().get(HttpHeaders.HOST)); +getHeaders().get("Host")); assertEquals("Not the expected HTTP
svn commit: r1332558 - in /axis/axis2/java/core/branches/1_6: ./ modules/kernel/pom.xml modules/parent/pom.xml
Author: sagara Date: Tue May 1 08:08:52 2012 New Revision: 1332558 URL: http://svn.apache.org/viewvc?rev=1332558&view=rev Log: Merged r1332545 to the 1.6 branch. Modified: axis/axis2/java/core/branches/1_6/ (props changed) axis/axis2/java/core/branches/1_6/modules/kernel/pom.xml axis/axis2/java/core/branches/1_6/modules/parent/pom.xml Propchange: axis/axis2/java/core/branches/1_6/ -- Merged /axis/axis2/java/core/trunk:r1332545 Modified: axis/axis2/java/core/branches/1_6/modules/kernel/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/kernel/pom.xml?rev=1332558&r1=1332557&r2=1332558&view=diff == --- axis/axis2/java/core/branches/1_6/modules/kernel/pom.xml (original) +++ axis/axis2/java/core/branches/1_6/modules/kernel/pom.xml Tue May 1 08:08:52 2012 @@ -90,7 +90,6 @@ javax.ws.rs jsr311-api -1.0 commons-io Modified: axis/axis2/java/core/branches/1_6/modules/parent/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/parent/pom.xml?rev=1332558&r1=1332557&r2=1332558&view=diff == --- axis/axis2/java/core/branches/1_6/modules/parent/pom.xml (original) +++ axis/axis2/java/core/branches/1_6/modules/parent/pom.xml Tue May 1 08:08:52 2012 @@ -122,6 +122,7 @@ false '${settings.localRepository}' 1.1 +1.1.1 @@ -725,6 +726,11 @@ woden-impl-dom ${woden.version} + +javax.ws.rs +jsr311-api +${jsr311.api.version} + xmlunit xmlunit
svn commit: r1332584 - /axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/
Author: veithen Date: Tue May 1 09:18:52 2012 New Revision: 1332584 URL: http://svn.apache.org/viewvc?rev=1332584&view=rev Log: Use the proper Axiom APIs to access the original JSON string in the OMDataSource. Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/JSONBadgerfishDataSource.java axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/JSONBadgerfishMessageFormatter.java axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/JSONDataSource.java axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/JSONMessageFormatter.java Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java?rev=1332584&r1=1332583&r2=1332584&view=diff == --- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java (original) +++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONDataSource.java Tue May 1 09:18:52 2012 @@ -21,6 +21,8 @@ package org.apache.axis2.json; import org.apache.axiom.om.OMException; import org.apache.axiom.om.ds.AbstractPullOMDataSource; +import org.codehaus.jettison.AbstractXMLInputFactory; +import org.codehaus.jettison.json.JSONTokener; import javax.xml.stream.XMLStreamReader; import javax.xml.stream.XMLStreamException; @@ -44,23 +46,24 @@ public abstract class AbstractJSONDataSo this.jsonReader = jsonReader; } -/** - * Gives the StAX reader using the "Mapped" formatted input JSON String. - * - * @return The XMLStreamReader according to the JSON String. - * @throws javax.xml.stream.XMLStreamException - * if there is an error while making the StAX reader. - */ - -public abstract XMLStreamReader getReader() throws XMLStreamException; +public final XMLStreamReader getReader() throws XMLStreamException { +return getXMLInputFactory().createXMLStreamReader(new JSONTokener(getJSONString())); +} +protected abstract AbstractXMLInputFactory getXMLInputFactory(); + public boolean isDestructiveRead() { // TODO: for the moment the data source in not destructive (because it reads the entire message into memory before processing it), but this will change... return false; } +@Override +public Object getObject() { +return getJSONString(); +} + //returns the json string by consuming the JSON input stream. -protected String getJSONString() { +private String getJSONString() { if (isRead) { return jsonString; } else { Modified: axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java?rev=1332584&r1=1332583&r2=1332584&view=diff == --- axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java (original) +++ axis/axis2/java/core/trunk/modules/json/src/org/apache/axis2/json/AbstractJSONMessageFormatter.java Tue May 1 09:18:52 2012 @@ -50,6 +50,18 @@ import java.net.URL; public abstract class AbstractJSONMessageFormatter implements MessageFormatter { +private final Class dataSourceClass; + +/** + * Constructor. + * + * @param dataSourceClass + *the {@link OMDataSource} class corresponding to the JSON format used by this + *message formatter; this information is used for optimization (pass through) + */ +public AbstractJSONMessageFormatter(Class dataSourceClass) { +this.dataSourceClass = dataSourceClass; +} public String getContentType(MessageContext msgCtxt, OMOutputFormat format, String soapActionString) { @@ -83,9 +95,8 @@ public abstract class AbstractJSONMessag //if the element is an OMSourcedElement and it contains a JSONDataSource with //correct convention, directly get the JSON string. -if (element instanceof OMSourcedElement && -getStringToWrite(((OMSourcedElement)element).getDataSource()) != null) { -String jsonToWrite = getStringToWrite(((OMSourcedElement)element).getDataSource()); +String jsonToWrite = getStringToWrite(element); +if (jsonToWrite != null) { return jsonToWrite.getBytes(); //otherwise serialize the OM by e
svn commit: r1332587 - /axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java
Author: sagara Date: Tue May 1 09:24:09 2012 New Revision: 1332587 URL: http://svn.apache.org/viewvc?rev=1332587&view=rev Log: AXIS2-5303 - Fixed possible NullPointerException Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java Modified: axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java?rev=1332587&r1=1332586&r2=1332587&view=diff == --- axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java (original) +++ axis/axis2/java/core/trunk/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java Tue May 1 09:24:09 2012 @@ -18,7 +18,12 @@ */ package org.apache.axis2.deployment.util; -import java.io.*; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.io.PrintStream; import java.util.logging.Level; import java.util.logging.Logger; @@ -135,16 +140,18 @@ public class TempFileManager { throws IOException { // Select all the files File[] files = rootDir.listFiles(); -for (File file : files) { -// If the file is a directory, we will -// recursively call delete on it. -if (file.isDirectory()) { -recursiveDelete(file); -} else { -// It is just a file so we are safe to -// delete it -if (!file.delete()) { -throw new IOException("Could not delete: " + file.getAbsolutePath()); +if (files != null) { +for (File file : files) { +// If the file is a directory, we will +// recursively call delete on it. +if (file.isDirectory()) { +recursiveDelete(file); +} else { +// It is just a file so we are safe to +// delete it +if (!file.delete()) { +throw new IOException("Could not delete: " + file.getAbsolutePath()); +} } } }
svn commit: r1332589 - in /axis/axis2/java/core/branches/1_6: ./ modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java
Author: sagara Date: Tue May 1 09:27:26 2012 New Revision: 1332589 URL: http://svn.apache.org/viewvc?rev=1332589&view=rev Log: Merged r1332587 to the 1.6 branch. Modified: axis/axis2/java/core/branches/1_6/ (props changed) axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java Propchange: axis/axis2/java/core/branches/1_6/ -- Merged /axis/axis2/java/core/trunk:r1332587 Modified: axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java?rev=1332589&r1=1332588&r2=1332589&view=diff == --- axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java (original) +++ axis/axis2/java/core/branches/1_6/modules/kernel/src/org/apache/axis2/deployment/util/TempFileManager.java Tue May 1 09:27:26 2012 @@ -18,7 +18,12 @@ */ package org.apache.axis2.deployment.util; -import java.io.*; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileFilter; +import java.io.IOException; +import java.io.PrintStream; import java.util.logging.Level; import java.util.logging.Logger; @@ -135,16 +140,18 @@ public class TempFileManager { throws IOException { // Select all the files File[] files = rootDir.listFiles(); -for (File file : files) { -// If the file is a directory, we will -// recursively call delete on it. -if (file.isDirectory()) { -recursiveDelete(file); -} else { -// It is just a file so we are safe to -// delete it -if (!file.delete()) { -throw new IOException("Could not delete: " + file.getAbsolutePath()); +if (files != null) { +for (File file : files) { +// If the file is a directory, we will +// recursively call delete on it. +if (file.isDirectory()) { +recursiveDelete(file); +} else { +// It is just a file so we are safe to +// delete it +if (!file.delete()) { +throw new IOException("Could not delete: " + file.getAbsolutePath()); +} } } }
svn commit: r1332835 - in /axis/axis2/java/core/trunk/modules/json: ./ test-repository/ test-repository/services/ test-repository/services/POJOService.aar/ test-repository/services/POJOService.aar/MET
Author: veithen Date: Tue May 1 21:18:45 2012 New Revision: 1332835 URL: http://svn.apache.org/viewvc?rev=1332835&view=rev Log: Added an integration test for Badgerfish with a POJO service. Added: axis/axis2/java/core/trunk/modules/json/test-repository/ axis/axis2/java/core/trunk/modules/json/test-repository/services/ axis/axis2/java/core/trunk/modules/json/test-repository/services/POJOService.aar/ axis/axis2/java/core/trunk/modules/json/test-repository/services/POJOService.aar/META-INF/ axis/axis2/java/core/trunk/modules/json/test-repository/services/POJOService.aar/META-INF/services.xml (with props) axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/POJOService.java (with props) Modified: axis/axis2/java/core/trunk/modules/json/pom.xml axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java Modified: axis/axis2/java/core/trunk/modules/json/pom.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/pom.xml?rev=1332835&r1=1332834&r2=1332835&view=diff == --- axis/axis2/java/core/trunk/modules/json/pom.xml (original) +++ axis/axis2/java/core/trunk/modules/json/pom.xml Tue May 1 21:18:45 2012 @@ -61,6 +61,12 @@ ${project.version} test + +${project.groupId} +axis2-adb +${project.version} +test + http://axis.apache.org/axis2/java/core/ Added: axis/axis2/java/core/trunk/modules/json/test-repository/services/POJOService.aar/META-INF/services.xml URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/test-repository/services/POJOService.aar/META-INF/services.xml?rev=1332835&view=auto == --- axis/axis2/java/core/trunk/modules/json/test-repository/services/POJOService.aar/META-INF/services.xml (added) +++ axis/axis2/java/core/trunk/modules/json/test-repository/services/POJOService.aar/META-INF/services.xml Tue May 1 21:18:45 2012 @@ -0,0 +1,28 @@ + + +http://example.org";> +POJO Service +http://example.org"/> + +http://www.w3.org/2004/08/wsdl/in-only"; class="org.apache.axis2.rpc.receivers.RPCInOnlyMessageReceiver"/> +http://www.w3.org/2004/08/wsdl/in-out"; class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> + +org.apache.axis2.json.POJOService + \ No newline at end of file Propchange: axis/axis2/java/core/trunk/modules/json/test-repository/services/POJOService.aar/META-INF/services.xml -- svn:eol-style = native Modified: axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java URL: http://svn.apache.org/viewvc/axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java?rev=1332835&r1=1332834&r2=1332835&view=diff == --- axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java (original) +++ axis/axis2/java/core/trunk/modules/json/test/org/apache/axis2/json/JSONIntegrationTest.java Tue May 1 21:18:45 2012 @@ -19,7 +19,9 @@ package org.apache.axis2.json; -import junit.framework.TestCase; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertTrue; + import org.apache.axiom.om.OMAbstractFactory; import org.apache.axiom.om.OMElement; import org.apache.axiom.om.OMFactory; @@ -34,10 +36,20 @@ import org.apache.axis2.description.Axis import org.apache.axis2.testutils.PortAllocator; import org.apache.axis2.transport.http.SimpleHTTPServer; import org.apache.axis2.util.Utils; +import org.junit.AfterClass; +import org.junit.Assert; +import org.junit.BeforeClass; +import org.junit.Test; +import java.io.BufferedReader; import java.io.File; +import java.io.InputStreamReader; +import java.io.OutputStreamWriter; +import java.io.Writer; +import java.net.HttpURLConnection; +import java.net.URL; -public class JSONIntegrationTest extends TestCase implements JSONTestConstants { +public class JSONIntegrationTest implements JSONTestConstants { private static AxisService service; @@ -47,44 +59,38 @@ public class JSONIntegrationTest extends private static ConfigurationContext configurationContext; -private static EndpointReference targetEPR; - -public JSONIntegrationTest() { -} +private static EndpointReference echoTargetEPR; +private static String pojoUri; -private static int count = 0; +@BeforeClass +public static void startServer() throws Exception { +int testingPort = PortAllocator.allocatePort(); +echoTargetEPR = new EndpointReference( +"http://127.0.0.1:"; + (testingPort) +