Skip to content

Commit eb77cde

Browse files
Reactivate Couchbase for SB3 (#27972)
* fix #27490 - remove old walkaround * fix #27490 - remove old walkaround * fix #27490 - remove old walkaround * fix #27490 - remove old walkaround * fix #27490 - remove old walkaround * fix #27490 - remove old walkaround and fix tests * fix #27490 - remove old walkaround and fix tests * fix #27490 - remove old walkaround and fix tests * docker: adjust couchbase healthcheck * fix #27490 - remove old walkaround and fix tests * spring-boot: don't sort uuids * spring-boot: test adjusts * spring-boot: adjusts * spring-boot: fix * ci: enable couchbase ms sample * ci: enable couchbase search sample * fix #27490 - remove old walkaround and fix tests * fix #27490 - remove old walkaround and fix tests * spring-boot: fix * fix #27490 - remove old walkaround and fix tests - npm update-snapshots * add .blueprint to update-snapshots * fix #27490 - remove old walkaround and fix tests - npm update-snapshots --------- Co-authored-by: Marcelo Shima <marceloshima@gmail.com>
1 parent b161c8b commit eb77cde

File tree

13 files changed

+108
-49
lines changed

13 files changed

+108
-49
lines changed

.blueprint/github-build-matrix/__snapshots__/generator.spec.ts.snap

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,45 @@ exports[`generator - github-build-matrix with angular should match matrix value
106106
"jhipster-bom-branch": "main",
107107
"jhipster-bom-cicd-version": "0.0.0-CICD"
108108
},
109+
{
110+
"job-name": "ng-couchbase (n[1]/j[0])",
111+
"sample": "ng-couchbase",
112+
"os": "ubuntu-latest",
113+
"node-version": "[1]",
114+
"java-version": "[0]",
115+
"npm-version": "NPM-VERSION",
116+
"default-environment": "prod",
117+
"jwt-secret-key": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=",
118+
"skip-backend-tests": "false",
119+
"skip-frontend-tests": "false",
120+
"name": "ng-couchbase",
121+
"app-sample": "ng-couchbase",
122+
"entity": "couchbase",
123+
"workspaces": "false",
124+
"build-jhipster-bom": true,
125+
"jhipster-bom-branch": "main",
126+
"jhipster-bom-cicd-version": "0.0.0-CICD"
127+
},
128+
{
129+
"job-name": "ng-gradle-couchbase-search (n[0]/j[1])",
130+
"sample": "ng-gradle-couchbase-search",
131+
"os": "ubuntu-latest",
132+
"node-version": "[0]",
133+
"java-version": "[1]",
134+
"npm-version": "NPM-VERSION",
135+
"default-environment": "prod",
136+
"jwt-secret-key": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=",
137+
"skip-backend-tests": "false",
138+
"skip-frontend-tests": "false",
139+
"gradle-cache": true,
140+
"name": "ng-gradle-couchbase-search",
141+
"app-sample": "ng-gradle-couchbase-search",
142+
"entity": "couchbase",
143+
"workspaces": "false",
144+
"build-jhipster-bom": true,
145+
"jhipster-bom-branch": "main",
146+
"jhipster-bom-cicd-version": "0.0.0-CICD"
147+
},
109148
{
110149
"job-name": "ng-gradle-fr (n[2]/j[3])",
111150
"sample": "ng-gradle-fr",
@@ -272,6 +311,25 @@ exports[`generator - github-build-matrix with angular should match matrix value
272311
"jhipster-bom-branch": "main",
273312
"jhipster-bom-cicd-version": "0.0.0-CICD"
274313
},
314+
{
315+
"job-name": "ng-webflux-couchbase (n[1]/j[3])",
316+
"sample": "ng-webflux-couchbase",
317+
"os": "ubuntu-latest",
318+
"node-version": "[1]",
319+
"java-version": "[3]",
320+
"npm-version": "NPM-VERSION",
321+
"default-environment": "prod",
322+
"jwt-secret-key": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=",
323+
"skip-backend-tests": "false",
324+
"skip-frontend-tests": "false",
325+
"name": "ng-webflux-couchbase",
326+
"app-sample": "webflux-couchbase",
327+
"entity": "couchbase",
328+
"workspaces": "false",
329+
"build-jhipster-bom": true,
330+
"jhipster-bom-branch": "main",
331+
"jhipster-bom-cicd-version": "0.0.0-CICD"
332+
},
275333
{
276334
"job-name": "ms-ng-oauth2-mongodb-caffeine (n[1]/j[1])",
277335
"sample": "ms-ng-oauth2-mongodb-caffeine",
@@ -911,6 +969,29 @@ exports[`generator - github-build-matrix with vue should match matrix value 1`]
911969
"jhipster-bom-branch": "main",
912970
"jhipster-bom-cicd-version": "0.0.0-CICD"
913971
},
972+
{
973+
"job-name": "ms-vue-eureka-jwt-couchbase-hazelcast (n[0]/j[0])",
974+
"sample": "ms-vue-eureka-jwt-couchbase-hazelcast",
975+
"os": "ubuntu-latest",
976+
"node-version": "[0]",
977+
"java-version": "[0]",
978+
"npm-version": "NPM-VERSION",
979+
"default-environment": "prod",
980+
"jwt-secret-key": "ZjY4MTM4YjI5YzMwZjhjYjI2OTNkNTRjMWQ5Y2Q0Y2YwOWNmZTE2NzRmYzU3NTMwM2NjOTE3MTllOTM3MWRkMzcyYTljMjVmNmQ0Y2MxOTUzODc0MDhhMTlkMDIxMzI2YzQzZDM2ZDE3MmQ3NjVkODk3OTVmYzljYTQyZDNmMTQ=",
981+
"skip-backend-tests": "false",
982+
"skip-frontend-tests": "false",
983+
"gradle-cache": true,
984+
"name": "ms-vue-eureka-jwt-couchbase-hazelcast",
985+
"jdl-samples": "ms-vue-eureka-jwt-couchbase-hazelcast",
986+
"generatorOptions": {
987+
"workspaces": true,
988+
"monorepository": true
989+
},
990+
"workspaces": "true",
991+
"build-jhipster-bom": true,
992+
"jhipster-bom-branch": "main",
993+
"jhipster-bom-cicd-version": "0.0.0-CICD"
994+
},
914995
{
915996
"job-name": "ms-mf-vue-consul-oauth2-mysql-memcached (n[2]/j[2])",
916997
"sample": "ms-mf-vue-consul-oauth2-mysql-memcached",

generators/docker-compose/__snapshots__/docker-compose.spec.ts.snap

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,12 +1092,10 @@ jhipster:
10921092
- BUCKET=mscouchbase
10931093
healthcheck:
10941094
test:
1095-
- CMD
1096-
- curl
1097-
- -f
1098-
- http://localhost:8091/ui/index.html
1095+
- CMD-SHELL
1096+
- curl -f "http://localhost:8091/ui/index.html" && sleep 20
10991097
interval: 5s
1100-
timeout: 5s
1098+
timeout: 25s
11011099
retries: 10
11021100
11031101
msmariadb:
@@ -1832,12 +1830,10 @@ jhipster:
18321830
- BUCKET=mscouchbase
18331831
healthcheck:
18341832
test:
1835-
- CMD
1836-
- curl
1837-
- -f
1838-
- http://localhost:8091/ui/index.html
1833+
- CMD-SHELL
1834+
- curl -f "http://localhost:8091/ui/index.html" && sleep 20
18391835
interval: 5s
1840-
timeout: 5s
1836+
timeout: 25s
18411837
retries: 10
18421838
18431839
msmariadb:

generators/docker/templates/docker/couchbase.yml.ejs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ services:
3434
environment:
3535
- BUCKET=<%= baseName %>
3636
healthcheck:
37-
test: ['CMD', 'curl', '-f', 'http://localhost:8091/ui/index.html']
37+
test: ['CMD-SHELL', 'curl -f "http://localhost:8091/ui/index.html" && sleep 20']
3838
interval: 5s
39-
timeout: 5s
39+
timeout: 25s
4040
retries: 10
4141
# volumes:
4242
# - ~/volumes/jhipster/<%= baseName.toLowerCase() %>/couchbase/:/opt/couchbase/var

generators/spring-boot/templates/build.gradle.ejs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,10 +264,15 @@ task cleanResources(type: Delete) {
264264
delete "build/resources"
265265
}
266266

267-
<%_ if (embeddableLaunchScript) { _%>
267+
<%_ if ( embeddableLaunchScript || databaseTypeCouchbase ) { _%>
268268
269269
bootJar {
270+
<%_ if ( databaseTypeCouchbase ) { _%>
271+
loaderImplementation = org.springframework.boot.loader.tools.LoaderImplementation.CLASSIC
272+
<%_ } _%>
273+
<%_ if ( embeddableLaunchScript ) { _%>
270274
launchScript()
275+
<%_ } _%>
271276
}
272277
<%_ } _%>
273278

generators/spring-boot/templates/pom.xml.ejs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -528,6 +528,9 @@
528528
</executions>
529529
<configuration>
530530
<mainClass>${start-class}</mainClass>
531+
<%_ if (databaseTypeCouchbase) { _%>
532+
<loaderImplementation>CLASSIC</loaderImplementation>
533+
<%_ } _%>
531534
<%_ if (embeddableLaunchScript) { _%>
532535
<executable>true</executable>
533536
<%_ } _%>

generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/UserResourceIT.java.ejs

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -497,13 +497,12 @@ class UserResourceIT {
497497
498498
// Get all the users
499499
<%_ if (reactive) { _%>
500-
<%= user.adminUserDto %> foundUser = webTestClient.get().uri("/api/admin/users?sort=id,desc")
500+
<%= user.adminUserDto %> foundUser = webTestClient.get().uri("/api/admin/users<% if (user.primaryKey.typeNumeric) { %>?sort=id,desc<% } %>")
501501
.accept(MediaType.APPLICATION_JSON)
502502
.exchange()
503503
.expectStatus().isOk()
504504
.expectHeader().contentType(MediaType.APPLICATION_JSON)
505-
.returnResult(<%= user.adminUserDto %>.class).getResponseBody().blockFirst();
506-
505+
.returnResult(<%= user.adminUserDto %>.class).getResponseBody()<% if (!user.primaryKey.typeNumeric) { %>.filter(e -> DEFAULT_LOGIN.equals(e.getLogin()))<% } %>.blockFirst();
507506
assertThat(foundUser.getLogin()).isEqualTo(DEFAULT_LOGIN);
508507
assertThat(foundUser.getFirstName()).isEqualTo(DEFAULT_FIRSTNAME);
509508
assertThat(foundUser.getLastName()).isEqualTo(DEFAULT_LASTNAME);
@@ -513,7 +512,7 @@ class UserResourceIT {
513512
<%_ } _%>
514513
assertThat(foundUser.getLangKey()).isEqualTo(DEFAULT_LANGKEY);
515514
<%_ } else { _%>
516-
restUserMockMvc.perform(get("/api/admin/users<% if (databaseTypeSql) { %>?sort=id,desc<% } %>")
515+
restUserMockMvc.perform(get("/api/admin/users<% if (user.primaryKey.typeNumeric) { %>?sort=id,desc<% } %>")
517516
.accept(MediaType.APPLICATION_JSON))
518517
.andExpect(status().isOk())
519518
.andExpect(content().contentType(MediaType.APPLICATION_JSON_VALUE))
@@ -541,7 +540,7 @@ class UserResourceIT {
541540
<%_ } _%>
542541
<%_ if (cacheProviderAny) { _%>
543542
544-
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull();
543+
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin(), <%= user.persistClass %>.class)).isNull();
545544
<%_ } _%>
546545
547546
// Get the user
@@ -578,7 +577,7 @@ class UserResourceIT {
578577
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNotNull();
579578
}
580579
<%_ } else if (cacheProviderAny) { _%>
581-
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNotNull();
580+
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin(), <%= user.persistClass %>.class)).isNotNull();
582581
<%_ } _%>
583582
}
584583
@@ -882,7 +881,7 @@ class UserResourceIT {
882881
<%_ } _%>
883882
<%_ if (cacheProviderAny) { _%>
884883
885-
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin())).isNull();
884+
assertThat(cacheManager.getCache(UserRepository.USERS_BY_LOGIN_CACHE).get(user.getLogin(), <%= user.persistClass %>.class)).isNull();
886885
<%_ } _%>
887886
888887
// Validate the database is empty

