[forge-issues] [JBoss JIRA] (FURNACE-68) PostStartup events are fired when addon is in LOADED state

George Gastaldi (JIRA) issues at jboss.org
Wed Aug 12 17:11:02 EDT 2015


    [ https://issues.jboss.org/browse/FURNACE-68?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13097809#comment-13097809 ] 

George Gastaldi commented on FURNACE-68:
----------------------------------------

The following test reproduces the error using the simple container: 

{code:java}
/**
 * Copyright 2015 Red Hat, Inc. and/or its affiliates.
 *
 * Licensed under the Eclipse Public License version 1.0, available at
 * http://www.eclipse.org/legal/epl-v10.html
 */

package org.jboss.forge.furnace.container.simple;

import static org.hamcrest.CoreMatchers.notNullValue;

import org.jboss.arquillian.container.test.api.Deployment;
import org.jboss.arquillian.junit.Arquillian;
import org.jboss.forge.arquillian.AddonDependencies;
import org.jboss.forge.arquillian.archive.AddonArchive;
import org.jboss.forge.furnace.container.simple.lifecycle.SimpleContainer;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;

/**
 * 
 * @author <a href="mailto:ggastald at redhat.com">George Gastaldi</a>
 */
@RunWith(Arquillian.class)
public class PostStartupTest
{

   @Deployment
   @AddonDependencies
   public static AddonArchive getDeployment()
   {
      AddonArchive archive = ShrinkWrap.create(AddonArchive.class)
               .addClasses(BB.class, MyEventListener.class)
               .addAsServiceProvider(SingletonService.class, MyEventListener.class)
               .addAsServiceProvider(Service.class, PostStartupTest.class, BB.class);
      return archive;
   }

   @Test
   public void testLookupOnPostStartup() throws Exception
   {
      Assert.assertThat("Service lookup failed in PostStartup", MyEventListener.bb, notNullValue());
   }

   public static class MyEventListener extends AbstractEventListener
   {
      static BB bb;

      @Override
      protected void handleThisPostStartup()
      {
         bb = SimpleContainer.getServices(getClass().getClassLoader(), BB.class).get();
      }
   }

}
{code}

> PostStartup events are fired when addon is in LOADED state
> ----------------------------------------------------------
>
>                 Key: FURNACE-68
>                 URL: https://issues.jboss.org/browse/FURNACE-68
>             Project: Forge: Furnace
>          Issue Type: Bug
>          Components: Runtime
>    Affects Versions: 2.20.1.Final
>            Reporter: George Gastaldi
>            Priority: Blocker
>             Fix For: 2.x Future
>
>
> It was observed to happen in the simple container



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)


More information about the forge-issues mailing list