Package org.xmlBlaster.contrib

Examples of org.xmlBlaster.contrib.PropertiesInfo


   }
  
   public static void main(String[] args) {
      try {
         I_DbPool pool = new DbPool();
         I_Info info = new PropertiesInfo(System.getProperties());
         String filename = info.get("file", null);
         if (filename == null) {
            System.out.println("usage: java -Dfile=someFile org.xmlBlaster.contrib.db.DbWaitingPool");
            System.exit(-1);
         }
           
View Full Code Here


   abstract protected void doInit(I_Info info) throws XmlBlasterException;

   public I_Info init(I_Info origInfo) throws XmlBlasterException {
      // we take a clone to avoid contaminate the original info with the table settings
      I_Info info = new PropertiesInfo(new Properties());
      InfoHelper.fillInfoWithEntriesFromInfo(info, origInfo);
     
     
      String url = info.get("db.url", null);
      if (url != null) {
         if (url.startsWith("jdbc:postgresql:"))
            dbVendor = POSTGRES;
         else if (url.startsWith("jdbc:oracle:"))
            dbVendor = ORACLE;
View Full Code Here

    * @see TestCase#setUp()
    */
   protected void setUp() throws Exception {
      super.setUp();
      this.specificHelper = new SpecificHelper(System.getProperties());
      this.readerInfo = new PropertiesInfo((Properties)this.specificHelper.getProperties().clone());
      this.writerInfo = new PropertiesInfo((Properties)this.specificHelper.getProperties().clone());
      boolean extraUser = false;
      this.replPrefix = setupProperties(this.readerInfo, this.writerInfo, extraUser);
      extraUser = true; // to make it easy to recognize by the session name

      // we use the writerInfo since this will not instantiate an publisher
      I_Info tmpInfo =  new PropertiesInfo((Properties)this.specificHelper.getProperties().clone());
      setupProperties(null, tmpInfo, extraUser);
      boolean forceCreationAndInit = true;
      I_DbSpecific dbSpecific = ReplicationConverter.getDbSpecific(tmpInfo, forceCreationAndInit);
      I_DbPool pool = (I_DbPool)tmpInfo.getObject("db.pool");

      DbInfo persistentInfo = new DbInfo(pool, "replication", tmpInfo);
      String name = readerInfo.get("replication.prefix", "repl_") + ".oldReplKey";
      persistentInfo.put(name, "0");

View Full Code Here

    * Tests the creation of the necessary directories
    *
    */
   public void testDirectories() {
      // absolute path
      I_Info prop = new PropertiesInfo(new Properties());
      prop.put("mom.topicName", "dummy");
      prop.put("filewatcher.directoryName", this.pollerDirName);
      prop.put("filewatcher.sent", this.pollerDirNameSent);
      prop.put("filewatcher.discarded", this.pollerDirNameDiscarded);
      try {
         new Publisher(this.global, "test", prop);
      }
      catch (XmlBlasterException ex) {
         ex.printStackTrace();
         assertTrue("An exception should not occur here " + ex.getMessage(), false);
      }
      checkDirs();

      // repeat that with already existing directories
      prop = new PropertiesInfo(new Properties());
      prop.put("mom.topicName", "dummy");
      prop.put("filewatcher.directoryName", this.pollerDirName);
      prop.put("filewatcher.sent", this.pollerDirNameSent);
      prop.put("filewatcher.discarded", this.pollerDirNameDiscarded);
      try {
         new Publisher(this.global, "test", prop);
      }
      catch (XmlBlasterException ex) {
         ex.printStackTrace();
         assertTrue("An exception should not occur here " + ex.getMessage(), false);
      }
      checkDirs();
      cleanUpDirs();

      // relative path are added to the 'directoryName'
      prop = new PropertiesInfo(new Properties());
      prop.put("mom.topicName", "dummy");
      prop.put("filewatcher.directoryName", this.pollerDirName);
      prop.put("filewatcher.sent", "Sent");
      prop.put("filewatcher.discarded", "Discarded");
      try {
         new Publisher(this.global, "test", prop);
      }
      catch (XmlBlasterException ex) {
         ex.printStackTrace();
         assertTrue("An exception should not occur here " + ex.getMessage(), false);
      }
      checkDirs();
      // relative path are added to the 'directoryName' repeat with existing directories
      prop = new PropertiesInfo(new Properties());
      prop.put("mom.topicName", "dummy");
      prop.put("filewatcher.directoryName", this.pollerDirName);
      prop.put("filewatcher.filewatcher.sent", "Sent");
      prop.put("filewatcher.discarded", "Discarded");
      try {
         new Publisher(this.global, "test", prop);
      }
      catch (XmlBlasterException ex) {
         ex.printStackTrace();
         assertTrue("An exception should not occur here " + ex.getMessage(), false);
      }
      checkDirs();
     
      cleanUpDirs();
     
      // now some which should fail:
      // existing file but not a directory
      File file = new File(this.pollerDirName);
      try {
         file.createNewFile();
      }
      catch (IOException ex) {
         assertTrue("could not create the file '" + this.pollerDirName + "'", false);
      }
     
      prop = new PropertiesInfo(new Properties());
      prop.put("mom.topicName", "dummy");
      prop.put("filewatcher.directoryName", this.pollerDirName);
      prop.put("filewatcher.sent", "Sent");
      prop.put("filewatcher.discarded", "Discarded");
      try {
         new Publisher(this.global, "test", prop);
         assertTrue("an exception should occur since '" + this.pollerDirName + "' is a file and should be a directory", false);
      }
      catch (XmlBlasterException ex) {
         log.info("Exception is OK here");
      }
      cleanUpDirs();
     
      try {
         file = new File(this.pollerDirName);
         boolean ret = file.mkdir();
         assertTrue("could not create directory '" + this.pollerDirName + "'", ret);
         file = new File(this.pollerDirNameSent);
         file.createNewFile();
      }
      catch (IOException ex) {
         assertTrue("could not create the file '" + this.pollerDirNameSent + "'", false);
      }
     
      prop = new PropertiesInfo(new Properties());
      prop.put("mom.topicName", "dummy");
      prop.put("filewatcher.directoryName", this.pollerDirName);
      prop.put("filewatcher.sent", "Sent");
      prop.put("filewatcher.discarded", "Discarded");
      try {
         new Publisher(this.global, "test", prop);
         assertTrue("an exception should occur since '" + this.pollerDirName + "' is a file and should be a directory", false);
      }
      catch (XmlBlasterException ex) {
View Full Code Here

  
   public void testSimplePublish() {
      boolean deliverDat = true;
      boolean deliverGif = true;
      boolean absSubPath = true;
      I_Info prop = new PropertiesInfo(new Properties());
      doPublish(prop, deliverDat, deliverGif, absSubPath);
   }
View Full Code Here

   public void testSimplePublishWithFilter() {
      boolean deliverDat = false;
      boolean deliverGif = true;
      boolean absSubPath = true;
      I_Info prop = new PropertiesInfo(new Properties());
      prop.put("filewatcher.fileFilter", "*.gif");
      doPublish(prop, deliverDat, deliverGif, absSubPath);
   }
View Full Code Here

  
   public void testSimplePublishWithFilterRegex() {
      boolean deliverDat = true;
      boolean deliverGif = true;
      boolean absSubPath = true;
      I_Info prop = new PropertiesInfo(new Properties());
      prop.put("filewatcher.filterType", "regex");
      // note that the double backslash would be simple if read from the configuration file
      prop.put("filewatcher.fileFilter", "(.*\\.dat)|(.*\\.gif)");
      doPublish(prop, deliverDat, deliverGif, absSubPath);
   }
View Full Code Here

  
   public void testPublishWithMoveAbsolute() {
      boolean deliverDat = true;
      boolean deliverGif = true;
      boolean absSubPath = true;
      I_Info prop = new PropertiesInfo(new Properties());
      prop.put("filewatcher.sent", this.pollerDirName + File.separator + "Sent");
      prop.put("filewatcher.discarded", this.pollerDirName + File.separator + "Discarded");
      doPublish(prop, deliverDat, deliverGif, absSubPath);
   }
View Full Code Here

   public void testPublishWithMoveRelative() {
      boolean deliverDat = true;
      boolean deliverGif = true;
      boolean absSubPath = false;
      I_Info prop = new PropertiesInfo(new Properties());
      prop.put("filewatcher.sent", "Sent");
      prop.put("filewatcher.discarded", "Discarded");
      doPublish(prop, deliverDat, deliverGif, absSubPath);
   }
View Full Code Here

   public void testPublishWithMoveRelativeLockMode() {
      boolean deliverDat = true;
      boolean deliverGif = true;
      boolean absSubPath = false;
      I_Info prop = new PropertiesInfo(new Properties());
      prop.put("filewatcher.sent", "Sent");
      prop.put("filewatcher.discarded", "Discarded");
      prop.put("filewatcher.lockExtention", "*.lck");
      doPublish(prop, deliverDat, deliverGif, absSubPath);
   }
View Full Code Here

TOP

Related Classes of org.xmlBlaster.contrib.PropertiesInfo

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.