@@ -149,6 +149,39 @@ queryMethod, converter, config().bucketname(), new SpelExpressionParser(),
149
149
}
150
150
}
151
151
152
+ @ Test
153
+ @ IgnoreWhen (missesCapabilities = Capabilities .QUERY , clusterTypes = ClusterType .MOCKED )
154
+ void findUsingStringNq1l_3x_projection_id_cas () throws Exception {
155
+ Airline airline = new Airline (UUID .randomUUID ().toString (), "Continental" , "USA" );
156
+ try {
157
+ Airline modified = couchbaseTemplate .upsertById (Airline .class ).one (airline );
158
+
159
+ String input = "getByName_3x" ;
160
+ Method method = AirlineRepository .class .getMethod (input , String .class );
161
+
162
+ CouchbaseQueryMethod queryMethod = new CouchbaseQueryMethod (method ,
163
+ new DefaultRepositoryMetadata (AirlineRepository .class ), new SpelAwareProxyProjectionFactory (),
164
+ converter .getMappingContext ());
165
+
166
+ StringN1qlQueryCreator creator = new StringN1qlQueryCreator (getAccessor (getParameters (method ), "Continental" ),
167
+ queryMethod , converter , config ().bucketname (), new SpelExpressionParser (),
168
+ QueryMethodEvaluationContextProvider .DEFAULT , namedQueries );
169
+
170
+ Query query = creator .createQuery ();
171
+
172
+ ExecutableFindByQuery q = (ExecutableFindByQuery ) couchbaseTemplate .findByQuery (Airline .class )
173
+ .withConsistency (QueryScanConsistency .REQUEST_PLUS ).matching (query );
174
+
175
+ Optional <Airline > al = q .one ();
176
+ assertEquals (airline .toString (), al .get ().toString ());
177
+ } catch (Exception e ) {
178
+ e .printStackTrace ();
179
+ throw e ;
180
+ } finally {
181
+ couchbaseTemplate .removeById ().one (airline .getId ());
182
+ }
183
+ }
184
+
152
185
private ParameterAccessor getAccessor (Parameters <?, ?> params , Object ... values ) {
153
186
return new ParametersParameterAccessor (params , values );
154
187
}
0 commit comments