- On my machine, running ant -Dtestcase=FOO test
1. Still runs the unit test
I didn't know tests should be able to be isolated by testcase. I just added that functionality.
2. Fails (times out)
Did you run "ant tar" first in the $HADOOP_ROOT dir. hadoop-core-*.jar is needed for the war file. We could have used a static lib dir to hold a pre-compiled hadoop jar, but that would bring some redundancy as a whole. I am not sure in this case which way should we go. Either have a static hadoop jar to make the proxy code more independent but add some redundancy or have some dependency on the hadoop build but have a cleaner structure. I follow the latter in the patch. I can change if necessary.
- If the "UnitTest" parameter is in the URI query:
+ boolean unitTest = false;
+ if (rqst.getParameter("UnitTest") != null) unitTest = true;
What does this do?
These two lines are used to test if UnitTest parameter is in the query. It is to differentiate normal requests and unit-test-case requests. It is generally not a good idea to have unit test code mingled in the source code. But in our case, as the cactus in-container unit test is still in its early stage, It cannot set the request attributes in the webRequest. Although it has a servletRequestWrapper, but the attributes set through that are not visible to the source code request. To successfully conduct unit test, we have to do some extra work in the source code to cooperate the unit test code.
- This should be removed from tomcat-web.xml:
+ <description> name node address </description>
Is this value duplicated in the hdfsproxy configuration and the tomcat configuration?
Yes, as you can see, this property is commented out with <!-- -->. I need to delete it.
- These dependencies look suspect (ivy.xml). Are they necessary?
+ <dependency org="httpunit" name="httpunit" rev="1.6" conf="common->master"/>
+ <dependency org="htmlunit" name="htmlunit" rev="1.10" conf="common->master"/>
+ <dependency org="aspectj" name="aspectjrt" rev="1.5.3" conf="common->master"/>
aspectj is needed for cactus.
I've tried httpunit for some tests, then didn't use it in the end. I forgot to comment out/ remove these two lines in the ivy file.
- I'm not sure ProxyUtils::sendCommand should be a public method. Given that it will overwrite several system properties and no tool has a demonstrable need for it yet, it would be better if it were package-private for now.
I think it is a good idea to make it package-private so that you can still do unit test.
Hi, can you do ant tar first, then run the test again to see if you can run the test? Or you want me to add a static hadoop jar?