From fa9248941aa8666f624ca988c9d2af2232a242fe Mon Sep 17 00:00:00 2001 From: David Webb Date: Mon, 25 Nov 2013 11:19:27 -0500 Subject: [PATCH] DATACASS-39 : WIP : Temporarily introducing failing test for CI POC. --- .../template/CassandraOperationsTest.java | 103 +----------------- 1 file changed, 5 insertions(+), 98 deletions(-) diff --git a/src/test/java/org/springframework/data/cassandra/test/integration/template/CassandraOperationsTest.java b/src/test/java/org/springframework/data/cassandra/test/integration/template/CassandraOperationsTest.java index db2b14583..0ad8033cd 100644 --- a/src/test/java/org/springframework/data/cassandra/test/integration/template/CassandraOperationsTest.java +++ b/src/test/java/org/springframework/data/cassandra/test/integration/template/CassandraOperationsTest.java @@ -41,15 +41,11 @@ import org.junit.runner.RunWith; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.cache.annotation.Cacheable; -import org.springframework.cache.interceptor.DefaultKeyGenerator; import org.springframework.cassandra.core.BoundStatementFactory; -import org.springframework.cassandra.core.CachedPreparedStatementCreator; import org.springframework.cassandra.core.CassandraOperations; import org.springframework.cassandra.core.CqlParameter; import org.springframework.cassandra.core.CqlParameterValue; import org.springframework.cassandra.core.HostMapper; -import org.springframework.cassandra.core.PreparedStatementBinder; import org.springframework.cassandra.core.PreparedStatementCreatorFactory; import org.springframework.cassandra.core.ResultSetExtractor; import org.springframework.cassandra.core.RingMember; @@ -60,13 +56,10 @@ import org.springframework.test.context.ContextConfiguration; import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; import org.springframework.test.context.support.AnnotationConfigContextLoader; -import com.datastax.driver.core.BoundStatement; import com.datastax.driver.core.DataType; import com.datastax.driver.core.Host; -import com.datastax.driver.core.PreparedStatement; import com.datastax.driver.core.ResultSet; import com.datastax.driver.core.Row; -import com.datastax.driver.core.Session; import com.datastax.driver.core.exceptions.DriverException; /** @@ -196,6 +189,11 @@ public class CassandraOperationsTest { } + @Test + public void failingTest() { + assertNotNull(null); + } + @Test public void boundStatementFactoryTest() { @@ -209,97 +207,6 @@ public class CassandraOperationsTest { cassandraTemplate.execute(bsf); } - // @Test - public void cachedPreparedStatementTest() { - - log.info(echoString("Hello")); - log.info(echoString("Hello")); - - String cql = "select * from book where isbn = ?"; - - CachedPreparedStatementCreator cpsc = new CachedPreparedStatementCreator(cql); - - Book b = cassandraTemplate.query(cpsc, new PreparedStatementBinder() { - - @Override - public BoundStatement bindValues(PreparedStatement ps) throws DriverException { - return ps.bind("999999999"); - } - }, new ResultSetExtractor() { - - @Override - public Book extractData(ResultSet rs) throws DriverException, DataAccessException { - Row r = rs.one(); - Book b = new Book(); - b.setIsbn(r.getString("isbn")); - b.setTitle(r.getString("title")); - b.setAuthor(r.getString("author")); - b.setPages(r.getInt("pages")); - return b; - } - }); - - assertNotNull(b); - - log.info(b.toString()); - - try { - DefaultKeyGenerator generator = new DefaultKeyGenerator(); - - // TODO Why does method have to be public to work? Options? - Object cacheKey = generator.generate(CachedPreparedStatementCreator.class, - CachedPreparedStatementCreator.class.getMethod("getCachedPreparedStatement", Session.class, String.class), - cassandraTemplate.getSession(), cql); - - log.info("cacheKey -> " + cacheKey); - - // ConcurrentMapCache cache = (ConcurrentMapCache) cacheManager.getCache("sdc-pstmts"); - // ConcurrentMap cacheMap = cache.getNativeCache(); - // assertNotNull(cacheMap); - // log.info("CacheMap.size() -> " + cacheMap.size()); - // ValueWrapper vw = cache.get(cacheKey); - // PreparedStatement pstmt = (PreparedStatement) vw.get(); - // assertNotNull(pstmt); - // log.info(pstmt.getQueryString()); - // assertEquals(pstmt.getQueryString(), cql); - } catch (NoSuchMethodException e) { - log.error("Failed to find method", e); - } - - CachedPreparedStatementCreator cpsc2 = new CachedPreparedStatementCreator(cql); - - Book b2 = cassandraTemplate.query(cpsc2, new PreparedStatementBinder() { - - @Override - public BoundStatement bindValues(PreparedStatement ps) throws DriverException { - return ps.bind("999999999"); - } - }, new ResultSetExtractor() { - - @Override - public Book extractData(ResultSet rs) throws DriverException, DataAccessException { - Row r = rs.one(); - Book b = new Book(); - b.setIsbn(r.getString("isbn")); - b.setTitle(r.getString("title")); - b.setAuthor(r.getString("author")); - b.setPages(r.getInt("pages")); - return b; - } - }); - - assertNotNull(b2); - - log.info(b2.toString()); - - } - - @Cacheable("sdc-pstmts") - public String echoString(String s) { - log.info("In EchoString"); - return s; - } - @After public void clearCassandra() { EmbeddedCassandraServerHelper.cleanEmbeddedCassandra();