Source Adapter Test API

The test API allows you to spec test your RhoConnect source adapter application.

setup_test_for

Initializes the source adapter under test for a given user, typically in a before(:each) block. Refer to Example of setup_test_for for an example.

setup_test_for(adapter,user_id)
adapter The name of the source adapter.
user_id The name of the user.

test_query

Executes the adapter’s query method and returns the master document (:md) stored in redis. Refer to Example of test_query for an example.

test_query

query_errors

Returns any errors stored in redis for the previous source adapter query. Refer to Example of query_errors for an example.

query_errors

test_create

Executes the adapter’s create method with a provided record and returns the object string from the create method. If the create method returns a string, then a link will be saved for the device next time it synchronizes. Refer to Example of test_create for an example.

test_create(record)
record a local database partition.

create_errors

Returns the result of the adapter’s create method. The master document (:md) should also contain the new record. Returns any errors stored in redis from the previous source adapter create (same structure as query errors).

create_errors

test_update

Execute the source adapter’s update method. Refer to Example of test_update for an example.

test_update(record)
record A record as hash of hashes (object_id => object).

update_errors

Returns any errors stored in redis from the previous source adapter update (same structure as query errors).

update_errors

test_delete

Execute the source adapter’s delete method. Takes a record as hash of hashes (object_id => object). Refer to Example of test_delete for an example.

test_delete(record)
record A record as hash of hashes (object_id => object).

delete_errors

Returns any errors stored in redis from the previous source adapter delete (same structure as query errors). Refer to Example of test_delete for an example.

delete_errors

md

Returns the master document (:md) for the source adapter stored in redis. This is equivalent to the @result hash of hashes structure. Refer to Example of md for an example.

md

cd

Returns the client document (:cd) for the source adapter + client under test. The master document (:md) and client document (:cd) should be equal after the query is executed. Refer to Example of cd for an example.

cd
Back to Top