Search in sources :

Example 1 with ExplorerPreferencesLoader

use of org.kie.workbench.common.screens.explorer.backend.server.preferences.ExplorerPreferencesLoader in project kie-wb-common by kiegroup.

the class BaseViewPresenterTest method testAutomaticModuleBuildDisabledSystemProperty.

@Test
public void testAutomaticModuleBuildDisabledSystemProperty() {
    final OrganizationalUnit ou = mock(OrganizationalUnit.class);
    final Repository repository = mock(Repository.class);
    final Module module = mock(Module.class);
    String spBuildDisableModuleExplorer = null;
    try {
        spBuildDisableModuleExplorer = System.getProperty(ExplorerService.BUILD_PROJECT_PROPERTY_NAME);
        System.setProperty(ExplorerService.BUILD_PROJECT_PROPERTY_NAME, "true");
        final ExplorerPreferencesLoader preferencesLoader = new ExplorerPreferencesLoader();
        ApplicationPreferences.setUp(preferencesLoader.load());
        when(activeContextItems.setupActiveModule(content)).thenReturn(true);
        final WorkspaceProject project = mock(WorkspaceProject.class);
        when(activeContextItems.getActiveProject()).thenReturn(project);
        when(project.getOrganizationalUnit()).thenReturn(ou);
        when(project.getRepository()).thenReturn(repository);
        when(project.getBranch()).thenReturn(new Branch("master", mock(Path.class)));
        when(activeContextItems.getActiveModule()).thenReturn(module);
        presenter.doContentCallback(content);
        verify(buildServiceActual, never()).build(any(Module.class));
    } finally {
        if (spBuildDisableModuleExplorer != null) {
            System.setProperty(ExplorerService.BUILD_PROJECT_PROPERTY_NAME, spBuildDisableModuleExplorer);
        }
    }
}
Also used : Repository(org.guvnor.structure.repositories.Repository) OrganizationalUnit(org.guvnor.structure.organizationalunit.OrganizationalUnit) WorkspaceProject(org.guvnor.common.services.project.model.WorkspaceProject) Branch(org.guvnor.structure.repositories.Branch) ExplorerPreferencesLoader(org.kie.workbench.common.screens.explorer.backend.server.preferences.ExplorerPreferencesLoader) Module(org.guvnor.common.services.project.model.Module) Test(org.junit.Test)

Aggregations

Module (org.guvnor.common.services.project.model.Module)1 WorkspaceProject (org.guvnor.common.services.project.model.WorkspaceProject)1 OrganizationalUnit (org.guvnor.structure.organizationalunit.OrganizationalUnit)1 Branch (org.guvnor.structure.repositories.Branch)1 Repository (org.guvnor.structure.repositories.Repository)1 Test (org.junit.Test)1 ExplorerPreferencesLoader (org.kie.workbench.common.screens.explorer.backend.server.preferences.ExplorerPreferencesLoader)1