@Override @ManagedOperation(description = "Does the store contain the given key") public boolean contains(Object key) { return getCache().containsKey(key); }
@Test public void testFindConditionNotMet() { final Integer bookToCacheId = Integer.valueOf(1); assert !booksCache().containsKey(bookToCacheId): "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookCondition(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert !booksCache().containsKey(bookToCacheId) : "findBook(" + bookToCacheId + ") should not have cached book"; }
@Test public void testFindUnlessNotMet() { final Integer bookToCacheId = Integer.valueOf(5); assert !booksCache().containsKey(bookToCacheId): "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookUnless(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert !booksCache().containsKey(bookToCacheId) : "findBook(" + bookToCacheId + ") should not have cached book"; }
@Test public void testFindConditionNotMet() { final Integer bookToCacheId = Integer.valueOf(1); assert !booksCache().containsKey(bookToCacheId): "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookCondition(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert !booksCache().containsKey(bookToCacheId) : "findBook(" + bookToCacheId + ") should not have cached book"; }
@Test public void testFindUnlessNotMet() { final Integer bookToCacheId = Integer.valueOf(5); assert !booksCache().containsKey(bookToCacheId): "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookUnless(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert !booksCache().containsKey(bookToCacheId) : "findBook(" + bookToCacheId + ") should not have cached book"; }
@Test public void testFindConditionMet() { final Integer bookToCacheId = Integer.valueOf(5); assert !booksCache().containsKey(bookToCacheId): "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookCondition(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert cachedBook.equals(booksCache().get(bookToCacheId)) : "findBook(" + bookToCacheId + ") should have cached book"; }
@Test public void testFindConditionMet() { final Integer bookToCacheId = Integer.valueOf(5); assert !booksCache().containsKey(bookToCacheId): "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookCondition(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert cachedBook.equals(booksCache().get(bookToCacheId)) : "findBook(" + bookToCacheId + ") should have cached book"; }
@Test public void testFindCustomCacheManager() { final Integer bookToCacheId = Integer.valueOf(5); assert !booksCache().containsKey(bookToCacheId): "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookCustomCacheManager(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert cachedBook.equals(booksCache().get(bookToCacheId)) : "findBook(" + bookToCacheId + ") should have cached book"; }
@Test public void testFindCustomKeyGenerator() { final Integer bookToCacheId = Integer.valueOf(5); assert !booksCache().containsKey(bookToCacheId): "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookCustomKeyGenerator(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert cachedBook.equals(booksCache().get(bookToCacheId)) : "findBook(" + bookToCacheId + ") should have cached book"; }
@Test public void testFindConditionMet() { final Integer bookToCacheId = Integer.valueOf(5); assert !booksCache().containsKey(bookToCacheId): "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookCondition(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert cachedBook.equals(booksCache().get(bookToCacheId)) : "findBook(" + bookToCacheId + ") should have cached book"; }
@Test public void testFindCustomCacheManager() { final Integer bookToCacheId = Integer.valueOf(5); assert !booksCache().containsKey(bookToCacheId): "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookCustomCacheManager(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert cachedBook.equals(booksCache().get(bookToCacheId)) : "findBook(" + bookToCacheId + ") should have cached book"; }
@Test public void testCreateCustomKeyGenerator() { final Book bookToCreate = new Book("112-358-132", "Random Author", "Path to Infinispan Enlightenment"); this.log.infof("Creating book [%s] ...", bookToCreate); getBookService().createBookCustomKeyGenerator(bookToCreate); this.log.infof("Book [%s] created", bookToCreate); assert booksCache().containsKey(bookToCreate) : "createBook(" + bookToCreate + ") should have inserted created book into cache"; }
@Test public void testCreateCustomKeyGenerator() { final Book bookToCreate = new Book("112-358-132", "Random Author", "Path to Infinispan Enlightenment"); this.log.infof("Creating book [%s] ...", bookToCreate); getBookService().createBookCustomKeyGenerator(bookToCreate); this.log.infof("Book [%s] created", bookToCreate); assert booksCache().containsKey(bookToCreate) : "createBook(" + bookToCreate + ") should have inserted created book into cache"; }
@Test public void testCreateCustomKeyGenerator() { final Book bookToCreate = new Book("112-358-132", "Random Author", "Path to Infinispan Enlightenment"); this.log.infof("Creating book [%s] ...", bookToCreate); getBookService().createBookCustomKeyGenerator(bookToCreate); this.log.infof("Book [%s] created", bookToCreate); assert booksCache().containsKey(bookToCreate) : "createBook(" + bookToCreate + ") should have inserted created book into cache"; }
@Test public void testCachingFind() { final Integer bookToCacheId = Integer.valueOf(5); assert !booksCache().containsKey(bookToCacheId) : "Cache should not initially contain the book with id " + bookToCacheId; assert !backupCache().containsKey(bookToCacheId) : "Cache should not initially contain the book with id " + bookToCacheId; final Book cachedBook = getBookService().findBookCachingBackup(bookToCacheId); this.log.infof("Book [%s] cached", cachedBook); assert cachedBook.equals(booksCache().get(cachedBook.getId())) : "findBook(" + bookToCacheId + ") should have cached book"; assert cachedBook.equals(backupCache().get(cachedBook.getId())) : "findBook(" + bookToCacheId + ") should have cached book"; }
@Test public void testCreateUnlessNotMet() { final Book bookToCreate = new Book("112-358-132", "Random Author", "Path to Infinispan Enlightenment"); this.log.infof("Creating book [%s] ...", bookToCreate); getBookService().createBookUnless(bookToCreate); this.log.infof("Book [%s] created", bookToCreate); assert !booksCache().containsKey(bookToCreate.getId()) : "createBook(" + bookToCreate + ") should not have inserted created book into cache"; }
@Test public void testCreateUnlessNotMet() { final Book bookToCreate = new Book("112-358-132", "Random Author", "Path to Infinispan Enlightenment"); this.log.infof("Creating book [%s] ...", bookToCreate); getBookService().createBookUnless(bookToCreate); this.log.infof("Book [%s] created", bookToCreate); assert !booksCache().containsKey(bookToCreate.getId()) : "createBook(" + bookToCreate + ") should not have inserted created book into cache"; }
@Test public void testCreateConditionNotMet() { final Book bookToCreate = new Book("112-358-132", "Random Author", "Wrong Path to Infinispan Enlightenment"); this.log.infof("Creating book [%s] ...", bookToCreate); getBookService().createBookCondition(bookToCreate); this.log.infof("Book [%s] created", bookToCreate); assert bookToCreate.getId() != null : "Book.id should have been set."; assert !booksCache().containsKey(bookToCreate.getId()) : "createBook(" + bookToCreate + ") should not have inserted created book into cache"; }
@Test public void testCreateConditionNotMet() { final Book bookToCreate = new Book("112-358-132", "Random Author", "Wrong Path to Infinispan Enlightenment"); this.log.infof("Creating book [%s] ...", bookToCreate); getBookService().createBookCondition(bookToCreate); this.log.infof("Book [%s] created", bookToCreate); assert bookToCreate.getId() != null : "Book.id should have been set."; assert !booksCache().containsKey(bookToCreate.getId()) : "createBook(" + bookToCreate + ") should not have inserted created book into cache"; }
@Test public void testCreateConditionNotMet() { final Book bookToCreate = new Book("112-358-132", "Random Author", "Wrong Path to Infinispan Enlightenment"); this.log.infof("Creating book [%s] ...", bookToCreate); getBookService().createBookCondition(bookToCreate); this.log.infof("Book [%s] created", bookToCreate); assert bookToCreate.getId() != null : "Book.id should have been set."; assert !booksCache().containsKey(bookToCreate.getId()) : "createBook(" + bookToCreate + ") should not have inserted created book into cache"; }