Search in sources :

Example 21 with ProjectScreenModel

use of org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel in project kie-wb-common by kiegroup.

the class ProjectScreenModelLoaderTest method testWhiteList.

@Test
public void testWhiteList() throws Exception {
    final WhiteList whiteList = new WhiteList();
    when(whiteListService.load(packageNamesWhiteListPath)).thenReturn(whiteList);
    final Metadata metadata = new Metadata();
    when(metadataService.getMetadata(packageNamesWhiteListPath)).thenReturn(metadata);
    ProjectScreenModel model = loader.load(pathToPom);
    assertEquals(packageNamesWhiteListPath, model.getPathToWhiteList());
    assertEquals(whiteList, model.getWhiteList());
    assertEquals(metadata, model.getWhiteListMetaData());
}
Also used : WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test)

Example 22 with ProjectScreenModel

use of org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel in project kie-wb-common by kiegroup.

the class ProjectScreenModelSaverTest method testBatchSave.

@Test
public void testBatchSave() throws Exception {
    final CommentedOption commentedOption = new CommentedOption("hello");
    when(commentedOptionFactory.makeCommentedOption("message")).thenReturn(commentedOption);
    saver.save(pathToPom, new ProjectScreenModel(), DeploymentMode.FORCED, "message");
    verify(ioService).startBatch(any(FileSystem.class), eq(commentedOption));
    verify(ioService).endBatch();
}
Also used : CommentedOption(org.uberfire.java.nio.base.options.CommentedOption) TestFileSystem(org.guvnor.test.TestFileSystem) FileSystem(org.uberfire.java.nio.file.FileSystem) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test)

Example 23 with ProjectScreenModel

use of org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel in project kie-wb-common by kiegroup.

the class ProjectScreenModelSaverTest method testKModuleSave.

@Test
public void testKModuleSave() throws Exception {
    final ProjectScreenModel model = new ProjectScreenModel();
    final KModuleModel kModule = new KModuleModel();
    model.setKModule(kModule);
    final Path pathToKModule = mock(Path.class);
    model.setPathToKModule(pathToKModule);
    final Metadata metadata = new Metadata();
    model.setKModuleMetaData(metadata);
    saver.save(pathToPom, model, DeploymentMode.FORCED, "message kmodule");
    verify(kModuleService).save(eq(pathToKModule), eq(kModule), eq(metadata), eq("message kmodule"));
}
Also used : Path(org.uberfire.backend.vfs.Path) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) KModuleModel(org.kie.workbench.common.services.shared.kmodule.KModuleModel) Test(org.junit.Test)

Example 24 with ProjectScreenModel

use of org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel in project kie-wb-common by kiegroup.

the class ProjectScreenModelSaverTest method testPOMSave.

@Test
public void testPOMSave() throws Exception {
    final ProjectScreenModel model = new ProjectScreenModel();
    final POM pom = new POM();
    model.setPOM(pom);
    final Metadata pomMetaData = new Metadata();
    model.setPOMMetaData(pomMetaData);
    saver.save(pathToPom, model, DeploymentMode.FORCED, "message");
    verify(pomService).save(eq(pathToPom), eq(pom), eq(pomMetaData), eq("message"));
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) POM(org.guvnor.common.services.project.model.POM) Test(org.junit.Test)

Example 25 with ProjectScreenModel

use of org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel in project kie-wb-common by kiegroup.

the class ProjectScreenModelSaverTest method testWhiteListSave.

@Test
public void testWhiteListSave() throws Exception {
    final ProjectScreenModel model = new ProjectScreenModel();
    final WhiteList whiteList = new WhiteList();
    model.setWhiteList(whiteList);
    final Path pathToWhiteList = mock(Path.class);
    model.setPathToWhiteList(pathToWhiteList);
    final Metadata metadata = new Metadata();
    model.setWhiteListMetaData(metadata);
    saver.save(pathToPom, model, DeploymentMode.FORCED, "message white list");
    verify(whiteListService).save(eq(pathToWhiteList), eq(whiteList), eq(metadata), eq("message white list"));
}
Also used : Path(org.uberfire.backend.vfs.Path) WhiteList(org.kie.workbench.common.services.shared.whitelist.WhiteList) Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test)

Aggregations

ProjectScreenModel (org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel)31 Test (org.junit.Test)28 ModuleRepositories (org.guvnor.common.services.project.model.ModuleRepositories)9 Metadata (org.guvnor.common.services.shared.metadata.model.Metadata)9 POM (org.guvnor.common.services.project.model.POM)8 GAVAlreadyExistsException (org.guvnor.common.services.project.service.GAVAlreadyExistsException)6 Path (org.uberfire.backend.vfs.Path)6 MavenRepositoryMetadata (org.guvnor.common.services.project.model.MavenRepositoryMetadata)5 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)5 CommentedOption (org.uberfire.java.nio.base.options.CommentedOption)5 FileSystem (org.uberfire.java.nio.file.FileSystem)5 GAV (org.guvnor.common.services.project.model.GAV)4 ArrayList (java.util.ArrayList)3 ProjectImports (org.guvnor.common.services.project.model.ProjectImports)3 GitRepository (org.guvnor.structure.repositories.impl.git.GitRepository)3 KModuleModel (org.kie.workbench.common.services.shared.kmodule.KModuleModel)3 WhiteList (org.kie.workbench.common.services.shared.whitelist.WhiteList)3 DomGlobal (elemental2.dom.DomGlobal)1 HTMLElement (elemental2.dom.HTMLElement)1 Promise (elemental2.promise.Promise)1