use of org.kie.workbench.common.services.shared.kmodule.KBaseModel in project kie-wb-common by kiegroup.
the class KnowledgeBasesPresenter method newKBaseModel.
KBaseModel newKBaseModel(final String knowledgeBaseName) {
final KBaseModel kBaseModel = new KBaseModel();
kBaseModel.setName(knowledgeBaseName);
kBaseModel.setDefault(knowledgeBaseListPresenter.getObjectsList().isEmpty());
return kBaseModel;
}
use of org.kie.workbench.common.services.shared.kmodule.KBaseModel 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;
}
}
}
}
use of org.kie.workbench.common.services.shared.kmodule.KBaseModel in project kie-wb-common by kiegroup.
the class KSessionSelector method addMockKBaseModel.
private void addMockKBaseModel(final String kbaseName, final String ksessionsName) {
KBaseModel kbaseModel = new KBaseModel();
kbaseModel.setName(kbaseName);
KSessionModel ksessionModel = new KSessionModel();
ksessionModel.setName(ksessionsName);
kbaseModel.getKSessions().add(ksessionModel);
kmodule.getKBases().put(kbaseName, kbaseModel);
}
use of org.kie.workbench.common.services.shared.kmodule.KBaseModel in project kie-wb-common by kiegroup.
the class KnowledgeBasesPresenterTest method testSave.
@Test
public void testSave() {
final KModuleModel kModuleModel = spy(new KModuleModel());
knowledgeBasesPresenter.kModuleModel = kModuleModel;
final Map<String, KBaseModel> kBasesMap = spy(new HashMap<>());
doReturn(kBasesMap).when(kModuleModel).getKBases();
knowledgeBasesPresenter.save("Test comment", null).catch_(i -> {
Assert.fail("Promise should've been resolved!");
return promises.resolve();
});
verify(kBasesMap).clear();
verify(kBasesMap).putAll(any());
}
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));
}
Aggregations