SiddhiPlan { @SuppressWarnings("unchecked") public static SiddhiPlan fromMap(Map<String, Object> map) throws ExecutionPlanException { String id = getField(map, "id", String.class); List<String> inputTopics = getField(map, "input", List.class); Map<String, String> outputTopics = getField(map, "output", Map.class); Map<String, String> filters = getField(map, "filters", Collections.emptyMap(), Map.class); String plan = getField(map, "executionPlan", String.class); Integer version = getField(map, "version", 0, Integer.class); return new SiddhiPlan(id, version, inputTopics, outputTopics, filters, plan); } SiddhiPlan(String id, int version, List<String> inputTopics,
                      Map<String, String> outputTopics, Map<String, String> filters,
                      String executionPlan); @SuppressWarnings("unchecked") static SiddhiPlan fromMap(Map<String, Object> map); Map<String, Object> toMap(); String getId(); long getVersion(); List<String> getInput(); Map<String, String> getOutput(); String getExecutionPlan(); String build(); String getFullExecutionPlan(); void send(String topicName, Map<String, Object> data); void start(SiddhiManager siddhiManager, SiddhiCallback siddhiCallback); void stop();  }
@Test(expected = TransformException.class) public void createsFromMapInvalid() throws ExecutionPlanException { Map<String, Object> executionPlanMap = new HashMap<>(); Map<String, String> outputTopics = new HashMap<>(); outputTopics.put("testOutput", "outputTopic"); executionPlanMap.put("input", Arrays.asList("test", "test2")); executionPlanMap.put("output", outputTopics); executionPlanMap.put("executionPlan", "from test select a insert into testOutput"); SiddhiPlan.fromMap(executionPlanMap); }
@Test(expected = TransformException.class) public void createsFromMapInvalidTypes() throws ExecutionPlanException { Map<String, Object> executionPlanMap = new HashMap<>(); Map<String, String> outputTopics = new HashMap<>(); outputTopics.put("testOutput", "outputTopic"); executionPlanMap.put("id", "invalid_rule"); executionPlanMap.put("input", 2); executionPlanMap.put("output", outputTopics); executionPlanMap.put("executionPlan", "from test select a insert into testOutput"); SiddhiPlan.fromMap(executionPlanMap); }