| 1 | |
|
| 2 | |
|
| 3 | |
|
| 4 | |
package org.jbehave.core.steps.weld; |
| 5 | |
|
| 6 | |
import java.util.ArrayList; |
| 7 | |
import java.util.List; |
| 8 | |
|
| 9 | |
import javax.enterprise.inject.Any; |
| 10 | |
import javax.enterprise.inject.Instance; |
| 11 | |
import javax.inject.Inject; |
| 12 | |
import javax.inject.Singleton; |
| 13 | |
|
| 14 | |
import org.jbehave.core.annotations.weld.WeldConfiguration; |
| 15 | |
import org.jbehave.core.annotations.weld.WeldStep; |
| 16 | |
import org.jbehave.core.configuration.Configuration; |
| 17 | |
import org.jbehave.core.steps.AbstractStepsFactory; |
| 18 | |
import org.jbehave.core.steps.InjectableStepsFactory; |
| 19 | |
|
| 20 | |
|
| 21 | |
|
| 22 | |
|
| 23 | |
|
| 24 | |
|
| 25 | |
|
| 26 | |
|
| 27 | |
@Singleton |
| 28 | |
public class WeldStepsFactory extends AbstractStepsFactory { |
| 29 | |
|
| 30 | |
@Inject |
| 31 | |
@Any |
| 32 | |
@WeldStep |
| 33 | |
private Instance<Object> instances; |
| 34 | |
|
| 35 | |
@Inject |
| 36 | |
public WeldStepsFactory(@WeldConfiguration Configuration configuration) { |
| 37 | 8 | super(configuration); |
| 38 | 8 | } |
| 39 | |
|
| 40 | |
@Override |
| 41 | |
protected List<Object> stepsInstances() { |
| 42 | 3 | List<Object> steps = new ArrayList<Object>(); |
| 43 | 3 | for (Object o : instances) { |
| 44 | 3 | steps.add(o); |
| 45 | |
} |
| 46 | 3 | return steps; |
| 47 | |
} |
| 48 | |
|
| 49 | |
} |