当前位置: 首页>>代码示例>>Java>>正文


Java BQModuleProvider类代码示例

本文整理汇总了Java中io.bootique.BQModuleProvider的典型用法代码示例。如果您正苦于以下问题:Java BQModuleProvider类的具体用法?Java BQModuleProvider怎么用?Java BQModuleProvider使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


BQModuleProvider类属于io.bootique包,在下文中一共展示了BQModuleProvider类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: testMetadata

import io.bootique.BQModuleProvider; //导入依赖的package包/类
protected void testMetadata() {

        testWithFactory(testFactory -> {
            // must auto-load modules to ensure all tested module dependencies are present...
            BQRuntime runtime = testFactory.app().autoLoadModules().createRuntime();

            BQModuleProvider provider = matchingProvider();
            String providerName = provider.name();

            // loading metadata ensures that all annotations are properly applied...
            Optional<ModuleMetadata> moduleMetadata = runtime
                    .getInstance(ModulesMetadata.class)
                    .getModules()
                    .stream()
                    .filter(mmd -> providerName.equals(mmd.getProviderName()))
                    .findFirst();

            assertTrue("No module metadata available for provider: '" + providerName + "'", moduleMetadata.isPresent());
            moduleMetadata.get().getConfigs();
        });
    }
 
开发者ID:bootique,项目名称:bootique,代码行数:22,代码来源:BQModuleProviderChecker.java

示例2: build

import io.bootique.BQModuleProvider; //导入依赖的package包/类
public BQModuleProvider build() {

            return new BQModuleProvider() {

                @Override
                public Module module() {
                    return commands;
                }

                @Override
                public Collection<Class<? extends Module>> overrides() {
                    return Collections.singleton(BQCoreModule.class);
                }

                @Override
                public String name() {
                    return "Commands.Builder";
                }
            };
        }
 
开发者ID:bootique,项目名称:bootique,代码行数:21,代码来源:Commands.java

示例3: testCustomNamedModule

import io.bootique.BQModuleProvider; //导入依赖的package包/类
@Test
public void testCustomNamedModule() {
    BQRuntime runtime = runtimeFactory.app().module(new BQModuleProvider() {
        @Override
        public Module module() {
            return b -> {
            };
        }

        @Override
        public BQModule.Builder moduleBuilder() {
            return BQModuleProvider.super
                    .moduleBuilder()
                    .name("mymodule");
        }
    }).createRuntime();

    ModulesMetadata md = runtime.getInstance(ModulesMetadata.class);
    assertEquals("Expected BQCoreModule + 2 test modules + custom module", 4, md.getModules().size());

    Optional<ModuleMetadata> myMd = md.getModules()
            .stream()
            .filter(m -> "mymodule".equals(m.getName()))
            .findFirst();
    assertTrue(myMd.isPresent());
}
 
开发者ID:bootique,项目名称:bootique,代码行数:27,代码来源:ModuleMetadataIT.java

示例4: createPropertiesProvider

import io.bootique.BQModuleProvider; //导入依赖的package包/类
protected BQModuleProvider createPropertiesProvider() {
    return new BQModuleProvider() {

        @Override
        public Module module() {
            return binder -> BQCoreModule.extend(binder).setProperties(properties);
        }

        @Override
        public BQModule.Builder moduleBuilder() {
            return BQModuleProvider.super
                    .moduleBuilder()
                    .name("BQInternalTestFactory:Builder:properties");
        }

        @Override
        public String name() {
            return "BQInternalTestFactory:Builder:properties:provider";
        }
    };
}
 
开发者ID:bootique,项目名称:bootique,代码行数:22,代码来源:BQInternalTestFactory.java

示例5: createVariablesProvider

