You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@ignite.apache.org by "zstan (via GitHub)" <gi...@apache.org> on 2026/03/30 10:39:05 UTC
Re: [PR] IGNITE-28277 Append additional tests for CacheInterceptor#onBeforePut [ignite]
zstan commented on code in PR #12911:
URL: https://github.com/apache/ignite/pull/12911#discussion_r2953037873
##########
modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/SqlFieldsQuerySelfTest.java:
##########
@@ -66,6 +72,93 @@ public void testSqlFieldsQueryWithTopologyChanges() throws Exception {
executeQuery();
}
+ /** */
+ @Test
+ public void testCacheInterceptorOnBeforePut() throws Exception {
+ IgniteEx ignite = startGrid(0);
+
+ var entPerson = new QueryEntity()
+ .setTableName("Person")
+ .setKeyType(Integer.class.getName())
+ .setValueType(Person.class.getName())
+ .addQueryField("id", Integer.class.getName(), null)
+ .addQueryField("age", Integer.class.getName(), null)
+ .addQueryField("name", String.class.getName(), null)
+ .setKeyFieldName("id");
+
+ var entString = new QueryEntity()
+ .setKeyType(Integer.class.getName())
+ .setValueType(String.class.getName())
+ .setKeyFieldName("id")
+ .setValueFieldName("val")
+ .addQueryField("id", Integer.class.getName(), null)
+ .addQueryField("val", String.class.getName(), null);
+
+ var cacheObjectCfg = new CacheConfiguration<Integer, Object>("mixedCache")
+ .setSqlSchema("PUBLIC")
+ .setInterceptor(new TestObjectCacheInterceptor())
+ .setQueryEntities(List.of(entPerson, entString.setTableName("StringMix")));
+
+ var cacheStringCfg = new CacheConfiguration<Integer, String>("singleValCache")
+ .setSqlSchema("PUBLIC")
+ .setInterceptor(new TestStringCacheInterceptor())
+ .setQueryEntities(List.of(new QueryEntity(entString).setTableName("String")));
+
+ IgniteCache<Integer, Object> mixedCache = ignite.getOrCreateCache(cacheObjectCfg);
+ IgniteCache<Integer, String> singleCache = ignite.getOrCreateCache(cacheStringCfg);
+
+ mixedCache.withKeepBinary().query(new SqlFieldsQuery("INSERT INTO PUBLIC.Person(id, age, name) VALUES (1, 2, 'name')"));
+ // Check cache interceptor will process binary object representation.
+ assertTrue(TestObjectCacheInterceptor.putBinaryRaised.get());
+ TestObjectCacheInterceptor.putBinaryRaised.set(false);
+
+ mixedCache.query(new SqlFieldsQuery("INSERT INTO PUBLIC.Person(id, age, name) VALUES (2, 2, 'name')"));
+ // Check cache interceptor will process custom object representation.
+ assertFalse(TestObjectCacheInterceptor.putBinaryRaised.get());
Review Comment:
it need to be passed here but it didn`t
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@ignite.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org