Search in sources :

Example 1 with Props

use of jodd.props.Props in project jodd by oblac.

the class DefaultAppCore method createProps.

/**
	 * Creates new Props. Empty props will be ignored,
	 * and missing macros will be resolved as empty string.
	 */
protected Props createProps() {
    Props props = new Props();
    props.setSkipEmptyProps(true);
    props.setIgnoreMissingMacros(true);
    return props;
}
Also used : Props(jodd.props.Props)

Example 2 with Props

use of jodd.props.Props in project jodd by oblac.

the class Madvoc method start.

private void start(ServletContext servletContext) {
    if (servletContext != null) {
        this.servletContext = servletContext;
        servletContext.setAttribute(MADVOC_ATTR, this);
    }
    // create and initialize web application
    webapp = createWebApplication();
    webapp.initWebApplication();
    // init logger
    log = LoggerFactory.getLogger(Madvoc.class);
    log.info("Madvoc starting...");
    if (webapp.getClass().equals(WebApplication.class)) {
        log.info("Default Madvoc web application created.");
    } else {
        log.info("Madvoc web application: " + webAppClass.getName());
    }
    // params
    if (paramsFiles != null) {
        Props params = loadMadvocParams(paramsFiles);
        webapp.defineParams(params);
    }
    // configure
    webapp.registerMadvocComponents();
    madvocConfig = webapp.getComponent(MadvocConfig.class);
    if (madvocConfig == null) {
        throw new MadvocException("Madvoc configuration not found");
    }
    webapp.init(madvocConfig, servletContext);
    // filters
    FiltersManager filtersManager = webapp.getComponent(FiltersManager.class);
    if (filtersManager == null) {
        throw new MadvocException("Madvoc filers manager not found");
    }
    webapp.initFilters(filtersManager);
    // interceptors
    InterceptorsManager interceptorsManager = webapp.getComponent(InterceptorsManager.class);
    if (interceptorsManager == null) {
        throw new MadvocException("Madvoc interceptors manager not found");
    }
    webapp.initInterceptors(interceptorsManager);
    // actions
    ActionsManager actionsManager = webapp.getComponent(ActionsManager.class);
    if (actionsManager == null) {
        throw new MadvocException("Madvoc actions manager not found");
    }
    webapp.initActions(actionsManager);
    // results
    ResultsManager resultsManager = webapp.getComponent(ResultsManager.class);
    if (resultsManager == null) {
        throw new MadvocException("Madvoc results manager not found");
    }
    webapp.initResults(resultsManager);
    // configure with external configurator
    MadvocConfigurator configurator = loadMadvocConfig();
    webapp.configure(configurator);
    // prepare web application
    madvocController = webapp.getComponent(MadvocController.class);
    if (madvocController == null) {
        throw new MadvocException("Madvoc controller not found");
    }
    madvocController.init(servletContext);
    // web app is ready
    webapp.ready();
}
Also used : ActionsManager(jodd.madvoc.component.ActionsManager) ResultsManager(jodd.madvoc.component.ResultsManager) FiltersManager(jodd.madvoc.component.FiltersManager) MadvocController(jodd.madvoc.component.MadvocController) InterceptorsManager(jodd.madvoc.component.InterceptorsManager) MadvocConfigurator(jodd.madvoc.config.MadvocConfigurator) AutomagicMadvocConfigurator(jodd.madvoc.config.AutomagicMadvocConfigurator) Props(jodd.props.Props) MadvocConfig(jodd.madvoc.component.MadvocConfig)

Example 3 with Props

use of jodd.props.Props in project jmeter by apache.

the class ApdexPerTransactionTest method testgetApdexPerTransactionProperty.

@Test
public void testgetApdexPerTransactionProperty() throws Exception {
    final Props props = new Props();
    final String REPORT_GENERATOR_KEY_PREFIX = "jmeter.reportgenerator";
    final char KEY_DELIMITER = '.';
    final String REPORT_GENERATOR_KEY_APDEX_PER_TRANSACTION = REPORT_GENERATOR_KEY_PREFIX + KEY_DELIMITER + "apdex_per_transaction";
    props.load(this.getClass().getResourceAsStream("reportgenerator_test.properties"));
    final String apdexPerTransaction = getOptionalProperty(props, REPORT_GENERATOR_KEY_APDEX_PER_TRANSACTION);
    assertEquals(apdexString, apdexPerTransaction);
}
Also used : Props(jodd.props.Props) Test(org.junit.Test)

Example 4 with Props

use of jodd.props.Props in project jodd by oblac.

the class WebApp method start.

/**
 * Initializes and starts web application.
 */
