FileDocCategorySizeDatePackage
TestBeans.javaAPI DocJBoss 4.2.14506Fri Jul 13 20:52:32 BST 2007org.jboss.deployment.spi.beans

TestBeans

public class TestBeans extends Object

Fields Summary
Constructors Summary
Methods Summary
public static voidindentPrint(int x, java.lang.String y)

      String s = "";
      for (int i = 0; i < x; i++)
         s += " ";
      System.out.println(s + y);
   
public static voidtest_remove(javax.enterprise.deploy.spi.DConfigBean config, javax.enterprise.deploy.model.DDBean dd)

      try
      {
         System.out.println(config.getXpaths().length + " xpaths.");
         String targetXPath = config.getXpaths()[0];
         System.out.println(targetXPath + " is the first.");
         DDBean first = dd.getChildBean(targetXPath)[0];
         DConfigBean cnfg = config.getDConfigBean(first);
         System.out.println("cnfg has " + cnfg.getXpaths().length + " sub kids");
         config.removeDConfigBean(cnfg);
         System.out.println("cnfg has " + cnfg.getXpaths().length + " sub kids");
         System.out.println(config.getXpaths().length + " xpaths.");

      }
      catch (Exception e)
      {
         System.out.println("ERROR: " + e.getMessage());
         e.printStackTrace();
      }
   
public static voidtraverse(javax.enterprise.deploy.spi.DConfigBean config, javax.enterprise.deploy.model.DDBean dd, int indent)

      indent += 3;
      indentPrint(indent, "starting \"" + dd.getXpath() + "\", config of type " + trimClass(config.getClass()));
      String[] pathsToFollow = config.getXpaths();
      if (pathsToFollow.length > 0)
         indentPrint(indent, "- There are " + pathsToFollow.length + " xpaths returned.");
      indent += 4;
      for (int i = 0; i < pathsToFollow.length; i++)
      {
         String s = "path " + i + ": " + pathsToFollow[i];
         DDBean[] lesserBeans = dd.getChildBean(pathsToFollow[i]);
         indentPrint(indent, s + " , " + lesserBeans.length + " found.");

         for (int j = 0; j < lesserBeans.length; j++)
         {
            DConfigBean cb = config.getDConfigBean(lesserBeans[j]);
            traverse(cb, lesserBeans[j], indent);
         }
      }

   
public static java.lang.StringtrimClass(java.lang.Class c)

      int dot = c.getName().lastIndexOf('.");
      int dollar = c.getName().lastIndexOf('$");
      if (dollar == -1)
      {
         return c.getName().substring(dot + 1);
      }
      return c.getName().substring(dollar + 1);