Difference between revisions of "GVExample TestProperty"

From GreenVulcano Wiki
Jump to: navigation, search
({{VULCON}} Configuration)
({{VULCON}} Configuration)
 
(11 intermediate revisions by one other user not shown)
Line 2: Line 2:
  
 
TestProperty service shows the use of the various metadata. This example is limited to create some properties and set its value with the scope of illustrating how metadata can be used. But shows also how to construct the possible properties that you will need in more complex flows.  
 
TestProperty service shows the use of the various metadata. This example is limited to create some properties and set its value with the scope of illustrating how metadata can be used. But shows also how to construct the possible properties that you will need in more complex flows.  
 +
  
 
For more information about metadata (or placeholders) click [[Placeholders|here]].
 
For more information about metadata (or placeholders) click [[Placeholders|here]].
Line 7: Line 8:
 
=={{VULCON}} Configuration==
 
=={{VULCON}} Configuration==
  
The Service TestProperty can be configured using the {{VULCON}} Editor View. The following list enumerates the configuration steps.
+
There are more ways to create and configure a [[Service]] with {{GVESB}}: using the Service Wizard, by drag and drop into the Editor panel or directly from the {{L_VULCON}} core view. Because of the simplicity of this service we preferred to create and configure it using the Editor panel. First we must define a new [[Group]], [[System]] and [[Channel]], if you do not want to use those already present.
# By commodity, we will use an existing [[Group]], in this case DEFAULT_GRP group.  But is also possible create a new one if your project needed.
 
# Create a new [[Service]]: From the {{VULCON}} Core View, right clicking on Services, insert-after -> Service. A new element Service will be created.
 
# Set the [[Service]] parameters in the [[VulCon_perspective|Properties panel]]. We setted:
 
#* group-name as DEFAULT-GRP
 
#* id-service as TestProperty
 
# Insert a new [[Operation]]: Right click the new Service element -> Insert after -> Operation. A new element Operation will be created.
 
# Set the [[Operation]] attributes: We setted the attribute ''name'' as Request.
 
# Add a [[Participant]]: Right clicking the operation element -> Insert after -> Participant. A new Participant element will be created.
 
# Set the parameters value for Participant: Click on the new Participant element. From the Properties view set:
 
#* id-System as GVESB
 
#* id-channel as TEST_CHANNEL
 
# Finally, open the editor: Right click the element ''Operation'' -> Open Editor. A new window will be open into the {{VULCON}} Editor View with the Start Node.  
 
  
Now we are able to configure our flow from the Editor View. Expand the [[Palette]] if it is not already visible from the Editor View. This can be done by clicking into a little arrow head present into the Editor right top corner. The steps are:
+
From the core view:
 +
# Right click the element Groups -> Insert after (or Insert before) -> Group. A new element Group will be created.
 +
# Click on the Group new element and set the attribute ''id-group'' from the Properties View. We named it TEST_GROUP.
 +
# Expand the GVSystems item.
 +
# Right clicking on Systems, insert-after -> System. A new element System will be created.
 +
# Set the [[System]] parameters in the [[VulCon_perspective|Properties panel]]. We named it GVESB_TEST
 +
# You can insert a new [[Channel]] right clicking the new [[System]] element -> Insert after (or Insert before) -> Channel*. A new Channel element will be created
 +
# Click on this new Channel element and set the property ''id_channel''. We named it TEST_CHANNEL.
 +
 
 +
Create a new service:
 +
# From the Core View of {{VULCON}}, right click the element Services -> Insert After (Insert Before) -> Service*
 +
# Set the Service properties: id-service as TestProperty, and group-name as TEST_GROUP.
 +
# Add into the Service TestProperty just created a new Operation: right click the element Service -> Insert After -> Operation*
 +
# Set the Operation property name as Request
 +
# Create a Participant: right click the element Operation -> Insert After (Insert Before) -> Participant*
 +
# Set the parameters id-system as GVESB_TEST and id-channel as TEST_CHANNEL.
 +
 
 +
[[File:GVExamples_TestProperty1.jpg|thumb|TestProperty Service]]Now, you are able to configure your flow from the Editor view as seen in the picture. To do that right click the Operation element -> Open editor.  
 +
 
 +
Expand the [[Palette]] if it is not already visible from the Editor View. This can be done by clicking into a little arrow head present into the Editor right top corner. The steps are:
 
# Add a [[Main_nodes|ChangeGVBuffer Node]]:  
 
