mylyn-suite/depends-on-bugzilla/test/unit/src/org/apidesign/netbinox/test/mylyn/InvokeAllActionsTest.java
2 * Copyright (C) 2009 Jaroslav Tulach <jaroslav.tulach@apidesign.org>
4 * This program is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU General Public License
6 * as published by the Free Software Foundation; version 2
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
19 package org.apidesign.netbinox.test.mylyn;
21 import java.awt.EventQueue;
22 import java.awt.event.ActionEvent;
23 import java.util.logging.Level;
24 import javax.swing.Action;
25 import junit.framework.Test;
26 import org.netbeans.junit.NbModuleSuite;
27 import org.netbeans.junit.NbTestCase;
28 import org.openide.util.Lookup;
29 import org.openide.util.lookup.Lookups;
33 * @author Jaroslav Tulach <jaroslav.tulach@apidesign.org>
35 public class InvokeAllActionsTest extends NbTestCase {
36 public InvokeAllActionsTest(String name) {
40 public static Test suite() {
41 System.setProperty("org.netbeans.core.TimableEventQueue.level", "OFF");
42 return NbModuleSuite.create(
43 NbModuleSuite.emptyConfiguration().
44 addTest(InvokeAllActionsTest.class).
45 clusters("cluster.*|eclipse.*").
46 enableModules("org.apidesign.*").
47 enableClasspathModules(false).
48 // honorAutoloadEager(true).
49 failOnException(Level.INFO).
50 failOnMessage(Level.WARNING)
54 public void testInvokeAllActionsInFileMenu() throws Exception {
55 Lookup menuFile = Lookups.forPath("Menu/File");
57 for (final Action a : menuFile.lookupAll(Action.class)) {
58 if (!Boolean.TRUE.equals(getValue(a, "org.apidesign.netbinox.test.mylyn"))) {
62 EventQueue.invokeLater(new Runnable() {
64 a.actionPerformed(new ActionEvent(this, 0, ""));
71 assertEquals("There are two actions provided by this sample", 2, cnt);
74 private Object getValue(final Action a, final String key) throws Exception {
75 class C implements Runnable {
79 ret = a.getValue(key);
84 EventQueue.invokeAndWait(c);