polygene-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Niclas Hedhman <nic...@hedhman.org>
Subject Bug in Assembly??
Date Sat, 07 Nov 2015 05:14:16 GMT
Gang,

I am chasing an Activation bug (I get activate() called twice), so I made
the testcase below. But here I get ZERO activate() called. Have I/we broken
the activation system completely when going to Java 8? Or am I missing
something bleeding obvious?

Cheers
Niclas

public class ServiceAssemblyTest extends AbstractZestTest
{
    @Test
    public void
givenMyServiceWithTwoDeclarationsWhenActivatingServiceExpectServiceActivatedOnce()
        throws PassivationException
    {
        ServiceReference<MyService> ref = module.findService( MyService.class );
        MyService underTest = ref.get();
        assertThat(underTest.activated(), equalTo(1)); // Fails here!!!
        underTest.passivate();
        assertThat(underTest.passivated(), equalTo(1));
    }

    @Override
    public void assemble( ModuleAssembly module )
        throws AssemblyException
    {
        module.services( MyService.class ).instantiateOnStartup();
        module.services( MyService.class ).setMetaInfo( "Hello" );
    }

    @Mixins( MyServiceMixin.class )
    public static interface MyService extends Activation
    {
        int activated();
        int passivated();
    }

    public static class MyServiceMixin implements MyService, Activation
    {

        private int activated;
        private int passivated;

        @Override
        public int activated()
        {
            return activated;
        }

        @Override
        public int passivated()
        {
            return passivated;
        }

        @Override
        public void activate()
            throws ActivationException
        {
            activated++;
        }

        @Override
        public void passivate()
            throws PassivationException
        {
            passivated++;
        }
    }
}



-- 
Niclas Hedhman, Software Developer
http://zest.apache.org - New Energy for Java

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message