DATACASS-217 - Add support for LZ4 compression.
Original pull request: #82.
This commit is contained in:
@@ -701,11 +701,14 @@ public class CassandraCqlClusterFactoryBean implements FactoryBean<Cluster>, Ini
|
||||
}
|
||||
|
||||
private static Compression convertCompressionType(CompressionType type) {
|
||||
|
||||
switch (type) {
|
||||
case NONE:
|
||||
return Compression.NONE;
|
||||
case SNAPPY:
|
||||
return Compression.SNAPPY;
|
||||
case LZ4:
|
||||
return Compression.LZ4;
|
||||
}
|
||||
|
||||
throw new IllegalArgumentException(String.format("Unknown compression type [%s]", type));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -19,7 +19,8 @@ package org.springframework.cassandra.config;
|
||||
* Simple enumeration for the various compression types.
|
||||
*
|
||||
* @author Alex Shvid
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
public enum CompressionType {
|
||||
NONE, SNAPPY;
|
||||
NONE, SNAPPY, LZ4
|
||||
}
|
||||
|
||||
@@ -101,6 +101,22 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getProtocolOptions().getCompression(), is(Compression.SNAPPY));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-217">DATACASS-217</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
public void shouldSetLZ4CompressionType() throws Exception {
|
||||
|
||||
CompressionType compressionType = CompressionType.LZ4;
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
bean.setCompressionType(compressionType);
|
||||
bean.afterPropertiesSet();
|
||||
|
||||
assertThat(getConfiguration(bean).getProtocolOptions().getCompression(), is(Compression.LZ4));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<context:property-placeholder
|
||||
location="classpath:/config/cassandra-connection.properties,classpath:/org/springframework/cassandra/test/integration/config/xml/FullySpecifiedKeyspaceCreatingXmlConfigIntegrationTests.properties" />
|
||||
|
||||
<cass:cluster port="${build.cassandra.native_transport_port}">
|
||||
<cass:cluster port="${build.cassandra.native_transport_port}" compression="LZ4">
|
||||
<cass:keyspace action="CREATE_DROP" durable-writes="true"
|
||||
name="full1">
|
||||
<cass:replication class="SIMPLE_STRATEGY">
|
||||
|
||||
Reference in New Issue
Block a user