
org.jnario.feature.jvmmodel.StepsProvider Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of org.jnario.standalone Show documentation
Show all versions of org.jnario.standalone Show documentation
The required libraries to execute Jnario specifications without Eclipse.
The newest version!
package org.jnario.feature.jvmmodel;
import com.google.common.base.Objects;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import java.util.Collections;
import org.eclipse.emf.common.util.EList;
import org.eclipse.emf.ecore.EObject;
import org.eclipse.emf.ecore.resource.Resource;
import org.eclipse.xtend.core.xtend.XtendTypeDeclaration;
import org.eclipse.xtext.xbase.lib.CollectionLiterals;
import org.eclipse.xtext.xbase.lib.Functions.Function1;
import org.eclipse.xtext.xbase.lib.IterableExtensions;
import org.jnario.feature.feature.Background;
import org.jnario.feature.feature.Feature;
import org.jnario.feature.feature.FeatureFile;
import org.jnario.feature.feature.Scenario;
import org.jnario.feature.feature.Step;
import org.jnario.feature.feature.StepImplementation;
@SuppressWarnings("all")
public class StepsProvider {
public Iterable getSteps(final EObject context) {
Iterable _xblockexpression = null;
{
Resource _eResource = context.eResource();
boolean _equals = Objects.equal(_eResource, null);
if (_equals) {
return CollectionLiterals.emptyList();
}
Resource _eResource_1 = context.eResource();
EList _contents = _eResource_1.getContents();
final Iterable featureFiles = Iterables.filter(_contents, FeatureFile.class);
final Function1> _function = new Function1>() {
public EList apply(final FeatureFile it) {
return it.getXtendTypes();
}
};
Iterable> _map = IterableExtensions.>map(featureFiles, _function);
Iterable _flatten = Iterables.concat(_map);
final Iterable features = Iterables.filter(_flatten, Feature.class);
final Function1> _function_1 = new Function1>() {
public Iterable apply(final Feature it) {
Iterable _xblockexpression = null;
{
Background _background = it.getBackground();
boolean _equals = Objects.equal(_background, null);
if (_equals) {
return it.getScenarios();
}
EList _scenarios = it.getScenarios();
Background _background_1 = it.getBackground();
_xblockexpression = Iterables.concat(_scenarios, Collections.unmodifiableList(Lists.newArrayList(_background_1)));
}
return _xblockexpression;
}
};
Iterable> _map_1 = IterableExtensions.>map(features, _function_1);
Iterable _flatten_1 = Iterables.concat(_map_1);
final Iterable scenarios = IterableExtensions.filterNull(_flatten_1);
final Function1> _function_2 = new Function1>() {
public EList apply(final Scenario it) {
return it.getSteps();
}
};
Iterable> _map_2 = IterableExtensions.>map(scenarios, _function_2);
Iterable _flatten_2 = Iterables.concat(_map_2);
_xblockexpression = Iterables.filter(_flatten_2, StepImplementation.class);
}
return _xblockexpression;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy