Package edu.scripps.mwsync

Examples of edu.scripps.mwsync.Sync


      parser.accepts("p", "sync one page").withRequiredArg().ofType(String.class);
      parser.accepts("h", "changes since x hours ago").withRequiredArg().ofType(Integer.class);
      OptionSet options = parser.parse(args);
      String root = "/usr/local/bin/gwsync/";
      root =  (String) (options.hasArgument("r") ? options.valueOf("r") : root);
      Sync sync = Sync.newFromConfigFile(root+"sync.conf");
      String ncboAPIKey   = sync.getProperties().getProperty("ncbo.api.key");
      String doidFile    = sync.getProperties().getProperty("doid.file");
      sync.addRewriter(new GeneWikiEditor(root, ncboAPIKey, doidFile));
      if (options.hasArgument("p")) {
        sync.runForPages((String) options.valueOf("p"));
      } else if (options.hasArgument("h")) {
        sync.runChangesFromHoursAgo((Integer)options.valueOf("h"));
      } else {
        sync.run();
      }
    } 
View Full Code Here


  public void testInstantiation()
  {
    MockWiki src = new MockWiki("url1");
    MockWiki tgt = new MockWiki("url2");
    long period = 1000;
    Sync sync = new Sync(src, tgt, period);
    assertEquals(sync.getPeriod(), period);
    assertEquals(sync.getSource(), src);
    assertEquals(sync.getTarget(), tgt);
  }
View Full Code Here

   */
  @SuppressWarnings("unused")
  @Test (expected=IllegalArgumentException.class)
  public void testFailedInstantiationNullWiki()
  {
    Sync sync = new Sync(null, null, 60);
  }
View Full Code Here

  @Test (expected=IllegalArgumentException.class)
  public void testFailedInstantiationShortPeriod()
  {
    MockWiki src = new MockWiki("url1");
    MockWiki tgt = new MockWiki("url2");
    Sync sync = new Sync(src, tgt, 30);
  }
View Full Code Here

  @Test
  public void testRun() {
    MockWiki src = new MockWiki("url1");
    MockWiki tgt = new MockWiki("url2");
    long period = 1000;
    Sync sync = new Sync(src, tgt, period);
    sync.run();
    assertEquals(tgt.editText, Arrays.asList(
        "Sample Page Text", "Sample Page Text", "Sample Page Text"));
   
  }
View Full Code Here

TOP

Related Classes of edu.scripps.mwsync.Sync

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.