Package barrysoft.plugins

Examples of barrysoft.plugins.Plugin


      fail(String.format("%s, Cause: (%s) %s", e.getMessage(),
          e.getCause().getClass().getCanonicalName(),
          e.getCause().getMessage()));
    }
   
    Plugin p = pm.getPlugin(0);
   
    assertEquals("Test Plugin 1", p.getInfo().getName());
    assertEquals(p.getClass().getCanonicalName(), p.getInfo().getJarClass());
    assertEquals("test_plugin.jar", p.getInfo().getJarName());
    assertEquals("Test Type", p.getInfo().getType());
    assertEquals("Plugins Testing Unit", p.getInfo().getHostApplication());
    assertEquals("1.0", p.getInfo().getVersion());
    assertEquals("Daniele Rapagnani", p.getInfo().getAuthor());
    assertEquals("This plugin does nothing and is only used for testing purposes",
          p.getInfo().getDescription());
   
    p.getOptions().setOption("regex", "(?i).*?<h href=\"bla\">.*?");
   
    try {
      for (int i=1; i <= 4; i++)
        assertEquals("test"+i, p.getOptions().getOptionValue("option"+i, String.class));
    } catch (OptionNotFoundException e) {
      fail(e.getMessage());
    }
   
    Vector<String> v = new Vector<String>();
   
    for (int i=0; i < 20; i++) {
      String uuid = UUID.randomUUID().toString();
     
      v.add(uuid);
     
      p.getOptions().setOption("uuid"+(i+1), uuid);
    }
   
    try {
      p.save();
    } catch (IOException e1) {
      fail(e1.getMessage());
    }
   
    pm = new PluginsManager<TestPlugin>();
   
    try {
      pm.addPlugin(pluginFile);
    } catch (PluginLoadingException e) {
      fail(e.getMessage());
    }
   
    p = pm.getPlugin(0);
   
    try {
      for (int i=0; i < 20; i++)
        assertEquals(v.get(i), p.getOptions().getOptionValue("uuid"+(i+1), String.class));
    } catch (OptionNotFoundException e) {
      fail(e.getMessage());
    }
   
    try {
      assertEquals("(?i).*?<h href=\"bla\">.*?",p.getOptions().getOptionValue("regex", String.class));
    } catch (OptionNotFoundException e) {
      fail(e.getMessage());
    }
   
    assertEquals(TestPlugin.EXTERNAL, ((Testable)p).test());
View Full Code Here

TOP

Related Classes of barrysoft.plugins.Plugin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.