Remove unused code and cleanup javadoc comments

Fixes #10233
This commit is contained in:
Dan Hermann 2018-12-21 17:08:12 -06:00
parent 134818e69e
commit 4152f89022
75 changed files with 0 additions and 386 deletions

View file

@ -2,9 +2,6 @@ package org.logstash;
import java.util.List;
/**
* Created by ph on 15-05-22.
*/
public class KeyNode {
private KeyNode() {

View file

@ -2,9 +2,6 @@ package org.logstash.common;
import org.logstash.config.ir.InvalidIRException;
/**
* Created by andrewvc on 6/12/17.
*/
public class IncompleteSourceWithMetadataException extends InvalidIRException {
private static final long serialVersionUID = 456422097113787583L;

View file

@ -9,9 +9,6 @@ import java.util.Objects;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
* Created by andrewvc on 9/6/16.
*/
public class SourceWithMetadata implements HashableWithSource {
// Either 'file' or something else
private final String protocol;

View file

@ -4,9 +4,6 @@ import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
/**
* Created by andrewvc on 12/23/16.
*/
public class Util {
// Modified from http://stackoverflow.com/a/11009612/11105

View file

@ -3,11 +3,8 @@ package org.logstash.config.ir;
import org.logstash.common.SourceWithMetadata;
/**
* Created by andrewvc on 9/6/16.
*
* This class is useful to inherit from for things that need to be source components
* since it handles storage of the meta property for you and reduces a lot of boilerplate.
*
*/
public abstract class BaseSourceComponent implements SourceComponent {
private final SourceWithMetadata meta;

View file

@ -35,9 +35,6 @@ import org.logstash.config.ir.imperative.NoopStatement;
import org.logstash.config.ir.imperative.PluginStatement;
import org.logstash.config.ir.imperative.Statement;
/**
* Created by andrewvc on 9/15/16.
*/
public class DSL {
public static EventValueExpression eEventValue(SourceWithMetadata meta, String fieldName) {
return new EventValueExpression(meta, fieldName);

View file

@ -1,8 +1,5 @@
package org.logstash.config.ir;
/**
* Created by andrewvc on 12/23/16.
*/
public interface Hashable {
String uniqueHash();
}

View file

@ -2,9 +2,6 @@ package org.logstash.config.ir;
import org.logstash.common.Util;
/**
* Created by andrewvc on 6/12/17.
*/
public interface HashableWithSource extends Hashable {
@Override
default String uniqueHash() {

View file

@ -1,8 +1,5 @@
package org.logstash.config.ir;
/**
* Created by andrewvc on 9/6/16.
*/
public class InvalidIRException extends Exception {
public InvalidIRException(String s) {
super(s);

View file

@ -9,9 +9,6 @@ import org.logstash.config.ir.graph.PluginVertex;
import org.logstash.config.ir.graph.QueueVertex;
import org.logstash.config.ir.graph.Vertex;
/**
* Created by andrewvc on 9/20/16.
*/
public final class PipelineIR implements Hashable {
private final String uniqueHash;

View file

@ -8,9 +8,6 @@ import java.util.Set;
import org.logstash.ObjectMappers;
import org.logstash.common.SourceWithMetadata;
/**
* Created by andrewvc on 9/20/16.
*/
public final class PluginDefinition implements SourceComponent, HashableWithSource {
@Override

View file

@ -2,9 +2,6 @@ package org.logstash.config.ir;
import org.logstash.common.SourceWithMetadata;
/**
* Created by andrewvc on 9/16/16.
*/
public interface SourceComponent {
boolean sourceComponentEquals(SourceComponent sourceComponent);
SourceWithMetadata getSourceWithMetadata();

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.common.Util;
import org.logstash.config.ir.SourceComponent;
/**
* Created by andrewvc on 9/6/16.
*/
public abstract class BinaryBooleanExpression extends BooleanExpression {
@Override
public boolean sourceComponentEquals(SourceComponent sourceComponent) {

View file

@ -2,9 +2,6 @@ package org.logstash.config.ir.expression;
import org.logstash.common.SourceWithMetadata;
/**
* Created by andrewvc on 9/14/16.
*/
public abstract class BooleanExpression extends Expression {
public BooleanExpression(SourceWithMetadata meta) {
super(meta);

View file

@ -3,9 +3,6 @@ package org.logstash.config.ir.expression;
import org.logstash.config.ir.SourceComponent;
import org.logstash.common.SourceWithMetadata;
/**
* Created by andrewvc on 9/13/16.
*/
public class EventValueExpression extends Expression {
private final String fieldName;

View file

@ -10,7 +10,6 @@ import org.logstash.config.ir.HashableWithSource;
*
* if [foo]
* notnull(eEventValue("foo"))
* Created by andrewvc on 9/6/16.
*/
public abstract class Expression extends BaseSourceComponent implements HashableWithSource {

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.InvalidIRException;
import org.logstash.config.ir.SourceComponent;
/**
* Created by andrewvc on 9/15/16.
*/
public class RegexValueExpression extends ValueExpression {
private final String regex;

View file

@ -3,9 +3,6 @@ package org.logstash.config.ir.expression;
import org.logstash.config.ir.InvalidIRException;
import org.logstash.common.SourceWithMetadata;
/**
* Created by andrewvc on 9/13/16.
*/
public abstract class UnaryBooleanExpression extends BooleanExpression {
private final Expression expression;

View file

@ -8,9 +8,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.InvalidIRException;
import org.logstash.config.ir.SourceComponent;
/**
* Created by andrewvc on 9/13/16.
*/
public class ValueExpression extends Expression {
protected final Object value;

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.BinaryBooleanExpression;
import org.logstash.config.ir.expression.Expression;
/**
* Created by andrewvc on 9/21/16.
*/
public class And extends BinaryBooleanExpression {
public And(SourceWithMetadata meta, Expression left, Expression right) {
super(meta, left, right);

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.BinaryBooleanExpression;
import org.logstash.config.ir.expression.Expression;
/**
* Created by andrewvc on 9/21/16.
*/
public class Eq extends BinaryBooleanExpression {
public Eq(SourceWithMetadata meta, Expression left, Expression right) {
super(meta, left, right);

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.BinaryBooleanExpression;
import org.logstash.config.ir.expression.Expression;
/**
* Created by andrewvc on 9/21/16.
*/
public class Gt extends BinaryBooleanExpression {
public Gt(SourceWithMetadata meta, Expression left, Expression right) {
super(meta, left, right);

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.BinaryBooleanExpression;
import org.logstash.config.ir.expression.Expression;
/**
* Created by andrewvc on 9/21/16.
*/
public class Gte extends BinaryBooleanExpression {
public Gte(SourceWithMetadata meta, Expression left, Expression right) {
super(meta, left, right);

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.BinaryBooleanExpression;
import org.logstash.config.ir.expression.Expression;
/**
* Created by andrewvc on 9/21/16.
*/
public class In extends BinaryBooleanExpression {
public In(SourceWithMetadata meta, Expression left, Expression right) {
super(meta, left, right);

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.BinaryBooleanExpression;
import org.logstash.config.ir.expression.Expression;
/**
* Created by andrewvc on 9/21/16.
*/
public class Lt extends BinaryBooleanExpression {
public Lt(SourceWithMetadata meta, Expression left, Expression right) {
super(meta, left, right);

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.BinaryBooleanExpression;
import org.logstash.config.ir.expression.Expression;
/**
* Created by andrewvc on 9/21/16.
*/
public class Lte extends BinaryBooleanExpression {
public Lte(SourceWithMetadata meta, Expression left, Expression right) {
super(meta, left, right);

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.BinaryBooleanExpression;
import org.logstash.config.ir.expression.Expression;
/**
* Created by andrewvc on 9/21/16.
*/
public class Neq extends BinaryBooleanExpression {
public Neq(SourceWithMetadata meta, Expression left, Expression right) {
super(meta, left, right);

View file

@ -4,9 +4,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.BinaryBooleanExpression;
import org.logstash.config.ir.expression.Expression;
/**
* Created by andrewvc on 9/21/16.
*/
public class Or extends BinaryBooleanExpression {
public Or(SourceWithMetadata meta, Expression left, Expression right) {
super(meta, left, right);

View file

@ -6,9 +6,6 @@ import org.logstash.config.ir.expression.BinaryBooleanExpression;
import org.logstash.config.ir.expression.Expression;
import org.logstash.config.ir.expression.RegexValueExpression;
/**
* Created by andrewvc on 9/21/16.
*/
public class RegexEq extends BinaryBooleanExpression {
public RegexEq(SourceWithMetadata meta, Expression left, Expression right) throws InvalidIRException {
super(meta, left, right);

View file

@ -6,9 +6,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.Expression;
import org.logstash.config.ir.expression.UnaryBooleanExpression;
/**
* Created by andrewvc on 9/21/16.
*/
public class Not extends UnaryBooleanExpression {
public Not(SourceWithMetadata meta, Expression expression) throws InvalidIRException {
super(meta, expression);

View file

@ -6,9 +6,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.expression.Expression;
import org.logstash.config.ir.expression.UnaryBooleanExpression;
/**
* Created by andrewvc on 9/21/16.
*/
public class Truthy extends UnaryBooleanExpression {
public Truthy(SourceWithMetadata meta, Expression expression) throws InvalidIRException {
super(meta, expression);

View file

@ -4,9 +4,6 @@ import org.logstash.common.Util;
import org.logstash.config.ir.SourceComponent;
import org.logstash.config.ir.InvalidIRException;
/**
* Created by andrewvc on 9/15/16.
*/
public final class BooleanEdge extends Edge {
public static class BooleanEdgeFactory extends EdgeFactory {
public Boolean getEdgeType() {

View file

@ -5,9 +5,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.InvalidIRException;
import org.logstash.config.ir.SourceComponent;
/**
* Created by andrewvc on 9/15/16.
*/
public abstract class Edge implements SourceComponent {
private final Vertex from;

View file

@ -9,15 +9,11 @@ import org.logstash.config.ir.graph.algorithms.BreadthFirst;
import org.logstash.config.ir.graph.algorithms.GraphDiff;
import org.logstash.config.ir.graph.algorithms.TopologicalSort;
import java.security.MessageDigest;
import java.util.*;
import java.util.function.BiFunction;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Created by andrewvc on 9/15/16.
*/
public final class Graph implements SourceComponent, Hashable {
private final Set<Vertex> vertices = new LinkedHashSet<>();
private final Set<Edge> edges = new LinkedHashSet<>();

View file

@ -8,9 +8,6 @@ import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.SourceComponent;
import org.logstash.config.ir.expression.BooleanExpression;
/**
* Created by andrewvc on 9/15/16.
*/
public class IfVertex extends Vertex {
public BooleanExpression getBooleanExpression() {

View file

@ -3,9 +3,6 @@ package org.logstash.config.ir.graph;
import org.logstash.common.Util;
import org.logstash.config.ir.InvalidIRException;
/**
* Created by andrewvc on 9/19/16.
*/
public class PlainEdge extends Edge {
public static class PlainEdgeFactory extends Edge.EdgeFactory {
@Override

View file

@ -1,15 +1,9 @@
package org.logstash.config.ir.graph;
import com.fasterxml.jackson.core.JsonProcessingException;
import org.logstash.ObjectMappers;
import org.logstash.common.SourceWithMetadata;
import org.logstash.common.Util;
import org.logstash.config.ir.PluginDefinition;
import org.logstash.config.ir.SourceComponent;
/**
* Created by andrewvc on 9/15/16.
*/
public class PluginVertex extends Vertex {
private final PluginDefinition pluginDefinition;

View file

@ -5,9 +5,6 @@ import org.logstash.common.Util;
import org.logstash.config.ir.SourceComponent;
import org.logstash.common.SourceWithMetadata;
/**
* Created by andrewvc on 9/15/16.
*/
public final class QueueVertex extends Vertex {
public QueueVertex() throws IncompleteSourceWithMetadataException {
super(new SourceWithMetadata("internal", "queue", 0,0,"queue"));

View file

@ -9,16 +9,11 @@ import org.logstash.config.ir.SourceComponent;
import org.logstash.config.ir.InvalidIRException;
import org.logstash.config.ir.graph.algorithms.DepthFirst;
import java.nio.charset.StandardCharsets;
import java.security.MessageDigest;
import java.util.Collection;
import java.util.Collections;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Created by andrewvc on 9/15/16.
*/
public abstract class Vertex implements SourceComponent, HashableWithSource {
private static final AtomicInteger SEQUENCE = new AtomicInteger();

View file

@ -6,10 +6,6 @@ import java.util.*;
import java.util.function.Consumer;
import java.util.stream.Stream;
/**
* Created by andrewvc on 1/5/17.
*
*/
public class BreadthFirst {
public static BfsResult breadthFirst(Collection<Vertex> roots) {
return breadthFirst(roots, false, null);

View file

@ -7,9 +7,6 @@ import java.util.*;
import java.util.stream.Stream;
import java.util.stream.StreamSupport;
/**
* Created by andrewvc on 1/5/17.
*/
public class DepthFirst {
public static Stream<Vertex> depthFirst(Graph g) {
return depthFirst(g.getRoots());

View file

@ -9,9 +9,6 @@ import org.logstash.config.ir.graph.Edge;
import org.logstash.config.ir.graph.Graph;
import org.logstash.config.ir.graph.Vertex;
/**
* Created by andrewvc on 1/5/17.
*/
public class GraphDiff {
public static DiffResult diff(Graph left, Graph right) {
List<Edge> removedEdges = left.edges().filter(e -> !right.hasEquivalentEdge(e)).collect(Collectors.toList());

View file

@ -1,106 +0,0 @@
package org.logstash.config.ir.graph.algorithms;
import org.logstash.config.ir.graph.Vertex;
import java.util.*;
import java.util.stream.Collectors;
import java.util.stream.Stream;
/**
* Created by andrewvc on 1/5/17.
* This class isn't currently used anywhere, I wrote it for some code that is now removed, however, I'm sure it will be
* useful shortly, so we should hold onto it for a while.
*/
public class ShortestPath {
static class InvalidShortestPathArguments extends Exception {
private static final long serialVersionUID = -1493537067800744231L;
private final Collection<Vertex> invalidVertices;
public InvalidShortestPathArguments(Collection<Vertex> invalidVertices) {
super();
this.invalidVertices = invalidVertices;
}
@Override
public String getMessage() {
String verticesMessage = invalidVertices.stream().map(Vertex::toString).collect(Collectors.joining(", "));
return "Attempted to determine path for vertex that is not in the search space!" + verticesMessage;
}
}
public static List<Vertex> shortestPath(Vertex from, Vertex to) throws InvalidShortestPathArguments {
return shortestPath(from, Collections.singleton(to)).get(to);
}
public static Map<Vertex, List<Vertex>> shortestPath(Vertex from, Collection<Vertex> to) throws InvalidShortestPathArguments {
return shortestPath(from, to, false);
}
// Finds the shortest paths to the specified vertices traversing edges backward using Dijkstra's algorithm.
// The items in `to` must be ancestors of this Vertex!
public static Map<Vertex, List<Vertex>> shortestReversePath(Vertex from, Collection<Vertex> to) throws InvalidShortestPathArguments {
return shortestPath(from, to, true);
}
// Finds the shortest paths to the specified vertices using Dijkstra's algorithm.
// The items in `to` must be ancestors of this Vertex!
public static Map<Vertex, List<Vertex>> shortestPath(Vertex from, Collection<Vertex> to, boolean reverseSearch) throws InvalidShortestPathArguments {
Map<Vertex, Integer> vertexDistances = new HashMap<>();
Map<Vertex, Vertex> vertexPathPrevious = new HashMap<>();
List<Vertex> pending = new ArrayList<>();
Stream<Vertex> searchSpace = reverseSearch ? from.ancestors() : from.descendants();
searchSpace.forEach((vertex) -> {
pending.add(vertex);
// Max value is an unknown distance
// using this is more convenient and concise than null in later code
vertexDistances.put(vertex, Integer.MAX_VALUE);
});
pending.add(from);
vertexDistances.put(from, 0);
Collection<Vertex> invalidVertices = to.stream().filter(v -> !pending.contains(v)).collect(Collectors.toList());
if (!invalidVertices.isEmpty()) {
throw new InvalidShortestPathArguments(invalidVertices);
}
while (!pending.isEmpty()) {
Vertex current = pending.stream().min(Comparator.comparing(vertexDistances::get)).get();
int currentDistance = vertexDistances.get(current);
pending.remove(current);
Stream<Vertex> toProcess = reverseSearch ? current.incomingVertices() : current.outgoingVertices();
toProcess.forEach((v) -> {
Integer curDistance = vertexDistances.get(v);
int altDistance = currentDistance + 1; // Fixed cost per edge of 1
if (altDistance < curDistance) {
vertexDistances.put(v, altDistance);
vertexPathPrevious.put(v, current);
}
});
}
Map<Vertex, List<Vertex>> result = new HashMap<>(to.size());
for (Vertex toVertex : to) {
int toVertexDistance = vertexDistances.get(toVertex);
List<Vertex> path = new ArrayList<>(toVertexDistance+1);
Vertex pathCurrentVertex = toVertex;
while (pathCurrentVertex != from) {
path.add(pathCurrentVertex);
pathCurrentVertex = vertexPathPrevious.get(pathCurrentVertex);
}
path.add(from);
Collections.reverse(path);
result.put(toVertex, path);
}
return result;
}
}

View file

@ -6,9 +6,6 @@ import org.logstash.config.ir.graph.Vertex;
import java.util.*;
/**
* Created by andrewvc on 1/7/17.
*/
public class TopologicalSort {
public static class UnexpectedGraphCycleError extends Exception {
private static final long serialVersionUID = 1778155790783320839L;

View file

@ -6,9 +6,6 @@ import org.logstash.config.ir.graph.Graph;
import java.util.List;
/**
* Created by andrewvc on 9/22/16.
*/
public class ComposedParallelStatement extends ComposedStatement {
public ComposedParallelStatement(SourceWithMetadata meta, List<Statement> statements) throws InvalidIRException {
super(meta, statements);

View file

@ -6,9 +6,6 @@ import org.logstash.config.ir.graph.Graph;
import java.util.List;
/**
* Created by andrewvc on 9/22/16.
*/
public class ComposedSequenceStatement extends ComposedStatement {
public ComposedSequenceStatement(SourceWithMetadata meta, List<Statement> statements) throws InvalidIRException {
super(meta, statements);

View file

@ -7,9 +7,6 @@ import org.logstash.common.SourceWithMetadata;
import java.util.List;
import java.util.stream.Collectors;
/**
* Created by andrewvc on 9/6/16.
*/
public abstract class ComposedStatement extends Statement {
public interface IFactory {
ComposedStatement make(SourceWithMetadata meta, List<Statement> statements) throws InvalidIRException;

View file

@ -13,7 +13,6 @@ import java.util.Collection;
import java.util.stream.Collectors;
/**
* Created by andrewvc on 9/6/16.
* if 5 {
*
* }

View file

@ -4,9 +4,6 @@ import org.logstash.config.ir.SourceComponent;
import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.graph.Graph;
/**
* Created by andrewvc on 9/15/16.
*/
public class NoopStatement extends Statement {
public NoopStatement(SourceWithMetadata meta) {

View file

@ -8,9 +8,6 @@ import org.logstash.config.ir.graph.Graph;
import org.logstash.config.ir.graph.PluginVertex;
import org.logstash.config.ir.graph.Vertex;
/**
* Created by andrewvc on 9/6/16.
*/
public class PluginStatement extends Statement {
private final PluginDefinition pluginDefinition;

View file

@ -5,9 +5,6 @@ import org.logstash.config.ir.BaseSourceComponent;
import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.graph.Graph;
/**
* Created by andrewvc on 9/6/16.
*/
public abstract class Statement extends BaseSourceComponent {
public Statement(SourceWithMetadata meta) {
super(meta);

View file

@ -18,7 +18,6 @@ import org.apache.logging.log4j.Logger;
/**
* Hot threads monitoring class. This class pulls information out of the JVM #
* provided beans and lest the different consumers query it.
* Created by purbon on 12/12/15.
*/
public final class HotThreadsMonitor {

View file

@ -8,9 +8,6 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Based on code created by purbon on 13/12/15.
*/
public final class MemoryMonitor {
private MemoryMonitor() {

View file

@ -8,9 +8,6 @@ import java.util.Map;
import java.util.concurrent.TimeUnit;
import javax.management.MBeanServer;
/**
* Created by andrewvc on 5/12/16.
*/
public class ProcessMonitor {
private static final OperatingSystemMXBean osMxBean = ManagementFactory.getOperatingSystemMXBean();
private static final MBeanServer platformMxBean = ManagementFactory.getPlatformMBeanServer();

View file

@ -7,7 +7,6 @@ import java.util.Map;
/**
* System information as returned by the different JVM's MxBeans
* Created by purbon on 13/12/15.
*/
public class SystemMonitor {

View file

@ -1,21 +0,0 @@
package org.logstash.instrument.reports;
import org.logstash.instrument.monitors.SystemMonitor;
import java.util.Map;
/**
* Created by purbon on 12/12/15.
*/
public class SystemReport {
/**
* Build a report with current System information
* @return a Map with the current system report
*/
public static Map<String, Object> generate() {
return SystemMonitor.detect().toMap();
}
}

View file

@ -9,7 +9,6 @@ import java.util.stream.Collectors;
/**
* A ThreadsReport object used to hold the hot threads information
* Created by purbon on 12/12/15.
*/
public class ThreadsReport {

View file

@ -6,9 +6,6 @@ import org.junit.runners.Parameterized;
import java.util.Arrays;
/**
* Created by andrewvc on 6/12/17.
*/
@RunWith(Parameterized.class)
public class SourceWithMetadataTest {
private final ParameterGroup parameterGroup;

View file

@ -10,22 +10,16 @@ import org.logstash.config.ir.graph.Edge;
import org.logstash.config.ir.graph.Graph;
import org.logstash.config.ir.graph.Vertex;
import org.logstash.config.ir.graph.algorithms.GraphDiff;
import org.logstash.config.ir.imperative.Statement;
import javax.xml.transform.Source;
import java.util.HashMap;
import java.util.Objects;
import java.util.Random;
import java.util.UUID;
import java.util.concurrent.Callable;
import java.util.stream.IntStream;
import static org.logstash.config.ir.DSL.*;
import static org.logstash.config.ir.PluginDefinition.Type.*;
/**
* Created by andrewvc on 9/19/16.
*/
public class IRHelpers {
public static void assertSyntaxEquals(SourceComponent left, SourceComponent right) {
String message = String.format("Expected '%s' to equal '%s'", left, right);

View file

@ -9,9 +9,6 @@ import static org.logstash.config.ir.DSL.*;
import static org.logstash.config.ir.PluginDefinition.Type.*;
import static org.logstash.config.ir.IRHelpers.randMeta;
/**
* Created by andrewvc on 9/20/16.
*/
public class PipelineIRTest {
public Graph makeInputSection() throws InvalidIRException {
return iComposeParallel(iPlugin(randMeta(), INPUT, "generator"), iPlugin(randMeta(), INPUT, "stdin")).toGraph();

View file

@ -10,9 +10,6 @@ import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
import static org.logstash.config.ir.IRHelpers.*;
/**
* Created by andrewvc on 11/21/16.
*/
@RunWith(Theories.class)
public class BooleanEdgeTest {
@DataPoint

View file

@ -7,10 +7,6 @@ import org.logstash.config.ir.InvalidIRException;
import static org.junit.Assert.*;
import static org.hamcrest.CoreMatchers.*;
/**
* Created by andrewvc on 11/21/16.
*/
public class EdgeTest {
@Test
public void testBasicEdge() throws InvalidIRException {

View file

@ -2,15 +2,11 @@ package org.logstash.config.ir.graph;
import org.junit.Test;
import org.logstash.common.SourceWithMetadata;
import org.logstash.config.ir.DSL;
import org.logstash.config.ir.IRHelpers;
import org.logstash.config.ir.InvalidIRException;
import org.logstash.config.ir.PluginDefinition;
import org.logstash.config.ir.imperative.IfStatement;
import java.util.Collection;
import java.util.Collections;
import java.util.Random;
import static org.hamcrest.CoreMatchers.instanceOf;
import static org.hamcrest.CoreMatchers.is;
@ -19,9 +15,6 @@ import static org.logstash.config.ir.IRHelpers.createTestExpression;
import static org.logstash.config.ir.IRHelpers.createTestVertex;
import static org.logstash.config.ir.IRHelpers.randMeta;
/**
* Created by andrewvc on 11/18/16.
*/
public class GraphTest {
@Test
public void testGraphBasics() throws InvalidIRException {

View file

@ -7,9 +7,6 @@ import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
import static org.logstash.config.ir.IRHelpers.*;
/**
* Created by andrewvc on 11/22/16.
*/
public class IfVertexTest {
@Test
public void testIfVertexCreation() throws InvalidIRException {

View file

@ -4,9 +4,6 @@ import org.junit.Test;
import org.logstash.config.ir.IRHelpers;
import org.logstash.config.ir.InvalidIRException;
/**
* Created by andrewvc on 11/22/16.
*/
public class PlainEdgeTest {
@Test
public void creationDoesNotRaiseException() throws InvalidIRException {

View file

@ -12,9 +12,6 @@ import static org.hamcrest.CoreMatchers.*;
import static org.junit.Assert.assertThat;
import static org.logstash.config.ir.IRHelpers.*;
/**
* Created by andrewvc on 11/22/16.
*/
public class PluginVertexTest {
@Test
public void testConstructionIdHandlingWhenNoExplicitId() throws InvalidIRException {

View file

@ -3,9 +3,6 @@ package org.logstash.config.ir.graph;
import org.junit.Test;
import org.logstash.common.IncompleteSourceWithMetadataException;
/**
* Created by andrewvc on 11/22/16.
*/
public class QueueVertexTest {
@Test
public void testConstruction() {

View file

@ -6,9 +6,6 @@ import org.logstash.config.ir.InvalidIRException;
import static org.junit.Assert.*;
/**
* Created by andrewvc on 11/21/16.
*/
public class VertexTest {
@Test
public void TestVertexBasics() throws InvalidIRException {

View file

@ -11,9 +11,6 @@ import static junit.framework.TestCase.assertEquals;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
/**
* Created by andrewvc on 1/5/17.
*/
public class BreadthFirstTest {
@Test
public void testBFSBasic() throws InvalidIRException {

View file

@ -13,9 +13,6 @@ import java.util.concurrent.atomic.AtomicInteger;
import static junit.framework.TestCase.assertEquals;
/**
* Created by andrewvc on 1/5/17.
*/
public class DepthFirstTest {
Graph g = Graph.empty();
final AtomicInteger visitCount = new AtomicInteger();

View file

@ -12,9 +12,6 @@ import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertTrue;
import static org.logstash.config.ir.IRHelpers.createTestVertex;
/**
* Created by andrewvc on 1/5/17.
*/
public class GraphDiffTest {
@Test
public void testIdenticalGraphs() throws InvalidIRException {

View file

@ -1,38 +0,0 @@
package org.logstash.config.ir.graph.algorithms;
import org.junit.Test;
import org.logstash.config.ir.InvalidIRException;
import org.logstash.config.ir.graph.Graph;
import org.logstash.config.ir.graph.Vertex;
import java.util.Arrays;
import java.util.List;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.logstash.config.ir.IRHelpers.createTestVertex;
/**
* Created by andrewvc on 1/5/17.
*/
public class ShortestPathTest {
@Test
public void testShortestPathBasic() throws InvalidIRException, ShortestPath.InvalidShortestPathArguments {
Graph g = Graph.empty();
Vertex v1 = createTestVertex("v1");
g.addVertex(v1);
Vertex v2 = createTestVertex("v2");
g.addVertex(v2);
Vertex v3 = createTestVertex("v3");
g.addVertex(v3);
Vertex v4 = createTestVertex("v4");
g.addVertex(v4);
g.chainVertices(v1, v2, v3, v4);
g.chainVertices(v2, v4);
List<Vertex> path = ShortestPath.shortestPath(v1, v4);
List<Vertex> expected = Arrays.asList(v1,v2,v4);
assertThat(path, is(expected));
}
}

View file

@ -12,9 +12,6 @@ import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.core.AnyOf.anyOf;
import static org.hamcrest.core.Is.is;
/**
* Created by andrewvc on 1/7/17.
*/
public class TopologicalSortTest {
@Test(expected = InvalidIRException.class)
public void testGraphCycleDetection() throws InvalidIRException {

View file

@ -10,9 +10,6 @@ import static org.logstash.config.ir.IRHelpers.assertSyntaxEquals;
import static org.logstash.config.ir.PluginDefinition.Type.*;
import static org.logstash.config.ir.IRHelpers.randMeta;
/**
* Created by andrewvc on 9/13/16.
*/
public class DSLTest {
@Test
public void testDSLOnePluginEquality() throws IncompleteSourceWithMetadataException {

View file

@ -11,9 +11,6 @@ import static org.logstash.config.ir.IRHelpers.assertSyntaxEquals;
import static org.logstash.config.ir.IRHelpers.randMeta;
import static org.logstash.config.ir.PluginDefinition.Type.*;
/**
* Created by andrewvc on 9/15/16.
*/
public class ImperativeToGraphtest {
@Test