| 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 | |
|---|