Search in sources :

Example 16 with ProjectScreenModel

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

the class ExternalDataObjectsPresenterTest method testSetup.

@Test
public void testSetup() {
    final ProjectScreenModel model = mock(ProjectScreenModel.class);
    doReturn(new ProjectImports()).when(model).getProjectImports();
    externalDataObjectsPresenter.setup(model).catch_(i -> {
        Assert.fail("Promise should've been resolved!");
        return promises.resolve();
    });
    verify(view).init(eq(externalDataObjectsPresenter));
    verify(itemPresenters).setup(any(), any(), any());
}
Also used : ProjectImports(org.guvnor.common.services.project.model.ProjectImports) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test)

Example 17 with ProjectScreenModel

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

the class KnowledgeBasesPresenterTest method testSetup.

@Test
public void testSetup() {
    final ProjectScreenModel model = mock(ProjectScreenModel.class);
    when(model.getKModule()).thenReturn(spy(new KModuleModel()));
    when(model.getKModule().getKBases()).thenReturn(emptyMap());
    knowledgeBasesPresenter.setup(model).catch_(i -> {
        Assert.fail("Promise should've been resolved!");
        return promises.resolve();
    });
    verify(view).init(eq(knowledgeBasesPresenter));
    verify(addKnowledgeBaseModal).setup(any(), any());
    verify(knowledgeBaseListPresenter).setup(any(), any(), any());
}
Also used : ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) KModuleModel(org.kie.workbench.common.services.shared.kmodule.KModuleModel) Test(org.junit.Test)

Example 18 with ProjectScreenModel

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

the class ValidationPresenterTest method testSetup.

@Test
public void testSetup() {
    final ProjectScreenModel model = mock(ProjectScreenModel.class);
    doReturn(new ModuleRepositories()).when(model).getRepositories();
    validationPresenter.setup(model).catch_(i -> {
        Assert.fail("Promise should've been resolved!");
        return promises.resolve();
    });
    verify(view).init(eq(validationPresenter));
    verify(validationItemPresenters).setup(any(), any(), any());
}
Also used : ModuleRepositories(org.guvnor.common.services.project.model.ModuleRepositories) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test)

Example 19 with ProjectScreenModel

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

the class ValidationPresenterTest method testCurrentHashCode.

@Test
public void testCurrentHashCode() {
    final ProjectScreenModel model = mock(ProjectScreenModel.class);
    final ModuleRepositories repositories = new ModuleRepositories();
    doReturn(repositories).when(model).getRepositories();
    validationPresenter.setup(model);
    int currentHashCode = validationPresenter.currentHashCode();
    Assert.assertEquals(repositories.getRepositories().hashCode(), currentHashCode);
    repositories.getRepositories().add(mock(ModuleRepositories.ModuleRepository.class));
    int updatedHashCode = validationPresenter.currentHashCode();
    Assert.assertEquals(repositories.getRepositories().hashCode(), updatedHashCode);
}
Also used : ModuleRepositories(org.guvnor.common.services.project.model.ModuleRepositories) ProjectScreenModel(org.kie.workbench.common.screens.projecteditor.model.ProjectScreenModel) Test(org.junit.Test)

Example 20 with ProjectScreenModel

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

the class ProjectScreenModelLoaderTest method testRepositories.

@Test
public void testRepositories() throws Exception {
    final ModuleRepositories moduleRepositories = new ModuleRepositories();
    when(moduleRepositoriesService.load(repositoriesPath)).thenReturn(moduleRepositories);
    ProjectScreenModel model = loader.load(pathToPom);
    assertEquals(repositoriesPath, model.getPathToRepositories());
    assertEquals(moduleRepositories, model.getRepositories());
}
Also used : ModuleRepositories(org.guvnor.common.services.project.model.ModuleRepositories) 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