@Test public void testDefaultRules() { AccountTelemetry result = underTest.createDefaultAccuontTelemetry(); for (AnonymizationRule rule : result.getRules()) { testPatternWithOutput(rule, "str myemail@email.com", "email"); testPatternWithOutput(rule, "333-44-2222", "XXX-"); testPatternWithOutput(rule, "card number: 1111-2222-3333-4444", "XXXX-"); testPatternWithOutput(rule, "- FPW: secret", "FPW"); } assertThat(result.getFeatures().getClusterLogsCollection().isEnabled()).isEqualTo(false); }
public AccountTelemetry createDefaultAccuontTelemetry() { AccountTelemetry defaultTelemetry = new AccountTelemetry(); List<AnonymizationRule> defaultRules = new ArrayList<>(); AnonymizationRule creditCardWithSepRule = new AnonymizationRule(); creditCardWithSepRule.setValue( Base64.getEncoder().encodeToString(CREDIT_CARD_PATTERN.getBytes())); creditCardWithSepRule.setReplacement(CREDIT_CARD_REPLACEMENT); AnonymizationRule ssnWithSepRule = new AnonymizationRule(); ssnWithSepRule.setValue( Base64.getEncoder().encodeToString(SSN_PATTERN.getBytes())); ssnWithSepRule.setReplacement(SSN_REPLACEMENT); AnonymizationRule emailRule = new AnonymizationRule(); emailRule.setValue( Base64.getEncoder().encodeToString(EMAIL_PATTERN.getBytes())); emailRule.setReplacement(EMAIL_REPLACEMENT); AnonymizationRule freeIpaPwdRule = new AnonymizationRule(); freeIpaPwdRule.setValue( Base64.getEncoder().encodeToString(FREEIPA_PWD_PATTERN.getBytes())); freeIpaPwdRule.setReplacement(FREEIPA_PWD_REPLACEMENT); defaultRules.add(creditCardWithSepRule); defaultRules.add(ssnWithSepRule); defaultRules.add(emailRule); defaultRules.add(freeIpaPwdRule); Features defaultFeatures = new Features(); defaultFeatures.addClusterLogsCollection(false); defaultTelemetry.setRules(defaultRules); defaultTelemetry.setFeatures(defaultFeatures); return defaultTelemetry; }
AccountTelemetryService { public AccountTelemetry createDefaultAccuontTelemetry() { AccountTelemetry defaultTelemetry = new AccountTelemetry(); List<AnonymizationRule> defaultRules = new ArrayList<>(); AnonymizationRule creditCardWithSepRule = new AnonymizationRule(); creditCardWithSepRule.setValue( Base64.getEncoder().encodeToString(CREDIT_CARD_PATTERN.getBytes())); creditCardWithSepRule.setReplacement(CREDIT_CARD_REPLACEMENT); AnonymizationRule ssnWithSepRule = new AnonymizationRule(); ssnWithSepRule.setValue( Base64.getEncoder().encodeToString(SSN_PATTERN.getBytes())); ssnWithSepRule.setReplacement(SSN_REPLACEMENT); AnonymizationRule emailRule = new AnonymizationRule(); emailRule.setValue( Base64.getEncoder().encodeToString(EMAIL_PATTERN.getBytes())); emailRule.setReplacement(EMAIL_REPLACEMENT); AnonymizationRule freeIpaPwdRule = new AnonymizationRule(); freeIpaPwdRule.setValue( Base64.getEncoder().encodeToString(FREEIPA_PWD_PATTERN.getBytes())); freeIpaPwdRule.setReplacement(FREEIPA_PWD_REPLACEMENT); defaultRules.add(creditCardWithSepRule); defaultRules.add(ssnWithSepRule); defaultRules.add(emailRule); defaultRules.add(freeIpaPwdRule); Features defaultFeatures = new Features(); defaultFeatures.addClusterLogsCollection(false); defaultTelemetry.setRules(defaultRules); defaultTelemetry.setFeatures(defaultFeatures); return defaultTelemetry; } }
AccountTelemetryService { public AccountTelemetry createDefaultAccuontTelemetry() { AccountTelemetry defaultTelemetry = new AccountTelemetry(); List<AnonymizationRule> defaultRules = new ArrayList<>(); AnonymizationRule creditCardWithSepRule = new AnonymizationRule(); creditCardWithSepRule.setValue( Base64.getEncoder().encodeToString(CREDIT_CARD_PATTERN.getBytes())); creditCardWithSepRule.setReplacement(CREDIT_CARD_REPLACEMENT); AnonymizationRule ssnWithSepRule = new AnonymizationRule(); ssnWithSepRule.setValue( Base64.getEncoder().encodeToString(SSN_PATTERN.getBytes())); ssnWithSepRule.setReplacement(SSN_REPLACEMENT); AnonymizationRule emailRule = new AnonymizationRule(); emailRule.setValue( Base64.getEncoder().encodeToString(EMAIL_PATTERN.getBytes())); emailRule.setReplacement(EMAIL_REPLACEMENT); AnonymizationRule freeIpaPwdRule = new AnonymizationRule(); freeIpaPwdRule.setValue( Base64.getEncoder().encodeToString(FREEIPA_PWD_PATTERN.getBytes())); freeIpaPwdRule.setReplacement(FREEIPA_PWD_REPLACEMENT); defaultRules.add(creditCardWithSepRule); defaultRules.add(ssnWithSepRule); defaultRules.add(emailRule); defaultRules.add(freeIpaPwdRule); Features defaultFeatures = new Features(); defaultFeatures.addClusterLogsCollection(false); defaultTelemetry.setRules(defaultRules); defaultTelemetry.setFeatures(defaultFeatures); return defaultTelemetry; } AccountTelemetryService(AccountTelemetryRepository accountTelemetryRepository); }
AccountTelemetryService { public AccountTelemetry createDefaultAccuontTelemetry() { AccountTelemetry defaultTelemetry = new AccountTelemetry(); List<AnonymizationRule> defaultRules = new ArrayList<>(); AnonymizationRule creditCardWithSepRule = new AnonymizationRule(); creditCardWithSepRule.setValue( Base64.getEncoder().encodeToString(CREDIT_CARD_PATTERN.getBytes())); creditCardWithSepRule.setReplacement(CREDIT_CARD_REPLACEMENT); AnonymizationRule ssnWithSepRule = new AnonymizationRule(); ssnWithSepRule.setValue( Base64.getEncoder().encodeToString(SSN_PATTERN.getBytes())); ssnWithSepRule.setReplacement(SSN_REPLACEMENT); AnonymizationRule emailRule = new AnonymizationRule(); emailRule.setValue( Base64.getEncoder().encodeToString(EMAIL_PATTERN.getBytes())); emailRule.setReplacement(EMAIL_REPLACEMENT); AnonymizationRule freeIpaPwdRule = new AnonymizationRule(); freeIpaPwdRule.setValue( Base64.getEncoder().encodeToString(FREEIPA_PWD_PATTERN.getBytes())); freeIpaPwdRule.setReplacement(FREEIPA_PWD_REPLACEMENT); defaultRules.add(creditCardWithSepRule); defaultRules.add(ssnWithSepRule); defaultRules.add(emailRule); defaultRules.add(freeIpaPwdRule); Features defaultFeatures = new Features(); defaultFeatures.addClusterLogsCollection(false); defaultTelemetry.setRules(defaultRules); defaultTelemetry.setFeatures(defaultFeatures); return defaultTelemetry; } AccountTelemetryService(AccountTelemetryRepository accountTelemetryRepository); AccountTelemetry create(AccountTelemetry telemetry, String accountId); AccountTelemetry getOrDefault(String accountId); Features updateFeatures(String accountId, Features newFeatures); AccountTelemetry createDefaultAccuontTelemetry(); String testRulePatterns(List<AnonymizationRule> rules, String input); }
AccountTelemetryService { public AccountTelemetry createDefaultAccuontTelemetry() { AccountTelemetry defaultTelemetry = new AccountTelemetry(); List<AnonymizationRule> defaultRules = new ArrayList<>(); AnonymizationRule creditCardWithSepRule = new AnonymizationRule(); creditCardWithSepRule.setValue( Base64.getEncoder().encodeToString(CREDIT_CARD_PATTERN.getBytes())); creditCardWithSepRule.setReplacement(CREDIT_CARD_REPLACEMENT); AnonymizationRule ssnWithSepRule = new AnonymizationRule(); ssnWithSepRule.setValue( Base64.getEncoder().encodeToString(SSN_PATTERN.getBytes())); ssnWithSepRule.setReplacement(SSN_REPLACEMENT); AnonymizationRule emailRule = new AnonymizationRule(); emailRule.setValue( Base64.getEncoder().encodeToString(EMAIL_PATTERN.getBytes())); emailRule.setReplacement(EMAIL_REPLACEMENT); AnonymizationRule freeIpaPwdRule = new AnonymizationRule(); freeIpaPwdRule.setValue( Base64.getEncoder().encodeToString(FREEIPA_PWD_PATTERN.getBytes())); freeIpaPwdRule.setReplacement(FREEIPA_PWD_REPLACEMENT); defaultRules.add(creditCardWithSepRule); defaultRules.add(ssnWithSepRule); defaultRules.add(emailRule); defaultRules.add(freeIpaPwdRule); Features defaultFeatures = new Features(); defaultFeatures.addClusterLogsCollection(false); defaultTelemetry.setRules(defaultRules); defaultTelemetry.setFeatures(defaultFeatures); return defaultTelemetry; } AccountTelemetryService(AccountTelemetryRepository accountTelemetryRepository); AccountTelemetry create(AccountTelemetry telemetry, String accountId); AccountTelemetry getOrDefault(String accountId); Features updateFeatures(String accountId, Features newFeatures); AccountTelemetry createDefaultAccuontTelemetry(); String testRulePatterns(List<AnonymizationRule> rules, String input);  }