GlobalEnumeration extends ElementaryOperator<GlobalEnumeration> { public String getIdFieldName() { return this.idFieldName; }  EvaluationExpression getEnumerationExpression(); ObjectAccess getIdAccess(); String getIdFieldName(); IdGeneration getIdGeneration(); IdGenerator getIdGenerator(); String getValueFieldName(); @Property @Name(preposition = "by") void setEnumerationExpression(final EvaluationExpression enumerationExpression); @Property @Name(preposition = "with key") void setIdFieldName(final String enumerationFieldName); @Property @Name(preposition = "by") void setIdGeneration(final IdGeneration idGeneration); void setIdGenerator(final IdGenerator idGenerator); @Property @Name(verb = "retain value in") void setValueFieldName(final String valueFieldName); GlobalEnumeration withEnumerationExpression(final EvaluationExpression enumerationExpression); GlobalEnumeration withIdFieldName(final String enumerationFieldName); GlobalEnumeration withIdGeneration(final IdGeneration idGeneration); GlobalEnumeration withValueFieldName(final String valueFieldName); static final EvaluationExpression AUTO_ENUMERATION; }
@Test public void shouldEnumerate() { final GlobalEnumeration globalEnumeration = new GlobalEnumeration(); globalEnumeration.setDegreeOfParallelism(2); final SopremoTestPlan plan = new SopremoTestPlan(globalEnumeration); for (int index = 0; index < 5; index++) plan.getInput(0).addObject("text", "value"); plan.run(); @SuppressWarnings({ "unchecked", "rawtypes" }) final List<IObjectNode> results = (List) plan.getActualOutput(0).getAllNodes(); Assert.assertEquals(5, results.size()); for (final IObjectNode result : results) Assert.assertEquals(TextNode.valueOf("value"), result.get("text")); for (int index1 = 0; index1 < results.size(); index1++) for (int index2 = index1 + 1; index2 < results.size(); index2++) Assert.assertFalse("different ids expected", results.get(index1) .get(globalEnumeration.getIdFieldName()).equals( results.get(index2).get(globalEnumeration.getIdFieldName()))); }