.enableState(SentryServiceState.COMPONENT, SentryServiceState.FULL_UPDATE_RUNNING); PathsImage snapshotInfo = client.getFullSnapshot(); if (snapshotInfo.getPathImage().isEmpty()) { LOGGER.debug("Received empty path image from HMS while taking a full snapshot");
when(sentryHmsClient.getFullSnapshot()).thenReturn(fullSnapshot);
when(sentryHmsClient.getFullSnapshot()).thenReturn(fullSnapshot);
/** * Creating snapshot when SentryHMSClient is not connected to HMS */ @Test public void testSnapshotCreationWithOutClientConnected() throws Exception { // Make sure that client is not connected Assert.assertFalse(client.isConnected()); PathsImage snapshotInfo = client.getFullSnapshot(); Assert.assertTrue(snapshotInfo.getPathImage().isEmpty()); Assert.assertFalse("FullUpdateInitializer is not expected to be in progress", SentryStateBank.isEnabled(FullUpdateInitializerState.COMPONENT, FullUpdateInitializerState.FULL_SNAPSHOT_INPROGRESS)); Assert.assertFalse(SentryStateBank.wereStatesEnabled(FullUpdateInitializerState.COMPONENT, new HashSet<SentryState>( Arrays.asList(FullUpdateInitializerState.FULL_SNAPSHOT_INPROGRESS)))); }
when(sentryHmsClient.getFullSnapshot()).thenReturn(fullSnapshot);
PathsImage fullSnapshot = new PathsImage(snapshotObjects, HMS_PROCESSED_EVENT_ID, 1); when(sentryHmsClient.getFullSnapshot()).thenReturn(fullSnapshot);
when(sentryHmsClient.getFullSnapshot()).thenReturn(fullSnapshot);
when(sentryHmsClient.getFullSnapshot()).thenReturn(fullSnapshot);
when(sentryHmsClient.getFullSnapshot()).thenReturn(fullSnapshot);
/** * Creating snapshot when HMS doesn't have any data */ @Test public void testSnapshotCreationWithNoHmsData() throws Exception { MockClient mockClient = new MockClient(new HiveSnapshot(), 1); client.setClient(mockClient.client); // Make sure that client is connected Assert.assertTrue(client.isConnected()); PathsImage snapshotInfo = client.getFullSnapshot(); Assert.assertTrue(snapshotInfo.getPathImage().isEmpty()); Assert.assertFalse("FullUpdateInitializer is not expected to be in progress", SentryStateBank.isEnabled(FullUpdateInitializerState.COMPONENT, FullUpdateInitializerState.FULL_SNAPSHOT_INPROGRESS)); Assert.assertTrue(SentryStateBank.wereStatesEnabled(FullUpdateInitializerState.COMPONENT, new HashSet<SentryState>( Arrays.asList(FullUpdateInitializerState.FULL_SNAPSHOT_INPROGRESS)))); }
PathsImage snapshotInfo = client.getFullSnapshot(); Assert.assertEquals(5, snapshotInfo.getPathImage().size()); Assert.assertEquals(Sets.newHashSet("db1"), snapshotInfo.getPathImage().get("db1"));
PathsImage snapshotInfo = client.getFullSnapshot(); snapshotInfo = client.getFullSnapshot(); Assert.assertTrue(snapshotInfo.getPathImage().isEmpty()); Assert.assertFalse("FullUpdateInitializer is not expected to be in progress",