Search in sources :

Example 1 with BaseIncludedModelActiveRecord

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

the class IncludedModelErrorMessageFactoryTest method testGetNameIsBlankFlashMessage.

@Test
public void testGetNameIsBlankFlashMessage() {
    final BaseIncludedModelActiveRecord includedModel = mock(BaseIncludedModelActiveRecord.class);
    final Type expectedType = ERROR;
    final String expectedStrongMessage = "StrongMessage";
    final String expectedRegularMessage = "RegularMessage";
    final String expectedElementSelector = "[data-card-uuid=\"1234\"] [data-field=\"title-input\"]";
    when(includedModel.getUUID()).thenReturn("1234");
    when(translationService.format(IncludedModelNameIsBlankErrorMessage_StrongMessage)).thenReturn(expectedStrongMessage);
    when(translationService.format(IncludedModelNameIsBlankErrorMessage_RegularMessage)).thenReturn(expectedRegularMessage);
    final FlashMessage flashMessage = factory.getNameIsBlankFlashMessage(includedModel);
    assertEquals(expectedType, flashMessage.getType());
    assertEquals(expectedStrongMessage, flashMessage.getStrongMessage());
    assertEquals(expectedRegularMessage, flashMessage.getRegularMessage());
    assertEquals(expectedElementSelector, flashMessage.getElementSelector());
}
Also used : Type(org.kie.workbench.common.dmn.client.editors.common.messages.FlashMessage.Type) FlashMessage(org.kie.workbench.common.dmn.client.editors.common.messages.FlashMessage) BaseIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord) Test(org.junit.Test)

Example 2 with BaseIncludedModelActiveRecord

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

the class DefinitionsHandlerTest method testCreate.

@Test
public void testCreate() {
    final BaseIncludedModelActiveRecord includedModel = mock(BaseIncludedModelActiveRecord.class);
    final String newNamespace = "://namespace2";
    when(includedModel.getNamespace()).thenReturn(newNamespace);
    handler.create(includedModel);
    assertEquals(2, nsContext.size());
    assertTrue(nsContext.values().contains(namespace));
    assertTrue(nsContext.values().contains(newNamespace));
}
Also used : BaseIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord) Test(org.junit.Test)

Example 3 with BaseIncludedModelActiveRecord

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

the class DefinitionsHandlerTest method testDestroy.

@Test
public void testDestroy() {
    final BaseIncludedModelActiveRecord includedModel = mock(BaseIncludedModelActiveRecord.class);
    when(includedModel.getNamespace()).thenReturn(namespace);
    handler.destroy(includedModel);
    assertEquals(0, nsContext.size());
}
Also used : BaseIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord) Test(org.junit.Test)

Example 4 with BaseIncludedModelActiveRecord

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

the class BaseCardComponentTest method testRemove.

@Test
public void testRemove() {
    final DMNCardsGridComponent grid = mock(DMNCardsGridComponent.class);
    final BaseIncludedModelActiveRecord includedModel = prepareIncludedModelMock();
    doReturn(includedModel).when(card).getIncludedModel();
    doReturn(grid).when(card).getGrid();
    card.remove();
    verify(includedModel).destroy();
    verify(grid).refresh();
    verify(refreshDecisionComponentsEvent).fire(Mockito.<RefreshDecisionComponents>any());
}
Also used : BaseIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord) Test(org.junit.Test)

Example 5 with BaseIncludedModelActiveRecord

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

the class BaseCardComponentTest method testRefreshView.

@Test
public void testRefreshView() {
    final BaseIncludedModelActiveRecord includedModel = prepareIncludedModelMock();
    final String path = "/bla/bla/bla/111111111111111222222222222222333333333333333444444444444444/file.dmn";
    when(includedModel.getNamespace()).thenReturn(path);
    doReturn(includedModel).when(card).getIncludedModel();
    card.refreshView();
    verify(cardView).setPath("...111111222222222222222333333333333333444444444444444/file.dmn");
}
Also used : BaseIncludedModelActiveRecord(org.kie.workbench.common.dmn.client.editors.included.BaseIncludedModelActiveRecord) 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