Java Doc for MediaTest.java in  » J2EE » JOnAS-4.8.6 » com » ibm » emb » test » 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 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


com.ibm.emb.junit.EMBTestCaseBase
   com.ibm.emb.test.MediaTest

All known Subclasses:   com.ibm.emb.test.MediaBeanTest,
MediaTest
abstract public class MediaTest extends EMBTestCaseBase (Code)
 Line Item: MFB API
 Subcategory 1: javax.emb
 Subcategory 2: Media
 This abstract class provides test methods for all methods described in the interface
 Media. For testing implementations of this interface one needs to create a Tester
 class which extends this interface and provide create methods for the concrete
 implementers of the Media interface
 



Constructor Summary
public  MediaTest(String name)
    

Method Summary
abstract public  MediacreateMedia(File inputFile, String mimeType)
    
abstract public  MediacreateMedia(InputStream in, String mimeType, String name)
    
public static  TeststdSuite(String TestCaseImplementor)
    
public  voidtestEMB001()
    
public  voidtestEMB002()
    
public  voidtestEMB003()
    
public  voidtestEMB004()
    
public  voidtestEMB005()
    
public  voidtestEMB006()
    
public  voidtestEMB007()
    
public  voidtestEMB008()
    
public  voidtestEMB009()
    
public  voidtestEMB010()
    


Constructor Detail
MediaTest
public MediaTest(String name) throws MediaException(Code)




Method Detail
createMedia
abstract public Media createMedia(File inputFile, String mimeType) throws MediaException(Code)
abstract method to create an instance of Media this method needs to be implemented in the test subclass and will create an instance of the concrete implementation of the class under test



createMedia
abstract public Media createMedia(InputStream in, String mimeType, String name) throws MediaException(Code)



stdSuite
public static Test stdSuite(String TestCaseImplementor)(Code)
stdSuite method of this test class instantiates all tests necesssary to for the standard compliance tests
Parameters:
  String - complete class Name of the implementor of the abstract test



testEMB001
public void testEMB001()(Code)
 Testcase Name: MIME_TYPE_UNKNOWN
 Testcase Number: EMB001
 setup:
 test procedure:
 1.query value of constant
 expected result: "www/unknown"
 



testEMB002
public void testEMB002() throws IOException, MediaException(Code)
 Testcase Name: getContent()
 Testcase Number: EMB002
 setup:
 test procedure:
 1.rebind("test", new GenericMediaFormat), create file of maxMediaSize and fill with random content
 create MediaBean by using file constructor, call getContent()
 expected result: ContentTooLargeException
 2.create small file, call getContent(), compare content with file content
 expected result: content and file content are equal
 



testEMB003
public void testEMB003() throws IOException, MediaException(Code)
 Testcase Name: getFormat()
 Testcase Number: EMB003
 setup:
 test procedure:
 1.rebind("jpg", new JpegFormat()), create random content file with name test.jpg
 create MediaBean from file, run getFormat()
 expected result: not null and instance of JpegFormat
 2.unbind("xxx") catch FormatNotFoundException
 create random content file with name test.xxx, create MediaBean from file, run getFormat()
 expected result: FormatNotFoundException
 



testEMB004
public void testEMB004() throws IOException, MediaException(Code)
 Testcase Name: getHeader()
 Testcase Number: EMB004
 setup:
 test procedure:
 1.rebind("jpg",new JpegFormat()), create file from JPEG image file with name test.jpg
 create MediaBean from file, run getHeader()
 expected result: return value not null and equals getFormat().extractHeader()
 2.unbind("xxx") catch FormatNotFoundException
 create random content file with name test.xxx, create MediaBean from file, run getHeader()
 expected result: FormatNotFoundException is thrown
 3.create file from random content, run getHeader()
 expected result: FormatSyntaxException
 4.use static byte array to create BMP file (contains unsupported version) and run getHeader()
 expected result: MediaFormatException
 



testEMB005
public void testEMB005() throws IOException, MediaException(Code)
 Testcase Name: getMimeType()
 Testcase Number: EMB005
 setup:
 test procedure:
 1.rebind("jpg", new JpegFormat())
 create random content file with name test.jpg, create MediaBean from file with mimetype null, run getMimeType()
 expected result: result equals getFormat().getDefaultMimeType()
 2.create random content file with name test.jpg, create MediaBean from file with mimetype "test", run getMimeType()
 expected result: result is "test"
 3.create random content file with name test.xxx and create MediaBean from file with null mimetype, run getMimeType()
 expected result: FormatNotFoundException
 



