View Javadoc

1   /*
2    * $Id: AbstractProxyPoolFactoryTestCase.java 7963 2007-08-21 08:53:15Z dirk.olmes $
3    * --------------------------------------------------------------------------------------
4    * Copyright (c) MuleSource, Inc.  All rights reserved.  http://www.mulesource.com
5    *
6    * The software in this package is published under the terms of the CPAL v1.0
7    * license, a copy of which has been included with this distribution in the
8    * LICENSE.txt file.
9    */
10  
11  package org.mule.tck.model;
12  
13  import org.mule.impl.MuleDescriptor;
14  import org.mule.impl.model.MuleProxy;
15  import org.mule.tck.AbstractMuleTestCase;
16  import org.mule.tck.testmodels.fruit.Apple;
17  import org.mule.util.ObjectFactory;
18  import org.mule.util.ObjectPool;
19  
20  import com.mockobjects.dynamic.Mock;
21  
22  public abstract class AbstractProxyPoolFactoryTestCase extends AbstractMuleTestCase
23  {
24      public void testCreateProxyFromFactory() throws Exception
25      {
26          Mock mockPool = new Mock(ObjectPool.class);
27          MuleDescriptor descriptor = getTestDescriptor("apple", Apple.class.getName());
28          ObjectFactory factory = getProxyFactory(descriptor, (ObjectPool) mockPool.proxy());
29          Object result = factory.create();
30          assertNotNull(result);
31          MuleProxy proxy = (MuleProxy) result;
32          assertEquals("apple", proxy.getDescriptor().getName());
33          mockPool.verify();
34      }
35  
36      public abstract ObjectFactory getProxyFactory(MuleDescriptor descriptor, ObjectPool pool);
37  }