Search in sources :

Example 1 with ProjectExplorerContent

use of org.kie.workbench.common.screens.explorer.model.ProjectExplorerContent in project kie-wb-common by kiegroup.

the class ProjectExplorerContentResolverTest method testChangeProjectOnBusinessView.

@Test
public void testChangeProjectOnBusinessView() throws Exception {
    ProjectExplorerContent content = resolver.resolve(getContentQuery(masterBranch, createModule("master", masterBranch, "module 1"), Option.BUSINESS_CONTENT));
    helperWrapper.reset();
    assertEquals("master", content.getProject().getBranch().getName());
    // This will be the default module
    assertNotNull(content.getModule());
    assertEquals("master@module 1", content.getModule().getRootPath().toURI());
    content = resolver.resolve(getContentQuery(devBranch, createModule("dev-1.0.0", devBranch, "module 1"), Option.BUSINESS_CONTENT));
    helperWrapper.reset();
    assertEquals("dev-1.0.0", content.getProject().getBranch().getName());
    assertEquals("module 1", content.getModule().getModuleName());
    assertEquals("dev-1.0.0@module 1", content.getModule().getRootPath().toURI());
    content = resolver.resolve(getContentQuery(devBranch, createModule("dev-1.0.0", devBranch, "module 2"), Option.BUSINESS_CONTENT));
    helperWrapper.reset();
    assertEquals("dev-1.0.0", content.getProject().getBranch().getName());
    assertEquals("module 2", content.getModule().getModuleName());
    assertEquals("dev-1.0.0@module 2", content.getModule().getRootPath().toURI());
    content = resolver.resolve(getContentQuery(masterBranch, createModule("master", masterBranch, "module 2"), Option.BUSINESS_CONTENT));
    helperWrapper.reset();
    assertEquals("master", content.getProject().getBranch().getName());
    assertEquals("module 2", content.getModule().getModuleName());
    assertEquals("master@module 2", content.getModule().getRootPath().toURI());
}
Also used : ProjectExplorerContent(org.kie.workbench.common.screens.explorer.model.ProjectExplorerContent) Test(org.junit.Test)

Example 2 with ProjectExplorerContent

use of org.kie.workbench.common.screens.explorer.model.ProjectExplorerContent in project kie-wb-common by kiegroup.

the class ProjectExplorerContentResolver method resolve.

public ProjectExplorerContent resolve(final ProjectExplorerContentQuery query) {
    final Content content = setupSelectedItems(query);
    // Content may contain invalid state, e.g. Repository deleted, Module deleted etc so validate and reset as appropriate
    setSelectedModule(content);
    setSelectedPackage(content);
    setSelectedItem(content);
    if (content.getSelectedProject() == null || content.getSelectedModule() == null) {
        return emptyModuleExplorerContent(content);
    } else {
        return moduleExplorerContentWithSelections(content, query.getOptions());
    }
}
Also used : ProjectExplorerContent(org.kie.workbench.common.screens.explorer.model.ProjectExplorerContent)

Example 3 with ProjectExplorerContent

use of org.kie.workbench.common.screens.explorer.model.ProjectExplorerContent in project kie-wb-common by kiegroup.

the class ProjectExplorerContentResolverDefaultSelectionsTest method testSelectionsModule.

@Test
public void testSelectionsModule() throws Exception {
    final ProjectExplorerContent content = resolver.resolve(getContentQuery(repository1, "master", repository1Module1));
    assertEquals(repository1, content.getProject().getRepository());
    assertEquals(repository1Module1, content.getModule());
}
Also used : ProjectExplorerContent(org.kie.workbench.common.screens.explorer.model.ProjectExplorerContent) Test(org.junit.Test)

Aggregations

ProjectExplorerContent (org.kie.workbench.common.screens.explorer.model.ProjectExplorerContent)3 Test (org.junit.Test)2