generators/spring-boot/templates/src/test/java/_package_/_entityPackage_/web/rest/_entityClass_ResourceIT.java.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1797,7 +1797,7 @@ _%>
17971797
<%= persistInstance %>.set<%= primaryKey.nameCapitalized %>(<%- field.fieldJavaValueGenerator %>);
17981798
<%_ } _%>
17991799
<%_ } _%>
1800-
inserted<%= persistClass %> = <%= entityInstance %>Repository.<%= saveMethod %>(<%= persistInstance %>)<%= callBlock %>;
1800+
<%_ if (!databaseTypeCouchbase) { _%> inserted<%= persistClass %> = <%_ } _%><%= entityInstance %>Repository.<%= saveMethod %>(<%= persistInstance %>)<%= callBlock %>;
18011801
<%_ if (searchEngineElasticsearch) { _%>
18021802
<%= entityInstance %>Repository.save(<%= persistInstance %>)<%= callBlock %>;
18031803
<%= entityInstance %>SearchRepository.save(<%= persistInstance %>)<%= callBlock %>;

generators/spring-data-couchbase/templates/src/main/java/_package_/_entityPackage_/repository/_entityClass_Repository.java.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public interface <%= entityClass %>Repository extends JHipsterCouchbaseRepositor
6969
%> ", OBJECT_ADD(`<%= relationship.relationshipFieldName %>`, 'id', meta(`<%= relationship.relationshipFieldName %>`).id) AS `<%= relationship.relationshipFieldName %>`" + <%
7070
}
7171
} %>
72-
" FROM #{#n1ql.bucket} b";
72+
" FROM #{#n1ql.bucket}.#{#n1ql.scope}.#{#n1ql.collection} b";
7373
7474
String JOIN = <%
7575
notEmbeddedRelationships.forEach(function (relationship, index) {

generators/spring-data-couchbase/templates/src/main/java/_package_/config/DatabaseConfiguration.java.ejs

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -158,13 +158,6 @@ public class DatabaseConfiguration extends AbstractCouchbaseConfiguration {
158158
return new CouchbaseCustomConversions(converters);
159159
}
160160
161-
@Override
162-
public MappingCouchbaseConverter mappingCouchbaseConverter(CouchbaseMappingContext couchbaseMappingContext, CouchbaseCustomConversions couchbaseCustomConversions) {
163-
MappingCouchbaseConverter mappingCouchbaseConverter = super.mappingCouchbaseConverter(couchbaseMappingContext, couchbaseCustomConversions);
164-
((GenericConversionService) mappingCouchbaseConverter.getConversionService()).addConverter(StringToObjectConverter.INSTANCE);
165-
return mappingCouchbaseConverter;
166-
}
167-
168161
@Bean
169162
public Couchmove couchmove(Cluster cluster) {
170163
LOG.debug("Configuring Couchmove");
@@ -307,18 +300,4 @@ public class DatabaseConfiguration extends AbstractCouchbaseConfiguration {
307300
}
308301
309302
}
310-
311-
public enum StringToObjectConverter implements GenericConverter {
312-
INSTANCE;
313-
314-
@Override
315-
public Set<ConvertiblePair> getConvertibleTypes() {
316-
return Collections.singleton(new ConvertiblePair(String.class, Object.class));
317-
}
318-
319-
@Override
320-
public Object convert(Object source, TypeDescriptor sourceType, TypeDescriptor targetType) {
321-
return null;
322-
}
323-
}
324303
}

generators/spring-data-couchbase/templates/src/main/java/_package_/repository/JHipsterCouchbaseRepository.java.ejs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ _%>
4343
@ScanConsistency(query = QueryScanConsistency.REQUEST_PLUS)
4444
public interface JHipsterCouchbaseRepository<T, ID> extends <% if (reactive) { %>Reactive<% } %>CouchbaseRepository<T, ID> {
4545

46-
String FIND_IDS_QUERY = "SELECT meta().id as __id, 0 as __cas FROM #{#n1ql.bucket} WHERE #{#n1ql.filter}";
46+
String FIND_IDS_QUERY = "SELECT meta().id as __id, 0 as __cas FROM #{#n1ql.bucket}.#{#n1ql.scope}.#{#n1ql.collection} WHERE #{#n1ql.filter}";
4747

4848
static String pageableStatement(Pageable pageable, String prefix) {
4949
Sort sort = Sort.by(

0 commit comments

Comments
 (0)