geronimo-scm mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject cvs commit: incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/service LifeCycleTest.java Person.java family-service.xml PersonImpl.java
Date Sun, 09 Nov 2003 20:18:58 GMT
dain        2003/11/09 12:18:58

  Modified:    modules/kernel/src/test/org/apache/geronimo/kernel/service
                        LifeCycleTest.java Person.java family-service.xml
  Removed:     modules/kernel/src/test/org/apache/geronimo/kernel/service
                        PersonImpl.java
  Log:
  Dropped the interface from person so the old PersonImpl is now Person
  This shows that we can use an object as a dp.
  
  Revision  Changes    Path
  1.2       +3 -3      incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/service/LifeCycleTest.java
  
  Index: LifeCycleTest.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/service/LifeCycleTest.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LifeCycleTest.java	6 Nov 2003 20:01:53 -0000	1.1
  +++ LifeCycleTest.java	9 Nov 2003 20:18:58 -0000	1.2
  @@ -406,8 +406,8 @@
   
       private GeronimoMBeanInfo createPersonMBeanInfo(ObjectName parent) {
           GeronimoMBeanInfo mbeanInfo = new GeronimoMBeanInfo();
  -        mbeanInfo.setTargetClass("org.apache.geronimo.kernel.service.PersonImpl");
  -        mbeanInfo.setName("PersonImpl");
  +        mbeanInfo.setTargetClass("org.apache.geronimo.kernel.service.Person");
  +        mbeanInfo.setName("Person");
           mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("name"));
           mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("doStartCalled", true, false));
           mbeanInfo.addAttributeInfo(new GeronimoAttributeInfo("doStopCalled", true, false));
  
  
  
  1.2       +76 -6     incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/service/Person.java
  
  Index: Person.java
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/service/Person.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- Person.java	6 Nov 2003 20:01:53 -0000	1.1
  +++ Person.java	9 Nov 2003 20:18:58 -0000	1.2
  @@ -55,13 +55,83 @@
    */
   package org.apache.geronimo.kernel.service;
   
  +
   /**
  - * 
  - * 
    * @version $Revision$ $Date$
    */
  -public interface Person {
  -    String getName();
  +public class Person {
  +    private String name;
  +    private Person parent;
  +    private boolean doStartCalled = false;
  +    private boolean doStopCalled = false;
  +    private boolean doFailCalled = false;
  +    private GeronimoMBeanContext context;
  +
  +    public String getName() {
  +        return name;
  +    }
  +
  +    public void setName(String name) {
  +        this.name = name;
  +    }
  +
  +    public String getParentName() {
  +        if (parent != null) {
  +            return parent.getName();
  +        }
  +        return null;
  +    }
  +
  +    public void setParent(Person parent) {
  +        this.parent = parent;
  +        if(parent != null) {
  +            System.out.println("parent " + parent.getName() + " - "+ parent.hashCode());
  +        }
  +    }
  +
  +    public void fail() {
  +        context.fail();
  +    }
  +
  +    public boolean isDoStartCalled() {
  +        return doStartCalled;
  +    }
  +
  +    public boolean isDoStopCalled() {
  +        return doStopCalled;
  +    }
  +
  +    public boolean isDoFailCalled() {
  +        return doFailCalled;
  +    }
  +
  +    public void reset() {
  +        doStartCalled = false;
  +        doStopCalled = false;
  +        doFailCalled = false;
  +    }
  +
  +    protected void doStart() {
  +        doStartCalled = true;
  +    }
  +
  +    protected void doStop() {
  +        doStopCalled = true;
  +    }
  +
  +    protected void doFail() {
  +        doFailCalled = true;
  +    }
  +
  +    protected void setMBeanContext(GeronimoMBeanContext context) {
  +        this.context = context;
  +    }
  +
  +    protected boolean canStart() {
  +        return true;
  +    }
   
  -    String getParentName();
  +    protected boolean canStop() {
  +        return true;
  +    }
   }
  
  
  
  1.2       +3 -3      incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/service/family-service.xml
  
  Index: family-service.xml
  ===================================================================
  RCS file: /home/cvs/incubator-geronimo/modules/kernel/src/test/org/apache/geronimo/kernel/service/family-service.xml,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- family-service.xml	6 Nov 2003 20:01:53 -0000	1.1
  +++ family-service.xml	9 Nov 2003 20:18:58 -0000	1.2
  @@ -4,16 +4,16 @@
           <codebase url="file:../../../../../../../target/test-classes/"/>
       </class-space>
   
  -    <mbean code="org.apache.geronimo.kernel.service.PersonImpl" name="family:role=Grandparent">
  +    <mbean code="org.apache.geronimo.kernel.service.Person" name="family:role=Grandparent">
           <attribute name="Name">Grandparent</attribute>
       </mbean>
   
  -    <mbean code="org.apache.geronimo.kernel.service.PersonImpl" name="family:role=Parent">
  +    <mbean code="org.apache.geronimo.kernel.service.Person" name="family:role=Parent">
           <attribute name="Name">Parent</attribute>
           <depends name="family:role=Grandparent"/>
       </mbean>
   
  -    <mbean code="org.apache.geronimo.kernel.service.PersonImpl" name="family:role=Child">
  +    <mbean code="org.apache.geronimo.kernel.service.Person" name="family:role=Child">
           <attribute name="Name">Child</attribute>
           <depends name="family:role=Parent"/>
       </mbean>
  
  
  

Mime
View raw message