Friday, 24 February 2012

Portable Apps

This week at my customer, I got my laptop replaced. Where I had a laptop with Windows XP and was Local Admin on it, I now have a Windows 7 with a standard user account. For my development work I have a remote pc in a closet (a closet-PC or "Ophok PC").

The most annoying thing is that I can't install my favorite browser Firefox.  But I also want to use XMind mindmapping program and several other tools. For instance, Total Commander is becoming more and more my personal desktop. It's the first thing to start and from there I have buttons to start other apps.

Now I remembered that there are several initiatives to have a collection of apps on a USB stick. For Firefox, and XMind there are portable versions. And also Totalcommander is runnable from a USB stick.

So I got me a spare 8GB USB stick (or at least I made it "spare" for this purpose) and I searched and got into "Portable Apps". This initiative makes it really easy to get a stick with your favorite apps, where it gives a Start menu and a place to browse and work with your documents on a stick. It has an "exit" button to savely remove your stick from the machine.



After you install it on your stick, you can start it with the start.exe file.
Then you get this nice looking start menu:
With the link below, "All Portable Apps", you can switch to a categorized display of your apps. With the Apps menu option you get the possibility to install extra apps:
With Get More Apps  it goes checking it's online repository and from there you can install apps just by checking them and press "Next".





Create an XMind installer
If you want to add your own apps, check the PortableApps.com  Apps Installer:



With this App you can create your own installer.

For Xmind it is pretty easy. Download the Portable version. Unzip the common and the XMind_windows to a temp dir:


Then you can move the contents of the XMind_Windows folder to the upper folder besides the Commons folder. You have to edit the xmind.ini file to replace all occurences of  "../Commons"  with "./Commons".
Then you can direct the PortableApps installer to that folder, and follow the instructions. However, it will fail running the first time.
But it creates several folders, amongst others:



