geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From djen...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel ConfigTest.java MockGBean.java
Date Mon, 19 Jan 2004 06:35:36 GMT
djencks     2004/01/18 22:35:36

  Modified:    modules/kernel/src/test/org/apache/geronimo/kernel
                        ConfigTest.java MockGBean.java
  Log:
  collection endpoint test
  
  Revision  Changes    Path
  1.8       +5 -1      incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java
  
  Index: ConfigTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/ConfigTest.java,v
  retrieving revision 1.7
  retrieving revision 1.8
  diff -u -r1.7 -r1.8
  --- ConfigTest.java	17 Jan 2004 00:32:10 -0000	1.7
  +++ ConfigTest.java	19 Jan 2004 06:35:36 -0000	1.8
  @@ -125,6 +125,9 @@
           assertEquals("no endpoint", mbServer.invoke(gbeanName1, "checkEndpoint", null,
null));
           assertEquals("endpointCheck", mbServer.invoke(gbeanName2, "checkEndpoint", null,
null));
   
  +        assertEquals(new Integer(0), mbServer.invoke(gbeanName1, "checkEndpointCollection",
null, null));
  +        assertEquals(new Integer(1), mbServer.invoke(gbeanName2, "checkEndpointCollection",
null, null));
  +
           mbServer.setAttribute(gbeanName2, new Attribute("EndpointMutableInt", new Integer(99)));
           assertEquals(new Integer(99), mbServer.getAttribute(gbeanName2, "EndpointMutableInt"));
           assertEquals(new Integer(99), mbServer.getAttribute(gbeanName1, "MutableInt"));
  @@ -164,6 +167,7 @@
           mockBean2.setAttribute("FinalInt", new Integer(3));
           mockBean2.setAttribute("MutableInt", new Integer(4));
           mockBean2.setEndpointPatterns("MockEndpoint", Collections.singleton(gbeanName1));
  +        mockBean2.setEndpointPatterns("EndpointCollection", Collections.singleton(gbeanName1));
   
           Map gbeans = new HashMap();
           gbeans.put(gbeanName1, mockBean1);
  
  
  
  1.7       +29 -1     incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java
  
  Index: MockGBean.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/MockGBean.java,v
  retrieving revision 1.6
  retrieving revision 1.7
  diff -u -r1.6 -r1.7
  --- MockGBean.java	17 Jan 2004 00:32:10 -0000	1.6
  +++ MockGBean.java	19 Jan 2004 06:35:36 -0000	1.7
  @@ -55,6 +55,10 @@
    */
   package org.apache.geronimo.kernel;
   
  +import java.util.Collection;
  +import java.util.Iterator;
  +import java.util.Collections;
  +
   import org.apache.geronimo.gbean.GAttributeInfo;
   import org.apache.geronimo.gbean.GBeanInfo;
   import org.apache.geronimo.gbean.GBeanInfoFactory;
  @@ -76,6 +80,8 @@
   
       private MockEndpoint endpoint;
   
  +    private Collection endpointCollection = Collections.EMPTY_SET;
  +
       public static GBeanInfo getGBeanInfo() {
           return GBEAN_INFO;
       }
  @@ -89,9 +95,11 @@
           infoFactory.addAttribute(new GAttributeInfo("EndpointMutableInt"));
           infoFactory.addOperation(new GOperationInfo("checkResource", new String[]{"java.lang.String"}));
           infoFactory.addOperation(new GOperationInfo("checkEndpoint"));
  +        infoFactory.addOperation(new GOperationInfo("checkEndpointCollection"));
           infoFactory.addOperation(new GOperationInfo("doSomething", new String[]{"java.lang.String"}));
           infoFactory.addOperation(new GOperationInfo("doSetMutableInt", new String[] {"int"}));
           infoFactory.addEndpoint(new GEndpointInfo("MockEndpoint", MockEndpoint.class.getName()));
  +        infoFactory.addEndpoint(new GEndpointInfo("EndpointCollection", MockEndpoint.class.getName()));
           infoFactory.setConstructor(new GConstructorInfo(new String[]{"Name", "FinalInt"},
new Class[]{String.class, Integer.TYPE}));
           GBEAN_INFO = infoFactory.getBeanInfo();
       }
  @@ -137,6 +145,14 @@
           this.endpoint = endpoint;
       }
   
  +    public Collection getEndpointCollection() {
  +        return endpointCollection;
  +    }
  +
  +    public void setEndpointCollection(Collection endpointCollection) {
  +        this.endpointCollection = endpointCollection;
  +    }
  +
       public boolean checkResource(String name) {
           ClassLoader cl = Thread.currentThread().getContextClassLoader();
           return cl.getResource(name) != null;
  @@ -151,6 +167,18 @@
               return "no endpoint";
           }
           return endpoint.doSomething("endpointCheck");
  +    }
  +
  +    public int checkEndpointCollection() {
  +        int successCount = 0;
  +        for (Iterator iterator = endpointCollection.iterator(); iterator.hasNext();) {
  +            MockEndpoint mockEndpoint = (MockEndpoint) iterator.next();
  +            String result = mockEndpoint.doSomething("endpointCheck");
  +            if ("endpointCheck".equals(result)) {
  +                successCount++;
  +            }
  +        }
  +        return successCount;
       }
   
       public int getEndpointMutableInt() {
  
  
  

Mime
View raw message