mhansonp commented on a change in pull request #7442:
URL: https://github.com/apache/geode/pull/7442#discussion_r838795033



##########
File path: 
geode-core/src/test/java/org/apache/geode/internal/cache/LocalRegionUpdateTest.java
##########
@@ -0,0 +1,151 @@
+/*
+ * 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.internal.cache;
+
+import static 
org.apache.geode.internal.statistics.StatisticsClockFactory.disabledClock;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyBoolean;
+import static org.mockito.ArgumentMatchers.anyLong;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.spy;
+import static org.mockito.Mockito.times;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import java.util.function.Function;
+
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+import org.mockito.junit.MockitoJUnit;
+import org.mockito.junit.MockitoRule;
+import org.mockito.quality.Strictness;
+
+import org.apache.geode.cache.AttributesFactory;
+import org.apache.geode.cache.DataPolicy;
+import org.apache.geode.cache.InterestPolicy;
+import org.apache.geode.cache.InterestResultPolicy;
+import org.apache.geode.cache.RegionAttributes;
+import org.apache.geode.cache.SubscriptionAttributes;
+import org.apache.geode.cache.client.internal.PoolImpl;
+import org.apache.geode.cache.client.internal.RegisterInterestTracker;
+import org.apache.geode.cache.client.internal.ServerRegionProxy;
+import org.apache.geode.distributed.internal.DSClock;
+import org.apache.geode.distributed.internal.InternalDistributedSystem;
+import org.apache.geode.internal.cache.tier.InterestType;
+
+public class LocalRegionUpdateTest {
+  private InternalDataView internalDataView;
+  private LocalRegion region;
+  private RegisterInterestTracker registerInterestTracker;
+
+  @Rule
+  public MockitoRule mockitoRule = 
MockitoJUnit.rule().strictness(Strictness.STRICT_STUBS);
+
+  @Before
+  public void setUp() {
+    internalDataView = mock(InternalDataView.class);
+
+    EntryEventFactory entryEventFactory = mock(EntryEventFactory.class);
+    InternalCache cache = mock(InternalCache.class);
+    InternalDistributedSystem internalDistributedSystem = 
mock(InternalDistributedSystem.class);
+    InternalRegionArguments internalRegionArguments = 
mock(InternalRegionArguments.class);
+
+    LocalRegion.RegionMapConstructor regionMapConstructor =
+        mock(LocalRegion.RegionMapConstructor.class);
+    Function<LocalRegion, RegionPerfStats> regionPerfStatsFactory = 
localRegion -> {
+      localRegion.getLocalSize();
+      return mock(RegionPerfStats.class);
+    };
+
+    final PoolImpl poolImpl = mock(PoolImpl.class);
+    SubscriptionAttributes subscriptionAttributes =
+        new SubscriptionAttributes(InterestPolicy.ALL);
+
+
+    
when(cache.getInternalDistributedSystem()).thenReturn(internalDistributedSystem);
+    when(internalDistributedSystem.getClock()).thenReturn(mock(DSClock.class));
+
+    when(regionMapConstructor.create(any(), any(), 
any())).thenReturn(mock(RegionMap.class));
+
+
+    AttributesFactory<Object, Object> regionAttributesFactory = new 
AttributesFactory<>();
+    regionAttributesFactory.setDataPolicy(DataPolicy.NORMAL);
+    regionAttributesFactory.setPoolName("Pool1");
+    regionAttributesFactory.setConcurrencyChecksEnabled(false);
+    regionAttributesFactory.setSubscriptionAttributes(subscriptionAttributes);
+    RegionAttributes<Object, Object> regionAttributes =
+        regionAttributesFactory.createRegionAttributes();

Review comment:
       I disagree this is necessary. If you look at internal region factory. 
Your call uses the the AttributesFactory. So it does not reduce anything. I 
think your deprecation of RegionAttributes is only for the fact that we want 
people using factory methods. While I would agree that is preferred, give the 
context of what we are doing, I don't think it adds value and further I think 
it obfuscates things.
   
   public class RegionFactory<K, V> {
     private final AttributesFactory<K, V> attrsFactory;
   
     protected RegionAttributes<K, V> getRegionAttributes() {
       return attrsFactory.create();
     }
   
   




-- 
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: [email protected]

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


Reply via email to