use of org.ihtsdo.drools.service.TestResourceProvider in project snomed-drools by IHTSDO.
the class RuleExecutor method newTestResourceProvider.
/**
* TestResourceProvider should be created once and used by other services to load test resources such as the case significant words list.
* Calling this method again will load the resources again so can be useful if the resources change.
* @param resourceManager The resource manager to use to load the test resource files.
* @return A TestResourceProvider which uses the resourceManager.
* @throws RuleExecutorException if there is a problem loading the test resources.
*/
public TestResourceProvider newTestResourceProvider(ResourceManager resourceManager) throws RuleExecutorException {
try {
TestResourceProvider testResourceProvider = new TestResourceProvider(resourceManager);
testResourcesEmpty = !testResourceProvider.isAnyResourcesLoaded();
return testResourceProvider;
} catch (IOException e) {
testResourcesEmpty = true;
throw new RuleExecutorException("Failed to load test resources.", e);
}
}
use of org.ihtsdo.drools.service.TestResourceProvider in project snomed-drools by IHTSDO.
the class RuleExecutor method newTestResourceProvider.
public TestResourceProvider newTestResourceProvider(String awsKey, String awsSecretKey, String bucket, String path) throws RuleExecutorException {
try {
AmazonS3 amazonS3 = AmazonS3ClientBuilder.standard().withRegion("us-east-1").withCredentials(new AWSStaticCredentialsProvider(new BasicAWSCredentials(awsKey, awsSecretKey))).build();
ManualResourceConfiguration resourceConfiguration = new ManualResourceConfiguration(true, true, null, new ResourceConfiguration.Cloud(bucket, path));
ResourceManager resourceManager = new ResourceManager(resourceConfiguration, new SimpleStorageResourceLoader(amazonS3));
TestResourceProvider testResourceProvider = new TestResourceProvider(resourceManager);
testResourcesEmpty = !testResourceProvider.isAnyResourcesLoaded();
return testResourceProvider;
} catch (IOException e) {
testResourcesEmpty = true;
throw new RuleExecutorException("Failed to load test resources.", e);
}
}
use of org.ihtsdo.drools.service.TestResourceProvider in project snomed-drools by IHTSDO.
the class RulesTestManual method setup.
@Before
public void setup() {
ManualResourceConfiguration resourceConfiguration = new ManualResourceConfiguration(true, false, new ResourceConfiguration.Local("src/test/resources/dummy-test-resources"), null);
TestResourceProvider testResourceProvider = this.ruleExecutor.newTestResourceProvider(new ResourceManager(resourceConfiguration, null));
conceptService = new TestConceptService(concepts);
descriptionService = new TestDescriptionService(concepts, testResourceProvider);
relationshipService = new TestRelationshipService(concepts);
}
use of org.ihtsdo.drools.service.TestResourceProvider in project snomed-drools by IHTSDO.
the class RuleExecutorTest method setup.
@Before
public void setup() {
ruleExecutor = new RuleExecutorFactory().createRuleExecutor("src/test/resources/rules");
ManualResourceConfiguration resourceConfiguration = new ManualResourceConfiguration(true, false, new ResourceConfiguration.Local("src/test/resources/dummy-test-resources"), null);
TestResourceProvider testResourceProvider = ruleExecutor.newTestResourceProvider(new ResourceManager(resourceConfiguration, null));
final Map<String, Concept> concepts = new HashMap<>();
conceptService = new TestConceptService(concepts);
descriptionService = new TestDescriptionService(concepts, testResourceProvider);
relationshipService = new TestRelationshipService(concepts);
}
use of org.ihtsdo.drools.service.TestResourceProvider in project snomed-drools by IHTSDO.
the class DroolsDescriptionServiceTest method setup.
@Before
public void setup() throws IOException {
loadConceptsIntoRepository();
loadDescriptionsIntoRepository();
ResourceManager resourceManager = new ResourceManager(DroolsRF2Validator.BLANK_RESOURCES_CONFIGURATION, null);
droolsDescriptionService = new DroolsDescriptionService(repository, new TestResourceProvider(resourceManager));
}
Aggregations