Flowgear Nodes are the building blocks of an integration. The Flowgear Nodes Test Harness makes it easy for developers to build and debug Nodes.

Screencasts


You will need

  • Visual Studio 2015/2017 (Run as Administrator)
  • Install a DropPoint on your development machine (requires Flowgear DropPoint v4.3 or later)

Creating a Project

  1. Create a Class Library project in Visual Studio targeting .NET Framework 4.5.1. This will be the assembly that contains your Node (or Nodes).
  2. Create a second Console Application project in the same solution, it also needs to target .NET Framework 4.5.1.
  3. Reference the Class library project in your Console Application project
  4. In your Class Library project, add a nuget reference to Flowgear.Sdk. To do this, locate the Package Manager Console in Visual Studio and enter the command install-package Flowgear.Sdk
  5. In your Console Application project, add a nuget reference to Flowgear.Nodes.TestHarness using the command install-package Flowgear.Nodes.TestHarness
  6. Sign both projects. (You do not need to use your production certificate. Signing the projects up-front ensures that they can only reference signed assemblies).
  7. Add a 16x16 PNG to the Class Library, this will be the icon used to represent your Node. Set the Build Action to Embedded Resource
  8. Create the structure of your Node using the template shown below
  9. In your Console Application, add the harness loader code shown below
  10. Set the Console Application to be the Startup Project for the Solution and launch the project
  11. In the Flowgear Console, open or add a Workflow. Click the + button on the Design Canvas to add an object and tap Debug a Node.
  12. Tap the DropPoint that is running on the development machine
  13. Flowgear will add the Node to the Design Canvas. If you make changes to the Node (eg. add properties, implement optional methods, etc), you can update the Node UI by tapping Node settings (cog button) and choosing Upgrade Node
  14. Run the Workflow to invoke the Node.
  15. You can also create and test Connections (if your Node defines a Connection) by tapping the Connection property and clicking the + button

Harness Loader Code

Place the Harness reference code in the Main method of your C# Console Application project.

See the Harness sample code

Example Node Class

Place the Custom Node reference code in its own class in a C# Console Application

See the Node sample code

Creating Samples

  1. Create an XML file that confirms to the Node Sample Schema.
  2. When providing values for the Properties on the Node, you can either provide a text value in the Value attribute or if the value is a document or large string, point to a file in a sub-folder with a relative path by using the ValueFile attribute.
  3. For XML properties, you can also optionally supply a schema file by providing a value for the SchemaFile attribute. If you don't provide a schema for an XML property, Flowgear will infer a schema for you.
  4. Run your Node via the Test Harness, add it to a Workflow as described above and then click Settings (cog icon) and Choose Samples on the Node.
  5. All samples will be immediately syntactically validated.

Publishing Your Node

  1. In the Console, click Nodes and then click the + icon to upload a Node.
  2. Select the Account you would like to publish the Node from and then point to a Zip archive of the binaries for the Node (typically, the contents of the bin\Release folder should be zipped).
  3. Tick the Make this Node Public checkbox if you would like the Node to be reviewed and published to all users on approval. If this is left unchecked, the Node will only be available for your use.
  4. Once a Node has been uploaded, you can access it from the Nodes Pane where you will see an Owned label against the Node. Click the Node for more information and to upload Samples and save Node Configurations
  5. To upload samples, create a Zip archive of the contents of your samples folder including any referenced files. Click Upload Samples and point to the archive. Once it's uploaded, click Submit
  6. To change Node Configuration, modify the content of the Configuration textbox and click Save Configuration.

Troubleshooting

Unable to connect to Test Harness

Ensure that you have selected the correct DropPoint and that your Visual Studio project is running on the same machine as the DropPoint. It may also be necessary to run Visual Studio as Administrator (if you don't do this, it may not be able to establish a connection to the DropPoint service).

Request for the permission of type ... failed

Nodes are not permitted to perform certain actions within the Flowgear Cloud environment. Set the appropriate RunFrom value in the Node attribute on your class. All permissions except RunFrom.DropPointUnrestrictedOnly will apply sandbox permissions similar to those of our Cloud environment so that you are able to identify any potential security issues during debugging.

To identify the source of this exception in your Node, check the Common Language Runtime Exceptions checkbox under the Exceptions pane in Visual Studio. In your own code, ensure you are not attempting to access resources such as the File System, Registry, Environment variables and are not calling functions in the System.Reflection namespace.

If the permission exception is triggered by a third party library that you are referencing, review the source code of the library. If the source code is not available, use ILDASM, ILSpy or .NET Reflector to review the source code.

If it is not possible to avoid violating the permission requirement, you can still publish your Node but it will only execute when routed through a DropPoint.

Did this answer your question?