use of org.apache.commons.io.output.NullOutputStream in project webservices-axiom by apache.
the class OMOutputTest method testComplete.
public void testComplete() throws Exception {
OMOutputFormat mtomOutputFormat = new OMOutputFormat();
mtomOutputFormat.setDoOptimize(true);
OMOutputFormat baseOutputFormat = new OMOutputFormat();
baseOutputFormat.setDoOptimize(false);
envelope.serializeAndConsume(new NullOutputStream(), baseOutputFormat);
envelope.serializeAndConsume(new NullOutputStream(), mtomOutputFormat);
}
use of org.apache.commons.io.output.NullOutputStream in project webservices-axiom by apache.
the class AttachmentsTest method testReadOnceOnBufferedPart.
/**
* Tests that after consuming the input stream returned by {@link DataHandlerExt#readOnce()} for
* an attachment that has been buffered on disk, the temporary file for that attachment is
* deleted.
*
* @throws Exception
*/
public void testReadOnceOnBufferedPart() throws Exception {
InputStream in = getTestResource("mtom/msg-soap-wls81.txt");
MyLifecycleManager manager = new MyLifecycleManager();
Attachments attachments = new Attachments(manager, in, "multipart/related;type=\"text/xml\";boundary=\"----=_Part_0_3437046.1188904239130\";start=__WLS__1188904239161__SOAP__", true, getAttachmentsDir(), "1024");
// Read the attachment once to make sure it is buffered
DataHandler dh = attachments.getDataHandler("__WLS__1188904239162__SOAP__");
InputStream content = dh.getInputStream();
IOUtils.copy(content, new NullOutputStream());
content.close();
assertEquals(1, manager.getFileCount());
// Now consume the content of the attachment
content = ((DataHandlerExt) dh).readOnce();
IOUtils.copy(content, new NullOutputStream());
content.close();
// The temporary file should have been deleted
assertEquals(0, manager.getFileCount());
in.close();
}
use of org.apache.commons.io.output.NullOutputStream in project webservices-axiom by apache.
the class SerializerTest method testUnmappableCharacterInProcessingInstruction.
@Test(expected = StreamException.class)
public void testUnmappableCharacterInProcessingInstruction() throws Exception {
Serializer handler = new Serializer(new NullOutputStream(), "ascii");
handler.startFragment();
handler.startProcessingInstruction("test");
handler.processCharacterData("c'est la fête!", false);
handler.endProcessingInstruction();
handler.completed();
}
use of org.apache.commons.io.output.NullOutputStream in project webservices-axiom by apache.
the class SerializerTest method testUnmappableCharacterInCDATASection.
@Test(expected = StreamException.class)
public void testUnmappableCharacterInCDATASection() throws Exception {
Serializer handler = new Serializer(new NullOutputStream(), "ascii");
handler.startFragment();
handler.startCDATASection();
handler.processCharacterData("c'est la fête!", false);
handler.endCDATASection();
handler.completed();
}
use of org.apache.commons.io.output.NullOutputStream in project webservices-axiom by apache.
the class SerializerTest method testUnmappableCharacterInName.
@Test(expected = StreamException.class)
public void testUnmappableCharacterInName() throws Exception {
Serializer handler = new Serializer(new NullOutputStream(), "iso-8859-15");
handler.startFragment();
handler.startElement("", "Ͱ", "");
handler.attributesCompleted();
handler.endElement();
handler.completed();
}
Aggregations