Create Activity Items


Overview

This page explains how to create Activity Items.
The creation of Activity Items is the first mandatory step to take when you want to validate a SQL Architecture using Zen4Sync.

If you're not familiar with the concept of Activity Items, please take time to read the Zen4Sync Philosophy.

Zen4Sync does not provide - yet - a GUI to create Activity Items.
Therefore the Activity Items creation involves SQL Script writing.

Activity Items creation philosophy

As mentioned in the Zen4Sync Philosophy, Zen4Sync comes with 7 different activities :
  • Merge Synchronization : A Client synchronizes its local database with a publisher of your SQL Server Merge Replication based Architecture.
  • SQL Server Execution : A Client executes SQL queries on a SQL Server database.
  • SQL Server Check Data : A Client executes a SQL query on a SQL Server database and the value returned by the query is compared to an expected value.
  • SQL CE Execution : A Client executes SQL queries on a SQL CE database.
  • SQL CE Check Data : A Client executes a SQL query on a SQL CE database and the value returned by the query is compared to an expected value.
  • SQL CE Backup : A Client saves a SQL CE database by sending it to the Zen4Sync Orchestrator.
  • MEF Component Execution : A Client executes a method of a MEF Component that you've coded and deployed into Zen4Sync.

Each Activity is related to particular resources declared in the Zen4SyncRepository database.

For instance, a (Merge Synchronization Activity relies on a distributor, a publisher, and an internet (IIS Server used for synchronization).
The subscriber is part of the Activity Context, and is therefore inserted when the Test Session is created.

Thus the Activity creation always follows the same pattern:
  1. Insert all the resources needed by the Activity,
  2. Insert the Activity referring to the resources inserted on step 1.

Activities

The following sections explain what are the resources needed by each Activity.
The Zen4Sync Data Model is a precious help when creating Activities.
It'll show you what are the resources needed by each Activity (a resource being a table related to the Activity).

Merge Synchronization

To insert a Merge Synchronization Activity, insert all the needed resources, then insert the Merge Sync.

Related part of the Data Model Table representing the activity
Merge Sync [MergeSync].[syncSession]


Resources needed by the Activity Associated SQL table
Distributor [MergeSync].[distributor]
Publisher [MergeSync].[publisher]
IIS Server Properties [MergeSync].[internet]


The subscriber part of the Synchronization belongs to the Activity Context, so it's inserted when the Test Session is inserted.

SQL Server Execution

The SQL Server Execution Activity does not rely on any resources.
It's standalone and contain the SQL query you want to execute.

Related part of the Data Model Table representing the activity
SQL Server Execution [SQLServerExecution].[sqlServerExecution]


You can specify a parameterized query such as :

-- Parameters are prefixed with @
UPDATE Customer SET Points = @NewPoints WHERE Id = @Id

The value of the parameters can then be specified for each Client executing the Activity.
The parameters value is part of the Activity Context, so it's inserted when the Test Session is inserted.
The Connection String used to connect to the remote SQL Server is also part of the Activity Context.

SQL Server Check Data

The SQL Server Check Data Activity is very similar to the SQL Server Execution except you need to specify the expected value of the executed query.

Related part of the Data Model Table representing the activity
SQL Server Check Data [SQLServerExecution].[sqlServerCheckData]


The SQL query to execute is specified in the exact same way as in a SQL Server Execution Activity.

-- If more than 1 row is returned by the query, only the first row value will be compared to the expected result.
SELECT Points FROM Customer Where Age > @Age

The expected value is specified in the activity using the sqlServerCheckData_expectedValue column.
Its type must be part of the [Admin].[sqlValueType] table.

Again, parameters value and Connection String are part of the Activity Context, so they are inserted when the Test Session is inserted.

SQL CE Execution

The SQL CE Execution Activity is very much like the SQL Server Execution Activity except for the table impacted.

Related part of the Data Model Table representing the activity
SQL CE Execution [SQLCEExecution].[sqlceExecution]


SQL CE Check Data

The SQL CE Check Data Activity is very much like the SQL Server Check Data Activity except for the table impacted.

Related part of the Data Model Table representing the activity
SQL CE Execution [SQLCEExecution].[sqlceCheckData]


SQL CE Backup

TODO

MEF Execution

To insert a MEF Execution Activity, the Zen4Sync MEF Component you're planning on using must be created and deployed in your Zen4Sync platform.

For more information on how to create and deploy a Zen4Sync MEF Component, please see the Zen4Sync MEF Component dedicated documentation page.

Related part of the Data Model Table representing the activity
MEF [MEF].[mefExecution]


An important part of the Activity is the XML Metadata.
These data are stored in the mefExecution_metadata column and will be passed as a parameter to the Zen4Sync MEF Component executing the Activity.
So you can use this column to transmit data to your MEF Component.

You need to make sure to insert valid and well-formed XML into this column.

For instance you could insert something like:
<MyMefComponentMetadata>
  <Color name="Red" />
</MyMefComponentMetadata>

Then your MEF Component will be able to access the Color node since it will receive all the XML.

You can also specify specific Metadata for each Client but this is part of the Activity Context, so it'll be inserted when the Test Session is inserted.

Last edited Jun 16, 2011 at 2:04 PM by Christophe_, version 23

Comments

No comments yet.