Announcement Announcement Module
Collapse
No announcement yet.
How to test HttpInvoker Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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
    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.

    Comment


    • #3
      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

      Comment


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

        Comment


        • #5
          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

          Comment


          • #6
            Call a method on the remote service?

            Comment

            Working...
            X