Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

Data File

Each implementation of the Avro object container file spec implements a data file generator and a data file reader.

The schema used for each task can be found at share/test/schemas/interop.avsc.

An example of the data file generator used by the Python implementation can be found at lang/py/test/gen_interop_data.py.

An example of the data file reader used by the Python implementation can be found at lang/py/test/test_datafile_interop.py.

Once you have implemented your data file generator and reader, you should add them to the test target of build.sh.

RPC

Each implementation of the Avro RPC spec implements a client and server for the protocol found at share/test/schemas/simple.avpr.

It's common for an implementation to define a "tool" script that can start up an Avro server or client to handle a single message with an arbitrary protocol. An example tool implementation, in Python, can be found at lang/py/src/avro/tool.py (it's not pretty, but it gets the job done).

The driver which executes the RPC interoperability tests can be found at share/test/interop/bin/test_rpc_interop.sh. This driver iterates through each (client, server, message) triple and tests that an RPC is executed successfully.

To add your new implementation to the tests, define a bash variable for both the client and server for which the value is a bash command prefix which, when executed from the base of trunk and passed the additional arguments from the driver bash script, will execute the client or server. For example, the Python client and server use:

Code Block
py_client="python lang/py/src/avro/tool.py rpcsend"
py_server="python lang/py/src/avro/tool.py rpcreceive" 

The full client bash command is $client http://127.0.0.1:$port $proto $msg -file $c/request.avro. The client variable is the script prefix you defined above. The $proto variable points to the location of the protocol definition file, and the $msg is the message name being tested. $c/request.avro variable is filled in succession by the request.avro file found in the directory share/test/interop/rpc/$msg. This file contains an Avro-encoded request object for the specified message.

The full server bash command is $server http://0.0.0.0:0/ $proto $msg -file $c/response.avro > $portfile &. As you can see, your server script should output the port on which it is listening so that the driver script may pass this information to the client being tested. As in the client, the $server variable is the script prefix you defined above, the $proto variable points to the location of the protocol definition file, the $msg is the message name being tested, and the $c/response.avro file contains an Avro-encoded response object for the specified message.

Once these bash variables have been defined, add them to the clients and servers arrays defined just below the language-specific command definitions.