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



##########
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:
       Changing code to not use deprecated classes and methods (even if the 
replacement classes and methods use the deprecated stuff under the hood) allows 
all uses of the deprecated code to be removed in one go, by changing the 
implementation in the replacement classes/methods (if necessary), rather than 
having to find and fix every place that the deprecated code is used.
   
   I agree that it's not ideal that the deprecated class is used inside 
`RegionFactory`, but that's not a reason to continue using a class explicitly 
marked as deprecated when an alternative exists and works just fine here. 
Unless there is a reason that we *must* use the deprecated class, it should not 
be used.




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