Package com.github.jsr330.spi.config.builder

Examples of com.github.jsr330.spi.config.builder.ConfigBuilderTck


       
        JsonConfig config = new JsonConfig(new File("./src/test/resources/tck.json"));
       
        instancer = new DefaultClassInjector(config.getConfig(Thread.currentThread().getContextClassLoader()));
       
        Injector injector = new Injector(Thread.currentThread().getContextClassLoader(), scanner, analyser, instancer);
        Car car = injector.getInstance(Car.class);
        return Tck.testsFor(car, true, true);
    }
View Full Code Here


        binder.instance(Seat.class).as(DriversSeat.class).when(qualifierIs(Seat.class, Drivers.class));
        binder.instance(Tire.class).as(SpareTire.class).when(isNamed(Tire.class, "spare"));
       
        instancer = new DefaultClassInjector(binder.build());
       
        Injector injector = new Injector(Thread.currentThread().getContextClassLoader(), scanner, analyser, instancer);
        Car car = injector.getInstance(Car.class);
        return Tck.testsFor(car, true, true);
    }
View Full Code Here

import com.github.jsr330.spi.ClassScanner;

public class JsonConfigTck {
   
    public static Test suite() throws Exception {
        ClassAnalyser<Map<String, Class<?>[]>> analyser = new InheritanceAnalyser();
        ClassInjector instancer;
        ClassScanner scanner = new DefaultClassScanner(new RegExSourceDirFilter(".*javax\\.inject-tck-1\\.jar"), null);
       
        JsonConfig config = new JsonConfig(new File("./src/test/resources/tck.json"));
       
View Full Code Here

   
    public static Test suite() {
        InitialBinder<?> binder;
        ConfigBuilder builder = new ConfigBuilder();
       
        ClassAnalyser<Map<String, Class<?>[]>> analyser = new InheritanceAnalyser();
        ClassInjector instancer;
        ClassScanner scanner = new DefaultClassScanner(new RegExSourceDirFilter(".*javax\\.inject-tck-1\\.jar"), null);
       
        binder = builder.get();
       
View Full Code Here

        ClassInjector instancer;
        ClassScanner scanner = new DefaultClassScanner(new RegExSourceDirFilter(".*javax\\.inject-tck-1\\.jar"), null);
       
        JsonConfig config = new JsonConfig(new File("./src/test/resources/tck.json"));
       
        instancer = new DefaultClassInjector(config.getConfig(Thread.currentThread().getContextClassLoader()));
       
        Injector injector = new Injector(Thread.currentThread().getContextClassLoader(), scanner, analyser, instancer);
        Car car = injector.getInstance(Car.class);
        return Tck.testsFor(car, true, true);
    }
View Full Code Here

       
        binder.instance(Car.class).as(Convertible.class);
        binder.instance(Seat.class).as(DriversSeat.class).when(qualifierIs(Seat.class, Drivers.class));
        binder.instance(Tire.class).as(SpareTire.class).when(isNamed(Tire.class, "spare"));
       
        instancer = new DefaultClassInjector(binder.build());
       
        Injector injector = new Injector(Thread.currentThread().getContextClassLoader(), scanner, analyser, instancer);
        Car car = injector.getInstance(Car.class);
        return Tck.testsFor(car, true, true);
    }
View Full Code Here

   
    @Test
    public void usingCustomConstructor() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).as(TestImplementation1.class)
                .using(constructor(TestImplementation1.class, String.class, String.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertFalse(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
        assertEquals(constructor(TestImplementation1.class, String.class, String.class), container.getConstructor());
        assertNull(container.getFactoryMethod());
    }
View Full Code Here

   
    @Test
    public void usingNotExistingConstructor() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).as(TestImplementation1.class)
                .using(constructor(TestImplementation1.class, String.class, Integer.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertFalse(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
        assertNull(container.getConstructor());
        assertNull(container.getFactoryMethod());
    }
View Full Code Here

   
    @Test
    public void singletonUsingDefaultConstructor() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(defaultConstructor(TestImplementation1.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
        assertEquals(defaultConstructor(TestImplementation1.class), container.getConstructor());
        assertNull(container.getFactoryMethod());
    }
View Full Code Here

   
    @Test
    public void singletonUsingCustomConstructor() {
        TypeConfig config = defaultBinder.instance(TestImplementation1.class).asSingleton(TestImplementation1.class)
                .using(constructor(TestImplementation1.class, String.class, String.class)).build();
        TypeContainer container;
       
        container = config.getTypeContainer(null, TestImplementation1.class, null, null, null);
        assertNotNull(container);
        assertEquals(TestImplementation1.class, container.getType());
        assertTrue(container.isSingleton());
        assertEquals(InstanceMode.CONSTRUCTOR, container.getInstanceMode());
        assertEquals(constructor(TestImplementation1.class, String.class, String.class), container.getConstructor());
        assertNull(container.getFactoryMethod());
    }
View Full Code Here

TOP

Related Classes of com.github.jsr330.spi.config.builder.ConfigBuilderTck

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.