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/10/06 21:14:22 UTC

[GitHub] [geode] jinmeiliao opened a new pull request #6948: GEODE-9663: refactor authenticateIfRequired

jinmeiliao opened a new pull request #6948:
URL: https://github.com/apache/geode/pull/6948


   a simple refactor and unit tests for better readability


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

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



[GitHub] [geode] jmelchio commented on a change in pull request #6948: GEODE-9663: refactor authenticateIfRequired

Posted by GitBox <gi...@apache.org>.
jmelchio commented on a change in pull request #6948:
URL: https://github.com/apache/geode/pull/6948#discussion_r724341134



##########
File path: geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionFactoryImplTest.java
##########
@@ -0,0 +1,103 @@
+/*
+ *
+ * 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.cache.client.internal;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.distributed.internal.ServerLocation;
+
+public class ConnectionFactoryImplTest {
+  private ConnectionFactoryImpl factory;
+  private ConnectionConnector connector;
+  private ConnectionSource source;
+  private PoolImpl pool;
+  private CancelCriterion cancelCriterion;
+  private Connection connection;
+  private ServerLocation server;
+
+  @Before
+  public void before() throws Exception {
+    server = mock(ServerLocation.class);
+    connection = mock(Connection.class);
+    connector = mock(ConnectionConnector.class);
+    source = mock(ConnectionSource.class);
+    pool = mock(PoolImpl.class);
+    cancelCriterion = mock(CancelCriterion.class);
+    factory = new ConnectionFactoryImpl(connector, source, 5, pool, cancelCriterion);
+  }
+
+  @Test
+  public void authenticateIfRequired_noOp_whenUsedByGateway() throws Exception {

Review comment:
       Exception is not thrown in any of the `@Test` methods

##########
File path: geode-core/src/test/java/org/apache/geode/cache/client/internal/OpExecutorImplUnitTest.java
##########
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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.cache.client.internal;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.cache.client.internal.pooling.ConnectionManager;
+import org.apache.geode.distributed.internal.ServerLocation;
+
+public class OpExecutorImplUnitTest {
+  private OpExecutorImpl executor;
+  private ConnectionManager connectionManager;
+  private QueueManager queueManager;
+  private EndpointManager endpointManager;
+  private RegisterInterestTracker tracker;
+  private CancelCriterion cancelCriterion;
+  private PoolImpl pool;
+  private ServerLocation server;
+  private Connection connection;
+  private AbstractOp op;
+
+  @Before
+  public void before() throws Exception {
+    connectionManager = mock(ConnectionManager.class);
+    queueManager = mock(QueueManager.class);
+    endpointManager = mock(EndpointManager.class);
+    tracker = mock(RegisterInterestTracker.class);
+    cancelCriterion = mock(CancelCriterion.class);
+    server = mock(ServerLocation.class);
+    connection = mock(Connection.class);
+    pool = mock(PoolImpl.class);
+    op = mock(AbstractOp.class);
+    when(connection.getServer()).thenReturn(server);
+
+    executor = new OpExecutorImpl(connectionManager, queueManager, endpointManager, tracker, 1, 5L,
+        5L, cancelCriterion, pool);
+  }
+
+  @Test
+  public void authenticateIfRequired_noOp_WhenNotRequireCredential() throws Exception {

Review comment:
       None of the `@Test` methods throw Exception




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

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



[GitHub] [geode] jinmeiliao merged pull request #6948: GEODE-9663: refactor authenticateIfRequired

Posted by GitBox <gi...@apache.org>.
jinmeiliao merged pull request #6948:
URL: https://github.com/apache/geode/pull/6948


   


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

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



[GitHub] [geode] jmelchio commented on a change in pull request #6948: GEODE-9663: refactor authenticateIfRequired

Posted by GitBox <gi...@apache.org>.
jmelchio commented on a change in pull request #6948:
URL: https://github.com/apache/geode/pull/6948#discussion_r724341134



##########
File path: geode-core/src/test/java/org/apache/geode/cache/client/internal/ConnectionFactoryImplTest.java
##########
@@ -0,0 +1,103 @@
+/*
+ *
+ * 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.cache.client.internal;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.distributed.internal.ServerLocation;
+
+public class ConnectionFactoryImplTest {
+  private ConnectionFactoryImpl factory;
+  private ConnectionConnector connector;
+  private ConnectionSource source;
+  private PoolImpl pool;
+  private CancelCriterion cancelCriterion;
+  private Connection connection;
+  private ServerLocation server;
+
+  @Before
+  public void before() throws Exception {
+    server = mock(ServerLocation.class);
+    connection = mock(Connection.class);
+    connector = mock(ConnectionConnector.class);
+    source = mock(ConnectionSource.class);
+    pool = mock(PoolImpl.class);
+    cancelCriterion = mock(CancelCriterion.class);
+    factory = new ConnectionFactoryImpl(connector, source, 5, pool, cancelCriterion);
+  }
+
+  @Test
+  public void authenticateIfRequired_noOp_whenUsedByGateway() throws Exception {

Review comment:
       Exception is not thrown in any of the `@Test` methods

##########
File path: geode-core/src/test/java/org/apache/geode/cache/client/internal/OpExecutorImplUnitTest.java
##########
@@ -0,0 +1,102 @@
+/*
+ *
+ * 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.cache.client.internal;
+
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.mock;
+import static org.mockito.Mockito.never;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import org.apache.geode.CancelCriterion;
+import org.apache.geode.cache.client.internal.pooling.ConnectionManager;
+import org.apache.geode.distributed.internal.ServerLocation;
+
+public class OpExecutorImplUnitTest {
+  private OpExecutorImpl executor;
+  private ConnectionManager connectionManager;
+  private QueueManager queueManager;
+  private EndpointManager endpointManager;
+  private RegisterInterestTracker tracker;
+  private CancelCriterion cancelCriterion;
+  private PoolImpl pool;
+  private ServerLocation server;
+  private Connection connection;
+  private AbstractOp op;
+
+  @Before
+  public void before() throws Exception {
+    connectionManager = mock(ConnectionManager.class);
+    queueManager = mock(QueueManager.class);
+    endpointManager = mock(EndpointManager.class);
+    tracker = mock(RegisterInterestTracker.class);
+    cancelCriterion = mock(CancelCriterion.class);
+    server = mock(ServerLocation.class);
+    connection = mock(Connection.class);
+    pool = mock(PoolImpl.class);
+    op = mock(AbstractOp.class);
+    when(connection.getServer()).thenReturn(server);
+
+    executor = new OpExecutorImpl(connectionManager, queueManager, endpointManager, tracker, 1, 5L,
+        5L, cancelCriterion, pool);
+  }
+
+  @Test
+  public void authenticateIfRequired_noOp_WhenNotRequireCredential() throws Exception {

Review comment:
       None of the `@Test` methods throw Exception




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

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