public void testEventFilterPerformance() { long t1 = testEventFilterPerformance(false); long t2 = testEventFilterPerformance(true); log.infof("ClusteredListenerWithDslFilterProfilingTest.testEventFilterPerformance doRegisterListener=false took %d ms\n", t1 / 1000000); log.infof("ClusteredListenerWithDslFilterProfilingTest.testEventFilterPerformance doRegisterListener=true took %d ms\n", t2 / 1000000); }
private void testInvalidConfiguration(String xmlConfiguration) throws IOException { EmbeddedCacheManager invalidCacheManager = null; try { log.infof("Creating cache manager with %s", xmlConfiguration); invalidCacheManager = TestCacheManagerFactory .fromStream(new ByteArrayInputStream(xmlConfiguration.getBytes())); } finally { if (invalidCacheManager != null) { invalidCacheManager.stop(); } } }
@Override public void deleteBook(Integer bookId) { this.log.infof("Deleting book [ID = %d]", bookId); this.jdbcTemplate.update("DELETE FROM books WHERE id = :id", new MapSqlParameterSource("id", bookId)); }
@Override public void deleteBook(Integer bookId) { this.log.infof("Deleting book [ID = %d]", bookId); this.jdbcTemplate.update("DELETE FROM books WHERE id = :id", new MapSqlParameterSource("id", bookId)); }
@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 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 testCreateCustomCacheResolver() { final Book bookToCreate = new Book("112-358-132", "Random Author", "Path to Infinispan Enlightenment"); this.log.infof("Creating book [%s] ...", bookToCreate); getBookService().createBookCustomCacheResolver(bookToCreate); this.log.infof("Book [%s] created", bookToCreate); assert bookToCreate.equals(getCache("custom").get(bookToCreate.getId())) : "createBook(" + bookToCreate + ") should 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 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"; }
private List<MagicKey> init() { List<MagicKey> keys = new ArrayList<>(Arrays.asList( new MagicKey("k1", c1), new MagicKey("k2", c2), new MagicKey("k3", c1), new MagicKey("k4", c2) )); int i = 0; for (Cache<Object, String> c : caches) c.put(keys.get(i++), "v" + i); log.infof("Initialized with keys %s", keys); return keys; }
@Test public void testCachingCreate() { Book bookToCreate = new Book("112-358-132", "Random Author", "Path to Infinispan Enlightenment"); this.log.infof("Creating book [%s] ...", bookToCreate); getBookService().createBookCachingBackup(bookToCreate); this.log.infof("Book [%s] created", bookToCreate); assert bookToCreate.equals(booksCache().get(bookToCreate.getId())) : "createBook(" + bookToCreate + ") should have inserted created book into cache"; assert bookToCreate.equals(backupCache().get(bookToCreate.getId())) : "createBook(" + bookToCreate + ") should have inserted created book into cache"; }