use of org.kie.workbench.common.dmn.api.definition.model.ItemDefinition in project kie-wb-common by kiegroup.
the class IncludedModelModalTest method testGetItemDefinitionConsumer.
@Test
public void testGetItemDefinitionConsumer() {
final ItemDefinition itemDefinition1 = mock(ItemDefinition.class);
final ItemDefinition itemDefinition2 = mock(ItemDefinition.class);
final List<ItemDefinition> expectedNewItemDefinitions = asList(itemDefinition1, itemDefinition2);
modal.getItemDefinitionConsumer().accept(expectedNewItemDefinitions);
verify(refreshDataTypesListEvent).fire(refreshDataTypesListArgumentCaptor.capture());
final List<ItemDefinition> actualNewItemDefinitions = refreshDataTypesListArgumentCaptor.getValue().getNewItemDefinitions();
assertEquals(expectedNewItemDefinitions, actualNewItemDefinitions);
}
use of org.kie.workbench.common.dmn.api.definition.model.ItemDefinition in project kie-wb-common by kiegroup.
the class IncludedModelModalTest method testRefreshDataTypesList.
@Test
public void testRefreshDataTypesList() {
final BaseIncludedModelActiveRecord includedModel = mock(BaseIncludedModelActiveRecord.class);
final Consumer<List<ItemDefinition>> listConsumer = list -> {
/* Nothing. */
};
final String modelName = "model1";
final String namespace = "://namespace1";
when(includedModel.getName()).thenReturn(modelName);
when(includedModel.getNamespace()).thenReturn(namespace);
doReturn(listConsumer).when(modal).getItemDefinitionConsumer();
modal.refreshDataTypesList(includedModel);
verify(client).loadItemDefinitionsByNamespace(modelName, namespace, listConsumer);
}
use of org.kie.workbench.common.dmn.api.definition.model.ItemDefinition in project kie-wb-common by kiegroup.
the class DataTypesPageTest method makeItem.
private ItemDefinition makeItem(final String itemName) {
final ItemDefinition itemDefinition = mock(ItemDefinition.class);
final Name name = mock(Name.class);
when(name.getValue()).thenReturn(itemName);
when(itemDefinition.getName()).thenReturn(name);
return itemDefinition;
}
use of org.kie.workbench.common.dmn.api.definition.model.ItemDefinition in project kie-wb-common by kiegroup.
the class DataTypesPageTest method testMakeDataType.
@Test
public void testMakeDataType() {
final ItemDefinition itemDefinition = mock(ItemDefinition.class);
final DataType expectedDataType = mock(DataType.class);
when(dataTypeManager.from(itemDefinition)).thenReturn(dataTypeManager);
when(dataTypeManager.get()).thenReturn(expectedDataType);
final DataType actualDataType = page.makeDataType(itemDefinition);
assertEquals(expectedDataType, actualDataType);
}
use of org.kie.workbench.common.dmn.api.definition.model.ItemDefinition in project kie-wb-common by kiegroup.
the class DataTypesPageTest method testOnRefreshDataTypesListWithNewItemDefinitionWhenPageIsLoaded.
@Test
public void testOnRefreshDataTypesListWithNewItemDefinitionWhenPageIsLoaded() {
final ItemDefinition itemDefinition1 = mock(ItemDefinition.class);
final ItemDefinition itemDefinition2 = mock(ItemDefinition.class);
final List<ItemDefinition> newItemDefinitions = asList(itemDefinition1, itemDefinition2);
final RefreshDataTypesListEvent event = new RefreshDataTypesListEvent(newItemDefinitions);
doReturn(true).when(page).isLoaded();
page.onRefreshDataTypesListWithNewItemDefinitions(event);
verify(page).refreshItemDefinitions(newItemDefinitions);
verify(page).reload();
}
Aggregations