Home » geronimo-2.2-source-release » org.apache.geronimo.kernel.management » [javadoc | source]

    1   /**
    2    *
    3    * Copyright 2003-2004 The Apache Software Foundation
    4    *
    5    *  Licensed under the Apache License, Version 2.0 (the "License");
    6    *  you may not use this file except in compliance with the License.
    7    *  You may obtain a copy of the License at
    8    *
    9    *     http://www.apache.org/licenses/LICENSE-2.0
   10    *
   11    *  Unless required by applicable law or agreed to in writing, software
   12    *  distributed under the License is distributed on an "AS IS" BASIS,
   13    *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   14    *  See the License for the specific language governing permissions and
   15    *  limitations under the License.
   16    */
   17   
   18   package org.apache.geronimo.kernel.management;
   19   
   20   import org.apache.geronimo.kernel.management.State;
   21   
   22   import junit.framework.TestCase;
   23   
   24   /**
   25    * Unit test for org.apache.geronimo.common.State class
   26    *
   27    * @version $Rev: 160733 $ $Date: 2005-04-09 20:32:10 -0700 (Sat, 09 Apr 2005) $
   28    */
   29   
   30   public class StateTest extends TestCase {
   31   
   32       public void testValues() {
   33   
   34           assertEquals(0, State.STARTING_INDEX);
   35           assertEquals(1, State.RUNNING_INDEX);
   36           assertEquals(2, State.STOPPING_INDEX);
   37           assertEquals(3, State.STOPPED_INDEX);
   38           assertEquals(4, State.FAILED_INDEX);
   39   
   40           assertEquals(0, State.STARTING.toInt());
   41           assertEquals(1, State.RUNNING.toInt());
   42           assertEquals(2, State.STOPPING.toInt());
   43           assertEquals(3, State.STOPPED.toInt());
   44           assertEquals(4, State.FAILED.toInt());
   45       }
   46   
   47       public void testLessThanMin() {
   48           assertNull(State.fromInt(-1));
   49       }
   50   
   51       public void testGreaterThanMax() {
   52           assertNull(State.fromInt(5));
   53       }
   54   
   55       public void testName() {
   56           assertEquals("starting", State.STARTING.toString());
   57           assertEquals("running", State.RUNNING.toString());
   58           assertEquals("stopping", State.STOPPING.toString());
   59           assertEquals("stopped", State.STOPPED.toString());
   60           assertEquals("failed", State.FAILED.toString());
   61       }
   62   
   63       public void testEventTypeValue() {
   64           assertEquals("j2ee.state.starting", State.STARTING.getEventTypeValue());
   65           assertEquals("j2ee.state.running", State.RUNNING.getEventTypeValue());
   66           assertEquals("j2ee.state.stopping", State.STOPPING.getEventTypeValue());
   67           assertEquals("j2ee.state.stopped", State.STOPPED.getEventTypeValue());
   68           assertEquals("j2ee.state.failed", State.FAILED.getEventTypeValue());
   69       }
   70   }

Home » geronimo-2.2-source-release » org.apache.geronimo.kernel.management » [javadoc | source]