Bael 4461 2 (#4444)

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* [BAEL-4462] - Fixed integration tests

* Fix verification times
This commit is contained in:
Amit Pandey
2018-06-11 13:48:30 +05:30
committed by Grzegorz Piwowarek
parent 096826cc07
commit a54c9e0c9e
40 changed files with 201 additions and 101 deletions

View File

@@ -0,0 +1,24 @@
package com.baeldung.couchbase.async.person;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.CouchbaseCluster;
import com.couchbase.client.java.env.CouchbaseEnvironment;
import com.couchbase.client.java.env.DefaultCouchbaseEnvironment;
@Configuration
@ComponentScan(basePackages = {"com.baeldung.couchbase.async.service", "com.baeldung.couchbase.n1ql"})
public class PersonCrudServiceIntegrationTestConfig {
@Bean
public Cluster cluster() {
CouchbaseEnvironment env = DefaultCouchbaseEnvironment.builder()
.connectTimeout(60000)
.build();
return CouchbaseCluster.create(env, "127.0.0.1");
}
}

View File

@@ -1,27 +1,31 @@
package com.baeldung.couchbase.async.person;
import static org.junit.Assert.*;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import javax.annotation.PostConstruct;
import org.apache.commons.lang3.RandomStringUtils;
import org.junit.Before;
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.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.baeldung.couchbase.async.AsyncIntegrationTest;
import com.baeldung.couchbase.async.person.Person;
import com.baeldung.couchbase.async.person.PersonCrudService;
import com.baeldung.couchbase.async.person.PersonDocumentConverter;
import com.baeldung.couchbase.async.service.BucketService;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.document.JsonDocument;
public class PersonCrudServiceIntegrationTest extends AsyncIntegrationTest {
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {PersonCrudServiceIntegrationTestConfig.class})
public class PersonCrudServiceLiveTest extends AsyncIntegrationTest {
@Autowired
private PersonCrudService personService;
@@ -35,8 +39,8 @@ public class PersonCrudServiceIntegrationTest extends AsyncIntegrationTest {
private Bucket bucket;
@PostConstruct
private void init() {
@Before
public void init() {
bucket = bucketService.getBucket();
}

View File

@@ -18,7 +18,7 @@ import com.couchbase.client.java.Bucket;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { AsyncIntegrationTestConfig.class })
@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class })
public class ClusterServiceIntegrationTest extends AsyncIntegrationTest {
public class ClusterServiceLiveTest extends AsyncIntegrationTest {
@Autowired
private ClusterService couchbaseService;

View File

@@ -14,8 +14,8 @@ import com.couchbase.client.java.document.JsonDocument;
import com.couchbase.client.java.view.ViewResult;
import com.couchbase.client.java.view.ViewRow;
public class StudentGradeServiceIntegrationTest {
private static final Logger logger = LoggerFactory.getLogger(StudentGradeServiceIntegrationTest.class);
public class StudentGradeServiceLiveTest {
private static final Logger logger = LoggerFactory.getLogger(StudentGradeServiceLiveTest.class);
static StudentGradeService studentGradeService;
static Set<String> gradeIds = new HashSet<>();

View File

@@ -1,5 +1,23 @@
package com.baeldung.couchbase.n1ql;
import static com.baeldung.couchbase.n1ql.CodeSnippets.extractJsonResult;
import static com.couchbase.client.java.query.Select.select;
import static com.couchbase.client.java.query.dsl.Expression.i;
import static com.couchbase.client.java.query.dsl.Expression.s;
import static com.couchbase.client.java.query.dsl.Expression.x;
import static org.junit.Assert.assertNotNull;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import com.couchbase.client.java.Bucket;
import com.couchbase.client.java.Cluster;
import com.couchbase.client.java.document.JsonDocument;
@@ -10,28 +28,13 @@ import com.couchbase.client.java.query.N1qlQueryResult;
import com.couchbase.client.java.query.N1qlQueryRow;
import com.couchbase.client.java.query.Statement;
import com.fasterxml.jackson.databind.JsonNode;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import rx.Observable;
import java.util.List;
import java.util.UUID;
import java.util.stream.Collectors;
import java.util.stream.IntStream;
import java.util.stream.Stream;
import static com.baeldung.couchbase.n1ql.CodeSnippets.extractJsonResult;
import static com.couchbase.client.java.query.Select.select;
import static com.couchbase.client.java.query.dsl.Expression.*;
import static org.junit.Assert.assertNotNull;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { IntegrationTestConfig.class })
public class N1QLIntegrationTest {
public class N1QLLiveTest {
@Autowired

View File

@@ -10,7 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import com.baeldung.couchbase.spring.IntegrationTest;
public class PersonCrudServiceIntegrationTest extends IntegrationTest {
public class PersonCrudServiceLiveTest extends IntegrationTest {
private static final String CLARK_KENT = "Clark Kent";
private static final String SMALLVILLE = "Smallville";

View File

@@ -17,7 +17,7 @@ import com.couchbase.client.java.Bucket;
@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = { IntegrationTestConfig.class })
@TestExecutionListeners(listeners = { DependencyInjectionTestExecutionListener.class })
public class ClusterServiceIntegrationTest extends IntegrationTest {
public class ClusterServiceLiveTest extends IntegrationTest {
@Autowired
private ClusterService couchbaseService;