You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@activemq.apache.org by johncarl81 <je...@kcp.com> on 2010/02/01 16:16:08 UTC

Re: Testing around BlobMessage

Another related question...

Am I required to have a ftp (or similar... scp?) server running side by side
with activemq to utilize the BlobMessage functionality?  Seems like I would
have to from the way the unit tests work.

Thanks again.

John



Gary Tully wrote:
> 
> have a look at org.apache.activemq.blob.FTPBlobTest in activemq-core
> 
> Blobs just have url references to them and make use of http or ftp to
> upload
> and download the message content. So for http you need to configure a http
> endpoint in your unit test.
> In the FTPBlobTest an embedded ftp server is used as the transfer policy
> indicates to use ftp. You need to do something similar with say, embedded
> jetty
> 
> 2010/1/27 johncarl81 <je...@kcp.com>
> 
>>
>> Hello,
>>
>> I am trying to write some unit tests around an embedded ActiveMQ
>> configured
>> using the suggested testing configuration:
>>
>> ConnectionFactory connectionFactory = new
>> ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
>>
>> When I try to use the producer to send a message from a
>> session.createBlobMessage(...) the unit test responds with the following
>> exception:
>>
>> javax.jms.JMSException: Connection refused: connect
>>        at
>>
>> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
>>        at
>>
>> org.apache.activemq.command.ActiveMQBlobMessage.onSend(ActiveMQBlobMessage.java:176)
>>        at
>> org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1674)
>>        at
>>
>> org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:231)
>>        at
>>
>> org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:241)
>>        ...
>> Caused by: java.net.ConnectException: Connection refused: connect
>>        at java.net.PlainSocketImpl.socketConnect(Native Method)
>>        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
>>        at
>> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
>>        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
>>        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>>        at java.net.Socket.connect(Socket.java:519)
>>        at java.net.Socket.connect(Socket.java:469)
>>        at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
>>        at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
>>        at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
>>        at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
>>        at sun.net.www.http.HttpClient.New(HttpClient.java:306)
>>        at sun.net.www.http.HttpClient.New(HttpClient.java:323)
>>        at
>>
>> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:837)
>>        at
>>
>> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:778)
>>        at
>>
>> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:703)
>>        at
>>
>> sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:881)
>>        at
>>
>> org.apache.activemq.blob.DefaultBlobUploadStrategy.uploadStream(DefaultBlobUploadStrategy.java:59)
>>        at
>> org.apache.activemq.blob.BlobUploader.upload(BlobUploader.java:53)
>>        at
>>
>> org.apache.activemq.command.ActiveMQBlobMessage.onSend(ActiveMQBlobMessage.java:173)
>>        ... 32 more
>>
>> It looks like the client is trying to upload the 'blob' and failing to do
>> so
>> because of a connection problem (refused).
>>
>> Is there a better way to test around the blob message functionality? 
>> Maybe
>> mocking the functionality further than simply embedding activemq?
>>
>> Thanks for your reply.
>>
>> John
>> --
>> View this message in context:
>> http://old.nabble.com/Testing-around-BlobMessage-tp27333888p27333888.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> http://blog.garytully.com
> 
> Open Source Integration
> http://fusesource.com
> 
> 

-- 
View this message in context: http://old.nabble.com/Testing-around-BlobMessage-tp27333888p27405823.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Testing around BlobMessage

Posted by Gary Tully <ga...@gmail.com>.
want to submit your hack as a patch, using ssh/scp makes great sense.

On 2 August 2011 17:07, johncarl81 <jo...@gmail.com> wrote:
> Pawan Chhabra <pa...@...> writes:
>
>>
>>
>> I had faced the similar problem. you need to set policy like
>>
> connectionFactory.getBlobTransferPolicy().setUploadUrl("http://127.0.0.1:8161/fileserver/");
>>
>>
>
> Just a follow up since I found this post from last year.
>
> We've successfully used SSH / SCP to transfer files out of band using the
> blob transfer policy and a little hacking of the upload url (urls don't
> support).
>
>
>
>
>



-- 
http://fusesource.com
http://blog.garytully.com

Re: Testing around BlobMessage

Posted by johncarl81 <jo...@gmail.com>.
Pawan Chhabra <pa...@...> writes:

> 
> 
> I had faced the similar problem. you need to set policy like
>
connectionFactory.getBlobTransferPolicy().setUploadUrl("http://127.0.0.1:8161/fileserver/");
> 
> 

Just a follow up since I found this post from last year.

We've successfully used SSH / SCP to transfer files out of band using the 
blob transfer policy and a little hacking of the upload url (urls don't
support).





Re: Testing around BlobMessage

