avalon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/impl/lookup/test FortressServiceManagerTestCase.java
Date Mon, 21 Apr 2003 19:30:25 GMT
bloritsch    2003/04/21 12:30:25

  Modified:    fortress/src/test/org/apache/avalon/fortress/impl/lookup/test
                        FortressServiceManagerTestCase.java
  Log:
  fix the test for testing contracts
  
  Revision  Changes    Path
  1.3       +16 -1     avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/impl/lookup/test/FortressServiceManagerTestCase.java
  
  Index: FortressServiceManagerTestCase.java
  ===================================================================
  RCS file: /home/cvs/avalon-excalibur/fortress/src/test/org/apache/avalon/fortress/impl/lookup/test/FortressServiceManagerTestCase.java,v
  retrieving revision 1.2
  retrieving revision 1.3
  diff -u -r1.2 -r1.3
  --- FortressServiceManagerTestCase.java	21 Apr 2003 19:19:31 -0000	1.2
  +++ FortressServiceManagerTestCase.java	21 Apr 2003 19:30:25 -0000	1.3
  @@ -58,6 +58,7 @@
   import org.apache.avalon.fortress.test.data.Component1;
   import org.apache.avalon.fortress.test.data.Role1;
   import org.apache.avalon.framework.service.ServiceException;
  +import org.apache.avalon.framework.service.ServiceSelector;
   
   /**
    * FortressServiceManagerTestCase does XYZ
  @@ -91,6 +92,11 @@
           m_container.setExpectedHint( AbstractContainer.SELECTOR_ENTRY );
           assertTrue( manager.hasService( Role1.ROLE + "Selector" ) );
           assertNotNull( manager.lookup( Role1.ROLE + "Selector" ) );
  +
  +        ServiceSelector selector = (ServiceSelector) manager.lookup( Role1.ROLE + "Selector"
);
  +        m_container.setExpectedHint( hint );
  +        assertTrue( selector.isSelectable( hint ) );
  +        assertNotNull( selector.select( hint ) );
       }
   
       public void testServiceSelector() throws Exception
  @@ -111,6 +117,7 @@
       private String m_key;
       private Object m_hint = AbstractContainer.DEFAULT_ENTRY;
       private TestComponentHandler m_component;
  +    private FortressServiceSelector m_selector;
   
       public TestContainer()
       {
  @@ -120,6 +127,7 @@
       public void setExpectedKey( String key )
       {
           m_key = key;
  +        m_selector = new FortressServiceSelector( this, m_key );
       }
   
       public void setExpectedHint( Object hint )
  @@ -131,7 +139,14 @@
       {
           if ( exists( key, hint ) )
           {
  -            return m_component;
  +            if (hint.equals(AbstractContainer.SELECTOR_ENTRY))
  +            {
  +                return m_selector;
  +            }
  +            else
  +            {
  +                return m_component;
  +            }
           }
   
           throw new ServiceException( m_key, "Unexpected key/hint combo" );
  
  
  

---------------------------------------------------------------------
To unsubscribe, e-mail: cvs-unsubscribe@avalon.apache.org
For additional commands, e-mail: cvs-help@avalon.apache.org


Mime
View raw message