DATACASS-385 - Migrate ticket references in test code to Spring Framework style.
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -38,15 +38,10 @@ import com.datastax.driver.core.policies.SpeculativeExecutionPolicy;
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @author John Blum
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
*/
|
||||
public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldInitializeWithoutAnyOptions() throws Exception {
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
@@ -58,11 +53,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getMetricsOptions().isJMXReportingEnabled()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldShutdownClusterInstance() throws Exception {
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
@@ -72,11 +63,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(bean.getObject().isClosed()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-217">DATACASS-217</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-217
|
||||
public void shouldSetLZ4CompressionType() throws Exception {
|
||||
|
||||
CompressionType compressionType = CompressionType.LZ4;
|
||||
@@ -88,11 +75,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getProtocolOptions(bean).getCompression()).isEqualTo(Compression.LZ4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetSnappyCompressionType() throws Exception {
|
||||
|
||||
CompressionType compressionType = CompressionType.SNAPPY;
|
||||
@@ -104,11 +87,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getProtocolOptions().getCompression()).isEqualTo(Compression.SNAPPY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetPoolingOptions() throws Exception {
|
||||
|
||||
PoolingOptions poolingOptions = new PoolingOptions();
|
||||
@@ -120,11 +99,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getPoolingOptions()).isEqualTo(poolingOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetSocketOptions() throws Exception {
|
||||
|
||||
SocketOptions socketOptions = new SocketOptions();
|
||||
@@ -136,11 +111,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getSocketOptions()).isEqualTo(socketOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetQueryOptions() throws Exception {
|
||||
|
||||
QueryOptions queryOptions = new QueryOptions();
|
||||
@@ -152,11 +123,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getQueryOptions()).isEqualTo(queryOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void defaultQueryOptionsShouldHaveOwnObjectIdentity() throws Exception {
|
||||
|
||||
QueryOptions queryOptions = new QueryOptions();
|
||||
@@ -168,11 +135,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getQueryOptions()).isNotEqualTo(queryOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetAuthProvider() throws Exception {
|
||||
|
||||
AuthProvider authProvider = new PlainTextAuthProvider("x", "y");
|
||||
@@ -184,12 +147,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getProtocolOptions().getAuthProvider()).isEqualTo(authProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-263">DATACASS-263</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226, DATACASS-263
|
||||
public void shouldSetAuthenticationProvider() throws Exception {
|
||||
|
||||
AuthProvider authProvider = new PlainTextAuthProvider("x", "y");
|
||||
@@ -202,12 +160,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(result).isEqualTo(authProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-263">DATACASS-263</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226, DATACASS-263
|
||||
public void shouldSetAuthentication() throws Exception {
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
@@ -221,11 +174,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(ReflectionTestUtils.getField(result, "password")).isEqualTo((Object) "password");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetLoadBalancingPolicy() throws Exception {
|
||||
|
||||
LoadBalancingPolicy loadBalancingPolicy = new RoundRobinPolicy();
|
||||
@@ -237,11 +186,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getPolicies().getLoadBalancingPolicy()).isEqualTo(loadBalancingPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetReconnectionPolicy() throws Exception {
|
||||
|
||||
ReconnectionPolicy reconnectionPolicy = new ExponentialReconnectionPolicy(1, 2);
|
||||
@@ -253,11 +198,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getPolicies().getReconnectionPolicy()).isEqualTo(reconnectionPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetProtocolVersion() throws Exception {
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
@@ -268,11 +209,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
.contains(ProtocolVersion.V2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetSslOptions() throws Exception {
|
||||
|
||||
SSLOptions sslOptions = JdkSSLOptions.builder().build();
|
||||
@@ -285,11 +222,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getProtocolOptions().getSSLOptions()).isEqualTo(sslOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldDisableMetrics() throws Exception {
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
@@ -299,11 +232,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getConfiguration(bean).getMetricsOptions().isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldDisableJmxReporting() throws Exception {
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
@@ -325,10 +254,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
verify(mockClusterBuilderConfigurer, times(1)).configure(isA(Cluster.Builder.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-316">DATACASS-316</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-316
|
||||
public void shouldSetAddressTranslator() throws Exception {
|
||||
|
||||
AddressTranslator mockAddressTranslator = mock(AddressTranslator.class);
|
||||
@@ -340,10 +266,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getPolicies(bean).getAddressTranslator()).isEqualTo(mockAddressTranslator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-317">DATACASS-317</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-317
|
||||
public void shouldSetClusterNameWithBeanNameProperty() throws Exception {
|
||||
|
||||
final Cluster.Builder mockClusterBuilder = mock(Cluster.Builder.class);
|
||||
@@ -364,10 +287,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
verify(mockClusterBuilder, times(1)).withClusterName(eq("ABC"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-317">DATACASS-317</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-317
|
||||
public void shouldSetClusterNameWithClusterNameProperty() throws Exception {
|
||||
|
||||
final Cluster.Builder mockClusterBuilder = mock(Cluster.Builder.class);
|
||||
@@ -388,10 +308,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
verify(mockClusterBuilder, times(1)).withClusterName(eq("XYZ"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-319">DATACASS-319</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-319
|
||||
public void shouldSetMaxSchemaAgreementWaitSeconds() throws Exception {
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
@@ -402,10 +319,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getProtocolOptions(bean).getMaxSchemaAgreementWaitSeconds()).isEqualTo(20);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-320">DATACASS-320</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-320
|
||||
public void shouldSetSpeculativeExecutionPolicy() throws Exception {
|
||||
|
||||
SpeculativeExecutionPolicy mockSpeculativeExecutionPolicy = mock(SpeculativeExecutionPolicy.class);
|
||||
@@ -417,10 +331,7 @@ public class CassandraCqlClusterFactoryBeanUnitTests {
|
||||
assertThat(getPolicies(bean).getSpeculativeExecutionPolicy()).isEqualTo(mockSpeculativeExecutionPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-238">DATACASS-238</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-238
|
||||
public void shouldSetTimestampGenerator() throws Exception {
|
||||
|
||||
TimestampGenerator mockTimestampGenerator = mock(TimestampGenerator.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
* Copyright 2013-2017 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.
|
||||
@@ -24,6 +24,7 @@ import static org.mockito.Mockito.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -45,8 +46,6 @@ import com.datastax.driver.core.Session;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.cassandra.config.CassandraCqlSessionFactoryBean
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-219>DATACASS-219</a>
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
@@ -59,35 +58,28 @@ public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
|
||||
private CassandraCqlSessionFactoryBean factoryBean;
|
||||
|
||||
protected <T> List<T> asList(T... array) {
|
||||
return new ArrayList<T>(Arrays.asList(array));
|
||||
}
|
||||
|
||||
protected void assertNonNullEmptyCollection(Collection<?> collection) {
|
||||
assertThat(collection).isNotNull();
|
||||
assertThat(collection.isEmpty()).isTrue();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
factoryBean = spy(new CassandraCqlSessionFactoryBean());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void cassandraCqlSessionFactoryBeanIsSingleton() {
|
||||
assertThat(factoryBean.isSingleton()).isTrue();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void objectTypeWhenSessionHasNotBeenInitializedIsSessionClass() {
|
||||
|
||||
assertThat(factoryBean.getObject()).isNull();
|
||||
assertThat(factoryBean.<Session> getObjectType()).isEqualTo(Session.class);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
@SuppressWarnings("unchecked")
|
||||
public void afterPropertiesSetInitializesSessionWithKeyspaceAndExecutesStartupScripts() throws Exception {
|
||||
List<String> expectedStartupScripts = asList("/path/to/schema.cql", "/path/to/data.cql");
|
||||
|
||||
List<String> expectedStartupScripts = Arrays.asList("/path/to/schema.cql", "/path/to/data.cql");
|
||||
|
||||
CqlOperations mockCqlOperations = mock(CqlOperations.class);
|
||||
|
||||
@@ -115,10 +107,10 @@ public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
verify(mockCqlOperations, times(1)).execute(eq(expectedStartupScripts.get(1)));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void connectToSystemKeyspace() {
|
||||
when(mockCluster.connect()).thenReturn(mockSession);
|
||||
|
||||
when(mockCluster.connect()).thenReturn(mockSession);
|
||||
factoryBean.setCluster(mockCluster);
|
||||
|
||||
assertThat(factoryBean.connect(null)).isEqualTo(mockSession);
|
||||
@@ -127,10 +119,10 @@ public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
verify(mockCluster, never()).connect(anyString());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void connectToTargetKeyspace() {
|
||||
when(mockCluster.connect(eq("TestKeyspace"))).thenReturn(mockSession);
|
||||
|
||||
when(mockCluster.connect(eq("TestKeyspace"))).thenReturn(mockSession);
|
||||
factoryBean.setCluster(mockCluster);
|
||||
|
||||
assertThat(factoryBean.connect("TestKeyspace")).isEqualTo(mockSession);
|
||||
@@ -139,10 +131,10 @@ public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
verify(mockCluster, times(1)).connect(eq("TestKeyspace"));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
@SuppressWarnings("unchecked")
|
||||
public void destroySessionAndExecutesShutdownScripts() throws Exception {
|
||||
List<String> expectedShutdownScripts = asList("/path/to/shutdown.cql");
|
||||
List<String> expectedShutdownScripts = Collections.singletonList("/path/to/shutdown.cql");
|
||||
|
||||
CqlOperations mockCqlOperations = mock(CqlOperations.class);
|
||||
|
||||
@@ -159,35 +151,42 @@ public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
inOrder.verify(mockSession, times(1)).close();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void isConnectedWithNullSessionIsFalse() {
|
||||
|
||||
assertThat(factoryBean.getObject()).isNull();
|
||||
assertThat(factoryBean.isConnected()).isFalse();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void isConnectedWithClosedSessionIsFalse() {
|
||||
doReturn(mockSession).when(factoryBean).getObject();
|
||||
|
||||
when(factoryBean.getObject()).thenReturn(mockSession);
|
||||
when(mockSession.isClosed()).thenReturn(true);
|
||||
|
||||
assertThat(factoryBean.isConnected()).isFalse();
|
||||
verify(mockSession, times(1)).isClosed();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void isConnectedWithOpenSessionIsTrue() {
|
||||
doReturn(mockSession).when(factoryBean).getObject();
|
||||
|
||||
when(factoryBean.getObject()).thenReturn(mockSession);
|
||||
when(mockSession.isClosed()).thenReturn(false);
|
||||
|
||||
assertThat(factoryBean.isConnected()).isTrue();
|
||||
verify(mockSession, times(1)).isClosed();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void setAndGetCluster() {
|
||||
|
||||
factoryBean.setCluster(mockCluster);
|
||||
|
||||
assertThat(factoryBean.getCluster()).isEqualTo(mockCluster);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void setClusterToNullThrowsIllegalArgumentException() {
|
||||
|
||||
try {
|
||||
@@ -199,7 +198,7 @@ public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void getClusterWhenUninitializedThrowsIllegalStateException() {
|
||||
|
||||
try {
|
||||
@@ -210,20 +209,19 @@ public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void setAndGetKeyspaceName() {
|
||||
|
||||
assertThat(factoryBean.getKeyspaceName()).isNull();
|
||||
|
||||
factoryBean.setKeyspaceName("TEST");
|
||||
|
||||
assertThat(factoryBean.getKeyspaceName()).isEqualTo("TEST");
|
||||
|
||||
factoryBean.setKeyspaceName(null);
|
||||
|
||||
assertThat(factoryBean.getKeyspaceName()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void getSessionWhenUninitializedThrowsIllegalStateException() {
|
||||
|
||||
assertThat(factoryBean.getObject()).isNull();
|
||||
@@ -237,26 +235,25 @@ public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void setAndGetStartupScripts() {
|
||||
|
||||
assertNonNullEmptyCollection(factoryBean.getStartupScripts());
|
||||
|
||||
List<String> expectedStartupScripts = asList("/path/to/schema.cql", "/path/to/data.cql");
|
||||
|
||||
List<String> expectedStartupScripts = Arrays.asList("/path/to/schema.cql", "/path/to/data.cql");
|
||||
factoryBean.setStartupScripts(expectedStartupScripts);
|
||||
|
||||
List<String> actualStartupScripts = factoryBean.getStartupScripts();
|
||||
|
||||
assertThat(actualStartupScripts).isNotSameAs(expectedStartupScripts).isEqualTo(expectedStartupScripts);
|
||||
|
||||
factoryBean.setStartupScripts(null);
|
||||
|
||||
assertNonNullEmptyCollection(factoryBean.getStartupScripts());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void startupScriptsAreImmutable() {
|
||||
List<String> startupScripts = asList("/path/to/startup.cql");
|
||||
|
||||
List<String> startupScripts = new ArrayList<String>(Collections.singletonList("/path/to/startup.cql"));
|
||||
|
||||
factoryBean.setStartupScripts(startupScripts);
|
||||
|
||||
@@ -282,29 +279,26 @@ public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
|
||||
@Test
|
||||
public void setAndGetShutdownScripts() {
|
||||
|
||||
assertNonNullEmptyCollection(factoryBean.getShutdownScripts());
|
||||
|
||||
List<String> expectedShutdownScripts = asList("/path/to/backup.cql", "/path/to/dropTables.cql");
|
||||
|
||||
List<String> expectedShutdownScripts = Arrays.asList("/path/to/backup.cql", "/path/to/dropTables.cql");
|
||||
factoryBean.setShutdownScripts(expectedShutdownScripts);
|
||||
|
||||
List<String> actualShutdownScripts = factoryBean.getShutdownScripts();
|
||||
|
||||
assertThat(actualShutdownScripts).isEqualTo(expectedShutdownScripts).isNotSameAs(expectedShutdownScripts);
|
||||
|
||||
factoryBean.setShutdownScripts(null);
|
||||
|
||||
assertNonNullEmptyCollection(factoryBean.getShutdownScripts());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void shutdownScriptsAreImmutable() {
|
||||
List<String> shutdownScripts = asList("/path/to/shutdown.cql");
|
||||
|
||||
List<String> shutdownScripts = new ArrayList<String>(Collections.singletonList("/path/to/shutdown.cql"));
|
||||
factoryBean.setShutdownScripts(shutdownScripts);
|
||||
|
||||
List<String> actualShutdownScripts = factoryBean.getShutdownScripts();
|
||||
|
||||
assertThat(actualShutdownScripts).isEqualTo(shutdownScripts).isNotSameAs(shutdownScripts);
|
||||
|
||||
shutdownScripts.add("/path/to/corruptSession.cql");
|
||||
@@ -321,4 +315,10 @@ public class CassandraCqlSessionFactoryBeanUnitTests {
|
||||
assertThat(actualShutdownScripts).hasSize(1);
|
||||
}
|
||||
}
|
||||
|
||||
private void assertNonNullEmptyCollection(Collection<?> collection) {
|
||||
|
||||
assertThat(collection).isNotNull();
|
||||
assertThat(collection.isEmpty()).isTrue();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -47,8 +47,6 @@ import com.datastax.driver.core.PoolingOptions;
|
||||
* @author David Webb
|
||||
* @author John Blum
|
||||
* @author Mark Paluch
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-176">DATACASS-176</a>
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class PoolingOptionsFactoryBeanUnitTests {
|
||||
@@ -63,7 +61,7 @@ public class PoolingOptionsFactoryBeanUnitTests {
|
||||
poolingOptionsFactoryBean = new PoolingOptionsFactoryBean();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-176, DATACASS-298
|
||||
public void getObjectReturnsNullWhenNotInitialized() throws Exception {
|
||||
assertThat(poolingOptionsFactoryBean.getObject()).isNull();
|
||||
}
|
||||
@@ -79,11 +77,7 @@ public class PoolingOptionsFactoryBeanUnitTests {
|
||||
assertThat(poolingOptionsFactoryBean.isSingleton()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-344">DATACASS-344</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298, DATACASS-344
|
||||
public void setAndGetFactoryBeanProperties() {
|
||||
|
||||
poolingOptionsFactoryBean.setHeartbeatIntervalSeconds(15);
|
||||
@@ -113,10 +107,7 @@ public class PoolingOptionsFactoryBeanUnitTests {
|
||||
assertThat(poolingOptionsFactoryBean.getRemoteMinSimultaneousRequests()).isEqualTo(50);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void afterPropertiesSetInitializesLocalPoolingOptions() throws Exception {
|
||||
|
||||
PoolingOptionsFactoryBean poolingOptionsFactoryBean = new PoolingOptionsFactoryBean() {
|
||||
@@ -157,10 +148,7 @@ public class PoolingOptionsFactoryBeanUnitTests {
|
||||
verify(poolingOptionsSpy, never()).setNewConnectionThreshold(eq(HostDistance.REMOTE), anyInt());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void afterPropertiesSetInitializesRemotePoolingOptions() throws Exception {
|
||||
|
||||
PoolingOptionsFactoryBean poolingOptionsFactoryBean = new PoolingOptionsFactoryBean() {
|
||||
@@ -201,10 +189,7 @@ public class PoolingOptionsFactoryBeanUnitTests {
|
||||
verify(poolingOptionsSpy, never()).setNewConnectionThreshold(eq(HostDistance.REMOTE), eq(5));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-344">DATACASS-344</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-344
|
||||
public void afterPropertiesSetInitializesMaxQueueSize() throws Exception {
|
||||
|
||||
Method setMaxQueueSize = ReflectionUtils.findMethod(PoolingOptions.class, "setMaxQueueSize", int.class);
|
||||
@@ -234,11 +219,8 @@ public class PoolingOptionsFactoryBeanUnitTests {
|
||||
* driver class type... {@link PoolingOptions}! The max values should be set before setting core values. Otherwise the
|
||||
* core values will be compared with the default max values which is 8. Same for other min-max properties pairs. This
|
||||
* test checks the same.
|
||||
*
|
||||
* @throws Exception Any unhandled scenarios will result in a test failure.
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-176">DATACASS-176</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-176
|
||||
public void afterPropertiesSetProperlySetsPoolingOptionsMaxBeforeMinProperties() throws Exception {
|
||||
|
||||
poolingOptionsFactoryBean = new PoolingOptionsFactoryBean() {
|
||||
@@ -283,10 +265,7 @@ public class PoolingOptionsFactoryBeanUnitTests {
|
||||
verify(poolingOptions).setNewConnectionThreshold(eq(HostDistance.REMOTE), eq(111));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-176">DATACASS-176</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-176
|
||||
public void newLocalHostDistancePoolingOptionsReturnsLocalHostDistancePoolingOptionsFactoryBeanSettings() {
|
||||
|
||||
poolingOptionsFactoryBean.setLocalCoreConnections(50);
|
||||
@@ -308,10 +287,7 @@ public class PoolingOptionsFactoryBeanUnitTests {
|
||||
assertThat(poolingOptions.getNewConnectionThreshold()).isEqualTo(100);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-176">DATACASS-176</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-176
|
||||
public void newLocalHostDistancePoolingOptionsReturnsRemoteHostDistancePoolingOptionsFactoryBeanSettings() {
|
||||
|
||||
poolingOptionsFactoryBean.setLocalCoreConnections(50);
|
||||
@@ -333,10 +309,7 @@ public class PoolingOptionsFactoryBeanUnitTests {
|
||||
assertThat(poolingOptions.getNewConnectionThreshold()).isEqualTo(40);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-176">DATACASS-176</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-176
|
||||
public void configureLocalHostDistancePoolingOptionsCallsConfigureWithExpectedInstance() {
|
||||
|
||||
final PoolingOptionsFactoryBean.HostDistancePoolingOptions mockHostDistancePoolingOptions = mock(
|
||||
@@ -362,10 +335,7 @@ public class PoolingOptionsFactoryBeanUnitTests {
|
||||
verify(mockHostDistancePoolingOptions).configure(same(poolingOptionsSpy));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-176">DATACASS-176</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-176
|
||||
public void configureRemoteHostDistancePoolingOptionsCallsConfigureWithExpectedInstance() {
|
||||
|
||||
final PoolingOptionsFactoryBean.HostDistancePoolingOptions mockHostDistancePoolingOptions = mock(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -45,15 +45,10 @@ import com.datastax.driver.core.policies.SpeculativeExecutionPolicy;
|
||||
* @author Mark Paluch
|
||||
* @author John Blum
|
||||
* @soundtrack Max Graham Feat Neev Kennedy - So Caught Up (Dns Project Remix)
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226"></a>
|
||||
*/
|
||||
public class AbstractClusterConfigurationUnitTests {
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldInitializeWithoutAnyOptions() throws Exception {
|
||||
|
||||
CassandraCqlClusterFactoryBean bean = new CassandraCqlClusterFactoryBean();
|
||||
@@ -68,11 +63,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(getConfiguration(cluster).getMetricsOptions().isJMXReportingEnabled()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetCompressionType() throws Exception {
|
||||
|
||||
final CompressionType compressionType = CompressionType.SNAPPY;
|
||||
@@ -88,11 +79,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(getConfiguration(cluster).getProtocolOptions().getCompression()).isEqualTo(Compression.SNAPPY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetPoolingOptions() throws Exception {
|
||||
|
||||
final PoolingOptions poolingOptions = new PoolingOptions();
|
||||
@@ -108,11 +95,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(getConfiguration(cluster).getPoolingOptions()).isEqualTo(poolingOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetSocketOptions() throws Exception {
|
||||
|
||||
final SocketOptions socketOptions = new SocketOptions();
|
||||
@@ -128,11 +111,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(getConfiguration(cluster).getSocketOptions()).isEqualTo(socketOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetQueryOptions() throws Exception {
|
||||
|
||||
final QueryOptions queryOptions = new QueryOptions();
|
||||
@@ -148,11 +127,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(getConfiguration(cluster).getQueryOptions()).isEqualTo(queryOptions);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetAuthProvider() throws Exception {
|
||||
|
||||
final AuthProvider authProvider = new PlainTextAuthProvider("x", "y");
|
||||
@@ -168,11 +143,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(getConfiguration(cluster).getProtocolOptions().getAuthProvider()).isEqualTo(authProvider);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetLoadBalancingPolicy() throws Exception {
|
||||
|
||||
final LoadBalancingPolicy loadBalancingPolicy = new RoundRobinPolicy();
|
||||
@@ -188,11 +159,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(getConfiguration(cluster).getPolicies().getLoadBalancingPolicy()).isEqualTo(loadBalancingPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetReconnectionPolicy() throws Exception {
|
||||
|
||||
final ReconnectionPolicy reconnectionPolicy = new ExponentialReconnectionPolicy(1, 2);
|
||||
@@ -208,11 +175,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(getConfiguration(cluster).getPolicies().getReconnectionPolicy()).isEqualTo(reconnectionPolicy);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetProtocolVersion() throws Exception {
|
||||
|
||||
AbstractClusterConfiguration clusterConfiguration = new AbstractClusterConfiguration() {
|
||||
@@ -227,11 +190,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
.contains(ProtocolVersion.V2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
* @throws Exception
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldDisableMetrics() throws Exception {
|
||||
|
||||
AbstractClusterConfiguration clusterConfiguration = new AbstractClusterConfiguration() {
|
||||
@@ -245,10 +204,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(getConfiguration(cluster).getMetricsOptions().isEnabled()).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetKeyspaceCreations() {
|
||||
|
||||
final List<CreateKeyspaceSpecification> specification = Collections
|
||||
@@ -263,10 +219,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(clusterConfiguration.cluster().getKeyspaceCreations()).isEqualTo(specification);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetKeyspaceDrops() {
|
||||
|
||||
final List<DropKeyspaceSpecification> specification = Collections
|
||||
@@ -281,10 +234,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(clusterConfiguration.cluster().getKeyspaceDrops()).isEqualTo(specification);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetStartupScripts() {
|
||||
|
||||
final List<String> scripts = Collections.singletonList("USE BLUE_METH; CREATE TABLE...");
|
||||
@@ -298,10 +248,7 @@ public class AbstractClusterConfigurationUnitTests {
|
||||
assertThat(clusterConfiguration.cluster().getStartupScripts()).isEqualTo(scripts);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-226">DATACASS-226</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-226
|
||||
public void shouldSetShutdownScripts() {
|
||||
|
||||
final List<String> scripts = Collections.singletonList("USE BLUE_METH; DROP TABLE...");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
* Copyright 2013-2017 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.
|
||||
@@ -52,10 +52,7 @@ public class CassandraCqlClusterParserUnitTests {
|
||||
|
||||
private CassandraCqlClusterParser parser = new CassandraCqlClusterParser();
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void resolveIdFromElement() {
|
||||
|
||||
when(mockElement.getAttribute(eq(CassandraCqlClusterParser.ID_ATTRIBUTE))).thenReturn("test");
|
||||
@@ -64,10 +61,7 @@ public class CassandraCqlClusterParserUnitTests {
|
||||
verify(mockElement).getAttribute(eq(CassandraCqlClusterParser.ID_ATTRIBUTE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void resolveIdUsingDefault() {
|
||||
|
||||
when(mockElement.getAttribute(eq(CassandraCqlClusterParser.ID_ATTRIBUTE))).thenReturn("");
|
||||
@@ -76,10 +70,7 @@ public class CassandraCqlClusterParserUnitTests {
|
||||
verify(mockElement).getAttribute(eq(CassandraCqlClusterParser.ID_ATTRIBUTE));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void parseInternalCallsDoParseAndConstructsBeanDefinition() {
|
||||
|
||||
BeanDefinition mockContainingBeanDefinition = mock(BeanDefinition.class);
|
||||
@@ -171,10 +162,7 @@ public class CassandraCqlClusterParserUnitTests {
|
||||
verify(mockElement).getAttribute(eq("username"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void parseChildElementsWithLocalPoolingOptions() {
|
||||
|
||||
Element localPoolingOptionsElement = mock(Element.class);
|
||||
@@ -228,10 +216,7 @@ public class CassandraCqlClusterParserUnitTests {
|
||||
verify(localPoolingOptionsElement).getAttribute(eq("min-simultaneous-requests"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void parseChildElementsWithRemotePoolingOptions() {
|
||||
|
||||
Element localPoolingOptionsElement = mock(Element.class);
|
||||
@@ -285,10 +270,7 @@ public class CassandraCqlClusterParserUnitTests {
|
||||
verify(localPoolingOptionsElement).getAttribute(eq("min-simultaneous-requests"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-242">DATACASS-242</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-242
|
||||
public void parseChildElementsWithStartupAndShutdownScripts() {
|
||||
|
||||
Element mockStartupCqlOne = mock(Element.class, "MockStartupCqlOne");
|
||||
@@ -322,10 +304,7 @@ public class CassandraCqlClusterParserUnitTests {
|
||||
assertThat(shutdownScripts).contains("DROP KEYSPACE test;", "DROP USER jblum;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void parseLocalPoolingOptionsProperlyConfiguresBeanDefinition() {
|
||||
|
||||
when(mockElement.getAttribute(eq("core-connections"))).thenReturn("50");
|
||||
@@ -362,10 +341,7 @@ public class CassandraCqlClusterParserUnitTests {
|
||||
verify(mockElement).getAttribute(eq("min-simultaneous-requests"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void parseRemotePoolingOptionsProperlyConfiguresBeanDefinition() {
|
||||
|
||||
when(mockElement.getAttribute(eq("core-connections"))).thenReturn("50");
|
||||
@@ -402,10 +378,7 @@ public class CassandraCqlClusterParserUnitTests {
|
||||
verify(mockElement).getAttribute(eq("min-simultaneous-requests"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void parseScript() {
|
||||
|
||||
when(mockElement.getTextContent()).thenReturn("CREATE TABLE schema.table;");
|
||||
@@ -413,10 +386,7 @@ public class CassandraCqlClusterParserUnitTests {
|
||||
verify(mockElement).getTextContent();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void newSocketOptionsBeanDefinitionIsProperlyInitialized() {
|
||||
|
||||
when(mockElement.getAttribute(eq("connect-timeout-millis"))).thenReturn("15000");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
* Copyright 2013-2017 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.
|
||||
@@ -36,10 +36,7 @@ public class ParsingUtilsUnitTests {
|
||||
|
||||
@Rule public ExpectedException exception = ExpectedException.none();
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void addOptionalReferencePropertyUsesDefault() {
|
||||
|
||||
BeanDefinitionBuilder builder = ParsingUtils.addProperty(BeanDefinitionBuilder.genericBeanDefinition(),
|
||||
@@ -51,10 +48,7 @@ public class ParsingUtilsUnitTests {
|
||||
assertThat(propertyValue.getBeanName()).isEqualTo("defaultBeanReference");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void addOptionalReferencePropertyWithNoValueDoesReturnsWithoutAdding() {
|
||||
|
||||
BeanDefinitionBuilder builder = ParsingUtils.addProperty(BeanDefinitionBuilder.genericBeanDefinition(),
|
||||
@@ -66,10 +60,7 @@ public class ParsingUtilsUnitTests {
|
||||
assertThat(beanDefinition.getPropertyValues().isEmpty()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void addOptionalValuePropertyUsesDefault() {
|
||||
|
||||
BeanDefinitionBuilder builder = ParsingUtils.addProperty(BeanDefinitionBuilder.genericBeanDefinition(),
|
||||
@@ -80,10 +71,7 @@ public class ParsingUtilsUnitTests {
|
||||
assertThat(propertyValue).isEqualTo("defaultValue");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void addOptionalValuePropertyWithNoValueDoesReturnsWithoutAdding() {
|
||||
|
||||
BeanDefinitionBuilder builder = ParsingUtils.addProperty(BeanDefinitionBuilder.genericBeanDefinition(),
|
||||
@@ -95,10 +83,7 @@ public class ParsingUtilsUnitTests {
|
||||
assertThat(beanDefinition.getPropertyValues().isEmpty()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void addRequiredReferencePropertyIsSuccessful() {
|
||||
|
||||
BeanDefinitionBuilder builder = ParsingUtils.addProperty(BeanDefinitionBuilder.genericBeanDefinition(),
|
||||
@@ -110,10 +95,7 @@ public class ParsingUtilsUnitTests {
|
||||
assertThat(propertyValue.getBeanName()).isEqualTo("reference");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void addRequiredReferencePropertyWithNoReferenceFails() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
@@ -123,10 +105,7 @@ public class ParsingUtilsUnitTests {
|
||||
"defaultReference", true, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void addRequiredValuePropertyIsSuccessful() {
|
||||
|
||||
BeanDefinitionBuilder builder = ParsingUtils.addProperty(BeanDefinitionBuilder.genericBeanDefinition(),
|
||||
@@ -137,10 +116,7 @@ public class ParsingUtilsUnitTests {
|
||||
assertThat(propertyValue).isEqualTo("value");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void addRequiredValuePropertyWithNoValueFails() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
@@ -150,10 +126,7 @@ public class ParsingUtilsUnitTests {
|
||||
false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void addPropertyThrowsIllegalArgumentExceptionForNullBuilder() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
@@ -162,10 +135,7 @@ public class ParsingUtilsUnitTests {
|
||||
ParsingUtils.addProperty(null, "propertyName", "value", "defaultValue", false, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void addPropertyThrowsIllegalArgumentExceptionForNullPropertyName() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -20,6 +20,8 @@ import static org.assertj.core.api.Assertions.*;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Mockito.*;
|
||||
|
||||
import edu.umd.cs.mtc.MultithreadedTestCase;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
@@ -34,13 +36,10 @@ import org.mockito.runners.MockitoJUnitRunner;
|
||||
import com.datastax.driver.core.PreparedStatement;
|
||||
import com.datastax.driver.core.Session;
|
||||
|
||||
import edu.umd.cs.mtc.MultithreadedTestCase;
|
||||
|
||||
/**
|
||||
* Unit tests for {@link CachedPreparedStatementCreator}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-253">DATACASS-253</a>
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class CachedPreparedStatementCreatorUnitTests {
|
||||
@@ -55,26 +54,17 @@ public class CachedPreparedStatementCreatorUnitTests {
|
||||
when(sessionMock.prepare(anyString())).thenReturn(preparedStatement);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-253
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-253
|
||||
public void shouldRejectEmptyCql() {
|
||||
new CachedPreparedStatementCreator("");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-253
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-253
|
||||
public void shouldRejectNullCql() {
|
||||
new CachedPreparedStatementCreator(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-253
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-253
|
||||
public void shouldCreatePreparedStatement() {
|
||||
|
||||
CachedPreparedStatementCreator cachedPreparedStatementCreator = new CachedPreparedStatementCreator("my cql");
|
||||
@@ -85,10 +75,7 @@ public class CachedPreparedStatementCreatorUnitTests {
|
||||
verify(sessionMock).prepare("my cql");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-253
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-253
|
||||
public void shouldCacheCreatePreparedStatement() {
|
||||
|
||||
CachedPreparedStatementCreator cachedPreparedStatementCreator = new CachedPreparedStatementCreator("my cql");
|
||||
@@ -102,11 +89,7 @@ public class CachedPreparedStatementCreatorUnitTests {
|
||||
verify(sessionMock, times(1)).prepare("my cql");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-253
|
||||
* @throws Throwable
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-253
|
||||
public void concurrentAccessToCreateStatementShouldBeSynchronized() throws Throwable {
|
||||
|
||||
CreatePreparedStatementIsThreadSafe concurrentPrepareStatement = new CreatePreparedStatementIsThreadSafe(
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -32,7 +32,6 @@ import org.junit.runners.Parameterized.Parameters;
|
||||
* Unit tests for {@link ConsistencyLevelResolver}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@RunWith(Parameterized.class)
|
||||
public class ConsistencyLevelResolverUnitTests {
|
||||
@@ -80,10 +79,7 @@ public class ConsistencyLevelResolverUnitTests {
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void shouldResolveCorrectly() {
|
||||
assertThat(ConsistencyLevelResolver.resolve(from)).isEqualTo(expected);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -97,10 +97,7 @@ public class CqlTemplateUnitTests {
|
||||
verify(mockSession, times(1)).execute(eq("test"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-304">DATACASS-304</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-304
|
||||
public void doExecuteInSessionCallbackTranslatesToCassandraException() {
|
||||
exception.expect(CassandraReadTimeoutException.class);
|
||||
exception.expectCause(org.hamcrest.Matchers.isA(ReadTimeoutException.class));
|
||||
@@ -113,10 +110,7 @@ public class CqlTemplateUnitTests {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-304">DATACASS-304</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-304
|
||||
public void doExecuteInSessionCallbackTranslatesToCassandraUncategorizedException() {
|
||||
|
||||
try {
|
||||
@@ -132,10 +126,7 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-304">DATACASS-304</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-304
|
||||
public void doExecuteInSessionCallbackTranslatesToCassandraUncategorizedDataAccessException() {
|
||||
|
||||
try {
|
||||
@@ -191,10 +182,7 @@ public class CqlTemplateUnitTests {
|
||||
verifyZeroInteractions(mockResultSet);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-286">DATACASS-286</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void firstColumnToObjectReturnsColumnValue() {
|
||||
|
||||
final Row mockRow = mock(Row.class);
|
||||
@@ -226,10 +214,7 @@ public class CqlTemplateUnitTests {
|
||||
verifyZeroInteractions(mockColumnDefinition);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-286">DATACASS-286</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void firstColumnToObjectReturnsNull() {
|
||||
|
||||
Row mockRow = mock(Row.class);
|
||||
@@ -248,10 +233,7 @@ public class CqlTemplateUnitTests {
|
||||
verify(mockIterator, never()).next();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-286">DATACASS-286</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void processOneIsSuccessful() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
@@ -270,10 +252,7 @@ public class CqlTemplateUnitTests {
|
||||
verifyZeroInteractions(mockRow);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-286">DATACASS-286</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void processOneThrowsIncorrectResultSetSizeDataAccessExceptionWhenNoRowsFound() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
@@ -294,10 +273,7 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-286">DATACASS-286</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void processOneThrowsIncorrectResultSetSizeDataAccessExceptionWhenTooManyRowsFound() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
@@ -320,10 +296,7 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-286">DATACASS-286</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void processOnePassingNullResultSetThrowsIllegalArgumentException() {
|
||||
|
||||
RowMapper mockRowMapper = mock(RowMapper.class);
|
||||
@@ -336,10 +309,7 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-286">DATACASS-286</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void processOneWithRequiredTypeIsSuccessful() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
@@ -365,10 +335,7 @@ public class CqlTemplateUnitTests {
|
||||
verifyZeroInteractions(mockRow);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-286">DATACASS-286</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void processOneWithRequiredTypeThrowsIncorrectResultSetSizeDataAccessExceptionWhenNoRowsFound() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
@@ -386,10 +353,7 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-286">DATACASS-286</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void processOneWithRequiredTypeThrowsIncorrectResultSetSizeDataAccessExceptionWhenTooManyRowsFound() {
|
||||
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
@@ -411,20 +375,14 @@ public class CqlTemplateUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-286">DATACASS-286</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void processOneWithRequiredTypePassingNullResultSetThrowsIllegalArgumentException() {
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
|
||||
template.processOne(null, String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void addPreparedStatementOptionsShouldAddDriverQueryOptions() {
|
||||
|
||||
QueryOptions queryOptions = QueryOptions.builder() //
|
||||
@@ -438,10 +396,7 @@ public class CqlTemplateUnitTests {
|
||||
verify(mockPreparedStatement).setRetryPolicy(FallthroughRetryPolicy.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void addPreparedStatementOptionsShouldAddOurQueryOptions() {
|
||||
|
||||
QueryOptions queryOptions = QueryOptions.builder().retryPolicy(RetryPolicy.FALLTHROUGH).build();
|
||||
@@ -454,10 +409,7 @@ public class CqlTemplateUnitTests {
|
||||
verify(mockPreparedStatement).setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void addStatementQueryOptionsShouldAddDriverQueryOptions() {
|
||||
|
||||
QueryOptions queryOptions = QueryOptions.builder().consistencyLevel(ConsistencyLevel.EACH_QUORUM) //
|
||||
@@ -470,10 +422,7 @@ public class CqlTemplateUnitTests {
|
||||
verify(mockStatement).setRetryPolicy(FallthroughRetryPolicy.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void addStatementQueryOptionsShouldAddOurQueryOptions() {
|
||||
|
||||
QueryOptions queryOptions = QueryOptions.builder().retryPolicy(RetryPolicy.FALLTHROUGH).build();
|
||||
@@ -486,10 +435,7 @@ public class CqlTemplateUnitTests {
|
||||
verify(mockStatement).setConsistencyLevel(ConsistencyLevel.LOCAL_QUORUM);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void addStatementQueryOptionsShouldNotAddOptions() {
|
||||
|
||||
QueryOptions queryOptions = QueryOptions.builder().build();
|
||||
@@ -499,10 +445,7 @@ public class CqlTemplateUnitTests {
|
||||
verifyZeroInteractions(mockStatement);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void addStatementQueryOptionsShouldAddGenericQueryOptions() {
|
||||
|
||||
QueryOptions queryOptions = QueryOptions.builder() //
|
||||
@@ -518,10 +461,7 @@ public class CqlTemplateUnitTests {
|
||||
verify(mockStatement).enableTracing();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void addInsertWriteOptionsShouldAddDriverQueryOptions() {
|
||||
|
||||
WriteOptions writeOptions = WriteOptions.builder() //
|
||||
@@ -539,10 +479,7 @@ public class CqlTemplateUnitTests {
|
||||
verify(mockInsert).using(Mockito.any(Using.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void addUpdateWriteOptionsShouldAddDriverQueryOptions() {
|
||||
|
||||
WriteOptions writeOptions = WriteOptions.builder() //
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -33,10 +33,7 @@ import com.datastax.driver.core.policies.LoggingRetryPolicy;
|
||||
*/
|
||||
public class QueryOptionsUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void buildQueryOptions() {
|
||||
|
||||
QueryOptions queryOptions = QueryOptions.builder() //
|
||||
@@ -56,10 +53,7 @@ public class QueryOptionsUnitTests {
|
||||
assertThat(queryOptions.getTracing()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void buildQueryOptionsWithDriverRetryPolicy() {
|
||||
|
||||
QueryOptions writeOptions = QueryOptions.builder() //
|
||||
@@ -70,10 +64,7 @@ public class QueryOptionsUnitTests {
|
||||
assertThat(writeOptions.getDriverRetryPolicy()).isInstanceOf(LoggingRetryPolicy.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void buildQueryOptionsWithRetryPolicy() {
|
||||
|
||||
QueryOptions writeOptions = QueryOptions.builder() //
|
||||
@@ -84,26 +75,17 @@ public class QueryOptionsUnitTests {
|
||||
assertThat(writeOptions.getDriverRetryPolicy()).isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = IllegalStateException.class) // DATACASS-202
|
||||
public void builderShouldRejectSettingOurAndDriverRetryPolicy() {
|
||||
QueryOptions.builder().retryPolicy(RetryPolicy.DEFAULT).retryPolicy(FallthroughRetryPolicy.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = IllegalStateException.class) // DATACASS-202
|
||||
public void builderShouldRejectSettingDriverAndOurRetryPolicy() {
|
||||
QueryOptions.builder().retryPolicy(FallthroughRetryPolicy.INSTANCE).retryPolicy(RetryPolicy.DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = IllegalStateException.class) // DATACASS-202
|
||||
public void shouldRejectSettingOurAndDriverRetryPolicy() {
|
||||
|
||||
QueryOptions queryOptions = new QueryOptions();
|
||||
@@ -111,10 +93,7 @@ public class QueryOptionsUnitTests {
|
||||
queryOptions.setRetryPolicy(FallthroughRetryPolicy.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = IllegalStateException.class) // DATACASS-202
|
||||
public void shouldRejectSettingDriverAndOurRetryPolicy() {
|
||||
|
||||
QueryOptions queryOptions = new QueryOptions();
|
||||
@@ -122,10 +101,7 @@ public class QueryOptionsUnitTests {
|
||||
queryOptions.setRetryPolicy(RetryPolicy.DEFAULT);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = IllegalStateException.class) // DATACASS-202
|
||||
public void shouldRejectSettingOurAndDriverConsistencyLevel() {
|
||||
|
||||
QueryOptions queryOptions = new QueryOptions();
|
||||
@@ -133,10 +109,7 @@ public class QueryOptionsUnitTests {
|
||||
queryOptions.setConsistencyLevel(ConsistencyLevel.ANY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = IllegalStateException.class) // DATACASS-202
|
||||
public void shouldRejectSettingDriverAndOurConsistencyLevel() {
|
||||
|
||||
QueryOptions queryOptions = new QueryOptions();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -30,10 +30,7 @@ import com.datastax.driver.core.policies.FallthroughRetryPolicy;
|
||||
*/
|
||||
public class WriteOptionsUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void buildWriteOptions() {
|
||||
|
||||
WriteOptions writeOptions = WriteOptions.builder() //
|
||||
@@ -54,10 +51,7 @@ public class WriteOptionsUnitTests {
|
||||
assertThat(writeOptions.getTracing()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void buildReadTimeoutOptionsWriteOptions() {
|
||||
|
||||
WriteOptions writeOptions = WriteOptions.builder().readTimeout(1, TimeUnit.MINUTES).build();
|
||||
@@ -67,10 +61,7 @@ public class WriteOptionsUnitTests {
|
||||
assertThat(writeOptions.getTracing()).isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void buildQueryOptionsWithDriverRetryPolicy() {
|
||||
|
||||
QueryOptions writeOptions = QueryOptions.builder().retryPolicy(FallthroughRetryPolicy.INSTANCE).build();
|
||||
@@ -79,10 +70,7 @@ public class WriteOptionsUnitTests {
|
||||
assertThat(writeOptions.getDriverRetryPolicy()).isEqualTo(FallthroughRetryPolicy.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void buildQueryOptionsWithRetryPolicy() {
|
||||
|
||||
QueryOptions writeOptions = QueryOptions.builder().retryPolicy(RetryPolicy.DOWNGRADING_CONSISTENCY).build();
|
||||
@@ -91,18 +79,12 @@ public class WriteOptionsUnitTests {
|
||||
assertThat(writeOptions.getDriverRetryPolicy()).isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = IllegalStateException.class) // DATACASS-202
|
||||
public void builderShouldRejectSettingOurAndDriverRetryPolicy() {
|
||||
WriteOptions.builder().retryPolicy(RetryPolicy.DEFAULT).retryPolicy(FallthroughRetryPolicy.INSTANCE);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = IllegalStateException.class) // DATACASS-202
|
||||
public void builderShouldRejectSettingDriverAndOurRetryPolicy() {
|
||||
WriteOptions.builder().retryPolicy(FallthroughRetryPolicy.INSTANCE).retryPolicy(RetryPolicy.DEFAULT);
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -37,7 +37,6 @@ import com.datastax.driver.core.TableMetadata;
|
||||
* Integration tests tests for {@link AlterTableCqlGenerator}.
|
||||
*
|
||||
* @author Mark Paluch
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCreatingIntegrationTest {
|
||||
|
||||
@@ -48,10 +47,7 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
session.execute("DROP TABLE IF EXISTS users;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAlterColumnType() {
|
||||
|
||||
session.execute(
|
||||
@@ -67,10 +63,7 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(column.getType()).isEqualTo(DataType.varint());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAlterListColumnType() {
|
||||
|
||||
session.execute(
|
||||
@@ -86,10 +79,7 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(column.getType()).isEqualTo((DataType) DataType.list(DataType.varchar()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAddColumn() {
|
||||
|
||||
session.execute(
|
||||
@@ -105,10 +95,7 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(column.getType()).isEqualTo(DataType.varchar());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAddListColumn() {
|
||||
|
||||
session.execute("CREATE TABLE users (user_name varchar PRIMARY KEY);");
|
||||
@@ -123,10 +110,7 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(column.getType()).isEqualTo((DataType) DataType.list(DataType.ascii()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableDropColumn() {
|
||||
|
||||
session.execute("CREATE TABLE addamsFamily (name varchar PRIMARY KEY, gender varchar);");
|
||||
@@ -138,10 +122,7 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(getTableMetadata("addamsfamily").getColumn("gender")).isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableRenameColumn() {
|
||||
|
||||
session.execute("CREATE TABLE addamsFamily (name varchar PRIMARY KEY, firstname varchar);");
|
||||
@@ -154,10 +135,7 @@ public class AlterTableCqlGeneratorIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(getTableMetadata("addamsfamily").getColumn("newname")).isNotNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAddCaching() {
|
||||
|
||||
session.execute("CREATE TABLE users (user_name varchar PRIMARY KEY);");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -37,10 +37,7 @@ import com.datastax.driver.core.DataType;
|
||||
*/
|
||||
public class AlterTableCqlGeneratorUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAlterColumnType() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").alter("lastKnownLocation",
|
||||
@@ -49,10 +46,7 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("ALTER TABLE addamsfamily ALTER lastknownlocation TYPE uuid;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAlterListColumnType() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").alter("lastKnownLocation",
|
||||
@@ -61,10 +55,7 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("ALTER TABLE addamsfamily ALTER lastknownlocation TYPE list<ascii>;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAddColumn() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").add("gravesite",
|
||||
@@ -73,10 +64,7 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("ALTER TABLE addamsfamily ADD gravesite varchar;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAddListColumn() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("users").add("top_places",
|
||||
@@ -85,10 +73,7 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("ALTER TABLE users ADD top_places list<ascii>;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableDropColumn() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").drop("gender");
|
||||
@@ -96,10 +81,7 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("ALTER TABLE addamsfamily DROP gender;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableRenameColumn() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily").rename("firstname", "lastname");
|
||||
@@ -107,10 +89,7 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("ALTER TABLE addamsfamily RENAME firstname TO lastname;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAddCommentAndTableOption() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily")
|
||||
@@ -120,10 +99,7 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
"ALTER TABLE addamsfamily WITH read_repair_chance = 0.2 AND comment = 'A most excellent and useful table';");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAddColumnAndComment() {
|
||||
|
||||
AlterTableSpecification spec = AlterTableSpecification.alterTable("addamsFamily")
|
||||
@@ -134,10 +110,7 @@ public class AlterTableCqlGeneratorUnitTests {
|
||||
"ALTER TABLE addamsfamily ADD top_places list<ascii> ADD other list<ascii> WITH comment = 'A most excellent and useful table';");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-192
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-192
|
||||
public void alterTableAddCaching() {
|
||||
|
||||
Map<Object, Object> cachingMap = new LinkedHashMap<Object, Object>();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -38,10 +38,7 @@ public class AlterUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspaceC
|
||||
session.execute("CREATE TYPE address (zip text, state text);");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void alterTypeShouldAddField() {
|
||||
|
||||
AlterUserTypeSpecification spec = AlterUserTypeSpecification.alterType("address")//
|
||||
@@ -50,10 +47,7 @@ public class AlterUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspaceC
|
||||
session.execute(toCql(spec));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void alterTypeShouldAlterField() {
|
||||
|
||||
AlterUserTypeSpecification spec = AlterUserTypeSpecification.alterType("address")//
|
||||
@@ -62,10 +56,7 @@ public class AlterUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspaceC
|
||||
session.execute(toCql(spec));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void alterTypeShouldRenameField() {
|
||||
|
||||
AlterUserTypeSpecification spec = AlterUserTypeSpecification.alterType("address")//
|
||||
@@ -74,10 +65,7 @@ public class AlterUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspaceC
|
||||
session.execute(toCql(spec));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void alterTypeShouldRenameFields() {
|
||||
|
||||
AlterUserTypeSpecification spec = AlterUserTypeSpecification.alterType("address")//
|
||||
@@ -87,18 +75,12 @@ public class AlterUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspaceC
|
||||
session.execute(toCql(spec));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-172
|
||||
public void generationFailsIfNameIsNotSet() {
|
||||
toCql(AlterUserTypeSpecification.alterType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-172
|
||||
public void generationFailsWithoutFields() {
|
||||
toCql(AlterUserTypeSpecification.alterType().name("hello"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -30,10 +30,7 @@ import com.datastax.driver.core.DataType;
|
||||
*/
|
||||
public class AlterUserTypeCqlGeneratorUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void alterTypeShouldAddField() {
|
||||
|
||||
AlterUserTypeSpecification spec = AlterUserTypeSpecification.alterType("address") //
|
||||
@@ -42,10 +39,7 @@ public class AlterUserTypeCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("ALTER TYPE address ADD zip varchar;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void alterTypeShouldAlterField() {
|
||||
|
||||
AlterUserTypeSpecification spec = AlterUserTypeSpecification.alterType("address") //
|
||||
@@ -54,10 +48,7 @@ public class AlterUserTypeCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("ALTER TYPE address ALTER zip TYPE varchar;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void alterTypeShouldRenameField() {
|
||||
|
||||
AlterUserTypeSpecification spec = AlterUserTypeSpecification.alterType("address") //
|
||||
@@ -66,10 +57,7 @@ public class AlterUserTypeCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("ALTER TYPE address RENAME zip TO zap;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void alterTypeShouldRenameFields() {
|
||||
|
||||
AlterUserTypeSpecification spec = AlterUserTypeSpecification.alterType("address") //
|
||||
@@ -79,18 +67,12 @@ public class AlterUserTypeCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("ALTER TYPE address RENAME zip TO zap AND city TO county;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-172
|
||||
public void generationFailsIfNameIsNotSet() {
|
||||
toCql(AlterUserTypeSpecification.alterType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-172
|
||||
public void generationFailsWithoutFields() {
|
||||
toCql(AlterUserTypeSpecification.alterType().name("hello"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.cassandra.core.cql.generator;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.springframework.cassandra.core.cql.generator.CreateUserTypeCqlGenerator.*;
|
||||
|
||||
import org.junit.Before;
|
||||
@@ -41,10 +41,7 @@ public class CreateUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspace
|
||||
session.execute("DROP TYPE IF EXISTS address;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void createUserType() {
|
||||
|
||||
CreateUserTypeSpecification spec = CreateUserTypeSpecification //
|
||||
@@ -59,10 +56,7 @@ public class CreateUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspace
|
||||
assertThat(address.getFieldNames()).contains("zip", "city");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void createUserTypeIfNotExists() {
|
||||
|
||||
CreateUserTypeSpecification spec = CreateUserTypeSpecification //
|
||||
@@ -77,10 +71,7 @@ public class CreateUserTypeCqlGeneratorIntegrationTests extends AbstractKeyspace
|
||||
assertThat(address.getFieldNames()).contains("zip", "city");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void createNestedUserType() {
|
||||
|
||||
CreateUserTypeSpecification addressSpec = CreateUserTypeSpecification //
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -30,10 +30,7 @@ import com.datastax.driver.core.DataType;
|
||||
*/
|
||||
public class CreateUserTypeCqlGeneratorUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void createUserType() {
|
||||
|
||||
CreateUserTypeSpecification spec = CreateUserTypeSpecification //
|
||||
@@ -43,10 +40,7 @@ public class CreateUserTypeCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("CREATE TYPE address (city varchar);");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void createMultiFieldUserType() {
|
||||
|
||||
CreateUserTypeSpecification spec = CreateUserTypeSpecification //
|
||||
@@ -57,10 +51,7 @@ public class CreateUserTypeCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("CREATE TYPE address (zip ascii, city varchar);");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void createUserTypeIfNotExists() {
|
||||
|
||||
CreateUserTypeSpecification spec = CreateUserTypeSpecification //
|
||||
@@ -71,18 +62,12 @@ public class CreateUserTypeCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("CREATE TYPE IF NOT EXISTS address (zip ascii, city varchar);");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-172
|
||||
public void generationFailsIfNameIsNotSet() {
|
||||
toCql(CreateUserTypeSpecification.createType());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-172
|
||||
public void generationFailsWithoutFields() {
|
||||
toCql(CreateUserTypeSpecification.createType().name("hello"));
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,7 +15,7 @@
|
||||
*/
|
||||
package org.springframework.cassandra.core.cql.generator;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.springframework.cassandra.core.cql.generator.DropUserTypeCqlGenerator.*;
|
||||
|
||||
import org.junit.Test;
|
||||
@@ -28,10 +28,7 @@ import org.springframework.cassandra.core.keyspace.DropUserTypeSpecification;
|
||||
*/
|
||||
public class DropUserTypeCqlGeneratorUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldDropUserType() {
|
||||
|
||||
DropUserTypeSpecification spec = DropUserTypeSpecification.dropType("address");
|
||||
@@ -39,10 +36,7 @@ public class DropUserTypeCqlGeneratorUnitTests {
|
||||
assertThat(toCql(spec)).isEqualTo("DROP TYPE address;");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldDropUserTypeIfExists() {
|
||||
|
||||
DropUserTypeSpecification spec = DropUserTypeSpecification.dropType("address").ifExists();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -49,10 +49,7 @@ public class CassandraAccessorUnitTests {
|
||||
cassandraAccessor = new CassandraAccessor();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void afterPropertiesSetWithUnitializedSessionThrowsIllegalStateException() {
|
||||
|
||||
try {
|
||||
@@ -63,20 +60,14 @@ public class CassandraAccessorUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void setAndGetExceptionTranslator() {
|
||||
|
||||
cassandraAccessor.setExceptionTranslator(mockExceptionTranslator);
|
||||
assertThat(cassandraAccessor.getExceptionTranslator()).isSameAs(mockExceptionTranslator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void setExceptionTranslatorToNullThrowsIllegalArgumentException() {
|
||||
|
||||
try {
|
||||
@@ -87,28 +78,19 @@ public class CassandraAccessorUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void getUninitializedExceptionTranslatorReturnsDefault() {
|
||||
assertThat(cassandraAccessor.getExceptionTranslator()).isEqualTo(cassandraAccessor.exceptionTranslator);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void setAndGetSession() {
|
||||
|
||||
cassandraAccessor.setSession(mockSession);
|
||||
assertThat(cassandraAccessor.getSession()).isSameAs(mockSession);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void setSessionToNullThrowsIllegalArgumentException() {
|
||||
|
||||
try {
|
||||
@@ -119,10 +101,7 @@ public class CassandraAccessorUnitTests {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-286
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-286
|
||||
public void getUninitializedSessionThrowsIllegalStateException() {
|
||||
|
||||
try {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
@@ -57,10 +57,7 @@ public class PropertyPlaceholderNamespaceCreatingXmlConfigIntegrationTests
|
||||
assertThat(ops).isNotNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void localAndRemotePoolingOptionsWereConfiguredProperly() {
|
||||
|
||||
PoolingOptions poolingOptions = cassandraCluster.getConfiguration().getPoolingOptions();
|
||||
@@ -78,10 +75,7 @@ public class PropertyPlaceholderNamespaceCreatingXmlConfigIntegrationTests
|
||||
assertThat(poolingOptions.getNewConnectionThreshold(HostDistance.REMOTE)).isEqualTo(5);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void socketOptionsWereConfiguredProperly() {
|
||||
|
||||
SocketOptions socketOptions = cassandraCluster.getConfiguration().getSocketOptions();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
@@ -108,10 +108,7 @@ public class XmlConfigIntegrationTests extends AbstractEmbeddedCassandraIntegrat
|
||||
assertThat(((TestClusterBuilderConfigurer) clusterBuilderConfigurer).configureCalled.get()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void localAndRemotePoolingOptionsWereConfiguredProperly() {
|
||||
|
||||
PoolingOptions poolingOptions = cluster.getConfiguration().getPoolingOptions();
|
||||
@@ -130,10 +127,7 @@ public class XmlConfigIntegrationTests extends AbstractEmbeddedCassandraIntegrat
|
||||
assertThat(poolingOptions.getNewConnectionThreshold(HostDistance.REMOTE)).isEqualTo(25);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-298">DATACASS-298</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-298
|
||||
public void socketOptionsWereConfiguredProperly() {
|
||||
|
||||
SocketOptions socketOptions = cluster.getConfiguration().getSocketOptions();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -1074,10 +1074,7 @@ public class CqlOperationsIntegrationTests extends AbstractKeyspaceCreatingInteg
|
||||
cqlTemplate.execute(truncate);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-202
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-202
|
||||
public void queryShouldApplyFetchSize() {
|
||||
|
||||
insertTestObjectArray();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2015 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
* Copyright 2013-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.cassandra.test.integration.support;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
import java.net.URL;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
@@ -23,8 +25,6 @@ import org.springframework.util.Assert;
|
||||
|
||||
import com.google.common.io.Resources;
|
||||
|
||||
import lombok.SneakyThrows;
|
||||
|
||||
/**
|
||||
* An executable CQL data set. The data set can be created from class path resources and execution can be bound to a
|
||||
* particular keyspace.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
package org.springframework.cassandra.test.integration.support;
|
||||
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import com.datastax.driver.core.NettyOptions;
|
||||
|
||||
import io.netty.channel.EventLoopGroup;
|
||||
|
||||
/**
|
||||
* {@link NettyOptions} to shutdown a {@link com.datastax.driver.core.Cluster} instance without wait time.
|
||||
*
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
* Copyright 2013-2017 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.
|
||||
@@ -18,15 +18,10 @@ package org.springframework.data.cassandra.config;
|
||||
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
import static org.mockito.Matchers.anyBoolean;
|
||||
import static org.mockito.Matchers.anyString;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Matchers.isNull;
|
||||
import static org.mockito.Mockito.*;
|
||||
import static org.springframework.data.cassandra.config.CassandraSessionFactoryBean.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Rule;
|
||||
import org.junit.Test;
|
||||
@@ -38,15 +33,9 @@ import org.mockito.runners.MockitoJUnitRunner;
|
||||
import org.mockito.stubbing.Answer;
|
||||
import org.springframework.cassandra.core.cql.CqlIdentifier;
|
||||
import org.springframework.data.cassandra.convert.CassandraConverter;
|
||||
import org.springframework.data.cassandra.core.CassandraAdminOperations;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
|
||||
import com.datastax.driver.core.Cluster;
|
||||
import com.datastax.driver.core.KeyspaceMetadata;
|
||||
import com.datastax.driver.core.Metadata;
|
||||
import com.datastax.driver.core.Session;
|
||||
import com.datastax.driver.core.TableMetadata;
|
||||
|
||||
/**
|
||||
* The CassandraSessionFactoryBeanUnitTests class is a test suite of test cases testing the contract and functionality
|
||||
@@ -54,8 +43,6 @@ import com.datastax.driver.core.TableMetadata;
|
||||
*
|
||||
* @author John Blum
|
||||
* @see org.springframework.data.cassandra.config.CassandraSessionFactoryBean
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-219>DATACASS-219</a>
|
||||
* @since 1.5.0
|
||||
*/
|
||||
@RunWith(MockitoJUnitRunner.class)
|
||||
public class CassandraSessionFactoryBeanUnitTests {
|
||||
@@ -70,7 +57,7 @@ public class CassandraSessionFactoryBeanUnitTests {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
|
||||
|
||||
when(mockCluster.connect()).thenReturn(mockSession);
|
||||
when(mockSession.getCluster()).thenReturn(mockCluster);
|
||||
|
||||
@@ -82,9 +69,9 @@ public class CassandraSessionFactoryBeanUnitTests {
|
||||
return new CqlIdentifier(id, false);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void afterPropertiesSetPerformsSchemaAction() throws Exception {
|
||||
|
||||
|
||||
doAnswer(new Answer<Void>() {
|
||||
@Override
|
||||
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
|
||||
@@ -107,9 +94,9 @@ public class CassandraSessionFactoryBeanUnitTests {
|
||||
verify(factoryBean, times(1)).performSchemaAction();
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void afterPropertiesSetThrowsIllegalStateExceptionWhenConverterIsNull() throws Exception {
|
||||
|
||||
|
||||
exception.expect(IllegalStateException.class);
|
||||
exception.expectMessage("Converter was not properly initialized");
|
||||
|
||||
@@ -117,7 +104,7 @@ public class CassandraSessionFactoryBeanUnitTests {
|
||||
factoryBean.afterPropertiesSet();
|
||||
}
|
||||
|
||||
protected void performSchemaActionCallsCreateTableWithArgumentsMatchingTheSchemaAction(SchemaAction schemaAction,
|
||||
private void performSchemaActionCallsCreateTableWithArgumentsMatchingTheSchemaAction(SchemaAction schemaAction,
|
||||
final boolean dropTables, final boolean dropUnused, final boolean ifNotExists) {
|
||||
|
||||
doAnswer(new Answer<Void>() {
|
||||
@@ -131,41 +118,39 @@ public class CassandraSessionFactoryBeanUnitTests {
|
||||
}).when(factoryBean).createTables(anyBoolean(), anyBoolean(), anyBoolean());
|
||||
|
||||
factoryBean.setSchemaAction(schemaAction);
|
||||
|
||||
assertThat(factoryBean.getSchemaAction()).isEqualTo(schemaAction);
|
||||
|
||||
factoryBean.performSchemaAction();
|
||||
|
||||
verify(factoryBean, times(1)).createTables(eq(dropTables), eq(dropUnused), eq(ifNotExists));
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void performsSchemaActionCreatesTablesWithDefaults() {
|
||||
performSchemaActionCallsCreateTableWithArgumentsMatchingTheSchemaAction(SchemaAction.CREATE, DEFAULT_DROP_TABLES,
|
||||
DEFAULT_DROP_UNUSED_TABLES, DEFAULT_CREATE_IF_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void performsSchemaActionCreatesTablesIfNotExists() {
|
||||
performSchemaActionCallsCreateTableWithArgumentsMatchingTheSchemaAction(SchemaAction.CREATE_IF_NOT_EXISTS,
|
||||
DEFAULT_DROP_TABLES, DEFAULT_DROP_UNUSED_TABLES, true);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void performsSchemaActionRecreatesTables() {
|
||||
performSchemaActionCallsCreateTableWithArgumentsMatchingTheSchemaAction(SchemaAction.RECREATE, true,
|
||||
DEFAULT_DROP_UNUSED_TABLES, DEFAULT_CREATE_IF_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void performsSchemaActionRecreatesAndDropsUnusedTables() {
|
||||
performSchemaActionCallsCreateTableWithArgumentsMatchingTheSchemaAction(SchemaAction.RECREATE_DROP_UNUSED, true,
|
||||
true, DEFAULT_CREATE_IF_NOT_EXISTS);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void performsSchemaActionDoesNotCallCreateTablesWhenSchemaActionIsNone() {
|
||||
|
||||
|
||||
doAnswer(new Answer<Void>() {
|
||||
@Override
|
||||
public Void answer(InvocationOnMock invocationOnMock) throws Throwable {
|
||||
@@ -183,27 +168,27 @@ public class CassandraSessionFactoryBeanUnitTests {
|
||||
verify(factoryBean, never()).createTables(anyBoolean(), anyBoolean(), anyBoolean());
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void setAndGetConverter() {
|
||||
|
||||
|
||||
assertThat(factoryBean.getConverter()).isNull();
|
||||
factoryBean.setConverter(mockConverter);
|
||||
assertThat(factoryBean.getConverter()).isEqualTo(mockConverter);
|
||||
verifyZeroInteractions(mockConverter);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void setConverterToNull() {
|
||||
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
exception.expectMessage("CassandraConverter must not be null");
|
||||
|
||||
factoryBean.setConverter(null);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void setAndGetSchemaAction() {
|
||||
|
||||
|
||||
assertThat(factoryBean.getSchemaAction()).isEqualTo(SchemaAction.NONE);
|
||||
factoryBean.setSchemaAction(SchemaAction.CREATE);
|
||||
assertThat(factoryBean.getSchemaAction()).isEqualTo(SchemaAction.CREATE);
|
||||
@@ -211,8 +196,9 @@ public class CassandraSessionFactoryBeanUnitTests {
|
||||
assertThat(factoryBean.getSchemaAction()).isEqualTo(SchemaAction.NONE);
|
||||
}
|
||||
|
||||
@Test
|
||||
@Test // DATACASS-219
|
||||
public void setSchemaActionToNullThrowsIllegalArgumentException() {
|
||||
|
||||
exception.expect(IllegalArgumentException.class);
|
||||
exception.expectMessage("SchemaAction must not be null");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -49,7 +49,6 @@ import com.datastax.driver.core.TableMetadata;
|
||||
*
|
||||
* @author John Blum
|
||||
* @author Mark Paluch
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-219>DATACASS-219</a>
|
||||
*/
|
||||
public class SchemaActionIntegrationTests extends AbstractEmbeddedCassandraIntegrationTest {
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -47,10 +47,7 @@ public class CassandraNamespaceIntegrationTests extends AbstractSpringDataEmbedd
|
||||
|
||||
@Autowired ApplicationContext applicationContext;
|
||||
|
||||
/**
|
||||
* @see DATACASS-271
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-271
|
||||
public void clusterShouldHaveCompressionSet() {
|
||||
|
||||
Cluster cluster = applicationContext.getBean(Cluster.class);
|
||||
@@ -58,10 +55,7 @@ public class CassandraNamespaceIntegrationTests extends AbstractSpringDataEmbedd
|
||||
assertThat(configuration.getProtocolOptions().getCompression()).isEqualTo(Compression.SNAPPY);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-271
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-271
|
||||
public void clusterShouldHavePoolingOptionsConfigured() {
|
||||
|
||||
Cluster cluster = applicationContext.getBean(Cluster.class);
|
||||
@@ -77,10 +71,7 @@ public class CassandraNamespaceIntegrationTests extends AbstractSpringDataEmbedd
|
||||
assertThat(poolingOptions.getMaxConnectionsPerHost(HostDistance.REMOTE)).isEqualTo(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-271
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-271
|
||||
public void clusterShouldHaveSocketOptionsConfigured() {
|
||||
|
||||
Cluster cluster = applicationContext.getBean(Cluster.class);
|
||||
@@ -95,15 +86,13 @@ public class CassandraNamespaceIntegrationTests extends AbstractSpringDataEmbedd
|
||||
assertThat(socketOptions.getSendBufferSize()).isEqualTo(65536);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void mappingContextShouldHaveUserTypeResolverConfigured() {
|
||||
|
||||
BasicCassandraMappingContext mappingContext = applicationContext.getBean(BasicCassandraMappingContext.class);
|
||||
|
||||
SimpleUserTypeResolver userTypeResolver = (SimpleUserTypeResolver) ReflectionTestUtils.getField(mappingContext, "userTypeResolver");
|
||||
SimpleUserTypeResolver userTypeResolver = (SimpleUserTypeResolver) ReflectionTestUtils.getField(mappingContext,
|
||||
"userTypeResolver");
|
||||
|
||||
assertThat(userTypeResolver).isNotNull();
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -28,10 +28,7 @@ import org.springframework.data.cassandra.domain.Person;
|
||||
*/
|
||||
public class ConverterRegistrationUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void considersNotExplicitlyReadingDependingOnTypes() {
|
||||
|
||||
ConverterRegistration context = new ConverterRegistration(Person.class, String.class, false, false);
|
||||
@@ -47,10 +44,7 @@ public class ConverterRegistrationUnitTests {
|
||||
assertThat(context.isReading()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void forcesReadWriteOnlyIfAnnotated() {
|
||||
|
||||
ConverterRegistration context = new ConverterRegistration(String.class, Class.class, false, true);
|
||||
@@ -62,10 +56,7 @@ public class ConverterRegistrationUnitTests {
|
||||
assertThat(context.isReading()).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void considersConverterForReadAndWriteIfBothAnnotated() {
|
||||
|
||||
ConverterRegistration context = new ConverterRegistration(String.class, Class.class, true, true);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -47,10 +47,7 @@ import com.datastax.driver.core.Row;
|
||||
*/
|
||||
public class CustomConversionsUnitTests {
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void findsBasicReadAndWriteConversions() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions(
|
||||
@@ -63,10 +60,7 @@ public class CustomConversionsUnitTests {
|
||||
assertThat(conversions.hasCustomReadTarget(String.class, Locale.class)).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void considersSubtypesCorrectly() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions(
|
||||
@@ -76,20 +70,14 @@ public class CustomConversionsUnitTests {
|
||||
assertThat(conversions.hasCustomReadTarget(String.class, Long.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void considersTypesWeRegisteredConvertersForAsSimple() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions(Arrays.asList(FormatToStringConverter.INSTANCE));
|
||||
assertThat(conversions.isSimpleType(UUID.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void populatesConversionServiceCorrectly() {
|
||||
|
||||
GenericConversionService conversionService = new DefaultConversionService();
|
||||
@@ -100,20 +88,14 @@ public class CustomConversionsUnitTests {
|
||||
assertThat(conversionService.canConvert(String.class, Format.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void doesNotConsiderTypeSimpleIfOnlyReadConverterIsRegistered() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions(Arrays.asList(StringToFormatConverter.INSTANCE));
|
||||
assertThat(conversions.isSimpleType(Format.class)).isFalse();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void discoversConvertersForSubtypesOfCassandraTypes() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions(Arrays.asList(StringToIntegerConverter.INSTANCE));
|
||||
@@ -121,40 +103,28 @@ public class CustomConversionsUnitTests {
|
||||
assertThat(conversions.hasCustomWriteTarget(String.class, Integer.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void considersUUIDASimpleType() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions();
|
||||
assertThat(conversions.isSimpleType(UUID.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void considersInetAddressASimpleType() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions();
|
||||
assertThat(conversions.isSimpleType(InetAddress.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void considersRowASimpleType() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions();
|
||||
assertThat(conversions.isSimpleType(Row.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
@SuppressWarnings("rawtypes")
|
||||
public void favorsCustomConverterForIndeterminedTargetType() {
|
||||
|
||||
@@ -162,10 +132,7 @@ public class CustomConversionsUnitTests {
|
||||
assertThat(conversions.getCustomWriteTarget(DateTime.class, null)).isEqualTo((Class) String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void customConverterOverridesDefault() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions(Arrays.asList(CustomDateTimeConverter.INSTANCE));
|
||||
@@ -175,30 +142,21 @@ public class CustomConversionsUnitTests {
|
||||
assertThat(conversionService.convert(new DateTime(), Date.class)).isEqualTo(new Date(0));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldSelectPropertCustomWriteTargetForCglibProxiedType() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions(Arrays.asList(FormatToStringConverter.INSTANCE));
|
||||
assertThat(conversions.getCustomWriteTarget(createProxyTypeFor(Format.class))).isAssignableFrom(String.class);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldSelectPropertyCustomReadTargetForCglibProxiedType() {
|
||||
|
||||
CustomConversions conversions = new CustomConversions(Arrays.asList(CustomObjectToStringConverter.INSTANCE));
|
||||
assertThat(conversions.hasCustomReadTarget(createProxyTypeFor(Object.class), String.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void registersConverterFactoryCorrectly() {
|
||||
|
||||
CustomConversions customConversions = new CustomConversions(
|
||||
@@ -207,10 +165,7 @@ public class CustomConversionsUnitTests {
|
||||
assertThat(customConversions.getCustomWriteTarget(String.class, SimpleDateFormat.class)).isNotNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void registersConvertersForJsr310() {
|
||||
|
||||
CustomConversions customConversions = new CustomConversions();
|
||||
@@ -218,10 +173,7 @@ public class CustomConversionsUnitTests {
|
||||
assertThat(customConversions.hasCustomWriteTarget(java.time.LocalDateTime.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void registersConvertersForThreeTenBackPort() {
|
||||
|
||||
CustomConversions customConversions = new CustomConversions();
|
||||
@@ -229,10 +181,7 @@ public class CustomConversionsUnitTests {
|
||||
assertThat(customConversions.hasCustomWriteTarget(org.threeten.bp.LocalDateTime.class)).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void registersConvertersForJoda() {
|
||||
|
||||
CustomConversions customConversions = new CustomConversions();
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,7 +15,9 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.convert;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
import static org.assertj.core.api.Assertions.*;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
@@ -53,8 +55,6 @@ import com.datastax.driver.core.querybuilder.QueryBuilder;
|
||||
import com.datastax.driver.core.querybuilder.Select;
|
||||
import com.datastax.driver.core.querybuilder.Update;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* Integration tests for UDT types through {@link MappingCassandraConverter}.
|
||||
*
|
||||
@@ -122,10 +122,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldReadMappedUdt() {
|
||||
|
||||
session.execute("INSERT INTO addressbook (id, currentaddress) " + "VALUES ('1', "
|
||||
@@ -142,10 +139,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
assertThat(address.getStreetLines()).contains("Heckenpfad", "14");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteMappedUdt() {
|
||||
|
||||
AddressUserType addressUserType = new AddressUserType();
|
||||
@@ -164,10 +158,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
+ "VALUES (null,{zip:'69469',city:'Weinheim',streetlines:['Heckenpfad','14']},'1',null);");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldReadMappedUdtCollection() {
|
||||
|
||||
session.execute("INSERT INTO addressbook (id, previousaddresses) " + "VALUES ('1', "
|
||||
@@ -185,10 +176,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
assertThat(address.getStreetLines()).isEmpty();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteMappedUdtCollection() {
|
||||
|
||||
AddressUserType addressUserType = new AddressUserType();
|
||||
@@ -207,10 +195,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
+ "VALUES (null,null,'1',[{zip:'69469',city:'Weinheim',streetlines:['Heckenpfad','14']}]);");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldReadUdt() {
|
||||
|
||||
session.execute("INSERT INTO addressbook (id, alternate) " + "VALUES ('1', "
|
||||
@@ -224,10 +209,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
assertThat(addressBook.getAlternate().getString("zip")).isEqualTo("69469");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteUdt() {
|
||||
|
||||
CassandraPersistentEntity<?> persistentEntity = converter.getMappingContext()
|
||||
@@ -248,10 +230,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
+ "VALUES ({zip:'69469',city:'Weinheim',streetlines:['Heckenpfad','14']},null,'1',null);");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteUdtPk() {
|
||||
|
||||
AddressUserType addressUserType = new AddressUserType();
|
||||
@@ -269,10 +248,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
"INSERT INTO addressbook (id) " + "VALUES ({zip:'69469',city:'Weinheim',streetlines:['Heckenpfad','14']});");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteMappedUdtPk() {
|
||||
|
||||
CassandraPersistentEntity<?> persistentEntity = converter.getMappingContext()
|
||||
@@ -292,10 +268,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
"INSERT INTO addressbook (id) " + "VALUES ({zip:'69469',city:'Weinheim',streetlines:['Heckenpfad','14']});");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldReadUdtWithCustomConversion() {
|
||||
|
||||
session.execute("INSERT INTO bank (id, currency) " + "VALUES ('1', {currency:'EUR'});");
|
||||
@@ -307,10 +280,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
assertThat(addressBook.getCurrency().getCurrencyCode()).isEqualTo("EUR");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldReadUdtListWithCustomConversion() {
|
||||
|
||||
session.execute("INSERT INTO bank (id, othercurrencies) " + "VALUES ('1', [{currency:'EUR'}]);");
|
||||
@@ -321,10 +291,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
assertThat(addressBook.getOtherCurrencies()).hasSize(1).contains(Currency.getInstance("EUR"));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteUdtWithCustomConversion() {
|
||||
|
||||
Bank bank = new Bank();
|
||||
@@ -333,13 +300,11 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
Insert insert = QueryBuilder.insertInto("bank");
|
||||
converter.write(bank, insert);
|
||||
|
||||
assertThat(insert.toString()).isEqualTo("INSERT INTO bank (currency,id,othercurrencies) VALUES ({currency:'EUR'},null,null);");
|
||||
assertThat(insert.toString())
|
||||
.isEqualTo("INSERT INTO bank (currency,id,othercurrencies) VALUES ({currency:'EUR'},null,null);");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteUdtUpdateWherePrimaryKeyWithCustomConversion() {
|
||||
|
||||
Money money = new Money();
|
||||
@@ -351,10 +316,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
assertThat(update.toString()).isEqualTo("UPDATE money WHERE currency={currency:'EUR'};");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteUdtUpdateAssignmentsWithCustomConversion() {
|
||||
|
||||
MoneyTransfer money = new MoneyTransfer();
|
||||
@@ -367,10 +329,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
assertThat(update.toString()).isEqualTo("UPDATE money SET currency={currency:'EUR'} WHERE id='1';");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteUdtSelectWherePrimaryKeyWithCustomConversion() {
|
||||
|
||||
Money money = new Money();
|
||||
@@ -382,10 +341,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
assertThat(select.toString()).isEqualTo("SELECT * FROM money WHERE currency={currency:'EUR'};");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteUdtDeleteWherePrimaryKeyWithCustomConversion() {
|
||||
|
||||
Money money = new Money();
|
||||
@@ -397,10 +353,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
assertThat(delete.toString()).isEqualTo("DELETE FROM money WHERE currency={currency:'EUR'};");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteUdtListWithCustomConversion() {
|
||||
|
||||
Bank bank = new Bank();
|
||||
@@ -409,13 +362,11 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
Insert insert = QueryBuilder.insertInto("bank");
|
||||
converter.write(bank, insert);
|
||||
|
||||
assertThat(insert.toString()).isEqualTo("INSERT INTO bank (currency,id,othercurrencies) VALUES (null,null,[{currency:'EUR'}]);");
|
||||
assertThat(insert.toString())
|
||||
.isEqualTo("INSERT INTO bank (currency,id,othercurrencies) VALUES (null,null,[{currency:'EUR'}]);");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldReadNestedUdt() {
|
||||
|
||||
session.execute("INSERT INTO car (id, engine) VALUES ('1', {manufacturer: {name:'a good one'}});");
|
||||
@@ -428,10 +379,7 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
assertThat(car.getEngine().getManufacturer().getName()).isEqualTo("a good one");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldWriteNestedUdt() {
|
||||
|
||||
session.execute("INSERT INTO car (id, engine) VALUES ('1', {manufacturer: {name:'a good one'}});");
|
||||
@@ -449,7 +397,8 @@ public class MappingCassandraConverterUDTIntegrationTests extends AbstractSpring
|
||||
Insert insert = QueryBuilder.insertInto("car");
|
||||
converter.write(car, insert);
|
||||
|
||||
assertThat(insert.toString()).isEqualTo("INSERT INTO car (engine,id) VALUES ({manufacturer:{name:'a good one'}},'1');");
|
||||
assertThat(insert.toString())
|
||||
.isEqualTo("INSERT INTO car (engine,id) VALUES ({manufacturer:{name:'a good one'}},'1');");
|
||||
}
|
||||
|
||||
@Table
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -109,10 +109,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
mappingCassandraConverter.afterPropertiesSet();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-260
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-260
|
||||
public void insertEnumShouldMapToString() {
|
||||
|
||||
WithEnumColumns withEnumColumns = new WithEnumColumns();
|
||||
@@ -126,10 +123,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getValues(insert)).contains("MINT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-260
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-260
|
||||
public void insertEnumDoesNotMapToOrdinalBeforeSpring43() {
|
||||
|
||||
assumeTrue(Version.parse(SpringVersion.getVersion()).isLessThan(VERSION_4_3));
|
||||
@@ -144,10 +138,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
mappingCassandraConverter.write(unsupportedEnumToOrdinalMapping, insert);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-255
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-255
|
||||
public void insertEnumMapsToOrdinalWithSpring43AndHiger() {
|
||||
|
||||
assumeTrue(Version.parse(SpringVersion.getVersion()).isGreaterThanOrEqualTo(VERSION_4_3));
|
||||
@@ -162,10 +153,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getValues(insert)).contains((Object) Integer.valueOf(Condition.USED.ordinal()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-260
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-260
|
||||
public void insertEnumAsPrimaryKeyShouldMapToString() {
|
||||
|
||||
EnumPrimaryKey key = new EnumPrimaryKey();
|
||||
@@ -178,10 +166,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getValues(insert)).contains((Object) "MINT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-260
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-260
|
||||
public void insertEnumInCompositePrimaryKeyShouldMapToString() {
|
||||
|
||||
EnumCompositePrimaryKey key = new EnumCompositePrimaryKey();
|
||||
@@ -197,10 +182,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getValues(insert)).contains((Object) "MINT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-260
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-260
|
||||
public void updateEnumShouldMapToString() {
|
||||
|
||||
WithEnumColumns withEnumColumns = new WithEnumColumns();
|
||||
@@ -213,10 +195,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getAssignmentValues(update)).contains((Object) "MINT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-260
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-260
|
||||
public void updateEnumAsPrimaryKeyShouldMapToString() {
|
||||
|
||||
EnumPrimaryKey key = new EnumPrimaryKey();
|
||||
@@ -229,10 +208,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWhereValues(update)).contains((Object) "MINT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-260
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-260
|
||||
public void updateEnumInCompositePrimaryKeyShouldMapToString() {
|
||||
|
||||
EnumCompositePrimaryKey key = new EnumCompositePrimaryKey();
|
||||
@@ -248,10 +224,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWhereValues(update)).contains((Object) "MINT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-260
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-260
|
||||
public void whereEnumAsPrimaryKeyShouldMapToString() {
|
||||
|
||||
EnumPrimaryKey key = new EnumPrimaryKey();
|
||||
@@ -264,10 +237,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWhereValues(where)).contains((Object) "MINT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-260
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-260
|
||||
public void whereEnumInCompositePrimaryKeyShouldMapToString() {
|
||||
|
||||
EnumCompositePrimaryKey key = new EnumCompositePrimaryKey();
|
||||
@@ -283,10 +253,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWhereValues(where)).contains((Object) "MINT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldReadStringCorrectly() {
|
||||
|
||||
when(rowMock.getString(0)).thenReturn("foo");
|
||||
@@ -296,10 +263,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo("foo");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldReadIntegerCorrectly() {
|
||||
|
||||
when(rowMock.getObject(0)).thenReturn(2);
|
||||
@@ -309,10 +273,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(2);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldReadLongCorrectly() {
|
||||
|
||||
when(rowMock.getObject(0)).thenReturn(2);
|
||||
@@ -322,10 +283,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(2L);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldReadDoubleCorrectly() {
|
||||
|
||||
when(rowMock.getObject(0)).thenReturn(2D);
|
||||
@@ -335,10 +293,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(2D);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldReadFloatCorrectly() {
|
||||
|
||||
when(rowMock.getObject(0)).thenReturn(2F);
|
||||
@@ -348,10 +303,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(2F);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldReadBigIntegerCorrectly() {
|
||||
|
||||
when(rowMock.getObject(0)).thenReturn(BigInteger.valueOf(2));
|
||||
@@ -361,10 +313,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(BigInteger.valueOf(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldReadBigDecimalCorrectly() {
|
||||
|
||||
when(rowMock.getObject(0)).thenReturn(BigDecimal.valueOf(2));
|
||||
@@ -374,10 +323,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(BigDecimal.valueOf(2));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldReadUUIDCorrectly() {
|
||||
|
||||
UUID uuid = UUID.randomUUID();
|
||||
@@ -389,10 +335,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(uuid);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldReadInetAddressCorrectly() throws UnknownHostException {
|
||||
|
||||
InetAddress localHost = InetAddress.getLocalHost();
|
||||
@@ -404,11 +347,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(localHost);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
* @see DATACASS-271
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280, DATACASS-271
|
||||
public void shouldReadTimestampCorrectly() {
|
||||
|
||||
Date date = new Date(1);
|
||||
@@ -420,10 +359,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-271
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-271
|
||||
public void shouldReadDateCorrectly() {
|
||||
|
||||
LocalDate date = LocalDate.fromDaysSinceEpoch(1234);
|
||||
@@ -435,10 +371,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(date);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-280
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-280
|
||||
public void shouldReadBooleanCorrectly() {
|
||||
|
||||
when(rowMock.getBool(0)).thenReturn(true);
|
||||
@@ -448,10 +381,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result).isEqualTo(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldReadLocalDateCorrectly() {
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -467,10 +397,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result.localDate.getMonthValue()).isEqualTo(now.getMonthValue());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldCreateInsertWithLocalDateCorrectly() {
|
||||
|
||||
java.time.LocalDate now = java.time.LocalDate.now();
|
||||
@@ -486,10 +413,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
.contains(LocalDate.fromYearMonthDay(now.getYear(), now.getMonthValue(), now.getDayOfMonth()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldCreateUpdateWithLocalDateCorrectly() {
|
||||
|
||||
java.time.LocalDate now = java.time.LocalDate.now();
|
||||
@@ -505,10 +429,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
.contains(LocalDate.fromYearMonthDay(now.getYear(), now.getMonthValue(), now.getDayOfMonth()));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldCreateInsertWithLocalDateListUsingCassandraDate() {
|
||||
|
||||
java.time.LocalDate now = java.time.LocalDate.now();
|
||||
@@ -527,10 +448,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(dates).contains(LocalDate.fromYearMonthDay(2010, 7, 4));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldCreateInsertWithLocalDateSetUsingCassandraDate() {
|
||||
|
||||
java.time.LocalDate now = java.time.LocalDate.now();
|
||||
@@ -549,10 +467,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(dates).contains(LocalDate.fromYearMonthDay(2010, 7, 4));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldReadLocalDateTimeUsingCassandraDateCorrectly() {
|
||||
|
||||
Row rowMock = RowMockUtil.newRowMock(column("id", "my-id", DataType.ascii()),
|
||||
@@ -567,10 +482,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result.localDate.getDayOfMonth()).isEqualTo(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldCreateInsertWithLocalDateUsingCassandraDateCorrectly() {
|
||||
|
||||
TypeWithLocalDateMappedToDate typeWithLocalDate = new TypeWithLocalDateMappedToDate();
|
||||
@@ -583,10 +495,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getValues(insert).contains(LocalDate.fromYearMonthDay(2010, 7, 4))).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldCreateUpdateWithLocalDateUsingCassandraDateCorrectly() {
|
||||
|
||||
TypeWithLocalDateMappedToDate typeWithLocalDate = new TypeWithLocalDateMappedToDate();
|
||||
@@ -599,10 +508,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getAssignmentValues(update)).contains(LocalDate.fromYearMonthDay(2010, 7, 4));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldReadLocalDateTimeCorrectly() {
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -618,10 +524,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result.localDateTime.getMinute()).isEqualTo(now.getMinute());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldReadInstantCorrectly() {
|
||||
|
||||
LocalDateTime now = LocalDateTime.now();
|
||||
@@ -636,10 +539,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result.instant.getEpochSecond()).isEqualTo(instant.getEpochSecond());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldReadZoneIdCorrectly() {
|
||||
|
||||
Row rowMock = RowMockUtil.newRowMock(column("id", "my-id", DataType.ascii()),
|
||||
@@ -651,10 +551,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result.zoneId.getId()).isEqualTo("Europe/Paris");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldReadJodaLocalDateTimeUsingCassandraDateCorrectly() {
|
||||
|
||||
Row rowMock = RowMockUtil.newRowMock(column("id", "my-id", DataType.ascii()),
|
||||
@@ -669,10 +566,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result.localDate.getDayOfMonth()).isEqualTo(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldCreateInsertWithJodaLocalDateUsingCassandraDateCorrectly() {
|
||||
|
||||
TypeWithJodaLocalDateMappedToDate typeWithLocalDate = new TypeWithJodaLocalDateMappedToDate();
|
||||
@@ -685,10 +579,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getValues(insert).contains(LocalDate.fromYearMonthDay(2010, 7, 4))).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldCreateUpdateWithJodaLocalDateUsingCassandraDateCorrectly() {
|
||||
|
||||
TypeWithJodaLocalDateMappedToDate typeWithLocalDate = new TypeWithJodaLocalDateMappedToDate();
|
||||
@@ -701,10 +592,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getAssignmentValues(update)).contains(LocalDate.fromYearMonthDay(2010, 7, 4));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldReadThreeTenBpLocalDateTimeUsingCassandraDateCorrectly() {
|
||||
|
||||
Row rowMock = RowMockUtil.newRowMock(column("id", "my-id", DataType.ascii()),
|
||||
@@ -719,10 +607,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(result.localDate.getDayOfMonth()).isEqualTo(4);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldCreateInsertWithThreeTenBpLocalDateUsingCassandraDateCorrectly() {
|
||||
|
||||
TypeWithThreeTenBpLocalDateMappedToDate typeWithLocalDate = new TypeWithThreeTenBpLocalDateMappedToDate();
|
||||
@@ -735,10 +620,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getValues(insert).contains(LocalDate.fromYearMonthDay(2010, 7, 4))).isTrue();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-296
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-296
|
||||
public void shouldCreateUpdateWithThreeTenBpLocalDateUsingCassandraDateCorrectly() {
|
||||
|
||||
TypeWithThreeTenBpLocalDateMappedToDate typeWithLocalDate = new TypeWithThreeTenBpLocalDateMappedToDate();
|
||||
@@ -751,10 +633,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getAssignmentValues(update)).contains(LocalDate.fromYearMonthDay(2010, 7, 4));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-206
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-206
|
||||
public void updateShouldUseSpecifiedColumnNames() {
|
||||
|
||||
UserToken userToken = new UserToken();
|
||||
@@ -772,10 +651,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(update)).containsEntry("user_id", userToken.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-206
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-206
|
||||
public void deleteShouldUseSpecifiedColumnNames() {
|
||||
|
||||
UserToken userToken = new UserToken();
|
||||
@@ -791,10 +667,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("user_id", userToken.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteWhereConditionUsingPlainId() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -804,10 +677,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("id", "42");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteWhereConditionUsingEntity() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -820,10 +690,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("id", "42");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-308
|
||||
public void shouldFailWriteWhereConditionUsingEntityWithNullId() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -831,10 +698,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
mappingCassandraConverter.write(new Person(), delete.where(), mappingContext.getPersistentEntity(Person.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteWhereConditionUsingMapId() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -844,10 +708,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("id", "42");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteWhereConditionForCompositeKeyUsingEntity() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -863,10 +724,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("lastname", "White");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteWhereConditionForCompositeKeyUsingMapId() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -878,10 +736,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("lastname", "White");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteWhereConditionForMapIdKeyUsingEntity() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -896,10 +751,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("lastname", "White");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteEnumWhereCondition() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -910,10 +762,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("condition", "MINT");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteWhereConditionForMapIdKeyUsingMapId() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -925,10 +774,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("lastname", "White");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteWhereConditionForTypeWithPkClassKeyUsingEntity() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -946,10 +792,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("lastname", "White");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-308
|
||||
public void shouldFailWritingWhereConditionForTypeWithPkClassKeyUsingEntityWithNullId() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -958,10 +801,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
mappingContext.getPersistentEntity(TypeWithKeyClass.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteWhereConditionForTypeWithPkClassKeyUsingKey() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -976,10 +816,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("lastname", "White");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-308
|
||||
public void shouldWriteWhereConditionForTypeWithPkClassKeyUsingMapId() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
@@ -991,10 +828,7 @@ public class MappingCassandraConverterUnitTests {
|
||||
assertThat(getWherePredicates(delete)).containsEntry("lastname", "White");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-308
|
||||
*/
|
||||
@Test(expected = IllegalArgumentException.class)
|
||||
@Test(expected = IllegalArgumentException.class) // DATACASS-308
|
||||
public void shouldFailWhereConditionForTypeWithPkClassKeyUsingMapIdHavingUnknownProperty() {
|
||||
|
||||
Delete delete = QueryBuilder.delete().from("table");
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -53,10 +53,7 @@ public class CassandraBatchTemplateIntegrationTests extends AbstractKeyspaceCrea
|
||||
SchemaTestUtils.truncate(FlatGroup.class, template);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-288
|
||||
public void shouldInsertEntities() {
|
||||
|
||||
Group walter = new Group(new GroupKey("users", "0x1", "walter"));
|
||||
@@ -70,10 +67,7 @@ public class CassandraBatchTemplateIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(loaded.getId().getUsername()).isEqualTo(walter.getId().getUsername());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-288
|
||||
public void shouldInsertCollectionOfEntities() {
|
||||
|
||||
Group walter = new Group(new GroupKey("users", "0x1", "walter"));
|
||||
@@ -87,10 +81,7 @@ public class CassandraBatchTemplateIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(loaded.getId().getUsername()).isEqualTo(walter.getId().getUsername());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-288
|
||||
public void shouldUpdateEntities() {
|
||||
|
||||
Group walter = template.insert(new Group(new GroupKey("users", "0x1", "walter")));
|
||||
@@ -107,10 +98,7 @@ public class CassandraBatchTemplateIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(loaded.getEmail()).isEqualTo(walter.getEmail());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-288
|
||||
public void shouldUpdateCollectionOfEntities() {
|
||||
|
||||
Group walter = template.insert(new Group(new GroupKey("users", "0x1", "walter")));
|
||||
@@ -127,10 +115,7 @@ public class CassandraBatchTemplateIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(loaded.getEmail()).isEqualTo(walter.getEmail());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-288
|
||||
public void shouldUpdatesCollectionOfEntities() {
|
||||
|
||||
FlatGroup walter = template.insert(new FlatGroup("users", "0x1", "walter"));
|
||||
@@ -147,10 +132,7 @@ public class CassandraBatchTemplateIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(loaded.getEmail()).isEqualTo(walter.getEmail());
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-288
|
||||
public void shouldDeleteEntities() {
|
||||
|
||||
Group walter = template.insert(new Group(new GroupKey("users", "0x1", "walter")));
|
||||
@@ -165,10 +147,7 @@ public class CassandraBatchTemplateIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(loaded).isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-288
|
||||
public void shouldDeleteCollectionOfEntities() {
|
||||
|
||||
Group walter = template.insert(new Group(new GroupKey("users", "0x1", "walter")));
|
||||
@@ -183,10 +162,7 @@ public class CassandraBatchTemplateIntegrationTests extends AbstractKeyspaceCrea
|
||||
assertThat(loaded).isNull();
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-288
|
||||
public void shouldApplyTimestampToAllEntities() {
|
||||
|
||||
Group walter = new Group(new GroupKey("users", "0x1", "walter"));
|
||||
@@ -209,10 +185,7 @@ public class CassandraBatchTemplateIntegrationTests extends AbstractKeyspaceCrea
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = IllegalStateException.class) // DATACASS-288
|
||||
public void shouldNotExecuteTwice() {
|
||||
|
||||
CassandraBatchOperations batchOperations = new CassandraBatchTemplate(template);
|
||||
@@ -223,10 +196,7 @@ public class CassandraBatchTemplateIntegrationTests extends AbstractKeyspaceCrea
|
||||
fail("Missing IllegalStateException");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test(expected = IllegalStateException.class)
|
||||
@Test(expected = IllegalStateException.class) // DATACASS-288
|
||||
public void shouldNotAllowModificationAfterExecution() {
|
||||
|
||||
CassandraBatchOperations batchOperations = new CassandraBatchTemplate(template);
|
||||
|
||||
@@ -62,10 +62,7 @@ public class CassandraPersistentEntitySchemaCreatorUnitTests {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-172
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-172
|
||||
public void shouldCreateTypesInOrder() {
|
||||
|
||||
context.getPersistentEntity(MoonType.class);
|
||||
|
||||
@@ -58,9 +58,7 @@ public class CassandraPersistentEntitySchemaDropperUnitTests {
|
||||
|
||||
BasicCassandraMappingContext context = new BasicCassandraMappingContext();
|
||||
|
||||
/**
|
||||
* @see DATACASS-355
|
||||
*/
|
||||
// DATACASS-355
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
|
||||
@@ -79,10 +77,7 @@ public class CassandraPersistentEntitySchemaDropperUnitTests {
|
||||
when(contact.getName()).thenReturn("contact");
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-355
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-355
|
||||
public void shouldDropTypes() throws Exception {
|
||||
|
||||
context.setInitialEntitySet(new HashSet<Class<?>>(Arrays.asList(MoonType.class, UniverseType.class)));
|
||||
@@ -102,10 +97,7 @@ public class CassandraPersistentEntitySchemaDropperUnitTests {
|
||||
verifyNoMoreInteractions(operations);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-355
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-355
|
||||
public void dropUserTypesShouldRetainUnusedTypes() {
|
||||
|
||||
context.setInitialEntitySet(new HashSet<Class<?>>(Arrays.asList(MoonType.class, UniverseType.class)));
|
||||
@@ -124,10 +116,7 @@ public class CassandraPersistentEntitySchemaDropperUnitTests {
|
||||
verifyNoMoreInteractions(operations);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see DATACASS-355
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-355
|
||||
public void shouldDropTables() throws Exception {
|
||||
|
||||
context.setInitialEntitySet(Collections.singleton(Person.class));
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2013-2016 the original author or authors
|
||||
* Copyright 2013-2017 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.
|
||||
@@ -70,10 +70,7 @@ public class CassandraTemplateUnitTests {
|
||||
return new CassandraConverterRowCallback<T>(converter, type);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-310">DATACASS-310</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-310
|
||||
public void processResultSetHandlesResultSetRows() {
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
|
||||
@@ -101,10 +98,7 @@ public class CassandraTemplateUnitTests {
|
||||
verify(mockCassandraConverter, times(1)).read(eq(Integer.class), eq(mockRowThree));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-310">DATACASS-310</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-310
|
||||
public void processResultSetHandlesSingleElementResultSet() {
|
||||
Select mockSelect = mock(Select.class);
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
@@ -124,10 +118,7 @@ public class CassandraTemplateUnitTests {
|
||||
verify(mockCassandraConverter, times(1)).read(eq(String.class), eq(mockRow));
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-310">DATACASS-310</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-310
|
||||
public void processResultSetHandlesEmptyResultSet() {
|
||||
CassandraConverter mockCassandraConverter = mock(CassandraConverter.class);
|
||||
ResultSet mockResultSet = mock(ResultSet.class);
|
||||
@@ -145,10 +136,7 @@ public class CassandraTemplateUnitTests {
|
||||
verifyZeroInteractions(mockCassandraConverter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-310">DATACASS-310</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-310
|
||||
public void processResultSetHandlesNullResultSet() {
|
||||
CassandraConverter mockCassandraConverter = mock(CassandraConverter.class);
|
||||
|
||||
@@ -163,10 +151,7 @@ public class CassandraTemplateUnitTests {
|
||||
verifyZeroInteractions(mockCassandraConverter);
|
||||
}
|
||||
|
||||
/**
|
||||
* @see <a href="https://jira.spring.io/browse/DATACASS-288">DATACASS-288</a>
|
||||
*/
|
||||
@Test
|
||||
@Test // DATACASS-288
|
||||
public void batchOperationsShouldCallSession() {
|
||||
template.batchOps().insert(new Book()).execute();
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,6 +15,11 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.domain;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.math.BigInteger;
|
||||
import java.net.InetAddress;
|
||||
@@ -32,11 +37,6 @@ import org.springframework.data.cassandra.test.integration.mapping.types.Cassand
|
||||
|
||||
import com.datastax.driver.core.DataType.Name;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import lombok.NonNull;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,14 +15,14 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,15 +15,16 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
* @see http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling
|
||||
* @see <a href=
|
||||
* "http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling">http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling</a>
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,15 +15,16 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.domain;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKey;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKey;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
* @see http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling
|
||||
* @see <a href=
|
||||
* "http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling">http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling</a>
|
||||
*/
|
||||
@Table
|
||||
@Data
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,19 +15,20 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.domain;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
* @see http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling
|
||||
* @see <a href=
|
||||
* "http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling">http://www.datastax.com/dev/blog/basic-rules-of-cassandra-data-modeling</a>
|
||||
*/
|
||||
@PrimaryKeyClass
|
||||
@Data
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,11 +15,11 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
* Copyright 2016-2017 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.
|
||||
@@ -15,12 +15,12 @@
|
||||
*/
|
||||
package org.springframework.data.cassandra.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author Mark Paluch
|
||||
*/
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user