@Test public void testGetTotalRenewedTokens() throws Exception { statisticsService.incrementRenewedTokens(TENANT); statisticsService.incrementRenewedTokens(TENANT); statisticsService.incrementRenewedTokens(TENANT); SsoHealthStatsData statsData = statisticsService.getSsoStatistics(TENANT); Assert.assertEquals( "Renewed tokens for this tenant should be 3", 3, statsData.getRenewedTokensForTenant()); Assert.assertTrue( "Total Renewed tokens should be >= 3", statsData.getTotalTokensRenewed() >= 3); Assert.assertTrue("Uptime STS service should not be 0", statsData.getUptimeIDM() > 0); // Add some more tokens for generated statisticsService.incrementRenewedTokens("coke.com"); statisticsService.incrementRenewedTokens("coke.com"); statsData = statisticsService.getSsoStatistics("coke.com"); Assert.assertEquals( "Renewed tokens for this tenant should be 2", 2, statsData.getRenewedTokensForTenant()); Assert.assertTrue( "Total Renewed tokens should be >= 5", statsData.getTotalTokensRenewed() >= 5); statsData = statisticsService.getSsoStatistics("fakeTenant"); Assert.assertEquals( "Renewed tokens for this tenant should be 0", 0, statsData.getRenewedTokensForTenant()); }
@Test public void testGetRenewedTokens() throws Exception { statisticsService.incrementRenewedTokens(TENANT); SsoHealthStatsData statsData = statisticsService.getSsoStatistics(TENANT); Assert.assertEquals( "Renewed tokens for this tenant should be 1", 1, statsData.getRenewedTokensForTenant()); Assert.assertTrue( "Total renewed tokens should be >=1 ", statsData.getTotalTokensRenewed() >= 1); Assert.assertTrue("Uptime STS service should not be 0", statsData.getUptimeIDM() > 0); statsData = statisticsService.getSsoStatistics("fakeTenant"); Assert.assertEquals( "Renewed tokens for fake tenant should be 0", 0, statsData.getRenewedTokensForTenant()); }