Package org.jostraca.util

Examples of org.jostraca.util.OrderedPropertySetManager


    defps.put( Service.CONF_local,    new PropertySet() );
    defps.put( Service.CONF_template, new PropertySet() );
    defps.put( Service.CONF_cmdline,  new PropertySet() );
    defps.put( Service.CONF_override, new PropertySet() );

    return new OrderedPropertySetManager( names, defps );
  }
View Full Code Here


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

    try {
      OrderedPropertySetManager opsm = new OrderedPropertySetManager( null, null );
      fail();
    } catch( Exception iae ) {}
    try {
      OrderedPropertySetManager opsm = new OrderedPropertySetManager( null, defps );
      fail();
    } catch( Exception iae ) {}
    try {
      OrderedPropertySetManager opsm = new OrderedPropertySetManager( names, null );
      fail();
    } catch( Exception iae ) {}

    OrderedPropertySetManager opsm01 = new OrderedPropertySetManager();
    OrderedPropertySetManager opsm02 = new OrderedPropertySetManager( names, defps );


    PropertySet ps01 = new PropertySet();
    defps.put( "ps01", ps01 );
    names.add( "ps01" );
    OrderedPropertySetManager opsm03 = new OrderedPropertySetManager( names, defps );

    defps.put( "ps02", new Object() );
    try {
      OrderedPropertySetManager opsm04 = new OrderedPropertySetManager( names, defps );
      fail();
    } catch( Exception iae ) {}

    defps.put( "ps02", new PropertySet() );
    names.add( "ps02" );
    OrderedPropertySetManager opsm05 = new OrderedPropertySetManager( names, defps );

    defps.remove( "ps02" );

    try {
      OrderedPropertySetManager opsm06 = new OrderedPropertySetManager( names, defps );
      fail();
    } catch( Exception iae ) {}

    names.remove( "ps02" );
    OrderedPropertySetManager opsm07 = new OrderedPropertySetManager( names, defps );

    names.add( new Object() );
    try {
      OrderedPropertySetManager opsm06 = new OrderedPropertySetManager( names, defps );
      fail();
    } catch( Exception iae ) {}
  }
View Full Code Here

    } catch( Exception iae ) {}
  }


  public void testAdd() {
    OrderedPropertySetManager opsm01 = new OrderedPropertySetManager( new Vector(), new Hashtable() );
    opsm01.add( "foo", new PropertySet() );
    opsm01.add( "bar", new PropertySet() );
    opsm01.put( "foo", new PropertySet() );
  }
View Full Code Here

    opsm01.put( "foo", new PropertySet() );
  }


  public void testRemove() {
    OrderedPropertySetManager opsm01 = new OrderedPropertySetManager( new Vector(), new Hashtable() );
    try {
      opsm01.remove( "foo" );
      fail();
    } catch( Exception uoe ) {}
  }
View Full Code Here

    Hashtable defps = new Hashtable();
    defps.put( "ps01", new PropertySet() );
    defps.put( "ps02", new PropertySet() );

    OrderedPropertySetManager opsm01 = new OrderedPropertySetManager( names, defps );
    opsm01.put( "ps01", new PropertySet() );

    try {
      opsm01.put( "ps02", null );
      fail();
    } catch( Exception iae ) {}

    try {
      opsm01.put( "ps03", new PropertySet() );
      fail();
    } catch( Exception ise ) {}
  }
View Full Code Here

    PropertySet ps02 = new PropertySet();

    defps.put( "ps01", ps01 );
    defps.put( "ps02", ps02 );

    OrderedPropertySetManager opsm01 = new OrderedPropertySetManager( names, defps );
    assertEquals( ps01, opsm01.get( "ps01" ) );
    assertEquals( ps02, opsm01.get( "ps02" ) );

    try {
      opsm01.get( "ps03" );
      fail();
    } catch( Exception ise ) {}
  }
View Full Code Here

    defps.put( "ps01", ps01 );
    defps.put( "ps02", ps02 );
    defps.put( "ps03", ps03 );

    OrderedPropertySetManager opsm01 = new OrderedPropertySetManager( names, defps );
    // also test cloning
    ps01.set( "a", "-" );
    ps01.set( "b", "-" );
    ps01.set( "c", "-" );

    PropertySet ops = opsm01.merge();
    assertEquals( "a01", ops.get("a") );
    assertEquals( "b02", ops.get("b") );
    assertEquals( "c03", ops.get("c") );
    assertEquals( "d03", ops.get("d") );
  }
View Full Code Here

    PropertySet ps02 = new PropertySet();
    ps02.set( "default02", "true" );
    psdefs.put( "test01", ps01 );
    psdefs.put( "test02", ps02 );

    OrderedPropertySetManager opsm01 = new OrderedPropertySetManager( names, psdefs );
   
    PropertySet ops01 = opsm01.load( "test01", Tools.findRelativeSystemPath("src/org/jostraca/util/test/test.conf") );
    assertEquals( "0", ops01.get("a") );
    assertEquals( "1", ops01.get("b") );
    assertEquals( "",  ops01.get("default01") );

    try {
      PropertySet ops02 = opsm01.load( "test02", new File("no-test.conf") );
      fail();
    } catch( Exception ioe ) {}
    try {
      PropertySet ops02 = opsm01.load( "test02", new File("no-test.conf"), PropertySetManager.FILE_MUST_EXIST );
      fail();
    } catch( Exception ioe ) {}


    try {
      PropertySet ops02 = opsm01.load( "test02", new File("no-test.conf"), PropertySetManager.USE_DEFAULT_IF_FILE_DOES_NOT_EXIST );
      assertEquals( "true",  ops02.get("default02") );
    } catch( Exception ioe ) { fail(); }
   

    /*
 
View Full Code Here

    defps.put( Service.CONF_local,    new PropertySet() );
    defps.put( Service.CONF_template, new PropertySet() );
    defps.put( Service.CONF_cmdline,  new PropertySet() );
    defps.put( Service.CONF_override, new PropertySet() );

    return new OrderedPropertySetManager( names, defps );
  }
View Full Code Here

TOP

Related Classes of org.jostraca.util.OrderedPropertySetManager

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.