Package org.qi4j.bootstrap

Examples of org.qi4j.bootstrap.SingletonAssembler.module()


            {
                module.values( SomeValue.class );
                module.services( DummyService.class );
            }
        };
        ValueBuilder<Some> builder = app.module().newValueBuilder( Some.class );
        Some prototype = builder.prototype();
        Property<String> otherProperty = prototype.other();
        otherProperty.set( "Abc" );
        Some value = builder.newInstance();
        Assert.assertEquals( value.other().get(), "Abc" );
View Full Code Here


            {
                module.transients( MyComposite.class );
            }
        };

        MyComposite composite = assembly.module().newTransient( MyComposite.class );

        composite.doStuff();
        composite.doStuff();
        composite.doStuff2();
        composite.doStuff3();
View Full Code Here

                module.addServices( SuccessDataService.class );
                module.addServices( SuccessDataService.class );
            }
        };

        Iterable<ServiceReference<DataAccess>> iterable = assembly.module().findServices( DataAccess.class );
        for( ServiceReference<DataAccess> service : iterable )
        {
            assertTrue( "Service should not be Active before accessed", !service.isActive() );
            assertTrue( service.get().data().activated );
            assertTrue( "Service should be Active after access.", service.isActive() );
View Full Code Here

            }
        };

        ArrayList<Data> datas = new ArrayList<Data>();

        Iterable<ServiceReference<DataAccess>> iterable = assembly.module().findServices( DataAccess.class );
        for( ServiceReference<DataAccess> service : iterable )
        {
            assertTrue( "Service should not be Active before accessed", !service.isActive() );
            Data data = service.get().data();
            if( SuccessDataService.class.isInstance( service.get() ) )
View Full Code Here

            {
                module.addServices( FailingDataService.class );
            }
        };

        ServiceReference<DataAccess> service = assembly.module().findService( DataAccess.class );
        assertTrue( "Service should not be Active before accessed", !service.isActive() );
        assertTrue( service.get().data().activated );
        assertTrue( "Service should be Active after access.", service.isActive() );

        try
View Full Code Here

                module.addServices( FailingDataService.class );
                module.addServices( FailingDataService.class );
            }
        };

        Iterable<ServiceReference<DataAccess>> iterable = assembly.module().findServices( DataAccess.class );
        for( ServiceReference<DataAccess> service : iterable )
        {
            assertTrue( "Service should not be Active before accessed", !service.isActive() );
            assertTrue( service.get().data().activated );
            assertTrue( "Service should be Active after access.", service.isActive() );
View Full Code Here

            public void assemble( ModuleAssembly module )
                throws AssemblyException
            {
            }
        };
        assembler.module().newTransientBuilder( AnyComposite.class );
    }

    /**
     * Tests that an transient builder cannot be created for a 'null' type.
     *
 
View Full Code Here

            public void assemble( ModuleAssembly module )
                throws AssemblyException
            {
            }
        };
        assembler.module().newTransientBuilder( null );
    }

    /**
     * Tests that a transient composite instance cannot be created for a 'null' type.
     *
 
View Full Code Here

            public void assemble( ModuleAssembly module )
                throws AssemblyException
            {
            }
        };
        assembler.module().newTransient( null );
    }

    /**
     * Tests that an object builder can be created for an registered object.
     */
 
View Full Code Here

                throws AssemblyException
            {
                module.transients( AnyComposite.class );
            }
        };
        assembler.module().newTransientBuilder( AnyComposite.class );
    }

    /**
     * Tests that an object can be created for an registered object class.
     */
 
View Full Code Here

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.