Can we add any external jar to the REST client GUI?

88 views
Skip to first unread message

Tanusree M

unread,
Jul 8, 2013, 5:48:56 PM7/8/13
to rest-...@googlegroups.com
Hi,
First I want to thank you for the wonderful tool for helping testing the rest web services.
I just started using the RESTClient GUI tool. I found it very interesting. What I'm trying is, 
I'm trying to save my response to a jason file in my local machine, then trying to use JUnit to match the values for each keys from the json file.
Now when I'm trying to import some external libs I'm getting error.
Here 
I'm getting the following error:
When I imported the import org.json.simple.parser.JSONParser;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject; in eclipse, I added external jars but I don't know if I can do that for the RESTClient GUI tool.
Pls advice me.
==========================================================================================================================================================
ERROR
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------



org.wiztools.restclient.bean.TestException: 
at org.wiztools.restclient.TestUtil.getTestSuite(TestUtil.java:73)
at org.wiztools.restclient.HTTPClientRequestExecuter.execute(HTTPClientRequestExecuter.java:461)
at org.wiztools.restclient.ui.RESTViewImpl$2.run(RESTViewImpl.java:322)
Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed, __GenRESTTestCase__: 4: unable to resolve class org.json.simple.parser.JSONParser
 @ line 4, column 1.__GenRESTTestCase__: 5: unable to resolve class org.json.simple.JSONObject
 @ line 5, column 1.__GenRESTTestCase__: 26: unable to resolve class org.json.simple.parser.JSONParser 
 @ line 26, column 18.__GenRESTTestCase__: 31: unable to resolve class org.json.simple.JSONObject 
 @ line 31, column 32.__GenRESTTestCase__: 34: unable to resolve class org.json.simple.JSONObject 
 @ line 34, column 30.__GenRESTTestCase__: 37: unable to resolve class org.json.simple.JSONObject 
 @ line 37, column 31.__GenRESTTestCase__: 40: unable to resolve class org.json.simple.JSONObject 
 @ line 40, column 34.__GenRESTTestCase__: 43: unable to resolve class org.json.simple.JSONObject 
 @ line 43, column 38.
8 errors

at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:296)
at org.codehaus.groovy.control.CompilationUnit.applyToSourceUnits(CompilationUnit.java:787)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:438)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:281)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:252)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:247)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:209)
at org.wiztools.restclient.TestUtil.getTestSuite(TestUtil.java:40)
... 2 more
========================================================================================================================================================================================
My Test code for the response which I wrote in the Test area of the GUI
-------------------------------------------------------------------------------------------------------------------------------

import java.io.File;
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.util.Iterator;

import org.json.simple.parser.JSONParser;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.junit.Assert;

import org.wiztools.restclient.RESTTestCase;
import org.wiztools.commons.MultiValueMap;

public class TemplateClassgetminspecTest extends
org.wiztools.restclient.RESTTestCase {
public void testStatus() {
byte[] responseBody = response.getResponseBody();

if ((response.getStatusCode() != 200) || (responseBody == null)) {
fail("Test is failed!");

} else {
try {
String str = new String(responseBody);
File newTextFile = new File("C://RESTResponse/response.txt");
FileWriter fw = new FileWriter(newTextFile);
fw.write(str);
fw.close();

JSONParser parser = new JSONParser();

Object obj = parser.parse(new FileReader(
"C://RESTResponse/response.txt"));

JSONObject jsonObject = (JSONObject) obj;

String Name = (String) jsonObject.get("Name");
assertEquals(Name,"aaab","Name value is wrong");
fail("Test is failed!");
String SSN = (String) jsonObject.get("SSN");
assertEquals(SSN,"432-97-7654","SSNvalue is wrong");
fail("Test is failed!");

}

catch (IOException iox) {
iox.printStackTrace();
} catch (Exception e) {
e.printStackTrace();
}

}
}
}

Any help will be highly appreciated.
Best Regards.
Tanusree

Subhash Chandran

unread,
Jul 9, 2013, 1:51:41 PM7/9/13
to rest-...@googlegroups.com
Tanusree,

This is a very valid point you have raised. I added this request to our issue tracker:


I will make sure the next release has some support for external Jars. Till then, I do not even have a workaround :-(

Subhash.


Tanusree

--
You received this message because you are subscribed to the Google Groups "rest-client" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rest-client...@googlegroups.com.
To post to this group, send email to rest-...@googlegroups.com.
Visit this group at http://groups.google.com/group/rest-client.
For more options, visit https://groups.google.com/groups/opt_out.
 
 



--
Subhash Chandran
Author PHP OOP: Quick & Dirty for Advanced Learners
Phone: +91 979 102 0238
Skype & GTalk: subwiz

Subhash Chandran

unread,
Jul 9, 2013, 3:05:27 PM7/9/13
to rest-...@googlegroups.com
I did a quick fix:


You will be able to add dependency Jars in ~/.rest-client/lib directory. I plan to include a GUI element to specify external Jars later. Please follow the issue for further updates.

Thanks,
Subhash.
Reply all
Reply to author
Forward
0 new messages