[
https://issues.jboss.org/browse/FURNACE-68?page=com.atlassian.jira.plugin...
]
George Gastaldi commented on FURNACE-68:
----------------------------------------
The following test reproduces it using the CDI 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 test.org.jboss.forge.furnace.events;
import static org.hamcrest.CoreMatchers.notNullValue;
import javax.enterprise.event.Observes;
import javax.inject.Inject;
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.addons.AddonRegistry;
import org.jboss.forge.furnace.container.cdi.events.Local;
import org.jboss.forge.furnace.event.PostStartup;
import org.jboss.shrinkwrap.api.ShrinkWrap;
import org.junit.Assert;
import org.junit.Test;
import org.junit.runner.RunWith;
import test.org.jboss.forge.furnace.mocks.BB;
/**
*
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a>
*/
@RunWith(Arquillian.class)
public class PostStartupTest
{
@Deployment
@AddonDependencies
public static AddonArchive getDeployment()
{
AddonArchive archive = ShrinkWrap.create(AddonArchive.class)
.addBeansXML()
.addClasses(BB.class, MyEventListener.class);
return archive;
}
@Test
public void testLookupOnPostStartup() throws Exception
{
Assert.assertThat("Service lookup failed in PostStartup",
MyEventListener.bb, notNullValue());
}
public static class MyEventListener
{
static BB bb;
@Inject
private AddonRegistry addonRegistry;
public void observes(@Observes @Local PostStartup postStartup)
{
bb = addonRegistry.getServices(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)