Package ninja.utils

Examples of ninja.utils.NinjaPropertiesImpl


                   
                    // if properties
                    if (ninjaProperties == null) {
                       
                        ninjaProperties
                                = new NinjaPropertiesImpl(
                                        NinjaModeHelper.determineModeFromSystemPropertiesOrProdIfNotSet());
                   
                    }
               
                    ninjaBootstrap
View Full Code Here


    @Test
    public void testInitializeWithAllUserSpecifiedThingsInConfDirectory() {
       
        // Using the real class is simpler because it loads a
        // lot of stuff from application.conf.
        ninjaPropertiesImpl = new NinjaPropertiesImpl(NinjaMode.test);
       
        NinjaBootstrap ninjaBootstrap = new NinjaBootstrap(ninjaPropertiesImpl);
       
        ninjaBootstrap.boot();
       
View Full Code Here

    }
   
    @Test
    public void testInitializeWithAllUserSpecifiedThingsInShiftedConfDirectory() {
       
        ninjaPropertiesImpl = Mockito.spy(new NinjaPropertiesImpl(NinjaMode.test));
       
        Mockito.when(
                ninjaPropertiesImpl.get(NinjaConstant.APPLICATION_MODULES_BASE_PACKAGE))
                .thenReturn("custom_base_package");
       
View Full Code Here

    @Test
    public void testCreatingInjectorWithCustomNinjaPropertiesWorks() {

        // setup stuff
        NinjaPropertiesImpl ninjaProperties = new NinjaPropertiesImpl(NinjaMode.test);
        ninjaProperties.setProperty("key!", "value!");

        NinjaServletListener ninjaServletListener = new NinjaServletListener();
        ninjaServletListener.setNinjaProperties(ninjaProperties);

        // start the injector:
        ninjaServletListener.contextInitialized(servletContextEvent);

        // test stuff
        Injector injector = ninjaServletListener.getInjector();
        NinjaProperties ninjaPropertiesFromServer = injector.getInstance(NinjaProperties.class);


        assertThat(ninjaPropertiesFromServer.get("key!"), equalTo("value!"));
        // make sure we are using the context path from the serveltcontext here
        assertThat(ninjaProperties.getContextPath(), equalTo(CONTEXT_PATH));

    }
View Full Code Here

    @Test
    public void testCreatingInjectorWithCustomModulesPackageWorks() {

        // setup stuff
        NinjaPropertiesImpl ninjaProperties = new NinjaPropertiesImpl(NinjaMode.test);
        ninjaProperties.setProperty(NinjaConstant.APPLICATION_MODULES_BASE_PACKAGE, "ninja.servlet");

        NinjaServletListener ninjaServletListener = new NinjaServletListener();
        ninjaServletListener.setNinjaProperties(ninjaProperties);

        // start the injector:
View Full Code Here

    @Test
    public void testThatSettingNinjaPropertiesTwiceDoesNotWork() {

        NinjaServletListener ninjaServletListener = new NinjaServletListener();
        NinjaPropertiesImpl ninjaProperties = new NinjaPropertiesImpl(NinjaMode.test);

        // first setting works
        ninjaServletListener.setNinjaProperties(ninjaProperties);

View Full Code Here

     */
    public void startServer(NinjaMode ninjaMode) {
       
        if (ninjaMode == null) {
           
            NinjaPropertiesImpl ninjaProperties = new NinjaPropertiesImpl(
                    NinjaModeHelper.determineModeFromSystemPropertiesOrProdIfNotSet());
           
            ninjaBootup = new NinjaBootstrap(
                    ninjaProperties);
        } else {
            // in this case servletContext can be null
            NinjaPropertiesImpl ninjaProperties = new NinjaPropertiesImpl(ninjaMode);
           
            ninjaBootup = new NinjaBootstrap(ninjaProperties);
        }

        ninjaBootup.boot();
View Full Code Here

        ninjaMode = testMode;
    }

    @Before
    public final void initialize() {
        NinjaPropertiesImpl ninjaProperties = new NinjaPropertiesImpl(ninjaMode);
        injector = Guice.createInjector(new JpaModule(ninjaProperties));
        jpaInitializer = injector.getInstance(JpaInitializer.class);
        jpaInitializer.start();
    }
View Full Code Here

    }

    @Test
    public void testRouteOrdering() {
        NinjaPropertiesImpl ninjaProperties = new NinjaPropertiesImpl(
                NinjaMode.test);
        RouterImpl router = new RouterImpl(injector, ninjaProperties);
        Routes routes = new Routes(ninjaProperties);
        routes.init(router);
        router.compileRoutes();
View Full Code Here

    }

    @Test
    public void testMissingKeyedRoute() {
        NinjaPropertiesImpl ninjaProperties = new NinjaPropertiesImpl(
                NinjaMode.test);
        RouterImpl router = new RouterImpl(injector, ninjaProperties);
        Routes routes = new Routes(ninjaProperties);
        routes.init(router);
        router.compileRoutes();
View Full Code Here

TOP

Related Classes of ninja.utils.NinjaPropertiesImpl

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.