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 2020/08/15 01:30:23 UTC

[GitHub] [shardingsphere] jacksparrow414 opened a new pull request #6854: fix issue 6850

jacksparrow414 opened a new pull request #6854:
URL: https://github.com/apache/shardingsphere/pull/6854


   * add test case for EncryptTableRuleConfigurationYamlSwapper
   
   Fixes #6850 .
   
   Changes proposed in this pull request:


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



[GitHub] [shardingsphere] coveralls commented on pull request #6854: fix issue 6850

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


   ## Pull Request Test Coverage Report for [Build 13781](https://coveralls.io/builds/32773602)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * No unchanged relevant lines lost coverage.
   * Overall coverage increased (+**0.1%**) to **58.142%**
   
   ---
   
   
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/32773602/badge)](https://coveralls.io/builds/32773602) |
   | :-- | --: |
   | Change from base [Build 13776](https://coveralls.io/builds/32764862): |  0.1% |
   | Covered Lines: | 13140 |
   | Relevant Lines: | 22600 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


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



[GitHub] [shardingsphere] jacksparrow414 commented on a change in pull request #6854: fix issue 6850

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



##########
File path: shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapperTest.java
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.encrypt.yaml.swapper.rule;
+
+import com.google.common.collect.Lists;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnRuleConfiguration;
+import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
+import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfiguration;
+import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+public final class EncryptTableRuleConfigurationYamlSwapperTest {
+    
+    private final EncryptTableRuleConfigurationYamlSwapper tableRuleConfigYamlSwapper = new EncryptTableRuleConfigurationYamlSwapper();
+    
+    @Test
+    public void assertSwapToYamlConfiguration() {
+        Collection<EncryptColumnRuleConfiguration> encryptColumnRuleConfigCollection =
+            Lists.newArrayList(
+                new EncryptColumnRuleConfiguration("encrypt_column_1", "encrypt_cipher_1", "", "", "test_encrypto_1r"),
+                new EncryptColumnRuleConfiguration("encrypt_column_2", "encrypt_cipher_2", "", "", "test_encryptor_2"),
+                new EncryptColumnRuleConfiguration("encrypt_column_3", "encrypt_cipher_3", "", "", "test_encryptor_3")
+              );
+        EncryptTableRuleConfiguration encryptTableRuleConfig = new EncryptTableRuleConfiguration("test_table", encryptColumnRuleConfigCollection);
+        YamlEncryptTableRuleConfiguration actualYamlEncryptTableRuleConfig = tableRuleConfigYamlSwapper.swapToYamlConfiguration(encryptTableRuleConfig);
+        assertNotNull(actualYamlEncryptTableRuleConfig);
+        assertFalse(actualYamlEncryptTableRuleConfig.getColumns().isEmpty());
+        assertThat(actualYamlEncryptTableRuleConfig.getColumns().size(), is(3));

Review comment:
       > Please add more assertions of columns content
   
   ok, I will add more assertions of columns content




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



[GitHub] [shardingsphere] terrymanu commented on a change in pull request #6854: fix issue 6850

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



##########
File path: shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapperTest.java
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.encrypt.yaml.swapper.rule;
+
+import com.google.common.collect.Lists;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnRuleConfiguration;
+import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
+import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfiguration;
+import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+public final class EncryptTableRuleConfigurationYamlSwapperTest {
+    
+    private final EncryptTableRuleConfigurationYamlSwapper tableRuleConfigYamlSwapper = new EncryptTableRuleConfigurationYamlSwapper();
+    
+    @Test
+    public void assertSwapToYamlConfiguration() {
+        Collection<EncryptColumnRuleConfiguration> encryptColumnRuleConfigCollection =
+            Lists.newArrayList(
+                new EncryptColumnRuleConfiguration("encrypt_column_1", "encrypt_cipher_1", "", "", "test_encrypto_1r"),
+                new EncryptColumnRuleConfiguration("encrypt_column_2", "encrypt_cipher_2", "", "", "test_encryptor_2"),
+                new EncryptColumnRuleConfiguration("encrypt_column_3", "encrypt_cipher_3", "", "", "test_encryptor_3")
+              );
+        EncryptTableRuleConfiguration encryptTableRuleConfig = new EncryptTableRuleConfiguration("test_table", encryptColumnRuleConfigCollection);
+        YamlEncryptTableRuleConfiguration actualYamlEncryptTableRuleConfig = tableRuleConfigYamlSwapper.swapToYamlConfiguration(encryptTableRuleConfig);
+        assertNotNull(actualYamlEncryptTableRuleConfig);
+        assertFalse(actualYamlEncryptTableRuleConfig.getColumns().isEmpty());
+        assertThat(actualYamlEncryptTableRuleConfig.getColumns().size(), is(3));
+    }
+    
+    @Test
+    public void assertSwapToObject() {
+        YamlEncryptColumnRuleConfiguration encryptColumnRuleConfig = new YamlEncryptColumnRuleConfiguration();
+        encryptColumnRuleConfig.setLogicColumn("encrypt_column");
+        encryptColumnRuleConfig.setCipherColumn("encrypt_cipher");
+        encryptColumnRuleConfig.setAssistedQueryColumn("encrypt_assisted");
+        encryptColumnRuleConfig.setPlainColumn("encrypt_plain");
+        encryptColumnRuleConfig.setEncryptorName("test_encryptor");
+        Map<String, YamlEncryptColumnRuleConfiguration> columns = new LinkedHashMap<>(1);
+        columns.put("test_column", encryptColumnRuleConfig);
+        YamlEncryptTableRuleConfiguration yamlEncryptTableRuleConfig = new YamlEncryptTableRuleConfiguration();
+        yamlEncryptTableRuleConfig.setName("test_table");
+        yamlEncryptTableRuleConfig.setColumns(columns);
+        EncryptTableRuleConfiguration actualEncryptTableRuleConfig = tableRuleConfigYamlSwapper.swapToObject(yamlEncryptTableRuleConfig);
+        assertNotNull(actualEncryptTableRuleConfig);
+        assertThat(actualEncryptTableRuleConfig.getName(), is("test_table"));
+        Collection<EncryptColumnRuleConfiguration> actualColumn = actualEncryptTableRuleConfig.getColumns();

Review comment:
       The variable should be `actualColumns`

##########
File path: shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/test/java/org/apache/shardingsphere/encrypt/yaml/swapper/rule/EncryptTableRuleConfigurationYamlSwapperTest.java
##########
@@ -0,0 +1,74 @@
+/*
+ * 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.encrypt.yaml.swapper.rule;
+
+import com.google.common.collect.Lists;
+import java.util.Collection;
+import java.util.LinkedHashMap;
+import java.util.Map;
+import org.apache.shardingsphere.encrypt.api.config.rule.EncryptColumnRuleConfiguration;
+import org.apache.shardingsphere.encrypt.api.config.rule.EncryptTableRuleConfiguration;
+import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptColumnRuleConfiguration;
+import org.apache.shardingsphere.encrypt.yaml.config.rule.YamlEncryptTableRuleConfiguration;
+import org.junit.Test;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertThat;
+
+public final class EncryptTableRuleConfigurationYamlSwapperTest {
+    
+    private final EncryptTableRuleConfigurationYamlSwapper tableRuleConfigYamlSwapper = new EncryptTableRuleConfigurationYamlSwapper();
+    
+    @Test
+    public void assertSwapToYamlConfiguration() {
+        Collection<EncryptColumnRuleConfiguration> encryptColumnRuleConfigCollection =
+            Lists.newArrayList(
+                new EncryptColumnRuleConfiguration("encrypt_column_1", "encrypt_cipher_1", "", "", "test_encrypto_1r"),
+                new EncryptColumnRuleConfiguration("encrypt_column_2", "encrypt_cipher_2", "", "", "test_encryptor_2"),
+                new EncryptColumnRuleConfiguration("encrypt_column_3", "encrypt_cipher_3", "", "", "test_encryptor_3")
+              );
+        EncryptTableRuleConfiguration encryptTableRuleConfig = new EncryptTableRuleConfiguration("test_table", encryptColumnRuleConfigCollection);
+        YamlEncryptTableRuleConfiguration actualYamlEncryptTableRuleConfig = tableRuleConfigYamlSwapper.swapToYamlConfiguration(encryptTableRuleConfig);
+        assertNotNull(actualYamlEncryptTableRuleConfig);
+        assertFalse(actualYamlEncryptTableRuleConfig.getColumns().isEmpty());
+        assertThat(actualYamlEncryptTableRuleConfig.getColumns().size(), is(3));

Review comment:
       Please add more assertions of columns content




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



[GitHub] [shardingsphere] terrymanu merged pull request #6854: fix issue 6850

Posted by GitBox <gi...@apache.org>.
terrymanu merged pull request #6854:
URL: https://github.com/apache/shardingsphere/pull/6854


   


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



[GitHub] [shardingsphere] coveralls edited a comment on pull request #6854: fix issue 6850

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on pull request #6854:
URL: https://github.com/apache/shardingsphere/pull/6854#issuecomment-675160072


   ## Pull Request Test Coverage Report for [Build 13786](https://coveralls.io/builds/32774334)
   
   * **0** of **0**   changed or added relevant lines in **0** files are covered.
   * **5** unchanged lines in **2** files lost coverage.
   * Overall coverage increased (+**0.2%**) to **58.272%**
   
   ---
   
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleConfigurationYamlSwapper.java](https://coveralls.io/builds/32774334/source?filename=shardingsphere-features%2Fshardingsphere-encrypt%2Fshardingsphere-encrypt-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fencrypt%2Fyaml%2Fswapper%2FEncryptRuleConfigurationYamlSwapper.java#L84) | 1 | 95.65% |
   | [shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-common/src/main/java/org/apache/shardingsphere/encrypt/yaml/swapper/EncryptRuleAlgorithmProviderConfigurationYamlSwapper.java](https://coveralls.io/builds/32774334/source?filename=shardingsphere-features%2Fshardingsphere-encrypt%2Fshardingsphere-encrypt-common%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fencrypt%2Fyaml%2Fswapper%2FEncryptRuleAlgorithmProviderConfigurationYamlSwapper.java#L45) | 4 | 21.05% |
   <!-- | **Total:** | **5** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/32774334/badge)](https://coveralls.io/builds/32774334) |
   | :-- | --: |
   | Change from base [Build 13776](https://coveralls.io/builds/32764862): |  0.2% |
   | Covered Lines: | 13169 |
   | Relevant Lines: | 22599 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   


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