Skip to main content

Posts

Showing posts from 2008

Testing Remote Data Services with FlexUnit

This is a short example that describes an approach on testing a Flex remote data access code with FlexUnit . The access to the remote services in Flex is provided via HTTPService , WebService or RemoteObject classes. The requests to the data services are handled asynchronously. That adds a bit more complexity to the unit testing. In this example, I will share a design idea on how to test a client side of the remote data services. This is something I came up with working on my "pet" project. The "pet" project is a Web application that is based on a three tier architecture: an SQL database, a middleware part implemented with Java, Hibernate, and BlazeDS, and a client tier implemented with Flex. The example shown here works on a client side and tests access to the server-side part of the application. The tests covered in this example are designed to test a user login operation. The login operation is defined on the server-side class called UserService. public class ...

Building a Flex project with Ant

Here is a quick sample on how to build a simple Flex "hello world" project with Ant. The "hello world" project contains a src folder with one Flex application file and an Ant build.xml file: ./project_home/ ./src/ app.mxml build.xml The app.mxml is the main module of the project. It simply has a label with a "Hello World!" text: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" layout="absolute"> <mx:Label text="Hello World!"/> </mx:Application> Here is the build.xml source: <?xml version="1.0"?> <project name="fx_practice7" default="all"> <!-- Init the build process --> <target name="init" unless="initialized"> <!-- Name of project and version --> <property name="FLEX_HOME" location="/Users/mykola/java/flex"/> ...

Using FlexUnit for Stress Testing

I saw quite a few questions in the forums on how to stress test a Flex application. I thought about it and came up with an idea that I want to share here. I think FlexUnit can be used for stress testing. It is not that difficult. I simply add multiple test runners for each client application and run all of them asynchronously. Here is the example of the FlexUnit runner: <?xml version="1.0" encoding="utf-8"?> <mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" xmlns="*" xmlns:flexunit="flexunit.flexui.*" creationComplete="onCreationComplete()"> <mx:Script> <![CDATA[ import flexunit.framework.TestSuite; import test.TemperatureConverterTest; import test.ArrayUtilTest; import mx.collections.ArrayCollection; import flexunit.flexui.TestRunnerBase; [Bindable] public var testClients:ArrayCollection; public var NUMBER_OF_TESTS:int = 100; private function onCreationComple...

Java and Flex Builder 3

Flex Builder 3 is distributed as an Eclipse plugin and as a standalone IDE. The standalone version does not support Java development out of the box. These couple of blogs helped me to add Java to the standalone version. Adding Java Development Tools to Flex Builder Standalone by Flex Doc Team Adding Subclipse to Flex Builder 3 Standalone by Dan Wilson

Setting a default application for Flex SWF files on Mac

I found a small problem with opening SWF files on Mac. I am using Mac OS X Tiger version at the moment. I installed Flex SDK 3 and created a sample project in Eclipse with an Ant build file that compiles my Flex msml code to SWF files. I've noticed that generated SWF files are associated with RealPlayer, however it does not really play them. I can select these files in Firefox just fine. But, the bigger problem is when I use a command line Flex debugging tool called fdb. It opens the RealPlayer for me, and I cannot really choose a player in the fdb tool. Adobe fdb (Flash Player Debugger) [build 814] Copyright (c) 2004-2007 Adobe, Inc. All rights reserved. (fdb) (fdb) run file:///Users/mykola/progs/workspace2/fx_practice3/build/fx_practice3.swf Attempting to launch and connect to Player using URL file:///Users/mykola/progs/workspace2/fx_practice3/build/fx_practice3.swf Here is how to fix it. Open Finder and locate the file with swf extension. Right click and select Get Info. ...

How to debug SOAP on Mac with tcpdump

I’ve been using several tools to debug SOAP on Mac and Windows. I would like to share my experience in using some of the tools and show some examples. So far I found four major categories of tools that are useful in debugging SOAP: Interface listeners such as tcpdump and others Proxy tools such as TCPMonitor Servlet filters Application server logging. For example, Weblogic has a special logging option that dumps SOAP requests and responses to the sever log. All of these tools have their own advantages and disadvantages. In this article, I will describe the first type - an interface listener tool called tcpdump. I am planning to describe other three categories in the future posts. The tcpdump is a tool that sniffs IP traffic and dumps it to a file or a standard output stream. It was originally developed by Van Jacobson, Craig Leres and Steven McCanne from the Lawrence Berkeley National Laboratory, University of California, Berkeley, CA. It is open source. The tcpdump documentation...

Deploying BlazeDS to Weblogic 10.0

The BlazeDS is a free and open source J2EE application that provides data services to Adobe Flex and AIR applications. I’ve deployed it to Weblogic 10.0 server. I thought somebody else would be interested to do the same. Here is how. In case you need to install Weblogic 10.0, the developers copy is available for free at http://commerce.bea.com/products/weblogicplatform/weblogic_prod_fam.jsp . I have it installed on my Windows XP at D:\bea10 folder. I have created a new domain for my BlazeDS applications. It is easy to do, see http://edocs.bea.com/common/docs100/confgwiz/index.html for details. In my case, the domain name is blazeds and it is located in D:\bea10\user_projects\domains\blazeds folder on my computer. The domain name and the folders names can be difference, I just mentioned them so it is easier to follow the examples.. Once the Weblogic server is installed and a domain is ready, the BlazeDS applications can be deployed. A copy of BlazeDS is available...