@SuppressWarnings("unchecked") @Test public void testSyncLicense() throws NomadException { List<NomadChangeInfo> sameChanges = new ArrayList<>(); sameChanges.add(activation); sameChanges.add(new NomadChangeInfo(UUID.randomUUID(), createOffheapChange("a", "100"), ChangeRequestState.COMMITTED, 1L, "SYSTEM", "SYSTEM", now)); UpgradableNomadServer<NodeContext> activeNomadServer = mock(UpgradableNomadServer.class); DynamicConfigurationPassiveSync activeSyncManager = new DynamicConfigurationPassiveSync(startupTopology, activeNomadServer, mock(DynamicConfigService.class), topologyService, () -> "license content"); when(activeNomadServer.getAllNomadChanges()).thenReturn(sameChanges); byte[] active = codec.encode(activeSyncManager.getSyncData()); UpgradableNomadServer<NodeContext> nomadServer = mock(UpgradableNomadServer.class); when(nomadServer.getAllNomadChanges()).thenReturn(sameChanges); DynamicConfigService dynamicConfigService = mock(DynamicConfigService.class); DynamicConfigurationPassiveSync syncManager = new DynamicConfigurationPassiveSync(startupTopology, nomadServer, dynamicConfigService, topologyService, () -> null); Set<Require> sync = syncManager.sync(codec.decode(active)); assertThat(sync.size(), is(equalTo(0))); verify(dynamicConfigService).upgradeLicense("license content"); }
private void syncLicense(String activeLicense) { String passiveLicense = licenseContent.get(); if (!Objects.equals(activeLicense, passiveLicense)) { LOGGER.info("Syncing license"); dynamicConfigService.upgradeLicense(activeLicense); } }
DynamicConfigurationPassiveSync { private void syncLicense(String activeLicense) { String passiveLicense = licenseContent.get(); if (!Objects.equals(activeLicense, passiveLicense)) { LOGGER.info("Syncing license"); dynamicConfigService.upgradeLicense(activeLicense); } } }
DynamicConfigurationPassiveSync { private void syncLicense(String activeLicense) { String passiveLicense = licenseContent.get(); if (!Objects.equals(activeLicense, passiveLicense)) { LOGGER.info("Syncing license"); dynamicConfigService.upgradeLicense(activeLicense); } } DynamicConfigurationPassiveSync(NodeContext nodeStartupConfiguration,
                                         UpgradableNomadServer<NodeContext> nomadServer,
                                         DynamicConfigService dynamicConfigService,
                                         TopologyService topologyService,
                                         Supplier<String> licenseContent); }
DynamicConfigurationPassiveSync { private void syncLicense(String activeLicense) { String passiveLicense = licenseContent.get(); if (!Objects.equals(activeLicense, passiveLicense)) { LOGGER.info("Syncing license"); dynamicConfigService.upgradeLicense(activeLicense); } } DynamicConfigurationPassiveSync(NodeContext nodeStartupConfiguration,
                                         UpgradableNomadServer<NodeContext> nomadServer,
                                         DynamicConfigService dynamicConfigService,
                                         TopologyService topologyService,
                                         Supplier<String> licenseContent); DynamicConfigSyncData getSyncData(); Set<Require> sync(DynamicConfigSyncData data); }
DynamicConfigurationPassiveSync { private void syncLicense(String activeLicense) { String passiveLicense = licenseContent.get(); if (!Objects.equals(activeLicense, passiveLicense)) { LOGGER.info("Syncing license"); dynamicConfigService.upgradeLicense(activeLicense); } } DynamicConfigurationPassiveSync(NodeContext nodeStartupConfiguration,
                                         UpgradableNomadServer<NodeContext> nomadServer,
                                         DynamicConfigService dynamicConfigService,
                                         TopologyService topologyService,
                                         Supplier<String> licenseContent); DynamicConfigSyncData getSyncData(); Set<Require> sync(DynamicConfigSyncData data);  }