|
|
|
|
|
|
Re: name may not be null xtext 2.12 [message #1764683 is a reply to message #1764681] |
Thu, 01 June 2017 11:35 |
|
(the following unit test seems ok for me with the code you originally shared)
=> would be interesting to see what you changed
import com.google.inject.Inject
import org.eclipse.xtext.testing.InjectWith
import org.eclipse.xtext.testing.XtextRunner
import org.eclipse.xtext.xbase.testing.CompilationTestHelper
import org.junit.Test
import org.junit.runner.RunWith
@RunWith(XtextRunner)
@InjectWith(HDslInjectorProvider)
class HDslParsingTest {
@Inject extension CompilationTestHelper
helper;
@Test
def void xxxxx() {
assertCompilesTo('''
source source1 with id="1";
flatmap operator deneme source source1 [
rows.forEach[row|
if(row.age>10)
emit("anil" + 1 named col1,row.age named name)
]
val first=rows.next
emit("anil" named col1)
]
flatmap operator deneme2 source deneme [
val first = rows.next
emit("anil2" named col1)
]
sink mysink with id="2" source deneme2;
''', '''
MULTIPLE FILES WERE GENERATED
File 1 : /myProject/./src-gen/deneme2Function.java
import henkan.dsl.lib.HenkanRow;
import java.util.Iterator;
import org.apache.flink.util.Collector;
@SuppressWarnings("all")
public class deneme2Function {
public void main(final Iterator<denemeRow> rows, final Collector<HenkanRow> collector) {
final denemeRow first = rows.next();
deneme2Row _row = new deneme2Row();
_row.col1 = "anil2";
collector.out(_row);
}
}
File 2 : /myProject/./src-gen/deneme2Row.java
import henkan.dsl.lib.HenkanRow;
@SuppressWarnings("all")
public class deneme2Row implements HenkanRow {
public String col1;
}
File 3 : /myProject/./src-gen/denemeFunction.java
import henkan.dsl.lib.HenkanRow;
import java.util.Iterator;
import org.apache.flink.util.Collector;
import org.eclipse.xtext.xbase.lib.IteratorExtensions;
import org.eclipse.xtext.xbase.lib.Procedures.Procedure1;
@SuppressWarnings("all")
public class denemeFunction {
public void main(final Iterator<source1Row> rows, final Collector<HenkanRow> collector) {
final Procedure1<source1Row> _function = new Procedure1<source1Row>() {
@Override
public void apply(final source1Row row) {
if (((row.age).intValue() > 10)) {
denemeRow _row = new denemeRow();
_row.col1 = ("anil" + Integer.valueOf(1));
_row.name = row.age;
collector.out(_row);
}
}
};
IteratorExtensions.<source1Row>forEach(rows, _function);
final source1Row first = rows.next();
denemeRow _row = new denemeRow();
_row.col1 = "anil";
collector.out(_row);
}
}
File 4 : /myProject/./src-gen/denemeRow.java
import henkan.dsl.lib.HenkanRow;
@SuppressWarnings("all")
public class denemeRow implements HenkanRow {
public String col1;
}
File 5 : /myProject/./src-gen/source1Row.java
import henkan.dsl.lib.HenkanRow;
@SuppressWarnings("all")
public class source1Row implements HenkanRow {
public String surname;
public String name;
public Integer age;
}
''')
}
}
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Day Job: https://www.everest-systems.com
|
|
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04799 seconds