use of com.sun.xml.ws.util.ByteArrayBuffer in project metro-jax-ws by eclipse-ee4j.
the class SerializableWebServiceExceptionTest method testClientTransportExSerial5.
/**
* Tests non-serializable argument, should serialize as String
* @throws Exception
*/
public void testClientTransportExSerial5() throws Exception {
ClientTransportException cte_orig = new ClientTransportException(ClientMessages.localizableFAILED_TO_PARSE(new URL("http://example.com?wsdl"), Thread.currentThread()));
ByteArrayBuffer buffer = new ByteArrayBuffer();
ObjectOutputStream oos = new ObjectOutputStream(buffer);
oos.writeObject(cte_orig);
ObjectInputStream ois = new ObjectInputStream(buffer.newInputStream());
WebServiceException wse_ser = (WebServiceException) ois.readObject();
ObjectInputStream ois1 = new ObjectInputStream(buffer.newInputStream());
ClientTransportException cte_ser = (ClientTransportException) ois1.readObject();
assertEquals(cte_orig.getLocalizedMessage(), cte_ser.getLocalizedMessage());
assertEquals(cte_orig.getResourceBundleName(), cte_ser.getResourceBundleName());
assertEquals(cte_orig.getKey(), cte_ser.getKey());
assert (cte_orig.getArguments().length == cte_ser.getArguments().length);
assertEquals(cte_orig.getArguments()[0], cte_ser.getArguments()[0]);
assert (cte_ser.getArguments()[1] instanceof String);
assertEquals(cte_orig.getArguments()[1].toString(), cte_ser.getArguments()[1].toString());
}
use of com.sun.xml.ws.util.ByteArrayBuffer in project metro-jax-ws by eclipse-ee4j.
the class SerializableWebServiceExceptionTest method testClientTransportExSerial2.
/**
* Tests Nested Exception
* @throws Exception
*/
public void testClientTransportExSerial2() throws Exception {
ClientTransportException cte_orig = new ClientTransportException(ClientMessages.localizableEPR_WITHOUT_ADDRESSING_ON());
cte_orig.fillInStackTrace();
ByteArrayBuffer buffer = new ByteArrayBuffer();
ObjectOutputStream oos = new ObjectOutputStream(buffer);
oos.writeObject(new WebServiceException(cte_orig));
ObjectInputStream ois = new ObjectInputStream(buffer.newInputStream());
WebServiceException wse_ser = (WebServiceException) ois.readObject();
ClientTransportException cte_ser = (ClientTransportException) wse_ser.getCause();
assertEquals(cte_orig.getLocalizedMessage(), cte_ser.getLocalizedMessage());
assertEquals(cte_orig.getResourceBundleName(), cte_ser.getResourceBundleName());
assertEquals(cte_orig.getKey(), cte_ser.getKey());
assert (cte_orig.getArguments().length == cte_ser.getArguments().length);
}
use of com.sun.xml.ws.util.ByteArrayBuffer in project metro-jax-ws by eclipse-ee4j.
the class SerializableWebServiceExceptionTest method testClientTransportExSerial1.
/**
* Tests Localizable with no args
* @throws Exception
*/
public void testClientTransportExSerial1() throws Exception {
ClientTransportException cte_orig = new ClientTransportException(ClientMessages.localizableEPR_WITHOUT_ADDRESSING_ON());
cte_orig.fillInStackTrace();
ByteArrayBuffer buffer = new ByteArrayBuffer();
ObjectOutputStream oos = new ObjectOutputStream(buffer);
oos.writeObject(cte_orig);
ObjectInputStream ois = new ObjectInputStream(buffer.newInputStream());
ClientTransportException cte_ser = (ClientTransportException) ois.readObject();
assertEquals(cte_orig.getLocalizedMessage(), cte_ser.getLocalizedMessage());
assertEquals(cte_orig.getResourceBundleName(), cte_ser.getResourceBundleName());
assertEquals(cte_orig.getKey(), cte_ser.getKey());
assert (cte_orig.getArguments().length == cte_ser.getArguments().length);
}
use of com.sun.xml.ws.util.ByteArrayBuffer in project metro-jax-ws by eclipse-ee4j.
the class SerializableWebServiceExceptionTest method testClientTransportExSerial4.
/**
* Tests with two serializable arguments
* @throws Exception
*/
public void testClientTransportExSerial4() throws Exception {
WebServiceException wse_orig = new ClientTransportException(ClientMessages.localizableFAILED_TO_PARSE(new URL("http://example.com?wsdl"), new java.io.IOException("Can't access url")));
ClientTransportException cte_orig = (ClientTransportException) wse_orig;
ByteArrayBuffer buffer = new ByteArrayBuffer();
ObjectOutputStream oos = new ObjectOutputStream(buffer);
oos.writeObject(cte_orig);
ObjectInputStream ois = new ObjectInputStream(buffer.newInputStream());
WebServiceException wse_ser = (WebServiceException) ois.readObject();
ObjectInputStream ois1 = new ObjectInputStream(buffer.newInputStream());
ClientTransportException cte_ser = (ClientTransportException) ois1.readObject();
assertEquals(cte_orig.getLocalizedMessage(), cte_ser.getLocalizedMessage());
assertEquals(cte_orig.getResourceBundleName(), cte_ser.getResourceBundleName());
assertEquals(cte_orig.getKey(), cte_ser.getKey());
assert (cte_orig.getArguments().length == cte_ser.getArguments().length);
assertEquals(cte_orig.getArguments()[0], cte_ser.getArguments()[0]);
assertEquals(cte_orig.getArguments()[1].getClass(), cte_ser.getArguments()[1].getClass());
assertEquals(cte_orig.getArguments()[1].toString(), cte_ser.getArguments()[1].toString());
}
Aggregations