Package test.plugin

Examples of test.plugin.TestPluginLifeCycle


    SimplePluginDiscovery discovery = new SimplePluginDiscovery();
    discovery.add(new TelnetPlugin());
    discovery.add(handler);

    //
    ctx = new TestPluginLifeCycle(new TelnetPlugin(), handler);
    ctx.setProperty(TelnetPlugin.TELNET_PORT, port);

    //
    ctx.start();
View Full Code Here


//    IOHandler handler = new IOHandler();
    SimpleAuthenticationPlugin auth = new SimpleAuthenticationPlugin();

    //
    Foo foo = new Foo();
    TestPluginLifeCycle lifeCycle = new TestPluginLifeCycle(new SSHPlugin(), foo, auth);
    lifeCycle.setProperty(SSHPlugin.SSH_PORT, port);
    lifeCycle.setProperty(SSHPlugin.SSH_SERVER_IDLE_TIMEOUT, 10 * 60 * 1000);
    lifeCycle.setProperty(SSHPlugin.SSH_SERVER_AUTH_TIMEOUT, 10 * 60 * 1000);
    lifeCycle.setProperty(SSHPlugin.SSH_ENCODING, Utils.UTF_8);
    lifeCycle.setProperty(AuthenticationPlugin.AUTH, Arrays.asList(auth.getName()));
    lifeCycle.setProperty(SimpleAuthenticationPlugin.SIMPLE_USERNAME, "root");
    lifeCycle.setProperty(SimpleAuthenticationPlugin.SIMPLE_PASSWORD, "");
    lifeCycle.start();
    SSHClient client = new SSHClient(port).connect();

    //
//    this.handler = handler;
    this.client = client;
View Full Code Here

    final AtomicReference<String> usernameRef = new AtomicReference<String>();
    final AtomicReference<String> passwordRef = new AtomicReference<String>();
    Support support = new Support() {
      @Override
      protected TestPluginLifeCycle createLifeCycle() throws Exception {
        TestPluginLifeCycle lifeCycle = super.createLifeCycle();
        lifeCycle.setProperty(MailPlugin.SMTP_USERNAME, "foo");
        lifeCycle.setProperty(MailPlugin.SMTP_PASSWORD, "bar");
        return lifeCycle;
      }

      @Override
      protected SMTPServer createServer(MessageHandlerFactory mhf) {
View Full Code Here

  public void testAuthFailed() throws Exception {
    final AtomicBoolean done = new AtomicBoolean();
    Support support = new Support() {
      @Override
      protected TestPluginLifeCycle createLifeCycle() throws Exception {
        TestPluginLifeCycle lifeCycle = super.createLifeCycle();
        lifeCycle.setProperty(MailPlugin.SMTP_USERNAME, "foo");
        lifeCycle.setProperty(MailPlugin.SMTP_PASSWORD, "bar");
        return lifeCycle;
      }
      @Override
      protected SMTPServer createServer(MessageHandlerFactory mhf) {
        SMTPServer smtpServer = super.createServer(mhf);
View Full Code Here

          };
        }

        @Override
        protected TestPluginLifeCycle createLifeCycle() throws Exception {
          TestPluginLifeCycle lifeCycle = super.createLifeCycle();
          lifeCycle.setProperty(MailPlugin.SMTP_SECURE, SmtpSecure.TLS);
          return lifeCycle;
        }
      };

      //
View Full Code Here

  protected SMTPServer createServer(MessageHandlerFactory mhf) {
    return new SMTPServer(mhf);
  }

  protected TestPluginLifeCycle createLifeCycle() throws Exception {
    TestPluginLifeCycle test = new TestPluginLifeCycle(new MailPlugin(), new GroovyLanguageProxy(), new JavaLanguage());
    test.setProperty(MailPlugin.SMTP_HOST, "localhost");
    test.setProperty(MailPlugin.SMTP_PORT, 5000);
    test.setProperty(MailPlugin.SMTP_FROM, "foo@gmail.com");
    return test;
  }
View Full Code Here

  public void doTest() throws Exception {
    Wiser wiser = new Wiser();
    SMTPServer smtpServer = createServer(new SimpleMessageListenerAdapter(wiser));
    smtpServer.setHostName("localhost");
    smtpServer.setPort(5000);
    TestPluginLifeCycle lifeCycle = createLifeCycle();
    try {
      lifeCycle.start();
      smtpServer.start();
      execute(lifeCycle, wiser);
    }
    finally {
      smtpServer.stop();
      lifeCycle.stop();
    }
  }
View Full Code Here

    /** . */
    final TestPluginLifeCycle lifecycle;

    public Support(final String crontab) throws Exception {
      lifecycle = new TestPluginLifeCycle(new CronPlugin() {
        @Override
        protected Resource getConfig() {
          return new Resource("contrab", crontab.getBytes(), 0);
        }
      }, new GroovyLanguageProxy(), new CRaSHShellFactory());
View Full Code Here

  protected void setUp() throws Exception {
    super.setUp();

    //
    List<CRaSHPlugin<?>> plugins = getPlugins();
    TestPluginLifeCycle lifeCycle = new TestPluginLifeCycle(plugins.toArray(new CRaSHPlugin[plugins.size()]));

    //
    lifeCycle.start();

    //
    this.shell = lifeCycle.createShell();
    this.session = (ShellSession)shell; // A bit nasty but will do for tests :-)
    this.groovyShell = GroovyCompiler.getGroovyShell((ShellSession)shell);
    this.lifeCycle = lifeCycle;
  }
View Full Code Here

  @Override
  protected void setUp() throws Exception {
    super.setUp();

    //
    TestPluginLifeCycle lifeCycle = new TestPluginLifeCycle();
    lifeCycle.start();

    //
    this.lifeCycle = lifeCycle;
  }
View Full Code Here

TOP

Related Classes of test.plugin.TestPluginLifeCycle

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.