Skip to content

Commit 7e44109

Browse files
Denis RosaDenis Rosa
authored andcommitted
tem fix
1 parent 641c763 commit 7e44109

File tree

2 files changed

+12
-32
lines changed

2 files changed

+12
-32
lines changed

src/main/java/org/couchbase/quickstart/runners/DBSetupRunner.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,12 @@ public class DBSetupRunner implements CommandLineRunner {
3030
@Override
3131
public void run(String... args) {
3232

33+
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
34+
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
35+
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
36+
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
37+
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
38+
System.out.println("||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||");
3339
try {
3440
cluster.queryIndexes().createPrimaryIndex(props.getBucketName());
3541
} catch (Exception e) {
@@ -40,6 +46,7 @@ public void run(String... args) {
4046
try {
4147
CollectionSpec spec = CollectionSpec.create(CollectionNames.PROFILE, bucket.defaultScope().name());
4248
collectionManager.createCollection(spec);
49+
Thread.sleep(10000);
4350
} catch (CollectionExistsException e){
4451
System.out.println(String.format("Collection <%s> already exists", CollectionNames.PROFILE));
4552
} catch (Exception e) {
@@ -58,4 +65,8 @@ public void run(String... args) {
5865
}
5966

6067
}
68+
//
69+
// private QueryResult createCollectionIndex() throws Exception {
70+
// return cluster.query("CREATE PRIMARY INDEX default_profile_index ON "+props.getBucketName()+"._default."+ CollectionNames.PROFILE);
71+
// }
6172
}

src/test/java/org/couchbase/quickstart/userProfile/UserProfileTest.java

Lines changed: 1 addition & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.junit.Before;
2020
import org.junit.Rule;
2121
import org.junit.jupiter.api.AfterEach;
22+
import org.junit.jupiter.api.BeforeEach;
2223
import org.junit.rules.ExpectedException;
2324
import org.springframework.beans.factory.annotation.Autowired;
2425
import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient;
@@ -55,38 +56,6 @@ public class UserProfileTest {
5556

5657

5758
@Before
58-
public void init() {
59-
try {
60-
cluster.queryIndexes().createPrimaryIndex(prop.getBucketName());
61-
} catch (Exception e) {
62-
System.out.println("Primary index already exists on bucket "+prop.getBucketName());
63-
}
64-
65-
CollectionManager collectionManager = bucket.collections();
66-
try {
67-
CollectionSpec spec = CollectionSpec.create(CollectionNames.PROFILE, bucket.defaultScope().name());
68-
collectionManager.createCollection(spec);
69-
} catch (CollectionExistsException e){
70-
System.out.println(String.format("Collection <%s> already exists", CollectionNames.PROFILE));
71-
} catch (Exception e) {
72-
System.out.println(String.format("Generic error <%s>",e.getMessage()));
73-
}
74-
75-
try {
76-
final QueryResult result = cluster.query("CREATE PRIMARY INDEX default_profile_index ON "+prop.getBucketName()+"._default."+ CollectionNames.PROFILE);
77-
for (JsonObject row : result.rowsAsObject()){
78-
System.out.println(String.format("Index Creation Status %s",row.getObject("meta").getString("status")));
79-
}
80-
} catch (IndexExistsException e){
81-
System.out.println(String.format("Collection's primary index already exists"));
82-
} catch (Exception e){
83-
System.out.println(String.format("General error <%s> when trying to create index ",e.getMessage()));
84-
}
85-
86-
cluster.query("DELETE FROM "+prop.getBucketName()+"._default.profile ");
87-
}
88-
89-
@AfterEach
9059
public void cleanDB() {
9160
cluster.query("DELETE FROM "+prop.getBucketName()+"._default.profile ");
9261
}

0 commit comments

Comments
 (0)