-
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.
Merge pull request #11 from gastaldi/FURNACE-98
FURNACE-98 and FURNACE-46: Introduces a FurnaceProvider implementation
- Loading branch information
Showing
4 changed files
with
64 additions
and
0 deletions.
There are no files selected for viewing
26 changes: 26 additions & 0 deletions
26
impl/src/main/java/org/jboss/forge/furnace/container/cdi/impl/WeldFurnaceProvider.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,26 @@ | ||
/* | ||
* Copyright 2016 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 org.jboss.forge.furnace.container.cdi.impl; | ||
|
||
import javax.enterprise.inject.spi.CDI; | ||
|
||
import org.jboss.forge.furnace.Furnace; | ||
import org.jboss.forge.furnace.spi.FurnaceProvider; | ||
|
||
/** | ||
* | ||
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a> | ||
*/ | ||
public class WeldFurnaceProvider implements FurnaceProvider | ||
{ | ||
@Override | ||
public Furnace getFurnace(ClassLoader loader) | ||
{ | ||
return CDI.current().select(Furnace.class).get(); | ||
} | ||
} |
1 change: 1 addition & 0 deletions
1
impl/src/main/resources/META-INF/services/org.jboss.forge.furnace.spi.FurnaceProvider
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 @@ | ||
org.jboss.forge.furnace.container.cdi.impl.WeldFurnaceProvider |
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
34 changes: 34 additions & 0 deletions
34
tests/src/test/java/test/org/jboss/forge/furnace/FurnaceProviderTest.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,34 @@ | ||
/* | ||
* Copyright 2016 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; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.jboss.arquillian.junit.Arquillian; | ||
import org.jboss.forge.furnace.Furnace; | ||
import org.junit.Assert; | ||
import org.junit.Test; | ||
import org.junit.runner.RunWith; | ||
|
||
/** | ||
* | ||
* @author <a href="mailto:ggastald@redhat.com">George Gastaldi</a> | ||
*/ | ||
@RunWith(Arquillian.class) | ||
public class FurnaceProviderTest | ||
{ | ||
@Inject | ||
Furnace furnace; | ||
|
||
@Test | ||
public void testFurnaceInstance() | ||
{ | ||
ClassLoader loader = getClass().getClassLoader(); | ||
Assert.assertSame(furnace, Furnace.instance(loader)); | ||
} | ||
} |