OpenStream.java revision 12278:6fb5ee377870
1304732Scy/*
2304732Scy * Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
3304732Scy * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4304732Scy *
5304732Scy * This code is free software; you can redistribute it and/or modify it
6304732Scy * under the terms of the GNU General Public License version 2 only, as
7304732Scy * published by the Free Software Foundation.
8304732Scy *
9304732Scy * This code is distributed in the hope that it will be useful, but WITHOUT
10304732Scy * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11304732Scy * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
12304732Scy * version 2 for more details (a copy is included in the LICENSE file that
13304732Scy * accompanied this code).
14304732Scy *
15304732Scy * You should have received a copy of the GNU General Public License version
16304732Scy * 2 along with this work; if not, write to the Free Software Foundation,
17304732Scy * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18304732Scy *
19304732Scy * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20304732Scy * or visit www.oracle.com if you need additional information or have any
21304732Scy * questions.
22304732Scy */
23304732Scy
24304732Scy/* @test
25304732Scy   @summary Test SoftSynthesizer openStream method
26304732Scy   @modules java.desktop/com.sun.media.sound
27304732Scy*/
28304732Scy
29304732Scyimport javax.sound.midi.MidiDevice;
30304732Scyimport javax.sound.midi.MidiUnavailableException;
31304732Scyimport javax.sound.midi.Patch;
32304732Scyimport javax.sound.sampled.*;
33304732Scyimport javax.sound.midi.MidiDevice.Info;
34304732Scy
35304732Scyimport com.sun.media.sound.*;
36304732Scy
37304732Scypublic class OpenStream {
38304732Scy
39304732Scy    private static void assertEquals(Object a, Object b) throws Exception
40304732Scy    {
41304732Scy        if(!a.equals(b))
42304732Scy            throw new RuntimeException("assertEquals fails!");
43304732Scy    }
44304732Scy
45304732Scy    private static void assertTrue(boolean value) throws Exception
46304732Scy    {
47304732Scy        if(!value)
48304732Scy            throw new RuntimeException("assertTrue fails!");
49304732Scy    }
50304732Scy
51304732Scy    public static void main(String[] args) throws Exception {
52304732Scy        AudioSynthesizer synth = new SoftSynthesizer();
53304732Scy        synth.openStream(null, null);
54304732Scy        assertTrue(synth.isOpen());
55304732Scy        synth.close();
56304732Scy
57304732Scy    }
58304732Scy}
59304732Scy