Package org.impalaframework.service

Examples of org.impalaframework.service.ServiceRegistryEntry


                "moduleName", null, Collections.singletonMap("attribute","value"), ClassUtils.getDefaultClassLoader());
        assertEquals(1, entry.getAttributes().size());
    }

    public void testConstructTagsAttributesNull() throws Exception {
        ServiceRegistryEntry entry = new StaticServiceRegistryEntry("service1","beanName",
                "moduleName", null, null, ClassUtils.getDefaultClassLoader());
        assertEquals(0, entry.getAttributes().size());
    }  
View Full Code Here


        super.setUp();
        sorter = new ServiceReferenceSorter();
    }

    public void testSort() {
        ServiceRegistryEntry ref1 = newRef(new Integer(1));
        ServiceRegistryEntry ref2 = newRef("nothing");
        ServiceRegistryEntry ref3 = newRef(-100);
        ServiceRegistryEntry ref4 = newRef(400);
        ServiceRegistryEntry ref5 = newRef(Long.MAX_VALUE);
        ServiceRegistryEntry ref6 = newRef(new Double(Integer.MAX_VALUE + ".51"));
       
        List<ServiceRegistryEntry> list = Arrays.asList(ref1, ref2, ref3, ref4, ref5, ref6);
        List<ServiceRegistryEntry> sorted = sorter.sort(list);
        List<ServiceRegistryEntry> expected = Arrays.asList(ref5, ref6, ref4, ref1, ref2, ref3);
        System.out.println("sorted:" + sorted);
View Full Code Here

        Map<String, Object> attributes = null;
        if (ranking != null) {
            attributes = new HashMap<String, Object>();
            attributes.put("service.ranking", ranking);
        }
        ServiceRegistryEntry entry = new StaticServiceRegistryEntry("service", "bean", "mod", null, attributes, ClassUtils.getDefaultClassLoader());
        return entry;
    }
View Full Code Here

       
        //no service
        noService(list);

        //add service and see we can call
        ServiceRegistryEntry reference = serviceRegistry.addService("beanName", "moduleName", new StaticServiceBeanReference(service), null, Collections.singletonMap("name", "value"), ClassUtils.getDefaultClassLoader());
      
        list.add("some string");
        list.add("some string");
       
        //remove registry
View Full Code Here

        serviceRegistry = createMock(ServiceRegistry.class);
    }   
   
    public void testInfrastructure() throws Exception {
        final List<String> list = new ArrayList<String>();
        ServiceRegistryEntry ref = new StaticServiceRegistryEntry(list, "mybean", "mymod", ClassUtils.getDefaultClassLoader());
       
        final ProxyFactory proxyFactory = creator.createProxyFactory(new StaticServiceReferenceProxyFactorySource(classes, ref), null, null);
       
        Object proxy = proxyFactory.getProxy();
        assertTrue(proxy instanceof List);
View Full Code Here

        assertTrue(wrappedObject instanceof ArrayList);
    }   
   
    public void testInfrastructureClassOnly() throws Exception {
        final List<String> list = new ArrayList<String>();
        ServiceRegistryEntry ref = new StaticServiceRegistryEntry(list, "mybean", "mymod", ClassUtils.getDefaultClassLoader());
       
        final ProxyFactory proxyFactory = creator.createProxyFactory(new StaticServiceReferenceProxyFactorySource(null, ref), null, null);
       
        Object proxy = proxyFactory.getProxy();
        assertTrue(proxy instanceof ArrayList);
View Full Code Here

    }

    @SuppressWarnings("unchecked")
    public void testDynamicProxyFactory() throws Exception {
        final List<String> list = new ArrayList<String>();
        ServiceRegistryEntry ref = new StaticServiceRegistryEntry(list, "mybean", "mymod", ClassUtils.getDefaultClassLoader());
        expect(serviceRegistry.getService("mykey", classes, false)).andReturn(ref);
       
        replay(serviceRegistry);
        final ProxyFactory proxyFactory = creator.createProxyFactory(new BeanRetrievingProxyFactorySource(serviceRegistry, classes, null, "mykey"), null, null);
       
View Full Code Here

    public void testDynamicProxyFactoryForClass() throws Exception {
        classes = new Class[]{
                ArrayList.class
                };
        final List<String> list = new ArrayList<String>();
        ServiceRegistryEntry ref = new StaticServiceRegistryEntry(list, "mybean", "mymod", ClassUtils.getDefaultClassLoader());
        expect(serviceRegistry.getService("mykey", classes, false)).andReturn(ref);
       
        replay(serviceRegistry);
        final ProxyFactory proxyFactory = creator.createProxyFactory(new BeanRetrievingProxyFactorySource(serviceRegistry, classes, null, "mykey"), null, null);
       
View Full Code Here

    }
   
    @SuppressWarnings("unchecked")
    public void testStaticProxyFactory() throws Exception {
        final List<String> list = new ArrayList<String>();
        ServiceRegistryEntry ref = new StaticServiceRegistryEntry(list, "mybean", "mymod", ClassUtils.getDefaultClassLoader());
       
        replay(serviceRegistry);
        final ProxyFactory proxyFactory = creator.createProxyFactory(new StaticServiceReferenceProxyFactorySource(new Class<?>[]{List.class}, ref), null, null);
       
        final List<String> proxy = (List<String>) proxyFactory.getProxy();
View Full Code Here

    }
   
    @SuppressWarnings("unchecked")
    public void testStaticProxyFactoryWithNoInterfaces() throws Exception {
        final List<String> list = new ArrayList<String>();
        ServiceRegistryEntry ref = new StaticServiceRegistryEntry(list, "mybean", "mymod", ClassUtils.getDefaultClassLoader());
       
        replay(serviceRegistry);
        final ProxyFactory proxyFactory = creator.createProxyFactory(new StaticServiceReferenceProxyFactorySource(null, ref), null, null);
       
        final List<String> proxy = (List<String>) proxyFactory.getProxy();
View Full Code Here

TOP

Related Classes of org.impalaframework.service.ServiceRegistryEntry

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.