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.MediaBean;
010: import javax.emb.MediaException;
011: import javax.emb.MediaFormatRegistry;
012: import javax.emb.MediaHeader;
013:
014: import org.objectweb.jonas.emb.mfb.formats.video.MpegVideoFormat;
015:
016: import com.ibm.emb.junit.EMBTestRunner;
017: import com.ibm.emb.test.MediaHeaderTest;
018:
019: public class MpegVideoHeaderTest extends MediaHeaderTest {
020:
021: /**
022: * constructor
023: */
024: public MpegVideoHeaderTest(String name) throws MediaException {
025: super (name);
026: }
027:
028: /**
029: * main method
030: */
031: public static void main(String args[]) {
032: EMBTestRunner.run(MpegVideoHeaderTest.class);
033: }
034:
035: /**
036: * do initialisation here
037: */
038: protected void setUp() {
039: }
040:
041: /**
042: * freeup resources
043: */
044: protected void tearDown() {
045: }
046:
047: /**
048: * creates an instance of MpegVideoHeader with the given Parameters used in
049: * super class of MpegVideoHeaderTest
050: */
051: public MediaHeader createMediaHeader() throws MediaException,
052: IOException {
053:
054: // register media format
055: MediaFormatRegistry formatRegistry = MediaFormatRegistry.SINGLETON;
056: formatRegistry.rebind("mpg", new MpegVideoFormat());
057:
058: // full path of the mpeg video sample
059: String mediaMpgFullPath = embTestConfig.getMediaDir()
060: + File.separator + embTestConfig.getMpegMovieName1();
061:
062: // creates media bean
063: File mediaMpegFile = new File(mediaMpgFullPath);
064: MediaBean mediaBean = new MediaBean(mediaMpegFile, "mpg");
065:
066: // creates jpeg format
067: InputStream mediaMpegInputStream = new FileInputStream(
068: mediaMpegFile);
069: MpegVideoFormat mpgFormat = new MpegVideoFormat();
070:
071: // TODO : MpegHeader does not exist any more
072:
073: MediaHeader mpgHeader = mpgFormat
074: .extractHeader(mediaMpegInputStream);
075: mediaMpegInputStream.close();
076: return mpgHeader;
077: }
078:
079: /**
080: * <pre>
081: *
082: *
083: *
084: * Testcase Name: getField(String)
085: * Testcase Number: TEMB0083SBA
086: *
087: * Test 1:
088: * iterate over fieldnames, check for results, check system and stream headers.
089: *
090: *
091: *
092: *
093: * </pre>
094: */
095: public void testTEMB0083SBA() throws MediaException, IOException {
096:
097: // TODO : MpegHeader does not exist any more
098: // MpegVideoHeader testInstance;
099: // testInstance = (MpegVideoHeader) createMediaHeader();
100: //
101: // //
102: // // test 1
103: // //
104: //
105: // // error report
106: // logProductError("reported error PEMB0055RMD");
107: //
108: // assertTrue("test1 : ", testInstance.getField("bitrate").toString().equals("128")
109: // && testInstance.getField("emphasisIndex").toString().equals("0")
110: // && testInstance.getField("layer").toString().equals("3")
111: // && testInstance.getField("modeExtensionIndex").toString().equals("0")
112: // && testInstance.getField("modeIndex").toString().equals("0")
113: // && testInstance.getField("samplingFrequency").toString().equals("22050")
114: // && testInstance.getField("version").toString().equals("2.0"));
115:
116: testTrace("test 1 passed");
117:
118: succeed();
119: }
120: }
|