jinmeiliao commented on a change in pull request #7088:
URL: https://github.com/apache/geode/pull/7088#discussion_r745018174



##########
File path: 
geode-cq/src/distributedTest/java/org/apache/geode/security/MultiUserAPIDUnitTest.java
##########
@@ -252,4 +283,50 @@ public void jsonFormatterOnTheClientWithMultiUser() throws 
Exception {
     PdxInstance value = regionService.getJsonFormatter().toPdxInstance(json);
     regionView.put("key", value);
   }
+
+  @Test
+  public void transactionTest() throws Exception {
+    ClientCache cache = client.withServerConnection(server.getPort())
+        .withCredential("data", "data")
+        .createCache();
+    Region<Object, Object> region = client.createProxyRegion("region");
+    CacheTransactionManager txManager =
+        cache.getCacheTransactionManager();
+
+    try {
+      txManager.begin();
+      region.put("key1", "value1");
+      region.put("key2", "value2");
+      txManager.commit();
+    } catch (CommitConflictException conflict) {
+      // ... do necessary work for a transaction that failed on commit
+    } finally {
+      if (txManager.exists()) {
+        txManager.rollback();
+      }
+    }
+  }
+
+  @Test
+  public void multiUserWithClientSubscription() throws Exception {

Review comment:
       the test was added for code understanding. Not needed, but kept since it 
provide some coverage.

##########
File path: 
geode-cq/src/distributedTest/java/org/apache/geode/security/MultiUserAPIDUnitTest.java
##########
@@ -252,4 +283,50 @@ public void jsonFormatterOnTheClientWithMultiUser() throws 
Exception {
     PdxInstance value = regionService.getJsonFormatter().toPdxInstance(json);
     regionView.put("key", value);
   }
+
+  @Test
+  public void transactionTest() throws Exception {
+    ClientCache cache = client.withServerConnection(server.getPort())
+        .withCredential("data", "data")
+        .createCache();
+    Region<Object, Object> region = client.createProxyRegion("region");
+    CacheTransactionManager txManager =
+        cache.getCacheTransactionManager();
+
+    try {
+      txManager.begin();
+      region.put("key1", "value1");
+      region.put("key2", "value2");
+      txManager.commit();
+    } catch (CommitConflictException conflict) {
+      // ... do necessary work for a transaction that failed on commit
+    } finally {
+      if (txManager.exists()) {
+        txManager.rollback();
+      }
+    }
+  }
+
+  @Test
+  public void multiUserWithClientSubscription() throws Exception {
+    ClientCache cache = client.withServerConnection(server.getPort())
+        .withPoolSubscription(true)
+        .withProperty(SECURITY_CLIENT_AUTH_INIT, 
CountableUserPasswordAuthInit.class.getName())
+        .withMultiUser(true)
+        .createCache();
+    Properties properties = new Properties();
+    properties.setProperty(UserPasswordAuthInit.USER_NAME, "data");
+    properties.setProperty(UserPasswordAuthInit.PASSWORD, "wrongPassword");
+    RegionService regionService = cache.createAuthenticatedView(properties);
+
+    
cache.createClientRegionFactory(ClientRegionShortcut.PROXY).create("region");
+    Region region = regionService.getRegion(SEPARATOR + "region");
+    assertThatThrownBy(() -> region.registerInterestForAllKeys())
+        .isInstanceOf(UnsupportedOperationException.class);

Review comment:
       the test was added for code understanding. Not needed.




-- 
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-unsubscr...@geode.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to