001/** 002 * 003 * Copyright 2003-2006 Jive Software. 004 * 005 * Licensed under the Apache License, Version 2.0 (the "License"); 006 * you may not use this file except in compliance with the License. 007 * You may obtain a copy of the License at 008 * 009 * http://www.apache.org/licenses/LICENSE-2.0 010 * 011 * Unless required by applicable law or agreed to in writing, software 012 * distributed under the License is distributed on an "AS IS" BASIS, 013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 014 * See the License for the specific language governing permissions and 015 * limitations under the License. 016 */ 017package org.jivesoftware.smackx.jingleold.mediaimpl.test; 018 019import org.jivesoftware.smackx.jingleold.JingleSession; 020import org.jivesoftware.smackx.jingleold.media.JingleMediaSession; 021import org.jivesoftware.smackx.jingleold.media.PayloadType; 022import org.jivesoftware.smackx.jingleold.nat.TransportCandidate; 023 024/** 025 * This Class implements a complete JingleMediaSession for unit testing. 026 * 027 * @author Thiago Camargo 028 */ 029public class TestMediaSession extends JingleMediaSession { 030 031 /** 032 * Creates a TestMediaSession with defined payload type, remote and local candidates. 033 * 034 * @param payloadType Payload of the jmf 035 * @param remote the remote information. The candidate that the jmf will be sent to. 036 * @param local the local information. The candidate that will receive the jmf 037 * @param locator media locator 038 * @param jingleSession the jingle session. 039 */ 040 @SuppressWarnings("this-escape") 041 public TestMediaSession(final PayloadType payloadType, final TransportCandidate remote, final TransportCandidate local, 042 final String locator, JingleSession jingleSession) { 043 super(payloadType, remote, local, "Test", jingleSession); 044 initialize(); 045 } 046 047 /** 048 * Initialize the screen share channels. 049 */ 050 @Override 051 public void initialize() { 052 053 } 054 055 /** 056 * Starts transmission and for NAT Traversal reasons start receiving also. 057 */ 058 @Override 059 public void startTransmit() { 060 061 } 062 063 /** 064 * Set transmit activity. If the active is true, the instance should transmit. 065 * If it is set to false, the instance should pause transmit. 066 * 067 * @param active active state 068 */ 069 @Override 070 public void setTransmit(boolean active) { 071 072 } 073 074 /** 075 * For NAT Reasons this method does nothing. Use startTransmit() to start transmit and receive jmf 076 */ 077 @Override 078 public void startReceive() { 079 // Do nothing 080 } 081 082 /** 083 * Stops transmission and for NAT Traversal reasons stop receiving also. 084 */ 085 @Override 086 public void stopTransmit() { 087 088 } 089 090 /** 091 * For NAT Reasons this method does nothing. Use startTransmit() to start transmit and receive jmf 092 */ 093 @Override 094 public void stopReceive() { 095 096 } 097}