HighAvailabilitySupportChecker { public boolean isSupported(final String formatName) { boolean formatForcedEnabled = formatHAStates.computeIfAbsent(formatName, f -> getBoolean(format("nexus.%s.ha.supported", formatName), false)); return !isNexusClustered || formatForcedEnabled; } @Inject  HighAvailabilitySupportChecker(final NodeAccess nodeAccess); boolean isSupported(final String formatName);  }
@Test public void returnTrue_IfNexusHAIsFalseAndFormatHAIsFalse() { when(nodeAccess.isClustered()).thenReturn(false); highAvailabilitySupportChecker = new HighAvailabilitySupportChecker(nodeAccess); System.setProperty(HA_SUPPORTED_PROPERTY, "false"); assertThat(highAvailabilitySupportChecker.isSupported(FORMAT_NAME), is(true)); }
@Test public void returnFalse_IfNexusHAIsTrueAndFormatHAIsFalse() { when(nodeAccess.isClustered()).thenReturn(true); highAvailabilitySupportChecker = new HighAvailabilitySupportChecker(nodeAccess); System.setProperty(HA_SUPPORTED_PROPERTY, "false"); assertThat(highAvailabilitySupportChecker.isSupported(FORMAT_NAME), is(false)); }
@Test public void returnTrue_IfNexusHAIsTrueAndFormatHAIsTrue() { when(nodeAccess.isClustered()).thenReturn(true); highAvailabilitySupportChecker = new HighAvailabilitySupportChecker(nodeAccess); System.setProperty(HA_SUPPORTED_PROPERTY, "true"); assertThat(highAvailabilitySupportChecker.isSupported(FORMAT_NAME), is(true)); }
@Test public void returnTrue_IfNexusHAIsFalseAndFormatHAIsTrue() { when(nodeAccess.isClustered()).thenReturn(false); highAvailabilitySupportChecker = new HighAvailabilitySupportChecker(nodeAccess); System.setProperty(HA_SUPPORTED_PROPERTY, "true"); assertThat(highAvailabilitySupportChecker.isSupported(FORMAT_NAME), is(true)); }