Skip to content

Commit

Permalink
Merge pull request #11 from gastaldi/FURNACE-98
Browse files Browse the repository at this point in the history
FURNACE-98 and FURNACE-46: Introduces a FurnaceProvider implementation
  • Loading branch information
gastaldi committed Jan 14, 2016
2 parents e76682e + 021dce2 commit ee94c1a
Show file tree
Hide file tree
Showing 4 changed files with 64 additions and 0 deletions.
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();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
org.jboss.forge.furnace.container.cdi.impl.WeldFurnaceProvider
3 changes: 3 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,9 @@
<forge.scm.connection>scm:git:git://github.com/forge/furnace-cdi.git</forge.scm.connection>
<forge.developer.connection>scm:git:git@github.com:forge/furnace-cdi.git</forge.developer.connection>
<forge.scm.url>http://github.com/forge/furnace-cdi</forge.scm.url>
<maven.compiler.target>1.8</maven.compiler.target>
<maven.compiler.source>1.8</maven.compiler.source>

<!-- This version is bound to the Weld version -->
<version.annotations>1.0.0.Alpha1</version.annotations>
<version.cdi>1.2</version.cdi>
Expand Down
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));
}
}

0 comments on commit ee94c1a

Please sign in to comment.