Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-1.1
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-1.1
Commits
a602c01e
Commit
a602c01e
authored
Jul 20, 2008
by
Filippo Carone
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jvlc: abstract test class added to not-internal tests too
parent
b774d66a
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
120 additions
and
59 deletions
+120
-59
bindings/java/core/src/test/java/org/videolan/jvlc/AbstractJVLCTest.java
...ore/src/test/java/org/videolan/jvlc/AbstractJVLCTest.java
+112
-0
bindings/java/core/src/test/java/org/videolan/jvlc/JVLCTest.java
...s/java/core/src/test/java/org/videolan/jvlc/JVLCTest.java
+1
-3
bindings/java/core/src/test/java/org/videolan/jvlc/LoggerTest.java
...java/core/src/test/java/org/videolan/jvlc/LoggerTest.java
+1
-12
bindings/java/core/src/test/java/org/videolan/jvlc/MediaListTest.java
...a/core/src/test/java/org/videolan/jvlc/MediaListTest.java
+1
-12
bindings/java/core/src/test/java/org/videolan/jvlc/VLMTest.java
...gs/java/core/src/test/java/org/videolan/jvlc/VLMTest.java
+5
-31
bindings/java/core/src/test/java/org/videolan/jvlc/internal/AbstractVLCInternalTest.java
...a/org/videolan/jvlc/internal/AbstractVLCInternalTest.java
+0
-1
No files found.
bindings/java/core/src/test/java/org/videolan/jvlc/AbstractJVLCTest.java
0 → 100644
View file @
a602c01e
/*****************************************************************************
* AbstractJVLCTest.java: VLC Java Bindings
*****************************************************************************
* Copyright (C) 1998-2008 the VideoLAN team
*
* Authors: Filippo Carone <filippo@carone.org>
*
*
* $Id $
*
* This program 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.
*
* This program 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 this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111, USA.
*****************************************************************************/
package
org.videolan.jvlc
;
import
java.io.BufferedOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.net.URL
;
import
java.net.URLConnection
;
import
org.apache.commons.io.IOUtils
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.videolan.jvlc.internal.AbstractVLCInternalTest
;
public
abstract
class
AbstractJVLCTest
{
protected
JVLC
jvlc
;
protected
String
mrl
;
private
String
address
=
"http://streams.videolan.org/streams-videolan/reference/avi/Hero-Div3.avi"
;
/**
* Logger.
*/
private
Logger
log
=
LoggerFactory
.
getLogger
(
AbstractVLCInternalTest
.
class
);
@Before
public
void
testSetup
()
{
jvlc
=
new
JVLC
(
"-vvv --ignore-config --no-media-library -I dummy --aout=dummy --vout=dummy"
);
downloadSample
();
}
@After
public
void
tearDown
()
{
jvlc
.
release
();
}
private
void
downloadSample
()
{
OutputStream
out
=
null
;
URLConnection
conn
=
null
;
InputStream
in
=
null
;
URL
sampleResource
=
this
.
getClass
().
getResource
(
"/sample.avi"
);
if
(
sampleResource
!=
null
)
{
log
.
debug
(
"Sample file already downloaded"
);
mrl
=
sampleResource
.
getPath
();
return
;
}
try
{
log
.
info
(
"Downloading sample: {}"
,
address
);
String
testResoucesPath
=
this
.
getClass
().
getResource
(
"/sample"
).
getPath
();
URL
url
=
new
URL
(
address
);
out
=
new
BufferedOutputStream
(
new
FileOutputStream
(
testResoucesPath
+
".avi"
));
conn
=
url
.
openConnection
();
in
=
conn
.
getInputStream
();
byte
[]
buffer
=
new
byte
[
1024
];
int
numRead
;
long
numWritten
=
0
;
while
((
numRead
=
in
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
numRead
);
numWritten
+=
numRead
;
}
log
.
info
(
"Sample downloaded."
);
mrl
=
testResoucesPath
+
".avi"
;
}
catch
(
Exception
e
)
{
log
.
error
(
"{}"
,
e
);
}
finally
{
IOUtils
.
closeQuietly
(
in
);
IOUtils
.
closeQuietly
(
out
);
}
}
}
bindings/java/core/src/test/java/org/videolan/jvlc/JVLCTest.java
View file @
a602c01e
...
...
@@ -30,7 +30,7 @@ import junit.framework.Assert;
import
org.junit.Test
;
public
class
JVLCTest
public
class
JVLCTest
extends
AbstractJVLCTest
{
String
mrl
=
getClass
().
getResource
(
"/raffa_voice.ogg"
).
getFile
();
...
...
@@ -45,7 +45,6 @@ public class JVLCTest
@Test
public
void
jvlcPlay
()
{
JVLC
jvlc
=
new
JVLC
();
MediaPlayer
instance
=
jvlc
.
play
(
mrl
);
Assert
.
assertNotNull
(
instance
);
}
...
...
@@ -55,7 +54,6 @@ public class JVLCTest
{
JVLC
jvlc
=
new
JVLC
();
jvlc
.
release
();
jvlc
.
release
();
}
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/LoggerTest.java
View file @
a602c01e
...
...
@@ -29,22 +29,11 @@ import java.util.Iterator;
import
junit.framework.Assert
;
import
org.junit.Before
;
import
org.junit.Test
;
public
class
LoggerTest
public
class
LoggerTest
extends
AbstractJVLCTest
{
private
JVLC
jvlc
;
private
String
mrl
=
getClass
().
getResource
(
"/raffa_voice.ogg"
).
getFile
();
@Before
public
void
setup
()
{
jvlc
=
new
JVLC
(
"-I dummy --aout=dummy --vout=dummy"
);
}
@Test
public
void
testLogDebug
()
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/MediaListTest.java
View file @
a602c01e
...
...
@@ -26,23 +26,12 @@
package
org.videolan.jvlc
;
import
org.junit.Assert
;
import
org.junit.Before
;
import
org.junit.Test
;
public
class
MediaListTest
public
class
MediaListTest
extends
AbstractJVLCTest
{
private
JVLC
jvlc
;
private
String
mrl
=
getClass
().
getResource
(
"/raffa_voice.ogg"
).
getFile
();
@Before
public
void
setup
()
{
jvlc
=
new
JVLC
(
"-vvv --ignore-config --no-media-library -I dummy --aout=dummy --vout=dummy"
);
}
@Test
public
void
mediaListAddMedia
()
{
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/VLMTest.java
View file @
a602c01e
...
...
@@ -27,32 +27,13 @@ package org.videolan.jvlc;
import
junit.framework.Assert
;
import
org.junit.After
;
import
org.junit.Before
;
import
org.junit.Test
;
public
class
VLMTest
public
class
VLMTest
extends
AbstractJVLCTest
{
private
JVLC
jvlc
;
private
String
mrl
=
getClass
().
getResource
(
"/raffa_voice.ogg"
).
getFile
();
private
String
mediaName
=
"test"
;
@Before
public
void
setup
()
{
jvlc
=
new
JVLC
(
"--ignore-config --no-media-library -I dummy --aout=dummy --vout=dummy"
);
jvlc
.
setLogVerbosity
(
LoggerVerbosityLevel
.
DEBUG
);
}
@After
public
void
tearDown
()
{
jvlc
.
release
();
}
@Test
public
void
testVLMInit
()
{
...
...
@@ -82,14 +63,7 @@ public class VLMTest
vlm
.
addBroadcast
(
mediaName
,
"file://"
+
mrl
,
""
,
null
,
true
,
false
);
vlm
.
disableMedia
(
mediaName
);
}
@Test
public
void
testPlayMedia
()
{
VLM
vlm
=
jvlc
.
getVLM
();
vlm
.
addBroadcast
(
mediaName
,
mrl
,
""
,
null
,
true
,
false
);
vlm
.
playMedia
(
mediaName
);
}
@Test
public
void
testPauseMedia
()
...
...
@@ -98,17 +72,16 @@ public class VLMTest
vlm
.
addBroadcast
(
mediaName
,
"file://"
+
mrl
,
""
,
null
,
true
,
false
);
vlm
.
playMedia
(
mediaName
);
vlm
.
pauseMedia
(
mediaName
);
vlm
.
stopMedia
(
mediaName
);
}
@Test
public
void
testStopMedia
()
throws
Exception
public
void
testStopMedia
()
{
VLM
vlm
=
jvlc
.
getVLM
();
vlm
.
addBroadcast
(
mediaName
,
"file://"
+
mrl
,
""
,
null
,
true
,
false
);
vlm
.
playMedia
(
mediaName
);
Thread
.
sleep
(
2000
);
vlm
.
stopMedia
(
mediaName
);
jvlc
.
release
();
}
@Test
...
...
@@ -118,6 +91,7 @@ public class VLMTest
vlm
.
addBroadcast
(
mediaName
,
"file://"
+
mrl
,
""
,
null
,
true
,
false
);
vlm
.
playMedia
(
mediaName
);
vlm
.
seekMedia
(
mediaName
,
0.3f
);
vlm
.
stopMedia
(
mediaName
);
}
@Test
...
...
bindings/java/core/src/test/java/org/videolan/jvlc/internal/AbstractVLCInternalTest.java
View file @
a602c01e
...
...
@@ -27,7 +27,6 @@ package org.videolan.jvlc.internal;
import
java.io.BufferedOutputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.OutputStream
;
import
java.net.URL
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment