@Test public void testGetUpTimeSTSService() throws Exception { statisticsService.incrementGeneratedTokens(TENANT); try { Thread.sleep(2000); } catch (InterruptedException ex) { Thread.currentThread().interrupt(); } SsoHealthStatsData statsData = statisticsService.getSsoStatistics(TENANT); Assert.assertTrue("Uptime STS service should not be 0", statsData.getUptimeSTS() > 0); }
@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()); }
@Test public void testGetTotalGeneratedTokens() throws Exception { statisticsService.incrementGeneratedTokens(TENANT); statisticsService.incrementGeneratedTokens(TENANT); statisticsService.incrementGeneratedTokens(TENANT); SsoHealthStatsData statsData = statisticsService.getSsoStatistics(TENANT); Assert.assertEquals( "Generated tokens for this tenant should be 3", 3, statsData.getGeneratedTokensForTenant()); Assert.assertTrue( "Total Generated tokens should be >= 3", statsData.getTotalTokensGenerated() >= 3); Assert.assertTrue("Uptime STS service should not be 0", statsData.getUptimeIDM() > 0); // Add some more tokens for generated statisticsService.incrementGeneratedTokens("coke.com"); statisticsService.incrementGeneratedTokens("coke.com"); statsData = statisticsService.getSsoStatistics("coke.com"); Assert.assertEquals( "Generated tokens for this tenant should be 2", 2, statsData.getGeneratedTokensForTenant()); Assert.assertTrue( "Total Generated tokens should be >= 5", statsData.getTotalTokensGenerated() >= 5); statsData = statisticsService.getSsoStatistics("fakeTenant"); Assert.assertEquals( "Generated tokens for this tenant should be 0", 0, statsData.getGeneratedTokensForTenant()); }
@Test public void testGetUpTimeIDMService() throws Exception { SsoHealthStatsData statsData = statisticsService.getSsoStatistics(TENANT); Assert.assertTrue("Uptime IDM service should not be 0", statsData.getUptimeIDM() > 0); }