DATACOUCH-135 - Migrate to Couchbase SDK 2.0 and add N1QL find method.
Adaptation were made to use SDK 2.0: - Reworked the configuration approach (more parts to be configured, like Environment, Cluster and Bucket) - Added a new xml schema for configuration of 2.0 version - Adapted the template - Added N1QL support in the template (findByN1QL) - Removed the cache package - Adapted the repository - Better separated Unit Tests from Integration Tests All integration and unit tests pass, except one (SimpleCouchbaseRepositoryTests.shouldFindCustom). Customisation of a ViewQuery will be addressed in another ticket.
This commit is contained in:
@@ -2,20 +2,18 @@
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:couchbase="http://www.springframework.org/schema/data/couchbase"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/data/couchbase http://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<context:property-placeholder location="classpath:/namespace/couchbase.properties"/>
|
||||
<couchbase:cluster id="clusterDefault" />
|
||||
|
||||
<couchbase:couchbase/>
|
||||
<couchbase:bucket id="bucketDefaultNoCluster" />
|
||||
|
||||
<couchbase:couchbase id="couchbase2" host="localhost" bucket="default" password=""/>
|
||||
<couchbase:bucket id="bucketDefault" cluster-ref="clusterDefault" />
|
||||
|
||||
<couchbase:translation-service objectMapper="myCustomObjectMapper"/>
|
||||
<couchbase:bucket id="bucketWithName" cluster-ref="clusterDefault" bucketName="toto" />
|
||||
|
||||
<bean id="myCustomObjectMapper" class="com.fasterxml.jackson.databind.ObjectMapper"/>
|
||||
<couchbase:bucket id="bucketWithNameAndPassword" cluster-ref="clusterDefault" bucketName="test" bucketPassword="123" />
|
||||
|
||||
<couchbase:couchbase id="couchbase3" host="${couchbase.host}" bucket="${couchbase.bucket}" password="${couchbase.password}" />
|
||||
</beans>
|
||||
</beans>
|
||||
26
src/test/resources/configurations/couchbaseCluster-bean.xml
Normal file
26
src/test/resources/configurations/couchbaseCluster-bean.xml
Normal file
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:couchbase="http://www.springframework.org/schema/data/couchbase"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/data/couchbase http://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<couchbase:env id="someEnv" retryStrategy="FailFast" />
|
||||
|
||||
<couchbase:cluster id="clusterDefault" />
|
||||
<couchbase:cluster id="clusterWithEnvRef" env-ref="someEnv"/>
|
||||
<couchbase:cluster id="clusterWithEnvInline">
|
||||
<couchbase:env managementTimeout="1"/>
|
||||
</couchbase:cluster>
|
||||
<couchbase:cluster id="clusterWithNodes">
|
||||
<couchbase:node>192.1.2.3</couchbase:node>
|
||||
<couchbase:node>192.4.5.6</couchbase:node>
|
||||
</couchbase:cluster>
|
||||
<couchbase:cluster id="clusterWithAll" env-ref="someEnv">
|
||||
<couchbase:env autoreleaseAfter="8"/>
|
||||
<couchbase:node>2.2.2.2</couchbase:node>
|
||||
<couchbase:node>4.4.4.4</couchbase:node>
|
||||
</couchbase:cluster>
|
||||
|
||||
</beans>
|
||||
48
src/test/resources/configurations/couchbaseEnv-bean.xml
Normal file
48
src/test/resources/configurations/couchbaseEnv-bean.xml
Normal file
@@ -0,0 +1,48 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:couchbase="http://www.springframework.org/schema/data/couchbase"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/data/couchbase http://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
|
||||
|
||||
<couchbase:env id="envWithFailFast" retryStrategy="FailFast" />
|
||||
|
||||
<couchbase:env id="envWithBestEffort" retryStrategy="BestEffort" />
|
||||
|
||||
<couchbase:env id="envWithNoDefault"
|
||||
managementTimeout="1"
|
||||
queryTimeout="2"
|
||||
viewTimeout="3"
|
||||
kvTimeout="4"
|
||||
connectTimeout="5"
|
||||
disconnectTimeout="6"
|
||||
dnsSrvEnabled="true"
|
||||
|
||||
dcpEnabled="false"
|
||||
sslEnabled="true"
|
||||
sslKeystoreFile="test"
|
||||
sslKeystorePassword="test"
|
||||
queryEnabled="true"
|
||||
queryPort="7"
|
||||
bootstrapHttpEnabled="false"
|
||||
bootstrapCarrierEnabled="false"
|
||||
bootstrapHttpDirectPort="8"
|
||||
bootstrapHttpSslPort="9"
|
||||
bootstrapCarrierDirectPort="10"
|
||||
bootstrapCarrierSslPort="11"
|
||||
ioPoolSize="12"
|
||||
computationPoolSize="13"
|
||||
responseBufferSize="14"
|
||||
requestBufferSize="15"
|
||||
kvEndpoints="16"
|
||||
viewEndpoints="17"
|
||||
queryEndpoints="18"
|
||||
retryStrategy="FailFast"
|
||||
maxRequestLifetime="19"
|
||||
keepAliveInterval="20"
|
||||
autoreleaseAfter="21"
|
||||
bufferPoolingEnabled="false"
|
||||
/>
|
||||
|
||||
</beans>
|
||||
@@ -1,23 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:couchbase="http://www.springframework.org/schema/data/couchbase"
|
||||
xmlns:data-repository="http://www.springframework.org/schema/data/repository"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/data/couchbase http://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/data/repository http://www.springframework.org/schema/data/repository/spring-repository.xsd">
|
||||
|
||||
<couchbase:couchbase id="cb-first" bucket="default" password="" host="localhost" />
|
||||
<couchbase:couchbase id="cb-second" bucket="default" password="" host="localhost" />
|
||||
|
||||
<couchbase:template id="cb-template-first" client-ref="cb-first" />
|
||||
<couchbase:template id="cb-template-second" client-ref="cb-second" />
|
||||
|
||||
<couchbase:repositories base-package="com.example" couchbase-template-ref="cb-template-first">
|
||||
<data-repository:include-filter type="regex" expression=".*ARepository" />
|
||||
</couchbase:repositories>
|
||||
|
||||
<couchbase:repositories base-package="com.example" couchbase-template-ref="cb-template-second">
|
||||
<data-repository:include-filter type="regex" expression=".*BRepository" />
|
||||
</couchbase:repositories>
|
||||
|
||||
</beans>
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:couchbase="http://www.springframework.org/schema/data/couchbase"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/data/couchbase http://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<couchbase:couchbase/>
|
||||
|
||||
<couchbase:template/>
|
||||
|
||||
</beans>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<beans xmlns="http://www.springframework.org/schema/beans"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xmlns:couchbase="http://www.springframework.org/schema/data/couchbase"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/data/couchbase http://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
|
||||
|
||||
<couchbase:couchbase/>
|
||||
|
||||
<couchbase:template translation-service-ref="myCustomTranslationService"/>
|
||||
|
||||
<bean id="myCustomTranslationService" class="org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService"/>
|
||||
|
||||
</beans>
|
||||
@@ -1,3 +0,0 @@
|
||||
couchbase.host=127.0.0.1
|
||||
couchbase.bucket=default
|
||||
couchbase.password=
|
||||
Reference in New Issue
Block a user