Search in sources :

Example 1 with ModelFeaturesBuilder

use of org.whole.lang.builders.builder.ModelFeaturesBuilder in project whole by wholeplatform.

the class ModelFragmentsBuilderTest method testModelFeaturesBuilderWithFeatureEvents.

@Test
public void testModelFeaturesBuilderWithFeatureEvents() {
    ITemplateFactory<Model> modelsModel = new ModelsModelWithFeatureEvents();
    Features features = ModelsEntityFactory.instance.createFeatures(0);
    modelsModel.apply(new SpecificBuilderAdapterOperation(new ModelFeaturesBuilder(features)));
    int count = 0;
    Model model = modelsModel.create();
    AbstractPatternFilterIterator<Feature> i = IteratorFactory.<Feature>descendantOrSelfMatcherIterator().withPattern(ModelsEntityDescriptorEnum.Feature);
    i.reset(model);
    for (Feature feature : i) if (EntityUtils.isNotResolver(feature))
        count++;
    assertEquals(features.wSize(), count);
}
Also used : ModelsModel(org.whole.lang.models.codebase.ModelsModel) Model(org.whole.lang.models.model.Model) Features(org.whole.lang.models.model.Features) ModelFeaturesBuilder(org.whole.lang.builders.builder.ModelFeaturesBuilder) Feature(org.whole.lang.models.model.Feature) Test(org.junit.Test)

Example 2 with ModelFeaturesBuilder

use of org.whole.lang.builders.builder.ModelFeaturesBuilder in project whole by wholeplatform.

the class ModelFragmentsBuilderTest method testModelFeaturesBuilder.

@Test
public void testModelFeaturesBuilder() {
    ITemplateFactory<Model> modelsModel = new ModelsModel();
    final Features features = ModelsEntityFactory.instance.createFeatures(0);
    modelsModel.apply(new SpecificBuilderAdapterOperation(new ModelFeaturesBuilder(features)));
    int count = 0;
    Model model = modelsModel.create();
    AbstractPatternFilterIterator<Feature> i = IteratorFactory.<Feature>descendantOrSelfMatcherIterator().withPattern(ModelsEntityDescriptorEnum.Feature);
    i.reset(model);
    for (Feature feature : i) if (EntityUtils.isNotResolver(feature))
        count++;
    assertEquals(features.wSize(), count);
}
Also used : ModelsModel(org.whole.lang.models.codebase.ModelsModel) Model(org.whole.lang.models.model.Model) Features(org.whole.lang.models.model.Features) ModelsModel(org.whole.lang.models.codebase.ModelsModel) ModelFeaturesBuilder(org.whole.lang.builders.builder.ModelFeaturesBuilder) Feature(org.whole.lang.models.model.Feature) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)2 ModelFeaturesBuilder (org.whole.lang.builders.builder.ModelFeaturesBuilder)2 ModelsModel (org.whole.lang.models.codebase.ModelsModel)2 Feature (org.whole.lang.models.model.Feature)2 Features (org.whole.lang.models.model.Features)2 Model (org.whole.lang.models.model.Model)2