Package org.impalaframework.spring.service.registry

Source Code of org.impalaframework.spring.service.registry.StaticServiceRegistryTargetSourceTest

package org.impalaframework.spring.service.registry;

import junit.framework.TestCase;

import org.impalaframework.service.reference.BasicServiceRegistryEntry;
import org.impalaframework.service.reference.StaticServiceRegistryEntry;
import org.impalaframework.spring.bean.StringFactoryBean;
import org.springframework.util.ClassUtils;

public class StaticServiceRegistryTargetSourceTest extends TestCase {

    public void testWithBean() throws Exception {
        final BasicServiceRegistryEntry reference = new StaticServiceRegistryEntry("bean", "beanName", "moduleName", ClassUtils.getDefaultClassLoader());
        doTest(reference);
    }
   
    public void testWithFactoryBean() throws Exception {
        final StringFactoryBean bean = new StringFactoryBean();
        bean.setValue("bean");
        final BasicServiceRegistryEntry reference = new StaticServiceRegistryEntry(bean, "beanName", "moduleName", ClassUtils.getDefaultClassLoader());
        doTest(reference);
    }

    private void doTest(final BasicServiceRegistryEntry reference)
            throws Exception {
        StaticServiceRegistryTargetSource targetSource = new StaticServiceRegistryTargetSource(reference);
        assertEquals("bean", targetSource.getTarget());
        assertSame(reference, targetSource.getServiceRegistryReference());
        assertEquals(false, targetSource.isStatic());
    }

}
TOP

Related Classes of org.impalaframework.spring.service.registry.StaticServiceRegistryTargetSourceTest

TOP
Copyright © 2018 www.massapi.com. 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.