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);
}
}
}
Aggregations