Package de.mhus.lib.config

Examples of de.mhus.lib.config.XmlConfig


        element.setAttribute("type", "group");
      else
        element.setAttribute("type", "field");
    }

    load(new XmlConfig(root),this.root);
  }
View Full Code Here


  public void testXml() throws Exception {
   
    String xml = "<start test1='wow' test2='alf'><sub test1='wow1' test2='alf1'/><sub test1='wow2' test2='alf2'/><sub test1='wow3' test2='alf3'/></start>";
    Document doc = MXml.loadXml(xml);
   
    XmlConfig c = new XmlConfig(doc.getDocumentElement());
   
    derTeschd(c, true);

  }
View Full Code Here

    ConfigBuilder builder = new ConfigBuilder();
   
    String xml = "<start test1='wow' test2='alf'><sub test1='wow1' test2='alf1'/><sub test1='wow2' test2='alf2'/><sub test1='wow3' test2='alf3'/></start>";
    Document doc = MXml.loadXml(xml);
   
    XmlConfig src = new XmlConfig(doc.getDocumentElement());

    HashConfig tar1 = new HashConfig();
    JsonConfig tar2 = new JsonConfig();
    XmlConfig  tar3 = new XmlConfig();
   
    builder.cloneConfig(src, tar1);
    builder.cloneConfig(src, tar2);
    builder.cloneConfig(src, tar3);
   
View Full Code Here

    public void testLifecycle() throws Exception
    {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c name='Test1'/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1 };
      MyBundle b1 = new MyBundle("mybundle", true, ac1 );
     
      List<IModActivator> activators = new LinkedList<IModActivator>();
      manager.initializeBundle(b1,activators);
View Full Code Here

    public void testLifecycleFailInit() throws Exception
    {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c fail_initialize='1'/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1 };
      MyBundle b1 = new MyBundle("mybundle", true, ac1 );
     
      List<IModActivator> activators = new LinkedList<IModActivator>();
      try {
View Full Code Here

    public void testConsistentOn() throws Exception
    {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c id='test1' />").getDocumentElement() ) );
      MyConfig a2 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c id='test2' fail_initialize='1'/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1, a2 };
      MyBundle b1 = new MyBundle("mybundle", true, ac1 );
     
      List<IModActivator> activators = new LinkedList<IModActivator>();
    try {
View Full Code Here

    public void testConsistentOff() throws Exception
    {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c/>").getDocumentElement() ) );
      MyConfig a2 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c fail_initialize='1'/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1, a2 };
      MyBundle b1 = new MyBundle("mybundle", false, ac1 );
           
      List<IModActivator> activators = new LinkedList<IModActivator>();
      manager.initializeBundle(b1,activators);
View Full Code Here

    public void testBundles2() throws Exception
    {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c/>").getDocumentElement() ) );
      MyConfig a2 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1, a2 };
      MyBundle b1 = new MyBundle("mybundle", false, ac1 );
     
      List<IModActivator> activators1 = new LinkedList<IModActivator>();
      manager.initializeBundle(b1,activators1);
      assertTrue( activators1.size() == 2 );
      assertTrue( manager.getActivators().size() == 2 );
     
      IModActivator act1 = activators1.get(0);
      assertTrue( act1.getStatus() == IModActivator.STATUS.INITIALIZED );
      manager.enableActivators(activators1);
      assertTrue( act1.getStatus() == IModActivator.STATUS.ENABLED );
      manager.disableActivators(activators1);
     
      MyConfig a3 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c/>").getDocumentElement() ) );
      MyConfig a4 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c/>").getDocumentElement() ) );
      IModConfig[] ac2 = new IModConfig[] { a3, a4 };
      MyBundle b2 = new MyBundle("mybundle", false, ac2 );
           
      List<IModActivator> activators2 = new LinkedList<IModActivator>();
      manager.initializeBundle(b2,activators2);
View Full Code Here

     */
    public void testServiceRegister() throws Exception {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c register_service='1'/>").getDocumentElement() ) );
      MyConfig a2 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c lookup_service='1'/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1, a2 };
      MyBundle b1 = new MyBundle("mybundle", false, ac1 );
     
      List<IModActivator> activators = new LinkedList<IModActivator>();
      manager.initializeBundle(b1,activators);
View Full Code Here

     */
    public void testServiceLookupException() throws Exception {
     
      ModManager manager = new ModManager(base);

      MyConfig a1 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c id='test1'/>").getDocumentElement() ) );
      MyConfig a2 = new MyConfig( SimpleActivator.class.getCanonicalName(), new XmlConfig( null, MXml.loadXml("<c id='test2' lookup_service='1'/>").getDocumentElement() ) );
      IModConfig[] ac1 = new IModConfig[] { a1, a2 };
      MyBundle b1 = new MyBundle("mybundle", false, ac1 );
     
      List<IModActivator> activators = new LinkedList<IModActivator>();
      manager.initializeBundle(b1,activators);
View Full Code Here

TOP

Related Classes of de.mhus.lib.config.XmlConfig

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.