Difference between revisions of "GVExample TOUPPER"

From GreenVulcano Wiki
Jump to: navigation, search
(Testing with {{GVCONSOLE}})
m (Description)
Line 1: Line 1:
 
==Description==
 
==Description==
  
This example shows a [[Paradigms_of_communication|synchronous service]].  
+
This simple example shows a [[Paradigms_of_communication|synchronous service]] and its configuration.
 +
A string is passed and {{GVESB}} returns it uppercase.
  
 
==How To==
 
==How To==

Revision as of 11:47, 17 February 2012

Description

This simple example shows a synchronous service and its configuration. A string is passed and GreenVulcano® ESB returns it uppercase.

How To

New Vulcon Project

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

  1. From the Menu panel of VulCon 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 the Location as ${{gv.app.home}}/TEST/TESTFS. Then click finish. The new VulCon project GVEXAMPLE has been created.


The best mode for creating a Service is through the Wizard. But for use it you must first define a new Group, System and Channel, if you do not want to use those already presents, and the workflow operations. 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.
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 windows will be open where you can set the name of the Service you want to create, in this case we named TOUPPER, and your Group, we used TEST_GROUP. You can also select the paradigm, for this example will be synchronous-synchronous. Click next.
  3. Set System as GVESB_TEST and Channel as TEST_CHANNEL. Then chose 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 open 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 follow:

  • 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 compressed file.

Testing with GV Console

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

Deploy new Service

Suppose you have saved the VulCon project as "${{gv.app.home}}/TEST/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 files 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 voice select TOUPPER
  2. Into the System voice select GVESB_TEST
  3. Click RequestReply

When test finishes, the Testing view will be expanded for containing the GVBUFFER OUTPUT. In this case no properties have been defined so there are only be presents the main informations about the process (System, Service, Id, etc.). Standard fields and the detailed GVBuffer are described in the Output File Name (we setted it as ${{gv.app.home}}/log/TestOutput.txt).

In case of error or exceptions you can review the logs file presents in the folder ${{gv.app.home}}/log/.