RED-9472: seperation of system rules

fixed failing tests
This commit is contained in:
yhampe 2024-10-16 09:29:01 +02:00
parent 370b76628b
commit ed9f2defbc
2 changed files with 6 additions and 28 deletions

View File

@ -1,56 +1,34 @@
package com.iqser.red.service.redaction.v1.server.rulesmanagement;
import java.io.File;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;
import com.iqser.red.service.redaction.v1.server.rulesmanagement.models.ApplicationType;
import lombok.SneakyThrows;
@SuppressWarnings("PMD")
public class RuleManagementResources {
public static InputStream getAllRulesInputStream(ApplicationType applicationType) {
if (applicationType == ApplicationType.RM) {
return RuleManagementResources.class.getClassLoader().getResourceAsStream("all_redact_manager_rules.drl");
return RuleManagementResources.class.getClassLoader().getResourceAsStream("drools/all_redact_manager_rules.drl");
}
return RuleManagementResources.class.getClassLoader().getResourceAsStream("all_rules_documine.drl");
return RuleManagementResources.class.getClassLoader().getResourceAsStream("drools/all_rules_documine.drl");
}
public static InputStream getDefaultRuleIdentifiesInputStream(ApplicationType applicationType) {
if (applicationType == ApplicationType.RM) {
return RuleManagementResources.class.getClassLoader().getResourceAsStream("default_rule_identifiers.txt");
return RuleManagementResources.class.getClassLoader().getResourceAsStream("rulesmanagement/default_rule_identifiers.txt");
} else {
return RuleManagementResources.class.getClassLoader().getResourceAsStream("default_rule_identifiers_dm.txt");
return RuleManagementResources.class.getClassLoader().getResourceAsStream("rulesmanagement/default_rule_identifiers_dm.txt");
}
}
public static InputStream getTemplateInputStream() {
return RuleManagementResources.class.getClassLoader().getResourceAsStream("order_template.txt");
}
public static InputStream getOldRulesCsvInputStream() {
return RuleManagementResources.class.getClassLoader().getResourceAsStream("old_rules_with_translations.csv");
}
@SneakyThrows
public static String createTempOldRulesCsv(String formattedAsCsv) {
File csvFile = File.createTempFile("old_rules_with_translations-", ".csv");
try (var out = new FileOutputStream(csvFile)) {
out.write(formattedAsCsv.getBytes(StandardCharsets.UTF_8));
}
return csvFile.toString();
return RuleManagementResources.class.getClassLoader().getResourceAsStream("rulesmanagement/order_template.txt");
}
}

View File

@ -8,7 +8,7 @@ import com.iqser.red.service.redaction.v1.server.rulesmanagement.factory.RuleFil
import com.iqser.red.service.redaction.v1.server.rulesmanagement.models.RuleFileBluePrint;
import com.iqser.red.service.redaction.v1.server.rulesmanagement.models.RuleIdentifier;
public class RuleCompilationResultMergingTest {
public class RuleFileBluePrintMergingTest {
@Test
public void testBothRuleFilesCanBeMerged() {