use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.
the class KSessionSelector method selectFirstKBaseAndKSession.
private void selectFirstKBaseAndKSession() {
KBaseModel firstKBase = kmodule.getKBases().values().iterator().next();
List<KSessionModel> ksessions = firstKBase.getKSessions();
listKSessions(ksessions);
view.setSelected(firstKBase.getName(), ksessions.iterator().next().getName());
}
use of org.kie.workbench.common.services.shared.kmodule.KSessionModel 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.KSessionModel in project kie-wb-common by kiegroup.
the class KnowledgeSessionListItemPresenterTest method testSetDefault.
@Test
public void testSetDefault() {
final KSessionModel kSessionModel = new KSessionModel();
kSessionModel.setDefault(false);
final KnowledgeSessionsModal parentPresenter = mock(KnowledgeSessionsModal.class);
knowledgeSessionListItemPresenter.parentPresenter = parentPresenter;
knowledgeSessionListItemPresenter.kSessionModel = kSessionModel;
knowledgeSessionListItemPresenter.setDefault(true);
Assert.assertTrue(kSessionModel.isDefault());
verify(defaultKnowledgeSessionChangeEvent).fire(any());
verify(parentPresenter).fireChangeEvent();
}
use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.
the class KnowledgeSessionsModalTest method testNewKSessionModelEmptyList.
@Test
public void testNewKSessionModelEmptyList() {
doReturn(emptyList()).when(knowledgeBasesListPresenter).getObjectsList();
final KSessionModel kSessionModel = knowledgeSessionsModal.newKSessionModel();
Assert.assertEquals("", kSessionModel.getName());
Assert.assertTrue(kSessionModel.isDefault());
}
use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.
the class KSessionSelector method selectFromModel.
private void selectFromModel(final String currentKSession) {
for (KBaseModel kbase : kmodule.getKBases().values()) {
for (KSessionModel ksession : kbase.getKSessions()) {
if (ksession.getName().equals(currentKSession)) {
listKSessions(kmodule.getKBases().get(kbase.getName()).getKSessions());
view.setSelected(kbase.getName(), currentKSession);
break;
}
}
}
}
Aggregations