use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.
the class KnowledgeSessionListItemPresenterTest method testSetType.
@Test
public void testSetType() {
final KSessionModel kSessionModel = new KSessionModel();
final KnowledgeSessionsModal parentPresenter = mock(KnowledgeSessionsModal.class);
knowledgeSessionListItemPresenter.parentPresenter = parentPresenter;
knowledgeSessionListItemPresenter.kSessionModel = kSessionModel;
knowledgeSessionListItemPresenter.setType("Type");
Assert.assertEquals("Type", kSessionModel.getType());
verify(parentPresenter).fireChangeEvent();
}
use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.
the class KnowledgeSessionListItemPresenterTest method testSetName.
@Test
public void testSetName() {
final KSessionModel kSessionModel = new KSessionModel();
final KnowledgeSessionsModal parentPresenter = mock(KnowledgeSessionsModal.class);
knowledgeSessionListItemPresenter.parentPresenter = parentPresenter;
knowledgeSessionListItemPresenter.kSessionModel = kSessionModel;
knowledgeSessionListItemPresenter.setName("Name");
Assert.assertEquals("Name", kSessionModel.getName());
verify(parentPresenter).fireChangeEvent();
}
use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.
the class KnowledgeSessionListItemPresenterTest method testAddListener.
@Test
public void testAddListener() {
doNothing().when(knowledgeSessionListItemPresenter).fireChangeEvent();
knowledgeSessionListItemPresenter.kSessionModel = new KSessionModel();
knowledgeSessionListItemPresenter.addListener();
verify(listenersListPresenter).add(any());
verify(knowledgeSessionListItemPresenter).signalListenerAddedOrRemoved();
verify(knowledgeSessionListItemPresenter).fireChangeEvent();
}
use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.
the class KnowledgeSessionsModalTest method testNewKSessionModelNonEmptyList.
@Test
public void testNewKSessionModelNonEmptyList() {
doReturn(singletonList(mock(KSessionModel.class))).when(knowledgeBasesListPresenter).getObjectsList();
final KSessionModel kSessionModel = knowledgeSessionsModal.newKSessionModel();
Assert.assertEquals("", kSessionModel.getName());
Assert.assertEquals(false, kSessionModel.isDefault());
}
use of org.kie.workbench.common.services.shared.kmodule.KSessionModel in project kie-wb-common by kiegroup.
the class KBaseConverter method unmarshal.
public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingContext context) {
final KBaseModel kBase = new KBaseModel();
kBase.setName(reader.getAttribute("name"));
kBase.setDefault("true".equals(reader.getAttribute("default")));
String eventMode = reader.getAttribute("eventProcessingMode");
if (eventMode != null) {
kBase.setEventProcessingMode(EventProcessingOption.determineEventProcessingMode(eventMode));
}
String equalsBehavior = reader.getAttribute("equalsBehavior");
if (equalsBehavior != null) {
kBase.setEqualsBehavior(AssertBehaviorOption.determineAssertBehaviorMode(equalsBehavior));
}
String declarativeAgenda = reader.getAttribute("declarativeAgenda");
if (declarativeAgenda != null) {
kBase.setDeclarativeAgenda(DeclarativeAgendaOption.determineDeclarativeAgendaMode(declarativeAgenda));
}
String scope = reader.getAttribute("scope");
if (scope != null) {
kBase.setScope(scope.trim());
}
String pkgs = reader.getAttribute("packages");
if (pkgs != null) {
for (String pkg : pkgs.split(",")) {
kBase.addPackage(pkg.trim());
}
}
String includes = reader.getAttribute("includes");
if (includes != null) {
for (String include : includes.split(",")) {
kBase.addInclude(include.trim());
}
}
readNodes(reader, new AbstractXStreamConverter.NodeReader() {
public void onNode(HierarchicalStreamReader reader, String name, String value) {
if ("ksession".equals(name)) {
KSessionModel kSession = readObject(reader, context, KSessionModel.class);
kBase.getKSessions().add(kSession);
} else if ("includes".equals(name)) {
for (String include : readList(reader)) {
kBase.addInclude(include);
}
}
}
});
return kBase;
}
Aggregations