@Test public void testDistinctGraphs() throws Exception { FlinkAsciiGraphLoader loader = getLoaderFromString("(v1) (v2) g1[(v1)] g2[(v1) (v2)]"); int limit = 2; GraphCollection inputCollection = loader.getGraphCollectionByVariables("g1", "g2"); collectAndAssertTrue(inputCollection.equalsByGraphElementData(inputCollection.limit(limit))); } }
@Test public void testSameCollection() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); int limit = 2; GraphCollection input = loader.getGraphCollectionByVariables("g0", "g1"); collectAndAssertTrue(input.equalsByGraphElementData(input.limit(limit))); }
@Test public void testInBound() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); int limit = 2; GraphCollection inputCollection = loader.getGraphCollectionByVariables("g0", "g1", "g2", "g3"); GraphCollection outputCollection = inputCollection.limit(limit); assertEquals(limit, outputCollection.getGraphHeads().count()); }
@Test public void testOutOfBound() throws Exception { FlinkAsciiGraphLoader loader = getSocialNetworkLoader(); GraphCollection inputCollection = loader.getGraphCollectionByVariables("g0", "g1"); int limit = 4; int expectedCount = 2; GraphCollection outputCollection = inputCollection.limit(limit); assertEquals(expectedCount, outputCollection.getGraphHeads().count()); }
@Test public void testEmpty() throws Exception { GraphCollection inputCollection = getConfig().getGraphCollectionFactory() .createEmptyCollection(); int limit = 4; int expectedCount = 0; GraphCollection outputCollection = inputCollection.limit(limit); assertEquals(expectedCount, outputCollection.getGraphHeads().count()); }
@Test(expected = InvalidProgramException.class) public void testNegativeLimit() throws Exception { GraphCollection inputCollection = getConfig().getGraphCollectionFactory() .createEmptyCollection(); int limit = -1; int expectedCount = 0; GraphCollection outputCollection = inputCollection.limit(limit); assertEquals(expectedCount, outputCollection.getGraphHeads().count()); }