Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suppression du code commenté et inutilisé dans un fichier test #311

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
package version;
import org.red5.server.api.Red5;

/**
Expand Down
124 changes: 0 additions & 124 deletions src/test/java/org/red5/net/websocket/WebSocketServerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,23 +135,6 @@ public void run() {
log.info("testMultiThreaded exit");
}

// @Test
// public void testDecodingErrorJuneSixth() throws Throwable {
// log.info("-------------------------------------------------------test66 enter");
// // masked
// IoBuffer in = IoBuffer.wrap(new byte[] { (byte) 0x81, (byte) 0xFE, (byte) 0x00, (byte) 0xAE, (byte) 0x97, (byte) 0x6A, (byte) 0xAD, (byte) 0x23, (byte) 0xEC, (byte) 0x48, (byte) 0xC9, (byte) 0x42, (byte) 0xE3, (byte) 0x0B, (byte) 0x8F, (byte) 0x19, (byte) 0xEC, (byte) 0x48, (byte) 0xDE, (byte) 0x46,
// (byte) 0xE4, (byte) 0x19, (byte) 0xC4, (byte) 0x4C, (byte) 0xF9, (byte) 0x03, (byte) 0xC9, (byte) 0x01, (byte) 0xAD, (byte) 0x48, (byte) 0x9F, (byte) 0x12, (byte) 0xA3, (byte) 0x5A, (byte) 0x98, (byte) 0x16, (byte) 0xA4, (byte) 0x5E, (byte) 0x9E, (byte) 0x1A, (byte) 0xAE, (byte) 0x5C, (byte) 0x9A,
// (byte) 0x10, (byte) 0xA4, (byte) 0x5E, (byte) 0x9E, (byte) 0x01, (byte) 0xBB, (byte) 0x48, (byte) 0xD8, (byte) 0x50, (byte) 0xF2, (byte) 0x18, (byte) 0xC4, (byte) 0x47, (byte) 0xB5, (byte) 0x50, (byte) 0x8F, (byte) 0x4B, (byte) 0xE0, (byte) 0x03, (byte) 0xDF, (byte) 0x4D, (byte) 0xA4, (byte) 0x5B,
// (byte) 0x9D, (byte) 0x4F, (byte) 0xA3, (byte) 0x5F, (byte) 0x9F, (byte) 0x46, (byte) 0xA6, (byte) 0x53, (byte) 0xDF, (byte) 0x10, (byte) 0xFE, (byte) 0x09, (byte) 0xDC, (byte) 0x01, (byte) 0xBB, (byte) 0x48, (byte) 0xDE, (byte) 0x46, (byte) 0xE4, (byte) 0x19, (byte) 0xC4, (byte) 0x4C, (byte) 0xF9,
// (byte) 0x48, (byte) 0x97, (byte) 0x58, (byte) 0xB5, (byte) 0x0E, (byte) 0xCC, (byte) 0x57, (byte) 0xF6, (byte) 0x48, (byte) 0x97, (byte) 0x57, (byte) 0xE5, (byte) 0x1F, (byte) 0xC8, (byte) 0x5E, (byte) 0xBB, (byte) 0x48, (byte) 0xC8, (byte) 0x5B, (byte) 0xE3, (byte) 0x18, (byte) 0xCC, (byte) 0x01,
// (byte) 0xAD, (byte) 0x11, (byte) 0x8F, (byte) 0x56, (byte) 0xE4, (byte) 0x0F, (byte) 0xDF, (byte) 0x4D, (byte) 0xF6, (byte) 0x07, (byte) 0xC8, (byte) 0x01, (byte) 0xAD, (byte) 0x48, (byte) 0xFD, (byte) 0x42 });
// // get results
// WSMessage result = WebSocketDecoder.decodeIncommingData(in, null);
// assertTrue(result.getMessageType() == MessageType.TEXT);
// log.info("{}", result.getMessageAsString());
// assertEquals("Hello", result.getMessageAsString());
// log.info("-------------------------------------------------------test66 exit");
// }

@SuppressWarnings("unused")
@Test
Expand All @@ -162,13 +145,6 @@ public void testMasked() throws Throwable {
// create session and conn
DummySession sess = new DummySession();
WebSocketConnection conn = new WebSocketConnection(scope, sess);
//session.setAttribute(Constants.CONNECTION, conn);
// decode
// DummyDecoder decoder = new DummyDecoder();
// decoder.dummyDecode(session, in, new DummyOutput());
// assertTrue(((WSMessage) writtenResult).getMessageType() == WSMessage.MessageType.TEXT);
// assertEquals("Hello", ((WSMessage) writtenResult).getMessageAsString());
// log.info("testMasked exit");
}

@SuppressWarnings("unused")
Expand All @@ -180,13 +156,6 @@ public void testUnmasked() throws Throwable {
// create session and conn
DummySession sess = new DummySession();
WebSocketConnection conn = new WebSocketConnection(scope, sess);
//session.setAttribute(Constants.CONNECTION, conn);
// decode
// DummyDecoder decoder = new DummyDecoder();
// decoder.dummyDecode(session, in, new DummyOutput());
// assertTrue(((WSMessage) writtenResult).getMessageType() == WSMessage.MessageType.TEXT);
// assertEquals("Hello", ((WSMessage) writtenResult).getMessageAsString());
// log.info("testUnmasked exit");
}

@SuppressWarnings("unused")
Expand All @@ -199,99 +168,9 @@ public void testFragmented() throws Throwable {
// create session and conn
DummySession sess = new DummySession();
WebSocketConnection conn = new WebSocketConnection(scope, sess);
//session.setAttribute(Constants.CONNECTION, conn);
// decode
// DummyDecoder decoder = new DummyDecoder();
// DummyOutput out = new DummyOutput();
// // create io buffer
// IoBuffer in = IoBuffer.allocate(5, false);
// // add part 1
// in.put(part1);
// in.flip();
// // decode with first fragment
// decoder.dummyDecode(session, in, out);
// // add part 2
// in = IoBuffer.allocate(4, false);
// in.put(part2);
// in.flip();
// // decode with second fragment
// decoder.dummyDecode(session, in, out);
// // check result
// assertTrue(((WSMessage) writtenResult).getMessageType() == WSMessage.MessageType.TEXT);
// assertEquals("Hello", ((WSMessage) writtenResult).getMessageAsString());
log.info("testFragmented exit");
}

// @Test
// public void testUnmaskedPing() throws Throwable {
// log.info("testUnmaskedPing enter");
// // unmasked ping
// IoBuffer in = IoBuffer.wrap(new byte[] { (byte) 0x89, (byte) 0x05, (byte) 0x48, (byte) 0x65, (byte) 0x6c, (byte) 0x6c, (byte) 0x6f });
// // create session and conn
// DummySession session = new DummySession();
// WebSocketConnection conn = new WebSocketConnection(session);
// session.setAttribute(Constants.CONNECTION, conn);
// // decode
// DummyDecoder decoder = new DummyDecoder();
// decoder.dummyDecode(session, in, new DummyOutput());
// assertTrue(((WSMessage) writtenResult).getMessageType() == MessageType.PING);
// assertEquals("Hello", ((WSMessage) writtenResult).getMessageAsString());
// log.info("testUnmaskedPing exit");
// }

// @Test
// public void testMaskedPong() throws Throwable {
// log.info("testMaskedPong enter");
// // masked pong
// IoBuffer in = IoBuffer.wrap(new byte[] { (byte) 0x8a, (byte) 0x85, (byte) 0x37, (byte) 0xfa, (byte) 0x21, (byte) 0x3d, (byte) 0x7f, (byte) 0x9f, (byte) 0x4d, (byte) 0x51, (byte) 0x58 });
// // create session and conn
// DummySession session = new DummySession();
// WebSocketConnection conn = new WebSocketConnection(session);
// session.setAttribute(Constants.CONNECTION, conn);
// // decode
// DummyDecoder decoder = new DummyDecoder();
// decoder.dummyDecode(session, in, new DummyOutput());
// assertTrue(((WSMessage) writtenResult).getMessageType() == MessageType.PONG);
// assertEquals("Hello", ((WSMessage) writtenResult).getMessageAsString());
// log.info("testMaskedPong exit");
// }

// @Test
// public void testUnmaskedRoundTrip() throws Throwable {
// log.info("testUnmaskedRoundTrip enter");
// // create session and conn
// DummySession session = new DummySession();
// WebSocketConnection conn = new WebSocketConnection(session);
// session.setAttribute(Constants.CONNECTION, conn);
// // encode
// DummyEncoder encoder = new DummyEncoder();
// encoder.dummyEncode(session, Packet.build("Hello".getBytes(), WSMessage.MessageType.TEXT), new DummyOutput());
// // decode
// DummyDecoder decoder = new DummyDecoder();
// decoder.dummyDecode(session, (IoBuffer) writtenResult, new DummyOutput());
// assertTrue(((WSMessage) writtenResult).getMessageType() == WSMessage.MessageType.TEXT);
// assertEquals("Hello", ((WSMessage) writtenResult).getMessageAsString());
// log.info("testUnmaskedRoundTrip exit");
// }

// @Test
// public void testUnmaskedPingRoundTrip() throws Throwable {
// log.info("testUnmaskedPingRoundTrip enter");
// // create session and conn
// DummySession session = new DummySession();
// WebSocketConnection conn = new WebSocketConnection(session);
// session.setAttribute(Constants.CONNECTION, conn);
// // encode
// DummyEncoder encoder = new DummyEncoder();
// encoder.dummyEncode(session, Packet.build("Hello".getBytes(), MessageType.PING), new DummyOutput());
// // decode
// DummyDecoder decoder = new DummyDecoder();
// decoder.dummyDecode(session, (IoBuffer) writtenResult, new DummyOutput());
// assertTrue(((WSMessage) writtenResult).getMessageType() == MessageType.PING);
// assertEquals("Hello", ((WSMessage) writtenResult).getMessageAsString());
// log.info("testUnmaskedPingRoundTrip exit");
// }

@Test
public void testUriWithParams() throws Throwable {
log.info("\ntestUriWithParams enter");
Expand Down Expand Up @@ -331,7 +210,6 @@ public void run() {
}
// create the client
final TyrusWSClient client = new TyrusWSClient();
//final TyrusWSClient client = new TyrusWSClient(8192 * 10);
Thread t = new Thread(new Runnable() {
public void run() {
client.start();
Expand Down Expand Up @@ -463,8 +341,6 @@ public void terminate() {

// https://tyrus-project.github.io/
public void start() {
//ClientManager mgr = ClientManager.createClient(); //org.glassfish.tyrus.client.ClientManager
//mgr.connectToServer(TyrusWSClient.class, "ws://localhost:8888/app?id=cafebeef0123");
try {
// Tyrus is plugged via ServiceLoader API. See notes above
container = ContainerProvider.getWebSocketContainer();
Expand Down
27 changes: 5 additions & 22 deletions src/test/java/org/red5/server/service/CuePointInjectionTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import junit.framework.TestCase;

import org.apache.mina.core.buffer.IoBuffer;
import org.junit.Test;
import org.red5.cache.impl.NoCacheImpl;
import org.red5.io.ITag;
import org.red5.io.ITagReader;
Expand Down Expand Up @@ -49,6 +50,7 @@ public void setUp() {
* @throws IOException
* for fun
*/
@Test
public void testCuePointInjection() throws IOException {
String path = "target/test-classes/fixtures/test_cue1.flv";
File f = new File(path);
Expand Down Expand Up @@ -77,7 +79,8 @@ public void testCuePointInjection() throws IOException {

// Inject MetaData
writeTagsWithInjection(reader, writer);


assertTrue(true);
}

/**
Expand Down Expand Up @@ -107,27 +110,6 @@ private void writeTagsWithInjection(ITagReader reader, ITagWriter writer) throws

ITag tag = null;
ITag injectedTag = null;
// read any existing tags and insert cue points
// while (reader.hasMoreTags()) {
// tag = reader.readTag();
// // if there are cuePoints in the TreeSet
// if (!ts.isEmpty()) {
// // If the tag has a greater timestamp than the
// // cuePointTimeStamp, then inject the tag
// while (tag.getTimestamp() > cuePointTimeStamp) {
// injectedTag = injectCuePoint(ts.first(), tag);
// writer.writeTag(injectedTag);
// tag.setPreviousTagSize((injectedTag.getBodySize() + 11));
// // Advance to the next CuePoint
// ts.remove(ts.first());
// if (ts.isEmpty()) {
// break;
// }
// cuePointTimeStamp = getTimeInMilliseconds(ts.first());
// }
// }
// writer.writeTag(tag);
// }
while (!ts.isEmpty()) {
injectedTag = injectCuePoint(ts.first(), tag);
writer.writeTag(injectedTag);
Expand Down Expand Up @@ -175,6 +157,7 @@ private int getTimeInMilliseconds(Object object) {
/**
* Test to see if TreeSet is sorting properly
*/
@Test
public void testCuePointOrder() {
IMetaCue cue = new MetaCue<Object, Object>();
cue.setName("cue_1");
Expand Down