You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@beehive.apache.org by ek...@apache.org on 2005/08/12 17:23:08 UTC

svn commit: r232310 [79/92] - in /beehive/trunk/controls/test: common/ infra/gtlf/ infra/gtlf/xsl/ infra/mantis/ infra/tch/ infra/tch/messages/ infra/tch/runtime/ infra/tch/schema/ perf/ perf/bin/ perf/cases/ perf/ctlsrc/org/apache/beehive/controls/per...

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/BasicCache.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/BasicCache.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/BasicCache.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/BasicCache.java Fri Aug 12 08:12:28 2005
@@ -1,68 +1,68 @@
-package org.apache.beehive.test.tools.tch.util;
-
-import java.util.HashMap;
-import java.util.Map;
-
-/**
- * BasicCache is simply a HashMap...  very little overhead
- */
-public abstract class BasicCache
-	implements Cache
-{
-    // place to hold cache
-    protected HashMap mCache = new HashMap();
-
-    // overriden method
-    public abstract Object miss(Object key)
-        throws Exception;
-
-    public void flush()
-    {
-        mCache.clear();
-    }
-    
-    public void expire(Object key)
-    {
-        mCache.remove(key);
-    }
-    
-    public void hit(Object key)
-    {
-    }
-    
-    public Object get(Object key)
-        throws Exception
-    {
-        if (!contains(key))
-        {
-            // place in cache
-            add(key, miss(key));
-        }
-        else
-        {
-            // object found
-            hit(key);
-        }
-        return mCache.get(key);
-    }
-    
-    public void add(Object key, Object value)
-    {
-        mCache.put(key, value);
-    }
-    
-    public void addAll(Map aMap) 
-    {
-        mCache.putAll(aMap);
-    }
-    
-    public boolean contains(Object key)
-    {
-    	return mCache.containsKey(key);
-    }
-
-    public String toString()
-    {
-        return mCache.toString();
-    }
-}
+package org.apache.beehive.test.tools.tch.util;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * BasicCache is simply a HashMap...  very little overhead
+ */
+public abstract class BasicCache
+	implements Cache
+{
+    // place to hold cache
+    protected HashMap mCache = new HashMap();
+
+    // overriden method
+    public abstract Object miss(Object key)
+        throws Exception;
+
+    public void flush()
+    {
+        mCache.clear();
+    }
+    
+    public void expire(Object key)
+    {
+        mCache.remove(key);
+    }
+    
+    public void hit(Object key)
+    {
+    }
+    
+    public Object get(Object key)
+        throws Exception
+    {
+        if (!contains(key))
+        {
+            // place in cache
+            add(key, miss(key));
+        }
+        else
+        {
+            // object found
+            hit(key);
+        }
+        return mCache.get(key);
+    }
+    
+    public void add(Object key, Object value)
+    {
+        mCache.put(key, value);
+    }
+    
+    public void addAll(Map aMap) 
+    {
+        mCache.putAll(aMap);
+    }
+    
+    public boolean contains(Object key)
+    {
+    	return mCache.containsKey(key);
+    }
+
+    public String toString()
+    {
+        return mCache.toString();
+    }
+}

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/BasicCache.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/BlockUntilSocketOpen.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/BlockUntilSocketOpen.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/BlockUntilSocketOpen.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/BlockUntilSocketOpen.java Fri Aug 12 08:12:28 2005
@@ -1,75 +1,75 @@
-package org.apache.beehive.test.tools.tch.util;
-
-import java.io.IOException;
-import java.net.Socket;
-
-
-/**
- * This is not an Ant Task because we might later 
- * use Ant's java task timeout mechanism when this.
- * 
- */
-public class BlockUntilSocketOpen 
-{
-  public static final String HOST_KEY = "host";
-  public static final String PORT_KEY = "port";
-  
-  private String host = null;
-  private int port = -1;
-  
-
-  public static void main(String[] args)
-  {
-	BlockUntilSocketOpen block = new BlockUntilSocketOpen();
-	block.setPort(Integer.parseInt(System.getProperty(PORT_KEY)));
-  	block.setHost(System.getProperty(HOST_KEY));
-  	block.execute();
-  }
-
-  public void setHost(String in)
-  {
-    host = in;
-  }
-
-  public void setPort(int in)
-  {
-    port = in;
-  }
-
-  public void execute()
-  {
-  	System.out.println("Trying to ping " + host + ":" + port);
-  	while (!canPing());
-	System.out.println("Was able to ping " + host + ":" + port);
-  }
-
-  private boolean canPing()
-  {
-    Socket s = null;
-    boolean connected = false;
-    try
-    {
-      s = new Socket(host, port);
-      connected = true;
-    }
-    catch (Exception ex)
-    {
-      connected = false;
-    }
-    if (connected)
-    {
-      try 
-      {
-      	s.close();
-      } catch (IOException ex)
-      {
-      	
-      }
-      return true;
-    }
-    else
-    {
-      return false;
-    }
-  }
-}
+package org.apache.beehive.test.tools.tch.util;
+
+import java.io.IOException;
+import java.net.Socket;
+
+
+/**
+ * This is not an Ant Task because we might later 
+ * use Ant's java task timeout mechanism when this.
+ * 
+ */
+public class BlockUntilSocketOpen 
+{
+  public static final String HOST_KEY = "host";
+  public static final String PORT_KEY = "port";
+  
+  private String host = null;
+  private int port = -1;
+  
+
+  public static void main(String[] args)
+  {
+	BlockUntilSocketOpen block = new BlockUntilSocketOpen();
+	block.setPort(Integer.parseInt(System.getProperty(PORT_KEY)));
+  	block.setHost(System.getProperty(HOST_KEY));
+  	block.execute();
+  }
+
+  public void setHost(String in)
+  {
+    host = in;
+  }
+
+  public void setPort(int in)
+  {
+    port = in;
+  }
+
+  public void execute()
+  {
+  	System.out.println("Trying to ping " + host + ":" + port);
+  	while (!canPing());
+	System.out.println("Was able to ping " + host + ":" + port);
+  }
+
+  private boolean canPing()
+  {
+    Socket s = null;
+    boolean connected = false;
+    try
+    {
+      s = new Socket(host, port);
+      connected = true;
+    }
+    catch (Exception ex)
+    {
+      connected = false;
+    }
+    if (connected)
+    {
+      try 
+      {
+      	s.close();
+      } catch (IOException ex)
+      {
+      	
+      }
+      return true;
+    }
+    else
+    {
+      return false;
+    }
+  }
+}

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/BlockUntilSocketOpen.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/Cache.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/Cache.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/Cache.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/Cache.java Fri Aug 12 08:12:28 2005
@@ -1,28 +1,28 @@
-package org.apache.beehive.test.tools.tch.util;
-
-import java.io.Serializable;
-import java.util.Map;
-
-public interface Cache
-    extends Serializable
-{
-    // Hook to tell cache what to do if it does not contain requested item
-    public Object miss(Object key)
-        throws Exception;
-    
-    public void flush();
-
-    public void expire(Object key);
-    
-    public void hit(Object key);
-    
-    public Object get(Object key)
-        throws Exception;
-    
-    public void add(Object key, Object value);
-    
-    public void addAll(Map aMap);
-    
-    public boolean contains(Object key);
-}
-
+package org.apache.beehive.test.tools.tch.util;
+
+import java.io.Serializable;
+import java.util.Map;
+
+public interface Cache
+    extends Serializable
+{
+    // Hook to tell cache what to do if it does not contain requested item
+    public Object miss(Object key)
+        throws Exception;
+    
+    public void flush();
+
+    public void expire(Object key);
+    
+    public void hit(Object key);
+    
+    public Object get(Object key)
+        throws Exception;
+    
+    public void add(Object key, Object value);
+    
+    public void addAll(Map aMap);
+    
+    public boolean contains(Object key);
+}
+

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/Cache.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CaseInsensitiveStringKey.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CaseInsensitiveStringKey.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CaseInsensitiveStringKey.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CaseInsensitiveStringKey.java Fri Aug 12 08:12:28 2005
@@ -1,37 +1,37 @@
-package org.apache.beehive.test.tools.tch.util;
-
-public class CaseInsensitiveStringKey
-{
-  private String s = null;
-  
-  public CaseInsensitiveStringKey(String inS)
-  {
-    s = inS;
-  }
-
-  public String getString()
-  {
-    return s;
-  }
-
-  public boolean equals(Object o)
-  {
-    if(o instanceof CaseInsensitiveStringKey)
-      return s.equalsIgnoreCase(((CaseInsensitiveStringKey)o).s);
-    else
-      return false;
-  }
-  
-  public int hashCode()
-  {
-    if(s!=null)
-      return s.toLowerCase().hashCode();
-    else
-      return 0;
-  }
-
-  public String toString()
-  {
-    return s;
-  }
-}
+package org.apache.beehive.test.tools.tch.util;
+
+public class CaseInsensitiveStringKey
+{
+  private String s = null;
+  
+  public CaseInsensitiveStringKey(String inS)
+  {
+    s = inS;
+  }
+
+  public String getString()
+  {
+    return s;
+  }
+
+  public boolean equals(Object o)
+  {
+    if(o instanceof CaseInsensitiveStringKey)
+      return s.equalsIgnoreCase(((CaseInsensitiveStringKey)o).s);
+    else
+      return false;
+  }
+  
+  public int hashCode()
+  {
+    if(s!=null)
+      return s.toLowerCase().hashCode();
+    else
+      return 0;
+  }
+
+  public String toString()
+  {
+    return s;
+  }
+}

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CaseInsensitiveStringKey.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/ChildThread.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/ChildThread.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/ChildThread.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/ChildThread.java Fri Aug 12 08:12:28 2005
@@ -1,11 +1,11 @@
-package org.apache.beehive.test.tools.tch.util;
-
-/**
- * Interface for threads to give a reference back to
- * the thread that spawned them.  
- */
-
-public interface ChildThread
-{
-    public Thread getParentThread();
-}
+package org.apache.beehive.test.tools.tch.util;
+
+/**
+ * Interface for threads to give a reference back to
+ * the thread that spawned them.  
+ */
+
+public interface ChildThread
+{
+    public Thread getParentThread();
+}

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/ChildThread.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CmdDashDEmulator.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CmdDashDEmulator.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CmdDashDEmulator.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CmdDashDEmulator.java Fri Aug 12 08:12:28 2005
@@ -1,109 +1,109 @@
-package org.apache.beehive.test.tools.tch.util;
-
-import java.lang.reflect.Method;
-import java.lang.reflect.Modifier;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
-
-/**
- * It is akward to use tab complete when setting many -D options (java system
- * properties) on a command line. Instead of -Dfoo=blah, I want to be able to 
- * type -Dfoo blah. This class allows to do that - it will do the appropriate
- * conversion (meaning, insert a '=' where necessary), and then delegate to the 
- * real main class we actually want to run.
- * 
- * @version 1.0, October 30th, 2002
- */
-public class CmdDashDEmulator 
-{
-
-  private static final String MAIN_CLASS_PROP_NAME = "-mainclass";
-  private static String mainClassName = null;
-
-  private static StringBuffer newCmd = new StringBuffer();
-   
-  public static void main(String[] args)
-    throws Exception
-  {
-    String newArgs[] = checkArgs(args);
-
-    for (int i = 0; i < newArgs.length; i++)
-    {
-      String token = newArgs[i];
-      newCmd.append(token);
-      if (token.startsWith("-D") && token.indexOf("=") == -1)
-      {
-        newCmd.append("=");
-      }
-      else
-      {
-        newCmd.append(" ");
-      }
-    }
-    System.out.println("\ncmd is: " + newCmd.toString() + "\n");
-    Method main = getMain();
-    main.invoke(null, new Object[]{newArgs});
-  }
-
-  private static Method getMain()
-    throws Exception
-  {
-    Class mainClass = Class.forName(mainClassName);
-    Method main = mainClass.getMethod("main", new Class[]{String[].class});
-    if ((!main.getReturnType().getName().equals("void")) ||
-         (!Modifier.isStatic(main.getModifiers())))
-    {
-      throw new NoMainMethodFoundException("public static void main " + 
-                                           "(String[] args) not declared " +
-                                           "for class " + mainClass);
-    }
-    return main;
-  }
-
-  private static String[] checkArgs(String args[])
-  {
-    String newArgs[] = args;
-    mainClassName = GeneralUtil.getValueFor(args, MAIN_CLASS_PROP_NAME);
-    if (mainClassName == null)  
-    {
-      throw new ParamMustBeSetException(MAIN_CLASS_PROP_NAME + " must be set");
-    }
-    else
-    {
-      // Move this bit into GeneralUtil also.
-      List argsList = new ArrayList(Arrays.asList(newArgs));
-      int index = GeneralUtil.getIndexOf(newArgs, MAIN_CLASS_PROP_NAME);
-      argsList.remove(index);
-      argsList.remove(index);
-      newArgs = (String[])argsList.toArray(new String[1]);
-    }
-    return newArgs;
-  }
-
-  private static class NoMainMethodFoundException
-    extends RuntimeException
-  {
-    public NoMainMethodFoundException()
-    {
-      super();
-    }
-    public NoMainMethodFoundException(String message)
-    {
-      super(message);
-    }
-  }
-
-  private static class ParamMustBeSetException
-    extends RuntimeException
-  {
-    public ParamMustBeSetException()
-    {
-      super();
-    }
-    public ParamMustBeSetException(String message)
-    {
-      super(message);
-    }
-  }
-}
+package org.apache.beehive.test.tools.tch.util;
+
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+
+/**
+ * It is akward to use tab complete when setting many -D options (java system
+ * properties) on a command line. Instead of -Dfoo=blah, I want to be able to 
+ * type -Dfoo blah. This class allows to do that - it will do the appropriate
+ * conversion (meaning, insert a '=' where necessary), and then delegate to the 
+ * real main class we actually want to run.
+ * 
+ * @version 1.0, October 30th, 2002
+ */
+public class CmdDashDEmulator 
+{
+
+  private static final String MAIN_CLASS_PROP_NAME = "-mainclass";
+  private static String mainClassName = null;
+
+  private static StringBuffer newCmd = new StringBuffer();
+   
+  public static void main(String[] args)
+    throws Exception
+  {
+    String newArgs[] = checkArgs(args);
+
+    for (int i = 0; i < newArgs.length; i++)
+    {
+      String token = newArgs[i];
+      newCmd.append(token);
+      if (token.startsWith("-D") && token.indexOf("=") == -1)
+      {
+        newCmd.append("=");
+      }
+      else
+      {
+        newCmd.append(" ");
+      }
+    }
+    System.out.println("\ncmd is: " + newCmd.toString() + "\n");
+    Method main = getMain();
+    main.invoke(null, new Object[]{newArgs});
+  }
+
+  private static Method getMain()
+    throws Exception
+  {
+    Class mainClass = Class.forName(mainClassName);
+    Method main = mainClass.getMethod("main", new Class[]{String[].class});
+    if ((!main.getReturnType().getName().equals("void")) ||
+         (!Modifier.isStatic(main.getModifiers())))
+    {
+      throw new NoMainMethodFoundException("public static void main " + 
+                                           "(String[] args) not declared " +
+                                           "for class " + mainClass);
+    }
+    return main;
+  }
+
+  private static String[] checkArgs(String args[])
+  {
+    String newArgs[] = args;
+    mainClassName = GeneralUtil.getValueFor(args, MAIN_CLASS_PROP_NAME);
+    if (mainClassName == null)  
+    {
+      throw new ParamMustBeSetException(MAIN_CLASS_PROP_NAME + " must be set");
+    }
+    else
+    {
+      // Move this bit into GeneralUtil also.
+      List argsList = new ArrayList(Arrays.asList(newArgs));
+      int index = GeneralUtil.getIndexOf(newArgs, MAIN_CLASS_PROP_NAME);
+      argsList.remove(index);
+      argsList.remove(index);
+      newArgs = (String[])argsList.toArray(new String[1]);
+    }
+    return newArgs;
+  }
+
+  private static class NoMainMethodFoundException
+    extends RuntimeException
+  {
+    public NoMainMethodFoundException()
+    {
+      super();
+    }
+    public NoMainMethodFoundException(String message)
+    {
+      super(message);
+    }
+  }
+
+  private static class ParamMustBeSetException
+    extends RuntimeException
+  {
+    public ParamMustBeSetException()
+    {
+      super();
+    }
+    public ParamMustBeSetException(String message)
+    {
+      super(message);
+    }
+  }
+}

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CmdDashDEmulator.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CollectionsUtil.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CollectionsUtil.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CollectionsUtil.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CollectionsUtil.java Fri Aug 12 08:12:28 2005
@@ -1,265 +1,265 @@
-package org.apache.beehive.test.tools.tch.util;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-
-/**
- * Provides a bunch of functionalities that jdk 1.3 java.util.Collections provide
- */
-public class CollectionsUtil
-{
-  public static final Map EMPTY_MAP =
-    Collections.unmodifiableMap(new HashMap(0));
-  public static final Set EMPTY_SET =
-    Collections.unmodifiableSet(new HashSet(0));
-  public static final List EMPTY_LIST =
-    Collections.unmodifiableList(new ArrayList(0));
-
-  /**
-   * Returns a singleton, unmodifiable empty Map
-   */
-  public static final Map getEmptyMap()
-  {
-    return EMPTY_MAP;
-  }
-
-  public static final Set getEmptySet()
-  {
-    return EMPTY_SET;
-  }
-
-  public static final List getEmptyList()
-  {
-    return EMPTY_LIST;
-  }
-
-  public static final Map getSingletonMap(Object aKey, Object aValue)
-  {
-    Map rtn = new HashMap(1);
-    rtn.put(aKey, aValue);
-    return rtn;
-  }
-
-  public static final Set getSingletonSet(Object aValue)
-  {
-    Set rtn = new HashSet(1);
-    rtn.add(aValue);
-    return rtn;
-  }
-
-  public static final List getSingletonList(Object aValue)
-  {
-    List rtn = new ArrayList(1);
-    rtn.add(aValue);
-    return rtn;
-  }
-  public static final List reverseOrder(List aList)
-  {
-    List rtn = new ArrayList(aList.size());
-    for (int i = aList.size() - 1; i >= 0; i--)
-    {
-      Object value = aList.get(i);
-      rtn.add(value);
-    }
-    return rtn;
-  }
-
-  /**
-   *
-   * Constructs the composition of two maps.
-   *
-   * Example:
-   *
-   *   In aFirstMap, "1" maps to "one"
-   *   In aSecondMap, "one" maps to "uno"
-   *   In the returned map, "1" maps to "uno"
-   *
-   * The values of the aFirstMap must be a subset of the keys of aSecondMap
-   *
-   * @param aFirstMap Map for which keys are the keys of the returned map
-   * @param aSecondMap Map for which at least some of the values are the values of the returned map
-   * @param aMapToFill Map implementation to populate for return
-   * @return The composite mapping, keys of aFirstMap to values of aSecondMap
-   */
-
-  public static Map getCompositeMap(
-    Map aFirstMap,
-    Map aSecondMap,
-    Map aMapToFill)
-  {
-    for (Iterator iter = aFirstMap.entrySet().iterator(); iter.hasNext();)
-    {
-      Map.Entry me = (Map.Entry)iter.next();
-      aMapToFill.put(me.getKey(), aSecondMap.get(me.getValue()));
-    }
-    return aMapToFill;
-  }
-
-  /**
-   * Constructs the composition of two maps, assuming HashMap implementation for returned Map
-   *
-   * See method getCompositeMap(Map aFirstMap, Map aSecondMap, Map aMapToFill)
-   */
-
-  public static Map getCompositeMap(Map aFirstMap, Map aSecondMap)
-  {
-    return getCompositeMap(
-      aFirstMap,
-      aSecondMap,
-      new HashMap(aFirstMap.size()));
-  }
-
-  public static Map filterMapOnKey(Map map, Collection col, Map mapToFill)
-  {
-    return filterMapOnKey(map, col, mapToFill, false);
-  }
-
-  public static Map filterMapOnKey(
-    Map map,
-    Collection col,
-    Map mapToFill,
-    boolean exclude)
-  {
-
-    for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
-    {
-      Map.Entry me = (Map.Entry)iter.next();
-      Object key = me.getKey();
-      if (col.contains(key) ^ exclude)
-        mapToFill.put(key, me.getValue());
-    }
-    return mapToFill;
-  }
-
-  public static Map filterMapOnKey(Map map, Collection col)
-  {
-    return filterMapOnKey(map, col, new HashMap(col.size()));
-  }
-
-  public static Map filterMapOnValue(Map map, Collection col, Map mapToFill)
-  {
-    return filterMapOnValue(map, col, mapToFill, false);
-  }
-
-  public static Map filterMapOnValue(
-    Map map,
-    Collection col,
-    Map mapToFill,
-    boolean exclude)
-  {
-    for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
-    {
-      Map.Entry me = (Map.Entry)iter.next();
-      Object value = me.getValue();
-      if (col.contains(value) ^ exclude)
-        mapToFill.put(me.getKey(), value);
-    }
-    return mapToFill;
-  }
-
-  public static Map filterMapOnValue(Map map, Collection col)
-  {
-    return filterMapOnValue(map, col, new HashMap(col.size()));
-  }
-
-  public static String collectionToString(Collection inColl, String delimiter)
-  {
-    if (inColl.size() == 0) //Short circuit
-      return "";
-
-    Collection coll = new ArrayList(inColl);
-    StringBuffer sb = new StringBuffer();
-    for (Iterator iter = coll.iterator(); iter.hasNext();)
-    {
-      sb.append(iter.next().toString());
-      if (iter.hasNext())
-        sb.append(delimiter);
-    }
-    return sb.toString();
-  }
-
-  public static String collectionToString(Collection coll)
-  {
-    return collectionToString(coll, ".");
-  }
-
-  public static Map putAllNoOverride(Map source, Map target)
-  {
-    for (Iterator iter = source.entrySet().iterator(); iter.hasNext();)
-    {
-      Map.Entry me = (Map.Entry)iter.next();
-      Object key = me.getKey();
-      Object val = me.getValue();
-      if (!target.containsKey(key))
-      {
-        target.put(key, val);
-      }
-    }
-    return target;
-  }
-
-  /**
-   * Clones a new HashMap based on the passed in Map.
-   * If the passed-in Map is null, then null is returned
-   *
-   */
-
-  public static HashMap cloneHashMap(Map aMap)
-  {
-    if (aMap == null)
-      return null;
-
-    return new HashMap(aMap);
-  }
-
-  /**
-   * Clones a new ArrayList based on the passed in List.
-   * If the passed-in List is null, then null is returned
-   *
-   */
-
-  public static ArrayList cloneArrayList(List aList)
-  {
-    if (aList == null)
-      return null;
-
-    return new ArrayList(aList);
-  }
-
-  /**
-   * Clones a new LinkedList based on the passed in LinkedList.
-   * If the passed-in LinkedList is null, then null is returned
-   *
-   */
-
-  public static LinkedList cloneLinkedList(LinkedList aList)
-  {
-    if (aList == null)
-      return null;
-
-    return new LinkedList(aList);
-  }
-
-  /**
-   * Clones a new HashSet based on the passed in HashSet.
-   * If the passed-in HashSet is null, then null is returned
-   *
-   */
-
-  public static HashSet cloneHashSet(HashSet aSet)
-  {
-    if (aSet == null)
-      return null;
-
-    return new HashSet(aSet);
-  }
-
-}
+package org.apache.beehive.test.tools.tch.util;
+
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * Provides a bunch of functionalities that jdk 1.3 java.util.Collections provide
+ */
+public class CollectionsUtil
+{
+  public static final Map EMPTY_MAP =
+    Collections.unmodifiableMap(new HashMap(0));
+  public static final Set EMPTY_SET =
+    Collections.unmodifiableSet(new HashSet(0));
+  public static final List EMPTY_LIST =
+    Collections.unmodifiableList(new ArrayList(0));
+
+  /**
+   * Returns a singleton, unmodifiable empty Map
+   */
+  public static final Map getEmptyMap()
+  {
+    return EMPTY_MAP;
+  }
+
+  public static final Set getEmptySet()
+  {
+    return EMPTY_SET;
+  }
+
+  public static final List getEmptyList()
+  {
+    return EMPTY_LIST;
+  }
+
+  public static final Map getSingletonMap(Object aKey, Object aValue)
+  {
+    Map rtn = new HashMap(1);
+    rtn.put(aKey, aValue);
+    return rtn;
+  }
+
+  public static final Set getSingletonSet(Object aValue)
+  {
+    Set rtn = new HashSet(1);
+    rtn.add(aValue);
+    return rtn;
+  }
+
+  public static final List getSingletonList(Object aValue)
+  {
+    List rtn = new ArrayList(1);
+    rtn.add(aValue);
+    return rtn;
+  }
+  public static final List reverseOrder(List aList)
+  {
+    List rtn = new ArrayList(aList.size());
+    for (int i = aList.size() - 1; i >= 0; i--)
+    {
+      Object value = aList.get(i);
+      rtn.add(value);
+    }
+    return rtn;
+  }
+
+  /**
+   *
+   * Constructs the composition of two maps.
+   *
+   * Example:
+   *
+   *   In aFirstMap, "1" maps to "one"
+   *   In aSecondMap, "one" maps to "uno"
+   *   In the returned map, "1" maps to "uno"
+   *
+   * The values of the aFirstMap must be a subset of the keys of aSecondMap
+   *
+   * @param aFirstMap Map for which keys are the keys of the returned map
+   * @param aSecondMap Map for which at least some of the values are the values of the returned map
+   * @param aMapToFill Map implementation to populate for return
+   * @return The composite mapping, keys of aFirstMap to values of aSecondMap
+   */
+
+  public static Map getCompositeMap(
+    Map aFirstMap,
+    Map aSecondMap,
+    Map aMapToFill)
+  {
+    for (Iterator iter = aFirstMap.entrySet().iterator(); iter.hasNext();)
+    {
+      Map.Entry me = (Map.Entry)iter.next();
+      aMapToFill.put(me.getKey(), aSecondMap.get(me.getValue()));
+    }
+    return aMapToFill;
+  }
+
+  /**
+   * Constructs the composition of two maps, assuming HashMap implementation for returned Map
+   *
+   * See method getCompositeMap(Map aFirstMap, Map aSecondMap, Map aMapToFill)
+   */
+
+  public static Map getCompositeMap(Map aFirstMap, Map aSecondMap)
+  {
+    return getCompositeMap(
+      aFirstMap,
+      aSecondMap,
+      new HashMap(aFirstMap.size()));
+  }
+
+  public static Map filterMapOnKey(Map map, Collection col, Map mapToFill)
+  {
+    return filterMapOnKey(map, col, mapToFill, false);
+  }
+
+  public static Map filterMapOnKey(
+    Map map,
+    Collection col,
+    Map mapToFill,
+    boolean exclude)
+  {
+
+    for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
+    {
+      Map.Entry me = (Map.Entry)iter.next();
+      Object key = me.getKey();
+      if (col.contains(key) ^ exclude)
+        mapToFill.put(key, me.getValue());
+    }
+    return mapToFill;
+  }
+
+  public static Map filterMapOnKey(Map map, Collection col)
+  {
+    return filterMapOnKey(map, col, new HashMap(col.size()));
+  }
+
+  public static Map filterMapOnValue(Map map, Collection col, Map mapToFill)
+  {
+    return filterMapOnValue(map, col, mapToFill, false);
+  }
+
+  public static Map filterMapOnValue(
+    Map map,
+    Collection col,
+    Map mapToFill,
+    boolean exclude)
+  {
+    for (Iterator iter = map.entrySet().iterator(); iter.hasNext();)
+    {
+      Map.Entry me = (Map.Entry)iter.next();
+      Object value = me.getValue();
+      if (col.contains(value) ^ exclude)
+        mapToFill.put(me.getKey(), value);
+    }
+    return mapToFill;
+  }
+
+  public static Map filterMapOnValue(Map map, Collection col)
+  {
+    return filterMapOnValue(map, col, new HashMap(col.size()));
+  }
+
+  public static String collectionToString(Collection inColl, String delimiter)
+  {
+    if (inColl.size() == 0) //Short circuit
+      return "";
+
+    Collection coll = new ArrayList(inColl);
+    StringBuffer sb = new StringBuffer();
+    for (Iterator iter = coll.iterator(); iter.hasNext();)
+    {
+      sb.append(iter.next().toString());
+      if (iter.hasNext())
+        sb.append(delimiter);
+    }
+    return sb.toString();
+  }
+
+  public static String collectionToString(Collection coll)
+  {
+    return collectionToString(coll, ".");
+  }
+
+  public static Map putAllNoOverride(Map source, Map target)
+  {
+    for (Iterator iter = source.entrySet().iterator(); iter.hasNext();)
+    {
+      Map.Entry me = (Map.Entry)iter.next();
+      Object key = me.getKey();
+      Object val = me.getValue();
+      if (!target.containsKey(key))
+      {
+        target.put(key, val);
+      }
+    }
+    return target;
+  }
+
+  /**
+   * Clones a new HashMap based on the passed in Map.
+   * If the passed-in Map is null, then null is returned
+   *
+   */
+
+  public static HashMap cloneHashMap(Map aMap)
+  {
+    if (aMap == null)
+      return null;
+
+    return new HashMap(aMap);
+  }
+
+  /**
+   * Clones a new ArrayList based on the passed in List.
+   * If the passed-in List is null, then null is returned
+   *
+   */
+
+  public static ArrayList cloneArrayList(List aList)
+  {
+    if (aList == null)
+      return null;
+
+    return new ArrayList(aList);
+  }
+
+  /**
+   * Clones a new LinkedList based on the passed in LinkedList.
+   * If the passed-in LinkedList is null, then null is returned
+   *
+   */
+
+  public static LinkedList cloneLinkedList(LinkedList aList)
+  {
+    if (aList == null)
+      return null;
+
+    return new LinkedList(aList);
+  }
+
+  /**
+   * Clones a new HashSet based on the passed in HashSet.
+   * If the passed-in HashSet is null, then null is returned
+   *
+   */
+
+  public static HashSet cloneHashSet(HashSet aSet)
+  {
+    if (aSet == null)
+      return null;
+
+    return new HashSet(aSet);
+  }
+
+}

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/CollectionsUtil.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DebugLogger.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DebugLogger.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DebugLogger.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DebugLogger.java Fri Aug 12 08:12:28 2005
@@ -1,97 +1,97 @@
-package org.apache.beehive.test.tools.tch.util;
-
-import java.io.FileWriter;
-import java.io.IOException;
-
-import org.apache.tools.ant.Location;
-
-/**
- * FIXME
- * This should be changed when Samrat's loggers 
- * are in the right place
- * and abstracted from Sapphire
- */
-
-public class DebugLogger
-{
-  public static final String DEBUG_FILENAME = "tch.internal.debug";
-
-  private static DebugLogger instance = null;
-  
-  private FileWriter writer = null;
-  private boolean debugOn = false;
-  
-  private DebugLogger(String filename)
-  {
-    try
-    {
-      String prop = AntProperties.getGlobalProperty("tch.debug","false").trim();
-      if(prop.equals("true")) 
-      {
-        debugOn = true;
-        writer = new FileWriter(filename);
-      }
-    }
-    catch(IOException io)
-    {
-      throw new NestedRuntimeException(io);
-    }
-  }
-  
-  public static DebugLogger getInstance()
-  {
-    if(instance == null)
-    {
-      instance = new DebugLogger(DEBUG_FILENAME);
-    }
-    return instance;
-  }
-
-  public static void log(String message)
-  {
-    getInstance().logPlease(message);
-  }
-
-  public static void log(String message, Location location)
-  {
-    getInstance().logPlease(message,location);
-  }
-
-  public void logPlease(String message, Location location)
-  {
-    try
-    {
-      if(debugOn)
-      {
-        writer.write(location+":    ");
-      }    
-    }
-    catch(IOException io)
-    {
-      throw new NestedRuntimeException(io);
-    }
-    logPlease(message);
-  }
-
-  public void logPlease(String message)
-  {
-    try
-    {
-      if(debugOn)
-      {
-        writer.write(message+"\n");
-        writer.flush();
-      }    
-    }
-    catch(IOException io)
-    {
-      throw new NestedRuntimeException(io);
-    }    
-  }
-
-  public static void log(String message, int debugLevel)
-  {
-    log(message);
-    //Does nothing right now, hopefully will never need to
-  }
-}
+package org.apache.beehive.test.tools.tch.util;
+
+import java.io.FileWriter;
+import java.io.IOException;
+
+import org.apache.tools.ant.Location;
+
+/**
+ * FIXME
+ * This should be changed when Samrat's loggers 
+ * are in the right place
+ * and abstracted from Sapphire
+ */
+
+public class DebugLogger
+{
+  public static final String DEBUG_FILENAME = "tch.internal.debug";
+
+  private static DebugLogger instance = null;
+  
+  private FileWriter writer = null;
+  private boolean debugOn = false;
+  
+  private DebugLogger(String filename)
+  {
+    try
+    {
+      String prop = AntProperties.getGlobalProperty("tch.debug","false").trim();
+      if(prop.equals("true")) 
+      {
+        debugOn = true;
+        writer = new FileWriter(filename);
+      }
+    }
+    catch(IOException io)
+    {
+      throw new NestedRuntimeException(io);
+    }
+  }
+  
+  public static DebugLogger getInstance()
+  {
+    if(instance == null)
+    {
+      instance = new DebugLogger(DEBUG_FILENAME);
+    }
+    return instance;
+  }
+
+  public static void log(String message)
+  {
+    getInstance().logPlease(message);
+  }
+
+  public static void log(String message, Location location)
+  {
+    getInstance().logPlease(message,location);
+  }
+
+  public void logPlease(String message, Location location)
+  {
+    try
+    {
+      if(debugOn)
+      {
+        writer.write(location+":    ");
+      }    
+    }
+    catch(IOException io)
+    {
+      throw new NestedRuntimeException(io);
+    }
+    logPlease(message);
+  }
+
+  public void logPlease(String message)
+  {
+    try
+    {
+      if(debugOn)
+      {
+        writer.write(message+"\n");
+        writer.flush();
+      }    
+    }
+    catch(IOException io)
+    {
+      throw new NestedRuntimeException(io);
+    }    
+  }
+
+  public static void log(String message, int debugLevel)
+  {
+    log(message);
+    //Does nothing right now, hopefully will never need to
+  }
+}

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DebugLogger.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DomAsMap.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DomAsMap.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DomAsMap.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DomAsMap.java Fri Aug 12 08:12:28 2005
@@ -1,208 +1,208 @@
-package org.apache.beehive.test.tools.tch.util;
-
-import java.util.HashMap;
-import java.util.Iterator;
-import java.util.Map;
-
-import org.w3c.dom.NamedNodeMap;
-import org.w3c.dom.Node;
-import org.w3c.dom.NodeList;
-
-
-/**
- * Map representation of a DOM Node object.<br>
- * Takes a node like:<br>
-  <XMP>
-<test someattr="v1,
-   v1,
-   v3">
-<name>UgorjiServletWritableTest</name>
-<assertion>UgorjiServletWritableTest</assertion>
-<description>UgorjiServletWritableTest</description>
-<phase>3</phase>
-<test-run mode="automatic" stage="active" />
-<valid-period from="Servlet 2.0" to="Servlet 2.3"/>
-<deploy-agent>ServletWritable</deploy-agent>
-<test-object>
-<test-class>org.apache.beehive.test.tools.tch.xmlbasedtests.tryout.UgorjiServletWritableTest</test-class>
-<test-method>testUgorjiAsHuman</test-method>
-<test-method>testUgorjiAsMachine</test-method>
-</test-object>
-<associated-file>UgorjiServletWritableTest.java</associated-file>
-<http-url-connection>
-<check-mode>RESPONSE_STRING</check-mode>
-<expected-string><![CDATA[
-Ugorji is a human being
-Ugorji is a machine
-]]></expected-string>
-<param name="human" value="true" />
-<param name="machine" value="true" />
-</http-url-connection>
-</test>
-  </XMP>
- * <br> you will get:<br>
-  <XMP>
-#someattr -> v1,    v1,    v3
-assertion!1 -> UgorjiServletWritableTest
-assertion!size -> 1
-associated-file!1 -> UgorjiServletWritableTest.java
-associated-file!size -> 1
-deploy-agent!1 -> ServletWritable
-deploy-agent!size -> 1
-description!1 -> UgorjiServletWritableTest
-description!size -> 1
-http-url-connection!1:check-mode!1 -> RESPONSE_STRING
-http-url-connection!1:check-mode!size -> 1
-http-url-connection!1:expected-string!1 -> 
-Ugorji is a human being
-Ugorji is a machine
-
-http-url-connection!1:expected-string!size -> 1
-http-url-connection!1:param!1#name -> human
-http-url-connection!1:param!1#value -> true
-http-url-connection!1:param!2#name -> machine
-http-url-connection!1:param!2#value -> true
-http-url-connection!1:param!size -> 2
-http-url-connection!size -> 1
-name!1 -> UgorjiServletWritableTest
-name!size -> 1
-phase!1 -> 3
-phase!size -> 1
-test-object!1:test-class!1 -> org.apache.beehive.test.tools.tch.xmlbasedtests.tryout.UgorjiServletWritableTest
-test-object!1:test-class!size -> 1
-test-object!1:test-method!1 -> testUgorjiAsHuman
-test-object!1:test-method!2 -> testUgorjiAsMachine
-test-object!1:test-method!size -> 2
-test-object!size -> 1
-test-run!1#mode -> automatic
-test-run!1#stage -> active
-test-run!size -> 1
-valid-period!1#from -> Servlet 2.0
-valid-period!1#to -> Servlet 2.3
-valid-period!size -> 1
-  </XMP>
- * 
- * @version 1.0, Mar 3, 2001
- */
-public class DomAsMap {
-  private Map info;
-  private String name;
-  
-  public DomAsMap (Node node) 
-  {
-    name = node.getNodeName ();
-    info = load (node, info);
-  }
-
-  /** Returns the name of the DOM Node */
-  public String getName () {
-    return name;
-  }
-  
-  /** Returns the Map of Information got from this node */
-  public Map getInfo () {
-    return info;
-  }
-
-  /** Convenience method to extract a value from the map of information
-   */
-  public String getValue (String key) {
-    String val = (String) info.get (key);
-    return val;
-  }
-   
-  /**
-   * For a given entry, get the number of times it exists in the map
-   */
-  public int getSizeForEntry (String str) {
-    return getSizeForEntry (info, str);
-  }
-  
-  /** 
-   * Static Method to load a Node into a map representation
-   */
-  public static Map load (Node n, Map info) {
-    Map map = info;
-    if (map == null) 
-      map = new HashMap ();
-    Map sizes = new HashMap ();
-    
-    NamedNodeMap nnm = n.getAttributes ();
-    if (nnm != null) {
-      int len = nnm.getLength ();
-      for (int i = 0; i < len; i++) {
-	Node n2 = nnm.item (i);
-	map.put ("#" + n2.getNodeName(), n2.getNodeValue() );
-      }
-    }
-    
-    NodeList nl = n.getChildNodes ();
-    int len = nl.getLength ();
-    for (int i = 0; i < len; i++) {
-      Node n2 = nl.item (i);
-      if (n2.getNodeType() == Node.ELEMENT_NODE)
-	getRecursiveMap (n2, map, "", sizes);
-    }
-    for (Iterator itr = sizes.entrySet().iterator(); itr.hasNext(); ) {
-      Map.Entry entry = (Map.Entry) itr.next ();
-      map.put (entry.getKey() + "!size", entry.getValue() );
-    }
-    return map;
-  }
-    
-  /** 
-   * For a given entry, get the number of times it exists in the map
-   */
-  public static int getSizeForEntry (Map info, String str) {
-    int size = 0;
-    Integer ii = (Integer) info.get (str + "!size");
-    if (ii != null) 
-      size = ii.intValue ();
-    return size;
-  }
-  
-  private static void getRecursiveMap (Node n, Map map, String path, Map sizes) {
-    String path2 = n.getNodeName ();
-    if (path.length() > 0)
-      path2 = path + ":" + path2;
-    Integer size = (Integer) sizes.get (path2);
-    if (size == null) 
-      size = TchUtils.asInteger (1);
-    else 
-      size = TchUtils.asInteger (size.intValue() + 1);
-    sizes.put (path2, size);
-    path2 = path2 + "!" + size;
-
-    NamedNodeMap nnm = n.getAttributes ();
-    if (nnm != null) {
-      int len = nnm.getLength ();
-      for (int i = 0; i < len; i++) {
-	Node n2 = nnm.item (i);
-	map.put (path2 + "#" + n2.getNodeName(), n2.getNodeValue() );
-      }
-    }
-    
-    NodeList nl = n.getChildNodes ();
-    int len = nl.getLength ();
-    if (len > 0) {
-      Node n3 = n.getFirstChild ();
-      int nNodeType = n3.getNodeType();
-      if (nNodeType == Node.CDATA_SECTION_NODE ) {
-	map.put (path2, n3.getNodeValue() );
-      }
-      else if (len == 1 && nNodeType == Node.TEXT_NODE ) {
-	map.put (path2, n3.getNodeValue() );
-      }
-      else {
-	for (int i = 0; i < len; i++) {
-	  Node n2 = nl.item (i);
-	  if (n2.getNodeType() == Node.ELEMENT_NODE)
-	    getRecursiveMap (n2, map, path2, sizes);
-	}
-      }
-    }
-  }
-
-
-}
-    
+package org.apache.beehive.test.tools.tch.util;
+
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+
+
+/**
+ * Map representation of a DOM Node object.<br>
+ * Takes a node like:<br>
+  <XMP>
+<test someattr="v1,
+   v1,
+   v3">
+<name>UgorjiServletWritableTest</name>
+<assertion>UgorjiServletWritableTest</assertion>
+<description>UgorjiServletWritableTest</description>
+<phase>3</phase>
+<test-run mode="automatic" stage="active" />
+<valid-period from="Servlet 2.0" to="Servlet 2.3"/>
+<deploy-agent>ServletWritable</deploy-agent>
+<test-object>
+<test-class>org.apache.beehive.test.tools.tch.xmlbasedtests.tryout.UgorjiServletWritableTest</test-class>
+<test-method>testUgorjiAsHuman</test-method>
+<test-method>testUgorjiAsMachine</test-method>
+</test-object>
+<associated-file>UgorjiServletWritableTest.java</associated-file>
+<http-url-connection>
+<check-mode>RESPONSE_STRING</check-mode>
+<expected-string><![CDATA[
+Ugorji is a human being
+Ugorji is a machine
+]]></expected-string>
+<param name="human" value="true" />
+<param name="machine" value="true" />
+</http-url-connection>
+</test>
+  </XMP>
+ * <br> you will get:<br>
+  <XMP>
+#someattr -> v1,    v1,    v3
+assertion!1 -> UgorjiServletWritableTest
+assertion!size -> 1
+associated-file!1 -> UgorjiServletWritableTest.java
+associated-file!size -> 1
+deploy-agent!1 -> ServletWritable
+deploy-agent!size -> 1
+description!1 -> UgorjiServletWritableTest
+description!size -> 1
+http-url-connection!1:check-mode!1 -> RESPONSE_STRING
+http-url-connection!1:check-mode!size -> 1
+http-url-connection!1:expected-string!1 -> 
+Ugorji is a human being
+Ugorji is a machine
+
+http-url-connection!1:expected-string!size -> 1
+http-url-connection!1:param!1#name -> human
+http-url-connection!1:param!1#value -> true
+http-url-connection!1:param!2#name -> machine
+http-url-connection!1:param!2#value -> true
+http-url-connection!1:param!size -> 2
+http-url-connection!size -> 1
+name!1 -> UgorjiServletWritableTest
+name!size -> 1
+phase!1 -> 3
+phase!size -> 1
+test-object!1:test-class!1 -> org.apache.beehive.test.tools.tch.xmlbasedtests.tryout.UgorjiServletWritableTest
+test-object!1:test-class!size -> 1
+test-object!1:test-method!1 -> testUgorjiAsHuman
+test-object!1:test-method!2 -> testUgorjiAsMachine
+test-object!1:test-method!size -> 2
+test-object!size -> 1
+test-run!1#mode -> automatic
+test-run!1#stage -> active
+test-run!size -> 1
+valid-period!1#from -> Servlet 2.0
+valid-period!1#to -> Servlet 2.3
+valid-period!size -> 1
+  </XMP>
+ * 
+ * @version 1.0, Mar 3, 2001
+ */
+public class DomAsMap {
+  private Map info;
+  private String name;
+  
+  public DomAsMap (Node node) 
+  {
+    name = node.getNodeName ();
+    info = load (node, info);
+  }
+
+  /** Returns the name of the DOM Node */
+  public String getName () {
+    return name;
+  }
+  
+  /** Returns the Map of Information got from this node */
+  public Map getInfo () {
+    return info;
+  }
+
+  /** Convenience method to extract a value from the map of information
+   */
+  public String getValue (String key) {
+    String val = (String) info.get (key);
+    return val;
+  }
+   
+  /**
+   * For a given entry, get the number of times it exists in the map
+   */
+  public int getSizeForEntry (String str) {
+    return getSizeForEntry (info, str);
+  }
+  
+  /** 
+   * Static Method to load a Node into a map representation
+   */
+  public static Map load (Node n, Map info) {
+    Map map = info;
+    if (map == null) 
+      map = new HashMap ();
+    Map sizes = new HashMap ();
+    
+    NamedNodeMap nnm = n.getAttributes ();
+    if (nnm != null) {
+      int len = nnm.getLength ();
+      for (int i = 0; i < len; i++) {
+	Node n2 = nnm.item (i);
+	map.put ("#" + n2.getNodeName(), n2.getNodeValue() );
+      }
+    }
+    
+    NodeList nl = n.getChildNodes ();
+    int len = nl.getLength ();
+    for (int i = 0; i < len; i++) {
+      Node n2 = nl.item (i);
+      if (n2.getNodeType() == Node.ELEMENT_NODE)
+	getRecursiveMap (n2, map, "", sizes);
+    }
+    for (Iterator itr = sizes.entrySet().iterator(); itr.hasNext(); ) {
+      Map.Entry entry = (Map.Entry) itr.next ();
+      map.put (entry.getKey() + "!size", entry.getValue() );
+    }
+    return map;
+  }
+    
+  /** 
+   * For a given entry, get the number of times it exists in the map
+   */
+  public static int getSizeForEntry (Map info, String str) {
+    int size = 0;
+    Integer ii = (Integer) info.get (str + "!size");
+    if (ii != null) 
+      size = ii.intValue ();
+    return size;
+  }
+  
+  private static void getRecursiveMap (Node n, Map map, String path, Map sizes) {
+    String path2 = n.getNodeName ();
+    if (path.length() > 0)
+      path2 = path + ":" + path2;
+    Integer size = (Integer) sizes.get (path2);
+    if (size == null) 
+      size = TchUtils.asInteger (1);
+    else 
+      size = TchUtils.asInteger (size.intValue() + 1);
+    sizes.put (path2, size);
+    path2 = path2 + "!" + size;
+
+    NamedNodeMap nnm = n.getAttributes ();
+    if (nnm != null) {
+      int len = nnm.getLength ();
+      for (int i = 0; i < len; i++) {
+	Node n2 = nnm.item (i);
+	map.put (path2 + "#" + n2.getNodeName(), n2.getNodeValue() );
+      }
+    }
+    
+    NodeList nl = n.getChildNodes ();
+    int len = nl.getLength ();
+    if (len > 0) {
+      Node n3 = n.getFirstChild ();
+      int nNodeType = n3.getNodeType();
+      if (nNodeType == Node.CDATA_SECTION_NODE ) {
+	map.put (path2, n3.getNodeValue() );
+      }
+      else if (len == 1 && nNodeType == Node.TEXT_NODE ) {
+	map.put (path2, n3.getNodeValue() );
+      }
+      else {
+	for (int i = 0; i < len; i++) {
+	  Node n2 = nl.item (i);
+	  if (n2.getNodeType() == Node.ELEMENT_NODE)
+	    getRecursiveMap (n2, map, path2, sizes);
+	}
+      }
+    }
+  }
+
+
+}
+    

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DomAsMap.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DynamicProxyFactory.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DynamicProxyFactory.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DynamicProxyFactory.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DynamicProxyFactory.java Fri Aug 12 08:12:28 2005
@@ -1,59 +1,59 @@
-package org.apache.beehive.test.tools.tch.util;
-
-import java.lang.reflect.InvocationHandler;
-
-/**
- * DynamicProxyFactory provides simple static methods for creating dynamic proxies
- */
-abstract public class DynamicProxyFactory
-{
-  /**
-   * Creates a new dynamic proxy from a single interface using its own ClassLoader
-   *
-   * @param aInterface Single interface to proxy
-   * @param aInvocationHandler the invocation handler
-   */
-  public static Object newInstance(Class aInterface, InvocationHandler aInvocationHandler)
-  {
-    return newInstance(DynamicProxyFactory.class.getClassLoader(), aInterface, aInvocationHandler);
-  }
-  
-  /**
-   * Creates a new dynamic proxy from a multiple interfaces using its own ClassLoader
-   *
-   * @param aInterfaces Multiple interfaces to proxy
-   * @param aInvocationHandler the invocation handler
-   */
-  public static Object newInstance(Class[] aInterfaces, InvocationHandler aInvocationHandler)
-  {
-    return newInstance(DynamicProxyFactory.class.getClassLoader(),
-                       aInterfaces,
-                       aInvocationHandler);
-  }
-  
-  
-  /**
-   * Creates a new dynamic proxy from a single interface
-   *
-   * @param aClassLoader ClassLoader that will be used to construct Proxy object
-   * @param aInterface Single interface to proxy
-   */
-  public static Object newInstance(ClassLoader aClassLoader, Class aInterface, InvocationHandler aInvocationHandler)
-  {
-    return newInstance(aClassLoader, new Class[] {aInterface}, aInvocationHandler);
-  }
-  
-  /**
-   * Creates a new dynamic proxy from a multiple interfaces
-   *
-   * @param aClassLoader ClassLoader that will be used to construct Proxy object
-   * @param aInterfaces Multiple interfaces to proxy
-   */
-  public static Object newInstance(ClassLoader aClassLoader, Class[] aInterfaces, InvocationHandler aInvocationHandler)
-  {
-    return java.lang.reflect.Proxy.newProxyInstance(aClassLoader,
-                                                    aInterfaces,
-                                                    aInvocationHandler);
-  }  
-}
-
+package org.apache.beehive.test.tools.tch.util;
+
+import java.lang.reflect.InvocationHandler;
+
+/**
+ * DynamicProxyFactory provides simple static methods for creating dynamic proxies
+ */
+abstract public class DynamicProxyFactory
+{
+  /**
+   * Creates a new dynamic proxy from a single interface using its own ClassLoader
+   *
+   * @param aInterface Single interface to proxy
+   * @param aInvocationHandler the invocation handler
+   */
+  public static Object newInstance(Class aInterface, InvocationHandler aInvocationHandler)
+  {
+    return newInstance(DynamicProxyFactory.class.getClassLoader(), aInterface, aInvocationHandler);
+  }
+  
+  /**
+   * Creates a new dynamic proxy from a multiple interfaces using its own ClassLoader
+   *
+   * @param aInterfaces Multiple interfaces to proxy
+   * @param aInvocationHandler the invocation handler
+   */
+  public static Object newInstance(Class[] aInterfaces, InvocationHandler aInvocationHandler)
+  {
+    return newInstance(DynamicProxyFactory.class.getClassLoader(),
+                       aInterfaces,
+                       aInvocationHandler);
+  }
+  
+  
+  /**
+   * Creates a new dynamic proxy from a single interface
+   *
+   * @param aClassLoader ClassLoader that will be used to construct Proxy object
+   * @param aInterface Single interface to proxy
+   */
+  public static Object newInstance(ClassLoader aClassLoader, Class aInterface, InvocationHandler aInvocationHandler)
+  {
+    return newInstance(aClassLoader, new Class[] {aInterface}, aInvocationHandler);
+  }
+  
+  /**
+   * Creates a new dynamic proxy from a multiple interfaces
+   *
+   * @param aClassLoader ClassLoader that will be used to construct Proxy object
+   * @param aInterfaces Multiple interfaces to proxy
+   */
+  public static Object newInstance(ClassLoader aClassLoader, Class[] aInterfaces, InvocationHandler aInvocationHandler)
+  {
+    return java.lang.reflect.Proxy.newProxyInstance(aClassLoader,
+                                                    aInterfaces,
+                                                    aInvocationHandler);
+  }  
+}
+

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/DynamicProxyFactory.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/ErrorMessageConstants.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/ErrorMessageConstants.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/ErrorMessageConstants.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/ErrorMessageConstants.java Fri Aug 12 08:12:28 2005
@@ -1,8 +1,8 @@
-package org.apache.beehive.test.tools.tch.util;
-
-public interface ErrorMessageConstants
-{
-  public static final int VALIDATE_NAME_ERROR_CODE = 200;
-  public static final String NAME = "name";
-  public static final String ILLEGALCHARS = "illegalchars";
-}
+package org.apache.beehive.test.tools.tch.util;
+
+public interface ErrorMessageConstants
+{
+  public static final int VALIDATE_NAME_ERROR_CODE = 200;
+  public static final String NAME = "name";
+  public static final String ILLEGALCHARS = "illegalchars";
+}

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/ErrorMessageConstants.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/FixedLengthQueue.java
URL: http://svn.apache.org/viewcvs/beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/FixedLengthQueue.java?rev=232310&r1=232309&r2=232310&view=diff
==============================================================================
--- beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/FixedLengthQueue.java (original)
+++ beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/FixedLengthQueue.java Fri Aug 12 08:12:28 2005
@@ -1,66 +1,66 @@
-package org.apache.beehive.test.tools.tch.util;
-
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.List;
-
-public class FixedLengthQueue
-  implements Serializable
-{
-  private int capacity = -1;
-  private List queue = null;
-
-  public FixedLengthQueue()
-  {
-    this(-1);  //will make this unlimited size.  FIXME:  Change classname
-  }
-
-  public FixedLengthQueue(int inCapacity)
-  {
-    capacity = inCapacity;
-    if(capacity != -1)
-      queue = new ArrayList(capacity);
-    else
-      queue = new ArrayList();
-  }
-
-  public synchronized void enqueue(Object in)
-  {
-    // REVIEW - optionally dequeue a batch of objects, insead of 1 at a time?
-    if (queue.size() == capacity)
-      dequeue();
-    queue.add(in);
-  }
-
-  public Object[] toArray(Object[] a)
-  {
-    return queue.toArray(a);
-  }
-
-  // convenience method
-  public String[] toStringArray()
-  {
-    String[] output = new String[queue.size()];
-    return (String[])toArray(output);
-  }
-  
-  public String toString()
-  {
-    return queue.toString();
-  }
-
-  public int size()
-  {
-    return queue.size();
-  }
-
-  public synchronized void clear()
-  {
-    queue.clear();
-  }
-
-  private synchronized void dequeue()
-  {
-    queue.remove(0);
-  }
-}
+package org.apache.beehive.test.tools.tch.util;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.List;
+
+public class FixedLengthQueue
+  implements Serializable
+{
+  private int capacity = -1;
+  private List queue = null;
+
+  public FixedLengthQueue()
+  {
+    this(-1);  //will make this unlimited size.  FIXME:  Change classname
+  }
+
+  public FixedLengthQueue(int inCapacity)
+  {
+    capacity = inCapacity;
+    if(capacity != -1)
+      queue = new ArrayList(capacity);
+    else
+      queue = new ArrayList();
+  }
+
+  public synchronized void enqueue(Object in)
+  {
+    // REVIEW - optionally dequeue a batch of objects, insead of 1 at a time?
+    if (queue.size() == capacity)
+      dequeue();
+    queue.add(in);
+  }
+
+  public Object[] toArray(Object[] a)
+  {
+    return queue.toArray(a);
+  }
+
+  // convenience method
+  public String[] toStringArray()
+  {
+    String[] output = new String[queue.size()];
+    return (String[])toArray(output);
+  }
+  
+  public String toString()
+  {
+    return queue.toString();
+  }
+
+  public int size()
+  {
+    return queue.size();
+  }
+
+  public synchronized void clear()
+  {
+    queue.clear();
+  }
+
+  private synchronized void dequeue()
+  {
+    queue.remove(0);
+  }
+}

Propchange: beehive/trunk/controls/test/tools/tch/src/java/org/apache/beehive/test/tools/tch/util/FixedLengthQueue.java
------------------------------------------------------------------------------
    svn:eol-style = native