|
19 | 19 | import org.junit.Before; |
20 | 20 | import org.junit.Rule; |
21 | 21 | import org.junit.jupiter.api.AfterEach; |
| 22 | +import org.junit.jupiter.api.BeforeEach; |
22 | 23 | import org.junit.rules.ExpectedException; |
23 | 24 | import org.springframework.beans.factory.annotation.Autowired; |
24 | 25 | import org.springframework.boot.test.autoconfigure.web.reactive.AutoConfigureWebTestClient; |
@@ -55,38 +56,6 @@ public class UserProfileTest { |
55 | 56 |
|
56 | 57 |
|
57 | 58 | @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 |
90 | 59 | public void cleanDB() { |
91 | 60 | cluster.query("DELETE FROM "+prop.getBucketName()+"._default.profile "); |
92 | 61 | } |
|
0 commit comments