Difference between revisions of "GVExample TOUPPER"

From GreenVulcano Wiki
Jump to: navigation, search
(Testing with {{GVCONSOLE}})
 
(19 intermediate revisions by 4 users not shown)
Line 1: Line 1:
The easiest way to create a service with {{L_VULCON}} is to interact with the ''[[Wizard]] New Service'' option.
+
==Description==
  
 +
This example shows a simple [[Paradigms_of_communication|synchronous service]] and its configuration.
 +
The service accepts a string as input, then returns it converted to uppercase.
  
From the core view:
+
==How To==
# expand the element [[GVServices]]
 
# right click the element [[Services]]
 
# select from the visualized drop down menu the object Wizard New Service
 
  
 +
[[File:NewVulconProject.jpg|thumb| New Vulcon Project]]As this might be our first example, the first step will be the creation of a new {{VULCON}} Project.
 +
# From the Menu panel of Eclipse click File -> New -> Project. A new windows will be open containing the projects type.
 +
# Select Vulcon -> "New Vulcon Project" item. Then click Next
 +
# Set the project name and Location. We named the project GVEXAMPLE and choose a Location of your choice. Then click finish. The new {{VULCON}} project GVEXAMPLE has been created.
  
[[File:GVExamplesTOUPPER1.jpg|thumb|Creating service TOUPPER]]In addition to the name of the service, the user could select a [[group]] (including those already configured) and a [[paradigm]] of communication between couples Client-ESB and ESB-Server. In this new service, the client will be the system suggested by the name "GVESB", and the server will be a testing service internal to {{GVESB}}
 
# choose "DEFAULT_GRP" as a group
 
# choose "Synchronous-Synchronous" as a [[scenario]]
 
# call the Service "TOUPPER".
 
  
 +
The preferred mode for creating a [[Service]] (at least its skeleton) is through the Service Wizard. Before using it you must first configure the test VCL plugin tho execute the uppercase conversion. So let's define a new [[Group]], [[System]] and [[Channel]], if you do not want to use those already present, and then start the Wizard.
  
 +
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
 +
# Finally, insert the operation you need for the workflow. In this case a ''test-service-call''. Right clicking Channel -> Insert after -> [[test-service-call]]. A new element ''test-service-call'' will be created.
 +
# Set the [[test-service-call]] attributes. From the properties view set the ''name'' attribute as ''test'' and the ''service'' attribute as ''toupper''.
  
 
+
[[File:NewServiceWizard.jpg|thumb|New {{GVESB}} Service Wizard]]Now we are able to use the Wizard.
[[File:GVExamplesTOUPPER2.jpg|thumb|Chosing an operation]]Continuing with the Wizard, the user can choose the client system, and the requested operation that will run on the server through the selection of the triple [[system]]-[[Channel]]-[[Operation]].
+
# From the Core View of {{VULCON}}. Right click the element Services -> Wizard New Service
 
+
# A new window will be open where you can set the name of the Service you want to create, in this case we name it TOUPPER, and as Group, we use TEST_GROUP. You can also select the communication paradigm, for this example it will be [[Paradigms_of_communication#synchronous-synchronous|synchronous-synchronous]]. Click next.
 
+
# Set System as GVESB_TEST and Channel as TEST_CHANNEL. Then choose the Operation, in this case ''test''. Then finish.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
[[File:GVExamplesTOUPPER3.jpg|thumb|Operation diagram]]After you click on the button "Finish", a new [[service]] named "TOUPPER" will be available. In addition, a diagram is shown with the flow operations (in this case only one: the ''RequestReply'').
 
 
 
  
  
 +
[[File:TOUPPEREditor.jpg |thumb |TOUPPER flow]]As you can see from the core view, inside the Services element, a new Service named TOUPPER has been created. The editor will be opened automatically, showing the nodes involved in our [[Flow]].
 +
* The [[Main_nodes|Start node]] sets the flow first node. In this case ''request''
 +
* The [[Operations |Operation node]] ''request'' calls the ''test-service-call'' operation '''test''' and executes it.
 +
* A [[Main_nodes|Check node]] named ''check_status'' is also inserted for controlling the success of the preceding node.
 +
* If ''success'' flow passes to the [[Main_nodes|End node]] ''return_status''
 +
* In case of Error, flow goes to the [[Main_nodes|End node]] ''return_error''. The difference with ''return_status'' is signed by the [[Palette|Connection]] with ''check_status'' Check node. In this case an [[Palette|Error Connection]] (the Red arrow) have been used.
 +
* Save clicking the ''Save'' icon from the Core View
  
 +
The GVCore.xml configuration file will be changed as follows:
 +
* Into ''Groups'' element will be added the tag
 +
<syntaxhighlight lang="XML">
 +
<Group group-activation="on" id-group="TEST_GROUP"/>
 +
</syntaxhighlight>
 +
* Into ''Services'' element will be added the tag
 +
<syntaxhighlight lang="XML">
 +
