Search in sources :

Example 16 with KModuleModel

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

the class KSessionSelectorTest method testKSessionDefinedInScenarioNoLongerExistsAndKModuleIsEmpty.

@Test
public void testKSessionDefinedInScenarioNoLongerExistsAndKModuleIsEmpty() throws Exception {
    // No kbases or ksessions defined in the kmodule.xml
    when(kModuleService.load(kmodulePath)).thenReturn(new KModuleModel());
    selector.init(path, "ksessionThatHasBeenRemovedFromKModuleXML");
    verify(view).addKBases("defaultKieBase", "---");
    ArgumentCaptor<List> listArgumentCaptor = ArgumentCaptor.forClass(List.class);
    verify(view).setKSessions(listArgumentCaptor.capture());
    verify(view).setSelected(eq("---"), eq("ksessionThatHasBeenRemovedFromKModuleXML"));
    verify(view).showWarningSelectedKSessionDoesNotExist();
    List ksessionNamesList = listArgumentCaptor.getValue();
    assertEquals(1, ksessionNamesList.size());
    assertEquals("ksessionThatHasBeenRemovedFromKModuleXML", ksessionNamesList.get(0));
}
Also used : List(java.util.List) KModuleModel(org.kie.workbench.common.services.shared.kmodule.KModuleModel) Test(org.junit.Test)

Aggregations

KModuleModel (org.kie.workbench.common.services.shared.kmodule.KModuleModel)16 Test (org.junit.Test)13 KBaseModel (org.kie.workbench.common.services.shared.kmodule.KBaseModel)6 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)4 ProjectScreenModel (org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel)4 List (java.util.List)2 GAV (org.guvnor.common.services.project.model.GAV)2 MavenRepository (org.guvnor.common.services.project.model.MavenRepository)2 POM (org.guvnor.common.services.project.model.POM)2 ProjectImports (org.guvnor.common.services.project.model.ProjectImports)2 Import (org.kie.soup.project.datamodel.imports.Import)2 KSessionModel (org.kie.workbench.common.services.shared.kmodule.KSessionModel)2 HierarchicalStreamReader (com.thoughtworks.xstream.io.HierarchicalStreamReader)1 AbstractXStreamConverter (org.drools.core.util.AbstractXStreamConverter)1 MavenRepositoryMetadata (org.guvnor.common.services.project.model.MavenRepositoryMetadata)1 Before (org.junit.Before)1 ConsoleLogger (org.kie.workbench.common.services.shared.kmodule.ConsoleLogger)1 FileLogger (org.kie.workbench.common.services.shared.kmodule.FileLogger)1 KieModule (org.kie.workbench.common.services.shared.project.KieModule)1 Path (org.uberfire.backend.vfs.Path)1