Search in sources :

Example 31 with BaseIncludedModelActiveRecord

use of org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord in project kie-wb-common by kiegroup.

the class BaseCardComponentTest method testGetTitle.

@Test
public void testGetTitle() {
    final BaseIncludedModelActiveRecord includedModel = prepareIncludedModelMock();
    final String expectedTitle = "file";
    when(includedModel.getName()).thenReturn(expectedTitle);
    doReturn(includedModel).when(card).getIncludedModel();
    final String actualTitle = card.getTitle();
    assertEquals(expectedTitle, actualTitle);
}
Also used : BaseIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord) Test(org.junit.Test)

Example 32 with BaseIncludedModelActiveRecord

use of org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord in project kie-wb-common by kiegroup.

the class DMNCardsGridComponentTest method testRefresh.

@Test
public void testRefresh() {
    final DefaultIncludedModelActiveRecord includedModel1 = mock(DefaultIncludedModelActiveRecord.class);
    final DMNIncludedModelActiveRecord includedModel2 = mock(DMNIncludedModelActiveRecord.class);
    final PMMLIncludedModelActiveRecord includedModel3 = mock(PMMLIncludedModelActiveRecord.class);
    final DefaultCardComponent card1 = mock(DefaultCardComponent.class);
    final DMNCardComponent card2 = mock(DMNCardComponent.class);
    final PMMLCardComponent card3 = mock(PMMLCardComponent.class);
    final List<BaseIncludedModelActiveRecord> includedModels = asList(includedModel1, includedModel2, includedModel3);
    when(pageState.generateIncludedModels()).thenReturn(includedModels);
    when(defaultCardComponent.get()).thenReturn(card1);
    when(dmnCardComponent.get()).thenReturn(card2);
    when(pmmlCardComponent.get()).thenReturn(card3);
    grid.refresh();
    verify(card1).setup(grid, includedModel1);
    verify(card2).setup(grid, includedModel2);
    verify(card3).setup(grid, includedModel3);
    verify(cardsGridComponent).setupCards(asList(card1, card2, card3));
}
Also used : DefaultIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.DefaultIncludedModelActiveRecord) PMMLIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.PMMLIncludedModelActiveRecord) BaseIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord) DMNIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.DMNIncludedModelActiveRecord) Test(org.junit.Test)

Aggregations

BaseIncludedModelActiveRecord (org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord)32 Test (org.junit.Test)27 Import (org.kie.workbench.common.dmn.api.definition.model.Import)11 Name (org.kie.workbench.common.dmn.api.property.dmn.Name)7 ArrayList (java.util.ArrayList)6 FlashMessage (org.kie.workbench.common.dmn.client.editors.common.messages.FlashMessage)6 DMNIncludedModelActiveRecord (org.kie.workbench.common.dmn.client.editors.included.DMNIncludedModelActiveRecord)6 PMMLIncludedModelActiveRecord (org.kie.workbench.common.dmn.client.editors.included.PMMLIncludedModelActiveRecord)5 KieAssetsDropdownItem (org.kie.workbench.common.widgets.client.assets.dropdown.KieAssetsDropdownItem)4 Maps (org.kie.soup.commons.util.Maps)3 RefreshDecisionComponents (org.kie.workbench.common.dmn.client.docks.navigator.events.RefreshDecisionComponents)3 ImportDMN (org.kie.workbench.common.dmn.api.definition.model.ImportDMN)2 ImportPMML (org.kie.workbench.common.dmn.api.definition.model.ImportPMML)2 LocationURI (org.kie.workbench.common.dmn.api.property.dmn.LocationURI)2 Type (org.kie.workbench.common.dmn.client.editors.common.messages.FlashMessage.Type)2 DefaultIncludedModelActiveRecord (org.kie.workbench.common.dmn.client.editors.included.DefaultIncludedModelActiveRecord)2 GwtMockitoTestRunner (com.google.gwtmockito.GwtMockitoTestRunner)1 HTMLElement (elemental2.dom.HTMLElement)1 Arrays.asList (java.util.Arrays.asList)1 List (java.util.List)1