Source Code Cross Referenced for EmbeddedMediaFormatTest.java in  » J2EE » JOnAS-4.8.6 » com » ibm » emb » test » mfb » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » JOnAS 4.8.6 » com.ibm.emb.test.mfb 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package com.ibm.emb.test.mfb;
002:
003:        import java.io.File;
004:        import java.net.MalformedURLException;
005:        import java.net.URL;
006:
007:        import javax.emb.FormatSyntaxException;
008:        import javax.emb.MediaException;
009:        import javax.emb.MediaFormat;
010:        import javax.emb.MediaSegment;
011:
012:        import com.ibm.emb.junit.EMBStaticHelper;
013:        import com.ibm.emb.test.MediaFormatTest;
014:
015:        public abstract class EmbeddedMediaFormatTest extends MediaFormatTest {
016:
017:            public EmbeddedMediaFormatTest(String name) throws MediaException {
018:                super (name);
019:            }
020:
021:            /**
022:             * abstract method to create an instance of MediaFormat this method needs to
023:             * be implemented in the test subclass and will create an Instance of the
024:             * concrete implementation of the class under test
025:             */
026:            public abstract MediaFormat createMediaFormat();
027:
028:            /**
029:             * <pre>
030:             * 
031:             *  
032:             *   
033:             *        Testcase Name: assembleContent(URL, MediaSegment[])
034:             *        Testcase Number: TEMB0054SBA  
035:             *        
036:             *        Test 1:
037:             *        create 2 element segment array
038:             *        call assembleContent with the segment array created and null as location
039:             *        ----&gt; check for FormatSyntaxException
040:             *        
041:             *        Test 2:
042:             *        create 1 element segment array, fill in random content and valid random child location
043:             *        call assembleContent with the segment array created and null as location
044:             *        ---&gt;check for FormatSyntaxException
045:             *        
046:             *   
047:             *  
048:             * </pre>
049:             */
050:            public void testTEMB0054SBA() throws MediaException,
051:                    MalformedURLException {
052:                // media segment
053:                MediaSegment mediaSegment1 = null;
054:                MediaSegment[] testMediaSegmentArray = null;
055:
056:                // test instance
057:                MediaFormat testInstance = createMediaFormat();
058:
059:                //
060:                // test 1
061:                //
062:                mediaSegment1 = new MediaSegment();
063:                testMediaSegmentArray = new MediaSegment[] { mediaSegment1,
064:                        mediaSegment1 };
065:                try {
066:                    testInstance.assembleContent(null, testMediaSegmentArray);
067:                    fail("test1: should throw a FormatSyntaxException");
068:                } catch (FormatSyntaxException e) {
069:                    testTrace("test 1 passed");
070:                } catch (Exception e) {
071:                    fail("test 1: should throw a FormatSyntaxException but threw "
072:                            + e.toString());
073:                }
074:
075:                //
076:                // test 2
077:                //
078:                // name of a jpg sample
079:                String mediaBmp = embTestConfig.getBmpPictureName1();
080:
081:                // full path of the jpg sample
082:                String mediaBmpFullPath = embTestConfig.getMediaDir()
083:                        + File.separator + mediaBmp;
084:
085:                // test URL
086:                URL testURL = new URL("file", "localhost", mediaBmpFullPath);
087:
088:                // media segment
089:                mediaSegment1 = new MediaSegment();
090:                mediaSegment1.setContent(EMBStaticHelper
091:                        .createRandomByteArray(1024));
092:                mediaSegment1.setChildLocation(testURL);
093:                testMediaSegmentArray = new MediaSegment[] { mediaSegment1 };
094:                try {
095:                    testInstance.assembleContent(null, testMediaSegmentArray);
096:                    fail("test2: should throw a FormatSyntaxException");
097:                } catch (FormatSyntaxException e) {
098:                    testTrace("test 2 passed");
099:                } catch (Exception e) {
100:                    fail("test 2: should throw a FormatSyntaxException but threw "
101:                            + e.toString());
102:                }
103:
104:                succeed();
105:            }
106:
107:            /**
108:             * <pre>
109:             * 
110:             *  
111:             *   
112:             *        Testcase Name: disassembleContent(URL, byte[])
113:             *        Testcase Number: TEMB0055SBA  
114:             *        
115:             *        Test 1:
116:             *        call disassembleContent with random media content and null as location
117:             *        ---&gt;check the result to be a 1-element segment array, 
118:             *        and the element to contain the random content created and a childLocation of null.
119:             *        
120:             *   
121:             *  
122:             * </pre>
123:             */
124:            public void testTEMB0055SBA() throws MediaException,
125:                    MalformedURLException {
126:                // media segment
127:                MediaSegment mediaSegment1 = null;
128:                MediaSegment[] testMediaSegmentArray = null;
129:                // test array
130:                byte[] testByteArray = EMBStaticHelper
131:                        .createRandomByteArray(1024);
132:
133:                // test instance
134:                MediaFormat testInstance = createMediaFormat();
135:
136:                //
137:                // test 1
138:                //
139:
140:                testMediaSegmentArray = testInstance.disassembleContent(null,
141:                        testByteArray);
142:                assertTrue(
143:                        "test 1",
144:                        (testMediaSegmentArray.length == 1)
145:                                && (java.util.Arrays.equals(
146:                                        testMediaSegmentArray[0].getContent(),
147:                                        testByteArray))
148:                                && (testMediaSegmentArray[0].getChildLocation() == null));
149:                testTrace("test 1 passed");
150:
151:                succeed();
152:            }
153:
154:            /**
155:             * <pre>
156:             * 
157:             *  
158:             *   
159:             *        Testcase Name: isEmbedded()
160:             *        Testcase Number: TEMB0059SBA  
161:             *        
162:             *        Test 1:
163:             *        call isEmbedded
164:             *        ---&gt;check if result is true
165:             *        
166:             *   
167:             *  
168:             * </pre>
169:             */
170:            public void testTEMB0059SBA() throws MediaException,
171:                    MalformedURLException {
172:                // test instance
173:                MediaFormat testInstance = createMediaFormat();
174:                assertTrue("test 1", testInstance.isEmbedded());
175:                testTrace("test 1 passed");
176:
177:                succeed();
178:            }
179:
180:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.