Results 1 to 6 of 6

Thread: How to test HttpInvoker

  1. #1
    Join Date
    Nov 2006
    Posts
    218

    Default How to test HttpInvoker

    Hi,

    I need to do an integration test about HttpInvoker. I need to launch in "runtime" jetty and "deploy" in it. Reading around this forum, I have found some threads about this, but I have not understand exactly if it's really possible.

    Can you link me to right post or doc about this problem?

    Thanks,
    Julio

  2. #2
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    My guess is it won't be worth the effort to embed jetty in your actual test case. You can use the Eclipse or maven plugins from jetty very easily and conveniently to launch a server and deploy your service, and then run a test against it in a separate process. If you really want to embed it yourself, then jetty is probably the easiest platform - take a look at the source code for the Eclipse and maven plugins (available from mortbay). There is also a jetty forum where you could ask for help with embedding the server - they are usually pretty helpful there.

  3. #3
    Join Date
    Nov 2006
    Posts
    218

    Default

    Ok, thanks.

    Now it seems that jetty running in my tests.

    Now I would like "test" if my httpinvoker is really "linked" to embedded-jetty. Is there a way (simulating a dummy-request I suppose)?

    Thanks,
    Julio

  4. #4
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    I'm really not sure what you are asking here. Can you provide an example with some code snippets or something?

  5. #5
    Join Date
    Nov 2006
    Posts
    218

    Default

    that's code:

    jetty.xml

    Code:
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
    
    <beans>
        <bean id="Server"
              class="org.mortbay.jetty.Server" init-method="start" destroy-method="stop">
            <property name="connectors">
                <list>
                    <bean id="Connector" class="org.mortbay.jetty.nio.SelectChannelConnector">
                        <property name="port" value="8181"/>
                    </bean>
                </list>
            </property>
    
            <property name="handler">
                <bean id="handlers"
                      class="org.mortbay.jetty.handler.HandlerCollection">
                    <property name="handlers">
                        <list>
                            <bean id="contexts"
                                  class="org.mortbay.jetty.handler.ContextHandlerCollection">
                                <property name="handlers">
                                    <list>
                                        <bean class="org.mortbay.jetty.webapp.WebAppContext">
                                            <property name="contextPath" value="/"/>
                                            <!--  <property name="war" value="../../main/webapp/WEB-INF/web.xml"> -->
                                            <property name="resourceBase" value="web">
                                            </property>
                                        </bean>
                                    </list>
                                </property>
                            </bean>
                        </list>
                    </property>
                </bean>
            </property>
        </bean>
    </beans>
    (i'm not sure about meaning of <property name="resourceBase" value="web">)

    that's part of my test (just start configuration):

    Code:
    private static ApplicationContext applicationContext = new ClassPathXmlApplicationContext(new String[] { "/applicationContext-business.xml", "/jetty.xml"});
    
    ....
    
    protected void setUp() throws Exception {
    		this.jetty = (Server) applicationContext.getBean("Server");
    ....
    }
    in log files I can see that jetty starts.

    In "/applicationContext-business.xml" is configured a httpinvoker. It works normally but how can I know that it's "grabbed/catched/linked" (sorry my english is horrible) by "this.jetty"?

    Thanks,
    Julio

  6. #6
    Join Date
    Jun 2005
    Posts
    4,241

    Default

    Call a method on the remote service?

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •