diff --git a/spring-data-cassandra/pom.xml b/spring-data-cassandra/pom.xml index 80aeb6a83f..13c5c18529 100644 --- a/spring-data-cassandra/pom.xml +++ b/spring-data-cassandra/pom.xml @@ -1,138 +1,110 @@ - 4.0.0 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> + 4.0.0 - org.baeldung - spring-data-cassandra - 0.0.1-SNAPSHOT - jar + org.baeldung + spring-data-cassandra + 0.0.1-SNAPSHOT + jar - spring-data-cassandra + spring-data-cassandra - - UTF-8 - 1.3.1.RELEASE - 4.2.2.RELEASE - 4.11 - 1.7.12 - 1.1.3 - - - - - - org.springframework.data - spring-data-cassandra - ${org.springframework.data.version} - - - - org.springframework - spring-core - ${org.springframework.version} - - - - junit - junit-dep - ${junit.version} - test - - - - org.springframework - spring-test - ${org.springframework.version} - test - - - - org.cassandraunit - cassandra-unit-spring - 2.1.9.2 - test - - - org.cassandraunit - cassandra-unit - - - - - org.cassandraunit - cassandra-unit-shaded - 2.1.9.2 - test - - - org.hectorclient - hector-core - 2.0-0 - - - - - - - - - - - - - - - - - com.datastax.cassandra - cassandra-driver-core - 2.1.5 - true - - - - - - - - - - - org.slf4j - slf4j-api - ${org.slf4j.version} - - - - ch.qos.logback - logback-classic - ${logback.version} - - - - org.slf4j - jcl-over-slf4j - ${org.slf4j.version} - - - - org.slf4j - log4j-over-slf4j - ${org.slf4j.version} - - - - - - - maven-compiler-plugin - 2.3.2 - - 1.7 - 1.7 - - - - + + UTF-8 + 1.3.1.RELEASE + 4.2.2.RELEASE + 4.11 + 1.7.12 + 1.1.3 + 2.1.5 + 2.1.9.2 + 2.1.9.2 + 2.0-0 + + + + org.springframework.data + spring-data-cassandra + ${org.springframework.data.version} + + + org.springframework + spring-core + ${org.springframework.version} + + + junit + junit-dep + ${junit.version} + test + + + org.springframework + spring-test + ${org.springframework.version} + test + + + org.cassandraunit + cassandra-unit-spring + ${cassandra-unit-spring.version} + test + + + org.cassandraunit + cassandra-unit + + + + + org.cassandraunit + cassandra-unit-shaded + ${cassandra-unit-shaded} + test + + + org.hectorclient + hector-core + ${hector-core.version} + + + com.datastax.cassandra + cassandra-driver-core + ${cassandra-driver-core.version} + true + + + org.slf4j + slf4j-api + ${org.slf4j.version} + + + ch.qos.logback + logback-classic + ${logback.version} + + + org.slf4j + jcl-over-slf4j + ${org.slf4j.version} + + + org.slf4j + log4j-over-slf4j + ${org.slf4j.version} + + + + + + maven-compiler-plugin + 2.3.2 + + 1.7 + 1.7 + + + + diff --git a/spring-data-cassandra/src/main/java/org/baeldung/spring/data/cassandra/config/CassandraConfig.java b/spring-data-cassandra/src/main/java/org/baeldung/spring/data/cassandra/config/CassandraConfig.java index 9dda322ca3..5f2c4c6d47 100644 --- a/spring-data-cassandra/src/main/java/org/baeldung/spring/data/cassandra/config/CassandraConfig.java +++ b/spring-data-cassandra/src/main/java/org/baeldung/spring/data/cassandra/config/CassandraConfig.java @@ -32,8 +32,7 @@ public class CassandraConfig extends AbstractCassandraConfiguration { CassandraClusterFactoryBean cluster = new CassandraClusterFactoryBean(); cluster.setContactPoints(environment.getProperty("cassandra.contactpoints")); cluster.setPort(Integer.parseInt(environment.getProperty("cassandra.port"))); - LOGGER.info("Cluster created with contact points ["+ environment.getProperty("cassandra.contactpoints") +"] " + - "& port [" + Integer.parseInt(environment.getProperty("cassandra.port")) + "]."); + LOGGER.info("Cluster created with contact points [" + environment.getProperty("cassandra.contactpoints") + "] " + "& port [" + Integer.parseInt(environment.getProperty("cassandra.port")) + "]."); return cluster; } diff --git a/spring-data-cassandra/src/main/java/org/baeldung/spring/data/cassandra/repository/BookRepository.java b/spring-data-cassandra/src/main/java/org/baeldung/spring/data/cassandra/repository/BookRepository.java index dee1f9ef88..e37ae78b59 100644 --- a/spring-data-cassandra/src/main/java/org/baeldung/spring/data/cassandra/repository/BookRepository.java +++ b/spring-data-cassandra/src/main/java/org/baeldung/spring/data/cassandra/repository/BookRepository.java @@ -1,6 +1,5 @@ package org.baeldung.spring.data.cassandra.repository; - import org.baeldung.spring.data.cassandra.model.Book; import org.springframework.data.cassandra.repository.CassandraRepository; import org.springframework.data.cassandra.repository.Query; @@ -11,4 +10,3 @@ public interface BookRepository extends CassandraRepository { @Query("select * from book where title = ?0 and publisher=?1") Iterable findByTitleAndPublisher(String title, String publisher); } - diff --git a/spring-data-cassandra/src/test/java/org/baeldung/spring/data/cassandra/repository/BookRepositoryIntegrationTest.java b/spring-data-cassandra/src/test/java/org/baeldung/spring/data/cassandra/repository/BookRepositoryIntegrationTest.java index 215c6b3824..f6937d10cd 100644 --- a/spring-data-cassandra/src/test/java/org/baeldung/spring/data/cassandra/repository/BookRepositoryIntegrationTest.java +++ b/spring-data-cassandra/src/test/java/org/baeldung/spring/data/cassandra/repository/BookRepositoryIntegrationTest.java @@ -31,20 +31,20 @@ public class BookRepositoryIntegrationTest { private static final Log LOGGER = LogFactory.getLog(BookRepositoryIntegrationTest.class); - public static final String KEYSPACE_CREATION_QUERY = - "CREATE KEYSPACE IF NOT EXISTS testKeySpace WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '3' };"; + public static final String KEYSPACE_CREATION_QUERY = "CREATE KEYSPACE IF NOT EXISTS testKeySpace WITH replication = { 'class': 'SimpleStrategy', 'replication_factor': '3' };"; public static final String KEYSPACE_ACTIVATE_QUERY = "USE testKeySpace;"; public static final String DATA_TABLE_NAME = "book"; - @Autowired private BookRepository bookRepository; + @Autowired + private BookRepository bookRepository; - @Autowired private CassandraAdminOperations adminTemplate; + @Autowired + private CassandraAdminOperations adminTemplate; @BeforeClass - public static void startCassandraEmbedded() - throws InterruptedException, TTransportException, ConfigurationException, IOException { + public static void startCassandraEmbedded() throws InterruptedException, TTransportException, ConfigurationException, IOException { EmbeddedCassandraServerHelper.startEmbeddedCassandra(); Cluster cluster = Cluster.builder().addContactPoints("127.0.0.1").withPort(9142).build(); LOGGER.info("Server Started at 127.0.0.1:9142... "); @@ -55,8 +55,7 @@ public class BookRepositoryIntegrationTest { } @Before - public void resetKeySpace() - throws InterruptedException, TTransportException, ConfigurationException, IOException { + public void resetKeySpace() throws InterruptedException, TTransportException, ConfigurationException, IOException { adminTemplate.createTable(true, CqlIdentifier.cqlId(DATA_TABLE_NAME), Book.class, new HashMap()); }