PicoContainer
  1. PicoContainer
  2. PICO-265

Montior no longer called for LC methods

    Details

    • Type: Bug Bug
    • Status: Closed Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 1.2-RC1
    • Fix Version/s: 1.2
    • Component/s: None
    • Labels:
      None
    • Number of attachments :
      0

      Description

      The ComponentMonitor is no longer called for the lifecycle methods. DLCS must have the current CM of the CA.

        Activity

        Hide
        Paul Hammant added a comment -

        Fixed as of revision 2650. New test method DefaultPicoContainerTestCase.testStartCapturedByMonitor()

        Show
        Paul Hammant added a comment - Fixed as of revision 2650. New test method DefaultPicoContainerTestCase.testStartCapturedByMonitor()
        Paul Hammant made changes -
        Field Original Value New Value
        Status Open [ 1 ] Closed [ 6 ]
        Assignee Paul Hammant [ paul ]
        Resolution Fixed [ 1 ]
        Hide
        Jörg Schaible added a comment -

        Close, but no cigar:

        public void testCanReallyChangeMonitor() throws SecurityException, NoSuchMethodException

        { Method start = Startable.class.getMethod("start", null); Method stop = Startable.class.getMethod("stop", null); Mock mockMonitor1 = mock(ComponentMonitor.class, "Monitor1"); Mock mockMonitor2 = mock(ComponentMonitor.class, "Monitor2"); DefaultPicoContainer pico = new DefaultPicoContainer((ComponentMonitor)mockMonitor1.proxy()); pico.registerComponentImplementation(MyStartable.class); mockMonitor1.expects(once()).method("instantiating"); mockMonitor1.expects(once()).method("instantiated"); mockMonitor1.expects(once()).method("invoking").with(eq(start), ANYTHING); mockMonitor1.expects(once()).method("invoked").with(eq(start), ANYTHING, ANYTHING); mockMonitor1.expects(once()).method("invoking").with(eq(stop), ANYTHING); mockMonitor1.expects(once()).method("invoked").with(eq(stop), ANYTHING, ANYTHING); pico.start(); pico.stop(); Startable startable = (Startable)pico.getComponentInstance(MyStartable.class); assertNotNull(startable); pico.changeMonitor((ComponentMonitor)mockMonitor2.proxy()); mockMonitor2.expects(once()).method("invoking").with(eq(start), ANYTHING); mockMonitor2.expects(once()).method("invoked").with(eq(start), ANYTHING, ANYTHING); mockMonitor2.expects(once()).method("invoking").with(eq(stop), ANYTHING); mockMonitor2.expects(once()).method("invoked").with(eq(stop), ANYTHING, ANYTHING); pico.start(); pico.stop(); }
        Show
        Jörg Schaible added a comment - Close, but no cigar: public void testCanReallyChangeMonitor() throws SecurityException, NoSuchMethodException { Method start = Startable.class.getMethod("start", null); Method stop = Startable.class.getMethod("stop", null); Mock mockMonitor1 = mock(ComponentMonitor.class, "Monitor1"); Mock mockMonitor2 = mock(ComponentMonitor.class, "Monitor2"); DefaultPicoContainer pico = new DefaultPicoContainer((ComponentMonitor)mockMonitor1.proxy()); pico.registerComponentImplementation(MyStartable.class); mockMonitor1.expects(once()).method("instantiating"); mockMonitor1.expects(once()).method("instantiated"); mockMonitor1.expects(once()).method("invoking").with(eq(start), ANYTHING); mockMonitor1.expects(once()).method("invoked").with(eq(start), ANYTHING, ANYTHING); mockMonitor1.expects(once()).method("invoking").with(eq(stop), ANYTHING); mockMonitor1.expects(once()).method("invoked").with(eq(stop), ANYTHING, ANYTHING); pico.start(); pico.stop(); Startable startable = (Startable)pico.getComponentInstance(MyStartable.class); assertNotNull(startable); pico.changeMonitor((ComponentMonitor)mockMonitor2.proxy()); mockMonitor2.expects(once()).method("invoking").with(eq(start), ANYTHING); mockMonitor2.expects(once()).method("invoked").with(eq(start), ANYTHING, ANYTHING); mockMonitor2.expects(once()).method("invoking").with(eq(stop), ANYTHING); mockMonitor2.expects(once()).method("invoked").with(eq(stop), ANYTHING, ANYTHING); pico.start(); pico.stop(); }
        Jörg Schaible made changes -
        Status Closed [ 6 ] Reopened [ 4 ]
        Resolution Fixed [ 1 ]
        Hide
        Paul Hammant added a comment -

        Fixed again.

        There were a number of things that were done twice (under debugging) re the changeMonitor and instantiate of default DefaultLifecycleStrategy that have been eliminated with the latest commit (2654). Things are more logical now; more CDI.

        Show
        Paul Hammant added a comment - Fixed again. There were a number of things that were done twice (under debugging) re the changeMonitor and instantiate of default DefaultLifecycleStrategy that have been eliminated with the latest commit (2654). Things are more logical now; more CDI.
        Paul Hammant made changes -
        Status Reopened [ 4 ] Closed [ 6 ]
        Resolution Fixed [ 1 ]

          People

          • Assignee:
            Paul Hammant
            Reporter:
            Jörg Schaible
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: