Search in sources :

Example 1 with ProjectScreenModel

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

the class GeneralSettingsPresenterTest method testSetup.

@Test
public void testSetup() {
    final ProjectScreenModel model = mock(ProjectScreenModel.class);
    final POM pom = mock(POM.class);
    doReturn(pom).when(model).getPOM();
    doReturn(new GAV()).when(pom).getGav();
    generalSettingsPresenter.setup(model).catch_(i -> {
        Assert.fail("Promise should've been resolved!");
        return promises.resolve();
    });
    verify(view).init(eq(generalSettingsPresenter));
    verify(view).setName(any());
    verify(view).setDescription(any());
    verify(view).setGroupId(any());
    verify(view).setArtifactId(any());
    verify(view).setVersion(any());
    verify(gavPreferences).load(any(), any(), any());
}
Also used : ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) GAV(org.guvnor.common.services.project.model.GAV) POM(org.guvnor.common.services.project.model.POM) Test(org.junit.Test)

Example 2 with ProjectScreenModel

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

the class ProjectScreenModelLoaderTest method testWhiteListNoMetadata.

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

Example 3 with ProjectScreenModel

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

the class ProjectScreenModelLoaderTest method testImports.

@Test
public void testImports() throws Exception {
    final ProjectImports projectImports = new ProjectImports();
    when(projectImportsService.load(importsPath)).thenReturn(projectImports);
    final Metadata metadata = new Metadata();
    when(metadataService.getMetadata(importsPath)).thenReturn(metadata);
    ProjectScreenModel model = loader.load(pathToPom);
    assertEquals(importsPath, model.getPathToImports());
    assertEquals(projectImports, model.getProjectImports());
    assertEquals(metadata, model.getProjectImportsMetaData());
}
Also used : Metadata(org.guvnor.common.services.shared.metadata.model.Metadata) ProjectImports(org.guvnor.common.services.project.model.ProjectImports) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test)

Example 4 with ProjectScreenModel

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

the class ProjectScreenModelLoaderTest method testKModule.

@Test
public void testKModule() throws Exception {
    final KModuleModel kModuleModel = new KModuleModel();
    when(kModuleService.load(kmoduleXMLPath)).thenReturn(kModuleModel);
    final Metadata metadata = new Metadata();
    when(metadataService.getMetadata(kmoduleXMLPath)).thenReturn(metadata);
    ProjectScreenModel model = loader.load(pathToPom);
    assertEquals(kmoduleXMLPath, model.getPathToKModule());
    assertEquals(kModuleModel, model.getKModule());
    assertEquals(metadata, model.getKModuleMetaData());
}
Also used : 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 5 with ProjectScreenModel

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

the class ProjectScreenModelLoaderTest method testLoadPom.

@Test
public void testLoadPom() throws Exception {
    final POM pom = new POM();
    when(pomService.load(pathToPom)).thenReturn(pom);
    final Metadata metadata = new Metadata();
    when(metadataService.getMetadata(pathToPom)).thenReturn(metadata);
    ProjectScreenModel model = loader.load(pathToPom);
    assertEquals(pathToPom, model.getPathToPOM());
    assertEquals(pom, model.getPOM());
    assertEquals(metadata, model.getPOMMetaData());
}
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)

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