File: jlpTest.java

package info (click to toggle)
libjlayer-java 1.0-2
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 712 kB
  • ctags: 1,039
  • sloc: java: 8,145; xml: 47; sh: 30; makefile: 9
file content (87 lines) | stat: -rw-r--r-- 2,580 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
/*
 * 11/19/2004 : 1.0 moved to LGPL. 
 * 01/01/2004 : Initial version by E.B javalayer@javazoom.net
 *-----------------------------------------------------------------------
 *   This program is free software; you can redistribute it and/or modify
 *   it under the terms of the GNU Library 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 Library General Public License for more details.
 *
 *   You should have received a copy of the GNU Library General Public
 *   License along with this program; if not, write to the Free Software
 *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 *----------------------------------------------------------------------
 */
 
package javazoom.jl.player;

import java.io.InputStream;
import java.util.Properties;

import javazoom.jl.decoder.JavaLayerException;
import junit.framework.TestCase;

/**
 * Simple player unit test.
 * It takes around 3-6% of CPU and 10MB RAM under Win2K/PIII/1GHz/JDK1.5.0
 * It takes around 10-12% of CPU and 10MB RAM under Win2K/PIII/1GHz/JDK1.4.1
 * It takes around 08-10% of CPU and 10MB RAM under Win2K/PIII/1GHz/JDK1.3.1
 * @since 0.4 
 */
public class jlpTest extends TestCase
{
	private Properties props = null;
	private String filename = null;
	
	/**
	 * Constructor for jlpTest.
	 * @param arg0
	 */
	public jlpTest(String arg0)
	{
		super(arg0);
	}
	/*
	 * @see TestCase#setUp()
	 */
	protected void setUp() throws Exception
	{
		super.setUp();
		props = new Properties();
		InputStream pin = getClass().getClassLoader().getResourceAsStream("test.mp3.properties");
		props.load(pin);
		String basefile = (String) props.getProperty("basefile");
		String name = (String) props.getProperty("filename");		
		filename = basefile + name;	
		//out = System.out;
	}
	/*
	 * @see TestCase#tearDown()
	 */
	protected void tearDown() throws Exception
	{
		super.tearDown();
	}

	public void testPlay()
	{
		String[] args = new String[1];
		args[0] = filename;
		jlp player = jlp.createInstance(args);
		try
		{
			player.play();
			assertTrue("Play",true);	
		}
		catch (JavaLayerException e)
		{
			e.printStackTrace();
			assertTrue("JavaLayerException : "+e.getMessage(),false);			
		}
	}
}