Posted by Pawan Chhabra <pa...@infosys.com>.
I had faced the similar problem. you need to set policy like
connectionFactory.getBlobTransferPolicy().setUploadUrl("http://127.0.0.1:8161/fileserver/");



Gary Tully wrote:
> 
> yea, that is correct.
> 
> On 1 February 2010 15:16, johncarl81 <je...@kcp.com> wrote:
> 
>>
>> Another related question...
>>
>> Am I required to have a ftp (or similar... scp?) server running side by
>> side
>> with activemq to utilize the BlobMessage functionality?  Seems like I
>> would
>> have to from the way the unit tests work.
>>
>> Thanks again.
>>
>> John
>>
>>
>>
>> Gary Tully wrote:
>> >
>> > have a look at org.apache.activemq.blob.FTPBlobTest in activemq-core
>> >
>> > Blobs just have url references to them and make use of http or ftp to
>> > upload
>> > and download the message content. So for http you need to configure a
>> http
>> > endpoint in your unit test.
>> > In the FTPBlobTest an embedded ftp server is used as the transfer
>> policy
>> > indicates to use ftp. You need to do something similar with say,
>> embedded
>> > jetty
>> >
>> > 2010/1/27 johncarl81 <je...@kcp.com>
>> >
>> >>
>> >> Hello,
>> >>
>> >> I am trying to write some unit tests around an embedded ActiveMQ
>> >> configured
>> >> using the suggested testing configuration:
>> >>
>> >> ConnectionFactory connectionFactory = new
>> >> ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
>> >>
>> >> When I try to use the producer to send a message from a
>> >> session.createBlobMessage(...) the unit test responds with the
>> following
>> >> exception:
>> >>
>> >> javax.jms.JMSException: Connection refused: connect
>> >>        at
>> >>
>> >>
>> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
>> >>        at
>> >>
>> >>
>> org.apache.activemq.command.ActiveMQBlobMessage.onSend(ActiveMQBlobMessage.java:176)
>> >>        at
>> >> org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1674)
>> >>        at
>> >>
>> >>
>> org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:231)
>> >>        at
>> >>
>> >>
>> org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:241)
>> >>        ...
>> >> Caused by: java.net.ConnectException: Connection refused: connect
>> >>        at java.net.PlainSocketImpl.socketConnect(Native Method)
>> >>        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
>> >>        at
>> >> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
>> >>        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
>> >>        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
>> >>        at java.net.Socket.connect(Socket.java:519)
>> >>        at java.net.Socket.connect(Socket.java:469)
>> >>        at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
>> >>        at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
>> >>        at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
>> >>        at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
>> >>        at sun.net.www.http.HttpClient.New(HttpClient.java:306)
>> >>        at sun.net.www.http.HttpClient.New(HttpClient.java:323)
>> >>        at
>> >>
>> >>
>> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:837)
>> >>        at
>> >>
>> >>
>> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:778)
>> >>        at
>> >>
>> >>
>> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:703)
>> >>        at
>> >>
>> >>
>> sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:881)
>> >>        at
>> >>
>> >>
>> org.apache.activemq.blob.DefaultBlobUploadStrategy.uploadStream(DefaultBlobUploadStrategy.java:59)
>> >>        at
>> >> org.apache.activemq.blob.BlobUploader.upload(BlobUploader.java:53)
>> >>        at
>> >>
>> >>
>> org.apache.activemq.command.ActiveMQBlobMessage.onSend(ActiveMQBlobMessage.java:173)
>> >>        ... 32 more
>> >>
>> >> It looks like the client is trying to upload the 'blob' and failing to
>> do
>> >> so
>> >> because of a connection problem (refused).
>> >>
>> >> Is there a better way to test around the blob message functionality?
>> >> Maybe
>> >> mocking the functionality further than simply embedding activemq?
>> >>
>> >> Thanks for your reply.
>> >>
>> >> John
>> >> --
>> >> View this message in context:
>> >>
>> http://old.nabble.com/Testing-around-BlobMessage-tp27333888p27333888.html
>> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>> >>
>> >>
>> >
>> >
>> > --
>> > http://blog.garytully.com
>> >
>> > Open Source Integration
>> > http://fusesource.com
>> >
>> >
>>
>> --
>> View this message in context:
>> http://old.nabble.com/Testing-around-BlobMessage-tp27333888p27405823.html
>> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>>
>>
> 
> 
> -- 
> http://blog.garytully.com
> 
> Open Source Integration
> http://fusesource.com
> 
> 

-- 
View this message in context: http://old.nabble.com/Testing-around-BlobMessage-tp27333888p28777252.html
Sent from the ActiveMQ - User mailing list archive at Nabble.com.


Re: Testing around BlobMessage

Posted by Gary Tully <ga...@gmail.com>.
yea, that is correct.

