Package org.mule.object

Examples of org.mule.object.PrototypeObjectFactory


    }

    @Test
    public void testObjectUniqueness() throws Exception
    {
        PrototypeObjectFactory objectFactory = new PrototypeObjectFactory(UniqueComponent.class);
        PooledJavaComponent component = createPooledComponent(objectFactory);
        assertEquals(0, component.lifecycleAdapterPool.getNumActive());

        String id1 = getIdFromObjectCreatedByPool(component);
        String id2 = getIdFromObjectCreatedByPool(component);
View Full Code Here


    }
   
    @Test
    public void testDisposingFactoryDisposesObject() throws Exception
    {
        PrototypeObjectFactory objectFactory = new PrototypeObjectFactory(WaterMelon.class);
        PooledJavaComponent component = createPooledComponent(objectFactory);

        DefaultComponentLifecycleAdapter lifecycleAdapter = (DefaultComponentLifecycleAdapter) component.borrowComponentLifecycleAdaptor();
        component.returnComponentLifecycleAdaptor(lifecycleAdapter);
        component.stop();
View Full Code Here

        assertNull(lifecycleAdapter.componentObject);
    }
   
    private PrototypeObjectFactory getDefaultObjectFactory() throws InitialisationException
    {
        PrototypeObjectFactory objectFactory = new PrototypeObjectFactory(Orange.class);
        objectFactory.initialise();
        return objectFactory;
    }
View Full Code Here

{

    @Test
    public void testComponentCreationWithObjectFactory() throws Exception
    {
        PrototypeObjectFactory objectFactory = new PrototypeObjectFactory(
            Apple.class);
        objectFactory.setObjectClass(Apple.class);
        objectFactory.initialise();

        SimpleCallableJavaComponent component = new SimpleCallableJavaComponent(
            objectFactory);

        assertNotNull(component.getObjectFactory());
        assertEquals(objectFactory, component.getObjectFactory());
        assertEquals(Apple.class, component.getObjectFactory().getObjectClass());
        assertEquals(Apple.class, component.getObjectType());

        objectFactory = new PrototypeObjectFactory(Orange.class);
        objectFactory.setObjectClass(Orange.class);
        objectFactory.initialise();

        try
        {
            component = new SimpleCallableJavaComponent(objectFactory);
        }
View Full Code Here

        {
            factory = new SingletonObjectFactory(clazz);
        }
        else
        {
            factory = new PrototypeObjectFactory(clazz);
        }

        if (scope == Scope.Pooled)
        {
            component = new PooledJavaComponent(factory);
View Full Code Here

public class DefaultJavaComponentTestCase extends AbstractComponentTestCase
{

    protected ObjectFactory createObjectFactory() throws InitialisationException
    {
        PrototypeObjectFactory objectFactory = new PrototypeObjectFactory(Orange.class);
        objectFactory.initialise();
        return objectFactory;
    }
View Full Code Here

    @Override
    protected void doSetUp() throws Exception
    {
        service = new SedaService(muleContext);
        service.setName("test");
        PrototypeObjectFactory factory = new PrototypeObjectFactory(Object.class);
        service.setComponent(new DefaultJavaComponent(factory));
        service.setModel(new SedaModel());
        service.getModel().setMuleContext(muleContext);
        service.getModel().initialise();
    }
View Full Code Here

    }

    private ObjectFactory createDefaultObjectFactory()
    {
        // WaterMelon implements some lifecycle methods
        PrototypeObjectFactory factory = new PrototypeObjectFactory(WaterMelon.class);
        return factory;
    }
View Full Code Here

    public Service initialiseService(byte txBeginAction, EventCallback callback) throws Exception
    {
        Service service = new SedaService(muleContext);
        ((AbstractService) service).setExceptionListener(new DefaultMessagingExceptionStrategy(muleContext));
        service.setName("testComponent");
        service.setComponent(new DefaultJavaComponent(new PrototypeObjectFactory(JdbcFunctionalTestComponent.class)));

        TransactionFactory tf = getTransactionFactory();
        TransactionConfig txConfig = new MuleTransactionConfig(txBeginAction);
        txConfig.setFactory(tf);
       
View Full Code Here

TOP

Related Classes of org.mule.object.PrototypeObjectFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.