public WebApp start() {
    log = LoggerFactory.getLogger(WebApp.class);
    log.debug("Initializing Madvoc WebApp");
    // // params & props
    for (final Map<String, Object> params : paramsList) {
        madvocContainer.defineParams(params);
    }
    for (final Props props : propsList) {
        madvocContainer.defineParams(props);
    }
    propsList = null;
    // // components
    registerMadvocComponents();
    madvocComponents.forEach(madvocComponent -> madvocContainer.registerComponent(madvocComponent.type(), madvocComponent.consumer()));
    madvocComponents = null;
    madvocComponentInstances.forEach(madvocContainer::registerComponentInstance);
    madvocComponentInstances = null;
    configureDefaults();
    // // listeners
    madvocContainer.fireEvent(Init.class);
    // // component configuration
    componentConfigs.accept(madvocContainer);
    componentConfigs = null;
    initialized();
    madvocContainer.fireEvent(Start.class);
    if (!madvocRouterConsumers.isEmpty()) {
        final MadvocRouter madvocRouter = MadvocRouter.create();
        madvocContainer.registerComponentInstance(madvocRouter);
        madvocRouterConsumers.accept(madvocRouter);
    }
    madvocRouterConsumers = null;
    started();
    madvocContainer.fireEvent(Ready.class);
    ready();
    return this;
}
Also used : Props(jodd.props.Props)

Example 5 with Props

use of jodd.props.Props in project jodd by oblac.

the class JoyMadvoc method start.

// ---------------------------------------------------------------- lifecycle
@Override
public void start() {
    initLogger();
    log.info("MADVOC start  ----------");
    webApp = webAppSupplier == null ? new PetiteWebApp(joyPetiteSupplier.get().getPetiteContainer()) : webAppSupplier.get();
    webApp.withRegisteredComponent(ActionConfigManager.class, acm -> {
        acm.bindAnnotationConfig(Action.class, JoyActionConfig.class);
        acm.bindAnnotationConfig(RestAction.class, JoyRestActionConfig.class);
    });
    if (servletContext != null) {
        webApp.bindServletContext(servletContext);
    }
    final Props allProps = joyPropsSupplier.get().getProps();
    webApp.withParams(allProps.innerMap(beanNamePrefix()));
    webApp.registerComponent(new ProxettaSupplier(joyProxettaSupplier.get().getProxetta()));
    webApp.registerComponent(ProxettaAwareActionsManager.class);
    // Automagic Madvoc configurator will scan and register ALL!
    // This way we reduce the startup time and have only one scanning.
    // Scanning happens in the INIT phase.
    final AutomagicMadvocConfigurator automagicMadvocConfigurator = new AutomagicMadvocConfigurator(joyScannerSupplier.get().getClassScanner()) {

        @Override
        protected String createInfoMessage() {
            return "Scanning completed in " + elapsed + "ms.";
        }
    };
    webApp.registerComponent(automagicMadvocConfigurator);
    webAppConsumers.accept(webApp);
    webApp.start();
    log.info("MADVOC OK!");
}
Also used : ProxettaSupplier(jodd.madvoc.proxetta.ProxettaSupplier) AutomagicMadvocConfigurator(jodd.madvoc.AutomagicMadvocConfigurator) Props(jodd.props.Props) PetiteWebApp(jodd.madvoc.petite.PetiteWebApp)

Aggregations

Props (jodd.props.Props)11 Test (org.junit.Test)3 File (java.io.File)1 ParseException (java.text.ParseException)1 SimpleDateFormat (java.text.SimpleDateFormat)1 Date (java.util.Date)1 UncheckedException (jodd.exception.UncheckedException)1 AutomagicMadvocConfigurator (jodd.madvoc.AutomagicMadvocConfigurator)1 ActionsManager (jodd.madvoc.component.ActionsManager)1 FiltersManager (jodd.madvoc.component.FiltersManager)1 InterceptorsManager (jodd.madvoc.component.InterceptorsManager)1 MadvocConfig (jodd.madvoc.component.MadvocConfig)1 MadvocController (jodd.madvoc.component.MadvocController)1 ResultsManager (jodd.madvoc.component.ResultsManager)1 AutomagicMadvocConfigurator (jodd.madvoc.config.AutomagicMadvocConfigurator)1 MadvocConfigurator (jodd.madvoc.config.MadvocConfigurator)1 PetiteWebApp (jodd.madvoc.petite.PetiteWebApp)1 ProxettaSupplier (jodd.madvoc.proxetta.ProxettaSupplier)1 PojoBean2 (jodd.petite.data.PojoBean2)1