IBinaryStreamRepresentation usage

Poster Content
nk4um User
Posts: 37
September 13, 2014 19:09Finally figure out what's the cause

When the tests are run one by one (visualizing the test sequence first) the expected behavior is correct: a save popup is open in the browser and when the content is saved is the one produced by write.

Tried with a normal http request (in a page) and worked like a charm.

So the only problem (if any?!) is that when the entire test sequence is run at once the toString method is called instead (but I think is more over a correct behavior than a wrong one).

As usual I managed to find a weird context and complain about.

Thanks for your support,

Radu

Like · Post Reply
nk4um User
Posts: 37
September 12, 2014 15:16Imported layer1 but still don't work

Posted by tab (View)
Hi Radu, when you say "i got" what do you mean? I.e. 1) are you returning this as a response from a REST service over HTTP?
Actually the outer request come from an XUnit test sequence.

The endpoint that expects the IBinaryStreamRepresentation contains the sequence

IBinaryStreamRepresentation binaryStream = (IBinaryStreamRepresentation) myIBinaryStreamRepresentationInstance;

aContext.createResponseFrom(binaryStream);

it is in a space of a transparent mapper overlay that injects a space in the request scope (similar with session).

I imported layer1 just beside the endpoint declaration, in the same space.

In my understanding using a plain IBinaryStreamRepresentation object (obtained via a cast) and having imported layer1 will trigger the proper transreption.

But unfortunatelly the behavior is the same (default toString of Object).

Posted by tab (View)
2) you representation class is incorrect in some way

Actually I implemented write and getEncoding in a pretty straight forward way ... Any thing that I should care about?! (and probably is missing) ...

Kind regards,

Radu

Like · Post Reply
nk4um Administrator
Posts: 607
September 12, 2014 08:49

Hi Radu, when you say "i got" what do you mean? I.e. 1) are you returning this as a response from a REST service over HTTP? 2) looking in the visualizer?

The visualizer will perform a toString() if no transreptors are available. So check that you can validaly transrept this representation class. There are a number of reasons why you can't 1) you haven't imported layer1 2) you representation class is incorrect in some way

Cheers, Tony

Like · Post Reply
nk4um User
Posts: 37
September 12, 2014 07:48IBinaryStreamRepresentation usage

Hi!

Just created a resource that implements IBinaryStreamRepresantation.

The problem is that when I tried to use it

aContext.createResponseFrom(myIBinaryStreamRepresantionInstance)

i got, instead of the content that I provided via write method, the content provided by toString method (actually is missing so I got something like myIBinaryStreamRepresentation@<hashCode>.

Any idea of how to get rid of this will be very much appreciated.

Thanks,

Radu

Like · Post Reply