use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.
the class ImportsWidgetPresenterTest method testOnImportAdded.
@Test
public void testOnImportAdded() {
final Imports imports = new Imports();
imports.addImport(new Import("Internal1"));
presenter.setContent(dmo, imports, false);
presenter.onAddImport(new Import("NewImport1"));
assertEquals(2, imports.getImports().size());
assertContains("Internal1", imports.getImports());
assertContains("NewImport1", imports.getImports());
verify(importAddedEvent, times(1)).fire(importAddedEventCaptor.capture());
assertEquals("NewImport1", importAddedEventCaptor.getValue().getImport().getType());
verify(view, times(2)).updateRenderedColumns();
}
use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.
the class ImportsWidgetPresenterTest method testOnImportRemovedExternal.
@Test
public void testOnImportRemovedExternal() {
final Imports imports = new Imports();
imports.addImport(new Import("org.pkg1.External1"));
presenter.setContent(dmo, imports, false);
presenter.onRemoveImport(new Import("org.pkg1.External1"));
verify(view, times(2)).updateRenderedColumns();
assertEquals(0, imports.getImports().size());
assertContains("org.pkg1.External1", presenter.getExternalFactTypes());
}
use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.
the class ImportsWidgetPresenterTest method testSetContentWithExternalImport.
@Test
public void testSetContentWithExternalImport() {
final Imports imports = new Imports();
imports.addImport(new Import("org.pkg1.External1"));
presenter.setContent(dmo, imports, false);
verify(view, times(1)).setContent(internalFactTypesCaptor.capture(), externalFactTypesCaptor.capture(), importsFactTypesCaptor.capture(), eq(false));
assertEquals(3, internalFactTypesCaptor.getValue().size());
assertContains("Internal1", internalFactTypesCaptor.getValue());
assertContains("Internal2", internalFactTypesCaptor.getValue());
assertContains("Internal3", internalFactTypesCaptor.getValue());
assertEquals(2, externalFactTypesCaptor.getValue().size());
assertContains("org.pkg1.External2", externalFactTypesCaptor.getValue());
assertContains("org.pkg1.External3", externalFactTypesCaptor.getValue());
assertEquals(1, importsFactTypesCaptor.getValue().size());
assertContains("org.pkg1.External1", importsFactTypesCaptor.getValue());
assertEquals(1, imports.getImports().size());
assertContains("org.pkg1.External1", imports.getImports());
}
use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.
the class ImportsWidgetPresenterTest method testSetContentRemovesOldImportsOnImportAdded.
@Test
public void testSetContentRemovesOldImportsOnImportAdded() {
when(dmo.getInternalFactTypes()).thenReturn(new String[] { "a" });
when(dmo.getExternalFactTypes()).thenReturn(new String[] { "b" });
final Imports imports = new Imports();
imports.addImport(new Import("c"));
presenter.setContent(dmo, imports, false);
when(dmo.getInternalFactTypes()).thenReturn(new String[] { "A" });
when(dmo.getExternalFactTypes()).thenReturn(new String[] { "B" });
final Imports importsNew = new Imports();
importsNew.addImport(new Import("C"));
presenter.setContent(dmo, importsNew, false);
verify(view, times(2)).updateRenderedColumns();
assertEquals(1, presenter.getInternalFactTypes().size());
assertEquals("A", presenter.getInternalFactTypes().get(0).getType());
assertEquals(1, presenter.getExternalFactTypes().size());
assertEquals("B", presenter.getExternalFactTypes().get(0).getType());
assertEquals(1, presenter.getModelFactTypes().size());
assertEquals("C", presenter.getModelFactTypes().get(0).getType());
}
use of org.kie.soup.project.datamodel.imports.Import in project kie-wb-common by kiegroup.
the class ImportsWidgetPresenterTest method setup.
@Before
public void setup() {
this.presenter = new ImportsWidgetPresenter(view);
imports.getImports().addImport(new Import("import1"));
imports.getImports().addImport(new Import("import2"));
}
Aggregations