<Service group-name="TEST_GROUP" id-service="TOUPPER" service-activation="on"
 +
                    statistics="off">
 +
    <Operation name="RequestReply" operation-activation="on"
 +
                          out-check-type="sys-svc-tid" type="operation">
 +
        <Description>VulCon generated Operation</Description>
 +
        <Participant id-channel="TEST_CHANNEL" id-system="GVESB_TEST"/>
 +
        <Flow first-node="request" point-x="50" point-y="150">
 +
              <GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode"
 +
                  id="request" id-system="GVESB_TEST"
 +
                  input="input_test" next-node-id="check_status"
 +
                  op-type="call" operation-name="test"
 +
                  output="output_test" point-x="200" point-y="150"
 +
                  type="flow-node"/>
 +
              <GVNodeCheck class="it.greenvulcano.gvesb.core.flow.GVNodeCheck"
 +
                  default-id="return_status" id="check_status"
 +
                  input="output_test" on-exception-id="return_error"
 +
                  op-type="check" point-x="350" point-y="150"
 +
                  type="flow-node"/>
 +
              <GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode"
 +
                  id="return_status" op-type="end" output="output_test"
 +
                  point-x="700" point-y="50" type="flow-node"/>
 +
              <GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode"
 +
                  id="return_error" op-type="end" output="output_test"
 +
                  point-x="700" point-y="250" type="flow-node"/>
 +
        </Flow>
 +
    </Operation>
 +
</Service>
 +
</syntaxhighlight>
 +
* Into ''Systems'' element will be added the tag
 +
<syntaxhighlight lang="XML">
 +
<System id-system="GVESB_TEST" system-activation="on">
 +
  <Channel id-channel="TEST_CHANNEL">
 +
        <test-service-call class="it.greenvulcano.gvesb.virtual.internal.TestServiceCall"
 +
                name="test" service="toupper" type="call"/>
 +
  </Channel>
 +
</System>
 +
</syntaxhighlight>
  
 +
Now you are able to test your first {{VULCON}} Service from the {{L_GVCONSOLE}}. But first you need to export the configuration.
  
 +
[[File:GVExamplesTOUPPER5.jpg|thumb|Exporting configuration]]Once the flow is correctly configured, the user can export the configuration and pass it to the {{GVESB}} import tool, in order to add into the {{GVESB}} the service just created.
 +
# The Export function is available in the view "Project". Expand the 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 VulCon project file (.zip).
  
 +
===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]]Suppose you have saved the {{VULCON}} project as <nowiki>REPG1.zip</nowiki>. 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.
  
[[File:GVExamplesTOUPPER4.jpg|thumb|Adding a Notification node]]The user can also customize the flow created by adding new nodes with the help of the palette tools. For example, let's add a [[Notification node]] for notifying an error occurred in the [[flow]] (must be inserted after a [[check node]] and it is identified by a red arrow).
+
The section [[Deploy_Service|Deploy Services]] will be open. In this section you can select the services you want to deploy.
# pick a notification node present in the [[palette]] and drag it into the editor
+
# Clicking on service TOUPPER a new view will be showed containing the file ''GVCore.xml'' present in local and on server side.
# give it a name, we use ''notify''
+
# Click Deploy. Now you can save the document and write some notes about it.
# make the Error [[connection]] (red arrow pointing from ''check_status'' to ''end_error'' nodes), to point to ''notify'' node by dragging the arrowhead
+
# Save the Document. By saving you will return to the [[Deploy Service]] section.
# create a Default [[connection]] from ''notify'' to ''end_error''
 
# save the editor (Ctrl+s) or directly from the Eclipse Menu.
 
# control that everything is fine in the Core view. Errors are visualized using the icon [[File:DefaultWarn.png|20px]] for the superelements and a red cross over the icon of the node for which the warning is present ([[File:notification_error.png|20px]] in this case)
 
# moves the cursor over the object with warning. In this case ''notify''. Comments and warnings (reported with a red background) of the DTD elements appear as a tooltip. In this case it reads: "Attribute ''output'' in the element ''GVNotificationNode'' cannot be empty"
 
# set in the property panel the attribute output, preferably with the input value of one of the preceding operation nodes in order to avoid and [[exception]] spread.
 
# save the changes into the core view
 
  
 +
[[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:GVExamplesTOUPPER5.jpg|thumb|Exporting configuration]]Once the flow is correctly configured, the user can export the configuration and pass it to the {{GVESB}} import tool, in order to add into the ESB the service just created. The Export function is available in the view "Navigator Explorer" (or "Project Explorer" depending on the Eclipse version), expanding the project and clicking the folder "conf" with the left mouse button (before you proceed press F5 to refresh the file list). It will open a drop-down list, which shows the "VulCon Editor "> option "Export in compressed files".
+
[[File:GVConsoleTesting.jpg|thumb|{{GVCONSOLE}} Testing section]]Go to the {{GVCONSOLE}} section [[Testing]]. In this section you can finally test your new service:
 +
# Into the Service field select TOUPPER
 +
# Into the System field select GVESB_TEST (Optional)
 +
# Into the Payload area insert the text to convert in uppercase
 +
# Click RequestReply
  
 +
