-
Notifications
You must be signed in to change notification settings - Fork 97
Redis handler and heuristic calculator. #1345
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…s Handler now creates a generic structure with Redis data. Also Redis client is using redis-data no more. It now uses Lettuce with refflection
…s Handler now creates a generic structure with Redis data. Also Redis client is using redis-data no more. It now uses Lettuce with refflection
…om/WebFuzzing/EvoMaster into feature/redis-distance-calculation
...src/main/java/org/evomaster/client/java/controller/internal/db/RedisDistanceWithMetrics.java
Show resolved
Hide resolved
...r/src/main/java/org/evomaster/client/java/controller/internal/db/RedisCommandEvaluation.java
Show resolved
Hide resolved
| } | ||
|
|
||
| case HGETALL: { | ||
| List<RedisInfo> redisInfo = createRedisInfoForKeysByType("hash", redisClient); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace "hash" with string constant
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added constant Strings.
| } | ||
|
|
||
| case GET: { | ||
| List<RedisInfo> redisInfo = createRedisInfoForKeysByType("string", redisClient); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace all "...." string constants with constant definitions
| } | ||
|
|
||
| default: | ||
| return new RedisDistanceWithMetrics(1d, 0); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
replace 1d with constant value
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added constant value for MAX_REDIS_DISTANCE in RedisHeuristicCalculator, and that is the value imported in RedisHandler.
|
|
||
| public class RedisHeuristicsCalculator { | ||
|
|
||
| public static final double MAX_DISTANCE = 1d; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
rename to MAX_REDIS_DISTANCE
| * @param redisPattern the Redis glob-style pattern (e.g., "h?llo*", "user:[0-9]*") | ||
| * @return a valid Java regex string equivalent to the Redis pattern. | ||
| */ | ||
| private static String redisPatternToRegex(String redisPattern) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
move to a RedisUtils class, add test cases to check all cases are considered.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added RedisUtils and RedisUtilsTests
|
|
||
| import java.util.Set; | ||
|
|
||
| public class RedisInfo { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add javadoc of this class, what is its purpose?
| // Parser rules have first letter in lower-case | ||
|
|
||
| pattern : disjunction; | ||
| pattern : disjunction EOF; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There have been changes to this file in master. Please pull changes and merge them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged master to this branch
| // Parser rules have first letter in lower-case | ||
|
|
||
| pattern : disjunction; | ||
| pattern : disjunction EOF; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as before
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Merged master to this branch
…s Handler now creates a generic structure with Redis data. Also Redis client is using redis-data no more. It now uses Lettuce with refflection
# Conflicts: # client-java/controller/src/main/java/org/evomaster/client/java/controller/internal/db/RedisHandler.java # client-java/controller/src/main/java/org/evomaster/client/java/controller/redis/RedisClient.java # client-java/controller/src/main/java/org/evomaster/client/java/controller/redis/RedisHeuristicsCalculator.java # client-java/controller/src/test/java/org/evomaster/client/java/controller/internal/db/redis/RedisHandlerIntegrationTest.java # client-java/controller/src/test/java/org/evomaster/client/java/controller/internal/db/redis/RedisHeuristicsCalculatorTest.java
…s Handler now creates a generic structure with Redis data. Also Redis client is using redis-data no more. It now uses Lettuce with refflection
…om/WebFuzzing/EvoMaster into feature/redis-distance-calculation
…s Handler now creates a generic structure with Redis data. Also Redis client is using redis-data no more. It now uses Lettuce with refflection
# Conflicts: # client-java/controller/src/main/java/org/evomaster/client/java/controller/internal/db/RedisHandler.java # client-java/controller/src/main/java/org/evomaster/client/java/controller/redis/RedisClient.java # client-java/controller/src/main/java/org/evomaster/client/java/controller/redis/RedisHeuristicsCalculator.java # client-java/controller/src/test/java/org/evomaster/client/java/controller/internal/db/redis/RedisHandlerIntegrationTest.java # client-java/controller/src/test/java/org/evomaster/client/java/controller/internal/db/redis/RedisHeuristicsCalculatorTest.java
…s Handler now creates a generic structure with Redis data. Also Redis client is using redis-data no more. It now uses Lettuce with refflection
# Conflicts: # client-java/controller/src/main/java/org/evomaster/client/java/controller/internal/db/RedisHandler.java # client-java/controller/src/main/java/org/evomaster/client/java/controller/redis/RedisClient.java # client-java/controller/src/main/java/org/evomaster/client/java/controller/redis/RedisHeuristicsCalculator.java # client-java/controller/src/test/java/org/evomaster/client/java/controller/internal/db/redis/RedisHandlerIntegrationTest.java # client-java/controller/src/test/java/org/evomaster/client/java/controller/internal/db/redis/RedisHeuristicsCalculatorTest.java
…s Handler now creates a generic structure with Redis data. Also Redis client is using redis-data no more. It now uses Lettuce with refflection
…s Handler now creates a generic structure with Redis data. Also Redis client is using redis-data no more. It now uses Lettuce with refflection
…om/WebFuzzing/EvoMaster into feature/redis-distance-calculation
| @@ -0,0 +1,16 @@ | |||
| package org.evomaster.client.java.controller.internal.db; | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as more files are added to internal/db, should refactor, and have subfolders for internal/db/redis, internal/db/mongo and internal/db/opensearch
| * This class will link a given RedisCommand to the result of the distance calculation for that commmand. | ||
| */ | ||
| public class RedisCommandEvaluation { | ||
| public final RedisCommand redisCommand; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
those should be private, with public getters. usually, we have public fields only for DTOs
| */ | ||
| public class RedisDistanceWithMetrics { | ||
| public final double redisDistance; // A number between 0 and 1. | ||
| public final int numberOfEvaluatedKeys; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should be private
Added distance calculation for several Redis Commands.
RedisCommand class holds an attribute for each one that should have an heuristic value computation.