Author: ygrego Date: 2015-03-24 17:01:23 +0000 (Tue, 24 Mar 2015) New Revision: 967 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/967 Log: -New implementation of methods "testCreateX where X equals to one of object present in oipf object factory(eg. VideoBroadcastObject, SearchManagerObject). Each method is binded on method "testobjectCreated". -New methods delared as "testIsXSupported" where X equals to one of object present in oipf object factory. And these one are bound to method "testObjectSupported". All bindings are performed in constructor "init". Modified: oipf/js/test/OipfFactoryTest.js Modified: oipf/js/test/OipfFactoryTest.js =================================================================== --- oipf/js/test/OipfFactoryTest.js 2015-03-24 12:14:41 UTC (rev 966) +++ oipf/js/test/OipfFactoryTest.js 2015-03-24 17:01:23 UTC (rev 967) @@ -5,119 +5,65 @@ */ var OipfFactoryTest = TestCase.extend({ - - oipfObjectFactory: null, - init: function() { - this.oipfObjectFactory = new OipfObjectFactory(); + this.testIsApplicationManagerObjectSupported = this.testObjectSupported.bind(this, APPLICATION_MANAGER_DAE_MIME_TYPE); + this.testIsCapabilitiesObjectSupported = this.testObjectSupported.bind(this, CAPABILITIES_DAE_MIME_TYPE); + this.testIsChannelConfigSupported = this.testObjectSupported.bind(this, CHANNEL_CONFIG_TYPE); + this.testIsCodManagerObjectSupported = this.testObjectSupported.bind(this, COD_MANAGER_DAE_MIME_TYPE); + this.testIsIMSObjectSupported = this.testObjectSupported.bind(this, COMMUNICATION_SERVICES_DAE_MIME_TYPE); + this.testIsConfigurationObjectSupported = this.testObjectSupported.bind(this, CONFIGURATION_DAE_MIME_TYPE); + this.testIsDownloadManagerObjectSupported = this.testObjectSupported.bind(this, DOWNLOAD_MANAGER_DAE_MIME_TYPE); + this.testIsDownloadTriggerObjectSupported = this.testObjectSupported.bind(this, DOWNLOAD_TRIGGER_DAE_MIME_TYPE); + this.testIsDrmAgentObjectSupported = this.testObjectSupported.bind(this, DRM_AGENT_DAE_MIME_TYPE); + this.testIsGatewayInfoObjectSupported = this.testObjectSupported.bind(this, GATEWAY_INFO_DAE_MIME_TYPE); + this.testIsMDTFObjectSupported = this.testObjectSupported.bind(this, MDTF_DAE_MIME_TYPE); + this.testIsNotifSocketObjectSupported = this.testObjectSupported.bind(this, NOTIF_SOCKET_DAE_MIME_TYPE); + this.testIsParentalControlManagerObjectSupported = this.testObjectSupported.bind(this, PARENTAL_CONTROL_MANAGER_DAE_MIME_TYPE); + this.testIsRecordingSchedulerObjectSupported = this.testObjectSupported.bind(this, RECORDING_SCHEDULER_DAE_MIME_TYPE); + this.testIsRemoteControlFunctionObjectSupported = this.testObjectSupported.bind(this, REMOTE_CONTROL_FUNCTION_DAE_MIME_TYPE); + this.testIsRemoteManagementObjectSupported = this.testObjectSupported.bind(this, REMOTE_MANAGEMENT_DAE_MIME_TYPE); + this.testIsSearchManagerObjectSupported = this.testObjectSupported.bind(this, SEARCH_MANAGER_DAE_MIME_TYPE); + this.testIsStatusViewObjectSupported = this.testObjectSupported.bind(this, STATUS_VIEW_DAE_MIME_TYPE); + this.testIsVideoBroadcastObjectSupported = this.testObjectSupported.bind(this, VIDEO_BROADCAST_DAE_MIME_TYPE); + this.testIsVideoMpegObjectSupported = this.testObjectSupported.bind(this, VIDEO_MPEG_DAE_MIME_TYPE); + + this.testCreateApplicationManagerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createApplicationManagerObject); + this.testCreateCapabilitiesObject = this.testObjectCreated.bind(this, oipfObjectFactory.createCapabilitiesObject); + this.testCreateChannelConfig = this.testObjectCreated.bind(this, oipfObjectFactory.createChannelConfig); + this.testCreateCodManagerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createCodManagerObject); + this.testCreateConfigurationObject = this.testObjectCreated.bind(this, oipfObjectFactory.createConfigurationObject); + this.testCreateDownloadManagerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createDownloadManagerObject); + this.testCreateDownloadTriggerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createDownloadTriggerObject); + this.testCreateDrmAgentObject = this.testObjectCreated.bind(this, oipfObjectFactory.createDrmAgentObject); + this.testCreateGatewayInfoObject = this.testObjectCreated.bind(this, oipfObjectFactory.createGatewayInfoObject); + this.testCreateIMSObject = this.testObjectCreated.bind(this, oipfObjectFactory.createIMSObject); + this.testCreateMDTFObject = this.testObjectCreated.bind(this, oipfObjectFactory.createMDTFObject); + this.testCreateNotifSocketObject = this.testObjectCreated.bind(this, oipfObjectFactory.createNotifSocketObject); + this.testCreateParentalControlManagerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createParentalControlManagerObject); + this.testCreateRecordingSchedulerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createRecordingSchedulerObject); + this.testCreateRemoteControlFunctionObject = this.testObjectCreated.bind(this, oipfObjectFactory.createRemoteControlFunctionObject); + this.testCreateRemoteManagementObject = this.testObjectCreated.bind(this, oipfObjectFactory.createRemoteManagementObject); + this.testCreateSearchManagerObject = this.testObjectCreated.bind(this, oipfObjectFactory.createSearchManagerObject); + this.testCreateStatusViewObject = this.testObjectCreated.bind(this, oipfObjectFactory.createStatusViewObject); + this.testCreateVideoBroadcastObject = this.testObjectCreated.bind(this, oipfObjectFactory.createVideoBroadcastObject); + this.testCreateVideoMpegObject = this.testObjectCreated.bind(this, oipfObjectFactory.createVideoMpegObject); }, - verifyObjectImplementation: function(methodName, resolve, reject) { - var method = this.oipfObjectFactory[methodName]; + testObjectCreated: function(method, resolve, reject) { + var object = method.call(oipfObjectFactory); - if(method) { - var object = method(); - - if(this.assertNotNull(object)){ - resolve(); - } else { - reject("The object is null."); - } + if (this.assertNotNull(object)) { + resolve(); } else { - reject("Object not Implemented."); + reject("The object is null."); } }, - - beforeTest: function(resolve, reject) { - this.verifyObjectImplementation = this.verifyObjectImplementation(resolve, reject); - }, - - testCreateApplicationManagerObject: function(resolve, reject) { - this.verifyObjectImplementation("createApplicationManagerObject"); - }, - - testCreateCapabilitiesObject: function(resolve, reject) { - this.verifyObjectImplementation("createCapabilitiesObject"); - }, - - testCreateChannelConfig: function(resolve, reject) { - this.verifyObjectImplementation("createChannelConfig"); - }, - - testCreateCodManagerObject: function(resolve, reject) { - this.verifyObjectImplementation("createCodManagerObject"); - }, - - testCreateConfigurationObject: function(resolve, reject) { - this.verifyObjectImplementation("createConfigurationObject"); - }, - - testCreateDownloadManagerObject: function(resolve, reject) { - this.verifyObjectImplementation("createDownloadManagerObject"); - }, - - testCreateDownloadTriggerObject: function(resolve, reject) { - this.verifyObjectImplementation("createDownloadTriggerObject"); - }, - - testCreateDrmAgentObject: function(resolve, reject) { - this.verifyObjectImplementation("createDrmAgentObject"); - }, - - testCreateGatewayInfoObject: function(resolve, reject) { - this.verifyObjectImplementation("createGatewayInfoObject"); - }, - - testCreateImsObject: function(resolve, reject) { - this.verifyObjectImplementation("createImsObject"); - }, - - testCreateIsObjectSupported: function(resolve, reject) { - if( this.oipfObjectFactory.isObjectSupported) { + + testObjectSupported: function(mimeType, resolve, reject) { + if (oipfObjectFactory.isObjectSupported(mimeType)) { resolve(); } else { reject(); } - }, - - testCreateMdtfObject: function(resolve, reject) { - this.verifyObjectImplementation("createMdtfObject"); - }, - - testCreateNotifSocketObject: function(resolve, reject) { - this.verifyObjectImplementation("createNotifSocketObject"); - }, - - testCreateParentalControlManagerObject: function(resolve, reject) { - this.verifyObjectImplementation("createParentalControlManagerObject"); - }, - - testCreateRecordingSchedulerObject: function(resolve, reject) { - this.verifyObjectImplementation("createRecordingSchedulerObject"); - }, - - testCreateRemoteControlFunctionObject: function(resolve, reject) { - this.verifyObjectImplementation("createRemoteControlFunctionObject"); - }, - - testCreateRemoteManagementObject: function(resolve, reject) { - this.verifyObjectImplementation("createRemoteManagementObject"); - }, - - testCreateSearchManagerObject: function(resolve, reject) { - this.verifyObjectImplementation("createSearchManagerObject"); - }, - - testCreateStatusViewObject: function(resolve, reject) { - this.verifyObjectImplementation("createStatusViewObject"); - }, - - testCreateVideoBroadcastObject: function(resolve, reject) { - this.verifyObjectImplementation("createVideoBroadcastObject"); - }, - - testCreateVideoMpegObject: function() { - this.verifyObjectImplementation("createVideoMpegObject"); } - });