Search in sources :

Example 1 with KBaseModel

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

Example 2 with KBaseModel

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

the class KnowledgeBasesPresenterTest method testNewKBaseModelEmptyMap.

@Test
public void testNewKBaseModelEmptyMap() {
    doReturn(emptyList()).when(knowledgeBaseListPresenter).getObjectsList();
    final KBaseModel kBaseModel = knowledgeBasesPresenter.newKBaseModel("Name");
    Assert.assertEquals("Name", kBaseModel.getName());
    Assert.assertEquals(true, kBaseModel.isDefault());
}
Also used : KBaseModel(org.kie.workbench.common.services.shared.kmodule.KBaseModel) Test(org.junit.Test)

Example 3 with KBaseModel

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(addPackageModal).setup(any(), any());
    verify(addIncludedKnowledgeBaseModal).setup(any(), any());
    verify(packageListPresenter).setup(any(), any(), any());
    verify(includedKnowledgeBasesListPresenter).setup(any(), any(), any());
    verify(eventProcessingModeSelect).setup(any(), any(), any(), any());
    verify(equalsBehaviorSelect).setup(any(), any(), any(), any());
}
Also used : KnowledgeBasesPresenter(org.kie.workbench.common.screens.library.client.settings.knowledgebases.KnowledgeBasesPresenter) KBaseModel(org.kie.workbench.common.services.shared.kmodule.KBaseModel) Test(org.junit.Test)

Example 4 with KBaseModel

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

the class KnowledgeBaseItemPresenterTest method testOnDefaultKnowledgeSessionChanged.

@Test
public void testOnDefaultKnowledgeSessionChanged() {
    final KBaseModel kBaseModel = new KBaseModel();
    kBaseModel.setDefault(true);
    knowledgeBaseItemPresenter.kBaseModel = kBaseModel;
    knowledgeBaseItemPresenter.onDefaultKnowledgeSessionChanged(new DefaultKnowledgeBaseChange(kBaseModel));
    Assert.assertTrue(kBaseModel.isDefault());
}
Also used : KBaseModel(org.kie.workbench.common.services.shared.kmodule.KBaseModel) Test(org.junit.Test)

Example 5 with KBaseModel

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

the class KnowledgeBaseItemPresenterTest method testOnDefaultKnowledgeSessionChangedWithAnotherKBaseModel.

@Test
public void testOnDefaultKnowledgeSessionChangedWithAnotherKBaseModel() {
    final KBaseModel kBaseModel = new KBaseModel();
    kBaseModel.setDefault(true);
    knowledgeBaseItemPresenter.kBaseModel = kBaseModel;
    knowledgeBaseItemPresenter.onDefaultKnowledgeSessionChanged(new DefaultKnowledgeBaseChange(mock(KBaseModel.class)));
    Assert.assertFalse(kBaseModel.isDefault());
}
Also used : KBaseModel(org.kie.workbench.common.services.shared.kmodule.KBaseModel) Test(org.junit.Test)

Aggregations

KBaseModel (org.kie.workbench.common.services.shared.kmodule.KBaseModel)38 Test (org.junit.Test)27 KSessionModel (org.kie.workbench.common.services.shared.kmodule.KSessionModel)12 KModuleModel (org.kie.workbench.common.services.shared.kmodule.KModuleModel)6 KnowledgeBasesPresenter (org.kie.workbench.common.screens.library.client.settings.sections.knowledgebases.KnowledgeBasesPresenter)5 KnowledgeBasesPresenter (org.kie.workbench.common.screens.library.client.settings.knowledgebases.KnowledgeBasesPresenter)3 HierarchicalStreamReader (com.thoughtworks.xstream.io.HierarchicalStreamReader)2 AbstractXStreamConverter (org.drools.core.util.AbstractXStreamConverter)2 SingleValueItemObjectModel (org.kie.workbench.common.services.shared.kmodule.SingleValueItemObjectModel)2 InputStream (java.io.InputStream)1 ArrayList (java.util.ArrayList)1 RuntimeStrategy (org.kie.internal.runtime.conf.RuntimeStrategy)1 KnowledgeBaseItemPresenter (org.kie.workbench.common.screens.library.client.settings.knowledgebases.item.KnowledgeBaseItemPresenter)1 KnowledgeBaseItemPresenter (org.kie.workbench.common.screens.library.client.settings.sections.knowledgebases.item.KnowledgeBaseItemPresenter)1 ProcessConfigModule (org.kie.workbench.common.screens.server.management.model.ProcessConfigModule)1 RuntimeStrategy (org.kie.workbench.common.screens.server.management.model.RuntimeStrategy)1 KModuleContentHandler (org.kie.workbench.common.services.backend.kmodule.KModuleContentHandler)1 ConsoleLogger (org.kie.workbench.common.services.shared.kmodule.ConsoleLogger)1 FileLogger (org.kie.workbench.common.services.shared.kmodule.FileLogger)1