import io.bootique.BQModuleProvider; //导入依赖的package包/类
protected BQModuleProvider createVariablesProvider() {
    return new BQModuleProvider() {

        @Override
        public Module module() {
            return binder -> {
                BQCoreModule.extend(binder).setVars(variables).declareVars(declaredVars);
            };
        }

        @Override
        public BQModule.Builder moduleBuilder() {
            return BQModuleProvider.super
                    .moduleBuilder()
                    .name("BQInternalTestFactory:Builder:variables");
        }

        @Override
        public String name() {
            return "BQInternalTestFactory:Builder:variables:provider";
        }
    };
}
 
开发者ID:bootique,项目名称:bootique,代码行数:24,代码来源:BQInternalTestFactory.java

示例6: testAlsoRun_DecorateWithPrivate

import io.bootique.BQModuleProvider; //导入依赖的package包/类
@Test
public void testAlsoRun_DecorateWithPrivate() {

    // use private "-s" command in decorator
    BQModuleProvider commandsOverride = Commands.builder().add(MainCommand.class).noModuleCommands().build();
    CommandDecorator decorator = CommandDecorator.alsoRun("s");

    BQRuntime runtime = createRuntime(commandsOverride, decorator);
    CommandOutcome outcome = runtime.run();

    waitForAllToFinish();

    assertTrue(outcome.isSuccess());
    assertTrue(getCommand(runtime, MainCommand.class).isExecuted());
    assertTrue(getCommand(runtime, SuccessfulCommand.class).isExecuted());
}
 
开发者ID:bootique,项目名称:bootique,代码行数:17,代码来源:CommandDecorator_CommandsIT.java

示例7: testModuleCommands

import io.bootique.BQModuleProvider; //导入依赖的package包/类
@Test
public void testModuleCommands() {
    BQModuleProvider provider = Commands.builder().build();
    BQRuntime runtime = testFactory.app(args).module(provider).createRuntime();
    CommandManager commandManager = runtime.getInstance(CommandManager.class);

    Map<String, ManagedCommand> commands = commandManager.getAllCommands();
    assertCommandKeys(commands, "help", "help-config");

    assertFalse(commands.get("help").isHidden());
    assertFalse(commands.get("help").isDefault());
    assertTrue(commands.get("help").isHelp());

    assertFalse(commands.get("help-config").isHidden());
    assertFalse(commands.get("help-config").isDefault());
}
 
开发者ID:bootique,项目名称:bootique,代码行数:17,代码来源:CommandsIT.java

示例8: testNoModuleCommands

import io.bootique.BQModuleProvider; //导入依赖的package包/类
@Test
public void testNoModuleCommands() {
    BQModuleProvider provider = Commands.builder().noModuleCommands().build();
    BQRuntime runtime = testFactory.app(args).module(provider).createRuntime();
    CommandManager commandManager = runtime.getInstance(CommandManager.class);

    Map<String, ManagedCommand> commands = commandManager.getAllCommands();
    assertCommandKeys(commands, "help", "help-config");

    assertTrue(commands.get("help").isHidden());
    assertFalse(commands.get("help").isDefault());
    assertTrue(commands.get("help").isHelp());

    assertTrue(commands.get("help-config").isHidden());
    assertFalse(commands.get("help-config").isDefault());
}
 
开发者ID:bootique,项目名称:bootique,代码行数:17,代码来源:CommandsIT.java

示例9: testModule_ExtraCommandAsType

import io.bootique.BQModuleProvider; //导入依赖的package包/类
@Test
public void testModule_ExtraCommandAsType() {
    BQModuleProvider provider = Commands.builder(C1.class).build();
    BQRuntime runtime = testFactory.app(args).module(provider).createRuntime();
    CommandManager commandManager = runtime.getInstance(CommandManager.class);

    Map<String, ManagedCommand> commands = commandManager.getAllCommands();
    assertCommandKeys(commands, "c1", "help", "help-config");

    assertFalse(commands.get("help").isHidden());
    assertFalse(commands.get("help").isDefault());
    assertTrue(commands.get("help").isHelp());

    assertFalse(commands.get("help-config").isHidden());
    assertFalse(commands.get("help-config").isDefault());

    assertTrue(commands.containsKey("c1"));
    assertFalse(commands.get("c1").isDefault());
}
 
