DATACOUCH-30 - ObjectMapper configuration must be supported
Allow for a custom ObjectMapper to be used.
This commit is contained in:
committed by
Michael Nitschinger
parent
51dea603de
commit
7d79d79e28
@@ -66,14 +66,12 @@ public class TestApplicationConfig extends AbstractCouchbaseConfiguration {
|
||||
return new BucketCreator(couchbaseHost(), couchbaseAdminUser(), couchbaseAdminPassword());
|
||||
}
|
||||
|
||||
@Override
|
||||
@Bean
|
||||
@Override
|
||||
@DependsOn("bucketCreator")
|
||||
public CouchbaseClient couchbaseClient() throws Exception {
|
||||
return new CouchbaseClient(
|
||||
Arrays.asList(new URI(couchbaseHost())), couchbaseBucket(), couchbasePassword());
|
||||
return new CouchbaseClient(Arrays.asList(new URI(couchbaseHost())), couchbaseBucket(), couchbasePassword());
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ import com.couchbase.client.CouchbaseClient;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Qualifier;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.data.couchbase.TestApplicationConfig;
|
||||
import org.springframework.data.couchbase.core.mapping.Document;
|
||||
@@ -47,14 +48,13 @@ public class AbstractCouchbaseConfigurationTests {
|
||||
@Test
|
||||
public void usesConfigClassPackageAsBaseMappingPackage() throws Exception {
|
||||
AbstractCouchbaseConfiguration config = new SampleCouchbaseConfiguration();
|
||||
|
||||
assertEquals(config.getMappingBasePackage(),
|
||||
SampleCouchbaseConfiguration.class.getPackage().getName());
|
||||
assertEquals(config.getMappingBasePackage(), SampleCouchbaseConfiguration.class.getPackage().getName());
|
||||
assertEquals(config.getInitialEntitySet().size(), 1);
|
||||
assertTrue(config.getInitialEntitySet().contains(Entity.class));
|
||||
}
|
||||
|
||||
class SampleCouchbaseConfiguration extends AbstractCouchbaseConfiguration {
|
||||
|
||||
@Bean
|
||||
@Override
|
||||
public CouchbaseClient couchbaseClient() throws Exception {
|
||||
@@ -64,5 +64,6 @@ public class AbstractCouchbaseConfigurationTests {
|
||||
|
||||
@Document
|
||||
static class Entity {
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,4 +50,14 @@ public class CouchbaseTemplateParserIntegrationTests {
|
||||
factory.getBean("couchbaseTemplate");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void readsCouchbaseTemplateWithTranslationServiceAttributesCorrectly() {
|
||||
reader.loadBeanDefinitions(new ClassPathResource("namespace/couchbase-template-with-translation-service-bean.xml"));
|
||||
|
||||
BeanDefinition definition = factory.getBeanDefinition("couchbaseTemplate");
|
||||
assertEquals(2, definition.getConstructorArgumentValues().getArgumentCount());
|
||||
|
||||
factory.getBean("couchbaseTemplate");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user