EncryptRule implements ShardingSphereRule { public Collection<String> getEncryptTableNames() { return tables.keySet(); } EncryptRule(final EncryptRuleConfiguration config);  EncryptRule(final AlgorithmProvidedEncryptRuleConfiguration config); Collection<String> getEncryptTableNames(); Optional<EncryptTable> findEncryptTable(final String logicTable); Optional<EncryptAlgorithm> findEncryptor(final String logicTable, final String logicColumn); List<Object> getEncryptValues(final String logicTable, final String logicColumn, final List<Object> originalValues); boolean isCipherColumn(final String tableName, final String columnName); String getCipherColumn(final String logicTable, final String logicColumn); String getLogicColumnOfCipher(final String logicTable, final String cipherColumn); Map<String, String> getLogicAndCipherColumns(final String logicTable); Optional<String> findAssistedQueryColumn(final String logicTable, final String logicColumn); Collection<String> getAssistedQueryColumns(final String logicTable); List<Object> getEncryptAssistedQueryValues(final String logicTable, final String logicColumn, final List<Object> originalValues); Collection<String> getAssistedQueryAndPlainColumns(final String logicTable); Optional<String> findPlainColumn(final String logicTable, final String logicColumn);  }
@Test public void assertNewInstanceWithAlgorithmProvidedEncryptRuleConfiguration() { EncryptColumnRuleConfiguration encryptColumnConfig = new EncryptColumnRuleConfiguration("encrypt_column", "encrypt_cipher", "", "", "test_encryptor"); EncryptTableRuleConfiguration tableConfig = new EncryptTableRuleConfiguration("t_encrypt", Collections.singletonList(encryptColumnConfig)); AlgorithmProvidedEncryptRuleConfiguration ruleConfig = new AlgorithmProvidedEncryptRuleConfiguration( Collections.singleton(tableConfig), ImmutableMap.of("test_encryptor", new TestEncryptAlgorithm())); EncryptRule actual = new EncryptRule(ruleConfig); assertThat(actual.getEncryptTableNames(), is(Collections.singleton("t_encrypt"))); }
@Test public void assertGetEncryptTableNames() { assertFalse(new EncryptRule(createEncryptRuleConfiguration()).getEncryptTableNames().isEmpty()); }