The whole episode is meant to be exaggerated and funny, yet with an element of truth to it. Heidi Anne Heiner of Surlalune says, "Previous versions of the tale had the princess learning about the test from a sympathetic helper. She then passes the test with her cunning and foreknowledge. Andersen, on the other hand, liked the idea of a princess' true sensitivity and thus makes the princess an innocent victim of a bad night's sleep."
Jack Zipes points out the irony of the fact that the Prince traveled all over the world, when in fact he only needed to stay at home, because the True Princess came to him.
Yet an even more glaring irony occured to me that I can't believe I never thought of before: in stark contrast to the Princesses' inability to sleep because of the pea, she travels by herself, through a rainstorm, to get to the Prince's palace. When she arrives, "what with the rain and the wind, she was in a sad condition; the water trickled down from her hair, and her clothes clung to her body."
A "true" Princess would never travel alone, on foot, through a rainstorm! She would have an entourage making her journey as comfortable as possible, probably riding in a beautiful carriage, and being announced by trumpet fanfare and accompanied by ladies in waiting. Whatever sensitivity would lead to sleeplessness caused by a little pea would most certainly ensure that she would never even leave the door of her house in such conditions.
According to Heiner's comment above, I wonder if Andersen even noticed the irony of this situation, but the rainstorm travelling episode certainly seems to indicate the folk tales in which the Princess passed the test by cleverness, not by being spoiled. Maria Tatar's and Jack Zipes' reflections on the tale would indicated that Andersen was motivated partly by criticizing the upper class, poking fun at their obsession with establishing bloodlines; yet at the same time Andersen had longed his whole life to be accepted by this same group of people, so he was also vicariously living through the Princess.
This post by Carol L Ward has the summaries of several folk versions. It's likely that the one Andersen had heard in childhood, and thus based his story on, is the Swedish "Princess Who Lay on Seven Peas." I can't seem to find a fell text version online though, let me know if anyone has a link!