• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Junit / httpunit questions.

 
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure this is the correct group but so far this seems to be the closest to what I'm looking for. I have some httpunit questions. Should I post them here?
 
Carl Parrish
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Here is my code. It shouldn't be passing but it is. any ideas why?
<pre>
public void TestLink()throws Exception {

WebResponse resp = null;
WebLink link = null;
WebRequest req = null;
WebResponse addMember = null;
String linkValue = " ";
try {
resp = wc.getResponse( url );
link = resp.getLinkWith("click here");
linkValue = link.getURLString();

}
catch (java.net.MalformedURLException e) {
System.out.println("Bad url: " + e);
} catch (java.io.IOException e) {
System.out.println("IO Err: " + e);
} catch (org.xml.sax.SAXException e) {
System.out.println("XML Err: " + e);
}
addMember = wc.getResponse(linkValue);

assertEquals(200, addMember.getResponseCode());
}
</pre>

(reformatted by moderator for clarity)
[ May 15, 2002: Message edited by: Junilu Lacar ]
 
Carl Parrish
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay addMember should be addMeberPage. And I'm beginning to think that its a ant issue. This is the first time I'm trying to build my test suite from ant. and it doesn't seem to be getting the exceptions.
 
Carl Parrish
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay I stopped throwing the Exceptions and wrapped everything in a try catch block. I also renamed the method 'testLink' instead of 'TestLink' but it still says
"variable addMemberPage might not have been initialized"

Any idea why not?
 
Carl Parrish
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay I figured it out. I had to set addMemberPage to null at the top first.
So now I have a new question.
do I have to do anything special to create a https link? So for instance if I have this.

And link is of the form "https://myURLhere.com" should that work?? Right now I'm getting a 404 error even though its working on my browser.
 
Carl Parrish
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay from the sourceforge site I found that to get https working you have to set the following java system property.
-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol
Which would be fine if I knew how to set a java system property from within ant. If anyone knows please share, else I'll share when I figure it out.
Carl P.
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Carl Parrish:
I'm not sure this is the correct group but so far this seems to be the closest to what I'm looking for. I have some httpunit questions. Should I post them here?


The "IDE's and other tools" forum might be more appropriate...
Regards, Ilja
 
Carl Parrish
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hmmmm httpunit is a unit testing suite ala junit.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Carl Parrish:
hmmmm httpunit is a unit testing suite ala junit.


Yes, I know. There are frequently JUnit questions posted (and answered) in the "IDE's and other tools" forum. After all, it is a testing tool, isn't it?
 
Carl Parrish
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okay then can a modirator move the discussion over there? For the archives I want to post what I've found about posting java system properties via ant (from a nice javaranch member)
Here is a snip from my build.xml file
[snip]
<!-- =================================================================== -->
<!-- Runs the test code -->
<!-- =================================================================== -->
<target name="test" depends="compile">
<echo message="Starting HTTP Test (in separate VM)" />
<java classname="HTTPTest" fork="yes" >
<classpath>
<path refid="base.classpath" />
<pathelement location="${classes.dir}" />
<pathelement location="${classpath}" />
</classpath>
<jvmarg value="-Djava.protocol.handler.pkgs=com.sun.net.ssl.internal.www.protocol" />
</java>
</target>
[/snip]
 
Carl Parrish
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But this still doesn't seem to resolve my https problem so if anyone have any advise please share.
 
Ilja Preuss
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you take a look at http://httpunit.sourceforge.net/doc/sslfaq.html ?
 
Carl Parrish
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thanks, this was helpful but I still can't seem to get it working. My server has a thawte ca so I think I should be fine there (it in some funkcy .pfx format so I can't add it anyways). And I installed jsse. But I still get a 404 error While trying to access the page.
 
Please do not shoot the fish in this barrel. But you can shoot at this tiny ad:
a bit of art, as a gift, the permaculture playing cards
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic