@Test public void testRepositoryGetProducts() throws Exception { RedisKeysRepository repository = new RedisKeysRepository(pool); Map<String, String> products = repository.getProducts(); assertEquals(products.size(), 1); assertTrue(!Boolean.valueOf(products.get(PROD3568_BLOCKED))); Optional<Boolean> product = repository.getProduct("/" + SERVICE_A_OPEN + "/" + PROD3568_BLOCKED); assertTrue(product.isPresent()); assertTrue(!product.get().booleanValue()); }
@Test public void testRepositoryGetServices() throws Exception { RedisKeysRepository repository = new RedisKeysRepository(pool); Map<String, String> services = repository.getServices(); assertEquals(services.size(), 3); assertTrue(Boolean.valueOf(services.get(SERVICE_A_OPEN))); assertTrue(Boolean.valueOf(services.get(WHO_AM_I))); assertTrue(!Boolean.valueOf(services.get(SERVICE_B_BLOCKED))); Optional<Boolean> service = repository.getService("/" + SERVICE_A_OPEN + "/" + PROD7340_OPED); assertTrue(service.isPresent()); assertTrue(service.get().booleanValue()); }
@Test public void testRepositoryGetChannelServices() throws Exception { RedisKeysRepository repository = new RedisKeysRepository(pool); Set<String> services = repository.getChannelServices("channel.internet"); assertEquals(services.size(), 3); assertTrue(services.contains(SERVICE_A_OPEN)); assertTrue(services.contains(WHO_AM_I)); assertTrue(services.contains(SERVICE_B_BLOCKED)); Optional<Boolean> service = repository.getChannelService( "/" + SERVICE_A_OPEN + "/" + PROD7340_OPED, "channel.internet"); assertTrue(service.isPresent()); assertTrue(service.get().booleanValue()); service = repository.getChannelService("/" + WHO_AM_I, "channel.internet"); assertTrue(service.isPresent()); assertTrue(service.get().booleanValue()); }