zstan commented on a change in pull request #8169:
URL: https://github.com/apache/ignite/pull/8169#discussion_r473974349



##########
File path: 
modules/core/src/test/java/org/apache/ignite/client/IgniteBinaryTest.java
##########
@@ -123,6 +130,59 @@ public void testBinaryObjectPutGet() throws Exception {
         }
     }
 
+    /**
+     * Tests that {@code 
org.apache.ignite.cache.CacheInterceptor#onBeforePut(javax.cache.Cache.Entry, 
java.lang.Object)}
+     * throws correct exception in case while cache operations are called from 
thin client. Only BinaryObject`s are
+     * acceptable in this case.
+     */
+    @Test
+    public void testBinaryWithNotGenericInterceptor() throws Exception {
+        IgniteConfiguration ccfg = Config.getServerConfiguration()
+            .setCacheConfiguration(new 
CacheConfiguration("test").setInterceptor(new ThinBinaryValueInterceptor()));
+
+        String castErr = "cannot be cast to";
+        String treeErr = "Tree is corrupted";
+
+        ListeningTestLogger srvLog = new ListeningTestLogger(log);
+
+        LogListener lsnrCast = LogListener.matches(castErr).
+            andMatches(str -> !str.contains(treeErr)).build();
+
+        srvLog.registerListener(lsnrCast);
+
+        ccfg.setGridLogger(srvLog);
+
+        try (Ignite ignored = Ignition.start(ccfg)) {
+            try (IgniteClient client =
+                     Ignition.startClient(new 
ClientConfiguration().setAddresses(Config.SERVER))
+            ) {
+                ClientCache<Integer, ThinBinaryValue> cache = 
client.cache("test");
+
+                try {
+                    cache.put(1, new ThinBinaryValue());
+                }
+                catch (Exception e) {
+                    assertTrue(X.getFullStackTrace(e).contains(castErr));

Review comment:
       this case is hardly to realize as i can see, i need additional custom 
Exception class and its further processing looks like stub and over engineering 
here plus if cache.put would have different errors on different nodes need some 
merge logic, thus i have no clear solution here, besides this part 
https://github.com/apache/ignite/pull/8169/files#diff-b877f1ecebf42e9839a94843abe445aeR119
 hack, i can show only low level messages but seems it a stub too.




----------------------------------------------------------------
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.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to