RED-9472: seperation of system rules
fixed failing tests
This commit is contained in:
parent
370b76628b
commit
ed9f2defbc
@ -1,56 +1,34 @@
|
|||||||
package com.iqser.red.service.redaction.v1.server.rulesmanagement;
|
package com.iqser.red.service.redaction.v1.server.rulesmanagement;
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
|
|
||||||
import com.iqser.red.service.redaction.v1.server.rulesmanagement.models.ApplicationType;
|
import com.iqser.red.service.redaction.v1.server.rulesmanagement.models.ApplicationType;
|
||||||
|
|
||||||
import lombok.SneakyThrows;
|
|
||||||
|
|
||||||
@SuppressWarnings("PMD")
|
@SuppressWarnings("PMD")
|
||||||
public class RuleManagementResources {
|
public class RuleManagementResources {
|
||||||
|
|
||||||
public static InputStream getAllRulesInputStream(ApplicationType applicationType) {
|
public static InputStream getAllRulesInputStream(ApplicationType applicationType) {
|
||||||
|
|
||||||
if (applicationType == ApplicationType.RM) {
|
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) {
|
public static InputStream getDefaultRuleIdentifiesInputStream(ApplicationType applicationType) {
|
||||||
|
|
||||||
if (applicationType == ApplicationType.RM) {
|
if (applicationType == ApplicationType.RM) {
|
||||||
return RuleManagementResources.class.getClassLoader().getResourceAsStream("default_rule_identifiers.txt");
|
return RuleManagementResources.class.getClassLoader().getResourceAsStream("rulesmanagement/default_rule_identifiers.txt");
|
||||||
} else {
|
} 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() {
|
public static InputStream getTemplateInputStream() {
|
||||||
|
|
||||||
return RuleManagementResources.class.getClassLoader().getResourceAsStream("order_template.txt");
|
return RuleManagementResources.class.getClassLoader().getResourceAsStream("rulesmanagement/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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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.RuleFileBluePrint;
|
||||||
import com.iqser.red.service.redaction.v1.server.rulesmanagement.models.RuleIdentifier;
|
import com.iqser.red.service.redaction.v1.server.rulesmanagement.models.RuleIdentifier;
|
||||||
|
|
||||||
public class RuleCompilationResultMergingTest {
|
public class RuleFileBluePrintMergingTest {
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testBothRuleFilesCanBeMerged() {
|
public void testBothRuleFilesCanBeMerged() {
|
||||||
Loading…
x
Reference in New Issue
Block a user