Did some quick digging into the code and here what i found the problem.

It works fine if i use this Spring context loader.

1. ClassPathResource resource = new ClassPathResource("
applicationContext.xml");
        BeanFactory factory = new XmlBeanFactory(resource);

        Server server = (Server) factory.getBean("server");

        System.out.println("key1: " + server.getContext
().getParameters().getFirstValue("key1"));

2. However in Spring 2.5 framework, I use this and it returns NULL on the
parameters if i use this. (All the beans loaded perfectly fine BTW).

       ApplicationContext context = new ClassPathXmlApplicationContext(new
String[] {
        "applicationContext.xml",
        });
       Server server = (Server) context.getBean("server");

        System.out.println("key1: " + server.getContext
().getParameters().getFirstValue("key1"));

Does anyone have a quick answer why?

Thanks
dev


On Jan 15, 2008 8:11 AM, dev dev <[EMAIL PROTECTED]> wrote:

> yes we did to run with Spring 2.5 Test Framework which is running on top
> of JUnit 4.4.
>
>
> On Jan 13, 2008 6:35 AM, Kevin Conaway < [EMAIL PROTECTED] > wrote:
>
> > Did you modify the test case at all? I noticed the snippet you posted
> > has the @Test annotation whereas the code in SVN trunk does not have that
> > annotation.
> >
> > The test in the trunk runs fine.
> >
> >
> > On Jan 13, 2008 1:36 AM, dev dev <[EMAIL PROTECTED]> wrote:
> >
> > > Without looking at the Restlet code, i'm having problems with this
> > > simple configuration. I'm using Spring 2.5.
> > >
> > >  <bean id="server" class="org.restlet.ext.spring.SpringServer">
> > >         <constructor-arg value="http" />
> > >         <constructor-arg value="8182" />
> > >         <property name="parameters">
> > >             <props>
> > >                 <prop key="key1">value1</prop>
> > >                 <prop key="key2">value2</prop>
> > >             </props>
> > >         </property>
> > >     </bean>
> > >
> > > and run the corresponding Spring test case.
> > >
> > >     @Test
> > >     public void testSpringServerProperties() {
> > >       log.debug("parameters size is :::" + server.getContext
> > > ().getParameters().size());
> > >        assertEquals("value1", server.getContext
> > > ().getParameters().getFirstValue("key1"));
> > >         assertEquals("value2", server.getContext
> > > ().getParameters().getFirstValue("key2"));
> > >         log.debug("parameters size is :::" + server.getContext
> > > ().getParameters().size());
> > >     }
> > >
> > >
> > > The log shows that getParameters().size() = 0 and the test case failed
> > > because the properties are not loaded it seems like. Is this a bug in the
> > > code?
> > >
> > > Thanks
> > > dev
> > >
> > >
> > >
> >
>

Reply via email to