Skip to content

Commit

Permalink
Rework JSONPathCondition
Browse files Browse the repository at this point in the history
  • Loading branch information
wsargent committed Dec 22, 2024
1 parent a625eab commit 5524884
Show file tree
Hide file tree
Showing 13 changed files with 26 additions and 18 deletions.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package echopraxia.jsonpath;
package echopraxia.api;

import java.util.List;
import java.util.Map;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.jayway.jsonpath.Option;
import com.jayway.jsonpath.spi.json.JsonProvider;
import com.jayway.jsonpath.spi.mapper.MappingProvider;
import echopraxia.api.FindPathMethods;
import echopraxia.api.Value;
import echopraxia.api.Value.ArrayValue;
import echopraxia.api.Value.ExceptionValue;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
import ch.qos.logback.classic.spi.ILoggingEvent;
import echopraxia.api.Field;
import echopraxia.jsonpath.AbstractJsonPathFinder;
import echopraxia.jsonpath.LoggingContextWithFindPathMethods;
import echopraxia.logging.api.LoggingContextWithFindPathMethods;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Marker;

import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
import org.jetbrains.annotations.NotNull;
import org.slf4j.Marker;

public abstract class AbstractEventLoggingContext extends AbstractJsonPathFinder
implements LoggingContextWithFindPathMethods {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

import echopraxia.api.Field;
import echopraxia.jsonpath.AbstractJsonPathFinder;
import echopraxia.jsonpath.LoggingContextWithFindPathMethods;
import echopraxia.logging.api.LoggingContextWithFindPathMethods;
import echopraxia.logging.spi.CoreLogger;
import java.util.Collections;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package echopraxia.logback;

import static echopraxia.jsonpath.JsonPathCondition.pathCondition;
import static echopraxia.logging.api.JsonPathCondition.pathCondition;
import static org.assertj.core.api.Assertions.assertThat;

import ch.qos.logback.classic.spi.ILoggingEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
package echopraxia.jsonpath;
package echopraxia.logging.api;

import echopraxia.logging.api.Condition;
import echopraxia.logging.api.Level;
import java.util.function.BiFunction;
import java.util.function.Function;
import org.jetbrains.annotations.Contract;
import org.jetbrains.annotations.NotNull;

public class JsonPathCondition {
public interface JsonPathCondition extends Condition {

boolean jsonPathTest(Level level, LoggingContextWithFindPathMethods context);

default boolean test(Level level, LoggingContext context) {
return jsonPathTest(level, (LoggingContextWithFindPathMethods) context);
}

@Contract(pure = true)
public static @NotNull Condition pathCondition(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package echopraxia.jsonpath;
package echopraxia.logging.api;

import echopraxia.logging.api.LoggingContext;
import echopraxia.api.FindPathMethods;

public interface LoggingContextWithFindPathMethods extends LoggingContext, FindPathMethods {}
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package echopraxia.logstash;

import echopraxia.api.*;
import echopraxia.jsonpath.JsonPathCondition;
import echopraxia.logging.api.JsonPathCondition;
import echopraxia.logging.api.Condition;
import echopraxia.logging.api.Level;
import echopraxia.logging.api.LoggingContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package echopraxia.logstash;

import static echopraxia.api.Value.*;
import static echopraxia.jsonpath.JsonPathCondition.pathCondition;
import static echopraxia.logging.api.JsonPathCondition.pathCondition;
import static org.assertj.core.api.Assertions.assertThat;

import ch.qos.logback.classic.spi.ILoggingEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package echopraxia.logstash;

import static echopraxia.jsonpath.JsonPathCondition.pathCondition;
import static echopraxia.logging.api.JsonPathCondition.pathCondition;
import static org.assertj.core.api.Assertions.assertThat;

import ch.qos.logback.classic.spi.ILoggingEvent;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
package echopraxia.scripting;

import echopraxia.jsonpath.LoggingContextWithFindPathMethods;
import echopraxia.logging.api.Condition;
import echopraxia.logging.api.Level;
import echopraxia.logging.api.LoggingContext;
import echopraxia.logging.api.LoggingContextWithFindPathMethods;

import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@
import com.twineworks.tweakflow.lang.runtime.Runtime;
import com.twineworks.tweakflow.lang.types.Types;
import com.twineworks.tweakflow.lang.values.*;
import echopraxia.jsonpath.LoggingContextWithFindPathMethods;
import echopraxia.logging.api.Level;
import echopraxia.logging.api.LoggingContext;
import echopraxia.logging.api.LoggingContextWithFindPathMethods;

import java.util.*;
import java.util.function.Function;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import echopraxia.api.Field;
import echopraxia.jsonpath.AbstractJsonPathFinder;
import echopraxia.jsonpath.LoggingContextWithFindPathMethods;
import echopraxia.logging.api.LoggingContextWithFindPathMethods;
import echopraxia.logging.spi.CoreLogger;
import java.util.Arrays;
import java.util.Collections;
Expand Down

0 comments on commit 5524884

Please sign in to comment.