use of com.sequenceiq.environment.telemetry.domain.AccountTelemetry in project cloudbreak by hortonworks.
the class AccountTelemetryServiceTest method testDefaultRules.
@Test
public void testDefaultRules() {
// GIVEN
// WHEN
AccountTelemetry result = underTest.createDefaultAccuontTelemetry();
// THEN
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");
testPatternWithOutput(rule, "cdpHashedPassword='{SHA512}abcdef'", "[CDP");
}
assertThat(result.getFeatures().getClusterLogsCollection().isEnabled()).isEqualTo(false);
}
use of com.sequenceiq.environment.telemetry.domain.AccountTelemetry in project cloudbreak by hortonworks.
the class AccountTelemetryServiceTest method testValidateRulesWithInvalidRules.
@Test
public void testValidateRulesWithInvalidRules() {
// GIVEN
AccountTelemetry telemetry = new AccountTelemetry();
List<AnonymizationRule> rules = new ArrayList<>();
AnonymizationRule rule = new AnonymizationRule();
rule.setReplacement("[REDACTED]");
String pattern = "invalidrule{";
String encodedPattern = new String(Base64.getEncoder().encode(pattern.getBytes()));
rule.setValue(encodedPattern);
rules.add(rule);
telemetry.setRules(rules);
// THEN
assertThrows(BadRequestException.class, () -> {
// WHEN
underTest.validateAnonymizationRules(telemetry);
});
}
Aggregations