Skip to content

Commit 33af3a6

Browse files
committed
caching local profiles
1 parent da0b12a commit 33af3a6

File tree

2 files changed

+2
-7
lines changed

2 files changed

+2
-7
lines changed

curation-cr/src/main/java/eu/clarin/cmdi/curation/cr/cache/CRCache.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public class CRCache {
5151
* @return the public entry
5252
* @throws CCRServiceNotAvailableException the ccr service is not available
5353
*/
54-
@Cacheable(value = "crCache", key ="#schemaLocation", condition = "#schemaLocation.startsWith('http')", sync = true)
54+
@Cacheable(value = "crCache", key ="#schemaLocation", sync = true)
5555
public ProfileCacheEntry getEntry(String schemaLocation) throws CRServiceStorageException, CCRServiceNotAvailableException, PPHCacheException {
5656

5757
String fileName = schemaLocation.replaceAll("[/.:]", "_");

curation-cr/src/test/java/eu/clarin/cmdi/curation/cr/CRServiceTests.java

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -86,8 +86,6 @@ void serverNotAvailable() {
8686
assertNotNull(cacheManager.getCache("crCache").get("http://www.wowasa.com/clarin.eu:cr1:p_1403526079381/xsd"));
8787
// even with a local file it should throw an exception
8888
assertDoesNotThrow(() -> this.crCache.getEntry(Paths.get("tmp", "77777").toUri().toString()));
89-
// but it shouldn't be cached
90-
assertNull(cacheManager.getCache("crCache").get(Paths.get("tmp", "77777").toUri().toString()));
9189
}
9290
catch (Exception e) {
9391

@@ -176,10 +174,7 @@ void cacheUsage() {
176174

177175
assertNotNull(cacheManager.getCache("crCache").get("https://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/1.x/profiles/clarin.eu:cr1:p_1403526079380/xsd"));
178176
assertNotNull(cacheManager.getCache("crCache").get("https://catalog.clarin.eu/ds/ComponentRegistry/rest/registry/1.x/profiles/clarin.eu:cr1:p_9990106710826/xsd"));
179-
// next should NOT be cached when loaded from a file
180-
assertNull(cacheManager.getCache("crCache").get(this.crConfig.getCrCache().resolve("https___catalog_clarin_eu_ds_ComponentRegistry_rest_registry_1_x_profiles_clarin_eu_cr1_p_1403526079380_xsd.xsd").toUri().toString()));
181-
182-
}
177+
}
183178
catch (Exception e) {
184179

185180
log.error("error in schema");

0 commit comments

Comments
 (0)