Skip to content

Commit

Permalink
fixes for comments
Browse files Browse the repository at this point in the history
  • Loading branch information
sergey-zinchenko committed Dec 26, 2024
1 parent a1e8194 commit e45f5b4
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ ObjectNode getSchema() throws JsonProcessingException {
try {
schemaId = URI.create(schemaIdParam);
} catch (IllegalArgumentException e) {
throw new HttpException(HttpStatus.BAD_REQUEST, "Schema ID is required");
throw new HttpException(HttpStatus.BAD_REQUEST, "Bad Schema ID");
}

String schema = context.getConfig().getApplicationTypeSchemas().get(schemaId.toString());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -378,12 +378,23 @@ private void prepareAndValidatePublicationRequest(ProxyContext context, Publicat
validateRules(publication);
}

/**
* Builds the target folder path for custom application files.
*
* @param resource the publication resource containing the target URL
* @return the constructed target folder path for custom application files
*/
private static String buildTargetFolderForCustomAppFiles(Publication.Resource resource) {
String targetUrl = resource.getTargetUrl();
String appPath = targetUrl.substring(targetUrl.indexOf(ResourceDescriptor.PATH_SEPARATOR,
targetUrl.indexOf(ResourceDescriptor.PATH_SEPARATOR) + 1) + 1,
targetUrl.lastIndexOf(ResourceDescriptor.PATH_SEPARATOR));
String appName = targetUrl.substring(targetUrl.lastIndexOf(ResourceDescriptor.PATH_SEPARATOR) + 1);
// Find the index of the end of a bucket segment (the second slash in the target URL)
int indexOfBucketEndSlash = targetUrl.indexOf(ResourceDescriptor.PATH_SEPARATOR, targetUrl.indexOf(ResourceDescriptor.PATH_SEPARATOR) + 1);
// Find the index of the start of a file name (the last slash in the target URL)
int indexOfFileNameStartSlash = targetUrl.lastIndexOf(ResourceDescriptor.PATH_SEPARATOR);
// Extract the application path from the target URL
String appPath = targetUrl.substring(indexOfBucketEndSlash + 1, indexOfFileNameStartSlash);
// Extract the application name from the target URL
String appName = targetUrl.substring(indexOfFileNameStartSlash + 1);
// Construct and return the target folder path
return appPath + ResourceDescriptor.PATH_SEPARATOR + "." + appName + ResourceDescriptor.PATH_SEPARATOR;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ void init() throws Exception {
redis = RedisServer.newRedisServer()
.port(16370)
.bind("127.0.0.1")
.onShutdownForceStop(true)
.onShutdownForceStop(true) // redis on windows does not stop gracefully. So tests takes 6h to complete otherwise.
.setting("maxmemory 16M")
.setting("maxmemory-policy volatile-lfu")
.build();
Expand Down

0 comments on commit e45f5b4

Please sign in to comment.