On 1 February 2010 15:16, johncarl81 <je...@kcp.com> wrote:

>
> Another related question...
>
> Am I required to have a ftp (or similar... scp?) server running side by
> side
> with activemq to utilize the BlobMessage functionality?  Seems like I would
> have to from the way the unit tests work.
>
> Thanks again.
>
> John
>
>
>
> Gary Tully wrote:
> >
> > have a look at org.apache.activemq.blob.FTPBlobTest in activemq-core
> >
> > Blobs just have url references to them and make use of http or ftp to
> > upload
> > and download the message content. So for http you need to configure a
> http
> > endpoint in your unit test.
> > In the FTPBlobTest an embedded ftp server is used as the transfer policy
> > indicates to use ftp. You need to do something similar with say, embedded
> > jetty
> >
> > 2010/1/27 johncarl81 <je...@kcp.com>
> >
> >>
> >> Hello,
> >>
> >> I am trying to write some unit tests around an embedded ActiveMQ
> >> configured
> >> using the suggested testing configuration:
> >>
> >> ConnectionFactory connectionFactory = new
> >> ActiveMQConnectionFactory("vm://localhost?broker.persistent=false");
> >>
> >> When I try to use the producer to send a message from a
> >> session.createBlobMessage(...) the unit test responds with the following
> >> exception:
> >>
> >> javax.jms.JMSException: Connection refused: connect
> >>        at
> >>
> >>
> org.apache.activemq.util.JMSExceptionSupport.create(JMSExceptionSupport.java:62)
> >>        at
> >>
> >>
> org.apache.activemq.command.ActiveMQBlobMessage.onSend(ActiveMQBlobMessage.java:176)
> >>        at
> >> org.apache.activemq.ActiveMQSession.send(ActiveMQSession.java:1674)
> >>        at
> >>
> >>
> org.apache.activemq.ActiveMQMessageProducer.send(ActiveMQMessageProducer.java:231)
> >>        at
> >>
> >>
> org.apache.activemq.ActiveMQMessageProducerSupport.send(ActiveMQMessageProducerSupport.java:241)
> >>        ...
> >> Caused by: java.net.ConnectException: Connection refused: connect
> >>        at java.net.PlainSocketImpl.socketConnect(Native Method)
> >>        at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:333)
> >>        at
> >> java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:195)
> >>        at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:182)
> >>        at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:366)
> >>        at java.net.Socket.connect(Socket.java:519)
> >>        at java.net.Socket.connect(Socket.java:469)
> >>        at sun.net.NetworkClient.doConnect(NetworkClient.java:163)
> >>        at sun.net.www.http.HttpClient.openServer(HttpClient.java:394)
> >>        at sun.net.www.http.HttpClient.openServer(HttpClient.java:529)
> >>        at sun.net.www.http.HttpClient.<init>(HttpClient.java:233)
> >>        at sun.net.www.http.HttpClient.New(HttpClient.java:306)
> >>        at sun.net.www.http.HttpClient.New(HttpClient.java:323)
> >>        at
> >>
> >>
> sun.net.www.protocol.http.HttpURLConnection.getNewHttpClient(HttpURLConnection.java:837)
> >>        at
> >>
> >>
> sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:778)
> >>        at
> >>
> >>
> sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:703)
> >>        at
> >>
> >>
> sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:881)
> >>        at
> >>
> >>
> org.apache.activemq.blob.DefaultBlobUploadStrategy.uploadStream(DefaultBlobUploadStrategy.java:59)
> >>        at
> >> org.apache.activemq.blob.BlobUploader.upload(BlobUploader.java:53)
> >>        at
> >>
> >>
> org.apache.activemq.command.ActiveMQBlobMessage.onSend(ActiveMQBlobMessage.java:173)
> >>        ... 32 more
> >>
> >> It looks like the client is trying to upload the 'blob' and failing to
> do
> >> so
> >> because of a connection problem (refused).
> >>
> >> Is there a better way to test around the blob message functionality?
> >> Maybe
> >> mocking the functionality further than simply embedding activemq?
> >>
> >> Thanks for your reply.
> >>
> >> John
> >> --
> >> View this message in context:
> >>
> http://old.nabble.com/Testing-around-BlobMessage-tp27333888p27333888.html
> >> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
> >>
> >>
> >
> >
> > --
> > http://blog.garytully.com
> >
> > Open Source Integration
> > http://fusesource.com
> >
> >
>
> --
> View this message in context:
> http://old.nabble.com/Testing-around-BlobMessage-tp27333888p27405823.html
> Sent from the ActiveMQ - User mailing list archive at Nabble.com.
>
>


-- 
http://blog.garytully.com

Open Source Integration
http://fusesource.com