use of org.kie.workbench.common.services.shared.kmodule.KBaseModel in project kie-wb-common by kiegroup.
the class KModuleContentHandlerTest method testConsoleLogger.
@Test
public void testConsoleLogger() throws Exception {
final KModuleContentHandler kModuleContentHandler = new KModuleContentHandler();
final KModuleModel model = kModuleContentHandler.toModel(readResource("consoleLoggerKModule.xml"));
assertNotNull(model);
assertEquals(1, model.getKBases().size());
final KBaseModel kBaseModel = model.getKBases().get("org.kie.example2");
assertNotNull(kBaseModel);
assertEquals(1, kBaseModel.getKSessions().size());
final KSessionModel kSessionModel = kBaseModel.getKSessions().get(0);
assertEquals("ksession2", kSessionModel.getName());
assertEquals("stateless", kSessionModel.getType());
assertFalse(kSessionModel.isDefault());
assertEquals(ClockTypeOption.PSEUDO, kSessionModel.getClockType());
assertTrue(kSessionModel.getLogger() instanceof ConsoleLogger);
final String xml = kModuleContentHandler.toString(model);
assertTrue(xml.contains("<kbase name=\"org.kie.example2\" default=\"false\" eventProcessingMode=\"stream\" equalsBehavior=\"identity\">"));
assertTrue(xml.contains("<ksession name=\"ksession2\" type=\"stateless\" default=\"false\" clockType=\"pseudo\">"));
assertTrue(xml.contains("<consoleLogger/>"));
}
use of org.kie.workbench.common.services.shared.kmodule.KBaseModel in project kie-wb-common by kiegroup.
the class KnowledgeBaseItemPresenterTest method testSignalAddedOrRemoved.
@Test
public void testSignalAddedOrRemoved() {
final KBaseModel kBaseModel = new KBaseModel();
final KnowledgeBasesPresenter parentPresenter = mock(KnowledgeBasesPresenter.class);
knowledgeBaseItemPresenter.kBaseModel = kBaseModel;
knowledgeBaseItemPresenter.parentPresenter = parentPresenter;
knowledgeBaseItemPresenter.signalAddedOrRemoved();
verify(parentPresenter).fireChangeEvent();
verify(view).setKnowledgeSessionsCount(eq(0));
}
use of org.kie.workbench.common.services.shared.kmodule.KBaseModel in project kie-wb-common by kiegroup.
the class KnowledgeBaseItemPresenterTest method testSetup.
@Test
public void testSetup() {
final KnowledgeBaseItemPresenter setup = knowledgeBaseItemPresenter.setup(new KBaseModel(), mock(KnowledgeBasesPresenter.class));
Assert.assertEquals(setup, knowledgeBaseItemPresenter);
verify(view).setKnowledgeSessionsCount(anyInt());
verify(view).setDefault(anyBoolean());
verify(view).setName(any());
verify(knowledgeSessionsModal).setup(any());
verify(packageListPresenter).setup(any(), any(), any());
verify(includedKnowledgeBasesListPresenter).setup(any(), any(), any());
verify(view).setupEventProcessingModelSelect(any());
verify(view).setupEqualBehaviorSelect(any());
}
use of org.kie.workbench.common.services.shared.kmodule.KBaseModel in project kie-wb-common by kiegroup.
the class KnowledgeSessionListItemPresenterTest method testOnDefaultKnowledgeSessionChanged.
@Test
public void testOnDefaultKnowledgeSessionChanged() {
final KBaseModel kBaseModel = new KBaseModel();
final KSessionModel kSessionModel = new KSessionModel();
kSessionModel.setDefault(true);
final KnowledgeSessionsModal parentPresenter = mock(KnowledgeSessionsModal.class);
doReturn(kBaseModel).when(parentPresenter).getObject();
knowledgeSessionListItemPresenter.parentPresenter = parentPresenter;
knowledgeSessionListItemPresenter.kSessionModel = kSessionModel;
knowledgeSessionListItemPresenter.onDefaultKnowledgeSessionChanged(new DefaultKnowledgeSessionChange(kBaseModel, kSessionModel));
Assert.assertTrue(kSessionModel.isDefault());
}
use of org.kie.workbench.common.services.shared.kmodule.KBaseModel in project kie-wb-common by kiegroup.
the class KnowledgeBasesPresenterTest method testNewKBaseModelNonEmptyMap.
@Test
public void testNewKBaseModelNonEmptyMap() {
doReturn(singletonList(new KBaseModel())).when(knowledgeBaseListPresenter).getObjectsList();
final KBaseModel kBaseModel = knowledgeBasesPresenter.newKBaseModel("Name");
Assert.assertEquals("Name", kBaseModel.getName());
Assert.assertEquals(false, kBaseModel.isDefault());
}
Aggregations