Package org.apache.activemq.command

Examples of org.apache.activemq.command.ActiveMQBlobMessage


     * @return a BlobMessage
     * @throws JMSException if the JMS provider fails to create this message due
     *                 to some internal error.
     */
    public BlobMessage createBlobMessage(InputStream in) throws JMSException {
        ActiveMQBlobMessage message = new ActiveMQBlobMessage();
        configureMessage(message);
        message.setBlobUploader(new BlobUploader(getBlobTransferPolicy(), in));
        message.setBlobDownloader(new BlobDownloader(getBlobTransferPolicy()));
        message.setDeletedByBroker(true);
        return message;
    }
View Full Code Here


            wrt.write("a");
        }

        wrt.close();

        ActiveMQBlobMessage message = new ActiveMQBlobMessage();
        BlobDownloadStrategy strategy = new FTPBlobDownloadStrategy(new BlobTransferPolicy());
        InputStream stream;
        try {
            message.setURL(new URL(ftpUrl + "test.txt"));
            stream = strategy.getInputStream(message);
            int i = stream.read();
            StringBuilder sb = new StringBuilder(2048);
            while(i != -1) {
                sb.append((char)i);
View Full Code Here

            assertTrue(false);
        }
    }

    public void testWrongAuthentification() throws MalformedURLException {
        ActiveMQBlobMessage message = new ActiveMQBlobMessage();
        BlobDownloadStrategy strategy = new FTPBlobDownloadStrategy(new BlobTransferPolicy());
        try {
            message.setURL(new URL("ftp://" + userNamePass + "_wrong:" + userNamePass + "@localhost:"  + ftpPort + "/ftptest/"));
            strategy.getInputStream(message);
        } catch(JMSException e) {
            assertEquals("Wrong Exception", "Cant Authentificate to FTP-Server", e.getMessage());
            return;
        } catch(Exception e) {
View Full Code Here

        assertTrue("Expect Exception", false);
    }

    public void testWrongFTPPort() throws MalformedURLException {
        ActiveMQBlobMessage message = new ActiveMQBlobMessage();
        BlobDownloadStrategy strategy = new FTPBlobDownloadStrategy(new BlobTransferPolicy());
        try {
            message.setURL(new URL("ftp://" + userNamePass + ":" + userNamePass + "@localhost:"  + 422 + "/ftptest/"));
            strategy.getInputStream(message);
        } catch(JMSException e) {
            assertEquals("Wrong Exception", "Problem connecting the FTP-server", e.getMessage());
            return;
        } catch(Exception e) {
View Full Code Here

        writer.close();

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        ((ActiveMQConnection)connection).setCopyMessageOnSend(false);

        ActiveMQBlobMessage message = (ActiveMQBlobMessage) ((ActiveMQSession)session).createBlobMessage(file);
        message.setJMSMessageID("testmessage");
        message.onSend();
        assertEquals(ftpUrl + "ID_testmessage", message.getURL().toString());
        File uploaded = new File(ftpHomeDirFile, "ID_testmessage");
        assertTrue("File doesn't exists", uploaded.exists());
    }
View Full Code Here

        writer.close();

        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        ((ActiveMQConnection)connection).setCopyMessageOnSend(false);

        ActiveMQBlobMessage message = (ActiveMQBlobMessage) ((ActiveMQSession)session).createBlobMessage(file);
        message.setJMSMessageID("testmessage");
        try {
            message.onSend();
        } catch (JMSException e) {
            e.printStackTrace();
            return;
        }
        fail("Should have failed with permission denied exception!");
View Full Code Here

public class JmsBindingTest {

    @Test
    public void testJmsBindingNoArgs() throws Exception {
        JmsBinding underTest = new JmsBinding();
        assertNull(underTest.extractBodyFromJms(null, new ActiveMQBlobMessage()));
    }
View Full Code Here

            wrt.write("a");
        }

        wrt.close();
       
        ActiveMQBlobMessage message = new ActiveMQBlobMessage();
        BlobDownloadStrategy strategy = new FTPBlobDownloadStrategy(new BlobTransferPolicy());
        InputStream stream;
        try {
            message.setURL(new URL(ftpUrl + "test.txt"));
            stream = strategy.getInputStream(message);
            int i = stream.read();
            StringBuilder sb = new StringBuilder(2048);
            while(i != -1) {
                sb.append((char)i);
View Full Code Here

            Assert.assertTrue(false);
        }
    }

    public void testWrongAuthentification() throws MalformedURLException {
        ActiveMQBlobMessage message = new ActiveMQBlobMessage();
        BlobDownloadStrategy strategy = new FTPBlobDownloadStrategy(new BlobTransferPolicy());
        try {
            message.setURL(new URL("ftp://" + userNamePass + "_wrong:" + userNamePass + "@localhost:"  + ftpPort + "/ftptest/"));
            strategy.getInputStream(message);
        } catch(JMSException e) {
            Assert.assertEquals("Wrong Exception", "Cant Authentificate to FTP-Server", e.getMessage());
            return;
        } catch(Exception e) {
View Full Code Here

        Assert.assertTrue("Expect Exception", false);
    }

    public void testWrongFTPPort() throws MalformedURLException {
        ActiveMQBlobMessage message = new ActiveMQBlobMessage();
        BlobDownloadStrategy strategy = new FTPBlobDownloadStrategy(new BlobTransferPolicy());
        try {
            message.setURL(new URL("ftp://" + userNamePass + ":" + userNamePass + "@localhost:"  + 422 + "/ftptest/"));
            strategy.getInputStream(message);
        } catch(JMSException e) {
            Assert.assertEquals("Wrong Exception", "Problem connecting the FTP-server", e.getMessage());
            return;
        } catch(Exception e) {
View Full Code Here

TOP

Related Classes of org.apache.activemq.command.ActiveMQBlobMessage

Copyright © 2018 www.massapicom. 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.