# Add a [[Main_nodes|ChangeGVBuffer Node]]:  
## From the Palette drag and drop into the editor a ChangeGVBuffer Node. [[File:GVExamples_TestProperty2.jpg|thumb|Adding a ChangeGVBuffer Node]]A new windows will be open where you can set the element id and its input GVBuffer name. In this example we set
+
## From the Palette drag and drop into the editor a ChangeGVBuffer Node. [[File:GVExamples_TestProperty2.jpg|thumb|Adding a ChangeGVBuffer Node]]A new windows will be open where you can set the element id. In this example we set
#* id: test_property
+
##* id: test_property
#* input: data <br/> Then -> Next
+
##* input: data
## Choose the Virtual Layer Operation you need: in this case we add a [[ChangeGVBuffer]]. Then -> Next 
+
## From the Palette drag and drop into the editor an EndNode Node. A new windows will be open where you can set the element id. In this example we set
## You can also set an Operation Level 2: As we want to define some Properties, we select a PropertyDef.
+
##* id: end
## Set the property name as SQL and the value as <nowiki>sql{{ds.gv_test::select 'OK' from dual}}</nowiki>. Then -> Finish.
 
# Add an [[Main_nodes|End Node]]:
 
## From the Palette drag and drop into the editor a EndNode Node. A new windows will be open where you can set the element id. In this example we set
 
#* id: end. <br/> Then -> Finish
 
 
# Create the connections:  
 
# Create the connections:  
 
## From the Palette click into the Default Connection (black arrow)
 
## From the Palette click into the Default Connection (black arrow)
## Create a connection between the Star Node and ''test_property'' ChangeGVBuffer Node. This is done by clicking first the Start Node and then the ''test_property'' node.  
+
## Create a connection between the Start Node and ''test_property'' ChangeGVBuffer Node. This is done by clicking first the Start Node and then the ''test_property'' node.  
 
## Create another Default Connection between  ''test_property'' ChangeGVBuffer Node and ''end'' node.
 
## Create another Default Connection between  ''test_property'' ChangeGVBuffer Node and ''end'' node.
# Save the Editor in the Eclipse Main Menu.
+
# Save the Editor in the Eclipse Main Menu and close it. You can reopen it from the Core View by right clicking the respective element [[Operation]].
 +
 
 +
The flow is already created. Refresh the Core view in the apposite icon. Check from that the workflow elements will be configured as follow:
 +
 
 +
:Service: group-name="TEST_GROUP", id-service="TestProperty", service-activation="on", statistics="off"
 +
:Operation: name="Request", operation-activation="on"
 +
:Participant: id-channel="TEST_CHANNEL", id-system="GVESB_TEST"
 +
 
 +
The following table shows the parameters to be defined for nodes and sub-elements added:
 +
{|class="gvtable"
 +
! Node !! Attribute
 +
|-
 +
| [[ChangeGVBufferNode]] || id="set_properties" <br/>input="input"<br/> next-node-id="return_status"<br/>output="output"
 +
|-
 +
| ChangeGVBufferNode/ChangeGVBuffer || clear-data="false"
 +
|-
 +
| ChangeGVBufferNode/ChangeGVBuffer/PropertyDef || name="SQL" <br/>value="<nowiki>sql{{ds.gv_test::select 'OK' from dual}}</nowiki>"
 +
|-
 +
| GVEndNode || id="return_status" <br/> output="output"
 +
|}                               
  
The flow is already created. We added more properties in order to illustrate some {{GVESB}} [[Placeholders]]. You can add more PropertyDef elements by right clicking the ''ChangeGVBuffer'' element present in the ChangeGVBufferNode -> Insert After -> PropertyDef. The defined properties are:
+
We added more properties in order to illustrate some {{GVESB}} [[Placeholders]]. You can add more PropertyDef elements by right clicking the ''ChangeGVBuffer'' element present in the [[ChangeGVBufferNode]] -> Insert After -> PropertyDef. The defined properties are:
 
