use of com.dexels.navajo.repository.api.RepositoryInstance in project navajo by Dexels.
the class BundleQueueComponent method checkForChangedScripts.
private void checkForChangedScripts(Event e, String folder) {
RepositoryInstance ri = (RepositoryInstance) e.getProperty("repository");
Set<String> changedScripts = new HashSet<>(RepositoryEventParser.filterChanged(e, folder));
for (String changedScript : changedScripts) {
// Replace windows backslashes with normal ones
changedScript = changedScript.replace("\\", "/");
try {
File location = new File(ri.getRepositoryFolder(), changedScript);
if (location.isFile()) {
String stripped = changedScript.substring(folder.length());
int dotIndex = stripped.lastIndexOf('.');
if (dotIndex < 0) {
logger.info("Scripts need an extension, and {} has none. Ignoring update.", stripped);
continue;
}
String scriptName = stripped.substring(0, dotIndex);
String extension = stripped.substring(dotIndex, stripped.length());
if (!SUPPORTED_EXTENSIONS.contains(extension)) {
logger.info("Ignoring file update {} due to non-matching extension: {} ", scriptName, extension);
continue;
}
if (scriptName.endsWith("entitymapping")) {
continue;
}
enqueueScript(scriptName, changedScript);
}
} catch (IllegalArgumentException e1) {
logger.warn("Error in handling changed script {}: {}", changedScript, e1);
}
}
}
use of com.dexels.navajo.repository.api.RepositoryInstance in project navajo by Dexels.
the class TestHttpResource method setUp.
@Before
public void setUp() throws Exception {
this.access = new Access();
access.setTenant("MYTENANT");
factory = new HttpResourceFactory();
component = new ResourceComponent();
RepositoryInstance instance = createStubInstance("test");
component.setRepositoryInstance(instance);
Map<String, Object> settings = new HashMap<String, Object>();
String url = TestConfig.HTTP_TEST_URL.getValue();
Assert.assertNotNull(url);
settings.put("url", url);
settings.put("name", "binstore");
settings.put("authorization", TestConfig.HTTP_TEST_TOKEN.getValue());
settings.put("secret", TestConfig.HTTP_TEST_SECRET.getValue());
settings.put("expire", "120");
component.activate(settings);
factory.addHttpResource(component, settings);
factory.activate();
}
Aggregations