public MutableProjectSettings(GlobalConfiguration globalConfig) { super(globalConfig.getDefinitions(), globalConfig.getEncryption()); addProperties(globalConfig.getProperties()); }
@Before public void setUp() { MockitoAnnotations.initMocks(this); when(globalConfiguration.getProperties()).thenReturn(globalPropertiesMap); when(reactor.getRoot()).thenReturn(root); }
@Test public void settings_should_include_command_line_args_with_highest_priority() { when(globalConfiguration.getProperties()).thenReturn(Collections.singletonMap("key", "global")); when(projectServerSettings.properties()).thenReturn(Collections.singletonMap("key", "settings")); when(root.properties()).thenReturn(Collections.singletonMap("key", "root")); provider.provide(loader, globalConfiguration, reactor, globalServerSettings, projectServerSettings, branches, pullRequests); verify(loader).load(anyMap(), settingsCaptor.capture(), any(ProjectBranches.class), any(ProjectPullRequests.class)); Map<String, String> map = settingsCaptor.getValue().get(); assertThat(map.get("key")).isEqualTo("root"); }
public BranchConfiguration provide(@Nullable BranchConfigurationLoader loader, GlobalConfiguration globalConfiguration, ProjectReactor reactor, GlobalServerSettings globalServerSettings, ProjectServerSettings projectServerSettings, ProjectBranches branches, ProjectPullRequests pullRequests) { if (branchConfiguration == null) { if (loader == null) { branchConfiguration = new DefaultBranchConfiguration(); } else { Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG); Supplier<Map<String, String>> settingsSupplier = createSettingsSupplier(reactor.getRoot(), globalServerSettings, projectServerSettings); branchConfiguration = loader.load(globalConfiguration.getProperties(), settingsSupplier, branches, pullRequests); profiler.stopInfo(); } } return branchConfiguration; }
public MutableProjectSettings(GlobalConfiguration globalConfig) { super(globalConfig.getDefinitions(), globalConfig.getEncryption()); addProperties(globalConfig.getProperties()); }
public BranchConfiguration provide(@Nullable BranchConfigurationLoader loader, GlobalConfiguration globalConfiguration, ProjectReactor reactor, GlobalServerSettings globalServerSettings, ProjectServerSettings projectServerSettings, ProjectBranches branches, ProjectPullRequests pullRequests) { if (branchConfiguration == null) { if (loader == null) { branchConfiguration = new DefaultBranchConfiguration(); } else { Profiler profiler = Profiler.create(LOG).startInfo(LOG_MSG); Supplier<Map<String, String>> settingsSupplier = createSettingsSupplier(reactor.getRoot(), globalServerSettings, projectServerSettings); branchConfiguration = loader.load(globalConfiguration.getProperties(), settingsSupplier, branches, pullRequests); profiler.stopInfo(); } } return branchConfiguration; }