@Test public void create_execution_request() throws Exception { DataValue op = m_oi.create_operation("foo"); m_oi.add_parameter(op, m_pscope.int32(), "foo", ParameterDirection.INPUT); Map<String, DataValue> iargs = new HashMap<>(); iargs.put("foo", m_pscope.int32().make(-6)); DataValue er = m_oi.create_execution_request(3, "-4", "5", op, iargs); assertEquals(3, m_oi.execution_request_id(er)); assertEquals("-4", m_oi.execution_request_dst(er)); assertEquals("5", m_oi.execution_request_obj_id(er)); assertEquals("foo", m_oi.execution_request_operation(er)); assertEquals(iargs, m_oi.execution_request_input_arguments(er)); }
public DataValue create_execution_request(long exec_id, String dst_id, String obj_id, DataValue op_v, Map<String, DataValue> input_arguments) { Ensure.not_null(dst_id, "dst_id == null"); Ensure.not_null(obj_id, "obj_id == null"); Ensure.is_true(is_operation(op_v), "op_v is not an operation"); Ensure.not_null(input_arguments, "input_arguments == null"); Set<String> all_params = parameters(op_v); Set<String> params = new HashSet<>(); for (String p : all_params) { if (parameter_direction(op_v, p) == ParameterDirection.INPUT) { params.add(p); } } Ensure.equals(params.size(), input_arguments.size()); MapDataValue mdv = MapDataType.map_of(m_pscope.string(), m_pscope.any(), m_pscope).make(); for (String p : params) { DataValue v = input_arguments.get(p); Ensure.not_null(v); Ensure.is_true(parameter_type(op_v, p).is_instance(v)); mdv.put(m_pscope.string().make(p), v); } Map<Field, DataValue> sfields = new HashMap<>(); sfields.put(m_request_dst_id_field, m_pscope.string().make(dst_id)); sfields.put(m_request_exec_id_field, m_pscope.int64().make(exec_id)); sfields.put(m_request_obj_id_field, m_pscope.string().make(obj_id)); sfields.put(m_request_operation_field, m_pscope.string().make( operation_name(op_v))); sfields.put(m_request_inputs_field, mdv); return m_request_type.make(sfields); }
OperationInformation { public DataValue create_execution_request(long exec_id, String dst_id, String obj_id, DataValue op_v, Map<String, DataValue> input_arguments) { Ensure.not_null(dst_id, "dst_id == null"); Ensure.not_null(obj_id, "obj_id == null"); Ensure.is_true(is_operation(op_v), "op_v is not an operation"); Ensure.not_null(input_arguments, "input_arguments == null"); Set<String> all_params = parameters(op_v); Set<String> params = new HashSet<>(); for (String p : all_params) { if (parameter_direction(op_v, p) == ParameterDirection.INPUT) { params.add(p); } } Ensure.equals(params.size(), input_arguments.size()); MapDataValue mdv = MapDataType.map_of(m_pscope.string(), m_pscope.any(), m_pscope).make(); for (String p : params) { DataValue v = input_arguments.get(p); Ensure.not_null(v); Ensure.is_true(parameter_type(op_v, p).is_instance(v)); mdv.put(m_pscope.string().make(p), v); } Map<Field, DataValue> sfields = new HashMap<>(); sfields.put(m_request_dst_id_field, m_pscope.string().make(dst_id)); sfields.put(m_request_exec_id_field, m_pscope.int64().make(exec_id)); sfields.put(m_request_obj_id_field, m_pscope.string().make(obj_id)); sfields.put(m_request_operation_field, m_pscope.string().make( operation_name(op_v))); sfields.put(m_request_inputs_field, mdv); return m_request_type.make(sfields); } }
OperationInformation { public DataValue create_execution_request(long exec_id, String dst_id, String obj_id, DataValue op_v, Map<String, DataValue> input_arguments) { Ensure.not_null(dst_id, "dst_id == null"); Ensure.not_null(obj_id, "obj_id == null"); Ensure.is_true(is_operation(op_v), "op_v is not an operation"); Ensure.not_null(input_arguments, "input_arguments == null"); Set<String> all_params = parameters(op_v); Set<String> params = new HashSet<>(); for (String p : all_params) { if (parameter_direction(op_v, p) == ParameterDirection.INPUT) { params.add(p); } } Ensure.equals(params.size(), input_arguments.size()); MapDataValue mdv = MapDataType.map_of(m_pscope.string(), m_pscope.any(), m_pscope).make(); for (String p : params) { DataValue v = input_arguments.get(p); Ensure.not_null(v); Ensure.is_true(parameter_type(op_v, p).is_instance(v)); mdv.put(m_pscope.string().make(p), v); } Map<Field, DataValue> sfields = new HashMap<>(); sfields.put(m_request_dst_id_field, m_pscope.string().make(dst_id)); sfields.put(m_request_exec_id_field, m_pscope.int64().make(exec_id)); sfields.put(m_request_obj_id_field, m_pscope.string().make(obj_id)); sfields.put(m_request_operation_field, m_pscope.string().make( operation_name(op_v))); sfields.put(m_request_inputs_field, mdv); return m_request_type.make(sfields); } OperationInformation(PrimitiveScope pscope); }
OperationInformation { public DataValue create_execution_request(long exec_id, String dst_id, String obj_id, DataValue op_v, Map<String, DataValue> input_arguments) { Ensure.not_null(dst_id, "dst_id == null"); Ensure.not_null(obj_id, "obj_id == null"); Ensure.is_true(is_operation(op_v), "op_v is not an operation"); Ensure.not_null(input_arguments, "input_arguments == null"); Set<String> all_params = parameters(op_v); Set<String> params = new HashSet<>(); for (String p : all_params) { if (parameter_direction(op_v, p) == ParameterDirection.INPUT) { params.add(p); } } Ensure.equals(params.size(), input_arguments.size()); MapDataValue mdv = MapDataType.map_of(m_pscope.string(), m_pscope.any(), m_pscope).make(); for (String p : params) { DataValue v = input_arguments.get(p); Ensure.not_null(v); Ensure.is_true(parameter_type(op_v, p).is_instance(v)); mdv.put(m_pscope.string().make(p), v); } Map<Field, DataValue> sfields = new HashMap<>(); sfields.put(m_request_dst_id_field, m_pscope.string().make(dst_id)); sfields.put(m_request_exec_id_field, m_pscope.int64().make(exec_id)); sfields.put(m_request_obj_id_field, m_pscope.string().make(obj_id)); sfields.put(m_request_operation_field, m_pscope.string().make( operation_name(op_v))); sfields.put(m_request_inputs_field, mdv); return m_request_type.make(sfields); } OperationInformation(PrimitiveScope pscope); DataValue create_operation(String name); boolean is_operation(DataValue op_v); String operation_name(DataValue op_v); void add_parameter(DataValue op_v, DataType type, String name,
			ParameterDirection direction); Set<String> parameters(DataValue op_v); DataType parameter_type(DataValue op_v, String name); ParameterDirection parameter_direction(DataValue op_v, String name); DataValue create_group(); boolean is_group(DataValue group_v); void add_operation_to_group(DataValue group_v, DataValue op_v); Set<String> group_operation_names(DataValue group_v); boolean group_has_operation(DataValue group_v, String name); DataValue group_operation(DataValue group_v, String name); DataValue create_execution_request(long exec_id, String dst_id,
			String obj_id, DataValue op_v, Map<String,
			DataValue> input_arguments); boolean is_execution_request(DataValue ereq_v); long execution_request_id(DataValue ereq_v); String execution_request_dst(DataValue ereq_v); String execution_request_obj_id(DataValue ereq_v); String execution_request_operation(DataValue ereq_v); Map<String, DataValue> execution_request_input_arguments(
			DataValue ereq_v); DataValue create_execution_response(DataValue ereq_v,
			DataValue op_v, Map<String, DataValue> output_arguments); DataValue create_execution_failure(DataValue ereq_v,
			String failure_type, String failure_description,
			String failure_data); boolean is_execution_response(DataValue eres_v); boolean is_successful_execution(DataValue eres_v); long execution_response_id(DataValue eres_v); Map<String, DataValue> execution_response_output_arguments(
			DataValue eres_v); String execution_response_failure_type(DataValue eres_v); String execution_response_failure_description(DataValue eres_v); String execution_response_failure_data(DataValue eres_v); }
