You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@geode.apache.org by GitBox <gi...@apache.org> on 2021/03/09 20:06:08 UTC

[GitHub] [geode] kirklund commented on a change in pull request #6036: GEODE-8856: Persist gateway-sender state

kirklund commented on a change in pull request #6036:
URL: https://github.com/apache/geode/pull/6036#discussion_r590679758



##########
File path: geode-core/src/test/java/org/apache/geode/internal/cache/xmlcache/CacheXmlParserTest.java
##########
@@ -0,0 +1,175 @@
+/*
+ * 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.xmlcache;
+
+import static org.apache.geode.internal.cache.GemFireCacheImpl.DEFAULT_LOCK_LEASE;
+import static org.apache.geode.internal.cache.GemFireCacheImpl.DEFAULT_LOCK_TIMEOUT;
+import static org.apache.geode.internal.cache.GemFireCacheImpl.DEFAULT_SEARCH_TIMEOUT;
+import static org.apache.geode.internal.cache.xmlcache.CacheXml.COPY_ON_READ;
+import static org.apache.geode.internal.cache.xmlcache.CacheXml.IS_SERVER;
+import static org.apache.geode.internal.cache.xmlcache.CacheXml.LOCK_LEASE;
+import static org.apache.geode.internal.cache.xmlcache.CacheXml.LOCK_TIMEOUT;
+import static org.apache.geode.internal.cache.xmlcache.CacheXml.MESSAGE_SYNC_INTERVAL;
+import static org.apache.geode.internal.cache.xmlcache.CacheXml.REMOTE_DISTRIBUTED_SYSTEM_ID;
+import static org.apache.geode.internal.cache.xmlcache.CacheXml.SEARCH_TIMEOUT;
+import static org.apache.geode.internal.cache.xmlcache.CacheXml.STATE;
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.powermock.api.mockito.PowerMockito;
+import org.powermock.core.classloader.annotations.PrepareForTest;
+import org.powermock.modules.junit4.PowerMockRunner;
+import org.xml.sax.SAXException;
+import org.xml.sax.helpers.AttributesImpl;
+
+import org.apache.geode.cache.wan.GatewaySenderFactory;
+import org.apache.geode.cache.wan.GatewaySenderState;
+import org.apache.geode.internal.cache.ha.HARegionQueue;
+import org.apache.geode.internal.cache.wan.WANServiceProvider;
+
+@RunWith(PowerMockRunner.class)
+@PrepareForTest(WANServiceProvider.class)
+public class CacheXmlParserTest {
+
+  @Mock
+  private GatewaySenderFactory gatewaySenderFactory;
+
+  @Before
+  public void setUp() {
+    PowerMockito.mockStatic(WANServiceProvider.class);

Review comment:
       The Geode community decided on the dev-list to get rid of and avoid `PowerMockito`. It causes too many problems including corrupting the unit testing JVM for later unit tests. It also discourages us from refactoring classes to be better structured and easier to unit test.
   
   The main Jira ticket is [https://issues.apache.org/jira/browse/GEODE-6143](https://issues.apache.org/jira/browse/GEODE-6143), but there are additional sub-tickets you can search Jira for.




----------------------------------------------------------------
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:
users@infra.apache.org