When the service completes, the Testing view will be expanded for containing the GVBUFFER OUTPUT. In this case no properties have been defined, so only the main information about the process is present (System, Service, Id, etc.). To view the service payload output click on ''Show as Text'' button. 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 you can test your First Vulcon Project using the {{L_GVCONSOLE}}. You can find the "How To" for this example clicking [[Examples using the GV Console | here]].
+
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 15:28, 28 May 2014

Description

This example shows a simple synchronous service and its configuration. The service accepts a string as input, then returns it converted to uppercase.

How To

New Vulcon Project

As this might be our first example, the first step will be the creation of a new VulCon Project.

  1. From the Menu panel of Eclipse click File -> New -> Project. A new windows will be open containing the projects type.
  2. Select Vulcon -> "New Vulcon Project" item. Then click Next
  3. Set the project name and Location. We named the project GVEXAMPLE and choose a Location of your choice. Then click finish. The new VulCon project GVEXAMPLE has been created.


The preferred mode for creating a Service (at least its skeleton) is through the Service Wizard. Before using it you must first configure the test VCL plugin tho execute the uppercase conversion. So let's define a new Group, System and Channel, if you do not want to use those already present, and then start the Wizard.

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
  8. Finally, insert the operation you need for the workflow. In this case a test-service-call. Right clicking Channel -> Insert after -> test-service-call. A new element test-service-call will be created.
  9. Set the test-service-call attributes. From the properties view set the name attribute as test and the service attribute as toupper.
New GreenVulcano® ESB Service Wizard

Now we are able to use the Wizard.

  1. From the Core View of VulCon. Right click the element Services -> Wizard New Service
  2. A new window will be open where you can set the name of the Service you want to create, in this case we name it TOUPPER, and as Group, we use TEST_GROUP. You can also select the communication paradigm, for this example it will be synchronous-synchronous. Click next.
  3. Set System as GVESB_TEST and Channel as TEST_CHANNEL. Then choose the Operation, in this case test. Then finish.


TOUPPER flow

As you can see from the core view, inside the Services element, a new Service named TOUPPER has been created. The editor will be opened automatically, showing the nodes involved in our Flow.

  • The Start node sets the flow first node. In this case request
  • The Operation node request calls the test-service-call operation test and executes it.
  • A Check node named check_status is also inserted for controlling the success of the preceding node.
  • If success flow passes to the End node return_status
  • In case of Error, flow goes to the End node return_error. The difference with return_status is signed by the Connection with check_status Check node. In this case an Error Connection (the Red arrow) have been used.
  • Save clicking the Save icon from the Core View

The GVCore.xml configuration file will be changed as follows:

  • Into Groups element will be added the tag
<Group group-activation="on" id-group="TEST_GROUP"/>
  • Into Services element will be added the tag
<Service group-name="TEST_GROUP" id-service="TOUPPER" service-activation="on"
                     statistics="off">
     <Operation name="RequestReply" operation-activation="on"
                           out-check-type="sys-svc-tid" type="operation">
         <Description>VulCon generated Operation</Description>
         <Participant id-channel="TEST_CHANNEL" id-system="GVESB_TEST"/>
         <Flow first-node="request" point-x="50" point-y="150">
              <GVOperationNode class="it.greenvulcano.gvesb.core.flow.GVOperationNode"
                   id="request" id-system="GVESB_TEST"
                   input="input_test" next-node-id="check_status"
                   op-type="call" operation-name="test"
                   output="output_test" point-x="200" point-y="150"
                   type="flow-node"/>
              <GVNodeCheck class="it.greenvulcano.gvesb.core.flow.GVNodeCheck"
                   default-id="return_status" id="check_status"
                   input="output_test" on-exception-id="return_error"
                   op-type="check" point-x="350" point-y="150"
                   type="flow-node"/>
              <GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode"
                   id="return_status" op-type="end" output="output_test"
                   point-x="700" point-y="50" type="flow-node"/>
              <GVEndNode class="it.greenvulcano.gvesb.core.flow.GVEndNode"
                   id="return_error" op-type="end" output="output_test"
                   point-x="700" point-y="250" type="flow-node"/>
         </Flow>
     </Operation>
</Service>
  • Into Systems element will be added the tag
<System id-system="GVESB_TEST" system-activation="on">
   <Channel id-channel="TEST_CHANNEL">
        <test-service-call class="it.greenvulcano.gvesb.virtual.internal.TestServiceCall"
                name="test" service="toupper" type="call"/>
   </Channel>
</System>

Now you are able to test your first VulCon Service from the GV Console®. But first you need to export the configuration.

Exporting configuration

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

  1. The Export function is available in the view "Project". Expand the 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 VulCon project file (.zip).

Testing with GV Console

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

Deploy new Service

Suppose you have saved the VulCon project as REPG1.zip. 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 TOUPPER 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.
GV Console Testing section

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

  1. Into the Service field select TOUPPER
  2. Into the System field select GVESB_TEST (Optional)
  3. Into the Payload area insert the text to convert in uppercase
  4. Click RequestReply

When the service completes, the Testing view will be expanded for containing the GVBUFFER OUTPUT. In this case no properties have been defined, so only the main information about the process is present (System, Service, Id, etc.). To view the service payload output click on Show as Text button. 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/.