Package org.apache.torque.generator.option

Examples of org.apache.torque.generator.option.Options


     */
    private void mergeInheritedOptionConfiguration(
            UnitConfiguration unitConfiguration,
            UnitConfiguration inheritedConfiguration)
    {
        Options options = unitConfiguration.getOptions();
        Options inheritedOptions = inheritedConfiguration.getOptions();
        for (Map.Entry<QualifiedName, Option> entry
            : inheritedOptions.getGlobalScope().entrySet())
        {
            QualifiedName optionName = entry.getKey();
            Option option = entry.getValue();
            if (!options.getGlobalScope().containsKey(optionName))
            {
View Full Code Here


            if (unitDescriptor.getOverrideOptions() != null)
            {
                optionConfigurations.add(unitDescriptor.getOverrideOptions());
            }

            Options options = new Options();
            for (OptionsConfiguration optionConfiguration
                    : optionConfigurations)
            {
                options.addGlobalOptions(
                        optionConfiguration.getOptions(
                                configurationProvider));
            }
            unitConfiguration.setOptions(options);
            {
View Full Code Here

                new StringUtils());

        if (optionsInContext)
        {
            // Only consider options visible from the current namespace.
            Options visibleOptions
                    = controllerState.getVisibleOptions();
            for (Option option : visibleOptions.values())
            {
                QualifiedName qualifiedName = option.getQualifiedName();
                context.put(qualifiedName.getName(), option.getValue());
            }
            log.debug("Put options in context " + visibleOptions.keySet());
        }
        else
        {
            log.debug("options in context are disabled");
        }
View Full Code Here

     * @return The value of the option, or null if no option with that name
     *         is visible from the given namespace.
     */
    public Object getOption(String name)
    {
        Options options = unitConfiguration.getOptions();
        QualifiedName qualifiedName = getQualifiedName(name);
        Option option = options.getInHierarchy(qualifiedName);
        Object result = null;
        if (option != null)
        {
            result = option.getValue();
        }
View Full Code Here

    private TokenReplacer tokenReplacer;

    @Before
    public void setUp()
    {
        Options options = new Options();
        {
            Option optionWithoutNamespace = new OptionImpl(
                    "optionWithoutNamespace",
                    "ValueWithoutNamespace");
            options.setGlobalOption(optionWithoutNamespace);
        }
        {
            Option optionWithNamespace = new OptionImpl(
                    "org.apache.torque.generator.optionWithNamespace",
                    "ValueWithNamespace");
            options.setGlobalOption(optionWithNamespace);
        }
        {
            Option optionWithSpecialChars = new OptionImpl(
                    "opt${}i\\on",
                    "ValueWith${}Special\\Chars");
            options.setGlobalOption(optionWithSpecialChars);
        }

        UnitConfiguration unitConfiguration = new UnitConfiguration();
        unitConfiguration.setOptions(options);
        ControllerState controllerState = new ControllerState();
View Full Code Here

    public void setUp()
    {
        controllerState = new ControllerState();
        UnitConfiguration unitConfiguration = new UnitConfiguration();
        controllerState.setUnitConfiguration(unitConfiguration);
        Options options = new Options();
        unitConfiguration.setOptions(options);
    }
View Full Code Here

        }

        assertEquals(Loglevel.DEBUG, unitConfiguration.getLoglevel());

        {
            Options expectedOptions = new Options();
            Set<Option> expectedOptionSet = new HashSet<Option>();
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("org.apache.torque.generator.optionWithNamespace"),
                    "optionWithNamespaceValue"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("org.apache.optionWithNamespace"),
                    "org.apache.optionWithNamespaceValue"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("optionWithoutNamespace", ""),
                    "optionWithoutNamespaceValue"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("optionPrecedenceLastFile"),
                    "value from xml"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("jdbcUrl"),
                    "jdbc.url.option.value"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("jdbcDriver"),
                    "jdbc.driver.option.value"));
            expectedOptions.addGlobalOptions(expectedOptionSet);
            assertOptionsEquals(
                    expectedOptions,
                    unitConfiguration.getOptions());
        }
View Full Code Here

                        unitDescriptor,
                        configurationHandlers);

        // check that we have read the correct configuration
        {
            Options options = unitConfiguration.getOptions();
            Option option  = options.getInHierarchy(
                    new QualifiedName("configuration"));
            assertNotNull("option configuration should be set", option);
            assertEquals("fromClasspath", option.getValue());
        }
View Full Code Here

                = new UnitConfigurationReader();
        UnitConfiguration unitConfiguration
                = configurationReader.read(
                        unitDescriptor,
                        configurationHandlers);
        Options options = unitConfiguration.getOptions();
        {
            Option option = options.getInHierarchy(
                    new QualifiedName("optionWithoutNamespace"));
            assertEquals("overriddenValue", option.getValue());
        }
        {
            Option option = options.getInHierarchy(
                    new QualifiedName("newOption"));
            assertEquals("newValue", option.getValue());
        }
    }
View Full Code Here

            File expected = new File("src/test/configuration/src/main/custom");
            assertEquals(expected, modifiableFileTargetDirectory);
        }

        {
            Options expectedOptions = new Options();
            Set<Option> expectedOptionSet = new HashSet<Option>();
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("org.apache.torque.generator.optionWithNamespace"),
                    "optionWithNamespaceValue"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("org.apache.optionWithNamespace"),
                    "org.apache.optionWithNamespaceValue"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("optionWithoutNamespace", ""),
                    "optionWithoutNamespaceValue"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("optionPrecedenceLastFile"),
                    "value from xml"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("jdbcUrl"),
                    "jdbc.url.option.value"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("jdbcDriver"),
                    "jdbc.driver.option.value"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("parentOptionWithoutNamespace", ""),
                    "parentOptionWithoutNamespaceParentValue"));
            expectedOptionSet.add(new OptionImpl(
                    new QualifiedName("org.apache.torque.generator.parentOptionWithNamespace"),
                    "parentOptionWithNamespaceParentValue"));
            expectedOptions.addGlobalOptions(expectedOptionSet);
            assertOptionsEquals(
                    expectedOptions,
                    unitConfiguration.getOptions());
        }
View Full Code Here

TOP

Related Classes of org.apache.torque.generator.option.Options

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.