DATACASS-99 - completed
This commit is contained in:
@@ -30,7 +30,7 @@ import org.springframework.data.cassandra.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.CassandraOperations;
|
||||
import org.springframework.data.cassandra.core.CassandraTemplate;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.DefaultCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import com.datastax.driver.core.Session;
|
||||
@@ -41,7 +41,7 @@ import com.datastax.driver.core.Session;
|
||||
* interface types via their default implementation types:
|
||||
* <ul>
|
||||
* <li>{@link CassandraOperations} via {@link CassandraTemplate}</li>
|
||||
* <li>{@link CassandraMappingContext} via {@link DefaultCassandraMappingContext}</li>
|
||||
* <li>{@link CassandraMappingContext} via {@link BasicCassandraMappingContext}</li>
|
||||
* <li> {@link CassandraConverter} via {@link MappingCassandraConverter}</li>
|
||||
* </ul>
|
||||
* <p/>
|
||||
@@ -52,7 +52,7 @@ import com.datastax.driver.core.Session;
|
||||
* <p/>
|
||||
* If a single definition of a required type is present, then it is used. For example, if there is already a
|
||||
* {@link CassandraMappingContext} definition present, then it will be used in the
|
||||
* {@link DefaultCassandraMappingContext} bean definition.
|
||||
* {@link BasicCassandraMappingContext} bean definition.
|
||||
* <p/>
|
||||
* It requires that a single {@link Session} or {@link CassandraDataSessionFactoryBean} definition be present. As
|
||||
* described above, multiple {@link Session} definitions, multiple {@link CassandraDataSessionFactoryBean} definitions,
|
||||
@@ -168,7 +168,7 @@ public class CassandraMappingBeanFactoryPostProcessor implements BeanDefinitionR
|
||||
protected BeanDefinitionHolder regsiterDefaultContext(BeanDefinitionRegistry registry) {
|
||||
|
||||
BeanDefinitionHolder contextBean = new BeanDefinitionHolder(BeanDefinitionBuilder.genericBeanDefinition(
|
||||
DefaultCassandraMappingContext.class).getBeanDefinition(), DefaultDataBeanNames.CONTEXT);
|
||||
BasicCassandraMappingContext.class).getBeanDefinition(), DefaultDataBeanNames.CONTEXT);
|
||||
|
||||
registry.registerBeanDefinition(contextBean.getBeanName(), contextBean.getBeanDefinition());
|
||||
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.data.cassandra.convert.MappingCassandraConverter;
|
||||
import org.springframework.data.cassandra.core.CassandraAdminOperations;
|
||||
import org.springframework.data.cassandra.core.CassandraAdminTemplate;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.DefaultCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
import org.springframework.data.mapping.context.MappingContext;
|
||||
|
||||
@@ -93,7 +93,7 @@ public abstract class AbstractSpringDataCassandraConfiguration extends AbstractC
|
||||
@Bean
|
||||
public CassandraMappingContext cassandraMapping() throws ClassNotFoundException {
|
||||
|
||||
DefaultCassandraMappingContext bean = new DefaultCassandraMappingContext();
|
||||
BasicCassandraMappingContext bean = new BasicCassandraMappingContext();
|
||||
bean.setInitialEntitySet(CassandraEntityClassScanner.scan(getEntityBasePackages()));
|
||||
bean.setBeanClassLoader(beanClassLoader);
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.beans.factory.support.BeanDefinitionBuilder;
|
||||
import org.springframework.beans.factory.xml.AbstractSingleBeanDefinitionParser;
|
||||
import org.springframework.beans.factory.xml.ParserContext;
|
||||
import org.springframework.data.cassandra.config.DefaultDataBeanNames;
|
||||
import org.springframework.data.cassandra.mapping.DefaultCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.EntityMapping;
|
||||
import org.springframework.data.cassandra.mapping.Mapping;
|
||||
import org.springframework.data.cassandra.mapping.PropertyMapping;
|
||||
@@ -43,7 +43,7 @@ public class CassandraMappingContextParser extends AbstractSingleBeanDefinitionP
|
||||
|
||||
@Override
|
||||
protected Class<?> getBeanClass(Element element) {
|
||||
return DefaultCassandraMappingContext.class;
|
||||
return BasicCassandraMappingContext.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -51,14 +51,14 @@ import com.datastax.driver.core.TableMetadata;
|
||||
* @author Alex Shvid
|
||||
* @author Matthew T. Adams
|
||||
*/
|
||||
public class DefaultCassandraMappingContext extends
|
||||
public class BasicCassandraMappingContext extends
|
||||
AbstractMappingContext<CassandraPersistentEntity<?>, CassandraPersistentProperty> implements
|
||||
CassandraMappingContext, ApplicationContextAware {
|
||||
|
||||
protected ApplicationContext context;
|
||||
protected Mapping mapping = new Mapping();
|
||||
protected ClassLoader beanClassLoader;
|
||||
protected CassandraPersistentEntityMetadataVerifier verifier = new DefaultCassandraPersistentEntityMetadataVerifier();
|
||||
protected CassandraPersistentEntityMetadataVerifier verifier = new BasicCassandraPersistentEntityMetadataVerifier();
|
||||
|
||||
// useful caches
|
||||
protected Map<CqlIdentifier, Set<CassandraPersistentEntity<?>>> entitySetsByTableName = new HashMap<CqlIdentifier, Set<CassandraPersistentEntity<?>>>();
|
||||
@@ -67,9 +67,9 @@ public class DefaultCassandraMappingContext extends
|
||||
protected Map<Class<?>, CassandraPersistentEntity<?>> entitiesByType = new HashMap<Class<?>, CassandraPersistentEntity<?>>();
|
||||
|
||||
/**
|
||||
* Creates a new {@link DefaultCassandraMappingContext}.
|
||||
* Creates a new {@link BasicCassandraMappingContext}.
|
||||
*/
|
||||
public DefaultCassandraMappingContext() {
|
||||
public BasicCassandraMappingContext() {
|
||||
setSimpleTypeHolder(new CassandraSimpleTypeHolder());
|
||||
}
|
||||
|
||||
@@ -47,7 +47,7 @@ import org.springframework.util.StringUtils;
|
||||
public class BasicCassandraPersistentEntity<T> extends BasicPersistentEntity<T, CassandraPersistentProperty> implements
|
||||
CassandraPersistentEntity<T>, ApplicationContextAware {
|
||||
|
||||
protected static final CassandraPersistentEntityMetadataVerifier DEFAULT_VERIFIER = new DefaultCassandraPersistentEntityMetadataVerifier();
|
||||
protected static final CassandraPersistentEntityMetadataVerifier DEFAULT_VERIFIER = new BasicCassandraPersistentEntityMetadataVerifier();
|
||||
|
||||
protected CqlIdentifier tableName;
|
||||
protected CassandraMappingContext mappingContext;
|
||||
|
||||
@@ -33,9 +33,9 @@ import org.springframework.data.mapping.model.MappingException;
|
||||
* @author Matthew T Adams
|
||||
* @author David Webb
|
||||
*/
|
||||
public class DefaultCassandraPersistentEntityMetadataVerifier implements CassandraPersistentEntityMetadataVerifier {
|
||||
public class BasicCassandraPersistentEntityMetadataVerifier implements CassandraPersistentEntityMetadataVerifier {
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(DefaultCassandraPersistentEntityMetadataVerifier.class);
|
||||
private static final Logger log = LoggerFactory.getLogger(BasicCassandraPersistentEntityMetadataVerifier.class);
|
||||
|
||||
protected boolean strict = false;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class DefaultCassandraPersistentEntityMetadataVerifier implements Cassand
|
||||
public void verify(CassandraPersistentEntity<?> entity) throws MappingException {
|
||||
|
||||
VerifierMappingExceptions exceptions = new VerifierMappingExceptions(
|
||||
"Mapping Exceptions from DefaultCassandraPersistentEntityMetadataVerifier");
|
||||
"Mapping Exceptions from BasicCassandraPersistentEntityMetadataVerifier");
|
||||
|
||||
final List<CassandraPersistentProperty> idProperties = new ArrayList<CassandraPersistentProperty>();
|
||||
final List<CassandraPersistentProperty> compositePrimaryKeys = new ArrayList<CassandraPersistentProperty>();
|
||||
@@ -88,7 +88,7 @@ public interface CassandraMappingContext extends
|
||||
boolean contains(Class<?> type);
|
||||
|
||||
/**
|
||||
* Sets a verifier other than the {@link DefaultCassandraPersistentEntityMetadataVerifier}
|
||||
* Sets a verifier other than the {@link BasicCassandraPersistentEntityMetadataVerifier}
|
||||
*/
|
||||
void setVerifier(CassandraPersistentEntityMetadataVerifier verifier);
|
||||
}
|
||||
|
||||
@@ -27,6 +27,7 @@ import org.springframework.data.mapping.model.MappingException;
|
||||
* @author David Webb
|
||||
*
|
||||
*/
|
||||
@SuppressWarnings("serial")
|
||||
public class VerifierMappingExceptions extends MappingException {
|
||||
|
||||
Collection<MappingException> exceptions = new LinkedList<MappingException>();
|
||||
|
||||
@@ -33,7 +33,10 @@ import com.datastax.driver.core.TableMetadata;
|
||||
* @author Alex Shvid
|
||||
* @author David Webb
|
||||
* @author Matthew T. Adams
|
||||
*
|
||||
* @deprecated need to find a better place for this
|
||||
*/
|
||||
@Deprecated
|
||||
public abstract class CqlUtils {
|
||||
|
||||
/**
|
||||
|
||||
@@ -16,7 +16,7 @@ import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.mapping.Column;
|
||||
import org.springframework.data.cassandra.mapping.DefaultCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKey;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
@@ -24,7 +24,7 @@ import org.springframework.data.cassandra.mapping.Table;
|
||||
|
||||
public class ForceQuotedPropertiesSimpleIntegrationTests {
|
||||
|
||||
CassandraMappingContext context = new DefaultCassandraMappingContext();
|
||||
CassandraMappingContext context = new BasicCassandraMappingContext();
|
||||
|
||||
@Test
|
||||
public void testImplicit() {
|
||||
|
||||
@@ -26,7 +26,7 @@ import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.DefaultCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKey;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
@@ -44,7 +44,7 @@ public class BasicCassandraPersistentEntityVerifierIntegrationTest {
|
||||
@Before
|
||||
public void init() {
|
||||
|
||||
mappingContext = new DefaultCassandraMappingContext();
|
||||
mappingContext = new BasicCassandraMappingContext();
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.mapping.CassandraSimpleTypeHolder;
|
||||
import org.springframework.data.cassandra.mapping.Column;
|
||||
import org.springframework.data.cassandra.mapping.DefaultCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKey;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
@@ -119,7 +119,7 @@ public class CassandraCompositePrimaryKeyIntegrationTests {
|
||||
|
||||
@Before
|
||||
public void setup() {
|
||||
context = new DefaultCassandraMappingContext();
|
||||
context = new BasicCassandraMappingContext();
|
||||
thing = context.getPersistentEntity(ClassTypeInformation.from(Thing.class));
|
||||
key = context.getPersistentEntity(ClassTypeInformation.from(Key.class));
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ import static org.junit.Assert.assertTrue;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.DefaultCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKey;
|
||||
import org.springframework.data.cassandra.mapping.Table;
|
||||
import org.springframework.data.mapping.model.MappingException;
|
||||
@@ -43,7 +43,7 @@ public class MappingContextIntegrationTests {
|
||||
String key;
|
||||
}
|
||||
|
||||
DefaultCassandraMappingContext ctx = new DefaultCassandraMappingContext();
|
||||
BasicCassandraMappingContext ctx = new BasicCassandraMappingContext();
|
||||
|
||||
@Test(expected = MappingException.class)
|
||||
public void testGetPersistentEntityOfTransientType() {
|
||||
|
||||
@@ -25,20 +25,20 @@ import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.cassandra.config.CassandraEntityClassScanner;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.DefaultCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.test.integration.multipackagescanning.first.First;
|
||||
import org.springframework.data.cassandra.test.integration.multipackagescanning.second.Second;
|
||||
import org.springframework.data.cassandra.test.integration.multipackagescanning.third.Third;
|
||||
|
||||
public class MultipackageScanningIntegrationTests {
|
||||
|
||||
DefaultCassandraMappingContext mapping;
|
||||
BasicCassandraMappingContext mapping;
|
||||
String pkg = getClass().getPackage().getName();
|
||||
|
||||
@Before
|
||||
public void before() throws ClassNotFoundException {
|
||||
|
||||
mapping = new DefaultCassandraMappingContext();
|
||||
mapping = new BasicCassandraMappingContext();
|
||||
mapping.setInitialEntitySet(CassandraEntityClassScanner.scan(pkg + ".first", pkg + ".second"));
|
||||
|
||||
mapping.initialize();
|
||||
|
||||
@@ -27,7 +27,7 @@ import org.springframework.cassandra.core.PrimaryKeyType;
|
||||
import org.springframework.data.annotation.Id;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentEntity;
|
||||
import org.springframework.data.cassandra.mapping.CassandraPersistentProperty;
|
||||
import org.springframework.data.cassandra.mapping.DefaultCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.BasicCassandraMappingContext;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKey;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyClass;
|
||||
import org.springframework.data.cassandra.mapping.PrimaryKeyColumn;
|
||||
@@ -41,7 +41,7 @@ import org.springframework.data.mapping.PropertyHandler;
|
||||
public class BasicCassandraPersistentEntityOrderPropertiesTest {
|
||||
|
||||
private List<CassandraPersistentProperty> expected;
|
||||
private DefaultCassandraMappingContext mappingContext = new DefaultCassandraMappingContext();
|
||||
private BasicCassandraMappingContext mappingContext = new BasicCassandraMappingContext();
|
||||
|
||||
@Before
|
||||
public void init() {
|
||||
|
||||
Reference in New Issue
Block a user