0001: package com.ibm.emb.test;
0002:
0003: import java.io.File;
0004: import java.io.FileOutputStream;
0005: import java.io.IOException;
0006: import java.net.MalformedURLException;
0007: import java.net.URL;
0008: import java.rmi.RemoteException;
0009: import java.util.Arrays;
0010: import java.util.List;
0011: import java.util.StringTokenizer;
0012:
0013: import javax.ejb.CreateException;
0014: import javax.ejb.FinderException;
0015: import javax.ejb.RemoveException;
0016: import javax.emb.ContentAccessException;
0017: import javax.emb.FormatNotFoundException;
0018: import javax.emb.GenericMediaFormat;
0019: import javax.emb.Media;
0020: import javax.emb.MediaBean;
0021: import javax.emb.MediaEntityLocalHome;
0022: import javax.emb.MediaException;
0023: import javax.emb.NoServerFoundException;
0024: import javax.emb.ProtocolConstraints;
0025: import javax.naming.InitialContext;
0026: import javax.naming.NamingException;
0027: import javax.rmi.PortableRemoteObject;
0028:
0029: import org.objectweb.jonas.emb.mfb.formats.image.BmpFormat;
0030: import org.objectweb.jonas.emb.mfb.formats.image.JpegFormat;
0031: import org.objectweb.jonas.emb.mfb.formats.playlist.GenericPlaylistFormat;
0032:
0033: import com.ibm.emb.junit.ComplexMediaLocationInfo;
0034: import com.ibm.emb.junit.EMBStaticHelper;
0035: import com.ibm.emb.junit.EMBTestCaseBase;
0036: import com.ibm.emb.junit.EmbeddedMediaLocationInfo;
0037: import com.ibm.emb.meb.test.ejb.MediaEntityLocalTestDriver;
0038: import com.ibm.emb.meb.test.ejb.MediaEntityLocalTestDriverHome;
0039:
0040: /**
0041: * <pre>
0042: *
0043: *
0044: *
0045: *
0046: *
0047: *
0048: * Line Item: MEB API
0049: * Subcategory 1: javax.emb
0050: * Subcategory 2: MediaEntityLocalHome
0051: *
0052: *
0053: *
0054: *
0055: *
0056: *
0057: * </pre>
0058: */
0059: public class MediaEntityLocalHomeTest extends EMBTestCaseBase {
0060:
0061: private static String MEBTESTER_JNDI = "java:comp/env/ejb/MediaEntityLocalTestDriverHome";
0062:
0063: private InitialContext ic;
0064:
0065: private MediaEntityLocalTestDriverHome mebHome;
0066:
0067: private MediaEntityLocalTestDriver mebTester = null;
0068:
0069: public MediaEntityLocalHomeTest(String name) throws MediaException {
0070: super (name);
0071: }
0072:
0073: /**
0074: * do initialisation of each individual Test method here this method is
0075: * called before each individual Test Method
0076: */
0077: protected void setUp() throws RemoteException, CreateException {
0078: if (mebHome == null) {
0079: try {
0080: ic = new InitialContext();
0081: Object ojb = ic.lookup(MEBTESTER_JNDI);
0082: mebHome = (MediaEntityLocalTestDriverHome) PortableRemoteObject
0083: .narrow(ojb,
0084: MediaEntityLocalTestDriverHome.class);
0085: } catch (NamingException ne) {
0086: System.out
0087: .println("NamingException thrown during setup. Msg: "
0088: + ne.getMessage());
0089: }
0090: }
0091: mebTester = mebHome.create();
0092: return;
0093: }
0094:
0095: /**
0096: * <pre>
0097: *
0098: *
0099: *
0100: *
0101: *
0102: *
0103: * Testcase Name: create()
0104: * Testcase Number: EMB134
0105: *
0106: * setup: create testInstance of MediaEntityLocalHome
0107: *
0108: * test procedure:
0109: * 1.call testInstance.create()
0110: * expected result: new Media entity created and verify primary key is not null
0111: * verify initial values of properties
0112: *
0113: *
0114: *
0115: *
0116: *
0117: *
0118: * </pre>
0119: */
0120: public void testEMB134() throws MediaException, NamingException,
0121: FinderException, RemoteException, CreateException {
0122:
0123: //
0124: // test 1
0125: //
0126: String mediaEntity = mebTester.createMediaEntityBean();
0127: assertNotNull("test 1: primary key is null", mediaEntity);
0128: assertTrue("test 1: timestamp is not initialized", mebTester
0129: .getMediaEntityLastModified(mediaEntity) > 0);
0130:
0131: try {
0132: mebTester.getMediaEntityContent(mediaEntity);
0133: fail("test 1: (content) Should throw a ContentAccessException");
0134: } catch (ContentAccessException e) {
0135: // correct exception
0136: } catch (Exception e) {
0137: fail("test 1: (content) Should throw a ContentAccessException but threw "
0138: + e.toString());
0139: }
0140: assertNull("test 1: description should be null", mebTester
0141: .getMediaEntityDescription(mediaEntity));
0142:
0143: try {
0144: mebTester.getMediaEntityFormat(mediaEntity);
0145: fail("test 1: (format) Should throw a FormatNotFoundException");
0146: } catch (FormatNotFoundException e) {
0147: // correct exception
0148: } catch (Exception e) {
0149: fail("test 1: (format) Should throw a FormatNotFoundException but threw "
0150: + e.toString());
0151: }
0152:
0153: try {
0154: mebTester.getMediaEntityHeader(mediaEntity);
0155: fail("test 1: (header) Should throw a FormatNotFoundException or ContentAccessException");
0156: } catch (FormatNotFoundException e) {
0157: } catch (ContentAccessException e) {
0158: } catch (Exception e) {
0159: fail("test 1: (header) Should throw a FormatNotFoundException or ContentAccessException but threw "
0160: + e.toString());
0161: }
0162:
0163: assertNull("test 1: name is not null", mebTester
0164: .getMediaEntityName(mediaEntity));
0165:
0166: try {
0167: mebTester.getMediaEntityMimeType(mediaEntity);
0168: fail("test 1: (mimeType) Should throw a FormatNotFoundException");
0169: } catch (FormatNotFoundException e) {
0170: } catch (Exception e) {
0171: fail("test 1: (mimeType) Should throw a FormatNotFoundException but threw "
0172: + e.toString());
0173: }
0174:
0175: assertNull("test 1: location is not null", mebTester
0176: .getMediaEntityLocation(mediaEntity));
0177:
0178: assertNull("test 1: previousVersion is not null", mebTester
0179: .getMediaEntityPreviousVersion(mediaEntity));
0180: assertNull("test 1: nextVersion is not null", mebTester
0181: .getMediaEntityNextVersion(mediaEntity));
0182: assertEquals("test 1: should have no listeners", 0, mebTester
0183: .getMediaEntityListeners(mediaEntity).length);
0184: assertEquals("test 1: should have no parents", 0, mebTester
0185: .getMediaEntityParents(mediaEntity).length);
0186: assertEquals("test 1: should have no children", 0, mebTester
0187: .getMediaEntityChildren(mediaEntity).length);
0188: assertEquals("test 1: should have no meta data", 0, mebTester
0189: .getMediaEntityMetaData(mediaEntity).length);
0190: assertNotNull("test 1: proxy is null", mebTester
0191: .getMediaEntityProxy(mediaEntity));
0192:
0193: testTrace("test 1 passed");
0194:
0195: succeed();
0196: }
0197:
0198: /**
0199: * <pre>
0200: *
0201: *
0202: *
0203: *
0204: *
0205: *
0206: * Testcase Name: exportMedia(MediaEntityLocal[], URL)
0207: * Testcase Number: EMB135
0208: *
0209: * setup: create testInstance of MediaEntityLocalHome
0210: * create Media entity me1 from embedded media file
0211: * create Media entity me2 from nonembedded media file
0212: * rebind corresponding formats to registry
0213: *
0214: * test procedure:
0215: * 1.call exportMedia(null, valid location)
0216: * expected result: NullPointerException
0217: *
0218: * 2.call exportMedia(new MediaEntityLocal[]{me1, null}, valid location)
0219: * expected result: 2 element array with second element being null
0220: *
0221: * 3.call exportMedia(new MediaEntityLocal[0], valid location)
0222: * expected result: empty array
0223: *
0224: * 4.call exportMedia(new MediaEntityLocal[]{me1, me2}, valid location)
0225: * expected result: 2 element array of URL's, verify media entities in new location are accessible
0226: *
0227: * 5.repeat test 4
0228: * expected result: files copied and files from test 4 are not overwritten
0229: *
0230: * 6.create Media entity from nonexistent file, add to entity array
0231: * call exportMedia with array and valid location
0232: * expected result: ContentAccessException
0233: *
0234: * 7.create Media entity from random byte array and add to array
0235: * call exportMedia with array and valid location
0236: * expected result: MediaFormatException
0237: *
0238: * 8.call exportMedia(new MediaEntityLocal[]{me1, me1}, valid location)
0239: * expected result: 2 element array of URL's, verify URL's are the same
0240: *
0241: * 9.call exportMedia(new MediaEntityLocal[]{me1}, null)
0242: * expected result: no exception, media copied to default location
0243: *
0244: * 10.call importMedia on two nonembedded media with a common child
0245: * call exportMedia with media entities created and valid location
0246: * expected result: 2 parents copied with only one copy of common child
0247: * use URLs to access media entities and check children
0248: *
0249: *
0250: *
0251: *
0252: *
0253: *
0254: * </pre>
0255: */
0256: public void testEMB135() throws MediaException,
0257: MalformedURLException, IOException, CreateException,
0258: NamingException, RemoteException, FinderException {
0259:
0260: mebTester.bindMediaFormat("jpg", new JpegFormat());
0261: mebTester.bindMediaFormat("bmp", new BmpFormat());
0262: mebTester.bindMediaFormat("gpl", new GenericPlaylistFormat());
0263: mebTester.bindMediaFormat("test", new GenericMediaFormat());
0264:
0265: EmbeddedMediaLocationInfo me1ELocInfo = new EmbeddedMediaLocationInfo(
0266: embTestConfig.getJpgPictureName1());
0267: String me1E = mebTester.createMediaEntityBean();
0268: mebTester.setMediaEntityName(me1E, me1ELocInfo.getMediaName());
0269: mebTester.setMediaEntityContent(me1E, me1ELocInfo
0270: .getMediaFile());
0271:
0272: ComplexMediaLocationInfo me2NELocInfo = new ComplexMediaLocationInfo(
0273: ComplexMediaLocationInfo.MEDIAGPL1);
0274: String me2NE = mebTester.createMediaEntityBean();
0275: mebTester.setMediaEntityName(me2NE, me2NELocInfo.getRootFile()
0276: .getName());
0277: mebTester.importMediaEntityContent(me2NE, me2NELocInfo
0278: .getRootURL(), me2NELocInfo.getRootFile().getName());
0279:
0280: int exception = -1;
0281: //
0282: // test 1
0283: //
0284: // String targetDirectory = "/C:/" + embTestConfig.getMediaDir() + "/" +
0285: // "export";
0286: String targetDirectory = embTestConfig.getMediaDir()
0287: + File.separatorChar + "export";
0288: try {
0289: exception = mebTester
0290: .exportHomeMediaExceptions(null, new URL("file",
0291: embTestConfig.getTestClientIPAddress(),
0292: targetDirectory));
0293: } catch (Throwable e) {
0294: fail("test 1 threw " + e.toString());
0295: }
0296: assertEquals("test 1: Should throw a NullPointerException",
0297: MediaEntityLocalTestDriver.NULLPOINTER, exception);
0298: testTrace("test 1 passed");
0299: //
0300: // test 2
0301: //
0302: URL[] exportedMediaURLs = mebTester.exportHomeMediaEntityBeans(
0303: new String[] { me1E, null }, new URL("file",
0304: embTestConfig.getTestClientIPAddress(),
0305: targetDirectory));
0306: assertEquals("test 2: less than 2 URL's", 2,
0307: exportedMediaURLs.length);
0308: assertTrue("test 2: content does not match", java.util.Arrays
0309: .equals(mebTester.getMediaEntityContent(me1E),
0310: getByteArrayFromFile(new File(
0311: exportedMediaURLs[0].getFile()))));
0312: assertNull("test 2: second URL not null", exportedMediaURLs[1]);
0313: testTrace("test 2 passed");
0314: //
0315: // test 3
0316: //
0317: exportedMediaURLs = mebTester.exportHomeMediaEntityBeans(
0318: new String[0], new URL("file", embTestConfig
0319: .getTestClientIPAddress(), targetDirectory));
0320: assertEquals("test 3: array not empty", 0,
0321: exportedMediaURLs.length);
0322: testTrace("test 3 passed");
0323:
0324: //
0325: // test 4
0326: //
0327: exportedMediaURLs = mebTester.exportHomeMediaEntityBeans(
0328: new String[] { me1E, me2NE }, new URL("file",
0329: embTestConfig.getTestClientIPAddress(),
0330: targetDirectory));
0331: assertEquals("test 4: number of URLs incorrect", 2,
0332: exportedMediaURLs.length);
0333:
0334: String[] names = new String[] { "test.jpg", "test.gpl" };
0335: String[] exportedMEBs = null;
0336: try {
0337: exportedMEBs = mebTester.importHomeMediaEntityBeans(
0338: exportedMediaURLs, names);
0339: } catch (Exception e) {
0340: fail("test 4: could not reimport media");
0341: }
0342: assertTrue("test 4: content of me1E does not match",
0343: java.util.Arrays.equals(mebTester
0344: .getMediaEntityContent(me1E), mebTester
0345: .getMediaEntityContent(exportedMEBs[0])));
0346:
0347: // check children of nonembedded media copied correctly
0348: String[] exportedChildren = mebTester
0349: .getMediaEntityChildren(exportedMEBs[1]);
0350: assertEquals(
0351: "test 4: number of children does not match",
0352: mebTester.getMediaEntityChildren(me2NE).length,
0353: mebTester.getMediaEntityChildren(exportedMEBs[1]).length);
0354: testTrace("test 4 passed");
0355:
0356: //
0357: // test 5
0358: //
0359: URL[] secondMediaURLArray = mebTester
0360: .exportHomeMediaEntityBeans(
0361: new String[] { me1E, me2NE }, new URL("file",
0362: embTestConfig.getTestClientIPAddress(),
0363: targetDirectory));
0364: assertEquals("test 5: does not contain 2 elements",
0365: secondMediaURLArray.length, 2);
0366: for (int j = 0; j < secondMediaURLArray.length; j++) {
0367: assertFalse("test 5: media overwritten",
0368: secondMediaURLArray[j].equals(exportedMediaURLs[j]));
0369: }
0370: testTrace("test 5 passed");
0371: //
0372: // test 6
0373: //
0374: String me3E = mebTester.createMediaEntityBean();
0375: mebTester.setMediaEntityName(me3E, "test.jpg");
0376: try {
0377: exception = mebTester.exportHomeMediaExceptions(
0378: new String[] { me3E }, new URL("file",
0379: embTestConfig.getTestClientIPAddress(),
0380: targetDirectory));
0381: } catch (Throwable e) {
0382: fail("test 6 threw " + e.toString());
0383: }
0384: assertEquals("test 6: Should throw a ContentAccessException",
0385: MediaEntityLocalTestDriver.CONTENTACCESS, exception);
0386: testTrace("test 6 passed");
0387: //
0388: // test 7
0389: //
0390: String mediaFullPath = embTestConfig.getMediaDir()
0391: + File.separatorChar + "Generated" + File.separatorChar
0392: + "test.gpl";
0393: FileOutputStream mediaBmpOutputStream = new FileOutputStream(
0394: mediaFullPath);
0395: mediaBmpOutputStream.write(EMBStaticHelper
0396: .createRandomByteArray(1024));
0397: mediaBmpOutputStream.close();
0398:
0399: String me4E = mebTester.createMediaEntityBean();
0400: mebTester.setMediaEntityName(me4E, "testBean.test");
0401: mebTester.setMediaEntityContent(me4E, new File(mediaFullPath));
0402: mebTester.setMediaEntityName(me4E, "testBean.gpl");
0403:
0404: try {
0405: exception = mebTester.exportHomeMediaExceptions(
0406: new String[] { me4E }, new URL("file",
0407: embTestConfig.getTestClientIPAddress(),
0408: targetDirectory));
0409: } catch (Throwable e) {
0410: fail("test 7 threw " + e.toString());
0411: }
0412: assertEquals("test 7: Should throw a MediaFormatException",
0413: MediaEntityLocalTestDriver.MEDIAFORMAT, exception);
0414: testTrace("test 7 passed");
0415: //
0416: // test 8
0417: //
0418: exportedMediaURLs = mebTester.exportHomeMediaEntityBeans(
0419: new String[] { me1E, me1E }, new URL("file",
0420: embTestConfig.getTestClientIPAddress(),
0421: targetDirectory));
0422: assertTrue("test 8: URL's not equal", exportedMediaURLs[0]
0423: .equals(exportedMediaURLs[1]));
0424: testTrace("test 8 passed");
0425:
0426: //
0427: // test 9
0428: //
0429: try {
0430: exportedMediaURLs = mebTester.exportHomeMediaEntityBeans(
0431: new String[] { me1E }, null);
0432: assertEquals("test 9: media not copied", 1,
0433: exportedMediaURLs.length);
0434: testTrace("test 9 passed");
0435: } catch (Exception e) {
0436: fail("test 9 threw " + e.toString());
0437: }
0438:
0439: //
0440: // test 10
0441: //
0442: // ahrrrr C:/ !!!!
0443: // URL playlist2URL = new URL("file",
0444: // embTestConfig.getTestClientIPAddress(), "/C:" +
0445: // embTestConfig.getMediaDir() + "/" +
0446: // embTestConfig.getPlaylistName2());
0447: URL playlist2URL = new URL("file", embTestConfig
0448: .getTestClientIPAddress(), embTestConfig.getMediaDir()
0449: + File.separatorChar + embTestConfig.getPlaylistName2());
0450: String[] neMediaArray = mebTester.importHomeMediaEntityBeans(
0451: new URL[] { me2NELocInfo.getRootURL(), playlist2URL },
0452: null);
0453: assertEquals(
0454: "test 10: neMediaArray does not contain 2 elements",
0455: neMediaArray.length, 2);
0456: assertEquals(
0457: "test 10: testPlaylist1 does not have 3 children",
0458: mebTester.getMediaEntityChildren(neMediaArray[0]).length,
0459: 3);
0460: assertEquals(
0461: "test 10: testPlaylist2 does not have 1 child",
0462: mebTester.getMediaEntityChildren(neMediaArray[1]).length,
0463: 1);
0464:
0465: // verify only one media entity created for common child
0466: boolean commonChild = false;
0467: String[] meChildren = mebTester
0468: .getMediaEntityChildren(neMediaArray[0]);
0469: for (int i = 0; i < meChildren.length; i++) {
0470: if (mebTester.getMediaEntityChildren(neMediaArray[1])[0]
0471: .equals(meChildren[i])) {
0472: commonChild = true;
0473: break;
0474: }
0475: }
0476: assertTrue(
0477: "test 10: more than 1 entity imported for common child",
0478: commonChild);
0479:
0480: // exportMedia and verify only one copy of common child created
0481: exportedMediaURLs = mebTester.exportHomeMediaEntityBeans(
0482: neMediaArray, new URL("file", embTestConfig
0483: .getTestClientIPAddress(), targetDirectory));
0484: neMediaArray = mebTester.importHomeMediaEntityBeans(
0485: exportedMediaURLs, null);
0486: meChildren = mebTester.getMediaEntityChildren(neMediaArray[0]);
0487: for (int i = 0; i < meChildren.length; i++) {
0488: if (mebTester.getMediaEntityChildren(neMediaArray[1])[0]
0489: .equals(meChildren[i])) {
0490: commonChild = true;
0491: break;
0492: }
0493: }
0494: assertTrue(
0495: "test 10: more than 1 entity exported for common child",
0496: commonChild);
0497: testTrace("test 10 passed");
0498:
0499: succeed();
0500: }
0501:
0502: /**
0503: * <pre>
0504: *
0505: *
0506: *
0507: *
0508: *
0509: *
0510: * Testcase Name: findByPartialDescription(String)
0511: * Testcase Number: EMB136
0512: *
0513: * setup: create Media entities me1, me2, and me3
0514: * call me1.setDescription("foo1")
0515: * call me2.setDescription("foo2")
0516: * leave me3's description as null
0517: *
0518: * test procedure:
0519: * 1.call findByPartialDescription(null)
0520: * expected result: empty array?
0521: *
0522: * 2.call findByPartialDescription("foo")
0523: * expected result: 2 element array
0524: *
0525: * 3.call findByPartialDescription("FOO")
0526: * expected result: empty array
0527: *
0528: * 4.call findByPartialDescription("oO1")
0529: * expected result: empty array
0530: *
0531: * 5.call findByPartialDescription("oO2")
0532: * expected result: empty array
0533: *
0534: * 6.call findByPartialDescription("fooo")
0535: * expected result: empty array
0536: *
0537: * 7.call findByPartialDescription("")
0538: * expected result: 2 element array
0539: *
0540: *
0541: *
0542: *
0543: *
0544: *
0545: * </pre>
0546: */
0547: public void testEMB136() throws NamingException,
0548: MalformedURLException, IOException, FinderException,
0549: RemoveException, CreateException, MediaException {
0550:
0551: mebTester.bindMediaFormat("jpg", new JpegFormat());
0552:
0553: EmbeddedMediaLocationInfo me1ELocInfo = new EmbeddedMediaLocationInfo(
0554: embTestConfig.getJpgPictureName1());
0555: String me1E = mebTester.createMediaEntityBean();
0556: mebTester.setMediaEntityName(me1E, "test1.jpg");
0557: mebTester.setMediaEntityContent(me1E, me1ELocInfo
0558: .getMediaFile());
0559: mebTester.setMediaEntityDescription(me1E, "foo1");
0560:
0561: EmbeddedMediaLocationInfo me2ELocInfo = new EmbeddedMediaLocationInfo(
0562: embTestConfig.getJpgPictureName2());
0563: String me2E = mebTester.createMediaEntityBean();
0564: mebTester.setMediaEntityName(me2E, "test2.jpg");
0565: mebTester.setMediaEntityContent(me2E, me2ELocInfo
0566: .getMediaFile());
0567: mebTester.setMediaEntityDescription(me2E, "foo2");
0568:
0569: String[] foundMEBs = null;
0570: //
0571: // test 1
0572: //
0573: foundMEBs = mebTester.findMEBByPartialDescription(null);
0574: assertEquals("test 1: Should return empty array", 0,
0575: foundMEBs.length);
0576: testTrace("test 1 passed");
0577: //
0578: // test 2
0579: //
0580: foundMEBs = mebTester.findMEBByPartialDescription("foo");
0581: assertTrue("test 2: (foo) Should return at least 2 elements",
0582: foundMEBs.length >= 2);
0583: List alist = Arrays.asList(foundMEBs);
0584: assertTrue("test 2: me1 is not in array", alist.contains(me1E));
0585: assertTrue("test 2: me2 is not in array", alist.contains(me2E));
0586: testTrace("test 2 passed");
0587: //
0588: // test 3
0589: //
0590: foundMEBs = mebTester.findMEBByPartialDescription("FOO");
0591: assertTrue("test 3: (FOO) Should return empty array",
0592: foundMEBs.length >= 0);
0593: alist = Arrays.asList(foundMEBs);
0594: assertFalse("test 3: me1 is in array", alist.contains(me1E));
0595: assertFalse("test 3: me2 is in array", alist.contains(me2E));
0596: testTrace("test 3 passed");
0597: //
0598: // test 4
0599: //
0600: foundMEBs = mebTester.findMEBByPartialDescription("oO1");
0601: assertTrue("test 4: (oO1) Should return empty array",
0602: foundMEBs.length >= 0);
0603: alist = Arrays.asList(foundMEBs);
0604: assertFalse("test 4: me1 is in array", alist.contains(me1E));
0605: testTrace("test 4 passed");
0606: //
0607: // test 5
0608: //
0609: foundMEBs = mebTester.findMEBByPartialDescription("oO2");
0610: assertTrue("test 5: (oO2) Should return empty array",
0611: foundMEBs.length >= 0);
0612: alist = Arrays.asList(foundMEBs);
0613: assertFalse("test 5: me2 is in array", alist.contains(me2E));
0614: testTrace("test 5 passed");
0615: //
0616: // test 6
0617: //
0618: foundMEBs = mebTester.findMEBByPartialDescription("fooo");
0619: assertTrue("test 6: (fooo) Should return empty array",
0620: foundMEBs.length >= 0);
0621: alist = Arrays.asList(foundMEBs);
0622: assertFalse("test 6: me1 is in array", alist.contains(me1E));
0623: assertFalse("test 6: me2 is in array", alist.contains(me2E));
0624: testTrace("test 6 passed");
0625: //
0626: // test 7
0627: //
0628: foundMEBs = mebTester.findMEBByPartialDescription("");
0629: assertTrue("test 7: (\"\") Should return at least 2 elements",
0630: foundMEBs.length >= 2);
0631: alist = Arrays.asList(foundMEBs);
0632: assertTrue("test 7: me1 is in array", alist.contains(me1E));
0633: assertTrue("test 7: me2 is in array", alist.contains(me2E));
0634: testTrace("test 7 passed");
0635:
0636: succeed();
0637: }
0638:
0639: /**
0640: * <pre>
0641: *
0642: *
0643: *
0644: *
0645: *
0646: *
0647: * Testcase Name: findByPartialLocation(String)
0648: * Testcase Number: EMB137
0649: *
0650: * setup: create Media entities me1, me2, and me3
0651: * call me1.setName and me1.setLocation
0652: * call me2.setName and me2.setLocation
0653: * call me3.setName and me3.setContent
0654: *
0655: * test procedure:
0656: * 1.call findByPartialLocation(null)
0657: * expected result: empty array
0658: *
0659: * 2.call findByPartialLocation("file")
0660: * expected result: 1 element array
0661: *
0662: * 3.call findByPartialLocation(location1)
0663: * expected result: 1 element array
0664: *
0665: * 4.call findByPartialLocation(location2)
0666: * expected result: 1 element array
0667: *
0668: * 5.call findByPartialLocation(test client IP address)
0669: * expected result: 2 element array
0670: *
0671: * 6.call findByPartialLocation("//////")
0672: * expected result: empty array
0673: *
0674: * 7.call findByPartialLocation("")
0675: * expected result: empty array
0676: *
0677: *
0678: *
0679: *
0680: *
0681: *
0682: * </pre>
0683: */
0684: public void testEMB137() throws NamingException,
0685: MalformedURLException, IOException, FinderException,
0686: RemoveException, CreateException, MediaException {
0687:
0688: mebTester.bindMediaFormat("jpg", new JpegFormat());
0689: mebTester.bindMediaFormat("bmp", new BmpFormat());
0690:
0691: EmbeddedMediaLocationInfo me1ELocInfo = new EmbeddedMediaLocationInfo(
0692: embTestConfig.getJpgPictureName1());
0693: String me1E = mebTester.createMediaEntityBean();
0694: mebTester.setMediaEntityName(me1E, "test1.jpg");
0695: mebTester.setMediaEntityLocation(me1E, me1ELocInfo
0696: .getMediaURL());
0697:
0698: EmbeddedMediaLocationInfo me2ELocInfo = new EmbeddedMediaLocationInfo(
0699: embTestConfig.getJpgPictureName2());
0700: String me2E = mebTester.createMediaEntityBean();
0701: mebTester.setMediaEntityName(me2E, "test2.jpg");
0702: mebTester.setMediaEntityLocation(me2E, me2ELocInfo
0703: .getMediaURL());
0704:
0705: EmbeddedMediaLocationInfo me3ELocInfo = new EmbeddedMediaLocationInfo(
0706: embTestConfig.getBmpPictureName1());
0707: String me3E = mebTester.createMediaEntityBean();
0708: mebTester.setMediaEntityName(me3E, "test3.bmp");
0709: mebTester.setMediaEntityContent(me3E, me3ELocInfo
0710: .getMediaFile());
0711:
0712: String[] foundMEBs = null;
0713: //
0714: // test 1
0715: //
0716: foundMEBs = mebTester.findMEBByPartialLocation(null);
0717: assertEquals("test 1: (null) Should return empty array", 0,
0718: foundMEBs.length);
0719: testTrace("test 1 passed");
0720: //
0721: // test 2
0722: //
0723: foundMEBs = mebTester.findMEBByPartialLocation("file");
0724: assertTrue("test 2: (file) Should return at least 2 elements",
0725: foundMEBs.length >= 2);
0726: List alist = Arrays.asList(foundMEBs);
0727: assertTrue("test 2: me1 is not in array", alist.contains(me1E));
0728: assertTrue("test 2: me2 is not in array", alist.contains(me2E));
0729: testTrace("test 2 passed");
0730: //
0731: // test 3
0732: //
0733: foundMEBs = mebTester.findMEBByPartialLocation(mebTester
0734: .getMediaEntityLocation(me1E).toExternalForm());
0735: assertTrue(
0736: "test 3: (location1) Should return at least 1 element",
0737: foundMEBs.length >= 1);
0738: alist = Arrays.asList(foundMEBs);
0739: assertTrue("test 3: me1 is not in array", alist.contains(me1E));
0740: testTrace("test 3 passed");
0741: //
0742: // test 4
0743: //
0744: foundMEBs = mebTester.findMEBByPartialLocation(mebTester
0745: .getMediaEntityLocation(me2E).toExternalForm());
0746: assertTrue(
0747: "test 4: (location2) Should return at least 1 element",
0748: foundMEBs.length >= 1);
0749: alist = Arrays.asList(foundMEBs);
0750: assertTrue("test 4: me2 is not in array", alist.contains(me2E));
0751: testTrace("test 4 passed");
0752: //
0753: // test 5
0754: //
0755: foundMEBs = mebTester.findMEBByPartialLocation(embTestConfig
0756: .getTestClientIPAddress());
0757: assertTrue(
0758: "test 5: (testClientIP) Should return at least 2 elements",
0759: foundMEBs.length >= 2);
0760: alist = Arrays.asList(foundMEBs);
0761: assertTrue("test 5: me1 is not in array", alist.contains(me1E));
0762: assertTrue("test 5: me2 is not in array", alist.contains(me2E));
0763: testTrace("test 5 passed");
0764: //
0765: // test 6
0766: //
0767: foundMEBs = mebTester.findMEBByPartialLocation("//////");
0768: assertTrue("test 6: (/////) Should return empty array",
0769: foundMEBs.length >= 0);
0770: alist = Arrays.asList(foundMEBs);
0771: assertFalse("test 6: me1 is not in array", alist.contains(me1E));
0772: assertFalse("test 6: me2 is not in array", alist.contains(me2E));
0773: testTrace("test 6 passed");
0774: //
0775: // test 7
0776: //
0777: foundMEBs = mebTester.findMEBByPartialLocation("");
0778: assertTrue("test 7: (\"\") Should return at least 2 elements",
0779: foundMEBs.length >= 2);
0780: alist = Arrays.asList(foundMEBs);
0781: assertTrue("test 7: me1 is not in array", alist.contains(me1E));
0782: assertTrue("test 7: me2 is not in array", alist.contains(me2E));
0783: testTrace("test 7 passed");
0784:
0785: succeed();
0786: }
0787:
0788: /**
0789: * <pre>
0790: *
0791: *
0792: *
0793: *
0794: *
0795: *
0796: * Testcase Name: findByPrimaryKey(String)
0797: * Testcase Number: EMB138
0798: *
0799: * setup: create testInstance of MediaEntityLocalHome
0800: * create Media entity me1
0801: * test procedure:
0802: * 1.call findByPrimaryKey(null)
0803: * expected result: NullPointerException
0804: *
0805: * 2.call findByPrimaryKey(random String)
0806: * expected result: javax.ejb.FinderException
0807: *
0808: * 3.call findByPrimaryKey(pk of me1)
0809: * expected result: me1
0810: *
0811: *
0812: *
0813: *
0814: *
0815: *
0816: * </pre>
0817: */
0818: public void testEMB138() throws CreateException, MediaException,
0819: RemoteException, NamingException, FinderException {
0820:
0821: int exception = -1;
0822: //
0823: // test 1
0824: //
0825: try {
0826: exception = mebTester.findByPKExceptions(null);
0827: } catch (Throwable e) {
0828: fail("test 1 threw " + e.toString());
0829: }
0830: // TODO : EMB 138 : JOnAS finbyprimarykey(null) not throw a NPE
0831: // assertEquals("test 1: Should throw a NullPointerException",
0832: // MediaEntityLocalTestDriver.NULLPOINTER, exception);
0833: testTrace("test 1 passed");
0834: //
0835: // test 2
0836: //
0837: try {
0838: exception = mebTester.findByPKExceptions(EMBStaticHelper
0839: .createRandomString(EMBStaticHelper
0840: .randomInt(0, 10)));
0841: } catch (Throwable e) {
0842: fail("test 2 threw " + e.toString());
0843: }
0844: assertEquals("test 2: Should throw a FinderException",
0845: MediaEntityLocalTestDriver.FINDER, exception);
0846: testTrace("test 2 passed");
0847: //
0848: // test 3
0849: //
0850: String testMedia = mebTester.createMediaEntityBean();
0851: assertEquals("test 3: incorrect media entity found", testMedia,
0852: mebTester.findMEBByPrimaryKey(testMedia));
0853: testTrace("test 3 passed");
0854:
0855: succeed();
0856: }
0857:
0858: /**
0859: * <pre>
0860: *
0861: *
0862: *
0863: *
0864: *
0865: *
0866: * Testcase Name: importMedia(URL[], String[])
0867: * Testcase Number: EMB139
0868: *
0869: * setup: create Media entity me1 from embedded media file
0870: * create Media entity me2 from nonembedded media file
0871: * location1 = me1.getLocation()
0872: * location2 = me2.getLocation()
0873: *
0874: * test procedure:
0875: * 1.call importMedia(null, valid names)
0876: * expected result: NullPointerException
0877: *
0878: * 2.call importMedia(new URL[]{location1, null}, valid names)
0879: * expected result: 2 element array with second being null
0880: *
0881: * 3.call importMedia(new URL[]{location1, location2}, valid names)
0882: * expected result: new entities created
0883: * verify children of me2 also created
0884: *
0885: * 4.call importMedia(new URL[]{location1, location1}, valid names)
0886: * expected result: 2 element array with both being same entity
0887: *
0888: * 5.call importMedia(new URL[0], new String[0])
0889: * expected result: empty array
0890: *
0891: * 6.call importMedia(new URL[]{location1}, null)
0892: * expected result: no exception, verify getName is not null
0893: *
0894: * 7.create Media entity me3 from corrupted bmp file
0895: * call importMedia(new URL[]{me3.getLocation}, valid name)
0896: * expected result: MediaFormatException
0897: *
0898: * 8.create URL pointing to nonexistent file
0899: * call importMedia(new URL[]{urlToNonexistentFile}, valid name)
0900: * expected result: ContentAccessException
0901: *
0902: * 9.call importMedia(new URL[]{location1}, invalid name)
0903: * expected result: IllegalArgumentException
0904: *
0905: * 10.call importMedia(new URL[] {location1}, new String[] {name1, name2})
0906: * expected result: IllegalArgumentException
0907: *
0908: * 11.call importMedia with URL pointing to file larger than maxMediaSize
0909: * expected result: ContentTooLargeException
0910: *
0911: *
0912: *
0913: *
0914: *
0915: *
0916: * </pre>
0917: */
0918: public void testEMB139() throws MediaException, CreateException,
0919: IOException, RemoteException, NamingException,
0920: FinderException, RemoveException {
0921:
0922: mebTester.bindMediaFormat("jpg", new JpegFormat());
0923: mebTester.bindMediaFormat("gpl", new GenericPlaylistFormat());
0924: mebTester.bindMediaFormat("test", new GenericMediaFormat());
0925:
0926: EmbeddedMediaLocationInfo me1ELocInfo = new EmbeddedMediaLocationInfo(
0927: embTestConfig.getJpgPictureName1());
0928: ComplexMediaLocationInfo me2NELocInfo = new ComplexMediaLocationInfo(
0929: ComplexMediaLocationInfo.MEDIAGPL1);
0930:
0931: String me1E = mebTester.createMediaEntityBean();
0932: String me2NE = mebTester.createMediaEntityBean();
0933:
0934: URL location1 = me1ELocInfo.getMediaURL();
0935: URL location2 = me2NELocInfo.getRootURL();
0936:
0937: int exception = -1;
0938: //
0939: // test 1
0940: //
0941: try {
0942: exception = mebTester.importHomeMediaExceptions(null,
0943: new String[] { "test.jpg" });
0944: } catch (Throwable e) {
0945: fail("test 1 threw " + e.toString());
0946: }
0947: assertEquals("test 1: Should throw a NullPointerException",
0948: MediaEntityLocalTestDriver.NULLPOINTER, exception);
0949: testTrace("test 1 passed");
0950: //
0951: // test 2
0952: //
0953: String[] importedMedia = mebTester.importHomeMediaEntityBeans(
0954: new URL[] { location1, null }, new String[] {
0955: "testPicture.jpg", "nullFile.jpg" });
0956: assertEquals("test 2: does not contain 2 elements",
0957: importedMedia.length, 2);
0958: assertTrue(
0959: "test 2: media content does not match",
0960: java.util.Arrays
0961: .equals(
0962: mebTester
0963: .getMediaEntityContent(importedMedia[0]),
0964: getByteArrayFromFile(me1ELocInfo
0965: .getMediaFile())));
0966: assertTrue(
0967: "test 2: format does not match",
0968: mebTester.getMediaEntityFormat(importedMedia[0]) instanceof JpegFormat);
0969: assertNull("test 2: second media entity is not null",
0970: importedMedia[1]);
0971: testTrace("test 2 passed");
0972:
0973: //
0974: // test 3
0975: //
0976: importedMedia = mebTester.importHomeMediaEntityBeans(new URL[] {
0977: location1, location2 }, new String[] {
0978: "testPicture.jpg", "testPlaylist.gpl" });
0979: assertEquals("test 3: does not contain 2 elements",
0980: importedMedia.length, 2);
0981: assertTrue(
0982: "test 3: embedded media does not match",
0983: java.util.Arrays
0984: .equals(
0985: mebTester
0986: .getMediaEntityContent(importedMedia[0]),
0987: getByteArrayFromFile(me1ELocInfo
0988: .getMediaFile())));
0989: assertTrue(
0990: "test 3: format does not match",
0991: mebTester.getMediaEntityFormat(importedMedia[0]) instanceof JpegFormat);
0992: assertTrue(
0993: "test 3: nonembedded media format is incorrect",
0994: mebTester.getMediaEntityFormat(importedMedia[1]) instanceof GenericPlaylistFormat);
0995: String[] importedChildren = mebTester
0996: .getMediaEntityChildren(importedMedia[1]);
0997: assertEquals("test 3: playlist does not have 3 children", 3,
0998: importedChildren.length);
0999: for (int i = 0; i < importedChildren.length; i++) {
1000: assertEquals(
1001: "test 3: parent is not testPlaylist",
1002: mebTester
1003: .getMediaEntityParents(importedChildren[i])[0],
1004: importedMedia[1]);
1005: }
1006: testTrace("test 3 passed");
1007:
1008: //
1009: // test 4
1010: //
1011: importedMedia = mebTester.importHomeMediaEntityBeans(new URL[] {
1012: location1, location1 }, new String[] {
1013: "testPicture1.jpg", "testPicture2.jpg" });
1014: assertEquals("test 4: does not contain 2 elements", 2,
1015: importedMedia.length);
1016: assertEquals("test 4: not same media entity", importedMedia[0],
1017: importedMedia[1]);
1018: testTrace("test 4 passed");
1019:
1020: //
1021: // test 5
1022: //
1023: importedMedia = mebTester.importHomeMediaEntityBeans(
1024: new URL[0], new String[0]);
1025: assertEquals("test 5: not empty array", 0, importedMedia.length);
1026: testTrace("test 5 passed");
1027:
1028: //
1029: // test 6
1030: //
1031: importedMedia = mebTester.importHomeMediaEntityBeans(
1032: new URL[] { location1 }, null);
1033: assertEquals("test 6: does not contain 1 element", 1,
1034: importedMedia.length);
1035: assertNotNull("test 6: name is null", mebTester
1036: .getMediaEntityName(importedMedia[0]));
1037: testTrace("test 6 passed");
1038:
1039: //
1040: // test 7
1041: //
1042: String mediaJpgFullPath = embTestConfig.getMediaDir()
1043: + File.separatorChar + "Generated" + File.separatorChar
1044: + "testMedia.jpg";
1045: FileOutputStream mediaJpgOutputStream = new FileOutputStream(
1046: mediaJpgFullPath);
1047: mediaJpgOutputStream.write(EMBStaticHelper
1048: .createRandomByteArray(1024));
1049: mediaJpgOutputStream.close();
1050:
1051: try {
1052: // remove c:
1053: // exception = mebTester.importHomeMediaExceptions(new URL[] {new
1054: // URL("file", embTestConfig.getTestClientIPAddress(), "/C:" +
1055: // mediaJpgFullPath)}, new String[] {"test.jpg"});
1056: exception = mebTester
1057: .importHomeMediaExceptions(new URL[] { new URL(
1058: "file", embTestConfig
1059: .getTestClientIPAddress(),
1060: mediaJpgFullPath) },
1061: new String[] { "test.jpg" });
1062: } catch (Throwable e) {
1063: fail("test 7 threw " + e.toString());
1064: }
1065: assertEquals("test 7: Should throw a MediaFormatException",
1066: MediaEntityLocalTestDriver.MEDIAFORMAT, exception);
1067: testTrace("test 7 passed");
1068:
1069: //
1070: // test 8
1071: //
1072: EmbeddedMediaLocationInfo me4ELocInfo = new EmbeddedMediaLocationInfo(
1073: "nonexistentFile.jpg");
1074:
1075: try {
1076: exception = mebTester.importHomeMediaExceptions(
1077: new URL[] { me4ELocInfo.getMediaURL() },
1078: new String[] { "nonexistentFile.jpg" });
1079: } catch (Throwable e) {
1080: fail("test 8 threw " + e.toString());
1081: }
1082: assertEquals("test 8: Should throw a ContentAccessException",
1083: MediaEntityLocalTestDriver.CONTENTACCESS, exception);
1084: testTrace("test 8 passed");
1085: //
1086: // test 9
1087: //
1088: try {
1089: exception = mebTester.importHomeMediaExceptions(
1090: new URL[] { me1ELocInfo.getMediaURL() },
1091: new String[] { "?test?.jpg" });
1092: } catch (Throwable e) {
1093: fail("test 9 threw " + e.toString());
1094: }
1095: assertEquals(
1096: "test 9: Should throw an IllegalArgumentException",
1097: MediaEntityLocalTestDriver.ILLEGALARGUMENT, exception);
1098: testTrace("test 9 passed");
1099: //
1100: // test 10
1101: //
1102: try {
1103: exception = mebTester.importHomeMediaExceptions(
1104: new URL[] { me1ELocInfo.getMediaURL() },
1105: new String[] { "testName1.jpg", "testName2.jpg" });
1106: } catch (Throwable e) {
1107: fail("test 10 threw " + e.toString());
1108: }
1109: assertEquals(
1110: "test 10: Should throw an IllegalArgumentException",
1111: MediaEntityLocalTestDriver.ILLEGALARGUMENT, exception);
1112: testTrace("test 10 passed");
1113: //
1114: // test 11
1115: //
1116: if (embTestConfig.getIncludeLongRunningTest()) {
1117: String largeFilePath = embTestConfig.getMediaDir()
1118: + File.separatorChar + "Generated"
1119: + File.separatorChar + "largeFile.test";
1120: File largeFile = new File(largeFilePath);
1121: largeFile.createNewFile();
1122: FileOutputStream largeFileOutputStream = new FileOutputStream(
1123: largeFile);
1124: // create byte array 1 byte larger than maxMediaSize
1125: byte[] testArray = EMBStaticHelper
1126: .createRandomByteArray(Integer
1127: .parseInt(embTestConfig.getMaxMediaSize()) + 1);
1128: largeFileOutputStream.write(testArray);
1129: largeFileOutputStream.close();
1130: URL location = new URL("file", embTestConfig
1131: .getTestClientIPAddress(), largeFilePath);
1132: try {
1133: exception = mebTester.importHomeMediaExceptions(
1134: new URL[] { location },
1135: new String[] { "largeFileMeda.test" });
1136: } catch (Throwable e) {
1137: fail("test 11 threw " + e.toString());
1138: }
1139: assertEquals(
1140: "test 11: Should throw a ContentTooLargeException",
1141: MediaEntityLocalTestDriver.CONTENTTOOLARGE,
1142: exception);
1143: testTrace("test 11 passed");
1144: largeFile.delete();
1145: }
1146:
1147: succeed();
1148: }
1149:
1150: /**
1151: * <pre>
1152: *
1153: *
1154: *
1155: *
1156: *
1157: *
1158: * Testcase Name: publishContent(Media, String, ProtocolConstraints)
1159: * Testcase Number: EMB140
1160: *
1161: * setup: create Media object from embedded media file
1162: * create Media entity from embedded media file
1163: * create constraints with "SERVER_TYPE" set to array of Strings
1164: *
1165: * test procedure:
1166: * 1.a.call publishContent(null, "TRANSFER_TYPE_BURST", constraints)
1167: * expected result: if web server present, NullPointerException
1168: * else NoServerFoundException
1169: * b.call publishContent(null, "TRANSFER_TYPE_STREAM", constraints)
1170: * expected result: if stream server present, NullPointerException
1171: * else NoServerFoundException
1172: *
1173: * 2.call publishContent(mediaObject, invalidTransferType, constraints)
1174: * expected result: IllegalArgumentException
1175: *
1176: * 3.a.call publishContent(mediaObject, "TRANSFER_TYPE_BURST", constraints)
1177: * expected result: if web server present, URL pointing to media object on server
1178: * else NoServerFoundException
1179: * b.call publishContent(mediaObject, "TRANSFER_TYPE_STREAM", constraints)
1180: * expected result: if stream server present, URL pointing to media object on server
1181: * else NoServerFoundException
1182: *
1183: * 4.a.call publishContent(mediaObject, "TRANSFER_TYPE_BURST", null)
1184: * expected result: if web server present, URL pointing to media object on server
1185: * else NoServerFoundException
1186: * b.call publishContent(mediaObject, "TRANSFER_TYPE_STREAM", null)
1187: * expected result: if stream server present, URL pointing to media object on server
1188: * else NoServerFoundException
1189: *
1190: * 5.create Media entity from nonexistent file
1191: * a.call publishContent(nonexistentMediaEntity, "TRANSFER_TYPE_BURST", constraints)
1192: * expected result: if web server present, ContentAccessException
1193: * else NoServerFoundException
1194: * b.call publishContent(nonexistentMediaEntity, "TRANSFER_TYPE_STREAM", constraints
1195: * expected result: if stream server present, ContentAccessException
1196: * else NoServerFoundException
1197: *
1198: * 6.call publishContent(mediaEntity, invalidTransferType, constraints)
1199: * expected result: IllegalArgumentException
1200: *
1201: * 7.a.call publishContent(mediaEntity, "TRANSFER_TYPE_BURST", constraints)
1202: * expected result: if web server present, URL pointing to media object on server
1203: * else NoServerFoundException
1204: * b.call publishContent(mediaEntity, "TRANSFER_TYPE_STREAM", constraints)
1205: * expected result: if stream server present, URL pointing to media object on server
1206: * else NoServerFoundException
1207: *
1208: * 8.a.call publishContent(mediaEntity, "TRANSFER_TYPE_BURST", null)
1209: * expected result: if web server present, URL pointing to media object on server
1210: * else NoServerFoundException
1211: * b.call publishContent(mediaEntity, "TRANSFER_TYPE_STREAM", null)
1212: * expected result: if stream server present, URL pointing to media object on server
1213: * else NoServerFoundException
1214: *
1215: * 9.a.call publishContent(nonembeddedMediaBean, "TRANSFER_TYPE_BURST", constraints)
1216: * expected result: if web server present, ContentAccessException
1217: * else NoServerFoundException
1218: * b.call publishContent(nonembeddedMediaBean, "TRANSFER_TYPE_STREAM", constraints)
1219: * expected result: if web server present, ContentAccessException
1220: * else NoServerFoundException
1221: *
1222: * 10.a.call publishContent(nonembeddedMediaEntityBean, "TRANSFER_TYPE_BURST", constraints)
1223: * expected result: if web server present, ContentAccessException
1224: * else NoServerFoundException
1225: * b.call publishContent(nonembeddedMediaEntityBean, "TRANSFER_TYPE_STREAM", constraints)
1226: * expected result: if web server present, ContentAccessException
1227: * else NoServerFoundException
1228: *
1229: *
1230: *
1231: *
1232: *
1233: *
1234: * </pre>
1235: */
1236: public void testEMB140() throws MediaException, NamingException,
1237: IOException, CreateException, FinderException {
1238:
1239: mebTester.bindMediaFormat("jpg", new JpegFormat());
1240: mebTester.bindMediaFormat("test", new GenericMediaFormat());
1241: mebTester.bindMediaFormat("gpl", new GenericPlaylistFormat());
1242:
1243: String mediaJpgFullPath = embTestConfig.getMediaDir()
1244: + File.separatorChar
1245: + embTestConfig.getJpgPictureName1();
1246:
1247: MediaBean mediaBean = new MediaBean(new File(mediaJpgFullPath),
1248: "image/jpg");
1249: String mediaEntity = mebTester.createMediaEntityBean();
1250: mebTester.setMediaEntityName(mediaEntity, "test.jpg");
1251: mebTester.setMediaEntityContent(mediaEntity, new File(
1252: mediaJpgFullPath));
1253:
1254: String streamServerTypes = embTestConfig.getStreamServerTypes();
1255: StringTokenizer st = new StringTokenizer(streamServerTypes, ";");
1256: String[] serverTypesArray = new String[st.countTokens()];
1257: for (int i = 0; i < st.countTokens(); i++) {
1258: serverTypesArray[i] = st.nextToken();
1259: }
1260:
1261: ProtocolConstraints constraints = new ProtocolConstraints();
1262: constraints.setConstraint("SERVER_TYPE", serverTypesArray);
1263:
1264: byte burstTransfer = MediaEntityLocalHome.TRANSFER_TYPE_BURST;
1265: byte streamTransfer = MediaEntityLocalHome.TRANSFER_TYPE_STREAM;
1266: URL mediaLoc = null;
1267: int exception = -1;
1268: //
1269: // test 1a
1270: //
1271: MediaBean nullMediaBean = null;
1272: try {
1273: exception = mebTester.publishContentExceptions(
1274: nullMediaBean, burstTransfer, constraints);
1275: } catch (Throwable e) {
1276: fail("test 1a threw " + e.toString());
1277: }
1278: assertTrue(
1279: "test 1a: Should throw a NullPointerException or NoServerFoundException",
1280: (exception == MediaEntityLocalTestDriver.NULLPOINTER)
1281: || (exception == MediaEntityLocalTestDriver.NOSERVERFOUND));
1282: testTrace("test 1a passed");
1283: //
1284: // test 1b
1285: //
1286: try {
1287: exception = mebTester.publishContentExceptions(
1288: nullMediaBean, streamTransfer, constraints);
1289: } catch (Throwable e) {
1290: fail("test 1b threw " + e.toString());
1291: }
1292: assertTrue(
1293: "test 1b: Should throw a NullPointerException or NoServerFoundException",
1294: (exception == MediaEntityLocalTestDriver.NULLPOINTER)
1295: || (exception == MediaEntityLocalTestDriver.NOSERVERFOUND));
1296: testTrace("test 1b passed");
1297: //
1298: // test 2
1299: //
1300: byte invalidTransferType = -1;
1301: try {
1302: exception = mebTester.publishContentExceptions(mediaBean,
1303: invalidTransferType, constraints);
1304: } catch (Throwable e) {
1305: fail("test 2 threw " + e.toString());
1306: }
1307: assertTrue(
1308: "test 2: Should throw an IllegalArgumentException or NoServerFoundException",
1309: (exception == MediaEntityLocalTestDriver.ILLEGALARGUMENT)
1310: || (exception == MediaEntityLocalTestDriver.NOSERVERFOUND));
1311: testTrace("test 2 passed");
1312: //
1313: // test 3a
1314: //
1315: try {
1316: mediaLoc = mebTester.publishMediaContent(mediaBean,
1317: burstTransfer, constraints);
1318: System.out.println("media location: "
1319: + mediaLoc.toExternalForm());
1320: assertNotNull("test 3a: media location is null", mediaLoc);
1321: testTrace("test 3a passed");
1322: } catch (NoServerFoundException e) {
1323: testTrace("test 3a skipped: no server found");
1324: } catch (Exception e) {
1325: fail("test 3a threw " + e.toString());
1326: }
1327: //
1328: // test 3b
1329: //
1330: try {
1331: mediaLoc = mebTester.publishMediaContent(mediaBean,
1332: streamTransfer, constraints);
1333: System.out.println("media location: " + mediaLoc);
1334: assertNotNull("test 3b: media location is null", mediaLoc);
1335: testTrace("test 3b passed");
1336: } catch (NoServerFoundException e) {
1337: testTrace("test 3b skipped: no server found");
1338: } catch (Exception e) {
1339: fail("test 3b threw " + e.toString());
1340: }
1341: //
1342: // test 4a
1343: //
1344: try {
1345: mediaLoc = mebTester.publishMediaContent(mediaBean,
1346: burstTransfer, null);
1347: System.out.println("media location: "
1348: + mediaLoc.toExternalForm());
1349: assertNotNull("test 4a: media location is null", mediaLoc);
1350: testTrace("test 4a passed");
1351: } catch (NoServerFoundException e) {
1352: testTrace("test 4a skipped: no server found");
1353: } catch (Exception e) {
1354: fail("test 4a threw " + e.toString());
1355: }
1356: //
1357: // test 4b
1358: //
1359: try {
1360: mediaLoc = mebTester.publishMediaContent(mediaBean,
1361: streamTransfer, null);
1362: System.out.println("media location: "
1363: + mediaLoc.toExternalForm());
1364: assertNotNull("test 4b: media location is null", mediaLoc);
1365: testTrace("test 4b passed");
1366: } catch (NoServerFoundException e) {
1367: testTrace("test 4b skipped: no server found");
1368: } catch (Exception e) {
1369: fail("test 4b threw " + e.toString());
1370: }
1371: //
1372: // test 5a
1373: //
1374: String tmpMediaEntity = mebTester.createMediaEntityBean();
1375: mebTester.setMediaEntityName(tmpMediaEntity, "testFile.test");
1376: try {
1377: exception = mebTester.publishContentExceptions(
1378: tmpMediaEntity, burstTransfer, constraints);
1379: } catch (Throwable e) {
1380: fail("test 5a threw " + e.toString());
1381: }
1382: assertTrue(
1383: "test 5a: Should throw a ContentAccessException or NoServerFoundException",
1384: (exception == MediaEntityLocalTestDriver.CONTENTACCESS)
1385: || (exception == MediaEntityLocalTestDriver.NOSERVERFOUND));
1386: testTrace("test 5a passed");
1387: //
1388: // test 5b
1389: //
1390: try {
1391: exception = mebTester.publishContentExceptions(
1392: tmpMediaEntity, streamTransfer, constraints);
1393: } catch (Throwable e) {
1394: fail("test 5b threw " + e.toString());
1395: }
1396: assertTrue(
1397: "test 5b: Should throw a ContentAccessException or NoServerFoundException",
1398: (exception == MediaEntityLocalTestDriver.CONTENTACCESS)
1399: || (exception == MediaEntityLocalTestDriver.NOSERVERFOUND));
1400: testTrace("test 5b passed");
1401: //
1402: // test 6
1403: //
1404: try {
1405: exception = mebTester.publishContentExceptions(mediaEntity,
1406: invalidTransferType, constraints);
1407: } catch (Throwable e) {
1408: fail("test 6 threw " + e.toString());
1409: }
1410: assertTrue(
1411: "test 6: Should throw a IllegalArgumentException or NoServerFoundException",
1412: (exception == MediaEntityLocalTestDriver.ILLEGALARGUMENT)
1413: || (exception == MediaEntityLocalTestDriver.NOSERVERFOUND));
1414: testTrace("test 6 passed");
1415: //
1416: // test 7a
1417: //
1418: try {
1419: mediaLoc = mebTester.publishMediaContent(mediaEntity,
1420: burstTransfer, constraints);
1421: assertNotNull("test 7a: media location is null", mediaLoc);
1422: testTrace("test 7a passed");
1423: } catch (NoServerFoundException e) {
1424: testTrace("test 7a skipped: no server found");
1425: } catch (Exception e) {
1426: fail("test 7a threw " + e.toString());
1427: }
1428: //
1429: // test 7b
1430: //
1431: try {
1432: mediaLoc = mebTester.publishMediaContent(mediaEntity,
1433: streamTransfer, constraints);
1434: assertNotNull("test 7b: media location is null", mediaLoc);
1435: testTrace("test 7b passed");
1436: } catch (NoServerFoundException e) {
1437: testTrace("test 7b skipped: no server found");
1438: } catch (Exception e) {
1439: fail("test 7b threw " + e.toString());
1440: }
1441: //
1442: // test 8a
1443: //
1444: try {
1445: mediaLoc = mebTester.publishMediaContent(mediaEntity,
1446: burstTransfer, null);
1447: assertNotNull("test 8a: media location is null", mediaLoc);
1448: testTrace("test 8a passed");
1449: } catch (NoServerFoundException e) {
1450: testTrace("test 8a skipped: no server found");
1451: } catch (Exception e) {
1452: fail("test 8a threw " + e.toString());
1453: }
1454: //
1455: // test 8b
1456: //
1457: try {
1458: mediaLoc = mebTester.publishMediaContent(mediaEntity,
1459: streamTransfer, null);
1460: assertNotNull("test 8b: media location is null", mediaLoc);
1461: testTrace("test 8b passed");
1462: } catch (NoServerFoundException e) {
1463: testTrace("test 8b skipped: no server found");
1464: } catch (Exception e) {
1465: fail("test 8b threw " + e.toString());
1466: }
1467: //
1468: // test 9a
1469: //
1470: ComplexMediaLocationInfo me1NE = new ComplexMediaLocationInfo(
1471: ComplexMediaLocationInfo.MEDIAGPL1);
1472: MediaBean nonEmbeddedMedia = new MediaBean(me1NE.getRootFile(),
1473: "test");
1474: try {
1475: exception = mebTester.publishContentExceptions(
1476: nonEmbeddedMedia, burstTransfer, constraints);
1477: } catch (Throwable e) {
1478: fail("test 9a threw " + e.toString());
1479: }
1480: assertTrue(
1481: "test 9a: Should throw a ContentAccessException",
1482: MediaEntityLocalTestDriver.CONTENTACCESS == exception
1483: || MediaEntityLocalTestDriver.NOSERVERFOUND == exception);
1484: testTrace("test 9a passed");
1485: //
1486: // test 9b
1487: //
1488: try {
1489: exception = mebTester.publishContentExceptions(
1490: nonEmbeddedMedia, streamTransfer, constraints);
1491: } catch (Throwable e) {
1492: fail("test 9b threw " + e.toString());
1493: }
1494: assertTrue(
1495: "test 9b: Should throw a ContentAccessException",
1496: MediaEntityLocalTestDriver.CONTENTACCESS == exception
1497: || MediaEntityLocalTestDriver.NOSERVERFOUND == exception);
1498: testTrace("test 9b passed");
1499:
1500: //
1501: // test 10a
1502: //
1503: String nonEmbeddedMediaEntity = mebTester
1504: .createMediaEntityBean();
1505: mebTester.setMediaEntityName(nonEmbeddedMediaEntity,
1506: "testPlaylist.gpl");
1507: mebTester.importMediaEntityContent(nonEmbeddedMediaEntity,
1508: me1NE.getRootURL(), null);
1509: try {
1510: mebTester.publishMediaContent(nonEmbeddedMediaEntity,
1511: burstTransfer, constraints);
1512: testTrace("test 10a passed");
1513: } catch (Throwable e) {
1514: fail("test 10a threw " + e.toString());
1515: }
1516: try {
1517: mebTester.publishMediaContent(nonEmbeddedMediaEntity,
1518: streamTransfer, constraints);
1519: testTrace("test 10b passed");
1520: } catch (Throwable e) {
1521: fail("test 10b threw " + e.toString());
1522: }
1523:
1524: succeed();
1525: }
1526:
1527: /**
1528: * <pre>
1529: *
1530: *
1531: *
1532: *
1533: *
1534: *
1535: * Testcase Name: publishMedia(MediaEntityLocal[], String, ProtocolConstraints)
1536: * Testcase Number: EMB141
1537: *
1538: * setup: create Media entity from embedded media file
1539: * create constraints with "SERVER_TYPE" set to array of Strings
1540: *
1541: * test procedure:
1542: * 1.a.call publishMedia(null, "TRANSFER_TYPE_BURST", constraints)
1543: * expected result: if web server present, NullPointerException
1544: * else NoServerFoundException
1545: * b.call publishMedia(null, "TRANSFER_TYPE_STREAM", constraints)
1546: * expected result: if stream server present, NullPointerException
1547: * else NoServerFoundException
1548: *
1549: * 2.call publishMedia(new MediaEntityLocal[]{mediaEntity}, invalidTransferType, constraints)
1550: * expected result: IllegalArgumentException
1551: *
1552: * 3.a.call publishMedia(new MediaEntityLocal[]{mediaEntity}, "TRANSFER_TYPE_BURST", constraints)
1553: * expected result: if web server present, media object that is not null
1554: * else NoServerFoundException
1555: * b.call publishMedia(new MediaEntityLocal[]{mediaEntity}. "TRANSFER_TYPE_BURST", constraints)
1556: * expected result: if stream server present, media object that is not null
1557: * else NoServerFoundException
1558: *
1559: * 4.a.call publishMedia(new MediaEntityLocal[]{mediaEntity}, "TRANSFER_TYPE_BURST", null)
1560: * expected result: if web server present, media object that is not null
1561: * else NoServerFoundException
1562: * b.call publishMedia(new MediaEntityLocal[]{mediaEntity}. "TRANSFER_TYPE_BURST", null)
1563: * expected result: if stream server present, media object that is not null
1564: * else NoServerFoundException
1565: *
1566: * 5.create Media entity from random content file
1567: * a.call publishMedia(new MediaEntityLocal[]{mediaEntity}, "TRANSFER_TYPE_BURST", constraints)
1568: * expected result: if web server present, MediaFormatException
1569: * else NoServerFoundException
1570: * b.call publishMedia(new MediaEntityLocal[]{mediaEntity}. "TRANSFER_TYPE_BURST", constraints)
1571: * expected result: if stream server present, MediaFormatException
1572: * else NoServerFoundException
1573: *
1574: * 6.create Media entity from nonexistent file
1575: * a.call publishMedia(new MediaEntityLocal[]{mediaEntity}, "TRANSFER_TYPE_BURST", constraints)
1576: * expected result: if web server present, ContentAccessException
1577: * else NoServerFoundException
1578: * b.call publishMedia(new MediaEntityLocal[]{mediaEntity}. "TRANSFER_TYPE_BURST", constraints)
1579: * expected result: if stream server present, ContentAccessException
1580: * else NoServerFoundException
1581: *
1582: * 7.a.call publishMedia(new MediaEntityLocal[0], "TRANSFER_TYPE_BURST", constraints)
1583: * expected result: if web server present, no exception (check media obj not null)
1584: * else NoServerFoundException
1585: * b.call publishMedia(new MediaEntityLocal[0], "TRANSFER_TYPE_STREAM", constraints)
1586: * expected result: if web server present, no exception (check media obj not null)
1587: * else NoServerFoundException
1588: *
1589: * 8.a.call publishMedia(new MediaEntityLocal[]{mediaEntity, mediaEntity}, "TRANSFER_TYPE_BURST", constraints)
1590: * expected result: if web server present, media object not null
1591: * else NoServerFoundException
1592: * b.call publishMedia(new MediaEntityLocal[]{mediaEntity, mediaEntity}, "TRANSFER_TYPE_STREAM", constraints)
1593: * expected result: if web server present, media object not null
1594: * else NoServerFoundException
1595: *
1596: *
1597: *
1598: *
1599: *
1600: *
1601: * </pre>
1602: */
1603: public void testEMB141() throws MediaException, NamingException,
1604: IOException, CreateException, FinderException {
1605:
1606: mebTester.bindMediaFormat("jpg", new JpegFormat());
1607: mebTester.bindMediaFormat("test", new GenericMediaFormat());
1608:
1609: EmbeddedMediaLocationInfo me1LocInfo = new EmbeddedMediaLocationInfo(
1610: embTestConfig.getJpgPictureName1());
1611: String me1 = mebTester.createMediaEntityBean();
1612: mebTester.setMediaEntityName(me1, me1LocInfo.getMediaName());
1613: mebTester.setMediaEntityContent(me1, me1LocInfo.getMediaFile());
1614:
1615: String streamServerTypes = embTestConfig.getStreamServerTypes();
1616: StringTokenizer st = new StringTokenizer(streamServerTypes, ";");
1617: String[] serverTypesArray = new String[st.countTokens()];
1618: for (int i = 0; i < st.countTokens(); i++) {
1619: serverTypesArray[i] = st.nextToken();
1620: }
1621:
1622: ProtocolConstraints constraints = new ProtocolConstraints();
1623: constraints.setConstraint("SERVER_TYPE", serverTypesArray);
1624: byte burstTransfer = MediaEntityLocalHome.TRANSFER_TYPE_BURST;
1625: byte streamTransfer = MediaEntityLocalHome.TRANSFER_TYPE_STREAM;
1626: Media mediaObject = null;
1627:
1628: int exception = -1;
1629: //
1630: // test 1a
1631: //
1632: try {
1633: exception = mebTester.publishMediaExceptions(null,
1634: burstTransfer, constraints);
1635: } catch (Throwable e) {
1636: fail("test 1a threw " + e.toString());
1637: }
1638: assertTrue(
1639: "test 1a: Should throw a NullPointerException or NoServerFoundException",
1640: (exception == MediaEntityLocalTestDriver.NULLPOINTER)
1641: || (exception == MediaEntityLocalTestDriver.NOSERVERFOUND));
1642: testTrace("test 1a passed");
1643: //
1644: // test 1b
1645: //
1646: try {
1647: exception = mebTester.publishMediaExceptions(null,
1648: streamTransfer, constraints);
1649: } catch (Throwable e) {
1650: fail("test 1b threw " + e.toString());
1651: }
1652: assertTrue(
1653: "test 1b: Should throw a NullPointerException or NoServerFoundException",
1654: (exception == MediaEntityLocalTestDriver.NULLPOINTER)
1655: || (exception == MediaEntityLocalTestDriver.NOSERVERFOUND));
1656: testTrace("test 1b passed");
1657: //
1658: // test 2
1659: //
1660: byte invalidTransferType = -1;
1661: try {
1662: exception = mebTester.publishMediaExceptions(
1663: new String[] { me1 }, invalidTransferType,
1664: constraints);
1665: } catch (Throwable e) {
1666: fail("test 2 threw " + e.toString());
1667: }
1668: assertTrue(
1669: "test 2: Should throw an IllegalArgumentException or NoServerFoundException",
1670: (exception == MediaEntityLocalTestDriver.ILLEGALARGUMENT)
1671: || (exception == MediaEntityLocalTestDriver.NOSERVERFOUND));
1672: testTrace("test 2 passed");
1673: //
1674: // test 3a
1675: //
1676: try {
1677: mediaObject = mebTester.publishMediaEntityBeans(
1678: new String[] { me1 }, burstTransfer, constraints);
1679: assertNotNull("test 3a: media object null", mediaObject);
1680: testTrace("test 3a passed");
1681: } catch (NoServerFoundException e) {
1682: testTrace("test 3a skipped: no server found");
1683: } catch (Exception e) {
1684: fail("test 3a threw " + e.toString());
1685: }
1686: //
1687: // test 3b
1688: //
1689: try {
1690: mediaObject = mebTester.publishMediaEntityBeans(
1691: new String[] { me1 }, streamTransfer, constraints);
1692: assertNotNull("test 3b: media object null", mediaObject);
1693: testTrace("test 3b passed");
1694: } catch (NoServerFoundException e) {
1695: testTrace("test 3b skipped: no server found");
1696: } catch (Exception e) {
1697: fail("test 3b threw " + e.toString());
1698: }
1699: //
1700: // test 4a
1701: //
1702: try {
1703: mediaObject = mebTester.publishMediaEntityBeans(
1704: new String[] { me1 }, burstTransfer, null);
1705: assertNotNull("test 4a: media object null", mediaObject);
1706: testTrace("test 4a passed");
1707: } catch (NoServerFoundException e) {
1708: testTrace("test 4a skipped: no server found");
1709: } catch (Exception e) {
1710: fail("test 4a threw " + e.toString());
1711: }
1712: //
1713: // test 4b
1714: //
1715: try {
1716: mediaObject = mebTester.publishMediaEntityBeans(
1717: new String[] { me1 }, streamTransfer, null);
1718: assertNotNull("test 4b: media object null", mediaObject);
1719: testTrace("test 4b passed");
1720: } catch (NoServerFoundException e) {
1721: testTrace("test 4b skipped: no server found");
1722: } catch (Exception e) {
1723: fail("test 4b threw " + e.toString());
1724: }
1725: //
1726: // test 5a
1727: //
1728: File file1024Byte = new File(embTestConfig.getMediaDir()
1729: + File.separatorChar + "Generated" + File.separatorChar
1730: + "testMedia.test");
1731: file1024Byte.createNewFile();
1732: FileOutputStream file1024ByteOutputStream = new FileOutputStream(
1733: file1024Byte);
1734: byte[] testArray = EMBStaticHelper.createRandomByteArray(1024);
1735: file1024ByteOutputStream.write(testArray);
1736: file1024ByteOutputStream.close();
1737:
1738: String me2 = mebTester.createMediaEntityBean();
1739: mebTester.setMediaEntityName(me2, "test.test");
1740: mebTester.setMediaEntityContent(me2, file1024Byte);
1741: mebTester.setMediaEntityName(me2, "test.gpl");
1742:
1743: try {
1744: exception = mebTester.publishMediaExceptions(
1745: new String[] { me2 }, burstTransfer, constraints);
1746: } catch (Throwable e) {
1747: fail("test 5a threw " + e.toString());
1748: }
1749: assertTrue(
1750: "test 5a: Should throw a MediaFormatException or NoServerFoundException",
1751: (exception == MediaEntityLocalTestDriver.MEDIAFORMAT)
1752: || (exception == MediaEntityLocalTestDriver.NOSERVERFOUND));
1753: testTrace("test 5a passed");
1754: //
1755: // test 5b
1756: //
1757: try {
1758: exception = mebTester.publishMediaExceptions(
1759: new String[] { me2 }, streamTransfer, constraints);
1760: } catch (Throwable e) {
1761: fail("test 5b threw " + e.toString());
1762: }
1763: assertTrue(
1764: "test 5b: Should throw a MediaFormatException or NoServerFoundException",
1765: exception == MediaEntityLocalTestDriver.MEDIAFORMAT
1766: || exception == MediaEntityLocalTestDriver.NOSERVERFOUND);
1767: testTrace("test 5b passed");
1768: //
1769: // test 6a
1770: //
1771: String me3 = mebTester.createMediaEntityBean();
1772: mebTester.setMediaEntityName(me3, "testFile.test");
1773: try {
1774: exception = mebTester.publishMediaExceptions(
1775: new String[] { me3 }, burstTransfer, constraints);
1776: } catch (Throwable e) {
1777: fail("test 6a threw " + e.toString());
1778: }
1779: assertTrue(
1780: "test 6a: Should throw a ContentAccessException or NoServerFoundException",
1781: exception == MediaEntityLocalTestDriver.CONTENTACCESS
1782: || exception == MediaEntityLocalTestDriver.NOSERVERFOUND);
1783: testTrace("test 6a passed");
1784: //
1785: // test 6b
1786: //
1787: try {
1788: exception = mebTester.publishMediaExceptions(
1789: new String[] { me3 }, streamTransfer, constraints);
1790: } catch (Throwable e) {
1791: fail("test 6b threw " + e.toString());
1792: }
1793: assertTrue(
1794: "test 6b: Should throw a ContentAccessException or NoServerFoundException",
1795: exception == MediaEntityLocalTestDriver.CONTENTACCESS
1796: || exception == MediaEntityLocalTestDriver.NOSERVERFOUND);
1797: testTrace("test 6b passed");
1798: //
1799: // test 7a
1800: //
1801: try {
1802: mediaObject = mebTester.publishMediaEntityBeans(
1803: new String[0], burstTransfer, constraints);
1804: assertNotNull("test 7a: media object null", mediaObject);
1805: testTrace("test 7a passed");
1806: } catch (NoServerFoundException e) {
1807: testTrace("test 7a skipped: no server found");
1808: } catch (Exception e) {
1809: fail("test 7a threw " + e.toString());
1810: }
1811: //
1812: // test 7b
1813: //
1814: try {
1815: mediaObject = mebTester.publishMediaEntityBeans(
1816: new String[0], streamTransfer, constraints);
1817: assertNotNull("test 7b: media object null", mediaObject);
1818: testTrace("test 7b passed");
1819: } catch (NoServerFoundException e) {
1820: testTrace("test 7b skipped: no server found");
1821: } catch (Exception e) {
1822: fail("test 7b threw " + e.toString());
1823: }
1824: //
1825: // test 8a
1826: //
1827: try {
1828: mediaObject = mebTester.publishMediaEntityBeans(
1829: new String[] { me1, me1 }, burstTransfer,
1830: constraints);
1831: assertNotNull("test 8a: media object null", mediaObject);
1832: testTrace("test 8a passed");
1833: } catch (NoServerFoundException e) {
1834: testTrace("test 8a skipped: no server found");
1835: } catch (Exception e) {
1836: fail("test 8a threw " + e.toString());
1837: }
1838: //
1839: // test 8b
1840: //
1841: try {
1842: mediaObject = mebTester.publishMediaEntityBeans(
1843: new String[] { me1, me1 }, streamTransfer,
1844: constraints);
1845: assertNotNull("test 8b: media object null", mediaObject);
1846: testTrace("test 8b passed");
1847: } catch (NoServerFoundException e) {
1848: testTrace("test 8b skipped: no server found");
1849: } catch (Exception e) {
1850: fail("test 8b threw " + e.toString());
1851: }
1852:
1853: succeed();
1854: }
1855: }
|