I fixed that.

On Wed, Mar 9, 2011 at 9:12 PM, Howard Lewis Ship <[email protected]> wrote:

> That's my bad.  It was supposed to be @PostInjection (the Tapestry
> annotation), not @PostConstruct (the JSR whatever annotation).
>
> I ran all the tests and didn't have a failure.
>
> The changes were related to the excising of pooled pages support, and
> with it, the JMX MBean for the page pool; I had to replace a bit of
> code in the JMX world.  My modest improvement led to a refactoring
> (using a @PostInjection method to register as a shutdown listener,
> rather than a builder method).
>
>
> On Wed, Mar 9, 2011 at 11:22 AM, Igor Drobiazko
> <[email protected]> wrote:
> > I'm seeing the @PostConstruct annotation placed on the listenForShutdown
> > method of the MBeanSupportImpl class. Why is that annotation needed?
> > Tapestry IoC doesn't support this annotation. Actually, my local build is
> > even failing with error:
> >
> >
> /Users/igor/Documents/workspaces/tapestry5/tapestry-jmx/src/main/java/org/apache/tapestry5/internal/jmx/MBeanSupportImpl.java:[23,24]
> > package javax.annotation does not exist
>
>
>
>
> >
> >
> >
> > On Thu, Mar 3, 2011 at 12:01 AM, <[email protected]> wrote:
> >
> >> Author: hlship
> >> Date: Wed Mar  2 23:01:37 2011
> >> New Revision: 1076449
> >>
> >> URL: http://svn.apache.org/viewvc?rev=1076449&view=rev
> >> Log:
> >> TAP5-1455: Rebuild the tapestry-jmx tests now that PagePool is no longer
> >> available as a JMX MBean
> >>
> >> Added:
> >>
> >>
>  
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/Sample.java
> >>
> >>
>  
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/SampleImpl.java
> >>      - copied, changed from r1076448,
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/apache/tapestry5/jmx/integration/TapestryJmxIntegrationTests.java
> >>
> >>
>  
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/SampleImplMBean.java
> >>    tapestry/tapestry5/trunk/tapestry-jmx/src/test/resources/
> >>
> >>
>  tapestry/tapestry5/trunk/tapestry-jmx/src/test/resources/log4j.properties
> >> Modified:
> >>    tapestry/tapestry5/trunk/tapestry-jmx/pom.xml
> >>
> >>
>  
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/internal/jmx/MBeanSupportImpl.java
> >>
> >>
>  
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/jmx/JmxModule.java
> >>
> >>
>  
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/jmx/MBeanSupport.java
> >>    tapestry/tapestry5/trunk/tapestry-jmx/src/test/conf/testng.xml
> >>
> >>
>  
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/apache/tapestry5/jmx/integration/TapestryJmxIntegrationTests.java
> >>
> >>
>  
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/pages/RemotePoolManagement.java
> >>
> >>
>  
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/AppModule.java
> >>
> >>
>  
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/webapp/RemotePoolManagement.tml
> >>
> >> Modified: tapestry/tapestry5/trunk/tapestry-jmx/pom.xml
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/pom.xml?rev=1076449&r1=1076448&r2=1076449&view=diff
> >>
> >>
> ==============================================================================
> >> --- tapestry/tapestry5/trunk/tapestry-jmx/pom.xml (original)
> >> +++ tapestry/tapestry5/trunk/tapestry-jmx/pom.xml Wed Mar  2 23:01:37
> 2011
> >> @@ -41,6 +41,9 @@
> >>             <plugin>
> >>                 <groupId>org.apache.maven.plugins</groupId>
> >>                 <artifactId>maven-surefire-plugin</artifactId>
> >> +                <configuration>
> >> +
> >>  <argLine>-Dtapestry.service-reloading-enabled=false</argLine>
> >> +                </configuration>
> >>             </plugin>
> >>             <plugin>
> >>                 <groupId>org.apache.maven.plugins</groupId>
> >>
> >> Modified:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/internal/jmx/MBeanSupportImpl.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/internal/jmx/MBeanSupportImpl.java?rev=1076449&r1=1076448&r2=1076449&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/internal/jmx/MBeanSupportImpl.java
> >> (original)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/internal/jmx/MBeanSupportImpl.java
> >> Wed Mar  2 23:01:37 2011
> >> @@ -1,10 +1,10 @@
> >> -// Copyright 2010 The Apache Software Foundation
> >> +// Copyright 2010, 2011 The Apache Software Foundation
> >>  //
> >>  // Licensed under the Apache License, Version 2.0 (the "License");
> >>  // you may not use this file except in compliance with the License.
> >>  // You may obtain a copy of the License at
> >>  //
> >> -//     http://www.apache.org/licenses/LICENSE-2.0
> >> +// http://www.apache.org/licenses/LICENSE-2.0
> >>  //
> >>  // Unless required by applicable law or agreed to in writing, software
> >>  // distributed under the License is distributed on an "AS IS" BASIS,
> >> @@ -20,22 +20,25 @@ import java.lang.management.ManagementFa
> >>  import java.util.List;
> >>  import java.util.Set;
> >>
> >> +import javax.annotation.PostConstruct;
> >>  import javax.management.MBeanServer;
> >>  import javax.management.MBeanServerFactory;
> >> +import javax.management.MalformedObjectNameException;
> >>  import javax.management.ObjectName;
> >>
> >>  import org.apache.tapestry5.ioc.internal.util.CollectionFactory;
> >>  import org.apache.tapestry5.ioc.internal.util.OneShotLock;
> >> +import org.apache.tapestry5.ioc.services.RegistryShutdownHub;
> >>  import org.apache.tapestry5.ioc.services.RegistryShutdownListener;
> >>  import org.apache.tapestry5.jmx.MBeanSupport;
> >>  import org.slf4j.Logger;
> >>
> >>  public class MBeanSupportImpl implements MBeanSupport,
> >> RegistryShutdownListener
> >>  {
> >> -    private Logger logger;
> >> +    private final Logger logger;
> >> +
> >> +    private final MBeanServer server;
> >>
> >> -    private MBeanServer server;
> >> -
> >>     private final OneShotLock lock = new OneShotLock();
> >>
> >>     private final Set<ObjectName> registeredBeans =
> >> CollectionFactory.newSet();
> >> @@ -43,28 +46,55 @@ public class MBeanSupportImpl implements
> >>     public MBeanSupportImpl(Logger logger)
> >>     {
> >>         this.logger = logger;
> >> -
> >> +
> >>         // TODO: Agent Id should be configurable
> >>         final List<MBeanServer> servers =
> >> MBeanServerFactory.findMBeanServer(null);
> >>
> >> -        if (servers != null && 0 <  servers.size())
> >> +        MBeanServer server = null;
> >> +
> >> +        if (servers != null && 0 < servers.size())
> >>         {
> >> -            this.server = servers.get(0);
> >> +            server = servers.get(0);
> >>         }
> >>
> >>         if (this.server == null)
> >>         {
> >> -            this.server = ManagementFactory.getPlatformMBeanServer();
> >> +            server = ManagementFactory.getPlatformMBeanServer();
> >> +        }
> >> +
> >> +        this.server = server;
> >> +    }
> >> +
> >> +    @PostConstruct
> >> +    public void listenForShutdown(RegistryShutdownHub hub)
> >> +    {
> >> +        hub.addRegistryShutdownListener(this);
> >> +    }
> >> +
> >> +    public void register(Object bean, String name)
> >> +    {
> >> +        register(bean, toObjectName(name));
> >> +    }
> >> +
> >> +    private static ObjectName toObjectName(String name)
> >> +    {
> >> +        try
> >> +        {
> >> +            return new ObjectName(name);
> >> +        }
> >> +        catch (Exception ex)
> >> +        {
> >> +            throw new RuntimeException(ex);
> >>         }
> >>     }
> >>
> >>     public void register(final Object object, final ObjectName
> objectName)
> >>     {
> >>         lock.check();
> >> -
> >> +
> >>         if (this.server.isRegistered(objectName))
> >>             return;
> >> -
> >> +
> >>         try
> >>         {
> >>             this.server.registerMBean(object, objectName);
> >> @@ -82,10 +112,10 @@ public class MBeanSupportImpl implements
> >>     public void unregister(final ObjectName objectName)
> >>     {
> >>         lock.check();
> >> -
> >> +
> >>         doUnregister(objectName);
> >>     }
> >> -
> >> +
> >>     private void doUnregister(final ObjectName objectName)
> >>     {
> >>         if (this.server.isRegistered(objectName))
> >> @@ -95,8 +125,8 @@ public class MBeanSupportImpl implements
> >>                 this.server.unregisterMBean(objectName);
> >>
> >>                 this.logger.info(format("Unregistered MBean '%s' from
> >> server", objectName));
> >> -
> >> -                if(registeredBeans.contains(objectName))
> >> +
> >> +                if (registeredBeans.contains(objectName))
> >>                     registeredBeans.remove(objectName);
> >>             }
> >>             catch (final Exception e)
> >>
> >> Modified:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/jmx/JmxModule.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/jmx/JmxModule.java?rev=1076449&r1=1076448&r2=1076449&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/jmx/JmxModule.java
> >> (original)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/jmx/JmxModule.java
> >> Wed Mar  2 23:01:37 2011
> >> @@ -1,10 +1,10 @@
> >> -// Copyright 2010 The Apache Software Foundation
> >> +// Copyright 2010, 2011 The Apache Software Foundation
> >>  //
> >>  // Licensed under the Apache License, Version 2.0 (the "License");
> >>  // you may not use this file except in compliance with the License.
> >>  // You may obtain a copy of the License at
> >>  //
> >> -//     http://www.apache.org/licenses/LICENSE-2.0
> >> +// http://www.apache.org/licenses/LICENSE-2.0
> >>  //
> >>  // Unless required by applicable law or agreed to in writing, software
> >>  // distributed under the License is distributed on an "AS IS" BASIS,
> >> @@ -13,44 +13,16 @@
> >>  // limitations under the License.
> >>  package org.apache.tapestry5.jmx;
> >>
> >> -import javax.management.ObjectName;
> >> -
> >>  import org.apache.tapestry5.internal.jmx.MBeanSupportImpl;
> >> -import org.apache.tapestry5.internal.services.PagePool;
> >> -import org.apache.tapestry5.ioc.annotations.Autobuild;
> >> -import org.apache.tapestry5.ioc.services.RegistryShutdownHub;
> >> +import org.apache.tapestry5.ioc.ServiceBinder;
> >>
> >>  /**
> >>  * Module for JMX services.
> >> - *
> >>  */
> >>  public class JmxModule
> >>  {
> >> -    public MBeanSupport buildMBeanSupport(RegistryShutdownHub
> shutdownHub,
> >> @Autobuild MBeanSupportImpl service)
> >> -    {
> >> -        shutdownHub.addRegistryShutdownListener(service);
> >> -
> >> -        return service;
> >> -    }
> >> -
> >> -    public static PagePool decoratePagePool(final PagePool pagePool,
> final
> >> MBeanSupport managedBeanSupport)
> >> -    {
> >> -        final ObjectName objectName =
> >> buildObjectName("org.apache.tapestry5:service=PagePool");
> >> -
> >> -        managedBeanSupport.register(pagePool, objectName);
> >> -
> >> -        return pagePool;
> >> -    }
> >> -
> >> -    private static ObjectName buildObjectName(String name)
> >> +    public static void bind(ServiceBinder binder)
> >>     {
> >> -        try
> >> -        {
> >> -            return new ObjectName(name);
> >> -        }
> >> -        catch (Exception e)
> >> -        {
> >> -            throw new RuntimeException(e);
> >> -        }
> >> +        binder.bind(MBeanSupport.class, MBeanSupportImpl.class);
> >>     }
> >>  }
> >>
> >> Modified:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/jmx/MBeanSupport.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/jmx/MBeanSupport.java?rev=1076449&r1=1076448&r2=1076449&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/jmx/MBeanSupport.java
> >> (original)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/main/java/org/apache/tapestry5/jmx/MBeanSupport.java
> >> Wed Mar  2 23:01:37 2011
> >> @@ -1,10 +1,10 @@
> >> -// Copyright 20010 The Apache Software Foundation
> >> +// Copyright 2010, 2011 The Apache Software Foundation
> >>  //
> >>  // Licensed under the Apache License, Version 2.0 (the "License");
> >>  // you may not use this file except in compliance with the License.
> >>  // You may obtain a copy of the License at
> >>  //
> >> -//     http://www.apache.org/licenses/LICENSE-2.0
> >> +// http://www.apache.org/licenses/LICENSE-2.0
> >>  //
> >>  // Unless required by applicable law or agreed to in writing, software
> >>  // distributed under the License is distributed on an "AS IS" BASIS,
> >> @@ -17,26 +17,40 @@ package org.apache.tapestry5.jmx;
> >>  import javax.management.ObjectName;
> >>
> >>  /**
> >> - * Creates an MBean server and registers MBeans with the created
> server.
> >> The registered MBeans are unregistered when Registry is shut down.
> >> + * Creates an MBean server and registers MBeans with the created
> server.
> >> The registered MBeans are unregistered when
> >> + * Registry is shut down.
> >>  *
> >>  * @since 5.2.0
> >>  */
> >> -public interface MBeanSupport
> >> +public interface MBeanSupport
> >>  {
> >>
> >>     /**
> >>      * Registers the specified MBean with the server.
> >>      *
> >> -     * @param bean the MBean instance
> >> -     * @param objectName the name for the MBean
> >> +     * @param bean
> >> +     *            the MBean instance
> >> +     * @param objectName
> >> +     *            the name for the MBean
> >>      */
> >> -    void register(final Object bean, final ObjectName objectName);
> >> +    void register(Object bean, ObjectName objectName);
> >>
> >>     /**
> >> -     * Unregisters the specified MBean from the server.
> >> +     * Registers the specific MBean with the server.
> >>      *
> >> -     * @param objectName the name for the MBean
> >> +     * @param bean
> >> +     *            the MBean instance
> >> +     * @param name
> >> +     *            string name used to create an {@link ObjectName}
> >> +     * @since 5.3.0
> >>      */
> >> -    void unregister(final ObjectName objectName);
> >> +    void register(Object bean, String name);
> >>
> >> -}
> >> \ No newline at end of file
> >> +    /**
> >> +     * Unregisters the specified MBean from the server.
> >> +     *
> >> +     * @param objectName
> >> +     *            the name for the MBean
> >> +     */
> >> +    void unregister(ObjectName objectName);
> >> +}
> >>
> >> Modified: tapestry/tapestry5/trunk/tapestry-jmx/src/test/conf/testng.xml
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/test/conf/testng.xml?rev=1076449&r1=1076448&r2=1076449&view=diff
> >>
> >>
> ==============================================================================
> >> --- tapestry/tapestry5/trunk/tapestry-jmx/src/test/conf/testng.xml
> >> (original)
> >> +++ tapestry/tapestry5/trunk/tapestry-jmx/src/test/conf/testng.xml Wed
> Mar
> >>  2 23:01:37 2011
> >> @@ -1,22 +1,12 @@
> >>  <!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd";>
> >> -       <!--
> >> -               Copyright 2010 The Apache Software Foundation Licensed
> >> under the
> >> -               Apache License, Version 2.0 (the "License"); you may not
> >> use this file
> >> -               except in compliance with the License. You may obtain a
> >> copy of the
> >> -               License at
> http://www.apache.org/licenses/LICENSE-2.0Unless required
> >> -               by applicable law or agreed to in writing, software
> >> distributed under
> >> -               the License is distributed on an "AS IS" BASIS, WITHOUT
> >> WARRANTIES OR
> >> -               CONDITIONS OF ANY KIND, either express or implied. See
> the
> >> License for
> >> -               the specific language governing permissions and
> limitations
> >> under the
> >> -               License.
> >> -       -->
> >>
> >>  <suite name="Tapestry JMX" parallel="false" thread-count="10"
> >> annotations="1.5" verbose="2">
> >> -    <parameter name="tapestry.integration-webapp"
> >> value="src/test/webapp"/>
> >>
> >> -    <test name="Tapestry JMX Integration Tests">
> >> -        <packages>
> >> -            <package name="org.apache.tapestry5.jmx.integration"/>
> >> -        </packages>
> >> -    </test>
> >> +  <test name="Tapestry JMX Integration Tests">
> >> +    <parameter name="tapestry.web-app-folder" value="src/test/webapp"/>
> >> +
> >> +    <packages>
> >> +      <package name="org.apache.tapestry5.jmx.integration"/>
> >> +    </packages>
> >> +  </test>
> >>  </suite>
> >>
> >> Modified:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/apache/tapestry5/jmx/integration/TapestryJmxIntegrationTests.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/apache/tapestry5/jmx/integration/TapestryJmxIntegrationTests.java?rev=1076449&r1=1076448&r2=1076449&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/apache/tapestry5/jmx/integration/TapestryJmxIntegrationTests.java
> >> (original)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/apache/tapestry5/jmx/integration/TapestryJmxIntegrationTests.java
> >> Wed Mar  2 23:01:37 2011
> >> @@ -13,25 +13,20 @@
> >>  // limitations under the License.
> >>  package org.apache.tapestry5.jmx.integration;
> >>
> >> -import org.apache.tapestry5.test.AbstractIntegrationTestSuite;
> >> +import org.apache.tapestry5.test.SeleniumTestCase;
> >>  import org.testng.annotations.Test;
> >>
> >>  @Test(sequential = true, groups = "integration")
> >> -public class TapestryJmxIntegrationTests extends
> >> AbstractIntegrationTestSuite
> >> +public class TapestryJmxIntegrationTests extends SeleniumTestCase
> >>  {
> >> -
> >> -    public TapestryJmxIntegrationTests()
> >> -    {
> >> -        super("src/test/webapp");
> >> -    }
> >> -
> >>     /** TAP5-978 */
> >>     @Test
> >>     public void remote_pool_management()
> >>     {
> >> +        openBaseURL();
> >>
> >> -        start("Remote Pool Management");
> >> +        clickAndWait("link=Remote Pool Management");
> >>
> >> -        assertTextPresent("SoftWait: 10");
> >> +        assertText("sample-value", "42");
> >>     }
> >>  }
> >>
> >> Modified:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/pages/RemotePoolManagement.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/pages/RemotePoolManagement.java?rev=1076449&r1=1076448&r2=1076449&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/pages/RemotePoolManagement.java
> >> (original)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/pages/RemotePoolManagement.java
> >> Wed Mar  2 23:01:37 2011
> >> @@ -1,10 +1,10 @@
> >> -// Copyright 2010 The Apache Software Foundation
> >> +// Copyright 2010, 2011 The Apache Software Foundation
> >>  //
> >>  // Licensed under the Apache License, Version 2.0 (the "License");
> >>  // you may not use this file except in compliance with the License.
> >>  // You may obtain a copy of the License at
> >>  //
> >> -//     http://www.apache.org/licenses/LICENSE-2.0
> >> +// http://www.apache.org/licenses/LICENSE-2.0
> >>  //
> >>  // Unless required by applicable law or agreed to in writing, software
> >>  // distributed under the License is distributed on an "AS IS" BASIS,
> >> @@ -20,12 +20,12 @@ import javax.management.ObjectName;
> >>
> >>  public class RemotePoolManagement
> >>  {
> >> -
> >> -    public Object getSoftWait() throws Exception
> >> +
> >> +    public Object getSampleValue() throws Exception
> >>     {
> >>         MBeanServer server = ManagementFactory.getPlatformMBeanServer();
> >> -
> >> -        return server.getAttribute(new
> >> ObjectName("org.apache.tapestry5:service=PagePool"), "SoftWait");
> >> +
> >> +        return server.getAttribute(new
> >> ObjectName("org.example.testapp.services:service=Sample"),
> "SampleValue");
> >>     }
> >>
> >>  }
> >>
> >> Modified:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/AppModule.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/AppModule.java?rev=1076449&r1=1076448&r2=1076449&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/AppModule.java
> >> (original)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/AppModule.java
> >> Wed Mar  2 23:01:37 2011
> >> @@ -1,10 +1,10 @@
> >> -// Copyright 2010 The Apache Software Foundation
> >> +// Copyright 2010, 2011 The Apache Software Foundation
> >>  //
> >>  // Licensed under the Apache License, Version 2.0 (the "License");
> >>  // you may not use this file except in compliance with the License.
> >>  // You may obtain a copy of the License at
> >>  //
> >> -//     http://www.apache.org/licenses/LICENSE-2.0
> >> +// http://www.apache.org/licenses/LICENSE-2.0
> >>  //
> >>  // Unless required by applicable law or agreed to in writing, software
> >>  // distributed under the License is distributed on an "AS IS" BASIS,
> >> @@ -16,15 +16,30 @@ package org.example.testapp.services;
> >>
> >>  import org.apache.tapestry5.SymbolConstants;
> >>  import org.apache.tapestry5.ioc.MappedConfiguration;
> >> +import org.apache.tapestry5.ioc.ServiceBinder;
> >> +import org.apache.tapestry5.ioc.annotations.Decorate;
> >>  import org.apache.tapestry5.ioc.annotations.SubModule;
> >>  import org.apache.tapestry5.jmx.JmxModule;
> >> +import org.apache.tapestry5.jmx.MBeanSupport;
> >>
> >>  @SubModule(JmxModule.class)
> >>  public class AppModule
> >>  {
> >> +    public static void bind(ServiceBinder binder)
> >> +    {
> >> +        binder.bind(Sample.class);
> >> +    }
> >> +
> >>     public static void
> >> contributeApplicationDefaults(MappedConfiguration<String, String>
> >> configuration)
> >>     {
> >>         configuration.add(SymbolConstants.PRODUCTION_MODE, "false");
> >> -        configuration.add(SymbolConstants.PAGE_POOL_ENABLED, "true");
> >>     }
> >> -}
> >> \ No newline at end of file
> >> +
> >> +    @Decorate(serviceInterface = Sample.class)
> >> +    public static Sample enableJMXForSample(Sample service,
> MBeanSupport
> >> managedBeanSupport)
> >> +    {
> >> +        managedBeanSupport.register(service,
> >> "org.example.testapp.services:service=Sample");
> >> +
> >> +        return service;
> >> +    }
> >> +}
> >>
> >> Added:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/Sample.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/Sample.java?rev=1076449&view=auto
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/Sample.java
> >> (added)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/Sample.java
> >> Wed Mar  2 23:01:37 2011
> >> @@ -0,0 +1,20 @@
> >> +// Copyright 2011 The Apache Software Foundation
> >> +//
> >> +// Licensed under the Apache License, Version 2.0 (the "License");
> >> +// you may not use this file except in compliance with the License.
> >> +// You may obtain a copy of the License at
> >> +//
> >> +// http://www.apache.org/licenses/LICENSE-2.0
> >> +//
> >> +// Unless required by applicable law or agreed to in writing, software
> >> +// distributed under the License is distributed on an "AS IS" BASIS,
> >> +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> >> implied.
> >> +// See the License for the specific language governing permissions and
> >> +// limitations under the License.
> >> +
> >> +package org.example.testapp.services;
> >> +
> >> +public interface Sample
> >> +{
> >> +    int getSampleValue();
> >> +}
> >>
> >> Copied:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/SampleImpl.java
> >> (from r1076448,
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/apache/tapestry5/jmx/integration/TapestryJmxIntegrationTests.java)
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/SampleImpl.java?p2=tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/SampleImpl.java&p1=tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/apache/tapestry5/jmx/integration/TapestryJmxIntegrationTests.java&r1=1076448&r2=1076449&rev=1076449&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/apache/tapestry5/jmx/integration/TapestryJmxIntegrationTests.java
> >> (original)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/SampleImpl.java
> >> Wed Mar  2 23:01:37 2011
> >> @@ -1,4 +1,4 @@
> >> -// Copyright 2009, 2010 The Apache Software Foundation
> >> +// Copyright 2011 The Apache Software Foundation
> >>  //
> >>  // Licensed under the Apache License, Version 2.0 (the "License");
> >>  // you may not use this file except in compliance with the License.
> >> @@ -11,27 +11,16 @@
> >>  // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> >> implied.
> >>  // See the License for the specific language governing permissions and
> >>  // limitations under the License.
> >> -package org.apache.tapestry5.jmx.integration;
> >>
> >> -import org.apache.tapestry5.test.AbstractIntegrationTestSuite;
> >> -import org.testng.annotations.Test;
> >> +package org.example.testapp.services;
> >>
> >> -@Test(sequential = true, groups = "integration")
> >> -public class TapestryJmxIntegrationTests extends
> >> AbstractIntegrationTestSuite
> >> -{
> >> -
> >> -    public TapestryJmxIntegrationTests()
> >> -    {
> >> -        super("src/test/webapp");
> >> -    }
> >> +import org.apache.tapestry5.ioc.annotations.EagerLoad;
> >>
> >> -    /** TAP5-978 */
> >> -    @Test
> >> -    public void remote_pool_management()
> >> +@EagerLoad
> >> +public class SampleImpl implements Sample, SampleImplMBean
> >> +{
> >> +    public int getSampleValue()
> >>     {
> >> -
> >> -        start("Remote Pool Management");
> >> -
> >> -        assertTextPresent("SoftWait: 10");
> >> +        return 42;
> >>     }
> >>  }
> >>
> >> Added:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/SampleImplMBean.java
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/SampleImplMBean.java?rev=1076449&view=auto
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/SampleImplMBean.java
> >> (added)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/java/org/example/testapp/services/SampleImplMBean.java
> >> Wed Mar  2 23:01:37 2011
> >> @@ -0,0 +1,19 @@
> >> +// Copyright 2011 The Apache Software Foundation
> >> +//
> >> +// Licensed under the Apache License, Version 2.0 (the "License");
> >> +// you may not use this file except in compliance with the License.
> >> +// You may obtain a copy of the License at
> >> +//
> >> +// http://www.apache.org/licenses/LICENSE-2.0
> >> +//
> >> +// Unless required by applicable law or agreed to in writing, software
> >> +// distributed under the License is distributed on an "AS IS" BASIS,
> >> +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
> >> implied.
> >> +// See the License for the specific language governing permissions and
> >> +// limitations under the License.
> >> +
> >> +package org.example.testapp.services;
> >> +
> >> +public interface SampleImplMBean extends Sample
> >> +{
> >> +}
> >>
> >> Added:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/resources/log4j.properties
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/test/resources/log4j.properties?rev=1076449&view=auto
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/resources/log4j.properties
> >> (added)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/resources/log4j.properties
> >> Wed Mar  2 23:01:37 2011
> >> @@ -0,0 +1,10 @@
> >> +log4j.rootCategory=INFO, A1
> >> +
> >> +# A1 is set to be a ConsoleAppender.
> >> +log4j.appender.A1=org.apache.log4j.ConsoleAppender
> >> +
> >> +# A1 uses PatternLayout.
> >> +log4j.appender.A1.layout=org.apache.log4j.PatternLayout
> >> +log4j.appender.A1.layout.ConversionPattern=[%p] %c{1} %m%n
> >> +
> >> +log4j.category.org.example.testapp=debug
> >>
> >> Modified:
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/webapp/RemotePoolManagement.tml
> >> URL:
> >>
> http://svn.apache.org/viewvc/tapestry/tapestry5/trunk/tapestry-jmx/src/test/webapp/RemotePoolManagement.tml?rev=1076449&r1=1076448&r2=1076449&view=diff
> >>
> >>
> ==============================================================================
> >> ---
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/webapp/RemotePoolManagement.tml
> >> (original)
> >> +++
> >>
> tapestry/tapestry5/trunk/tapestry-jmx/src/test/webapp/RemotePoolManagement.tml
> >> Wed Mar  2 23:01:37 2011
> >> @@ -1,7 +1,10 @@
> >>  <html xmlns:t="http://tapestry.apache.org/schema/tapestry_5_0_0.xsd";>
> >>
> >>   <h1>Remote Pool Management Demo</h1>
> >> -
> >> -  <p>SoftWait: ${softWait}</p>
> >> +
> >> +  <p>
> >> +    Sample value:
> >> +    <span id="sample-value">${sampleValue}</span>
> >> +  </p>
> >>
> >>  </html>
> >> \ No newline at end of file
> >>
> >>
> >>
> >
> >
> > --
> > Best regards,
> >
> > Igor Drobiazko
> > http://tapestry5.de
> >
>
>
>
> --
> Howard M. Lewis Ship
>
> Creator of Apache Tapestry
>
> The source for Tapestry training, mentoring and support. Contact me to
> learn how I can get you up and productive in Tapestry fast!
>
> (971) 678-5210
> http://howardlewisship.com
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [email protected]
> For additional commands, e-mail: [email protected]
>
>


-- 
Best regards,

Igor Drobiazko
http://tapestry5.de

Reply via email to