チェンジセット 3364

差分発生行の前後
無視リスト:
コミット日時:
2010/01/28 17:04:01 (2 年前)
コミッタ:
Seacolor
ログメッセージ:

オンメモリDBのレコード取得テストの追加・修正

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • air/AirDao/tests/OnMemoryTest.as

    r3355 r3364  
    1616                 * @private 
    1717                 */ 
    18                 //public var t1:ConstructorTest; 
     18                public var t1:ConstructorTest; 
    1919                /** 
    2020                 * @private 
    2121                 */ 
    22                 //public var t2:InsertTest; 
     22                public var t2:InsertTest; 
    2323                /** 
    2424                 * @private 
    2525                 */ 
    26                 //public var t3:UpdateTest; 
     26                public var t3:UpdateTest; 
    2727                /** 
    2828                 * @private 
  • air/AirDao/tests/onMemory/ReadTest.as

    r3355 r3364  
    44        import entities.BooleanOnly; 
    55        import entities.ByteArrayOnly; 
     6        import entities.CreatedOnColumnOnly; 
    67        import entities.DateOnly; 
    78        import entities.IntOnly; 
     
    910        import entities.StringOnly; 
    1011        import entities.UIntOnly; 
     12        import entities.UpdatedOnColumnOnly; 
    1113        import entities.User; 
    1214        import entities.XMLListOnly; 
     
    1517        import flash.events.EventDispatcher; 
    1618        import flash.utils.ByteArray; 
     19        import mx.logging.Log; 
     20        import mx.logging.LogEventLevel; 
     21        import mx.logging.targets.TraceTarget; 
    1722        import org.flexunit.Assert; 
    1823        import org.flexunit.assertThat; 
     
    2328        import org.hamcrest.core.not; 
    2429        import org.hamcrest.date.dateAfter; 
     30        import org.hamcrest.date.dateAfterOrEqual; 
    2531        import org.hamcrest.date.dateEqual; 
     32        import org.hamcrest.number.greaterThan; 
    2633        import org.hamcrest.object.equalTo; 
    2734        import org.hamcrest.object.hasProperties; 
     
    3744                protected var error:Error; 
    3845                 
     46                [BeforeClass] 
     47                public static function runBeforeClass():void { 
     48                        var tt:TraceTarget = new TraceTarget(); 
     49                        tt.includeDate = true; 
     50                        tt.includeTime = true; 
     51                        tt.includeLevel = true; 
     52                        tt.includeCategory = true; 
     53                        tt.level = LogEventLevel.DEBUG; 
     54                        Log.addTarget(tt); 
     55                } 
     56                 
    3957                [Before] 
    4058                public function setUp():void { 
     
    254272                                assertThat(actual, arrayWithSize(1)); 
    255273                                assertThat(actual, everyItem(isA(DateOnly))); 
    256                                 assertThat(actual[0], hasProperties( { 
    257                                         date: dateEqual(newEntity.date) 
    258                                 })); 
     274                                Assert.assertEquals(actual[0].date.toString(), newEntity.date.toString()); 
    259275                        }; 
    260276                        var handleSuccess:Function = function(result:Array):void { 
     
    374390                                assertThat(actual, arrayWithSize(1)); 
    375391                                assertThat(actual, everyItem(isA(ByteArrayOnly))); 
    376                                 assertThat(actual[0], hasProperties( { 
    377                                         byte_array: equalTo(newEntity.byte_array) 
    378                                 })); 
     392                                Assert.assertEquals(actual[0].byte_array.readUTFBytes(actual[0].byte_array.length), newEntity.byte_array.readUTFBytes(newEntity.byte_array.length)); 
    379393                        }; 
    380394                        var handleSuccess:Function = function(result:Array):void { 
     
    395409                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
    396410                } 
    397                 [Ignore] 
     411                 
     412                [Test(async)] 
     413                public function readOneOfInsertedCreatedOnColumn():void { 
     414                        var newEntity:CreatedOnColumnOnly = new CreatedOnColumnOnly(); 
     415                         
     416                        var actual:Array; 
     417                         
     418                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     419                         
     420                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     421                                if (error) { 
     422                                        throw error; 
     423                                        return; 
     424                                } 
     425                                assertThat(actual, arrayWithSize(1)); 
     426                                assertThat(actual, everyItem(isA(CreatedOnColumnOnly))); 
     427                                assertThat(actual[0], hasProperties( { 
     428                                        created_on: notNullValue() 
     429                                })); 
     430                        }; 
     431                        var handleSuccess:Function = function(result:Array):void { 
     432                                actual = result; 
     433                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     434                        }; 
     435                        var handleCreateSuccess:Function = function():void { 
     436                                testTarget.read(CreatedOnColumnOnly, handleSuccess, null, null, handleError); 
     437                        }; 
     438                        var handleError:Function = function(e:Error):void { 
     439                                error = e; 
     440                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     441                        }; 
     442                         
     443                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 500, null, handleTimeout); 
     444                         
     445                        testTarget = new AirDao(); 
     446                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     447                } 
     448                 
     449                [Test(async)] 
     450                public function readOneOfInsertedUpdatedOnColumn():void { 
     451                        var newEntity:UpdatedOnColumnOnly = new UpdatedOnColumnOnly(); 
     452                         
     453                        var actual:Array; 
     454                         
     455                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     456                         
     457                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     458                                if (error) { 
     459                                        throw error; 
     460                                        return; 
     461                                } 
     462                                assertThat(actual, arrayWithSize(1)); 
     463                                assertThat(actual, everyItem(isA(UpdatedOnColumnOnly))); 
     464                                assertThat(actual[0], hasProperties( { 
     465                                        updated_on: notNullValue() 
     466                                })); 
     467                        }; 
     468                        var handleSuccess:Function = function(result:Array):void { 
     469                                actual = result; 
     470                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     471                        }; 
     472                        var handleCreateSuccess:Function = function():void { 
     473                                testTarget.read(UpdatedOnColumnOnly, handleSuccess, null, null, handleError); 
     474                        }; 
     475                        var handleError:Function = function(e:Error):void { 
     476                                error = e; 
     477                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     478                        }; 
     479                         
     480                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 500, null, handleTimeout); 
     481                         
     482                        testTarget = new AirDao(); 
     483                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     484                } 
     485                 
    398486                [Test(async)] 
    399487                public function readOneOfInserted():void { 
     
    419507                                        profile_image: equalTo(newEntity.profile_image), 
    420508                                        created_on: notNullValue(), 
    421                                         updated_on: dateEqual(actual[0].created_on) 
    422                                 })); 
     509                                        updated_on: notNullValue() 
     510                                })); 
     511                                Assert.assertEquals(actual[0].updated_on.toString(), newEntity.updated_on.toString()); 
    423512                        }; 
    424513                        var handleSuccess:Function = function(result:Array):void { 
     
    439528                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
    440529                } 
    441                 [Ignore] 
     530                 
    442531                [Test(async)] 
    443532                public function readManyOfInserted():void { 
     
    472561                                                profile_image: equalTo(expectedEntity.profile_image), 
    473562                                                created_on: notNullValue(), 
    474                                                 updated_on: dateEqual(entity.created_on
     563                                                updated_on: notNullValue(
    475564                                        })); 
     565                                        Assert.assertEquals(entity.updated_on.toString(), expectedEntity.updated_on.toString()); 
    476566                                } 
    477567                        }; 
     
    499589                        } 
    500590                } 
    501                 [Ignore] 
     591                 
     592                [Test(async)] 
     593                public function readOneOfUpdatedInt():void { 
     594                        var newEntity:IntOnly = new IntOnly(); 
     595                        newEntity.min_value = int.MIN_VALUE + 1; 
     596                        newEntity.max_value = int.MAX_VALUE - 1; 
     597                         
     598                        var actual:Array; 
     599                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     600                         
     601                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     602                                if (error) { 
     603                                        throw error; 
     604                                        return; 
     605                                } 
     606                                assertThat(actual, arrayWithSize(1)); 
     607                                assertThat(actual, everyItem(isA(IntOnly))); 
     608                                assertThat(actual[0], hasProperties( { 
     609                                        id: not(equalTo(newEntity.id)), 
     610                                        min_value: equalTo(int.MIN_VALUE), 
     611                                        max_value: equalTo(int.MAX_VALUE) 
     612                                })); 
     613                        }; 
     614                        var handleSuccess:Function = function(result:Array):void { 
     615                                actual = result; 
     616                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     617                        }; 
     618                        var handleUpdateSuccess:Function = function():void { 
     619                                testTarget.read(IntOnly, handleSuccess, null, null, handleError); 
     620                        }; 
     621                        var handleReadSuccess:Function = function(result:Array):void { 
     622                                var updateEntity:IntOnly = result[0]; 
     623                                updateEntity.min_value--; 
     624                                updateEntity.max_value++; 
     625                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     626                        }; 
     627                        var handleCreateSuccess:Function = function():void { 
     628                                testTarget.read(IntOnly, handleReadSuccess, null, null, handleError); 
     629                        }; 
     630                        var handleError:Function = function(e:Error):void { 
     631                                error = e; 
     632                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     633                        }; 
     634                         
     635                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     636                         
     637                        testTarget = new AirDao(); 
     638                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     639                } 
     640                 
     641                [Test(async)] 
     642                public function readOneOfUpdatedUInt():void { 
     643                        var newEntity:UIntOnly = new UIntOnly(); 
     644                        newEntity.min_value = uint.MIN_VALUE + 1; 
     645                        newEntity.max_value = uint.MAX_VALUE - 1; 
     646                         
     647                        var actual:Array; 
     648                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     649                         
     650                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     651                                if (error) { 
     652                                        throw error; 
     653                                        return; 
     654                                } 
     655                                assertThat(actual, arrayWithSize(1)); 
     656                                assertThat(actual, everyItem(isA(UIntOnly))); 
     657                                assertThat(actual[0], hasProperties( { 
     658                                        id: not(equalTo(newEntity.id)), 
     659                                        min_value: equalTo(uint.MIN_VALUE), 
     660                                        max_value: equalTo(uint.MAX_VALUE) 
     661                                })); 
     662                        }; 
     663                        var handleSuccess:Function = function(result:Array):void { 
     664                                actual = result; 
     665                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     666                        }; 
     667                        var handleUpdateSuccess:Function = function():void { 
     668                                testTarget.read(UIntOnly, handleSuccess, null, null, handleError); 
     669                        }; 
     670                        var handleReadSuccess:Function = function(result:Array):void { 
     671                                var updateEntity:UIntOnly = result[0]; 
     672                                updateEntity.min_value--; 
     673                                updateEntity.max_value++; 
     674                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     675                        }; 
     676                        var handleCreateSuccess:Function = function():void { 
     677                                testTarget.read(UIntOnly, handleReadSuccess, null, null, handleError); 
     678                        }; 
     679                        var handleError:Function = function(e:Error):void { 
     680                                error = e; 
     681                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     682                        }; 
     683                         
     684                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     685                         
     686                        testTarget = new AirDao(); 
     687                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     688                } 
     689                 
     690                [Test(async)] 
     691                public function readOneOfUpdatedNumber():void { 
     692                        var newEntity:NumberOnly = new NumberOnly(); 
     693                        newEntity.min_value = -Number.MAX_VALUE + 1.0; 
     694                        newEntity.max_value = Number.MAX_VALUE - 1.0; 
     695                         
     696                        var actual:Array; 
     697                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     698                         
     699                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     700                                if (error) { 
     701                                        throw error; 
     702                                        return; 
     703                                } 
     704                                assertThat(actual, arrayWithSize(1)); 
     705                                assertThat(actual, everyItem(isA(NumberOnly))); 
     706                                assertThat(actual[0], hasProperties( { 
     707                                        id: not(equalTo(newEntity.id)), 
     708                                        min_value: equalTo(-Number.MAX_VALUE), 
     709                                        max_value: equalTo(Number.MAX_VALUE) 
     710                                })); 
     711                        }; 
     712                        var handleSuccess:Function = function(result:Array):void { 
     713                                actual = result; 
     714                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     715                        }; 
     716                        var handleUpdateSuccess:Function = function():void { 
     717                                testTarget.read(NumberOnly, handleSuccess, null, null, handleError); 
     718                        }; 
     719                        var handleReadSuccess:Function = function(result:Array):void { 
     720                                var updateEntity:NumberOnly = result[0]; 
     721                                updateEntity.min_value--; 
     722                                updateEntity.max_value++; 
     723                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     724                        }; 
     725                        var handleCreateSuccess:Function = function():void { 
     726                                testTarget.read(NumberOnly, handleReadSuccess, null, null, handleError); 
     727                        }; 
     728                        var handleError:Function = function(e:Error):void { 
     729                                error = e; 
     730                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     731                        }; 
     732                         
     733                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     734                         
     735                        testTarget = new AirDao(); 
     736                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     737                } 
     738                 
     739                [Test(async)] 
     740                public function readOneOfUpdatedString():void { 
     741                        var newEntity:StringOnly = new StringOnly(); 
     742                        newEntity.name = "user"; 
     743                         
     744                        var actual:Array; 
     745                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     746                         
     747                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     748                                if (error) { 
     749                                        throw error; 
     750                                        return; 
     751                                } 
     752                                assertThat(actual, arrayWithSize(1)); 
     753                                assertThat(actual, everyItem(isA(StringOnly))); 
     754                                assertThat(actual[0], hasProperties( { 
     755                                        id: not(equalTo(newEntity.id)), 
     756                                        name: equalTo("changed " + newEntity.name) 
     757                                })); 
     758                        }; 
     759                        var handleSuccess:Function = function(result:Array):void { 
     760                                actual = result; 
     761                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     762                        }; 
     763                        var handleUpdateSuccess:Function = function():void { 
     764                                testTarget.read(StringOnly, handleSuccess, null, null, handleError); 
     765                        }; 
     766                        var handleReadSuccess:Function = function(result:Array):void { 
     767                                var updateEntity:StringOnly = result[0]; 
     768                                updateEntity.name = "changed " + updateEntity.name; 
     769                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     770                        }; 
     771                        var handleCreateSuccess:Function = function():void { 
     772                                testTarget.read(StringOnly, handleReadSuccess, null, null, handleError); 
     773                        }; 
     774                        var handleError:Function = function(e:Error):void { 
     775                                error = e; 
     776                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     777                        }; 
     778                         
     779                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     780                         
     781                        testTarget = new AirDao(); 
     782                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     783                } 
     784                 
     785                [Test(async)] 
     786                public function readOneOfUpdatedBoolean():void { 
     787                        var newEntity:BooleanOnly = new BooleanOnly(); 
     788                        newEntity.flag = true; 
     789                         
     790                        var actual:Array; 
     791                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     792                         
     793                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     794                                if (error) { 
     795                                        throw error; 
     796                                        return; 
     797                                } 
     798                                assertThat(actual, arrayWithSize(1)); 
     799                                assertThat(actual, everyItem(isA(BooleanOnly))); 
     800                                assertThat(actual[0], hasProperties( { 
     801                                        id: not(equalTo(newEntity.id)), 
     802                                        flag: equalTo(!newEntity.flag) 
     803                                })); 
     804                        }; 
     805                        var handleSuccess:Function = function(result:Array):void { 
     806                                actual = result; 
     807                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     808                        }; 
     809                        var handleUpdateSuccess:Function = function():void { 
     810                                testTarget.read(BooleanOnly, handleSuccess, null, null, handleError); 
     811                        }; 
     812                        var handleReadSuccess:Function = function(result:Array):void { 
     813                                var updateEntity:BooleanOnly = result[0]; 
     814                                updateEntity.flag = !updateEntity.flag; 
     815                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     816                        }; 
     817                        var handleCreateSuccess:Function = function():void { 
     818                                testTarget.read(BooleanOnly, handleReadSuccess, null, null, handleError); 
     819                        }; 
     820                        var handleError:Function = function(e:Error):void { 
     821                                error = e; 
     822                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     823                        }; 
     824                         
     825                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     826                         
     827                        testTarget = new AirDao(); 
     828                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     829                } 
     830                 
     831                [Test(async)] 
     832                public function readOneOfUpdatedDate():void { 
     833                        var newEntity:DateOnly = new DateOnly(); 
     834                        newEntity.date = new Date(); 
     835                         
     836                        var actual:Array; 
     837                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     838                         
     839                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     840                                if (error) { 
     841                                        throw error; 
     842                                        return; 
     843                                } 
     844                                assertThat(actual, arrayWithSize(1)); 
     845                                assertThat(actual, everyItem(isA(DateOnly))); 
     846                                assertThat(actual[0], hasProperties( { 
     847                                        id: not(equalTo(newEntity.id)), 
     848                                        date: dateAfter(newEntity.date) 
     849                                })); 
     850                        }; 
     851                        var handleSuccess:Function = function(result:Array):void { 
     852                                actual = result; 
     853                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     854                        }; 
     855                        var handleUpdateSuccess:Function = function():void { 
     856                                testTarget.read(DateOnly, handleSuccess, null, null, handleError); 
     857                        }; 
     858                        var handleReadSuccess:Function = function(result:Array):void { 
     859                                var updateEntity:DateOnly = result[0]; 
     860                                updateEntity.date = new Date(); 
     861                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     862                        }; 
     863                        var handleCreateSuccess:Function = function():void { 
     864                                testTarget.read(DateOnly, handleReadSuccess, null, null, handleError); 
     865                        }; 
     866                        var handleError:Function = function(e:Error):void { 
     867                                error = e; 
     868                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     869                        }; 
     870                         
     871                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     872                         
     873                        testTarget = new AirDao(); 
     874                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     875                } 
     876                 
     877                [Test(async)] 
     878                public function readOneOfUpdatedXML():void { 
     879                        var newEntity:XMLOnly = new XMLOnly(); 
     880                        newEntity.xml = <root><code>0</code><message>OK</message></root>; 
     881                         
     882                        var actual:Array; 
     883                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     884                         
     885                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     886                                if (error) { 
     887                                        throw error; 
     888                                        return; 
     889                                } 
     890                                assertThat(actual, arrayWithSize(1)); 
     891                                assertThat(actual, everyItem(isA(XMLOnly))); 
     892                                assertThat(actual[0], hasProperties( { 
     893                                        id: not(equalTo(newEntity.id)), 
     894                                        xml: equalTo(<root><code>1</code><message>NOT OK</message></root>) 
     895                                })); 
     896                        }; 
     897                        var handleSuccess:Function = function(result:Array):void { 
     898                                actual = result; 
     899                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     900                        }; 
     901                        var handleUpdateSuccess:Function = function():void { 
     902                                testTarget.read(XMLOnly, handleSuccess, null, null, handleError); 
     903                        }; 
     904                        var handleReadSuccess:Function = function(result:Array):void { 
     905                                var updateEntity:XMLOnly = result[0]; 
     906                                updateEntity.xml = <root><code>1</code><message>NOT OK</message></root>; 
     907                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     908                        }; 
     909                        var handleCreateSuccess:Function = function():void { 
     910                                testTarget.read(XMLOnly, handleReadSuccess, null, null, handleError); 
     911                        }; 
     912                        var handleError:Function = function(e:Error):void { 
     913                                error = e; 
     914                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     915                        }; 
     916                         
     917                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     918                         
     919                        testTarget = new AirDao(); 
     920                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     921                } 
     922                 
     923                [Test(async)] 
     924                public function readOneOfUpdatedXMLList():void { 
     925                        var newEntity:XMLListOnly = new XMLListOnly(); 
     926                        newEntity.xml_list = <> 
     927                                <item><name>name0</name><id>1</id></item> 
     928                                <item><name>name1</name><id>2</id></item> 
     929                                <item><name>name2</name><id>3</id></item> 
     930                        </>; 
     931                         
     932                        var actual:Array; 
     933                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     934                         
     935                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     936                                if (error) { 
     937                                        throw error; 
     938                                        return; 
     939                                } 
     940                                assertThat(actual, arrayWithSize(1)); 
     941                                assertThat(actual, everyItem(isA(XMLListOnly))); 
     942                                assertThat(actual[0], hasProperties( { 
     943                                        id: not(equalTo(newEntity.id)), 
     944                                        xml_list: equalTo(<> 
     945                                                <item><name>name0</name><id>1</id></item> 
     946                                                <item><name>name2</name><id>3</id></item> 
     947                                                <item><name>name3</name><id>4</id></item> 
     948                                                <item><name>name4</name><id>5</id></item> 
     949                                        </>) 
     950                                })); 
     951                        }; 
     952                        var handleSuccess:Function = function(result:Array):void { 
     953                                actual = result; 
     954                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     955                        }; 
     956                        var handleUpdateSuccess:Function = function():void { 
     957                                testTarget.read(XMLListOnly, handleSuccess, null, null, handleError); 
     958                        }; 
     959                        var handleReadSuccess:Function = function(result:Array):void { 
     960                                var updateEntity:XMLListOnly = result[0]; 
     961                                updateEntity.xml_list = <> 
     962                                        <item><name>name0</name><id>1</id></item> 
     963                                        <item><name>name2</name><id>3</id></item> 
     964                                        <item><name>name3</name><id>4</id></item> 
     965                                        <item><name>name4</name><id>5</id></item> 
     966                                </>; 
     967                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     968                        }; 
     969                        var handleCreateSuccess:Function = function():void { 
     970                                testTarget.read(XMLListOnly, handleReadSuccess, null, null, handleError); 
     971                        }; 
     972                        var handleError:Function = function(e:Error):void { 
     973                                error = e; 
     974                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     975                        }; 
     976                         
     977                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     978                         
     979                        testTarget = new AirDao(); 
     980                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     981                } 
     982                 
     983                [Test(async)] 
     984                public function readOneOfUpdatedByteArray():void { 
     985                        var newEntity:ByteArrayOnly = new ByteArrayOnly(); 
     986                        newEntity.byte_array = new ByteArray(); 
     987                        newEntity.byte_array.writeMultiByte("あいうえお", "utf-8"); 
     988                        newEntity.byte_array.position = 0; 
     989                         
     990                        var updateEntity:ByteArrayOnly; 
     991                         
     992                        var actual:Array; 
     993                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     994                         
     995                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     996                                if (error) { 
     997                                        throw error; 
     998                                        return; 
     999                                } 
     1000                                assertThat(actual, arrayWithSize(1)); 
     1001                                assertThat(actual, everyItem(isA(ByteArrayOnly))); 
     1002                                assertThat(actual[0], hasProperties( { 
     1003                                        id: not(equalTo(newEntity.id)) 
     1004                                })); 
     1005                                Assert.assertEquals(actual[0].byte_array.readUTFBytes(actual[0].byte_array.length), updateEntity.byte_array.readUTFBytes(updateEntity.byte_array.length)); 
     1006                        }; 
     1007                        var handleSuccess:Function = function(result:Array):void { 
     1008                                actual = result; 
     1009                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     1010                        }; 
     1011                        var handleUpdateSuccess:Function = function():void { 
     1012                                testTarget.read(ByteArrayOnly, handleSuccess, null, null, handleError); 
     1013                        }; 
     1014                        var handleReadSuccess:Function = function(result:Array):void { 
     1015                                updateEntity = result[0]; 
     1016                                updateEntity.byte_array = new ByteArray(); 
     1017                                updateEntity.byte_array.writeMultiByte("かきくけこ", "utf-8"); 
     1018                                updateEntity.byte_array.position = 0; 
     1019                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     1020                        }; 
     1021                        var handleCreateSuccess:Function = function():void { 
     1022                                testTarget.read(ByteArrayOnly, handleReadSuccess, null, null, handleError); 
     1023                        }; 
     1024                        var handleError:Function = function(e:Error):void { 
     1025                                error = e; 
     1026                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     1027                        }; 
     1028                         
     1029                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     1030                         
     1031                        testTarget = new AirDao(); 
     1032                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     1033                } 
     1034                 
     1035                [Test(async)] 
     1036                public function readOneOfUpdatedCreatedOnColumn():void { 
     1037                        var newEntity:CreatedOnColumnOnly = new CreatedOnColumnOnly(); 
     1038                         
     1039                        var actual:Array; 
     1040                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     1041                         
     1042                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     1043                                if (error) { 
     1044                                        throw error; 
     1045                                        return; 
     1046                                } 
     1047                                assertThat(actual, arrayWithSize(1)); 
     1048                                assertThat(actual, everyItem(isA(CreatedOnColumnOnly))); 
     1049                                assertThat(actual[0], hasProperties( { 
     1050                                        id: not(equalTo(newEntity.id)), 
     1051                                        created_on: notNullValue() 
     1052                                })); 
     1053                                Assert.assertEquals(actual[0].created_on.toString(), newEntity.created_on.toString()); 
     1054                        }; 
     1055                        var handleSuccess:Function = function(result:Array):void { 
     1056                                actual = result; 
     1057                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     1058                        }; 
     1059                        var handleUpdateSuccess:Function = function():void { 
     1060                                testTarget.read(CreatedOnColumnOnly, handleSuccess, null, null, handleError); 
     1061                        }; 
     1062                        var handleReadSuccess:Function = function(result:Array):void { 
     1063                                var updateEntity:CreatedOnColumnOnly = result[0]; 
     1064                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     1065                        }; 
     1066                        var handleCreateSuccess:Function = function():void { 
     1067                                testTarget.read(CreatedOnColumnOnly, handleReadSuccess, null, null, handleError); 
     1068                        }; 
     1069                        var handleError:Function = function(e:Error):void { 
     1070                                error = e; 
     1071                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     1072                        }; 
     1073                         
     1074                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     1075                         
     1076                        testTarget = new AirDao(); 
     1077                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     1078                } 
     1079                 
     1080                [Test(async)] 
     1081                public function readOneOfUpdatedUpdatedOnColumn():void { 
     1082                        var newEntity:UpdatedOnColumnOnly = new UpdatedOnColumnOnly(); 
     1083                         
     1084                        var actual:Array; 
     1085                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     1086                         
     1087                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     1088                                if (error) { 
     1089                                        throw error; 
     1090                                        return; 
     1091                                } 
     1092                                assertThat(actual, arrayWithSize(1)); 
     1093                                assertThat(actual, everyItem(isA(UpdatedOnColumnOnly))); 
     1094                                assertThat(actual[0], hasProperties( { 
     1095                                        id: not(equalTo(newEntity.id)), 
     1096                                        updated_on: dateAfter(newEntity.updated_on) 
     1097                                })); 
     1098                        }; 
     1099                        var handleSuccess:Function = function(result:Array):void { 
     1100                                actual = result; 
     1101                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     1102                        }; 
     1103                        var handleUpdateSuccess:Function = function():void { 
     1104                                testTarget.read(UpdatedOnColumnOnly, handleSuccess, null, null, handleError); 
     1105                        }; 
     1106                        var handleReadSuccess:Function = function(result:Array):void { 
     1107                                var updateEntity:UpdatedOnColumnOnly = result[0]; 
     1108                                testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     1109                        }; 
     1110                        var handleCreateSuccess:Function = function():void { 
     1111                                testTarget.read(UpdatedOnColumnOnly, handleReadSuccess, null, null, handleError); 
     1112                        }; 
     1113                        var handleError:Function = function(e:Error):void { 
     1114                                error = e; 
     1115                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     1116                        }; 
     1117                         
     1118                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 750, null, handleTimeout); 
     1119                         
     1120                        testTarget = new AirDao(); 
     1121                        testTarget.create(newEntity, handleCreateSuccess, handleError); 
     1122                } 
     1123                 
    5021124                [Test(async)] 
    5031125                public function readOneOfUpdated():void { 
     
    5221144                                        profile_image: equalTo(newEntity.profile_image), 
    5231145                                        created_on: notNullValue(), 
    524                                         updated_on: dateAfter(actual[0].created_on) 
     1146                                        updated_on: dateAfter(newEntity.created_on) 
    5251147                                })); 
    5261148                        }; 
     
    5521174                } 
    5531175                 
     1176                [Test(async)] 
     1177                public function readManyOfUpdated():void { 
     1178                        const limCols:int = 30; 
     1179                        var newEntities:Vector.<User> = new Vector.<User>(limCols, true); 
     1180                        for (var i:int = 0; i < limCols; i++) { 
     1181                                var newEntity:User = new User(); 
     1182                                newEntity.name = "user" + i; 
     1183                                newEntity.password = "password" + i; 
     1184                                newEntities[i] = newEntity; 
     1185                        } 
     1186                         
     1187                        var actual:Array; 
     1188                        var eventDispatcher:EventDispatcher = new EventDispatcher(); 
     1189                        var j:int = 0; 
     1190                        var k:int = 0; 
     1191                         
     1192                        var handleComplete:Function = function(event:Event, passThroughData:Object):void { 
     1193                                if (error) { 
     1194                                        throw error; 
     1195                                        return; 
     1196                                } 
     1197                                assertThat(actual, arrayWithSize(limCols)); 
     1198                                assertThat(actual, everyItem(isA(User))); 
     1199                                for (var l:int = 0; l < limCols; l++) { 
     1200                                        var entity:User = User(actual[l]); 
     1201                                        var expectedEntity:User = newEntities[l]; 
     1202                                        assertThat(entity, hasProperties( { 
     1203                                                id: not(equalTo(expectedEntity.id)), 
     1204                                                name: equalTo("changed " + expectedEntity.name), 
     1205                                                password: equalTo("changed " + expectedEntity.password), 
     1206                                                profile_image: equalTo(expectedEntity.profile_image), 
     1207                                                created_on: notNullValue(), 
     1208                                                updated_on: dateAfter(entity.created_on) 
     1209                                        })); 
     1210                                } 
     1211                        }; 
     1212                        var handleSuccess:Function = function(result:Array):void { 
     1213                                actual = result; 
     1214                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     1215                        }; 
     1216                        var handleUpdateSuccess:Function = function():void { 
     1217                                j++; 
     1218                                 
     1219                                if (j == 30) { 
     1220                                        testTarget.read(User, handleSuccess, null, null, handleError); 
     1221                                } 
     1222                        }; 
     1223                        var handleReadSuccess:Function = function(result:Array):void { 
     1224                                for each (var updateEntity:User in result) { 
     1225                                        updateEntity.name = "changed " + updateEntity.name; 
     1226                                        updateEntity.password = "changed " + updateEntity.password; 
     1227                                        testTarget.update(updateEntity, handleUpdateSuccess, handleError); 
     1228                                } 
     1229                        }; 
     1230                        var handleCreateSuccess:Function = function():void { 
     1231                                k++; 
     1232                                 
     1233                                if (k == 30) { 
     1234                                        testTarget.read(User, handleReadSuccess, null, null, handleError); 
     1235                                } 
     1236                        }; 
     1237                        var handleError:Function = function(e:Error):void { 
     1238                                error = e; 
     1239                                eventDispatcher.dispatchEvent(new Event(Event.COMPLETE)); 
     1240                        }; 
     1241                         
     1242                        Async.handleEvent(this, eventDispatcher, Event.COMPLETE, handleComplete, 15000, null, handleTimeout); 
     1243                         
     1244                        testTarget = new AirDao(); 
     1245                        for each (var e:User in newEntities) { 
     1246                                testTarget.create(e, handleCreateSuccess, handleError); 
     1247                        } 
     1248                } 
     1249                 
    5541250                protected function handleTimeout(passThroughData:Object):void { 
    5551251                        Assert.fail("query timeouted..");