开发者ID:bootique,项目名称:bootique,代码行数:20,代码来源:CommandsIT.java

示例10: moduleBuilder

import io.bootique.BQModuleProvider; //导入依赖的package包/类
@Override
public BQModule.Builder moduleBuilder() {
    return BQModuleProvider.super
            .moduleBuilder()
            .description("Provides configuration for JCache subsystem. Module itself does NOT include a JCache provider."
                    + " The users will need to add a provider of their choice to the application classpath.");
}
 
开发者ID:bootique,项目名称:bootique-jcache,代码行数:8,代码来源:JCacheModuleProvider.java

示例11: createPropertiesProvider

import io.bootique.BQModuleProvider; //导入依赖的package包/类
protected BQModuleProvider createPropertiesProvider() {
    return new BQModuleProvider() {

        @Override
        public Module module() {
            return binder -> BQCoreModule.extend(binder).setProperties(properties);
        }

        @Override
        public String name() {
            return "BQTestRuntimeBuilder:properties";
        }
    };
}
 
开发者ID:bootique,项目名称:bootique,代码行数:15,代码来源:BQTestRuntimeBuilder.java

示例12: testMatchingProvider

import io.bootique.BQModuleProvider; //导入依赖的package包/类
@Test
public void testMatchingProvider() {
    BQModuleProvider p = new BQModuleProviderChecker(P1.class).matchingProvider();

    Assert.assertNotNull(p);
    Assert.assertTrue(p instanceof P1);
}
 
开发者ID:bootique,项目名称:bootique,代码行数:8,代码来源:BQModuleProviderCheckerTest.java

示例13: testBeforeRun_DecorateWithPrivate

import io.bootique.BQModuleProvider; //导入依赖的package包/类
@Test
public void testBeforeRun_DecorateWithPrivate() {

    // use private "-s" command in decorator
    BQModuleProvider commandsOverride = Commands.builder().add(MainCommand.class).noModuleCommands().build();
    CommandDecorator decorator = CommandDecorator.beforeRun("s");

    BQRuntime runtime = createRuntime(commandsOverride, decorator);
    CommandOutcome outcome = runtime.run();

    assertTrue(outcome.isSuccess());
    assertTrue(getCommand(runtime, MainCommand.class).isExecuted());
    assertTrue(getCommand(runtime, SuccessfulCommand.class).isExecuted());
}
 
开发者ID:bootique,项目名称:bootique,代码行数:15,代码来源:CommandDecorator_CommandsIT.java

示例14: createRuntime

import io.bootique.BQModuleProvider; //导入依赖的package包/类
private BQRuntime createRuntime(BQModuleProvider commandsOverride, CommandDecorator decorator) {
    return testFactory
            .app("--a")
            .module(b -> BQCoreModule.extend(b)
                    .addCommand(MainCommand.class)
                    .addCommand(SuccessfulCommand.class)
                    .decorateCommand(MainCommand.class, decorator))
            .module(commandsOverride)
            .createRuntime();
}
 
开发者ID:bootique,项目名称:bootique,代码行数:11,代码来源:CommandDecorator_CommandsIT.java

示例15: testModule_ExtraCommandAsInstance

import io.bootique.BQModuleProvider; //导入依赖的package包/类
@Test
public void testModule_ExtraCommandAsInstance() {
    BQModuleProvider provider = Commands.builder().add(new C1()).build();
    BQRuntime runtime = testFactory.app(args).module(provider).createRuntime();
    CommandManager commandManager = runtime.getInstance(CommandManager.class);

    Map<String, ManagedCommand> commands = commandManager.getAllCommands();
    assertCommandKeys(commands, "c1", "help", "help-config");
}
 
开发者ID:bootique,项目名称:bootique,代码行数:10,代码来源:CommandsIT.java


注:本文中的io.bootique.BQModuleProvider类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。