OperationInformation { public DataValue create_execution_request(long exec_id, String dst_id, String obj_id, DataValue op_v, Map<String, DataValue> input_arguments) { Ensure.not_null(dst_id, "dst_id == null"); Ensure.not_null(obj_id, "obj_id == null"); Ensure.is_true(is_operation(op_v), "op_v is not an operation"); Ensure.not_null(input_arguments, "input_arguments == null"); Set<String> all_params = parameters(op_v); Set<String> params = new HashSet<>(); for (String p : all_params) { if (parameter_direction(op_v, p) == ParameterDirection.INPUT) { params.add(p); } } Ensure.equals(params.size(), input_arguments.size()); MapDataValue mdv = MapDataType.map_of(m_pscope.string(), m_pscope.any(), m_pscope).make(); for (String p : params) { DataValue v = input_arguments.get(p); Ensure.not_null(v); Ensure.is_true(parameter_type(op_v, p).is_instance(v)); mdv.put(m_pscope.string().make(p), v); } Map<Field, DataValue> sfields = new HashMap<>(); sfields.put(m_request_dst_id_field, m_pscope.string().make(dst_id)); sfields.put(m_request_exec_id_field, m_pscope.int64().make(exec_id)); sfields.put(m_request_obj_id_field, m_pscope.string().make(obj_id)); sfields.put(m_request_operation_field, m_pscope.string().make( operation_name(op_v))); sfields.put(m_request_inputs_field, mdv); return m_request_type.make(sfields); } OperationInformation(PrimitiveScope pscope); DataValue create_operation(String name); boolean is_operation(DataValue op_v); String operation_name(DataValue op_v); void add_parameter(DataValue op_v, DataType type, String name,
			ParameterDirection direction); Set<String> parameters(DataValue op_v); DataType parameter_type(DataValue op_v, String name); ParameterDirection parameter_direction(DataValue op_v, String name); DataValue create_group(); boolean is_group(DataValue group_v); void add_operation_to_group(DataValue group_v, DataValue op_v); Set<String> group_operation_names(DataValue group_v); boolean group_has_operation(DataValue group_v, String name); DataValue group_operation(DataValue group_v, String name); DataValue create_execution_request(long exec_id, String dst_id,
			String obj_id, DataValue op_v, Map<String,
			DataValue> input_arguments); boolean is_execution_request(DataValue ereq_v); long execution_request_id(DataValue ereq_v); String execution_request_dst(DataValue ereq_v); String execution_request_obj_id(DataValue ereq_v); String execution_request_operation(DataValue ereq_v); Map<String, DataValue> execution_request_input_arguments(
			DataValue ereq_v); DataValue create_execution_response(DataValue ereq_v,
			DataValue op_v, Map<String, DataValue> output_arguments); DataValue create_execution_failure(DataValue ereq_v,
			String failure_type, String failure_description,
			String failure_data); boolean is_execution_response(DataValue eres_v); boolean is_successful_execution(DataValue eres_v); long execution_response_id(DataValue eres_v); Map<String, DataValue> execution_response_output_arguments(
			DataValue eres_v); String execution_response_failure_type(DataValue eres_v); String execution_response_failure_description(DataValue eres_v); String execution_response_failure_data(DataValue eres_v); static final String TDL_RESOURCE; static final String ESEB_NAMESPACE; static final String OPERATION_NAMESPACE; static final String PARAMETER_DIRECTION_ENUM_NAME; static final String PARAMETER_DIRECTION_INPUT_ENUM_VALUE; static final String PARAMETER_DIRECTION_OUTPUT_ENUM_VALUE; static final String PARAMETER_STRUCTURE_NAME; static final String PARAMETER_NAME_FIELD_NAME; static final String PARAMETER_DIRECTION_FIELD_NAME; static final String PARAMETER_TYPE_FIELD_NAME; static final String OPERATION_STRUCTURE_NAME; static final String OPERATION_NAME_FIELD_NAME; static final String OPERATION_PARAMETERS_FIELD_NAME; static final String GROUP_STRUCTURE_NAME; static final String GROUP_OPERATIONS_FIELD_NAME; static final String REQUEST_STRUCTURE_NAME; static final String REQUEST_EXEC_ID_FIELD_NAME; static final String REQUEST_DST_ID_FIELD_NAME; static final String REQUEST_OBJ_ID_FIELD_NAME; static final String REQUEST_OPERATION_FIELD_NAME; static final String REQUEST_INPUTS_FIELD_NAME; static final String RESPONSE_STRUCTURE_NAME; static final String RESPONSE_EXEC_ID_FIELD_NAME; static final String RESPONSE_SUCCESS_STRUCTURE_NAME; static final String RESPONSE_OUTPUT_FIELD_NAME; static final String RESPONSE_FAILURE_STRUCTURE_NAME; static final String RESPONSE_FAILURE_TYPE_FIELD_NAME; static final String RESPONSE_FAILURE_DESCRIPTION_FIELD_NAME; static final String RESPONSE_FAILURE_DATA_FIELD_NAME; }