DATACOUCH-451 - Should be able to run integration tests and all unit tests

This change enables running the integration tests with the command:

    mvn verify

Update the integration tests so they compile and pass. Rename them according
to Spring Data convention (*IntegrationTests.java) so they are executed by the
failsafe plugin instead of the surefire plugin. Move them to same folder as
unit tests according to Spring Data convention.

Update the surefire plugin configuration to include unit tests in classes
named `*Test` as well as `*Tests`. Prior to this change about half of the unit
tests were being ignored.

Integration test changes
========================

Use static factory methods for Sort and PageRequest instead of calling the
constructors which are now private.

Import EvaluationContextExtension from its new package. Remove reference to
deprecated EvaluationContextExtensionSupport.

Retry all calls to `getRepository` because otherwise they may fail due to
concurrent index creation.

Fix test `shouldDeriveViewParameters` to assume results are unordered.

Fail fast if the `server.properties` resource is missing.

Increase query and view timeouts; container is a big sluggish sometimes.
This commit is contained in:
David Nault
2019-05-20 18:46:21 -07:00
committed by GitHub
parent d25531078d
commit 9080c2dede
113 changed files with 217 additions and 133 deletions

View File

@@ -0,0 +1,16 @@
<?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 https://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
<couchbase:env/>
<couchbase:cluster/>
<couchbase:clusterInfo login="protected" password="password"/>
<couchbase:bucket username="protected" bucketName="protected" bucketPassword="password"/>
<couchbase:template id="template" consistency="EVENTUALLY_CONSISTENT"/>
<couchbase:template id="templateBad" consistency="BadConsistency"/>
</beans>

View File

@@ -0,0 +1,18 @@
<?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 https://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/data/repository https://www.springframework.org/schema/data/repository/spring-repository.xsd">
<couchbase:env/>
<couchbase:cluster/>
<couchbase:clusterInfo login="protected" password="password"/>
<couchbase:bucket id="cb-first" bucketName="protected" username="protected" bucketPassword="password"/>
<couchbase:bucket id="cb-second" bucketName="protected" username="protected" bucketPassword="password"/>
<couchbase:template id="cb-template-first" bucket-ref="cb-first" />
<couchbase:template id="cb-template-second" bucket-ref="cb-second" />
</beans>

View File

@@ -0,0 +1,19 @@
<?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 https://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
<couchbase:env/>
<couchbase:cluster/>
<couchbase:clusterInfo login="protected" password="password"/>
<couchbase:bucket username="protected" bucketName="protected" bucketPassword="password"/>
<couchbase:template/>
<couchbase:indexManager/>
<couchbase:repositories base-package="org.springframework.data.couchbase.repository.xmlconfig"/>
</beans>

View File

@@ -0,0 +1,15 @@
<?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 https://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
<couchbase:env/>
<couchbase:cluster/>
<couchbase:clusterInfo login="protected" password="password"/>
<couchbase:bucket username="protected" bucketName="protected" bucketPassword="password"/>
<couchbase:template/>
</beans>

View File

@@ -0,0 +1,17 @@
<?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 https://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
<couchbase:env/>
<couchbase:cluster/>
<couchbase:clusterInfo login="protected" password="password"/>
<couchbase:bucket username="protected" bucketName="protected" bucketPassword="password"/>
<couchbase:template translation-service-ref="myCustomTranslationService"/>
<bean id="myCustomTranslationService" class="org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService"/>
</beans>

View File

@@ -0,0 +1,31 @@
<?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 https://www.springframework.org/schema/data/couchbase/spring-couchbase.xsd
http://www.springframework.org/schema/beans https://www.springframework.org/schema/beans/spring-beans.xsd">
<couchbase:env/>
<couchbase:cluster/>
<couchbase:clusterInfo login="protected" password="password"/>
<couchbase:bucket username="protected" bucketName="protected" bucketPassword="password"/>
<!--note that the template needs both converter and translation service if you want to customize converter-->
<couchbase:template translation-service-ref="myCustomTranslationService" converter-ref="myCustomConverter"/>
<bean id="myCustomTranslationService" class="org.springframework.data.couchbase.core.convert.translation.JacksonTranslationService"/>
<bean id="myCustomConverter" class="org.springframework.data.couchbase.core.convert.MappingCouchbaseConverter">
<!--this is a consequence of having to customize the converter-->
<!--WARNING this example is incomplete, look at couchbaseMappingContext() in AbstractCouchbaseConfiguration -->
<constructor-arg index="0" type="org.springframework.data.mapping.context.MappingContext">
<ref bean="myCustomMappingContext"/>
</constructor-arg>
<!--this is where you customize the class field in JSON -->
<constructor-arg index="1" type="java.lang.String" value="javaXmlClass"/>
</bean>
<!--WARNING this example is incomplete, look at couchbaseMappingContext() in AbstractCouchbaseConfiguration -->
<bean id="myCustomMappingContext" class="org.springframework.data.couchbase.core.mapping.CouchbaseMappingContext" />
</beans>

View File

@@ -0,0 +1,6 @@
#Couchbase server versions 4.5 and above are supported
server.version=6.0.0
#resource can be set to container or omitted
#container just would require docker installed
#omitted indicates that there is a local couchbase server running
server.resource=container