Search in sources :

Example 1 with ModelReader

use of org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader in project kie-wb-common by kiegroup.

the class ModuleDMOModelReaderServiceTest method testReadModels.

private void testReadModels(Function<ModelReader, Collection<DataObjectFormModel>> formula) {
    ModelReader modelReader = resolveModelReader();
    Assertions.assertThat(modelReader).isNotNull();
    Collection<DataObjectFormModel> models = formula.apply(modelReader);
    Assertions.assertThat(models).isNotNull().hasSize(3);
    Optional<DataObjectFormModel> clientModel = findModel(models, CLIENT_TYPE);
    assertTrue(clientModel.isPresent());
    validateClientModel(clientModel.get(), Source.INTERNAL);
    Optional<DataObjectFormModel> lineModel = findModel(models, LINE_TYPE);
    assertTrue(lineModel.isPresent());
    validateLineModel(lineModel.get(), Source.INTERNAL);
    Optional<DataObjectFormModel> expenseModel = findModel(models, EXPENSE_TYPE);
    assertTrue(expenseModel.isPresent());
    validateExpenseModel(expenseModel.get(), Source.INTERNAL);
}
Also used : ModelReader(org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader) DataObjectFormModel(org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel)

Example 2 with ModelReader

use of org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader in project kie-wb-common by kiegroup.

the class AbstractDMOModelReaderServiceTest method launchSingleModelTest.

protected void launchSingleModelTest(Consumer<ModelReader> modelReaderConsumer) {
    ModelReader modelReader = resolveModelReader();
    Assertions.assertThat(modelReader).isNotNull();
    modelReaderConsumer.accept(modelReader);
}
Also used : ModelReader(org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader)

Example 3 with ModelReader

use of org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader in project kie-wb-common by kiegroup.

the class ModuleDMOModelReaderServiceDependentModulesTest method testReadModuleModels.

@Test
public void testReadModuleModels() {
    ModelReader modelReader = resolveModelReader();
    Collection<DataObjectFormModel> models = modelReader.readModuleFormModels();
    Assertions.assertThat(models).isNotNull().hasSize(1);
    Optional<DataObjectFormModel> addressModel = findModel(models, ADDRESS_TYPE);
    assertTrue(addressModel.isPresent());
    validateAddressModel(addressModel.get(), Source.INTERNAL);
}
Also used : ModelReader(org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader) DataObjectFormModel(org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel) Test(org.junit.Test)

Example 4 with ModelReader

use of org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader in project kie-wb-common by kiegroup.

the class ModuleDMOModelReaderServiceDependentModulesTest method testReadAllModels.

@Test
public void testReadAllModels() {
    ModelReader modelReader = resolveModelReader();
    Collection<DataObjectFormModel> models = modelReader.readAllFormModels();
    Assertions.assertThat(models).isNotNull().hasSize(4);
    Optional<DataObjectFormModel> addressModel = findModel(models, ADDRESS_TYPE);
    assertTrue(addressModel.isPresent());
    validateAddressModel(addressModel.get(), Source.INTERNAL);
    Optional<DataObjectFormModel> clientModel = findModel(models, CLIENT_TYPE);
    assertTrue(clientModel.isPresent());
    validateClientModel(clientModel.get(), Source.EXTERNAL);
    Optional<DataObjectFormModel> lineModel = findModel(models, LINE_TYPE);
    assertTrue(lineModel.isPresent());
    validateLineModel(lineModel.get(), Source.EXTERNAL);
    Optional<DataObjectFormModel> expenseModel = findModel(models, EXPENSE_TYPE);
    assertTrue(expenseModel.isPresent());
    validateExpenseModel(expenseModel.get(), Source.EXTERNAL);
}
Also used : ModelReader(org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader) DataObjectFormModel(org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel) Test(org.junit.Test)

Example 5 with ModelReader

use of org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader in project kie-wb-common by kiegroup.

the class NestedFormsBPMNRuntimeFormDefinitionGeneratorServiceTest method setup.

@Override
public void setup() {
    when(modelReaderService.getModelReader(any())).thenAnswer((Answer<ModelReader>) invocationOnMock -> new RuntimeDMOModelReader((ClassLoader) invocationOnMock.getArguments()[0], new RawMVELEvaluator()));
    super.setup();
}
Also used : ModelReader(org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader) ArgumentMatchers.any(org.mockito.ArgumentMatchers.any) RawMVELEvaluator(org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator) RunWith(org.junit.runner.RunWith) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) Expense(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Expense) Mockito(org.mockito.Mockito) Answer(org.mockito.stubbing.Answer) Client(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Client) Line(org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Line) MockitoJUnitRunner(org.mockito.junit.MockitoJUnitRunner) RuntimeDMOModelReader(org.kie.workbench.common.forms.data.modeller.service.impl.ext.dmo.runtime.RuntimeDMOModelReader) ModelReader(org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader) RuntimeDMOModelReader(org.kie.workbench.common.forms.data.modeller.service.impl.ext.dmo.runtime.RuntimeDMOModelReader) RawMVELEvaluator(org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator) RuntimeDMOModelReader(org.kie.workbench.common.forms.data.modeller.service.impl.ext.dmo.runtime.RuntimeDMOModelReader)

Aggregations

ModelReader (org.kie.workbench.common.forms.data.modeller.service.ext.ModelReader)6 Test (org.junit.Test)3 DataObjectFormModel (org.kie.workbench.common.forms.data.modeller.model.DataObjectFormModel)3 RunWith (org.junit.runner.RunWith)1 RawMVELEvaluator (org.kie.soup.project.datamodel.commons.util.RawMVELEvaluator)1 RuntimeDMOModelReader (org.kie.workbench.common.forms.data.modeller.service.impl.ext.dmo.runtime.RuntimeDMOModelReader)1 Client (org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Client)1 Expense (org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Expense)1 Line (org.kie.workbench.common.forms.jbpm.server.service.formGeneration.model.Line)1 ArgumentMatchers.any (org.mockito.ArgumentMatchers.any)1 Mockito (org.mockito.Mockito)1 Mockito.when (org.mockito.Mockito.when)1 MockitoJUnitRunner (org.mockito.junit.MockitoJUnitRunner)1 Answer (org.mockito.stubbing.Answer)1