Search in sources :

Example 6 with KSessionModel

use of org.kie.workbench.common.services.shared.kmodule.KSessionModel 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);
}
Also used : KSessionModel(org.kie.workbench.common.services.shared.kmodule.KSessionModel) KBaseModel(org.kie.workbench.common.services.shared.kmodule.KBaseModel)

Example 7 with KSessionModel

use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.

the class KSessionSelector method listKSessions.

private void listKSessions(List<KSessionModel> ksessions) {
    List<String> ksessionNames = new ArrayList<String>();
    for (KSessionModel ksession : ksessions) {
        ksessionNames.add(ksession.getName());
    }
    view.setKSessions(ksessionNames);
}
Also used : ArrayList(java.util.ArrayList) KSessionModel(org.kie.workbench.common.services.shared.kmodule.KSessionModel)

Example 8 with KSessionModel

use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.

the class KnowledgeSessionsModal method newKSessionModel.

KSessionModel newKSessionModel() {
    final KSessionModel kSessionModel = new KSessionModel();
    kSessionModel.setName("");
    kSessionModel.setDefault(knowledgeBasesListPresenter.getObjectsList().isEmpty());
    return kSessionModel;
}
Also used : KSessionModel(org.kie.workbench.common.services.shared.kmodule.KSessionModel)

Example 9 with KSessionModel

use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.

the class KnowledgeSessionListItemPresenterTest method testOnDefaultKnowledgeSessionChangedWithAnotherKSessionModel.

@Test
public void testOnDefaultKnowledgeSessionChangedWithAnotherKSessionModel() {
    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;
    final KSessionModel anotherKSessionModel = new KSessionModel();
    anotherKSessionModel.setName("Distinguishing name");
    knowledgeSessionListItemPresenter.onDefaultKnowledgeSessionChanged(new DefaultKnowledgeSessionChange(kBaseModel, anotherKSessionModel));
    Assert.assertEquals(false, kSessionModel.isDefault());
}
Also used : KSessionModel(org.kie.workbench.common.services.shared.kmodule.KSessionModel) KBaseModel(org.kie.workbench.common.services.shared.kmodule.KBaseModel) Test(org.junit.Test)

Example 10 with KSessionModel

use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.

the class KnowledgeSessionListItemPresenterTest method testAddWorkItemHandler.

@Test
public void testAddWorkItemHandler() {
    doNothing().when(knowledgeSessionListItemPresenter).fireChangeEvent();
    knowledgeSessionListItemPresenter.kSessionModel = new KSessionModel();
    knowledgeSessionListItemPresenter.addWorkItemHandler();
    verify(workItemHandlersListPresenter).add(any());
    verify(knowledgeSessionListItemPresenter).signalWorkItemHandlerAddedOrRemoved();
    verify(knowledgeSessionListItemPresenter).fireChangeEvent();
}
Also used : KSessionModel(org.kie.workbench.common.services.shared.kmodule.KSessionModel) Test(org.junit.Test)

Aggregations

KSessionModel (org.kie.workbench.common.services.shared.kmodule.KSessionModel)18 Test (org.junit.Test)9 KBaseModel (org.kie.workbench.common.services.shared.kmodule.KBaseModel)7 HierarchicalStreamReader (com.thoughtworks.xstream.io.HierarchicalStreamReader)2 AbstractXStreamConverter (org.drools.core.util.AbstractXStreamConverter)2 ArrayList (java.util.ArrayList)1 WorkItemHandlerModel (org.guvnor.common.services.project.model.WorkItemHandlerModel)1 ListenerModel (org.kie.workbench.common.services.shared.kmodule.ListenerModel)1