diff --git a/pom.xml b/pom.xml
index cf65f822..68236a9e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -21,8 +21,8 @@
DATACOUCH
- 2.2.8
- 2.2.8
+ 2.4.4
+ 2.4.4
1.13.2.BUILD-SNAPSHOT
1.0.0.GA
diff --git a/src/integration/java/org/springframework/data/couchbase/repository/CouchbaseRepositoryViewTests.java b/src/integration/java/org/springframework/data/couchbase/repository/CouchbaseRepositoryViewTests.java
index b3f5c853..01935302 100644
--- a/src/integration/java/org/springframework/data/couchbase/repository/CouchbaseRepositoryViewTests.java
+++ b/src/integration/java/org/springframework/data/couchbase/repository/CouchbaseRepositoryViewTests.java
@@ -134,9 +134,9 @@ public class CouchbaseRepositoryViewTests {
String highKey = "uname-11";
List keys = Arrays.asList(lowKey, middleKey, highKey);
- User u1 = repository.findByUsernameIs(lowKey);
- User u2 = repository.findByUsernameIs(middleKey);
- User u3 = repository.findByUsernameIs(highKey);
+ User u1 = repository.findByUsernameIs(lowKey).get(0);
+ User u2 = repository.findByUsernameIs(middleKey).get(0);
+ User u3 = repository.findByUsernameIs(highKey).get(0);
List in = repository.findAllByUsernameIn(keys);
diff --git a/src/integration/java/org/springframework/data/couchbase/repository/CustomUserRepository.java b/src/integration/java/org/springframework/data/couchbase/repository/CustomUserRepository.java
index fe53a396..078ec18b 100644
--- a/src/integration/java/org/springframework/data/couchbase/repository/CustomUserRepository.java
+++ b/src/integration/java/org/springframework/data/couchbase/repository/CustomUserRepository.java
@@ -46,7 +46,7 @@ public interface CustomUserRepository extends CouchbaseRepository
long countByUsernameGreaterThanEqualAndUsernameLessThan(String lowBound, String highBound);
@View(viewName = "customFindByNameView")
- User findByUsernameIs(String lowKey);
+ List findByUsernameIs(String lowKey);
@View(viewName = "customFindByNameView")
List findAllByUsernameIn(List keys);
diff --git a/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTestListener.java b/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTestListener.java
index 9fe208d9..50489cbe 100644
--- a/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTestListener.java
+++ b/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTestListener.java
@@ -1,6 +1,7 @@
package org.springframework.data.couchbase.repository.index;
import com.couchbase.client.java.Bucket;
+import com.couchbase.client.java.error.DesignDocumentDoesNotExistException;
import com.couchbase.client.java.query.Index;
import com.couchbase.client.java.query.N1qlQuery;
@@ -12,14 +13,19 @@ import org.springframework.test.context.support.DependencyInjectionTestExecution
* A test listener that will remove the indexes created in {@link IndexedRepositoryTests} before test case is run.
*
* @author Simon Baslé
+ * @author Subhashni Balakrishnan
*/
public class IndexedRepositoryTestListener extends DependencyInjectionTestExecutionListener {
@Override
public void beforeTestClass(final TestContext testContext) throws Exception {
Bucket client = (Bucket) testContext.getApplicationContext().getBean(BeanNames.COUCHBASE_BUCKET);
- client.bucketManager().removeDesignDocument(IndexedRepositoryTests.VIEW_DOC);
- client.bucketManager().removeDesignDocument("foo");
+ try {
+ client.bucketManager().removeDesignDocument(IndexedRepositoryTests.VIEW_DOC);
+ client.bucketManager().removeDesignDocument("foo");
+ } catch (DesignDocumentDoesNotExistException ex) {
+ //ignore
+ }
client.query(N1qlQuery.simple(Index.dropPrimaryIndex(client.name())));
client.query(N1qlQuery.simple(Index.dropIndex(client.name(), IndexedRepositoryTests.SECONDARY)));
}
diff --git a/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTests.java b/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTests.java
index 99fcc432..9dd3c66f 100644
--- a/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTests.java
+++ b/src/integration/java/org/springframework/data/couchbase/repository/index/IndexedRepositoryTests.java
@@ -20,6 +20,7 @@ import static org.junit.Assert.*;
import java.util.Arrays;
+import com.couchbase.client.java.error.DesignDocumentDoesNotExistException;
import com.couchbase.client.java.query.N1qlQuery;
import com.couchbase.client.java.query.N1qlQueryResult;
import com.couchbase.client.java.view.DesignDocument;
@@ -136,9 +137,15 @@ public class IndexedRepositoryTests {
public void shouldNotFindViewIndexWithIgnoringIndexManager() {
AnotherIndexedUserRepository repository = ignoringIndexFactory.getRepository(AnotherIndexedUserRepository.class);
- DesignDocument designDoc = template.getCouchbaseBucket()
- .bucketManager()
- .getDesignDocument(VIEW_DOC);
+ DesignDocument designDoc = null;
+
+ try {
+ designDoc = template.getCouchbaseBucket()
+ .bucketManager()
+ .getDesignDocument(VIEW_DOC);
+ } catch (DesignDocumentDoesNotExistException ex) {
+ //ignore
+ }
if (designDoc != null) {
for (View view : designDoc.views()) {
diff --git a/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentFactoryBean.java b/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentFactoryBean.java
index c1c9f5a6..1c3d1e01 100644
--- a/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentFactoryBean.java
+++ b/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentFactoryBean.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2016 the original author or authors
+ * Copyright 2012-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,6 +30,7 @@ import org.springframework.beans.factory.config.AbstractFactoryBean;
*
* @author Simon Baslé
* @author Simon Bland
+ * @author Subhashni Balakrishnan
*/
/*package*/ class CouchbaseEnvironmentFactoryBean extends AbstractFactoryBean {
@@ -51,6 +52,17 @@ import org.springframework.beans.factory.config.AbstractFactoryBean;
eventBus
systemMetricsCollectorConfig
networkLatencyMetricsCollectorConfig
+ requestBufferWaitStrategy
+ sslKeystore
+ memcachedHashingStrategy
+ kvIoPool
+ queryIoPool
+ searchIoPool
+ viewIoPool
+ kvServiceConfig
+ queryServiceConfig
+ searchServiceConfig
+ viewServiceConfig
*/
@Override
@@ -123,14 +135,6 @@ import org.springframework.beans.factory.config.AbstractFactoryBean;
this.couchbaseEnvBuilder.sslKeystorePassword(sslKeystorePassword);
}
- public void setQueryEnabled(boolean queryEnabled) {
- this.couchbaseEnvBuilder.queryEnabled(queryEnabled);
- }
-
- public void setQueryPort(int queryPort) {
- this.couchbaseEnvBuilder.queryPort(queryPort);
- }
-
public void setBootstrapHttpEnabled(boolean bootstrapHttpEnabled) {
this.couchbaseEnvBuilder.bootstrapHttpEnabled(bootstrapHttpEnabled);
}
@@ -206,4 +210,8 @@ import org.springframework.beans.factory.config.AbstractFactoryBean;
public void setMutationTokensEnabled(boolean mutationTokensEnabled) {
this.couchbaseEnvBuilder.mutationTokensEnabled(mutationTokensEnabled);
}
-}
+
+ public void setAnalyticsTimeout(long analyticsTimeout) {
+ this.couchbaseEnvBuilder.analyticsTimeout(analyticsTimeout);
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentNoShutdownProxy.java b/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentNoShutdownProxy.java
index c5a18482..3caa2c0f 100644
--- a/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentNoShutdownProxy.java
+++ b/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentNoShutdownProxy.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2016 the original author or authors
+ * Copyright 2012-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.
@@ -16,9 +16,14 @@
package org.springframework.data.couchbase.config;
+import java.security.KeyStore;
+import java.util.concurrent.TimeUnit;
+
+import com.couchbase.client.core.env.*;
import com.couchbase.client.core.event.EventBus;
import com.couchbase.client.core.metrics.MetricsCollector;
import com.couchbase.client.core.metrics.NetworkLatencyMetricsCollector;
+import com.couchbase.client.core.node.MemcachedHashingStrategy;
import com.couchbase.client.core.retry.RetryStrategy;
import com.couchbase.client.core.time.Delay;
import com.couchbase.client.deps.io.netty.channel.EventLoopGroup;
@@ -32,6 +37,7 @@ import rx.Scheduler;
*
* @author Simon Baslé
* @author Jonathan Edwards
+ * @author Subhashni Balakrishnan
*/
public class CouchbaseEnvironmentNoShutdownProxy implements CouchbaseEnvironment {
@@ -42,8 +48,8 @@ public class CouchbaseEnvironmentNoShutdownProxy implements CouchbaseEnvironment
}
@Override
- public Observable shutdown() {
- return Observable.just(false);
+ public boolean shutdown() {
+ return false;
}
//===== DELEGATION METHODS =====
@@ -83,18 +89,6 @@ public class CouchbaseEnvironmentNoShutdownProxy implements CouchbaseEnvironment
return delegate.sslKeystorePassword();
}
- @Override
- @Deprecated
- public boolean queryEnabled() {
- return delegate.queryEnabled();
- }
-
- @Override
- @Deprecated
- public int queryPort() {
- return delegate.queryPort();
- }
-
@Override
public boolean bootstrapHttpEnabled() {
return delegate.bootstrapHttpEnabled();
@@ -324,4 +318,74 @@ public class CouchbaseEnvironmentNoShutdownProxy implements CouchbaseEnvironment
public long searchTimeout() {
return delegate.searchTimeout();
}
-}
+
+ @Override
+ public WaitStrategyFactory requestBufferWaitStrategy() {
+ return delegate.requestBufferWaitStrategy();
+ }
+
+ @Override
+ public EventLoopGroup kvIoPool() {
+ return delegate.kvIoPool();
+ }
+
+ @Override
+ public EventLoopGroup viewIoPool() {
+ return delegate.viewIoPool();
+ }
+
+ @Override
+ public EventLoopGroup searchIoPool() {
+ return delegate.searchIoPool();
+ }
+
+ @Override
+ public EventLoopGroup queryIoPool() {
+ return delegate.queryIoPool();
+ }
+
+ @Override
+ public KeyStore sslKeystore() {
+ return delegate.sslKeystore();
+ }
+
+ @Override
+ public boolean shutdown(long timeout, TimeUnit timeUnit) {
+ return delegate.shutdown(timeout, timeUnit);
+ }
+
+ @Override
+ public MemcachedHashingStrategy memcachedHashingStrategy() {
+ return delegate.memcachedHashingStrategy();
+ }
+
+ @Override
+ public long analyticsTimeout() {
+ return delegate.analyticsTimeout();
+ }
+
+ @Override
+ public long configPollInterval() {
+ return delegate.configPollInterval();
+ }
+
+ @Override
+ public KeyValueServiceConfig kvServiceConfig() {
+ return delegate.kvServiceConfig();
+ }
+
+ @Override
+ public QueryServiceConfig queryServiceConfig() {
+ return delegate.queryServiceConfig();
+ }
+
+ @Override
+ public SearchServiceConfig searchServiceConfig() {
+ return delegate.searchServiceConfig();
+ }
+
+ @Override
+ public ViewServiceConfig viewServiceConfig() {
+ return delegate.viewServiceConfig();
+ }
+}
\ No newline at end of file
diff --git a/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentParser.java b/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentParser.java
index 61caa967..37b0f1a2 100644
--- a/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentParser.java
+++ b/src/main/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentParser.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors
+ * Copyright 2012-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.
@@ -44,8 +44,6 @@ import org.springframework.util.StringUtils;
* {@link DefaultCouchbaseEnvironment.Builder#sslEnabled(boolean) sslEnabled}
* {@link DefaultCouchbaseEnvironment.Builder#sslKeystoreFile(String) sslKeystoreFile}
* {@link DefaultCouchbaseEnvironment.Builder#sslKeystorePassword(String) sslKeystorePassword}
- * {@link DefaultCouchbaseEnvironment.Builder#queryEnabled(boolean) queryEnabled}
- * {@link DefaultCouchbaseEnvironment.Builder#queryPort(int) queryPort}
* {@link DefaultCouchbaseEnvironment.Builder#bootstrapHttpEnabled(boolean) bootstrapHttpEnabled}
* {@link DefaultCouchbaseEnvironment.Builder#bootstrapCarrierEnabled(boolean) bootstrapCarrierEnabled}
* {@link DefaultCouchbaseEnvironment.Builder#bootstrapHttpDirectPort(int) bootstrapHttpDirectPort}
@@ -66,9 +64,11 @@ import org.springframework.util.StringUtils;
* {@link DefaultCouchbaseEnvironment.Builder#bufferPoolingEnabled(boolean) bufferPoolingEnabled}
* {@link DefaultCouchbaseEnvironment.Builder#tcpNodelayEnabled(boolean) tcpNodelayEnabled}
* {@link DefaultCouchbaseEnvironment.Builder#mutationTokensEnabled(boolean) mutationTokensEnabled}
+ * {@link DefaultCouchbaseEnvironment.Builder#analyticsTimeout(long) analyticsTimeout}
*
*
* @author Simon Baslé
+ * @author Subhashni Balakrishnan
*/
public class CouchbaseEnvironmentParser extends AbstractSingleBeanDefinitionParser {
@@ -117,8 +117,6 @@ public class CouchbaseEnvironmentParser extends AbstractSingleBeanDefinitionPars
setPropertyValue(envDefinitionBuilder, envElement, "sslEnabled", "sslEnabled");
setPropertyValue(envDefinitionBuilder, envElement, "sslKeystoreFile", "sslKeystoreFile");
setPropertyValue(envDefinitionBuilder, envElement, "sslKeystorePassword", "sslKeystorePassword");
- setPropertyValue(envDefinitionBuilder, envElement, "queryEnabled", "queryEnabled");
- setPropertyValue(envDefinitionBuilder, envElement, "queryPort", "queryPort");
setPropertyValue(envDefinitionBuilder, envElement, "bootstrapHttpEnabled", "bootstrapHttpEnabled");
setPropertyValue(envDefinitionBuilder, envElement, "bootstrapCarrierEnabled", "bootstrapCarrierEnabled");
setPropertyValue(envDefinitionBuilder, envElement, "bootstrapHttpDirectPort", "bootstrapHttpDirectPort");
@@ -138,6 +136,7 @@ public class CouchbaseEnvironmentParser extends AbstractSingleBeanDefinitionPars
setPropertyValue(envDefinitionBuilder, envElement, "bufferPoolingEnabled", "bufferPoolingEnabled");
setPropertyValue(envDefinitionBuilder, envElement, "tcpNodelayEnabled", "tcpNodelayEnabled");
setPropertyValue(envDefinitionBuilder, envElement, "mutationTokensEnabled", "mutationTokensEnabled");
+ setPropertyValue(envDefinitionBuilder, envElement, "analyticsTimeout", "analyticsTimeout");
//retry strategy is particular, in the xsd this is an enum (FailFast, BestEffort)
setPropertyValue(envDefinitionBuilder, envElement, "retryStrategy", "retryStrategy");
diff --git a/src/main/java/org/springframework/data/couchbase/repository/support/IndexManager.java b/src/main/java/org/springframework/data/couchbase/repository/support/IndexManager.java
index 5619817b..62f0fd17 100644
--- a/src/main/java/org/springframework/data/couchbase/repository/support/IndexManager.java
+++ b/src/main/java/org/springframework/data/couchbase/repository/support/IndexManager.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors
+ * Copyright 2012-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.
@@ -23,6 +23,7 @@ import java.util.Collections;
import com.couchbase.client.java.bucket.BucketManager;
import com.couchbase.client.java.document.json.JsonObject;
+import com.couchbase.client.java.error.DesignDocumentDoesNotExistException;
import com.couchbase.client.java.query.AsyncN1qlQueryResult;
import com.couchbase.client.java.query.Index;
import com.couchbase.client.java.query.Statement;
@@ -51,6 +52,7 @@ import org.springframework.data.repository.core.RepositoryInformation;
* Index creation will be attempted in parallel using the asynchronous APIs, but the overall process is still blocking.
*
* @author Simon Baslé
+ * @author Subhashni Balakrishnan
*/
public class IndexManager {
@@ -241,7 +243,14 @@ public class IndexManager {
}
com.couchbase.client.java.view.View view = DefaultView.create(viewName, mapFunction, reduceFunction);
- DesignDocument doc = manager.getDesignDocument(config.designDoc());
+ DesignDocument doc = null;
+
+ try {
+ doc = manager.getDesignDocument(config.designDoc());
+ } catch (DesignDocumentDoesNotExistException ex) {
+ //Ignore
+ }
+
if (doc != null) {
for (com.couchbase.client.java.view.View existingView : doc.views()) {
if (existingView.name().equals(viewName)) {
diff --git a/src/main/resources/org/springframework/data/couchbase/config/spring-couchbase-env-2.0.xsd b/src/main/resources/org/springframework/data/couchbase/config/spring-couchbase-env-2.0.xsd
index 0647c96b..6973761f 100644
--- a/src/main/resources/org/springframework/data/couchbase/config/spring-couchbase-env-2.0.xsd
+++ b/src/main/resources/org/springframework/data/couchbase/config/spring-couchbase-env-2.0.xsd
@@ -54,6 +54,7 @@
+
diff --git a/src/test/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentParserTest.java b/src/test/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentParserTest.java
index b1b84863..2ac0cfc2 100644
--- a/src/test/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentParserTest.java
+++ b/src/test/java/org/springframework/data/couchbase/config/CouchbaseEnvironmentParserTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2012-2015 the original author or authors
+ * Copyright 2012-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.
@@ -79,8 +79,6 @@ public class CouchbaseEnvironmentParserTest {
assertThat(env.sslEnabled(), allOf(equalTo(true), not(defaultEnv.sslEnabled())));
assertThat(env.sslKeystoreFile(), is(equalTo("test")));
assertThat(env.sslKeystorePassword(), is(equalTo("test")));
- assertThat(env.queryEnabled(), allOf(equalTo(true), not(defaultEnv.queryEnabled())));
- assertThat(env.queryPort(), is(equalTo(7)));
assertThat(env.bootstrapHttpEnabled(), allOf(equalTo(false), not(defaultEnv.bootstrapHttpEnabled())));
assertThat(env.bootstrapCarrierEnabled(), allOf(equalTo(false), not(defaultEnv.bootstrapCarrierEnabled())));
assertThat(env.bootstrapHttpDirectPort(), is(equalTo(8)));
@@ -101,6 +99,7 @@ public class CouchbaseEnvironmentParserTest {
assertThat(env.bufferPoolingEnabled(), allOf(equalTo(false), not(defaultEnv.bufferPoolingEnabled())));
assertThat(env.tcpNodelayEnabled(), allOf(equalTo(false), not(defaultEnv.tcpNodelayEnabled())));
assertThat(env.mutationTokensEnabled(), allOf(equalTo(true), not(defaultEnv.mutationTokensEnabled())));
+ assertThat(env.analyticsTimeout(), is(equalTo(30L)));
}
@AfterClass
diff --git a/src/test/resources/configurations/couchbaseEnv-bean.xml b/src/test/resources/configurations/couchbaseEnv-bean.xml
index d280a67c..5040a2ce 100644
--- a/src/test/resources/configurations/couchbaseEnv-bean.xml
+++ b/src/test/resources/configurations/couchbaseEnv-bean.xml
@@ -23,8 +23,6 @@
sslEnabled="true"
sslKeystoreFile="test"
sslKeystorePassword="test"
- queryEnabled="true"
- queryPort="7"
bootstrapHttpEnabled="false"
bootstrapCarrierEnabled="false"
bootstrapHttpDirectPort="8"
@@ -45,6 +43,7 @@
bufferPoolingEnabled="false"
tcpNodelayEnabled="false"
mutationTokensEnabled="true"
+ analyticsTimeout="30"
/>
\ No newline at end of file