{|class="gvtable"
 
{|class="gvtable"
 
! PropertyDef name !! value
 
! PropertyDef name !! value
Line 62: Line 85:
  
 
[[File:GVExamples_TestProperty3.jpg|thumb|TestProperty configuration]]Before finishing you must control that the {{VULCON}} Configuration has not errors. Errors are indicated by a red cross into the element icon.
 
[[File:GVExamples_TestProperty3.jpg|thumb|TestProperty configuration]]Before finishing you must control that the {{VULCON}} Configuration has not errors. Errors are indicated by a red cross into the element icon.
# As we can see, it is present an error in the ''end'' node. Clicking this element we realize that is missing the output field.
+
# Review all the properties just configured
# Set the parameter ''output'' as the ''output'' of the preceding node, that of ''test_property'' node.  
+
# Save your changes using the Save icon present in the [[The_views|Core View]].
# On clicking ''test_property'' element we see that the output has been setted automatically to ''output_1''. You can change this value or set it if is not present. We changed it to ''output''.
+
 
# Set the ''end'' element attribute output as ''output'' too.
+
[[File:GVExamplesTOUPPER5.jpg|thumb|Exporting configuration]]Once the flow is correctly configured, you can export the configuration and pass it to the {{GVESB}} import tool, in order to add into {{GVESB}} the service just created.
# Save your changes using the Save icon present in the [[Core View]].
+
# The Export function is available in the view "Project". Expand your project
 +
# Before you proceed, press F5 to refresh the file list.
 +
# Right click the ''conf'' folder. It will open a drop-down list.
 +
# Export your project as a compressed file.
 +
 
 +
===Testing with {{GVCONSOLE}}===
 +
 
 +
It is finally the time to test your project. To do that execute the following steps:
 +
 
 +
[[File:GVCONSOLEDeploy.jpg|thumb|Deploy new Service]]To deploy the new Service follow this steps:
 +
# [[Starting|Start {{GVESB}}]]
 +
# [[GV_Console#Access|Access to the {{GVCONSOLE}}]].  
 +
# In the Deploy New Service section click Browse and select the file where you saved the {{VULCON}} configuration.
 +
# Click Submit.
 +
 
 +
The section [[Deploy_Service|Deploy Services]] will be open. In this section you can select the services you want to deploy.
 +
# Clicking on service TestProperty a new view will be showed containing the file ''GVCore.xml'' present in local and on server side.
 +
# Click Deploy. Now you can save the document and write some notes about it.
 +
# Save the Document. By saving you will return to the [[Deploy Service]] section.
 +
 
 +
[[File:GVConsoleUtilityReload1.jpg|thumb|{{GVCONSOLE}} Utility section]]Now pass to the {{GVCONSOLE}} section [[Utility]].
 +
# Click on [[Reload_Configuration|Reload configuration]]
 +
# Select GVCore.xml and then Reload. A new windows will be open to confirm the operation
 +
# Click OK.
 +
 
 +
[[File:GVExamples_TestPropertyOutput.jpg|thumb|Testing TestProperty]]Go to the {{GVCONSOLE}} section [[Testing]]. In this section you can finally test your new service:
 +
# Into the Service field select TestProperty
 +
# Into the System field select GVESB_TEST (Optional)
 +
# Click Request
 +
 
 +
When the service completes, the Testing view will be expanded for containing the GVBUFFER OUTPUT. Standard fields and the detailed GVBuffer are described in the [[Testing#Data_input|Output File Name]] (the default location is <nowiki>$GV_HOME</nowiki>/log/TestOutput.txt).  
  
Now your Service ''TestProperty'' will be configured as seen in the following picture.
+
In case of error or exceptions you can review the logs file present in the folder <nowiki>$GV_HOME</nowiki>/log/.

Latest revision as of 13:46, 28 May 2014

Description

TestProperty service shows the use of the various metadata. This example is limited to create some properties and set its value with the scope of illustrating how metadata can be used. But shows also how to construct the possible properties that you will need in more complex flows.


For more information about metadata (or placeholders) click here.

VulCon Configuration

There are more ways to create and configure a Service with GreenVulcano® ESB: using the Service Wizard, by drag and drop into the Editor panel or directly from the VulCon® core view. Because of the simplicity of this service we preferred to create and configure it using the Editor panel. First we must define a new Group, System and Channel, if you do not want to use those already present.

From the core view:

  1. Right click the element Groups -> Insert after (or Insert before) -> Group. A new element Group will be created.
  2. Click on the Group new element and set the attribute id-group from the Properties View. We named it TEST_GROUP.
  3. Expand the GVSystems item.
  4. Right clicking on Systems, insert-after -> System. A new element System will be created.
  5. Set the System parameters in the Properties panel. We named it GVESB_TEST
  6. You can insert a new Channel right clicking the new System element -> Insert after (or Insert before) -> Channel*. A new Channel element will be created
  7. Click on this new Channel element and set the property id_channel. We named it TEST_CHANNEL.

Create a new service:

  1. From the Core View of VulCon, right click the element Services -> Insert After (Insert Before) -> Service*
  2. Set the Service properties: id-service as TestProperty, and group-name as TEST_GROUP.
  3. Add into the Service TestProperty just created a new Operation: right click the element Service -> Insert After -> Operation*
  4. Set the Operation property name as Request
  5. Create a Participant: right click the element Operation -> Insert After (Insert Before) -> Participant*
  6. Set the parameters id-system as GVESB_TEST and id-channel as TEST_CHANNEL.
TestProperty Service

Now, you are able to configure your flow from the Editor view as seen in the picture. To do that right click the Operation element -> Open editor.

Expand the Palette if it is not already visible from the Editor View. This can be done by clicking into a little arrow head present into the Editor right top corner. The steps are:

  1. Add a ChangeGVBuffer Node:
    1. From the Palette drag and drop into the editor a ChangeGVBuffer Node.
      Adding a ChangeGVBuffer Node
      A new windows will be open where you can set the element id. In this example we set
      • id: test_property
      • input: data
    2. From the Palette drag and drop into the editor an EndNode Node. A new windows will be open where you can set the element id. In this example we set
      • id: end
  2. Create the connections:
    1. From the Palette click into the Default Connection (black arrow)
    2. Create a connection between the Start Node and test_property ChangeGVBuffer Node. This is done by clicking first the Start Node and then the test_property node.
    3. Create another Default Connection between test_property ChangeGVBuffer Node and end node.
  3. Save the Editor in the Eclipse Main Menu and close it. You can reopen it from the Core View by right clicking the respective element Operation.

The flow is already created. Refresh the Core view in the apposite icon. Check from that the workflow elements will be configured as follow:

Service: group-name="TEST_GROUP", id-service="TestProperty", service-activation="on", statistics="off"
Operation: name="Request", operation-activation="on"
Participant: id-channel="TEST_CHANNEL", id-system="GVESB_TEST"

The following table shows the parameters to be defined for nodes and sub-elements added:

Node Attribute
ChangeGVBufferNode id="set_properties"
input="input"
next-node-id="return_status"
output="output"
ChangeGVBufferNode/ChangeGVBuffer clear-data="false"
ChangeGVBufferNode/ChangeGVBuffer/PropertyDef name="SQL"
value="sql{{ds.gv_test::select 'OK' from dual}}"
GVEndNode id="return_status"
output="output"

We added more properties in order to illustrate some GreenVulcano® ESB Placeholders. You can add more PropertyDef elements by right clicking the ChangeGVBuffer element present in the ChangeGVBufferNode -> Insert After -> PropertyDef. The defined properties are:

PropertyDef name value
SQL sql{{ds.gv_test::select 'OK' from dual}}
SQLLIST [sqllist{{ds.gv_test::select name from city order by 1}}]
TIMESTAMP timestamp{{yyyyMMdd HH:mm:ss}}
OGNL Service: ognl{{#object.getService()}}
JAVASCRIPT System: js{{gvesb::object.getSystem()}}
SYSTEM Server Name: ${{jboss.server.name}}
CLASS %{{fqclass}}
DECODE decode{{ognl{{#object.getProperty('SQL')}}::OK::Sql OK::Sql KO}}
MINUTE Minute decode{{js{{gvesb::timestamp{{mm}} % 2 == 0}}::true::EVEN::ODD}}
TestProperty configuration

Before finishing you must control that the VulCon Configuration has not errors. Errors are indicated by a red cross into the element icon.

  1. Review all the properties just configured
  2. Save your changes using the Save icon present in the Core View.
Exporting configuration

Once the flow is correctly configured, you can export the configuration and pass it to the GreenVulcano® ESB import tool, in order to add into GreenVulcano® ESB the service just created.

  1. The Export function is available in the view "Project". Expand your project
  2. Before you proceed, press F5 to refresh the file list.
  3. Right click the conf folder. It will open a drop-down list.
  4. Export your project as a compressed file.

Testing with GV Console

It is finally the time to test your project. To do that execute the following steps:

Deploy new Service

To deploy the new Service follow this steps:

  1. Start GreenVulcano® ESB
  2. Access to the GV Console.
  3. In the Deploy New Service section click Browse and select the file where you saved the VulCon configuration.
  4. Click Submit.

The section Deploy Services will be open. In this section you can select the services you want to deploy.

  1. Clicking on service TestProperty a new view will be showed containing the file GVCore.xml present in local and on server side.
  2. Click Deploy. Now you can save the document and write some notes about it.
  3. Save the Document. By saving you will return to the Deploy Service section.
GV Console Utility section

Now pass to the GV Console section Utility.

  1. Click on Reload configuration
  2. Select GVCore.xml and then Reload. A new windows will be open to confirm the operation
  3. Click OK.
Testing TestProperty

Go to the GV Console section Testing. In this section you can finally test your new service:

  1. Into the Service field select TestProperty
  2. Into the System field select GVESB_TEST (Optional)
  3. Click Request

When the service completes, the Testing view will be expanded for containing the GVBUFFER OUTPUT. Standard fields and the detailed GVBuffer are described in the Output File Name (the default location is $GV_HOME/log/TestOutput.txt).

In case of error or exceptions you can review the logs file present in the folder $GV_HOME/log/.