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

[GitHub] [shardingsphere] SriSatyaT opened a new pull request #11663: GovernanceExecuteProcessReporterTest

SriSatyaT opened a new pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663


   Fixes #10969 
   
   Changes proposed in this pull request:
   -
   -Added Unit Test for Governance Execute Process Reporter
   


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

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



[GitHub] [shardingsphere] SriSatyaT commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
SriSatyaT commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-893618115


   @menghaoranss Will look into it.


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

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



[GitHub] [shardingsphere] SriSatyaT commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
SriSatyaT commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-894668263


   @tristaZero Yes it's my first pr. I have introduced in slack channel 😃.


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

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



[GitHub] [shardingsphere] SriSatyaT commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
SriSatyaT commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-893618691


   Thanks @menghaoranss. Will look into it.


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

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



[GitHub] [shardingsphere] tristaZero commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
tristaZero commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-913094837


   @SriSatyaT Hi Any block?


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

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



[GitHub] [shardingsphere] SriSatyaT commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
SriSatyaT commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-980533573


   > @SriSatyaT hi, This PR has been for a long time. If there is no progress, I will close this PR later. If you are interested in continuing, please feel free to commit another pr, thanks.
   
   Alright. I'll try pick some other issues.


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

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



[GitHub] [shardingsphere] menghaoranss commented on a change in pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
menghaoranss commented on a change in pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#discussion_r685056382



##########
File path: shardingsphere-governance/shardingsphere-governance-context/src/test/java/org/apache/shardingsphere/governance/context/Process/GovernanceExecuteProcessReporterTest.java
##########
@@ -0,0 +1,73 @@
+/*
+ * 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.shardingsphere.governance.context.process;
+
+import org.apache.shardingsphere.governance.core.registry.process.event.ExecuteProcessReportEvent;
+import org.apache.shardingsphere.governance.core.registry.process.event.ExecuteProcessSummaryReportEvent;
+import org.apache.shardingsphere.governance.core.registry.process.event.ExecuteProcessUnitReportEvent;
+import org.apache.shardingsphere.infra.binder.LogicSQL;
+import org.apache.shardingsphere.infra.eventbus.ShardingSphereEventBus;
+import org.apache.shardingsphere.infra.executor.kernel.model.ExecutionGroupContext;
+import org.apache.shardingsphere.infra.executor.sql.execute.engine.SQLExecutionUnit;
+import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessConstants;
+import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessContext;
+import org.apache.shardingsphere.infra.executor.sql.process.model.ExecuteProcessUnit;
+import org.apache.shardingsphere.infra.executor.sql.process.spi.ExecuteProcessReporter;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.mockito.Mock;
+import org.mockito.junit.MockitoJUnitRunner;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.eq;
+import static org.mockito.Mockito.verify;
+import static org.mockito.Mockito.when;
+
+@RunWith(MockitoJUnitRunner.class)
+public final class GovernanceExecuteProcessReporterTest {
+
+    @Mock
+    private ShardingSphereEventBus shardingSphereEventBus;
+
+    @Test
+    public void assertReport() {
+        ExecuteProcessReporter executeProcessReporter = new GovernanceExecuteProcessReporter(shardingSphereEventBus);
+        ExecuteProcessContext executeProcessContext = new ExecuteProcessContext(ExecuteProcessConstants.EXECUTE_PROCESS_TYPE, "ds_0", "schema_0", "table_0", "sql_0");
+        ExecuteProcessUnit executeProcessUnit = new ExecuteProcessUnit(ExecuteProcessConstants.EXECUTE_PROCESS_TYPE, "ds_0", "schema_0", "table_0", "sql_0");
+        ExecuteProcessReportEvent executeProcessReportEvent = new ExecuteProcessReportEvent(executeProcessContext, executeProcessUnit, executionGroupContext);
+        executeProcessReporter.report(executeProcessReportEvent);
+        verify(shardingSphereEventBus).post(any(ExecuteProcessSummaryReportEvent.class));
+        verify(shardingSphereEventBus).post(any(ExecuteProcessUnitReportEvent.class));
+    }
+
+    @Test
+    public void assertReportWithLogicSQL() {
+        ExecuteProcessReporter executeProcessReporter = new GovernanceExecuteProcessReporter(shardingSphereEventBus);
+        ExecutionGroupContext executionGroupContext = new ExecutionGroupContext(ExecuteProcessConstants.EXECUTE_PROCESS_TYPE, "ds_0", "schema_0", "table_0", "sql_0");
+        ExecuteProcessReportEvent executeProcessReportEvent = new ExecuteProcessReportEvent(executeProcessContext, executionGroupContext);
+        executeProcessReporter.report(executeProcessReportEvent);
+        verify(shardingSphereEventBus).post(any(ExecuteProcessSummaryReportEvent.class));
+        verify(shardingSphereEventBus).post(any(ExecuteProcessUnitReportEvent.class));
+        verify(shardingSphereEventBus).post(any(LogicSQL.class));
+    }
+    

Review comment:
       Missing `}` , and please keep a blank line at the end of file




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

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



[GitHub] [shardingsphere] tristaZero commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
tristaZero commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-894660728


   Hi @SriSatyaT Is this your first PR in this community? Please have my welcome! BTW, could I know what makes you come here?


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

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



[GitHub] [shardingsphere] menghaoranss commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
menghaoranss commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-979911828


   @SriSatyaT hi, This PR has been for a long time. If there is no progress, I will close this PR later. If you are interested in continuing, please feel free to commit another pr, thanks.
   


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

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



[GitHub] [shardingsphere] menghaoranss commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
menghaoranss commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-895096346


   @SriSatyaT hi, there are some minor problems that cause to ci build failed , and I have explained in the `requested changes`, please check again.


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

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



[GitHub] [shardingsphere] menghaoranss commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
menghaoranss commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-893381711


   @SriSatyaT ci build failed.


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

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



[GitHub] [shardingsphere] SriSatyaT commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
SriSatyaT commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-927571914


   > @SriSatyaT No hurries and worries, go ahead. ;-)
   
   Sure. Thank you :)


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

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



[GitHub] [shardingsphere] SriSatyaT commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
SriSatyaT commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-927126632


   > @SriSatyaT Hi Any block?
   
   Hey, Yeah I have to recheck it. I might did many mistakes while making a pr.


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

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



[GitHub] [shardingsphere] menghaoranss commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
menghaoranss commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-894201983


   > Thanks @menghaoranss. Will look into it.
   
   May be you should pull the master branch code first.


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

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



[GitHub] [shardingsphere] menghaoranss closed pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
menghaoranss closed pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663


   


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

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



[GitHub] [shardingsphere] tristaZero commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
tristaZero commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-927571509


   @SriSatyaT No hurries and worries, go ahead. ;-)


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

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



[GitHub] [shardingsphere] SriSatyaT removed a comment on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
SriSatyaT removed a comment on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-893618115


   @menghaoranss Will look into it.


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

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



[GitHub] [shardingsphere] SriSatyaT commented on pull request #11663: GovernanceExecuteProcessReporterTest

Posted by GitBox <gi...@apache.org>.
SriSatyaT commented on pull request #11663:
URL: https://github.com/apache/shardingsphere/pull/11663#issuecomment-895111940


   @menghaoranss Thank you for reviewing pr. I'll modify them.


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

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