Package org.jostraca.util

Examples of org.jostraca.util.PropertySetManager


    defps.put( "ruby",   makeLangPS_ruby()   );
    defps.put( "c",      makeLangPS_c()      );
    defps.put( "rebol",  makeLangPS_rebol()  );
    defps.put( "jython", makeLangPS_jython() );
    defps.put( "javascript", makeLangPS_javascript() );
    return new PropertySetManager( defps );
  }
View Full Code Here


  public void testConstructor() {
    Hashtable defps = new Hashtable();

    try {
      PropertySetManager psm04 = new PropertySetManager( null );
      fail();
    } catch( IllegalArgumentException iae ) {}

    PropertySetManager psm01 = new PropertySetManager();
    PropertySetManager psm02 = new PropertySetManager( defps );

    PropertySet ps01 = new PropertySet();
    defps.put( "ps01", ps01 );
    PropertySetManager psm03 = new PropertySetManager( defps );

    defps.put( "ps02", new Object() );
    try {
      PropertySetManager psm04 = new PropertySetManager( defps );
      fail();
    } catch( IllegalArgumentException iae ) {}

    defps.remove( "ps02" );

    defps.put( new Object(), ps01 );
    try {
      PropertySetManager psm04 = new PropertySetManager( defps );
      fail();
    } catch( IllegalArgumentException iae ) {}
  }
View Full Code Here

    } catch( IllegalArgumentException iae ) {}
  }


  public void testLoad() throws Exception {
    PropertySetManager psm01 = new PropertySetManager();
    PropertySet ps01 = psm01.load( "test01", Tools.findRelativeSystemPath("src/org/jostraca/util/test/test.conf") );
    assertEquals( "0", ps01.get("a") );
    assertEquals( "1", ps01.get("b") );

    try {
      psm01.load( "test02", new File("notest.conf") );
      fail();    
    } catch( PropertySetException ioe ) {}

    try {
      psm01.load( "test02", new File("notest.conf"), PropertySetManager.FILE_MUST_EXIST );
      fail();
    } catch( PropertySetException ioe ) {}

    try {
      PropertySet ps01o = psm01.load( "test01", new File("notest.conf"), PropertySetManager.USE_DEFAULT_IF_FILE_DOES_NOT_EXIST );
      assertEquals( ps01o, ps01 );
    } catch( PropertySetException ioe ) { fail(); }
  }
View Full Code Here

    } catch( PropertySetException ioe ) { fail(); }
  }


  public void testAdd() {
    PropertySetManager psm01 = new PropertySetManager();
    PropertySet ps01 = new PropertySet();
    psm01.put( "ps01", ps01 );

    try {
      psm01.put( null, ps01 );
      fail();
    } catch( IllegalArgumentException iae ) {}
    try {
      psm01.put( "ps01", null );
      fail();
    } catch( IllegalArgumentException iae ) {}
    try {
      psm01.put( null, null );
      fail();
    } catch( IllegalArgumentException iae ) {}

  }
View Full Code Here

  }


  public void testGet() {
    PropertySetManager psm01 = new PropertySetManager();
    PropertySet ps01 = new PropertySet();
    psm01.put( "ps01", ps01 );

    PropertySet ps01o = psm01.get( "ps01" );
    assertEquals( ps01, ps01o );

    try {
      psm01.get( "ps02" );
      fail();
    } catch( Exception iae ) {}
  }
View Full Code Here

    } catch( Exception iae ) {}
  }


  public void testRemove() {
    PropertySetManager psm01 = new PropertySetManager();
    PropertySet ps01 = new PropertySet();
    psm01.put( "ps01", ps01 );
    PropertySet ps01o = psm01.remove( "ps01" );
    assertEquals( ps01, ps01o );

    try {
      psm01.get( "ps01" );
      fail();
    } catch( Exception iae ) {}

  }
View Full Code Here

    defps.put( "c",      makeLangPS_c()      );
    defps.put( "rebol",  makeLangPS_rebol()  );
    defps.put( "jython", makeLangPS_jython() );
    defps.put( "javascript", makeLangPS_javascript() );
    defps.put( "groovy",     makeLangPS_groovy() );
    return new PropertySetManager( defps );
  }
View Full Code Here

TOP

Related Classes of org.jostraca.util.PropertySetManager

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.