With a tool like Irfanview it is easy to replace these icon-files with a resized version of the picture that can be found if you search on xmind pictures in google. (http://lmgtfy.com/?q=icons+xmind and click on images). Then it will complain for a help.html. You can copy that from an other portable app, like the one of Kompozer/NVU. With Kompozer/NVU you can edit the html file easily. After these changes the PortableApps installer will work, and creates a nice XMind installer.
Here you see that I managed to install it in Portable Apps with even a correct Icon:

Total Commander
For TotalCommander, you simply install the TotalCommander Launcher. Then running it for the first time, it will complain that it hasn't got a correct TotalCommander installation. But it will suggest to copy the installed version to the stick. So just run it for the first time on a machine with a normal installation of TC.

Conclusion
So what does this have to do with Oracle? Almost nothing. But lots with being a consultant that has to do his "thing" on any machine of a customer, with his own favorite tools.

Have fun.

Thursday, 23 February 2012

BPM & SOA 11.1.1.6 released

Just a moment ago I found out that the new Patchset of BPM Suite and SOA Suite is released. I read it on the soacommunity blog.
It's about 11g PS5 (11.1.1.6). It can be downloaded here. This is very important, since the feature pack (4) that was released last autmn was only available for customers through a password protected patch.
So I hope (and expect) that all the goodies in FP4 is also in PS5. Lets check out.

Oh, see also the post about Lucas Jellema's first impressions.

Tuesday, 13 December 2011

SoapUI Tip 3

It was a little searching using the javadocs of SoapUI, but if you want to log the result of the script of a mockService or mockResponse step in a testCase, then that can be done using:
log.info("Response: "+mockResponse.getMockResult().getResponseContent())
Another nice tip I found at another blog: "SoapUI limitations and workarounds : mock response test step"
If you want to use mockServices in your testcase or testsuite, but don't want to implement mockResponse steps for them, you can create (of course) mockServices for them. They can handle multple responses and use xpath expressions to choose the right response for a particular request. But running the testcase you'll need to start the mockServices that you need in the test. this can be done by in the "Setup Script" of the testCase:
def project = testCase.getTestSuite().getProject();
def mockService = project.getMockServiceByName("Name of the MockService");
mockService.start();
After running the testcase/testsuite the mockservices should be stopped neatly. This can be done in the "TearDown Script":
def project = testCase.getTestSuite().getProject();
def mockService = project.getMockServiceByName("Name of the MockService");
def mockRunner = mockService.getMockRunner();
mockRunner.stop();

Monday, 12 December 2011

SoapUI: Properties from test Suite

In my previous post I showed how to get a file from a script in SoapUI. One of the parts on building the filepath of the file to load was a property from the mockService. The same thing is possible from a test suite. There are several places at which you can define properties. Amongst them is the TestSuite.

To get the properties from a test suite, you have to "get" it. To get the test suite on which you defined the properties goes as follows:

def project = mockResponse.mockOperation.mockService.project
def testSuite = project.testSuites["TestSupport"]

The property can then be fetched with:

def filePath = testSuite.getPropertyValue( "responseFilePath")


Test cases are part of the testSuite and they can be fetched from an string-based array in the same manner as getting the testSuite:

def testCase = project.testSuites["TestSuite 1"].testCases["TestCase 1"]

Expanding SoapUI possibilities...

Thursday, 8 December 2011

Load Response Message File System in SoapUI

Today I figured out how to get a response from filesystem in SoapUI. I found that I could not dynamically select from multiple responses in a mockResponse-TestStep in a TestSuite. But loading from a file within a Groovy script should do the job. Advantage is also that you can have as many response files as you like. You just put a value in the filename, that you select using xpath from the request message. The folder in which you store the message can be put in a property on the mockService. I don't have the time to explain the whole lot. But the response in the mockService should be like:
<soapenv:envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:header>
      <darwinheader xmlns="http://www.darwin-it.nl/XMLHeader/10">
         <headerversion>${headerVersion}</headerversion>
         <messageid>${messageId}</messageid>
         <servicerequestordomain>${serviceRequestorDomain}</servicerequestordomain>
         <servicerequestorid>${serviceRequestorId}</servicerequestorid>
         <serviceproviderdomain>${serviceProviderDomain}</serviceproviderdomain>
         <serviceid>${serviceId}</serviceid>
         <serviceversion≶${serviceVersion}</serviceversion>
         <faultindication>${faultIndication}</faultindication>
         <messagetimestamp>${messageTimestamp}</messagetimestamp>
      </darwinheader>
   </soapenv:header>
   <soapenv:body>${responseBody}</soapenv:body>
</soapenv:envelope>
Here you see that the Soapenvelope with the header is given, but the diffent values are properties, as well as the responseBody. The script to get these from the request is as follows:
def method = "ChangeServiceRequest.Response 1.Script"
log.info("Start "+method)

log.info(mockRequest.requestContent)

def groovyUtils = new com.eviware.soapui.support.GroovyUtils(context)
// Set Namespaces
def holder = groovyUtils.getXmlHolder(mockRequest.requestContent)
holder.namespaces["soapenv"] = "http://schemas.xmlsoap.org/soap/envelope/"
holder.namespaces["ns"] = "http://www.darwin-it.nl/XMLHeader/10"
holder.namespaces["rpy"] = "http://www.darwin-it.nl/ChangeServiceRequest/2/Rpy"


log.info("Get Header Properties")
context.messageId=Math.random()
log.info("messageId: "+context.messageId)
context.headerVersion= holder.getNodeValue("//ns:DarwinHeader/ns:HeaderVersion")
log.info("headerVersion: "+context.headerVersion)
context.serviceRequestorDomain= holder.getNodeValue("//ns:DarwinHeader/ns:ServiceRequestorDomain")
log.info("ServiceRequestorDomain: "+context.serviceRequestorDomain)
context.serviceRequestorId= holder.getNodeValue("//ns:DarwinHeader/ns:ServiceRequestorId")
log.info("serviceRequestorId: "+context.serviceRequestorId)
context.serviceProviderDomain= holder.getNodeValue("//ns:DarwinHeader/ns:ServiceProviderDomain")
log.info("serviceProviderDomain: "+context.serviceProviderDomain)
context.serviceId= holder.getNodeValue("//ns:DarwinHeader/ns:ServiceId")
log.info("serviceId: "+context.serviceId)
context.serviceVersion= holder.getNodeValue("//ns:DarwinHeader/ns:ServiceVersion")
log.info("serviceVersion: "+context.serviceVersion)
context.faultIndication= holder.getNodeValue("//ns:DarwinHeader/ns:FaultIndication")
log.info("faultIndication: "+context.faultIndication)
context.messageTimestamp= holder.getNodeValue("//ns:DarwinHeader/ns:MessageTimestamp")
log.info("messageTimestamp: "+context.messageTimestamp)

def serviceRequestNr= holder.getNodeValue("//req:ChangeServiceRequest_Req/req:ServiceRequestData/req:ServiceRequestNumber")
log.info("ServiceRequestNr: "+serviceRequestNr)

def mockRunner = context.getMockRunner()
def mockService = mockRunner.mockService
def filePath = mockService.getPropertyValue( "responseFilePath")+"/FT01_ChangeServiceRequest_"+serviceRequestNr+".xml"
log.info("FileName: "+ filePath)
def File file = new File( filePath )
def fileLength = (int) file.length();
def buffer = new char[fileLength];
def inputReader = new FileReader(file);
def numChar = inputReader.read(buffer);
requestContext.responseBody = new String(buffer);
log.info("End "+method)
With "def holder = groovyUtils.getXmlHolder(mockRequest.requestContent)" you get an XML object of the request. The lines "holder.namespaces["ns"] = "http://www.darwin-it.nl/XMLHeader/10" set the namespace-abbreviations, needed to select the values from the request.
Then with "def serviceRequestNr= holder.getNodeValue("//req:ChangeServiceRequest_Req/req:ServiceRequestData/req:ServiceRequestNumber")", you can perform an xpath query, to get the serviceRequestNr from the request message in this case.

The lines
def mockRunner = context.getMockRunner()
def mockService = mockRunner.mockService
def filePath = mockService.getPropertyValue( "responseFilePath")

show how to read a property from the mockService.

Then the last lines are to determine the actual file path using this property and the  queried serviceRequestNr, and  to read the file.

By putting the file in the requestContext using: "requestContext.responseBody = new String(buffer);" it can be put in the response using the property "${responseBody}" like in the response-skeleton above. You might notice that it is a mixture of Java and Groovy. I'm not so familiar with Groovy yet. But I found that if it works in Java it is easy to get it work in Groovy. Actually, Groovy is just more loosely typed. I hope this clears enough to get this going. Good luck.

Wednesday, 19 October 2011

Drag and drop in Gmail

Well, I'm probably one of the last gmail users that see's it but I just a moment ago encountered that Gmail supports drag and drop.  One of the things I really missed. When I wanted to move mails to a label I had to do it using the 'move-to' poplist. But apparently sometime in the past months google implemented the possibility to grab one of more mails/conversations and drag them to a label. Great. By this the frontend mimics a rich-mail-client as Thunderbird., so that handling mail using Gmail is much more convenient. I love empty mailboxes...