Examples of ImageDataSource


Examples of org.apache.axiom.attachments.utils.ImageDataSource

    public void testGetInputAttachhmentStreams() throws Exception {

        Image expectedImage;
        IncomingAttachmentInputStream dataIs;
        ImageDataSource dataSource;
        InputStream expectedDataIs;

        InputStream inStream = new FileInputStream(getTestResourceFile(inMimeFileName));
        Attachments attachments = new Attachments(inStream, contentTypeString);

        // Since SOAP part operated independently of other streams, access it
        // directly, and then get to the streams. If this sequence throws an
        // error, something is wrong with the stream handling code.
        InputStream is = attachments.getSOAPPartInputStream();
        while (is.read() != -1);

        // Get the inputstream container
        IncomingAttachmentStreams ias = attachments.getIncomingAttachmentStreams();

        dataIs = ias.getNextStream();
        expectedImage = ImageIO.read(new FileInputStream(getTestResourceFile(img1FileName)));
        dataSource = new ImageDataSource("test1.jpg", expectedImage);
        expectedDataIs = dataSource.getInputStream();
        compareStreams(dataIs, expectedDataIs);

        dataIs = ias.getNextStream();
        expectedImage = ImageIO.read(new FileInputStream(getTestResourceFile(img2FileName)));
        dataSource = new ImageDataSource("test2.jpg", expectedImage);
        expectedDataIs = dataSource.getInputStream();
        compareStreams(dataIs, expectedDataIs);

        // Confirm that no more streams are left
        assertEquals(null, ias.getNextStream());
View Full Code Here

Examples of org.apache.axiom.attachments.utils.ImageDataSource

        DataHandler dh = attachments.getDataHandler("2.urn:uuid:A3ADBAEE51A1A87B2A11443668160994@apache.org");
        InputStream dataIs = dh.getDataSource().getInputStream();

        Image expectedImage = ImageIO.read(new FileInputStream(getTestResourceFile(img2FileName)));
        ImageDataSource dataSource = new ImageDataSource("test.jpg", expectedImage);
        InputStream expectedDataIs = dataSource.getInputStream();

        // Compare data across streams
        compareStreams(dataIs, expectedDataIs);
    }
View Full Code Here

Examples of org.apache.axiom.attachments.utils.ImageDataSource

        expectedImage =
                new ImageIO().loadImage(
                        new FileInputStream(
                                getTestResourceFile(imageInFileName)));
        ImageDataSource dataSource = new ImageDataSource("WaterLilies.jpg",
                expectedImage);
        expectedDH = new DataHandler(dataSource);
        OMText binaryNode = new OMTextImpl(expectedDH, true, fac);

        envelope.addChild(body);
View Full Code Here

Examples of org.apache.axiom.attachments.utils.ImageDataSource

        OMElement image = fac.createOMElement("image", omNs);
        Image expectedImage;
        expectedImage = new ImageIO()
                .loadImage(new FileInputStream(inputFile));

        ImageDataSource dataSource = new ImageDataSource("test.jpg",
                expectedImage);
        expectedDH = new DataHandler(dataSource);
        OMText textData = fac.createOMText(expectedDH, true);
        image.addChild(textData);
View Full Code Here

Examples of org.apache.axis.attachments.ImageDataSource

    public void serialize(QName name, Attributes attributes,
                          Object value, SerializationContext context)
        throws IOException
    {
        DataHandler dh = new DataHandler(
                new ImageDataSource("source", (Image) value));
        super.serialize(name, attributes, dh, context);
    } // serialize
View Full Code Here

Examples of org.apache.axis.attachments.ImageDataSource

    public void serialize(QName name, Attributes attributes,
                          Object value, SerializationContext context)
        throws IOException
    {
        DataHandler dh = new DataHandler(
                new ImageDataSource("source", (Image) value));
        super.serialize(name, attributes, dh, context);
    } // serialize
View Full Code Here

Examples of org.apache.axis.attachments.ImageDataSource

    public void serialize(QName name, Attributes attributes,
                          Object value, SerializationContext context)
        throws IOException
    {
        DataHandler dh = new DataHandler(
                new ImageDataSource("source", (Image) value));
        super.serialize(name, attributes, dh, context);
    } // serialize
View Full Code Here

Examples of org.apache.axis.attachments.ImageDataSource

    public void serialize(QName name, Attributes attributes,
                          Object value, SerializationContext context)
        throws IOException
    {
        DataHandler dh = new DataHandler(
                new ImageDataSource("source", (Image) value));
        super.serialize(name, attributes, dh, context);
    } // serialize
View Full Code Here

Examples of org.apache.axis2.attachments.ImageDataSource

        OMElement image = fac.createOMElement("image", omNs);
        Image expectedImage;
        expectedImage = new JDK13IO()
                .loadImage(new FileInputStream(inputFile));

        ImageDataSource dataSource = new ImageDataSource("test.jpg",
                expectedImage);
        expectedDH = new DataHandler(dataSource);
        OMText textData = fac.createText(expectedDH, true);
        image.addChild(textData);
View Full Code Here

Examples of org.apache.axis2.attachments.ImageDataSource

    OMElement data = fac.createOMElement("data", omNs);
    Image expectedImage;
    expectedImage = new JDK13IO()
        .loadImage(getResourceAsStream("org/apache/axis2/mtom/test.jpg"));

    ImageDataSource dataSource = new ImageDataSource("test.jpg",
        expectedImage);
    expectedDH = new DataHandler(dataSource);
    OMTextImpl textData = new OMTextImpl(expectedDH, true);
    data.addChild(textData);
    //OMTextImpl textData1 = new OMTextImpl(expectedDH, true);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.