Saturday, September 10, 2011

biggest concern with moving your applications to the cloud?

wow I wrote about enterprise cloud adoption and found this poll on my linkedin profile that validates my thinking of security and reliability being biggest concerns for cloud adoption by enterpries.



Friday, September 9, 2011

Enterprise customers and Cloud Adoption

A big fear among enterprise customers who want to adopt cloud is that
  1. Is my data secure?
  2. What if this site goes down for 3-4 hours?
  3. What if this startup shutdown business, what will happen to my data?
Recent downtimes from big companies as shown below instills a fear among mission critical busineses wanting to adopt cloud.
  1. Microsoft http://techcrunch.com/2011/09/09/microsofts-cloud-briefly-evaporates-leaves-up-to-365-million-users-without-access-for-four-hours/
  2. Amazon http://eu.techcrunch.com/2011/04/21/amazon-ec2-goes-down-taking-with-it-reddit-foursquare-and-quora/
  3. Google App Engine http://techcrunch.com/2011/09/09/google-explains-its-google-docs-outage/
While moving to cloud makes sense economically but having one bad day can make people go back to traditional methods of manging own infrastructure. Think of a hospital storing all records in cloud, it cant afford a 2-3 hour downtime. There is a better solution to this and its by adopting the hybrid model and companies that will do it successfully will see far more growth in enterprise area. The idea is to have an on-premise cloud that syncs to the real cloud. This way even if the real cloud is down or goes out of business, the on-premise instance ensures business continuity.

Making Junit tests faster

I had some batch of Junit tests that were taking close to 20 minutes and it was wasteful to wait everytime before checking in code, one trick I found was to use the forkmod="once" property. Using this reduce the time to 5 minute 8 sec.

        <junit tempdir="build" printsummary="on" fork="yes" forkmode="once" haltonfailure="${test.haltonfailure}" failureproperty="tests.failed" showoutput="false">

Earlier Junit was forking a JVM per test and now its doing one for all test so its very fast. Here is some documentation from Junit on this property.

Controls how many Java Virtual Machines get created if you want to fork some tests. Possible values are "perTest" (the default), "perBatch" and "once". "once" creates only a single Java VM for all tests while "perTest" creates a new VM for each TestCase class. "perBatch" creates a VM for each nested and one collecting all nested s. Note that only tests with the same settings of filtertrace, haltonerror, haltonfailure, errorproperty and failureproperty can share a VM, so even if you set forkmode to "once", Ant may have to create more than a single Java VM. This attribute is ignored for tests that don't get forked into a new Java VM. since Ant 1.6.2

Selenium and ExtJS

A trick to test selenium with ExtJS is to use cssSelectors. As an element can have more than one css classes and you really dont need to define any style for that css class it can be a good locator for the element and faster than XPATH on IE.

You can define cssSelector as

        tbar: {
            xtype: 'toolbar',
            items: [
                {
                    xtype: 'button',
                    text: 'Send',
                    cls: 'x-btn-text',
                    overCls: 'x-btn-noicon',
                    ctCls: 't-btn-yellow x-btn-over',
                    iconCls: 't-send seleniumSendNote',
                    ...........
                    ...........
and you can then in your test call the button click as

        driver.findElement(By.cssSelector("button.seleniumSendNote"))
                .click();

Selenium and ExtJS HtmlEditor

I had to add a selenium test for a page with ExtJS HtmlEditor and selenium wont recognize it, even tests recorded with Selenium IDE wont recognize it. The reason is that HtmlEditor uses a hidden textarea and a DIV on top of it to trap keystrokes. I tried using lots of ways to set text into it but it would complain about component not visible  and other stuff. Finally the only way I could do is to execute Javascript from webdriver. Here is the code that I used to set the text.

                String notes = "This is a test note from selenium";
		JavascriptExecutor js = (JavascriptExecutor) driver;
		js.executeScript("Ext.getCmp('notes').setValue('"
				+ notes + "')");