2020-02-12 20:43:47 +01:00
|
|
|
package com.baeldung;
|
2019-10-31 20:43:47 -05:00
|
|
|
|
2020-02-12 20:43:47 +01:00
|
|
|
import com.baeldung.spring.data.couchbase2b.MultiBucketCouchbaseConfig;
|
|
|
|
import com.baeldung.spring.data.couchbase2b.MultiBucketIntegrationTestConfig;
|
2019-10-31 20:43:47 -05:00
|
|
|
import org.junit.Test;
|
|
|
|
import org.junit.runner.RunWith;
|
|
|
|
import org.springframework.test.context.ContextConfiguration;
|
|
|
|
import org.springframework.test.context.TestExecutionListeners;
|
|
|
|
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
|
|
|
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This LiveTest requires:
|
|
|
|
*
|
2023-09-22 18:22:57 +02:00
|
|
|
* 1- Couchbase 5 instance Running and Configured.
|
|
|
|
* It's enough to execute the "dockerbuild.sh" script in the test/docker folder.
|
|
|
|
*
|
|
|
|
* 2.1- Spacial View: Add new spacial view (in Index tab) in document 'campus_spatial', view 'byLocation' with the following function:
|
2019-10-31 20:43:47 -05:00
|
|
|
* {@code
|
|
|
|
* function (doc) {
|
|
|
|
* if (doc.location &&
|
2020-02-12 20:43:47 +01:00
|
|
|
* doc._class == "com.baeldung.spring.data.couchbase.model.Campus") {
|
2019-10-31 20:43:47 -05:00
|
|
|
* emit([doc.location.x, doc.location.y], null);
|
|
|
|
* }
|
|
|
|
* }}
|
|
|
|
*
|
2023-09-22 18:22:57 +02:00
|
|
|
* 2.2- MapReduce Views: Add new views in document 'campus':
|
|
|
|
*
|
|
|
|
* 2.2.1- view 'all' with function:
|
2019-10-31 20:43:47 -05:00
|
|
|
* {@code
|
|
|
|
* function (doc, meta) {
|
2020-02-12 20:43:47 +01:00
|
|
|
* if(doc._class == "com.baeldung.spring.data.couchbase.model.Campus") {
|
2019-10-31 20:43:47 -05:00
|
|
|
* emit(meta.id, null);
|
|
|
|
* }
|
|
|
|
* }}
|
|
|
|
*
|
2023-09-22 18:22:57 +02:00
|
|
|
* 2.2.2- view 'byName' with function:
|
2019-10-31 20:43:47 -05:00
|
|
|
* {@code
|
|
|
|
* function (doc, meta) {
|
2020-02-12 20:43:47 +01:00
|
|
|
* if(doc._class == "com.baeldung.spring.data.couchbase.model.Campus" &&
|
2019-10-31 20:43:47 -05:00
|
|
|
* doc.name) {
|
|
|
|
* emit(doc.name, null);
|
|
|
|
* }
|
|
|
|
* }}
|
|
|
|
*/
|
|
|
|
@RunWith(SpringJUnit4ClassRunner.class)
|
|
|
|
@ContextConfiguration(classes = { MultiBucketCouchbaseConfig.class, MultiBucketIntegrationTestConfig.class })
|
|
|
|
@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class })
|
|
|
|
public class SpringContextLiveTest {
|
|
|
|
|
|
|
|
@Test
|
|
|
|
public void whenSpringContextIsBootstrapped_thenNoExceptions() {
|
|
|
|
}
|
|
|
|
}
|