testEMB006
public void testEMB006() throws IOException, MediaException(Code)
 Testcase Name: getName()
 Testcase Number: EMB006
 setup:
 test procedure:
 1.rebind("jpg", new JpegFormat()), create random content file with name test.jpg, create MediaBean from file with mimetype null, run getName()
 expected result: result is not null and contains a '.'
 2.create MediaBean from InputStream with null mimetype and random name, call getName
 expected result: name matches original name
 



testEMB007
public void testEMB007() throws MediaException, IOException(Code)
 Testcase Name: getProxy()
 Testcase Number: EMB007
 setup:
 test procedure:
 1.create random content file with name test.jpg, create MediaBean from file, call getProxy()
 expected result: not null
 



testEMB008
public void testEMB008() throws IOException, MediaException, Exception(Code)
 Testcase Name: getSize()
 Testcase Number: EMB008
 setup:
 test procedure:
 1.create random content file with name test.jpg and content size 1024, create MediaBean from file, run getSize()
 expected result: result is 1024
 



testEMB009
public void testEMB009() throws IOException, MediaException, Exception(Code)
 Testcase Name: readContent(long position, byte[] buffer)
 Testcase Number: EMB009
 setup: create file (1024 byte), rebind("test", new GenericMediaFormat()), create MediaBean
 create byte array buffer of size 1024 bytes
 test procedure:
 1.call readContent(-1,testBuffer)
 expected result: IndexOutOfBoundsException
 2.call readContent(1025,testBuffer)
 expected result: IndexOutOfBoundsException
 3.call readContent(0,null)
 expected result: NullPointerException
 4.call readContent(10,testBuffer) with buffer size 100 bytes
 compare to media content offset 10, length of return value
 expected result: same content
 5.call readContent(1024,testBuffer)
 expected result: -1 returned with empty buffer
 6.create testInstance from nonexistent file and call readContent(0,buffer)
 expected result: ContentAccessException
 7.create testInstance of size 100 bytes and buffer of size 1024 bytes
 call readContent(0,testBuffer) and compare content of media and buffer
 expected result: buffer partially filled (return value is the length)
 



testEMB010
public void testEMB010() throws IOException, MediaException, Exception(Code)
 Testcase Name: readContent(long position, byte[] buffer, int offset, int length)
 Testcase Number: EMB010
 setup: create file (1024 byte), rebind("test", new GenericMediaFormat()), create MediaBean
 create byte array buffer of size 1024 bytes
 test procedure:
 1.call readContent(-1,testBuffer,0,1024)
 expected result: IndexOutOfBoundsException
 2.call readContent(1025,testBuffer,0,1024)
 expected result: IndexOutOfBoundsException
 3.call readContent(0,testBuffer,-1,1024)
 expected result: IndexOutOfBoundsException
 4.call readContent(0,testBuffer,1025,1024)
 expected result: IndexOutOfBoundsException
 5.call readContent(0,testBuffer,0,-1)
 expected result: NegativeIndexArrayException
 6.call readContent(0,null,0,1024)
 expected result: NullPointerException
 7.create testInstance from nonexistent file and call readContent(0,testBuffer,0,1024)
 expected result: ContentAccessException
 8.call readContent(0,testBuffer,0,1024) (loop to fill buffer)
 compare with file content
 expected result: same content
 9.call readContent(512,testBuffer,0,1024)
 expected result: buffer partially filled with 512 bytes matching last 512 bytes
 of media content (could be less if nonblocking)
 10.call readContent(1024,testBuffer,0,1024)
 expected result: return -1 with empty buffer
 11.call readContent(0,testBuffer,100,924), compare buffer offset 100 with media content
 (use return value as length)
 expected result: same content
 12.call readContent(200,testBuffer,100,100), compare buffer offset 100 with file offset 200
 (use return value as length)
 expected result: same content
 13.call readContent(0,testBuffer,0,1048), compare buffer with file content
 expected result: same content and no exceptions
 



Fields inherited from com.ibm.emb.junit.EMBTestCaseBase
protected EMBTestConfiguration embTestConfig(Code)(Java Doc)

Methods inherited from com.ibm.emb.junit.EMBTestCaseBase
public static byte[] getByteArrayFromFile(File arg) throws IOException(Code)(Java Doc)
public void logProductError(String msg)(Code)(Java Doc)
public static void removeFilesInDir(File srcDir) throws IOException(Code)(Java Doc)
protected void setUp() throws Exception(Code)(Java Doc)
public void succeed(String msg)(Code)(Java Doc)
public void succeed()(Code)(Java Doc)
protected void tearDown() throws Exception(Code)(Java Doc)
public void testError(String msg)(Code)(Java Doc)
public void testLog(String msg)(Code)(Java Doc)
public void testTrace(String msg)(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.