pivotal-eshu commented on a change in pull request #7514:
URL: https://github.com/apache/geode/pull/7514#discussion_r838988948



##########
File path: 
geode-core/src/integrationTest/java/org/apache/geode/TxWithCacheLoderIntegrationTest.java
##########
@@ -0,0 +1,140 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more 
contributor license
+ * agreements. See the NOTICE file distributed with this work for additional 
information regarding
+ * copyright ownership. The ASF licenses this file to You under the Apache 
License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance with the 
License. You may obtain a
+ * copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software 
distributed under the License
+ * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 
KIND, either express
+ * or implied. See the License for the specific language governing permissions 
and limitations under
+ * the License.
+ */
+package org.apache.geode;
+
+import static org.apache.geode.distributed.ConfigurationProperties.LOCATORS;
+import static org.apache.geode.distributed.ConfigurationProperties.MCAST_PORT;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.catchThrowable;
+
+import java.util.Properties;
+
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.geode.cache.Cache;
+import org.apache.geode.cache.CacheFactory;
+import org.apache.geode.cache.CacheLoader;
+import org.apache.geode.cache.CacheLoaderException;
+import org.apache.geode.cache.CacheTransactionManager;
+import org.apache.geode.cache.CommitConflictException;
+import org.apache.geode.cache.LoaderHelper;
+import org.apache.geode.cache.Region;
+import org.apache.geode.cache.RegionFactory;
+import org.apache.geode.cache.RegionShortcut;
+import org.apache.geode.cache.TransactionId;
+
+public class TxWithCacheLoderIntegrationTest {
+
+  private static final String REGION_NAME =
+      TxWithCacheLoderIntegrationTest.class.getSimpleName() + "_Region";
+  private static final String VALUE2 = "value2";
+  private final String KEY1 = "key1";
+  private final String KEY2 = "key2";
+  private static final String VALUE1 = "value1";
+
+  private Cache cache;
+  private CacheTransactionManager transactionManager;
+
+  private Region<String, String> region;
+
+  @Before
+  public void setUp() throws Exception {
+    cache = new CacheFactory().create();
+    transactionManager = cache.getCacheTransactionManager();
+  }
+
+  @After
+  public void tearDown() throws Exception {
+    if (cache != null) {
+      cache.close();
+    }
+    cache = null;
+    region = null;
+  }
+
+  protected Properties getConfig() {
+    Properties config = new Properties();
+    config.setProperty(LOCATORS, "");
+    config.setProperty(MCAST_PORT, "0");
+    return config;
+  }
+
+
+  @Test
+  public void txWithCacheLoaderThrowsIfThereIsConflict() {
+    region = createRegion(REGION_NAME);
+    // first operation
+    transactionManager.begin();
+    region.put(KEY1, VALUE1);
+    assertThat(region.get(KEY1)).isEqualTo(VALUE1);
+    TransactionId txId = transactionManager.suspend();
+
+    // second operation with cacheLoader

Review comment:
       Second transaction instead of operation?




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