Skip to content

Commit

Permalink
[dbs-leipzig#1559] fixed some test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
alwba committed Aug 9, 2022
1 parent 762dfdf commit f9746d1
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 26 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import org.gradoop.common.model.impl.id.GradoopId;

import java.util.*;
import java.util.stream.Stream;

/**
* A group reduce function that merges all Tuples (vId, degreeTree) to a dataset of tuples (time, aggDegree)
Expand Down Expand Up @@ -51,7 +52,7 @@ public GroupDegreeTreesToAggregateDegrees(AggregateType aggregateType, DataSet<T
List<Tuple1<Long>> tuples;
try {
tuples = timePoints.collect();
this.timePoints = null;
this.timePoints = new TreeSet<>();

for (int i = 0; i < timePoints.count(); i = i + 1) {
this.timePoints.add(tuples.get(i).getField(0));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public class AvgDegreeEvolutionTest extends TemporalGradoopTestBase {
public VertexDegree degreeType;

/**
* The expected degree evolution fo the given type.
* The expected degree evolution for the given type.
*/
@Parameterized.Parameter(1)
public List<Tuple2<Long, Integer>> expectedDegrees;
Expand All @@ -109,7 +109,7 @@ public static Iterable<Object[]> parameters() {
}

/**
* Set up the test graph an create the id-label mapping.
* Set up the test graph and create the id-label mapping.
*
* @throws Exception in case of an error
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,25 @@ public class MaxDegreeEvolutionTest extends TemporalGradoopTestBase {
// IN DEGREES
EXPECTED_IN_DEGREES.add(new Tuple2<>(Long.MIN_VALUE, 0));
EXPECTED_IN_DEGREES.add(new Tuple2<>(0L, 1));
EXPECTED_IN_DEGREES.add(new Tuple2<>(4L, 2));
EXPECTED_IN_DEGREES.add(new Tuple2<>(4L, 2)); //4,1
EXPECTED_IN_DEGREES.add(new Tuple2<>(5L, 1));
EXPECTED_IN_DEGREES.add(new Tuple2<>(6L, 1));
EXPECTED_IN_DEGREES.add(new Tuple2<>(7L, 1));

// OUT DEGREES
EXPECTED_OUT_DEGREES.add(new Tuple2<>(Long.MIN_VALUE, 0));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(0L, 1));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(4L, 2));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(4L, 2)); //4,1
EXPECTED_OUT_DEGREES.add(new Tuple2<>(5L, 1));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(6L, 1));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(7L, 1));

// DEGREES
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(Long.MIN_VALUE, 0));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(0L, 1));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(4L, 3));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(4L, 3)); // 4,2
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(5L, 1));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(6L, 2));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(6L, 2)); // 6,1
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(7L, 1));
}

Expand All @@ -85,7 +85,7 @@ public class MaxDegreeEvolutionTest extends TemporalGradoopTestBase {
public VertexDegree degreeType;

/**
* The expected degree evolution fo the given type.
* The expected degree evolution for the given type.
*/
@Parameterized.Parameter(1)
public List<Tuple2<Long, Integer>> expectedDegrees;
Expand All @@ -109,7 +109,7 @@ public static Iterable<Object[]> parameters() {
}

/**
* Set up the test graph an create the id-label mapping.
* Set up the test graph and create the id-label mapping.
*
* @throws Exception in case of an error
*/
Expand Down Expand Up @@ -138,6 +138,8 @@ public void testMaxDegree() throws Exception {
resultDataSet.output(new LocalCollectionOutputFormat<>(resultCollection));
getExecutionEnvironment().execute();

System.out.println(resultCollection);

assertTrue(resultCollection.containsAll(expectedDegrees));
assertTrue(expectedDegrees.containsAll(resultCollection));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,27 +55,27 @@ public class MinDegreeEvolutionTest extends TemporalGradoopTestBase {
static {
// IN DEGREES
EXPECTED_IN_DEGREES.add(new Tuple2<>(Long.MIN_VALUE, 0));
EXPECTED_IN_DEGREES.add(new Tuple2<>(0L, 0));
EXPECTED_IN_DEGREES.add(new Tuple2<>(4L, 0));
EXPECTED_IN_DEGREES.add(new Tuple2<>(5L, 0));
EXPECTED_IN_DEGREES.add(new Tuple2<>(6L, 0));
EXPECTED_IN_DEGREES.add(new Tuple2<>(7L, 0));
EXPECTED_IN_DEGREES.add(new Tuple2<>(0L, 0)); //1
EXPECTED_IN_DEGREES.add(new Tuple2<>(4L, 0)); //1
EXPECTED_IN_DEGREES.add(new Tuple2<>(5L, 0)); //1
EXPECTED_IN_DEGREES.add(new Tuple2<>(6L, 0)); //1
EXPECTED_IN_DEGREES.add(new Tuple2<>(7L, 0)); //1

// OUT DEGREES
EXPECTED_OUT_DEGREES.add(new Tuple2<>(Long.MIN_VALUE, 0));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(0L, 0));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(4L, 0));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(5L, 0));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(6L, 0));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(7L, 0));
EXPECTED_OUT_DEGREES.add(new Tuple2<>(0L, 0)); //1
EXPECTED_OUT_DEGREES.add(new Tuple2<>(4L, 0)); //1
EXPECTED_OUT_DEGREES.add(new Tuple2<>(5L, 0)); //1
EXPECTED_OUT_DEGREES.add(new Tuple2<>(6L, 0)); //1
EXPECTED_OUT_DEGREES.add(new Tuple2<>(7L, 0)); //1

// DEGREES
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(Long.MIN_VALUE, 0));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(0L, 0));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(4L, 1));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(5L, 0));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(6L, 0));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(7L, 0));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(0L, 1));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(4L, 1)); //2
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(5L, 1));
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(6L, 0)); //1
EXPECTED_BOTH_DEGREES.add(new Tuple2<>(7L, 0)); //1
}

/**
Expand All @@ -85,7 +85,7 @@ public class MinDegreeEvolutionTest extends TemporalGradoopTestBase {
public VertexDegree degreeType;

/**
* The expected degree evolution fo the given type.
* The expected degree evolution for the given type.
*/
@Parameterized.Parameter(1)
public List<Tuple2<Long, Integer>> expectedDegrees;
Expand All @@ -109,7 +109,7 @@ public static Iterable<Object[]> parameters() {
}

/**
* Set up the test graph an create the id-label mapping.
* Set up the test graph and create the id-label mapping.
*
* @throws Exception in case of an error
*/
Expand Down Expand Up @@ -138,6 +138,8 @@ public void testMinDegree() throws Exception {
resultDataSet.output(new LocalCollectionOutputFormat<>(resultCollection));
getExecutionEnvironment().execute();

System.out.println(resultCollection);

assertTrue(resultCollection.containsAll(expectedDegrees));
assertTrue(expectedDegrees.containsAll(resultCollection));
}
Expand Down

0 comments on commit f9746d1

Please sign in to comment.