jesterxl

Untitled

Jul 6th, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. package tests.com.hbo.suites.factories.specialfeatures
  2. {
  3.    
  4.     import com.hbo.gocore.factories.InteractiveFeatureFactory;
  5.     import com.hbo.gocore.model.vo.specialfeatures.MapVO;
  6.    
  7.     import flash.events.ErrorEvent;
  8.     import flash.events.Event;
  9.     import flash.events.IOErrorEvent;
  10.     import flash.events.SecurityErrorEvent;
  11.     import flash.net.URLLoader;
  12.     import flash.net.URLRequest;
  13.    
  14.     import org.flexunit.assertThat;
  15.     import org.flexunit.asserts.fail;
  16.     import org.flexunit.async.Async;
  17.     import org.hamcrest.number.greaterThanOrEqualTo;
  18.     import org.hamcrest.object.notNullValue;
  19.  
  20.     public class MapParsingTest
  21.     {
  22.        
  23.         private static const TIMEOUT:int = 2 * 1000;
  24.        
  25.         [Embed(source="/assets/xml/map-viewisimage-takeover.xml")]
  26.         private var mapXMLClass:Class;
  27.        
  28.         [Before]
  29.         public function setup():void
  30.         {
  31.         }
  32.        
  33.         [After]
  34.         public function tearDown():void
  35.         {
  36.         }
  37.        
  38.         private function validateMapVO(mapVO:MapVO):void
  39.         {
  40.             assertThat(mapVO, notNullValue());
  41.             assertThat(mapVO.title, notNullValue());
  42.             assertThat(mapVO.title.length, greaterThanOrEqualTo(1));
  43.             assertThat(mapVO.body, notNullValue());
  44.             assertThat(mapVO.body.length, greaterThanOrEqualTo(1));
  45.             assertThat(mapVO.imageURL, notNullValue());
  46.             assertThat(mapVO.imageURL.length, greaterThanOrEqualTo(1));
  47.         }
  48.        
  49.         [Test]
  50.         public function createMapVOFromWordDocumentNewXML():void
  51.         {
  52.             var wordDocAlsoKnownAsIPadXML:XML = <takeover view="image" baseref="/SPECIAL_FEATURES/GAME_OF_THRONES/SEASON_02/CONTENT/">
  53.                   <title>Maidenpool</title>
  54.                   <subtitle />
  55.                   <body>Legend has named this Riverlands town, where the fool Florian spotted the maiden Jonquil bathing in a pool.</body>
  56.                 <asset>
  57.                   <imageUrl>IMAGE_TAKEOVER/EP205-15/740581_00-21-08_tkvr_ipad_map-maidenpool.jpg</imageUrl>
  58.                   </asset>
  59.                 <links>
  60.                 <share>
  61.                   <iconURL>ICONS/shareIcon.png</iconURL>
  62.                   <title>SHARE</title>
  63.                   </share>
  64.                   </links>
  65.                   </takeover>;
  66.            
  67.             var mapVO:MapVO = InteractiveFeatureFactory.getMapVO(wordDocAlsoKnownAsIPadXML, null);
  68.             validateMapVO(mapVO);
  69.         }
  70.        
  71.         [Test]
  72.         public function createMapVOFromOldXML():void
  73.         {
  74.             var oldXML:XML = <takeover view="map" baseref="/SPECIAL_FEATURES/GAME_OF_THRONES/SEASON_02/CONTENT/MAP_TAKEOVER/">
  75.                     <medias>
  76.                       <media type="image" id="map" src="maidenpool.jpg" />
  77.                       </medias>
  78.                     <texts>
  79.                       <text type="title">MAIDENPOOL</text>
  80.                     <text type="long">
  81.                     <![CDATA[
  82.                     <p>Legend has named this Riverlands spot where the fool Florian spotted the maiden Jonquil bathing in a pool.</p>
  83.                       ]]>  
  84.                       </text>
  85.                       </texts>
  86.                       </takeover>;
  87.             var mapVO:MapVO = InteractiveFeatureFactory.getMapVO(oldXML, null);
  88.             validateMapVO(mapVO);
  89.         }
  90.        
  91.         [Test]
  92.         public function testTakeoverViewAsImageXML():void
  93.         {
  94.             var mapXML:XML = mapXMLClass.data as XML;
  95.             var mapVO:MapVO = InteractiveFeatureFactory.getMapVO(mapXML, null);
  96.             validateMapVO(mapVO);
  97.         }
  98.        
  99.     }
  100. }
Advertisement
Add Comment
Please, Sign In to add comment