Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/FlexUnitApplication.mxml
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/FlexUnitApplication.mxml	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/FlexUnitApplication.mxml	(revision 3366)
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
+				xmlns:flexui="flexunit.flexui.*"
+				minWidth="955" minHeight="600" creationComplete="onCreationComplete()"
+				layout="absolute">
+	<mx:Script>
+		<![CDATA[
+			import clarin.cmdi.componentregistry.editor.model.CMDAttributeTest;
+			import clarin.cmdi.componentregistry.editor.model.CMDComponentElementTest;
+			import clarin.cmdi.componentregistry.editor.model.CMDSpecTest;
+			import clarin.cmdi.componentregistry.services.ComponentInfoServiceTest;
+			
+			public function currentRunTestSuite():Array
+			{
+				var testsToRun:Array = new Array();
+				testsToRun.push(clarin.cmdi.componentregistry.editor.model.CMDAttributeTest);
+				testsToRun.push(clarin.cmdi.componentregistry.editor.model.CMDComponentElementTest);
+				testsToRun.push(clarin.cmdi.componentregistry.editor.model.CMDSpecTest);
+				testsToRun.push(clarin.cmdi.componentregistry.services.ComponentInfoServiceTest);
+				return testsToRun;
+			}
+			
+			
+			private function onCreationComplete():void
+			{
+				testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "ComponentBrowserGui");
+			}
+			
+		]]>
+	</mx:Script>
+	<flexui:FlexUnitTestRunnerUI id="testRunner" portNumber="8765">
+	</flexui:FlexUnitTestRunnerUI>
+	
+</mx:Application>
Index: mponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/TestRunner.mxml
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/TestRunner.mxml	(revision 3365)
+++ 	(revision )
@@ -1,39 +1,0 @@
-<?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 clarin.cmdi.componentregistry.editor.model.CMDSpecTest;
-			import clarin.cmdi.componentregistry.editor.model.CMDAttributeTest;
-			import clarin.cmdi.componentregistry.editor.model.CMDComponentElementTest;
-			import clarin.cmdi.componentregistry.editor.model.CMDComponentTest;
-			import flexunit.framework.TestSuite;
-
-			// Create the test suite and run the tests
-			private function onCreationComplete():void {
-				testRunner.test = createSuite();
-				testRunner.startTest();
-			}
-
-			// Creates the test suite to run
-			private function createSuite():TestSuite {
-				var testSuite:TestSuite = new TestSuite();
-
-				testSuite.addTestSuite(CMDSpecTest);
-				testSuite.addTestSuite(CMDComponentTest);
-				testSuite.addTestSuite(CMDComponentElementTest);
-				testSuite.addTestSuite(CMDAttributeTest);
-
-				return testSuite;
-			}
-		]]>
-	</mx:Script>
-
-	<!-- FlexUnit GUI Component -->
-	<flexunit:TestRunnerBase id="testRunner"
-							 width="100%"
-							 height="100%"/>
-</mx:Application>
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/HelpLabelButton.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/HelpLabelButton.as	(revision 3365)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/HelpLabelButton.as	(revision 3366)
@@ -1,8 +1,4 @@
 package clarin.cmdi.componentregistry.common.components
 {
-	import clarin.cmdi.componentregistry.services.Config;
-	
-	import com.adobe.net.URI;
-	
 	import flash.events.MouseEvent;
 	import flash.net.URLRequest;
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/LoginLabelButton.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/LoginLabelButton.as	(revision 3365)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/common/components/LoginLabelButton.as	(revision 3366)
@@ -8,5 +8,4 @@
 	import flash.net.navigateToURL;
 
-	import mx.controls.Label;
 
 	public class LoginLabelButton extends LabelButton {
@@ -27,5 +26,5 @@
 			var req:URLRequest = new URLRequest();
 
-			var uri:URI = new URI(Config.instance.serviceRootUrl);
+			var uri:URI  = new URI(Config.instance.serviceRootUrl);
 			uri.setQueryValue("shhaaDo", "lI");
 			if (viewType) {
Index: mponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDAttributeTest.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDAttributeTest.as	(revision 3365)
+++ 	(revision )
@@ -1,59 +1,0 @@
-package clarin.cmdi.componentregistry.editor.model {
-	import clarin.cmdi.componentregistry.common.ComponentMD;
-	import clarin.cmdi.componentregistry.editor.ValueSchemeItem;
-	
-	import flexunit.framework.TestCase;
-	import flexunit.framework.TestSuite;
-	
-	import mx.collections.ArrayCollection;
-
-	public class CMDAttributeTest extends TestCase {
-		public function CMDAttributeTest() {
-			super();
-		}
-
-		public static function suite():TestSuite {
-			return new TestSuite(CMDAttributeTest);
-		}
-
-		public function testToXml():void {
-			var result:CMDAttribute = new CMDAttribute();
-			result.name = "aap";
-			result.valueSchemeSimple = "string";
-			var expected:XML = <Attribute>
-					<Name>aap</Name>
-					<Type>string</Type>
-				</Attribute>;
-			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
-		}
-
-		public function testToXmlValueSchemePattern():void {
-			var result:CMDAttribute = new CMDAttribute();
-			result.name = "aap";
-			result.valueSchemePattern = "[a-zA-Z]+";
-			var expected:XML = <Attribute>
-					<Name>aap</Name>
-					<ValueScheme>
-					    <pattern>[a-zA-Z]+</pattern>
-					</ValueScheme>
-				</Attribute>;
-			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
-		}
-
-		public function testToXmlValueSchemeEnumeration():void {
-			var result:CMDAttribute = new CMDAttribute();
-			result.name = "aap";
-			result.valueSchemeEnumeration = new ArrayCollection();
-			result.valueSchemeEnumeration.addItem(new ValueSchemeItem("Male", "test", "test2"));
-			var expected:XML = <Attribute>
-					<Name>aap</Name>
-					<ValueScheme>
-						<enumeration>
-							<item AppInfo="test" ConceptLink="test2">Male</item>
-						</enumeration>
-					</ValueScheme>
-				</Attribute>;
-			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
-		}
-	}
-}
Index: mponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDComponentElementTest.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDComponentElementTest.as	(revision 3365)
+++ 	(revision )
@@ -1,98 +1,0 @@
-package clarin.cmdi.componentregistry.editor.model {
-	import clarin.cmdi.componentregistry.editor.ValueSchemeItem;
-
-	import flexunit.framework.TestCase;
-	import flexunit.framework.TestSuite;
-
-	import mx.collections.ArrayCollection;
-
-	public class CMDComponentElementTest extends TestCase {
-		public function CMDComponentElementTest() {
-			super();
-		}
-
-		public static function suite():TestSuite {
-			return new TestSuite(CMDComponentElementTest);
-		}
-
-		public function testToXml():void {
-			var result:CMDComponentElement = new CMDComponentElement();
-			result.name = "aap";
-			result.valueSchemeSimple = "string";
-			result.documentation = "Docu";
-			result.displayPriority = "1";
-			result.multilingual = "false";
-			var att:CMDAttribute = new CMDAttribute();
-			att.name = "test";
-			att.valueSchemeSimple = "string";
-			result.attributeList.addItem(att);
-			var expected:XML = <CMD_Element name="aap" Documentation="Docu" DisplayPriority="1" ValueScheme="string" CardinalityMin="1" CardinalityMax="1"  Multilingual="false">
-					<AttributeList>
-						<Attribute>
-							<Name>test</Name>
-							<Type>string</Type>
-						</Attribute>  
-					</AttributeList>
-				</CMD_Element>;
-			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
-		}
-
-		public function testToXmlDisplayPriorityZeroMeansDoNotSetIt():void {
-			var result:CMDComponentElement = new CMDComponentElement();
-			result.name = "aap";
-			result.valueSchemeSimple = "string";
-			result.documentation = "Docu";
-			result.displayPriority = "0";
-			var att:CMDAttribute = new CMDAttribute();
-			att.name = "test";
-			att.valueSchemeSimple = "string";
-			result.attributeList.addItem(att);
-			var expected:XML = <CMD_Element name="aap" Documentation="Docu" ValueScheme="string" CardinalityMin="1" CardinalityMax="1">
-					<AttributeList>
-						<Attribute>
-							<Name>test</Name>
-							<Type>string</Type>
-						</Attribute>  
-					</AttributeList>
-				</CMD_Element>;
-			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
-		}
-
-		public function testToXmlValueScheme():void {
-			var result:CMDComponentElement = new CMDComponentElement();
-			result.name = "Sex";
-			result.conceptLink = "http://www.isocat.org/datcat/DC-2560";
-			result.valueSchemeEnumeration = new ArrayCollection();
-			result.valueSchemeEnumeration.addItem(new ValueSchemeItem("Male", "", ""));
-			result.valueSchemeEnumeration.addItem(new ValueSchemeItem("Female", "", ""));
-			result.valueSchemeEnumeration.addItem(new ValueSchemeItem("Unknown", "test", "test2"));
-			var expected:XML = <CMD_Element name="Sex" ConceptLink="http://www.isocat.org/datcat/DC-2560" CardinalityMin="1" CardinalityMax="1">
-					<ValueScheme>
-						<enumeration>
-							<item AppInfo="" ConceptLink="">Male</item>
-							<item AppInfo="" ConceptLink="">Female</item>
-							<item AppInfo="test" ConceptLink="test2">Unknown</item>
-						</enumeration>
-					</ValueScheme>
-				</CMD_Element>;
-
-			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
-		}
-
-		public function testToXmlValueSchemePattern():void {
-			var result:CMDComponentElement = new CMDComponentElement();
-			result.name = "Test";
-			result.cardinalityMax = "5"
-			result.valueSchemePattern = "[a-z]";
-
-			var expected:XML = <CMD_Element name="Test" CardinalityMin="1" CardinalityMax="5">
-					<ValueScheme>
-						<pattern>[a-z]</pattern>
-					</ValueScheme>
-				</CMD_Element>;
-
-			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
-		}
-
-	}
-}
Index: mponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDComponentTest.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDComponentTest.as	(revision 3365)
+++ 	(revision )
@@ -1,24 +1,0 @@
-package clarin.cmdi.componentregistry.editor.model {
-	import flexunit.framework.TestCase;
-	import flexunit.framework.TestSuite;
-
-	public class CMDComponentTest extends TestCase {
-		public function CMDComponentTest() {
-			super();
-		}
-
-		public static function suite():TestSuite {
-			return new TestSuite(CMDComponentTest);
-		}
-
-		public function testToXml():void {
-		    var comp:CMDComponent = new CMDComponent();
-		    comp.name = "aap";
-		    var expected:XML = <CMD_Component name="aap" CardinalityMin="1" CardinalityMax="1"/>
-			assertEquals(expected.toXMLString(), comp.toXml().toXMLString());
-			
-		}
-
-
-	}
-}
Index: mponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDSpecTest.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/editor/model/CMDSpecTest.as	(revision 3365)
+++ 	(revision )
@@ -1,31 +1,0 @@
-package clarin.cmdi.componentregistry.editor.model {
-	import flexunit.framework.TestCase;
-	import flexunit.framework.TestSuite;
-
-	public class CMDSpecTest extends TestCase {
-		public function CMDSpecTest() {
-			super();
-		}
-
-		public static function suite():TestSuite {
-			return new TestSuite(CMDSpecTest);
-		}
-
-		public function testToXml():void {
-			var comp:CMDSpec = new CMDSpec(true);
-			comp.headerName = "aap";
-			comp.headerDescription = "noot";
-			comp.headerId = "";
-			var expected:XML = <CMD_ComponentSpec isProfile="true">
-					<Header>
-						<ID></ID>
-						<Name>aap</Name>
-						<Description>noot</Description>
-					</Header>
-				</CMD_ComponentSpec>
-
-			assertEquals(expected.toXMLString(), comp.toXml().toXMLString());
-
-		}
-	}
-}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/importer/FileLoadedEvent.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/importer/FileLoadedEvent.as	(revision 3365)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/importer/FileLoadedEvent.as	(revision 3366)
@@ -1,4 +1,3 @@
 package clarin.cmdi.componentregistry.importer {
-	import clarin.cmdi.componentregistry.common.ItemDescription;
 	
 	import flash.events.Event;
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/BaseRemoteService.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/BaseRemoteService.as	(revision 3365)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/BaseRemoteService.as	(revision 3366)
@@ -14,4 +14,7 @@
 	import mx.utils.StringUtil;
 	
+	import clarin.cmdi.componentregistry.services.remote.HttpServiceFactory;
+	import clarin.cmdi.componentregistry.services.remote.RemoteService;
+	
 /**
  * Handles communication with any arbitrary XML backend service, implements error handling and dispatching of success events.
@@ -22,5 +25,5 @@
 
 		protected var successEventName:String;
-		protected var readService:HTTPService;
+		protected var readService:RemoteService;
 		
 		/**
@@ -29,7 +32,7 @@
 		 */
 		public function BaseRemoteService(successEventName:String) {
-			readService = new HTTPService();
-			readService.method = HTTPRequestMessage.GET_METHOD;
-			readService.resultFormat = HTTPService.RESULT_FORMAT_E4X;
+			readService = HttpServiceFactory.createRemoteService();
+			readService.setMethod(HTTPRequestMessage.GET_METHOD);
+			readService.setResultFormat(HTTPService.RESULT_FORMAT_E4X);
 			this.successEventName = successEventName;
 		}
@@ -41,5 +44,5 @@
 		protected function dispatchRequest(url:URI):void {
 			trace(url);
-			readService.url = url.toString();
+			readService.setUrl(url);
 			var token:AsyncToken = readService.send();
 			token.addResponder(new Responder(this.requestCallbackOk, this.requestCallbackFailed));
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentInfoService.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentInfoService.as	(revision 3365)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/ComponentInfoService.as	(revision 3366)
@@ -2,4 +2,6 @@
 
 	import com.adobe.net.URI;
+	
+	import mx.controls.Alert;
 	
 	import clarin.cmdi.componentregistry.common.Component;
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/IsocatService.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/IsocatService.as	(revision 3365)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/IsocatService.as	(revision 3366)
@@ -2,15 +2,8 @@
 	import com.adobe.net.URI;
 	
-	import flash.events.EventDispatcher;
-	
-	import mx.controls.Alert;
 	import mx.managers.CursorManager;
-	import mx.messaging.messages.HTTPRequestMessage;
-	import mx.rpc.events.FaultEvent;
-	import mx.rpc.events.ResultEvent;
 	import mx.rpc.http.HTTPService;
-	import mx.utils.StringUtil;
 
-	public class IsocatService extends EventDispatcher {
+	public class IsocatService extends BaseRemoteService {
 		public static const PROFILE_LOADED:String = "ProfileLoaded";
 		public static const TYPE_SIMPLE:String = "simple";
@@ -27,4 +20,5 @@
 
 		public function IsocatService() {
+			super(PROFILE_LOADED);
 		}
 
@@ -35,5 +29,4 @@
 		public function load(keyword:String, type:String):void {
 			if (keyword) {
-				createClient();
 				CursorManager.setBusyCursor();
 				var uri:URI = new URI(Config.instance.isocatSearchUrl);
@@ -41,6 +34,5 @@
 				if (type)
 				    uri.setQueryValue("type", type);
-				service.url = uri.toString();
-				service.send();
+				dispatchRequest(uri);
 			}
 		}
@@ -53,27 +45,7 @@
 		}
 
-		private function createClient():void {
-			service = new HTTPService();
-			service.method = HTTPRequestMessage.GET_METHOD;
-			service.resultFormat = HTTPService.RESULT_FORMAT_E4X;
-			service.addEventListener(ResultEvent.RESULT, handleResult);
-			service.addEventListener(FaultEvent.FAULT, handleError);
-		}
-
-
-		private function handleResult(resultEvent:ResultEvent):void {
+		override protected function handleXmlResult(result:XML):void {
 			CursorManager.removeBusyCursor();
-			if (resultEvent.statusCode >= 200 && resultEvent.statusCode < 300) {
-				var data:XML = new XML(resultEvent.result);
-				searchResults = data.dcif::dataCategory;
-			} else {
-				Alert.show("Unexpected error, server returned status: " + resultEvent.statusCode + "\n Message = ");
-			}
-		}
-
-		private function handleError(faultEvent:FaultEvent):void {
-			CursorManager.removeBusyCursor();
-			var errorMessage:String = StringUtil.substitute("Error in {0} status {1}: {2}", this, faultEvent.statusCode, faultEvent.fault.faultString);
-			Alert.show(errorMessage);
+			searchResults = result.dcif::dataCategory;
 		}
 
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/SaveItemDialog.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/SaveItemDialog.as	(revision 3365)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/SaveItemDialog.as	(revision 3366)
@@ -1,9 +1,8 @@
 package clarin.cmdi.componentregistry.services {
-	import clarin.cmdi.componentregistry.common.ItemDescription;
-
-	import com.adobe.net.URI;
 
 	import flash.net.URLRequest;
 	import flash.net.navigateToURL;
+	import clarin.cmdi.componentregistry.common.ItemDescription;
+	import com.adobe.net.URI;
 
 	public class SaveItemDialog {
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/ClientServiceFactoryImpl.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/ClientServiceFactoryImpl.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/ClientServiceFactoryImpl.as	(revision 3366)
@@ -0,0 +1,15 @@
+package clarin.cmdi.componentregistry.services.remote
+{
+	public class ClientServiceFactoryImpl extends HttpServiceFactory
+	{
+		
+		public function ClientServiceFactoryImpl()
+		{
+			HttpServiceFactory.impl = this;
+		}
+		
+		override public function createNew():RemoteService{
+			return new RemoteServiceWrapper();
+		}
+	}
+}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/HttpServiceFactory.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/HttpServiceFactory.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/HttpServiceFactory.as	(revision 3366)
@@ -0,0 +1,25 @@
+package clarin.cmdi.componentregistry.services.remote
+{
+/**
+ * HttpService factory returns the right implementation of a RemoteService interface, which would typically be
+ * a ClientHttpService for a flex app running in the browser and a MockHttpService for an app running in a flexunit test
+ */
+	
+	public class HttpServiceFactory
+	{
+		
+		public static var impl:HttpServiceFactory;
+		
+		public static function createRemoteService():RemoteService{
+			if (impl == null)
+				impl = new ClientServiceFactoryImpl();
+			return impl.createNew();
+		}
+		
+		public function createNew():RemoteService{
+			if (impl == null)
+				impl = new ClientServiceFactoryImpl();
+			return impl.createNew();
+		};	
+	}
+}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/RemoteService.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/RemoteService.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/RemoteService.as	(revision 3366)
@@ -0,0 +1,14 @@
+package clarin.cmdi.componentregistry.services.remote
+{
+	import com.adobe.net.URI;
+	
+	import mx.rpc.AsyncToken;
+
+	public interface RemoteService
+	{
+		function setMethod(method:String):void;
+		function setResultFormat(format:String):void;
+		function setUrl(url:URI):void;
+		function send():AsyncToken;
+	}
+}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/RemoteServiceWrapper.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/RemoteServiceWrapper.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/clarin/cmdi/componentregistry/services/remote/RemoteServiceWrapper.as	(revision 3366)
@@ -0,0 +1,35 @@
+package clarin.cmdi.componentregistry.services.remote
+{
+	import com.adobe.net.URI;
+	
+	import mx.rpc.AsyncToken;
+	import mx.rpc.http.HTTPService;
+
+	public class RemoteServiceWrapper implements RemoteService
+	{
+		protected var service:HTTPService;
+		
+		public function RemoteServiceWrapper()
+		{
+			service = new HTTPService();
+		}
+		
+		
+		public function setMethod(method:String):void{
+			service.method = method;
+		};
+		
+		public function setResultFormat(format:String):void{
+			service.resultFormat = format;
+		};
+		
+		public function setUrl(url:URI):void{
+			service.url = url.toString();
+		};
+		
+		public function send():AsyncToken{
+			return service.send();
+		};
+
+	}
+}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/main.mxml
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/main.mxml	(revision 3365)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/main/flex/main.mxml	(revision 3366)
@@ -9,4 +9,9 @@
 	<mx:Script>
 		<![CDATA[
+			import com.flexspy.FlexSpy;
+			
+			import mx.controls.Button;
+			import mx.managers.PopUpManager;
+			
 			import clarin.cmdi.componentregistry.common.AboutPopup;
 			import clarin.cmdi.componentregistry.common.Credentials;
@@ -14,9 +19,5 @@
 			import clarin.cmdi.componentregistry.services.Config;
 			import clarin.cmdi.componentregistry.services.PingSessionService;
-			
-			import com.flexspy.FlexSpy;
-			
-			import mx.controls.Button;
-			import mx.managers.PopUpManager;
+			import clarin.cmdi.componentregistry.services.remote.ClientServiceFactoryImpl;
 			
 			import org.hasseg.externalMouseWheel.ExternalMouseWheelSupport;
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/FlexUnitApplication.mxml
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/FlexUnitApplication.mxml	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/FlexUnitApplication.mxml	(revision 3366)
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+
+<!-- This is an auto generated file and is not intended for modification. -->
+
+<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml"
+				xmlns:flexui="flexunit.flexui.*"
+				minWidth="955" minHeight="600" creationComplete="onCreationComplete()"
+				layout="absolute">
+	<mx:Script>
+		<![CDATA[
+			import clarin.cmdi.componentregistry.editor.model.CMDAttributeTest;
+			import clarin.cmdi.componentregistry.editor.model.CMDComponentElementTest;
+			import clarin.cmdi.componentregistry.editor.model.CMDComponentTest;
+			import clarin.cmdi.componentregistry.editor.model.CMDSpecTest;
+			import clarin.cmdi.componentregistry.services.ComponentInfoServiceTest;
+			
+			public function currentRunTestSuite():Array
+			{
+				var testsToRun:Array = new Array();
+				testsToRun.push(clarin.cmdi.componentregistry.editor.model.CMDAttributeTest);
+				testsToRun.push(clarin.cmdi.componentregistry.editor.model.CMDComponentElementTest);
+				testsToRun.push(clarin.cmdi.componentregistry.editor.model.CMDComponentTest);
+				testsToRun.push(clarin.cmdi.componentregistry.editor.model.CMDSpecTest);
+				testsToRun.push(clarin.cmdi.componentregistry.services.ComponentInfoServiceTest);
+				return testsToRun;
+			}
+			
+			
+			private function onCreationComplete():void
+			{
+				testRunner.runWithFlexUnit4Runner(currentRunTestSuite(), "ComponentBrowserGui");
+			}
+			
+		]]>
+	</mx:Script>
+	<flexui:FlexUnitTestRunnerUI id="testRunner" portNumber="8765">
+	</flexui:FlexUnitTestRunnerUI>
+	
+</mx:Application>
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/TestRunner.mxml
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/TestRunner.mxml	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/TestRunner.mxml	(revision 3366)
@@ -0,0 +1,39 @@
+<?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 clarin.cmdi.componentregistry.editor.model.CMDSpecTest;
+			import clarin.cmdi.componentregistry.editor.model.CMDAttributeTest;
+			import clarin.cmdi.componentregistry.editor.model.CMDComponentElementTest;
+			import clarin.cmdi.componentregistry.editor.model.CMDComponentTest;
+			import flexunit.framework.TestSuite;
+
+			// Create the test suite and run the tests
+			private function onCreationComplete():void {
+				testRunner.test = createSuite();
+				testRunner.startTest();
+			}
+
+			// Creates the test suite to run
+			private function createSuite():TestSuite {
+				var testSuite:TestSuite = new TestSuite();
+
+				testSuite.addTestSuite(CMDSpecTest);
+				testSuite.addTestSuite(CMDComponentTest);
+				testSuite.addTestSuite(CMDComponentElementTest);
+				testSuite.addTestSuite(CMDAttributeTest);
+
+				return testSuite;
+			}
+		]]>
+	</mx:Script>
+
+	<!-- FlexUnit GUI Component -->
+	<flexunit:TestRunnerBase id="testRunner"
+							 width="100%"
+							 height="100%"/>
+</mx:Application>
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/CMDComponentTest.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/CMDComponentTest.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/CMDComponentTest.as	(revision 3366)
@@ -0,0 +1,24 @@
+package clarin.cmdi.componentregistry.editor.model {
+	import flexunit.framework.TestCase;
+	import flexunit.framework.TestSuite;
+
+	public class CMDComponentTest extends TestCase {
+		public function CMDComponentTest() {
+			super();
+		}
+
+		public static function suite():TestSuite {
+			return new TestSuite(CMDComponentTest);
+		}
+
+		public function testToXml():void {
+		    var comp:CMDComponent = new CMDComponent();
+		    comp.name = "aap";
+		    var expected:XML = <CMD_Component name="aap" CardinalityMin="1" CardinalityMax="1"/>
+			assertEquals(expected.toXMLString(), comp.toXml().toXMLString());
+			
+		}
+
+
+	}
+}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/editor/model/CMDAttributeTest.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/editor/model/CMDAttributeTest.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/editor/model/CMDAttributeTest.as	(revision 3366)
@@ -0,0 +1,58 @@
+package clarin.cmdi.componentregistry.editor.model {
+	import clarin.cmdi.componentregistry.editor.ValueSchemeItem;
+	
+	import flexunit.framework.TestCase;
+	import flexunit.framework.TestSuite;
+	
+	import mx.collections.ArrayCollection;
+
+	public class CMDAttributeTest extends TestCase {
+		public function CMDAttributeTest() {
+			super();
+		}
+
+		public static function suite():TestSuite {
+			return new TestSuite(CMDAttributeTest);
+		}
+
+		public function testToXml():void {
+			var result:CMDAttribute = new CMDAttribute();
+			result.name = "aap";
+			result.valueSchemeSimple = "string";
+			var expected:XML = <Attribute>
+					<Name>aap</Name>
+					<Type>string</Type>
+				</Attribute>;
+			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
+		}
+
+		public function testToXmlValueSchemePattern():void {
+			var result:CMDAttribute = new CMDAttribute();
+			result.name = "aap";
+			result.valueSchemePattern = "[a-zA-Z]+";
+			var expected:XML = <Attribute>
+					<Name>aap</Name>
+					<ValueScheme>
+					    <pattern>[a-zA-Z]+</pattern>
+					</ValueScheme>
+				</Attribute>;
+			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
+		}
+
+		public function testToXmlValueSchemeEnumeration():void {
+			var result:CMDAttribute = new CMDAttribute();
+			result.name = "aap";
+			result.valueSchemeEnumeration = new ArrayCollection();
+			result.valueSchemeEnumeration.addItem(new ValueSchemeItem("Male", "test", "test2"));
+			var expected:XML = <Attribute>
+					<Name>aap</Name>
+					<ValueScheme>
+						<enumeration>
+							<item AppInfo="test" ConceptLink="test2">Male</item>
+						</enumeration>
+					</ValueScheme>
+				</Attribute>;
+			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
+		}
+	}
+}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/editor/model/CMDComponentElementTest.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/editor/model/CMDComponentElementTest.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/editor/model/CMDComponentElementTest.as	(revision 3366)
@@ -0,0 +1,98 @@
+package clarin.cmdi.componentregistry.editor.model {
+	import clarin.cmdi.componentregistry.editor.ValueSchemeItem;
+
+	import flexunit.framework.TestCase;
+	import flexunit.framework.TestSuite;
+
+	import mx.collections.ArrayCollection;
+
+	public class CMDComponentElementTest extends TestCase {
+		public function CMDComponentElementTest() {
+			super();
+		}
+
+		public static function suite():TestSuite {
+			return new TestSuite(CMDComponentElementTest);
+		}
+
+		public function testToXml():void {
+			var result:CMDComponentElement = new CMDComponentElement();
+			result.name = "aap";
+			result.valueSchemeSimple = "string";
+			result.documentation = "Docu";
+			result.displayPriority = "1";
+			result.multilingual = "false";
+			var att:CMDAttribute = new CMDAttribute();
+			att.name = "test";
+			att.valueSchemeSimple = "string";
+			result.attributeList.addItem(att);
+			var expected:XML = <CMD_Element name="aap" Documentation="Docu" DisplayPriority="1" ValueScheme="string" CardinalityMin="1" CardinalityMax="1"  Multilingual="false">
+					<AttributeList>
+						<Attribute>
+							<Name>test</Name>
+							<Type>string</Type>
+						</Attribute>  
+					</AttributeList>
+				</CMD_Element>;
+			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
+		}
+
+		public function testToXmlDisplayPriorityZeroMeansDoNotSetIt():void {
+			var result:CMDComponentElement = new CMDComponentElement();
+			result.name = "aap";
+			result.valueSchemeSimple = "string";
+			result.documentation = "Docu";
+			result.displayPriority = "0";
+			var att:CMDAttribute = new CMDAttribute();
+			att.name = "test";
+			att.valueSchemeSimple = "string";
+			result.attributeList.addItem(att);
+			var expected:XML = <CMD_Element name="aap" Documentation="Docu" ValueScheme="string" CardinalityMin="1" CardinalityMax="1">
+					<AttributeList>
+						<Attribute>
+							<Name>test</Name>
+							<Type>string</Type>
+						</Attribute>  
+					</AttributeList>
+				</CMD_Element>;
+			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
+		}
+
+		public function testToXmlValueScheme():void {
+			var result:CMDComponentElement = new CMDComponentElement();
+			result.name = "Sex";
+			result.conceptLink = "http://www.isocat.org/datcat/DC-2560";
+			result.valueSchemeEnumeration = new ArrayCollection();
+			result.valueSchemeEnumeration.addItem(new ValueSchemeItem("Male", "", ""));
+			result.valueSchemeEnumeration.addItem(new ValueSchemeItem("Female", "", ""));
+			result.valueSchemeEnumeration.addItem(new ValueSchemeItem("Unknown", "test", "test2"));
+			var expected:XML = <CMD_Element name="Sex" ConceptLink="http://www.isocat.org/datcat/DC-2560" CardinalityMin="1" CardinalityMax="1">
+					<ValueScheme>
+						<enumeration>
+							<item AppInfo="" ConceptLink="">Male</item>
+							<item AppInfo="" ConceptLink="">Female</item>
+							<item AppInfo="test" ConceptLink="test2">Unknown</item>
+						</enumeration>
+					</ValueScheme>
+				</CMD_Element>;
+
+			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
+		}
+
+		public function testToXmlValueSchemePattern():void {
+			var result:CMDComponentElement = new CMDComponentElement();
+			result.name = "Test";
+			result.cardinalityMax = "5"
+			result.valueSchemePattern = "[a-z]";
+
+			var expected:XML = <CMD_Element name="Test" CardinalityMin="1" CardinalityMax="5">
+					<ValueScheme>
+						<pattern>[a-z]</pattern>
+					</ValueScheme>
+				</CMD_Element>;
+
+			assertEquals(expected.toXMLString(), result.toXml().toXMLString());
+		}
+
+	}
+}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/editor/model/CMDSpecTest.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/editor/model/CMDSpecTest.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/editor/model/CMDSpecTest.as	(revision 3366)
@@ -0,0 +1,31 @@
+package clarin.cmdi.componentregistry.editor.model {
+	import flexunit.framework.TestCase;
+	import flexunit.framework.TestSuite;
+
+	public class CMDSpecTest extends TestCase {
+		public function CMDSpecTest() {
+			super();
+		}
+
+		public static function suite():TestSuite {
+			return new TestSuite(CMDSpecTest);
+		}
+
+		public function testToXml():void {
+			var comp:CMDSpec = new CMDSpec(true);
+			comp.headerName = "aap";
+			comp.headerDescription = "noot";
+			comp.headerId = "";
+			var expected:XML = <CMD_ComponentSpec isProfile="true">
+					<Header>
+						<ID></ID>
+						<Name>aap</Name>
+						<Description>noot</Description>
+					</Header>
+				</CMD_ComponentSpec>
+
+			assertEquals(expected.toXMLString(), comp.toXml().toXMLString());
+
+		}
+	}
+}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/services/ComponentInfoServiceTest.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/services/ComponentInfoServiceTest.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/services/ComponentInfoServiceTest.as	(revision 3366)
@@ -0,0 +1,51 @@
+package clarin.cmdi.componentregistry.services
+{
+	import mx.rpc.events.ResultEvent;
+	
+	import clarin.cmdi.componentregistry.common.ItemDescription;
+	
+	import flexunit.framework.TestCase;
+
+	public class ComponentInfoServiceTest extends TestCase
+	{
+		private var service:ComponentInfoService;
+		private var serviceFactory:MockServiceFactoryImpl;
+		
+		//for some reason setup doesn't get called
+		[Before]
+		public function setup():void{
+			serviceFactory = new MockServiceFactoryImpl();
+			service = new ComponentInfoService();
+		}
+		
+		public function ComponentInfoServiceTest()
+		{
+			super(); 
+		}
+		
+		public function testInvocation():void{
+			setup();
+			var item:ItemDescription = new ItemDescription();
+			service.load(item);
+			var xml:XML = <CMD_ComponentSpec isProfile="false">
+<Header>
+<ID>clarin.eu:cr1:c_1376059207640</ID>
+<Name>PublicComponent</Name>
+<Description>Description</Description>
+</Header>
+<CMD_Component CardinalityMax="1" CardinalityMin="1" name="PublicComponent">
+<CMD_Element Multilingual="false" DisplayPriority="1" CardinalityMax="1" CardinalityMin="0" ValueScheme="string" name="OneElement"></CMD_Element>
+</CMD_Component>
+</CMD_ComponentSpec>;
+
+			var result:ResultEvent = new ResultEvent("xml", false, true, xml, serviceFactory.lastService.token, null);
+			
+			serviceFactory.lastService.invokeResult(result);
+			assertNotNull(service.component);
+			assertNotNull(service.component.componentMD);
+			assertEquals("PublicComponent",service.component.componentMD.name);
+		}
+		
+		
+	}
+}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/services/MockRemoteService.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/services/MockRemoteService.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/services/MockRemoteService.as	(revision 3366)
@@ -0,0 +1,40 @@
+package clarin.cmdi.componentregistry.services
+{
+	import com.adobe.net.URI;
+	
+	import mx.rpc.AsyncToken;
+	import mx.rpc.Responder;
+	import mx.rpc.events.ResultEvent;
+	
+	import clarin.cmdi.componentregistry.services.remote.RemoteService;
+
+	public class MockRemoteService implements RemoteService
+	{
+		
+		public var token:AsyncToken;
+		
+		public function MockRemoteService()
+		{
+		}
+		
+		public function send():AsyncToken{
+		
+			token = new AsyncToken();
+			return token;
+		}
+		
+		public function setMethod(method:String):void{
+		}
+		
+		public function setUrl(url:URI):void{
+		}
+		
+		public function setResultFormat(format:String):void{
+		}
+		
+		public function invokeResult(result:ResultEvent):void{
+			var responder:Responder = token.responders[0];
+			responder.result(result);
+		}
+	}
+}
Index: /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/services/MockServiceFactoryImpl.as
===================================================================
--- /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/services/MockServiceFactoryImpl.as	(revision 3366)
+++ /ComponentRegistry/branches/ggeorgovassilis_workspace/ComponentBrowserGui/src/test/flex/clarin/cmdi/componentregistry/services/MockServiceFactoryImpl.as	(revision 3366)
@@ -0,0 +1,21 @@
+package clarin.cmdi.componentregistry.services
+{
+	import clarin.cmdi.componentregistry.services.remote.HttpServiceFactory;
+	import clarin.cmdi.componentregistry.services.remote.RemoteService;
+
+	public class MockServiceFactoryImpl extends HttpServiceFactory
+	{
+		public var lastService:MockRemoteService;
+		
+		public function MockServiceFactoryImpl()
+		{
+			HttpServiceFactory.impl = this;
+		}
+		
+		override public function createNew():RemoteService{
+			lastService = new MockRemoteService();
+			return lastService;
+		
+		}
+	}
+}
