-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FURNACE-35: PostStartup is not called for every deployed addon
- Loading branch information
Matej Briskar
committed
Mar 24, 2015
1 parent
9ff4048
commit e669812
Showing
2 changed files
with
69 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,6 +6,8 @@ | |
*/ | ||
package test.org.jboss.forge.furnace.events; | ||
|
||
import java.util.Map.Entry; | ||
|
||
import javax.inject.Inject; | ||
import javax.xml.xpath.XPathFactory; | ||
|
||
|
@@ -17,28 +19,65 @@ | |
import org.jboss.forge.furnace.repositories.AddonDependencyEntry; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.junit.Assert; | ||
import org.junit.Ignore; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* @author Matej Briškár | ||
* @author <a href="mailto:[email protected]">Lincoln Baxter, III</a> | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class ContainerLifecycleEventsTest | ||
{ | ||
@Deployment | ||
|
||
@Deployment(order = 3) | ||
@AddonDeployments({ | ||
@AddonDeployment(name = "org.jboss.forge.furnace.container:cdi") | ||
@AddonDeployment(name = "org.jboss.forge.furnace.container:cdi") | ||
}) | ||
public static AddonArchive getDeployment() | ||
public static AddonArchive getDeployment1() | ||
{ | ||
AddonArchive archive = ShrinkWrap.create(AddonArchive.class) | ||
.addAsAddonDependencies( | ||
AddonDependencyEntry.create("org.jboss.forge.furnace.container:cdi"), | ||
AddonDependencyEntry.create("dep2"), | ||
AddonDependencyEntry.create("dep3"), | ||
AddonDependencyEntry.create("dep4") | ||
).addBeansXML(); | ||
return archive; | ||
} | ||
|
||
|
||
@Deployment(name = "dep2,1", testable = false, order = 2) | ||
public static AddonArchive getDeploymentDep2() | ||
{ | ||
AddonArchive archive = ShrinkWrap.create(AddonArchive.class) | ||
.addClass(ContainerLifecycleEventObserver.class) | ||
.addAsAddonDependencies( | ||
AddonDependencyEntry.create("org.jboss.forge.furnace.container:cdi") | ||
) | ||
.addBeansXML(); | ||
return archive; | ||
} | ||
|
||
@Deployment(name = "dep3,1", testable = false, order = 1) | ||
public static AddonArchive getDeploymentDep3() | ||
{ | ||
AddonArchive archive = ShrinkWrap.create(AddonArchive.class) | ||
.addAsAddonDependencies( | ||
AddonDependencyEntry.create("org.jboss.forge.furnace.container:cdi") | ||
) | ||
.addBeansXML(); | ||
return archive; | ||
} | ||
@Deployment(name = "dep4,1", testable = false, order = 0) | ||
public static AddonArchive getDeploymentDep4() | ||
{ | ||
AddonArchive archive = ShrinkWrap.create(AddonArchive.class) | ||
.addClasses(ContainerLifecycleEventObserver.class) | ||
.addAsAddonDependencies( | ||
AddonDependencyEntry.create("org.jboss.forge.furnace.container:cdi") | ||
) | ||
.addBeansXML(); | ||
|
||
return archive; | ||
} | ||
|
||
|
@@ -49,6 +88,12 @@ public static AddonArchive getDeployment() | |
public void testContainerStartup() | ||
{ | ||
Assert.assertTrue(observer.isObservedPerform()); | ||
Assert.assertTrue("PostStartup should be called for each installed addon. Only " + observer.getPostStartupMap().size() + " calls were registered.", observer.getPostStartupMap().size() > 3); | ||
for( Entry<String, Integer> entry: observer.getPostStartupMap().entrySet()) { | ||
if(entry.getValue() > 1) { | ||
Assert.fail("Multiple PostStartup events for a single addon"); | ||
} | ||
} | ||
} | ||
|
||
@Test | ||
|