[vlma-devel] commit: More tests. (Adrien Grand )
git version control
git at videolan.org
Wed Jul 23 23:57:53 CEST 2008
vlma | branch: master | Adrien Grand <jpountz at videolan.org> | Wed Jul 23 23:59:38 2008 +0200| [3ee1ea1fb4fffeaea352ab480bda4ff7390d356f]
More tests.
> http://git.videolan.org/gitweb.cgi/vlma.git/?a=commit;h=3ee1ea1fb4fffeaea352ab480bda4ff7390d356f
---
.../test/java/org/videolan/vlma/IpBankTest.java | 20 +++++++
.../java/org/videolan/vlma/ProgramFactoryTest.java | 20 +++++++
.../org/videolan/vlma/order/CommandLoggerTest.java | 58 +++++++++++++++++++
.../watcher/DirectMulticastStreamWatcherTest.java | 51 +++++++++++++++++
.../vlma/watcher/HttpStreamWatcherTest.java | 59 ++++++++++++++++++++
5 files changed, 208 insertions(+), 0 deletions(-)
diff --git a/vlma-core/src/test/java/org/videolan/vlma/IpBankTest.java b/vlma-core/src/test/java/org/videolan/vlma/IpBankTest.java
index ec2a9de..f614f3d 100644
--- a/vlma-core/src/test/java/org/videolan/vlma/IpBankTest.java
+++ b/vlma-core/src/test/java/org/videolan/vlma/IpBankTest.java
@@ -1,3 +1,23 @@
+/*
+ * Copyright (C) 2008 the VideoLAN team
+ *
+ * This file is part of VLMa.
+ *
+ * VLMa is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * VLMa is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with VLMa. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
package org.videolan.vlma;
import static org.junit.Assert.*;
diff --git a/vlma-core/src/test/java/org/videolan/vlma/ProgramFactoryTest.java b/vlma-core/src/test/java/org/videolan/vlma/ProgramFactoryTest.java
index c4847ba..aaa81a8 100644
--- a/vlma-core/src/test/java/org/videolan/vlma/ProgramFactoryTest.java
+++ b/vlma-core/src/test/java/org/videolan/vlma/ProgramFactoryTest.java
@@ -1,3 +1,23 @@
+/*
+ * Copyright (C) 2008 the VideoLAN team
+ *
+ * This file is part of VLMa.
+ *
+ * VLMa is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * VLMa is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with VLMa. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
package org.videolan.vlma;
import static org.junit.Assert.*;
diff --git a/vlma-core/src/test/java/org/videolan/vlma/order/CommandLoggerTest.java b/vlma-core/src/test/java/org/videolan/vlma/order/CommandLoggerTest.java
new file mode 100644
index 0000000..8950e18
--- /dev/null
+++ b/vlma-core/src/test/java/org/videolan/vlma/order/CommandLoggerTest.java
@@ -0,0 +1,58 @@
+/*
+ * Copyright (C) 2008 the VideoLAN team
+ *
+ * This file is part of VLMa.
+ *
+ * VLMa is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * VLMa is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with VLMa. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package org.videolan.vlma.order;
+
+import static org.junit.Assert.*;
+
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.junit.Before;
+import org.junit.Test;
+import org.videolan.vlma.model.Command;
+import org.videolan.vlma.model.adapter.Server;
+
+public class CommandLoggerTest {
+
+ private Configuration configuration;
+ private CommandLogger commandLogger;
+ private Server server;
+
+ @Before
+ public void setup() {
+ configuration = new BaseConfiguration();
+ configuration.setProperty("vlma.ui.command.queue.size", 50);
+ commandLogger = new CommandLogger();
+ commandLogger.setConfiguration(configuration);
+ server = new Server();
+ }
+
+ @Test
+ public void testAdd() {
+ for (int i = 1; i < 100; i++) {
+ commandLogger.add(new Command(server, "command " + i, "response " + i));
+ }
+ assertEquals(50, commandLogger.getCommands().size());
+ configuration.setProperty("vlma.ui.command.queue.size", 25);
+ commandLogger.add(new Command(server, "command", "response"));
+ assertEquals(commandLogger.getCommands().size(), 25);
+ }
+
+}
diff --git a/vlma-core/src/test/java/org/videolan/vlma/watcher/DirectMulticastStreamWatcherTest.java b/vlma-core/src/test/java/org/videolan/vlma/watcher/DirectMulticastStreamWatcherTest.java
new file mode 100644
index 0000000..b704f14
--- /dev/null
+++ b/vlma-core/src/test/java/org/videolan/vlma/watcher/DirectMulticastStreamWatcherTest.java
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2008 the VideoLAN team
+ *
+ * This file is part of VLMa.
+ *
+ * VLMa is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * VLMa is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with VLMa. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package org.videolan.vlma.watcher;
+
+import static org.junit.Assert.*;
+
+import java.net.InetAddress;
+import java.util.Random;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.videolan.vlma.model.media.Program;
+
+public class DirectMulticastStreamWatcherTest {
+
+ private StreamWatcher watcher;
+
+ @Before
+ public void setup() {
+ watcher = new DirectMulticastStreamWatcher();
+ }
+
+ @Test
+ public void testIsPlayed() throws Exception {
+ Random random = new Random();
+ Program program = new Program();
+ assertFalse(watcher.isPlayed(program));
+ // Pick a random address
+ program.setIp(InetAddress.getByName("239.142." + random.nextInt(256) + "." + random.nextInt(256)));
+ assertFalse(watcher.isPlayed(program));
+ }
+
+}
diff --git a/vlma-core/src/test/java/org/videolan/vlma/watcher/HttpStreamWatcherTest.java b/vlma-core/src/test/java/org/videolan/vlma/watcher/HttpStreamWatcherTest.java
new file mode 100644
index 0000000..85a9dab
--- /dev/null
+++ b/vlma-core/src/test/java/org/videolan/vlma/watcher/HttpStreamWatcherTest.java
@@ -0,0 +1,59 @@
+/*
+ * Copyright (C) 2008 the VideoLAN team
+ *
+ * This file is part of VLMa.
+ *
+ * VLMa is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * VLMa is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with VLMa. If not, see <http://www.gnu.org/licenses/>.
+ *
+ */
+
+package org.videolan.vlma.watcher;
+
+import static org.junit.Assert.*;
+
+import java.net.InetAddress;
+import java.util.Random;
+
+import org.apache.commons.configuration.BaseConfiguration;
+import org.apache.commons.configuration.Configuration;
+import org.junit.Before;
+import org.junit.Test;
+import org.videolan.vlma.model.media.Program;
+
+public class HttpStreamWatcherTest {
+
+ private Configuration configuration;
+ private StreamWatcher watcher;
+
+ @Before
+ public void setup() {
+ configuration = new BaseConfiguration();
+ Random random = new Random();
+ configuration.setProperty("vlma.streaming.http.port", 81 + random.nextInt(10000));
+ watcher = new HttpStreamWatcher();
+ ((HttpStreamWatcher) watcher).setConfiguration(configuration);
+ }
+
+ @Test
+ public void testIsPlayed() throws Exception {
+ Program program = new Program();
+ program.setSapGroup("group");
+ program.setSapName("name");
+ assertFalse(watcher.isPlayed(program));
+ // Pick a random address
+ program.setPlayer(InetAddress.getByName("127.0.0.1"));
+ assertFalse(watcher.isPlayed(program));
+ }
+
+}
More information about the vlma-devel
mailing list