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(URL url, boolean deletedByBroker) throws JMSException {
        ActiveMQBlobMessage message = new ActiveMQBlobMessage();
        configureMessage(message);
        message.setURL(url);
        message.setDeletedByBroker(deletedByBroker);
        message.setBlobDownloader(new BlobDownloader(getBlobTransferPolicy()));
        return message;
    }
View Full Code Here


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

     * @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

        writer.close();
       
        Session session = connection.createSession(false, Session.AUTO_ACKNOWLEDGE);
        ((ActiveMQConnection)connection).setCopyMessageOnSend(false);
       
        ActiveMQBlobMessage message = (ActiveMQBlobMessage) ((ActiveMQSession)session).createBlobMessage(file);
        message.setMessageId(new MessageId("testmessage"));
        message.onSend();
        Assert.assertEquals(ftpUrl + "testmessage", message.getURL().toString());
        File uploaded = new File(ftpHomeDirFile, "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.setMessageId(new MessageId("testmessage"));
        try {
            message.onSend();
        } catch (JMSException e) {
            e.printStackTrace();
            return;
        }
        fail("Should have failed with permission denied exception!");
View Full Code Here

            addItem(CompositeDataConstants.MESSAGE_URL, "Body Url", SimpleType.STRING);
        }

        @Override
        public Map<String, Object> getFields(Object o) throws OpenDataException {
            ActiveMQBlobMessage m = (ActiveMQBlobMessage)o;
            Map<String, Object> rc = super.getFields(o);
            try {
                rc.put(CompositeDataConstants.MESSAGE_URL, "" + m.getURL().toString());
            } catch (JMSException e) {
                rc.put(CompositeDataConstants.MESSAGE_URL, "");
            }
            return rc;
        }
View Full Code Here

                msg.setConnection(connection);
                msg.setText(textMsg.getText());
                activeMessage = msg;
            } else if (message instanceof BlobMessage) {
              BlobMessage blobMessage = (BlobMessage)message;
              ActiveMQBlobMessage msg = new ActiveMQBlobMessage();
              msg.setConnection(connection);
              msg.setBlobDownloader(new BlobDownloader(connection.getBlobTransferPolicy()));
              try {
          msg.setURL(blobMessage.getURL());
        } catch (MalformedURLException e) {
         
        }
              activeMessage = msg;
            } else {
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.close();

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

      Assert.assertTrue(false);
    }
  }
 
  public void testWrongAuthentification() {
    ActiveMQBlobMessage message = new ActiveMQBlobMessage();
    BlobDownloadStrategy strategy = new FTPBlobDownloadStrategy();
    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

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.