registerSemanticDType("NationalPopulation",
new SimpleSemanticType("dispel", "NationalPopulation", "dispel"));
DISPELGraphBuilder builder =
runDISPELFromFile(PATH + "modifiers.dispel");
assertNull(mError);
Variable var = builder.getDispelExecutionState().getVariables().get("SQLQuery");
assertTrue(var.getType() instanceof ProcessingElementTypeType);
Object value = var.getValue();
assertTrue(value instanceof ProcessingElementType);
ProcessingElementDescriptor descriptor =
((ProcessingElementType)value).getDescriptor();
List<ProcessingElementModifier> modifiers =
descriptor.getInput("expression").getModifiers();
assertEquals(1, modifiers.size());
assertEquals("terminator", modifiers.get(0).getName());
modifiers = descriptor.getInput("resource").getModifiers();
assertEquals(1, modifiers.size());
assertEquals("locator", modifiers.get(0).getName());
assertTrue(descriptor.getInput("resource").getIsDataSourceInput());
var = builder.getDispelExecutionState().getVariables().get("LockedSQLQuery");
assertTrue(var.getType() instanceof ProcessingElementTypeType);
value = var.getValue();
assertTrue(value instanceof ProcessingElementType);
descriptor = ((ProcessingElementType)value).getDescriptor();
modifiers = descriptor.getInput("resource").getModifiers();
assertEquals(2, modifiers.size());
List<String> mods = Arrays.asList("locator", "initiator");
assertTrue(mods.contains(modifiers.get(0).getName()));
assertTrue(mods.contains(modifiers.get(1).getName()));
var = builder.getDispelExecutionState().getVariables().get("StrictSQLQuery");
assertTrue(var.getType() instanceof ProcessingElementTypeType);
value = var.getValue();
assertTrue(value instanceof ProcessingElementType);
descriptor = ((ProcessingElementType)value).getDescriptor();
modifiers = descriptor.getOutput("data").getModifiers();
assertEquals(1, modifiers.size());
assertEquals("requiresStype", modifiers.get(0).getName());
var = builder.getDispelExecutionState().getVariables().get("query");
assertTrue(var.getType() instanceof ProcessingElementType);
value = var.getValue();
assertTrue(value instanceof ProcessingElementNode);
descriptor = ((ProcessingElementNode)value).getProcessingElementDescriptor();
modifiers = descriptor.getOutput("data").getModifiers();
assertEquals(1, modifiers.size());
ProcessingElementModifier modifier = modifiers.get(0);
assertEquals("preserved", modifier.getName());
assertEquals(1, modifier.getArguments().size());
assertEquals("localhost:8080/QueryOutput", modifier.getArguments().get(0));
var = builder.getDispelExecutionState().getVariables().get("lockedQuery");
assertTrue(var.getType() instanceof ProcessingElementType);
value = var.getValue();
assertTrue(value instanceof ProcessingElementNode);
descriptor = ((ProcessingElementNode)value).getProcessingElementDescriptor();
modifiers = descriptor.getOutput("data").getModifiers();
assertEquals(2, modifiers.size());
mods = Arrays.asList("requiresStype", "preserved");
assertTrue(mods.contains(modifiers.get(0).getName()));
assertTrue(mods.contains(modifiers.get(1).getName()));
SType stype = descriptor.getOutput("data").getSType();
assertTrue(stype instanceof ListSType);
assertTrue(((ListSType)stype).getChildType() instanceof TupleSType);
var = builder.getDispelExecutionState().getVariables().get("compressedQuery");
assertTrue(var.getType() instanceof ProcessingElementType);
value = var.getValue();
assertTrue(value instanceof ProcessingElementNode);
descriptor = ((ProcessingElementNode)value).getProcessingElementDescriptor();
modifiers = descriptor.getOutput("data").getModifiers();
assertEquals(1, modifiers.size());
modifier = modifiers.get(0);
assertEquals("compressed", modifier.getName());
assertEquals(1, modifier.getArguments().size());
assertEquals("eu.admire.madup.compression", modifier.getArguments().get(0));
var = builder.getDispelExecutionState().getVariables().get("combine2");
assertTrue(var.getType() instanceof ProcessingElementType);
value = var.getValue();
assertTrue(value instanceof ProcessingElementNode);
descriptor = ((ProcessingElementNode)value).getProcessingElementDescriptor();
System.out.println(descriptor);
modifiers = descriptor.getInput("inputs").getModifiers();
assertEquals(1, modifiers.size());