Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Is there more examples #30

Closed
jwingo opened this issue Dec 12, 2012 · 13 comments
Closed

Is there more examples #30

jwingo opened this issue Dec 12, 2012 · 13 comments

Comments

@jwingo
Copy link

jwingo commented Dec 12, 2012

Im new to restfuse and I'm trying to a response code in subsequent request calls and I cant find any information or examples on how to do this with restfuse. Could anyone lead me into a general direction or if anyone has any examples as to how I can use a response value in other request calls or in the header. Thanks

@dcrissman
Copy link

You want to look at the RequestContext off of Destination. There you can set a few things, including header information. At this time there is currently no way to reset or change the values in RequestContext once set (see #24), so depending on your needs, you may need to create new Destination instances at the setup of each test.

@jwingo
Copy link
Author

jwingo commented Dec 12, 2012

So I would not need to set the @httptest() for the next request call? Also I'm not able to select this with the jar files that i downloaded: destination.getRequestContext().addHeader. addHeader is not an option and when I type it i receive an error

@dcrissman
Copy link

You will need @httptest for each unit test, just like JUnits @test annotation.

addHeader may not actually be in a build yet. Try just accessing the variable directly. That is depreciated in the current code base, but should work for now. getRequestContext().header

@jwingo
Copy link
Author

jwingo commented Dec 12, 2012

Ok so how would i pass that value to the next request b/c i have tried to pass it as a parameter and im receiving all kinds of errors

@dcrissman
Copy link

Once you have added a header it will be used for all @HttpTests, unless you clear the headers collection. Otherwise, you'd need to store the values in your testing code.

@jwingo
Copy link
Author

jwingo commented Dec 12, 2012

Ok even when i use your example im still receiving an error:
destination.getRequestContext().headers("Cookie", "name:value");
Error is the following:
The method headers(String, String) is undefined for the type RequestContext

@dcrissman
Copy link

headers is a public property, not a method. In the next release, that will be depreciated in favour of a setter method.

@jwingo
Copy link
Author

jwingo commented Dec 13, 2012

I think I got it. Thanks for your help

@jwingo
Copy link
Author

jwingo commented Dec 17, 2012

One more question, if i may. I need to make the path dynamic yet i see the addPathSegment method in an example but i dont see it as an option in my code when i declare context as a RequestContext. Is there another way to create a dynamically changing path?

@dcrissman
Copy link

Looks like that feature hasn't made it into a build yet, @hstaudacher would need to do that. In the meantime, you can make your own build, see #20 for steps to do that.

@jwingo
Copy link
Author

jwingo commented Dec 19, 2012

Im receiving these errors when i try to create the target file: Missing requirement: geronimo JavaxTransaction API1.1.1 and im using the following as the location: http://download.eclipse.org/tools/orbit/downloads/drops/R20110523182458/repository/. What am I missing to get this working?

@dcrissman
Copy link

You know, it looks like the some things have changed since I last made my own build. I will need to play with it some, let me know if you get it to build first.

I tried doing a maven build too, but it failed also (see #31)

@jwingo
Copy link
Author

jwingo commented Dec 26, 2012

Figured it out. Just went another route. Thanks for your help.

@jwingo jwingo closed this as completed Dec 26, 2012
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants