-
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-43: Remove the need for manual specification of Addon depende…
…ncies
- Loading branch information
1 parent
007aaf9
commit 4ef5c98
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
44 changes: 44 additions & 0 deletions
44
...est/java/test/org/jboss/forge/furnace/harness/AutomaticAddonDependenciesDisabledTest.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,44 @@ | ||
/* | ||
* 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.harness; | ||
|
||
import java.util.Set; | ||
|
||
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.arquillian.services.LocalServices; | ||
import org.jboss.forge.furnace.addons.Addon; | ||
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 AutomaticAddonDependenciesDisabledTest | ||
{ | ||
@Deployment | ||
@AddonDependencies(automatic = false) | ||
public static AddonArchive getDeployment() throws Exception | ||
{ | ||
AddonArchive archive = ShrinkWrap.create(AddonArchive.class); | ||
archive.addAsLocalServices(AutomaticAddonDependenciesDisabledTest.class); | ||
return archive; | ||
} | ||
|
||
@Test | ||
public void testDependenciesAreAutomaticallyDeployedAndAssigned() | ||
{ | ||
Addon addon = LocalServices.getAddon(getClass().getClassLoader()); | ||
Set<org.jboss.forge.furnace.addons.AddonDependency> dependencies = addon.getDependencies(); | ||
Assert.assertEquals(0, dependencies.size()); | ||
} | ||
} |
56 changes: 56 additions & 0 deletions
56
tests/src/test/java/test/org/jboss/forge/furnace/harness/AutomaticAddonDependenciesTest.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,56 @@ | ||
/* | ||
* 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.harness; | ||
|
||
import java.util.Iterator; | ||
import java.util.Set; | ||
|
||
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.Furnace; | ||
import org.jboss.forge.furnace.addons.Addon; | ||
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 AutomaticAddonDependenciesTest | ||
{ | ||
private static final String CONTAINER_CDI_DEP = "org.jboss.forge.furnace.container:cdi"; | ||
|
||
@Deployment | ||
@AddonDependencies | ||
public static AddonArchive getDeployment() throws Exception | ||
{ | ||
AddonArchive archive = ShrinkWrap.create(AddonArchive.class).addBeansXML(); | ||
This comment has been minimized.
Sorry, something went wrong. |
||
return archive; | ||
} | ||
|
||
@Inject | ||
private Furnace furnace; | ||
|
||
@Inject | ||
private Addon addon; | ||
|
||
@Test | ||
public void testDependenciesAreAutomaticallyDeployedAndAssigned() | ||
{ | ||
Assert.assertNotNull(furnace); | ||
Set<org.jboss.forge.furnace.addons.AddonDependency> dependencies = addon.getDependencies(); | ||
Assert.assertEquals(1, dependencies.size()); | ||
Iterator<org.jboss.forge.furnace.addons.AddonDependency> iterator = dependencies.iterator(); | ||
Assert.assertEquals(CONTAINER_CDI_DEP, iterator.next().getDependency().getId().getName()); | ||
} | ||
} |
This temporary variable seems useless now, I think that's a good indication of how simple this has become. Thanks!