Source Code Cross Referenced for MpegVideoFormatTest.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:        // java stuff
004:        import java.io.File;
005:        import java.io.FileInputStream;
006:        import java.io.IOException;
007:        import java.io.InputStream;
008:
009:        import javax.emb.Media;
010:        import javax.emb.MediaBean;
011:        import javax.emb.MediaException;
012:        import javax.emb.MediaFormat;
013:        import javax.emb.MediaFormatRegistry;
014:
015:        import org.objectweb.jonas.emb.mfb.formats.video.MpegVideoFormat;
016:
017:        import com.ibm.emb.junit.EMBTestRunner;
018:
019:        public class MpegVideoFormatTest extends EmbeddedMediaFormatTest {
020:
021:            /**
022:             * constructor
023:             */
024:            public MpegVideoFormatTest(String name) throws MediaException {
025:                super (name);
026:            }
027:
028:            /**
029:             * main method
030:             */
031:            public static void main(String args[]) {
032:                EMBTestRunner.run(MpegVideoFormatTest.class);
033:            }
034:
035:            /**
036:             * creates an instance of MpegVideoFormat with the given Parameters used in
037:             * super class of MpegVideoFormatTest
038:             */
039:            public MediaFormat createMediaFormat() {
040:                return new MpegVideoFormat();
041:            }
042:
043:            /**
044:             * do initialisation here
045:             */
046:            protected void setUp() {
047:            }
048:
049:            /**
050:             * freeup resources
051:             */
052:            protected void tearDown() {
053:            }
054:
055:            /**
056:             * <pre>
057:             *
058:             *      Testcase Name: extractHeader(Media)
059:             *      Testcase Number: TEMB0086SBA
060:             *
061:             *      Test 1:
062:             *      call extractHeader passing suitable MPEG video
063:             *      --&gt; check result to be an instance of com.ibm.emb.meb.MpegVideoHeader
064:             *
065:             * </pre>
066:             */
067:            public void testTEMB0086SBA() throws MediaException, IOException {
068:
069:                //
070:                // test 1
071:                //
072:
073:                // register media format
074:                MediaFormatRegistry formatRegistry = MediaFormatRegistry.SINGLETON;
075:                formatRegistry.rebind("mpeg", new MpegVideoFormat());
076:
077:                // full path of the mpeg video sample
078:                String mediaMpegFullPath = embTestConfig.getMediaDir()
079:                        + File.separator + embTestConfig.getMpegMovieName1();
080:
081:                // creates media bean
082:                File mediaMpegFile = new File(mediaMpegFullPath);
083:                MediaBean mediaBean = new MediaBean(mediaMpegFile, "mpeg");
084:
085:                // creates mpeg video format
086:                MpegVideoFormat mpegVideoFormat = new MpegVideoFormat();
087:
088:                // creates mpegVideoHeader
089:
090:                //      TODO : MpegHeader does not exist any more
091:                //        InputStream mediaMpegInputStream = new FileInputStream(mediaMpegFile);
092:                //        MpegVideoHeader mpegVideoHeader = (MpegVideoHeader) mpegVideoFormat.extractHeader(mediaMpegInputStream);
093:                //        mediaMpegInputStream.close();
094:                //
095:                //        // test
096:                //        assertTrue("test 1", mpegVideoHeader instanceof MpegVideoHeader);
097:
098:                testTrace("test 1 passed");
099:
100:                succeed();
101:            }
102:
103:            /**
104:             * <pre>
105:             *
106:             *      Testcase Name: extractSurrogate(Media)
107:             *      Testcase Number: TEMB0087SBA
108:             *
109:             *      Test 1:
110:             *      call extractSurrogate passing suitable MPEG video.
111:             *      check result to be an instance of Media
112:             *      access the content of the resulting media ----&gt;  to verify it is accessible
113:             *
114:             * </pre>
115:             */
116:            public void testTEMB0087SBA() throws MediaException, IOException {
117:                //
118:                // test 1
119:                //
120:
121:                // register media format
122:                MediaFormatRegistry formatRegistry = MediaFormatRegistry.SINGLETON;
123:                formatRegistry.rebind("mpg", new MpegVideoFormat());
124:
125:                // full path of the mpeg video sample
126:                String mediaMpegFullPath = embTestConfig.getMediaDir()
127:                        + File.separator + embTestConfig.getMpegMovieName1();
128:
129:                // creates media bean
130:                File mediaMpegFile = new File(mediaMpegFullPath);
131:                MediaBean mediaBean = new MediaBean(mediaMpegFile, "mpeg");
132:
133:                InputStream mediaMpegInputStream = new FileInputStream(
134:                        mediaMpegFile);
135:                // creates mpeg video format
136:                MpegVideoFormat mpegVideoFormat = new MpegVideoFormat();
137:                // gets surrogate
138:                MediaBean mediaBeanSurrogate = (MediaBean) mpegVideoFormat
139:                        .extractProxy(mediaMpegInputStream);
140:                mediaMpegInputStream.close();
141:
142:                // check access to content and check format
143:                byte[] content = mediaBeanSurrogate.getContent();
144:                byte[] content_ = new byte[content.length];
145:                System.arraycopy(content, 0, content_, 0, content.length);
146:
147:                assertTrue("test 1", mediaBeanSurrogate instanceof  Media);
148:                testTrace("test 1 passed");
149:
150:                succeed();
151:            }
152:
153:            /**
154:             * <pre>
155:             *
156:             *      Testcase Name: getDefaultMimeType()
157:             *      Testcase Number: TEMB0088SBA
158:             *
159:             *      Test 1:
160:             *      call getDefaultMimeType
161:             *      ---&gt;check if result equals &quot;video/mpeg&quot;
162:             *
163:             * </pre>
164:             */
165:            public void testTEMB0088SBA() throws MediaException {
166:                //
167:                // test 1
168:                //
169:
170:                // creates mpeg video format
171:                MpegVideoFormat mpegVideoFormat = new MpegVideoFormat();
172:
173:                assertEquals("test 1: ", "video/mpeg", mpegVideoFormat
174:                        .getDefaultMimeType());
175:                testTrace("test 1 passed");
176:
177:                succeed();
178:            }
179:
180:            /**
181:             * <pre>
182:             *
183:             *      Testcase Name: isStreamingDesirable()
184:             *      Testcase Number: TEMB0089SBA
185:             *
186:             *      Test 1:
187:             *      call isStreamingDesirable
188:             *      ---&gt;check if result is true
189:             *
190:             * </pre>
191:             */
192:            public void testTEMB0089SBA() throws MediaException {
193:                //
194:                // test 1
195:                //
196:
197:                // creates mpeg video format
198:                MpegVideoFormat mpegVideoFormat = new MpegVideoFormat();
199:
200:                assertTrue("test 1: ", mpegVideoFormat.isStreamingDesirable());
201:                testTrace("test 1 passed");
202:
203:                succeed();
204:            }
205:
206:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.