diff options
author | Christian Krause | 2015-02-19 15:11:53 +0000 |
---|---|---|
committer | Christian Krause | 2015-02-20 08:24:32 +0000 |
commit | 6c81273141ae9223af546d9e6f5f52326710a98f (patch) | |
tree | a3429e3c48e17f882f5c8c47abde65638657632f | |
parent | 5561d70379685a0370e9dba143cb91993ece19d1 (diff) | |
download | org.eclipse.emft.henshin-giraph.tar.gz org.eclipse.emft.henshin-giraph.tar.xz org.eclipse.emft.henshin-giraph.zip |
[giraph] fixed empty input graph problemgiraph
Change-Id: I704411321ea1e562f7150f2bc6bd48285c4f89e9
-rw-r--r-- | plugins/org.eclipse.emf.henshin.tests/src/org/eclipse/emf/henshin/tests/giraph/GiraphTest.java | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/plugins/org.eclipse.emf.henshin.tests/src/org/eclipse/emf/henshin/tests/giraph/GiraphTest.java b/plugins/org.eclipse.emf.henshin.tests/src/org/eclipse/emf/henshin/tests/giraph/GiraphTest.java index 119f552ab..e22c63076 100644 --- a/plugins/org.eclipse.emf.henshin.tests/src/org/eclipse/emf/henshin/tests/giraph/GiraphTest.java +++ b/plugins/org.eclipse.emf.henshin.tests/src/org/eclipse/emf/henshin/tests/giraph/GiraphTest.java @@ -142,7 +142,7 @@ public class GiraphTest { iteratedUnit.setName(iteratedUnit.getName() + iterations); // Run test: - run(iteratedUnit, ((Rule) TEST_MODULE.getUnit(inputRuleName)).getLhs(), aggregateVertices, aggregateEdges); + run(iteratedUnit, getInputGraph(inputRuleName), aggregateVertices, aggregateEdges); // Restore iterated unit: iteratedUnit.setIterations(backup.getIterations()); @@ -150,9 +150,17 @@ public class GiraphTest { } + private Graph getInputGraph(String inputRuleName) { + Rule rule = ((Rule) TEST_MODULE.getUnit(inputRuleName)); + Assert.assertNotNull(rule); + if (!rule.getMultiRules().isEmpty()) { + rule = rule.getMultiRules().get(0); + } + return rule.getLhs(); + } + private void run(String mainUnitName, String inputRuleName, int aggregateVertices, int aggregateEdges) { - run(TEST_MODULE.getUnit(mainUnitName), ((Rule) TEST_MODULE.getUnit(inputRuleName)).getLhs(), aggregateVertices, - aggregateEdges); + run(TEST_MODULE.getUnit(mainUnitName), getInputGraph(inputRuleName), aggregateVertices, aggregateEdges); } private void run(Unit mainUnit, Graph inputGraph, int aggregateVertices, int aggregateEdges) { @@ -162,7 +170,7 @@ public class GiraphTest { GiraphGenerator generator = new GiraphGenerator(); generator.setMainUnit(mainUnit); generator.setInputGraph(inputGraph); - generator.setInputName(inputGraph.getRule().getName()); + generator.setInputName(inputGraph.getRule().getRootRule().getName()); if (TEST_PROJECT == null) { System.out.println("Installing Hadoop Test Environment (may take a couple of minutes)..."); |