⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pluginmanagertest.java

📁 JSPWiki,100%Java开发的一套完整WIKI程序
💻 JAVA
字号:
package com.ecyrd.jspwiki.plugin;import com.ecyrd.jspwiki.*;import junit.framework.*;import java.util.*;public class PluginManagerTest extends TestCase{    public static final String NAME1 = "Test1";    Properties props = new Properties();    WikiEngine engine;    WikiContext context;    PluginManager manager;        public PluginManagerTest( String s )    {        super( s );    }    public void setUp()        throws Exception    {        props.load( TestEngine.findTestProperties() );        engine = new TestEngine(props);        context = new WikiContext( engine, new WikiPage("testpage") );        manager = new PluginManager( props );    }    public void tearDown()    {    }    public void testSimpleInsert()        throws Exception    {        String res = manager.execute( context,                                      "{INSERT com.ecyrd.jspwiki.plugin.SamplePlugin WHERE text=foobar}");        assertEquals( "foobar",                      res );    }    public void testSimpleInsertNoPackage()        throws Exception    {        String res = manager.execute( context,                                      "{INSERT SamplePlugin WHERE text=foobar}");        assertEquals( "foobar",                      res );    }    public void testSimpleInsertNoPackage2()        throws Exception    {        props.setProperty( PluginManager.PROP_SEARCHPATH, "com.foo" );        PluginManager m = new PluginManager( props );        String res = m.execute( context,                                "{INSERT SamplePlugin2 WHERE text=foobar}");        assertEquals( "foobar",                      res );    }    public void testSimpleInsertNoPackage3()        throws Exception    {        props.setProperty( PluginManager.PROP_SEARCHPATH, "com.foo" );        PluginManager m = new PluginManager( props );        String res = m.execute( context,                                "{INSERT SamplePlugin3 WHERE text=foobar}");        assertEquals( "foobar",                      res );    }    /** Check that in all cases com.ecyrd.jspwiki.plugin is searched. */    public void testSimpleInsertNoPackage4()        throws Exception    {        props.setProperty( PluginManager.PROP_SEARCHPATH, "com.foo,blat.blaa" );        PluginManager m = new PluginManager( props );        String res = m.execute( context,                                "{INSERT SamplePlugin WHERE text=foobar}");        assertEquals( "foobar",                      res );    }    public void testSimpleInsert2()        throws Exception    {        String res = manager.execute( context,                                      "{INSERT   com.ecyrd.jspwiki.plugin.SamplePlugin  WHERE   text = foobar2, moo=blat}");        assertEquals( "foobar2",                      res );    }    /** Missing closing brace */    public void testSimpleInsert3()        throws Exception    {        String res = manager.execute( context,                                      "{INSERT   com.ecyrd.jspwiki.plugin.SamplePlugin  WHERE   text = foobar2, moo=blat");        assertEquals( "foobar2",                      res );    }    public void testQuotedArgs()        throws Exception    {        String res = manager.execute( context,                                      "{INSERT SamplePlugin WHERE text='this is a space'}");        assertEquals( "this is a space",                      res );    }    public void testQuotedArgs2()        throws Exception    {        String res = manager.execute( context,                                      "{INSERT SamplePlugin WHERE text='this \\'is a\\' space'}");        assertEquals( "this 'is a' space",                      res );    }    public void testNumberArgs()        throws Exception    {        String res = manager.execute( context,                                      "{INSERT SamplePlugin WHERE text=15}");        assertEquals( "15",                      res );    }    public void testNoInsert()        throws Exception    {        String res = manager.execute( context,                                      "{SamplePlugin WHERE text=15}");        assertEquals( "15",                      res );    }        public static Test suite()    {        return new TestSuite( PluginManagerTest.class );    }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -