├── .gitignore
├── README
├── build
├── build.properties
├── build.xml
└── libs
│ ├── flexUnitTasks-4.0.0.jar
│ ├── flexunit-4.0.0.swc
│ ├── flexunit-aircilistener-4.0.0.swc
│ ├── flexunit-cilistener-4.0.0.swc
│ ├── flexunit-flexcoverlistener-4.0.0.swc
│ └── flexunit-uilistener-4.0.0.swc
├── examples
└── JSONExample
│ └── JSONExample.mxml
├── src
└── com
│ └── adobe
│ ├── air
│ ├── crypto
│ │ └── EncryptionKeyGenerator.as
│ ├── filesystem
│ │ ├── FileMonitor.as
│ │ ├── FileUtil.as
│ │ ├── VolumeMonitor.as
│ │ └── events
│ │ │ └── FileMonitorEvent.as
│ ├── logging
│ │ └── FileTarget.as
│ └── net
│ │ ├── ResourceCache.as
│ │ └── events
│ │ └── ResourceCacheEvent.as
│ ├── crypto
│ ├── HMAC.as
│ ├── MD5.as
│ ├── MD5Stream.as
│ ├── SHA1.as
│ ├── SHA224.as
│ ├── SHA256.as
│ └── WSSEUsernameToken.as
│ ├── errors
│ └── IllegalStateError.as
│ ├── fileformats
│ └── vcard
│ │ ├── Address.as
│ │ ├── Email.as
│ │ ├── Phone.as
│ │ ├── VCard.as
│ │ └── VCardParser.as
│ ├── images
│ ├── BitString.as
│ ├── JPGEncoder.as
│ └── PNGEncoder.as
│ ├── net
│ ├── DynamicURLLoader.as
│ ├── IURIResolver.as
│ ├── MimeTypeMap.as
│ ├── URI.as
│ ├── URIEncodingBitmap.as
│ └── proxies
│ │ └── RFC2817Socket.as
│ ├── protocols
│ └── dict
│ │ ├── Database.as
│ │ ├── Definition.as
│ │ ├── Dict.as
│ │ ├── DictionaryServer.as
│ │ ├── MatchStrategy.as
│ │ ├── Response.as
│ │ ├── events
│ │ ├── ConnectedEvent.as
│ │ ├── DatabaseEvent.as
│ │ ├── DefinitionEvent.as
│ │ ├── DefinitionHeaderEvent.as
│ │ ├── DictionaryServerEvent.as
│ │ ├── DisconnectedEvent.as
│ │ ├── ErrorEvent.as
│ │ ├── MatchEvent.as
│ │ ├── MatchStrategiesEvent.as
│ │ └── NoMatchEvent.as
│ │ └── util
│ │ ├── CompleteResponseEvent.as
│ │ └── SocketHelper.as
│ ├── serialization
│ └── json
│ │ ├── JSON.as
│ │ ├── JSONDecoder.as
│ │ ├── JSONEncoder.as
│ │ ├── JSONParseError.as
│ │ ├── JSONToken.as
│ │ ├── JSONTokenType.as
│ │ └── JSONTokenizer.as
│ ├── utils
│ ├── ArrayUtil.as
│ ├── DateUtil.as
│ ├── DictionaryUtil.as
│ ├── IntUtil.as
│ ├── NumberFormatter.as
│ ├── StringUtil.as
│ └── XMLUtil.as
│ └── webapis
│ ├── ServiceBase.as
│ ├── URLLoaderBase.as
│ └── events
│ └── ServiceEvent.as
└── tests
└── src
├── AllCoreLibTests.as
├── CoreLibTestRunner-app.xml
├── CoreLibTestRunner.mxml
└── com
└── adobe
├── air
├── crypto
│ └── EncryptionKeyGeneratorTest.as
├── filesystem
│ ├── FileMonitorTest.as
│ ├── VolumeMonitorTest.as
│ └── events
│ │ └── FileMonitorEventTest.as
└── net
│ └── events
│ └── ResourceCacheEventTest.as
├── crypto
├── HMACMD5Test.as
├── HMACSHA1Test.as
├── MD5Test.as
├── SHA1Test.as
├── SHA224Test.as
├── SHA256Test.as
└── WSSEUsernameTokenTest.as
├── images
├── JPGEncoderTest.as
└── PNGEncoderTest.as
├── net
└── URITest.as
├── protocols
├── events
│ ├── ConnectedEventTest.as
│ ├── DatabaseEventTest.as
│ ├── DefinitionEventTest.as
│ ├── DefinitionHeaderEventTest.as
│ ├── DictionaryServerEventTest.as
│ ├── DisconnectedEventTest.as
│ ├── ErrorEventTest.as
│ ├── MatchEventTest.as
│ ├── MatchStrategiesEventTest.as
│ └── NoMatchEventTest.as
└── util
│ └── CompletedResponseEventTest.as
├── serialization
└── json
│ ├── JSONTest.as
│ └── SimpleClass.as
├── utils
├── ArrayUtilTest.as
├── DateUtilTest.as
├── DictionaryUtilTest.as
├── IntUtilTest.as
├── NumberFormatterTest.as
├── StringUtilTest.as
└── XMLUtilTest.as
└── webapis
└── events
└── ServiceEventTest.as
/.gitignore:
--------------------------------------------------------------------------------
1 | #### `.gitignore`
2 |
3 | # SVN directories
4 | .svn
5 |
6 | # osx noise
7 | .DS_Store
8 | *.pbxuser
9 | profile
10 |
11 | #Flex Builder noise
12 | .actionScriptProperties
13 | .flexProperties
14 | .project
15 | .settings
16 | bin/*
17 | bin-debug/*
18 | report/*
19 | bin-test/*
20 | docs/*
21 | .flexLibProperties
22 |
23 | #Java Noise
24 | *.class
25 |
26 |
--------------------------------------------------------------------------------
/README:
--------------------------------------------------------------------------------
1 | An ActionScript 3 Library that contains a number of classes and utilities for working with ActionScript? 3. These include classes for MD5 and SHA 1 hashing, Image encoders, and JSON serialization as well as general String, Number and Date APIs.
2 |
3 | Code is released under a BSD License:
4 | http://www.opensource.org/licenses/bsd-license.php
5 |
6 | Copyright (c) 2008, Adobe Systems Incorporated
7 | All rights reserved.
8 |
9 | Redistribution and use in source and binary forms, with or without
10 | modification, are permitted provided that the following conditions are
11 | met:
12 |
13 | * Redistributions of source code must retain the above copyright notice,
14 | this list of conditions and the following disclaimer.
15 |
16 | * Redistributions in binary form must reproduce the above copyright
17 | notice, this list of conditions and the following disclaimer in the
18 | documentation and/or other materials provided with the distribution.
19 |
20 | * Neither the name of Adobe Systems Incorporated nor the names of its
21 | contributors may be used to endorse or promote products derived from
22 | this software without specific prior written permission.
23 |
24 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
25 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
26 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
27 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
28 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
29 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
30 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
31 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
32 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
33 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
34 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
--------------------------------------------------------------------------------
/build/build.properties:
--------------------------------------------------------------------------------
1 |
2 | # -----------------------------------------------------------------
3 | # File Names - DO NOT MODIFY
4 | # -----------------------------------------------------------------
5 | test.application.name = CoreLibTestRunner
6 |
7 | library.name = as3corelib
8 |
9 | # -----------------------------------------------------------------
10 | # Project Paths - DO NOT MODIFY
11 | # -----------------------------------------------------------------
12 | build.dir = ${basedir}/build
13 | build.libs.dir = ${basedir}/build/libs
14 | src.dir = ${basedir}/src
15 | test.src.dir = ${basedir}/tests/src
16 | bin.dir = ${basedir}/bin
17 | test.bin.dir = ${basedir}/bin-test
18 | report.dir = ${basedir}/report
19 | report.html.dir = ${basedir}/report/html
20 | docs.dir = ${basedir}/docs
21 |
--------------------------------------------------------------------------------
/build/libs/flexUnitTasks-4.0.0.jar:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikechambers/as3corelib/24c6c16aecbf0d8fcc043ae671e689b0d4b4c559/build/libs/flexUnitTasks-4.0.0.jar
--------------------------------------------------------------------------------
/build/libs/flexunit-4.0.0.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikechambers/as3corelib/24c6c16aecbf0d8fcc043ae671e689b0d4b4c559/build/libs/flexunit-4.0.0.swc
--------------------------------------------------------------------------------
/build/libs/flexunit-aircilistener-4.0.0.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikechambers/as3corelib/24c6c16aecbf0d8fcc043ae671e689b0d4b4c559/build/libs/flexunit-aircilistener-4.0.0.swc
--------------------------------------------------------------------------------
/build/libs/flexunit-cilistener-4.0.0.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikechambers/as3corelib/24c6c16aecbf0d8fcc043ae671e689b0d4b4c559/build/libs/flexunit-cilistener-4.0.0.swc
--------------------------------------------------------------------------------
/build/libs/flexunit-flexcoverlistener-4.0.0.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikechambers/as3corelib/24c6c16aecbf0d8fcc043ae671e689b0d4b4c559/build/libs/flexunit-flexcoverlistener-4.0.0.swc
--------------------------------------------------------------------------------
/build/libs/flexunit-uilistener-4.0.0.swc:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mikechambers/as3corelib/24c6c16aecbf0d8fcc043ae671e689b0d4b4c559/build/libs/flexunit-uilistener-4.0.0.swc
--------------------------------------------------------------------------------
/examples/JSONExample/JSONExample.mxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
37 |
38 |
41 |
42 |
43 |
58 |
59 |
60 |
65 |
66 |
67 |
68 |
69 |
70 |
71 |
72 |
73 |
74 |
--------------------------------------------------------------------------------
/src/com/adobe/air/filesystem/FileUtil.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.air.filesystem
34 | {
35 | import flash.system.Capabilities;
36 | import flash.filesystem.File;
37 |
38 |
39 | public class FileUtil
40 | {
41 | /**
42 | * @return An Array of Files representing the root directories of the
43 | * operating system.
44 | */
45 | public static function getRootDirectories():Array
46 | {
47 | var v:Array = File.getRootDirectories();
48 | var os:String = Capabilities.os;
49 |
50 | if(os.indexOf("Mac") > -1)
51 | {
52 | v = File(v[0]).resolvePath("Volumes").getDirectoryListing();
53 | }
54 | else if(os.indexOf("Linux") > -1)
55 | {
56 | //todo: need to impliment Linux
57 | }
58 |
59 | return v;
60 | }
61 |
62 | }
63 | }
--------------------------------------------------------------------------------
/src/com/adobe/air/filesystem/events/FileMonitorEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.air.filesystem.events
34 | {
35 | import flash.events.Event;
36 | import flash.filesystem.File;
37 |
38 | public class FileMonitorEvent extends Event
39 | {
40 | public static const CHANGE:String = "onFileChange";
41 | public static const MOVE:String = "onFileMove";
42 | public static const CREATE:String = "onFileCreate";
43 | public static const ADD_VOLUME:String = "onVolumeAdd";
44 | public static const REMOVE_VOLUME:String = "onVolumeRemove";
45 |
46 | public var file:File;
47 | public function FileMonitorEvent(type:String, bubbles:Boolean=false,
48 | cancelable:Boolean=false)
49 | {
50 | super(type, bubbles, cancelable);
51 | }
52 |
53 | public override function clone():Event
54 | {
55 | var out:FileMonitorEvent = new FileMonitorEvent(type, bubbles, cancelable);
56 | out.file = file;
57 |
58 | return out;
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/src/com/adobe/air/logging/FileTarget.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.air.logging
34 | {
35 | import flash.filesystem.File;
36 | import flash.filesystem.FileMode;
37 | import flash.filesystem.FileStream;
38 |
39 | import mx.core.mx_internal;
40 | import mx.logging.targets.LineFormattedTarget;
41 |
42 | use namespace mx_internal;
43 |
44 | /**
45 | * An Adobe AIR only class that provides a log target for the Flex logging
46 | * framework, that logs files to a file on the user's system.
47 | *
48 | * This class will only work when running within Adobe AIR>
49 | */
50 | public class FileTarget extends LineFormattedTarget
51 | {
52 | private const DEFAULT_LOG_PATH:String = "app-storage:/application.log";
53 |
54 | private var log:File;
55 |
56 | public function FileTarget(logFile:File = null)
57 | {
58 | if(logFile != null)
59 | {
60 | log = logFile;
61 | }
62 | else
63 | {
64 | log = new File(DEFAULT_LOG_PATH);
65 | }
66 | }
67 |
68 | public function get logURI():String
69 | {
70 | return log.url;
71 | }
72 |
73 | mx_internal override function internalLog(message:String):void
74 | {
75 | write(message);
76 | }
77 |
78 | private function write(msg:String):void
79 | {
80 | var fs:FileStream = new FileStream();
81 | fs.open(log, FileMode.APPEND);
82 | fs.writeUTFBytes(msg + File.lineEnding);
83 | fs.close();
84 | }
85 |
86 | public function clear():void
87 | {
88 | var fs:FileStream = new FileStream();
89 | fs.open(log, FileMode.WRITE);
90 | fs.writeUTFBytes("");
91 | fs.close();
92 | }
93 |
94 | }
95 | }
--------------------------------------------------------------------------------
/src/com/adobe/air/net/events/ResourceCacheEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.air.net.events
34 | {
35 | import flash.events.Event;
36 | import flash.filesystem.File;
37 |
38 | public class ResourceCacheEvent extends Event
39 | {
40 |
41 | public static const ITEM_READY:String = "onPathReady";
42 | public static const ITEM_CACHED:String = "onItemCached";
43 |
44 | [Bindable]
45 | public var key:String;
46 |
47 | [Bindable]
48 | public var file:File;
49 |
50 | public function ResourceCacheEvent(type:String,
51 | bubbles:Boolean=false,
52 | cancelable:Boolean=false)
53 | {
54 | super(type, bubbles, cancelable);
55 | }
56 |
57 | public override function clone():Event
58 | {
59 | var out:ResourceCacheEvent = new ResourceCacheEvent(type,
60 | bubbles,
61 | cancelable);
62 |
63 | out.key = key;
64 | out.file = file;
65 |
66 | return out;
67 | }
68 |
69 | }
70 | }
--------------------------------------------------------------------------------
/src/com/adobe/crypto/HMAC.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.crypto {
34 | import flash.utils.ByteArray;
35 | import flash.utils.Endian;
36 | import flash.utils.describeType;
37 | /**
38 | * Keyed-Hashing for Message Authentication
39 | * Implementation based on algorithm description at
40 | * http://www.faqs.org/rfcs/rfc2104.html
41 | */
42 | public class HMAC
43 | {
44 | /**
45 | * Performs the HMAC hash algorithm using byte arrays.
46 | *
47 | * @param secret The secret key
48 | * @param message The message to hash
49 | * @param algorithm Hash object to use
50 | * @return A string containing the hash value of message
51 | * @langversion ActionScript 3.0
52 | * @playerversion Flash 8.5
53 | * @tiptext
54 | */
55 | public static function hash( secret:String, message:String, algorithm:Object = null ):String
56 | {
57 | var text:ByteArray = new ByteArray();
58 | var k_secret:ByteArray = new ByteArray();
59 |
60 | text.writeUTFBytes(message);
61 | k_secret.writeUTFBytes(secret);
62 |
63 | return hashBytes(k_secret, text, algorithm);
64 | }
65 |
66 | /**
67 | * Performs the HMAC hash algorithm using string.
68 | *
69 | * @param secret The secret key
70 | * @param message The message to hash
71 | * @param algorithm Hash object to use
72 | * @return A string containing the hash value of message
73 | * @langversion ActionScript 3.0
74 | * @playerversion Flash 8.5
75 | * @tiptext
76 | */
77 | public static function hashBytes( secret:ByteArray, message:ByteArray, algorithm:Object = null ):String
78 | {
79 | var ipad:ByteArray = new ByteArray();
80 | var opad:ByteArray = new ByteArray();
81 | var endian:String = Endian.BIG_ENDIAN;
82 |
83 | if(algorithm == null){
84 | algorithm = MD5;
85 | }
86 |
87 | if ( describeType(algorithm).@name.toString() == "com.adobe.crypto::MD5" ) {
88 | endian = Endian.LITTLE_ENDIAN;
89 | }
90 |
91 | if ( secret.length > 64 ) {
92 | algorithm.hashBytes(secret);
93 | secret = new ByteArray();
94 | secret.endian = endian;
95 |
96 | while ( algorithm.digest.bytesAvailable != 0 ) {
97 | secret.writeInt(algorithm.digest.readInt());
98 | }
99 | }
100 |
101 | secret.length = 64
102 | secret.position = 0;
103 | for ( var x:int = 0; x < 64; x++ ) {
104 | var byte:int = secret.readByte();
105 | ipad.writeByte(0x36 ^ byte);
106 | opad.writeByte(0x5c ^ byte);
107 | }
108 |
109 | ipad.writeBytes(message);
110 | algorithm.hashBytes(ipad);
111 | var tmp:ByteArray = new ByteArray();
112 | tmp.endian = endian;
113 |
114 | while ( algorithm.digest.bytesAvailable != 0 ) {
115 | tmp.writeInt(algorithm.digest.readInt());
116 | }
117 | tmp.position = 0;
118 |
119 | while ( tmp.bytesAvailable != 0 ) {
120 | opad.writeByte(tmp.readUnsignedByte());
121 | }
122 | return algorithm.hashBytes( opad );
123 | }
124 |
125 | }
126 |
127 | }
128 |
--------------------------------------------------------------------------------
/src/com/adobe/crypto/WSSEUsernameToken.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.crypto
34 | {
35 | import mx.formatters.DateFormatter;
36 | import mx.utils.Base64Encoder;
37 |
38 | /**
39 | * Web Services Security Username Token
40 | *
41 | * Implementation based on algorithm description at
42 | * http://www.oasis-open.org/committees/wss/documents/WSS-Username-02-0223-merged.pdf
43 | */
44 | public class WSSEUsernameToken
45 | {
46 | /**
47 | * Generates a WSSE Username Token.
48 | *
49 | * @param username The username
50 | * @param password The password
51 | * @param nonce A cryptographically random nonce (if null, the nonce
52 | * will be generated)
53 | * @param timestamp The time at which the token is generated (if null,
54 | * the time will be set to the moment of execution)
55 | * @return The generated token
56 | * @langversion ActionScript 3.0
57 | * @playerversion Flash 9.0
58 | * @tiptext
59 | */
60 | public static function getUsernameToken(username:String, password:String, nonce:String=null, timestamp:Date=null):String
61 | {
62 | if (nonce == null)
63 | {
64 | nonce = generateNonce();
65 | }
66 | nonce = base64Encode(nonce);
67 |
68 | var created:String = generateTimestamp(timestamp);
69 |
70 | var password64:String = getBase64Digest(nonce,
71 | created,
72 | password);
73 |
74 | var token:String = new String("UsernameToken Username=\"");
75 | token += username + "\", " +
76 | "PasswordDigest=\"" + password64 + "\", " +
77 | "Nonce=\"" + nonce + "\", " +
78 | "Created=\"" + created + "\"";
79 | return token;
80 | }
81 |
82 | private static function generateNonce():String
83 | {
84 | // Math.random returns a Number between 0 and 1. We don't want our
85 | // nonce to contain invalid characters (e.g. the period) so we
86 | // strip them out before returning the result.
87 | var s:String = Math.random().toString();
88 | return s.replace(".", "");
89 | }
90 |
91 | internal static function base64Encode(s:String):String
92 | {
93 | var encoder:Base64Encoder = new Base64Encoder();
94 | encoder.encode(s);
95 | return encoder.flush();
96 | }
97 |
98 | internal static function generateTimestamp(timestamp:Date):String
99 | {
100 | if (timestamp == null)
101 | {
102 | timestamp = new Date();
103 | }
104 | var dateFormatter:DateFormatter = new DateFormatter();
105 | dateFormatter.formatString = "YYYY-MM-DDTJJ:NN:SS"
106 | return dateFormatter.format(timestamp) + "Z";
107 | }
108 |
109 | internal static function getBase64Digest(nonce:String, created:String, password:String):String
110 | {
111 | return SHA1.hashToBase64(nonce + created + password);
112 | }
113 | }
114 | }
--------------------------------------------------------------------------------
/src/com/adobe/errors/IllegalStateError.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.errors
34 | {
35 | /**
36 | * This class represents an Error that is thrown when a method is called when
37 | * the receiving instance is in an invalid state.
38 | *
39 | * For example, this may occur if a method has been called, and other properties
40 | * in the instance have not been initialized properly.
41 | *
42 | * @langversion ActionScript 3.0
43 | * @playerversion Flash 9.0
44 | * @tiptext
45 | *
46 | */
47 | public class IllegalStateError extends Error
48 | {
49 | /**
50 | * Constructor
51 | *
52 | * @param message A message describing the error in detail.
53 | *
54 | * @langversion ActionScript 3.0
55 | * @playerversion Flash 9.0
56 | * @tiptext
57 | */
58 | public function IllegalStateError(message:String)
59 | {
60 | super(message);
61 | }
62 | }
63 | }
--------------------------------------------------------------------------------
/src/com/adobe/fileformats/vcard/Address.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.adobe.fileformats.vcard
33 | {
34 | public class Address
35 | {
36 | public var type:String;
37 | public var street:String;
38 | public var city:String;
39 | public var state:String;
40 | public var postalCode:String;
41 |
42 | public function toString():String
43 | {
44 | return (street + " " + city + ", " + state + " " + postalCode);
45 | }
46 | }
47 | }
--------------------------------------------------------------------------------
/src/com/adobe/fileformats/vcard/Email.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.adobe.fileformats.vcard
33 | {
34 | public class Email
35 | {
36 | public var type:String;
37 | public var address:String;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/com/adobe/fileformats/vcard/Phone.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.adobe.fileformats.vcard
33 | {
34 | public class Phone
35 | {
36 | public var type:String;
37 | public var number:String;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/com/adobe/fileformats/vcard/VCard.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.adobe.fileformats.vcard
33 | {
34 | import flash.utils.ByteArray;
35 |
36 | public class VCard
37 | {
38 | public var fullName:String;
39 | public var orgs:Array;
40 | public var title:String;
41 | public var image:ByteArray;
42 | public var phones:Array;
43 | public var emails:Array;
44 | public var addresses:Array;
45 |
46 | public function VCard()
47 | {
48 | orgs = new Array();
49 | phones = new Array();
50 | emails = new Array();
51 | addresses = new Array();
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/src/com/adobe/images/BitString.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.adobe.images
33 | {
34 | public class BitString
35 | {
36 | public var len:int = 0;
37 | public var val:int = 0;
38 | }
39 | }
--------------------------------------------------------------------------------
/src/com/adobe/net/DynamicURLLoader.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.net
34 | {
35 | import flash.net.URLLoader;
36 |
37 | /**
38 | * Class that provides a dynamic implimentation of the URLLoader class.
39 | *
40 | * This class provides no API implimentations. However, since the class is
41 | * declared as dynamic, it can be used in place of URLLoader, and allow
42 | * you to dynamically attach properties to it (which URLLoader does not allow).
43 | *
44 | * @langversion ActionScript 3.0
45 | * @playerversion Flash 9.0
46 | * @tiptext
47 | */
48 | public dynamic class DynamicURLLoader extends URLLoader
49 | {
50 | public function DynamicURLLoader()
51 | {
52 | super();
53 | }
54 | }
55 | }
--------------------------------------------------------------------------------
/src/com/adobe/net/IURIResolver.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.net
34 | {
35 | /**
36 | * The URI class cannot know about DNS aliases, virtual hosts, or
37 | * symbolic links that may be involved. The application can provide
38 | * an implementation of this interface to resolve the URI before the
39 | * URI class makes any comparisons. For example, a web host has
40 | * two aliases:
41 | *
42 | *
43 | * http://www.site.com/
44 | * http://www.site.net/
45 | *
46 | *
47 | * The application can provide an implementation that automatically
48 | * resolves site.net to site.com before URI compares two URI objects.
49 | * Only the application can know and understand the context in which
50 | * the URI's are being used.
51 | *
52 | * Use the URI.resolver accessor to assign a custom resolver to
53 | * the URI class. Any resolver specified is global to all instances
54 | * of URI.
55 | *
56 | * URI will call this before performing URI comparisons in the
57 | * URI.getRelation() and URI.getCommonParent() functions.
58 | *
59 | * @see URI.getRelation
60 | * @see URI.getCommonParent
61 | *
62 | * @langversion ActionScript 3.0
63 | * @playerversion Flash 9.0
64 | */
65 | public interface IURIResolver
66 | {
67 | /**
68 | * Implement this method to provide custom URI resolution for
69 | * your application.
70 | *
71 | * @langversion ActionScript 3.0
72 | * @playerversion Flash 9.0
73 | */
74 | function resolve(uri:URI) : URI;
75 | }
76 | }
--------------------------------------------------------------------------------
/src/com/adobe/net/URIEncodingBitmap.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.net
34 | {
35 | import flash.utils.ByteArray;
36 |
37 | /**
38 | * This class implements an efficient lookup table for URI
39 | * character escaping. This class is only needed if you
40 | * create a derived class of URI to handle custom URI
41 | * syntax. This class is used internally by URI.
42 | *
43 | * @langversion ActionScript 3.0
44 | * @playerversion Flash 9.0*
45 | */
46 | public class URIEncodingBitmap extends ByteArray
47 | {
48 | /**
49 | * Constructor. Creates an encoding bitmap using the given
50 | * string of characters as the set of characters that need
51 | * to be URI escaped.
52 | *
53 | * @langversion ActionScript 3.0
54 | * @playerversion Flash 9.0
55 | */
56 | public function URIEncodingBitmap(charsToEscape:String) : void
57 | {
58 | var i:int;
59 | var data:ByteArray = new ByteArray();
60 |
61 | // Initialize our 128 bits (16 bytes) to zero
62 | for (i = 0; i < 16; i++)
63 | this.writeByte(0);
64 |
65 | data.writeUTFBytes(charsToEscape);
66 | data.position = 0;
67 |
68 | while (data.bytesAvailable)
69 | {
70 | var c:int = data.readByte();
71 |
72 | if (c > 0x7f)
73 | continue; // only escape low bytes
74 |
75 | var enc:int;
76 | this.position = (c >> 3);
77 | enc = this.readByte();
78 | enc |= 1 << (c & 0x7);
79 | this.position = (c >> 3);
80 | this.writeByte(enc);
81 | }
82 | }
83 |
84 | /**
85 | * Based on the data table contained in this object, check
86 | * if the given character should be escaped.
87 | *
88 | * @param char the character to be escaped. Only the first
89 | * character in the string is used. Any other characters
90 | * are ignored.
91 | *
92 | * @return the integer value of the raw UTF8 character. For
93 | * example, if '%' is given, the return value is 37 (0x25).
94 | * If the character given does not need to be escaped, the
95 | * return value is zero.
96 | *
97 | * @langversion ActionScript 3.0
98 | * @playerversion Flash 9.0
99 | */
100 | public function ShouldEscape(char:String) : int
101 | {
102 | var data:ByteArray = new ByteArray();
103 | var c:int, mask:int;
104 |
105 | // write the character into a ByteArray so
106 | // we can pull it out as a raw byte value.
107 | data.writeUTFBytes(char);
108 | data.position = 0;
109 | c = data.readByte();
110 |
111 | if (c & 0x80)
112 | {
113 | // don't escape high byte characters. It can make international
114 | // URI's unreadable. We just want to escape characters that would
115 | // make URI syntax ambiguous.
116 | return 0;
117 | }
118 | else if ((c < 0x1f) || (c == 0x7f))
119 | {
120 | // control characters must be escaped.
121 | return c;
122 | }
123 |
124 | this.position = (c >> 3);
125 | mask = this.readByte();
126 |
127 | if (mask & (1 << (c & 0x7)))
128 | {
129 | // we need to escape this, return the numeric value
130 | // of the character
131 | return c;
132 | }
133 | else
134 | {
135 | return 0;
136 | }
137 | }
138 | }
139 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/Database.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict
34 | {
35 | public class Database
36 | {
37 | private var _name:String;
38 | private var _description:String;
39 |
40 | public function Database(name:String, description:String)
41 | {
42 | this._name = name;
43 | this._description = description;
44 | }
45 |
46 | public function set name(name:String):void
47 | {
48 | this._name = name;
49 | }
50 |
51 | public function get name():String
52 | {
53 | return this._name;
54 | }
55 |
56 | public function set description(description:String):void
57 | {
58 | this._description = description;
59 | }
60 |
61 | public function get description():String
62 | {
63 | return this._description;
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/Definition.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict
34 | {
35 | public class Definition
36 | {
37 | private var _definition:String;
38 | private var _database:String;
39 | private var _term:String;
40 |
41 | public function set definition(definition:String):void
42 | {
43 | this._definition = definition;
44 | }
45 |
46 | public function get definition():String
47 | {
48 | return this._definition;
49 | }
50 |
51 | public function set database(database:String):void
52 | {
53 | this._database = database;
54 | }
55 |
56 | public function get database():String
57 | {
58 | return this._database;
59 | }
60 |
61 | public function set term(term:String):void
62 | {
63 | this._term = term;
64 | }
65 |
66 | public function get term():String
67 | {
68 | return this._term;
69 | }
70 | }
71 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/DictionaryServer.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict
34 | {
35 | public class DictionaryServer
36 | {
37 | private var _server:String;
38 | private var _description:String;
39 |
40 | public function set server(server:String):void
41 | {
42 | this._server = server;
43 | }
44 |
45 | public function get server():String
46 | {
47 | return this._server;
48 | }
49 |
50 | public function set description(description:String):void
51 | {
52 | this._description = description;
53 | }
54 |
55 | public function get description():String
56 | {
57 | return this._description;
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/MatchStrategy.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict
34 | {
35 | public class MatchStrategy
36 | {
37 | private var _name:String;
38 | private var _description:String;
39 |
40 | public function MatchStrategy(name:String, description:String)
41 | {
42 | this._name = name;
43 | this._description = description;
44 | }
45 |
46 | public function set name(name:String):void
47 | {
48 | this._name = name;
49 | }
50 |
51 | public function get name():String
52 | {
53 | return this._name;
54 | }
55 |
56 | public function set description(description:String):void
57 | {
58 | this._description = description;
59 | }
60 |
61 | public function get description():String
62 | {
63 | return this._description;
64 | }
65 | }
66 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/Response.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict
34 | {
35 | public class Response
36 | {
37 | private var _code:uint;
38 | private var _headerText:String;
39 | private var _body:String;
40 |
41 | public function set code(code:uint):void
42 | {
43 | this._code = code;
44 | }
45 |
46 | public function set headerText(headerText:String):void
47 | {
48 | this._headerText = headerText;
49 | }
50 |
51 | public function set body(body:String):void
52 | {
53 | this._body = body;
54 | }
55 |
56 | public function get code():uint
57 | {
58 | return this._code;
59 | }
60 |
61 | public function get headerText():String
62 | {
63 | return this._headerText;
64 | }
65 |
66 | public function get body():String
67 | {
68 | return this._body;
69 | }
70 | }
71 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/events/ConnectedEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.events
34 | {
35 | import flash.events.Event;
36 |
37 | public class ConnectedEvent extends Event
38 | {
39 | public static const CONNECTED:String = "connected";
40 |
41 | public function ConnectedEvent(type:String, bubbles:Boolean = false,
42 | cancelable:Boolean = false)
43 | {
44 | super(type, bubbles, cancelable);
45 | }
46 |
47 | public override function clone():Event
48 | {
49 | var out:ConnectedEvent = new ConnectedEvent(type, bubbles, cancelable);
50 | return out;
51 | }
52 | }
53 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/events/DatabaseEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.events
34 | {
35 | import flash.events.Event;
36 |
37 | public class DatabaseEvent extends Event
38 | {
39 | private var _databases:Array;
40 |
41 | public static const DATABASES:String = "databases";
42 |
43 | public function DatabaseEvent(type:String, bubbles:Boolean = false,
44 | cancelable:Boolean = false)
45 | {
46 | super(type, bubbles, cancelable);
47 | }
48 |
49 | public function set databases(databases:Array):void
50 | {
51 | this._databases = databases;
52 | }
53 |
54 | public function get databases():Array
55 | {
56 | return this._databases;
57 | }
58 |
59 | public override function clone():Event
60 | {
61 | var out:DatabaseEvent = new DatabaseEvent(type, bubbles, cancelable);
62 | out.databases = _databases;
63 |
64 | return out;
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/events/DefinitionEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.events
34 | {
35 | import com.adobe.protocols.dict.Definition;
36 |
37 | import flash.events.Event;
38 |
39 |
40 | public class DefinitionEvent extends Event
41 | {
42 | public static const DEFINITION:String = "definition";
43 |
44 | private var _definition:Definition;
45 |
46 | public function DefinitionEvent(type:String, bubbles:Boolean = false,
47 | cancelable:Boolean = false)
48 | {
49 | super(type, bubbles, cancelable);
50 | }
51 |
52 | public function set definition(definition:Definition):void
53 | {
54 | this._definition = definition;
55 | }
56 |
57 | public function get definition():Definition
58 | {
59 | return this._definition;
60 | }
61 |
62 | public override function clone():Event
63 | {
64 | var out:DefinitionEvent = new DefinitionEvent(type, bubbles, cancelable);
65 | out.definition = _definition;
66 |
67 | return out;
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/events/DefinitionHeaderEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.events
34 | {
35 | import flash.events.Event;
36 |
37 | public class DefinitionHeaderEvent extends Event
38 | {
39 | public static const DEFINITION_HEADER:String = "definitionHeader";
40 |
41 | private var _definitionCount:uint;
42 |
43 | public function DefinitionHeaderEvent(type:String, bubbles:Boolean = false,
44 | cancelable:Boolean = false)
45 | {
46 | super(type, bubbles, cancelable);
47 | }
48 |
49 | public function set definitionCount(definitionCount:uint):void
50 | {
51 | this._definitionCount = definitionCount;
52 | }
53 |
54 | public function get definitionCount():uint
55 | {
56 | return this._definitionCount;
57 | }
58 |
59 | public override function clone():Event
60 | {
61 | var out:DefinitionHeaderEvent = new DefinitionHeaderEvent(type,
62 | bubbles, cancelable);
63 |
64 | out.definitionCount = _definitionCount;
65 |
66 | return out;
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/events/DictionaryServerEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.events
34 | {
35 | import flash.events.Event;
36 |
37 | public class DictionaryServerEvent extends Event
38 | {
39 | public static const SERVERS:String = "servers";
40 |
41 | private var _servers:Array;
42 |
43 | public function DictionaryServerEvent(type:String, bubbles:Boolean = false,
44 | cancelable:Boolean = false)
45 | {
46 | super(type, bubbles, cancelable);
47 | }
48 |
49 | public function set servers(servers:Array):void
50 | {
51 | this._servers = servers;
52 | }
53 |
54 | public function get servers():Array
55 | {
56 | return this._servers;
57 | }
58 |
59 | public override function clone():Event
60 | {
61 | var out:DictionaryServerEvent = new DictionaryServerEvent(type,
62 | bubbles, cancelable);
63 |
64 | out.servers = _servers;
65 |
66 | return out;
67 | }
68 | }
69 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/events/DisconnectedEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.events
34 | {
35 | import flash.events.Event;
36 |
37 | public class DisconnectedEvent extends Event
38 | {
39 | public static const DISCONNECTED:String = "disconnected";
40 |
41 | public function DisconnectedEvent(type:String, bubbles:Boolean = false,
42 | cancelable:Boolean = false)
43 | {
44 | super(type, bubbles, cancelable);
45 | }
46 |
47 | public override function clone():Event
48 | {
49 | var out:DisconnectedEvent = new DisconnectedEvent(type, bubbles, cancelable);
50 |
51 | return out;
52 | }
53 |
54 | }
55 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/events/ErrorEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.events
34 | {
35 | import flash.events.Event;
36 |
37 | public class ErrorEvent extends Event
38 | {
39 | public static const ERROR:String = "error";
40 |
41 | private var _code:uint;
42 | private var _message:String;
43 |
44 | public function ErrorEvent(type:String, bubbles:Boolean = false,
45 | cancelable:Boolean = false)
46 | {
47 | super(type, bubbles, cancelable);
48 | }
49 |
50 | public function set code(code:uint):void
51 | {
52 | this._code = code;
53 | }
54 |
55 | public function set message(message:String):void
56 | {
57 | this._message = message;
58 | }
59 |
60 | public function get code():uint
61 | {
62 | return this._code;
63 | }
64 |
65 | public function get message():String
66 | {
67 | return this._message;
68 | }
69 |
70 | public override function clone():Event
71 | {
72 | var out:ErrorEvent = new ErrorEvent(type, bubbles, cancelable);
73 |
74 | out.message = _message;
75 | out.code = _code;
76 |
77 | return out;
78 | }
79 | }
80 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/events/MatchEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.events
34 | {
35 | import flash.events.Event;
36 |
37 | public class MatchEvent extends Event
38 | {
39 | private var _matches:Array;
40 |
41 | public static const MATCH:String = "match";
42 |
43 | public function MatchEvent(type:String, bubbles:Boolean = false,
44 | cancelable:Boolean = false)
45 | {
46 | super(type, bubbles, cancelable);
47 | }
48 |
49 | public function set matches(matches:Array):void
50 | {
51 | this._matches = matches;
52 | }
53 |
54 | public function get matches():Array
55 | {
56 | return this._matches;
57 | }
58 |
59 | public override function clone():Event
60 | {
61 | var out:MatchEvent = new MatchEvent(type, bubbles, cancelable);
62 | out.matches = _matches;
63 |
64 | return out;
65 | }
66 | }
67 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/events/MatchStrategiesEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.events
34 | {
35 | import flash.events.Event;
36 |
37 | public class MatchStrategiesEvent
38 | extends Event
39 | {
40 | private var _strategies:Array;
41 |
42 | public static const MATCH_STRATEGIES:String = "matchStrategies";
43 |
44 | public function MatchStrategiesEvent(type:String, bubbles:Boolean = false,
45 | cancelable:Boolean = false)
46 | {
47 | super(type, bubbles, cancelable);
48 | }
49 |
50 | public function set strategies(strategies:Array):void
51 | {
52 | this._strategies = strategies;
53 | }
54 |
55 | public function get strategies():Array
56 | {
57 | return this._strategies;
58 | }
59 |
60 | public override function clone():Event
61 | {
62 | var out:MatchStrategiesEvent = new MatchStrategiesEvent(type,
63 | bubbles, cancelable);
64 |
65 | out.strategies = _strategies;
66 |
67 | return out;
68 | }
69 | }
70 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/events/NoMatchEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.events
34 | {
35 | import flash.events.Event;
36 |
37 | public class NoMatchEvent extends Event
38 | {
39 | public static const NO_MATCH:String = "noMatch";
40 |
41 | public function NoMatchEvent(type:String, bubbles:Boolean = false,
42 | cancelable:Boolean = false)
43 | {
44 | super(type, bubbles, cancelable);
45 | }
46 |
47 | public override function clone():Event
48 | {
49 | var out:NoMatchEvent = new NoMatchEvent(type, bubbles, cancelable);
50 |
51 | return out;
52 | }
53 | }
54 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/util/CompleteResponseEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.util
34 | {
35 | import flash.events.Event;
36 |
37 | public class CompleteResponseEvent extends Event
38 | {
39 | private var _response:String;
40 |
41 | public static const COMPLETE_RESPONSE:String = "completeResponse"
42 |
43 | public function CompleteResponseEvent(type:String, bubbles:Boolean = false,
44 | cancelable:Boolean = false)
45 | {
46 | super(type, bubbles, cancelable);
47 | }
48 |
49 | public function set response(response:String):void
50 | {
51 | this._response = response;
52 | }
53 |
54 | public function get response():String
55 | {
56 | return this._response;
57 | }
58 |
59 | public override function clone():Event
60 | {
61 | var out:CompleteResponseEvent = new CompleteResponseEvent(type,
62 | bubbles, cancelable);
63 | out.response = _response;
64 |
65 | return out;
66 | }
67 | }
68 | }
--------------------------------------------------------------------------------
/src/com/adobe/protocols/dict/util/SocketHelper.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.dict.util
34 | {
35 | import com.adobe.net.proxies.RFC2817Socket;
36 | import flash.events.ProgressEvent;
37 |
38 | public class SocketHelper
39 | extends RFC2817Socket
40 | {
41 | private var terminator:String = "\r\n.\r\n";
42 | private var buffer:String;
43 | public static var COMPLETE_RESPONSE:String = "completeResponse";
44 |
45 | public function SocketHelper()
46 | {
47 | super();
48 | buffer = new String();
49 | addEventListener(ProgressEvent.SOCKET_DATA, incomingData);
50 | }
51 |
52 | private function incomingData(event:ProgressEvent):void
53 | {
54 | buffer += readUTFBytes(bytesAvailable);
55 | buffer = buffer.replace(/250[^\r\n]+\r\n/, ""); // Get rid of all 250s. Don't need them.
56 | var codeStr:String = buffer.substring(0, 3);
57 | if (!isNaN(parseInt(codeStr)))
58 | {
59 | var code:uint = uint(codeStr);
60 | if (code == 150 || code >= 200)
61 | {
62 | buffer = buffer.replace("\r\n", this.terminator);
63 | }
64 | }
65 |
66 | while (buffer.indexOf(this.terminator) != -1)
67 | {
68 | var chunk:String = buffer.substring(0, buffer.indexOf(this.terminator));
69 | buffer = buffer.substring(chunk.length + this.terminator.length, buffer.length);
70 | throwResponseEvent(chunk);
71 | }
72 | }
73 |
74 | private function throwResponseEvent(response:String):void
75 | {
76 | var responseEvent:CompleteResponseEvent = new CompleteResponseEvent(CompleteResponseEvent.COMPLETE_RESPONSE);
77 | responseEvent.response = response;
78 | dispatchEvent(responseEvent);
79 | }
80 | }
81 | }
--------------------------------------------------------------------------------
/src/com/adobe/serialization/json/JSON.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.serialization.json
34 | {
35 |
36 | /**
37 | * This class provides encoding and decoding of the JSON format.
38 | *
39 | * Example usage:
40 | *
41 | * // create a JSON string from an internal object
42 | * JSON.encode( myObject );
43 | *
44 | * // read a JSON string into an internal object
45 | * var myObject:Object = JSON.decode( jsonString );
46 | *
47 | */
48 | public final class JSON
49 | {
50 | /**
51 | * Encodes a object into a JSON string.
52 | *
53 | * @param o The object to create a JSON string for
54 | * @return the JSON string representing o
55 | * @langversion ActionScript 3.0
56 | * @playerversion Flash 9.0
57 | * @tiptext
58 | */
59 | public static function encode( o:Object ):String
60 | {
61 | return new JSONEncoder( o ).getString();
62 | }
63 |
64 | /**
65 | * Decodes a JSON string into a native object.
66 | *
67 | * @param s The JSON string representing the object
68 | * @param strict Flag indicating if the decoder should strictly adhere
69 | * to the JSON standard or not. The default of true
70 | * throws errors if the format does not match the JSON syntax exactly.
71 | * Pass false
to allow for non-properly-formatted JSON
72 | * strings to be decoded with more leniancy.
73 | * @return A native object as specified by s
74 | * @throw JSONParseError
75 | * @langversion ActionScript 3.0
76 | * @playerversion Flash 9.0
77 | * @tiptext
78 | */
79 | public static function decode( s:String, strict:Boolean = true ):*
80 | {
81 | return new JSONDecoder( s, strict ).getValue();
82 | }
83 |
84 | }
85 |
86 | }
--------------------------------------------------------------------------------
/src/com/adobe/serialization/json/JSONParseError.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.serialization.json
34 | {
35 |
36 | /**
37 | *
38 | *
39 | */
40 | public class JSONParseError extends Error
41 | {
42 |
43 | /** The location in the string where the error occurred */
44 | private var _location:int;
45 |
46 | /** The string in which the parse error occurred */
47 | private var _text:String;
48 |
49 | /**
50 | * Constructs a new JSONParseError.
51 | *
52 | * @param message The error message that occured during parsing
53 | * @langversion ActionScript 3.0
54 | * @playerversion Flash 9.0
55 | * @tiptext
56 | */
57 | public function JSONParseError( message:String = "", location:int = 0, text:String = "" )
58 | {
59 | super( message );
60 | name = "JSONParseError";
61 | _location = location;
62 | _text = text;
63 | }
64 |
65 | /**
66 | * Provides read-only access to the location variable.
67 | *
68 | * @return The location in the string where the error occurred
69 | * @langversion ActionScript 3.0
70 | * @playerversion Flash 9.0
71 | * @tiptext
72 | */
73 | public function get location():int
74 | {
75 | return _location;
76 | }
77 |
78 | /**
79 | * Provides read-only access to the text variable.
80 | *
81 | * @return The string in which the error occurred
82 | * @langversion ActionScript 3.0
83 | * @playerversion Flash 9.0
84 | * @tiptext
85 | */
86 | public function get text():String
87 | {
88 | return _text;
89 | }
90 | }
91 |
92 | }
--------------------------------------------------------------------------------
/src/com/adobe/serialization/json/JSONToken.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.serialization.json
34 | {
35 |
36 | public final class JSONToken
37 | {
38 |
39 | /**
40 | * The type of the token.
41 | *
42 | * @langversion ActionScript 3.0
43 | * @playerversion Flash 9.0
44 | * @tiptext
45 | */
46 | public var type:int;
47 |
48 | /**
49 | * The value of the token
50 | *
51 | * @langversion ActionScript 3.0
52 | * @playerversion Flash 9.0
53 | * @tiptext
54 | */
55 | public var value:Object;
56 |
57 | /**
58 | * Creates a new JSONToken with a specific token type and value.
59 | *
60 | * @param type The JSONTokenType of the token
61 | * @param value The value of the token
62 | * @langversion ActionScript 3.0
63 | * @playerversion Flash 9.0
64 | * @tiptext
65 | */
66 | public function JSONToken( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null )
67 | {
68 | this.type = type;
69 | this.value = value;
70 | }
71 |
72 | /**
73 | * Reusable token instance.
74 | *
75 | * @see #create()
76 | */
77 | internal static const token:JSONToken = new JSONToken();
78 |
79 | /**
80 | * Factory method to create instances. Because we don't need more than one instance
81 | * of a token at a time, we can always use the same instance to improve performance
82 | * and reduce memory consumption during decoding.
83 | */
84 | internal static function create( type:int = -1 /* JSONTokenType.UNKNOWN */, value:Object = null ):JSONToken
85 | {
86 | token.type = type;
87 | token.value = value;
88 |
89 | return token;
90 | }
91 | }
92 | }
--------------------------------------------------------------------------------
/src/com/adobe/serialization/json/JSONTokenType.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.serialization.json
34 | {
35 |
36 | /**
37 | * Class containing constant values for the different types
38 | * of tokens in a JSON encoded string.
39 | */
40 | public final class JSONTokenType
41 | {
42 | public static const UNKNOWN:int = -1;
43 |
44 | public static const COMMA:int = 0;
45 |
46 | public static const LEFT_BRACE:int = 1;
47 |
48 | public static const RIGHT_BRACE:int = 2;
49 |
50 | public static const LEFT_BRACKET:int = 3;
51 |
52 | public static const RIGHT_BRACKET:int = 4;
53 |
54 | public static const COLON:int = 6;
55 |
56 | public static const TRUE:int = 7;
57 |
58 | public static const FALSE:int = 8;
59 |
60 | public static const NULL:int = 9;
61 |
62 | public static const STRING:int = 10;
63 |
64 | public static const NUMBER:int = 11;
65 |
66 | public static const NAN:int = 12;
67 |
68 | }
69 | }
--------------------------------------------------------------------------------
/src/com/adobe/utils/DictionaryUtil.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.utils
34 | {
35 | import flash.utils.Dictionary;
36 |
37 | public class DictionaryUtil
38 | {
39 |
40 | /**
41 | * Returns an Array of all keys within the specified dictionary.
42 | *
43 | * @param d The Dictionary instance whose keys will be returned.
44 | *
45 | * @return Array of keys contained within the Dictionary
46 | *
47 | * @langversion ActionScript 3.0
48 | * @playerversion Flash 9.0
49 | * @tiptext
50 | */
51 | public static function getKeys(d:Dictionary):Array
52 | {
53 | var a:Array = new Array();
54 |
55 | for (var key:Object in d)
56 | {
57 | a.push(key);
58 | }
59 |
60 | return a;
61 | }
62 |
63 | /**
64 | * Returns an Array of all values within the specified dictionary.
65 | *
66 | * @param d The Dictionary instance whose values will be returned.
67 | *
68 | * @return Array of values contained within the Dictionary
69 | *
70 | * @langversion ActionScript 3.0
71 | * @playerversion Flash 9.0
72 | * @tiptext
73 | */
74 | public static function getValues(d:Dictionary):Array
75 | {
76 | var a:Array = new Array();
77 |
78 | for each (var value:Object in d)
79 | {
80 | a.push(value);
81 | }
82 |
83 | return a;
84 | }
85 |
86 | }
87 | }
--------------------------------------------------------------------------------
/src/com/adobe/utils/IntUtil.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 | package com.adobe.utils {
33 |
34 | import flash.utils.Endian;
35 |
36 | /**
37 | * Contains reusable methods for operations pertaining
38 | * to int values.
39 | */
40 | public class IntUtil {
41 |
42 | /**
43 | * Rotates x left n bits
44 | *
45 | * @langversion ActionScript 3.0
46 | * @playerversion Flash 9.0
47 | * @tiptext
48 | */
49 | public static function rol ( x:int, n:int ):int {
50 | return ( x << n ) | ( x >>> ( 32 - n ) );
51 | }
52 |
53 | /**
54 | * Rotates x right n bits
55 | *
56 | * @langversion ActionScript 3.0
57 | * @playerversion Flash 9.0
58 | * @tiptext
59 | */
60 | public static function ror ( x:int, n:int ):uint {
61 | var nn:int = 32 - n;
62 | return ( x << nn ) | ( x >>> ( 32 - nn ) );
63 | }
64 |
65 | /** String for quick lookup of a hex character based on index */
66 | private static var hexChars:String = "0123456789abcdef";
67 |
68 | /**
69 | * Outputs the hex value of a int, allowing the developer to specify
70 | * the endinaness in the process. Hex output is lowercase.
71 | *
72 | * @param n The int value to output as hex
73 | * @param bigEndian Flag to output the int as big or little endian
74 | * @return A string of length 8 corresponding to the
75 | * hex representation of n ( minus the leading "0x" )
76 | * @langversion ActionScript 3.0
77 | * @playerversion Flash 9.0
78 | * @tiptext
79 | */
80 | public static function toHex( n:int, bigEndian:Boolean = false ):String {
81 | var s:String = "";
82 |
83 | if ( bigEndian ) {
84 | for ( var i:int = 0; i < 4; i++ ) {
85 | s += hexChars.charAt( ( n >> ( ( 3 - i ) * 8 + 4 ) ) & 0xF )
86 | + hexChars.charAt( ( n >> ( ( 3 - i ) * 8 ) ) & 0xF );
87 | }
88 | } else {
89 | for ( var x:int = 0; x < 4; x++ ) {
90 | s += hexChars.charAt( ( n >> ( x * 8 + 4 ) ) & 0xF )
91 | + hexChars.charAt( ( n >> ( x * 8 ) ) & 0xF );
92 | }
93 | }
94 |
95 | return s;
96 | }
97 | }
98 |
99 | }
--------------------------------------------------------------------------------
/src/com/adobe/utils/NumberFormatter.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.utils
34 | {
35 |
36 | /**
37 | * Class that contains static utility methods for formatting Numbers
38 | *
39 | * @langversion ActionScript 3.0
40 | * @playerversion Flash 9.0
41 | * @tiptext
42 | *
43 | * @see #mx.formatters.NumberFormatter
44 | */
45 | public class NumberFormatter
46 | {
47 |
48 | /**
49 | * Formats a number to include a leading zero if it is a single digit
50 | * between -1 and 10.
51 | *
52 | * @param n The number that will be formatted
53 | *
54 | * @return A string with single digits between -1 and 10 padded with a
55 | * leading zero.
56 | *
57 | * @langversion ActionScript 3.0
58 | * @playerversion Flash 9.0
59 | * @tiptext
60 | */
61 | public static function addLeadingZero(n:Number):String
62 | {
63 | var out:String = String(n);
64 |
65 | if(n < 10 && n > -1)
66 | {
67 | out = "0" + out;
68 | }
69 |
70 | return out;
71 | }
72 |
73 | }
74 | }
--------------------------------------------------------------------------------
/src/com/adobe/webapis/ServiceBase.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 |
34 | package com.adobe.webapis
35 | {
36 | import flash.events.EventDispatcher;
37 |
38 | /**
39 | * Base class for remote service classes.
40 | */
41 | public class ServiceBase extends EventDispatcher
42 | {
43 | public function ServiceBase()
44 | {
45 | }
46 |
47 | }
48 | }
--------------------------------------------------------------------------------
/src/com/adobe/webapis/URLLoaderBase.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.webapis
34 | {
35 | import flash.events.IOErrorEvent;
36 | import flash.events.SecurityErrorEvent;
37 | import flash.events.ProgressEvent;
38 |
39 | import com.adobe.net.DynamicURLLoader;
40 |
41 | /**
42 | * Dispatched when data is
43 | * received as the download operation progresses.
44 | *
45 | * @eventType flash.events.ProgressEvent.PROGRESS
46 | *
47 | * @langversion ActionScript 3.0
48 | * @playerversion Flash 9.0
49 | */
50 | [Event(name="progress", type="flash.events.ProgressEvent")]
51 |
52 | /**
53 | * Dispatched if a call to the server results in a fatal
54 | * error that terminates the download.
55 | *
56 | * @eventType flash.events.IOErrorEvent.IO_ERROR
57 | *
58 | * @langversion ActionScript 3.0
59 | * @playerversion Flash 9.0
60 | */
61 | [Event(name="ioError", type="flash.events.IOErrorEvent")]
62 |
63 | /**
64 | * A securityError event occurs if a call attempts to
65 | * load data from a server outside the security sandbox.
66 | *
67 | * @eventType flash.events.SecurityErrorEvent.SECURITY_ERROR
68 | *
69 | * @langversion ActionScript 3.0
70 | * @playerversion Flash 9.0
71 | */
72 | [Event(name="securityError", type="flash.events.SecurityErrorEvent")]
73 |
74 | /**
75 | * Base class for services that utilize URLLoader
76 | * to communicate with remote APIs / Services.
77 | *
78 | * @langversion ActionScript 3.0
79 | * @playerversion Flash 9.0
80 | */
81 | public class URLLoaderBase extends ServiceBase
82 | {
83 | protected function getURLLoader():DynamicURLLoader
84 | {
85 | var loader:DynamicURLLoader = new DynamicURLLoader();
86 | loader.addEventListener("progress", onProgress);
87 | loader.addEventListener("ioError", onIOError);
88 | loader.addEventListener("securityError", onSecurityError);
89 |
90 | return loader;
91 | }
92 |
93 | private function onIOError(event:IOErrorEvent):void
94 | {
95 | dispatchEvent(event);
96 | }
97 |
98 | private function onSecurityError(event:SecurityErrorEvent):void
99 | {
100 | dispatchEvent(event);
101 | }
102 |
103 | private function onProgress(event:ProgressEvent):void
104 | {
105 | dispatchEvent(event);
106 | }
107 | }
108 | }
--------------------------------------------------------------------------------
/src/com/adobe/webapis/events/ServiceEvent.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 |
34 | package com.adobe.webapis.events
35 | {
36 |
37 | import flash.events.Event;
38 |
39 | /**
40 | * Event class that contains data loaded from remote services.
41 | *
42 | * @author Mike Chambers
43 | */
44 | public class ServiceEvent extends Event
45 | {
46 | private var _data:Object = new Object();;
47 |
48 | /**
49 | * Constructor for ServiceEvent class.
50 | *
51 | * @param type The type of event that the instance represents.
52 | */
53 | public function ServiceEvent(type:String, bubbles:Boolean = false,
54 | cancelable:Boolean=false)
55 | {
56 | super(type, bubbles, cancelable);
57 | }
58 |
59 | /**
60 | * This object contains data loaded in response
61 | * to remote service calls, and properties associated with that call.
62 | */
63 | public function get data():Object
64 | {
65 | return _data;
66 | }
67 |
68 | public function set data(d:Object):void
69 | {
70 | _data = d;
71 | }
72 |
73 | public override function clone():Event
74 | {
75 | var out:ServiceEvent = new ServiceEvent(type, bubbles, cancelable);
76 | out.data = data;
77 |
78 | return out;
79 | }
80 |
81 | }
82 | }
--------------------------------------------------------------------------------
/tests/src/AllCoreLibTests.as:
--------------------------------------------------------------------------------
1 | package
2 | {
3 | import com.adobe.air.crypto.EncryptionKeyGeneratorTest;
4 | import com.adobe.crypto.HMACMD5Test;
5 | import com.adobe.crypto.HMACSHA1Test;
6 | import com.adobe.crypto.MD5Test;
7 | import com.adobe.crypto.SHA1Test;
8 | import com.adobe.crypto.SHA224Test;
9 | import com.adobe.crypto.SHA256Test;
10 | import com.adobe.crypto.WSSEUsernameTokenTest;
11 | import com.adobe.images.JPGEncoderTest;
12 | import com.adobe.images.PNGEncoderTest;
13 | import com.adobe.net.URITest;
14 | import com.adobe.serialization.json.JSONTest;
15 | import com.adobe.utils.ArrayUtilTest;
16 | import com.adobe.utils.DateUtilTest;
17 | import com.adobe.utils.DictionaryUtilTest;
18 | import com.adobe.utils.IntUtilTest;
19 | import com.adobe.utils.NumberFormatterTest;
20 | import com.adobe.utils.StringUtilTest;
21 | import com.adobe.utils.XMLUtilTest;
22 | import com.adobe.air.filesystem.VolumeMonitorTest;
23 | import com.adobe.air.filesystem.events.FileMonitorEventTest;
24 | import com.adobe.air.net.events.ResourceCacheEventTest;
25 | import com.adobe.protocols.events.ConnectedEventTest;
26 | import com.adobe.protocols.events.DatabaseEventTest;
27 | import com.adobe.protocols.events.DefinitionEventTest;
28 | import com.adobe.protocols.events.DefinitionHeaderEventTest;
29 | import com.adobe.protocols.events.DictionaryServerEventTest;
30 | import com.adobe.protocols.events.DisconnectedEventTest;
31 | import com.adobe.protocols.events.ErrorEventTest;
32 | import com.adobe.protocols.events.MatchEventTest;
33 | import com.adobe.protocols.events.MatchStrategiesEventTest;
34 | import com.adobe.protocols.events.NoMatchEventTest;
35 | import com.adobe.protocols.util.CompletedResponseEventTest;
36 | import com.adobe.webapis.events.ServiceEventTest;
37 | import com.adobe.air.filesystem.FileMonitorTest;
38 |
39 | [Suite]
40 | [RunWith( "org.flexunit.runners.Suite" )]
41 | public class AllCoreLibTests
42 | {
43 | // utils
44 | public var stringUtilTest:StringUtilTest;
45 | public var vumberFormatterTest:NumberFormatterTest;
46 | public var arrayUtilTest:ArrayUtilTest;
47 | public var dateUtilTest:DateUtilTest;
48 | public var intUtilTest:IntUtilTest;
49 | public var xMLUtilTest:XMLUtilTest;
50 | public var dictionaryUtilTest:DictionaryUtilTest;
51 |
52 | // crypto
53 | public var hMACSHA1Test:HMACSHA1Test;
54 | public var hMACMD5Test:HMACMD5Test;
55 | public var mD5Test:MD5Test;
56 | public var sHA1Test:SHA1Test;
57 | public var sHA224Test:SHA224Test;
58 | public var sHA256Test:SHA256Test;
59 | public var wSSEUsernameTokenTest:WSSEUsernameTokenTest;
60 |
61 | // net
62 | public var uRITest:URITest;
63 |
64 | // serialization
65 | public var jSONTest:JSONTest;
66 |
67 | // images
68 | public var jPGEncoderTest:JPGEncoderTest;
69 | public var pNGEncoderTest:PNGEncoderTest;
70 |
71 | // protocols.dict
72 | public var connectedEventTest:ConnectedEventTest;
73 | public var databaseEventTest:DatabaseEventTest;
74 | public var definitionEventTest:DefinitionEventTest;
75 | public var definitionHeaderEventTest:DefinitionHeaderEventTest;
76 | public var dictionaryServerEventTest:DictionaryServerEventTest;
77 | public var disconnectedEventTest:DisconnectedEventTest;
78 | public var errorEventTest:ErrorEventTest;
79 | public var matchEventTest:MatchEventTest;
80 | public var matchStrategiesEventTest:MatchStrategiesEventTest;
81 | public var noMatchEventTest:NoMatchEventTest;
82 | public var completedResponseEventTest:CompletedResponseEventTest;
83 |
84 | // webapis
85 | public var serviceEventTest:ServiceEventTest;
86 |
87 | // air.crypto
88 | public var encryptionKeyGeneratorTest:EncryptionKeyGeneratorTest;
89 |
90 | // air.filesystem
91 | public var volumeMonitorTest:VolumeMonitorTest;
92 | public var fileMonitorTest:FileMonitorTest;
93 | public var fileMonitorEventTest:FileMonitorEventTest;
94 |
95 | // air.net
96 | public var resourceCacheEventTest:ResourceCacheEventTest;
97 | }
98 | }
--------------------------------------------------------------------------------
/tests/src/CoreLibTestRunner.mxml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
34 |
40 |
41 |
42 |
70 |
71 |
72 |
73 |
74 |
75 |
--------------------------------------------------------------------------------
/tests/src/com/adobe/air/filesystem/FileMonitorTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.air.filesystem
34 | {
35 | import flexunit.framework.TestCase;
36 | import flash.filesystem.File;
37 |
38 | public class FileMonitorTest extends TestCase
39 | {
40 | public function FileMonitorTest(methodName:String=null)
41 | {
42 | super(methodName);
43 | }
44 |
45 | public function test_interval():void
46 | {
47 | var vm1:FileMonitor = new FileMonitor();
48 | assertTrue("2000 == vm1.interval", FileMonitor.DEFAULT_MONITOR_INTERVAL == vm1.interval);
49 |
50 | var vm2:FileMonitor = new FileMonitor(null, 3000);
51 | assertTrue("3000 == vm2.interval", 3000 == vm2.interval);
52 |
53 | var vm3:FileMonitor = new FileMonitor(null, 500);
54 | assertTrue("1000 == vm3.interval", 1000 == vm3.interval);
55 |
56 | var f:File = File.desktopDirectory;
57 |
58 | var vm4:FileMonitor = new FileMonitor(f);
59 | assertTrue("f == vm4.file", f == vm4.file);
60 | }
61 |
62 | }
63 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/air/filesystem/VolumeMonitorTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.air.filesystem
34 | {
35 | import flexunit.framework.TestCase;
36 |
37 | public class VolumeMonitorTest extends TestCase
38 | {
39 | public function VolumeMonitorTest(methodName:String=null)
40 | {
41 | super(methodName);
42 | }
43 |
44 | public function test_interval():void
45 | {
46 |
47 | var vm1:VolumeMonitor = new VolumeMonitor();
48 | assertTrue("2000 == vm1.interval", 2000 == vm1.interval);
49 |
50 | var vm2:VolumeMonitor = new VolumeMonitor(3000);
51 | assertTrue("3000 == vm2.interval", 3000 == vm2.interval);
52 |
53 | var vm3:VolumeMonitor = new VolumeMonitor(500);
54 | assertTrue("1000 == vm3.interval", 1000 == vm3.interval);
55 | }
56 | }
57 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/air/filesystem/events/FileMonitorEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.air.filesystem.events
34 | {
35 | import flexunit.framework.TestCase;
36 | import flash.filesystem.File;
37 |
38 | public class FileMonitorEventTest extends TestCase
39 | {
40 | public function FileMonitorEventTest(methodName:String=null)
41 | {
42 | super(methodName);
43 | }
44 |
45 | public function test_clone():void
46 | {
47 | var e1:FileMonitorEvent = new FileMonitorEvent(FileMonitorEvent.ADD_VOLUME);
48 | e1.file = new File();
49 |
50 | var e2:FileMonitorEvent = FileMonitorEvent(e1.clone());
51 |
52 | assertTrue("e1 != e2", e1 != e2);
53 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
54 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
55 | assertTrue("e1.type == e2.type", e1.type == e2.type);
56 | assertTrue("e1.file == e2.file", e1.file == e2.file);
57 | }
58 | }
59 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/air/net/events/ResourceCacheEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.air.net.events
34 | {
35 | import flash.filesystem.File;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class ResourceCacheEventTest extends TestCase
40 | {
41 | public function ResourceCacheEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var type:String = ResourceCacheEvent.ITEM_CACHED;
49 | var key:String = "foo";
50 | var file:File = new File();
51 |
52 | var original:ResourceCacheEvent = new ResourceCacheEvent(type);
53 | original.key = key;
54 | original.file = file;
55 |
56 | var clone:ResourceCacheEvent = ResourceCacheEvent(original.clone());
57 |
58 | assertTrue("original != clone", original != clone);
59 |
60 | assertTrue("clone.bubbles == original.bubbles",
61 | clone.bubbles == original.bubbles);
62 | assertTrue("clone.cancelable == original.cancelable",
63 | clone.cancelable == original.cancelable);
64 | assertTrue("clone.type == original.type",
65 | clone.type == original.type);
66 | assertTrue("clone.key == original.key",
67 | clone.key == original.key);
68 | assertTrue("clone.file == original.file",
69 | clone.file == original.file);
70 | }
71 | }
72 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/crypto/HMACMD5Test.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.crypto
34 | {
35 |
36 | import flash.utils.ByteArray;
37 | import flexunit.framework.TestCase;
38 | import flexunit.framework.TestSuite;
39 |
40 | import com.adobe.crypto.HMAC;
41 |
42 | public class HMACMD5Test extends TestCase
43 | {
44 | private var key:ByteArray;
45 | private var data:ByteArray;
46 | private var x:int;
47 |
48 | public function HMACMD5Test( methodName:String = null) {
49 | super( methodName );
50 | }
51 |
52 | override public function setUp():void
53 | {
54 | super.setUp();
55 | key = new ByteArray();
56 | data = new ByteArray();
57 | }
58 |
59 | public function test1():void {
60 | for ( x = 0; x < 16; x++ ) {
61 | key.writeByte(0x0b);
62 | }
63 | data.writeUTFBytes("Hi There");
64 | assertHMAC(key, data, "9294727a3638bb1c13f48ef8158bfc9d");
65 | }
66 |
67 | public function test2():void {
68 | key.writeUTFBytes("Jefe");
69 | data.writeUTFBytes("what do ya want for nothing?");
70 | assertHMAC(key, data, "750c783e6ab0b503eaa86e310a5db738");
71 | }
72 |
73 | public function test3():void {
74 | for ( x = 0; x < 16; x++ ) {
75 | key.writeByte(0xaa);
76 | }
77 |
78 | for ( x = 0; x < 50; x++ ) {
79 | data.writeByte(0xdd);
80 | }
81 |
82 | assertHMAC(key, data, "56be34521d144c88dbb8c733f0e8b3f6");
83 | }
84 |
85 | public function test4():void {
86 | for ( x = 0; x < 25; x++ ) {
87 | key.writeByte( x + 1 );
88 | }
89 |
90 | for ( x = 0; x < 50; x++ ) {
91 | data.writeByte(0xcd);
92 | }
93 |
94 | assertHMAC(key, data, "697eaf0aca3a3aea3a75164746ffaa79");
95 | }
96 |
97 | public function test5():void {
98 | for ( x = 0; x < 16; x++ ) {
99 | key.writeByte(0x0c);
100 | }
101 |
102 | data.writeUTFBytes("Test With Truncation");
103 |
104 | assertHMAC(key, data, "56461ef2342edc00f9bab995690efd4c");
105 | }
106 |
107 | public function test6():void {
108 | for ( x = 0; x < 80; x++ ) {
109 | key.writeByte( 0xaa );
110 | }
111 |
112 | data.writeUTFBytes("Test Using Larger Than Block-Size Key - Hash Key First");
113 |
114 | assertHMAC(key, data, "6b1ab7fe4bd7bf8f0b62e6ce61b9d0cd");
115 | }
116 |
117 | public function test7():void {
118 | for ( x = 0; x < 80; x++ ) {
119 | key.writeByte( 0xaa );
120 | }
121 |
122 | data.writeUTFBytes("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data");
123 |
124 | assertHMAC(key, data, "6f630fad67cda0ee1fb1f562db3aa53e");
125 | }
126 |
127 | private function assertHMAC( key:ByteArray, value:ByteArray, expected:String):void {
128 | assertTrue( "Hash of '" + value.toString() + "' with key '" + key.toString() + "' returned wrong value ('" + HMAC.hashBytes(key,value) + " ')",
129 | HMAC.hashBytes(key,value) == expected );
130 | };
131 |
132 | }
133 |
134 | }
135 |
--------------------------------------------------------------------------------
/tests/src/com/adobe/crypto/HMACSHA1Test.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.crypto
34 | {
35 |
36 | import flash.utils.ByteArray;
37 | import flexunit.framework.TestCase;
38 | import flexunit.framework.TestSuite;
39 | import com.adobe.crypto.HMAC;
40 | import com.adobe.crypto.SHA1;
41 | /**
42 | * Test Cases for HMAC-MD5 and HMAC-SHA-1
43 | * Implementation based on test cases description at
44 | * http://www.faqs.org/rfcs/rfc2202.html
45 | */
46 | public class HMACSHA1Test extends TestCase
47 | {
48 | private var key:ByteArray;
49 | private var data:ByteArray;
50 | private var x:int;
51 |
52 | public function HMACSHA1Test( methodName:String = null) {
53 | super( methodName );
54 | }
55 |
56 | override public function setUp():void
57 | {
58 | super.setUp();
59 | key = new ByteArray();
60 | data = new ByteArray();
61 | }
62 |
63 | public function test1():void {
64 | for ( x = 0; x < 20; x++ ) {
65 | key.writeByte(0x0b);
66 | }
67 | data.writeUTFBytes("Hi There");
68 | assertHMAC(key, data, "b617318655057264e28bc0b6fb378c8ef146be00");
69 | }
70 |
71 | public function test2():void {
72 | key.writeUTFBytes("Jefe");
73 | data.writeUTFBytes("what do ya want for nothing?");
74 | assertHMAC(key, data, "effcdf6ae5eb2fa2d27416d5f184df9c259a7c79");
75 | }
76 |
77 | public function test3():void {
78 | for ( x = 0; x < 20; x++ ) {
79 | key.writeByte(0xaa);
80 | }
81 |
82 | for ( x = 0; x < 50; x++ ) {
83 | data.writeByte(0xdd);
84 | }
85 |
86 | assertHMAC(key, data, "125d7342b9ac11cd91a39af48aa17b4f63f175d3");
87 | }
88 |
89 | public function test4():void {
90 | for ( x = 0; x < 25; x++ ) {
91 | key.writeByte( x + 1 );
92 | }
93 |
94 | for ( x = 0; x < 50; x++ ) {
95 | data.writeByte(0xcd);
96 | }
97 |
98 | assertHMAC(key, data, "4c9007f4026250c6bc8414f9bf50c86c2d7235da");
99 | }
100 |
101 | public function test5():void {
102 | for ( x = 0; x < 20; x++ ) {
103 | key.writeByte(0x0c);
104 | }
105 |
106 | data.writeUTFBytes("Test With Truncation");
107 |
108 | assertHMAC(key, data, "4c1a03424b55e07fe7f27be1d58bb9324a9a5a04");
109 | }
110 |
111 | public function test6():void {
112 | for ( x = 0; x < 80; x++ ) {
113 | key.writeByte( 0xaa );
114 | }
115 |
116 | data.writeUTFBytes("Test Using Larger Than Block-Size Key - Hash Key First");
117 |
118 | assertHMAC(key, data, "aa4ae5e15272d00e95705637ce8a3b55ed402112");
119 | }
120 |
121 | public function test7():void {
122 | for ( x = 0; x < 80; x++ ) {
123 | key.writeByte( 0xaa );
124 | }
125 |
126 | data.writeUTFBytes("Test Using Larger Than Block-Size Key and Larger Than One Block-Size Data");
127 |
128 | assertHMAC(key, data, "e8e99d0f45237d786d6bbaa7965c7808bbff1a91");
129 | }
130 |
131 | private function assertHMAC( key:ByteArray, value:ByteArray, expected:String):void {
132 | assertTrue( "Hash of '" + value.toString() + "' with key '" + key.toString() + "' returned wrong value ('" + HMAC.hashBytes(key,value,SHA1) + " ')",
133 | HMAC.hashBytes(key,value, SHA1) == expected );
134 | };
135 |
136 | }
137 |
138 | }
139 |
--------------------------------------------------------------------------------
/tests/src/com/adobe/crypto/MD5Test.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.crypto
34 | {
35 |
36 | import flexunit.framework.TestCase;
37 | import flexunit.framework.TestSuite;
38 |
39 | import com.adobe.crypto.MD5;
40 |
41 | public class MD5Test extends TestCase {
42 |
43 | public function MD5Test( methodName:String = null) {
44 | super( methodName );
45 | }
46 |
47 | public function testEmpty():void {
48 | assertMD5( "", "d41d8cd98f00b204e9800998ecf8427e" );
49 | }
50 |
51 | public function testA():void {
52 | assertMD5( "a", "0cc175b9c0f1b6a831c399e269772661" );
53 | }
54 |
55 | public function testABC():void {
56 | assertMD5( "abc", "900150983cd24fb0d6963f7d28e17f72" );
57 | }
58 |
59 | public function testMD():void {
60 | assertMD5( "message digest", "f96b697d7cb7938d525a2f31aaf161d0" );
61 | }
62 |
63 | public function testAlphabet():void {
64 | assertMD5( "abcdefghijklmnopqrstuvwxyz", "c3fcd3d76192e4007dfb496cca67e13b" );
65 | }
66 |
67 | public function testAlphaNumeric():void {
68 | assertMD5( "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", "d174ab98d277d9f5a5611c2c9f419d9f" );
69 | }
70 |
71 | public function testRepeatingNumeric():void {
72 | assertMD5( "12345678901234567890123456789012345678901234567890123456789012345678901234567890", "57edf4a22be3c955ac49da2e2107b67a" );
73 | }
74 |
75 | private function assertMD5( value:String, expected:String ):void {
76 | assertTrue( "Hash of '" + value + "' returned wrong value ('" + MD5.hash( value ) + " ')",
77 | MD5.hash( value ) == expected );
78 | };
79 |
80 | }
81 |
82 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/crypto/SHA224Test.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.crypto
34 | {
35 |
36 | import flash.utils.ByteArray;
37 | import flexunit.framework.TestCase;
38 | import flexunit.framework.TestSuite;
39 |
40 | import com.adobe.crypto.SHA256;
41 |
42 | public class SHA224Test extends TestCase {
43 |
44 | public function SHA224Test( methodName:String = null ) {
45 | super( methodName );
46 | }
47 |
48 | public function testSHA224():void {
49 |
50 | // from the spec ( http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf )
51 | assertSHA224( "abc", "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7" );
52 | assertSHA224( "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525" );
53 |
54 | var millionAs:String = new String("");
55 | for ( var i:int = 0; i < 1000000; i++ ) {
56 | millionAs += "a";
57 | }
58 | assertSHA224( millionAs, "20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67" );
59 |
60 | }
61 |
62 | public function testSHA224Binary():void {
63 |
64 | // from the spec ( http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf )
65 | assertSHA224Binary( "abc", "23097d223405d8228642a477bda255b32aadbce4bda0b3f7e36c9da7" );
66 | assertSHA224Binary( "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "75388b16512776cc5dba5da1fd890150b0c6455cb4f58b1952522525" );
67 |
68 | var millionAs:String = new String("");
69 | for ( var i:int = 0; i < 1000000; i++ ) {
70 | millionAs += "a";
71 | }
72 | assertSHA224Binary( millionAs, "20794655980c91d8bbb4c1ea97618a4bf03f42581948b2ee4ee7ad67" );
73 | }
74 |
75 | public function testSHA224Base64():void {
76 |
77 | }
78 |
79 | private function assertSHA224( value:String, expected:String ):void {
80 | var result:String = SHA224.hash( value );
81 |
82 | assertTrue( "Hash of '" + value + "' returned wrong value ('" + result + "')",
83 | result == expected );
84 | }
85 |
86 | private function assertSHA224Binary(value:String, expected:String):void {
87 |
88 | var byteArray:ByteArray = new ByteArray();
89 | byteArray.writeUTFBytes(value);
90 |
91 | var result:String = SHA224.hashBytes( byteArray );
92 | assertTrue( "Hash of '" + value + "' returned wrong value ('" + result + "')",
93 | result == expected );
94 | }
95 |
96 | private function assertSHA224Base64( value:String, expected:String ):void {
97 | var result:String = SHA224.hashToBase64( value );
98 |
99 | assertTrue( "Hash of '" + value + "' returned wrong value ('" + result + "')",
100 | result == expected );
101 | }
102 |
103 | }
104 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/crypto/SHA256Test.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.crypto
34 | {
35 |
36 | import flash.utils.ByteArray;
37 | import flexunit.framework.TestCase;
38 | import flexunit.framework.TestSuite;
39 |
40 | import com.adobe.crypto.SHA256;
41 |
42 | public class SHA256Test extends TestCase {
43 |
44 | public function SHA256Test( methodName:String = null ) {
45 | super( methodName );
46 | }
47 |
48 | public function testSHA256():void {
49 |
50 |
51 | // from the spec ( http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf )
52 | assertSHA256( "abc", "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" );
53 | assertSHA256( "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1");
54 |
55 | var millionAs:String = new String("");
56 | for ( var i:int = 0; i < 1000000; i++ ) {
57 | millionAs += "a";
58 | }
59 | assertSHA256( millionAs, "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0" );
60 |
61 | // from wikipedia
62 | assertSHA256( "The quick brown fox jumps over the lazy dog", "d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592" );
63 | assertSHA256( "The quick brown fox jumps over the lazy cog", "e4c4d8f3bf76b692de791a173e05321150f7a345b46484fe427f6acc7ecc81be" );
64 | assertSHA256( "", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" );
65 |
66 | }
67 |
68 | public function testSHA256Binary():void {
69 |
70 | // from the spec ( http://csrc.nist.gov/publications/fips/fips180-2/fips180-2withchangenotice.pdf )
71 | assertSHA256Binary( "abc", "ba7816bf8f01cfea414140de5dae2223b00361a396177a9cb410ff61f20015ad" );
72 | assertSHA256Binary( "abcdbcdecdefdefgefghfghighijhijkijkljklmklmnlmnomnopnopq", "248d6a61d20638b8e5c026930c3e6039a33ce45964ff2167f6ecedd419db06c1");
73 |
74 | var millionAs:String = new String("");
75 | for ( var i:int = 0; i < 1000000; i++ ) {
76 | millionAs += "a";
77 | }
78 | assertSHA256Binary( millionAs, "cdc76e5c9914fb9281a1c7e284d73e67f1809a48a497200e046d39ccc7112cd0" );
79 |
80 | // from wikipedia
81 | assertSHA256Binary( "The quick brown fox jumps over the lazy dog", "d7a8fbb307d7809469ca9abcb0082e4f8d5651e46d3cdb762d02d0bf37c9e592" );
82 | assertSHA256Binary( "The quick brown fox jumps over the lazy cog", "e4c4d8f3bf76b692de791a173e05321150f7a345b46484fe427f6acc7ecc81be" );
83 | assertSHA256Binary( "", "e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855" );
84 |
85 | }
86 |
87 | public function testSHA256Base64():void {
88 |
89 | }
90 |
91 | private function assertSHA256( value:String, expected:String ):void {
92 | var result:String = SHA256.hash( value );
93 |
94 | assertTrue( "Hash of '" + value + "' returned wrong value ('" + result + "')",
95 | result == expected );
96 | }
97 |
98 | private function assertSHA256Binary(value:String, expected:String):void {
99 |
100 | var byteArray:ByteArray = new ByteArray();
101 | byteArray.writeUTFBytes(value);
102 |
103 | var result:String = SHA256.hashBytes( byteArray );
104 | assertTrue( "Hash of '" + value + "' returned wrong value ('" + result + "')",
105 | result == expected );
106 | }
107 |
108 | private function assertSHA256Base64( value:String, expected:String ):void {
109 | var result:String = SHA256.hashToBase64( value );
110 |
111 | assertTrue( "Hash of '" + value + "' returned wrong value ('" + result + "')",
112 | result == expected );
113 | }
114 |
115 | }
116 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/crypto/WSSEUsernameTokenTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.crypto
34 | {
35 |
36 | import com.adobe.crypto.WSSEUsernameToken;
37 |
38 | import flexunit.framework.TestCase;
39 | import flexunit.framework.TestSuite;
40 |
41 | public class WSSEUsernameTokenTest extends TestCase {
42 |
43 | public function WSSEUsernameTokenTest( methodName:String = null ) {
44 | super( methodName );
45 | }
46 |
47 | public function testWSSEUsernameToken():void {
48 |
49 | // Results generated from stripped-down version of Claude
50 | // Montpetit's WSSE-enabled Atom API client (see
51 | // http://www.montpetit.net/en/2004/06/06/11h32/index.html).
52 | //
53 |
54 | var date:Date = new Date(Date.parse("05/09/2006 13:43:21 GMT-0700"));
55 | assertWSSEUsernameToken( "abc", "abc", "0123456789", date,
56 | "UsernameToken Username=\"abc\", PasswordDigest=\""
57 | + WSSEUsernameToken.getBase64Digest( WSSEUsernameToken.base64Encode( "0123456789" ),
58 | WSSEUsernameToken.generateTimestamp( date ),
59 | "abc" )
60 | + "\", Nonce=\"MDEyMzQ1Njc4OQ==\", Created=\"2006-05-09T" + ( date.hours < 10 ? "0" + date.hours : date.hours ) + ":43:21Z\"" );
61 |
62 | date = new Date(Date.parse("05/09/2006 16:11:46 GMT-0700"));
63 | assertWSSEUsernameToken( "fe31_449", "168fqo4659", "1147216300992", date,
64 | "UsernameToken Username=\"fe31_449\", PasswordDigest=\""
65 | + WSSEUsernameToken.getBase64Digest( WSSEUsernameToken.base64Encode( "1147216300992" ),
66 | WSSEUsernameToken.generateTimestamp( date ),
67 | "168fqo4659" )
68 | + "\", Nonce=\"MTE0NzIxNjMwMDk5Mg==\", Created=\"2006-05-09T" + ( date.hours < 10 ? "0" + date.hours : date.hours ) + ":11:46Z\"" );
69 |
70 | date = new Date(Date.parse("08/16/2006 01:48:28 GMT-0700"));
71 | assertWSSEUsernameToken( "candy", "dandy", "2018558572", date,
72 | "UsernameToken Username=\"candy\", PasswordDigest=\""
73 | + WSSEUsernameToken.getBase64Digest( WSSEUsernameToken.base64Encode( "2018558572" ),
74 | WSSEUsernameToken.generateTimestamp( date ),
75 | "dandy" )
76 | + "\", Nonce=\"MjAxODU1ODU3Mg==\", Created=\"2006-08-16T" + ( date.hours < 10 ? "0" + date.hours : date.hours ) + ":48:28Z\"" );
77 | }
78 |
79 | private function assertWSSEUsernameToken( username:String, password:String, nonce:String,
80 | timestamp:Date, expected:String ):void {
81 | var result:String = WSSEUsernameToken.getUsernameToken( username, password, nonce, timestamp );
82 |
83 | assertTrue( "WSSEUsernameToken returned wrong value ('" + result + "')" + expected,
84 | result == expected );
85 | }
86 | }
87 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/images/JPGEncoderTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.images
34 | {
35 | import flexunit.framework.TestCase;
36 | import flexunit.framework.TestSuite;
37 | import com.adobe.images.JPGEncoder;
38 |
39 |
40 |
41 | public class JPGEncoderTest extends TestCase
42 | {
43 | public function JPGEncoderTest(methodName:String = null)
44 | {
45 | super(methodName);
46 | }
47 |
48 | public function testConstructor():void
49 | {
50 | var j:JPGEncoder = new JPGEncoder();
51 | }
52 |
53 | }
54 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/images/PNGEncoderTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.images
34 | {
35 | import flexunit.framework.TestCase;
36 | import flexunit.framework.TestSuite;
37 | import com.adobe.images.PNGEncoder;
38 |
39 |
40 |
41 | public class PNGEncoderTest extends TestCase
42 | {
43 | public function PNGEncoderTest(methodName:String = null)
44 | {
45 | super(methodName);
46 | }
47 |
48 | public function testConstructor():void
49 | {
50 | var p:PNGEncoder = new PNGEncoder();
51 | }
52 |
53 | }
54 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/events/ConnectedEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.events
34 | {
35 | import com.adobe.protocols.dict.events.ConnectedEvent;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class ConnectedEventTest extends TestCase
40 | {
41 | public function ConnectedEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var e1:ConnectedEvent = new ConnectedEvent(ConnectedEvent.CONNECTED);
49 |
50 | var e2:ConnectedEvent = ConnectedEvent(e1.clone());
51 |
52 | assertTrue("e1 != e2", e1 != e2);
53 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
54 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
55 | assertTrue("e1.type == e2.type", e1.type == e2.type);
56 | }
57 |
58 | }
59 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/events/DatabaseEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.events
34 | {
35 | import com.adobe.protocols.dict.events.DatabaseEvent;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class DatabaseEventTest extends TestCase
40 | {
41 | public function DatabaseEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var e1:DatabaseEvent = new DatabaseEvent(DatabaseEvent.DATABASES);
49 | e1.databases = [];
50 |
51 |
52 | var e2:DatabaseEvent = DatabaseEvent(e1.clone());
53 |
54 | assertTrue("e1 != e2", e1 != e2);
55 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
56 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
57 | assertTrue("e1.type == e2.type", e1.type == e2.type);
58 | assertTrue("e1.databases == e2.databases", e1.databases == e2.databases);
59 | }
60 |
61 | }
62 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/events/DefinitionEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.events
34 | {
35 | import com.adobe.protocols.dict.Definition;
36 | import com.adobe.protocols.dict.events.DefinitionEvent;
37 |
38 | import flexunit.framework.TestCase;
39 |
40 | public class DefinitionEventTest extends TestCase
41 | {
42 | public function DefinitionEventTest(methodName:String=null)
43 | {
44 | super(methodName);
45 | }
46 |
47 | public function test_clone():void
48 | {
49 | var e1:DefinitionEvent = new DefinitionEvent(DefinitionEvent.DEFINITION);
50 | e1.definition = new Definition();
51 |
52 | var e2:DefinitionEvent = DefinitionEvent(e1.clone());
53 |
54 | assertTrue("e1 != e2", e1 != e2);
55 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
56 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
57 | assertTrue("e1.type == e2.type", e1.type == e2.type);
58 | assertTrue("e1.definition == e2.definition", e1.definition == e2.definition);
59 | }
60 | }
61 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/events/DefinitionHeaderEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.events
34 | {
35 | import com.adobe.protocols.dict.events.DefinitionHeaderEvent;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class DefinitionHeaderEventTest extends TestCase
40 | {
41 | public function DefinitionHeaderEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var e1:DefinitionHeaderEvent = new DefinitionHeaderEvent(DefinitionHeaderEvent.DEFINITION_HEADER);
49 | e1.definitionCount = 7;;
50 |
51 | var e2:DefinitionHeaderEvent = DefinitionHeaderEvent(e1.clone());
52 |
53 | assertTrue("e1 != e2", e1 != e2);
54 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
55 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
56 | assertTrue("e1.type == e2.type", e1.type == e2.type);
57 | assertTrue("e1.definitionCount == e2.definitionCount", e1.definitionCount == e2.definitionCount);
58 | }
59 |
60 | }
61 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/events/DictionaryServerEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.events
34 | {
35 | import com.adobe.protocols.dict.events.DictionaryServerEvent;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class DictionaryServerEventTest extends TestCase
40 | {
41 | public function DictionaryServerEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var e1:DictionaryServerEvent = new DictionaryServerEvent(DictionaryServerEvent.SERVERS);
49 | e1.servers = new Array();
50 |
51 | var e2:DictionaryServerEvent = DictionaryServerEvent(e1.clone());
52 |
53 | assertTrue("e1 != e2", e1 != e2);
54 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
55 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
56 | assertTrue("e1.type == e2.type", e1.type == e2.type);
57 | assertTrue("e1.servers == e2.servers", e1.servers == e2.servers);
58 | }
59 |
60 | }
61 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/events/DisconnectedEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.events
34 | {
35 | import com.adobe.protocols.dict.events.DisconnectedEvent;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class DisconnectedEventTest extends TestCase
40 | {
41 | public function DisconnectedEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var e1:DisconnectedEvent = new DisconnectedEvent(DisconnectedEvent.DISCONNECTED);
49 |
50 | var e2:DisconnectedEvent = DisconnectedEvent(e1.clone());
51 |
52 | assertTrue("e1 != e2", e1 != e2);
53 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
54 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
55 | assertTrue("e1.type == e2.type", e1.type == e2.type);
56 | }
57 |
58 | }
59 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/events/ErrorEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.events
34 | {
35 | import com.adobe.protocols.dict.events.ErrorEvent;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class ErrorEventTest extends TestCase
40 | {
41 | public function ErrorEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var e1:ErrorEvent = new ErrorEvent(ErrorEvent.ERROR);
49 | e1.message = "foo";
50 | e1.code = 1;
51 |
52 | var e2:ErrorEvent = ErrorEvent(e1.clone());
53 |
54 | assertTrue("e1 != e2", e1 != e2);
55 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
56 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
57 | assertTrue("e1.type == e2.type", e1.type == e2.type);
58 | assertTrue("e1.message == e2.message", e1.message == e2.message);
59 | assertTrue("e1.code == e2.code", e1.code == e2.code);
60 | }
61 |
62 | }
63 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/events/MatchEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.events
34 | {
35 | import com.adobe.protocols.dict.events.MatchEvent;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class MatchEventTest extends TestCase
40 | {
41 | public function MatchEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var e1:MatchEvent = new MatchEvent(MatchEvent.MATCH);
49 | e1.matches = new Array();
50 |
51 | var e2:MatchEvent = MatchEvent(e1.clone());
52 |
53 | assertTrue("e1 != e2", e1 != e2);
54 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
55 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
56 | assertTrue("e1.type == e2.type", e1.type == e2.type);
57 | assertTrue("e1.matches == e2.matches", e1.matches == e2.matches);
58 | }
59 |
60 | }
61 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/events/MatchStrategiesEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.events
34 | {
35 | import com.adobe.protocols.dict.events.MatchStrategiesEvent;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class MatchStrategiesEventTest extends TestCase
40 | {
41 | public function MatchStrategiesEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var e1:MatchStrategiesEvent = new MatchStrategiesEvent(MatchStrategiesEvent.MATCH_STRATEGIES);
49 | e1.strategies = new Array();
50 |
51 | var e2:MatchStrategiesEvent = MatchStrategiesEvent(e1.clone());
52 |
53 | assertTrue("e1 != e2", e1 != e2);
54 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
55 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
56 | assertTrue("e1.type == e2.type", e1.type == e2.type);
57 | assertTrue("e1.strategies == e2.strategies", e1.strategies == e2.strategies);
58 | }
59 |
60 | }
61 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/events/NoMatchEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.events
34 | {
35 | import com.adobe.protocols.dict.events.NoMatchEvent;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class NoMatchEventTest extends TestCase
40 | {
41 | public function NoMatchEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var e1:NoMatchEvent = new NoMatchEvent(NoMatchEvent.NO_MATCH);
49 |
50 | var e2:NoMatchEvent = NoMatchEvent(e1.clone());
51 |
52 | assertTrue("e1 != e2", e1 != e2);
53 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
54 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
55 | assertTrue("e1.type == e2.type", e1.type == e2.type);
56 | }
57 | }
58 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/protocols/util/CompletedResponseEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.protocols.util
34 | {
35 | import com.adobe.protocols.dict.util.CompleteResponseEvent;
36 |
37 | import flexunit.framework.TestCase;
38 |
39 | public class CompletedResponseEventTest extends TestCase
40 | {
41 | public function CompletedResponseEventTest(methodName:String=null)
42 | {
43 | super(methodName);
44 | }
45 |
46 | public function test_clone():void
47 | {
48 | var e1:CompleteResponseEvent = new CompleteResponseEvent(CompleteResponseEvent.COMPLETE_RESPONSE);
49 | e1.response = "foo";
50 |
51 | var e2:CompleteResponseEvent = CompleteResponseEvent(e1.clone());
52 |
53 | assertTrue("e1 != e2", e1 != e2);
54 | assertTrue("e1.cancelable == e2.cancelable", e1.cancelable == e2.cancelable);
55 | assertTrue("e1.bubbles == e2.bubbles", e1.bubbles == e2.bubbles);
56 | assertTrue("e1.type == e2.type", e1.type == e2.type);
57 | assertTrue("e1.response == e2.response", e1.response == e2.response);
58 | }
59 | }
60 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/serialization/json/SimpleClass.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.serialization.json
34 | {
35 |
36 | /**
37 | * This is just a simple class with some properties
38 | * so that we can test converting the class instance
39 | * to a JSON string.
40 | */
41 | public class SimpleClass
42 | {
43 |
44 | public var publicVar1:int = 17;
45 | public var publicVar2:int = 20;
46 |
47 | protected var protectedVar:int = 0;
48 |
49 | private var privateVar:int = -17;
50 |
51 | public function get accessor1():int
52 | {
53 | return 25;
54 | }
55 |
56 | public function get accessor2():int
57 | {
58 | return 30;
59 | }
60 |
61 | /**
62 | * Constructor
63 | */
64 | public function SimpleClass()
65 | {
66 |
67 | }
68 |
69 | public function method():Boolean
70 | {
71 | return false;
72 | }
73 |
74 | [Transient]
75 | public var transientVar:String;
76 |
77 | /** Write-only property */
78 | public function set writeOnlyProp( value:Number ):void
79 | {
80 |
81 | }
82 |
83 |
84 | }
85 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/utils/DictionaryUtilTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.utils
34 | {
35 |
36 | import flexunit.framework.TestCase;
37 | import flexunit.framework.TestSuite;
38 |
39 | import com.adobe.utils.DictionaryUtil;
40 | import flash.utils.Dictionary;
41 | import com.adobe.utils.ArrayUtil;
42 |
43 | public class DictionaryUtilTest extends TestCase {
44 |
45 | private var d:Dictionary;
46 | private var objectKey:Object = {};
47 | private var objectValue:Object = {};
48 |
49 | public function DictionaryUtilTest( methodName:String = null) {
50 | super( methodName );
51 |
52 | d = new Dictionary();
53 | d.keyA = "valueA";
54 | d.keyB = "valueB";
55 | d[1] = 2;
56 | d[objectKey] = objectValue;
57 |
58 | }
59 |
60 | public function testGetKeys():void {
61 |
62 | var keys:Array = DictionaryUtil.getKeys(d);
63 |
64 | assertTrue( "keys.length == 4", keys.length == 4 );
65 | assertTrue("ArrayUtil.arrayContainsValue(keys, \"keyA\")",
66 | ArrayUtil.arrayContainsValue(keys, "keyA"));
67 | assertTrue("ArrayUtil.arrayContainsValue(keys, \"keyB\")",
68 | ArrayUtil.arrayContainsValue(keys, "keyB"));
69 | assertTrue("ArrayUtil.arrayContainsValue(keys, 1)",
70 | ArrayUtil.arrayContainsValue(keys, 1));
71 | assertTrue("ArrayUtil.arrayContainsValue(keys, objectKey)",
72 | ArrayUtil.arrayContainsValue(keys, objectKey));
73 |
74 |
75 | }
76 |
77 | public function testGetValues():void {
78 | var values:Array = DictionaryUtil.getValues(d);
79 |
80 | assertTrue( "values.length == 4", values.length == 4 );
81 |
82 | assertTrue("ArrayUtil.arrayContainsValue(values, \"valueA\")",
83 | ArrayUtil.arrayContainsValue(values, "valueA"));
84 | assertTrue("ArrayUtil.arrayContainsValue(values, \"keyB\")",
85 | ArrayUtil.arrayContainsValue(values, "valueB"));
86 | assertTrue("ArrayUtil.arrayContainsValue(values, 2)",
87 | ArrayUtil.arrayContainsValue(values, 2));
88 | assertTrue("ArrayUtil.arrayContainsValue(values, objectValue)",
89 | ArrayUtil.arrayContainsValue(values, objectValue));
90 | }
91 |
92 | }
93 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/utils/IntUtilTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.utils
34 | {
35 |
36 | import flexunit.framework.TestCase;
37 | import flexunit.framework.TestSuite;
38 |
39 | import com.adobe.utils.IntUtil;
40 |
41 | public class IntUtilTest extends TestCase {
42 |
43 | public function IntUtilTest( methodName:String = null) {
44 | super( methodName );
45 | }
46 |
47 |
48 |
49 | public function testRol():void {
50 | assertTrue( "IntUtil.rol( 0x00000001, 1 )", IntUtil.rol( 0x00000001, 1 ) == 0x00000002 );
51 | assertTrue( "IntUtil.rol( 0x00000001, 2 )", IntUtil.rol( 0x00000001, 2 ) == 0x00000004 );
52 | assertTrue( "IntUtil.rol( 0x00000001, 4 )", IntUtil.rol( 0x00000001, 4 ) == 0x00000010 );
53 | assertTrue( "IntUtil.rol( 0x00000001, 8 )", IntUtil.rol( 0x00000001, 8 ) == 0x00000100 );
54 | assertTrue( "IntUtil.rol( 0x00000001, 12 )", IntUtil.rol( 0x00000001, 12 ) == 0x00001000 );
55 | assertTrue( "IntUtil.rol( 0x00000001, 16 )", IntUtil.rol( 0x00000001, 16 ) == 0x00010000 );
56 | assertTrue( "IntUtil.rol( 0x00000001, 20 )", IntUtil.rol( 0x00000001, 20 ) == 0x00100000 );
57 | assertTrue( "IntUtil.rol( 0x00000001, 24 )", IntUtil.rol( 0x00000001, 24 ) == 0x01000000 );
58 | assertTrue( "IntUtil.rol( 0x00000001, 28 )", IntUtil.rol( 0x00000001, 28 ) == 0x10000000 );
59 | assertTrue( "IntUtil.rol( 0x00000001, 31 )", uint( IntUtil.rol( 0x00000001, 31 ) ) == 0x80000000 );
60 | assertTrue( "IntUtil.rol( 0x00000001, 32 )", IntUtil.rol( 0x00000001, 32 ) == 0x00000001 );
61 |
62 | assertTrue( "IntUtil.rol( 0x80000000, 1 )", IntUtil.rol( int( 0x80000000 ), 1 ) == 0x00000001 );
63 | }
64 |
65 | public function testToHex():void {
66 | assertTrue( "Little Endian", IntUtil.toHex( 0x12345678 ) == "78563412" );
67 | assertTrue( "Big Endian", IntUtil.toHex( 0x12345678, true ) == "12345678" );
68 |
69 | assertTrue( "Little Endian Negative", IntUtil.toHex( int( 0x89ABCDEF ) ) == "efcdab89" );
70 | assertTrue( "Big Endian Negative", IntUtil.toHex( int( 0x89ABCDEF ), true ) == "89abcdef" );
71 | }
72 | }
73 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/utils/NumberFormatterTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.utils
34 | {
35 | import flexunit.framework.TestCase;
36 | import flexunit.framework.TestSuite;
37 |
38 | import com.adobe.utils.NumberFormatter;
39 |
40 | public class NumberFormatterTest extends TestCase
41 | {
42 | public function NumberFormatterTest(methodName:String = null)
43 | {
44 | super(methodName);
45 | }
46 |
47 | public function testAddLeadingZero():void
48 | {
49 | assertTrue("NumberFormatter.addLeadingZero(7) == \"07\"",
50 | NumberFormatter.addLeadingZero(7) == "07");
51 |
52 | assertTrue("NumberFormatter.addLeadingZero(9) == \"09\"",
53 | NumberFormatter.addLeadingZero(9) == "09");
54 |
55 | assertTrue("NumberFormatter.addLeadingZero(0) == \"00\"",
56 | NumberFormatter.addLeadingZero(0) == "00");
57 |
58 | assertTrue("NumberFormatter.addLeadingZero(-1) == \"-1\"",
59 | NumberFormatter.addLeadingZero(-1) == "-1");
60 |
61 | assertTrue("NumberFormatter.addLeadingZero(10) == \"10\"",
62 | NumberFormatter.addLeadingZero(10) == "10");
63 |
64 | assertTrue("NumberFormatter.addLeadingZero(10000) == \"10000\"",
65 | NumberFormatter.addLeadingZero(10000) == "10000");
66 |
67 | }
68 |
69 | }
70 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/utils/XMLUtilTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2008, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.utils
34 | {
35 | import flexunit.framework.TestCase;
36 | import flexunit.framework.TestSuite;
37 |
38 | import com.adobe.utils.XMLUtil;
39 |
40 | public class XMLUtilTest extends TestCase
41 | {
42 |
43 | private var validXML:XML =
44 |
45 |
46 |
47 |
48 | private var nonvalidXML:String = "";
49 |
50 | private var simpleString:String = "a";
51 |
52 | private var element:String = "";
53 |
54 | public function XMLUtilTest(methodName:String = null)
55 | {
56 | super(methodName);
57 | }
58 |
59 |
60 |
61 | public function testStringsAreEqual():void
62 | {
63 | assertTrue("XMLUtil.isValidXML(String(validXML))",XMLUtil.isValidXML(String(validXML)));
64 | assertTrue("!XMLUtil.isValidXML(simpleString)", !XMLUtil.isValidXML(simpleString));
65 | assertTrue("XMLUtil.isValidXML(element)", XMLUtil.isValidXML(element));
66 | assertTrue("!XMLUtil.isValidXML(element)", !XMLUtil.isValidXML(nonvalidXML));
67 |
68 | }
69 |
70 | private var xml:XML =
71 |
72 |
73 | foo
74 | bar
75 | bam
76 |
77 |
78 |
79 | public function testgetNextSibling():void
80 | {
81 |
82 | var s:Number = (new Date()).getTime();
83 | assertTrue("XMLUtil.getNextSibling(xml.top[0].b[0]) == xml.top[0].c[0]",
84 | XMLUtil.getNextSibling(xml.top[0].b[0]) == xml.top[0].c[0]);
85 | assertTrue("XMLUtil.getNextSibling(xml.top[0].c[0]) == null",
86 | XMLUtil.getNextSibling(xml.top[0].c[0]) == null);
87 | assertTrue("XMLUtil.getNextSibling(xml.top[0]) == null",
88 | XMLUtil.getNextSibling(xml.top[0]) == null);
89 | }
90 |
91 | public function testgetPreviousSibling():void
92 | {
93 | assertTrue("XMLUtil.getPreviousSibling(xml.top[0].b[0]) == xml.top[0].a[0]",
94 | XMLUtil.getPreviousSibling(xml.top[0].b[0]) == xml.top[0].a[0]);
95 | assertTrue("XMLUtil.getPreviousSibling(xml.top[0].a[0]) == null",
96 | XMLUtil.getPreviousSibling(xml.top[0].a[0]) == null);
97 | assertTrue("XMLUtil.getPreviousSibling(xml.top[0]) == null",
98 | XMLUtil.getPreviousSibling(xml.top[0]) == null);
99 | }
100 | }
101 | }
--------------------------------------------------------------------------------
/tests/src/com/adobe/webapis/events/ServiceEventTest.as:
--------------------------------------------------------------------------------
1 | /*
2 | Copyright (c) 2009, Adobe Systems Incorporated
3 | All rights reserved.
4 |
5 | Redistribution and use in source and binary forms, with or without
6 | modification, are permitted provided that the following conditions are
7 | met:
8 |
9 | * Redistributions of source code must retain the above copyright notice,
10 | this list of conditions and the following disclaimer.
11 |
12 | * Redistributions in binary form must reproduce the above copyright
13 | notice, this list of conditions and the following disclaimer in the
14 | documentation and/or other materials provided with the distribution.
15 |
16 | * Neither the name of Adobe Systems Incorporated nor the names of its
17 | contributors may be used to endorse or promote products derived from
18 | this software without specific prior written permission.
19 |
20 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
21 | IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
22 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
23 | PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
24 | CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
25 | EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
26 | PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
27 | PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
28 | LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
29 | NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | */
32 |
33 | package com.adobe.webapis.events
34 | {
35 | import flexunit.framework.TestCase;
36 |
37 | public class ServiceEventTest extends TestCase
38 | {
39 | public function ServiceEventTest(methodName:String=null)
40 | {
41 | super(methodName);
42 | }
43 |
44 | public function test_clone():void
45 | {
46 | var type:String = "foo";
47 | var o:Object = {foo:"bar"};
48 |
49 | var original:ServiceEvent = new ServiceEvent(type);
50 |
51 | var clone:ServiceEvent = ServiceEvent(original.clone());
52 |
53 | assertTrue("original != clone", original != clone);
54 |
55 | assertTrue("clone.bubbles == original.bubbles",
56 | clone.bubbles == original.bubbles);
57 | assertTrue("clone.cancelable == original.cancelable",
58 | clone.cancelable == original.cancelable);
59 | assertTrue("clone.type == original.type",
60 | clone.type == original.type);
61 | assertTrue("clone.data == original.data",
62 | clone.data == original.data);
63 | }
64 |
65 | }
66 | }
--------------------------------------------------------------------------------