-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Completed FORGE-1111 - Implement a test to verify error scenario when…
… multiple AddonLifecycleProviders registered
- Loading branch information
1 parent
39339db
commit 4c90f09
Showing
4 changed files
with
184 additions
and
4 deletions.
There are no files selected for viewing
38 changes: 38 additions & 0 deletions
38
...test/java/test/org/jboss/forge/furnace/lifecycle/DuplicateAddonLifecycleProviderTest.java
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package test.org.jboss.forge.furnace.lifecycle; | ||
|
||
import org.jboss.arquillian.container.test.api.Deployment; | ||
import org.jboss.arquillian.container.test.api.ShouldThrowException; | ||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.forge.arquillian.archive.ForgeArchive; | ||
import org.jboss.forge.furnace.lifecycle.AddonLifecycleProvider; | ||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class DuplicateAddonLifecycleProviderTest | ||
{ | ||
@Deployment | ||
@ShouldThrowException | ||
public static ForgeArchive getDeployment() | ||
{ | ||
ForgeArchive archive = ShrinkWrap.create(ForgeArchive.class) | ||
.addClass(MockAddonLifecycleProvider.class) | ||
.addClass(MockAddonLifecycleProvider2.class) | ||
.addAsServiceProvider(AddonLifecycleProvider.class, MockAddonLifecycleProvider.class, | ||
MockAddonLifecycleProvider2.class); | ||
|
||
return archive; | ||
} | ||
|
||
@Test | ||
public void shouldNotRun() throws Exception | ||
{ | ||
Assert.fail("Deployment should have failed."); | ||
} | ||
|
||
} |
69 changes: 69 additions & 0 deletions
69
...ests/src/test/java/test/org/jboss/forge/furnace/lifecycle/MockAddonLifecycleProvider.java
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright 2013 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.lifecycle; | ||
|
||
import org.jboss.forge.furnace.Furnace; | ||
import org.jboss.forge.furnace.addons.Addon; | ||
import org.jboss.forge.furnace.addons.AddonRegistry; | ||
import org.jboss.forge.furnace.event.EventManager; | ||
import org.jboss.forge.furnace.lifecycle.AddonLifecycleProvider; | ||
import org.jboss.forge.furnace.lifecycle.ControlType; | ||
import org.jboss.forge.furnace.spi.ServiceRegistry; | ||
|
||
/** | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
* | ||
*/ | ||
public class MockAddonLifecycleProvider implements AddonLifecycleProvider | ||
{ | ||
|
||
@Override | ||
public void initialize(Furnace furnace, AddonRegistry registry, Addon self) throws Exception | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public void start(Addon addon) throws Exception | ||
{ | ||
} | ||
|
||
@Override | ||
public void stop(Addon addon) throws Exception | ||
{ | ||
} | ||
|
||
@Override | ||
public ServiceRegistry getServiceRegistry(Addon addon) throws Exception | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public EventManager getEventManager(Addon addon) | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public void postStartup(Addon addon) throws Exception | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public void preShutdown(Addon addon) throws Exception | ||
{ | ||
} | ||
|
||
@Override | ||
public ControlType getControlType() | ||
{ | ||
return ControlType.ALL; | ||
} | ||
|
||
} |
69 changes: 69 additions & 0 deletions
69
...sts/src/test/java/test/org/jboss/forge/furnace/lifecycle/MockAddonLifecycleProvider2.java
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 |
---|---|---|
@@ -0,0 +1,69 @@ | ||
/* | ||
* Copyright 2013 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.lifecycle; | ||
|
||
import org.jboss.forge.furnace.Furnace; | ||
import org.jboss.forge.furnace.addons.Addon; | ||
import org.jboss.forge.furnace.addons.AddonRegistry; | ||
import org.jboss.forge.furnace.event.EventManager; | ||
import org.jboss.forge.furnace.lifecycle.AddonLifecycleProvider; | ||
import org.jboss.forge.furnace.lifecycle.ControlType; | ||
import org.jboss.forge.furnace.spi.ServiceRegistry; | ||
|
||
/** | ||
* @author <a href="mailto:lincolnbaxter@gmail.com">Lincoln Baxter, III</a> | ||
* | ||
*/ | ||
public class MockAddonLifecycleProvider2 implements AddonLifecycleProvider | ||
{ | ||
|
||
@Override | ||
public void initialize(Furnace furnace, AddonRegistry registry, Addon self) throws Exception | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public void start(Addon addon) throws Exception | ||
{ | ||
} | ||
|
||
@Override | ||
public void stop(Addon addon) throws Exception | ||
{ | ||
} | ||
|
||
@Override | ||
public ServiceRegistry getServiceRegistry(Addon addon) throws Exception | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public EventManager getEventManager(Addon addon) | ||
{ | ||
return null; | ||
} | ||
|
||
@Override | ||
public void postStartup(Addon addon) throws Exception | ||
{ | ||
|
||
} | ||
|
||
@Override | ||
public void preShutdown(Addon addon) throws Exception | ||
{ | ||
} | ||
|
||
@Override | ||
public ControlType getControlType() | ||
{ | ||
return ControlType.ALL; | ||
} | ||
|
||
} |
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