Skip to content

Commit

Permalink
FURNACE-43: Remove the need for manual specification of Addon depende…
Browse files Browse the repository at this point in the history
…ncies
  • Loading branch information
lincolnthree committed Apr 21, 2015
1 parent 007aaf9 commit 4ef5c98
Show file tree
Hide file tree
Showing 2 changed files with 100 additions and 0 deletions.
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());
}
}
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.

Copy link
@jsight

jsight Apr 21, 2015

This temporary variable seems useless now, I think that's a good indication of how simple this has become. Thanks!

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());
}
}

0 comments on commit 4ef5c98

Please sign in to comment.